<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[43004] trunk/src/wp-includes: TinyMCE: Update to 4.7.11</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/43004">43004</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/43004","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>iseulde</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-04-25 22:34:41 +0000 (Wed, 25 Apr 2018)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>TinyMCE: Update to 4.7.11</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludescsseditorcss">trunk/src/wp-includes/css/editor.css</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginscharmappluginjs">trunk/src/wp-includes/js/tinymce/plugins/charmap/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginscharmappluginminjs">trunk/src/wp-includes/js/tinymce/plugins/charmap/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginscolorpickerpluginjs">trunk/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginscolorpickerpluginminjs">trunk/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginscompat3xpluginjs">trunk/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginscompat3xpluginminjs">trunk/src/wp-includes/js/tinymce/plugins/compat3x/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginsdirectionalitypluginjs">trunk/src/wp-includes/js/tinymce/plugins/directionality/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginsdirectionalitypluginminjs">trunk/src/wp-includes/js/tinymce/plugins/directionality/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginsfullscreenpluginjs">trunk/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginsfullscreenpluginminjs">trunk/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginshrpluginjs">trunk/src/wp-includes/js/tinymce/plugins/hr/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginshrpluginminjs">trunk/src/wp-includes/js/tinymce/plugins/hr/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginsimagepluginjs">trunk/src/wp-includes/js/tinymce/plugins/image/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginsimagepluginminjs">trunk/src/wp-includes/js/tinymce/plugins/image/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginslinkpluginjs">trunk/src/wp-includes/js/tinymce/plugins/link/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginslinkpluginminjs">trunk/src/wp-includes/js/tinymce/plugins/link/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginslistspluginjs">trunk/src/wp-includes/js/tinymce/plugins/lists/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginslistspluginminjs">trunk/src/wp-includes/js/tinymce/plugins/lists/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginsmediapluginjs">trunk/src/wp-includes/js/tinymce/plugins/media/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginsmediapluginminjs">trunk/src/wp-includes/js/tinymce/plugins/media/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginspastepluginjs">trunk/src/wp-includes/js/tinymce/plugins/paste/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginspastepluginminjs">trunk/src/wp-includes/js/tinymce/plugins/paste/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginstabfocuspluginjs">trunk/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginstabfocuspluginminjs">trunk/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginstextcolorpluginjs">trunk/src/wp-includes/js/tinymce/plugins/textcolor/plugin.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcepluginstextcolorpluginminjs">trunk/src/wp-includes/js/tinymce/plugins/textcolor/plugin.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinslightgraycontentinlinemincss">trunk/src/wp-includes/js/tinymce/skins/lightgray/content.inline.min.css</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinslightgraycontentmincss">trunk/src/wp-includes/js/tinymce/skins/lightgray/content.min.css</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinslightgrayfontstinymceeot">trunk/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.eot</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinslightgrayfontstinymcesvg">trunk/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.svg</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinslightgrayfontstinymcettf">trunk/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.ttf</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinslightgrayfontstinymcewoff">trunk/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.woff</a></li>
<li><a href="#trunksrcwpincludesjstinymceskinslightgrayskinmincss">trunk/src/wp-includes/js/tinymce/skins/lightgray/skin.min.css</a></li>
<li><a href="#trunksrcwpincludesjstinymcethemesinlitethemejs">trunk/src/wp-includes/js/tinymce/themes/inlite/theme.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcethemesinlitethememinjs">trunk/src/wp-includes/js/tinymce/themes/inlite/theme.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcethemesmodernthemejs">trunk/src/wp-includes/js/tinymce/themes/modern/theme.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcethemesmodernthememinjs">trunk/src/wp-includes/js/tinymce/themes/modern/theme.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcetinymcejs">trunk/src/wp-includes/js/tinymce/tinymce.js</a></li>
<li><a href="#trunksrcwpincludesjstinymcetinymceminjs">trunk/src/wp-includes/js/tinymce/tinymce.min.js</a></li>
<li><a href="#trunksrcwpincludesjstinymceutilsvalidatejs">trunk/src/wp-includes/js/tinymce/utils/validate.js</a></li>
<li><a href="#trunksrcwpincludesversionphp">trunk/src/wp-includes/version.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludescsseditorcss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/css/editor.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/css/editor.css 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/css/editor.css 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,6 +4,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /* TinyMCE widgets/containers */
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.mce-tinymce {
+ box-shadow: none;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .mce-container,
</span><span class="cx" style="display: block; padding: 0 10px"> .mce-container *,
</span><span class="cx" style="display: block; padding: 0 10px"> .mce-widget,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,6 +29,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> opacity: 0.7;
</span><span class="cx" style="display: block; padding: 0 10px"> filter: alpha(opacity=70);
</span><span class="cx" style="display: block; padding: 0 10px"> transition: none;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ background: #000;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> .mce-window {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -216,6 +221,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> .mce-menu-item {
</span><span class="cx" style="display: block; padding: 0 10px"> border: none;
</span><span class="cx" style="display: block; padding: 0 10px"> margin-bottom: 2px;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ padding: 6px 15px 6px 12px;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> .mce-menu-has-icons i.mce-ico {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -410,6 +416,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> box-shadow: inset 0 2px 5px -3px rgba( 0, 0, 0, 0.3 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.mce-btn.mce-active,
+.mce-btn.mce-active button,
+.mce-btn.mce-active:hover button,
+.mce-btn.mce-active i,
+.mce-btn.mce-active:hover i {
+ color: inherit;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> .mce-toolbar .mce-btn-group .mce-btn.mce-active:hover,
</span><span class="cx" style="display: block; padding: 0 10px"> .mce-toolbar .mce-btn-group .mce-btn.mce-active:focus {
</span><span class="cx" style="display: block; padding: 0 10px"> border-color: #23282d;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -562,14 +576,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> color: #fff;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.mce-menu .mce-menu-item-preview.mce-active {
- border-left: none;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.mce-menu-item:hover .mce-text,
+.mce-menu-item:focus .mce-text,
+.mce-menu-item:hover .mce-ico,
+.mce-menu-item:focus .mce-ico,
+.mce-menu-item:hover .mce-menu-shortcut,
+.mce-menu-item:focus .mce-menu-shortcut,
+.mce-menu-item.mce-active .mce-menu-shortcut,
+.mce-menu-item.mce-disabled:hover .mce-text,
+.mce-menu-item.mce-disabled:hover .mce-ico {
+ color: inherit;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.mce-menu .mce-menu-item-preview.mce-active .mce-text {
- color: #fff;
-}
-
</del><span class="cx" style="display: block; padding: 0 10px"> .mce-menu .mce-menu-item.mce-disabled {
</span><span class="cx" style="display: block; padding: 0 10px"> cursor: default;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginscharmappluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/charmap/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/charmap/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/charmap/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,617 +1,1275 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var charmap = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fireInsertCustomChar = function (editor, chr) {
+ return editor.fire('insertCustomChar', { chr: chr });
+ };
+ var $_j6jbo95jfuw8onk = { fireInsertCustomChar: fireInsertCustomChar };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
-
-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var insertChar = function (editor, chr) {
+ var evtChr = $_j6jbo95jfuw8onk.fireInsertCustomChar(editor, chr).chr;
+ editor.execCommand('mceInsertContent', false, evtChr);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_apbezv94jfuw8onj = { insertChar: insertChar };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getCharMap = function (editor) {
+ return editor.settings.charmap;
+ };
+ var getCharMapAppend = function (editor) {
+ return editor.settings.charmap_append;
+ };
+ var $_ae555o98jfuw8onx = {
+ getCharMap: getCharMap,
+ getCharMapAppend: getCharMapAppend
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isArray = global$1.isArray;
+ var getDefaultCharMap = function () {
+ return [
+ [
+ '160',
+ 'no-break space'
+ ],
+ [
+ '173',
+ 'soft hyphen'
+ ],
+ [
+ '34',
+ 'quotation mark'
+ ],
+ [
+ '162',
+ 'cent sign'
+ ],
+ [
+ '8364',
+ 'euro sign'
+ ],
+ [
+ '163',
+ 'pound sign'
+ ],
+ [
+ '165',
+ 'yen sign'
+ ],
+ [
+ '169',
+ 'copyright sign'
+ ],
+ [
+ '174',
+ 'registered sign'
+ ],
+ [
+ '8482',
+ 'trade mark sign'
+ ],
+ [
+ '8240',
+ 'per mille sign'
+ ],
+ [
+ '181',
+ 'micro sign'
+ ],
+ [
+ '183',
+ 'middle dot'
+ ],
+ [
+ '8226',
+ 'bullet'
+ ],
+ [
+ '8230',
+ 'three dot leader'
+ ],
+ [
+ '8242',
+ 'minutes / feet'
+ ],
+ [
+ '8243',
+ 'seconds / inches'
+ ],
+ [
+ '167',
+ 'section sign'
+ ],
+ [
+ '182',
+ 'paragraph sign'
+ ],
+ [
+ '223',
+ 'sharp s / ess-zed'
+ ],
+ [
+ '8249',
+ 'single left-pointing angle quotation mark'
+ ],
+ [
+ '8250',
+ 'single right-pointing angle quotation mark'
+ ],
+ [
+ '171',
+ 'left pointing guillemet'
+ ],
+ [
+ '187',
+ 'right pointing guillemet'
+ ],
+ [
+ '8216',
+ 'left single quotation mark'
+ ],
+ [
+ '8217',
+ 'right single quotation mark'
+ ],
+ [
+ '8220',
+ 'left double quotation mark'
+ ],
+ [
+ '8221',
+ 'right double quotation mark'
+ ],
+ [
+ '8218',
+ 'single low-9 quotation mark'
+ ],
+ [
+ '8222',
+ 'double low-9 quotation mark'
+ ],
+ [
+ '60',
+ 'less-than sign'
+ ],
+ [
+ '62',
+ 'greater-than sign'
+ ],
+ [
+ '8804',
+ 'less-than or equal to'
+ ],
+ [
+ '8805',
+ 'greater-than or equal to'
+ ],
+ [
+ '8211',
+ 'en dash'
+ ],
+ [
+ '8212',
+ 'em dash'
+ ],
+ [
+ '175',
+ 'macron'
+ ],
+ [
+ '8254',
+ 'overline'
+ ],
+ [
+ '164',
+ 'currency sign'
+ ],
+ [
+ '166',
+ 'broken bar'
+ ],
+ [
+ '168',
+ 'diaeresis'
+ ],
+ [
+ '161',
+ 'inverted exclamation mark'
+ ],
+ [
+ '191',
+ 'turned question mark'
+ ],
+ [
+ '710',
+ 'circumflex accent'
+ ],
+ [
+ '732',
+ 'small tilde'
+ ],
+ [
+ '176',
+ 'degree sign'
+ ],
+ [
+ '8722',
+ 'minus sign'
+ ],
+ [
+ '177',
+ 'plus-minus sign'
+ ],
+ [
+ '247',
+ 'division sign'
+ ],
+ [
+ '8260',
+ 'fraction slash'
+ ],
+ [
+ '215',
+ 'multiplication sign'
+ ],
+ [
+ '185',
+ 'superscript one'
+ ],
+ [
+ '178',
+ 'superscript two'
+ ],
+ [
+ '179',
+ 'superscript three'
+ ],
+ [
+ '188',
+ 'fraction one quarter'
+ ],
+ [
+ '189',
+ 'fraction one half'
+ ],
+ [
+ '190',
+ 'fraction three quarters'
+ ],
+ [
+ '402',
+ 'function / florin'
+ ],
+ [
+ '8747',
+ 'integral'
+ ],
+ [
+ '8721',
+ 'n-ary sumation'
+ ],
+ [
+ '8734',
+ 'infinity'
+ ],
+ [
+ '8730',
+ 'square root'
+ ],
+ [
+ '8764',
+ 'similar to'
+ ],
+ [
+ '8773',
+ 'approximately equal to'
+ ],
+ [
+ '8776',
+ 'almost equal to'
+ ],
+ [
+ '8800',
+ 'not equal to'
+ ],
+ [
+ '8801',
+ 'identical to'
+ ],
+ [
+ '8712',
+ 'element of'
+ ],
+ [
+ '8713',
+ 'not an element of'
+ ],
+ [
+ '8715',
+ 'contains as member'
+ ],
+ [
+ '8719',
+ 'n-ary product'
+ ],
+ [
+ '8743',
+ 'logical and'
+ ],
+ [
+ '8744',
+ 'logical or'
+ ],
+ [
+ '172',
+ 'not sign'
+ ],
+ [
+ '8745',
+ 'intersection'
+ ],
+ [
+ '8746',
+ 'union'
+ ],
+ [
+ '8706',
+ 'partial differential'
+ ],
+ [
+ '8704',
+ 'for all'
+ ],
+ [
+ '8707',
+ 'there exists'
+ ],
+ [
+ '8709',
+ 'diameter'
+ ],
+ [
+ '8711',
+ 'backward difference'
+ ],
+ [
+ '8727',
+ 'asterisk operator'
+ ],
+ [
+ '8733',
+ 'proportional to'
+ ],
+ [
+ '8736',
+ 'angle'
+ ],
+ [
+ '180',
+ 'acute accent'
+ ],
+ [
+ '184',
+ 'cedilla'
+ ],
+ [
+ '170',
+ 'feminine ordinal indicator'
+ ],
+ [
+ '186',
+ 'masculine ordinal indicator'
+ ],
+ [
+ '8224',
+ 'dagger'
+ ],
+ [
+ '8225',
+ 'double dagger'
+ ],
+ [
+ '192',
+ 'A - grave'
+ ],
+ [
+ '193',
+ 'A - acute'
+ ],
+ [
+ '194',
+ 'A - circumflex'
+ ],
+ [
+ '195',
+ 'A - tilde'
+ ],
+ [
+ '196',
+ 'A - diaeresis'
+ ],
+ [
+ '197',
+ 'A - ring above'
+ ],
+ [
+ '256',
+ 'A - macron'
+ ],
+ [
+ '198',
+ 'ligature AE'
+ ],
+ [
+ '199',
+ 'C - cedilla'
+ ],
+ [
+ '200',
+ 'E - grave'
+ ],
+ [
+ '201',
+ 'E - acute'
+ ],
+ [
+ '202',
+ 'E - circumflex'
+ ],
+ [
+ '203',
+ 'E - diaeresis'
+ ],
+ [
+ '274',
+ 'E - macron'
+ ],
+ [
+ '204',
+ 'I - grave'
+ ],
+ [
+ '205',
+ 'I - acute'
+ ],
+ [
+ '206',
+ 'I - circumflex'
+ ],
+ [
+ '207',
+ 'I - diaeresis'
+ ],
+ [
+ '298',
+ 'I - macron'
+ ],
+ [
+ '208',
+ 'ETH'
+ ],
+ [
+ '209',
+ 'N - tilde'
+ ],
+ [
+ '210',
+ 'O - grave'
+ ],
+ [
+ '211',
+ 'O - acute'
+ ],
+ [
+ '212',
+ 'O - circumflex'
+ ],
+ [
+ '213',
+ 'O - tilde'
+ ],
+ [
+ '214',
+ 'O - diaeresis'
+ ],
+ [
+ '216',
+ 'O - slash'
+ ],
+ [
+ '332',
+ 'O - macron'
+ ],
+ [
+ '338',
+ 'ligature OE'
+ ],
+ [
+ '352',
+ 'S - caron'
+ ],
+ [
+ '217',
+ 'U - grave'
+ ],
+ [
+ '218',
+ 'U - acute'
+ ],
+ [
+ '219',
+ 'U - circumflex'
+ ],
+ [
+ '220',
+ 'U - diaeresis'
+ ],
+ [
+ '362',
+ 'U - macron'
+ ],
+ [
+ '221',
+ 'Y - acute'
+ ],
+ [
+ '376',
+ 'Y - diaeresis'
+ ],
+ [
+ '562',
+ 'Y - macron'
+ ],
+ [
+ '222',
+ 'THORN'
+ ],
+ [
+ '224',
+ 'a - grave'
+ ],
+ [
+ '225',
+ 'a - acute'
+ ],
+ [
+ '226',
+ 'a - circumflex'
+ ],
+ [
+ '227',
+ 'a - tilde'
+ ],
+ [
+ '228',
+ 'a - diaeresis'
+ ],
+ [
+ '229',
+ 'a - ring above'
+ ],
+ [
+ '257',
+ 'a - macron'
+ ],
+ [
+ '230',
+ 'ligature ae'
+ ],
+ [
+ '231',
+ 'c - cedilla'
+ ],
+ [
+ '232',
+ 'e - grave'
+ ],
+ [
+ '233',
+ 'e - acute'
+ ],
+ [
+ '234',
+ 'e - circumflex'
+ ],
+ [
+ '235',
+ 'e - diaeresis'
+ ],
+ [
+ '275',
+ 'e - macron'
+ ],
+ [
+ '236',
+ 'i - grave'
+ ],
+ [
+ '237',
+ 'i - acute'
+ ],
+ [
+ '238',
+ 'i - circumflex'
+ ],
+ [
+ '239',
+ 'i - diaeresis'
+ ],
+ [
+ '299',
+ 'i - macron'
+ ],
+ [
+ '240',
+ 'eth'
+ ],
+ [
+ '241',
+ 'n - tilde'
+ ],
+ [
+ '242',
+ 'o - grave'
+ ],
+ [
+ '243',
+ 'o - acute'
+ ],
+ [
+ '244',
+ 'o - circumflex'
+ ],
+ [
+ '245',
+ 'o - tilde'
+ ],
+ [
+ '246',
+ 'o - diaeresis'
+ ],
+ [
+ '248',
+ 'o slash'
+ ],
+ [
+ '333',
+ 'o macron'
+ ],
+ [
+ '339',
+ 'ligature oe'
+ ],
+ [
+ '353',
+ 's - caron'
+ ],
+ [
+ '249',
+ 'u - grave'
+ ],
+ [
+ '250',
+ 'u - acute'
+ ],
+ [
+ '251',
+ 'u - circumflex'
+ ],
+ [
+ '252',
+ 'u - diaeresis'
+ ],
+ [
+ '363',
+ 'u - macron'
+ ],
+ [
+ '253',
+ 'y - acute'
+ ],
+ [
+ '254',
+ 'thorn'
+ ],
+ [
+ '255',
+ 'y - diaeresis'
+ ],
+ [
+ '563',
+ 'y - macron'
+ ],
+ [
+ '913',
+ 'Alpha'
+ ],
+ [
+ '914',
+ 'Beta'
+ ],
+ [
+ '915',
+ 'Gamma'
+ ],
+ [
+ '916',
+ 'Delta'
+ ],
+ [
+ '917',
+ 'Epsilon'
+ ],
+ [
+ '918',
+ 'Zeta'
+ ],
+ [
+ '919',
+ 'Eta'
+ ],
+ [
+ '920',
+ 'Theta'
+ ],
+ [
+ '921',
+ 'Iota'
+ ],
+ [
+ '922',
+ 'Kappa'
+ ],
+ [
+ '923',
+ 'Lambda'
+ ],
+ [
+ '924',
+ 'Mu'
+ ],
+ [
+ '925',
+ 'Nu'
+ ],
+ [
+ '926',
+ 'Xi'
+ ],
+ [
+ '927',
+ 'Omicron'
+ ],
+ [
+ '928',
+ 'Pi'
+ ],
+ [
+ '929',
+ 'Rho'
+ ],
+ [
+ '931',
+ 'Sigma'
+ ],
+ [
+ '932',
+ 'Tau'
+ ],
+ [
+ '933',
+ 'Upsilon'
+ ],
+ [
+ '934',
+ 'Phi'
+ ],
+ [
+ '935',
+ 'Chi'
+ ],
+ [
+ '936',
+ 'Psi'
+ ],
+ [
+ '937',
+ 'Omega'
+ ],
+ [
+ '945',
+ 'alpha'
+ ],
+ [
+ '946',
+ 'beta'
+ ],
+ [
+ '947',
+ 'gamma'
+ ],
+ [
+ '948',
+ 'delta'
+ ],
+ [
+ '949',
+ 'epsilon'
+ ],
+ [
+ '950',
+ 'zeta'
+ ],
+ [
+ '951',
+ 'eta'
+ ],
+ [
+ '952',
+ 'theta'
+ ],
+ [
+ '953',
+ 'iota'
+ ],
+ [
+ '954',
+ 'kappa'
+ ],
+ [
+ '955',
+ 'lambda'
+ ],
+ [
+ '956',
+ 'mu'
+ ],
+ [
+ '957',
+ 'nu'
+ ],
+ [
+ '958',
+ 'xi'
+ ],
+ [
+ '959',
+ 'omicron'
+ ],
+ [
+ '960',
+ 'pi'
+ ],
+ [
+ '961',
+ 'rho'
+ ],
+ [
+ '962',
+ 'final sigma'
+ ],
+ [
+ '963',
+ 'sigma'
+ ],
+ [
+ '964',
+ 'tau'
+ ],
+ [
+ '965',
+ 'upsilon'
+ ],
+ [
+ '966',
+ 'phi'
+ ],
+ [
+ '967',
+ 'chi'
+ ],
+ [
+ '968',
+ 'psi'
+ ],
+ [
+ '969',
+ 'omega'
+ ],
+ [
+ '8501',
+ 'alef symbol'
+ ],
+ [
+ '982',
+ 'pi symbol'
+ ],
+ [
+ '8476',
+ 'real part symbol'
+ ],
+ [
+ '978',
+ 'upsilon - hook symbol'
+ ],
+ [
+ '8472',
+ 'Weierstrass p'
+ ],
+ [
+ '8465',
+ 'imaginary part'
+ ],
+ [
+ '8592',
+ 'leftwards arrow'
+ ],
+ [
+ '8593',
+ 'upwards arrow'
+ ],
+ [
+ '8594',
+ 'rightwards arrow'
+ ],
+ [
+ '8595',
+ 'downwards arrow'
+ ],
+ [
+ '8596',
+ 'left right arrow'
+ ],
+ [
+ '8629',
+ 'carriage return'
+ ],
+ [
+ '8656',
+ 'leftwards double arrow'
+ ],
+ [
+ '8657',
+ 'upwards double arrow'
+ ],
+ [
+ '8658',
+ 'rightwards double arrow'
+ ],
+ [
+ '8659',
+ 'downwards double arrow'
+ ],
+ [
+ '8660',
+ 'left right double arrow'
+ ],
+ [
+ '8756',
+ 'therefore'
+ ],
+ [
+ '8834',
+ 'subset of'
+ ],
+ [
+ '8835',
+ 'superset of'
+ ],
+ [
+ '8836',
+ 'not a subset of'
+ ],
+ [
+ '8838',
+ 'subset of or equal to'
+ ],
+ [
+ '8839',
+ 'superset of or equal to'
+ ],
+ [
+ '8853',
+ 'circled plus'
+ ],
+ [
+ '8855',
+ 'circled times'
+ ],
+ [
+ '8869',
+ 'perpendicular'
+ ],
+ [
+ '8901',
+ 'dot operator'
+ ],
+ [
+ '8968',
+ 'left ceiling'
+ ],
+ [
+ '8969',
+ 'right ceiling'
+ ],
+ [
+ '8970',
+ 'left floor'
+ ],
+ [
+ '8971',
+ 'right floor'
+ ],
+ [
+ '9001',
+ 'left-pointing angle bracket'
+ ],
+ [
+ '9002',
+ 'right-pointing angle bracket'
+ ],
+ [
+ '9674',
+ 'lozenge'
+ ],
+ [
+ '9824',
+ 'black spade suit'
+ ],
+ [
+ '9827',
+ 'black club suit'
+ ],
+ [
+ '9829',
+ 'black heart suit'
+ ],
+ [
+ '9830',
+ 'black diamond suit'
+ ],
+ [
+ '8194',
+ 'en space'
+ ],
+ [
+ '8195',
+ 'em space'
+ ],
+ [
+ '8201',
+ 'thin space'
+ ],
+ [
+ '8204',
+ 'zero width non-joiner'
+ ],
+ [
+ '8205',
+ 'zero width joiner'
+ ],
+ [
+ '8206',
+ 'left-to-right mark'
+ ],
+ [
+ '8207',
+ 'right-to-left mark'
+ ]
+ ];
+ };
+ var charmapFilter = function (charmap) {
+ return global$1.grep(charmap, function (item) {
+ return isArray(item) && item.length === 2;
+ });
+ };
+ var getCharsFromSetting = function (settingValue) {
+ if (isArray(settingValue)) {
+ return [].concat(charmapFilter(settingValue));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (typeof settingValue === 'function') {
+ return settingValue();
+ }
+ return [];
+ };
+ var extendCharMap = function (editor, charmap) {
+ var userCharMap = $_ae555o98jfuw8onx.getCharMap(editor);
+ if (userCharMap) {
+ charmap = getCharsFromSetting(userCharMap);
+ }
+ var userCharMapAppend = $_ae555o98jfuw8onx.getCharMapAppend(editor);
+ if (userCharMapAppend) {
+ return [].concat(charmap).concat(getCharsFromSetting(userCharMapAppend));
+ }
+ return charmap;
+ };
+ var getCharMap$1 = function (editor) {
+ return extendCharMap(editor, getDefaultCharMap());
+ };
+ var $_a0v8qq96jfuw8onl = { getCharMap: getCharMap$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.charmap.Plugin","tinymce.core.PluginManager","tinymce.core.util.Tools","global!tinymce.util.Tools.resolve"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get = function (editor) {
+ var getCharMap = function () {
+ return $_a0v8qq96jfuw8onl.getCharMap(editor);
+ };
+ var insertChar = function (chr) {
+ $_apbezv94jfuw8onj.insertChar(editor, chr);
+ };
+ return {
+ getCharMap: getCharMap,
+ insertChar: insertChar
+ };
+ };
+ var $_bi5zpv93jfuw8oni = { get: get };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
- }
-);
-
-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains all core logic for the charmap plugin.
- *
- * @class tinymce.charmap.Plugin
- * @private
- */
-define(
- 'tinymce.plugins.charmap.Plugin',
- [
- 'tinymce.core.PluginManager',
- 'tinymce.core.util.Tools'
- ],
- function (PluginManager, Tools) {
- PluginManager.add('charmap', function (editor) {
- var isArray = Tools.isArray;
-
- function getDefaultCharMap() {
- return [
- ['160', 'no-break space'],
- ['173', 'soft hyphen'],
- ['34', 'quotation mark'],
- // finance
- ['162', 'cent sign'],
- ['8364', 'euro sign'],
- ['163', 'pound sign'],
- ['165', 'yen sign'],
- // signs
- ['169', 'copyright sign'],
- ['174', 'registered sign'],
- ['8482', 'trade mark sign'],
- ['8240', 'per mille sign'],
- ['181', 'micro sign'],
- ['183', 'middle dot'],
- ['8226', 'bullet'],
- ['8230', 'three dot leader'],
- ['8242', 'minutes / feet'],
- ['8243', 'seconds / inches'],
- ['167', 'section sign'],
- ['182', 'paragraph sign'],
- ['223', 'sharp s / ess-zed'],
- // quotations
- ['8249', 'single left-pointing angle quotation mark'],
- ['8250', 'single right-pointing angle quotation mark'],
- ['171', 'left pointing guillemet'],
- ['187', 'right pointing guillemet'],
- ['8216', 'left single quotation mark'],
- ['8217', 'right single quotation mark'],
- ['8220', 'left double quotation mark'],
- ['8221', 'right double quotation mark'],
- ['8218', 'single low-9 quotation mark'],
- ['8222', 'double low-9 quotation mark'],
- ['60', 'less-than sign'],
- ['62', 'greater-than sign'],
- ['8804', 'less-than or equal to'],
- ['8805', 'greater-than or equal to'],
- ['8211', 'en dash'],
- ['8212', 'em dash'],
- ['175', 'macron'],
- ['8254', 'overline'],
- ['164', 'currency sign'],
- ['166', 'broken bar'],
- ['168', 'diaeresis'],
- ['161', 'inverted exclamation mark'],
- ['191', 'turned question mark'],
- ['710', 'circumflex accent'],
- ['732', 'small tilde'],
- ['176', 'degree sign'],
- ['8722', 'minus sign'],
- ['177', 'plus-minus sign'],
- ['247', 'division sign'],
- ['8260', 'fraction slash'],
- ['215', 'multiplication sign'],
- ['185', 'superscript one'],
- ['178', 'superscript two'],
- ['179', 'superscript three'],
- ['188', 'fraction one quarter'],
- ['189', 'fraction one half'],
- ['190', 'fraction three quarters'],
- // math / logical
- ['402', 'function / florin'],
- ['8747', 'integral'],
- ['8721', 'n-ary sumation'],
- ['8734', 'infinity'],
- ['8730', 'square root'],
- ['8764', 'similar to'],
- ['8773', 'approximately equal to'],
- ['8776', 'almost equal to'],
- ['8800', 'not equal to'],
- ['8801', 'identical to'],
- ['8712', 'element of'],
- ['8713', 'not an element of'],
- ['8715', 'contains as member'],
- ['8719', 'n-ary product'],
- ['8743', 'logical and'],
- ['8744', 'logical or'],
- ['172', 'not sign'],
- ['8745', 'intersection'],
- ['8746', 'union'],
- ['8706', 'partial differential'],
- ['8704', 'for all'],
- ['8707', 'there exists'],
- ['8709', 'diameter'],
- ['8711', 'backward difference'],
- ['8727', 'asterisk operator'],
- ['8733', 'proportional to'],
- ['8736', 'angle'],
- // undefined
- ['180', 'acute accent'],
- ['184', 'cedilla'],
- ['170', 'feminine ordinal indicator'],
- ['186', 'masculine ordinal indicator'],
- ['8224', 'dagger'],
- ['8225', 'double dagger'],
- // alphabetical special chars
- ['192', 'A - grave'],
- ['193', 'A - acute'],
- ['194', 'A - circumflex'],
- ['195', 'A - tilde'],
- ['196', 'A - diaeresis'],
- ['197', 'A - ring above'],
- ['256', 'A - macron'],
- ['198', 'ligature AE'],
- ['199', 'C - cedilla'],
- ['200', 'E - grave'],
- ['201', 'E - acute'],
- ['202', 'E - circumflex'],
- ['203', 'E - diaeresis'],
- ['274', 'E - macron'],
- ['204', 'I - grave'],
- ['205', 'I - acute'],
- ['206', 'I - circumflex'],
- ['207', 'I - diaeresis'],
- ['298', 'I - macron'],
- ['208', 'ETH'],
- ['209', 'N - tilde'],
- ['210', 'O - grave'],
- ['211', 'O - acute'],
- ['212', 'O - circumflex'],
- ['213', 'O - tilde'],
- ['214', 'O - diaeresis'],
- ['216', 'O - slash'],
- ['332', 'O - macron'],
- ['338', 'ligature OE'],
- ['352', 'S - caron'],
- ['217', 'U - grave'],
- ['218', 'U - acute'],
- ['219', 'U - circumflex'],
- ['220', 'U - diaeresis'],
- ['362', 'U - macron'],
- ['221', 'Y - acute'],
- ['376', 'Y - diaeresis'],
- ['562', 'Y - macron'],
- ['222', 'THORN'],
- ['224', 'a - grave'],
- ['225', 'a - acute'],
- ['226', 'a - circumflex'],
- ['227', 'a - tilde'],
- ['228', 'a - diaeresis'],
- ['229', 'a - ring above'],
- ['257', 'a - macron'],
- ['230', 'ligature ae'],
- ['231', 'c - cedilla'],
- ['232', 'e - grave'],
- ['233', 'e - acute'],
- ['234', 'e - circumflex'],
- ['235', 'e - diaeresis'],
- ['275', 'e - macron'],
- ['236', 'i - grave'],
- ['237', 'i - acute'],
- ['238', 'i - circumflex'],
- ['239', 'i - diaeresis'],
- ['299', 'i - macron'],
- ['240', 'eth'],
- ['241', 'n - tilde'],
- ['242', 'o - grave'],
- ['243', 'o - acute'],
- ['244', 'o - circumflex'],
- ['245', 'o - tilde'],
- ['246', 'o - diaeresis'],
- ['248', 'o slash'],
- ['333', 'o macron'],
- ['339', 'ligature oe'],
- ['353', 's - caron'],
- ['249', 'u - grave'],
- ['250', 'u - acute'],
- ['251', 'u - circumflex'],
- ['252', 'u - diaeresis'],
- ['363', 'u - macron'],
- ['253', 'y - acute'],
- ['254', 'thorn'],
- ['255', 'y - diaeresis'],
- ['563', 'y - macron'],
- ['913', 'Alpha'],
- ['914', 'Beta'],
- ['915', 'Gamma'],
- ['916', 'Delta'],
- ['917', 'Epsilon'],
- ['918', 'Zeta'],
- ['919', 'Eta'],
- ['920', 'Theta'],
- ['921', 'Iota'],
- ['922', 'Kappa'],
- ['923', 'Lambda'],
- ['924', 'Mu'],
- ['925', 'Nu'],
- ['926', 'Xi'],
- ['927', 'Omicron'],
- ['928', 'Pi'],
- ['929', 'Rho'],
- ['931', 'Sigma'],
- ['932', 'Tau'],
- ['933', 'Upsilon'],
- ['934', 'Phi'],
- ['935', 'Chi'],
- ['936', 'Psi'],
- ['937', 'Omega'],
- ['945', 'alpha'],
- ['946', 'beta'],
- ['947', 'gamma'],
- ['948', 'delta'],
- ['949', 'epsilon'],
- ['950', 'zeta'],
- ['951', 'eta'],
- ['952', 'theta'],
- ['953', 'iota'],
- ['954', 'kappa'],
- ['955', 'lambda'],
- ['956', 'mu'],
- ['957', 'nu'],
- ['958', 'xi'],
- ['959', 'omicron'],
- ['960', 'pi'],
- ['961', 'rho'],
- ['962', 'final sigma'],
- ['963', 'sigma'],
- ['964', 'tau'],
- ['965', 'upsilon'],
- ['966', 'phi'],
- ['967', 'chi'],
- ['968', 'psi'],
- ['969', 'omega'],
- // symbols
- ['8501', 'alef symbol'],
- ['982', 'pi symbol'],
- ['8476', 'real part symbol'],
- ['978', 'upsilon - hook symbol'],
- ['8472', 'Weierstrass p'],
- ['8465', 'imaginary part'],
- // arrows
- ['8592', 'leftwards arrow'],
- ['8593', 'upwards arrow'],
- ['8594', 'rightwards arrow'],
- ['8595', 'downwards arrow'],
- ['8596', 'left right arrow'],
- ['8629', 'carriage return'],
- ['8656', 'leftwards double arrow'],
- ['8657', 'upwards double arrow'],
- ['8658', 'rightwards double arrow'],
- ['8659', 'downwards double arrow'],
- ['8660', 'left right double arrow'],
- ['8756', 'therefore'],
- ['8834', 'subset of'],
- ['8835', 'superset of'],
- ['8836', 'not a subset of'],
- ['8838', 'subset of or equal to'],
- ['8839', 'superset of or equal to'],
- ['8853', 'circled plus'],
- ['8855', 'circled times'],
- ['8869', 'perpendicular'],
- ['8901', 'dot operator'],
- ['8968', 'left ceiling'],
- ['8969', 'right ceiling'],
- ['8970', 'left floor'],
- ['8971', 'right floor'],
- ['9001', 'left-pointing angle bracket'],
- ['9002', 'right-pointing angle bracket'],
- ['9674', 'lozenge'],
- ['9824', 'black spade suit'],
- ['9827', 'black club suit'],
- ['9829', 'black heart suit'],
- ['9830', 'black diamond suit'],
- ['8194', 'en space'],
- ['8195', 'em space'],
- ['8201', 'thin space'],
- ['8204', 'zero width non-joiner'],
- ['8205', 'zero width joiner'],
- ['8206', 'left-to-right mark'],
- ['8207', 'right-to-left mark']
- ];
- }
-
- function charmapFilter(charmap) {
- return Tools.grep(charmap, function (item) {
- return isArray(item) && item.length == 2;
- });
- }
-
- function getCharsFromSetting(settingValue) {
- if (isArray(settingValue)) {
- return [].concat(charmapFilter(settingValue));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getHtml = function (charmap) {
+ var gridHtml, x, y;
+ var width = Math.min(charmap.length, 25);
+ var height = Math.ceil(charmap.length / width);
+ gridHtml = '<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>';
+ for (y = 0; y < height; y++) {
+ gridHtml += '<tr>';
+ for (x = 0; x < width; x++) {
+ var index = y * width + x;
+ if (index < charmap.length) {
+ var chr = charmap[index];
+ var charCode = parseInt(chr[0], 10);
+ var chrText = chr ? String.fromCharCode(charCode) : ' ';
+ gridHtml += '<td title="' + chr[1] + '">' + '<div tabindex="-1" title="' + chr[1] + '" role="button" data-chr="' + charCode + '">' + chrText + '</div>' + '</td>';
+ } else {
+ gridHtml += '<td />';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (typeof settingValue == "function") {
- return settingValue();
- }
-
- return [];
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ gridHtml += '</tr>';
+ }
+ gridHtml += '</tbody></table>';
+ return gridHtml;
+ };
+ var $_gbsfov9bjfuw8oo2 = { getHtml: getHtml };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function extendCharMap(charmap) {
- var settings = editor.settings;
-
- if (settings.charmap) {
- charmap = getCharsFromSetting(settings.charmap);
- }
-
- if (settings.charmap_append) {
- return [].concat(charmap).concat(getCharsFromSetting(settings.charmap_append));
- }
-
- return charmap;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getParentTd = function (elm) {
+ while (elm) {
+ if (elm.nodeName === 'TD') {
+ return elm;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getCharMap() {
- return extendCharMap(getDefaultCharMap());
- }
-
- function insertChar(chr) {
- editor.fire('insertCustomChar', { chr: chr }).chr;
- editor.execCommand('mceInsertContent', false, chr);
- }
-
- function showDialog() {
- var gridHtml, x, y, win;
-
- function getParentTd(elm) {
- while (elm) {
- if (elm.nodeName == 'TD') {
- return elm;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ elm = elm.parentNode;
+ }
+ };
+ var open = function (editor) {
+ var win;
+ var charMapPanel = {
+ type: 'container',
+ html: $_gbsfov9bjfuw8oo2.getHtml($_a0v8qq96jfuw8onl.getCharMap(editor)),
+ onclick: function (e) {
+ var target = e.target;
+ if (/^(TD|DIV)$/.test(target.nodeName)) {
+ var charDiv = getParentTd(target).firstChild;
+ if (charDiv && charDiv.hasAttribute('data-chr')) {
+ var charCodeString = charDiv.getAttribute('data-chr');
+ var charCode = parseInt(charCodeString, 10);
+ if (!isNaN(charCode)) {
+ $_apbezv94jfuw8onj.insertChar(editor, String.fromCharCode(charCode));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- elm = elm.parentNode;
- }
- }
-
- gridHtml = '<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>';
-
- var charmap = getCharMap();
- var width = Math.min(charmap.length, 25);
- var height = Math.ceil(charmap.length / width);
- for (y = 0; y < height; y++) {
- gridHtml += '<tr>';
-
- for (x = 0; x < width; x++) {
- var index = y * width + x;
- if (index < charmap.length) {
- var chr = charmap[index];
- var chrText = chr ? String.fromCharCode(parseInt(chr[0], 10)) : ' ';
-
- gridHtml += (
- '<td title="' + chr[1] + '">' +
- '<div tabindex="-1" title="' + chr[1] + '" role="button" data-chr="' + chrText + '">' +
- chrText +
- '</div>' +
- '</td>'
- );
- } else {
- gridHtml += '<td />';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!e.ctrlKey) {
+ win.close();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- gridHtml += '</tr>';
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- gridHtml += '</tbody></table>';
-
- var charMapPanel = {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ onmouseover: function (e) {
+ var td = getParentTd(e.target);
+ if (td && td.firstChild) {
+ win.find('#preview').text(td.firstChild.firstChild.data);
+ win.find('#previewTitle').text(td.title);
+ } else {
+ win.find('#preview').text(' ');
+ win.find('#previewTitle').text(' ');
+ }
+ }
+ };
+ win = editor.windowManager.open({
+ title: 'Special character',
+ spacing: 10,
+ padding: 10,
+ items: [
+ charMapPanel,
+ {
</ins><span class="cx" style="display: block; padding: 0 10px"> type: 'container',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- html: gridHtml,
- onclick: function (e) {
- var target = e.target;
-
- if (/^(TD|DIV)$/.test(target.nodeName)) {
- var charDiv = getParentTd(target).firstChild;
- if (charDiv && charDiv.hasAttribute('data-chr')) {
- insertChar(charDiv.getAttribute('data-chr'));
-
- if (!e.ctrlKey) {
- win.close();
- }
- }
- }
- },
- onmouseover: function (e) {
- var td = getParentTd(e.target);
-
- if (td && td.firstChild) {
- win.find('#preview').text(td.firstChild.firstChild.data);
- win.find('#previewTitle').text(td.title);
- } else {
- win.find('#preview').text(' ');
- win.find('#previewTitle').text(' ');
- }
- }
- };
-
- win = editor.windowManager.open({
- title: "Special character",
- spacing: 10,
- padding: 10,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ layout: 'flex',
+ direction: 'column',
+ align: 'center',
+ spacing: 5,
+ minWidth: 160,
+ minHeight: 160,
</ins><span class="cx" style="display: block; padding: 0 10px"> items: [
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- charMapPanel,
</del><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- type: 'container',
- layout: 'flex',
- direction: 'column',
- align: 'center',
- spacing: 5,
- minWidth: 160,
- minHeight: 160,
- items: [
- {
- type: 'label',
- name: 'preview',
- text: ' ',
- style: 'font-size: 40px; text-align: center',
- border: 1,
- minWidth: 140,
- minHeight: 80
- },
- {
- type: 'spacer',
- minHeight: 20
- },
- {
- type: 'label',
- name: 'previewTitle',
- text: ' ',
- style: 'white-space: pre-wrap;',
- border: 1,
- minWidth: 140
- }
- ]
- }
- ],
- buttons: [
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type: 'label',
+ name: 'preview',
+ text: ' ',
+ style: 'font-size: 40px; text-align: center',
+ border: 1,
+ minWidth: 140,
+ minHeight: 80
+ },
</ins><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- text: "Close", onclick: function () {
- win.close();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type: 'spacer',
+ minHeight: 20
+ },
+ {
+ type: 'label',
+ name: 'previewTitle',
+ text: ' ',
+ style: 'white-space: pre-wrap;',
+ border: 1,
+ minWidth: 140
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> ]
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ ],
+ buttons: [{
+ text: 'Close',
+ onclick: function () {
+ win.close();
+ }
+ }]
+ });
+ };
+ var $_apxwbz9ajfuw8oo0 = { open: open };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addCommand('mceShowCharmap', showDialog);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor) {
+ editor.addCommand('mceShowCharmap', function () {
+ $_apxwbz9ajfuw8oo0.open(editor);
+ });
+ };
+ var $_21ao9599jfuw8ony = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addButton('charmap', {
- icon: 'charmap',
- tooltip: 'Special character',
- cmd: 'mceShowCharmap'
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register$1 = function (editor) {
+ editor.addButton('charmap', {
+ icon: 'charmap',
+ tooltip: 'Special character',
+ cmd: 'mceShowCharmap'
+ });
+ editor.addMenuItem('charmap', {
+ icon: 'charmap',
+ text: 'Special character',
+ cmd: 'mceShowCharmap',
+ context: 'insert'
+ });
+ };
+ var $_9qh4i09cjfuw8oo4 = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addMenuItem('charmap', {
- icon: 'charmap',
- text: 'Special character',
- cmd: 'mceShowCharmap',
- context: 'insert'
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('charmap', function (editor) {
+ $_21ao9599jfuw8ony.register(editor);
+ $_9qh4i09cjfuw8oo4.register(editor);
+ return $_bi5zpv93jfuw8oni.get(editor);
+ });
+ function Plugin () {
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- getCharMap: getCharMap,
- insertChar: insertChar
- };
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return function () { };
- }
-);
-dem('tinymce.plugins.charmap.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginscharmappluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/charmap/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/charmap/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/charmap/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("3",tinymce.util.Tools.resolve),g("1",[&q
uot;3"],function(a){return a("tinymce.PluginManager")}),g("2",["3"],function(a){return a("tinymce.util.Tools")}),g("0",["1","2"],function(a,b){return a.add("charmap",function(a){function c(){return[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["163","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","
seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en da
sh"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722","minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three qu
arters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"],["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["87
09","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["192","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["256","A - macron"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"]
,["203","E - diaeresis"],["274","E - macron"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["298","I - macron"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["213","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["332","O - macron"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["362","U - macron"],["221","Y - acute"],[&quo
t;376","Y - diaeresis"],["562","Y - macron"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["257","a - macron"],["230","ligature ae"],["231","c - cedilla"],["232","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["275","e - macron"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["299","i - macron"],["240","eth"],["241","n - tilde"],["2
42","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["333","o macron"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252","u - diaeresis"],["363","u - macron"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["563","y - macron"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920"
,"Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi"],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu
"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol"],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629",&qu
ot;carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of or equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["900
2","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"],["8206","left-to-right mark"],["8207","right-to-left mark"]]}function d(a){return b.grep(a,function(a){return j(a)&&2==a.length})}function e(a){return j(a)?[].concat(d(a)):"function"==typeof a?a():[]}function f(b){var c=a.settings;return c.charmap&&(b=e(c.charmap)),c.charmap_append?[].concat(b).concat(e(c.charmap_append)):b}function g(){return f(c())}function h(b){a.fire("insertCustomChar",{chr:b}).chr,a.execCom
mand("mceInsertContent",!1,b)}function i(){function b(a){for(;a;){if("TD"==a.nodeName)return a;a=a.parentNode}}var c,d,e,f;c='<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>';var i=g(),j=Math.min(i.length,25),k=Math.ceil(i.length/j);for(e=0;e<k;e++){for(c+="<tr>",d=0;d<j;d++){var l=e*j+d;if(l<i.length){var m=i[l],n=m?String.fromCharCode(parseInt(m[0],10)):" ";c+='<td title="'+m[1]+'"><div tabindex="-1" title="'+m[1]+'" role="button" data-chr="'+n+'">'+n+"</div></td>"}else c+="<td />"}c+="</tr>"}c+="</tbody></table>";var o={type:"container",html:c,onclick:function(a){var c=a.target;if(/^(TD|DIV)$/.test(c.nodeName)){var d=b(c).firstChild;d&&d.hasAttribute("data-chr")&&(h(d.getAttribute(&
quot;data-chr")),a.ctrlKey||f.close())}},onmouseover:function(a){var c=b(a.target);c&&c.firstChild?(f.find("#preview").text(c.firstChild.firstChild.data),f.find("#previewTitle").text(c.title)):(f.find("#preview").text(" "),f.find("#previewTitle").text(" "))}};f=a.windowManager.open({title:"Special character",spacing:10,padding:10,items:[o,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"spacer",minHeight:20},{type:"label",name:"previewTitle",text:" ",style:"white-space: pre-wrap;",border:1,minWidth:140}]}],buttons:[{text:"Close",onclick:function(){f.close()}}]})}var j=b.isArray;ret
urn a.addCommand("mceShowCharmap",i),a.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),a.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"}),{getCharMap:g,insertChar:h}}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),i=function(e,t){return e.fire("insertCustomChar",{chr:t})},l=function(e,t){var a=i(e,t).chr;e.execCommand("mceInsertContent",!1,a)},a=tinymce.util.Tools.resolve("tinymce.util.Tools"),r=function(e){return e.settings.charmap},n=function(e){return e.settings.charmap_append},o=a.isArray,c=function(e){return o(e)?[].concat((t=e,a.grep(t,function(e){return o(e)&&2===e.length}))):"function"==typeof e?e():[];var t},s=function(e){return function(e,t){var a=r(e);a&&(t=c(a));var i=n(e);return i?[].concat(t).concat(c(i)):t}(e,[["160","no-break space"],["173","soft hyphen"],["34","quotation mark"],["162","cent sign"],["8364","euro sign"],["1
63","pound sign"],["165","yen sign"],["169","copyright sign"],["174","registered sign"],["8482","trade mark sign"],["8240","per mille sign"],["181","micro sign"],["183","middle dot"],["8226","bullet"],["8230","three dot leader"],["8242","minutes / feet"],["8243","seconds / inches"],["167","section sign"],["182","paragraph sign"],["223","sharp s / ess-zed"],["8249","single left-pointing angle quotation mark"],["8250","single right-pointing angle quotation mark"],["171","left pointing guillemet"],["187","right pointing guillemet"],["8216","left single quotation mark"],["8217","right
single quotation mark"],["8220","left double quotation mark"],["8221","right double quotation mark"],["8218","single low-9 quotation mark"],["8222","double low-9 quotation mark"],["60","less-than sign"],["62","greater-than sign"],["8804","less-than or equal to"],["8805","greater-than or equal to"],["8211","en dash"],["8212","em dash"],["175","macron"],["8254","overline"],["164","currency sign"],["166","broken bar"],["168","diaeresis"],["161","inverted exclamation mark"],["191","turned question mark"],["710","circumflex accent"],["732","small tilde"],["176","degree sign"],["8722&q
uot;,"minus sign"],["177","plus-minus sign"],["247","division sign"],["8260","fraction slash"],["215","multiplication sign"],["185","superscript one"],["178","superscript two"],["179","superscript three"],["188","fraction one quarter"],["189","fraction one half"],["190","fraction three quarters"],["402","function / florin"],["8747","integral"],["8721","n-ary sumation"],["8734","infinity"],["8730","square root"],["8764","similar to"],["8773","approximately equal to"],["8776","almost equal to"],["8800","not equal to"],["8801","identical to"],["8712","element of"]
,["8713","not an element of"],["8715","contains as member"],["8719","n-ary product"],["8743","logical and"],["8744","logical or"],["172","not sign"],["8745","intersection"],["8746","union"],["8706","partial differential"],["8704","for all"],["8707","there exists"],["8709","diameter"],["8711","backward difference"],["8727","asterisk operator"],["8733","proportional to"],["8736","angle"],["180","acute accent"],["184","cedilla"],["170","feminine ordinal indicator"],["186","masculine ordinal indicator"],["8224","dagger"],["8225","double dagger"],["19
2","A - grave"],["193","A - acute"],["194","A - circumflex"],["195","A - tilde"],["196","A - diaeresis"],["197","A - ring above"],["256","A - macron"],["198","ligature AE"],["199","C - cedilla"],["200","E - grave"],["201","E - acute"],["202","E - circumflex"],["203","E - diaeresis"],["274","E - macron"],["204","I - grave"],["205","I - acute"],["206","I - circumflex"],["207","I - diaeresis"],["298","I - macron"],["208","ETH"],["209","N - tilde"],["210","O - grave"],["211","O - acute"],["212","O - circumflex"],["2
13","O - tilde"],["214","O - diaeresis"],["216","O - slash"],["332","O - macron"],["338","ligature OE"],["352","S - caron"],["217","U - grave"],["218","U - acute"],["219","U - circumflex"],["220","U - diaeresis"],["362","U - macron"],["221","Y - acute"],["376","Y - diaeresis"],["562","Y - macron"],["222","THORN"],["224","a - grave"],["225","a - acute"],["226","a - circumflex"],["227","a - tilde"],["228","a - diaeresis"],["229","a - ring above"],["257","a - macron"],["230","ligature ae"],["231","c - cedilla"],["2
32","e - grave"],["233","e - acute"],["234","e - circumflex"],["235","e - diaeresis"],["275","e - macron"],["236","i - grave"],["237","i - acute"],["238","i - circumflex"],["239","i - diaeresis"],["299","i - macron"],["240","eth"],["241","n - tilde"],["242","o - grave"],["243","o - acute"],["244","o - circumflex"],["245","o - tilde"],["246","o - diaeresis"],["248","o slash"],["333","o macron"],["339","ligature oe"],["353","s - caron"],["249","u - grave"],["250","u - acute"],["251","u - circumflex"],["252",&
quot;u - diaeresis"],["363","u - macron"],["253","y - acute"],["254","thorn"],["255","y - diaeresis"],["563","y - macron"],["913","Alpha"],["914","Beta"],["915","Gamma"],["916","Delta"],["917","Epsilon"],["918","Zeta"],["919","Eta"],["920","Theta"],["921","Iota"],["922","Kappa"],["923","Lambda"],["924","Mu"],["925","Nu"],["926","Xi"],["927","Omicron"],["928","Pi"],["929","Rho"],["931","Sigma"],["932","Tau"],["933","Upsilon"],["934","Phi"],["935","Chi&qu
ot;],["936","Psi"],["937","Omega"],["945","alpha"],["946","beta"],["947","gamma"],["948","delta"],["949","epsilon"],["950","zeta"],["951","eta"],["952","theta"],["953","iota"],["954","kappa"],["955","lambda"],["956","mu"],["957","nu"],["958","xi"],["959","omicron"],["960","pi"],["961","rho"],["962","final sigma"],["963","sigma"],["964","tau"],["965","upsilon"],["966","phi"],["967","chi"],["968","psi"],["969","omega"],["8501","alef symbol&
quot;],["982","pi symbol"],["8476","real part symbol"],["978","upsilon - hook symbol"],["8472","Weierstrass p"],["8465","imaginary part"],["8592","leftwards arrow"],["8593","upwards arrow"],["8594","rightwards arrow"],["8595","downwards arrow"],["8596","left right arrow"],["8629","carriage return"],["8656","leftwards double arrow"],["8657","upwards double arrow"],["8658","rightwards double arrow"],["8659","downwards double arrow"],["8660","left right double arrow"],["8756","therefore"],["8834","subset of"],["8835","superset of"],["8836","not a subset of"],["8838","subset of o
r equal to"],["8839","superset of or equal to"],["8853","circled plus"],["8855","circled times"],["8869","perpendicular"],["8901","dot operator"],["8968","left ceiling"],["8969","right ceiling"],["8970","left floor"],["8971","right floor"],["9001","left-pointing angle bracket"],["9002","right-pointing angle bracket"],["9674","lozenge"],["9824","black spade suit"],["9827","black club suit"],["9829","black heart suit"],["9830","black diamond suit"],["8194","en space"],["8195","em space"],["8201","thin space"],["8204","zero width non-joiner"],["8205","zero width joiner"
;],["8206","left-to-right mark"],["8207","right-to-left mark"]])},t=function(t){return{getCharMap:function(){return s(t)},insertChar:function(e){l(t,e)}}},u=function(e){var t,a,i,r=Math.min(e.length,25),n=Math.ceil(e.length/r);for(t='<table role="presentation" cellspacing="0" class="mce-charmap"><tbody>',i=0;i<n;i++){for(t+="<tr>",a=0;a<r;a++){var o=i*r+a;if(o<e.length){var l=e[o],c=parseInt(l[0],10),s=l?String.fromCharCode(c):" ";t+='<td title="'+l[1]+'"><div tabindex="-1" title="'+l[1]+'" role="button" data-chr="'+c+'">'+s+"</div></td>"}else t+="<td />"}t+="</tr>"}return t+="</tbody></table>"},d=function(e){for(;e;){if("TD"===e.nodeName)return e;e=e.parentNode}},m=function(n){var o,e={type:"container",
html:u(s(n)),onclick:function(e){var t=e.target;if(/^(TD|DIV)$/.test(t.nodeName)){var a=d(t).firstChild;if(a&&a.hasAttribute("data-chr")){var i=a.getAttribute("data-chr"),r=parseInt(i,10);isNaN(r)||l(n,String.fromCharCode(r)),e.ctrlKey||o.close()}}},onmouseover:function(e){var t=d(e.target);t&&t.firstChild?(o.find("#preview").text(t.firstChild.firstChild.data),o.find("#previewTitle").text(t.title)):(o.find("#preview").text(" "),o.find("#previewTitle").text(" "))}};o=n.windowManager.open({title:"Special character",spacing:10,padding:10,items:[e,{type:"container",layout:"flex",direction:"column",align:"center",spacing:5,minWidth:160,minHeight:160,items:[{type:"label",name:"preview",text:" ",style:"font-size: 40px; text-align: center",border:1,minWidth:140,minHeight:80},{type:"spacer",minHeigh
t:20},{type:"label",name:"previewTitle",text:" ",style:"white-space: pre-wrap;",border:1,minWidth:140}]}],buttons:[{text:"Close",onclick:function(){o.close()}}]})},g=function(e){e.addCommand("mceShowCharmap",function(){m(e)})},p=function(e){e.addButton("charmap",{icon:"charmap",tooltip:"Special character",cmd:"mceShowCharmap"}),e.addMenuItem("charmap",{icon:"charmap",text:"Special character",cmd:"mceShowCharmap",context:"insert"})};e.add("charmap",function(e){return g(e),p(e),t(e)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginscolorpickerpluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,255 +1,126 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var colorpicker = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.util.Color');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
-
-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var showPreview = function (win, hexColor) {
+ win.find('#preview')[0].getEl().style.background = hexColor;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
-
-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
-
-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
-
-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
- }
- }
-};
-
-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.colorpicker.Plugin","tinymce.core.PluginManager","tinymce.core.util.Color","global!tinymce.util.Tools.resolve"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Color',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Color');
- }
-);
-
-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains all core logic for the colorpicker plugin.
- *
- * @class tinymce.colorpicker.Plugin
- * @private
- */
-define(
- 'tinymce.plugins.colorpicker.Plugin',
- [
- 'tinymce.core.PluginManager',
- 'tinymce.core.util.Color'
- ],
- function (PluginManager, Color) {
- PluginManager.add('colorpicker', function (editor) {
- function colorPickerCallback(callback, value) {
- function setColor(value) {
- var color = new Color(value), rgb = color.toRgb();
-
- win.fromJSON({
- r: rgb.r,
- g: rgb.g,
- b: rgb.b,
- hex: color.toHex().substr(1)
- });
-
- showPreview(color.toHex());
- }
-
- function showPreview(hexColor) {
- win.find('#preview')[0].getEl().style.background = hexColor;
- }
-
- var win = editor.windowManager.open({
- title: 'Color',
- items: {
- type: 'container',
- layout: 'flex',
- direction: 'row',
- align: 'stretch',
- padding: 5,
- spacing: 10,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setColor = function (win, value) {
+ var color = global$1(value), rgb = color.toRgb();
+ win.fromJSON({
+ r: rgb.r,
+ g: rgb.g,
+ b: rgb.b,
+ hex: color.toHex().substr(1)
+ });
+ showPreview(win, color.toHex());
+ };
+ var open = function (editor, callback, value) {
+ var win = editor.windowManager.open({
+ title: 'Color',
+ items: {
+ type: 'container',
+ layout: 'flex',
+ direction: 'row',
+ align: 'stretch',
+ padding: 5,
+ spacing: 10,
+ items: [
+ {
+ type: 'colorpicker',
+ value: value,
+ onchange: function () {
+ var rgb = this.rgb();
+ if (win) {
+ win.find('#r').value(rgb.r);
+ win.find('#g').value(rgb.g);
+ win.find('#b').value(rgb.b);
+ win.find('#hex').value(this.value().substr(1));
+ showPreview(win, this.value());
+ }
+ }
+ },
+ {
+ type: 'form',
+ padding: 0,
+ labelGap: 5,
+ defaults: {
+ type: 'textbox',
+ size: 7,
+ value: '0',
+ flex: 1,
+ spellcheck: false,
+ onchange: function () {
+ var colorPickerCtrl = win.find('colorpicker')[0];
+ var name, value;
+ name = this.name();
+ value = this.value();
+ if (name === 'hex') {
+ value = '#' + value;
+ setColor(win, value);
+ colorPickerCtrl.value(value);
+ return;
+ }
+ value = {
+ r: win.find('#r').value(),
+ g: win.find('#g').value(),
+ b: win.find('#b').value()
+ };
+ colorPickerCtrl.value(value);
+ setColor(win, value);
+ }
+ },
</ins><span class="cx" style="display: block; padding: 0 10px"> items: [
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- type: 'colorpicker',
- value: value,
- onchange: function () {
- var rgb = this.rgb();
-
- if (win) {
- win.find('#r').value(rgb.r);
- win.find('#g').value(rgb.g);
- win.find('#b').value(rgb.b);
- win.find('#hex').value(this.value().substr(1));
- showPreview(this.value());
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ name: 'r',
+ label: 'R',
+ autofocus: 1
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- type: 'form',
- padding: 0,
- labelGap: 5,
- defaults: {
- type: 'textbox',
- size: 7,
- value: '0',
- flex: 1,
- spellcheck: false,
- onchange: function () {
- var colorPickerCtrl = win.find('colorpicker')[0];
- var name, value;
-
- name = this.name();
- value = this.value();
-
- if (name == "hex") {
- value = '#' + value;
- setColor(value);
- colorPickerCtrl.value(value);
- return;
- }
-
- value = {
- r: win.find('#r').value(),
- g: win.find('#g').value(),
- b: win.find('#b').value()
- };
-
- colorPickerCtrl.value(value);
- setColor(value);
- }
- },
- items: [
- { name: 'r', label: 'R', autofocus: 1 },
- { name: 'g', label: 'G' },
- { name: 'b', label: 'B' },
- { name: 'hex', label: '#', value: '000000' },
- { name: 'preview', type: 'container', border: 1 }
- ]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ name: 'g',
+ label: 'G'
+ },
+ {
+ name: 'b',
+ label: 'B'
+ },
+ {
+ name: 'hex',
+ label: '#',
+ value: '000000'
+ },
+ {
+ name: 'preview',
+ type: 'container',
+ border: 1
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> ]
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
- onSubmit: function () {
- callback('#' + this.toJSON().hex);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- setColor(value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ]
+ },
+ onSubmit: function () {
+ callback('#' + win.toJSON().hex);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!editor.settings.color_picker_callback) {
- editor.settings.color_picker_callback = colorPickerCallback;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ setColor(win, value);
+ };
+ var $_3y7nz6a1jfuw8osh = { open: open };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return function () { };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('colorpicker', function (editor) {
+ if (!editor.settings.color_picker_callback) {
+ editor.settings.color_picker_callback = function (callback, value) {
+ $_3y7nz6a1jfuw8osh.open(editor, callback, value);
+ };
+ }
+ });
+ function Plugin () {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-dem('tinymce.plugins.colorpicker.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ return Plugin;
+
+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginscolorpickerpluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/colorpicker/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("3",tinymce.util.Tools.resolve),g("1",[&q
uot;3"],function(a){return a("tinymce.PluginManager")}),g("2",["3"],function(a){return a("tinymce.util.Color")}),g("0",["1","2"],function(a,b){return a.add("colorpicker",function(a){function c(c,d){function e(a){var c=new b(a),d=c.toRgb();g.fromJSON({r:d.r,g:d.g,b:d.b,hex:c.toHex().substr(1)}),f(c.toHex())}function f(a){g.find("#preview")[0].getEl().style.background=a}var g=a.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:d,onchange:function(){var a=this.rgb();g&&(g.find("#r").value(a.r),g.find("#g").value(a.g),g.find("#b").value(a.b),g.find("#hex").value(this.value().substr(1)),f(this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox"
,size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var a,b,c=g.find("colorpicker")[0];return a=this.name(),b=this.value(),"hex"==a?(b="#"+b,e(b),void c.value(b)):(b={r:g.find("#r").value(),g:g.find("#g").value(),b:g.find("#b").value()},c.value(b),void e(b))}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){c("#"+this.toJSON().hex)}});e(d)}a.settings.color_picker_callback||(a.settings.color_picker_callback=c)}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=tinymce.util.Tools.resolve("tinymce.util.Color"),a=function(e,n){e.find("#preview")[0].getEl().style.background=n},o=function(e,n){var i=l(n),t=i.toRgb();e.fromJSON({r:t.r,g:t.g,b:t.b,hex:i.toHex().substr(1)}),a(e,i.toHex())},t=function(e,n,i){var t=e.windowManager.open({title:"Color",items:{type:"container",layout:"flex",direction:"row",align:"stretch",padding:5,spacing:10,items:[{type:"colorpicker",value:i,onchange:function(){var e=this.rgb();t&&(t.find("#r").value(e.r),t.find("#g").value(e.g),t.find("#b").value(e.b),t.find("#hex").value(this.value().substr(1)),a(t,this.value()))}},{type:"form",padding:0,labelGap:5,defaults:{type:"textbox&quo
t;,size:7,value:"0",flex:1,spellcheck:!1,onchange:function(){var e,n,i=t.find("colorpicker")[0];if(e=this.name(),n=this.value(),"hex"===e)return o(t,n="#"+n),void i.value(n);n={r:t.find("#r").value(),g:t.find("#g").value(),b:t.find("#b").value()},i.value(n),o(t,n)}},items:[{name:"r",label:"R",autofocus:1},{name:"g",label:"G"},{name:"b",label:"B"},{name:"hex",label:"#",value:"000000"},{name:"preview",type:"container",border:1}]}]},onSubmit:function(){n("#"+t.toJSON().hex)}});o(t,i)};e.add("colorpicker",function(i){i.settings.color_picker_callback||(i.settings.color_picker_callback=function(e,n){t(i,e,n)})})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginscompat3xpluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/compat3x/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,7 +52,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> argsMap = argsMap.split(" ");
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (argsMap && typeof argsMap != "function") {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (argsMap && typeof argsMap !== "function") {
</ins><span class="cx" style="display: block; padding: 0 10px"> for (var i = 0; i < argsMap.length; i++) {
</span><span class="cx" style="display: block; padding: 0 10px"> callbackArgs.push(e[argsMap[i]]);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -287,7 +287,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- tinymce.on('SetupEditor', patchEditor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ tinymce.on('SetupEditor', function (e) {
+ patchEditor(e.editor);
+ });
+
</ins><span class="cx" style="display: block; padding: 0 10px"> tinymce.PluginManager.add("compat3x", patchEditor);
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> tinymce.addI18n = function (prefix, o) {
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginscompat3xpluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/compat3x/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/compat3x/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/compat3x/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(a){function b(){}function c(a){!f&&window&&window.console&&(f=!0,console.log("Deprecated TinyMCE API call: "+a))}function d(a,d,e,f){a=a||this;var g=[];return d?(this.add=function(b,h,i){function j(c){var g=[];if("string"==typeof e&&(e=e.split(" ")),e&&"function"!=typeof e)for(var i=0;i<e.length;i++)g.push(c[e[i]]);("function"!=typeof e||(g=e(d,c,a)))&&(e||(g=[c]),g.unshift(f||a),b.apply(h||f||a,g)===!1&&c.stopImmediatePropagation())}c("<target>.on"+d+".add(..)"),a.on(d,j,i);var k={original:b,patched:j};return g.push(k),j},this.addToTop=function(a,b){this.add(a,b,!0)},this.remove=function(b){return g.forEach(function(c,e){if(c.original===b)return g.splice(e,1),a.off(d,c.patched)}),a.off(d,b)},void(this.dispatch=function(){return a.fire(d),!0})):
void(this.add=this.addToTop=this.remove=this.dispatch=b)}function e(e){function f(b){var c=e.settings.language||"en",d=[c,b].join("."),f=a.i18n.translate(d);return d!==f?f:a.i18n.translate(b)}function g(b,c){a.each(b.split(" "),function(a){e["on"+a]=new d(e,a,c)})}function h(a,b,c){return[b.level,c]}function i(a){return function(b,c){if(!c.selection&&!a||c.selection==a)return[c]}}function j(){function b(){return j()}var d={},e="add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update";return c("editor.controlManager.*"),a.each(e.split(" "),function(a){d[a]=b}),d}if(!e.controlManager){e.controlManager={buttons:{},setDisabled:fun
ction(a,b){c("controlManager.setDisabled(..)"),this.buttons[a]&&this.buttons[a].disabled(b)},setActive:function(a,b){c("controlManager.setActive(..)"),this.buttons[a]&&this.buttons[a].active(b)},onAdd:new d,onPostRender:new d,add:function(a){return a},createButton:j,createColorSplitButton:j,createControl:j,createDropMenu:j,createListBox:j,createMenuButton:j,createSeparator:j,createSplitButton:j,createToolbar:j,createToolbarGroup:j,destroy:b,get:b,setControlType:j},g("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),g("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),g("BeforeExecCommand ExecCommand","command ui value args"),g("PreProcess PostProcess LoadContent SaveContent Change"),g("BeforeSetContent BeforeGetContent SetContent GetContent",i(!1)),g("SetProgressState","state time"),g(&qu
ot;VisualAid","element hasVisual"),g("Undo Redo",h),g("NodeChange",function(a,b){return[e.controlManager,b.element,e.selection.isCollapsed(),b]});var k=e.addButton;e.addButton=function(a,b){function c(){if(e.controlManager.buttons[a]=this,d)return d.apply(this,arguments)}var d;for(var g in b)"onpostrender"===g.toLowerCase()&&(d=b[g],b.onPostRender=c);return d||(b.onPostRender=c),b.title&&(b.title=f(b.title)),k.call(this,a,b)},e.on("init",function(){var a=e.undoManager,b=e.selection;a.onUndo=new d(e,"Undo",h,null,a),a.onRedo=new d(e,"Redo",h,null,a),a.onBeforeAdd=new d(e,"BeforeAddUndo",null,a),a.onAdd=new d(e,"AddUndo",null,a),b.onBeforeGetContent=new d(e,"BeforeGetContent",i(!0),b),b.onGetContent=new d(e,"GetContent",i(!0),b),b.onBeforeSetContent=new d(e,"BeforeSetContent",i(!0),b),b.onSetContent=new d(e,"SetContent",i(!0),b)}),e.on(
"BeforeRenderUI",function(){var b=e.windowManager;b.onOpen=new d,b.onClose=new d,b.createInstance=function(b,d,e,f,g,h){c("windowManager.createInstance(..)");var i=a.resolve(b);return new i(d,e,f,g,h)}})}}var f;a.util.Dispatcher=d,a.onBeforeUnload=new d(a,"BeforeUnload"),a.onAddEditor=new d(a,"AddEditor","editor"),a.onRemoveEditor=new d(a,"RemoveEditor","editor"),a.util.Cookie={get:b,getHash:b,remove:b,set:b,setHash:b},a.on("SetupEditor",e),a.PluginManager.add("compat3x",e),a.addI18n=function(b,c){var d=a.util.I18n,e=a.each;return"string"==typeof b&&b.indexOf(".")===-1?void d.add(b,c):void(a.is(b,"string")?e(c,function(a,c){d.data[b+"."+c]=a}):e(b,function(a,b){e(a,function(a,c){e(a,function(a,e){"common"===c?d.data[b+"."+e]=a:d.data[b+"."+c+"."+e]=a})})}))}}(tinymce);
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(u){var t;function l(){}function f(e){!t&&window&&window.console&&(t=!0,console.log("Deprecated TinyMCE API call: "+e))}function i(i,a,d,s){i=i||this;var c=[];a?(this.add=function(o,r,e){function t(e){var t=[];if("string"==typeof d&&(d=d.split(" ")),d&&"function"!=typeof d)for(var n=0;n<d.length;n++)t.push(e[d[n]]);("function"!=typeof d||(t=d(a,e,i)))&&(d||(t=[e]),t.unshift(s||i),!1===o.apply(r||s||i,t)&&e.stopImmediatePropagation())}f("<target>.on"+a+".add(..)"),i.on(a,t,e);var n={original:o,patched:t};return c.push(n),t},this.addToTop=function(e,t){this.add(e,t,!0)},this.remove=function(n){return c.forEach(function(e,t){if(e.original===n)return c.splice(t,1),i.off(a,e.patched)}),i.off(a,n)},this.dispatch=function(){return i.fire(a),!0}):this.ad
d=this.addToTop=this.remove=this.dispatch=l}function n(s){function e(e,t){u.each(e.split(" "),function(e){s["on"+e]=new i(s,e,t)})}function n(e,t,n){return[t.level,n]}function o(n){return function(e,t){if(!t.selection&&!n||t.selection==n)return[t]}}if(!s.controlManager){s.controlManager={buttons:{},setDisabled:function(e,t){f("controlManager.setDisabled(..)"),this.buttons[e]&&this.buttons[e].disabled(t)},setActive:function(e,t){f("controlManager.setActive(..)"),this.buttons[e]&&this.buttons[e].active(t)},onAdd:new i,onPostRender:new i,add:function(e){return e},createButton:r,createColorSplitButton:r,createControl:r,createDropMenu:r,createListBox:r,createMenuButton:r,createSeparator:r,createSplitButton:r,createToolbar:r,createToolbarGroup:r,destroy:l,get:l,setControlType:r},e("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),e("Click MouseUp MouseDown DblClick Key
Down KeyUp KeyPress ContextMenu Paste Submit Reset"),e("BeforeExecCommand ExecCommand","command ui value args"),e("PreProcess PostProcess LoadContent SaveContent Change"),e("BeforeSetContent BeforeGetContent SetContent GetContent",o(!1)),e("SetProgressState","state time"),e("VisualAid","element hasVisual"),e("Undo Redo",n),e("NodeChange",function(e,t){return[s.controlManager,t.element,s.selection.isCollapsed(),t]});var c=s.addButton;s.addButton=function(e,t){var n,o,r,i;function a(){if(s.controlManager.buttons[e]=this,n)return n.apply(this,arguments)}for(var d in t)"onpostrender"===d.toLowerCase()&&(n=t[d],t.onPostRender=a);return n||(t.onPostRender=a),t.title&&(t.title=(o=t.title,r=[s.settings.language||"en",o].join("."),i=u.i18n.translate(r),r!==i?i:u.i18n.translate(o))),c.call(this,e,t)},s.on("init",function(){var e=s.und
oManager,t=s.selection;e.onUndo=new i(s,"Undo",n,null,e),e.onRedo=new i(s,"Redo",n,null,e),e.onBeforeAdd=new i(s,"BeforeAddUndo",null,e),e.onAdd=new i(s,"AddUndo",null,e),t.onBeforeGetContent=new i(s,"BeforeGetContent",o(!0),t),t.onGetContent=new i(s,"GetContent",o(!0),t),t.onBeforeSetContent=new i(s,"BeforeSetContent",o(!0),t),t.onSetContent=new i(s,"SetContent",o(!0),t)}),s.on("BeforeRenderUI",function(){var e=s.windowManager;e.onOpen=new i,e.onClose=new i,e.createInstance=function(e,t,n,o,r,i){return f("windowManager.createInstance(..)"),new(u.resolve(e))(t,n,o,r,i)}})}function r(){var t={};function n(){return r()}return f("editor.controlManager.*"),u.each("add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMe
nu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update".split(" "),function(e){t[e]=n}),t}}u.util.Dispatcher=i,u.onBeforeUnload=new i(u,"BeforeUnload"),u.onAddEditor=new i(u,"AddEditor","editor"),u.onRemoveEditor=new i(u,"RemoveEditor","editor"),u.util.Cookie={get:l,getHash:l,remove:l,set:l,setHash:l},u.on("SetupEditor",function(e){n(e.editor)}),u.PluginManager.add("compat3x",n),u.addI18n=function(n,e){var r=u.util.I18n,t=u.each;"string"!=typeof n||-1!==n.indexOf(".")?u.is(n,"string")?t(e,function(e,t){r.data[n+"."+t]=e}):t(n,function(e,o){t(e,function(e,n){t(e,function(e,t){"common"===n?r.data[o+"."+t]=e:r.data[o+"."+n+"."+t]=e})})}):r.add(n,e)}}(tinymce);
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginsdirectionalitypluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/directionality/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/directionality/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/directionality/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,207 +1,66 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var directionality = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setDir = function (editor, dir) {
+ var dom = editor.dom;
+ var curDir;
+ var blocks = editor.selection.getSelectedBlocks();
+ if (blocks.length) {
+ curDir = dom.getAttrib(blocks[0], 'dir');
+ global$1.each(blocks, function (block) {
+ if (!dom.getParent(block.parentNode, '*[dir="' + dir + '"]', dom.getRoot())) {
+ dom.setAttrib(block, 'dir', curDir !== dir ? dir : null);
+ }
+ });
+ editor.nodeChanged();
+ }
+ };
+ var $_3zbk8naijfuw8otk = { setDir: setDir };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor) {
+ editor.addCommand('mceDirectionLTR', function () {
+ $_3zbk8naijfuw8otk.setDir(editor, 'ltr');
+ });
+ editor.addCommand('mceDirectionRTL', function () {
+ $_3zbk8naijfuw8otk.setDir(editor, 'rtl');
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_eltqhvahjfuw8otj = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var generateSelector = function (dir) {
+ var selector = [];
+ global$1.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function (name) {
+ selector.push(name + '[dir=' + dir + ']');
+ });
+ return selector.join(',');
+ };
+ var register$1 = function (editor) {
+ editor.addButton('ltr', {
+ title: 'Left to right',
+ cmd: 'mceDirectionLTR',
+ stateSelector: generateSelector('ltr')
+ });
+ editor.addButton('rtl', {
+ title: 'Right to left',
+ cmd: 'mceDirectionRTL',
+ stateSelector: generateSelector('rtl')
+ });
+ };
+ var $_g7lfqakjfuw8otn = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
-
-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('directionality', function (editor) {
+ $_eltqhvahjfuw8otj.register(editor);
+ $_g7lfqakjfuw8otn.register(editor);
+ });
+ function Plugin () {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.directionality.Plugin","tinymce.core.PluginManager","tinymce.core.util.Tools","global!tinymce.util.Tools.resolve"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
- }
-);
-
-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains all core logic for the directionality plugin.
- *
- * @class tinymce.directionality.Plugin
- * @private
- */
-define(
- 'tinymce.plugins.directionality.Plugin',
- [
- 'tinymce.core.PluginManager',
- 'tinymce.core.util.Tools'
- ],
- function (PluginManager, Tools) {
- PluginManager.add('directionality', function (editor) {
- function setDir(dir) {
- var dom = editor.dom, curDir, blocks = editor.selection.getSelectedBlocks();
-
- if (blocks.length) {
- curDir = dom.getAttrib(blocks[0], "dir");
-
- Tools.each(blocks, function (block) {
- // Add dir to block if the parent block doesn't already have that dir
- if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
- if (curDir != dir) {
- dom.setAttrib(block, "dir", dir);
- } else {
- dom.setAttrib(block, "dir", null);
- }
- }
- });
-
- editor.nodeChanged();
- }
- }
-
- function generateSelector(dir) {
- var selector = [];
-
- Tools.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function (name) {
- selector.push(name + '[dir=' + dir + ']');
- });
-
- return selector.join(',');
- }
-
- editor.addCommand('mceDirectionLTR', function () {
- setDir("ltr");
- });
-
- editor.addCommand('mceDirectionRTL', function () {
- setDir("rtl");
- });
-
- editor.addButton('ltr', {
- title: 'Left to right',
- cmd: 'mceDirectionLTR',
- stateSelector: generateSelector('ltr')
- });
-
- editor.addButton('rtl', {
- title: 'Right to left',
- cmd: 'mceDirectionRTL',
- stateSelector: generateSelector('rtl')
- });
- });
-
- return function () { };
- }
-);
-dem('tinymce.plugins.directionality.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginsdirectionalitypluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/directionality/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/directionality/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/directionality/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("3",tinymce.util.Tools.resolve),g("1",[&q
uot;3"],function(a){return a("tinymce.PluginManager")}),g("2",["3"],function(a){return a("tinymce.util.Tools")}),g("0",["1","2"],function(a,b){return a.add("directionality",function(a){function c(c){var d,e=a.dom,f=a.selection.getSelectedBlocks();f.length&&(d=e.getAttrib(f[0],"dir"),b.each(f,function(a){e.getParent(a.parentNode,"*[dir='"+c+"']",e.getRoot())||(d!=c?e.setAttrib(a,"dir",c):e.setAttrib(a,"dir",null))}),a.nodeChanged())}function d(a){var c=[];return b.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(b){c.push(b+"[dir="+a+"]")}),c.join(",")}a.addCommand("mceDirectionLTR",function(){c("ltr")}),a.addCommand("mceDirectionRTL",function(){c("rtl")}),a.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",state
Selector:d("ltr")}),a.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:d("rtl")})}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),c=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=function(t,e){var i,n=t.dom,o=t.selection.getSelectedBlocks();o.length&&(i=n.getAttrib(o[0],"dir"),c.each(o,function(t){n.getParent(t.parentNode,'*[dir="'+e+'"]',n.getRoot())||n.setAttrib(t,"dir",i!==e?e:null)}),t.nodeChanged())},i=function(t){t.addCommand("mceDirectionLTR",function(){e(t,"ltr")}),t.addCommand("mceDirectionRTL",function(){e(t,"rtl")})},n=function(e){var i=[];return c.each("h1 h2 h3 h4 h5 h6 div p".split(" "),function(t){i.push(t+"[dir="+e+"]")}),i.join(",")},o=function(t){t.addButton("ltr",{title:"Left to right",cmd:"mceDirectionLTR",stateSelector:n(&qu
ot;ltr")}),t.addButton("rtl",{title:"Right to left",cmd:"mceDirectionRTL",stateSelector:n("rtl")})};t.add("directionality",function(t){i(t),o(t)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginsfullscreenpluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,299 +1,177 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var fullscreen = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Cell = function (initial) {
+ var value = initial;
+ var get = function () {
+ return value;
+ };
+ var set = function (v) {
+ value = v;
+ };
+ var clone = function () {
+ return Cell(get());
+ };
+ return {
+ get: get,
+ set: set,
+ clone: clone
+ };
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
-
-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get = function (fullscreenState) {
+ return {
+ isFullscreen: function () {
+ return fullscreenState.get() !== null;
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_2d5qbdbsjfuw8ozh = { get: get };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fireFullscreenStateChanged = function (editor, state) {
+ editor.fire('FullscreenStateChanged', { state: state });
+ };
+ var $_6m5hhtbwjfuw8ozm = { fireFullscreenStateChanged: fireFullscreenStateChanged };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM = global$1.DOM;
+ var getWindowSize = function () {
+ var w;
+ var h;
+ var win = window;
+ var doc = document;
+ var body = doc.body;
+ if (body.offsetWidth) {
+ w = body.offsetWidth;
+ h = body.offsetHeight;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-};
-
-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.fullscreen.Plugin","tinymce.core.dom.DOMUtils","tinymce.core.PluginManager","global!tinymce.util.Tools.resolve"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.DOMUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.DOMUtils');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
-
-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains all core logic for the fullscreen plugin.
- *
- * @class tinymce.fullscreen.Plugin
- * @private
- */
-define(
- 'tinymce.plugins.fullscreen.Plugin',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.PluginManager'
- ],
- function (DOMUtils, PluginManager) {
- var DOM = DOMUtils.DOM;
-
- PluginManager.add('fullscreen', function (editor) {
- var fullscreenState = false, iframeWidth, iframeHeight, resizeHandler;
- var containerWidth, containerHeight, scrollPos;
-
- if (editor.settings.inline) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (win.innerWidth && win.innerHeight) {
+ w = win.innerWidth;
+ h = win.innerHeight;
+ }
+ return {
+ w: w,
+ h: h
+ };
+ };
+ var getScrollPos = function () {
+ var vp = DOM.getViewPort();
+ return {
+ x: vp.x,
+ y: vp.y
+ };
+ };
+ var setScrollPos = function (pos) {
+ window.scrollTo(pos.x, pos.y);
+ };
+ var toggleFullscreen = function (editor, fullscreenState) {
+ var body = document.body;
+ var documentElement = document.documentElement;
+ var editorContainerStyle;
+ var editorContainer, iframe, iframeStyle;
+ var fullscreenInfo = fullscreenState.get();
+ var resize = function () {
+ DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight));
+ };
+ var removeResize = function () {
+ DOM.unbind(window, 'resize', resize);
+ };
+ editorContainer = editor.getContainer();
+ editorContainerStyle = editorContainer.style;
+ iframe = editor.getContentAreaContainer().firstChild;
+ iframeStyle = iframe.style;
+ if (!fullscreenInfo) {
+ var newFullScreenInfo = {
+ scrollPos: getScrollPos(),
+ containerWidth: editorContainerStyle.width,
+ containerHeight: editorContainerStyle.height,
+ iframeWidth: iframeStyle.width,
+ iframeHeight: iframeStyle.height,
+ resizeHandler: resize,
+ removeHandler: removeResize
+ };
+ iframeStyle.width = iframeStyle.height = '100%';
+ editorContainerStyle.width = editorContainerStyle.height = '';
+ DOM.addClass(body, 'mce-fullscreen');
+ DOM.addClass(documentElement, 'mce-fullscreen');
+ DOM.addClass(editorContainer, 'mce-fullscreen');
+ DOM.bind(window, 'resize', resize);
+ editor.on('remove', removeResize);
+ resize();
+ fullscreenState.set(newFullScreenInfo);
+ $_6m5hhtbwjfuw8ozm.fireFullscreenStateChanged(editor, true);
+ } else {
+ iframeStyle.width = fullscreenInfo.iframeWidth;
+ iframeStyle.height = fullscreenInfo.iframeHeight;
+ if (fullscreenInfo.containerWidth) {
+ editorContainerStyle.width = fullscreenInfo.containerWidth;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getWindowSize() {
- var w, h, win = window, doc = document;
- var body = doc.body;
-
- // Old IE
- if (body.offsetWidth) {
- w = body.offsetWidth;
- h = body.offsetHeight;
- }
-
- // Modern browsers
- if (win.innerWidth && win.innerHeight) {
- w = win.innerWidth;
- h = win.innerHeight;
- }
-
- return { w: w, h: h };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (fullscreenInfo.containerHeight) {
+ editorContainerStyle.height = fullscreenInfo.containerHeight;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ DOM.removeClass(body, 'mce-fullscreen');
+ DOM.removeClass(documentElement, 'mce-fullscreen');
+ DOM.removeClass(editorContainer, 'mce-fullscreen');
+ setScrollPos(fullscreenInfo.scrollPos);
+ DOM.unbind(window, 'resize', fullscreenInfo.resizeHandler);
+ editor.off('remove', fullscreenInfo.removeHandler);
+ fullscreenState.set(null);
+ $_6m5hhtbwjfuw8ozm.fireFullscreenStateChanged(editor, false);
+ }
+ };
+ var $_e74zxhbujfuw8ozj = { toggleFullscreen: toggleFullscreen };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function getScrollPos() {
- var vp = DOM.getViewPort();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor, fullscreenState) {
+ editor.addCommand('mceFullScreen', function () {
+ $_e74zxhbujfuw8ozj.toggleFullscreen(editor, fullscreenState);
+ });
+ };
+ var $_j53v2btjfuw8ozi = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- x: vp.x,
- y: vp.y
- };
- }
-
- function setScrollPos(pos) {
- window.scrollTo(pos.x, pos.y);
- }
-
- function toggleFullscreen() {
- var body = document.body, documentElement = document.documentElement, editorContainerStyle;
- var editorContainer, iframe, iframeStyle;
-
- function resize() {
- DOM.setStyle(iframe, 'height', getWindowSize().h - (editorContainer.clientHeight - iframe.clientHeight));
- }
-
- fullscreenState = !fullscreenState;
-
- editorContainer = editor.getContainer();
- editorContainerStyle = editorContainer.style;
- iframe = editor.getContentAreaContainer().firstChild;
- iframeStyle = iframe.style;
-
- if (fullscreenState) {
- scrollPos = getScrollPos();
- iframeWidth = iframeStyle.width;
- iframeHeight = iframeStyle.height;
- iframeStyle.width = iframeStyle.height = '100%';
- containerWidth = editorContainerStyle.width;
- containerHeight = editorContainerStyle.height;
- editorContainerStyle.width = editorContainerStyle.height = '';
-
- DOM.addClass(body, 'mce-fullscreen');
- DOM.addClass(documentElement, 'mce-fullscreen');
- DOM.addClass(editorContainer, 'mce-fullscreen');
-
- DOM.bind(window, 'resize', resize);
- resize();
- resizeHandler = resize;
- } else {
- iframeStyle.width = iframeWidth;
- iframeStyle.height = iframeHeight;
-
- if (containerWidth) {
- editorContainerStyle.width = containerWidth;
- }
-
- if (containerHeight) {
- editorContainerStyle.height = containerHeight;
- }
-
- DOM.removeClass(body, 'mce-fullscreen');
- DOM.removeClass(documentElement, 'mce-fullscreen');
- DOM.removeClass(editorContainer, 'mce-fullscreen');
- DOM.unbind(window, 'resize', resizeHandler);
- setScrollPos(scrollPos);
- }
-
- editor.fire('FullscreenStateChanged', { state: fullscreenState });
- }
-
- editor.on('init', function () {
- editor.addShortcut('Ctrl+Shift+F', '', toggleFullscreen);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var postRender = function (editor) {
+ return function (e) {
+ var ctrl = e.control;
+ editor.on('FullscreenStateChanged', function (e) {
+ ctrl.active(e.state);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ };
+ var register$1 = function (editor) {
+ editor.addMenuItem('fullscreen', {
+ text: 'Fullscreen',
+ shortcut: 'Ctrl+Shift+F',
+ selectable: true,
+ cmd: 'mceFullScreen',
+ onPostRender: postRender(editor),
+ context: 'view'
+ });
+ editor.addButton('fullscreen', {
+ active: false,
+ tooltip: 'Fullscreen',
+ cmd: 'mceFullScreen',
+ onPostRender: postRender(editor)
+ });
+ };
+ var $_3ge8trbxjfuw8ozn = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('remove', function () {
- if (resizeHandler) {
- DOM.unbind(window, 'resize', resizeHandler);
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('fullscreen', function (editor) {
+ var fullscreenState = Cell(null);
+ if (editor.settings.inline) {
+ return $_2d5qbdbsjfuw8ozh.get(fullscreenState);
+ }
+ $_j53v2btjfuw8ozi.register(editor, fullscreenState);
+ $_3ge8trbxjfuw8ozn.register(editor);
+ editor.addShortcut('Ctrl+Shift+F', '', 'mceFullScreen');
+ return $_2d5qbdbsjfuw8ozh.get(fullscreenState);
+ });
+ function Plugin () {
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addCommand('mceFullScreen', toggleFullscreen);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addMenuItem('fullscreen', {
- text: 'Fullscreen',
- shortcut: 'Ctrl+Shift+F',
- selectable: true,
- onClick: function () {
- toggleFullscreen();
- editor.focus();
- },
- onPostRender: function () {
- var self = this;
-
- editor.on('FullscreenStateChanged', function (e) {
- self.active(e.state);
- });
- },
- context: 'view'
- });
-
- editor.addButton('fullscreen', {
- tooltip: 'Fullscreen',
- shortcut: 'Ctrl+Shift+F',
- onClick: toggleFullscreen,
- onPostRender: function () {
- var self = this;
-
- editor.on('FullscreenStateChanged', function (e) {
- self.active(e.state);
- });
- }
- });
-
- return {
- isFullscreen: function () {
- return fullscreenState;
- }
- };
- });
-
- return function () { };
- }
-);
-dem('tinymce.plugins.fullscreen.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginsfullscreenpluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/fullscreen/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("3",tinymce.util.Tools.resolve),g("1",[&q
uot;3"],function(a){return a("tinymce.dom.DOMUtils")}),g("2",["3"],function(a){return a("tinymce.PluginManager")}),g("0",["1","2"],function(a,b){var c=a.DOM;return b.add("fullscreen",function(a){function b(){var a,b,c=window,d=document,e=d.body;return e.offsetWidth&&(a=e.offsetWidth,b=e.offsetHeight),c.innerWidth&&c.innerHeight&&(a=c.innerWidth,b=c.innerHeight),{w:a,h:b}}function d(){var a=c.getViewPort();return{x:a.x,y:a.y}}function e(a){window.scrollTo(a.x,a.y)}function f(){function f(){c.setStyle(p,"height",b().h-(o.clientHeight-p.clientHeight))}var n,o,p,q,r=document.body,s=document.documentElement;m=!m,o=a.getContainer(),n=o.style,p=a.getContentAreaContainer().firstChild,q=p.style,m?(l=d(),g=q.width,h=q.height,q.width=q.height="100%",j=n.width,k=n.height,n.width=n.height="",c.addClass(r,"mce-fullscreen"),c.addClass(s,"mce-full
screen"),c.addClass(o,"mce-fullscreen"),c.bind(window,"resize",f),f(),i=f):(q.width=g,q.height=h,j&&(n.width=j),k&&(n.height=k),c.removeClass(r,"mce-fullscreen"),c.removeClass(s,"mce-fullscreen"),c.removeClass(o,"mce-fullscreen"),c.unbind(window,"resize",i),e(l)),a.fire("FullscreenStateChanged",{state:m})}var g,h,i,j,k,l,m=!1;if(!a.settings.inline)return a.on("init",function(){a.addShortcut("Ctrl+Shift+F","",f)}),a.on("remove",function(){i&&c.unbind(window,"resize",i)}),a.addCommand("mceFullScreen",f),a.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,onClick:function(){f(),a.focus()},onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})},context:"view"}),a.addButton("fullscreen",{tooltip:&quo
t;Fullscreen",shortcut:"Ctrl+Shift+F",onClick:f,onPostRender:function(){var b=this;a.on("FullscreenStateChanged",function(a){b.active(a.state)})}}),{isFullscreen:function(){return m}}}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var i=function(e){var n=e,t=function(){return n};return{get:t,set:function(e){n=e},clone:function(){return i(t())}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(e){return{isFullscreen:function(){return null!==e.get()}}},n=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),m=function(e,n){e.fire("FullscreenStateChanged",{state:n})},g=n.DOM,r=function(e,n){var t,r,l,i,o,c,s=document.body,u=document.documentElement,d=n.get(),a=function(){var e,n,t,i;g.setStyle(l,"height",(t=window,i=document.body,i.offsetWidth&&(e=i.offsetWidth,n=i.offsetHeight),t.innerWidth&&t.innerHeight&&(e=t.innerWidth,n=t.innerHeight),{w:e,h:n}).h-(r.clientHeight-l.clientHeight))},h=function(){g.unbind(window,"resize",a)};if(t=(r=e.getContainer()).style,i=(l=e.getContentAreaContainer().first
Child).style,d)i.width=d.iframeWidth,i.height=d.iframeHeight,d.containerWidth&&(t.width=d.containerWidth),d.containerHeight&&(t.height=d.containerHeight),g.removeClass(s,"mce-fullscreen"),g.removeClass(u,"mce-fullscreen"),g.removeClass(r,"mce-fullscreen"),o=d.scrollPos,window.scrollTo(o.x,o.y),g.unbind(window,"resize",d.resizeHandler),e.off("remove",d.removeHandler),n.set(null),m(e,!1);else{var f={scrollPos:(c=g.getViewPort(),{x:c.x,y:c.y}),containerWidth:t.width,containerHeight:t.height,iframeWidth:i.width,iframeHeight:i.height,resizeHandler:a,removeHandler:h};i.width=i.height="100%",t.width=t.height="",g.addClass(s,"mce-fullscreen"),g.addClass(u,"mce-fullscreen"),g.addClass(r,"mce-fullscreen"),g.bind(window,"resize",a),e.on("remove",h),a(),n.set(f),m(e,!0)}},l=function(e,n){e.addCommand("mceFullScreen",function(){r(e,n)})},o=function(t){
return function(e){var n=e.control;t.on("FullscreenStateChanged",function(e){n.active(e.state)})}},c=function(e){e.addMenuItem("fullscreen",{text:"Fullscreen",shortcut:"Ctrl+Shift+F",selectable:!0,cmd:"mceFullScreen",onPostRender:o(e),context:"view"}),e.addButton("fullscreen",{active:!1,tooltip:"Fullscreen",cmd:"mceFullScreen",onPostRender:o(e)})};e.add("fullscreen",function(e){var n=i(null);return e.settings.inline||(l(e,n),c(e),e.addShortcut("Ctrl+Shift+F","","mceFullScreen")),t(n)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginshrpluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/hr/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/hr/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/hr/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,152 +1,39 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var hr = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor) {
+ editor.addCommand('InsertHorizontalRule', function () {
+ editor.execCommand('mceInsertContent', false, '<hr />');
+ });
+ };
+ var $_598wgdc0jfuw8p00 = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
-
-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register$1 = function (editor) {
+ editor.addButton('hr', {
+ icon: 'hr',
+ tooltip: 'Horizontal line',
+ cmd: 'InsertHorizontalRule'
+ });
+ editor.addMenuItem('hr', {
+ icon: 'hr',
+ text: 'Horizontal line',
+ cmd: 'InsertHorizontalRule',
+ context: 'insert'
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_7oq7jyc1jfuw8p02 = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
-
-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
-
-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('hr', function (editor) {
+ $_598wgdc0jfuw8p00.register(editor);
+ $_7oq7jyc1jfuw8p02.register(editor);
+ });
+ function Plugin () {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.hr.Plugin","tinymce.core.PluginManager","global!tinymce.util.Tools.resolve"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
-
-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains all core logic for the hr plugin.
- *
- * @class tinymce.hr.Plugin
- * @private
- */
-define(
- 'tinymce.plugins.hr.Plugin',
- [
- 'tinymce.core.PluginManager'
- ],
- function (PluginManager) {
- PluginManager.add('hr', function (editor) {
- editor.addCommand('InsertHorizontalRule', function () {
- editor.execCommand('mceInsertContent', false, '<hr />');
- });
-
- editor.addButton('hr', {
- icon: 'hr',
- tooltip: 'Horizontal line',
- cmd: 'InsertHorizontalRule'
- });
-
- editor.addMenuItem('hr', {
- icon: 'hr',
- text: 'Horizontal line',
- cmd: 'InsertHorizontalRule',
- context: 'insert'
- });
- });
-
- return function () { };
- }
-);
-dem('tinymce.plugins.hr.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginshrpluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/hr/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/hr/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/hr/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("2",tinymce.util.Tools.resolve),g("1",[&q
uot;2"],function(a){return a("tinymce.PluginManager")}),g("0",["1"],function(a){return a.add("hr",function(a){a.addCommand("InsertHorizontalRule",function(){a.execCommand("mceInsertContent",!1,"<hr />")}),a.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),a.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var n=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=function(n){n.addCommand("InsertHorizontalRule",function(){n.execCommand("mceInsertContent",!1,"<hr />")})},o=function(n){n.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),n.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})};n.add("hr",function(n){t(n),o(n)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginsimagepluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/image/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/image/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/image/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,1159 +1,1337 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var image = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasDimensions = function (editor) {
+ return editor.settings.image_dimensions === false ? false : true;
+ };
+ var hasAdvTab = function (editor) {
+ return editor.settings.image_advtab === true ? true : false;
+ };
+ var getPrependUrl = function (editor) {
+ return editor.getParam('image_prepend_url', '');
+ };
+ var getClassList = function (editor) {
+ return editor.getParam('image_class_list');
+ };
+ var hasDescription = function (editor) {
+ return editor.settings.image_description === false ? false : true;
+ };
+ var hasImageTitle = function (editor) {
+ return editor.settings.image_title === true ? true : false;
+ };
+ var hasImageCaption = function (editor) {
+ return editor.settings.image_caption === true ? true : false;
+ };
+ var getImageList = function (editor) {
+ return editor.getParam('image_list', false);
+ };
+ var hasUploadUrl = function (editor) {
+ return editor.getParam('images_upload_url', false);
+ };
+ var hasUploadHandler = function (editor) {
+ return editor.getParam('images_upload_handler', false);
+ };
+ var getUploadUrl = function (editor) {
+ return editor.getParam('images_upload_url');
+ };
+ var getUploadHandler = function (editor) {
+ return editor.getParam('images_upload_handler');
+ };
+ var getUploadBasePath = function (editor) {
+ return editor.getParam('images_upload_base_path');
+ };
+ var getUploadCredentials = function (editor) {
+ return editor.getParam('images_upload_credentials');
+ };
+ var $_9cq6y3c6jfuw8p0n = {
+ hasDimensions: hasDimensions,
+ hasAdvTab: hasAdvTab,
+ getPrependUrl: getPrependUrl,
+ getClassList: getClassList,
+ hasDescription: hasDescription,
+ hasImageTitle: hasImageTitle,
+ hasImageCaption: hasImageCaption,
+ getImageList: getImageList,
+ hasUploadUrl: hasUploadUrl,
+ hasUploadHandler: hasUploadHandler,
+ getUploadUrl: getUploadUrl,
+ getUploadHandler: getUploadHandler,
+ getUploadBasePath: getUploadBasePath,
+ getUploadCredentials: getUploadCredentials
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = typeof window !== 'undefined' ? window : Function('return this;')();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var path = function (parts, scope) {
+ var o = scope !== undefined && scope !== null ? scope : global$1;
+ for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
+ o = o[parts[i]];
+ return o;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var resolve = function (p, scope) {
+ var parts = p.split('.');
+ return path(parts, scope);
+ };
+ var step = function (o, part) {
+ if (o[part] === undefined || o[part] === null)
+ o[part] = {};
+ return o[part];
+ };
+ var forge = function (parts, target) {
+ var o = target !== undefined ? target : global$1;
+ for (var i = 0; i < parts.length; ++i)
+ o = step(o, parts[i]);
+ return o;
+ };
+ var namespace = function (name, target) {
+ var parts = name.split('.');
+ return forge(parts, target);
+ };
+ var $_5mb36jcajfuw8p19 = {
+ path: path,
+ resolve: resolve,
+ forge: forge,
+ namespace: namespace
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var unsafe = function (name, scope) {
+ return $_5mb36jcajfuw8p19.resolve(name, scope);
+ };
+ var getOrDie = function (name, scope) {
+ var actual = unsafe(name, scope);
+ if (actual === undefined || actual === null)
+ throw name + ' not available on this browser';
+ return actual;
+ };
+ var $_ba69mec9jfuw8p15 = { getOrDie: getOrDie };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
-
-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function FileReader () {
+ var f = $_ba69mec9jfuw8p15.getOrDie('FileReader');
+ return new f();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.image.Plugin","tinymce.core.PluginManager","tinymce.core.util.Tools","tinymce.plugins.image.ui.Dialog","global!tinymce.util.Tools.resolve","global!document","global!Math","global!RegExp","tinymce.core.Env","tinymce.core.ui.Factory","tinymce.core.util.JSON","tinymce.core.util.XHR","tinymce.plugins.image.core.Uploader","tinymce.plugins.image.core.Utils","tinymce.core.util.Promise"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$2 = tinymce.util.Tools.resolve('tinymce.util.Promise');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.XHR');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
- }
-);
-
-defineGlobal("global!document", document);
-defineGlobal("global!Math", Math);
-defineGlobal("global!RegExp", RegExp);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.Env',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.Env');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ui.Factory',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.ui.Factory');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.JSON',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.JSON');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.XHR',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.XHR');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Promise',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Promise');
- }
-);
-
-/**
- * Uploader.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This is basically cut down version of tinymce.core.file.Uploader, which we could use directly
- * if it wasn't marked as private.
- *
- * @class tinymce.image.core.Uploader
- * @private
- */
-define(
- 'tinymce.plugins.image.core.Uploader',
- [
- 'tinymce.core.util.Promise',
- 'tinymce.core.util.Tools',
- 'global!document'
- ],
- function (Promise, Tools, document) {
- return function (settings) {
- var noop = function () {};
-
- function pathJoin(path1, path2) {
- if (path1) {
- return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var parseIntAndGetMax = function (val1, val2) {
+ return Math.max(parseInt(val1, 10), parseInt(val2, 10));
+ };
+ var getImageSize = function (url, callback) {
+ var img = document.createElement('img');
+ function done(width, height) {
+ if (img.parentNode) {
+ img.parentNode.removeChild(img);
+ }
+ callback({
+ width: width,
+ height: height
+ });
+ }
+ img.onload = function () {
+ var width = parseIntAndGetMax(img.width, img.clientWidth);
+ var height = parseIntAndGetMax(img.height, img.clientHeight);
+ done(width, height);
+ };
+ img.onerror = function () {
+ done(0, 0);
+ };
+ var style = img.style;
+ style.visibility = 'hidden';
+ style.position = 'fixed';
+ style.bottom = style.left = '0px';
+ style.width = style.height = 'auto';
+ document.body.appendChild(img);
+ img.src = url;
+ };
+ var buildListItems = function (inputList, itemCallback, startItems) {
+ function appendItems(values, output) {
+ output = output || [];
+ global$3.each(values, function (item) {
+ var menuItem = { text: item.text || item.title };
+ if (item.menu) {
+ menuItem.menu = appendItems(item.menu);
+ } else {
+ menuItem.value = item.value;
+ itemCallback(menuItem);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return path2;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ output.push(menuItem);
+ });
+ return output;
+ }
+ return appendItems(inputList, startItems || []);
+ };
+ var removePixelSuffix = function (value) {
+ if (value) {
+ value = value.replace(/px$/, '');
+ }
+ return value;
+ };
+ var addPixelSuffix = function (value) {
+ if (value.length > 0 && /^[0-9]+$/.test(value)) {
+ value += 'px';
+ }
+ return value;
+ };
+ var mergeMargins = function (css) {
+ if (css.margin) {
+ var splitMargin = css.margin.split(' ');
+ switch (splitMargin.length) {
+ case 1:
+ css['margin-top'] = css['margin-top'] || splitMargin[0];
+ css['margin-right'] = css['margin-right'] || splitMargin[0];
+ css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
+ css['margin-left'] = css['margin-left'] || splitMargin[0];
+ break;
+ case 2:
+ css['margin-top'] = css['margin-top'] || splitMargin[0];
+ css['margin-right'] = css['margin-right'] || splitMargin[1];
+ css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
+ css['margin-left'] = css['margin-left'] || splitMargin[1];
+ break;
+ case 3:
+ css['margin-top'] = css['margin-top'] || splitMargin[0];
+ css['margin-right'] = css['margin-right'] || splitMargin[1];
+ css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
+ css['margin-left'] = css['margin-left'] || splitMargin[1];
+ break;
+ case 4:
+ css['margin-top'] = css['margin-top'] || splitMargin[0];
+ css['margin-right'] = css['margin-right'] || splitMargin[1];
+ css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
+ css['margin-left'] = css['margin-left'] || splitMargin[3];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function defaultHandler(blobInfo, success, failure, progress) {
- var xhr, formData;
-
- xhr = new XMLHttpRequest();
- xhr.open('POST', settings.url);
- xhr.withCredentials = settings.credentials;
-
- xhr.upload.onprogress = function (e) {
- progress(e.loaded / e.total * 100);
- };
-
- xhr.onerror = function () {
- failure("Image upload failed due to a XHR Transport error. Code: " + xhr.status);
- };
-
- xhr.onload = function () {
- var json;
-
- if (xhr.status < 200 || xhr.status >= 300) {
- failure("HTTP Error: " + xhr.status);
- return;
- }
-
- json = JSON.parse(xhr.responseText);
-
- if (!json || typeof json.location != "string") {
- failure("Invalid JSON: " + xhr.responseText);
- return;
- }
-
- success(pathJoin(settings.basePath, json.location));
- };
-
- formData = new FormData();
- formData.append('file', blobInfo.blob(), blobInfo.filename());
-
- xhr.send(formData);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ delete css.margin;
+ }
+ return css;
+ };
+ var createImageList = function (editor, callback) {
+ var imageList = $_9cq6y3c6jfuw8p0n.getImageList(editor);
+ if (typeof imageList === 'string') {
+ global$4.send({
+ url: imageList,
+ success: function (text) {
+ callback(JSON.parse(text));
+ }
+ });
+ } else if (typeof imageList === 'function') {
+ imageList(callback);
+ } else {
+ callback(imageList);
+ }
+ };
+ var waitLoadImage = function (editor, data, imgElm) {
+ function selectImage() {
+ imgElm.onload = imgElm.onerror = null;
+ if (editor.selection) {
+ editor.selection.select(imgElm);
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function uploadBlob(blobInfo, handler) {
- return new Promise(function (resolve, reject) {
- try {
- handler(blobInfo, resolve, reject, noop);
- } catch (ex) {
- reject(ex.message);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ imgElm.onload = function () {
+ if (!data.width && !data.height && $_9cq6y3c6jfuw8p0n.hasDimensions(editor)) {
+ editor.dom.setAttribs(imgElm, {
+ width: imgElm.clientWidth,
+ height: imgElm.clientHeight
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isDefaultHandler(handler) {
- return handler === defaultHandler;
- }
-
- function upload(blobInfo) {
- return (!settings.url && isDefaultHandler(settings.handler)) ? Promise.reject("Upload url missng from the settings.") : uploadBlob(blobInfo, settings.handler);
- }
-
- settings = Tools.extend({
- credentials: false,
- handler: defaultHandler
- }, settings);
-
- return {
- upload: upload
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ selectImage();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Utils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * @class tinymce.image.core.Utils
- * @private
- */
-define(
- 'tinymce.plugins.image.core.Utils',
- [
- 'tinymce.core.util.Tools',
- 'global!Math',
- 'global!document'
- ],
- function (Tools, Math, document) {
-
- var getImageSize = function (url, callback) {
- var img = document.createElement('img');
-
- function done(width, height) {
- if (img.parentNode) {
- img.parentNode.removeChild(img);
- }
-
- callback({ width: width, height: height });
- }
-
- img.onload = function () {
- done(Math.max(img.width, img.clientWidth), Math.max(img.height, img.clientHeight));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ imgElm.onerror = selectImage;
+ };
+ var blobToDataUri = function (blob) {
+ return new global$2(function (resolve, reject) {
+ var reader = new FileReader();
+ reader.onload = function () {
+ resolve(reader.result);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- img.onerror = function () {
- done();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ reader.onerror = function () {
+ reject(FileReader.error.message);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ reader.readAsDataURL(blob);
+ });
+ };
+ var $_7v7yldc7jfuw8p0q = {
+ getImageSize: getImageSize,
+ buildListItems: buildListItems,
+ removePixelSuffix: removePixelSuffix,
+ addPixelSuffix: addPixelSuffix,
+ mergeMargins: mergeMargins,
+ createImageList: createImageList,
+ waitLoadImage: waitLoadImage,
+ blobToDataUri: blobToDataUri
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var style = img.style;
- style.visibility = 'hidden';
- style.position = 'fixed';
- style.bottom = style.left = 0;
- style.width = style.height = 'auto';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$5 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- document.body.appendChild(img);
- img.src = url;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var typeOf = function (x) {
+ if (x === null)
+ return 'null';
+ var t = typeof x;
+ if (t === 'object' && Array.prototype.isPrototypeOf(x))
+ return 'array';
+ if (t === 'object' && String.prototype.isPrototypeOf(x))
+ return 'string';
+ return t;
+ };
+ var isType = function (type) {
+ return function (value) {
+ return typeOf(value) === type;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_rbqovckjfuw8p27 = {
+ isString: isType('string'),
+ isObject: isType('object'),
+ isArray: isType('array'),
+ isNull: isType('null'),
+ isBoolean: isType('boolean'),
+ isUndefined: isType('undefined'),
+ isFunction: isType('function'),
+ isNumber: isType('number')
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var buildListItems = function (inputList, itemCallback, startItems) {
- function appendItems(values, output) {
- output = output || [];
-
- Tools.each(values, function (item) {
- var menuItem = { text: item.text || item.title };
-
- if (item.menu) {
- menuItem.menu = appendItems(item.menu);
- } else {
- menuItem.value = item.value;
- itemCallback(menuItem);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var shallow = function (old, nu) {
+ return nu;
+ };
+ var deep = function (old, nu) {
+ var bothObjects = $_rbqovckjfuw8p27.isObject(old) && $_rbqovckjfuw8p27.isObject(nu);
+ return bothObjects ? deepMerge(old, nu) : nu;
+ };
+ var baseMerge = function (merger) {
+ return function () {
+ var objects = new Array(arguments.length);
+ for (var i = 0; i < objects.length; i++)
+ objects[i] = arguments[i];
+ if (objects.length === 0)
+ throw new Error('Can\'t merge zero objects');
+ var ret = {};
+ for (var j = 0; j < objects.length; j++) {
+ var curObject = objects[j];
+ for (var key in curObject)
+ if (curObject.hasOwnProperty(key)) {
+ ret[key] = merger(ret[key], curObject[key]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- output.push(menuItem);
- });
-
- return output;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return appendItems(inputList, startItems || []);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return ret;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var deepMerge = baseMerge(deep);
+ var merge = baseMerge(shallow);
+ var $_ajpvnqcjjfuw8p25 = {
+ deepMerge: deepMerge,
+ merge: merge
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var removePixelSuffix = function (value) {
- if (value) {
- value = value.replace(/px$/, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM = global$5.DOM;
+ var getHspace = function (image) {
+ if (image.style.marginLeft && image.style.marginRight && image.style.marginLeft === image.style.marginRight) {
+ return $_7v7yldc7jfuw8p0q.removePixelSuffix(image.style.marginLeft);
+ } else {
+ return '';
+ }
+ };
+ var getVspace = function (image) {
+ if (image.style.marginTop && image.style.marginBottom && image.style.marginTop === image.style.marginBottom) {
+ return $_7v7yldc7jfuw8p0q.removePixelSuffix(image.style.marginTop);
+ } else {
+ return '';
+ }
+ };
+ var getBorder = function (image) {
+ if (image.style.borderWidth) {
+ return $_7v7yldc7jfuw8p0q.removePixelSuffix(image.style.borderWidth);
+ } else {
+ return '';
+ }
+ };
+ var getAttrib = function (image, name) {
+ if (image.hasAttribute(name)) {
+ return image.getAttribute(name);
+ } else {
+ return '';
+ }
+ };
+ var getStyle = function (image, name) {
+ return image.style[name] ? image.style[name] : '';
+ };
+ var hasCaption = function (image) {
+ return image.parentNode !== null && image.parentNode.nodeName === 'FIGURE';
+ };
+ var setAttrib = function (image, name, value) {
+ image.setAttribute(name, value);
+ };
+ var wrapInFigure = function (image) {
+ var figureElm = DOM.create('figure', { class: 'image' });
+ DOM.insertAfter(figureElm, image);
+ figureElm.appendChild(image);
+ figureElm.appendChild(DOM.create('figcaption', { contentEditable: true }, 'Caption'));
+ figureElm.contentEditable = 'false';
+ };
+ var removeFigure = function (image) {
+ var figureElm = image.parentNode;
+ DOM.insertAfter(image, figureElm);
+ DOM.remove(figureElm);
+ };
+ var toggleCaption = function (image) {
+ if (hasCaption(image)) {
+ removeFigure(image);
+ } else {
+ wrapInFigure(image);
+ }
+ };
+ var normalizeStyle = function (image, normalizeCss) {
+ var attrValue = image.getAttribute('style');
+ var value = normalizeCss(attrValue !== null ? attrValue : '');
+ if (value.length > 0) {
+ image.setAttribute('style', value);
+ image.setAttribute('data-mce-style', value);
+ } else {
+ image.removeAttribute('style');
+ }
+ };
+ var setSize = function (name, normalizeCss) {
+ return function (image, name, value) {
+ if (image.style[name]) {
+ image.style[name] = $_7v7yldc7jfuw8p0q.addPixelSuffix(value);
+ normalizeStyle(image, normalizeCss);
+ } else {
+ setAttrib(image, name, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return value;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getSize = function (image, name) {
+ if (image.style[name]) {
+ return $_7v7yldc7jfuw8p0q.removePixelSuffix(image.style[name]);
+ } else {
+ return getAttrib(image, name);
+ }
+ };
+ var setHspace = function (image, value) {
+ var pxValue = $_7v7yldc7jfuw8p0q.addPixelSuffix(value);
+ image.style.marginLeft = pxValue;
+ image.style.marginRight = pxValue;
+ };
+ var setVspace = function (image, value) {
+ var pxValue = $_7v7yldc7jfuw8p0q.addPixelSuffix(value);
+ image.style.marginTop = pxValue;
+ image.style.marginBottom = pxValue;
+ };
+ var setBorder = function (image, value) {
+ var pxValue = $_7v7yldc7jfuw8p0q.addPixelSuffix(value);
+ image.style.borderWidth = pxValue;
+ };
+ var setBorderStyle = function (image, value) {
+ image.style.borderStyle = value;
+ };
+ var getBorderStyle = function (image) {
+ return getStyle(image, 'borderStyle');
+ };
+ var isFigure = function (elm) {
+ return elm.nodeName === 'FIGURE';
+ };
+ var defaultData = function () {
+ return {
+ src: '',
+ alt: '',
+ title: '',
+ width: '',
+ height: '',
+ class: '',
+ style: '',
+ caption: false,
+ hspace: '',
+ vspace: '',
+ border: '',
+ borderStyle: ''
+ };
+ };
+ var getStyleValue = function (normalizeCss, data) {
+ var image = document.createElement('img');
+ setAttrib(image, 'style', data.style);
+ if (getHspace(image) || data.hspace !== '') {
+ setHspace(image, data.hspace);
+ }
+ if (getVspace(image) || data.vspace !== '') {
+ setVspace(image, data.vspace);
+ }
+ if (getBorder(image) || data.border !== '') {
+ setBorder(image, data.border);
+ }
+ if (getBorderStyle(image) || data.borderStyle !== '') {
+ setBorderStyle(image, data.borderStyle);
+ }
+ return normalizeCss(image.getAttribute('style'));
+ };
+ var create = function (normalizeCss, data) {
+ var image = document.createElement('img');
+ write(normalizeCss, $_ajpvnqcjjfuw8p25.merge(data, { caption: false }), image);
+ setAttrib(image, 'alt', data.alt);
+ if (data.caption) {
+ var figure = DOM.create('figure', { class: 'image' });
+ figure.appendChild(image);
+ figure.appendChild(DOM.create('figcaption', { contentEditable: true }, 'Caption'));
+ figure.contentEditable = 'false';
+ return figure;
+ } else {
+ return image;
+ }
+ };
+ var read = function (normalizeCss, image) {
+ return {
+ src: getAttrib(image, 'src'),
+ alt: getAttrib(image, 'alt'),
+ title: getAttrib(image, 'title'),
+ width: getSize(image, 'width'),
+ height: getSize(image, 'height'),
+ class: getAttrib(image, 'class'),
+ style: normalizeCss(getAttrib(image, 'style')),
+ caption: hasCaption(image),
+ hspace: getHspace(image),
+ vspace: getVspace(image),
+ border: getBorder(image),
+ borderStyle: getStyle(image, 'borderStyle')
+ };
+ };
+ var updateProp = function (image, oldData, newData, name, set) {
+ if (newData[name] !== oldData[name]) {
+ set(image, name, newData[name]);
+ }
+ };
+ var normalized = function (set, normalizeCss) {
+ return function (image, name, value) {
+ set(image, value);
+ normalizeStyle(image, normalizeCss);
+ };
+ };
+ var write = function (normalizeCss, newData, image) {
+ var oldData = read(normalizeCss, image);
+ updateProp(image, oldData, newData, 'caption', function (image, _name, _value) {
+ return toggleCaption(image);
+ });
+ updateProp(image, oldData, newData, 'src', setAttrib);
+ updateProp(image, oldData, newData, 'alt', setAttrib);
+ updateProp(image, oldData, newData, 'title', setAttrib);
+ updateProp(image, oldData, newData, 'width', setSize('width', normalizeCss));
+ updateProp(image, oldData, newData, 'height', setSize('height', normalizeCss));
+ updateProp(image, oldData, newData, 'class', setAttrib);
+ updateProp(image, oldData, newData, 'style', normalized(function (image, value) {
+ return setAttrib(image, 'style', value);
+ }, normalizeCss));
+ updateProp(image, oldData, newData, 'hspace', normalized(setHspace, normalizeCss));
+ updateProp(image, oldData, newData, 'vspace', normalized(setVspace, normalizeCss));
+ updateProp(image, oldData, newData, 'border', normalized(setBorder, normalizeCss));
+ updateProp(image, oldData, newData, 'borderStyle', normalized(setBorderStyle, normalizeCss));
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var addPixelSuffix = function (value) {
- if (value.length > 0 && /^[0-9]+$/.test(value)) {
- value += 'px';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var normalizeCss = function (editor, cssText) {
+ var css = editor.dom.styles.parse(cssText);
+ var mergedCss = $_7v7yldc7jfuw8p0q.mergeMargins(css);
+ var compressed = editor.dom.styles.parse(editor.dom.styles.serialize(mergedCss));
+ return editor.dom.styles.serialize(compressed);
+ };
+ var getSelectedImage = function (editor) {
+ var imgElm = editor.selection.getNode();
+ var figureElm = editor.dom.getParent(imgElm, 'figure.image');
+ if (figureElm) {
+ return editor.dom.select('img', figureElm)[0];
+ }
+ if (imgElm && (imgElm.nodeName !== 'IMG' || imgElm.getAttribute('data-mce-object') || imgElm.getAttribute('data-mce-placeholder'))) {
+ return null;
+ }
+ return imgElm;
+ };
+ var splitTextBlock = function (editor, figure) {
+ var dom = editor.dom;
+ var textBlock = dom.getParent(figure.parentNode, function (node) {
+ return editor.schema.getTextBlockElements()[node.nodeName];
+ });
+ if (textBlock) {
+ return dom.split(textBlock, figure);
+ } else {
+ return figure;
+ }
+ };
+ var readImageDataFromSelection = function (editor) {
+ var image = getSelectedImage(editor);
+ return image ? read(function (css) {
+ return normalizeCss(editor, css);
+ }, image) : defaultData();
+ };
+ var insertImageAtCaret = function (editor, data) {
+ var elm = create(function (css) {
+ return normalizeCss(editor, css);
+ }, data);
+ editor.dom.setAttrib(elm, 'data-mce-id', '__mcenew');
+ editor.focus();
+ editor.selection.setContent(elm.outerHTML);
+ var insertedElm = editor.dom.select('*[data-mce-id="__mcenew"]')[0];
+ editor.dom.setAttrib(insertedElm, 'data-mce-id', null);
+ if (isFigure(insertedElm)) {
+ var figure = splitTextBlock(editor, insertedElm);
+ editor.selection.select(figure);
+ } else {
+ editor.selection.select(insertedElm);
+ }
+ };
+ var syncSrcAttr = function (editor, image) {
+ editor.dom.setAttrib(image, 'src', image.getAttribute('src'));
+ };
+ var deleteImage = function (editor, image) {
+ if (image) {
+ var elm = editor.dom.is(image.parentNode, 'figure.image') ? image.parentNode : image;
+ editor.dom.remove(elm);
+ editor.focus();
+ editor.nodeChanged();
+ if (editor.dom.isEmpty(editor.getBody())) {
+ editor.setContent('');
+ editor.selection.setCursorLocation();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return value;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var writeImageDataToSelection = function (editor, data) {
+ var image = getSelectedImage(editor);
+ write(function (css) {
+ return normalizeCss(editor, css);
+ }, data, image);
+ syncSrcAttr(editor, image);
+ if (isFigure(image.parentNode)) {
+ var figure = image.parentNode;
+ splitTextBlock(editor, figure);
+ editor.selection.select(image.parentNode);
+ } else {
+ editor.selection.select(image);
+ $_7v7yldc7jfuw8p0q.waitLoadImage(editor, data, image);
+ }
+ };
+ var insertOrUpdateImage = function (editor, data) {
+ var image = getSelectedImage(editor);
+ if (image) {
+ if (data.src) {
+ writeImageDataToSelection(editor, data);
+ } else {
+ deleteImage(editor, image);
+ }
+ } else if (data.src) {
+ insertImageAtCaret(editor, data);
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var mergeMargins = function (css) {
- if (css.margin) {
-
- var splitMargin = css.margin.split(" ");
-
- switch (splitMargin.length) {
- case 1: //margin: toprightbottomleft;
- css['margin-top'] = css['margin-top'] || splitMargin[0];
- css['margin-right'] = css['margin-right'] || splitMargin[0];
- css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
- css['margin-left'] = css['margin-left'] || splitMargin[0];
- break;
- case 2: //margin: topbottom rightleft;
- css['margin-top'] = css['margin-top'] || splitMargin[0];
- css['margin-right'] = css['margin-right'] || splitMargin[1];
- css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];
- css['margin-left'] = css['margin-left'] || splitMargin[1];
- break;
- case 3: //margin: top rightleft bottom;
- css['margin-top'] = css['margin-top'] || splitMargin[0];
- css['margin-right'] = css['margin-right'] || splitMargin[1];
- css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
- css['margin-left'] = css['margin-left'] || splitMargin[1];
- break;
- case 4: //margin: top right bottom left;
- css['margin-top'] = css['margin-top'] || splitMargin[0];
- css['margin-right'] = css['margin-right'] || splitMargin[1];
- css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];
- css['margin-left'] = css['margin-left'] || splitMargin[3];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var updateVSpaceHSpaceBorder = function (editor) {
+ return function (evt) {
+ var dom = editor.dom;
+ var rootControl = evt.control.rootControl;
+ if (!$_9cq6y3c6jfuw8p0n.hasAdvTab(editor)) {
+ return;
+ }
+ var data = rootControl.toJSON();
+ var css = dom.parseStyle(data.style);
+ rootControl.find('#vspace').value('');
+ rootControl.find('#hspace').value('');
+ css = $_7v7yldc7jfuw8p0q.mergeMargins(css);
+ if (css['margin-top'] && css['margin-bottom'] || css['margin-right'] && css['margin-left']) {
+ if (css['margin-top'] === css['margin-bottom']) {
+ rootControl.find('#vspace').value($_7v7yldc7jfuw8p0q.removePixelSuffix(css['margin-top']));
+ } else {
+ rootControl.find('#vspace').value('');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- delete css.margin;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (css['margin-right'] === css['margin-left']) {
+ rootControl.find('#hspace').value($_7v7yldc7jfuw8p0q.removePixelSuffix(css['margin-right']));
+ } else {
+ rootControl.find('#hspace').value('');
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return css;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (css['border-width']) {
+ rootControl.find('#border').value($_7v7yldc7jfuw8p0q.removePixelSuffix(css['border-width']));
+ } else {
+ rootControl.find('#border').value('');
+ }
+ if (css['border-style']) {
+ rootControl.find('#borderStyle').value(css['border-style']);
+ } else {
+ rootControl.find('#borderStyle').value('');
+ }
+ rootControl.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var updateStyle = function (editor, win) {
+ win.find('#style').each(function (ctrl) {
+ var value = getStyleValue(function (css) {
+ return normalizeCss(editor, css);
+ }, $_ajpvnqcjjfuw8p25.merge(defaultData(), win.toJSON()));
+ ctrl.value(value);
+ });
+ };
+ var makeTab = function (editor) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- getImageSize: getImageSize,
- buildListItems: buildListItems,
- removePixelSuffix: removePixelSuffix,
- addPixelSuffix: addPixelSuffix,
- mergeMargins: mergeMargins
- };
- }
-);
-
-/**
- * Dialog.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * @class tinymce.image.ui.Dialog
- * @private
- */
-define(
- 'tinymce.plugins.image.ui.Dialog',
- [
- 'global!document',
- 'global!Math',
- 'global!RegExp',
- 'tinymce.core.Env',
- 'tinymce.core.ui.Factory',
- 'tinymce.core.util.JSON',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.XHR',
- 'tinymce.plugins.image.core.Uploader',
- 'tinymce.plugins.image.core.Utils'
- ],
- function (document, Math, RegExp, Env, Factory, JSON, Tools, XHR, Uploader, Utils) {
-
- return function (editor) {
- function createImageList(callback) {
- var imageList = editor.settings.image_list;
-
- if (typeof imageList == "string") {
- XHR.send({
- url: imageList,
- success: function (text) {
- callback(JSON.parse(text));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ title: 'Advanced',
+ type: 'form',
+ pack: 'start',
+ items: [
+ {
+ label: 'Style',
+ name: 'style',
+ type: 'textbox',
+ onchange: updateVSpaceHSpaceBorder(editor)
+ },
+ {
+ type: 'form',
+ layout: 'grid',
+ packV: 'start',
+ columns: 2,
+ padding: 0,
+ defaults: {
+ type: 'textbox',
+ maxWidth: 50,
+ onchange: function (evt) {
+ updateStyle(editor, evt.control.rootControl);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- } else if (typeof imageList == "function") {
- imageList(callback);
- } else {
- callback(imageList);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ items: [
+ {
+ label: 'Vertical space',
+ name: 'vspace'
+ },
+ {
+ label: 'Border width',
+ name: 'border'
+ },
+ {
+ label: 'Horizontal space',
+ name: 'hspace'
+ },
+ {
+ label: 'Border style',
+ type: 'listbox',
+ name: 'borderStyle',
+ width: 90,
+ maxWidth: 90,
+ onselect: function (evt) {
+ updateStyle(editor, evt.control.rootControl);
+ },
+ values: [
+ {
+ text: 'Select...',
+ value: ''
+ },
+ {
+ text: 'Solid',
+ value: 'solid'
+ },
+ {
+ text: 'Dotted',
+ value: 'dotted'
+ },
+ {
+ text: 'Dashed',
+ value: 'dashed'
+ },
+ {
+ text: 'Double',
+ value: 'double'
+ },
+ {
+ text: 'Groove',
+ value: 'groove'
+ },
+ {
+ text: 'Ridge',
+ value: 'ridge'
+ },
+ {
+ text: 'Inset',
+ value: 'inset'
+ },
+ {
+ text: 'Outset',
+ value: 'outset'
+ },
+ {
+ text: 'None',
+ value: 'none'
+ },
+ {
+ text: 'Hidden',
+ value: 'hidden'
+ }
+ ]
+ }
+ ]
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ]
+ };
+ };
+ var $_dlliegcfjfuw8p1m = { makeTab: makeTab };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function showDialog(imageList) {
- var win, data = {}, imgElm, figureElm, dom = editor.dom, settings = editor.settings;
- var width, height, imageListCtrl, classListCtrl, imageDimensions = settings.image_dimensions !== false;
-
-
- function onFileInput() {
- var Throbber = Factory.get('Throbber');
- var throbber = new Throbber(win.getEl());
- var file = this.value();
-
- var uploader = new Uploader({
- url: settings.images_upload_url,
- basePath: settings.images_upload_base_path,
- credentials: settings.images_upload_credentials,
- handler: settings.images_upload_handler
- });
-
- // we do not need to add this to editors blobCache, so we fake bare minimum
- var blobInfo = editor.editorUpload.blobCache.create({
- blob: file,
- name: file.name ? file.name.replace(/\.[^\.]+$/, '') : null, // strip extension
- base64: 'data:image/fake;base64,=' // without this create() will throw exception
- });
-
- var finalize = function () {
- throbber.hide();
- URL.revokeObjectURL(blobInfo.blobUri()); // in theory we could fake blobUri too, but until it's legitimate, we have too revoke it manually
- };
-
- throbber.show();
-
- return uploader.upload(blobInfo).then(function (url) {
- var src = win.find('#src');
- src.value(url);
- win.find('tabpanel')[0].activateTab(0); // switch to General tab
- src.fire('change'); // this will invoke onSrcChange (and any other handlers, if any).
- finalize();
- return url;
- }, function (err) {
- editor.windowManager.alert(err);
- finalize();
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var doSyncSize = function (widthCtrl, heightCtrl) {
+ widthCtrl.state.set('oldVal', widthCtrl.value());
+ heightCtrl.state.set('oldVal', heightCtrl.value());
+ };
+ var doSizeControls = function (win, f) {
+ var widthCtrl = win.find('#width')[0];
+ var heightCtrl = win.find('#height')[0];
+ var constrained = win.find('#constrain')[0];
+ if (widthCtrl && heightCtrl && constrained) {
+ f(widthCtrl, heightCtrl, constrained.checked());
+ }
+ };
+ var doUpdateSize = function (widthCtrl, heightCtrl, isContrained) {
+ var oldWidth = widthCtrl.state.get('oldVal');
+ var oldHeight = heightCtrl.state.get('oldVal');
+ var newWidth = widthCtrl.value();
+ var newHeight = heightCtrl.value();
+ if (isContrained && oldWidth && oldHeight && newWidth && newHeight) {
+ if (newWidth !== oldWidth) {
+ newHeight = Math.round(newWidth / oldWidth * newHeight);
+ if (!isNaN(newHeight)) {
+ heightCtrl.value(newHeight);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isTextBlock(node) {
- return editor.schema.getTextBlockElements()[node.nodeName];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ newWidth = Math.round(newHeight / oldHeight * newWidth);
+ if (!isNaN(newWidth)) {
+ widthCtrl.value(newWidth);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function recalcSize() {
- var widthCtrl, heightCtrl, newWidth, newHeight;
-
- widthCtrl = win.find('#width')[0];
- heightCtrl = win.find('#height')[0];
-
- if (!widthCtrl || !heightCtrl) {
- return;
- }
-
- newWidth = widthCtrl.value();
- newHeight = heightCtrl.value();
-
- if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
- if (width != newWidth) {
- newHeight = Math.round((newWidth / width) * newHeight);
-
- if (!isNaN(newHeight)) {
- heightCtrl.value(newHeight);
- }
- } else {
- newWidth = Math.round((newHeight / height) * newWidth);
-
- if (!isNaN(newWidth)) {
- widthCtrl.value(newWidth);
- }
- }
- }
-
- width = newWidth;
- height = newHeight;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ }
+ doSyncSize(widthCtrl, heightCtrl);
+ };
+ var syncSize = function (win) {
+ doSizeControls(win, doSyncSize);
+ };
+ var updateSize = function (win) {
+ doSizeControls(win, doUpdateSize);
+ };
+ var createUi = function () {
+ var recalcSize = function (evt) {
+ updateSize(evt.control.rootControl);
+ };
+ return {
+ type: 'container',
+ label: 'Dimensions',
+ layout: 'flex',
+ align: 'center',
+ spacing: 5,
+ items: [
+ {
+ name: 'width',
+ type: 'textbox',
+ maxLength: 5,
+ size: 5,
+ onchange: recalcSize,
+ ariaLabel: 'Width'
+ },
+ {
+ type: 'label',
+ text: 'x'
+ },
+ {
+ name: 'height',
+ type: 'textbox',
+ maxLength: 5,
+ size: 5,
+ onchange: recalcSize,
+ ariaLabel: 'Height'
+ },
+ {
+ name: 'constrain',
+ type: 'checkbox',
+ checked: true,
+ text: 'Constrain proportions'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ]
+ };
+ };
+ var $_1ahiincmjfuw8p2c = {
+ createUi: createUi,
+ syncSize: syncSize,
+ updateSize: updateSize
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function updateStyle() {
- if (!editor.settings.image_advtab) {
- return;
- }
-
- var data = win.toJSON(),
- css = dom.parseStyle(data.style);
-
- css = Utils.mergeMargins(css);
-
- if (data.vspace) {
- css['margin-top'] = css['margin-bottom'] = Utils.addPixelSuffix(data.vspace);
- }
- if (data.hspace) {
- css['margin-left'] = css['margin-right'] = Utils.addPixelSuffix(data.hspace);
- }
- if (data.border) {
- css['border-width'] = Utils.addPixelSuffix(data.border);
- }
-
- win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var onSrcChange = function (evt, editor) {
+ var srcURL, prependURL, absoluteURLPattern;
+ var meta = evt.meta || {};
+ var control = evt.control;
+ var rootControl = control.rootControl;
+ var imageListCtrl = rootControl.find('#image-list')[0];
+ if (imageListCtrl) {
+ imageListCtrl.value(editor.convertURL(control.value(), 'src'));
+ }
+ global$3.each(meta, function (value, key) {
+ rootControl.find('#' + key).value(value);
+ });
+ if (!meta.width && !meta.height) {
+ srcURL = editor.convertURL(control.value(), 'src');
+ prependURL = $_9cq6y3c6jfuw8p0n.getPrependUrl(editor);
+ absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i');
+ if (prependURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, prependURL.length) !== prependURL) {
+ srcURL = prependURL + srcURL;
+ }
+ control.value(srcURL);
+ $_7v7yldc7jfuw8p0q.getImageSize(editor.documentBaseURI.toAbsolute(control.value()), function (data) {
+ if (data.width && data.height && $_9cq6y3c6jfuw8p0n.hasDimensions(editor)) {
+ rootControl.find('#width').value(data.width);
+ rootControl.find('#height').value(data.height);
+ $_1ahiincmjfuw8p2c.syncSize(rootControl);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function updateVSpaceHSpaceBorder() {
- if (!editor.settings.image_advtab) {
- return;
- }
-
- var data = win.toJSON(),
- css = dom.parseStyle(data.style);
-
- win.find('#vspace').value("");
- win.find('#hspace').value("");
-
- css = Utils.mergeMargins(css);
-
- //Move opposite equal margins to vspace/hspace field
- if ((css['margin-top'] && css['margin-bottom']) || (css['margin-right'] && css['margin-left'])) {
- if (css['margin-top'] === css['margin-bottom']) {
- win.find('#vspace').value(Utils.removePixelSuffix(css['margin-top']));
- } else {
- win.find('#vspace').value('');
- }
- if (css['margin-right'] === css['margin-left']) {
- win.find('#hspace').value(Utils.removePixelSuffix(css['margin-right']));
- } else {
- win.find('#hspace').value('');
- }
- }
-
- //Move border-width
- if (css['border-width']) {
- win.find('#border').value(Utils.removePixelSuffix(css['border-width']));
- }
-
- win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
- }
-
- function waitLoad(imgElm) {
- function selectImage() {
- imgElm.onload = imgElm.onerror = null;
-
- if (editor.selection) {
- editor.selection.select(imgElm);
- editor.nodeChanged();
- }
- }
-
- imgElm.onload = function () {
- if (!data.width && !data.height && imageDimensions) {
- dom.setAttribs(imgElm, {
- width: imgElm.clientWidth,
- height: imgElm.clientHeight
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ };
+ var onBeforeCall = function (evt) {
+ evt.meta = evt.control.rootControl.toJSON();
+ };
+ var getGeneralItems = function (editor, imageListCtrl) {
+ var generalFormItems = [
+ {
+ name: 'src',
+ type: 'filepicker',
+ filetype: 'image',
+ label: 'Source',
+ autofocus: true,
+ onchange: function (evt) {
+ onSrcChange(evt, editor);
+ },
+ onbeforecall: onBeforeCall
+ },
+ imageListCtrl
+ ];
+ if ($_9cq6y3c6jfuw8p0n.hasDescription(editor)) {
+ generalFormItems.push({
+ name: 'alt',
+ type: 'textbox',
+ label: 'Image description'
+ });
+ }
+ if ($_9cq6y3c6jfuw8p0n.hasImageTitle(editor)) {
+ generalFormItems.push({
+ name: 'title',
+ type: 'textbox',
+ label: 'Image Title'
+ });
+ }
+ if ($_9cq6y3c6jfuw8p0n.hasDimensions(editor)) {
+ generalFormItems.push($_1ahiincmjfuw8p2c.createUi());
+ }
+ if ($_9cq6y3c6jfuw8p0n.getClassList(editor)) {
+ generalFormItems.push({
+ name: 'class',
+ type: 'listbox',
+ label: 'Class',
+ values: $_7v7yldc7jfuw8p0q.buildListItems($_9cq6y3c6jfuw8p0n.getClassList(editor), function (item) {
+ if (item.value) {
+ item.textStyle = function () {
+ return editor.formatter.getCssText({
+ inline: 'img',
+ classes: [item.value]
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- selectImage();
- };
-
- imgElm.onerror = selectImage;
- }
-
- function onSubmitForm() {
- var figureElm, oldImg;
-
- updateStyle();
- recalcSize();
-
- data = Tools.extend(data, win.toJSON());
-
- if (!data.alt) {
- data.alt = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ })
+ });
+ }
+ if ($_9cq6y3c6jfuw8p0n.hasImageCaption(editor)) {
+ generalFormItems.push({
+ name: 'caption',
+ type: 'checkbox',
+ label: 'Caption'
+ });
+ }
+ return generalFormItems;
+ };
+ var makeTab$1 = function (editor, imageListCtrl) {
+ return {
+ title: 'General',
+ type: 'form',
+ items: getGeneralItems(editor, imageListCtrl)
+ };
+ };
+ var $_e4gxykcljfuw8p29 = {
+ makeTab: makeTab$1,
+ getGeneralItems: getGeneralItems
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (!data.title) {
- data.title = '';
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var url = function () {
+ return $_ba69mec9jfuw8p15.getOrDie('URL');
+ };
+ var createObjectURL = function (blob) {
+ return url().createObjectURL(blob);
+ };
+ var revokeObjectURL = function (u) {
+ url().revokeObjectURL(u);
+ };
+ var $_52xhfhcojfuw8p2i = {
+ createObjectURL: createObjectURL,
+ revokeObjectURL: revokeObjectURL
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (data.width === '') {
- data.width = null;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$6 = tinymce.util.Tools.resolve('tinymce.ui.Factory');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (data.height === '') {
- data.height = null;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function XMLHttpRequest () {
+ var f = $_ba69mec9jfuw8p15.getOrDie('XMLHttpRequest');
+ return new f();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (!data.style) {
- data.style = null;
- }
-
- // Setup new data excluding style properties
- /*eslint dot-notation: 0*/
- data = {
- src: data.src,
- alt: data.alt,
- title: data.title,
- width: data.width,
- height: data.height,
- style: data.style,
- caption: data.caption,
- "class": data["class"]
- };
-
- editor.undoManager.transact(function () {
- if (!data.src) {
- if (imgElm) {
- var elm = dom.is(imgElm.parentNode, 'figure.image') ? imgElm.parentNode : imgElm;
- dom.remove(elm);
- editor.focus();
- editor.nodeChanged();
-
- if (dom.isEmpty(editor.getBody())) {
- editor.setContent('');
- editor.selection.setCursorLocation();
- }
- }
-
- return;
- }
-
- if (data.title === "") {
- data.title = null;
- }
-
- if (!imgElm) {
- data.id = '__mcenew';
- editor.focus();
- editor.selection.setContent(dom.createHTML('img', data));
- imgElm = dom.get('__mcenew');
- dom.setAttrib(imgElm, 'id', null);
- } else {
- dom.setAttribs(imgElm, data);
- }
-
- editor.editorUpload.uploadImagesAuto();
-
- if (data.caption === false) {
- if (dom.is(imgElm.parentNode, 'figure.image')) {
- figureElm = imgElm.parentNode;
- dom.setAttrib(imgElm, 'contenteditable', null);
- dom.insertAfter(imgElm, figureElm);
- dom.remove(figureElm);
- editor.selection.select(imgElm);
- editor.nodeChanged();
- }
- }
-
- if (data.caption === true) {
- if (!dom.is(imgElm.parentNode, 'figure.image')) {
- oldImg = imgElm;
- imgElm = imgElm.cloneNode(true);
- imgElm.contentEditable = true;
- figureElm = dom.create('figure', { 'class': 'image' });
- figureElm.appendChild(imgElm);
- figureElm.appendChild(dom.create('figcaption', { contentEditable: true }, 'Caption'));
- figureElm.contentEditable = false;
-
- var textBlock = dom.getParent(oldImg, isTextBlock);
- if (textBlock) {
- dom.split(textBlock, oldImg, figureElm);
- } else {
- dom.replace(figureElm, oldImg);
- }
-
- editor.selection.select(figureElm);
- }
-
- return;
- }
-
- waitLoad(imgElm);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var noop = function () {
+ };
+ var pathJoin = function (path1, path2) {
+ if (path1) {
+ return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, '');
+ }
+ return path2;
+ };
+ function Uploader (settings) {
+ var defaultHandler = function (blobInfo, success, failure, progress) {
+ var xhr, formData;
+ xhr = new XMLHttpRequest();
+ xhr.open('POST', settings.url);
+ xhr.withCredentials = settings.credentials;
+ xhr.upload.onprogress = function (e) {
+ progress(e.loaded / e.total * 100);
+ };
+ xhr.onerror = function () {
+ failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);
+ };
+ xhr.onload = function () {
+ var json;
+ if (xhr.status < 200 || xhr.status >= 300) {
+ failure('HTTP Error: ' + xhr.status);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function onSrcChange(e) {
- var srcURL, prependURL, absoluteURLPattern, meta = e.meta || {};
-
- if (imageListCtrl) {
- imageListCtrl.value(editor.convertURL(this.value(), 'src'));
- }
-
- Tools.each(meta, function (value, key) {
- win.find('#' + key).value(value);
- });
-
- if (!meta.width && !meta.height) {
- srcURL = editor.convertURL(this.value(), 'src');
-
- // Pattern test the src url and make sure we haven't already prepended the url
- prependURL = editor.settings.image_prepend_url;
- absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i');
- if (prependURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, prependURL.length) !== prependURL) {
- srcURL = prependURL + srcURL;
- }
-
- this.value(srcURL);
-
- Utils.getImageSize(editor.documentBaseURI.toAbsolute(this.value()), function (data) {
- if (data.width && data.height && imageDimensions) {
- width = data.width;
- height = data.height;
-
- win.find('#width').value(width);
- win.find('#height').value(height);
- }
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ json = JSON.parse(xhr.responseText);
+ if (!json || typeof json.location !== 'string') {
+ failure('Invalid JSON: ' + xhr.responseText);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function onBeforeCall(e) {
- e.meta = win.toJSON();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ success(pathJoin(settings.basePath, json.location));
+ };
+ formData = new FormData();
+ formData.append('file', blobInfo.blob(), blobInfo.filename());
+ xhr.send(formData);
+ };
+ var uploadBlob = function (blobInfo, handler) {
+ return new global$2(function (resolve, reject) {
+ try {
+ handler(blobInfo, resolve, reject, noop);
+ } catch (ex) {
+ reject(ex.message);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var isDefaultHandler = function (handler) {
+ return handler === defaultHandler;
+ };
+ var upload = function (blobInfo) {
+ return !settings.url && isDefaultHandler(settings.handler) ? global$2.reject('Upload url missing from the settings.') : uploadBlob(blobInfo, settings.handler);
+ };
+ settings = global$3.extend({
+ credentials: false,
+ handler: defaultHandler
+ }, settings);
+ return { upload: upload };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- imgElm = editor.selection.getNode();
- figureElm = dom.getParent(imgElm, 'figure.image');
- if (figureElm) {
- imgElm = dom.select('img', figureElm)[0];
- }
-
- if (imgElm &&
- (imgElm.nodeName != 'IMG' ||
- imgElm.getAttribute('data-mce-object') ||
- imgElm.getAttribute('data-mce-placeholder'))) {
- imgElm = null;
- }
-
- if (imgElm) {
- width = dom.getAttrib(imgElm, 'width');
- height = dom.getAttrib(imgElm, 'height');
-
- data = {
- src: dom.getAttrib(imgElm, 'src'),
- alt: dom.getAttrib(imgElm, 'alt'),
- title: dom.getAttrib(imgElm, 'title'),
- "class": dom.getAttrib(imgElm, 'class'),
- width: width,
- height: height,
- caption: !!figureElm
- };
- }
-
- if (imageList) {
- imageListCtrl = {
- type: 'listbox',
- label: 'Image list',
- values: Utils.buildListItems(
- imageList,
- function (item) {
- item.value = editor.convertURL(item.value || item.url, 'src');
- },
- [{ text: 'None', value: '' }]
- ),
- value: data.src && editor.convertURL(data.src, 'src'),
- onselect: function (e) {
- var altCtrl = win.find('#alt');
-
- if (!altCtrl.value() || (e.lastControl && altCtrl.value() == e.lastControl.text())) {
- altCtrl.value(e.control.text());
- }
-
- win.find('#src').value(e.control.value()).fire('change');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var onFileInput = function (editor) {
+ return function (evt) {
+ var Throbber = global$6.get('Throbber');
+ var rootControl = evt.control.rootControl;
+ var throbber = new Throbber(rootControl.getEl());
+ var file = evt.control.value();
+ var blobUri = $_52xhfhcojfuw8p2i.createObjectURL(file);
+ var uploader = Uploader({
+ url: $_9cq6y3c6jfuw8p0n.getUploadUrl(editor),
+ basePath: $_9cq6y3c6jfuw8p0n.getUploadBasePath(editor),
+ credentials: $_9cq6y3c6jfuw8p0n.getUploadCredentials(editor),
+ handler: $_9cq6y3c6jfuw8p0n.getUploadHandler(editor)
+ });
+ var finalize = function () {
+ throbber.hide();
+ $_52xhfhcojfuw8p2i.revokeObjectURL(blobUri);
+ };
+ throbber.show();
+ return $_7v7yldc7jfuw8p0q.blobToDataUri(file).then(function (dataUrl) {
+ var blobInfo = editor.editorUpload.blobCache.create({
+ blob: file,
+ blobUri: blobUri,
+ name: file.name ? file.name.replace(/\.[^\.]+$/, '') : null,
+ base64: dataUrl.split(',')[1]
+ });
+ return uploader.upload(blobInfo).then(function (url) {
+ var src = rootControl.find('#src');
+ src.value(url);
+ rootControl.find('tabpanel')[0].activateTab(0);
+ src.fire('change');
+ finalize();
+ return url;
+ });
+ }).catch(function (err) {
+ editor.windowManager.alert(err);
+ finalize();
+ });
+ };
+ };
+ var acceptExts = '.jpg,.jpeg,.png,.gif';
+ var makeTab$2 = function (editor) {
+ return {
+ title: 'Upload',
+ type: 'form',
+ layout: 'flex',
+ direction: 'column',
+ align: 'stretch',
+ padding: '20 20 20 20',
+ items: [
+ {
+ type: 'container',
+ layout: 'flex',
+ direction: 'column',
+ align: 'center',
+ spacing: 10,
+ items: [
+ {
+ text: 'Browse for an image',
+ type: 'browsebutton',
+ accept: acceptExts,
+ onchange: onFileInput(editor)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- onPostRender: function () {
- /*eslint consistent-this: 0*/
- imageListCtrl = this;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ text: 'OR',
+ type: 'label'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ]
+ },
+ {
+ text: 'Drop an image here',
+ type: 'dropzone',
+ accept: acceptExts,
+ height: 100,
+ onchange: onFileInput(editor)
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ]
+ };
+ };
+ var $_9k5u99cnjfuw8p2f = { makeTab: makeTab$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (editor.settings.image_class_list) {
- classListCtrl = {
- name: 'class',
- type: 'listbox',
- label: 'Class',
- values: Utils.buildListItems(
- editor.settings.image_class_list,
- function (item) {
- if (item.value) {
- item.textStyle = function () {
- return editor.formatter.getCssText({ inline: 'img', classes: [item.value] });
- };
- }
- }
- )
- };
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var noop$1 = function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ };
+ var noarg = function (f) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return f();
+ };
+ };
+ var compose = function (fa, fb) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return fa(fb.apply(null, arguments));
+ };
+ };
+ var constant = function (value) {
+ return function () {
+ return value;
+ };
+ };
+ var identity = function (x) {
+ return x;
+ };
+ var tripleEquals = function (a, b) {
+ return a === b;
+ };
+ var curry = function (f) {
+ var x = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ x[_i - 1] = arguments[_i];
+ }
+ var args = new Array(arguments.length - 1);
+ for (var i = 1; i < arguments.length; i++)
+ args[i - 1] = arguments[i];
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ var newArgs = new Array(arguments.length);
+ for (var j = 0; j < newArgs.length; j++)
+ newArgs[j] = arguments[j];
+ var all = args.concat(newArgs);
+ return f.apply(null, all);
+ };
+ };
+ var not = function (f) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return !f.apply(null, arguments);
+ };
+ };
+ var die = function (msg) {
+ return function () {
+ throw new Error(msg);
+ };
+ };
+ var apply = function (f) {
+ return f();
+ };
+ var call = function (f) {
+ f();
+ };
+ var never = constant(false);
+ var always = constant(true);
+ var $_ajqvh7csjfuw8p2q = {
+ noop: noop$1,
+ noarg: noarg,
+ compose: compose,
+ constant: constant,
+ identity: identity,
+ tripleEquals: tripleEquals,
+ curry: curry,
+ not: not,
+ die: die,
+ apply: apply,
+ call: call,
+ never: never,
+ always: always
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // General settings shared between simple and advanced dialogs
- var generalFormItems = [
- {
- name: 'src',
- type: 'filepicker',
- filetype: 'image',
- label: 'Source',
- autofocus: true,
- onchange: onSrcChange,
- onbeforecall: onBeforeCall
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var submitForm = function (editor, evt) {
+ var win = evt.control.getRoot();
+ $_1ahiincmjfuw8p2c.updateSize(win);
+ editor.undoManager.transact(function () {
+ var data = $_ajpvnqcjjfuw8p25.merge(readImageDataFromSelection(editor), win.toJSON());
+ insertOrUpdateImage(editor, data);
+ });
+ editor.editorUpload.uploadImagesAuto();
+ };
+ function Dialog (editor) {
+ function showDialog(imageList) {
+ var data = readImageDataFromSelection(editor);
+ var win, imageListCtrl;
+ if (imageList) {
+ imageListCtrl = {
+ type: 'listbox',
+ label: 'Image list',
+ name: 'image-list',
+ values: $_7v7yldc7jfuw8p0q.buildListItems(imageList, function (item) {
+ item.value = editor.convertURL(item.value || item.url, 'src');
+ }, [{
+ text: 'None',
+ value: ''
+ }]),
+ value: data.src && editor.convertURL(data.src, 'src'),
+ onselect: function (e) {
+ var altCtrl = win.find('#alt');
+ if (!altCtrl.value() || e.lastControl && altCtrl.value() === e.lastControl.text()) {
+ altCtrl.value(e.control.text());
+ }
+ win.find('#src').value(e.control.value()).fire('change');
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- imageListCtrl
- ];
-
- if (editor.settings.image_description !== false) {
- generalFormItems.push({ name: 'alt', type: 'textbox', label: 'Image description' });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ onPostRender: function () {
+ imageListCtrl = this;
+ }
+ };
+ }
+ if ($_9cq6y3c6jfuw8p0n.hasAdvTab(editor) || $_9cq6y3c6jfuw8p0n.hasUploadUrl(editor) || $_9cq6y3c6jfuw8p0n.hasUploadHandler(editor)) {
+ var body = [$_e4gxykcljfuw8p29.makeTab(editor, imageListCtrl)];
+ if ($_9cq6y3c6jfuw8p0n.hasAdvTab(editor)) {
+ body.push($_dlliegcfjfuw8p1m.makeTab(editor));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (editor.settings.image_title) {
- generalFormItems.push({ name: 'title', type: 'textbox', label: 'Image Title' });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_9cq6y3c6jfuw8p0n.hasUploadUrl(editor) || $_9cq6y3c6jfuw8p0n.hasUploadHandler(editor)) {
+ body.push($_9k5u99cnjfuw8p2f.makeTab(editor));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ win = editor.windowManager.open({
+ title: 'Insert/edit image',
+ data: data,
+ bodyType: 'tabpanel',
+ body: body,
+ onSubmit: $_ajqvh7csjfuw8p2q.curry(submitForm, editor)
+ });
+ } else {
+ win = editor.windowManager.open({
+ title: 'Insert/edit image',
+ data: data,
+ body: $_e4gxykcljfuw8p29.getGeneralItems(editor, imageListCtrl),
+ onSubmit: $_ajqvh7csjfuw8p2q.curry(submitForm, editor)
+ });
+ }
+ $_1ahiincmjfuw8p2c.syncSize(win);
+ }
+ function open() {
+ $_7v7yldc7jfuw8p0q.createImageList(editor, showDialog);
+ }
+ return { open: open };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (imageDimensions) {
- generalFormItems.push({
- type: 'container',
- label: 'Dimensions',
- layout: 'flex',
- direction: 'row',
- align: 'center',
- spacing: 5,
- items: [
- { name: 'width', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Width' },
- { type: 'label', text: 'x' },
- { name: 'height', type: 'textbox', maxLength: 5, size: 3, onchange: recalcSize, ariaLabel: 'Height' },
- { name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions' }
- ]
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor) {
+ editor.addCommand('mceImage', Dialog(editor).open);
+ };
+ var $_cbuvmdc4jfuw8p0d = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- generalFormItems.push(classListCtrl);
-
- if (editor.settings.image_caption && Env.ceFalse) {
- generalFormItems.push({ name: 'caption', type: 'checkbox', label: 'Caption' });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasImageClass = function (node) {
+ var className = node.attr('class');
+ return className && /\bimage\b/.test(className);
+ };
+ var toggleContentEditableState = function (state) {
+ return function (nodes) {
+ var i = nodes.length, node;
+ var toggleContentEditable = function (node) {
+ node.attr('contenteditable', state ? 'true' : null);
+ };
+ while (i--) {
+ node = nodes[i];
+ if (hasImageClass(node)) {
+ node.attr('contenteditable', state ? 'false' : null);
+ global$3.each(node.getAll('figcaption'), toggleContentEditable);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (editor.settings.image_advtab || editor.settings.images_upload_url) {
- var body = [
- {
- title: 'General',
- type: 'form',
- items: generalFormItems
- }
- ];
-
- if (editor.settings.image_advtab) {
- // Parse styles from img
- if (imgElm) {
- if (imgElm.style.marginLeft && imgElm.style.marginRight && imgElm.style.marginLeft === imgElm.style.marginRight) {
- data.hspace = Utils.removePixelSuffix(imgElm.style.marginLeft);
- }
- if (imgElm.style.marginTop && imgElm.style.marginBottom && imgElm.style.marginTop === imgElm.style.marginBottom) {
- data.vspace = Utils.removePixelSuffix(imgElm.style.marginTop);
- }
- if (imgElm.style.borderWidth) {
- data.border = Utils.removePixelSuffix(imgElm.style.borderWidth);
- }
-
- data.style = editor.dom.serializeStyle(editor.dom.parseStyle(editor.dom.getAttrib(imgElm, 'style')));
- }
-
- body.push({
- title: 'Advanced',
- type: 'form',
- pack: 'start',
- items: [
- {
- label: 'Style',
- name: 'style',
- type: 'textbox',
- onchange: updateVSpaceHSpaceBorder
- },
- {
- type: 'form',
- layout: 'grid',
- packV: 'start',
- columns: 2,
- padding: 0,
- alignH: ['left', 'right'],
- defaults: {
- type: 'textbox',
- maxWidth: 50,
- onchange: updateStyle
- },
- items: [
- { label: 'Vertical space', name: 'vspace' },
- { label: 'Horizontal space', name: 'hspace' },
- { label: 'Border', name: 'border' }
- ]
- }
- ]
- });
- }
-
- if (editor.settings.images_upload_url) {
- var acceptExts = '.jpg,.jpeg,.png,.gif';
-
- var uploadTab = {
- title: 'Upload',
- type: 'form',
- layout: 'flex',
- direction: 'column',
- align: 'stretch',
- padding: '20 20 20 20',
- items: [
- {
- type: 'container',
- layout: 'flex',
- direction: 'column',
- align: 'center',
- spacing: 10,
- items: [
- {
- text: "Browse for an image",
- type: 'browsebutton',
- accept: acceptExts,
- onchange: onFileInput
- },
- {
- text: 'OR',
- type: 'label'
- }
- ]
- },
- {
- text: "Drop an image here",
- type: 'dropzone',
- accept: acceptExts,
- height: 100,
- onchange: onFileInput
- }
- ]
- };
-
- body.push(uploadTab);
- }
-
- // Advanced dialog shows general+advanced tabs
- win = editor.windowManager.open({
- title: 'Insert/edit image',
- data: data,
- bodyType: 'tabpanel',
- body: body,
- onSubmit: onSubmitForm
- });
- } else {
- // Simple default dialog
- win = editor.windowManager.open({
- title: 'Insert/edit image',
- data: data,
- body: generalFormItems,
- onSubmit: onSubmitForm
- });
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ };
+ var setup = function (editor) {
+ editor.on('preInit', function () {
+ editor.parser.addNodeFilter('figure', toggleContentEditableState(true));
+ editor.serializer.addNodeFilter('figure', toggleContentEditableState(false));
+ });
+ };
+ var $_191db6ctjfuw8p2t = { setup: setup };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function open() {
- createImageList(showDialog);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register$1 = function (editor) {
+ editor.addButton('image', {
+ icon: 'image',
+ tooltip: 'Insert/edit image',
+ onclick: Dialog(editor).open,
+ stateSelector: 'img:not([data-mce-object],[data-mce-placeholder]),figure.image'
+ });
+ editor.addMenuItem('image', {
+ icon: 'image',
+ text: 'Image',
+ onclick: Dialog(editor).open,
+ context: 'insert',
+ prependToContext: true
+ });
+ };
+ var $_9nl4e0cujfuw8p2v = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- open: open
- };
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('image', function (editor) {
+ $_191db6ctjfuw8p2t.setup(editor);
+ $_9nl4e0cujfuw8p2v.register(editor);
+ $_cbuvmdc4jfuw8p0d.register(editor);
+ });
+ function Plugin () {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * This class contains all core logic for the image plugin.
- *
- * @class tinymce.image.Plugin
- * @private
- */
-define(
- 'tinymce.plugins.image.Plugin',
- [
- 'tinymce.core.PluginManager',
- 'tinymce.core.util.Tools',
- 'tinymce.plugins.image.ui.Dialog'
- ],
- function (PluginManager, Tools, Dialog) {
- PluginManager.add('image', function (editor) {
-
- editor.on('preInit', function () {
- function hasImageClass(node) {
- var className = node.attr('class');
- return className && /\bimage\b/.test(className);
- }
-
- function toggleContentEditableState(state) {
- return function (nodes) {
- var i = nodes.length, node;
-
- function toggleContentEditable(node) {
- node.attr('contenteditable', state ? 'true' : null);
- }
-
- while (i--) {
- node = nodes[i];
-
- if (hasImageClass(node)) {
- node.attr('contenteditable', state ? 'false' : null);
- Tools.each(node.getAll('figcaption'), toggleContentEditable);
- Tools.each(node.getAll('img'), toggleContentEditable);
- }
- }
- };
- }
-
- editor.parser.addNodeFilter('figure', toggleContentEditableState(true));
- editor.serializer.addNodeFilter('figure', toggleContentEditableState(false));
- });
-
- editor.addButton('image', {
- icon: 'image',
- tooltip: 'Insert/edit image',
- onclick: Dialog(editor).open,
- stateSelector: 'img:not([data-mce-object],[data-mce-placeholder]),figure.image'
- });
-
- editor.addMenuItem('image', {
- icon: 'image',
- text: 'Image',
- onclick: Dialog(editor).open,
- context: 'insert',
- prependToContext: true
- });
-
- editor.addCommand('mceImage', Dialog(editor).open);
- });
-
- return function () { };
- }
-);
-dem('tinymce.plugins.image.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginsimagepluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/image/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/image/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/image/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("4",tinymce.util.Tools.resolve),g("1",[&q
uot;4"],function(a){return a("tinymce.PluginManager")}),g("2",["4"],function(a){return a("tinymce.util.Tools")}),h("5",document),h("6",Math),h("7",RegExp),g("8",["4"],function(a){return a("tinymce.Env")}),g("9",["4"],function(a){return a("tinymce.ui.Factory")}),g("a",["4"],function(a){return a("tinymce.util.JSON")}),g("b",["4"],function(a){return a("tinymce.util.XHR")}),g("e",["4"],function(a){return a("tinymce.util.Promise")}),g("c",["e","2","5"],function(a,b,c){return function(c){function d(a,b){return a?a.replace(/\/$/,"")+"/"+b.replace(/^\//,""):b}function e(a,b,e,f){var g,h;g=new XMLHttpRequest,g.open("POST",c.url),g.withCredentials=c.credentials,g.upload.onprogress=function(a){
f(a.loaded/a.total*100)},g.onerror=function(){e("Image upload failed due to a XHR Transport error. Code: "+g.status)},g.onload=function(){var a;return g.status<200||g.status>=300?void e("HTTP Error: "+g.status):(a=JSON.parse(g.responseText),a&&"string"==typeof a.location?void b(d(c.basePath,a.location)):void e("Invalid JSON: "+g.responseText))},h=new FormData,h.append("file",a.blob(),a.filename()),g.send(h)}function f(b,c){return new a(function(a,d){try{c(b,a,d,i)}catch(a){d(a.message)}})}function g(a){return a===e}function h(b){return!c.url&&g(c.handler)?a.reject("Upload url missng from the settings."):f(b,c.handler)}var i=function(){};return c=b.extend({credentials:!1,handler:e},c),{upload:h}}}),g("d",["2","6","5"],function(a,b,c){var d=function(a,d){function e(a,b){f.parentNode&&f.parentNode.removeChild(f),d({width:a,height:b})}var f=c.createElement(&q
uot;img");f.onload=function(){e(b.max(f.width,f.clientWidth),b.max(f.height,f.clientHeight))},f.onerror=function(){e()};var g=f.style;g.visibility="hidden",g.position="fixed",g.bottom=g.left=0,g.width=g.height="auto",c.body.appendChild(f),f.src=a},e=function(b,c,d){function e(b,d){return d=d||[],a.each(b,function(a){var b={text:a.text||a.title};a.menu?b.menu=e(a.menu):(b.value=a.value,c(b)),d.push(b)}),d}return e(b,d||[])},f=function(a){return a&&(a=a.replace(/px$/,"")),a},g=function(a){return a.length>0&&/^[0-9]+$/.test(a)&&(a+="px"),a},h=function(a){if(a.margin){var b=a.margin.split(" ");switch(b.length){case 1:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[0],a["margin-bottom"]=a["margin-bottom"]||b[0],a["margin-left"]=a["margin-left"]||b[0];break;case 2:a["margin-top"]=a
["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[0],a["margin-left"]=a["margin-left"]||b[1];break;case 3:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[2],a["margin-left"]=a["margin-left"]||b[1];break;case 4:a["margin-top"]=a["margin-top"]||b[0],a["margin-right"]=a["margin-right"]||b[1],a["margin-bottom"]=a["margin-bottom"]||b[2],a["margin-left"]=a["margin-left"]||b[3]}delete a.margin}return a};return{getImageSize:d,buildListItems:e,removePixelSuffix:f,addPixelSuffix:g,mergeMargins:h}}),g("3",["5","6","7","8","9","a","2","b","c",&qu
ot;d"],function(a,b,c,d,e,f,g,h,i,j){return function(a){function k(b){var c=a.settings.image_list;"string"==typeof c?h.send({url:c,success:function(a){b(f.parse(a))}}):"function"==typeof c?c(b):b(c)}function l(f){function h(){var b=e.get("Throbber"),c=new b(s.getEl()),d=this.value(),f=new i({url:B.images_upload_url,basePath:B.images_upload_base_path,credentials:B.images_upload_credentials,handler:B.images_upload_handler}),g=a.editorUpload.blobCache.create({blob:d,name:d.name?d.name.replace(/\.[^\.]+$/,""):null,base64:"data:image/fake;base64,="}),h=function(){c.hide(),URL.revokeObjectURL(g.blobUri())};return c.show(),f.upload(g).then(function(a){var b=s.find("#src");return b.value(a),s.find("tabpanel")[0].activateTab(0),b.fire("change"),h(),a},function(b){a.windowManager.alert(b),h()})}function k(b){return a.schema.getTextBlockElements()[b.nodeName]}function l(){var a,c,d,e;a=s.find("#width"
;)[0],c=s.find("#height")[0],a&&c&&(d=a.value(),e=c.value(),s.find("#constrain")[0].checked()&&v&&w&&d&&e&&(v!=d?(e=b.round(d/v*e),isNaN(e)||c.value(e)):(d=b.round(e/w*d),isNaN(d)||a.value(d))),v=d,w=e)}function m(){if(a.settings.image_advtab){var b=s.toJSON(),c=A.parseStyle(b.style);c=j.mergeMargins(c),b.vspace&&(c["margin-top"]=c["margin-bottom"]=j.addPixelSuffix(b.vspace)),b.hspace&&(c["margin-left"]=c["margin-right"]=j.addPixelSuffix(b.hspace)),b.border&&(c["border-width"]=j.addPixelSuffix(b.border)),s.find("#style").value(A.serializeStyle(A.parseStyle(A.serializeStyle(c))))}}function n(){if(a.settings.image_advtab){var b=s.toJSON(),c=A.parseStyle(b.style);s.find("#vspace").value(""),s.find("#hspace").value(""),c=j.mergeMargins(c),(c["margin-top"]&&c["margin-b
ottom"]||c["margin-right"]&&c["margin-left"])&&(c["margin-top"]===c["margin-bottom"]?s.find("#vspace").value(j.removePixelSuffix(c["margin-top"])):s.find("#vspace").value(""),c["margin-right"]===c["margin-left"]?s.find("#hspace").value(j.removePixelSuffix(c["margin-right"])):s.find("#hspace").value("")),c["border-width"]&&s.find("#border").value(j.removePixelSuffix(c["border-width"])),s.find("#style").value(A.serializeStyle(A.parseStyle(A.serializeStyle(c))))}}function o(b){function c(){b.onload=b.onerror=null,a.selection&&(a.selection.select(b),a.nodeChanged())}b.onload=function(){z.width||z.height||!C||A.setAttribs(b,{width:b.clientWidth,height:b.clientHeight}),c()},b.onerror=c}function p(){var b,c;m(),l(),z=g.extend(z,s.toJSON()),z.alt||(z.alt=""),z.title||
(z.title=""),""===z.width&&(z.width=null),""===z.height&&(z.height=null),z.style||(z.style=null),z={src:z.src,alt:z.alt,title:z.title,width:z.width,height:z.height,style:z.style,caption:z.caption,"class":z["class"]},a.undoManager.transact(function(){if(z.src){if(""===z.title&&(z.title=null),t?A.setAttribs(t,z):(z.id="__mcenew",a.focus(),a.selection.setContent(A.createHTML("img",z)),t=A.get("__mcenew"),A.setAttrib(t,"id",null)),a.editorUpload.uploadImagesAuto(),z.caption===!1&&A.is(t.parentNode,"figure.image")&&(b=t.parentNode,A.setAttrib(t,"contenteditable",null),A.insertAfter(t,b),A.remove(b),a.selection.select(t),a.nodeChanged()),z.caption!==!0)o(t);else if(!A.is(t.parentNode,"figure.image")){c=t,t=t.cloneNode(!0),t.contentEditable=!0,b=A.create("figure",{"class":"image"}),b.appendChi
ld(t),b.appendChild(A.create("figcaption",{contentEditable:!0},"Caption")),b.contentEditable=!1;var d=A.getParent(c,k);d?A.split(d,c,b):A.replace(b,c),a.selection.select(b)}}else if(t){var e=A.is(t.parentNode,"figure.image")?t.parentNode:t;A.remove(e),a.focus(),a.nodeChanged(),A.isEmpty(a.getBody())&&(a.setContent(""),a.selection.setCursorLocation())}})}function q(b){var d,e,f,h=b.meta||{};x&&x.value(a.convertURL(this.value(),"src")),g.each(h,function(a,b){s.find("#"+b).value(a)}),h.width||h.height||(d=a.convertURL(this.value(),"src"),e=a.settings.image_prepend_url,f=new c("^(?:[a-z]+:)?//","i"),e&&!f.test(d)&&d.substring(0,e.length)!==e&&(d=e+d),this.value(d),j.getImageSize(a.documentBaseURI.toAbsolute(this.value()),function(a){a.width&&a.height&&C&&(v=a.width,w=a.height,s.find("#width").value(v),s.find("#height&quo
t;).value(w))}))}function r(a){a.meta=s.toJSON()}var s,t,u,v,w,x,y,z={},A=a.dom,B=a.settings,C=B.image_dimensions!==!1;t=a.selection.getNode(),u=A.getParent(t,"figure.image"),u&&(t=A.select("img",u)[0]),t&&("IMG"!=t.nodeName||t.getAttribute("data-mce-object")||t.getAttribute("data-mce-placeholder"))&&(t=null),t&&(v=A.getAttrib(t,"width"),w=A.getAttrib(t,"height"),z={src:A.getAttrib(t,"src"),alt:A.getAttrib(t,"alt"),title:A.getAttrib(t,"title"),"class":A.getAttrib(t,"class"),width:v,height:w,caption:!!u}),f&&(x={type:"listbox",label:"Image list",values:j.buildListItems(f,function(b){b.value=a.convertURL(b.value||b.url,"src")},[{text:"None",value:""}]),value:z.src&&a.convertURL(z.src,"src"),onselect:function(a){var b=s.find("#alt");(!b.value()||a.last
Control&&b.value()==a.lastControl.text())&&b.value(a.control.text()),s.find("#src").value(a.control.value()).fire("change")},onPostRender:function(){x=this}}),a.settings.image_class_list&&(y={name:"class",type:"listbox",label:"Class",values:j.buildListItems(a.settings.image_class_list,function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"img",classes:[b.value]})})})});var D=[{name:"src",type:"filepicker",filetype:"image",label:"Source",autofocus:!0,onchange:q,onbeforecall:r},x];if(a.settings.image_description!==!1&&D.push({name:"alt",type:"textbox",label:"Image description"}),a.settings.image_title&&D.push({name:"title",type:"textbox",label:"Image Title"}),C&&D.push({type:"container",label:"Dimensions",layout:"flex&q
uot;,direction:"row",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:3,onchange:l,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:3,onchange:l,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}),D.push(y),a.settings.image_caption&&d.ceFalse&&D.push({name:"caption",type:"checkbox",label:"Caption"}),a.settings.image_advtab||a.settings.images_upload_url){var E=[{title:"General",type:"form",items:D}];if(a.settings.image_advtab&&(t&&(t.style.marginLeft&&t.style.marginRight&&t.style.marginLeft===t.style.marginRight&&(z.hspace=j.removePixelSuffix(t.style.marginLeft)),t.style.marginTop&&t.style.marginBottom&&t.style.marginTop==
=t.style.marginBottom&&(z.vspace=j.removePixelSuffix(t.style.marginTop)),t.style.borderWidth&&(z.border=j.removePixelSuffix(t.style.borderWidth)),z.style=a.dom.serializeStyle(a.dom.parseStyle(a.dom.getAttrib(t,"style")))),E.push({title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:n},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,alignH:["left","right"],defaults:{type:"textbox",maxWidth:50,onchange:m},items:[{label:"Vertical space",name:"vspace"},{label:"Horizontal space",name:"hspace"},{label:"Border",name:"border"}]}]})),a.settings.images_upload_url){var F=".jpg,.jpeg,.png,.gif",G={title:"Upload",type:"form",layout:"flex",direction:"column",align:"stretch",p
adding:"20 20 20 20",items:[{type:"container",layout:"flex",direction:"column",align:"center",spacing:10,items:[{text:"Browse for an image",type:"browsebutton",accept:F,onchange:h},{text:"OR",type:"label"}]},{text:"Drop an image here",type:"dropzone",accept:F,height:100,onchange:h}]};E.push(G)}s=a.windowManager.open({title:"Insert/edit image",data:z,bodyType:"tabpanel",body:E,onSubmit:p})}else s=a.windowManager.open({title:"Insert/edit image",data:z,body:D,onSubmit:p})}function m(){k(l)}return{open:m}}}),g("0",["1","2","3"],function(a,b,c){return a.add("image",function(a){a.on("preInit",function(){function c(a){var b=a.attr("class");return b&&/\bimage\b/.test(b)}function d(a){return function(d){function e(b){b.attr("contenteditable",a?"true":null)}f
or(var f,g=d.length;g--;)f=d[g],c(f)&&(f.attr("contenteditable",a?"false":null),b.each(f.getAll("figcaption"),e),b.each(f.getAll("img"),e))}}a.parser.addNodeFilter("figure",d(!0)),a.serializer.addNodeFilter("figure",d(!1))}),a.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:c(a).open,stateSelector:"img:not([data-mce-object],[data-mce-placeholder]),figure.image"}),a.addMenuItem("image",{icon:"image",text:"Image",onclick:c(a).open,context:"insert",prependToContext:!0}),a.addCommand("mceImage",c(a).open)}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),d={hasDimensions:function(e){return!1!==e.settings.image_dimensions},hasAdvTab:function(e){return!0===e.settings.image_advtab},getPrependUrl:function(e){return e.getParam("image_prepend_url","")},getClassList:function(e){return e.getParam("image_class_list")},hasDescription:function(e){return!1!==e.settings.image_description},hasImageTitle:function(e){return!0===e.settings.image_title},hasImageCaption:function(e){return!0===e.settings.image_caption},getImageList:function(e){return e.getParam("image_list",!1)},hasUploadUrl:function(e){return e.getParam("images_upload_url",!1)},hasUploadHandler:function(e){return e.getParam("images_upload_handler",!1)},getUploadUrl:function(e){return e.getParam("images_upload_url")},get
UploadHandler:function(e){return e.getParam("images_upload_handler")},getUploadBasePath:function(e){return e.getParam("images_upload_base_path")},getUploadCredentials:function(e){return e.getParam("images_upload_credentials")}},a="undefined"!=typeof window?window:Function("return this;")(),r=function(e,t){for(var n=t!==undefined&&null!==t?t:a,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n},i=function(e,t){var n=e.split(".");return r(n,t)},t={getOrDie:function(e,t){var n=i(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n}};function o(){return new(t.getOrDie("FileReader"))}var n=tinymce.util.Tools.resolve("tinymce.util.Promise"),f=tinymce.util.Tools.resolve("tinymce.util.Tools"),l=tinymce.util.Tools.resolve("tinymce.util.XHR"),u=function(e,t){return Math.max(parseInt(e,10),parseInt(t,10))},g={getImageS
ize:function(e,n){var r=document.createElement("img");function t(e,t){r.parentNode&&r.parentNode.removeChild(r),n({width:e,height:t})}r.onload=function(){t(u(r.width,r.clientWidth),u(r.height,r.clientHeight))},r.onerror=function(){t(0,0)};var a=r.style;a.visibility="hidden",a.position="fixed",a.bottom=a.left="0px",a.width=a.height="auto",document.body.appendChild(r),r.src=e},buildListItems:function(e,a,t){return function n(e,r){return r=r||[],f.each(e,function(e){var t={text:e.text||e.title};e.menu?t.menu=n(e.menu):(t.value=e.value,a(t)),r.push(t)}),r}(e,t||[])},removePixelSuffix:function(e){return e&&(e=e.replace(/px$/,"")),e},addPixelSuffix:function(e){return 0<e.length&&/^[0-9]+$/.test(e)&&(e+="px"),e},mergeMargins:function(e){if(e.margin){var t=e.margin.split(" ");switch(t.length){case 1:e["margin-top"]=e["margin-top"]||t[0],e["margin-right&
quot;]=e["margin-right"]||t[0],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[0];break;case 2:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[0],e["margin-left"]=e["margin-left"]||t[1];break;case 3:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[1];break;case 4:e["margin-top"]=e["margin-top"]||t[0],e["margin-right"]=e["margin-right"]||t[1],e["margin-bottom"]=e["margin-bottom"]||t[2],e["margin-left"]=e["margin-left"]||t[3]}delete e.margin}return e},createImageList:function(e,t){var n
=d.getImageList(e);"string"==typeof n?l.send({url:n,success:function(e){t(JSON.parse(e))}}):"function"==typeof n?n(t):t(n)},waitLoadImage:function(e,t,n){function r(){n.onload=n.onerror=null,e.selection&&(e.selection.select(n),e.nodeChanged())}n.onload=function(){t.width||t.height||!d.hasDimensions(e)||e.dom.setAttribs(n,{width:n.clientWidth,height:n.clientHeight}),r()},n.onerror=r},blobToDataUri:function(r){return new n(function(e,t){var n=new o;n.onload=function(){e(n.result)},n.onerror=function(){t(o.error.message)},n.readAsDataURL(r)})}},s=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(e)===t}},m={isString:c("string"),isObject:c("object"),isArr
ay:c("array"),isNull:c("null"),isBoolean:c("boolean"),isUndefined:c("undefined"),isFunction:c("function"),isNumber:c("number")},p=function(o){return function(){for(var e=new Array(arguments.length),t=0;t<e.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("Can't merge zero objects");for(var n={},r=0;r<e.length;r++){var a=e[r];for(var i in a)a.hasOwnProperty(i)&&(n[i]=o(n[i],a[i]))}return n}},h=p(function(e,t){return m.isObject(e)&&m.isObject(t)?h(e,t):t}),v=p(function(e,t){return t}),b={deepMerge:h,merge:v},y=s.DOM,x=function(e){return e.style.marginLeft&&e.style.marginRight&&e.style.marginLeft===e.style.marginRight?g.removePixelSuffix(e.style.marginLeft):""},w=function(e){return e.style.marginTop&&e.style.marginBottom&&e.style.marginTop===e.style.marginBottom?g.removePixelSuffix(e.style.marginTop):""},S=function(e){return e.style
.borderWidth?g.removePixelSuffix(e.style.borderWidth):""},U=function(e,t){return e.hasAttribute(t)?e.getAttribute(t):""},C=function(e,t){return e.style[t]?e.style[t]:""},T=function(e){return null!==e.parentNode&&"FIGURE"===e.parentNode.nodeName},P=function(e,t,n){e.setAttribute(t,n)},I=function(e){var t,n,r,a;T(e)?(a=(r=e).parentNode,y.insertAfter(r,a),y.remove(a)):(t=e,n=y.create("figure",{"class":"image"}),y.insertAfter(n,t),n.appendChild(t),n.appendChild(y.create("figcaption",{contentEditable:!0},"Caption")),n.contentEditable="false")},N=function(e,t){var n=e.getAttribute("style"),r=t(null!==n?n:"");0<r.length?(e.setAttribute("style",r),e.setAttribute("data-mce-style",r)):e.removeAttribute("style")},A=function(e,r){return function(e,t,n){e.style[t]?(e.style[t]=g.addPixelSuffix(n),N(e,r)):P(e,t,n)}},L=function(e,t){return
e.style[t]?g.removePixelSuffix(e.style[t]):U(e,t)},_=function(e,t){var n=g.addPixelSuffix(t);e.style.marginLeft=n,e.style.marginRight=n},O=function(e,t){var n=g.addPixelSuffix(t);e.style.marginTop=n,e.style.marginBottom=n},R=function(e,t){var n=g.addPixelSuffix(t);e.style.borderWidth=n},D=function(e,t){e.style.borderStyle=t},k=function(e){return"FIGURE"===e.nodeName},z=function(e,t){var n=document.createElement("img");return P(n,"style",t.style),(x(n)||""!==t.hspace)&&_(n,t.hspace),(w(n)||""!==t.vspace)&&O(n,t.vspace),(S(n)||""!==t.border)&&R(n,t.border),(C(n,"borderStyle")||""!==t.borderStyle)&&D(n,t.borderStyle),e(n.getAttribute("style"))},M=function(e,t){return{src:U(t,"src"),alt:U(t,"alt"),title:U(t,"title"),width:L(t,"width"),height:L(t,"height"),"class":U(t,"class"),style:e(U(t,"styl
e")),caption:T(t),hspace:x(t),vspace:w(t),border:S(t),borderStyle:C(t,"borderStyle")}},E=function(e,t,n,r,a){n[r]!==t[r]&&a(e,r,n[r])},H=function(r,a){return function(e,t,n){r(e,n),N(e,a)}},j=function(e,t,n){var r=M(e,n);E(n,r,t,"caption",function(e,t,n){return I(e)}),E(n,r,t,"src",P),E(n,r,t,"alt",P),E(n,r,t,"title",P),E(n,r,t,"width",A(0,e)),E(n,r,t,"height",A(0,e)),E(n,r,t,"class",P),E(n,r,t,"style",H(function(e,t){return P(e,"style",t)},e)),E(n,r,t,"hspace",H(_,e)),E(n,r,t,"vspace",H(O,e)),E(n,r,t,"border",H(R,e)),E(n,r,t,"borderStyle",H(D,e))},B=function(e,t){var n=e.dom.styles.parse(t),r=g.mergeMargins(n),a=e.dom.styles.parse(e.dom.styles.serialize(r));return e.dom.styles.serialize(a)},F=function(e){var t=e.selection.getNode(),n=e.dom.getParent(t,"figure.image");return n?e.dom.select("img",n)[0]:t&&
("IMG"!==t.nodeName||t.getAttribute("data-mce-object")||t.getAttribute("data-mce-placeholder"))?null:t},W=function(t,e){var n=t.dom,r=n.getParent(e.parentNode,function(e){return t.schema.getTextBlockElements()[e.nodeName]});return r?n.split(r,e):e},G=function(t){var e=F(t);return e?M(function(e){return B(t,e)},e):{src:"",alt:"",title:"",width:"",height:"","class":"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:""}},J=function(t,e){var n=function(e,t){var n=document.createElement("img");if(j(e,b.merge(t,{caption:!1}),n),P(n,"alt",t.alt),t.caption){var r=y.create("figure",{"class":"image"});return r.appendChild(n),r.appendChild(y.create("figcaption",{contentEditable:!0},"Caption")),r.contentEditable="false",r}return n}(function(e){return B(t,
e)},e);t.dom.setAttrib(n,"data-mce-id","__mcenew"),t.focus(),t.selection.setContent(n.outerHTML);var r=t.dom.select('*[data-mce-id="__mcenew"]')[0];if(t.dom.setAttrib(r,"data-mce-id",null),k(r)){var a=W(t,r);t.selection.select(a)}else t.selection.select(r)},V=function(e,t){var n=F(e);n?t.src?function(t,e){var n,r=F(t);if(j(function(e){return B(t,e)},e,r),n=r,t.dom.setAttrib(n,"src",n.getAttribute("src")),k(r.parentNode)){var a=r.parentNode;W(t,a),t.selection.select(r.parentNode)}else t.selection.select(r),g.waitLoadImage(t,e,r)}(e,t):function(e,t){if(t){var n=e.dom.is(t.parentNode,"figure.image")?t.parentNode:t;e.dom.remove(n),e.focus(),e.nodeChanged(),e.dom.isEmpty(e.getBody())&&(e.setContent(""),e.selection.setCursorLocation())}}(e,n):t.src&&J(e,t)},$=function(n,r){r.find("#style").each(function(e){var t=z(function(e){return B(n,e)},b.merge({src:"",alt:"",t
itle:"",width:"",height:"","class":"",style:"",caption:!1,hspace:"",vspace:"",border:"",borderStyle:""},r.toJSON()));e.value(t)})},X={makeTab:function(t){return{title:"Advanced",type:"form",pack:"start",items:[{label:"Style",name:"style",type:"textbox",onchange:(i=t,function(e){var t=i.dom,n=e.control.rootControl;if(d.hasAdvTab(i)){var r=n.toJSON(),a=t.parseStyle(r.style);n.find("#vspace").value(""),n.find("#hspace").value(""),((a=g.mergeMargins(a))["margin-top"]&&a["margin-bottom"]||a["margin-right"]&&a["margin-left"])&&(a["margin-top"]===a["margin-bottom"]?n.find("#vspace").value(g.removePixelSuffix(a["margin-top"])):n.find("#vspace").value(""),a["margin-rig
ht"]===a["margin-left"]?n.find("#hspace").value(g.removePixelSuffix(a["margin-right"])):n.find("#hspace").value("")),a["border-width"]?n.find("#border").value(g.removePixelSuffix(a["border-width"])):n.find("#border").value(""),a["border-style"]?n.find("#borderStyle").value(a["border-style"]):n.find("#borderStyle").value(""),n.find("#style").value(t.serializeStyle(t.parseStyle(t.serializeStyle(a))))}})},{type:"form",layout:"grid",packV:"start",columns:2,padding:0,defaults:{type:"textbox",maxWidth:50,onchange:function(e){$(t,e.control.rootControl)}},items:[{label:"Vertical space",name:"vspace"},{label:"Border width",name:"border"},{label:"Horizontal space",name:"hspace"},{label:"Border style",type:"listbox&quo
t;,name:"borderStyle",width:90,maxWidth:90,onselect:function(e){$(t,e.control.rootControl)},values:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]}]}]};var i}},q=function(e,t){e.state.set("oldVal",e.value()),t.state.set("oldVal",t.value())},K=function(e,t){var n=e.find("#width")[0],r=e.find("#height")[0],a=e.find("#constrain")[0];n&&r&&a&&t(n,r,a.checked())},Q=function(e,t,n){var r=e.state.get("oldVal&q
uot;),a=t.state.get("oldVal"),i=e.value(),o=t.value();n&&r&&a&&i&&o&&(i!==r?(o=Math.round(i/r*o),isNaN(o)||t.value(o)):(i=Math.round(o/a*i),isNaN(i)||e.value(i))),q(e,t)},Y=function(e){K(e,Q)},Z={createUi:function(){var e=function(e){Y(e.control.rootControl)};return{type:"container",label:"Dimensions",layout:"flex",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:5,onchange:e,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:5,onchange:e,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}},syncSize:function(e){K(e,q)},updateSize:Y},ee=function(e){e.meta=e.control.rootControl.toJSON()},te=function(c,e){var t=[{name:"src",type:"filepicker",filetype:"im
age",label:"Source",autofocus:!0,onchange:function(e){var t,n,r,a,i,o,l,u,s;n=c,o=(t=e).meta||{},l=t.control,u=l.rootControl,(s=u.find("#image-list")[0])&&s.value(n.convertURL(l.value(),"src")),f.each(o,function(e,t){u.find("#"+t).value(e)}),o.width||o.height||(r=n.convertURL(l.value(),"src"),a=d.getPrependUrl(n),i=new RegExp("^(?:[a-z]+:)?//","i"),a&&!i.test(r)&&r.substring(0,a.length)!==a&&(r=a+r),l.value(r),g.getImageSize(n.documentBaseURI.toAbsolute(l.value()),function(e){e.width&&e.height&&d.hasDimensions(n)&&(u.find("#width").value(e.width),u.find("#height").value(e.height),Z.syncSize(u))}))},onbeforecall:ee},e];return d.hasDescription(c)&&t.push({name:"alt",type:"textbox",label:"Image description"}),d.hasImageTitle(c)&&t.push({name:"title",type:"textbox",label:&q
uot;Image Title"}),d.hasDimensions(c)&&t.push(Z.createUi()),d.getClassList(c)&&t.push({name:"class",type:"listbox",label:"Class",values:g.buildListItems(d.getClassList(c),function(e){e.value&&(e.textStyle=function(){return c.formatter.getCssText({inline:"img",classes:[e.value]})})})}),d.hasImageCaption(c)&&t.push({name:"caption",type:"checkbox",label:"Caption"}),t},ne={makeTab:function(e,t){return{title:"General",type:"form",items:te(e,t)}},getGeneralItems:te},re=function(){return t.getOrDie("URL")},ae=function(e){return re().createObjectURL(e)},ie=function(e){re().revokeObjectURL(e)},oe=tinymce.util.Tools.resolve("tinymce.ui.Factory");function le(){return new(t.getOrDie("XMLHttpRequest"))}var ue=function(){},se=function(e,t){return e?e.replace(/\/$/,"")+"/"+t.replace(/^\//,""):t};function ce(o){var
t=function(e,t,n,r){var a,i;(a=new le).open("POST",o.url),a.withCredentials=o.credentials,a.upload.onprogress=function(e){r(e.loaded/e.total*100)},a.onerror=function(){n("Image upload failed due to a XHR Transport error. Code: "+a.status)},a.onload=function(){var e;a.status<200||300<=a.status?n("HTTP Error: "+a.status):(e=JSON.parse(a.responseText))&&"string"==typeof e.location?t(se(o.basePath,e.location)):n("Invalid JSON: "+a.responseText)},(i=new FormData).append("file",e.blob(),e.filename()),a.send(i)};return o=f.extend({credentials:!1,handler:t},o),{upload:function(e){return o.url||o.handler!==t?(r=e,a=o.handler,new n(function(e,t){try{a(r,e,t,ue)}catch(n){t(n.message)}})):n.reject("Upload url missing from the settings.");var r,a}}}var de=function(u){return function(e){var t=oe.get("Throbber"),n=e.control.rootControl,r=new t(n.getEl()),a=e.control.value(),i=ae(a),o=ce({url:d.getUploadU
rl(u),basePath:d.getUploadBasePath(u),credentials:d.getUploadCredentials(u),handler:d.getUploadHandler(u)}),l=function(){r.hide(),ie(i)};return r.show(),g.blobToDataUri(a).then(function(e){var t=u.editorUpload.blobCache.create({blob:a,blobUri:i,name:a.name?a.name.replace(/\.[^\.]+$/,""):null,base64:e.split(",")[1]});return o.upload(t).then(function(e){var t=n.find("#src");return t.value(e),n.find("tabpanel")[0].activateTab(0),t.fire("change"),l(),e})})["catch"](function(e){u.windowManager.alert(e),l()})}},fe=".jpg,.jpeg,.png,.gif",ge={makeTab:function(e){return{title:"Upload",type:"form",layout:"flex",direction:"column",align:"stretch",padding:"20 20 20 20",items:[{type:"container",layout:"flex",direction:"column",align:"center",spacing:10,items:[{text:"Browse for an image",type:"browsebutton",ac
cept:fe,onchange:de(e)},{text:"OR",type:"label"}]},{text:"Drop an image here",type:"dropzone",accept:fe,height:100,onchange:de(e)}]}}},me=function(e){return function(){return e}},pe={noop:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},noarg:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n()}},compose:function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,arguments))}},constant:me,identity:function(e){return e},tripleEquals:function(e,t){return e===t},curry:function(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var o=new Array(arguments.length-1),n=1;n<arguments.length;n++)o[n-1]=arguments[n];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var a=o.concat(n);return i.apply(null
,a)}},not:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,arguments)}},die:function(e){return function(){throw new Error(e)}},apply:function(e){return e()},call:function(e){e()},never:me(!1),always:me(!0)},he=function(t,e){var n=e.control.getRoot();Z.updateSize(n),t.undoManager.transact(function(){var e=b.merge(G(t),n.toJSON());V(t,e)}),t.editorUpload.uploadImagesAuto()};function ve(i){function e(e){var n,t,r=G(i);if(e&&(t={type:"listbox",label:"Image list",name:"image-list",values:g.buildListItems(e,function(e){e.value=i.convertURL(e.value||e.url,"src")},[{text:"None",value:""}]),value:r.src&&i.convertURL(r.src,"src"),onselect:function(e){var t=n.find("#alt");(!t.value()||e.lastControl&&t.value()===e.lastControl.text())&&t.value(e.control.text()),n.find("#src").value(e.control.value()).fire("cha
nge")},onPostRender:function(){t=this}}),d.hasAdvTab(i)||d.hasUploadUrl(i)||d.hasUploadHandler(i)){var a=[ne.makeTab(i,t)];d.hasAdvTab(i)&&a.push(X.makeTab(i)),(d.hasUploadUrl(i)||d.hasUploadHandler(i))&&a.push(ge.makeTab(i)),n=i.windowManager.open({title:"Insert/edit image",data:r,bodyType:"tabpanel",body:a,onSubmit:pe.curry(he,i)})}else n=i.windowManager.open({title:"Insert/edit image",data:r,body:ne.getGeneralItems(i,t),onSubmit:pe.curry(he,i)});Z.syncSize(n)}return{open:function(){g.createImageList(i,e)}}}var be=function(e){e.addCommand("mceImage",ve(e).open)},ye=function(i){return function(e){for(var t,n,r=e.length,a=function(e){e.attr("contenteditable",i?"true":null)};r--;)t=e[r],(n=t.attr("class"))&&/\bimage\b/.test(n)&&(t.attr("contenteditable",i?"false":null),f.each(t.getAll("figcaption"),a))}},xe=function(e){e.on("preInit",funct
ion(){e.parser.addNodeFilter("figure",ye(!0)),e.serializer.addNodeFilter("figure",ye(!1))})},we=function(e){e.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:ve(e).open,stateSelector:"img:not([data-mce-object],[data-mce-placeholder]),figure.image"}),e.addMenuItem("image",{icon:"image",text:"Image",onclick:ve(e).open,context:"insert",prependToContext:!0})};e.add("image",function(e){xe(e),we(e),be(e)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginslinkpluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/link/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/link/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/link/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,1174 +1,713 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var link = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
-
-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var assumeExternalTargets = function (editorSettings) {
+ return typeof editorSettings.link_assume_external_targets === 'boolean' ? editorSettings.link_assume_external_targets : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasContextToolbar = function (editorSettings) {
+ return typeof editorSettings.link_context_toolbar === 'boolean' ? editorSettings.link_context_toolbar : false;
+ };
+ var getLinkList = function (editorSettings) {
+ return editorSettings.link_list;
+ };
+ var hasDefaultLinkTarget = function (editorSettings) {
+ return typeof editorSettings.default_link_target === 'string';
+ };
+ var getDefaultLinkTarget = function (editorSettings) {
+ return editorSettings.default_link_target;
+ };
+ var getTargetList = function (editorSettings) {
+ return editorSettings.target_list;
+ };
+ var setTargetList = function (editor, list) {
+ editor.settings.target_list = list;
+ };
+ var shouldShowTargetList = function (editorSettings) {
+ return getTargetList(editorSettings) !== false;
+ };
+ var getRelList = function (editorSettings) {
+ return editorSettings.rel_list;
+ };
+ var hasRelList = function (editorSettings) {
+ return getRelList(editorSettings) !== undefined;
+ };
+ var getLinkClassList = function (editorSettings) {
+ return editorSettings.link_class_list;
+ };
+ var hasLinkClassList = function (editorSettings) {
+ return getLinkClassList(editorSettings) !== undefined;
+ };
+ var shouldShowLinkTitle = function (editorSettings) {
+ return editorSettings.link_title !== false;
+ };
+ var allowUnsafeLinkTarget = function (editorSettings) {
+ return typeof editorSettings.allow_unsafe_link_target === 'boolean' ? editorSettings.allow_unsafe_link_target : false;
+ };
+ var $_ae1yh4f3jfuw8pj4 = {
+ assumeExternalTargets: assumeExternalTargets,
+ hasContextToolbar: hasContextToolbar,
+ getLinkList: getLinkList,
+ hasDefaultLinkTarget: hasDefaultLinkTarget,
+ getDefaultLinkTarget: getDefaultLinkTarget,
+ getTargetList: getTargetList,
+ setTargetList: setTargetList,
+ shouldShowTargetList: shouldShowTargetList,
+ getRelList: getRelList,
+ hasRelList: hasRelList,
+ getLinkClassList: getLinkClassList,
+ hasLinkClassList: hasLinkClassList,
+ shouldShowLinkTitle: shouldShowLinkTitle,
+ allowUnsafeLinkTarget: allowUnsafeLinkTarget
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var appendClickRemove = function (link, evt) {
+ document.body.appendChild(link);
+ link.dispatchEvent(evt);
+ document.body.removeChild(link);
+ };
+ var open = function (url) {
+ if (!global$3.ie || global$3.ie > 10) {
+ var link = document.createElement('a');
+ link.target = '_blank';
+ link.href = url;
+ link.rel = 'noreferrer noopener';
+ var evt = document.createEvent('MouseEvents');
+ evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ appendClickRemove(link, evt);
+ } else {
+ var win = window.open('', '_blank');
+ if (win) {
+ win.opener = null;
+ var doc = win.document;
+ doc.open();
+ doc.write('<meta http-equiv="refresh" content="0; url=' + global$2.DOM.encode(url) + '">');
+ doc.close();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_2ksejbf4jfuw8pj6 = { open: open };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.link.Plugin","tinymce.core.PluginManager","tinymce.plugins.link.core.Actions","tinymce.plugins.link.ui.Controls","global!tinymce.util.Tools.resolve","tinymce.core.util.VK","tinymce.plugins.link.ui.Dialog","tinymce.plugins.link.core.OpenUrl","tinymce.plugins.link.core.Utils","tinymce.plugins.link.core.Settings","tinymce.core.util.Delay","tinymce.core.util.Tools","tinymce.core.util.XHR","global!RegExp","tinymce.core.dom.DOMUtils","tinymce.core.Env"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.VK',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.VK');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Delay',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Delay');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.XHR',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.XHR');
- }
-);
-
-define(
- 'tinymce.plugins.link.core.Settings',
- [
-
- ],
- function () {
- var assumeExternalTargets = function (editorSettings) {
- return typeof editorSettings.link_assume_external_targets === 'boolean' ? editorSettings.link_assume_external_targets : false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toggleTargetRules = function (rel, isUnsafe) {
+ var rules = ['noopener'];
+ var newRel = rel ? rel.split(/\s+/) : [];
+ var toString = function (rel) {
+ return global$4.trim(rel.sort().join(' '));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var hasContextToolbar = function (editorSettings) {
- return typeof editorSettings.link_context_toolbar === 'boolean' ? editorSettings.link_context_toolbar : false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addTargetRules = function (rel) {
+ rel = removeTargetRules(rel);
+ return rel.length ? rel.concat(rules) : rules;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getLinkList = function (editorSettings) {
- return editorSettings.link_list;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var removeTargetRules = function (rel) {
+ return rel.filter(function (val) {
+ return global$4.inArray(rules, val) === -1;
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var hasDefaultLinkTarget = function (editorSettings) {
- return typeof editorSettings.default_link_target === 'string';
- };
-
- var getDefaultLinkTarget = function (editorSettings) {
- return editorSettings.default_link_target;
- };
-
- var getTargetList = function (editorSettings) {
- return editorSettings.target_list;
- };
-
- var setTargetList = function (editor, list) {
- editor.settings.target_list = list;
- };
-
- var shouldShowTargetList = function (editorSettings) {
- return getTargetList(editorSettings) !== false;
- };
-
- var getRelList = function (editorSettings) {
- return editorSettings.rel_list;
- };
-
- var hasRelList = function (editorSettings) {
- return getRelList(editorSettings) !== undefined;
- };
-
- var getLinkClassList = function (editorSettings) {
- return editorSettings.link_class_list;
- };
-
- var hasLinkClassList = function (editorSettings) {
- return getLinkClassList(editorSettings) !== undefined;
- };
-
- var shouldShowLinkTitle = function (editorSettings) {
- return editorSettings.link_title !== false;
- };
-
- var allowUnsafeLinkTarget = function (editorSettings) {
- return typeof editorSettings.allow_unsafe_link_target === 'boolean' ? editorSettings.allow_unsafe_link_target : false;
- };
-
- return {
- assumeExternalTargets: assumeExternalTargets,
- hasContextToolbar: hasContextToolbar,
- getLinkList: getLinkList,
- hasDefaultLinkTarget: hasDefaultLinkTarget,
- getDefaultLinkTarget: getDefaultLinkTarget,
- getTargetList: getTargetList,
- setTargetList: setTargetList,
- shouldShowTargetList: shouldShowTargetList,
- getRelList: getRelList,
- hasRelList: hasRelList,
- getLinkClassList: getLinkClassList,
- hasLinkClassList: hasLinkClassList,
- shouldShowLinkTitle: shouldShowLinkTitle,
- allowUnsafeLinkTarget: allowUnsafeLinkTarget
- };
- }
-);
-
-defineGlobal("global!RegExp", RegExp);
-/**
- * Utils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.link.core.Utils',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.plugins.link.core.Settings',
- 'global!RegExp'
- ],
- function (Tools, Settings, RegExp) {
-
- var toggleTargetRules = function (rel, isUnsafe) {
- var rules = ['noopener'];
- var newRel = rel ? rel.split(/\s+/) : [];
-
- var toString = function (rel) {
- return Tools.trim(rel.sort().join(' '));
- };
-
- var addTargetRules = function (rel) {
- rel = removeTargetRules(rel);
- return rel.length ? rel.concat(rules) : rules;
- };
-
- var removeTargetRules = function (rel) {
- return rel.filter(function (val) {
- return Tools.inArray(rules, val) === -1;
- });
- };
-
- newRel = isUnsafe ? addTargetRules(newRel) : removeTargetRules(newRel);
- return newRel.length ? toString(newRel) : null;
- };
-
-
- var trimCaretContainers = function (text) {
- return text.replace(/\uFEFF/g, '');
- };
-
-
- var getAnchorElement = function (editor, selectedElm) {
- selectedElm = selectedElm || editor.selection.getStart();
- if (isImageFigure(selectedElm)) {
- // for an image conained in a figure we look for a link inside the selected element
- return editor.dom.select('a[href]', selectedElm)[0];
- } else {
- return editor.dom.getParent(selectedElm, 'a[href]');
- }
- };
-
-
- var getAnchorText = function (selection, anchorElm) {
- var text = anchorElm ? (anchorElm.innerText || anchorElm.textContent) : selection.getContent({ format: 'text' });
- return trimCaretContainers(text);
- };
-
-
- var isLink = function (elm) {
- return elm && elm.nodeName === 'A' && elm.href;
- };
-
- var hasLinks = function (elements) {
- return Tools.grep(elements, isLink).length > 0;
- };
-
-
- var isOnlyTextSelected = function (html) {
- // Partial html and not a fully selected anchor element
- if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') == -1)) {
- return false;
- }
-
- return true;
- };
-
-
- var isImageFigure = function (node) {
- return node && node.nodeName === 'FIGURE' && /\bimage\b/i.test(node.className);
- };
-
-
- var link = function (editor, attachState) {
- return function (data) {
- editor.undoManager.transact(function () {
- var selectedElm = editor.selection.getNode();
- var anchorElm = getAnchorElement(editor, selectedElm);
-
- var linkAttrs = {
- href: data.href,
- target: data.target ? data.target : null,
- rel: data.rel ? data.rel : null,
- "class": data["class"] ? data["class"] : null,
- title: data.title ? data.title : null
- };
-
- if (!Settings.hasRelList(editor.settings) && Settings.allowUnsafeLinkTarget(editor.settings) === false) {
- linkAttrs.rel = toggleTargetRules(linkAttrs.rel, linkAttrs.target == '_blank');
- }
-
- if (data.href === attachState.href) {
- attachState.attach();
- attachState = {};
- }
-
- if (anchorElm) {
- editor.focus();
-
- if (data.hasOwnProperty('text')) {
- if ("innerText" in anchorElm) {
- anchorElm.innerText = data.text;
- } else {
- anchorElm.textContent = data.text;
- }
- }
-
- editor.dom.setAttribs(anchorElm, linkAttrs);
-
- editor.selection.select(anchorElm);
- editor.undoManager.add();
- } else {
- if (isImageFigure(selectedElm)) {
- linkImageFigure(editor, selectedElm, linkAttrs);
- } else if (data.hasOwnProperty('text')) {
- editor.insertContent(editor.dom.createHTML('a', linkAttrs, editor.dom.encode(data.text)));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ newRel = isUnsafe ? addTargetRules(newRel) : removeTargetRules(newRel);
+ return newRel.length ? toString(newRel) : null;
+ };
+ var trimCaretContainers = function (text) {
+ return text.replace(/\uFEFF/g, '');
+ };
+ var getAnchorElement = function (editor, selectedElm) {
+ selectedElm = selectedElm || editor.selection.getNode();
+ if (isImageFigure(selectedElm)) {
+ return editor.dom.select('a[href]', selectedElm)[0];
+ } else {
+ return editor.dom.getParent(selectedElm, 'a[href]');
+ }
+ };
+ var getAnchorText = function (selection, anchorElm) {
+ var text = anchorElm ? anchorElm.innerText || anchorElm.textContent : selection.getContent({ format: 'text' });
+ return trimCaretContainers(text);
+ };
+ var isLink = function (elm) {
+ return elm && elm.nodeName === 'A' && elm.href;
+ };
+ var hasLinks = function (elements) {
+ return global$4.grep(elements, isLink).length > 0;
+ };
+ var isOnlyTextSelected = function (html) {
+ if (/</.test(html) && (!/^<a [^>]+>[^<]+<\/a>$/.test(html) || html.indexOf('href=') === -1)) {
+ return false;
+ }
+ return true;
+ };
+ var isImageFigure = function (node) {
+ return node && node.nodeName === 'FIGURE' && /\bimage\b/i.test(node.className);
+ };
+ var link = function (editor, attachState) {
+ return function (data) {
+ editor.undoManager.transact(function () {
+ var selectedElm = editor.selection.getNode();
+ var anchorElm = getAnchorElement(editor, selectedElm);
+ var linkAttrs = {
+ href: data.href,
+ target: data.target ? data.target : null,
+ rel: data.rel ? data.rel : null,
+ class: data.class ? data.class : null,
+ title: data.title ? data.title : null
+ };
+ if (!$_ae1yh4f3jfuw8pj4.hasRelList(editor.settings) && $_ae1yh4f3jfuw8pj4.allowUnsafeLinkTarget(editor.settings) === false) {
+ linkAttrs.rel = toggleTargetRules(linkAttrs.rel, linkAttrs.target === '_blank');
+ }
+ if (data.href === attachState.href) {
+ attachState.attach();
+ attachState = {};
+ }
+ if (anchorElm) {
+ editor.focus();
+ if (data.hasOwnProperty('text')) {
+ if ('innerText' in anchorElm) {
+ anchorElm.innerText = data.text;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.execCommand('mceInsertLink', false, linkAttrs);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ anchorElm.textContent = data.text;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- };
- };
-
-
- var unlink = function (editor) {
- return function () {
- editor.undoManager.transact(function () {
- var node = editor.selection.getNode();
- if (isImageFigure(node)) {
- unlinkImageFigure(editor, node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.dom.setAttribs(anchorElm, linkAttrs);
+ editor.selection.select(anchorElm);
+ editor.undoManager.add();
+ } else {
+ if (isImageFigure(selectedElm)) {
+ linkImageFigure(editor, selectedElm, linkAttrs);
+ } else if (data.hasOwnProperty('text')) {
+ editor.insertContent(editor.dom.createHTML('a', linkAttrs, editor.dom.encode(data.text)));
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.execCommand('unlink');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.execCommand('mceInsertLink', false, linkAttrs);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
- var unlinkImageFigure = function (editor, fig) {
- var a, img;
- img = editor.dom.select('img', fig)[0];
- if (img) {
- a = editor.dom.getParents(img, 'a[href]', fig)[0];
- if (a) {
- a.parentNode.insertBefore(img, a);
- editor.dom.remove(a);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var unlink = function (editor) {
+ return function () {
+ editor.undoManager.transact(function () {
+ var node = editor.selection.getNode();
+ if (isImageFigure(node)) {
+ unlinkImageFigure(editor, node);
+ } else {
+ editor.execCommand('unlink');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
- var linkImageFigure = function (editor, fig, attrs) {
- var a, img;
- img = editor.dom.select('img', fig)[0];
- if (img) {
- a = editor.dom.create('a', attrs);
- img.parentNode.insertBefore(a, img);
- a.appendChild(img);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var unlinkImageFigure = function (editor, fig) {
+ var a, img;
+ img = editor.dom.select('img', fig)[0];
+ if (img) {
+ a = editor.dom.getParents(img, 'a[href]', fig)[0];
+ if (a) {
+ a.parentNode.insertBefore(img, a);
+ editor.dom.remove(a);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var linkImageFigure = function (editor, fig, attrs) {
+ var a, img;
+ img = editor.dom.select('img', fig)[0];
+ if (img) {
+ a = editor.dom.create('a', attrs);
+ img.parentNode.insertBefore(a, img);
+ a.appendChild(img);
+ }
+ };
+ var $_fs5xf5f7jfuw8pjf = {
+ link: link,
+ unlink: unlink,
+ isLink: isLink,
+ hasLinks: hasLinks,
+ isOnlyTextSelected: isOnlyTextSelected,
+ getAnchorElement: getAnchorElement,
+ getAnchorText: getAnchorText,
+ toggleTargetRules: toggleTargetRules
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- link: link,
- unlink: unlink,
- isLink: isLink,
- hasLinks: hasLinks,
- isOnlyTextSelected: isOnlyTextSelected,
- getAnchorElement: getAnchorElement,
- getAnchorText: getAnchorText,
- toggleTargetRules: toggleTargetRules
- };
- }
-);
-/**
- * Dialog.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$5 = tinymce.util.Tools.resolve('tinymce.util.Delay');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.plugins.link.ui.Dialog',
- [
- 'tinymce.core.util.Delay',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.XHR',
- 'tinymce.plugins.link.core.Utils',
- 'tinymce.plugins.link.core.Settings'
- ],
- function (Delay, Tools, XHR, Utils, Settings) {
- var attachState = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$6 = tinymce.util.Tools.resolve('tinymce.util.XHR');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var createLinkList = function (editor, callback) {
- var linkList = Settings.getLinkList(editor.settings);
-
- if (typeof linkList == "string") {
- XHR.send({
- url: linkList,
- success: function (text) {
- callback(editor, JSON.parse(text));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var attachState = {};
+ var createLinkList = function (editor, callback) {
+ var linkList = $_ae1yh4f3jfuw8pj4.getLinkList(editor.settings);
+ if (typeof linkList === 'string') {
+ global$6.send({
+ url: linkList,
+ success: function (text) {
+ callback(editor, JSON.parse(text));
+ }
+ });
+ } else if (typeof linkList === 'function') {
+ linkList(function (list) {
+ callback(editor, list);
+ });
+ } else {
+ callback(editor, linkList);
+ }
+ };
+ var buildListItems = function (inputList, itemCallback, startItems) {
+ var appendItems = function (values, output) {
+ output = output || [];
+ global$4.each(values, function (item) {
+ var menuItem = { text: item.text || item.title };
+ if (item.menu) {
+ menuItem.menu = appendItems(item.menu);
+ } else {
+ menuItem.value = item.value;
+ if (itemCallback) {
+ itemCallback(menuItem);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ output.push(menuItem);
+ });
+ return output;
+ };
+ return appendItems(inputList, startItems || []);
+ };
+ var delayedConfirm = function (editor, message, callback) {
+ var rng = editor.selection.getRng();
+ global$5.setEditorTimeout(editor, function () {
+ editor.windowManager.confirm(message, function (state) {
+ editor.selection.setRng(rng);
+ callback(state);
+ });
+ });
+ };
+ var showDialog = function (editor, linkList) {
+ var data = {};
+ var selection = editor.selection;
+ var dom = editor.dom;
+ var anchorElm, initialText;
+ var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value;
+ var linkListChangeHandler = function (e) {
+ var textCtrl = win.find('#text');
+ if (!textCtrl.value() || e.lastControl && textCtrl.value() === e.lastControl.text()) {
+ textCtrl.value(e.control.text());
+ }
+ win.find('#href').value(e.control.value());
+ };
+ var buildAnchorListControl = function (url) {
+ var anchorList = [];
+ global$4.each(editor.dom.select('a:not([href])'), function (anchor) {
+ var id = anchor.name || anchor.id;
+ if (id) {
+ anchorList.push({
+ text: id,
+ value: '#' + id,
+ selected: url.indexOf('#' + id) !== -1
+ });
+ }
+ });
+ if (anchorList.length) {
+ anchorList.unshift({
+ text: 'None',
+ value: ''
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if (typeof linkList == "function") {
- linkList(function (list) {
- callback(editor, list);
- });
- } else {
- callback(editor, linkList);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return {
+ name: 'anchor',
+ type: 'listbox',
+ label: 'Anchors',
+ values: anchorList,
+ onselect: linkListChangeHandler
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var buildListItems = function (inputList, itemCallback, startItems) {
- var appendItems = function (values, output) {
- output = output || [];
-
- Tools.each(values, function (item) {
- var menuItem = { text: item.text || item.title };
-
- if (item.menu) {
- menuItem.menu = appendItems(item.menu);
- } else {
- menuItem.value = item.value;
-
- if (itemCallback) {
- itemCallback(menuItem);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var updateText = function () {
+ if (!initialText && onlyText && !data.text) {
+ this.parent().parent().find('#text')[0].value(this.value());
+ }
+ };
+ var urlChange = function (e) {
+ var meta = e.meta || {};
+ if (linkListCtrl) {
+ linkListCtrl.value(editor.convertURL(this.value(), 'href'));
+ }
+ global$4.each(e.meta, function (value, key) {
+ var inp = win.find('#' + key);
+ if (key === 'text') {
+ if (initialText.length === 0) {
+ inp.value(value);
+ data.text = value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- output.push(menuItem);
- });
-
- return output;
- };
-
- return appendItems(inputList, startItems || []);
- };
-
- // Delay confirm since onSubmit will move focus
- var delayedConfirm = function (editor, message, callback) {
- var rng = editor.selection.getRng();
-
- Delay.setEditorTimeout(editor, function () {
- editor.windowManager.confirm(message, function (state) {
- editor.selection.setRng(rng);
- callback(state);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ inp.value(value);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (meta.attach) {
+ attachState = {
+ href: this.value(),
+ attach: meta.attach
+ };
+ }
+ if (!meta.text) {
+ updateText.call(this);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var showDialog = function (editor, linkList) {
- var data = {}, selection = editor.selection, dom = editor.dom, anchorElm, initialText;
- var win, onlyText, textListCtrl, linkListCtrl, relListCtrl, targetListCtrl, classListCtrl, linkTitleCtrl, value;
-
- var linkListChangeHandler = function (e) {
- var textCtrl = win.find('#text');
-
- if (!textCtrl.value() || (e.lastControl && textCtrl.value() == e.lastControl.text())) {
- textCtrl.value(e.control.text());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var onBeforeCall = function (e) {
+ e.meta = win.toJSON();
+ };
+ onlyText = $_fs5xf5f7jfuw8pjf.isOnlyTextSelected(selection.getContent());
+ anchorElm = $_fs5xf5f7jfuw8pjf.getAnchorElement(editor);
+ data.text = initialText = $_fs5xf5f7jfuw8pjf.getAnchorText(editor.selection, anchorElm);
+ data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
+ if (anchorElm) {
+ data.target = dom.getAttrib(anchorElm, 'target');
+ } else if ($_ae1yh4f3jfuw8pj4.hasDefaultLinkTarget(editor.settings)) {
+ data.target = $_ae1yh4f3jfuw8pj4.getDefaultLinkTarget(editor.settings);
+ }
+ if (value = dom.getAttrib(anchorElm, 'rel')) {
+ data.rel = value;
+ }
+ if (value = dom.getAttrib(anchorElm, 'class')) {
+ data.class = value;
+ }
+ if (value = dom.getAttrib(anchorElm, 'title')) {
+ data.title = value;
+ }
+ if (onlyText) {
+ textListCtrl = {
+ name: 'text',
+ type: 'textbox',
+ size: 40,
+ label: 'Text to display',
+ onchange: function () {
+ data.text = this.value();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- win.find('#href').value(e.control.value());
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var buildAnchorListControl = function (url) {
- var anchorList = [];
-
- Tools.each(editor.dom.select('a:not([href])'), function (anchor) {
- var id = anchor.name || anchor.id;
-
- if (id) {
- anchorList.push({
- text: id,
- value: '#' + id,
- selected: url.indexOf('#' + id) != -1
- });
- }
- });
-
- if (anchorList.length) {
- anchorList.unshift({ text: 'None', value: '' });
-
- return {
- name: 'anchor',
- type: 'listbox',
- label: 'Anchors',
- values: anchorList,
- onselect: linkListChangeHandler
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (linkList) {
+ linkListCtrl = {
+ type: 'listbox',
+ label: 'Link list',
+ values: buildListItems(linkList, function (item) {
+ item.value = editor.convertURL(item.value || item.url, 'href');
+ }, [{
+ text: 'None',
+ value: ''
+ }]),
+ onselect: linkListChangeHandler,
+ value: editor.convertURL(data.href, 'href'),
+ onPostRender: function () {
+ linkListCtrl = this;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var updateText = function () {
- if (!initialText && onlyText && !data.text) {
- this.parent().parent().find('#text')[0].value(this.value());
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if ($_ae1yh4f3jfuw8pj4.shouldShowTargetList(editor.settings)) {
+ if ($_ae1yh4f3jfuw8pj4.getTargetList(editor.settings) === undefined) {
+ $_ae1yh4f3jfuw8pj4.setTargetList(editor, [
+ {
+ text: 'None',
+ value: ''
+ },
+ {
+ text: 'New window',
+ value: '_blank'
+ }
+ ]);
+ }
+ targetListCtrl = {
+ name: 'target',
+ type: 'listbox',
+ label: 'Target',
+ values: buildListItems($_ae1yh4f3jfuw8pj4.getTargetList(editor.settings))
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var urlChange = function (e) {
- var meta = e.meta || {};
-
- if (linkListCtrl) {
- linkListCtrl.value(editor.convertURL(this.value(), 'href'));
- }
-
- Tools.each(e.meta, function (value, key) {
- var inp = win.find('#' + key);
-
- if (key === 'text') {
- if (initialText.length === 0) {
- inp.value(value);
- data.text = value;
- }
- } else {
- inp.value(value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if ($_ae1yh4f3jfuw8pj4.hasRelList(editor.settings)) {
+ relListCtrl = {
+ name: 'rel',
+ type: 'listbox',
+ label: 'Rel',
+ values: buildListItems($_ae1yh4f3jfuw8pj4.getRelList(editor.settings), function (item) {
+ if ($_ae1yh4f3jfuw8pj4.allowUnsafeLinkTarget(editor.settings) === false) {
+ item.value = $_fs5xf5f7jfuw8pjf.toggleTargetRules(item.value, data.target === '_blank');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- if (meta.attach) {
- attachState = {
- href: this.value(),
- attach: meta.attach
- };
- }
-
- if (!meta.text) {
- updateText.call(this);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ })
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var onBeforeCall = function (e) {
- e.meta = win.toJSON();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if ($_ae1yh4f3jfuw8pj4.hasLinkClassList(editor.settings)) {
+ classListCtrl = {
+ name: 'class',
+ type: 'listbox',
+ label: 'Class',
+ values: buildListItems($_ae1yh4f3jfuw8pj4.getLinkClassList(editor.settings), function (item) {
+ if (item.value) {
+ item.textStyle = function () {
+ return editor.formatter.getCssText({
+ inline: 'a',
+ classes: [item.value]
+ });
+ };
+ }
+ })
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- onlyText = Utils.isOnlyTextSelected(selection.getContent());
- anchorElm = Utils.getAnchorElement(editor);
-
- data.text = initialText = Utils.getAnchorText(editor.selection, anchorElm);
- data.href = anchorElm ? dom.getAttrib(anchorElm, 'href') : '';
-
- if (anchorElm) {
- data.target = dom.getAttrib(anchorElm, 'target');
- } else if (Settings.hasDefaultLinkTarget(editor.settings)) {
- data.target = Settings.getDefaultLinkTarget(editor.settings);
- }
-
- if ((value = dom.getAttrib(anchorElm, 'rel'))) {
- data.rel = value;
- }
-
- if ((value = dom.getAttrib(anchorElm, 'class'))) {
- data['class'] = value;
- }
-
- if ((value = dom.getAttrib(anchorElm, 'title'))) {
- data.title = value;
- }
-
- if (onlyText) {
- textListCtrl = {
- name: 'text',
- type: 'textbox',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if ($_ae1yh4f3jfuw8pj4.shouldShowLinkTitle(editor.settings)) {
+ linkTitleCtrl = {
+ name: 'title',
+ type: 'textbox',
+ label: 'Title',
+ value: data.title
+ };
+ }
+ win = editor.windowManager.open({
+ title: 'Insert link',
+ data: data,
+ body: [
+ {
+ name: 'href',
+ type: 'filepicker',
+ filetype: 'file',
</ins><span class="cx" style="display: block; padding: 0 10px"> size: 40,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- label: 'Text to display',
- onchange: function () {
- data.text = this.value();
- }
- };
- }
-
- if (linkList) {
- linkListCtrl = {
- type: 'listbox',
- label: 'Link list',
- values: buildListItems(
- linkList,
- function (item) {
- item.value = editor.convertURL(item.value || item.url, 'href');
- },
- [{ text: 'None', value: '' }]
- ),
- onselect: linkListChangeHandler,
- value: editor.convertURL(data.href, 'href'),
- onPostRender: function () {
- /*eslint consistent-this:0*/
- linkListCtrl = this;
- }
- };
- }
-
- if (Settings.shouldShowTargetList(editor.settings)) {
- if (Settings.getTargetList(editor.settings) === undefined) {
- Settings.setTargetList(editor, [
- { text: 'None', value: '' },
- { text: 'New window', value: '_blank' }
- ]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ autofocus: true,
+ label: 'Url',
+ onchange: urlChange,
+ onkeyup: updateText,
+ onpaste: updateText,
+ onbeforecall: onBeforeCall
+ },
+ textListCtrl,
+ linkTitleCtrl,
+ buildAnchorListControl(data.href),
+ linkListCtrl,
+ relListCtrl,
+ targetListCtrl,
+ classListCtrl
+ ],
+ onSubmit: function (e) {
+ var assumeExternalTargets = $_ae1yh4f3jfuw8pj4.assumeExternalTargets(editor.settings);
+ var insertLink = $_fs5xf5f7jfuw8pjf.link(editor, attachState);
+ var removeLink = $_fs5xf5f7jfuw8pjf.unlink(editor);
+ var resultData = global$4.extend({}, data, e.data);
+ var href = resultData.href;
+ if (!href) {
+ removeLink();
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- targetListCtrl = {
- name: 'target',
- type: 'listbox',
- label: 'Target',
- values: buildListItems(Settings.getTargetList(editor.settings))
- };
- }
-
- if (Settings.hasRelList(editor.settings)) {
- relListCtrl = {
- name: 'rel',
- type: 'listbox',
- label: 'Rel',
- values: buildListItems(
- Settings.getRelList(editor.settings),
- function (item) {
- if (Settings.allowUnsafeLinkTarget(editor.settings) === false) {
- item.value = Utils.toggleTargetRules(item.value, data.target === '_blank');
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!onlyText || resultData.text === initialText) {
+ delete resultData.text;
+ }
+ if (href.indexOf('@') > 0 && href.indexOf('//') === -1 && href.indexOf('mailto:') === -1) {
+ delayedConfirm(editor, 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?', function (state) {
+ if (state) {
+ resultData.href = 'mailto:' + href;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- )
- };
- }
-
- if (Settings.hasLinkClassList(editor.settings)) {
- classListCtrl = {
- name: 'class',
- type: 'listbox',
- label: 'Class',
- values: buildListItems(
- Settings.getLinkClassList(editor.settings),
- function (item) {
- if (item.value) {
- item.textStyle = function () {
- return editor.formatter.getCssText({ inline: 'a', classes: [item.value] });
- };
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ insertLink(resultData);
+ });
+ return;
+ }
+ if (assumeExternalTargets === true && !/^\w+:/i.test(href) || assumeExternalTargets === false && /^\s*www[\.|\d\.]/i.test(href)) {
+ delayedConfirm(editor, 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?', function (state) {
+ if (state) {
+ resultData.href = 'http://' + href;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- )
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ insertLink(resultData);
+ });
+ return;
+ }
+ insertLink(resultData);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var open$1 = function (editor) {
+ createLinkList(editor, showDialog);
+ };
+ var $_3kgdixf9jfuw8pjm = { open: open$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (Settings.shouldShowLinkTitle(editor.settings)) {
- linkTitleCtrl = {
- name: 'title',
- type: 'textbox',
- label: 'Title',
- value: data.title
- };
- }
-
- win = editor.windowManager.open({
- title: 'Insert link',
- data: data,
- body: [
- {
- name: 'href',
- type: 'filepicker',
- filetype: 'file',
- size: 40,
- autofocus: true,
- label: 'Url',
- onchange: urlChange,
- onkeyup: updateText,
- onbeforecall: onBeforeCall
- },
- textListCtrl,
- linkTitleCtrl,
- buildAnchorListControl(data.href),
- linkListCtrl,
- relListCtrl,
- targetListCtrl,
- classListCtrl
- ],
- onSubmit: function (e) {
- var assumeExternalTargets = Settings.assumeExternalTargets(editor.settings);
- var insertLink = Utils.link(editor, attachState);
- var removeLink = Utils.unlink(editor);
-
- var resultData = Tools.extend({}, data, e.data);
- /*eslint dot-notation: 0*/
- var href = resultData.href;
-
- if (!href) {
- removeLink();
- return;
- }
-
- if (!onlyText || resultData.text === initialText) {
- delete resultData.text;
- }
-
- // Is email and not //user@domain.com
- if (href.indexOf('@') > 0 && href.indexOf('//') == -1 && href.indexOf('mailto:') == -1) {
- delayedConfirm(
- editor,
- 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?',
- function (state) {
- if (state) {
- resultData.href = 'mailto:' + href;
- }
- insertLink(resultData);
- }
- );
- return;
- }
-
- // Is not protocol prefixed
- if ((assumeExternalTargets === true && !/^\w+:/i.test(href)) ||
- (assumeExternalTargets === false && /^\s*www[\.|\d\.]/i.test(href))) {
- delayedConfirm(
- editor,
- 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?',
- function (state) {
- if (state) {
- resultData.href = 'http://' + href;
- }
- insertLink(resultData);
- }
- );
- return;
- }
-
- insertLink(resultData);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getLink = function (editor, elm) {
+ return editor.dom.getParent(elm, 'a[href]');
+ };
+ var getSelectedLink = function (editor) {
+ return getLink(editor, editor.selection.getStart());
+ };
+ var getHref = function (elm) {
+ var href = elm.getAttribute('data-mce-href');
+ return href ? href : elm.getAttribute('href');
+ };
+ var isContextMenuVisible = function (editor) {
+ var contextmenu = editor.plugins.contextmenu;
+ return contextmenu ? contextmenu.isContextMenuVisible() : false;
+ };
+ var hasOnlyAltModifier = function (e) {
+ return e.altKey === true && e.shiftKey === false && e.ctrlKey === false && e.metaKey === false;
+ };
+ var gotoLink = function (editor, a) {
+ if (a) {
+ var href = getHref(a);
+ if (/^#/.test(href)) {
+ var targetEl = editor.$(href);
+ if (targetEl.length) {
+ editor.selection.scrollIntoView(targetEl[0], true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- };
-
- var open = function (editor) {
- createLinkList(editor, showDialog);
- };
-
- return {
- open: open
- };
- }
-);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.DOMUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.DOMUtils');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.Env',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.Env');
- }
-);
-
-/**
- * OpenUrl.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.link.core.OpenUrl',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.Env'
- ],
- function (DOMUtils, Env) {
- var appendClickRemove = function (link, evt) {
- document.body.appendChild(link);
- link.dispatchEvent(evt);
- document.body.removeChild(link);
- };
-
- var open = function (url) {
- // Chrome and Webkit has implemented noopener and works correctly with/without popup blocker
- // Firefox has it implemented noopener but when the popup blocker is activated it doesn't work
- // Edge has only implemented noreferrer and it seems to remove opener as well
- // Older IE versions pre IE 11 falls back to a window.open approach
- if (!Env.ie || Env.ie > 10) {
- var link = document.createElement('a');
- link.target = '_blank';
- link.href = url;
- link.rel = 'noreferrer noopener';
-
- var evt = document.createEvent('MouseEvents');
- evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
-
- appendClickRemove(link, evt);
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var win = window.open('', '_blank');
- if (win) {
- win.opener = null;
- var doc = win.document;
- doc.open();
- doc.write('<meta http-equiv="refresh" content="0; url=' + DOMUtils.DOM.encode(url) + '">');
- doc.close();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_2ksejbf4jfuw8pj6.open(a.href);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var openDialog = function (editor) {
+ return function () {
+ $_3kgdixf9jfuw8pjm.open(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- open: open
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var gotoSelectedLink = function (editor) {
+ return function () {
+ gotoLink(editor, getSelectedLink(editor));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Actions.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.link.core.Actions',
- [
- 'tinymce.core.util.VK',
- 'tinymce.plugins.link.ui.Dialog',
- 'tinymce.plugins.link.core.OpenUrl',
- 'tinymce.plugins.link.core.Utils',
- 'tinymce.plugins.link.core.Settings'
- ],
- function (VK, Dialog, OpenUrl, Utils, Settings) {
- var getLink = function (editor, elm) {
- return editor.dom.getParent(elm, 'a[href]');
- };
-
- var getSelectedLink = function (editor) {
- return getLink(editor, editor.selection.getStart());
- };
-
- var getHref = function (elm) {
- // Returns the real href value not the resolved a.href value
- var href = elm.getAttribute('data-mce-href');
- return href ? href : elm.getAttribute('href');
- };
-
- var isContextMenuVisible = function (editor) {
- var contextmenu = editor.plugins.contextmenu;
- return contextmenu ? contextmenu.isContextMenuVisible() : false;
- };
-
- var hasOnlyAltModifier = function (e) {
- return e.altKey === true && e.shiftKey === false && e.ctrlKey === false && e.metaKey === false;
- };
-
- var gotoLink = function (editor, a) {
- if (a) {
- var href = getHref(a);
- if (/^#/.test(href)) {
- var targetEl = editor.$(href);
- if (targetEl.length) {
- editor.selection.scrollIntoView(targetEl[0], true);
- }
- } else {
- OpenUrl.open(a.href);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var leftClickedOnAHref = function (editor) {
+ return function (elm) {
+ var sel, rng, node;
+ if ($_ae1yh4f3jfuw8pj4.hasContextToolbar(editor.settings) && !isContextMenuVisible(editor) && $_fs5xf5f7jfuw8pjf.isLink(elm)) {
+ sel = editor.selection;
+ rng = sel.getRng();
+ node = rng.startContainer;
+ if (node.nodeType === 3 && sel.isCollapsed() && rng.startOffset > 0 && rng.startOffset < node.data.length) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var openDialog = function (editor) {
- return function () {
- Dialog.open(editor);
- };
- };
-
- var gotoSelectedLink = function (editor) {
- return function () {
- gotoLink(editor, getSelectedLink(editor));
- };
- };
-
- var leftClickedOnAHref = function (editor) {
- return function (elm) {
- var sel, rng, node;
- if (Settings.hasContextToolbar(editor.settings) && !isContextMenuVisible(editor) && Utils.isLink(elm)) {
- sel = editor.selection;
- rng = sel.getRng();
- node = rng.startContainer;
- // ignore cursor positions at the beginning/end (to make context toolbar less noisy)
- if (node.nodeType == 3 && sel.isCollapsed() && rng.startOffset > 0 && rng.startOffset < node.data.length) {
- return true;
- }
- }
- return false;
- };
- };
-
- var setupGotoLinks = function (editor) {
- editor.on('click', function (e) {
- var link = getLink(editor, e.target);
- if (link && VK.metaKeyPressed(e)) {
- e.preventDefault();
- gotoLink(editor, link);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var setupGotoLinks = function (editor) {
+ editor.on('click', function (e) {
+ var link = getLink(editor, e.target);
+ if (link && global$1.metaKeyPressed(e)) {
+ e.preventDefault();
+ gotoLink(editor, link);
+ }
+ });
+ editor.on('keydown', function (e) {
+ var link = getSelectedLink(editor);
+ if (link && e.keyCode === 13 && hasOnlyAltModifier(e)) {
+ e.preventDefault();
+ gotoLink(editor, link);
+ }
+ });
+ };
+ var toggleActiveState = function (editor) {
+ return function () {
+ var self = this;
+ editor.on('nodechange', function (e) {
+ self.active(!editor.readonly && !!$_fs5xf5f7jfuw8pjf.getAnchorElement(editor, e.element));
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.on('keydown', function (e) {
- var link = getSelectedLink(editor);
- if (link && e.keyCode === 13 && hasOnlyAltModifier(e)) {
- e.preventDefault();
- gotoLink(editor, link);
- }
- });
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var toggleActiveState = function (editor) {
- return function () {
- var self = this;
- editor.on('nodechange', function (e) {
- self.active(!editor.readonly && !!Utils.getAnchorElement(editor, e.element));
- });
- };
- };
-
- var toggleViewLinkState = function (editor) {
- return function () {
- var self = this;
-
- var toggleVisibility = function (e) {
- if (Utils.hasLinks(e.parents)) {
- self.show();
- } else {
- self.hide();
- }
- };
-
- if (!Utils.hasLinks(editor.dom.getParents(editor.selection.getStart()))) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var toggleViewLinkState = function (editor) {
+ return function () {
+ var self = this;
+ var toggleVisibility = function (e) {
+ if ($_fs5xf5f7jfuw8pjf.hasLinks(e.parents)) {
+ self.show();
+ } else {
</ins><span class="cx" style="display: block; padding: 0 10px"> self.hide();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.on('nodechange', toggleVisibility);
-
- self.on('remove', function () {
- editor.off('nodechange', toggleVisibility);
- });
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!$_fs5xf5f7jfuw8pjf.hasLinks(editor.dom.getParents(editor.selection.getStart()))) {
+ self.hide();
+ }
+ editor.on('nodechange', toggleVisibility);
+ self.on('remove', function () {
+ editor.off('nodechange', toggleVisibility);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_auu7ckf1jfuw8pj0 = {
+ openDialog: openDialog,
+ gotoSelectedLink: gotoSelectedLink,
+ leftClickedOnAHref: leftClickedOnAHref,
+ setupGotoLinks: setupGotoLinks,
+ toggleActiveState: toggleActiveState,
+ toggleViewLinkState: toggleViewLinkState
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- openDialog: openDialog,
- gotoSelectedLink: gotoSelectedLink,
- leftClickedOnAHref: leftClickedOnAHref,
- setupGotoLinks: setupGotoLinks,
- toggleActiveState: toggleActiveState,
- toggleViewLinkState: toggleViewLinkState
- };
- }
-);
-/**
- * Controls.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor) {
+ editor.addCommand('mceLink', $_auu7ckf1jfuw8pj0.openDialog(editor));
+ };
+ var $_4bbs70f0jfuw8piz = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.plugins.link.ui.Controls',
- [
- 'tinymce.plugins.link.core.Actions',
- 'tinymce.plugins.link.core.Utils'
- ],
- function (Actions, Utils) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setup = function (editor) {
+ editor.addShortcut('Meta+K', '', $_auu7ckf1jfuw8pj0.openDialog(editor));
+ };
+ var $_7rlm6qfcjfuw8pjt = { setup: setup };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var setupButtons = function (editor) {
- editor.addButton('link', {
- icon: 'link',
- tooltip: 'Insert/edit link',
- shortcut: 'Meta+K',
- onclick: Actions.openDialog(editor),
- onpostrender: Actions.toggleActiveState(editor)
- });
-
- editor.addButton('unlink', {
- icon: 'unlink',
- tooltip: 'Remove link',
- onclick: Utils.unlink(editor),
- onpostrender: Actions.toggleActiveState(editor)
- });
-
- if (editor.addContextToolbar) {
- editor.addButton('openlink', {
- icon: 'newtab',
- tooltip: 'Open link',
- onclick: Actions.gotoSelectedLink(editor)
- });
- }
- };
-
- var setupMenuItems = function (editor) {
- editor.addMenuItem('openlink', {
- text: 'Open link',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setupButtons = function (editor) {
+ editor.addButton('link', {
+ active: false,
+ icon: 'link',
+ tooltip: 'Insert/edit link',
+ onclick: $_auu7ckf1jfuw8pj0.openDialog(editor),
+ onpostrender: $_auu7ckf1jfuw8pj0.toggleActiveState(editor)
+ });
+ editor.addButton('unlink', {
+ active: false,
+ icon: 'unlink',
+ tooltip: 'Remove link',
+ onclick: $_fs5xf5f7jfuw8pjf.unlink(editor),
+ onpostrender: $_auu7ckf1jfuw8pj0.toggleActiveState(editor)
+ });
+ if (editor.addContextToolbar) {
+ editor.addButton('openlink', {
</ins><span class="cx" style="display: block; padding: 0 10px"> icon: 'newtab',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- onclick: Actions.gotoSelectedLink(editor),
- onPostRender: Actions.toggleViewLinkState(editor),
- prependToContext: true
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ tooltip: 'Open link',
+ onclick: $_auu7ckf1jfuw8pj0.gotoSelectedLink(editor)
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var setupMenuItems = function (editor) {
+ editor.addMenuItem('openlink', {
+ text: 'Open link',
+ icon: 'newtab',
+ onclick: $_auu7ckf1jfuw8pj0.gotoSelectedLink(editor),
+ onPostRender: $_auu7ckf1jfuw8pj0.toggleViewLinkState(editor),
+ prependToContext: true
+ });
+ editor.addMenuItem('link', {
+ icon: 'link',
+ text: 'Link',
+ shortcut: 'Meta+K',
+ onclick: $_auu7ckf1jfuw8pj0.openDialog(editor),
+ stateSelector: 'a[href]',
+ context: 'insert',
+ prependToContext: true
+ });
+ editor.addMenuItem('unlink', {
+ icon: 'unlink',
+ text: 'Remove link',
+ onclick: $_fs5xf5f7jfuw8pjf.unlink(editor),
+ stateSelector: 'a[href]'
+ });
+ };
+ var setupContextToolbars = function (editor) {
+ if (editor.addContextToolbar) {
+ editor.addContextToolbar($_auu7ckf1jfuw8pj0.leftClickedOnAHref(editor), 'openlink | link unlink');
+ }
+ };
+ var $_dz7svyfdjfuw8pju = {
+ setupButtons: setupButtons,
+ setupMenuItems: setupMenuItems,
+ setupContextToolbars: setupContextToolbars
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addMenuItem('link', {
- icon: 'link',
- text: 'Link',
- shortcut: 'Meta+K',
- onclick: Actions.openDialog(editor),
- stateSelector: 'a[href]',
- context: 'insert',
- prependToContext: true
- });
- };
-
- var setupContextToolbars = function (editor) {
- if (editor.addContextToolbar) {
- editor.addContextToolbar(
- Actions.leftClickedOnAHref(editor),
- 'openlink | link unlink'
- );
- }
- };
-
- return {
- setupButtons: setupButtons,
- setupMenuItems: setupMenuItems,
- setupContextToolbars: setupContextToolbars
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('link', function (editor) {
+ $_dz7svyfdjfuw8pju.setupButtons(editor);
+ $_dz7svyfdjfuw8pju.setupMenuItems(editor);
+ $_dz7svyfdjfuw8pju.setupContextToolbars(editor);
+ $_auu7ckf1jfuw8pj0.setupGotoLinks(editor);
+ $_4bbs70f0jfuw8piz.register(editor);
+ $_7rlm6qfcjfuw8pjt.setup(editor);
+ });
+ function Plugin () {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.plugins.link.Plugin',
- [
- 'tinymce.core.PluginManager',
- 'tinymce.plugins.link.core.Actions',
- 'tinymce.plugins.link.ui.Controls'
- ],
- function (PluginManager, Actions, Controls) {
- PluginManager.add('link', function (editor) {
- Controls.setupButtons(editor);
- Controls.setupMenuItems(editor);
- Controls.setupContextToolbars(editor);
- Actions.setupGotoLinks(editor);
- editor.addShortcut('Meta+K', '', Actions.openDialog(editor));
- editor.addCommand('mceLink', Actions.openDialog(editor));
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return function () { };
- }
-);
-dem('tinymce.plugins.link.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginslinkpluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/link/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/link/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/link/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("4",tinymce.util.Tools.resolve),g("1",[&q
uot;4"],function(a){return a("tinymce.PluginManager")}),g("5",["4"],function(a){return a("tinymce.util.VK")}),g("a",["4"],function(a){return a("tinymce.util.Delay")}),g("b",["4"],function(a){return a("tinymce.util.Tools")}),g("c",["4"],function(a){return a("tinymce.util.XHR")}),g("9",[],function(){var a=function(a){return"boolean"==typeof a.link_assume_external_targets&&a.link_assume_external_targets},b=function(a){return"boolean"==typeof a.link_context_toolbar&&a.link_context_toolbar},c=function(a){return a.link_list},d=function(a){return"string"==typeof a.default_link_target},e=function(a){return a.default_link_target},f=function(a){return a.target_list},g=function(a,b){a.settings.target_list=b},h=function(a){return f(a)!==!1},i=function(a){return a.rel_list},j=function(a){return void 0!==i(a)
},k=function(a){return a.link_class_list},l=function(a){return void 0!==k(a)},m=function(a){return a.link_title!==!1},n=function(a){return"boolean"==typeof a.allow_unsafe_link_target&&a.allow_unsafe_link_target};return{assumeExternalTargets:a,hasContextToolbar:b,getLinkList:c,hasDefaultLinkTarget:d,getDefaultLinkTarget:e,getTargetList:f,setTargetList:g,shouldShowTargetList:h,getRelList:i,hasRelList:j,getLinkClassList:k,hasLinkClassList:l,shouldShowLinkTitle:m,allowUnsafeLinkTarget:n}}),h("d",RegExp),g("8",["b","9","d"],function(a,b,c){var d=function(b,c){var d=["noopener"],e=b?b.split(/\s+/):[],f=function(b){return a.trim(b.sort().join(" "))},g=function(a){return a=h(a),a.length?a.concat(d):d},h=function(b){return b.filter(function(b){return a.inArray(d,b)===-1})};return e=c?g(e):h(e),e.length?f(e):null},e=function(a){return a.replace(/\uFEFF/g,"")},f=function(a,b){return b=b||a.selecti
on.getStart(),k(b)?a.dom.select("a[href]",b)[0]:a.dom.getParent(b,"a[href]")},g=function(a,b){var c=b?b.innerText||b.textContent:a.getContent({format:"text"});return e(c)},h=function(a){return a&&"A"===a.nodeName&&a.href},i=function(b){return a.grep(b,h).length>0},j=function(a){return!(/</.test(a)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(a)||a.indexOf("href=")==-1))},k=function(a){return a&&"FIGURE"===a.nodeName&&/\bimage\b/i.test(a.className)},l=function(a,c){return function(e){a.undoManager.transact(function(){var g=a.selection.getNode(),h=f(a,g),i={href:e.href,target:e.target?e.target:null,rel:e.rel?e.rel:null,"class":e["class"]?e["class"]:null,title:e.title?e.title:null};b.hasRelList(a.settings)||b.allowUnsafeLinkTarget(a.settings)!==!1||(i.rel=d(i.rel,"_blank"==i.target)),e.href===c.href&&(c.attach(),c={}),h?(a.focus(
),e.hasOwnProperty("text")&&("innerText"in h?h.innerText=e.text:h.textContent=e.text),a.dom.setAttribs(h,i),a.selection.select(h),a.undoManager.add()):k(g)?o(a,g,i):e.hasOwnProperty("text")?a.insertContent(a.dom.createHTML("a",i,a.dom.encode(e.text))):a.execCommand("mceInsertLink",!1,i)})}},m=function(a){return function(){a.undoManager.transact(function(){var b=a.selection.getNode();k(b)?n(a,b):a.execCommand("unlink")})}},n=function(a,b){var c,d;d=a.dom.select("img",b)[0],d&&(c=a.dom.getParents(d,"a[href]",b)[0],c&&(c.parentNode.insertBefore(d,c),a.dom.remove(c)))},o=function(a,b,c){var d,e;e=a.dom.select("img",b)[0],e&&(d=a.dom.create("a",c),e.parentNode.insertBefore(d,e),d.appendChild(e))};return{link:l,unlink:m,isLink:h,hasLinks:i,isOnlyTextSelected:j,getAnchorElement:f,getAnchorText:g,toggleTargetRules:d}}),g("6",["a","b&quo
t;,"c","8","9"],function(a,b,c,d,e){var f={},g=function(a,b){var d=e.getLinkList(a.settings);"string"==typeof d?c.send({url:d,success:function(c){b(a,JSON.parse(c))}}):"function"==typeof d?d(function(c){b(a,c)}):b(a,d)},h=function(a,c,d){var e=function(a,d){return d=d||[],b.each(a,function(a){var b={text:a.text||a.title};a.menu?b.menu=e(a.menu):(b.value=a.value,c&&c(b)),d.push(b)}),d};return e(a,d||[])},i=function(b,c,d){var e=b.selection.getRng();a.setEditorTimeout(b,function(){b.windowManager.confirm(c,function(a){b.selection.setRng(e),d(a)})})},j=function(a,c){var g,j,k,l,m,n,o,p,q,r,s,t={},u=a.selection,v=a.dom,w=function(a){var b=k.find("#text");(!b.value()||a.lastControl&&b.value()==a.lastControl.text())&&b.value(a.control.text()),k.find("#href").value(a.control.value())},x=function(c){var d=[];if(b.each(a.dom.select("a:not([href])"),function(a){var b=a.name||a.id;b&&
;d.push({text:b,value:"#"+b,selected:c.indexOf("#"+b)!=-1})}),d.length)return d.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:d,onselect:w}},y=function(){j||!l||t.text||this.parent().parent().find("#text")[0].value(this.value())},z=function(c){var d=c.meta||{};n&&n.value(a.convertURL(this.value(),"href")),b.each(c.meta,function(a,b){var c=k.find("#"+b);"text"===b?0===j.length&&(c.value(a),t.text=a):c.value(a)}),d.attach&&(f={href:this.value(),attach:d.attach}),d.text||y.call(this)},A=function(a){a.meta=k.toJSON()};l=d.isOnlyTextSelected(u.getContent()),g=d.getAnchorElement(a),t.text=j=d.getAnchorText(a.selection,g),t.href=g?v.getAttrib(g,"href"):"",g?t.target=v.getAttrib(g,"target"):e.hasDefaultLinkTarget(a.settings)&&(t.target=e.getDefaultLinkTarget(a.settings)),(s=v.getAttr
ib(g,"rel"))&&(t.rel=s),(s=v.getAttrib(g,"class"))&&(t["class"]=s),(s=v.getAttrib(g,"title"))&&(t.title=s),l&&(m={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){t.text=this.value()}}),c&&(n={type:"listbox",label:"Link list",values:h(c,function(b){b.value=a.convertURL(b.value||b.url,"href")},[{text:"None",value:""}]),onselect:w,value:a.convertURL(t.href,"href"),onPostRender:function(){n=this}}),e.shouldShowTargetList(a.settings)&&(void 0===e.getTargetList(a.settings)&&e.setTargetList(a,[{text:"None",value:""},{text:"New window",value:"_blank"}]),p={name:"target",type:"listbox",label:"Target",values:h(e.getTargetList(a.settings))}),e.hasRelList(a.settings)&&(o={name:"rel",type:"l
istbox",label:"Rel",values:h(e.getRelList(a.settings),function(b){e.allowUnsafeLinkTarget(a.settings)===!1&&(b.value=d.toggleTargetRules(b.value,"_blank"===t.target))})}),e.hasLinkClassList(a.settings)&&(q={name:"class",type:"listbox",label:"Class",values:h(e.getLinkClassList(a.settings),function(b){b.value&&(b.textStyle=function(){return a.formatter.getCssText({inline:"a",classes:[b.value]})})})}),e.shouldShowLinkTitle(a.settings)&&(r={name:"title",type:"textbox",label:"Title",value:t.title}),k=a.windowManager.open({title:"Insert link",data:t,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:z,onkeyup:y,onbeforecall:A},m,r,x(t.href),n,o,p,q],onSubmit:function(c){var g=e.assumeExternalTargets(a.settings),h=d.link(a,f),k=d.unlink(a),m=b.extend({},t,c.data),n=m.href;
return n?(l&&m.text!==j||delete m.text,n.indexOf("@")>0&&n.indexOf("//")==-1&&n.indexOf("mailto:")==-1?void i(a,"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(a){a&&(m.href="mailto:"+n),h(m)}):g===!0&&!/^\w+:/i.test(n)||g===!1&&/^\s*www[\.|\d\.]/i.test(n)?void i(a,"The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(a){a&&(m.href="http://"+n),h(m)}):void h(m)):void k()}})},k=function(a){g(a,j)};return{open:k}}),g("e",["4"],function(a){return a("tinymce.dom.DOMUtils")}),g("f",["4"],function(a){return a("tinymce.Env")}),g("7",["e","f"],function(a,b){var c=function(a,b){document.body.appendChild(a),a.dispatchEvent(b),document.body.removeChild(a)},d=functi
on(d){if(!b.ie||b.ie>10){var e=document.createElement("a");e.target="_blank",e.href=d,e.rel="noreferrer noopener";var f=document.createEvent("MouseEvents");f.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),c(e,f)}else{var g=window.open("","_blank");if(g){g.opener=null;var h=g.document;h.open(),h.write('<meta http-equiv="refresh" content="0; url='+a.DOM.encode(d)+'">'),h.close()}}};return{open:d}}),g("2",["5","6","7","8","9"],function(a,b,c,d,e){var f=function(a,b){return a.dom.getParent(b,"a[href]")},g=function(a){return f(a,a.selection.getStart())},h=function(a){var b=a.getAttribute("data-mce-href");return b?b:a.getAttribute("href")},i=function(a){var b=a.plugins.contextmenu;return!!b&&b.isContextMenuVisible()},j=function(a){return a.altKey===!0&&a.shiftKey===!1&
amp;&a.ctrlKey===!1&&a.metaKey===!1},k=function(a,b){if(b){var d=h(b);if(/^#/.test(d)){var e=a.$(d);e.length&&a.selection.scrollIntoView(e[0],!0)}else c.open(b.href)}},l=function(a){return function(){b.open(a)}},m=function(a){return function(){k(a,g(a))}},n=function(a){return function(b){var c,f,g;return!!(e.hasContextToolbar(a.settings)&&!i(a)&&d.isLink(b)&&(c=a.selection,f=c.getRng(),g=f.startContainer,3==g.nodeType&&c.isCollapsed()&&f.startOffset>0&&f.startOffset<g.data.length))}},o=function(b){b.on("click",function(c){var d=f(b,c.target);d&&a.metaKeyPressed(c)&&(c.preventDefault(),k(b,d))}),b.on("keydown",function(a){var c=g(b);c&&13===a.keyCode&&j(a)&&(a.preventDefault(),k(b,c))})},p=function(a){return function(){var b=this;a.on("nodechange",function(c){b.active(!a.readonly&&!!d.getAnchorElement(a,c.element))})}},q=function(a){r
eturn function(){var b=this,c=function(a){d.hasLinks(a.parents)?b.show():b.hide()};d.hasLinks(a.dom.getParents(a.selection.getStart()))||b.hide(),a.on("nodechange",c),b.on("remove",function(){a.off("nodechange",c)})}};return{openDialog:l,gotoSelectedLink:m,leftClickedOnAHref:n,setupGotoLinks:o,toggleActiveState:p,toggleViewLinkState:q}}),g("3",["2","8"],function(a,b){var c=function(c){c.addButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Meta+K",onclick:a.openDialog(c),onpostrender:a.toggleActiveState(c)}),c.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onclick:b.unlink(c),onpostrender:a.toggleActiveState(c)}),c.addContextToolbar&&c.addButton("openlink",{icon:"newtab",tooltip:"Open link",onclick:a.gotoSelectedLink(c)})},d=function(b){b.addMenuItem("openlink",{text:"Open link&quo
t;,icon:"newtab",onclick:a.gotoSelectedLink(b),onPostRender:a.toggleViewLinkState(b),prependToContext:!0}),b.addMenuItem("link",{icon:"link",text:"Link",shortcut:"Meta+K",onclick:a.openDialog(b),stateSelector:"a[href]",context:"insert",prependToContext:!0})},e=function(b){b.addContextToolbar&&b.addContextToolbar(a.leftClickedOnAHref(b),"openlink | link unlink")};return{setupButtons:c,setupMenuItems:d,setupContextToolbars:e}}),g("0",["1","2","3"],function(a,b,c){return a.add("link",function(a){c.setupButtons(a),c.setupMenuItems(a),c.setupContextToolbars(a),b.setupGotoLinks(a),a.addShortcut("Meta+K","",b.openDialog(a)),a.addCommand("mceLink",b.openDialog(a))}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=tinymce.util.Tools.resolve("tinymce.util.VK"),e=function(t){return t.target_list},o=function(t){return t.rel_list},i=function(t){return t.link_class_list},p=function(t){return"boolean"==typeof t.link_assume_external_targets&&t.link_assume_external_targets},a=function(t){return"boolean"==typeof t.link_context_toolbar&&t.link_context_toolbar},r=function(t){return t.link_list},k=function(t){return"string"==typeof t.default_link_target},y=function(t){return t.default_link_target},b=e,_=function(t,e){t.settings.target_list=e},w=function(t){return!1!==e(t)},T=o,C=function(t){return o(t)!==undefined},M=i,O=function(t){return i(t)!==undefined},R=function(t){return!1!==t.link_title},N=function(t){return"boolean"==typeof t.allow_
unsafe_link_target&&t.allow_unsafe_link_target},l=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),u=tinymce.util.Tools.resolve("tinymce.Env"),c=function(t){if(!u.ie||10<u.ie){var e=document.createElement("a");e.target="_blank",e.href=t,e.rel="noreferrer noopener";var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),r=e,a=n,document.body.appendChild(r),r.dispatchEvent(a),document.body.removeChild(r)}else{var o=window.open("","_blank");if(o){o.opener=null;var i=o.document;i.open(),i.write('<meta http-equiv="refresh" content="0; url='+l.DOM.encode(t)+'">'),i.close()}}var r,a},A=tinymce.util.Tools.resolve("tinymce.util.Tools"),s=function(t,e){var n,o,i=["noopener"],r=t?t.split(/\s+/):[],a=function(t){return t.filter(function(t){return-1===A.inArray(i,t)})};return(r=e?(n=a(n=r)).lengt
h?n.concat(i):i:a(r)).length?(o=r,A.trim(o.sort().join(" "))):null},f=function(t,e){return e=e||t.selection.getNode(),m(e)?t.dom.select("a[href]",e)[0]:t.dom.getParent(e,"a[href]")},d=function(t){return t&&"A"===t.nodeName&&t.href},m=function(t){return t&&"FIGURE"===t.nodeName&&/\bimage\b/i.test(t.className)},v=function(t,e){var n,o;(o=t.dom.select("img",e)[0])&&(n=t.dom.getParents(o,"a[href]",e)[0])&&(n.parentNode.insertBefore(o,n),t.dom.remove(n))},g=function(t,e,n){var o,i;(i=t.dom.select("img",e)[0])&&(o=t.dom.create("a",n),i.parentNode.insertBefore(o,i),o.appendChild(i))},L=function(i,r){return function(o){i.undoManager.transact(function(){var t=i.selection.getNode(),e=f(i,t),n={href:o.href,target:o.target?o.target:null,rel:o.rel?o.rel:null,"class":o["class"]?o["class"]:null,title:o.title?o.title:null};C(
i.settings)||!1!==N(i.settings)||(n.rel=s(n.rel,"_blank"===n.target)),o.href===r.href&&(r.attach(),r={}),e?(i.focus(),o.hasOwnProperty("text")&&("innerText"in e?e.innerText=o.text:e.textContent=o.text),i.dom.setAttribs(e,n),i.selection.select(e),i.undoManager.add()):m(t)?g(i,t,n):o.hasOwnProperty("text")?i.insertContent(i.dom.createHTML("a",n,i.dom.encode(o.text))):i.execCommand("mceInsertLink",!1,n)})}},P=function(e){return function(){e.undoManager.transact(function(){var t=e.selection.getNode();m(t)?v(e,t):e.execCommand("unlink")})}},h=d,x=function(t){return 0<A.grep(t,d).length},E=function(t){return!(/</.test(t)&&(!/^<a [^>]+>[^<]+<\/a>$/.test(t)||-1===t.indexOf("href=")))},S=f,I=function(t,e){var n=e?e.innerText||e.textContent:t.getContent({format:"text"});return n.replace(/\uFEFF/g,"")},K=s,U=tinymce.util.Tools.resolve("tinymce
.util.Delay"),D=tinymce.util.Tools.resolve("tinymce.util.XHR"),B={},F=function(t,o,e){var i=function(t,n){return n=n||[],A.each(t,function(t){var e={text:t.text||t.title};t.menu?e.menu=i(t.menu):(e.value=t.value,o&&o(e)),n.push(e)}),n};return i(t,e||[])},q=function(e,t,n){var o=e.selection.getRng();U.setEditorTimeout(e,function(){e.windowManager.confirm(t,function(t){e.selection.setRng(o),n(t)})})},V=function(a,t){var e,l,o,u,n,i,r,c,s,f,d,m={},v=a.selection,g=a.dom,h=function(t){var e=o.find("#text");(!e.value()||t.lastControl&&e.value()===t.lastControl.text())&&e.value(t.control.text()),o.find("#href").value(t.control.value())},x=function(){l||!u||m.text||this.parent().parent().find("#text")[0].value(this.value())};u=E(v.getContent()),e=S(a),m.text=l=I(a.selection,e),m.href=e?g.getAttrib(e,"href"):"",e?m.target=g.getAttrib(e,"target"):k(a.settings)&&(m.target=y(a.settings)),(
d=g.getAttrib(e,"rel"))&&(m.rel=d),(d=g.getAttrib(e,"class"))&&(m["class"]=d),(d=g.getAttrib(e,"title"))&&(m.title=d),u&&(n={name:"text",type:"textbox",size:40,label:"Text to display",onchange:function(){m.text=this.value()}}),t&&(i={type:"listbox",label:"Link list",values:F(t,function(t){t.value=a.convertURL(t.value||t.url,"href")},[{text:"None",value:""}]),onselect:h,value:a.convertURL(m.href,"href"),onPostRender:function(){i=this}}),w(a.settings)&&(b(a.settings)===undefined&&_(a,[{text:"None",value:""},{text:"New window",value:"_blank"}]),c={name:"target",type:"listbox",label:"Target",values:F(b(a.settings))}),C(a.settings)&&(r={name:"rel",type:"listbox",label:"Rel",values:F(T(a.settings),fu
nction(t){!1===N(a.settings)&&(t.value=K(t.value,"_blank"===m.target))})}),O(a.settings)&&(s={name:"class",type:"listbox",label:"Class",values:F(M(a.settings),function(t){t.value&&(t.textStyle=function(){return a.formatter.getCssText({inline:"a",classes:[t.value]})})})}),R(a.settings)&&(f={name:"title",type:"textbox",label:"Title",value:m.title}),o=a.windowManager.open({title:"Insert link",data:m,body:[{name:"href",type:"filepicker",filetype:"file",size:40,autofocus:!0,label:"Url",onchange:function(t){var e=t.meta||{};i&&i.value(a.convertURL(this.value(),"href")),A.each(t.meta,function(t,e){var n=o.find("#"+e);"text"===e?0===l.length&&(n.value(t),m.text=t):n.value(t)}),e.attach&&(B={href:this.value(),attach:e.attach}),e.text||x.call(this)},onkeyup:x,onpaste:x,onbeforecal
l:function(t){t.meta=o.toJSON()}},n,f,function(n){var o=[];if(A.each(a.dom.select("a:not([href])"),function(t){var e=t.name||t.id;e&&o.push({text:e,value:"#"+e,selected:-1!==n.indexOf("#"+e)})}),o.length)return o.unshift({text:"None",value:""}),{name:"anchor",type:"listbox",label:"Anchors",values:o,onselect:h}}(m.href),i,r,c,s],onSubmit:function(t){var e=p(a.settings),n=L(a,B),o=P(a),i=A.extend({},m,t.data),r=i.href;r?(u&&i.text!==l||delete i.text,0<r.indexOf("@")&&-1===r.indexOf("//")&&-1===r.indexOf("mailto:")?q(a,"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",function(t){t&&(i.href="mailto:"+r),n(i)}):!0===e&&!/^\w+:/i.test(r)||!1===e&&/^\s*www[\.|\d\.]/i.test(r)?q(a,"The URL you entered seems to be an external link. Do you want to add t
he required http:// prefix?",function(t){t&&(i.href="http://"+r),n(i)}):n(i)):o()}})},z=function(t){var e,n,o;n=V,"string"==typeof(o=r((e=t).settings))?D.send({url:o,success:function(t){n(e,JSON.parse(t))}}):"function"==typeof o?o(function(t){n(e,t)}):n(e,o)},H=function(t,e){return t.dom.getParent(e,"a[href]")},J=function(t){return H(t,t.selection.getStart())},$=function(t,e){if(e){var n=(i=e).getAttribute("data-mce-href")||i.getAttribute("href");if(/^#/.test(n)){var o=t.$(n);o.length&&t.selection.scrollIntoView(o[0],!0)}else c(e.href)}var i},j=function(t){return function(){z(t)}},G=function(t){return function(){$(t,J(t))}},X=function(r){return function(t){var e,n,o,i;return!!(a(r.settings)&&(!(i=r.plugins.contextmenu)||!i.isContextMenuVisible())&&h(t)&&3===(o=(n=(e=r.selection).getRng()).startContainer).nodeType&&e.isCollapsed()&&0<n.startOffset&&n.sta
rtOffset<o.data.length)}},Q=function(o){o.on("click",function(t){var e=H(o,t.target);e&&n.metaKeyPressed(t)&&(t.preventDefault(),$(o,e))}),o.on("keydown",function(t){var e,n=J(o);n&&13===t.keyCode&&!0===(e=t).altKey&&!1===e.shiftKey&&!1===e.ctrlKey&&!1===e.metaKey&&(t.preventDefault(),$(o,n))})},W=function(n){return function(){var e=this;n.on("nodechange",function(t){e.active(!n.readonly&&!!S(n,t.element))})}},Y=function(n){return function(){var e=this,t=function(t){x(t.parents)?e.show():e.hide()};x(n.dom.getParents(n.selection.getStart()))||e.hide(),n.on("nodechange",t),e.on("remove",function(){n.off("nodechange",t)})}},Z=function(t){t.addCommand("mceLink",j(t))},tt=function(t){t.addShortcut("Meta+K","",j(t))},et=function(t){t.addButton("link",{active:!1,icon:"link",tooltip:"Insert/edit link&quo
t;,onclick:j(t),onpostrender:W(t)}),t.addButton("unlink",{active:!1,icon:"unlink",tooltip:"Remove link",onclick:P(t),onpostrender:W(t)}),t.addContextToolbar&&t.addButton("openlink",{icon:"newtab",tooltip:"Open link",onclick:G(t)})},nt=function(t){t.addMenuItem("openlink",{text:"Open link",icon:"newtab",onclick:G(t),onPostRender:Y(t),prependToContext:!0}),t.addMenuItem("link",{icon:"link",text:"Link",shortcut:"Meta+K",onclick:j(t),stateSelector:"a[href]",context:"insert",prependToContext:!0}),t.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onclick:P(t),stateSelector:"a[href]"})},ot=function(t){t.addContextToolbar&&t.addContextToolbar(X(t),"openlink | link unlink")};t.add("link",function(t){et(t),nt(t),ot(t),Q(t),Z(t),tt(t)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginslistspluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/lists/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/lists/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/lists/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,1792 +1,1114 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var lists = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$2 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
- };
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$3 = tinymce.util.Tools.resolve('tinymce.util.VK');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$4 = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var ephox = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$6 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isTextNode = function (node) {
+ return node && node.nodeType === 3;
+ };
+ var isListNode = function (node) {
+ return node && /^(OL|UL|DL)$/.test(node.nodeName);
+ };
+ var isListItemNode = function (node) {
+ return node && /^(LI|DT|DD)$/.test(node.nodeName);
+ };
+ var isTableCellNode = function (node) {
+ return node && /^(TH|TD)$/.test(node.nodeName);
+ };
+ var isBr = function (node) {
+ return node && node.nodeName === 'BR';
+ };
+ var isFirstChild = function (node) {
+ return node.parentNode.firstChild === node;
+ };
+ var isLastChild = function (node) {
+ return node.parentNode.lastChild === node;
+ };
+ var isTextBlock = function (editor, node) {
+ return node && !!editor.schema.getTextBlockElements()[node.nodeName];
+ };
+ var isBlock = function (node, blockElements) {
+ return node && node.nodeName in blockElements;
+ };
+ var isBogusBr = function (dom, node) {
+ if (!isBr(node)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-};
-
-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.lists.Plugin","tinymce.core.PluginManager","tinymce.core.util.Tools","tinymce.core.util.VK","tinymce.plugins.lists.actions.Indent","tinymce.plugins.lists.actions.Outdent","tinymce.plugins.lists.actions.ToggleList","tinymce.plugins.lists.core.Delete","tinymce.plugins.lists.core.NodeType","tinymce.plugins.lists.core.Selection","global!tinymce.util.Tools.resolve","tinymce.core.dom.DOMUtils","tinymce.plugins.lists.core.Bookmark","tinymce.core.dom.DomQuery","tinymce.plugins.lists.core.NormalizeLists","tinymce.plugins.lists.core.SplitList","tinymce.plugins.lists.core.TextBlock","tinymce.core.dom.BookmarkManager","tinymce.core.dom.RangeUtils","tinymce.core.dom.TreeWalker","tinymce.plugins.lists.core.Range","tinymce.core.Env"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.VK',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.VK');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.DOMUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.DOMUtils');
- }
-);
-
-/**
- * NodeType.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.core.NodeType',
- [
- ],
- function () {
- var isTextNode = function (node) {
- return node && node.nodeType === 3;
- };
-
- var isListNode = function (node) {
- return node && (/^(OL|UL|DL)$/).test(node.nodeName);
- };
-
- var isListItemNode = function (node) {
- return node && /^(LI|DT|DD)$/.test(node.nodeName);
- };
-
- var isBr = function (node) {
- return node && node.nodeName === 'BR';
- };
-
- var isFirstChild = function (node) {
- return node.parentNode.firstChild === node;
- };
-
- var isLastChild = function (node) {
- return node.parentNode.lastChild === node;
- };
-
- var isTextBlock = function (editor, node) {
- return node && !!editor.schema.getTextBlockElements()[node.nodeName];
- };
-
- var isBlock = function (node, blockElements) {
- return node && node.nodeName in blockElements;
- };
-
- var isBogusBr = function (dom, node) {
- if (!isBr(node)) {
- return false;
- }
-
- if (dom.isBlock(node.nextSibling) && !isBr(node.previousSibling)) {
- return true;
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (dom.isBlock(node.nextSibling) && !isBr(node.previousSibling)) {
+ return true;
+ }
+ return false;
+ };
+ var isEmpty = function (dom, elm, keepBookmarks) {
+ var empty = dom.isEmpty(elm);
+ if (keepBookmarks && dom.select('span[data-mce-type=bookmark]', elm).length > 0) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return empty;
+ };
+ var isChildOfBody = function (dom, elm) {
+ return dom.isChildOf(elm, dom.getRoot());
+ };
+ var $_fmlqy7fsjfuw8plr = {
+ isTextNode: isTextNode,
+ isListNode: isListNode,
+ isListItemNode: isListItemNode,
+ isTableCellNode: isTableCellNode,
+ isBr: isBr,
+ isFirstChild: isFirstChild,
+ isLastChild: isLastChild,
+ isTextBlock: isTextBlock,
+ isBlock: isBlock,
+ isBogusBr: isBogusBr,
+ isEmpty: isEmpty,
+ isChildOfBody: isChildOfBody
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isEmpty = function (dom, elm, keepBookmarks) {
- var empty = dom.isEmpty(elm);
-
- if (keepBookmarks && dom.select('span[data-mce-type=bookmark]', elm).length > 0) {
- return false;
- }
-
- return empty;
- };
-
- var isChildOfBody = function (dom, elm) {
- return dom.isChildOf(elm, dom.getRoot());
- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getNormalizedEndPoint = function (container, offset) {
+ var node = global$1.getNode(container, offset);
+ if ($_fmlqy7fsjfuw8plr.isListItemNode(container) && $_fmlqy7fsjfuw8plr.isTextNode(node)) {
+ var textNodeOffset = offset >= container.childNodes.length ? node.data.length : 0;
+ return {
+ container: node,
+ offset: textNodeOffset
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- isTextNode: isTextNode,
- isListNode: isListNode,
- isListItemNode: isListItemNode,
- isBr: isBr,
- isFirstChild: isFirstChild,
- isLastChild: isLastChild,
- isTextBlock: isTextBlock,
- isBlock: isBlock,
- isBogusBr: isBogusBr,
- isEmpty: isEmpty,
- isChildOfBody: isChildOfBody
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container: container,
+ offset: offset
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var normalizeRange = function (rng) {
+ var outRng = rng.cloneRange();
+ var rangeStart = getNormalizedEndPoint(rng.startContainer, rng.startOffset);
+ outRng.setStart(rangeStart.container, rangeStart.offset);
+ var rangeEnd = getNormalizedEndPoint(rng.endContainer, rng.endOffset);
+ outRng.setEnd(rangeEnd.container, rangeEnd.offset);
+ return outRng;
+ };
+ var $_14fh94frjfuw8plp = {
+ getNormalizedEndPoint: getNormalizedEndPoint,
+ normalizeRange: normalizeRange
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.RangeUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.RangeUtils');
- }
-);
-
-/**
- * Range.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.core.Range',
- [
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.plugins.lists.core.NodeType'
- ],
- function (RangeUtils, NodeType) {
- var getNormalizedEndPoint = function (container, offset) {
- var node = RangeUtils.getNode(container, offset);
-
- if (NodeType.isListItemNode(container) && NodeType.isTextNode(node)) {
- var textNodeOffset = offset >= container.childNodes.length ? node.data.length : 0;
- return { container: node, offset: textNodeOffset };
- }
-
- return { container: container, offset: offset };
- };
-
- var normalizeRange = function (rng) {
- var outRng = rng.cloneRange();
-
- var rangeStart = getNormalizedEndPoint(rng.startContainer, rng.startOffset);
- outRng.setStart(rangeStart.container, rangeStart.offset);
-
- var rangeEnd = getNormalizedEndPoint(rng.endContainer, rng.endOffset);
- outRng.setEnd(rangeEnd.container, rangeEnd.offset);
-
- return outRng;
- };
-
- return {
- getNormalizedEndPoint: getNormalizedEndPoint,
- normalizeRange: normalizeRange
- };
- }
-);
-
-
-/**
- * Bookmark.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.core.Bookmark',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.plugins.lists.core.NodeType',
- 'tinymce.plugins.lists.core.Range'
- ],
- function (DOMUtils, NodeType, Range) {
- var DOM = DOMUtils.DOM;
-
- /**
- * Returns a range bookmark. This will convert indexed bookmarks into temporary span elements with
- * index 0 so that they can be restored properly after the DOM has been modified. Text bookmarks will not have spans
- * added to them since they can be restored after a dom operation.
- *
- * So this: <p><b>|</b><b>|</b></p>
- * becomes: <p><b><span data-mce-type="bookmark">|</span></b><b data-mce-type="bookmark">|</span></b></p>
- *
- * @param {DOMRange} rng DOM Range to get bookmark on.
- * @return {Object} Bookmark object.
- */
- var createBookmark = function (rng) {
- var bookmark = {};
-
- var setupEndPoint = function (start) {
- var offsetNode, container, offset;
-
- container = rng[start ? 'startContainer' : 'endContainer'];
- offset = rng[start ? 'startOffset' : 'endOffset'];
-
- if (container.nodeType === 1) {
- offsetNode = DOM.create('span', { 'data-mce-type': 'bookmark' });
-
- if (container.hasChildNodes()) {
- offset = Math.min(offset, container.childNodes.length - 1);
-
- if (start) {
- container.insertBefore(offsetNode, container.childNodes[offset]);
- } else {
- DOM.insertAfter(offsetNode, container.childNodes[offset]);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM = global$6.DOM;
+ var createBookmark = function (rng) {
+ var bookmark = {};
+ var setupEndPoint = function (start) {
+ var offsetNode, container, offset;
+ container = rng[start ? 'startContainer' : 'endContainer'];
+ offset = rng[start ? 'startOffset' : 'endOffset'];
+ if (container.nodeType === 1) {
+ offsetNode = DOM.create('span', { 'data-mce-type': 'bookmark' });
+ if (container.hasChildNodes()) {
+ offset = Math.min(offset, container.childNodes.length - 1);
+ if (start) {
+ container.insertBefore(offsetNode, container.childNodes[offset]);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- container.appendChild(offsetNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ DOM.insertAfter(offsetNode, container.childNodes[offset]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- container = offsetNode;
- offset = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ container.appendChild(offsetNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- bookmark[start ? 'startContainer' : 'endContainer'] = container;
- bookmark[start ? 'startOffset' : 'endOffset'] = offset;
- };
-
- setupEndPoint(true);
-
- if (!rng.collapsed) {
- setupEndPoint();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = offsetNode;
+ offset = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return bookmark;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ bookmark[start ? 'startContainer' : 'endContainer'] = container;
+ bookmark[start ? 'startOffset' : 'endOffset'] = offset;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var resolveBookmark = function (bookmark) {
- function restoreEndPoint(start) {
- var container, offset, node;
-
- var nodeIndex = function (container) {
- var node = container.parentNode.firstChild, idx = 0;
-
- while (node) {
- if (node === container) {
- return idx;
- }
-
- // Skip data-mce-type=bookmark nodes
- if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') {
- idx++;
- }
-
- node = node.nextSibling;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ setupEndPoint(true);
+ if (!rng.collapsed) {
+ setupEndPoint();
+ }
+ return bookmark;
+ };
+ var resolveBookmark = function (bookmark) {
+ function restoreEndPoint(start) {
+ var container, offset, node;
+ var nodeIndex = function (container) {
+ var node = container.parentNode.firstChild, idx = 0;
+ while (node) {
+ if (node === container) {
+ return idx;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return -1;
- };
-
- container = node = bookmark[start ? 'startContainer' : 'endContainer'];
- offset = bookmark[start ? 'startOffset' : 'endOffset'];
-
- if (!container) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') {
+ idx++;
+ }
+ node = node.nextSibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (container.nodeType === 1) {
- offset = nodeIndex(container);
- container = container.parentNode;
- DOM.remove(node);
- }
-
- bookmark[start ? 'startContainer' : 'endContainer'] = container;
- bookmark[start ? 'startOffset' : 'endOffset'] = offset;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return -1;
+ };
+ container = node = bookmark[start ? 'startContainer' : 'endContainer'];
+ offset = bookmark[start ? 'startOffset' : 'endOffset'];
+ if (!container) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- restoreEndPoint(true);
- restoreEndPoint();
-
- var rng = DOM.createRng();
-
- rng.setStart(bookmark.startContainer, bookmark.startOffset);
-
- if (bookmark.endContainer) {
- rng.setEnd(bookmark.endContainer, bookmark.endOffset);
- }
-
- return Range.normalizeRange(rng);
- };
-
- return {
- createBookmark: createBookmark,
- resolveBookmark: resolveBookmark
- };
- }
-);
-
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.DomQuery',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.DomQuery');
- }
-);
-
-/**
- * Selection.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.core.Selection',
- [
- 'tinymce.core.dom.DomQuery',
- 'tinymce.core.util.Tools',
- 'tinymce.plugins.lists.core.NodeType'
- ],
- function (DomQuery, Tools, NodeType) {
- var getParentList = function (editor) {
- return editor.dom.getParent(editor.selection.getStart(true), 'OL,UL,DL');
- };
-
- var getSelectedSubLists = function (editor) {
- var parentList = getParentList(editor);
- return Tools.grep(editor.selection.getSelectedBlocks(), function (elm) {
- return NodeType.isListNode(elm) && parentList !== elm;
- });
- };
-
- var findParentListItemsNodes = function (editor, elms) {
- var listItemsElms = Tools.map(elms, function (elm) {
- var parentLi = editor.dom.getParent(elm, 'li,dd,dt', editor.getBody());
-
- return parentLi ? parentLi : elm;
- });
-
- return DomQuery.unique(listItemsElms);
- };
-
- var getSelectedListItems = function (editor) {
- var selectedBlocks = editor.selection.getSelectedBlocks();
- return Tools.grep(findParentListItemsNodes(editor, selectedBlocks), function (block) {
- return NodeType.isListItemNode(block);
- });
- };
-
- return {
- getParentList: getParentList,
- getSelectedSubLists: getSelectedSubLists,
- getSelectedListItems: getSelectedListItems
- };
- }
-);
-
-
-/**
- * Indent.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.actions.Indent',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.plugins.lists.core.Bookmark',
- 'tinymce.plugins.lists.core.NodeType',
- 'tinymce.plugins.lists.core.Selection'
- ],
- function (DOMUtils, Bookmark, NodeType, Selection) {
- var DOM = DOMUtils.DOM;
-
- var mergeLists = function (from, to) {
- var node;
-
- if (NodeType.isListNode(from)) {
- while ((node = from.firstChild)) {
- to.appendChild(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (container.nodeType === 1) {
+ offset = nodeIndex(container);
+ container = container.parentNode;
+ DOM.remove(node);
+ if (!container.hasChildNodes() && DOM.isBlock(container)) {
+ container.appendChild(DOM.create('br'));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- DOM.remove(from);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ bookmark[start ? 'startContainer' : 'endContainer'] = container;
+ bookmark[start ? 'startOffset' : 'endOffset'] = offset;
+ }
+ restoreEndPoint(true);
+ restoreEndPoint();
+ var rng = DOM.createRng();
+ rng.setStart(bookmark.startContainer, bookmark.startOffset);
+ if (bookmark.endContainer) {
+ rng.setEnd(bookmark.endContainer, bookmark.endOffset);
+ }
+ return $_14fh94frjfuw8plp.normalizeRange(rng);
+ };
+ var $_3byghwfqjfuw8pln = {
+ createBookmark: createBookmark,
+ resolveBookmark: resolveBookmark
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var indent = function (li) {
- var sibling, newList, listStyle;
-
- if (li.nodeName === 'DT') {
- DOM.rename(li, 'DD');
- return true;
- }
-
- sibling = li.previousSibling;
-
- if (sibling && NodeType.isListNode(sibling)) {
- sibling.appendChild(li);
- return true;
- }
-
- if (sibling && sibling.nodeName === 'LI' && NodeType.isListNode(sibling.lastChild)) {
- sibling.lastChild.appendChild(li);
- mergeLists(li.lastChild, sibling.lastChild);
- return true;
- }
-
- sibling = li.nextSibling;
-
- if (sibling && NodeType.isListNode(sibling)) {
- sibling.insertBefore(li, sibling.firstChild);
- return true;
- }
-
- /*if (sibling && sibling.nodeName === 'LI' && isListNode(li.lastChild)) {
- return false;
- }*/
-
- sibling = li.previousSibling;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$1 = global$6.DOM;
+ var normalizeList = function (dom, ul) {
+ var sibling;
+ var parentNode = ul.parentNode;
+ if (parentNode.nodeName === 'LI' && parentNode.firstChild === ul) {
+ sibling = parentNode.previousSibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> if (sibling && sibling.nodeName === 'LI') {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- newList = DOM.create(li.parentNode.nodeName);
- listStyle = DOM.getStyle(li.parentNode, 'listStyleType');
- if (listStyle) {
- DOM.setStyle(newList, 'listStyleType', listStyle);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sibling.appendChild(ul);
+ if ($_fmlqy7fsjfuw8plr.isEmpty(dom, parentNode)) {
+ DOM$1.remove(parentNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- sibling.appendChild(newList);
- newList.appendChild(li);
- mergeLists(li.lastChild, newList);
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ DOM$1.setStyle(parentNode, 'listStyleType', 'none');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
- };
-
- var indentSelection = function (editor) {
- var listElements = Selection.getSelectedListItems(editor);
-
- if (listElements.length) {
- var bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
-
- for (var i = 0; i < listElements.length; i++) {
- if (!indent(listElements[i]) && i === 0) {
- break;
- }
- }
-
- editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
- editor.nodeChanged();
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if ($_fmlqy7fsjfuw8plr.isListNode(parentNode)) {
+ sibling = parentNode.previousSibling;
+ if (sibling && sibling.nodeName === 'LI') {
+ sibling.appendChild(ul);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var normalizeLists = function (dom, element) {
+ global$5.each(global$5.grep(dom.select('ol,ul', element)), function (ul) {
+ normalizeList(dom, ul);
+ });
+ };
+ var $_7p90zmftjfuw8plu = {
+ normalizeList: normalizeList,
+ normalizeLists: normalizeLists
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- indentSelection: indentSelection
- };
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$7 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getParentList = function (editor) {
+ var selectionStart = editor.selection.getStart(true);
+ return editor.dom.getParent(selectionStart, 'OL,UL,DL', getClosestListRootElm(editor, selectionStart));
+ };
+ var isParentListSelected = function (parentList, selectedBlocks) {
+ return parentList && selectedBlocks.length === 1 && selectedBlocks[0] === parentList;
+ };
+ var findSubLists = function (parentList) {
+ return global$5.grep(parentList.querySelectorAll('ol,ul,dl'), function (elm) {
+ return $_fmlqy7fsjfuw8plr.isListNode(elm);
+ });
+ };
+ var getSelectedSubLists = function (editor) {
+ var parentList = getParentList(editor);
+ var selectedBlocks = editor.selection.getSelectedBlocks();
+ if (isParentListSelected(parentList, selectedBlocks)) {
+ return findSubLists(parentList);
+ } else {
+ return global$5.grep(selectedBlocks, function (elm) {
+ return $_fmlqy7fsjfuw8plr.isListNode(elm) && parentList !== elm;
+ });
+ }
+ };
+ var findParentListItemsNodes = function (editor, elms) {
+ var listItemsElms = global$5.map(elms, function (elm) {
+ var parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm));
+ return parentLi ? parentLi : elm;
+ });
+ return global$7.unique(listItemsElms);
+ };
+ var getSelectedListItems = function (editor) {
+ var selectedBlocks = editor.selection.getSelectedBlocks();
+ return global$5.grep(findParentListItemsNodes(editor, selectedBlocks), function (block) {
+ return $_fmlqy7fsjfuw8plr.isListItemNode(block);
+ });
+ };
+ var getClosestListRootElm = function (editor, elm) {
+ var parentTableCell = editor.dom.getParents(elm, 'TD,TH');
+ var root = parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();
+ return root;
+ };
+ var $_2bncsnfujfuw8plw = {
+ getParentList: getParentList,
+ getSelectedSubLists: getSelectedSubLists,
+ getSelectedListItems: getSelectedListItems,
+ getClosestListRootElm: getClosestListRootElm
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * NormalizeLists.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$8 = tinymce.util.Tools.resolve('tinymce.Env');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.plugins.lists.core.NormalizeLists',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.util.Tools',
- 'tinymce.plugins.lists.core.NodeType'
- ],
- function (DOMUtils, Tools, NodeType) {
- var DOM = DOMUtils.DOM;
-
- var normalizeList = function (dom, ul) {
- var sibling, parentNode = ul.parentNode;
-
- // Move UL/OL to previous LI if it's the only child of a LI
- if (parentNode.nodeName === 'LI' && parentNode.firstChild === ul) {
- sibling = parentNode.previousSibling;
- if (sibling && sibling.nodeName === 'LI') {
- sibling.appendChild(ul);
-
- if (NodeType.isEmpty(dom, parentNode)) {
- DOM.remove(parentNode);
- }
- } else {
- DOM.setStyle(parentNode, 'listStyleType', 'none');
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$2 = global$6.DOM;
+ var createNewTextBlock = function (editor, contentNode, blockName) {
+ var node, textBlock;
+ var fragment = DOM$2.createFragment();
+ var hasContentNode;
+ var blockElements = editor.schema.getBlockElements();
+ if (editor.settings.forced_root_block) {
+ blockName = blockName || editor.settings.forced_root_block;
+ }
+ if (blockName) {
+ textBlock = DOM$2.create(blockName);
+ if (textBlock.tagName === editor.settings.forced_root_block) {
+ DOM$2.setAttribs(textBlock, editor.settings.forced_root_block_attrs);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Append OL/UL to previous LI if it's in a parent OL/UL i.e. old HTML4
- if (NodeType.isListNode(parentNode)) {
- sibling = parentNode.previousSibling;
- if (sibling && sibling.nodeName === 'LI') {
- sibling.appendChild(ul);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!$_fmlqy7fsjfuw8plr.isBlock(contentNode.firstChild, blockElements)) {
+ fragment.appendChild(textBlock);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var normalizeLists = function (dom, element) {
- Tools.each(Tools.grep(dom.select('ol,ul', element)), function (ul) {
- normalizeList(dom, ul);
- });
- };
-
- return {
- normalizeList: normalizeList,
- normalizeLists: normalizeLists
- };
- }
-);
-
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.Env',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.Env');
- }
-);
-
-/**
- * TextBlock.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.core.TextBlock',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.Env',
- 'tinymce.plugins.lists.core.NodeType'
- ],
- function (DOMUtils, Env, NodeType) {
- var DOM = DOMUtils.DOM;
-
- var createNewTextBlock = function (editor, contentNode, blockName) {
- var node, textBlock, fragment = DOM.createFragment(), hasContentNode;
- var blockElements = editor.schema.getBlockElements();
-
- if (editor.settings.forced_root_block) {
- blockName = blockName || editor.settings.forced_root_block;
- }
-
- if (blockName) {
- textBlock = DOM.create(blockName);
-
- if (textBlock.tagName === editor.settings.forced_root_block) {
- DOM.setAttribs(textBlock, editor.settings.forced_root_block_attrs);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (contentNode) {
+ while (node = contentNode.firstChild) {
+ var nodeName = node.nodeName;
+ if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) {
+ hasContentNode = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!NodeType.isBlock(contentNode.firstChild, blockElements)) {
- fragment.appendChild(textBlock);
- }
- }
-
- if (contentNode) {
- while ((node = contentNode.firstChild)) {
- var nodeName = node.nodeName;
-
- if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) {
- hasContentNode = true;
- }
-
- if (NodeType.isBlock(node, blockElements)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_fmlqy7fsjfuw8plr.isBlock(node, blockElements)) {
+ fragment.appendChild(node);
+ textBlock = null;
+ } else {
+ if (blockName) {
+ if (!textBlock) {
+ textBlock = DOM$2.create(blockName);
+ fragment.appendChild(textBlock);
+ }
+ textBlock.appendChild(node);
+ } else {
</ins><span class="cx" style="display: block; padding: 0 10px"> fragment.appendChild(node);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- textBlock = null;
- } else {
- if (blockName) {
- if (!textBlock) {
- textBlock = DOM.create(blockName);
- fragment.appendChild(textBlock);
- }
-
- textBlock.appendChild(node);
- } else {
- fragment.appendChild(node);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!editor.settings.forced_root_block) {
- fragment.appendChild(DOM.create('br'));
- } else {
- // BR is needed in empty blocks on non IE browsers
- if (!hasContentNode && (!Env.ie || Env.ie > 10)) {
- textBlock.appendChild(DOM.create('br', { 'data-mce-bogus': '1' }));
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (!editor.settings.forced_root_block) {
+ fragment.appendChild(DOM$2.create('br'));
+ } else {
+ if (!hasContentNode && (!global$8.ie || global$8.ie > 10)) {
+ textBlock.appendChild(DOM$2.create('br', { 'data-mce-bogus': '1' }));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return fragment;
+ };
+ var $_3c0i4zfxjfuw8pm1 = { createNewTextBlock: createNewTextBlock };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return fragment;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$3 = global$6.DOM;
+ var splitList = function (editor, ul, li, newBlock) {
+ var tmpRng, fragment, bookmarks, node;
+ var removeAndKeepBookmarks = function (targetNode) {
+ global$5.each(bookmarks, function (node) {
+ targetNode.parentNode.insertBefore(node, li.parentNode);
+ });
+ DOM$3.remove(targetNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- createNewTextBlock: createNewTextBlock
- };
- }
-);
-
-/**
- * SplitList.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.core.SplitList',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.plugins.lists.core.NodeType',
- 'tinymce.plugins.lists.core.TextBlock',
- 'tinymce.core.util.Tools'
- ],
- function (DOMUtils, NodeType, TextBlock, Tools) {
- var DOM = DOMUtils.DOM;
-
- var splitList = function (editor, ul, li, newBlock) {
- var tmpRng, fragment, bookmarks, node;
-
- var removeAndKeepBookmarks = function (targetNode) {
- Tools.each(bookmarks, function (node) {
- targetNode.parentNode.insertBefore(node, li.parentNode);
- });
-
- DOM.remove(targetNode);
- };
-
- bookmarks = DOM.select('span[data-mce-type="bookmark"]', ul);
- newBlock = newBlock || TextBlock.createNewTextBlock(editor, li);
- tmpRng = DOM.createRng();
- tmpRng.setStartAfter(li);
- tmpRng.setEndAfter(ul);
- fragment = tmpRng.extractContents();
-
- for (node = fragment.firstChild; node; node = node.firstChild) {
- if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) {
- DOM.remove(node);
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ bookmarks = DOM$3.select('span[data-mce-type="bookmark"]', ul);
+ newBlock = newBlock || $_3c0i4zfxjfuw8pm1.createNewTextBlock(editor, li);
+ tmpRng = DOM$3.createRng();
+ tmpRng.setStartAfter(li);
+ tmpRng.setEndAfter(ul);
+ fragment = tmpRng.extractContents();
+ for (node = fragment.firstChild; node; node = node.firstChild) {
+ if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) {
+ DOM$3.remove(node);
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (!editor.dom.isEmpty(fragment)) {
+ DOM$3.insertAfter(fragment, ul);
+ }
+ DOM$3.insertAfter(newBlock, ul);
+ if ($_fmlqy7fsjfuw8plr.isEmpty(editor.dom, li.parentNode)) {
+ removeAndKeepBookmarks(li.parentNode);
+ }
+ DOM$3.remove(li);
+ if ($_fmlqy7fsjfuw8plr.isEmpty(editor.dom, ul)) {
+ DOM$3.remove(ul);
+ }
+ };
+ var $_dbkw03fwjfuw8plz = { splitList: splitList };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (!editor.dom.isEmpty(fragment)) {
- DOM.insertAfter(fragment, ul);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$4 = global$6.DOM;
+ var removeEmptyLi = function (dom, li) {
+ if ($_fmlqy7fsjfuw8plr.isEmpty(dom, li)) {
+ DOM$4.remove(li);
+ }
+ };
+ var outdent = function (editor, li) {
+ var ul = li.parentNode;
+ var ulParent, newBlock;
+ if (ul) {
+ ulParent = ul.parentNode;
+ } else {
+ removeEmptyLi(editor.dom, li);
+ return true;
+ }
+ if (ul === editor.getBody()) {
+ return true;
+ }
+ if (li.nodeName === 'DD') {
+ DOM$4.rename(li, 'DT');
+ return true;
+ }
+ if ($_fmlqy7fsjfuw8plr.isFirstChild(li) && $_fmlqy7fsjfuw8plr.isLastChild(li)) {
+ if (ulParent.nodeName === 'LI') {
+ DOM$4.insertAfter(li, ulParent);
+ removeEmptyLi(editor.dom, ulParent);
+ DOM$4.remove(ul);
+ } else if ($_fmlqy7fsjfuw8plr.isListNode(ulParent)) {
+ DOM$4.remove(ul, true);
+ } else {
+ ulParent.insertBefore($_3c0i4zfxjfuw8pm1.createNewTextBlock(editor, li), ul);
+ DOM$4.remove(ul);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- DOM.insertAfter(newBlock, ul);
-
- if (NodeType.isEmpty(editor.dom, li.parentNode)) {
- removeAndKeepBookmarks(li.parentNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ } else if ($_fmlqy7fsjfuw8plr.isFirstChild(li)) {
+ if (ulParent.nodeName === 'LI') {
+ DOM$4.insertAfter(li, ulParent);
+ li.appendChild(ul);
+ removeEmptyLi(editor.dom, ulParent);
+ } else if ($_fmlqy7fsjfuw8plr.isListNode(ulParent)) {
+ ulParent.insertBefore(li, ul);
+ } else {
+ ulParent.insertBefore($_3c0i4zfxjfuw8pm1.createNewTextBlock(editor, li), ul);
+ DOM$4.remove(li);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- DOM.remove(li);
-
- if (NodeType.isEmpty(editor.dom, ul)) {
- DOM.remove(ul);
- }
- };
-
- return {
- splitList: splitList
- };
- }
-);
-
-
-/**
- * Outdent.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.actions.Outdent',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.plugins.lists.core.Bookmark',
- 'tinymce.plugins.lists.core.NodeType',
- 'tinymce.plugins.lists.core.NormalizeLists',
- 'tinymce.plugins.lists.core.Selection',
- 'tinymce.plugins.lists.core.SplitList',
- 'tinymce.plugins.lists.core.TextBlock'
- ],
- function (DOMUtils, Bookmark, NodeType, NormalizeLists, Selection, SplitList, TextBlock) {
- var DOM = DOMUtils.DOM;
-
- var removeEmptyLi = function (dom, li) {
- if (NodeType.isEmpty(dom, li)) {
- DOM.remove(li);
- }
- };
-
- var outdent = function (editor, li) {
- var ul = li.parentNode, ulParent = ul.parentNode, newBlock;
-
- if (ul === editor.getBody()) {
- return true;
- }
-
- if (li.nodeName === 'DD') {
- DOM.rename(li, 'DT');
- return true;
- }
-
- if (NodeType.isFirstChild(li) && NodeType.isLastChild(li)) {
- if (ulParent.nodeName === "LI") {
- DOM.insertAfter(li, ulParent);
- removeEmptyLi(editor.dom, ulParent);
- DOM.remove(ul);
- } else if (NodeType.isListNode(ulParent)) {
- DOM.remove(ul, true);
- } else {
- ulParent.insertBefore(TextBlock.createNewTextBlock(editor, li), ul);
- DOM.remove(ul);
- }
-
- return true;
- } else if (NodeType.isFirstChild(li)) {
- if (ulParent.nodeName === "LI") {
- DOM.insertAfter(li, ulParent);
- li.appendChild(ul);
- removeEmptyLi(editor.dom, ulParent);
- } else if (NodeType.isListNode(ulParent)) {
- ulParent.insertBefore(li, ul);
- } else {
- ulParent.insertBefore(TextBlock.createNewTextBlock(editor, li), ul);
- DOM.remove(li);
- }
-
- return true;
- } else if (NodeType.isLastChild(li)) {
- if (ulParent.nodeName === "LI") {
- DOM.insertAfter(li, ulParent);
- } else if (NodeType.isListNode(ulParent)) {
- DOM.insertAfter(li, ul);
- } else {
- DOM.insertAfter(TextBlock.createNewTextBlock(editor, li), ul);
- DOM.remove(li);
- }
-
- return true;
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ } else if ($_fmlqy7fsjfuw8plr.isLastChild(li)) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if (ulParent.nodeName === 'LI') {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ul = ulParent;
- newBlock = TextBlock.createNewTextBlock(editor, li, 'LI');
- } else if (NodeType.isListNode(ulParent)) {
- newBlock = TextBlock.createNewTextBlock(editor, li, 'LI');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ DOM$4.insertAfter(li, ulParent);
+ } else if ($_fmlqy7fsjfuw8plr.isListNode(ulParent)) {
+ DOM$4.insertAfter(li, ul);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- newBlock = TextBlock.createNewTextBlock(editor, li);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ DOM$4.insertAfter($_3c0i4zfxjfuw8pm1.createNewTextBlock(editor, li), ul);
+ DOM$4.remove(li);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- SplitList.splitList(editor, ul, li, newBlock);
- NormalizeLists.normalizeLists(editor.dom, ul.parentNode);
-
</del><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var outdentSelection = function (editor) {
- var listElements = Selection.getSelectedListItems(editor);
-
- if (listElements.length) {
- var bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
- var i, y, root = editor.getBody();
-
- i = listElements.length;
- while (i--) {
- var node = listElements[i].parentNode;
-
- while (node && node !== root) {
- y = listElements.length;
- while (y--) {
- if (listElements[y] === node) {
- listElements.splice(i, 1);
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (ulParent.nodeName === 'LI') {
+ ul = ulParent;
+ newBlock = $_3c0i4zfxjfuw8pm1.createNewTextBlock(editor, li, 'LI');
+ } else if ($_fmlqy7fsjfuw8plr.isListNode(ulParent)) {
+ newBlock = $_3c0i4zfxjfuw8pm1.createNewTextBlock(editor, li, 'LI');
+ } else {
+ newBlock = $_3c0i4zfxjfuw8pm1.createNewTextBlock(editor, li);
+ }
+ $_dbkw03fwjfuw8plz.splitList(editor, ul, li, newBlock);
+ $_7p90zmftjfuw8plu.normalizeLists(editor.dom, ul.parentNode);
+ return true;
+ };
+ var outdentSelection = function (editor) {
+ var listElements = $_2bncsnfujfuw8plw.getSelectedListItems(editor);
+ if (listElements.length) {
+ var bookmark = $_3byghwfqjfuw8pln.createBookmark(editor.selection.getRng());
+ var i = void 0, y = void 0;
+ var root = $_2bncsnfujfuw8plw.getClosestListRootElm(editor, editor.selection.getStart(true));
+ i = listElements.length;
+ while (i--) {
+ var node = listElements[i].parentNode;
+ while (node && node !== root) {
+ y = listElements.length;
+ while (y--) {
+ if (listElements[y] === node) {
+ listElements.splice(i, 1);
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node = node.parentNode;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (i = 0; i < listElements.length; i++) {
- if (!outdent(editor, listElements[i]) && i === 0) {
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ for (i = 0; i < listElements.length; i++) {
+ if (!outdent(editor, listElements[i]) && i === 0) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
- editor.nodeChanged();
-
- return true;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.selection.setRng($_3byghwfqjfuw8pln.resolveBookmark(bookmark));
+ editor.nodeChanged();
+ return true;
+ }
+ };
+ var $_b067pwfojfuw8plj = {
+ outdent: outdent,
+ outdentSelection: outdentSelection
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- outdent: outdent,
- outdentSelection: outdentSelection
- };
- }
-);
-
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.BookmarkManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.BookmarkManager');
- }
-);
-
-/**
- * ToggleList.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.actions.ToggleList',
- [
- 'tinymce.core.dom.BookmarkManager',
- 'tinymce.core.util.Tools',
- 'tinymce.plugins.lists.actions.Outdent',
- 'tinymce.plugins.lists.core.Bookmark',
- 'tinymce.plugins.lists.core.NodeType',
- 'tinymce.plugins.lists.core.NormalizeLists',
- 'tinymce.plugins.lists.core.Selection',
- 'tinymce.plugins.lists.core.SplitList'
- ],
- function (BookmarkManager, Tools, Outdent, Bookmark, NodeType, NormalizeLists, Selection, SplitList) {
- var updateListStyle = function (dom, el, detail) {
- var type = detail['list-style-type'] ? detail['list-style-type'] : null;
- dom.setStyle(el, 'list-style-type', type);
- };
-
- var setAttribs = function (elm, attrs) {
- Tools.each(attrs, function (value, key) {
- elm.setAttribute(key, value);
- });
- };
-
- var updateListAttrs = function (dom, el, detail) {
- setAttribs(el, detail['list-attributes']);
- Tools.each(dom.select('li', el), function (li) {
- setAttribs(li, detail['list-item-attributes']);
- });
- };
-
- var updateListWithDetails = function (dom, el, detail) {
- updateListStyle(dom, el, detail);
- updateListAttrs(dom, el, detail);
- };
-
- var getEndPointNode = function (editor, rng, start) {
- var container, offset, root = editor.getBody();
-
- container = rng[start ? 'startContainer' : 'endContainer'];
- offset = rng[start ? 'startOffset' : 'endOffset'];
-
- // Resolve node index
- if (container.nodeType === 1) {
- container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var updateListStyle = function (dom, el, detail) {
+ var type = detail['list-style-type'] ? detail['list-style-type'] : null;
+ dom.setStyle(el, 'list-style-type', type);
+ };
+ var setAttribs = function (elm, attrs) {
+ global$5.each(attrs, function (value, key) {
+ elm.setAttribute(key, value);
+ });
+ };
+ var updateListAttrs = function (dom, el, detail) {
+ setAttribs(el, detail['list-attributes']);
+ global$5.each(dom.select('li', el), function (li) {
+ setAttribs(li, detail['list-item-attributes']);
+ });
+ };
+ var updateListWithDetails = function (dom, el, detail) {
+ updateListStyle(dom, el, detail);
+ updateListAttrs(dom, el, detail);
+ };
+ var removeStyles = function (dom, element, styles) {
+ global$5.each(styles, function (style) {
+ return dom.setStyle(element, (_a = {}, _a[style] = '', _a));
+ var _a;
+ });
+ };
+ var getEndPointNode = function (editor, rng, start, root) {
+ var container, offset;
+ container = rng[start ? 'startContainer' : 'endContainer'];
+ offset = rng[start ? 'startOffset' : 'endOffset'];
+ if (container.nodeType === 1) {
+ container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
+ }
+ if (!start && $_fmlqy7fsjfuw8plr.isBr(container.nextSibling)) {
+ container = container.nextSibling;
+ }
+ while (container.parentNode !== root) {
+ if ($_fmlqy7fsjfuw8plr.isTextBlock(editor, container)) {
+ return container;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- while (container.parentNode !== root) {
- if (NodeType.isTextBlock(editor, container)) {
- return container;
- }
-
- if (/^(TD|TH)$/.test(container.parentNode.nodeName)) {
- return container;
- }
-
- container = container.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (/^(TD|TH)$/.test(container.parentNode.nodeName)) {
+ return container;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return container;
- };
-
- var getSelectedTextBlocks = function (editor, rng) {
- var textBlocks = [], root = editor.getBody(), dom = editor.dom;
-
- var startNode = getEndPointNode(editor, rng, true);
- var endNode = getEndPointNode(editor, rng, false);
- var block, siblings = [];
-
- for (var node = startNode; node; node = node.nextSibling) {
- siblings.push(node);
-
- if (node === endNode) {
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = container.parentNode;
+ }
+ return container;
+ };
+ var getSelectedTextBlocks = function (editor, rng, root) {
+ var textBlocks = [], dom = editor.dom;
+ var startNode = getEndPointNode(editor, rng, true, root);
+ var endNode = getEndPointNode(editor, rng, false, root);
+ var block;
+ var siblings = [];
+ for (var node = startNode; node; node = node.nextSibling) {
+ siblings.push(node);
+ if (node === endNode) {
+ break;
+ }
+ }
+ global$5.each(siblings, function (node) {
+ if ($_fmlqy7fsjfuw8plr.isTextBlock(editor, node)) {
+ textBlocks.push(node);
+ block = null;
+ return;
+ }
+ if (dom.isBlock(node) || $_fmlqy7fsjfuw8plr.isBr(node)) {
+ if ($_fmlqy7fsjfuw8plr.isBr(node)) {
+ dom.remove(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ block = null;
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- Tools.each(siblings, function (node) {
- if (NodeType.isTextBlock(editor, node)) {
- textBlocks.push(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var nextSibling = node.nextSibling;
+ if (global$4.isBookmarkNode(node)) {
+ if ($_fmlqy7fsjfuw8plr.isTextBlock(editor, nextSibling) || !nextSibling && node.parentNode === root) {
</ins><span class="cx" style="display: block; padding: 0 10px"> block = null;
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (dom.isBlock(node) || NodeType.isBr(node)) {
- if (NodeType.isBr(node)) {
- dom.remove(node);
- }
-
- block = null;
- return;
- }
-
- var nextSibling = node.nextSibling;
- if (BookmarkManager.isBookmarkNode(node)) {
- if (NodeType.isTextBlock(editor, nextSibling) || (!nextSibling && node.parentNode === root)) {
- block = null;
- return;
- }
- }
-
- if (!block) {
- block = dom.create('p');
- node.parentNode.insertBefore(block, node);
- textBlocks.push(block);
- }
-
- block.appendChild(node);
- });
-
- return textBlocks;
- };
-
- var applyList = function (editor, listName, detail) {
- var rng = editor.selection.getRng(true), bookmark, listItemName = 'LI';
- var dom = editor.dom;
-
- detail = detail ? detail : {};
-
- if (dom.getContentEditable(editor.selection.getNode()) === "false") {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (!block) {
+ block = dom.create('p');
+ node.parentNode.insertBefore(block, node);
+ textBlocks.push(block);
+ }
+ block.appendChild(node);
+ });
+ return textBlocks;
+ };
+ var hasCompatibleStyle = function (dom, sib, detail) {
+ var sibStyle = dom.getStyle(sib, 'list-style-type');
+ var detailStyle = detail ? detail['list-style-type'] : '';
+ detailStyle = detailStyle === null ? '' : detailStyle;
+ return sibStyle === detailStyle;
+ };
+ var applyList = function (editor, listName, detail) {
+ if (detail === void 0) {
+ detail = {};
+ }
+ var rng = editor.selection.getRng(true);
+ var bookmark;
+ var listItemName = 'LI';
+ var root = $_2bncsnfujfuw8plw.getClosestListRootElm(editor, editor.selection.getStart(true));
+ var dom = editor.dom;
+ if (dom.getContentEditable(editor.selection.getNode()) === 'false') {
+ return;
+ }
+ listName = listName.toUpperCase();
+ if (listName === 'DL') {
+ listItemName = 'DT';
+ }
+ bookmark = $_3byghwfqjfuw8pln.createBookmark(rng);
+ global$5.each(getSelectedTextBlocks(editor, rng, root), function (block) {
+ var listBlock, sibling;
+ sibling = block.previousSibling;
+ if (sibling && $_fmlqy7fsjfuw8plr.isListNode(sibling) && sibling.nodeName === listName && hasCompatibleStyle(dom, sibling, detail)) {
+ listBlock = sibling;
+ block = dom.rename(block, listItemName);
+ sibling.appendChild(block);
+ } else {
+ listBlock = dom.create(listName);
+ block.parentNode.insertBefore(listBlock, block);
+ listBlock.appendChild(block);
+ block = dom.rename(block, listItemName);
+ }
+ removeStyles(dom, block, [
+ 'margin',
+ 'margin-right',
+ 'margin-bottom',
+ 'margin-left',
+ 'margin-top',
+ 'padding',
+ 'padding-right',
+ 'padding-bottom',
+ 'padding-left',
+ 'padding-top'
+ ]);
+ updateListWithDetails(dom, listBlock, detail);
+ mergeWithAdjacentLists(editor.dom, listBlock);
+ });
+ editor.selection.setRng($_3byghwfqjfuw8pln.resolveBookmark(bookmark));
+ };
+ var removeList = function (editor) {
+ var bookmark = $_3byghwfqjfuw8pln.createBookmark(editor.selection.getRng(true));
+ var root = $_2bncsnfujfuw8plw.getClosestListRootElm(editor, editor.selection.getStart(true));
+ var listItems = $_2bncsnfujfuw8plw.getSelectedListItems(editor);
+ var emptyListItems = global$5.grep(listItems, function (li) {
+ return editor.dom.isEmpty(li);
+ });
+ listItems = global$5.grep(listItems, function (li) {
+ return !editor.dom.isEmpty(li);
+ });
+ global$5.each(emptyListItems, function (li) {
+ if ($_fmlqy7fsjfuw8plr.isEmpty(editor.dom, li)) {
+ $_b067pwfojfuw8plj.outdent(editor, li);
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- listName = listName.toUpperCase();
-
- if (listName === 'DL') {
- listItemName = 'DT';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ global$5.each(listItems, function (li) {
+ var node, rootList;
+ if (li.parentNode === editor.getBody()) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- bookmark = Bookmark.createBookmark(rng);
-
- Tools.each(getSelectedTextBlocks(editor, rng), function (block) {
- var listBlock, sibling;
-
- var hasCompatibleStyle = function (sib) {
- var sibStyle = dom.getStyle(sib, 'list-style-type');
- var detailStyle = detail ? detail['list-style-type'] : '';
-
- detailStyle = detailStyle === null ? '' : detailStyle;
-
- return sibStyle === detailStyle;
- };
-
- sibling = block.previousSibling;
- if (sibling && NodeType.isListNode(sibling) && sibling.nodeName === listName && hasCompatibleStyle(sibling)) {
- listBlock = sibling;
- block = dom.rename(block, listItemName);
- sibling.appendChild(block);
- } else {
- listBlock = dom.create(listName);
- block.parentNode.insertBefore(listBlock, block);
- listBlock.appendChild(block);
- block = dom.rename(block, listItemName);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (node = li; node && node !== root; node = node.parentNode) {
+ if ($_fmlqy7fsjfuw8plr.isListNode(node)) {
+ rootList = node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- updateListWithDetails(dom, listBlock, detail);
- mergeWithAdjacentLists(editor.dom, listBlock);
- });
-
- editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
- };
-
- var removeList = function (editor) {
- var bookmark = Bookmark.createBookmark(editor.selection.getRng(true)), root = editor.getBody();
- var listItems = Selection.getSelectedListItems(editor);
- var emptyListItems = Tools.grep(listItems, function (li) {
- return editor.dom.isEmpty(li);
- });
-
- listItems = Tools.grep(listItems, function (li) {
- return !editor.dom.isEmpty(li);
- });
-
- Tools.each(emptyListItems, function (li) {
- if (NodeType.isEmpty(editor.dom, li)) {
- Outdent.outdent(editor, li);
- return;
- }
- });
-
- Tools.each(listItems, function (li) {
- var node, rootList;
-
- if (li.parentNode === editor.getBody()) {
- return;
- }
-
- for (node = li; node && node !== root; node = node.parentNode) {
- if (NodeType.isListNode(node)) {
- rootList = node;
- }
- }
-
- SplitList.splitList(editor, rootList, li);
- NormalizeLists.normalizeLists(editor.dom, rootList.parentNode);
- });
-
- editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
- };
-
- var isValidLists = function (list1, list2) {
- return list1 && list2 && NodeType.isListNode(list1) && list1.nodeName === list2.nodeName;
- };
-
- var hasSameListStyle = function (dom, list1, list2) {
- var targetStyle = dom.getStyle(list1, 'list-style-type', true);
- var style = dom.getStyle(list2, 'list-style-type', true);
- return targetStyle === style;
- };
-
- var hasSameClasses = function (elm1, elm2) {
- return elm1.className === elm2.className;
- };
-
- var shouldMerge = function (dom, list1, list2) {
- return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2);
- };
-
- var mergeWithAdjacentLists = function (dom, listBlock) {
- var sibling, node;
-
- sibling = listBlock.nextSibling;
- if (shouldMerge(dom, listBlock, sibling)) {
- while ((node = sibling.firstChild)) {
- listBlock.appendChild(node);
- }
-
- dom.remove(sibling);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- sibling = listBlock.previousSibling;
- if (shouldMerge(dom, listBlock, sibling)) {
- while ((node = sibling.lastChild)) {
- listBlock.insertBefore(node, listBlock.firstChild);
- }
-
- dom.remove(sibling);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_dbkw03fwjfuw8plz.splitList(editor, rootList, li);
+ $_7p90zmftjfuw8plu.normalizeLists(editor.dom, rootList.parentNode);
+ });
+ editor.selection.setRng($_3byghwfqjfuw8pln.resolveBookmark(bookmark));
+ };
+ var isValidLists = function (list1, list2) {
+ return list1 && list2 && $_fmlqy7fsjfuw8plr.isListNode(list1) && list1.nodeName === list2.nodeName;
+ };
+ var hasSameListStyle = function (dom, list1, list2) {
+ var targetStyle = dom.getStyle(list1, 'list-style-type', true);
+ var style = dom.getStyle(list2, 'list-style-type', true);
+ return targetStyle === style;
+ };
+ var hasSameClasses = function (elm1, elm2) {
+ return elm1.className === elm2.className;
+ };
+ var shouldMerge = function (dom, list1, list2) {
+ return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2);
+ };
+ var mergeWithAdjacentLists = function (dom, listBlock) {
+ var sibling, node;
+ sibling = listBlock.nextSibling;
+ if (shouldMerge(dom, listBlock, sibling)) {
+ while (node = sibling.firstChild) {
+ listBlock.appendChild(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var updateList = function (dom, list, listName, detail) {
- if (list.nodeName !== listName) {
- var newList = dom.rename(list, listName);
- updateListWithDetails(dom, newList, detail);
- } else {
- updateListWithDetails(dom, list, detail);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.remove(sibling);
+ }
+ sibling = listBlock.previousSibling;
+ if (shouldMerge(dom, listBlock, sibling)) {
+ while (node = sibling.lastChild) {
+ listBlock.insertBefore(node, listBlock.firstChild);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var toggleMultipleLists = function (editor, parentList, lists, listName, detail) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.remove(sibling);
+ }
+ };
+ var updateList = function (dom, list, listName, detail) {
+ if (list.nodeName !== listName) {
+ var newList = dom.rename(list, listName);
+ updateListWithDetails(dom, newList, detail);
+ } else {
+ updateListWithDetails(dom, list, detail);
+ }
+ };
+ var toggleMultipleLists = function (editor, parentList, lists, listName, detail) {
+ if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
+ removeList(editor);
+ } else {
+ var bookmark = $_3byghwfqjfuw8pln.createBookmark(editor.selection.getRng(true));
+ global$5.each([parentList].concat(lists), function (elm) {
+ updateList(editor.dom, elm, listName, detail);
+ });
+ editor.selection.setRng($_3byghwfqjfuw8pln.resolveBookmark(bookmark));
+ }
+ };
+ var hasListStyleDetail = function (detail) {
+ return 'list-style-type' in detail;
+ };
+ var toggleSingleList = function (editor, parentList, listName, detail) {
+ if (parentList === editor.getBody()) {
+ return;
+ }
+ if (parentList) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- removeList(editor, listName);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ removeList(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
-
- Tools.each([parentList].concat(lists), function (elm) {
- updateList(editor.dom, elm, listName, detail);
- });
-
- editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var bookmark = $_3byghwfqjfuw8pln.createBookmark(editor.selection.getRng(true));
+ updateListWithDetails(editor.dom, parentList, detail);
+ mergeWithAdjacentLists(editor.dom, editor.dom.rename(parentList, listName));
+ editor.selection.setRng($_3byghwfqjfuw8pln.resolveBookmark(bookmark));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ applyList(editor, listName, detail);
+ }
+ };
+ var toggleList = function (editor, listName, detail) {
+ var parentList = $_2bncsnfujfuw8plw.getParentList(editor);
+ var selectedSubLists = $_2bncsnfujfuw8plw.getSelectedSubLists(editor);
+ detail = detail ? detail : {};
+ if (parentList && selectedSubLists.length > 0) {
+ toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail);
+ } else {
+ toggleSingleList(editor, parentList, listName, detail);
+ }
+ };
+ var $_8qbnsrfljfuw8plb = {
+ toggleList: toggleList,
+ removeList: removeList,
+ mergeWithAdjacentLists: mergeWithAdjacentLists
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var hasListStyleDetail = function (detail) {
- return 'list-style-type' in detail;
- };
-
- var toggleSingleList = function (editor, parentList, listName, detail) {
- if (parentList === editor.getBody()) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var findNextCaretContainer = function (editor, rng, isForward, root) {
+ var node = rng.startContainer;
+ var offset = rng.startOffset;
+ var nonEmptyBlocks, walker;
+ if (node.nodeType === 3 && (isForward ? offset < node.data.length : offset > 0)) {
+ return node;
+ }
+ nonEmptyBlocks = editor.schema.getNonEmptyElements();
+ if (node.nodeType === 1) {
+ node = global$1.getNode(node, offset);
+ }
+ walker = new global$2(node, root);
+ if (isForward) {
+ if ($_fmlqy7fsjfuw8plr.isBogusBr(editor.dom, node)) {
+ walker.next();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (parentList) {
- if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
- removeList(editor, listName);
- } else {
- var bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
- updateListWithDetails(editor.dom, parentList, detail);
- mergeWithAdjacentLists(editor.dom, editor.dom.rename(parentList, listName));
- editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
- }
- } else {
- applyList(editor, listName, detail);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ while (node = walker[isForward ? 'next' : 'prev2']()) {
+ if (node.nodeName === 'LI' && !node.hasChildNodes()) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var toggleList = function (editor, listName, detail) {
- var parentList = Selection.getParentList(editor);
- var selectedSubLists = Selection.getSelectedSubLists(editor);
-
- detail = detail ? detail : {};
-
- if (parentList && selectedSubLists.length > 0) {
- toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail);
- } else {
- toggleSingleList(editor, parentList, listName, detail);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (nonEmptyBlocks[node.nodeName]) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- return {
- toggleList: toggleList,
- removeList: removeList,
- mergeWithAdjacentLists: mergeWithAdjacentLists
- };
- }
-);
-
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.TreeWalker',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.TreeWalker');
- }
-);
-
-/**
- * Delete.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.core.Delete',
- [
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.dom.TreeWalker',
- 'tinymce.core.util.VK',
- 'tinymce.plugins.lists.actions.ToggleList',
- 'tinymce.plugins.lists.core.Bookmark',
- 'tinymce.plugins.lists.core.NodeType',
- 'tinymce.plugins.lists.core.NormalizeLists',
- 'tinymce.plugins.lists.core.Range',
- 'tinymce.plugins.lists.core.Selection'
- ],
- function (RangeUtils, TreeWalker, VK, ToggleList, Bookmark, NodeType, NormalizeLists, Range, Selection) {
- var findNextCaretContainer = function (editor, rng, isForward) {
- var node = rng.startContainer, offset = rng.startOffset;
- var nonEmptyBlocks, walker;
-
- if (node.nodeType === 3 && (isForward ? offset < node.data.length : offset > 0)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.nodeType === 3 && node.data.length > 0) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return node;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- nonEmptyBlocks = editor.schema.getNonEmptyElements();
- if (node.nodeType === 1) {
- node = RangeUtils.getNode(node, offset);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var hasOnlyOneBlockChild = function (dom, elm) {
+ var childNodes = elm.childNodes;
+ return childNodes.length === 1 && !$_fmlqy7fsjfuw8plr.isListNode(childNodes[0]) && dom.isBlock(childNodes[0]);
+ };
+ var unwrapSingleBlockChild = function (dom, elm) {
+ if (hasOnlyOneBlockChild(dom, elm)) {
+ dom.remove(elm.firstChild, true);
+ }
+ };
+ var moveChildren = function (dom, fromElm, toElm) {
+ var node, targetElm;
+ targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;
+ unwrapSingleBlockChild(dom, fromElm);
+ if (!$_fmlqy7fsjfuw8plr.isEmpty(dom, fromElm, true)) {
+ while (node = fromElm.firstChild) {
+ targetElm.appendChild(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- walker = new TreeWalker(node, editor.getBody());
-
- // Delete at <li>|<br></li> then jump over the bogus br
- if (isForward) {
- if (NodeType.isBogusBr(editor.dom, node)) {
- walker.next();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var mergeLiElements = function (dom, fromElm, toElm) {
+ var node, listNode;
+ var ul = fromElm.parentNode;
+ if (!$_fmlqy7fsjfuw8plr.isChildOfBody(dom, fromElm) || !$_fmlqy7fsjfuw8plr.isChildOfBody(dom, toElm)) {
+ return;
+ }
+ if ($_fmlqy7fsjfuw8plr.isListNode(toElm.lastChild)) {
+ listNode = toElm.lastChild;
+ }
+ if (ul === toElm.lastChild) {
+ if ($_fmlqy7fsjfuw8plr.isBr(ul.previousSibling)) {
+ dom.remove(ul.previousSibling);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- while ((node = walker[isForward ? 'next' : 'prev2']())) {
- if (node.nodeName === 'LI' && !node.hasChildNodes()) {
- return node;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ node = toElm.lastChild;
+ if (node && $_fmlqy7fsjfuw8plr.isBr(node) && fromElm.hasChildNodes()) {
+ dom.remove(node);
+ }
+ if ($_fmlqy7fsjfuw8plr.isEmpty(dom, toElm, true)) {
+ dom.$(toElm).empty();
+ }
+ moveChildren(dom, fromElm, toElm);
+ if (listNode) {
+ toElm.appendChild(listNode);
+ }
+ dom.remove(fromElm);
+ if ($_fmlqy7fsjfuw8plr.isEmpty(dom, ul) && ul !== dom.getRoot()) {
+ dom.remove(ul);
+ }
+ };
+ var mergeIntoEmptyLi = function (editor, fromLi, toLi) {
+ editor.dom.$(toLi).empty();
+ mergeLiElements(editor.dom, fromLi, toLi);
+ editor.selection.setCursorLocation(toLi);
+ };
+ var mergeForward = function (editor, rng, fromLi, toLi) {
+ var dom = editor.dom;
+ if (dom.isEmpty(toLi)) {
+ mergeIntoEmptyLi(editor, fromLi, toLi);
+ } else {
+ var bookmark = $_3byghwfqjfuw8pln.createBookmark(rng);
+ mergeLiElements(dom, fromLi, toLi);
+ editor.selection.setRng($_3byghwfqjfuw8pln.resolveBookmark(bookmark));
+ }
+ };
+ var mergeBackward = function (editor, rng, fromLi, toLi) {
+ var bookmark = $_3byghwfqjfuw8pln.createBookmark(rng);
+ mergeLiElements(editor.dom, fromLi, toLi);
+ var resolvedBookmark = $_3byghwfqjfuw8pln.resolveBookmark(bookmark);
+ editor.selection.setRng(resolvedBookmark);
+ };
+ var backspaceDeleteFromListToListCaret = function (editor, isForward) {
+ var dom = editor.dom, selection = editor.selection;
+ var selectionStartElm = selection.getStart();
+ var root = $_2bncsnfujfuw8plw.getClosestListRootElm(editor, selectionStartElm);
+ var li = dom.getParent(selection.getStart(), 'LI', root);
+ var ul, rng, otherLi;
+ if (li) {
+ ul = li.parentNode;
+ if (ul === editor.getBody() && $_fmlqy7fsjfuw8plr.isEmpty(dom, ul)) {
+ return true;
+ }
+ rng = $_14fh94frjfuw8plp.normalizeRange(selection.getRng(true));
+ otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
+ if (otherLi && otherLi !== li) {
+ if (isForward) {
+ mergeForward(editor, rng, otherLi, li);
+ } else {
+ mergeBackward(editor, rng, li, otherLi);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (nonEmptyBlocks[node.nodeName]) {
- return node;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ } else if (!otherLi) {
+ if (!isForward && $_8qbnsrfljfuw8plb.removeList(editor)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (node.nodeType === 3 && node.data.length > 0) {
- return node;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var hasOnlyOneBlockChild = function (dom, elm) {
- var childNodes = elm.childNodes;
- return childNodes.length === 1 && !NodeType.isListNode(childNodes[0]) && dom.isBlock(childNodes[0]);
- };
-
- var unwrapSingleBlockChild = function (dom, elm) {
- if (hasOnlyOneBlockChild(dom, elm)) {
- dom.remove(elm.firstChild, true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return false;
+ };
+ var removeBlock = function (dom, block, root) {
+ var parentBlock = dom.getParent(block.parentNode, dom.isBlock, root);
+ dom.remove(block);
+ if (parentBlock && dom.isEmpty(parentBlock)) {
+ dom.remove(parentBlock);
+ }
+ };
+ var backspaceDeleteIntoListCaret = function (editor, isForward) {
+ var dom = editor.dom;
+ var selectionStartElm = editor.selection.getStart();
+ var root = $_2bncsnfujfuw8plw.getClosestListRootElm(editor, selectionStartElm);
+ var block = dom.getParent(selectionStartElm, dom.isBlock, root);
+ if (block && dom.isEmpty(block)) {
+ var rng = $_14fh94frjfuw8plp.normalizeRange(editor.selection.getRng(true));
+ var otherLi_1 = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);
+ if (otherLi_1) {
+ editor.undoManager.transact(function () {
+ removeBlock(dom, block, root);
+ $_8qbnsrfljfuw8plb.mergeWithAdjacentLists(dom, otherLi_1.parentNode);
+ editor.selection.select(otherLi_1, true);
+ editor.selection.collapse(isForward);
+ });
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var moveChildren = function (dom, fromElm, toElm) {
- var node, targetElm;
-
- targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;
- unwrapSingleBlockChild(dom, fromElm);
-
- if (!NodeType.isEmpty(dom, fromElm, true)) {
- while ((node = fromElm.firstChild)) {
- targetElm.appendChild(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return false;
+ };
+ var backspaceDeleteCaret = function (editor, isForward) {
+ return backspaceDeleteFromListToListCaret(editor, isForward) || backspaceDeleteIntoListCaret(editor, isForward);
+ };
+ var backspaceDeleteRange = function (editor) {
+ var selectionStartElm = editor.selection.getStart();
+ var root = $_2bncsnfujfuw8plw.getClosestListRootElm(editor, selectionStartElm);
+ var startListParent = editor.dom.getParent(selectionStartElm, 'LI,DT,DD', root);
+ if (startListParent || $_2bncsnfujfuw8plw.getSelectedListItems(editor).length > 0) {
+ editor.undoManager.transact(function () {
+ editor.execCommand('Delete');
+ $_7p90zmftjfuw8plu.normalizeLists(editor.dom, editor.getBody());
+ });
+ return true;
+ }
+ return false;
+ };
+ var backspaceDelete = function (editor, isForward) {
+ return editor.selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor);
+ };
+ var setup = function (editor) {
+ editor.on('keydown', function (e) {
+ if (e.keyCode === global$3.BACKSPACE) {
+ if (backspaceDelete(editor, false)) {
+ e.preventDefault();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- };
-
- var mergeLiElements = function (dom, fromElm, toElm) {
- var node, listNode, ul = fromElm.parentNode;
-
- if (!NodeType.isChildOfBody(dom, fromElm) || !NodeType.isChildOfBody(dom, toElm)) {
- return;
- }
-
- if (NodeType.isListNode(toElm.lastChild)) {
- listNode = toElm.lastChild;
- }
-
- if (ul === toElm.lastChild) {
- if (NodeType.isBr(ul.previousSibling)) {
- dom.remove(ul.previousSibling);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (e.keyCode === global$3.DELETE) {
+ if (backspaceDelete(editor, true)) {
+ e.preventDefault();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var $_6qu3vpfhjfuw8pl2 = {
+ setup: setup,
+ backspaceDelete: backspaceDelete
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- node = toElm.lastChild;
- if (node && NodeType.isBr(node) && fromElm.hasChildNodes()) {
- dom.remove(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get = function (editor) {
+ return {
+ backspaceDelete: function (isForward) {
+ $_6qu3vpfhjfuw8pl2.backspaceDelete(editor, isForward);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ };
+ var $_bgmttlfgjfuw8pl0 = { get: get };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (NodeType.isEmpty(dom, toElm, true)) {
- dom.$(toElm).empty();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$5 = global$6.DOM;
+ var mergeLists = function (from, to) {
+ var node;
+ if ($_fmlqy7fsjfuw8plr.isListNode(from)) {
+ while (node = from.firstChild) {
+ to.appendChild(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- moveChildren(dom, fromElm, toElm);
-
- if (listNode) {
- toElm.appendChild(listNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ DOM$5.remove(from);
+ }
+ };
+ var indent = function (li) {
+ var sibling, newList, listStyle;
+ if (li.nodeName === 'DT') {
+ DOM$5.rename(li, 'DD');
+ return true;
+ }
+ sibling = li.previousSibling;
+ if (sibling && $_fmlqy7fsjfuw8plr.isListNode(sibling)) {
+ sibling.appendChild(li);
+ return true;
+ }
+ if (sibling && sibling.nodeName === 'LI' && $_fmlqy7fsjfuw8plr.isListNode(sibling.lastChild)) {
+ sibling.lastChild.appendChild(li);
+ mergeLists(li.lastChild, sibling.lastChild);
+ return true;
+ }
+ sibling = li.nextSibling;
+ if (sibling && $_fmlqy7fsjfuw8plr.isListNode(sibling)) {
+ sibling.insertBefore(li, sibling.firstChild);
+ return true;
+ }
+ sibling = li.previousSibling;
+ if (sibling && sibling.nodeName === 'LI') {
+ newList = DOM$5.create(li.parentNode.nodeName);
+ listStyle = DOM$5.getStyle(li.parentNode, 'listStyleType');
+ if (listStyle) {
+ DOM$5.setStyle(newList, 'listStyleType', listStyle);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- dom.remove(fromElm);
-
- if (NodeType.isEmpty(dom, ul) && ul !== dom.getRoot()) {
- dom.remove(ul);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sibling.appendChild(newList);
+ newList.appendChild(li);
+ mergeLists(li.lastChild, newList);
+ return true;
+ }
+ return false;
+ };
+ var indentSelection = function (editor) {
+ var listElements = $_2bncsnfujfuw8plw.getSelectedListItems(editor);
+ if (listElements.length) {
+ var bookmark = $_3byghwfqjfuw8pln.createBookmark(editor.selection.getRng(true));
+ for (var i = 0; i < listElements.length; i++) {
+ if (!indent(listElements[i]) && i === 0) {
+ break;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.selection.setRng($_3byghwfqjfuw8pln.resolveBookmark(bookmark));
+ editor.nodeChanged();
+ return true;
+ }
+ };
+ var $_4zf6mug0jfuw8pm7 = { indentSelection: indentSelection };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var mergeIntoEmptyLi = function (editor, fromLi, toLi) {
- editor.dom.$(toLi).empty();
- mergeLiElements(editor.dom, fromLi, toLi);
- editor.selection.setCursorLocation(toLi);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var queryListCommandState = function (editor, listName) {
+ return function () {
+ var parentList = editor.dom.getParent(editor.selection.getStart(), 'UL,OL,DL');
+ return parentList && parentList.nodeName === listName;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var mergeForward = function (editor, rng, fromLi, toLi) {
- var dom = editor.dom;
-
- if (dom.isEmpty(toLi)) {
- mergeIntoEmptyLi(editor, fromLi, toLi);
- } else {
- var bookmark = Bookmark.createBookmark(rng);
- mergeLiElements(dom, fromLi, toLi);
- editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
- }
- };
-
- var mergeBackward = function (editor, rng, fromLi, toLi) {
- var bookmark = Bookmark.createBookmark(rng);
- mergeLiElements(editor.dom, fromLi, toLi);
- editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
- };
-
- var backspaceDeleteFromListToListCaret = function (editor, isForward) {
- var dom = editor.dom, selection = editor.selection;
- var li = dom.getParent(selection.getStart(), 'LI'), ul, rng, otherLi;
-
- if (li) {
- ul = li.parentNode;
- if (ul === editor.getBody() && NodeType.isEmpty(dom, ul)) {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var register = function (editor) {
+ editor.on('BeforeExecCommand', function (e) {
+ var cmd = e.command.toLowerCase();
+ var isHandled;
+ if (cmd === 'indent') {
+ if ($_4zf6mug0jfuw8pm7.indentSelection(editor)) {
+ isHandled = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- rng = Range.normalizeRange(selection.getRng(true));
- otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward), 'LI');
-
- if (otherLi && otherLi !== li) {
- if (isForward) {
- mergeForward(editor, rng, otherLi, li);
- } else {
- mergeBackward(editor, rng, li, otherLi);
- }
-
- return true;
- } else if (!otherLi) {
- if (!isForward && ToggleList.removeList(editor, ul.nodeName)) {
- return true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (cmd === 'outdent') {
+ if ($_b067pwfojfuw8plj.outdentSelection(editor)) {
+ isHandled = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isHandled) {
+ editor.fire('ExecCommand', { command: e.command });
+ e.preventDefault();
+ return true;
+ }
+ });
+ editor.addCommand('InsertUnorderedList', function (ui, detail) {
+ $_8qbnsrfljfuw8plb.toggleList(editor, 'UL', detail);
+ });
+ editor.addCommand('InsertOrderedList', function (ui, detail) {
+ $_8qbnsrfljfuw8plb.toggleList(editor, 'OL', detail);
+ });
+ editor.addCommand('InsertDefinitionList', function (ui, detail) {
+ $_8qbnsrfljfuw8plb.toggleList(editor, 'DL', detail);
+ });
+ editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState(editor, 'UL'));
+ editor.addQueryStateHandler('InsertOrderedList', queryListCommandState(editor, 'OL'));
+ editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState(editor, 'DL'));
+ };
+ var $_ci56e3fzjfuw8pm5 = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return false;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var shouldIndentOnTab = function (editor) {
+ return editor.getParam('lists_indent_on_tab', true);
+ };
+ var $_e85xmvg2jfuw8pmc = { shouldIndentOnTab: shouldIndentOnTab };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var removeBlock = function (dom, block) {
- var parentBlock = dom.getParent(block.parentNode, dom.isBlock);
-
- dom.remove(block);
- if (parentBlock && dom.isEmpty(parentBlock)) {
- dom.remove(parentBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setupTabKey = function (editor) {
+ editor.on('keydown', function (e) {
+ if (e.keyCode !== global$3.TAB || global$3.metaKeyPressed(e)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var backspaceDeleteIntoListCaret = function (editor, isForward) {
- var dom = editor.dom;
- var block = dom.getParent(editor.selection.getStart(), dom.isBlock);
-
- if (block && dom.isEmpty(block)) {
- var rng = Range.normalizeRange(editor.selection.getRng(true));
- var otherLi = dom.getParent(findNextCaretContainer(editor, rng, isForward), 'LI');
-
- if (otherLi) {
- editor.undoManager.transact(function () {
- removeBlock(dom, block);
- ToggleList.mergeWithAdjacentLists(dom, otherLi.parentNode);
- editor.selection.select(otherLi, true);
- editor.selection.collapse(isForward);
- });
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (editor.dom.getParent(editor.selection.getStart(), 'LI,DT,DD')) {
+ e.preventDefault();
+ if (e.shiftKey) {
+ $_b067pwfojfuw8plj.outdentSelection(editor);
+ } else {
+ $_4zf6mug0jfuw8pm7.indentSelection(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var setup$1 = function (editor) {
+ if ($_e85xmvg2jfuw8pmc.shouldIndentOnTab(editor)) {
+ setupTabKey(editor);
+ }
+ $_6qu3vpfhjfuw8pl2.setup(editor);
+ };
+ var $_1iz32kg1jfuw8pma = { setup: setup$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return false;
- };
-
- var backspaceDeleteCaret = function (editor, isForward) {
- return backspaceDeleteFromListToListCaret(editor, isForward) || backspaceDeleteIntoListCaret(editor, isForward);
- };
-
- var backspaceDeleteRange = function (editor) {
- var startListParent = editor.dom.getParent(editor.selection.getStart(), 'LI,DT,DD');
-
- if (startListParent || Selection.getSelectedListItems(editor).length > 0) {
- editor.undoManager.transact(function () {
- editor.execCommand('Delete');
- NormalizeLists.normalizeLists(editor.dom, editor.getBody());
- });
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var findIndex = function (list, predicate) {
+ for (var index = 0; index < list.length; index++) {
+ var element = list[index];
+ if (predicate(element)) {
+ return index;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
- };
-
- var backspaceDelete = function (editor, isForward) {
- return editor.selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor);
- };
-
- var setup = function (editor) {
- editor.on('keydown', function (e) {
- if (e.keyCode === VK.BACKSPACE) {
- if (backspaceDelete(editor, false)) {
- e.preventDefault();
- }
- } else if (e.keyCode === VK.DELETE) {
- if (backspaceDelete(editor, true)) {
- e.preventDefault();
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return -1;
+ };
+ var listState = function (editor, listName) {
+ return function (e) {
+ var ctrl = e.control;
+ editor.on('NodeChange', function (e) {
+ var tableCellIndex = findIndex(e.parents, $_fmlqy7fsjfuw8plr.isTableCellNode);
+ var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;
+ var lists = global$5.grep(parents, $_fmlqy7fsjfuw8plr.isListNode);
+ ctrl.active(lists.length > 0 && lists[0].nodeName === listName);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- setup: setup,
- backspaceDelete: backspaceDelete
- };
- }
-);
-
-
-/**
- * plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.lists.Plugin',
- [
- 'tinymce.core.PluginManager',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.VK',
- 'tinymce.plugins.lists.actions.Indent',
- 'tinymce.plugins.lists.actions.Outdent',
- 'tinymce.plugins.lists.actions.ToggleList',
- 'tinymce.plugins.lists.core.Delete',
- 'tinymce.plugins.lists.core.NodeType',
- 'tinymce.plugins.lists.core.Selection'
- ],
- function (PluginManager, Tools, VK, Indent, Outdent, ToggleList, Delete, NodeType, Selection) {
- var queryListCommandState = function (editor, listName) {
- return function () {
- var parentList = editor.dom.getParent(editor.selection.getStart(), 'UL,OL,DL');
- return parentList && parentList.nodeName === listName;
- };
- };
-
- var setupCommands = function (editor) {
- editor.on('BeforeExecCommand', function (e) {
- var cmd = e.command.toLowerCase(), isHandled;
-
- if (cmd === "indent") {
- if (Indent.indentSelection(editor)) {
- isHandled = true;
- }
- } else if (cmd === "outdent") {
- if (Outdent.outdentSelection(editor)) {
- isHandled = true;
- }
- }
-
- if (isHandled) {
- editor.fire('ExecCommand', { command: e.command });
- e.preventDefault();
- return true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var indentPostRender = function (editor) {
+ return function (e) {
+ var ctrl = e.control;
+ editor.on('nodechange', function () {
+ var listItemBlocks = $_2bncsnfujfuw8plw.getSelectedListItems(editor);
+ var disable = listItemBlocks.length > 0 && $_fmlqy7fsjfuw8plr.isFirstChild(listItemBlocks[0]);
+ ctrl.disabled(disable);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.addCommand('InsertUnorderedList', function (ui, detail) {
- ToggleList.toggleList(editor, 'UL', detail);
- });
-
- editor.addCommand('InsertOrderedList', function (ui, detail) {
- ToggleList.toggleList(editor, 'OL', detail);
- });
-
- editor.addCommand('InsertDefinitionList', function (ui, detail) {
- ToggleList.toggleList(editor, 'DL', detail);
- });
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var setupStateHandlers = function (editor) {
- editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState(editor, 'UL'));
- editor.addQueryStateHandler('InsertOrderedList', queryListCommandState(editor, 'OL'));
- editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState(editor, 'DL'));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var register$1 = function (editor) {
+ var hasPlugin = function (editor, plugin) {
+ var plugins = editor.settings.plugins ? editor.settings.plugins : '';
+ return global$5.inArray(plugins.split(/[ ,]/), plugin) !== -1;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var setupTabKey = function (editor) {
- editor.on('keydown', function (e) {
- // Check for tab but not ctrl/cmd+tab since it switches browser tabs
- if (e.keyCode !== 9 || VK.metaKeyPressed(e)) {
- return;
- }
-
- if (editor.dom.getParent(editor.selection.getStart(), 'LI,DT,DD')) {
- e.preventDefault();
-
- if (e.shiftKey) {
- Outdent.outdentSelection(editor);
- } else {
- Indent.indentSelection(editor);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!hasPlugin(editor, 'advlist')) {
+ editor.addButton('numlist', {
+ active: false,
+ title: 'Numbered list',
+ cmd: 'InsertOrderedList',
+ onPostRender: listState(editor, 'OL')
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var setupUi = function (editor) {
- var listState = function (listName) {
- return function () {
- var self = this;
-
- editor.on('NodeChange', function (e) {
- var lists = Tools.grep(e.parents, NodeType.isListNode);
- self.active(lists.length > 0 && lists[0].nodeName === listName);
- });
- };
- };
-
- var hasPlugin = function (editor, plugin) {
- var plugins = editor.settings.plugins ? editor.settings.plugins : '';
- return Tools.inArray(plugins.split(/[ ,]/), plugin) !== -1;
- };
-
- if (!hasPlugin(editor, 'advlist')) {
- editor.addButton('numlist', {
- title: 'Numbered list',
- cmd: 'InsertOrderedList',
- onPostRender: listState('OL')
- });
-
- editor.addButton('bullist', {
- title: 'Bullet list',
- cmd: 'InsertUnorderedList',
- onPostRender: listState('UL')
- });
- }
-
- editor.addButton('indent', {
- icon: 'indent',
- title: 'Increase indent',
- cmd: 'Indent',
- onPostRender: function (e) {
- var ctrl = e.control;
-
- editor.on('nodechange', function () {
- var listItemBlocks = Selection.getSelectedListItems(editor);
- var disable = listItemBlocks.length > 0 && NodeType.isFirstChild(listItemBlocks[0]);
- ctrl.disabled(disable);
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.addButton('bullist', {
+ active: false,
+ title: 'Bullet list',
+ cmd: 'InsertUnorderedList',
+ onPostRender: listState(editor, 'UL')
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- PluginManager.add('lists', function (editor) {
- setupUi(editor);
- Delete.setup(editor);
-
- editor.on('init', function () {
- setupCommands(editor);
- setupStateHandlers(editor);
- if (editor.getParam('lists_indent_on_tab', true)) {
- setupTabKey(editor);
- }
- });
-
- return {
- backspaceDelete: function (isForward) {
- Delete.backspaceDelete(editor, isForward);
- }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ editor.addButton('indent', {
+ icon: 'indent',
+ title: 'Increase indent',
+ cmd: 'Indent',
+ onPostRender: indentPostRender(editor)
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_fizi9xg3jfuw8pmd = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return function () { };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('lists', function (editor) {
+ $_1iz32kg1jfuw8pma.setup(editor);
+ $_fizi9xg3jfuw8pmd.register(editor);
+ $_ci56e3fzjfuw8pm5.register(editor);
+ return $_bgmttlfgjfuw8pl0.get(editor);
+ });
+ function Plugin () {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-dem('tinymce.plugins.lists.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginslistspluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/lists/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/lists/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/lists/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("a",tinymce.util.Tools.resolve),g("1",[&q
uot;a"],function(a){return a("tinymce.PluginManager")}),g("2",["a"],function(a){return a("tinymce.util.Tools")}),g("3",["a"],function(a){return a("tinymce.util.VK")}),g("b",["a"],function(a){return a("tinymce.dom.DOMUtils")}),g("8",[],function(){var a=function(a){return a&&3===a.nodeType},b=function(a){return a&&/^(OL|UL|DL)$/.test(a.nodeName)},c=function(a){return a&&/^(LI|DT|DD)$/.test(a.nodeName)},d=function(a){return a&&"BR"===a.nodeName},e=function(a){return a.parentNode.firstChild===a},f=function(a){return a.parentNode.lastChild===a},g=function(a,b){return b&&!!a.schema.getTextBlockElements()[b.nodeName]},h=function(a,b){return a&&a.nodeName in b},i=function(a,b){return!!d(b)&&!(!a.isBlock(b.nextSibling)||d(b.previousSibling))},j=function(a,b,c){var d=a.isEmpty(b);return!(c&&a.select("s
pan[data-mce-type=bookmark]",b).length>0)&&d},k=function(a,b){return a.isChildOf(b,a.getRoot())};return{isTextNode:a,isListNode:b,isListItemNode:c,isBr:d,isFirstChild:e,isLastChild:f,isTextBlock:g,isBlock:h,isBogusBr:i,isEmpty:j,isChildOfBody:k}}),g("i",["a"],function(a){return a("tinymce.dom.RangeUtils")}),g("k",["i","8"],function(a,b){var c=function(c,d){var e=a.getNode(c,d);if(b.isListItemNode(c)&&b.isTextNode(e)){var f=d>=c.childNodes.length?e.data.length:0;return{container:e,offset:f}}return{container:c,offset:d}},d=function(a){var b=a.cloneRange(),d=c(a.startContainer,a.startOffset);b.setStart(d.container,d.offset);var e=c(a.endContainer,a.endOffset);return b.setEnd(e.container,e.offset),b};return{getNormalizedEndPoint:c,normalizeRange:d}}),g("c",["b","8","k"],function(a,b,c){var d=a.DOM,e=function(a){var b={},c=function(c){var e,f,g;f=a[c?"startC
ontainer":"endContainer"],g=a[c?"startOffset":"endOffset"],1===f.nodeType&&(e=d.create("span",{"data-mce-type":"bookmark"}),f.hasChildNodes()?(g=Math.min(g,f.childNodes.length-1),c?f.insertBefore(e,f.childNodes[g]):d.insertAfter(e,f.childNodes[g])):f.appendChild(e),f=e,g=0),b[c?"startContainer":"endContainer"]=f,b[c?"startOffset":"endOffset"]=g};return c(!0),a.collapsed||c(),b},f=function(a){function b(b){var c,e,f,g=function(a){for(var b=a.parentNode.firstChild,c=0;b;){if(b===a)return c;1===b.nodeType&&"bookmark"===b.getAttribute("data-mce-type")||c++,b=b.nextSibling}return-1};c=f=a[b?"startContainer":"endContainer"],e=a[b?"startOffset":"endOffset"],c&&(1===c.nodeType&&(e=g(c),c=c.parentNode,d.remove(f)),a[b?"startContainer":"endContainer"]=c,a[b?"startOffset"
;:"endOffset"]=e)}b(!0),b();var e=d.createRng();return e.setStart(a.startContainer,a.startOffset),a.endContainer&&e.setEnd(a.endContainer,a.endOffset),c.normalizeRange(e)};return{createBookmark:e,resolveBookmark:f}}),g("d",["a"],function(a){return a("tinymce.dom.DomQuery")}),g("9",["d","2","8"],function(a,b,c){var d=function(a){return a.dom.getParent(a.selection.getStart(!0),"OL,UL,DL")},e=function(a){var e=d(a);return b.grep(a.selection.getSelectedBlocks(),function(a){return c.isListNode(a)&&e!==a})},f=function(c,d){var e=b.map(d,function(a){var b=c.dom.getParent(a,"li,dd,dt",c.getBody());return b?b:a});return a.unique(e)},g=function(a){var d=a.selection.getSelectedBlocks();return b.grep(f(a,d),function(a){return c.isListItemNode(a)})};return{getParentList:d,getSelectedSubLists:e,getSelectedListItems:g}}),g("4",["b","c","8",&quo
t;9"],function(a,b,c,d){var e=a.DOM,f=function(a,b){var d;if(c.isListNode(a)){for(;d=a.firstChild;)b.appendChild(d);e.remove(a)}},g=function(a){var b,d,g;return"DT"===a.nodeName?(e.rename(a,"DD"),!0):(b=a.previousSibling,b&&c.isListNode(b)?(b.appendChild(a),!0):b&&"LI"===b.nodeName&&c.isListNode(b.lastChild)?(b.lastChild.appendChild(a),f(a.lastChild,b.lastChild),!0):(b=a.nextSibling,b&&c.isListNode(b)?(b.insertBefore(a,b.firstChild),!0):(b=a.previousSibling,!(!b||"LI"!==b.nodeName)&&(d=e.create(a.parentNode.nodeName),g=e.getStyle(a.parentNode,"listStyleType"),g&&e.setStyle(d,"listStyleType",g),b.appendChild(d),d.appendChild(a),f(a.lastChild,d),!0))))},h=function(a){var c=d.getSelectedListItems(a);if(c.length){for(var e=b.createBookmark(a.selection.getRng(!0)),f=0;f<c.length&&(g(c[f])||0!==f);f++);return a.selection.setRng(b.resolveBookmark(e)),a.nodeChanged(),!
0}};return{indentSelection:h}}),g("e",["b","2","8"],function(a,b,c){var d=a.DOM,e=function(a,b){var e,f=b.parentNode;"LI"===f.nodeName&&f.firstChild===b&&(e=f.previousSibling,e&&"LI"===e.nodeName?(e.appendChild(b),c.isEmpty(a,f)&&d.remove(f)):d.setStyle(f,"listStyleType","none")),c.isListNode(f)&&(e=f.previousSibling,e&&"LI"===e.nodeName&&e.appendChild(b))},f=function(a,c){b.each(b.grep(a.select("ol,ul",c)),function(b){e(a,b)})};return{normalizeList:e,normalizeLists:f}}),g("l",["a"],function(a){return a("tinymce.Env")}),g("g",["b","l","8"],function(a,b,c){var d=a.DOM,e=function(a,e,f){var g,h,i,j=d.createFragment(),k=a.schema.getBlockElements();if(a.settings.forced_root_block&&(f=f||a.settings.forced_root_block),f&&(h=d.create(f),h.tagName===a.s
ettings.forced_root_block&&d.setAttribs(h,a.settings.forced_root_block_attrs),c.isBlock(e.firstChild,k)||j.appendChild(h)),e)for(;g=e.firstChild;){var l=g.nodeName;i||"SPAN"===l&&"bookmark"===g.getAttribute("data-mce-type")||(i=!0),c.isBlock(g,k)?(j.appendChild(g),h=null):f?(h||(h=d.create(f),j.appendChild(h)),h.appendChild(g)):j.appendChild(g)}return a.settings.forced_root_block?i||b.ie&&!(b.ie>10)||h.appendChild(d.create("br",{"data-mce-bogus":"1"})):j.appendChild(d.create("br")),j};return{createNewTextBlock:e}}),g("f",["b","8","g","2"],function(a,b,c,d){var e=a.DOM,f=function(a,f,g,h){var i,j,k,l,m=function(a){d.each(k,function(b){a.parentNode.insertBefore(b,g.parentNode)}),e.remove(a)};for(k=e.select('span[data-mce-type="bookmark"]',f),h=h||c.createNewTextBlock(a,g),i=e.createRng(),i.setStartAfter(g),i.setEndAfter(f),j=i.ext
ractContents(),l=j.firstChild;l;l=l.firstChild)if("LI"===l.nodeName&&a.dom.isEmpty(l)){e.remove(l);break}a.dom.isEmpty(j)||e.insertAfter(j,f),e.insertAfter(h,f),b.isEmpty(a.dom,g.parentNode)&&m(g.parentNode),e.remove(g),b.isEmpty(a.dom,f)&&e.remove(f)};return{splitList:f}}),g("5",["b","c","8","e","9","f","g"],function(a,b,c,d,e,f,g){var h=a.DOM,i=function(a,b){c.isEmpty(a,b)&&h.remove(b)},j=function(a,b){var e,j=b.parentNode,k=j.parentNode;return j===a.getBody()||("DD"===b.nodeName?(h.rename(b,"DT"),!0):c.isFirstChild(b)&&c.isLastChild(b)?("LI"===k.nodeName?(h.insertAfter(b,k),i(a.dom,k),h.remove(j)):c.isListNode(k)?h.remove(j,!0):(k.insertBefore(g.createNewTextBlock(a,b),j),h.remove(j)),!0):c.isFirstChild(b)?("LI"===k.nodeName?(h.insertAfter(b,k),b.appendChild(j),i(a.dom,k)):c.isListNode(k)?k.insertBefore(b,j):(k.i
nsertBefore(g.createNewTextBlock(a,b),j),h.remove(b)),!0):c.isLastChild(b)?("LI"===k.nodeName?h.insertAfter(b,k):c.isListNode(k)?h.insertAfter(b,j):(h.insertAfter(g.createNewTextBlock(a,b),j),h.remove(b)),!0):("LI"===k.nodeName?(j=k,e=g.createNewTextBlock(a,b,"LI")):e=c.isListNode(k)?g.createNewTextBlock(a,b,"LI"):g.createNewTextBlock(a,b),f.splitList(a,j,b,e),d.normalizeLists(a.dom,j.parentNode),!0))},k=function(a){var c=e.getSelectedListItems(a);if(c.length){var d,f,g=b.createBookmark(a.selection.getRng(!0)),h=a.getBody();for(d=c.length;d--;)for(var i=c[d].parentNode;i&&i!==h;){for(f=c.length;f--;)if(c[f]===i){c.splice(d,1);break}i=i.parentNode}for(d=0;d<c.length&&(j(a,c[d])||0!==d);d++);return a.selection.setRng(b.resolveBookmark(g)),a.nodeChanged(),!0}};return{outdent:j,outdentSelection:k}}),g("h",["a"],function(a){return a("tinymce.dom.BookmarkManager")}),g("6",["h",&quo
t;2","5","c","8","e","9","f"],function(a,b,c,d,e,f,g,h){var i=function(a,b,c){var d=c["list-style-type"]?c["list-style-type"]:null;a.setStyle(b,"list-style-type",d)},j=function(a,c){b.each(c,function(b,c){a.setAttribute(c,b)})},k=function(a,c,d){j(c,d["list-attributes"]),b.each(a.select("li",c),function(a){j(a,d["list-item-attributes"])})},l=function(a,b,c){i(a,b,c),k(a,b,c)},m=function(a,b,c){var d,f,g=a.getBody();for(d=b[c?"startContainer":"endContainer"],f=b[c?"startOffset":"endOffset"],1===d.nodeType&&(d=d.childNodes[Math.min(f,d.childNodes.length-1)]||d);d.parentNode!==g;){if(e.isTextBlock(a,d))return d;if(/^(TD|TH)$/.test(d.parentNode.nodeName))return d;d=d.parentNode}return d},n=function(c,d){for(var f,g=[],h=c.getBody(),i=c.dom,j=m(c,d,!0),k=m(c,d,!1),l=[],n=j;n&&(l.push(n),n!==k);n=n.nextSibling)
;return b.each(l,function(b){if(e.isTextBlock(c,b))return g.push(b),void(f=null);if(i.isBlock(b)||e.isBr(b))return e.isBr(b)&&i.remove(b),void(f=null);var d=b.nextSibling;return a.isBookmarkNode(b)&&(e.isTextBlock(c,d)||!d&&b.parentNode===h)?void(f=null):(f||(f=i.create("p"),b.parentNode.insertBefore(f,b),g.push(f)),void f.appendChild(b))}),g},o=function(a,c,f){var g,h=a.selection.getRng(!0),i="LI",j=a.dom;f=f?f:{},"false"!==j.getContentEditable(a.selection.getNode())&&(c=c.toUpperCase(),"DL"===c&&(i="DT"),g=d.createBookmark(h),b.each(n(a,h),function(b){var d,g,h=function(a){var b=j.getStyle(a,"list-style-type"),c=f?f["list-style-type"]:"";return c=null===c?"":c,b===c};g=b.previousSibling,g&&e.isListNode(g)&&g.nodeName===c&&h(g)?(d=g,b=j.rename(b,i),g.appendChild(b)):(d=j.create(c),b.parentNode.insertBefore(d,b),d.appendChild(b),b=
j.rename(b,i)),l(j,d,f),u(a.dom,d)}),a.selection.setRng(d.resolveBookmark(g)))},p=function(a){var i=d.createBookmark(a.selection.getRng(!0)),j=a.getBody(),k=g.getSelectedListItems(a),l=b.grep(k,function(b){return a.dom.isEmpty(b)});k=b.grep(k,function(b){return!a.dom.isEmpty(b)}),b.each(l,function(b){if(e.isEmpty(a.dom,b))return void c.outdent(a,b)}),b.each(k,function(b){var c,d;if(b.parentNode!==a.getBody()){for(c=b;c&&c!==j;c=c.parentNode)e.isListNode(c)&&(d=c);h.splitList(a,d,b),f.normalizeLists(a.dom,d.parentNode)}}),a.selection.setRng(d.resolveBookmark(i))},q=function(a,b){return a&&b&&e.isListNode(a)&&a.nodeName===b.nodeName},r=function(a,b,c){var d=a.getStyle(b,"list-style-type",!0),e=a.getStyle(c,"list-style-type",!0);return d===e},s=function(a,b){return a.className===b.className},t=function(a,b,c){return q(b,c)&&r(a,b,c)&&s(b,c)},u=function(a,b){var c,d;if(c=b.nextSibling,t(a,b,c)){for(;d=c.firstChi
ld;)b.appendChild(d);a.remove(c)}if(c=b.previousSibling,t(a,b,c)){for(;d=c.lastChild;)b.insertBefore(d,b.firstChild);a.remove(c)}},v=function(a,b,c,d){if(b.nodeName!==c){var e=a.rename(b,c);l(a,e,d)}else l(a,b,d)},w=function(a,c,e,f,g){if(c.nodeName!==f||x(g)){var h=d.createBookmark(a.selection.getRng(!0));b.each([c].concat(e),function(b){v(a.dom,b,f,g)}),a.selection.setRng(d.resolveBookmark(h))}else p(a,f)},x=function(a){return"list-style-type"in a},y=function(a,b,c,e){if(b!==a.getBody())if(b)if(b.nodeName!==c||x(e)){var f=d.createBookmark(a.selection.getRng(!0));l(a.dom,b,e),u(a.dom,a.dom.rename(b,c)),a.selection.setRng(d.resolveBookmark(f))}else p(a,c);else o(a,c,e)},z=function(a,b,c){var d=g.getParentList(a),e=g.getSelectedSubLists(a);c=c?c:{},d&&e.length>0?w(a,d,e,b,c):y(a,d,b,c)};return{toggleList:z,removeList:p,mergeWithAdjacentLists:u}}),g("j",["a"],function(a){return a("tinymce.dom.TreeWalker")}),g("7",["i&qu
ot;,"j","3","6","c","8","e","k","9"],function(a,b,c,d,e,f,g,h,i){var j=function(c,d,e){var g,h,i=d.startContainer,j=d.startOffset;if(3===i.nodeType&&(e?j<i.data.length:j>0))return i;for(g=c.schema.getNonEmptyElements(),1===i.nodeType&&(i=a.getNode(i,j)),h=new b(i,c.getBody()),e&&f.isBogusBr(c.dom,i)&&h.next();i=h[e?"next":"prev2"]();){if("LI"===i.nodeName&&!i.hasChildNodes())return i;if(g[i.nodeName])return i;if(3===i.nodeType&&i.data.length>0)return i}},k=function(a,b){var c=b.childNodes;return 1===c.length&&!f.isListNode(c[0])&&a.isBlock(c[0])},l=function(a,b){k(a,b)&&a.remove(b.firstChild,!0)},m=function(a,b,c){var d,e;if(e=k(a,c)?c.firstChild:c,l(a,b),!f.isEmpty(a,b,!0))for(;d=b.firstChild;)e.appendChild(d)},n=function(a,b,c){var d,e,g=b.parentNode;f.isChildOfBody(a,b)&&f.isChildOfBo
dy(a,c)&&(f.isListNode(c.lastChild)&&(e=c.lastChild),g===c.lastChild&&f.isBr(g.previousSibling)&&a.remove(g.previousSibling),d=c.lastChild,d&&f.isBr(d)&&b.hasChildNodes()&&a.remove(d),f.isEmpty(a,c,!0)&&a.$(c).empty(),m(a,b,c),e&&c.appendChild(e),a.remove(b),f.isEmpty(a,g)&&g!==a.getRoot()&&a.remove(g))},o=function(a,b,c){a.dom.$(c).empty(),n(a.dom,b,c),a.selection.setCursorLocation(c)},p=function(a,b,c,d){var f=a.dom;if(f.isEmpty(d))o(a,c,d);else{var g=e.createBookmark(b);n(f,c,d),a.selection.setRng(e.resolveBookmark(g))}},q=function(a,b,c,d){var f=e.createBookmark(b);n(a.dom,c,d),a.selection.setRng(e.resolveBookmark(f))},r=function(a,b){var c,e,g,i=a.dom,k=a.selection,l=i.getParent(k.getStart(),"LI");if(l){if(c=l.parentNode,c===a.getBody()&&f.isEmpty(i,c))return!0;if(e=h.normalizeRange(k.getRng(!0)),g=i.getParent(j(a,e,b),"LI"),g&&g!==l)return b?p(a,e,g,l):q(
a,e,l,g),!0;if(!g&&!b&&d.removeList(a,c.nodeName))return!0}return!1},s=function(a,b){var c=a.getParent(b.parentNode,a.isBlock);a.remove(b),c&&a.isEmpty(c)&&a.remove(c)},t=function(a,b){var c=a.dom,e=c.getParent(a.selection.getStart(),c.isBlock);if(e&&c.isEmpty(e)){var f=h.normalizeRange(a.selection.getRng(!0)),g=c.getParent(j(a,f,b),"LI");if(g)return a.undoManager.transact(function(){s(c,e),d.mergeWithAdjacentLists(c,g.parentNode),a.selection.select(g,!0),a.selection.collapse(b)}),!0}return!1},u=function(a,b){return r(a,b)||t(a,b)},v=function(a){var b=a.dom.getParent(a.selection.getStart(),"LI,DT,DD");return!!(b||i.getSelectedListItems(a).length>0)&&(a.undoManager.transact(function(){a.execCommand("Delete"),g.normalizeLists(a.dom,a.getBody())}),!0)},w=function(a,b){return a.selection.isCollapsed()?u(a,b):v(a)},x=function(a){a.on("keydown",function(b){b.keyCode===c.BACKSPACE?w(a,!1)&&b.
preventDefault():b.keyCode===c.DELETE&&w(a,!0)&&b.preventDefault()})};return{setup:x,backspaceDelete:w}}),g("0",["1","2","3","4","5","6","7","8","9"],function(a,b,c,d,e,f,g,h,i){var j=function(a,b){return function(){var c=a.dom.getParent(a.selection.getStart(),"UL,OL,DL");return c&&c.nodeName===b}},k=function(a){a.on("BeforeExecCommand",function(b){var c,f=b.command.toLowerCase();if("indent"===f?d.indentSelection(a)&&(c=!0):"outdent"===f&&e.outdentSelection(a)&&(c=!0),c)return a.fire("ExecCommand",{command:b.command}),b.preventDefault(),!0}),a.addCommand("InsertUnorderedList",function(b,c){f.toggleList(a,"UL",c)}),a.addCommand("InsertOrderedList",function(b,c){f.toggleList(a,"OL",c)}),a.addCommand("InsertDefinitionList",function(b,c){f.tog
gleList(a,"DL",c)})},l=function(a){a.addQueryStateHandler("InsertUnorderedList",j(a,"UL")),a.addQueryStateHandler("InsertOrderedList",j(a,"OL")),a.addQueryStateHandler("InsertDefinitionList",j(a,"DL"))},m=function(a){a.on("keydown",function(b){9!==b.keyCode||c.metaKeyPressed(b)||a.dom.getParent(a.selection.getStart(),"LI,DT,DD")&&(b.preventDefault(),b.shiftKey?e.outdentSelection(a):d.indentSelection(a))})},n=function(a){var c=function(c){return function(){var d=this;a.on("NodeChange",function(a){var e=b.grep(a.parents,h.isListNode);d.active(e.length>0&&e[0].nodeName===c)})}},d=function(a,c){var d=a.settings.plugins?a.settings.plugins:"";return b.inArray(d.split(/[ ,]/),c)!==-1};d(a,"advlist")||(a.addButton("numlist",{title:"Numbered list",cmd:"InsertOrderedList",onPostRender:c("OL")}),a.addButton("bull
ist",{title:"Bullet list",cmd:"InsertUnorderedList",onPostRender:c("UL")})),a.addButton("indent",{icon:"indent",title:"Increase indent",cmd:"Indent",onPostRender:function(b){var c=b.control;a.on("nodechange",function(){var b=i.getSelectedListItems(a),d=b.length>0&&h.isFirstChild(b[0]);c.disabled(d)})}})};return a.add("lists",function(a){return n(a),g.setup(a),a.on("init",function(){k(a),l(a),a.getParam("lists_indent_on_tab",!0)&&m(a)}),{backspaceDelete:function(b){g.backspaceDelete(a,b)}}}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),d=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),l=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),n=tinymce.util.Tools.resolve("tinymce.util.VK"),p=tinymce.util.Tools.resolve("tinymce.dom.BookmarkManager"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),t=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),o=function(e){return e&&"BR"===e.nodeName},r=function(e){return e&&3===e.nodeType},h=function(e){return e&&/^(OL|UL|DL)$/.test(e.nodeName)},i=function(e){return e&&/^(LI|DT|DD)$/.test(e.nodeName)},a=function(e){return e&&/^(TH|TD)$/.test(e.nodeName)},C=o,s=function(e){return e.parentNode.firstChild===e},c=function(e){return e.parentNode.lastChild===e},y=function(
e,t){return t&&!!e.schema.getTextBlockElements()[t.nodeName]},f=function(e,t){return e&&e.nodeName in t},u=function(e,t){return!!o(t)&&!(!e.isBlock(t.nextSibling)||o(t.previousSibling))},m=function(e,t,n){var o=e.isEmpty(t);return!(n&&0<e.select("span[data-mce-type=bookmark]",t).length)&&o},g=function(e,t){return e.isChildOf(t,e.getRoot())},N=function(e,t){var n=d.getNode(e,t);return i(e)&&r(n)?{container:n,offset:t>=e.childNodes.length?n.data.length:0}:{container:e,offset:t}},L=function(e){var t=e.cloneRange(),n=N(e.startContainer,e.startOffset);t.setStart(n.container,n.offset);var o=N(e.endContainer,e.endOffset);return t.setEnd(o.container,o.offset),t},S=t.DOM,b=function(r){var i={},e=function(e){var t,n,o;n=r[e?"startContainer":"endContainer"],o=r[e?"startOffset":"endOffset"],1===n.nodeType&&(t=S.create("span",{"data-mce-type":"bookmark"}),
n.hasChildNodes()?(o=Math.min(o,n.childNodes.length-1),e?n.insertBefore(t,n.childNodes[o]):S.insertAfter(t,n.childNodes[o])):n.appendChild(t),n=t,o=0),i[e?"startContainer":"endContainer"]=n,i[e?"startOffset":"endOffset"]=o};return e(!0),r.collapsed||e(),i},D=function(r){function e(e){var t,n,o;t=o=r[e?"startContainer":"endContainer"],n=r[e?"startOffset":"endOffset"],t&&(1===t.nodeType&&(n=function(e){for(var t=e.parentNode.firstChild,n=0;t;){if(t===e)return n;1===t.nodeType&&"bookmark"===t.getAttribute("data-mce-type")||n++,t=t.nextSibling}return-1}(t),t=t.parentNode,S.remove(o),!t.hasChildNodes()&&S.isBlock(t)&&t.appendChild(S.create("br"))),r[e?"startContainer":"endContainer"]=t,r[e?"startOffset":"endOffset"]=n)}e(!0),e();var t=S.createRng();return t.setStart(r.startContainer,r.startOffset),r.e
ndContainer&&t.setEnd(r.endContainer,r.endOffset),L(t)},k=t.DOM,T=function(e,t){var n,o=t.parentNode;"LI"===o.nodeName&&o.firstChild===t&&((n=o.previousSibling)&&"LI"===n.nodeName?(n.appendChild(t),m(e,o)&&k.remove(o)):k.setStyle(o,"listStyleType","none")),h(o)&&(n=o.previousSibling)&&"LI"===n.nodeName&&n.appendChild(t)},I=function(t,e){v.each(v.grep(t.select("ol,ul",e)),function(e){T(t,e)})},B=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),R=function(e){var t=e.selection.getStart(!0);return e.dom.getParent(t,"OL,UL,DL",O(e,t))},O=function(e,t){var n=e.dom.getParents(t,"TD,TH");return 0<n.length?n[0]:e.getBody()},E={getParentList:R,getSelectedSubLists:function(e){var t,n,o,r=R(e),i=e.selection.getSelectedBlocks();return o=i,(n=r)&&1===o.length&&o[0]===n?(t=r,v.grep(t.querySelectorAll("ol,ul,dl"),fun
ction(e){return h(e)})):v.grep(i,function(e){return h(e)&&r!==e})},getSelectedListItems:function(e){var n,t,o,r=e.selection.getSelectedBlocks();return v.grep((n=e,t=r,o=v.map(t,function(e){var t=n.dom.getParent(e,"li,dd,dt",O(n,e));return t||e}),B.unique(o)),function(e){return i(e)})},getClosestListRootElm:O},A=tinymce.util.Tools.resolve("tinymce.Env"),P=t.DOM,x=function(e,t,n){var o,r,i,a=P.createFragment(),s=e.schema.getBlockElements();if(e.settings.forced_root_block&&(n=n||e.settings.forced_root_block),n&&((r=P.create(n)).tagName===e.settings.forced_root_block&&P.setAttribs(r,e.settings.forced_root_block_attrs),f(t.firstChild,s)||a.appendChild(r)),t)for(;o=t.firstChild;){var d=o.nodeName;i||"SPAN"===d&&"bookmark"===o.getAttribute("data-mce-type")||(i=!0),f(o,s)?(a.appendChild(o),r=null):n?(r||(r=P.create(n),a.appendChild(r)),r.appendChild(o)):a.appendChild(o)}return e.settings.forced_root_bl
ock?i||A.ie&&!(10<A.ie)||r.appendChild(P.create("br",{"data-mce-bogus":"1"})):a.appendChild(P.create("br")),a},_=t.DOM,M=function(e,t,n,o){var r,i,a,s,d;for(a=_.select('span[data-mce-type="bookmark"]',t),o=o||x(e,n),(r=_.createRng()).setStartAfter(n),r.setEndAfter(t),s=(i=r.extractContents()).firstChild;s;s=s.firstChild)if("LI"===s.nodeName&&e.dom.isEmpty(s)){_.remove(s);break}e.dom.isEmpty(i)||_.insertAfter(i,t),_.insertAfter(o,t),m(e.dom,n.parentNode)&&(d=n.parentNode,v.each(a,function(e){d.parentNode.insertBefore(e,n.parentNode)}),_.remove(d)),_.remove(n),m(e.dom,t)&&_.remove(t)},U=t.DOM,H=function(e,t){m(e,t)&&U.remove(t)},$=function(e,t){var n,o,r=t.parentNode;return r?(n=r.parentNode,r===e.getBody()||("DD"===t.nodeName?U.rename(t,"DT"):s(t)&&c(t)?"LI"===n.nodeName?(U.insertAfter(t,n),H(e.dom,n),U.remove(r)):h(n)?U.remove(r,!0):(n.insertBe
fore(x(e,t),r),U.remove(r)):s(t)?"LI"===n.nodeName?(U.insertAfter(t,n),t.appendChild(r),H(e.dom,n)):h(n)?n.insertBefore(t,r):(n.insertBefore(x(e,t),r),U.remove(t)):c(t)?"LI"===n.nodeName?U.insertAfter(t,n):h(n)?U.insertAfter(t,r):(U.insertAfter(x(e,t),r),U.remove(t)):("LI"===n.nodeName?(r=n,o=x(e,t,"LI")):o=h(n)?x(e,t,"LI"):x(e,t),M(e,r,t,o),I(e.dom,r.parentNode)))):H(e.dom,t),!0},w=$,K=function(e){var t=E.getSelectedListItems(e);if(t.length){var n=b(e.selection.getRng()),o=void 0,r=void 0,i=E.getClosestListRootElm(e,e.selection.getStart(!0));for(o=t.length;o--;)for(var a=t[o].parentNode;a&&a!==i;){for(r=t.length;r--;)if(t[r]===a){t.splice(o,1);break}a=a.parentNode}for(o=0;o<t.length&&($(e,t[o])||0!==o);o++);return e.selection.setRng(D(n)),e.nodeChanged(),!0}},Q=function(n,e){v.each(e,function(e,t){n.setAttribute(t,e)})},W=function(e,t,n){var o,r,i,a,s,d,l;o=e,r=t,a=(i=n)["list-style-type"]?i["list-s
tyle-type"]:null,o.setStyle(r,"list-style-type",a),s=e,Q(d=t,(l=n)["list-attributes"]),v.each(s.select("li",d),function(e){Q(e,l["list-item-attributes"])})},j=function(e,t,n,o){var r,i;for(r=t[n?"startContainer":"endContainer"],i=t[n?"startOffset":"endOffset"],1===r.nodeType&&(r=r.childNodes[Math.min(i,r.childNodes.length-1)]||r),!n&&C(r.nextSibling)&&(r=r.nextSibling);r.parentNode!==o;){if(y(e,r))return r;if(/^(TD|TH)$/.test(r.parentNode.nodeName))return r;r=r.parentNode}return r},q=function(c,f,u){void 0===u&&(u={});var e,t=c.selection.getRng(!0),m="LI",n=E.getClosestListRootElm(c,c.selection.getStart(!0)),g=c.dom;"false"!==g.getContentEditable(c.selection.getNode())&&("DL"===(f=f.toUpperCase())&&(m="DT"),e=b(t),v.each(function(n,e,o){for(var r,i=[],a=n.dom,t=j(n,e,!0,o),s=j(n,e,!1,o),d=[],l=t;l&&(d.pus
h(l),l!==s);l=l.nextSibling);return v.each(d,function(e){if(y(n,e))return i.push(e),void(r=null);if(a.isBlock(e)||C(e))return C(e)&&a.remove(e),void(r=null);var t=e.nextSibling;p.isBookmarkNode(e)&&(y(n,t)||!t&&e.parentNode===o)?r=null:(r||(r=a.create("p"),e.parentNode.insertBefore(r,e),i.push(r)),r.appendChild(e))}),i}(c,t,n),function(e){var t,n,o,r,i,a,s,d,l;(n=e.previousSibling)&&h(n)&&n.nodeName===f&&(o=n,r=u,i=g.getStyle(o,"list-style-type"),a=r?r["list-style-type"]:"",i===(a=null===a?"":a))?(t=n,e=g.rename(e,m),n.appendChild(e)):(t=g.create(f),e.parentNode.insertBefore(t,e),t.appendChild(e),e=g.rename(e,m)),s=g,d=e,l=["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"],v.each(l,function(e){return
s.setStyle(d,((t={})[e]="",t));var t}),W(g,t,u),z(c.dom,t)}),c.selection.setRng(D(e)))},F=function(o){var e=b(o.selection.getRng(!0)),r=E.getClosestListRootElm(o,o.selection.getStart(!0)),t=E.getSelectedListItems(o),n=v.grep(t,function(e){return o.dom.isEmpty(e)});t=v.grep(t,function(e){return!o.dom.isEmpty(e)}),v.each(n,function(e){m(o.dom,e)&&w(o,e)}),v.each(t,function(e){var t,n;if(e.parentNode!==o.getBody()){for(t=e;t&&t!==r;t=t.parentNode)h(t)&&(n=t);M(o,n,e),I(o.dom,n.parentNode)}}),o.selection.setRng(D(e))},V=function(e,t,n){return d=n,(s=t)&&d&&h(s)&&s.nodeName===d.nodeName&&(i=t,a=n,(r=e).getStyle(i,"list-style-type",!0)===r.getStyle(a,"list-style-type",!0))&&(o=n,t.className===o.className);var o,r,i,a,s,d},z=function(e,t){var n,o;if(n=t.nextSibling,V(e,t,n)){for(;o=n.firstChild;)t.appendChild(o);e.remove(n)}if(n=t.previousSibling,V(e,t,n)){for(;o=n.lastChild;)t.insertBefore(o,t.f
irstChild);e.remove(n)}},G=function(t,e,n,o,r){if(e.nodeName!==o||J(r)){var i=b(t.selection.getRng(!0));v.each([e].concat(n),function(e){!function(e,t,n,o){if(t.nodeName!==n){var r=e.rename(t,n);W(e,r,o)}else W(e,t,o)}(t.dom,e,o,r)}),t.selection.setRng(D(i))}else F(t)},J=function(e){return"list-style-type"in e},X={toggleList:function(e,t,n){var o=E.getParentList(e),r=E.getSelectedSubLists(e);n=n||{},o&&0<r.length?G(e,o,r,t,n):function(e,t,n,o){if(t!==e.getBody())if(t)if(t.nodeName!==n||J(o)){var r=b(e.selection.getRng(!0));W(e.dom,t,o),z(e.dom,e.dom.rename(t,n)),e.selection.setRng(D(r))}else F(e);else q(e,n,o)}(e,o,t,n)},removeList:F,mergeWithAdjacentLists:z},Y=function(e,t,n,o){var r,i,a=t.startContainer,s=t.startOffset;if(3===a.nodeType&&(n?s<a.data.length:0<s))return a;for(r=e.schema.getNonEmptyElements(),1===a.nodeType&&(a=d.getNode(a,s)),i=new l(a,o),n&&u(e.dom,a)&&i.next();a=i[n?"next":"prev2"]();){
if("LI"===a.nodeName&&!a.hasChildNodes())return a;if(r[a.nodeName])return a;if(3===a.nodeType&&0<a.data.length)return a}},Z=function(e,t){var n=t.childNodes;return 1===n.length&&!h(n[0])&&e.isBlock(n[0])},ee=function(e,t,n){var o,r,i,a;if(r=Z(e,n)?n.firstChild:n,Z(i=e,a=t)&&i.remove(a.firstChild,!0),!m(e,t,!0))for(;o=t.firstChild;)r.appendChild(o)},te=function(e,t,n){var o,r,i=t.parentNode;g(e,t)&&g(e,n)&&(h(n.lastChild)&&(r=n.lastChild),i===n.lastChild&&C(i.previousSibling)&&e.remove(i.previousSibling),(o=n.lastChild)&&C(o)&&t.hasChildNodes()&&e.remove(o),m(e,n,!0)&&e.$(n).empty(),ee(e,t,n),r&&n.appendChild(r),e.remove(t),m(e,i)&&i!==e.getRoot()&&e.remove(i))},ne=function(e,t,n,o){var r,i,a,s=e.dom;if(s.isEmpty(o))i=n,a=o,(r=e).dom.$(a).empty(),te(r.dom,i,a),r.selection.setCursorLocation(a);else{var d=b(t);te(s,n,o),e.selection.setRng(
D(d))}},oe=function(e,t){var n,o,r,i=e.dom,a=e.selection,s=a.getStart(),d=E.getClosestListRootElm(e,s),l=i.getParent(a.getStart(),"LI",d);if(l){if((n=l.parentNode)===e.getBody()&&m(i,n))return!0;if(o=L(a.getRng(!0)),(r=i.getParent(Y(e,o,t,d),"LI",d))&&r!==l)return t?ne(e,o,r,l):function(e,t,n,o){var r=b(t);te(e.dom,n,o);var i=D(r);e.selection.setRng(i)}(e,o,l,r),!0;if(!r&&!t&&X.removeList(e))return!0}return!1},re=function(e,t){return oe(e,t)||function(r,i){var a=r.dom,e=r.selection.getStart(),s=E.getClosestListRootElm(r,e),d=a.getParent(e,a.isBlock,s);if(d&&a.isEmpty(d)){var t=L(r.selection.getRng(!0)),l=a.getParent(Y(r,t,i,s),"LI",s);if(l)return r.undoManager.transact(function(){var e,t,n,o;t=d,n=s,o=(e=a).getParent(t.parentNode,e.isBlock,n),e.remove(t),o&&e.isEmpty(o)&&e.remove(o),X.mergeWithAdjacentLists(a,l.parentNode),r.selection.select(l,!0),r.selection.collapse(i)}),!0}return!1}(e,t)},ie=fun
ction(e,t){return e.selection.isCollapsed()?re(e,t):(o=(n=e).selection.getStart(),r=E.getClosestListRootElm(n,o),!!(n.dom.getParent(o,"LI,DT,DD",r)||0<E.getSelectedListItems(n).length)&&(n.undoManager.transact(function(){n.execCommand("Delete"),I(n.dom,n.getBody())}),!0));var n,o,r},ae=function(t){t.on("keydown",function(e){e.keyCode===n.BACKSPACE?ie(t,!1)&&e.preventDefault():e.keyCode===n.DELETE&&ie(t,!0)&&e.preventDefault()})},se=ie,de=function(t){return{backspaceDelete:function(e){se(t,e)}}},le=t.DOM,ce=function(e,t){var n;if(h(e)){for(;n=e.firstChild;)t.appendChild(n);le.remove(e)}},fe=function(e){var t,n,o,r,i=E.getSelectedListItems(e);if(i.length){for(var a=b(e.selection.getRng(!0)),s=0;s<i.length&&(t=i[s],r=o=n=void 0,("DT"===t.nodeName?(le.rename(t,"DD"),1):(n=t.previousSibling)&&h(n)?(n.appendChild(t),1):n&&"LI"===n.nodeName&&h(n.lastChild)?(n.la
stChild.appendChild(t),ce(t.lastChild,n.lastChild),1):(n=t.nextSibling)&&h(n)?(n.insertBefore(t,n.firstChild),1):(n=t.previousSibling)&&"LI"===n.nodeName&&(o=le.create(t.parentNode.nodeName),(r=le.getStyle(t.parentNode,"listStyleType"))&&le.setStyle(o,"listStyleType",r),n.appendChild(o),o.appendChild(t),ce(t.lastChild,o),1))||0!==s);s++);return e.selection.setRng(D(a)),e.nodeChanged(),!0}},ue=function(t,n){return function(){var e=t.dom.getParent(t.selection.getStart(),"UL,OL,DL");return e&&e.nodeName===n}},me=function(o){o.on("BeforeExecCommand",function(e){var t,n=e.command.toLowerCase();if("indent"===n?fe(o)&&(t=!0):"outdent"===n&&K(o)&&(t=!0),t)return o.fire("ExecCommand",{command:e.command}),e.preventDefault(),!0}),o.addCommand("InsertUnorderedList",function(e,t){X.toggleList(o,"UL",t)}),o.addCommand("InsertOrder
edList",function(e,t){X.toggleList(o,"OL",t)}),o.addCommand("InsertDefinitionList",function(e,t){X.toggleList(o,"DL",t)}),o.addQueryStateHandler("InsertUnorderedList",ue(o,"UL")),o.addQueryStateHandler("InsertOrderedList",ue(o,"OL")),o.addQueryStateHandler("InsertDefinitionList",ue(o,"DL"))},ge=function(e){return e.getParam("lists_indent_on_tab",!0)},pe=function(e){var t;ge(e)&&(t=e).on("keydown",function(e){e.keyCode!==n.TAB||n.metaKeyPressed(e)||t.dom.getParent(t.selection.getStart(),"LI,DT,DD")&&(e.preventDefault(),e.shiftKey?K(t):fe(t))}),ae(e)},ve=function(t,i){return function(e){var r=e.control;t.on("NodeChange",function(e){var t=function(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n;return-1}(e.parents,a),n=-1!==t?e.parents.slice(0,t):e.parents,o=v.grep(n,h);r.active(0<o.length&&o[0].nodeName===i)})}},he=fun
ction(e){var t,n,o,r;n="advlist",o=(t=e).settings.plugins?t.settings.plugins:"",-1===v.inArray(o.split(/[ ,]/),n)&&(e.addButton("numlist",{active:!1,title:"Numbered list",cmd:"InsertOrderedList",onPostRender:ve(e,"OL")}),e.addButton("bullist",{active:!1,title:"Bullet list",cmd:"InsertUnorderedList",onPostRender:ve(e,"UL")})),e.addButton("indent",{icon:"indent",title:"Increase indent",cmd:"Indent",onPostRender:(r=e,function(e){var n=e.control;r.on("nodechange",function(){var e=E.getSelectedListItems(r),t=0<e.length&&s(e[0]);n.disabled(t)})})})};e.add("lists",function(e){return pe(e),he(e),me(e),de(e)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginsmediapluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/media/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/media/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/media/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,1788 +1,1166 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var media = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getScripts = function (editor) {
+ return editor.getParam('media_scripts');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getAudioTemplateCallback = function (editor) {
+ return editor.getParam('audio_template_callback');
+ };
+ var getVideoTemplateCallback = function (editor) {
+ return editor.getParam('video_template_callback');
+ };
+ var hasLiveEmbeds = function (editor) {
+ return editor.getParam('media_live_embeds', true);
+ };
+ var shouldFilterHtml = function (editor) {
+ return editor.getParam('media_filter_html', true);
+ };
+ var getUrlResolver = function (editor) {
+ return editor.getParam('media_url_resolver');
+ };
+ var hasAltSource = function (editor) {
+ return editor.getParam('media_alt_source', true);
+ };
+ var hasPoster = function (editor) {
+ return editor.getParam('media_poster', true);
+ };
+ var hasDimensions = function (editor) {
+ return editor.getParam('media_dimensions', true);
+ };
+ var $_bmkzfegajfuw8pol = {
+ getScripts: getScripts,
+ getAudioTemplateCallback: getAudioTemplateCallback,
+ getVideoTemplateCallback: getVideoTemplateCallback,
+ hasLiveEmbeds: hasLiveEmbeds,
+ shouldFilterHtml: shouldFilterHtml,
+ getUrlResolver: getUrlResolver,
+ hasAltSource: hasAltSource,
+ hasPoster: hasPoster,
+ hasDimensions: hasDimensions
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$3 = tinymce.util.Tools.resolve('tinymce.html.SaxParser');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$4 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getVideoScriptMatch = function (prefixes, src) {
+ if (prefixes) {
+ for (var i = 0; i < prefixes.length; i++) {
+ if (src.indexOf(prefixes[i].filter) !== -1) {
+ return prefixes[i];
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_9fg1sigejfuw8poq = { getVideoScriptMatch: getVideoScriptMatch };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.media.Plugin","tinymce.core.html.Node","tinymce.core.PluginManager","tinymce.core.util.Tools","tinymce.plugins.media.core.Nodes","tinymce.plugins.media.core.Sanitize","tinymce.plugins.media.core.UpdateHtml","tinymce.plugins.media.ui.Dialog","global!tinymce.util.Tools.resolve","tinymce.core.html.Writer","tinymce.core.html.SaxParser","tinymce.core.html.Schema","tinymce.plugins.media.core.VideoScript","tinymce.core.Env","tinymce.core.dom.DOMUtils","tinymce.plugins.media.core.Size","tinymce.core.util.Delay","tinymce.plugins.media.core.HtmlToData","tinymce.plugins.media.core.Service","tinymce.plugins.media.ui.SizeManager","tinymce.plugins.media.core.DataToHtml","tinymce.core.util.Promise","tinymce.plugins.media.core.Mime","tinymce.plugins.
media.core.UrlPatterns"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.html.Node',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.html.Node');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.html.Writer',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.html.Writer');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.html.SaxParser',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.html.SaxParser');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.html.Schema',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.html.Schema');
- }
-);
-
-/**
- * Sanitize.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.core.Sanitize',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.html.Writer',
- 'tinymce.core.html.SaxParser',
- 'tinymce.core.html.Schema'
- ],
- function (Tools, Writer, SaxParser, Schema) {
- var sanitize = function (editor, html) {
- if (editor.settings.media_filter_html === false) {
- return html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var trimPx = function (value) {
+ return value.replace(/px$/, '');
+ };
+ var addPx = function (value) {
+ return /^[0-9.]+$/.test(value) ? value + 'px' : value;
+ };
+ var getSize = function (name) {
+ return function (elm) {
+ return elm ? trimPx(elm.style[name]) : '';
+ };
+ };
+ var setSize = function (name) {
+ return function (elm, value) {
+ if (elm) {
+ elm.style[name] = addPx(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ };
+ var $_7rx1rygfjfuw8por = {
+ getMaxWidth: getSize('maxWidth'),
+ getMaxHeight: getSize('maxHeight'),
+ setMaxWidth: setSize('maxWidth'),
+ setMaxHeight: setSize('maxHeight')
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var writer = new Writer();
- var blocked;
-
- new SaxParser({
- validate: false,
- allow_conditional_comments: false,
- special: 'script,noscript',
-
- comment: function (text) {
- writer.comment(text);
- },
-
- cdata: function (text) {
- writer.cdata(text);
- },
-
- text: function (text, raw) {
- writer.text(text, raw);
- },
-
- start: function (name, attrs, empty) {
- blocked = true;
-
- if (name === 'script' || name === 'noscript') {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM = global$4.DOM;
+ var getEphoxEmbedIri = function (elm) {
+ return DOM.getAttrib(elm, 'data-ephox-embed-iri');
+ };
+ var isEphoxEmbed = function (html) {
+ var fragment = DOM.createFragment(html);
+ return getEphoxEmbedIri(fragment.firstChild) !== '';
+ };
+ var htmlToDataSax = function (prefixes, html) {
+ var data = {};
+ global$3({
+ validate: false,
+ allow_conditional_comments: true,
+ special: 'script,noscript',
+ start: function (name, attrs) {
+ if (!data.source1 && name === 'param') {
+ data.source1 = attrs.map.movie;
+ }
+ if (name === 'iframe' || name === 'object' || name === 'embed' || name === 'video' || name === 'audio') {
+ if (!data.type) {
+ data.type = name;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (var i = 0; i < attrs.length; i++) {
- if (attrs[i].name.indexOf('on') === 0) {
- return;
- }
-
- if (attrs[i].name === 'style') {
- attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name);
- }
- }
-
- writer.start(name, attrs, empty);
- blocked = false;
- },
-
- end: function (name) {
- if (blocked) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ data = global$2.extend(attrs.map, data);
+ }
+ if (name === 'script') {
+ var videoScript = $_9fg1sigejfuw8poq.getVideoScriptMatch(prefixes, attrs.map.src);
+ if (!videoScript) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- writer.end(name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ data = {
+ type: 'script',
+ source1: attrs.map.src,
+ width: videoScript.width,
+ height: videoScript.height
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }, new Schema({})).parse(html);
-
- return writer.getContent();
- };
-
- return {
- sanitize: sanitize
- };
- }
-);
-/**
- * VideoScript.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.core.VideoScript',
- [
- ],
- function () {
- var getVideoScriptMatch = function (prefixes, src) {
- // var prefixes = editor.settings.media_scripts;
- if (prefixes) {
- for (var i = 0; i < prefixes.length; i++) {
- if (src.indexOf(prefixes[i].filter) !== -1) {
- return prefixes[i];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (name === 'source') {
+ if (!data.source1) {
+ data.source1 = attrs.map.src;
+ } else if (!data.source2) {
+ data.source2 = attrs.map.src;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (name === 'img' && !data.poster) {
+ data.poster = attrs.map.src;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).parse(html);
+ data.source1 = data.source1 || data.src || data.data;
+ data.source2 = data.source2 || '';
+ data.poster = data.poster || '';
+ return data;
+ };
+ var ephoxEmbedHtmlToData = function (html) {
+ var fragment = DOM.createFragment(html);
+ var div = fragment.firstChild;
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- getVideoScriptMatch: getVideoScriptMatch
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type: 'ephox-embed-iri',
+ source1: getEphoxEmbedIri(div),
+ source2: '',
+ poster: '',
+ width: $_7rx1rygfjfuw8por.getMaxWidth(div),
+ height: $_7rx1rygfjfuw8por.getMaxHeight(div)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var htmlToData = function (prefixes, html) {
+ return isEphoxEmbed(html) ? ephoxEmbedHtmlToData(html) : htmlToDataSax(prefixes, html);
+ };
+ var $_g969ozgbjfuw8pom = { htmlToData: htmlToData };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.Env',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.Env');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$5 = tinymce.util.Tools.resolve('tinymce.util.Promise');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Nodes.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.core.Nodes',
- [
- 'tinymce.plugins.media.core.Sanitize',
- 'tinymce.plugins.media.core.VideoScript',
- 'tinymce.core.html.Node',
- 'tinymce.core.Env'
- ],
- function (Sanitize, VideoScript, Node, Env) {
- var createPlaceholderNode = function (editor, node) {
- var placeHolder;
- var name = node.name;
-
- placeHolder = new Node('img', 1);
- placeHolder.shortEnded = true;
-
- retainAttributesAndInnerHtml(editor, node, placeHolder);
-
- placeHolder.attr({
- width: node.attr('width') || "300",
- height: node.attr('height') || (name === "audio" ? "30" : "150"),
- style: node.attr('style'),
- src: Env.transparentSrc,
- "data-mce-object": name,
- "class": "mce-object mce-object-" + name
- });
-
- return placeHolder;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var guess = function (url) {
+ var mimes = {
+ mp3: 'audio/mpeg',
+ wav: 'audio/wav',
+ mp4: 'video/mp4',
+ webm: 'video/webm',
+ ogg: 'video/ogg',
+ swf: 'application/x-shockwave-flash'
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fileEnd = url.toLowerCase().split('.').pop();
+ var mime = mimes[fileEnd];
+ return mime ? mime : '';
+ };
+ var $_dq3p76gjjfuw8poy = { guess: guess };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var createPreviewIframeNode = function (editor, node) {
- var previewWrapper;
- var previewNode;
- var shimNode;
- var name = node.name;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$6 = tinymce.util.Tools.resolve('tinymce.html.Writer');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- previewWrapper = new Node('span', 1);
- previewWrapper.attr({
- contentEditable: 'false',
- style: node.attr('style'),
- "data-mce-object": name,
- "class": "mce-preview-object mce-object-" + name
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$7 = tinymce.util.Tools.resolve('tinymce.html.Schema');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- retainAttributesAndInnerHtml(editor, node, previewWrapper);
-
- previewNode = new Node(name, 1);
- previewNode.attr({
- src: node.attr('src'),
- allowfullscreen: node.attr('allowfullscreen'),
- width: node.attr('width') || "300",
- height: node.attr('height') || (name === "audio" ? "30" : "150"),
- frameborder: '0'
- });
-
- shimNode = new Node('span', 1);
- shimNode.attr('class', 'mce-shim');
-
- previewWrapper.append(previewNode);
- previewWrapper.append(shimNode);
-
- return previewWrapper;
- };
-
- var retainAttributesAndInnerHtml = function (editor, sourceNode, targetNode) {
- var attrName;
- var attrValue;
- var attribs;
- var ai;
- var innerHtml;
-
- // Prefix all attributes except width, height and style since we
- // will add these to the placeholder
- attribs = sourceNode.attributes;
- ai = attribs.length;
- while (ai--) {
- attrName = attribs[ai].name;
- attrValue = attribs[ai].value;
-
- if (attrName !== "width" && attrName !== "height" && attrName !== "style") {
- if (attrName === "data" || attrName === "src") {
- attrValue = editor.convertURL(attrValue, attrName);
- }
-
- targetNode.attr('data-mce-p-' + attrName, attrValue);
- }
- }
-
- // Place the inner HTML contents inside an escaped attribute
- // This enables us to copy/paste the fake object
- innerHtml = sourceNode.firstChild && sourceNode.firstChild.value;
- if (innerHtml) {
- targetNode.attr("data-mce-html", escape(Sanitize.sanitize(editor, innerHtml)));
- targetNode.firstChild = null;
- }
- };
-
- var isWithinEphoxEmbed = function (node) {
- while ((node = node.parent)) {
- if (node.attr('data-ephox-embed-iri')) {
- return true;
- }
- }
-
- return false;
- };
-
- var placeHolderConverter = function (editor) {
- return function (nodes) {
- var i = nodes.length;
- var node;
- var videoScript;
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$1 = global$4.DOM;
+ var setAttributes = function (attrs, updatedAttrs) {
+ var name;
+ var i;
+ var value;
+ var attr;
+ for (name in updatedAttrs) {
+ value = '' + updatedAttrs[name];
+ if (attrs.map[name]) {
+ i = attrs.length;
</ins><span class="cx" style="display: block; padding: 0 10px"> while (i--) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- node = nodes[i];
- if (!node.parent) {
- continue;
- }
-
- if (node.parent.attr('data-mce-object')) {
- continue;
- }
-
- if (node.name === 'script') {
- videoScript = VideoScript.getVideoScriptMatch(editor.settings.media_scripts, node.attr('src'));
- if (!videoScript) {
- continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ attr = attrs[i];
+ if (attr.name === name) {
+ if (value) {
+ attrs.map[name] = value;
+ attr.value = value;
+ } else {
+ delete attrs.map[name];
+ attrs.splice(i, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (videoScript) {
- if (videoScript.width) {
- node.attr('width', videoScript.width.toString());
- }
-
- if (videoScript.height) {
- node.attr('height', videoScript.height.toString());
- }
- }
-
- if (node.name === 'iframe' && editor.settings.media_live_embeds !== false && Env.ceFalse) {
- if (!isWithinEphoxEmbed(node)) {
- node.replace(createPreviewIframeNode(editor, node));
- }
- } else {
- if (!isWithinEphoxEmbed(node)) {
- node.replace(createPlaceholderNode(editor, node));
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- };
-
- return {
- createPreviewIframeNode: createPreviewIframeNode,
- createPlaceholderNode: createPlaceholderNode,
- placeHolderConverter: placeHolderConverter
- };
- }
-);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.DOMUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.DOMUtils');
- }
-);
-
-/**
- * Size.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.core.Size',
- [
- ],
- function () {
- var trimPx = function (value) {
- return value.replace(/px$/, '');
- };
-
- var addPx = function (value) {
- return /^[0-9.]+$/.test(value) ? (value + 'px') : value;
- };
-
- var getSize = function (name) {
- return function (elm) {
- return elm ? trimPx(elm.style[name]) : '';
- };
- };
-
- var setSize = function (name) {
- return function (elm, value) {
- if (elm) {
- elm.style[name] = addPx(value);
- }
- };
- };
-
- return {
- getMaxWidth: getSize('maxWidth'),
- getMaxHeight: getSize('maxHeight'),
- setMaxWidth: setSize('maxWidth'),
- setMaxHeight: setSize('maxHeight')
- };
- }
-);
-/**
- * UpdateHtml.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.core.UpdateHtml',
- [
- 'tinymce.core.html.Writer',
- 'tinymce.core.html.SaxParser',
- 'tinymce.core.html.Schema',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.plugins.media.core.Size'
- ],
- function (Writer, SaxParser, Schema, DOMUtils, Size) {
- var DOM = DOMUtils.DOM;
-
- var setAttributes = function (attrs, updatedAttrs) {
- var name;
- var i;
- var value;
- var attr;
-
- for (name in updatedAttrs) {
- value = "" + updatedAttrs[name];
-
- if (attrs.map[name]) {
- i = attrs.length;
- while (i--) {
- attr = attrs[i];
-
- if (attr.name === name) {
- if (value) {
- attrs.map[name] = value;
- attr.value = value;
- } else {
- delete attrs.map[name];
- attrs.splice(i, 1);
- }
- }
- }
- } else if (value) {
- attrs.push({
- name: name,
- value: value
- });
-
- attrs.map[name] = value;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (value) {
+ attrs.push({
+ name: name,
+ value: value
+ });
+ attrs.map[name] = value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var normalizeHtml = function (html) {
- var writer = new Writer();
- var parser = new SaxParser(writer);
- parser.parse(html);
- return writer.getContent();
- };
-
- var updateHtmlSax = function (html, data, updateAll) {
- var writer = new Writer();
- var sourceCount = 0;
- var hasImage;
-
- new SaxParser({
- validate: false,
- allow_conditional_comments: true,
- special: 'script,noscript',
-
- comment: function (text) {
- writer.comment(text);
- },
-
- cdata: function (text) {
- writer.cdata(text);
- },
-
- text: function (text, raw) {
- writer.text(text, raw);
- },
-
- start: function (name, attrs, empty) {
- switch (name) {
- case "video":
- case "object":
- case "embed":
- case "img":
- case "iframe":
- if (data.height !== undefined && data.width !== undefined) {
- setAttributes(attrs, {
- width: data.width,
- height: data.height
- });
- }
- break;
- }
-
- if (updateAll) {
- switch (name) {
- case "video":
- setAttributes(attrs, {
- poster: data.poster,
- src: ""
- });
-
- if (data.source2) {
- setAttributes(attrs, {
- src: ""
- });
- }
- break;
-
- case "iframe":
- setAttributes(attrs, {
- src: data.source1
- });
- break;
-
- case "source":
- sourceCount++;
-
- if (sourceCount <= 2) {
- setAttributes(attrs, {
- src: data["source" + sourceCount],
- type: data["source" + sourceCount + "mime"]
- });
-
- if (!data["source" + sourceCount]) {
- return;
- }
- }
- break;
-
- case "img":
- if (!data.poster) {
- return;
- }
-
- hasImage = true;
- break;
- }
- }
-
- writer.start(name, attrs, empty);
- },
-
- end: function (name) {
- if (name === "video" && updateAll) {
- for (var index = 1; index <= 2; index++) {
- if (data["source" + index]) {
- var attrs = [];
- attrs.map = {};
-
- if (sourceCount < index) {
- setAttributes(attrs, {
- src: data["source" + index],
- type: data["source" + index + "mime"]
- });
-
- writer.start("source", attrs, true);
- }
- }
- }
- }
-
- if (data.poster && name === "object" && updateAll && !hasImage) {
- var imgAttrs = [];
- imgAttrs.map = {};
-
- setAttributes(imgAttrs, {
- src: data.poster,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var normalizeHtml = function (html) {
+ var writer = global$6();
+ var parser = global$3(writer);
+ parser.parse(html);
+ return writer.getContent();
+ };
+ var updateHtmlSax = function (html, data, updateAll) {
+ var writer = global$6();
+ var sourceCount = 0;
+ var hasImage;
+ global$3({
+ validate: false,
+ allow_conditional_comments: true,
+ special: 'script,noscript',
+ comment: function (text) {
+ writer.comment(text);
+ },
+ cdata: function (text) {
+ writer.cdata(text);
+ },
+ text: function (text, raw) {
+ writer.text(text, raw);
+ },
+ start: function (name, attrs, empty) {
+ switch (name) {
+ case 'video':
+ case 'object':
+ case 'embed':
+ case 'img':
+ case 'iframe':
+ if (data.height !== undefined && data.width !== undefined) {
+ setAttributes(attrs, {
</ins><span class="cx" style="display: block; padding: 0 10px"> width: data.width,
</span><span class="cx" style="display: block; padding: 0 10px"> height: data.height
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- writer.start("img", imgAttrs, true);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- writer.end(name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }, new Schema({})).parse(html);
-
- return writer.getContent();
- };
-
- var isEphoxEmbed = function (html) {
- var fragment = DOM.createFragment(html);
- return DOM.getAttrib(fragment.firstChild, 'data-ephox-embed-iri') !== '';
- };
-
- var updateEphoxEmbed = function (html, data) {
- var fragment = DOM.createFragment(html);
- var div = fragment.firstChild;
-
- Size.setMaxWidth(div, data.width);
- Size.setMaxHeight(div, data.height);
-
- return normalizeHtml(div.outerHTML);
- };
-
- var updateHtml = function (html, data, updateAll) {
- return isEphoxEmbed(html) ? updateEphoxEmbed(html, data) : updateHtmlSax(html, data, updateAll);
- };
-
- return {
- updateHtml: updateHtml
- };
- }
-);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Delay',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Delay');
- }
-);
-
-/**
- * HtmlToData.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.core.HtmlToData',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.html.SaxParser',
- 'tinymce.core.html.Schema',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.plugins.media.core.VideoScript',
- 'tinymce.plugins.media.core.Size'
- ],
- function (Tools, SaxParser, Schema, DOMUtils, VideoScript, Size) {
- var DOM = DOMUtils.DOM;
-
- var getEphoxEmbedIri = function (elm) {
- return DOM.getAttrib(elm, 'data-ephox-embed-iri');
- };
-
- var isEphoxEmbed = function (html) {
- var fragment = DOM.createFragment(html);
- return getEphoxEmbedIri(fragment.firstChild) !== '';
- };
-
- var htmlToDataSax = function (prefixes, html) {
- var data = {};
-
- new SaxParser({
- validate: false,
- allow_conditional_comments: true,
- special: 'script,noscript',
- start: function (name, attrs) {
- if (!data.source1 && name === "param") {
- data.source1 = attrs.map.movie;
- }
-
- if (name === "iframe" || name === "object" || name === "embed" || name === "video" || name === "audio") {
- if (!data.type) {
- data.type = name;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (updateAll) {
+ switch (name) {
+ case 'video':
+ setAttributes(attrs, {
+ poster: data.poster,
+ src: ''
+ });
+ if (data.source2) {
+ setAttributes(attrs, { src: '' });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- data = Tools.extend(attrs.map, data);
- }
-
- if (name === "script") {
- var videoScript = VideoScript.getVideoScriptMatch(prefixes, attrs.map.src);
- if (!videoScript) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
+ case 'iframe':
+ setAttributes(attrs, { src: data.source1 });
+ break;
+ case 'source':
+ sourceCount++;
+ if (sourceCount <= 2) {
+ setAttributes(attrs, {
+ src: data['source' + sourceCount],
+ type: data['source' + sourceCount + 'mime']
+ });
+ if (!data['source' + sourceCount]) {
+ return;
+ }
+ }
+ break;
+ case 'img':
+ if (!data.poster) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- data = {
- type: "script",
- source1: attrs.map.src,
- width: videoScript.width,
- height: videoScript.height
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ hasImage = true;
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (name === "source") {
- if (!data.source1) {
- data.source1 = attrs.map.src;
- } else if (!data.source2) {
- data.source2 = attrs.map.src;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ writer.start(name, attrs, empty);
+ },
+ end: function (name) {
+ if (name === 'video' && updateAll) {
+ for (var index = 1; index <= 2; index++) {
+ if (data['source' + index]) {
+ var attrs = [];
+ attrs.map = {};
+ if (sourceCount < index) {
+ setAttributes(attrs, {
+ src: data['source' + index],
+ type: data['source' + index + 'mime']
+ });
+ writer.start('source', attrs, true);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (name === "img" && !data.poster) {
- data.poster = attrs.map.src;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }).parse(html);
-
- data.source1 = data.source1 || data.src || data.data;
- data.source2 = data.source2 || '';
- data.poster = data.poster || '';
-
- return data;
- };
-
- var ephoxEmbedHtmlToData = function (html) {
- var fragment = DOM.createFragment(html);
- var div = fragment.firstChild;
-
- return {
- type: 'ephox-embed-iri',
- source1: getEphoxEmbedIri(div),
- source2: '',
- poster: '',
- width: Size.getMaxWidth(div),
- height: Size.getMaxHeight(div)
- };
- };
-
- var htmlToData = function (prefixes, html) {
- return isEphoxEmbed(html) ? ephoxEmbedHtmlToData(html) : htmlToDataSax(prefixes, html);
- };
-
- return {
- htmlToData: htmlToData
- };
- }
-);
-/**
- * Mime.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.core.Mime',
- [
- ],
- function () {
- var guess = function (url) {
- var mimes = {
- 'mp3': 'audio/mpeg',
- 'wav': 'audio/wav',
- 'mp4': 'video/mp4',
- 'webm': 'video/webm',
- 'ogg': 'video/ogg',
- 'swf': 'application/x-shockwave-flash'
- };
- var fileEnd = url.toLowerCase().split('.').pop();
- var mime = mimes[fileEnd];
-
- return mime ? mime : '';
- };
-
- return {
- guess: guess
- };
- }
-);
-/**
- * UrlPatterns.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.core.UrlPatterns',
- [
- ],
- function () {
- var urlPatterns = [
- {
- regex: /youtu\.be\/([\w\-.]+)/,
- type: 'iframe', w: 560, h: 314,
- url: '//www.youtube.com/embed/$1',
- allowFullscreen: true
- },
- {
- regex: /youtube\.com(.+)v=([^&]+)/,
- type: 'iframe', w: 560, h: 314,
- url: '//www.youtube.com/embed/$2',
- allowFullscreen: true
- },
- {
- regex: /youtube.com\/embed\/([a-z0-9\-_]+(?:\?.+)?)/i,
- type: 'iframe', w: 560, h: 314,
- url: '//www.youtube.com/embed/$1',
- allowFullscreen: true
- },
- {
- regex: /vimeo\.com\/([0-9]+)/,
- type: 'iframe', w: 425, h: 350,
- url: '//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc',
- allowfullscreen: true
- },
- {
- regex: /vimeo\.com\/(.*)\/([0-9]+)/,
- type: "iframe", w: 425, h: 350,
- url: "//player.vimeo.com/video/$2?title=0&byline=0",
- allowfullscreen: true
- },
- {
- regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,
- type: 'iframe', w: 425, h: 350,
- url: '//maps.google.com/maps/ms?msid=$2&output=embed"',
- allowFullscreen: false
- },
- {
- regex: /dailymotion\.com\/video\/([^_]+)/,
- type: 'iframe', w: 480, h: 270,
- url: '//www.dailymotion.com/embed/video/$1',
- allowFullscreen: true
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (data.poster && name === 'object' && updateAll && !hasImage) {
+ var imgAttrs = [];
+ imgAttrs.map = {};
+ setAttributes(imgAttrs, {
+ src: data.poster,
+ width: data.width,
+ height: data.height
+ });
+ writer.start('img', imgAttrs, true);
+ }
+ writer.end(name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, global$7({})).parse(html);
+ return writer.getContent();
+ };
+ var isEphoxEmbed$1 = function (html) {
+ var fragment = DOM$1.createFragment(html);
+ return DOM$1.getAttrib(fragment.firstChild, 'data-ephox-embed-iri') !== '';
+ };
+ var updateEphoxEmbed = function (html, data) {
+ var fragment = DOM$1.createFragment(html);
+ var div = fragment.firstChild;
+ $_7rx1rygfjfuw8por.setMaxWidth(div, data.width);
+ $_7rx1rygfjfuw8por.setMaxHeight(div, data.height);
+ return normalizeHtml(div.outerHTML);
+ };
+ var updateHtml = function (html, data, updateAll) {
+ return isEphoxEmbed$1(html) ? updateEphoxEmbed(html, data) : updateHtmlSax(html, data, updateAll);
+ };
+ var $_9oq1mlgkjfuw8pp0 = { updateHtml: updateHtml };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- urlPatterns: urlPatterns
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var urlPatterns = [
+ {
+ regex: /youtu\.be\/([\w\-_\?&=.]+)/i,
+ type: 'iframe',
+ w: 560,
+ h: 314,
+ url: '//www.youtube.com/embed/$1',
+ allowFullscreen: true
+ },
+ {
+ regex: /youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i,
+ type: 'iframe',
+ w: 560,
+ h: 314,
+ url: '//www.youtube.com/embed/$2?$4',
+ allowFullscreen: true
+ },
+ {
+ regex: /youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i,
+ type: 'iframe',
+ w: 560,
+ h: 314,
+ url: '//www.youtube.com/embed/$1',
+ allowFullscreen: true
+ },
+ {
+ regex: /vimeo\.com\/([0-9]+)/,
+ type: 'iframe',
+ w: 425,
+ h: 350,
+ url: '//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc',
+ allowFullscreen: true
+ },
+ {
+ regex: /vimeo\.com\/(.*)\/([0-9]+)/,
+ type: 'iframe',
+ w: 425,
+ h: 350,
+ url: '//player.vimeo.com/video/$2?title=0&byline=0',
+ allowFullscreen: true
+ },
+ {
+ regex: /maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,
+ type: 'iframe',
+ w: 425,
+ h: 350,
+ url: '//maps.google.com/maps/ms?msid=$2&output=embed"',
+ allowFullscreen: false
+ },
+ {
+ regex: /dailymotion\.com\/video\/([^_]+)/,
+ type: 'iframe',
+ w: 480,
+ h: 270,
+ url: '//www.dailymotion.com/embed/video/$1',
+ allowFullscreen: true
+ },
+ {
+ regex: /dai\.ly\/([^_]+)/,
+ type: 'iframe',
+ w: 480,
+ h: 270,
+ url: '//www.dailymotion.com/embed/video/$1',
+ allowFullscreen: true
+ }
+ ];
+ var getUrl = function (pattern, url) {
+ var match = pattern.regex.exec(url);
+ var newUrl = pattern.url;
+ var _loop_1 = function (i) {
+ newUrl = newUrl.replace('$' + i, function () {
+ return match[i] ? match[i] : '';
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * DataToHtml.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (var i = 0; i < match.length; i++) {
+ _loop_1(i);
+ }
+ return newUrl.replace(/\?$/, '');
+ };
+ var matchPattern = function (url) {
+ var pattern = urlPatterns.filter(function (pattern) {
+ return pattern.regex.test(url);
+ });
+ if (pattern.length > 0) {
+ return global$2.extend({}, pattern[0], { url: getUrl(pattern[0], url) });
+ } else {
+ return null;
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.plugins.media.core.DataToHtml',
- [
- 'tinymce.plugins.media.core.Mime',
- 'tinymce.plugins.media.core.HtmlToData',
- 'tinymce.plugins.media.core.UrlPatterns',
- 'tinymce.plugins.media.core.VideoScript',
- 'tinymce.plugins.media.core.UpdateHtml',
- 'tinymce.core.util.Tools'
- ],
- function (Mime, HtmlToData, UrlPatterns, VideoScript, UpdateHtml, Tools) {
- var dataToHtml = function (editor, dataIn) {
- var html = '';
- var data = Tools.extend({}, dataIn);
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getIframeHtml = function (data) {
+ var allowFullscreen = data.allowFullscreen ? ' allowFullscreen="1"' : '';
+ return '<iframe src="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '"' + allowFullscreen + '></iframe>';
+ };
+ var getFlashHtml = function (data) {
+ var html = '<object data="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '" type="application/x-shockwave-flash">';
+ if (data.poster) {
+ html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
+ }
+ html += '</object>';
+ return html;
+ };
+ var getAudioHtml = function (data, audioTemplateCallback) {
+ if (audioTemplateCallback) {
+ return audioTemplateCallback(data);
+ } else {
+ return '<audio controls="controls" src="' + data.source1 + '">' + (data.source2 ? '\n<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') + '</audio>';
+ }
+ };
+ var getVideoHtml = function (data, videoTemplateCallback) {
+ if (videoTemplateCallback) {
+ return videoTemplateCallback(data);
+ } else {
+ return '<video width="' + data.width + '" height="' + data.height + '"' + (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' + '<source src="' + data.source1 + '"' + (data.source1mime ? ' type="' + data.source1mime + '"' : '') + ' />\n' + (data.source2 ? '<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') + '</video>';
+ }
+ };
+ var getScriptHtml = function (data) {
+ return '<script src="' + data.source1 + '"></script>';
+ };
+ var dataToHtml = function (editor, dataIn) {
+ var data = global$2.extend({}, dataIn);
+ if (!data.source1) {
+ global$2.extend(data, $_g969ozgbjfuw8pom.htmlToData($_bmkzfegajfuw8pol.getScripts(editor), data.embed));
</ins><span class="cx" style="display: block; padding: 0 10px"> if (!data.source1) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Tools.extend(data, HtmlToData.htmlToData(editor.settings.media_scripts, data.embed));
- if (!data.source1) {
- return '';
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return '';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!data.source2) {
- data.source2 = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (!data.source2) {
+ data.source2 = '';
+ }
+ if (!data.poster) {
+ data.poster = '';
+ }
+ data.source1 = editor.convertURL(data.source1, 'source');
+ data.source2 = editor.convertURL(data.source2, 'source');
+ data.source1mime = $_dq3p76gjjfuw8poy.guess(data.source1);
+ data.source2mime = $_dq3p76gjjfuw8poy.guess(data.source2);
+ data.poster = editor.convertURL(data.poster, 'poster');
+ var pattern = matchPattern(data.source1);
+ if (pattern) {
+ data.source1 = pattern.url;
+ data.type = pattern.type;
+ data.allowFullscreen = pattern.allowFullscreen;
+ data.width = data.width || pattern.w;
+ data.height = data.height || pattern.h;
+ }
+ if (data.embed) {
+ return $_9oq1mlgkjfuw8pp0.updateHtml(data.embed, data, true);
+ } else {
+ var videoScript = $_9fg1sigejfuw8poq.getVideoScriptMatch($_bmkzfegajfuw8pol.getScripts(editor), data.source1);
+ if (videoScript) {
+ data.type = 'script';
+ data.width = videoScript.width;
+ data.height = videoScript.height;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!data.poster) {
- data.poster = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var audioTemplateCallback = $_bmkzfegajfuw8pol.getAudioTemplateCallback(editor);
+ var videoTemplateCallback = $_bmkzfegajfuw8pol.getVideoTemplateCallback(editor);
+ data.width = data.width || 300;
+ data.height = data.height || 150;
+ global$2.each(data, function (value, key) {
+ data[key] = editor.dom.encode(value);
+ });
+ if (data.type === 'iframe') {
+ return getIframeHtml(data);
+ } else if (data.source1mime === 'application/x-shockwave-flash') {
+ return getFlashHtml(data);
+ } else if (data.source1mime.indexOf('audio') !== -1) {
+ return getAudioHtml(data, audioTemplateCallback);
+ } else if (data.type === 'script') {
+ return getScriptHtml(data);
+ } else {
+ return getVideoHtml(data, videoTemplateCallback);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var $_ekbiypgijfuw8pov = { dataToHtml: dataToHtml };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- data.source1 = editor.convertURL(data.source1, "source");
- data.source2 = editor.convertURL(data.source2, "source");
- data.source1mime = Mime.guess(data.source1);
- data.source2mime = Mime.guess(data.source2);
- data.poster = editor.convertURL(data.poster, "poster");
-
- Tools.each(UrlPatterns.urlPatterns, function (pattern) {
- var i;
- var url;
-
- var match = pattern.regex.exec(data.source1);
-
- if (match) {
- url = pattern.url;
-
- for (i = 0; match[i]; i++) {
- /*jshint loopfunc:true*/
- /*eslint no-loop-func:0 */
- url = url.replace('$' + i, function () {
- return match[i];
- });
- }
-
- data.source1 = url;
- data.type = pattern.type;
- data.allowFullscreen = pattern.allowFullscreen;
- data.width = data.width || pattern.w;
- data.height = data.height || pattern.h;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var cache = {};
+ var embedPromise = function (data, dataToHtml, handler) {
+ return new global$5(function (res, rej) {
+ var wrappedResolve = function (response) {
+ if (response.html) {
+ cache[data.source1] = response;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return res({
+ url: data.source1,
+ html: response.html ? response.html : dataToHtml(data)
+ });
+ };
+ if (cache[data.source1]) {
+ wrappedResolve(cache[data.source1]);
+ } else {
+ handler({ url: data.source1 }, wrappedResolve, rej);
+ }
+ });
+ };
+ var defaultPromise = function (data, dataToHtml) {
+ return new global$5(function (res) {
+ res({
+ html: dataToHtml(data),
+ url: data.source1
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var loadedData = function (editor) {
+ return function (data) {
+ return $_ekbiypgijfuw8pov.dataToHtml(editor, data);
+ };
+ };
+ var getEmbedHtml = function (editor, data) {
+ var embedHandler = $_bmkzfegajfuw8pol.getUrlResolver(editor);
+ return embedHandler ? embedPromise(data, loadedData(editor), embedHandler) : defaultPromise(data, loadedData(editor));
+ };
+ var isCached = function (url) {
+ return cache.hasOwnProperty(url);
+ };
+ var $_6v4rhbggjfuw8pos = {
+ getEmbedHtml: getEmbedHtml,
+ isCached: isCached
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (data.embed) {
- html = UpdateHtml.updateHtml(data.embed, data, true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var doSyncSize = function (widthCtrl, heightCtrl) {
+ widthCtrl.state.set('oldVal', widthCtrl.value());
+ heightCtrl.state.set('oldVal', heightCtrl.value());
+ };
+ var doSizeControls = function (win, f) {
+ var widthCtrl = win.find('#width')[0];
+ var heightCtrl = win.find('#height')[0];
+ var constrained = win.find('#constrain')[0];
+ if (widthCtrl && heightCtrl && constrained) {
+ f(widthCtrl, heightCtrl, constrained.checked());
+ }
+ };
+ var doUpdateSize = function (widthCtrl, heightCtrl, isContrained) {
+ var oldWidth = widthCtrl.state.get('oldVal');
+ var oldHeight = heightCtrl.state.get('oldVal');
+ var newWidth = widthCtrl.value();
+ var newHeight = heightCtrl.value();
+ if (isContrained && oldWidth && oldHeight && newWidth && newHeight) {
+ if (newWidth !== oldWidth) {
+ newHeight = Math.round(newWidth / oldWidth * newHeight);
+ if (!isNaN(newHeight)) {
+ heightCtrl.value(newHeight);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var videoScript = VideoScript.getVideoScriptMatch(editor.settings.media_scripts, data.source1);
- if (videoScript) {
- data.type = 'script';
- data.width = videoScript.width;
- data.height = videoScript.height;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ newWidth = Math.round(newHeight / oldHeight * newWidth);
+ if (!isNaN(newWidth)) {
+ widthCtrl.value(newWidth);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- data.width = data.width || 300;
- data.height = data.height || 150;
-
- Tools.each(data, function (value, key) {
- data[key] = editor.dom.encode(value);
- });
-
- if (data.type === "iframe") {
- var allowFullscreen = data.allowFullscreen ? ' allowFullscreen="1"' : '';
- html +=
- '<iframe src="' + data.source1 +
- '" width="' + data.width +
- '" height="' + data.height +
- '"' + allowFullscreen + '></iframe>';
- } else if (data.source1mime === "application/x-shockwave-flash") {
- html +=
- '<object data="' + data.source1 +
- '" width="' + data.width +
- '" height="' + data.height +
- '" type="application/x-shockwave-flash">';
-
- if (data.poster) {
- html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
- }
-
- html += '</object>';
- } else if (data.source1mime.indexOf('audio') !== -1) {
- if (editor.settings.audio_template_callback) {
- html = editor.settings.audio_template_callback(data);
- } else {
- html += (
- '<audio controls="controls" src="' + data.source1 + '">' +
- (
- data.source2 ?
- '\n<source src="' + data.source2 + '"' +
- (data.source2mime ? ' type="' + data.source2mime + '"' : '') +
- ' />\n' : '') +
- '</audio>'
- );
- }
- } else if (data.type === "script") {
- html += '<script src="' + data.source1 + '"></script>';
- } else {
- if (editor.settings.video_template_callback) {
- html = editor.settings.video_template_callback(data);
- } else {
- html = (
- '<video width="' + data.width +
- '" height="' + data.height + '"' +
- (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' +
- '<source src="' + data.source1 + '"' +
- (data.source1mime ? ' type="' + data.source1mime + '"' : '') + ' />\n' +
- (data.source2 ? '<source src="' + data.source2 + '"' +
- (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
- '</video>'
- );
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ doSyncSize(widthCtrl, heightCtrl);
+ };
+ var syncSize = function (win) {
+ doSizeControls(win, doSyncSize);
+ };
+ var updateSize = function (win) {
+ doSizeControls(win, doUpdateSize);
+ };
+ var createUi = function (onChange) {
+ var recalcSize = function () {
+ onChange(function (win) {
+ updateSize(win);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- dataToHtml: dataToHtml
- };
- }
-);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Promise',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Promise');
- }
-);
-
-/**
- * Service.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.core.Service',
- [
- 'tinymce.plugins.media.core.DataToHtml',
- 'tinymce.core.util.Promise'
- ],
- function (DataToHtml, Promise) {
- var embedPromise = function (data, dataToHtml, handler) {
- var cache = {};
- return new Promise(function (res, rej) {
- var wrappedResolve = function (response) {
- if (response.html) {
- cache[data.source1] = response;
- }
- return res({
- url: data.source1,
- html: response.html ? response.html : dataToHtml(data)
- });
- };
- if (cache[data.source1]) {
- wrappedResolve(cache[data.source1]);
- } else {
- handler({ url: data.source1 }, wrappedResolve, rej);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type: 'container',
+ label: 'Dimensions',
+ layout: 'flex',
+ align: 'center',
+ spacing: 5,
+ items: [
+ {
+ name: 'width',
+ type: 'textbox',
+ maxLength: 5,
+ size: 5,
+ onchange: recalcSize,
+ ariaLabel: 'Width'
+ },
+ {
+ type: 'label',
+ text: 'x'
+ },
+ {
+ name: 'height',
+ type: 'textbox',
+ maxLength: 5,
+ size: 5,
+ onchange: recalcSize,
+ ariaLabel: 'Height'
+ },
+ {
+ name: 'constrain',
+ type: 'checkbox',
+ checked: true,
+ text: 'Constrain proportions'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ]
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_32c8argojfuw8ppe = {
+ createUi: createUi,
+ syncSize: syncSize,
+ updateSize: updateSize
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var defaultPromise = function (data, dataToHtml) {
- return new Promise(function (res) {
- res({ html: dataToHtml(data), url: data.source1 });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var embedChange = global$1.ie && global$1.ie <= 8 ? 'onChange' : 'onInput';
+ var handleError = function (editor) {
+ return function (error) {
+ var errorMessage = error && error.msg ? 'Media embed handler error: ' + error.msg : 'Media embed handler threw unknown error.';
+ editor.notificationManager.open({
+ type: 'error',
+ text: errorMessage
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var loadedData = function (editor) {
- return function (data) {
- return DataToHtml.dataToHtml(editor, data);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getData = function (editor) {
+ var element = editor.selection.getNode();
+ var dataEmbed = element.getAttribute('data-ephox-embed-iri');
+ if (dataEmbed) {
+ return {
+ 'source1': dataEmbed,
+ 'data-ephox-embed-iri': dataEmbed,
+ 'width': $_7rx1rygfjfuw8por.getMaxWidth(element),
+ 'height': $_7rx1rygfjfuw8por.getMaxHeight(element)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var getEmbedHtml = function (editor, data) {
- var embedHandler = editor.settings.media_url_resolver;
-
- return embedHandler ? embedPromise(data, loadedData(editor), embedHandler) : defaultPromise(data, loadedData(editor));
- };
-
- return {
- getEmbedHtml: getEmbedHtml
- };
- }
-);
-/**
- * SizeManager.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.ui.SizeManager',
- [
- ],
- function () {
- var doSyncSize = function (widthCtrl, heightCtrl) {
- widthCtrl.state.set('oldVal', widthCtrl.value());
- heightCtrl.state.set('oldVal', heightCtrl.value());
- };
- var doSizeControls = function (win, f) {
- var widthCtrl = win.find('#width')[0];
- var heightCtrl = win.find('#height')[0];
- var constrained = win.find('#constrain')[0];
- if (widthCtrl && heightCtrl && constrained) {
- f(widthCtrl, heightCtrl, constrained.checked());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return element.getAttribute('data-mce-object') ? $_g969ozgbjfuw8pom.htmlToData($_bmkzfegajfuw8pol.getScripts(editor), editor.serializer.serialize(element, { selection: true })) : {};
+ };
+ var getSource = function (editor) {
+ var elm = editor.selection.getNode();
+ if (elm.getAttribute('data-mce-object') || elm.getAttribute('data-ephox-embed-iri')) {
+ return editor.selection.getContent();
+ }
+ };
+ var addEmbedHtml = function (win, editor) {
+ return function (response) {
+ var html = response.html;
+ var embed = win.find('#embed')[0];
+ var data = global$2.extend($_g969ozgbjfuw8pom.htmlToData($_bmkzfegajfuw8pol.getScripts(editor), html), { source1: response.url });
+ win.fromJSON(data);
+ if (embed) {
+ embed.value(html);
+ $_32c8argojfuw8ppe.updateSize(win);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var doUpdateSize = function (widthCtrl, heightCtrl, isContrained) {
- var oldWidth = widthCtrl.state.get('oldVal');
- var oldHeight = heightCtrl.state.get('oldVal');
- var newWidth = widthCtrl.value();
- var newHeight = heightCtrl.value();
-
- if (isContrained && oldWidth && oldHeight && newWidth && newHeight) {
- if (newWidth !== oldWidth) {
- newHeight = Math.round((newWidth / oldWidth) * newHeight);
-
- if (!isNaN(newHeight)) {
- heightCtrl.value(newHeight);
- }
- } else {
- newWidth = Math.round((newHeight / oldHeight) * newWidth);
-
- if (!isNaN(newWidth)) {
- widthCtrl.value(newWidth);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var selectPlaceholder = function (editor, beforeObjects) {
+ var i;
+ var y;
+ var afterObjects = editor.dom.select('img[data-mce-object]');
+ for (i = 0; i < beforeObjects.length; i++) {
+ for (y = afterObjects.length - 1; y >= 0; y--) {
+ if (beforeObjects[i] === afterObjects[y]) {
+ afterObjects.splice(y, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- doSyncSize(widthCtrl, heightCtrl);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ editor.selection.select(afterObjects[0]);
+ };
+ var handleInsert = function (editor, html) {
+ var beforeObjects = editor.dom.select('img[data-mce-object]');
+ editor.insertContent(html);
+ selectPlaceholder(editor, beforeObjects);
+ editor.nodeChanged();
+ };
+ var submitForm = function (win, editor) {
+ var data = win.toJSON();
+ data.embed = $_9oq1mlgkjfuw8pp0.updateHtml(data.embed, data);
+ if (data.embed && $_6v4rhbggjfuw8pos.isCached(data.source1)) {
+ handleInsert(editor, data.embed);
+ } else {
+ $_6v4rhbggjfuw8pos.getEmbedHtml(editor, data).then(function (response) {
+ handleInsert(editor, response.html);
+ }).catch(handleError(editor));
+ }
+ };
+ var populateMeta = function (win, meta) {
+ global$2.each(meta, function (value, key) {
+ win.find('#' + key).value(value);
+ });
+ };
+ var showDialog = function (editor) {
+ var win;
+ var data;
+ var generalFormItems = [{
+ name: 'source1',
+ type: 'filepicker',
+ filetype: 'media',
+ size: 40,
+ autofocus: true,
+ label: 'Source',
+ onpaste: function () {
+ setTimeout(function () {
+ $_6v4rhbggjfuw8pos.getEmbedHtml(editor, win.toJSON()).then(addEmbedHtml(win, editor)).catch(handleError(editor));
+ }, 1);
+ },
+ onchange: function (e) {
+ $_6v4rhbggjfuw8pos.getEmbedHtml(editor, win.toJSON()).then(addEmbedHtml(win, editor)).catch(handleError(editor));
+ populateMeta(win, e.meta);
+ },
+ onbeforecall: function (e) {
+ e.meta = win.toJSON();
+ }
+ }];
+ var advancedFormItems = [];
+ var reserialise = function (update) {
+ update(win);
+ data = win.toJSON();
+ win.find('#embed').value($_9oq1mlgkjfuw8pp0.updateHtml(data.embed, data));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var syncSize = function (win) {
- doSizeControls(win, doSyncSize);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_bmkzfegajfuw8pol.hasAltSource(editor)) {
+ advancedFormItems.push({
+ name: 'source2',
+ type: 'filepicker',
+ filetype: 'media',
+ size: 40,
+ label: 'Alternative source'
+ });
+ }
+ if ($_bmkzfegajfuw8pol.hasPoster(editor)) {
+ advancedFormItems.push({
+ name: 'poster',
+ type: 'filepicker',
+ filetype: 'image',
+ size: 40,
+ label: 'Poster'
+ });
+ }
+ if ($_bmkzfegajfuw8pol.hasDimensions(editor)) {
+ var control = $_32c8argojfuw8ppe.createUi(reserialise);
+ generalFormItems.push(control);
+ }
+ data = getData(editor);
+ var embedTextBox = {
+ id: 'mcemediasource',
+ type: 'textbox',
+ flex: 1,
+ name: 'embed',
+ value: getSource(editor),
+ multiline: true,
+ rows: 5,
+ label: 'Source'
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var updateSize = function (win) {
- doSizeControls(win, doUpdateSize);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var updateValueOnChange = function () {
+ data = global$2.extend({}, $_g969ozgbjfuw8pom.htmlToData($_bmkzfegajfuw8pol.getScripts(editor), this.value()));
+ this.parent().parent().fromJSON(data);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var createUi = function (onChange) {
- var recalcSize = function () {
- onChange(function (win) {
- updateSize(win);
- });
- };
-
- return {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ embedTextBox[embedChange] = updateValueOnChange;
+ var body = [
+ {
+ title: 'General',
+ type: 'form',
+ items: generalFormItems
+ },
+ {
+ title: 'Embed',
</ins><span class="cx" style="display: block; padding: 0 10px"> type: 'container',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- label: 'Dimensions',
</del><span class="cx" style="display: block; padding: 0 10px"> layout: 'flex',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- align: 'center',
- spacing: 5,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ direction: 'column',
+ align: 'stretch',
+ padding: 10,
+ spacing: 10,
</ins><span class="cx" style="display: block; padding: 0 10px"> items: [
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- name: 'width', type: 'textbox', maxLength: 5, size: 5,
- onchange: recalcSize, ariaLabel: 'Width'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type: 'label',
+ text: 'Paste your embed code below:',
+ forId: 'mcemediasource'
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- { type: 'label', text: 'x' },
- {
- name: 'height', type: 'textbox', maxLength: 5, size: 5,
- onchange: recalcSize, ariaLabel: 'Height'
- },
- { name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions' }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ embedTextBox
</ins><span class="cx" style="display: block; padding: 0 10px"> ]
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- };
-
- return {
- createUi: createUi,
- syncSize: syncSize,
- updateSize: updateSize
- };
- }
-);
-/**
- * Dialog.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.ui.Dialog',
- [
- 'tinymce.core.util.Delay',
- 'tinymce.plugins.media.core.HtmlToData',
- 'tinymce.plugins.media.core.UpdateHtml',
- 'tinymce.plugins.media.core.Service',
- 'tinymce.plugins.media.core.Size',
- 'tinymce.core.util.Tools',
- 'tinymce.core.Env',
- 'tinymce.plugins.media.ui.SizeManager'
- ],
- function (Delay, HtmlToData, UpdateHtml, Service, Size, Tools, Env, SizeManager) {
- var embedChange = (Env.ie && Env.ie <= 8) ? 'onChange' : 'onInput';
-
- var handleError = function (editor) {
- return function (error) {
- var errorMessage = error && error.msg ?
- 'Media embed handler error: ' + error.msg :
- 'Media embed handler threw unknown error.';
- editor.notificationManager.open({ type: 'error', text: errorMessage });
- };
- };
-
- var getData = function (editor) {
- var element = editor.selection.getNode();
- var dataEmbed = element.getAttribute('data-ephox-embed-iri');
-
- if (dataEmbed) {
- return {
- source1: dataEmbed,
- 'data-ephox-embed-iri': dataEmbed,
- width: Size.getMaxWidth(element),
- height: Size.getMaxHeight(element)
- };
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ];
+ if (advancedFormItems.length > 0) {
+ body.push({
+ title: 'Advanced',
+ type: 'form',
+ items: advancedFormItems
+ });
+ }
+ win = editor.windowManager.open({
+ title: 'Insert/edit media',
+ data: data,
+ bodyType: 'tabpanel',
+ body: body,
+ onSubmit: function () {
+ $_32c8argojfuw8ppe.updateSize(win);
+ submitForm(win, editor);
+ }
+ });
+ $_32c8argojfuw8ppe.syncSize(win);
+ };
+ var $_92htb0g7jfuw8pog = { showDialog: showDialog };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return element.getAttribute('data-mce-object') ?
- HtmlToData.htmlToData(editor.settings.media_scripts, editor.serializer.serialize(element, { selection: true })) :
- {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get = function (editor) {
+ var showDialog = function () {
+ $_92htb0g7jfuw8pog.showDialog(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return { showDialog: showDialog };
+ };
+ var $_4zi4sfg6jfuw8poe = { get: get };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getSource = function (editor) {
- var elm = editor.selection.getNode();
-
- if (elm.getAttribute('data-mce-object') || elm.getAttribute('data-ephox-embed-iri')) {
- return editor.selection.getContent();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor) {
+ var showDialog = function () {
+ $_92htb0g7jfuw8pog.showDialog(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.addCommand('mceMedia', showDialog);
+ };
+ var $_1si9ufgpjfuw8ppg = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var addEmbedHtml = function (win, editor) {
- return function (response) {
- var html = response.html;
- var embed = win.find('#embed')[0];
- var data = Tools.extend(HtmlToData.htmlToData(editor.settings.media_scripts, html), { source1: response.url });
- win.fromJSON(data);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$8 = tinymce.util.Tools.resolve('tinymce.html.Node');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (embed) {
- embed.value(html);
- SizeManager.updateSize(win);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var sanitize = function (editor, html) {
+ if ($_bmkzfegajfuw8pol.shouldFilterHtml(editor) === false) {
+ return html;
+ }
+ var writer = global$6();
+ var blocked;
+ global$3({
+ validate: false,
+ allow_conditional_comments: false,
+ special: 'script,noscript',
+ comment: function (text) {
+ writer.comment(text);
+ },
+ cdata: function (text) {
+ writer.cdata(text);
+ },
+ text: function (text, raw) {
+ writer.text(text, raw);
+ },
+ start: function (name, attrs, empty) {
+ blocked = true;
+ if (name === 'script' || name === 'noscript') {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- };
-
- var selectPlaceholder = function (editor, beforeObjects) {
- var i;
- var y;
- var afterObjects = editor.dom.select('img[data-mce-object]');
-
- // Find new image placeholder so we can select it
- for (i = 0; i < beforeObjects.length; i++) {
- for (y = afterObjects.length - 1; y >= 0; y--) {
- if (beforeObjects[i] === afterObjects[y]) {
- afterObjects.splice(y, 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (var i = 0; i < attrs.length; i++) {
+ if (attrs[i].name.indexOf('on') === 0) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (attrs[i].name === 'style') {
+ attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ writer.start(name, attrs, empty);
+ blocked = false;
+ },
+ end: function (name) {
+ if (blocked) {
+ return;
+ }
+ writer.end(name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, global$7({})).parse(html);
+ return writer.getContent();
+ };
+ var $_77d5ybgtjfuw8ppp = { sanitize: sanitize };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.selection.select(afterObjects[0]);
- };
-
- var handleInsert = function (editor, html) {
- var beforeObjects = editor.dom.select('img[data-mce-object]');
-
- editor.insertContent(html);
- selectPlaceholder(editor, beforeObjects);
- editor.nodeChanged();
- };
-
- var submitForm = function (win, editor) {
- var data = win.toJSON();
-
- data.embed = UpdateHtml.updateHtml(data.embed, data);
-
- if (data.embed) {
- handleInsert(editor, data.embed);
- } else {
- Service.getEmbedHtml(editor, data)
- .then(function (response) {
- handleInsert(editor, response.html);
- })["catch"](handleError(editor));
- }
- };
-
- var populateMeta = function (win, meta) {
- Tools.each(meta, function (value, key) {
- win.find('#' + key).value(value);
- });
- };
-
- var showDialog = function (editor) {
- var win;
- var data;
-
- var generalFormItems = [
- {
- name: 'source1',
- type: 'filepicker',
- filetype: 'media',
- size: 40,
- autofocus: true,
- label: 'Source',
- onpaste: function () {
- setTimeout(function () {
- Service.getEmbedHtml(editor, win.toJSON())
- .then(
- addEmbedHtml(win, editor)
- )["catch"](handleError(editor));
- }, 1);
- },
- onchange: function (e) {
- Service.getEmbedHtml(editor, win.toJSON())
- .then(
- addEmbedHtml(win, editor)
- )["catch"](handleError(editor));
-
- populateMeta(win, e.meta);
- },
- onbeforecall: function (e) {
- e.meta = win.toJSON();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createPlaceholderNode = function (editor, node) {
+ var placeHolder;
+ var name = node.name;
+ placeHolder = new global$8('img', 1);
+ placeHolder.shortEnded = true;
+ retainAttributesAndInnerHtml(editor, node, placeHolder);
+ placeHolder.attr({
+ 'width': node.attr('width') || '300',
+ 'height': node.attr('height') || (name === 'audio' ? '30' : '150'),
+ 'style': node.attr('style'),
+ 'src': global$1.transparentSrc,
+ 'data-mce-object': name,
+ 'class': 'mce-object mce-object-' + name
+ });
+ return placeHolder;
+ };
+ var createPreviewIframeNode = function (editor, node) {
+ var previewWrapper;
+ var previewNode;
+ var shimNode;
+ var name = node.name;
+ previewWrapper = new global$8('span', 1);
+ previewWrapper.attr({
+ 'contentEditable': 'false',
+ 'style': node.attr('style'),
+ 'data-mce-object': name,
+ 'class': 'mce-preview-object mce-object-' + name
+ });
+ retainAttributesAndInnerHtml(editor, node, previewWrapper);
+ previewNode = new global$8(name, 1);
+ previewNode.attr({
+ src: node.attr('src'),
+ allowfullscreen: node.attr('allowfullscreen'),
+ style: node.attr('style'),
+ class: node.attr('class'),
+ width: node.attr('width'),
+ height: node.attr('height'),
+ frameborder: '0'
+ });
+ shimNode = new global$8('span', 1);
+ shimNode.attr('class', 'mce-shim');
+ previewWrapper.append(previewNode);
+ previewWrapper.append(shimNode);
+ return previewWrapper;
+ };
+ var retainAttributesAndInnerHtml = function (editor, sourceNode, targetNode) {
+ var attrName;
+ var attrValue;
+ var attribs;
+ var ai;
+ var innerHtml;
+ attribs = sourceNode.attributes;
+ ai = attribs.length;
+ while (ai--) {
+ attrName = attribs[ai].name;
+ attrValue = attribs[ai].value;
+ if (attrName !== 'width' && attrName !== 'height' && attrName !== 'style') {
+ if (attrName === 'data' || attrName === 'src') {
+ attrValue = editor.convertURL(attrValue, attrName);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
-
- var advancedFormItems = [];
-
- var reserialise = function (update) {
- update(win);
- data = win.toJSON();
- win.find('#embed').value(UpdateHtml.updateHtml(data.embed, data));
- };
-
- if (editor.settings.media_alt_source !== false) {
- advancedFormItems.push({ name: 'source2', type: 'filepicker', filetype: 'media', size: 40, label: 'Alternative source' });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ targetNode.attr('data-mce-p-' + attrName, attrValue);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (editor.settings.media_poster !== false) {
- advancedFormItems.push({ name: 'poster', type: 'filepicker', filetype: 'image', size: 40, label: 'Poster' });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ innerHtml = sourceNode.firstChild && sourceNode.firstChild.value;
+ if (innerHtml) {
+ targetNode.attr('data-mce-html', escape($_77d5ybgtjfuw8ppp.sanitize(editor, innerHtml)));
+ targetNode.firstChild = null;
+ }
+ };
+ var isWithinEphoxEmbed = function (node) {
+ while (node = node.parent) {
+ if (node.attr('data-ephox-embed-iri')) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (editor.settings.media_dimensions !== false) {
- var control = SizeManager.createUi(reserialise);
- generalFormItems.push(control);
- }
-
- data = getData(editor);
-
- var embedTextBox = {
- id: 'mcemediasource',
- type: 'textbox',
- flex: 1,
- name: 'embed',
- value: getSource(editor),
- multiline: true,
- rows: 5,
- label: 'Source'
- };
-
- var updateValueOnChange = function () {
- data = Tools.extend({}, HtmlToData.htmlToData(editor.settings.media_scripts, this.value()));
- this.parent().parent().fromJSON(data);
- };
-
- embedTextBox[embedChange] = updateValueOnChange;
-
- win = editor.windowManager.open({
- title: 'Insert/edit media',
- data: data,
- bodyType: 'tabpanel',
- body: [
- {
- title: 'General',
- type: "form",
- items: generalFormItems
- },
-
- {
- title: 'Embed',
- type: "container",
- layout: 'flex',
- direction: 'column',
- align: 'stretch',
- padding: 10,
- spacing: 10,
- items: [
- {
- type: 'label',
- text: 'Paste your embed code below:',
- forId: 'mcemediasource'
- },
- embedTextBox
- ]
- },
-
- {
- title: 'Advanced',
- type: "form",
- items: advancedFormItems
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return false;
+ };
+ var placeHolderConverter = function (editor) {
+ return function (nodes) {
+ var i = nodes.length;
+ var node;
+ var videoScript;
+ while (i--) {
+ node = nodes[i];
+ if (!node.parent) {
+ continue;
+ }
+ if (node.parent.attr('data-mce-object')) {
+ continue;
+ }
+ if (node.name === 'script') {
+ videoScript = $_9fg1sigejfuw8poq.getVideoScriptMatch($_bmkzfegajfuw8pol.getScripts(editor), node.attr('src'));
+ if (!videoScript) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ],
- onSubmit: function () {
- SizeManager.updateSize(win);
- submitForm(win, editor);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- SizeManager.syncSize(win);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (videoScript) {
+ if (videoScript.width) {
+ node.attr('width', videoScript.width.toString());
+ }
+ if (videoScript.height) {
+ node.attr('height', videoScript.height.toString());
+ }
+ }
+ if (node.name === 'iframe' && $_bmkzfegajfuw8pol.hasLiveEmbeds(editor) && global$1.ceFalse) {
+ if (!isWithinEphoxEmbed(node)) {
+ node.replace(createPreviewIframeNode(editor, node));
+ }
+ } else {
+ if (!isWithinEphoxEmbed(node)) {
+ node.replace(createPlaceholderNode(editor, node));
+ }
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_bp9pftgsjfuw8ppl = {
+ createPreviewIframeNode: createPreviewIframeNode,
+ createPlaceholderNode: createPlaceholderNode,
+ placeHolderConverter: placeHolderConverter
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- showDialog: showDialog
- };
- }
-);
-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.media.Plugin',
- [
- 'tinymce.core.html.Node',
- 'tinymce.core.PluginManager',
- 'tinymce.core.util.Tools',
- 'tinymce.plugins.media.core.Nodes',
- 'tinymce.plugins.media.core.Sanitize',
- 'tinymce.plugins.media.core.UpdateHtml',
- 'tinymce.plugins.media.ui.Dialog'
- ],
- function (Node, PluginManager, Tools, Nodes, Sanitize, UpdateHtml, Dialog) {
- var Plugin = function (editor) {
- editor.on('ResolveName', function (e) {
- var name;
-
- if (e.target.nodeType === 1 && (name = e.target.getAttribute("data-mce-object"))) {
- e.name = name;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setup = function (editor) {
+ editor.on('preInit', function () {
+ var specialElements = editor.schema.getSpecialElements();
+ global$2.each('video audio iframe object'.split(' '), function (name) {
+ specialElements[name] = new RegExp('</' + name + '[^>]*>', 'gi');
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.on('preInit', function () {
- // Make sure that any messy HTML is retained inside these
- var specialElements = editor.schema.getSpecialElements();
- Tools.each('video audio iframe object'.split(' '), function (name) {
- specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi');
- });
-
- // Allow elements
- //editor.schema.addValidElements(
- // 'object[id|style|width|height|classid|codebase|*],embed[id|style|width|height|type|src|*],video[*],audio[*]'
- //);
-
- // Set allowFullscreen attribs as boolean
- var boolAttrs = editor.schema.getBoolAttrs();
- Tools.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function (name) {
- boolAttrs[name] = {};
- });
-
- // Converts iframe, video etc into placeholder images
- editor.parser.addNodeFilter('iframe,video,audio,object,embed,script',
- Nodes.placeHolderConverter(editor));
-
- // Replaces placeholder images with real elements for video, object, iframe etc
- editor.serializer.addAttributeFilter('data-mce-object', function (nodes, name) {
- var i = nodes.length;
- var node;
- var realElm;
- var ai;
- var attribs;
- var innerHtml;
- var innerNode;
- var realElmName;
- var className;
-
- while (i--) {
- node = nodes[i];
- if (!node.parent) {
- continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var boolAttrs = editor.schema.getBoolAttrs();
+ global$2.each('webkitallowfullscreen mozallowfullscreen allowfullscreen'.split(' '), function (name) {
+ boolAttrs[name] = {};
+ });
+ editor.parser.addNodeFilter('iframe,video,audio,object,embed,script', $_bp9pftgsjfuw8ppl.placeHolderConverter(editor));
+ editor.serializer.addAttributeFilter('data-mce-object', function (nodes, name) {
+ var i = nodes.length;
+ var node;
+ var realElm;
+ var ai;
+ var attribs;
+ var innerHtml;
+ var innerNode;
+ var realElmName;
+ var className;
+ while (i--) {
+ node = nodes[i];
+ if (!node.parent) {
+ continue;
+ }
+ realElmName = node.attr(name);
+ realElm = new global$8(realElmName, 1);
+ if (realElmName !== 'audio' && realElmName !== 'script') {
+ className = node.attr('class');
+ if (className && className.indexOf('mce-preview-object') !== -1) {
+ realElm.attr({
+ width: node.firstChild.attr('width'),
+ height: node.firstChild.attr('height')
+ });
+ } else {
+ realElm.attr({
+ width: node.attr('width'),
+ height: node.attr('height')
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- realElmName = node.attr(name);
- realElm = new Node(realElmName, 1);
-
- // Add width/height to everything but audio
- if (realElmName !== "audio" && realElmName !== "script") {
- className = node.attr('class');
- if (className && className.indexOf('mce-preview-object') !== -1) {
- realElm.attr({
- width: node.firstChild.attr('width'),
- height: node.firstChild.attr('height')
- });
- } else {
- realElm.attr({
- width: node.attr('width'),
- height: node.attr('height')
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ realElm.attr({ style: node.attr('style') });
+ attribs = node.attributes;
+ ai = attribs.length;
+ while (ai--) {
+ var attrName = attribs[ai].name;
+ if (attrName.indexOf('data-mce-p-') === 0) {
+ realElm.attr(attrName.substr(11), attribs[ai].value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- realElm.attr({
- style: node.attr('style')
- });
-
- // Unprefix all placeholder attributes
- attribs = node.attributes;
- ai = attribs.length;
- while (ai--) {
- var attrName = attribs[ai].name;
-
- if (attrName.indexOf('data-mce-p-') === 0) {
- realElm.attr(attrName.substr(11), attribs[ai].value);
- }
- }
-
- if (realElmName === "script") {
- realElm.attr('type', 'text/javascript');
- }
-
- // Inject innerhtml
- innerHtml = node.attr('data-mce-html');
- if (innerHtml) {
- innerNode = new Node('#text', 3);
- innerNode.raw = true;
- innerNode.value = Sanitize.sanitize(editor, unescape(innerHtml));
- realElm.append(innerNode);
- }
-
- node.replace(realElm);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- });
-
- editor.on('click keyup', function () {
- var selectedNode = editor.selection.getNode();
-
- if (selectedNode && editor.dom.hasClass(selectedNode, 'mce-preview-object')) {
- if (editor.dom.getAttrib(selectedNode, 'data-mce-selected')) {
- selectedNode.setAttribute('data-mce-selected', '2');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (realElmName === 'script') {
+ realElm.attr('type', 'text/javascript');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ innerHtml = node.attr('data-mce-html');
+ if (innerHtml) {
+ innerNode = new global$8('#text', 3);
+ innerNode.raw = true;
+ innerNode.value = $_77d5ybgtjfuw8ppp.sanitize(editor, unescape(innerHtml));
+ realElm.append(innerNode);
+ }
+ node.replace(realElm);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.on('ObjectSelected', function (e) {
- var objectType = e.target.getAttribute('data-mce-object');
-
- if (objectType === "audio" || objectType === "script") {
- e.preventDefault();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('setContent', function () {
+ editor.$('span.mce-preview-object').each(function (index, elm) {
+ var $elm = editor.$(elm);
+ if ($elm.find('span.mce-shim', elm).length === 0) {
+ $elm.append('<span class="mce-shim"></span>');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var $_7xjmklgqjfuw8pph = { setup: setup };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('objectResized', function (e) {
- var target = e.target;
- var html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setup$1 = function (editor) {
+ editor.on('ResolveName', function (e) {
+ var name;
+ if (e.target.nodeType === 1 && (name = e.target.getAttribute('data-mce-object'))) {
+ e.name = name;
+ }
+ });
+ };
+ var $_8fr4logujfuw8ppr = { setup: setup$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (target.getAttribute('data-mce-object')) {
- html = target.getAttribute('data-mce-html');
- if (html) {
- html = unescape(html);
- target.setAttribute('data-mce-html', escape(
- UpdateHtml.updateHtml(html, {
- width: e.width,
- height: e.height
- })
- ));
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setup$2 = function (editor) {
+ editor.on('click keyup', function () {
+ var selectedNode = editor.selection.getNode();
+ if (selectedNode && editor.dom.hasClass(selectedNode, 'mce-preview-object')) {
+ if (editor.dom.getAttrib(selectedNode, 'data-mce-selected')) {
+ selectedNode.setAttribute('data-mce-selected', '2');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ editor.on('ObjectSelected', function (e) {
+ var objectType = e.target.getAttribute('data-mce-object');
+ if (objectType === 'audio' || objectType === 'script') {
+ e.preventDefault();
+ }
+ });
+ editor.on('objectResized', function (e) {
+ var target = e.target;
+ var html;
+ if (target.getAttribute('data-mce-object')) {
+ html = target.getAttribute('data-mce-html');
+ if (html) {
+ html = unescape(html);
+ target.setAttribute('data-mce-html', escape($_9oq1mlgkjfuw8pp0.updateHtml(html, {
+ width: e.width,
+ height: e.height
+ })));
+ }
+ }
+ });
+ };
+ var $_b7skwpgvjfuw8pps = { setup: setup$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- this.showDialog = function () {
- Dialog.showDialog(editor);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register$1 = function (editor) {
+ editor.addButton('media', {
+ tooltip: 'Insert/edit media',
+ cmd: 'mceMedia',
+ stateSelector: [
+ 'img[data-mce-object]',
+ 'span[data-mce-object]',
+ 'div[data-ephox-embed-iri]'
+ ]
+ });
+ editor.addMenuItem('media', {
+ icon: 'media',
+ text: 'Media',
+ cmd: 'mceMedia',
+ context: 'insert',
+ prependToContext: true
+ });
+ };
+ var $_7zyd29gwjfuw8ppt = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addButton('media', {
- tooltip: 'Insert/edit media',
- onclick: this.showDialog,
- stateSelector: ['img[data-mce-object]', 'span[data-mce-object]', 'div[data-ephox-embed-iri]']
- });
-
- editor.addMenuItem('media', {
- icon: 'media',
- text: 'Media',
- onclick: this.showDialog,
- context: 'insert',
- prependToContext: true
- });
-
- editor.on('setContent', function () {
- // TODO: This shouldn't be needed there should be a way to mark bogus
- // elements so they are never removed except external save
- editor.$('span.mce-preview-object').each(function (index, elm) {
- var $elm = editor.$(elm);
-
- if ($elm.find('span.mce-shim', elm).length === 0) {
- $elm.append('<span class="mce-shim"></span>');
- }
- });
- });
-
- editor.addCommand('mceMedia', this.showDialog);
- };
-
- PluginManager.add('media', Plugin);
-
- return function () { };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('media', function (editor) {
+ $_1si9ufgpjfuw8ppg.register(editor);
+ $_7zyd29gwjfuw8ppt.register(editor);
+ $_8fr4logujfuw8ppr.setup(editor);
+ $_7xjmklgqjfuw8pph.setup(editor);
+ $_b7skwpgvjfuw8pps.setup(editor);
+ return $_4zi4sfg6jfuw8poe.get(editor);
+ });
+ function Plugin () {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-dem('tinymce.plugins.media.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginsmediapluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/media/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/media/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/media/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("8",tinymce.util.Tools.resolve),g("1",[&q
uot;8"],function(a){return a("tinymce.html.Node")}),g("2",["8"],function(a){return a("tinymce.PluginManager")}),g("3",["8"],function(a){return a("tinymce.util.Tools")}),g("9",["8"],function(a){return a("tinymce.html.Writer")}),g("a",["8"],function(a){return a("tinymce.html.SaxParser")}),g("b",["8"],function(a){return a("tinymce.html.Schema")}),g("5",["3","9","a","b"],function(a,b,c,d){var e=function(a,e){if(a.settings.media_filter_html===!1)return e;var f,g=new b;return new c({validate:!1,allow_conditional_comments:!1,special:"script,noscript",comment:function(a){g.comment(a)},cdata:function(a){g.cdata(a)},text:function(a,b){g.text(a,b)},start:function(b,c,d){if(f=!0,"script"!==b&&"noscript"!==b){for(var e=0;e<c.length;e++){if(0===
c[e].name.indexOf("on"))return;"style"===c[e].name&&(c[e].value=a.dom.serializeStyle(a.dom.parseStyle(c[e].value),b))}g.start(b,c,d),f=!1}},end:function(a){f||g.end(a)}},new d({})).parse(e),g.getContent()};return{sanitize:e}}),g("c",[],function(){var a=function(a,b){if(a)for(var c=0;c<a.length;c++)if(b.indexOf(a[c].filter)!==-1)return a[c]};return{getVideoScriptMatch:a}}),g("d",["8"],function(a){return a("tinymce.Env")}),g("4",["5","c","1","d"],function(a,b,c,d){var e=function(a,b){var e,f=b.name;return e=new c("img",1),e.shortEnded=!0,g(a,b,e),e.attr({width:b.attr("width")||"300",height:b.attr("height")||("audio"===f?"30":"150"),style:b.attr("style"),src:d.transparentSrc,"data-mce-object":f,"class":"mce-object mce-object-"+f}),e},f=function(a,b){var d,e,f
,h=b.name;return d=new c("span",1),d.attr({contentEditable:"false",style:b.attr("style"),"data-mce-object":h,"class":"mce-preview-object mce-object-"+h}),g(a,b,d),e=new c(h,1),e.attr({src:b.attr("src"),allowfullscreen:b.attr("allowfullscreen"),width:b.attr("width")||"300",height:b.attr("height")||("audio"===h?"30":"150"),frameborder:"0"}),f=new c("span",1),f.attr("class","mce-shim"),d.append(e),d.append(f),d},g=function(b,c,d){var e,f,g,h,i;for(g=c.attributes,h=g.length;h--;)e=g[h].name,f=g[h].value,"width"!==e&&"height"!==e&&"style"!==e&&("data"!==e&&"src"!==e||(f=b.convertURL(f,e)),d.attr("data-mce-p-"+e,f));i=c.firstChild&&c.firstChild.value,i&&(d.attr("data-mce-html",escape(a.sanitize(b
,i))),d.firstChild=null)},h=function(a){for(;a=a.parent;)if(a.attr("data-ephox-embed-iri"))return!0;return!1},i=function(a){return function(c){for(var g,i,j=c.length;j--;)g=c[j],g.parent&&(g.parent.attr("data-mce-object")||("script"!==g.name||(i=b.getVideoScriptMatch(a.settings.media_scripts,g.attr("src"))))&&(i&&(i.width&&g.attr("width",i.width.toString()),i.height&&g.attr("height",i.height.toString())),"iframe"===g.name&&a.settings.media_live_embeds!==!1&&d.ceFalse?h(g)||g.replace(f(a,g)):h(g)||g.replace(e(a,g))))}};return{createPreviewIframeNode:f,createPlaceholderNode:e,placeHolderConverter:i}}),g("e",["8"],function(a){return a("tinymce.dom.DOMUtils")}),g("f",[],function(){var a=function(a){return a.replace(/px$/,"")},b=function(a){return/^[0-9.]+$/.test(a)?a+"px":a},c=function(b){return function
(c){return c?a(c.style[b]):""}},d=function(a){return function(c,d){c&&(c.style[a]=b(d))}};return{getMaxWidth:c("maxWidth"),getMaxHeight:c("maxHeight"),setMaxWidth:d("maxWidth"),setMaxHeight:d("maxHeight")}}),g("6",["9","a","b","e","f"],function(a,b,c,d,e){var f=d.DOM,g=function(a,b){var c,d,e,f;for(c in b)if(e=""+b[c],a.map[c])for(d=a.length;d--;)f=a[d],f.name===c&&(e?(a.map[c]=e,f.value=e):(delete a.map[c],a.splice(d,1)));else e&&(a.push({name:c,value:e}),a.map[c]=e)},h=function(c){var d=new a,e=new b(d);return e.parse(c),d.getContent()},i=function(d,e,f){var h,i=new a,j=0;return new b({validate:!1,allow_conditional_comments:!0,special:"script,noscript",comment:function(a){i.comment(a)},cdata:function(a){i.cdata(a)},text:function(a,b){i.text(a,b)},start:function(a,b,c){switch(a){case"video":case"object":case&qu
ot;embed":case"img":case"iframe":void 0!==e.height&&void 0!==e.width&&g(b,{width:e.width,height:e.height})}if(f)switch(a){case"video":g(b,{poster:e.poster,src:""}),e.source2&&g(b,{src:""});break;case"iframe":g(b,{src:e.source1});break;case"source":if(j++,j<=2&&(g(b,{src:e["source"+j],type:e["source"+j+"mime"]}),!e["source"+j]))return;break;case"img":if(!e.poster)return;h=!0}i.start(a,b,c)},end:function(a){if("video"===a&&f)for(var b=1;b<=2;b++)if(e["source"+b]){var c=[];c.map={},j<b&&(g(c,{src:e["source"+b],type:e["source"+b+"mime"]}),i.start("source",c,!0))}if(e.poster&&"object"===a&&f&&!h){var d=[];d.map={},g(d,{src:e.poster,width:e.width,height:e.height}),i.start("img",d,!0)}i.end(a)}},new c({})).pa
rse(d),i.getContent()},j=function(a){var b=f.createFragment(a);return""!==f.getAttrib(b.firstChild,"data-ephox-embed-iri")},k=function(a,b){var c=f.createFragment(a),d=c.firstChild;return e.setMaxWidth(d,b.width),e.setMaxHeight(d,b.height),h(d.outerHTML)},l=function(a,b,c){return j(a)?k(a,b):i(a,b,c)};return{updateHtml:l}}),g("g",["8"],function(a){return a("tinymce.util.Delay")}),g("h",["3","a","b","e","c","f"],function(a,b,c,d,e,f){var g=d.DOM,h=function(a){return g.getAttrib(a,"data-ephox-embed-iri")},i=function(a){var b=g.createFragment(a);return""!==h(b.firstChild)},j=function(c,d){var f={};return new b({validate:!1,allow_conditional_comments:!0,special:"script,noscript",start:function(b,d){if(f.source1||"param"!==b||(f.source1=d.map.movie),"iframe"!==b&&"object"!==b&&"embed"!
==b&&"video"!==b&&"audio"!==b||(f.type||(f.type=b),f=a.extend(d.map,f)),"script"===b){var g=e.getVideoScriptMatch(c,d.map.src);if(!g)return;f={type:"script",source1:d.map.src,width:g.width,height:g.height}}"source"===b&&(f.source1?f.source2||(f.source2=d.map.src):f.source1=d.map.src),"img"!==b||f.poster||(f.poster=d.map.src)}}).parse(d),f.source1=f.source1||f.src||f.data,f.source2=f.source2||"",f.poster=f.poster||"",f},k=function(a){var b=g.createFragment(a),c=b.firstChild;return{type:"ephox-embed-iri",source1:h(c),source2:"",poster:"",width:f.getMaxWidth(c),height:f.getMaxHeight(c)}},l=function(a,b){return i(b)?k(b):j(a,b)};return{htmlToData:l}}),g("m",[],function(){var a=function(a){var b={mp3:"audio/mpeg",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"applicati
on/x-shockwave-flash"},c=a.toLowerCase().split(".").pop(),d=b[c];return d?d:""};return{guess:a}}),g("n",[],function(){var a=[{regex:/youtu\.be\/([\w\-.]+)/,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)/,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$2",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\-_]+(?:\?.+)?)/i,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowfullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$2?title=0&byline=0",allowfullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"ifra
me",w:425,h:350,url:'//maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480,h:270,url:"//www.dailymotion.com/embed/video/$1",allowFullscreen:!0}];return{urlPatterns:a}}),g("k",["m","h","n","c","6","3"],function(a,b,c,d,e,f){var g=function(g,h){var i="",j=f.extend({},h);if(!j.source1&&(f.extend(j,b.htmlToData(g.settings.media_scripts,j.embed)),!j.source1))return"";if(j.source2||(j.source2=""),j.poster||(j.poster=""),j.source1=g.convertURL(j.source1,"source"),j.source2=g.convertURL(j.source2,"source"),j.source1mime=a.guess(j.source1),j.source2mime=a.guess(j.source2),j.poster=g.convertURL(j.poster,"poster"),f.each(c.urlPatterns,function(a){var b,c,d=a.regex.exec(j.source1);if(d){for(c=a.url,b=0;d[b];b++)c=c.replace("$"+b,f
unction(){return d[b]});j.source1=c,j.type=a.type,j.allowFullscreen=a.allowFullscreen,j.width=j.width||a.w,j.height=j.height||a.h}}),j.embed)i=e.updateHtml(j.embed,j,!0);else{var k=d.getVideoScriptMatch(g.settings.media_scripts,j.source1);if(k&&(j.type="script",j.width=k.width,j.height=k.height),j.width=j.width||300,j.height=j.height||150,f.each(j,function(a,b){j[b]=g.dom.encode(a)}),"iframe"===j.type){var l=j.allowFullscreen?' allowFullscreen="1"':"";i+='<iframe src="'+j.source1+'" width="'+j.width+'" height="'+j.height+'"'+l+"></iframe>"}else"application/x-shockwave-flash"===j.source1mime?(i+='<object data="'+j.source1+'" width="'+j.width+'" height="'+j.height+'" type="application/x-shockwave-flash">',j.poster&&(i+='<img src="'+j.poster+'" width="'+j.width+'" height="'+j.height+'" />'
),i+="</object>"):j.source1mime.indexOf("audio")!==-1?g.settings.audio_template_callback?i=g.settings.audio_template_callback(j):i+='<audio controls="controls" src="'+j.source1+'">'+(j.source2?'\n<source src="'+j.source2+'"'+(j.source2mime?' type="'+j.source2mime+'"':"")+" />\n":"")+"</audio>":"script"===j.type?i+='<script src="'+j.source1+'"></script>':i=g.settings.video_template_callback?g.settings.video_template_callback(j):'<video width="'+j.width+'" height="'+j.height+'"'+(j.poster?' poster="'+j.poster+'"':"")+' controls="controls">\n<source src="'+j.source1+'"'+(j.source1mime?' type="'+j.source1mime+'"':"")+" />\n"+(j.source2?'<source src="'+j.source2+'"'+(j.source2mime?' type="'+j.source2mime+'"':&qu
ot;")+" />\n":"")+"</video>"}return i};return{dataToHtml:g}}),g("l",["8"],function(a){return a("tinymce.util.Promise")}),g("i",["k","l"],function(a,b){var c=function(a,c,d){var e={};return new b(function(b,f){var g=function(d){return d.html&&(e[a.source1]=d),b({url:a.source1,html:d.html?d.html:c(a)})};e[a.source1]?g(e[a.source1]):d({url:a.source1},g,f)})},d=function(a,c){return new b(function(b){b({html:c(a),url:a.source1})})},e=function(b){return function(c){return a.dataToHtml(b,c)}},f=function(a,b){var f=a.settings.media_url_resolver;return f?c(b,e(a),f):d(b,e(a))};return{getEmbedHtml:f}}),g("j",[],function(){var a=function(a,b){a.state.set("oldVal",a.value()),b.state.set("oldVal",b.value())},b=function(a,b){var c=a.find("#width")[0],d=a.find("#height")[0],e=a.find("#constrain")[0];c&&d&&e&&
amp;b(c,d,e.checked())},c=function(b,c,d){var e=b.state.get("oldVal"),f=c.state.get("oldVal"),g=b.value(),h=c.value();d&&e&&f&&g&&h&&(g!==e?(h=Math.round(g/e*h),isNaN(h)||c.value(h)):(g=Math.round(h/f*g),isNaN(g)||b.value(g))),a(b,c)},d=function(c){b(c,a)},e=function(a){b(a,c)},f=function(a){var b=function(){a(function(a){e(a)})};return{type:"container",label:"Dimensions",layout:"flex",align:"center",spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:5,onchange:b,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:5,onchange:b,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}};return{createUi:f,syncSize:d,updateSize:e}}),g("7",["g","h","6",&q
uot;i","f","3","d","j"],function(a,b,c,d,e,f,g,h){var i=g.ie&&g.ie<=8?"onChange":"onInput",j=function(a){return function(b){var c=b&&b.msg?"Media embed handler error: "+b.msg:"Media embed handler threw unknown error.";a.notificationManager.open({type:"error",text:c})}},k=function(a){var c=a.selection.getNode(),d=c.getAttribute("data-ephox-embed-iri");return d?{source1:d,"data-ephox-embed-iri":d,width:e.getMaxWidth(c),height:e.getMaxHeight(c)}:c.getAttribute("data-mce-object")?b.htmlToData(a.settings.media_scripts,a.serializer.serialize(c,{selection:!0})):{}},l=function(a){var b=a.selection.getNode();if(b.getAttribute("data-mce-object")||b.getAttribute("data-ephox-embed-iri"))return a.selection.getContent()},m=function(a,c){return function(d){var e=d.html,g=a.find("#embed")[0],i=f.extend(b.htmlToData(c.settings.m
edia_scripts,e),{source1:d.url});a.fromJSON(i),g&&(g.value(e),h.updateSize(a))}},n=function(a,b){var c,d,e=a.dom.select("img[data-mce-object]");for(c=0;c<b.length;c++)for(d=e.length-1;d>=0;d--)b[c]===e[d]&&e.splice(d,1);a.selection.select(e[0])},o=function(a,b){var c=a.dom.select("img[data-mce-object]");a.insertContent(b),n(a,c),a.nodeChanged()},p=function(a,b){var e=a.toJSON();e.embed=c.updateHtml(e.embed,e),e.embed?o(b,e.embed):d.getEmbedHtml(b,e).then(function(a){o(b,a.html)})["catch"](j(b))},q=function(a,b){f.each(b,function(b,c){a.find("#"+c).value(b)})},r=function(a){var e,g,n=[{name:"source1",type:"filepicker",filetype:"media",size:40,autofocus:!0,label:"Source",onpaste:function(){setTimeout(function(){d.getEmbedHtml(a,e.toJSON()).then(m(e,a))["catch"](j(a))},1)},onchange:function(b){d.getEmbedHtml(a,e.toJSON()).then(m(e,a))["catch"](j(a)),q(e,b.meta)},onb
eforecall:function(a){a.meta=e.toJSON()}}],o=[],r=function(a){a(e),g=e.toJSON(),e.find("#embed").value(c.updateHtml(g.embed,g))};if(a.settings.media_alt_source!==!1&&o.push({name:"source2",type:"filepicker",filetype:"media",size:40,label:"Alternative source"}),a.settings.media_poster!==!1&&o.push({name:"poster",type:"filepicker",filetype:"image",size:40,label:"Poster"}),a.settings.media_dimensions!==!1){var s=h.createUi(r);n.push(s)}g=k(a);var t={id:"mcemediasource",type:"textbox",flex:1,name:"embed",value:l(a),multiline:!0,rows:5,label:"Source"},u=function(){g=f.extend({},b.htmlToData(a.settings.media_scripts,this.value())),this.parent().parent().fromJSON(g)};t[i]=u,e=a.windowManager.open({title:"Insert/edit media",data:g,bodyType:"tabpanel",body:[{title:"General",type:"form",items:n},{title:"E
mbed",type:"container",layout:"flex",direction:"column",align:"stretch",padding:10,spacing:10,items:[{type:"label",text:"Paste your embed code below:",forId:"mcemediasource"},t]},{title:"Advanced",type:"form",items:o}],onSubmit:function(){h.updateSize(e),p(e,a)}}),h.syncSize(e)};return{showDialog:r}}),g("0",["1","2","3","4","5","6","7"],function(a,b,c,d,e,f,g){var h=function(b){b.on("ResolveName",function(a){var b;1===a.target.nodeType&&(b=a.target.getAttribute("data-mce-object"))&&(a.name=b)}),b.on("preInit",function(){var f=b.schema.getSpecialElements();c.each("video audio iframe object".split(" "),function(a){f[a]=new RegExp("</"+a+"[^>]*>","gi")});var g=b.schema.getBoolAttrs();c.each("webkitallowful
lscreen mozallowfullscreen allowfullscreen".split(" "),function(a){g[a]={}}),b.parser.addNodeFilter("iframe,video,audio,object,embed,script",d.placeHolderConverter(b)),b.serializer.addAttributeFilter("data-mce-object",function(c,d){for(var f,g,h,i,j,k,l,m,n=c.length;n--;)if(f=c[n],f.parent){for(l=f.attr(d),g=new a(l,1),"audio"!==l&&"script"!==l&&(m=f.attr("class"),m&&m.indexOf("mce-preview-object")!==-1?g.attr({width:f.firstChild.attr("width"),height:f.firstChild.attr("height")}):g.attr({width:f.attr("width"),height:f.attr("height")})),g.attr({style:f.attr("style")}),i=f.attributes,h=i.length;h--;){var o=i[h].name;0===o.indexOf("data-mce-p-")&&g.attr(o.substr(11),i[h].value)}"script"===l&&g.attr("type","text/javascript"),j=f.attr("data-mce-html"),j&&(k=new a("
;#text",3),k.raw=!0,k.value=e.sanitize(b,unescape(j)),g.append(k)),f.replace(g)}})}),b.on("click keyup",function(){var a=b.selection.getNode();a&&b.dom.hasClass(a,"mce-preview-object")&&b.dom.getAttrib(a,"data-mce-selected")&&a.setAttribute("data-mce-selected","2")}),b.on("ObjectSelected",function(a){var b=a.target.getAttribute("data-mce-object");"audio"!==b&&"script"!==b||a.preventDefault()}),b.on("objectResized",function(a){var b,c=a.target;c.getAttribute("data-mce-object")&&(b=c.getAttribute("data-mce-html"),b&&(b=unescape(b),c.setAttribute("data-mce-html",escape(f.updateHtml(b,{width:a.width,height:a.height})))))}),this.showDialog=function(){g.showDialog(b)},b.addButton("media",{tooltip:"Insert/edit media",onclick:this.showDialog,stateSelector:["img[data-mce-object]",&q
uot;span[data-mce-object]","div[data-ephox-embed-iri]"]}),b.addMenuItem("media",{icon:"media",text:"Media",onclick:this.showDialog,context:"insert",prependToContext:!0}),b.on("setContent",function(){b.$("span.mce-preview-object").each(function(a,c){var d=b.$(c);0===d.find("span.mce-shim",c).length&&d.append('<span class="mce-shim"></span>')})}),b.addCommand("mceMedia",this.showDialog)};return b.add("media",h),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),o=tinymce.util.Tools.resolve("tinymce.Env"),v=tinymce.util.Tools.resolve("tinymce.util.Tools"),w=function(e){return e.getParam("media_scripts")},b=function(e){return e.getParam("audio_template_callback")},y=function(e){return e.getParam("video_template_callback")},n=function(e){return e.getParam("media_live_embeds",!0)},t=function(e){return e.getParam("media_filter_html",!0)},s=function(e){return e.getParam("media_url_resolver")},m=function(e){return e.getParam("media_alt_source",!0)},d=function(e){return e.getParam("media_poster",!0)},h=function(e){return e.getParam("media_dimensions",!0)},p=tinymce.util.Tools.resolve("tinymce.html.SaxParser"),r=tinymce.util.Tools.res
olve("tinymce.dom.DOMUtils"),x=function(e,t){if(e)for(var r=0;r<e.length;r++)if(-1!==t.indexOf(e[r].filter))return e[r]},i=function(t){return function(e){return e?e.style[t].replace(/px$/,""):""}},a=function(i){return function(e,t){var r;e&&(e.style[i]=/^[0-9.]+$/.test(r=t)?r+"px":r)}},f={getMaxWidth:i("maxWidth"),getMaxHeight:i("maxHeight"),setMaxWidth:a("maxWidth"),setMaxHeight:a("maxHeight")},u=r.DOM,l=function(e){return u.getAttrib(e,"data-ephox-embed-iri")},j=function(e,t){return c=t,s=u.createFragment(c),""!==l(s.firstChild)?(o=t,n=u.createFragment(o).firstChild,{type:"ephox-embed-iri",source1:l(n),source2:"",poster:"",width:f.getMaxWidth(n),height:f.getMaxHeight(n)}):(i=e,r=t,p({validate:(a={},!1),allow_conditional_comments:!0,special:"script,noscript",start:function(e,t){if(a.source1||"param"!==e||(a.source1=t.map.mo
vie),"iframe"!==e&&"object"!==e&&"embed"!==e&&"video"!==e&&"audio"!==e||(a.type||(a.type=e),a=v.extend(t.map,a)),"script"===e){var r=x(i,t.map.src);if(!r)return;a={type:"script",source1:t.map.src,width:r.width,height:r.height}}"source"===e&&(a.source1?a.source2||(a.source2=t.map.src):a.source1=t.map.src),"img"!==e||a.poster||(a.poster=t.map.src)}}).parse(r),a.source1=a.source1||a.src||a.data,a.source2=a.source2||"",a.poster=a.poster||"",a);var i,r,a,o,n,c,s},g=tinymce.util.Tools.resolve("tinymce.util.Promise"),M=function(e){var t={mp3:"audio/mpeg",wav:"audio/wav",mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",swf:"application/x-shockwave-flash"}[e.toLowerCase().split(".").pop()];return t||""},_=tinymce.util.Tools.resolve("tinymce.html.Writ
er"),C=tinymce.util.Tools.resolve("tinymce.html.Schema"),S=r.DOM,F=function(e,t){var r,i,a,o;for(r in t)if(a=""+t[r],e.map[r])for(i=e.length;i--;)(o=e[i]).name===r&&(a?(e.map[r]=a,o.value=a):(delete e.map[r],e.splice(i,1)));else a&&(e.push({name:r,value:a}),e.map[r]=a)},k=function(e,t){var r,i,a=S.createFragment(e).firstChild;return f.setMaxWidth(a,t.width),f.setMaxHeight(a,t.height),r=a.outerHTML,i=_(),p(i).parse(r),i.getContent()},A=function(e,t,r){return u=e,l=S.createFragment(u),""!==S.getAttrib(l.firstChild,"data-ephox-embed-iri")?k(e,t):(i=e,a=t,o=r,c=_(),p({validate:!1,allow_conditional_comments:!(s=0),special:"script,noscript",comment:function(e){c.comment(e)},cdata:function(e){c.cdata(e)},text:function(e,t){c.text(e,t)},start:function(e,t,r){switch(e){case"video":case"object":case"embed":case"img":case"iframe":a.height!==undefined&&a.width!==undef
ined&&F(t,{width:a.width,height:a.height})}if(o)switch(e){case"video":F(t,{poster:a.poster,src:""}),a.source2&&F(t,{src:""});break;case"iframe":F(t,{src:a.source1});break;case"source":if(++s<=2&&(F(t,{src:a["source"+s],type:a["source"+s+"mime"]}),!a["source"+s]))return;break;case"img":if(!a.poster)return;n=!0}c.start(e,t,r)},end:function(e){if("video"===e&&o)for(var t=1;t<=2;t++)if(a["source"+t]){var r=[];r.map={},s<t&&(F(r,{src:a["source"+t],type:a["source"+t+"mime"]}),c.start("source",r,!0))}if(a.poster&&"object"===e&&o&&!n){var i=[];i.map={},F(i,{src:a.poster,width:a.width,height:a.height}),c.start("img",i,!0)}c.end(e)}},C({})).parse(i),c.getContent());var i,a,o,n,c,s,u,l},N=[{regex:/youtu\.be\/([\w\-_\?&=.]+)/i,type:"ifra
me",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/youtube\.com(.+)v=([^&]+)(&([a-z0-9&=\-_]+))?/i,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$2?$4",allowFullscreen:!0},{regex:/youtube.com\/embed\/([a-z0-9\?&=\-_]+)/i,type:"iframe",w:560,h:314,url:"//www.youtube.com/embed/$1",allowFullscreen:!0},{regex:/vimeo\.com\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$1?title=0&byline=0&portrait=0&color=8dc7dc",allowFullscreen:!0},{regex:/vimeo\.com\/(.*)\/([0-9]+)/,type:"iframe",w:425,h:350,url:"//player.vimeo.com/video/$2?title=0&byline=0",allowFullscreen:!0},{regex:/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/,type:"iframe",w:425,h:350,url:'//maps.google.com/maps/ms?msid=$2&output=embed"',allowFullscreen:!1},{regex:/dailymotion\.com\/video\/([^_]+)/,type:"iframe",w:480
,h:270,url:"//www.dailymotion.com/embed/video/$1",allowFullscreen:!0},{regex:/dai\.ly\/([^_]+)/,type:"iframe",w:480,h:270,url:"//www.dailymotion.com/embed/video/$1",allowFullscreen:!0}],c=function(r,e){var i=v.extend({},e);if(!i.source1&&(v.extend(i,j(w(r),i.embed)),!i.source1))return"";i.source2||(i.source2=""),i.poster||(i.poster=""),i.source1=r.convertURL(i.source1,"source"),i.source2=r.convertURL(i.source2,"source"),i.source1mime=M(i.source1),i.source2mime=M(i.source2),i.poster=r.convertURL(i.poster,"poster");var t,a,o=(t=i.source1,0<(a=N.filter(function(e){return e.regex.test(t)})).length?v.extend({},a[0],{url:function(e,t){for(var r=e.regex.exec(t),i=e.url,a=function(e){i=i.replace("$"+e,function(){return r[e]?r[e]:""})},o=0;o<r.length;o++)a(o);return i.replace(/\?$/,"")}(a[0],t)}):null);if(o&&(i.source1=o.url,i.type=o.type,i.allowFullsc
reen=o.allowFullscreen,i.width=i.width||o.w,i.height=i.height||o.h),i.embed)return A(i.embed,i,!0);var n=x(w(r),i.source1);n&&(i.type="script",i.width=n.width,i.height=n.height);var c,s,u,l,m,d,h,p,f=b(r),g=y(r);return i.width=i.width||300,i.height=i.height||150,v.each(i,function(e,t){i[t]=r.dom.encode(e)}),"iframe"===i.type?(p=(h=i).allowFullscreen?' allowFullscreen="1"':"",'<iframe src="'+h.source1+'" width="'+h.width+'" height="'+h.height+'"'+p+"></iframe>"):"application/x-shockwave-flash"===i.source1mime?(d='<object data="'+(m=i).source1+'" width="'+m.width+'" height="'+m.height+'" type="application/x-shockwave-flash">',m.poster&&(d+='<img src="'+m.poster+'" width="'+m.width+'" height="'+m.height+'" />'),d+="</object>"):-1!==i.source1mime.indexOf("audio")?(
u=i,(l=f)?l(u):'<audio controls="controls" src="'+u.source1+'">'+(u.source2?'\n<source src="'+u.source2+'"'+(u.source2mime?' type="'+u.source2mime+'"':"")+" />\n":"")+"</audio>"):"script"===i.type?'<script src="'+i.source1+'"><\/script>':(c=i,(s=g)?s(c):'<video width="'+c.width+'" height="'+c.height+'"'+(c.poster?' poster="'+c.poster+'"':"")+' controls="controls">\n<source src="'+c.source1+'"'+(c.source1mime?' type="'+c.source1mime+'"':"")+" />\n"+(c.source2?'<source src="'+c.source2+'"'+(c.source2mime?' type="'+c.source2mime+'"':"")+" />\n":"")+"</video>")},O={},P=function(t){return function(e){return c(t,e)}},T=function(e,t){var r,i,a,o,n,c=s(e);return c?(a=t,o=P(e),n=c,new g(functi
on(t,e){var r=function(e){return e.html&&(O[a.source1]=e),t({url:a.source1,html:e.html?e.html:o(a)})};O[a.source1]?r(O[a.source1]):n({url:a.source1},r,e)})):(r=t,i=P(e),new g(function(e){e({html:i(r),url:r.source1})}))},$=function(e){return O.hasOwnProperty(e)},z=function(e,t){e.state.set("oldVal",e.value()),t.state.set("oldVal",t.value())},L=function(e,t){var r=e.find("#width")[0],i=e.find("#height")[0],a=e.find("#constrain")[0];r&&i&&a&&t(r,i,a.checked())},H=function(e,t,r){var i=e.state.get("oldVal"),a=t.state.get("oldVal"),o=e.value(),n=t.value();r&&i&&a&&o&&n&&(o!==i?(n=Math.round(o/i*n),isNaN(n)||t.value(n)):(o=Math.round(n/a*o),isNaN(o)||e.value(o))),z(e,t)},W=function(e){L(e,H)},J=function(e){var t=function(){e(function(e){W(e)})};return{type:"container",label:"Dimensions",layout:"flex",align:"center&
quot;,spacing:5,items:[{name:"width",type:"textbox",maxLength:5,size:5,onchange:t,ariaLabel:"Width"},{type:"label",text:"x"},{name:"height",type:"textbox",maxLength:5,size:5,onchange:t,ariaLabel:"Height"},{name:"constrain",type:"checkbox",checked:!0,text:"Constrain proportions"}]}},R=function(e){L(e,z)},D=W,E=o.ie&&o.ie<=8?"onChange":"onInput",I=function(r){return function(e){var t=e&&e.msg?"Media embed handler error: "+e.msg:"Media embed handler threw unknown error.";r.notificationManager.open({type:"error",text:t})}},U=function(a,o){return function(e){var t=e.html,r=a.find("#embed")[0],i=v.extend(j(w(o),t),{source1:e.url});a.fromJSON(i),r&&(r.value(t),D(a))}},V=function(e,t){var r=e.dom.select("img[data-mce-object]");e.insertContent(t),function(e,t){var r,i,a=e.dom.select("
;img[data-mce-object]");for(r=0;r<t.length;r++)for(i=a.length-1;0<=i;i--)t[r]===a[i]&&a.splice(i,1);e.selection.select(a[0])}(e,r),e.nodeChanged()},B=function(i){var a,t,e,r,o,n=[{name:"source1",type:"filepicker",filetype:"media",size:40,autofocus:!0,label:"Source",onpaste:function(){setTimeout(function(){T(i,a.toJSON()).then(U(a,i))["catch"](I(i))},1)},onchange:function(e){var r,t;T(i,a.toJSON()).then(U(a,i))["catch"](I(i)),r=a,t=e.meta,v.each(t,function(e,t){r.find("#"+t).value(e)})},onbeforecall:function(e){e.meta=a.toJSON()}}],c=[];if(m(i)&&c.push({name:"source2",type:"filepicker",filetype:"media",size:40,label:"Alternative source"}),d(i)&&c.push({name:"poster",type:"filepicker",filetype:"image",size:40,label:"Poster"}),h(i)){var s=J(function(e){e(a),t=a.toJSON(),a.find("#embed").value(A
(t.embed,t))});n.push(s)}r=(e=i).selection.getNode(),o=r.getAttribute("data-ephox-embed-iri"),t=o?{source1:o,"data-ephox-embed-iri":o,width:f.getMaxWidth(r),height:f.getMaxHeight(r)}:r.getAttribute("data-mce-object")?j(w(e),e.serializer.serialize(r,{selection:!0})):{};var u={id:"mcemediasource",type:"textbox",flex:1,name:"embed",value:function(e){var t=e.selection.getNode();if(t.getAttribute("data-mce-object")||t.getAttribute("data-ephox-embed-iri"))return e.selection.getContent()}(i),multiline:!0,rows:5,label:"Source"};u[E]=function(){t=v.extend({},j(w(i),this.value())),this.parent().parent().fromJSON(t)};var l=[{title:"General",type:"form",items:n},{title:"Embed",type:"container",layout:"flex",direction:"column",align:"stretch",padding:10,spacing:10,items:[{type:"label",text:"Paste your embed code below:"
;,forId:"mcemediasource"},u]}];0<c.length&&l.push({title:"Advanced",type:"form",items:c}),a=i.windowManager.open({title:"Insert/edit media",data:t,bodyType:"tabpanel",body:l,onSubmit:function(){var t,e;D(a),t=i,(e=a.toJSON()).embed=A(e.embed,e),e.embed&&$(e.source1)?V(t,e.embed):T(t,e).then(function(e){V(t,e.html)})["catch"](I(t))}}),R(a)},G=function(e){return{showDialog:function(){B(e)}}},q=function(e){e.addCommand("mceMedia",function(){B(e)})},K=tinymce.util.Tools.resolve("tinymce.html.Node"),Q=function(a,e){if(!1===t(a))return e;var o,n=_();return p({validate:!1,allow_conditional_comments:!1,special:"script,noscript",comment:function(e){n.comment(e)},cdata:function(e){n.cdata(e)},text:function(e,t){n.text(e,t)},start:function(e,t,r){if(o=!0,"script"!==e&&"noscript"!==e){for(var i=0;i<t.length;i++){if(0===t[i].name.indexOf("on"))retu
rn;"style"===t[i].name&&(t[i].value=a.dom.serializeStyle(a.dom.parseStyle(t[i].value),e))}n.start(e,t,r),o=!1}},end:function(e){o||n.end(e)}},C({})).parse(e),n.getContent()},X=function(e,t){var r,i=t.name;return(r=new K("img",1)).shortEnded=!0,Z(e,t,r),r.attr({width:t.attr("width")||"300",height:t.attr("height")||("audio"===i?"30":"150"),style:t.attr("style"),src:o.transparentSrc,"data-mce-object":i,"class":"mce-object mce-object-"+i}),r},Y=function(e,t){var r,i,a,o=t.name;return(r=new K("span",1)).attr({contentEditable:"false",style:t.attr("style"),"data-mce-object":o,"class":"mce-preview-object mce-object-"+o}),Z(e,t,r),(i=new K(o,1)).attr({src:t.attr("src"),allowfullscreen:t.attr("allowfullscreen"),style:t.attr("style"),"class":t.attr("class"),wi
dth:t.attr("width"),height:t.attr("height"),frameborder:"0"}),(a=new K("span",1)).attr("class","mce-shim"),r.append(i),r.append(a),r},Z=function(e,t,r){var i,a,o,n,c;for(n=(o=t.attributes).length;n--;)i=o[n].name,a=o[n].value,"width"!==i&&"height"!==i&&"style"!==i&&("data"!==i&&"src"!==i||(a=e.convertURL(a,i)),r.attr("data-mce-p-"+i,a));(c=t.firstChild&&t.firstChild.value)&&(r.attr("data-mce-html",escape(Q(e,c))),r.firstChild=null)},ee=function(e){for(;e=e.parent;)if(e.attr("data-ephox-embed-iri"))return!0;return!1},te=function(a){return function(e){for(var t,r,i=e.length;i--;)(t=e[i]).parent&&(t.parent.attr("data-mce-object")||("script"!==t.name||(r=x(w(a),t.attr("src"))))&&(r&&(r.width&&t.attr("width",r.width.toString()),r.he
ight&&t.attr("height",r.height.toString())),"iframe"===t.name&&n(a)&&o.ceFalse?ee(t)||t.replace(Y(a,t)):ee(t)||t.replace(X(a,t))))}},re=function(d){d.on("preInit",function(){var t=d.schema.getSpecialElements();v.each("video audio iframe object".split(" "),function(e){t[e]=new RegExp("</"+e+"[^>]*>","gi")});var r=d.schema.getBoolAttrs();v.each("webkitallowfullscreen mozallowfullscreen allowfullscreen".split(" "),function(e){r[e]={}}),d.parser.addNodeFilter("iframe,video,audio,object,embed,script",te(d)),d.serializer.addAttributeFilter("data-mce-object",function(e,t){for(var r,i,a,o,n,c,s,u,l=e.length;l--;)if((r=e[l]).parent){for(s=r.attr(t),i=new K(s,1),"audio"!==s&&"script"!==s&&((u=r.attr("class"))&&-1!==u.indexOf("mce-preview-object")?i.attr({width:r.firstChild.attr(&
quot;width"),height:r.firstChild.attr("height")}):i.attr({width:r.attr("width"),height:r.attr("height")})),i.attr({style:r.attr("style")}),a=(o=r.attributes).length;a--;){var m=o[a].name;0===m.indexOf("data-mce-p-")&&i.attr(m.substr(11),o[a].value)}"script"===s&&i.attr("type","text/javascript"),(n=r.attr("data-mce-html"))&&((c=new K("#text",3)).raw=!0,c.value=Q(d,unescape(n)),i.append(c)),r.replace(i)}})}),d.on("setContent",function(){d.$("span.mce-preview-object").each(function(e,t){var r=d.$(t);0===r.find("span.mce-shim",t).length&&r.append('<span class="mce-shim"></span>')})})},ie=function(e){e.on("ResolveName",function(e){var t;1===e.target.nodeType&&(t=e.target.getAttribute("data-mce-object"))&&(e.name=t)})},ae=function(t){t.on("click keyup",funct
ion(){var e=t.selection.getNode();e&&t.dom.hasClass(e,"mce-preview-object")&&t.dom.getAttrib(e,"data-mce-selected")&&e.setAttribute("data-mce-selected","2")}),t.on("ObjectSelected",function(e){var t=e.target.getAttribute("data-mce-object");"audio"!==t&&"script"!==t||e.preventDefault()}),t.on("objectResized",function(e){var t,r=e.target;r.getAttribute("data-mce-object")&&(t=r.getAttribute("data-mce-html"))&&(t=unescape(t),r.setAttribute("data-mce-html",escape(A(t,{width:e.width,height:e.height}))))})},oe=function(e){e.addButton("media",{tooltip:"Insert/edit media",cmd:"mceMedia",stateSelector:["img[data-mce-object]","span[data-mce-object]","div[data-ephox-embed-iri]"]}),e.addMenuItem("media",{icon:"media",text:"Media",cmd:"mc
eMedia",context:"insert",prependToContext:!0})};e.add("media",function(e){return q(e),oe(e),ie(e),re(e),ae(e),G(e)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginspastepluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/paste/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/paste/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/paste/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,2488 +1,1609 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var paste = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
-
-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
-
-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
-
-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
- };
-};
-
-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
-
-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
-
-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
- }
- }
-};
-
-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.paste.Plugin","tinymce.core.PluginManager","tinymce.plugins.paste.api.Events","tinymce.plugins.paste.core.Clipboard","tinymce.plugins.paste.core.CutCopy","tinymce.plugins.paste.core.Quirks","global!tinymce.util.Tools.resolve","tinymce.core.dom.RangeUtils","tinymce.core.Env","tinymce.core.util.Delay","tinymce.core.util.Tools","tinymce.core.util.VK","tinymce.plugins.paste.core.InternalHtml","tinymce.plugins.paste.core.Newlines","tinymce.plugins.paste.core.PasteBin","tinymce.plugins.paste.core.ProcessFilters","tinymce.plugins.paste.core.SmartPaste","tinymce.plugins.paste.core.Utils","tinymce.plugins.paste.core.WordFilter","tinymce.core.html.Entities","tinymce.core.html.DomParser","tinymce.core.html.Schema","tinymce.core.html.Serializer","
;tinymce.core.html.Node"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
-
-/**
- * Events.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.paste.api.Events',
- [
- ],
- function () {
- var firePastePreProcess = function (editor, html, internal, isWordHtml) {
- return editor.fire('PastePreProcess', { content: html, internal: internal, wordContent: isWordHtml });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Cell = function (initial) {
+ var value = initial;
+ var get = function () {
+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var firePastePostProcess = function (editor, node, internal, isWordHtml) {
- return editor.fire('PastePostProcess', { node: node, internal: internal, wordContent: isWordHtml });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var set = function (v) {
+ value = v;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var firePastePlainTextToggle = function (editor, state) {
- return editor.fire('PastePlainTextToggle', { state: state });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var clone = function () {
+ return Cell(get());
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- firePastePreProcess: firePastePreProcess,
- firePastePostProcess: firePastePostProcess,
- firePastePlainTextToggle: firePastePlainTextToggle
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ get: get,
+ set: set,
+ clone: clone
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.dom.RangeUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.RangeUtils');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasProPlugin = function (editor) {
+ if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global.get('powerpaste')) {
+ if (typeof window.console !== 'undefined' && window.console.log) {
+ window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.');
+ }
+ return true;
+ } else {
+ return false;
+ }
+ };
+ var $_5e30n7hljfuw8pt8 = { hasProPlugin: hasProPlugin };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.Env',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.Env');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Delay',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Delay');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.VK',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.VK');
- }
-);
-
-/**
- * InternalHtml.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.paste.core.InternalHtml',
- [
- ],
- function () {
- var internalMimeType = 'x-tinymce/html';
- var internalMark = '<!-- ' + internalMimeType + ' -->';
-
- var mark = function (html) {
- return internalMark + html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get = function (clipboard, quirks) {
+ return {
+ clipboard: clipboard,
+ quirks: quirks
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_4xrki5hmjfuw8pta = { get: get };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var unmark = function (html) {
- return html.replace(internalMark, '');
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var firePastePreProcess = function (editor, html, internal, isWordHtml) {
+ return editor.fire('PastePreProcess', {
+ content: html,
+ internal: internal,
+ wordContent: isWordHtml
+ });
+ };
+ var firePastePostProcess = function (editor, node, internal, isWordHtml) {
+ return editor.fire('PastePostProcess', {
+ node: node,
+ internal: internal,
+ wordContent: isWordHtml
+ });
+ };
+ var firePastePlainTextToggle = function (editor, state) {
+ return editor.fire('PastePlainTextToggle', { state: state });
+ };
+ var firePaste = function (editor, ieFake) {
+ return editor.fire('paste', { ieFake: ieFake });
+ };
+ var $_ae0f8dhpjfuw8pte = {
+ firePastePreProcess: firePastePreProcess,
+ firePastePostProcess: firePastePostProcess,
+ firePastePlainTextToggle: firePastePlainTextToggle,
+ firePaste: firePaste
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isMarked = function (html) {
- return html.indexOf(internalMark) !== -1;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var shouldPlainTextInform = function (editor) {
+ return editor.getParam('paste_plaintext_inform', true);
+ };
+ var shouldBlockDrop = function (editor) {
+ return editor.getParam('paste_block_drop', false);
+ };
+ var shouldPasteDataImages = function (editor) {
+ return editor.getParam('paste_data_images', false);
+ };
+ var shouldFilterDrop = function (editor) {
+ return editor.getParam('paste_filter_drop', true);
+ };
+ var getPreProcess = function (editor) {
+ return editor.getParam('paste_preprocess');
+ };
+ var getPostProcess = function (editor) {
+ return editor.getParam('paste_postprocess');
+ };
+ var getWebkitStyles = function (editor) {
+ return editor.getParam('paste_webkit_styles');
+ };
+ var shouldRemoveWebKitStyles = function (editor) {
+ return editor.getParam('paste_remove_styles_if_webkit', true);
+ };
+ var shouldMergeFormats = function (editor) {
+ return editor.getParam('paste_merge_formats', true);
+ };
+ var isSmartPasteEnabled = function (editor) {
+ return editor.getParam('smart_paste', true);
+ };
+ var isPasteAsTextEnabled = function (editor) {
+ return editor.getParam('paste_as_text', false);
+ };
+ var getRetainStyleProps = function (editor) {
+ return editor.getParam('paste_retain_style_properties');
+ };
+ var getWordValidElements = function (editor) {
+ var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody';
+ return editor.getParam('paste_word_valid_elements', defaultValidElements);
+ };
+ var shouldConvertWordFakeLists = function (editor) {
+ return editor.getParam('paste_convert_word_fake_lists', true);
+ };
+ var shouldUseDefaultFilters = function (editor) {
+ return editor.getParam('paste_enable_default_filters', true);
+ };
+ var $_dls6llhqjfuw8ptf = {
+ shouldPlainTextInform: shouldPlainTextInform,
+ shouldBlockDrop: shouldBlockDrop,
+ shouldPasteDataImages: shouldPasteDataImages,
+ shouldFilterDrop: shouldFilterDrop,
+ getPreProcess: getPreProcess,
+ getPostProcess: getPostProcess,
+ getWebkitStyles: getWebkitStyles,
+ shouldRemoveWebKitStyles: shouldRemoveWebKitStyles,
+ shouldMergeFormats: shouldMergeFormats,
+ isSmartPasteEnabled: isSmartPasteEnabled,
+ isPasteAsTextEnabled: isPasteAsTextEnabled,
+ getRetainStyleProps: getRetainStyleProps,
+ getWordValidElements: getWordValidElements,
+ shouldConvertWordFakeLists: shouldConvertWordFakeLists,
+ shouldUseDefaultFilters: shouldUseDefaultFilters
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- mark: mark,
- unmark: unmark,
- isMarked: isMarked,
- internalHtmlMime: function () {
- return internalMimeType;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var shouldInformUserAboutPlainText = function (editor, userIsInformedState) {
+ return userIsInformedState.get() === false && $_dls6llhqjfuw8ptf.shouldPlainTextInform(editor);
+ };
+ var displayNotification = function (editor, message) {
+ editor.notificationManager.open({
+ text: editor.translate(message),
+ type: 'info'
+ });
+ };
+ var togglePlainTextPaste = function (editor, clipboard, userIsInformedState) {
+ if (clipboard.pasteFormat.get() === 'text') {
+ clipboard.pasteFormat.set('html');
+ $_ae0f8dhpjfuw8pte.firePastePlainTextToggle(editor, false);
+ } else {
+ clipboard.pasteFormat.set('text');
+ $_ae0f8dhpjfuw8pte.firePastePlainTextToggle(editor, true);
+ if (shouldInformUserAboutPlainText(editor, userIsInformedState)) {
+ displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.');
+ userIsInformedState.set(true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- }
-);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ editor.focus();
+ };
+ var $_btm9r2hojfuw8ptc = { togglePlainTextPaste: togglePlainTextPaste };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.html.Entities',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.html.Entities');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor, clipboard, userIsInformedState) {
+ editor.addCommand('mceTogglePlainTextPaste', function () {
+ $_btm9r2hojfuw8ptc.togglePlainTextPaste(editor, clipboard, userIsInformedState);
+ });
+ editor.addCommand('mceInsertClipboardContent', function (ui, value) {
+ if (value.content) {
+ clipboard.pasteHtml(value.content, value.internal);
+ }
+ if (value.text) {
+ clipboard.pasteText(value.text);
+ }
+ });
+ };
+ var $_a15l7thnjfuw8pta = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Newlines.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Newlines class contains utilities to convert newlines (\n or \r\n) tp BRs or to a combination of the specified block element and BRs
- *
- * @class tinymce.Newlines
- * @private
- */
-define(
- 'tinymce.plugins.paste.core.Newlines',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.html.Entities'
- ],
- function (Tools, Entities) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isPlainText = function (text) {
- // so basically any tag that is not one of the "p, div, span, br", or is one of them, but is followed
- // by some additional characters qualifies the text as not a plain text (having some HTML tags)
- // <span style="white-space:pre"> and <br /> are added as separate exceptions to the rule
- return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.VK');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var toBRs = function (text) {
- return text.replace(/\r?\n/g, '<br>');
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var internalMimeType = 'x-tinymce/html';
+ var internalMark = '<!-- ' + internalMimeType + ' -->';
+ var mark = function (html) {
+ return internalMark + html;
+ };
+ var unmark = function (html) {
+ return html.replace(internalMark, '');
+ };
+ var isMarked = function (html) {
+ return html.indexOf(internalMark) !== -1;
+ };
+ var $_ceqsrthxjfuw8ptx = {
+ mark: mark,
+ unmark: unmark,
+ isMarked: isMarked,
+ internalHtmlMime: function () {
+ return internalMimeType;
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$5 = tinymce.util.Tools.resolve('tinymce.html.Entities');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var openContainer = function (rootTag, rootAttrs) {
- var key, attrs = [];
- var tag = '<' + rootTag;
-
- if (typeof rootAttrs === 'object') {
- for (key in rootAttrs) {
- if (rootAttrs.hasOwnProperty(key)) {
- attrs.push(key + '="' + Entities.encodeAllRaw(rootAttrs[key]) + '"');
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isPlainText = function (text) {
+ return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text);
+ };
+ var toBRs = function (text) {
+ return text.replace(/\r?\n/g, '<br>');
+ };
+ var openContainer = function (rootTag, rootAttrs) {
+ var key;
+ var attrs = [];
+ var tag = '<' + rootTag;
+ if (typeof rootAttrs === 'object') {
+ for (key in rootAttrs) {
+ if (rootAttrs.hasOwnProperty(key)) {
+ attrs.push(key + '="' + global$5.encodeAllRaw(rootAttrs[key]) + '"');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (attrs.length) {
- tag += ' ' + attrs.join(' ');
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return tag + '>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (attrs.length) {
+ tag += ' ' + attrs.join(' ');
+ }
+ }
+ return tag + '>';
+ };
+ var toBlockElements = function (text, rootTag, rootAttrs) {
+ var blocks = text.split(/\n\n/);
+ var tagOpen = openContainer(rootTag, rootAttrs);
+ var tagClose = '</' + rootTag + '>';
+ var paragraphs = global$3.map(blocks, function (p) {
+ return p.split(/\n/).join('<br />');
+ });
+ var stitch = function (p) {
+ return tagOpen + p + tagClose;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return paragraphs.length === 1 ? paragraphs[0] : global$3.map(paragraphs, stitch).join('');
+ };
+ var convert = function (text, rootTag, rootAttrs) {
+ return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text);
+ };
+ var $_7lc4hihyjfuw8pty = {
+ isPlainText: isPlainText,
+ convert: convert,
+ toBRs: toBRs,
+ toBlockElements: toBlockElements
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$6 = tinymce.util.Tools.resolve('tinymce.html.DomParser');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var toBlockElements = function (text, rootTag, rootAttrs) {
- var blocks = text.split(/\n\n/);
- var tagOpen = openContainer(rootTag, rootAttrs);
- var tagClose = '</' + rootTag + '>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$7 = tinymce.util.Tools.resolve('tinymce.html.Node');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var paragraphs = Tools.map(blocks, function (p) {
- return p.split(/\n/).join('<br />');
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$8 = tinymce.util.Tools.resolve('tinymce.html.Schema');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var stitch = function (p) {
- return tagOpen + p + tagClose;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$9 = tinymce.util.Tools.resolve('tinymce.html.Serializer');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return paragraphs.length === 1 ? paragraphs[0] : Tools.map(paragraphs, stitch).join('');
- };
-
-
- var convert = function (text, rootTag, rootAttrs) {
- return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text);
- };
-
-
- return {
- isPlainText: isPlainText,
- convert: convert,
- toBRs: toBRs,
- toBlockElements: toBlockElements
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function filter(content, items) {
+ global$3.each(items, function (v) {
+ if (v.constructor === RegExp) {
+ content = content.replace(v, '');
+ } else {
+ content = content.replace(v[0], v[1]);
+ }
+ });
+ return content;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-/**
- * PasteBin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * @class tinymce.pasteplugin.PasteBin
- * @private
- */
-define(
- 'tinymce.plugins.paste.core.PasteBin',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.Env'
- ],
- function (Tools, Env) {
- return function (editor) {
- var lastRng;
- var pasteBinDefaultContent = '%MCEPASTEBIN%';
-
- /**
- * Creates a paste bin element as close as possible to the current caret location and places the focus inside that element
- * so that when the real paste event occurs the contents gets inserted into this element
- * instead of the current editor selection element.
- */
- var create = function () {
- var dom = editor.dom, body = editor.getBody();
- var viewport = editor.dom.getViewPort(editor.getWin()), scrollTop = viewport.y, top = 20;
- var pasteBinElm;
- var scrollContainer;
-
- lastRng = editor.selection.getRng();
-
- if (editor.inline) {
- scrollContainer = editor.selection.getScrollContainer();
-
- // Can't always rely on scrollTop returning a useful value.
- // It returns 0 if the browser doesn't support scrollTop for the element or is non-scrollable
- if (scrollContainer && scrollContainer.scrollTop > 0) {
- scrollTop = scrollContainer.scrollTop;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function innerText(html) {
+ var schema = global$8();
+ var domParser = global$6({}, schema);
+ var text = '';
+ var shortEndedElements = schema.getShortEndedElements();
+ var ignoreElements = global$3.makeMap('script noscript style textarea video audio iframe object', ' ');
+ var blockElements = schema.getBlockElements();
+ function walk(node) {
+ var name = node.name, currentNode = node;
+ if (name === 'br') {
+ text += '\n';
+ return;
+ }
+ if (shortEndedElements[name]) {
+ text += ' ';
+ }
+ if (ignoreElements[name]) {
+ text += ' ';
+ return;
+ }
+ if (node.type === 3) {
+ text += node.value;
+ }
+ if (!node.shortEnded) {
+ if (node = node.firstChild) {
+ do {
+ walk(node);
+ } while (node = node.next);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the rect of the current caret if the caret is in an empty block before a
- * BR we insert a temporary invisible character that we get the rect this way we always get a proper rect.
- *
- * TODO: This might be useful in core.
- */
- function getCaretRect(rng) {
- var rects, textNode, node, container = rng.startContainer;
-
- rects = rng.getClientRects();
- if (rects.length) {
- return rects[0];
- }
-
- if (!rng.collapsed || container.nodeType != 1) {
- return;
- }
-
- node = container.childNodes[lastRng.startOffset];
-
- // Skip empty whitespace nodes
- while (node && node.nodeType == 3 && !node.data.length) {
- node = node.nextSibling;
- }
-
- if (!node) {
- return;
- }
-
- // Check if the location is |<br>
- // TODO: Might need to expand this to say |<table>
- if (node.tagName == 'BR') {
- textNode = dom.doc.createTextNode('\uFEFF');
- node.parentNode.insertBefore(textNode, node);
-
- rng = dom.createRng();
- rng.setStartBefore(textNode);
- rng.setEndAfter(textNode);
-
- rects = rng.getClientRects();
- dom.remove(textNode);
- }
-
- if (rects.length) {
- return rects[0];
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (blockElements[name] && currentNode.next) {
+ text += '\n';
+ if (name === 'p') {
+ text += '\n';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Calculate top cordinate this is needed to avoid scrolling to top of document
- // We want the paste bin to be as close to the caret as possible to avoid scrolling
- if (lastRng.getClientRects) {
- var rect = getCaretRect(lastRng);
-
- if (rect) {
- // Client rects gets us closes to the actual
- // caret location in for example a wrapped paragraph block
- top = scrollTop + (rect.top - dom.getPos(body).y);
- } else {
- top = scrollTop;
-
- // Check if we can find a closer location by checking the range element
- var container = lastRng.startContainer;
- if (container) {
- if (container.nodeType == 3 && container.parentNode != body) {
- container = container.parentNode;
- }
-
- if (container.nodeType == 1) {
- top = dom.getPos(container, scrollContainer || body).y;
- }
- }
- }
- }
-
- // Create a pastebin
- pasteBinElm = editor.dom.add(editor.getBody(), 'div', {
- id: "mcepastebin",
- contentEditable: true,
- "data-mce-bogus": "all",
- style: 'position: absolute; top: ' + top + 'px; width: 10px; height: 10px; overflow: hidden; opacity: 0'
- }, pasteBinDefaultContent);
-
- // Move paste bin out of sight since the controlSelection rect gets displayed otherwise on IE and Gecko
- if (Env.ie || Env.gecko) {
- dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) == 'rtl' ? 0xFFFF : -0xFFFF);
- }
-
- // Prevent focus events from bubbeling fixed FocusManager issues
- dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {
- e.stopPropagation();
- });
-
- pasteBinElm.focus();
- editor.selection.select(pasteBinElm, true);
- };
-
- /**
- * Removes the paste bin if it exists.
- */
- var remove = function () {
- if (getEl()) {
- var pasteBinClone;
-
- // WebKit/Blink might clone the div so
- // lets make sure we remove all clones
- // TODO: Man o man is this ugly. WebKit is the new IE! Remove this if they ever fix it!
- while ((pasteBinClone = editor.dom.get('mcepastebin'))) {
- editor.dom.remove(pasteBinClone);
- editor.dom.unbind(pasteBinClone);
- }
-
- if (lastRng) {
- editor.selection.setRng(lastRng);
- }
- }
-
- lastRng = null;
- };
-
-
- var getEl = function () {
- return editor.dom.get('mcepastebin');
- };
-
- /**
- * Returns the contents of the paste bin as a HTML string.
- *
- * @return {String} Get the contents of the paste bin.
- */
- var getHtml = function () {
- var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper;
-
- // Since WebKit/Chrome might clone the paste bin when pasting
- // for example: <img style="float: right"> we need to check if any of them contains some useful html.
- // TODO: Man o man is this ugly. WebKit is the new IE! Remove this if they ever fix it!
-
- var copyAndRemove = function (toElm, fromElm) {
- toElm.appendChild(fromElm);
- editor.dom.remove(fromElm, true); // remove, but keep children
- };
-
- // find only top level elements (there might be more nested inside them as well, see TINY-1162)
- pasteBinClones = Tools.grep(editor.getBody().childNodes, function (elm) {
- return elm.id === 'mcepastebin';
- });
- pasteBinElm = pasteBinClones.shift();
-
- // if clones were found, move their content into the first bin
- Tools.each(pasteBinClones, function (pasteBinClone) {
- copyAndRemove(pasteBinElm, pasteBinClone);
- });
-
- // TINY-1162: when copying plain text (from notepad for example) WebKit clones
- // paste bin (with styles and attributes) and uses it as a default wrapper for
- // the chunks of the content, here we cycle over the whole paste bin and replace
- // those wrappers with a basic div
- dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm);
- for (i = dirtyWrappers.length - 1; i >= 0; i--) {
- cleanWrapper = editor.dom.create('div');
- pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]);
- copyAndRemove(cleanWrapper, dirtyWrappers[i]);
- }
-
- return pasteBinElm ? pasteBinElm.innerHTML : '';
- };
-
-
- var getLastRng = function () {
- return lastRng;
- };
-
-
- var isDefaultContent = function (content) {
- return content === pasteBinDefaultContent;
- };
-
-
- var isPasteBin = function (elm) {
- return elm && elm.id === 'mcepastebin';
- };
-
-
- var isDefault = function () {
- var pasteBinElm = getEl();
- return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinElm.innerHTML);
- };
-
- return {
- create: create,
- remove: remove,
- getEl: getEl,
- getHtml: getHtml,
- getLastRng: getLastRng,
- isDefault: isDefault,
- isDefaultContent: isDefaultContent
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ }
+ html = filter(html, [/<!\[[^\]]+\]>/g]);
+ walk(domParser.parse(html));
+ return text;
+ }
+ function trimHtml(html) {
+ function trimSpaces(all, s1, s2) {
+ if (!s1 && !s2) {
+ return ' ';
+ }
+ return '\xA0';
+ }
+ html = filter(html, [
+ /^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig,
+ /<!--StartFragment-->|<!--EndFragment-->/g,
+ [
+ /( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,
+ trimSpaces
+ ],
+ /<br class="Apple-interchange-newline">/g,
+ /<br>$/i
+ ]);
+ return html;
+ }
+ function createIdGenerator(prefix) {
+ var count = 0;
+ return function () {
+ return prefix + count++;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isMsEdge = function () {
+ return navigator.userAgent.indexOf(' Edge/') !== -1;
+ };
+ var $_cedk7ri6jfuw8pud = {
+ filter: filter,
+ innerText: innerText,
+ trimHtml: trimHtml,
+ createIdGenerator: createIdGenerator,
+ isMsEdge: isMsEdge
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.html.DomParser',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.html.DomParser');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function isWordContent(content) {
+ return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(content) || /class="OutlineElement/.test(content) || /id="?docs\-internal\-guid\-/.test(content);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.html.Schema',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.html.Schema');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function isNumericList(text) {
+ var found, patterns;
+ patterns = [
+ /^[IVXLMCD]{1,2}\.[ \u00a0]/,
+ /^[ivxlmcd]{1,2}\.[ \u00a0]/,
+ /^[a-z]{1,2}[\.\)][ \u00a0]/,
+ /^[A-Z]{1,2}[\.\)][ \u00a0]/,
+ /^[0-9]+\.[ \u00a0]/,
+ /^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,
+ /^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/
+ ];
+ text = text.replace(/^[\u00a0 ]+/, '');
+ global$3.each(patterns, function (pattern) {
+ if (pattern.test(text)) {
+ found = true;
+ return false;
+ }
+ });
+ return found;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.html.Serializer',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.html.Serializer');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function isBulletList(text) {
+ return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.html.Node',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.html.Node');
- }
-);
-
-/**
- * Utils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contails various utility functions for the paste plugin.
- *
- * @class tinymce.pasteplugin.Utils
- */
-define(
- 'tinymce.plugins.paste.core.Utils',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.html.DomParser',
- 'tinymce.core.html.Schema'
- ],
- function (Tools, DomParser, Schema) {
- function filter(content, items) {
- Tools.each(items, function (v) {
- if (v.constructor == RegExp) {
- content = content.replace(v, '');
- } else {
- content = content.replace(v[0], v[1]);
- }
- });
-
- return content;
- }
-
- /**
- * Gets the innerText of the specified element. It will handle edge cases
- * and works better than textContent on Gecko.
- *
- * @param {String} html HTML string to get text from.
- * @return {String} String of text with line feeds.
- */
- function innerText(html) {
- var schema = new Schema(), domParser = new DomParser({}, schema), text = '';
- var shortEndedElements = schema.getShortEndedElements();
- var ignoreElements = Tools.makeMap('script noscript style textarea video audio iframe object', ' ');
- var blockElements = schema.getBlockElements();
-
- function walk(node) {
- var name = node.name, currentNode = node;
-
- if (name === 'br') {
- text += '\n';
- return;
- }
-
- // img/input/hr
- if (shortEndedElements[name]) {
- text += ' ';
- }
-
- // Ingore script, video contents
- if (ignoreElements[name]) {
- text += ' ';
- return;
- }
-
- if (node.type == 3) {
- text += node.value;
- }
-
- // Walk all children
- if (!node.shortEnded) {
- if ((node = node.firstChild)) {
- do {
- walk(node);
- } while ((node = node.next));
- }
- }
-
- // Add \n or \n\n for blocks or P
- if (blockElements[name] && currentNode.next) {
- text += '\n';
-
- if (name == 'p') {
- text += '\n';
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function convertFakeListsToProperLists(node) {
+ var currentListNode, prevListNode, lastLevel = 1;
+ function getText(node) {
+ var txt = '';
+ if (node.type === 3) {
+ return node.value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- html = filter(html, [
- /<!\[[^\]]+\]>/g // Conditional comments
- ]);
-
- walk(domParser.parse(html));
-
- return text;
- }
-
- /**
- * Trims the specified HTML by removing all WebKit fragments, all elements wrapping the body trailing BR elements etc.
- *
- * @param {String} html Html string to trim contents on.
- * @return {String} Html contents that got trimmed.
- */
- function trimHtml(html) {
- function trimSpaces(all, s1, s2) {
- // WebKit meant to preserve multiple spaces but instead inserted around all inline tags,
- // including the spans with inline styles created on paste
- if (!s1 && !s2) {
- return ' ';
- }
-
- return '\u00a0';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node = node.firstChild) {
+ do {
+ txt += getText(node);
+ } while (node = node.next);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- html = filter(html, [
- /^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig, // Remove anything but the contents within the BODY element
- /<!--StartFragment-->|<!--EndFragment-->/g, // Inner fragments (tables from excel on mac)
- [/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g, trimSpaces],
- /<br class="Apple-interchange-newline">/g,
- /<br>$/i // Trailing BR elements
- ]);
-
- return html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return txt;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // TODO: Should be in some global class
- function createIdGenerator(prefix) {
- var count = 0;
-
- return function () {
- return prefix + (count++);
- };
- }
-
- var isMsEdge = function () {
- return navigator.userAgent.indexOf(' Edge/') !== -1;
- };
-
- return {
- filter: filter,
- innerText: innerText,
- trimHtml: trimHtml,
- createIdGenerator: createIdGenerator,
- isMsEdge: isMsEdge
- };
- }
-);
-
-/**
- * WordFilter.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class parses word HTML into proper TinyMCE markup.
- *
- * @class tinymce.pasteplugin.WordFilter
- * @private
- */
-define(
- 'tinymce.plugins.paste.core.WordFilter',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.html.DomParser',
- 'tinymce.core.html.Schema',
- 'tinymce.core.html.Serializer',
- 'tinymce.core.html.Node',
- 'tinymce.plugins.paste.core.Utils'
- ],
- function (Tools, DomParser, Schema, Serializer, Node, Utils) {
- /**
- * Checks if the specified content is from any of the following sources: MS Word/Office 365/Google docs.
- */
- function isWordContent(content) {
- return (
- (/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i).test(content) ||
- (/class="OutlineElement/).test(content) ||
- (/id="?docs\-internal\-guid\-/.test(content))
- );
- }
-
- /**
- * Checks if the specified text starts with "1. " or "a. " etc.
- */
- function isNumericList(text) {
- var found, patterns;
-
- patterns = [
- /^[IVXLMCD]{1,2}\.[ \u00a0]/, // Roman upper case
- /^[ivxlmcd]{1,2}\.[ \u00a0]/, // Roman lower case
- /^[a-z]{1,2}[\.\)][ \u00a0]/, // Alphabetical a-z
- /^[A-Z]{1,2}[\.\)][ \u00a0]/, // Alphabetical A-Z
- /^[0-9]+\.[ \u00a0]/, // Numeric lists
- /^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/, // Japanese
- /^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/ // Chinese
- ];
-
- text = text.replace(/^[\u00a0 ]+/, '');
-
- Tools.each(patterns, function (pattern) {
- if (pattern.test(text)) {
- found = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function trimListStart(node, regExp) {
+ if (node.type === 3) {
+ if (regExp.test(node.value)) {
+ node.value = node.value.replace(regExp, '');
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- return found;
- }
-
- function isBulletList(text) {
- return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text);
- }
-
- /**
- * Converts fake bullet and numbered lists to real semantic OL/UL.
- *
- * @param {tinymce.html.Node} node Root node to convert children of.
- */
- function convertFakeListsToProperLists(node) {
- var currentListNode, prevListNode, lastLevel = 1;
-
- function getText(node) {
- var txt = '';
-
- if (node.type === 3) {
- return node.value;
- }
-
- if ((node = node.firstChild)) {
- do {
- txt += getText(node);
- } while ((node = node.next));
- }
-
- return txt;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function trimListStart(node, regExp) {
- if (node.type === 3) {
- if (regExp.test(node.value)) {
- node.value = node.value.replace(regExp, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node = node.firstChild) {
+ do {
+ if (!trimListStart(node, regExp)) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- if ((node = node.firstChild)) {
- do {
- if (!trimListStart(node, regExp)) {
- return false;
- }
- } while ((node = node.next));
- }
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } while (node = node.next);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function removeIgnoredNodes(node) {
- if (node._listIgnore) {
- node.remove();
- return;
- }
-
- if ((node = node.firstChild)) {
- do {
- removeIgnoredNodes(node);
- } while ((node = node.next));
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ }
+ function removeIgnoredNodes(node) {
+ if (node._listIgnore) {
+ node.remove();
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function convertParagraphToLi(paragraphNode, listName, start) {
- var level = paragraphNode._listLevel || lastLevel;
-
- // Handle list nesting
- if (level != lastLevel) {
- if (level < lastLevel) {
- // Move to parent list
- if (currentListNode) {
- currentListNode = currentListNode.parent.parent;
- }
- } else {
- // Create new list
- prevListNode = currentListNode;
- currentListNode = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node = node.firstChild) {
+ do {
+ removeIgnoredNodes(node);
+ } while (node = node.next);
+ }
+ }
+ function convertParagraphToLi(paragraphNode, listName, start) {
+ var level = paragraphNode._listLevel || lastLevel;
+ if (level !== lastLevel) {
+ if (level < lastLevel) {
+ if (currentListNode) {
+ currentListNode = currentListNode.parent.parent;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- if (!currentListNode || currentListNode.name != listName) {
- prevListNode = prevListNode || currentListNode;
- currentListNode = new Node(listName, 1);
-
- if (start > 1) {
- currentListNode.attr('start', '' + start);
- }
-
- paragraphNode.wrap(currentListNode);
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- currentListNode.append(paragraphNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ prevListNode = currentListNode;
+ currentListNode = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- paragraphNode.name = 'li';
-
- // Append list to previous list if it exists
- if (level > lastLevel && prevListNode) {
- prevListNode.lastChild.append(currentListNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (!currentListNode || currentListNode.name !== listName) {
+ prevListNode = prevListNode || currentListNode;
+ currentListNode = new global$7(listName, 1);
+ if (start > 1) {
+ currentListNode.attr('start', '' + start);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- lastLevel = level;
-
- // Remove start of list item "1. " or "· " etc
- removeIgnoredNodes(paragraphNode);
- trimListStart(paragraphNode, /^\u00a0+/);
- trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);
- trimListStart(paragraphNode, /^\u00a0+/);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ paragraphNode.wrap(currentListNode);
+ } else {
+ currentListNode.append(paragraphNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Build a list of all root level elements before we start
- // altering them in the loop below.
- var elements = [], child = node.firstChild;
- while (typeof child !== 'undefined' && child !== null) {
- elements.push(child);
-
- child = child.walk();
- if (child !== null) {
- while (typeof child !== 'undefined' && child.parent !== node) {
- child = child.walk();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ paragraphNode.name = 'li';
+ if (level > lastLevel && prevListNode) {
+ prevListNode.lastChild.append(currentListNode);
+ }
+ lastLevel = level;
+ removeIgnoredNodes(paragraphNode);
+ trimListStart(paragraphNode, /^\u00a0+/);
+ trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);
+ trimListStart(paragraphNode, /^\u00a0+/);
+ }
+ var elements = [];
+ var child = node.firstChild;
+ while (typeof child !== 'undefined' && child !== null) {
+ elements.push(child);
+ child = child.walk();
+ if (child !== null) {
+ while (typeof child !== 'undefined' && child.parent !== node) {
+ child = child.walk();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (var i = 0; i < elements.length; i++) {
- node = elements[i];
-
- if (node.name == 'p' && node.firstChild) {
- // Find first text node in paragraph
- var nodeText = getText(node);
-
- // Detect unordered lists look for bullets
- if (isBulletList(nodeText)) {
- convertParagraphToLi(node, 'ul');
- continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ for (var i = 0; i < elements.length; i++) {
+ node = elements[i];
+ if (node.name === 'p' && node.firstChild) {
+ var nodeText = getText(node);
+ if (isBulletList(nodeText)) {
+ convertParagraphToLi(node, 'ul');
+ continue;
+ }
+ if (isNumericList(nodeText)) {
+ var matches = /([0-9]+)\./.exec(nodeText);
+ var start = 1;
+ if (matches) {
+ start = parseInt(matches[1], 10);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Detect ordered lists 1., a. or ixv.
- if (isNumericList(nodeText)) {
- // Parse OL start number
- var matches = /([0-9]+)\./.exec(nodeText);
- var start = 1;
- if (matches) {
- start = parseInt(matches[1], 10);
- }
-
- convertParagraphToLi(node, 'ol', start);
- continue;
- }
-
- // Convert paragraphs marked as lists but doesn't look like anything
- if (node._listLevel) {
- convertParagraphToLi(node, 'ul', 1);
- continue;
- }
-
- currentListNode = null;
- } else {
- // If the root level element isn't a p tag which can be
- // processed by convertParagraphToLi, it interrupts the
- // lists, causing a new list to start instead of having
- // elements from the next list inserted above this tag.
- prevListNode = currentListNode;
- currentListNode = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ convertParagraphToLi(node, 'ol', start);
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node._listLevel) {
+ convertParagraphToLi(node, 'ul', 1);
+ continue;
+ }
+ currentListNode = null;
+ } else {
+ prevListNode = currentListNode;
+ currentListNode = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function filterStyles(editor, validStyles, node, styleValue) {
- var outputStyles = {}, matches, styles = editor.dom.parseStyle(styleValue);
-
- Tools.each(styles, function (value, name) {
- // Convert various MS styles to W3C styles
- switch (name) {
- case 'mso-list':
- // Parse out list indent level for lists
- matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
- if (matches) {
- node._listLevel = parseInt(matches[1], 10);
- }
-
- // Remove these nodes <span style="mso-list:Ignore">o</span>
- // Since the span gets removed we mark the text node and the span
- if (/Ignore/i.test(value) && node.firstChild) {
- node._listIgnore = true;
- node.firstChild._listIgnore = true;
- }
-
- break;
-
- case "horiz-align":
- name = "text-align";
- break;
-
- case "vert-align":
- name = "vertical-align";
- break;
-
- case "font-color":
- case "mso-foreground":
- name = "color";
- break;
-
- case "mso-background":
- case "mso-highlight":
- name = "background";
- break;
-
- case "font-weight":
- case "font-style":
- if (value != "normal") {
- outputStyles[name] = value;
- }
- return;
-
- case "mso-element":
- // Remove track changes code
- if (/^(comment|comment-list)$/i.test(value)) {
- node.remove();
- return;
- }
-
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ function filterStyles(editor, validStyles, node, styleValue) {
+ var outputStyles = {}, matches;
+ var styles = editor.dom.parseStyle(styleValue);
+ global$3.each(styles, function (value, name) {
+ switch (name) {
+ case 'mso-list':
+ matches = /\w+ \w+([0-9]+)/i.exec(styleValue);
+ if (matches) {
+ node._listLevel = parseInt(matches[1], 10);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (name.indexOf('mso-comment') === 0) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (/Ignore/i.test(value) && node.firstChild) {
+ node._listIgnore = true;
+ node.firstChild._listIgnore = true;
+ }
+ break;
+ case 'horiz-align':
+ name = 'text-align';
+ break;
+ case 'vert-align':
+ name = 'vertical-align';
+ break;
+ case 'font-color':
+ case 'mso-foreground':
+ name = 'color';
+ break;
+ case 'mso-background':
+ case 'mso-highlight':
+ name = 'background';
+ break;
+ case 'font-weight':
+ case 'font-style':
+ if (value !== 'normal') {
+ outputStyles[name] = value;
+ }
+ return;
+ case 'mso-element':
+ if (/^(comment|comment-list)$/i.test(value)) {
</ins><span class="cx" style="display: block; padding: 0 10px"> node.remove();
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Never allow mso- prefixed names
- if (name.indexOf('mso-') === 0) {
- return;
- }
-
- // Output only valid styles
- if (editor.settings.paste_retain_style_properties == "all" || (validStyles && validStyles[name])) {
- outputStyles[name] = value;
- }
- });
-
- // Convert bold style to "b" element
- if (/(bold)/i.test(outputStyles["font-weight"])) {
- delete outputStyles["font-weight"];
- node.wrap(new Node("b", 1));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Convert italic style to "i" element
- if (/(italic)/i.test(outputStyles["font-style"])) {
- delete outputStyles["font-style"];
- node.wrap(new Node("i", 1));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (name.indexOf('mso-comment') === 0) {
+ node.remove();
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Serialize the styles and see if there is something left to keep
- outputStyles = editor.dom.serializeStyle(outputStyles, node.name);
- if (outputStyles) {
- return outputStyles;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (name.indexOf('mso-') === 0) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_dls6llhqjfuw8ptf.getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) {
+ outputStyles[name] = value;
+ }
+ });
+ if (/(bold)/i.test(outputStyles['font-weight'])) {
+ delete outputStyles['font-weight'];
+ node.wrap(new global$7('b', 1));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var filterWordContent = function (editor, content) {
- var retainStyleProperties, validStyles;
-
- retainStyleProperties = editor.settings.paste_retain_style_properties;
- if (retainStyleProperties) {
- validStyles = Tools.makeMap(retainStyleProperties.split(/[, ]/));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (/(italic)/i.test(outputStyles['font-style'])) {
+ delete outputStyles['font-style'];
+ node.wrap(new global$7('i', 1));
+ }
+ outputStyles = editor.dom.serializeStyle(outputStyles, node.name);
+ if (outputStyles) {
+ return outputStyles;
+ }
+ return null;
+ }
+ var filterWordContent = function (editor, content) {
+ var retainStyleProperties, validStyles;
+ retainStyleProperties = $_dls6llhqjfuw8ptf.getRetainStyleProps(editor);
+ if (retainStyleProperties) {
+ validStyles = global$3.makeMap(retainStyleProperties.split(/[, ]/));
+ }
+ content = $_cedk7ri6jfuw8pud.filter(content, [
+ /<br class="?Apple-interchange-newline"?>/gi,
+ /<b[^>]+id="?docs-internal-[^>]*>/gi,
+ /<!--[\s\S]+?-->/gi,
+ /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
+ [
+ /<(\/?)s>/gi,
+ '<$1strike>'
+ ],
+ [
+ / /gi,
+ '\xA0'
+ ],
+ [
+ /<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
+ function (str, spaces) {
+ return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join('\xA0') : '';
+ }
+ ]
+ ]);
+ var validElements = $_dls6llhqjfuw8ptf.getWordValidElements(editor);
+ var schema = global$8({
+ valid_elements: validElements,
+ valid_children: '-li[p]'
+ });
+ global$3.each(schema.elements, function (rule) {
+ if (!rule.attributes.class) {
+ rule.attributes.class = {};
+ rule.attributesOrder.push('class');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove basic Word junk
- content = Utils.filter(content, [
- // Remove apple new line markers
- /<br class="?Apple-interchange-newline"?>/gi,
-
- // Remove google docs internal guid markers
- /<b[^>]+id="?docs-internal-[^>]*>/gi,
-
- // Word comments like conditional comments etc
- /<!--[\s\S]+?-->/gi,
-
- // Remove comments, scripts (e.g., msoShowComment), XML tag, VML content,
- // MS Office namespaced tags, and a few other tags
- /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
-
- // Convert <s> into <strike> for line-though
- [/<(\/?)s>/gi, "<$1strike>"],
-
- // Replace nsbp entites to char since it's easier to handle
- [/ /gi, "\u00a0"],
-
- // Convert <span style="mso-spacerun:yes">___</span> to string of alternating
- // breaking/non-breaking spaces of same length
- [/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
- function (str, spaces) {
- return (spaces.length > 0) ?
- spaces.replace(/./, " ").slice(Math.floor(spaces.length / 2)).split("").join("\u00a0") : "";
- }
- ]
- ]);
-
- var validElements = editor.settings.paste_word_valid_elements;
- if (!validElements) {
- validElements = (
- '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' +
- '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' +
- 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody'
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!rule.attributes.style) {
+ rule.attributes.style = {};
+ rule.attributesOrder.push('style');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Setup strict schema
- var schema = new Schema({
- valid_elements: validElements,
- valid_children: '-li[p]'
- });
-
- // Add style/class attribute to all element rules since the user might have removed them from
- // paste_word_valid_elements config option and we need to check them for properties
- Tools.each(schema.elements, function (rule) {
- /*eslint dot-notation:0*/
- if (!rule.attributes["class"]) {
- rule.attributes["class"] = {};
- rule.attributesOrder.push("class");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ var domParser = global$6({}, schema);
+ domParser.addAttributeFilter('style', function (nodes) {
+ var i = nodes.length, node;
+ while (i--) {
+ node = nodes[i];
+ node.attr('style', filterStyles(editor, validStyles, node, node.attr('style')));
+ if (node.name === 'span' && node.parent && !node.attributes.length) {
+ node.unwrap();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!rule.attributes.style) {
- rule.attributes.style = {};
- rule.attributesOrder.push("style");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ domParser.addAttributeFilter('class', function (nodes) {
+ var i = nodes.length, node, className;
+ while (i--) {
+ node = nodes[i];
+ className = node.attr('class');
+ if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) {
+ node.remove();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- // Parse HTML into DOM structure
- var domParser = new DomParser({}, schema);
-
- // Filter styles to remove "mso" specific styles and convert some of them
- domParser.addAttributeFilter('style', function (nodes) {
- var i = nodes.length, node;
-
- while (i--) {
- node = nodes[i];
- node.attr('style', filterStyles(editor, validStyles, node, node.attr('style')));
-
- // Remove pointess spans
- if (node.name == 'span' && node.parent && !node.attributes.length) {
- node.unwrap();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.attr('class', null);
+ }
+ });
+ domParser.addNodeFilter('del', function (nodes) {
+ var i = nodes.length;
+ while (i--) {
+ nodes[i].remove();
+ }
+ });
+ domParser.addNodeFilter('a', function (nodes) {
+ var i = nodes.length, node, href, name;
+ while (i--) {
+ node = nodes[i];
+ href = node.attr('href');
+ name = node.attr('name');
+ if (href && href.indexOf('#_msocom_') !== -1) {
+ node.remove();
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- // Check the class attribute for comments or del items and remove those
- domParser.addAttributeFilter('class', function (nodes) {
- var i = nodes.length, node, className;
-
- while (i--) {
- node = nodes[i];
-
- className = node.attr('class');
- if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) {
- node.remove();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (href && href.indexOf('file://') === 0) {
+ href = href.split('#')[1];
+ if (href) {
+ href = '#' + href;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node.attr('class', null);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- // Remove all del elements since we don't want the track changes code in the editor
- domParser.addNodeFilter('del', function (nodes) {
- var i = nodes.length;
-
- while (i--) {
- nodes[i].remove();
- }
- });
-
- // Keep some of the links and anchors
- domParser.addNodeFilter('a', function (nodes) {
- var i = nodes.length, node, href, name;
-
- while (i--) {
- node = nodes[i];
- href = node.attr('href');
- name = node.attr('name');
-
- if (href && href.indexOf('#_msocom_') != -1) {
- node.remove();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!href && !name) {
+ node.unwrap();
+ } else {
+ if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {
+ node.unwrap();
</ins><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (href && href.indexOf('file://') === 0) {
- href = href.split('#')[1];
- if (href) {
- href = '#' + href;
- }
- }
-
- if (!href && !name) {
- node.unwrap();
- } else {
- // Remove all named anchors that aren't specific to TOC, Footnotes or Endnotes
- if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {
- node.unwrap();
- continue;
- }
-
- node.attr({
- href: href,
- name: name
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.attr({
+ href: href,
+ name: name
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- // Parse into DOM structure
- var rootNode = domParser.parse(content);
-
- // Process DOM
- if (editor.settings.paste_convert_word_fake_lists !== false) {
- convertFakeListsToProperLists(rootNode);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ var rootNode = domParser.parse(content);
+ if ($_dls6llhqjfuw8ptf.shouldConvertWordFakeLists(editor)) {
+ convertFakeListsToProperLists(rootNode);
+ }
+ content = global$9({ validate: editor.settings.validate }, schema).serialize(rootNode);
+ return content;
+ };
+ var preProcess = function (editor, content) {
+ return $_dls6llhqjfuw8ptf.shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content;
+ };
+ var $_8q8fy4i1jfuw8pu5 = {
+ preProcess: preProcess,
+ isWordContent: isWordContent
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Serialize DOM back to HTML
- content = new Serializer({
- validate: editor.settings.validate
- }, schema).serialize(rootNode);
-
- return content;
- };
-
- var preProcess = function (editor, content) {
- return editor.settings.paste_enable_default_filters === false ? content : filterWordContent(editor, content);
- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var processResult = function (content, cancelled) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- preProcess: preProcess,
- isWordContent: isWordContent
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ content: content,
+ cancelled: cancelled
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var postProcessFilter = function (editor, html, internal, isWordHtml) {
+ var tempBody = editor.dom.create('div', { style: 'display:none' }, html);
+ var postProcessArgs = $_ae0f8dhpjfuw8pte.firePastePostProcess(editor, tempBody, internal, isWordHtml);
+ return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented());
+ };
+ var filterContent = function (editor, content, internal, isWordHtml) {
+ var preProcessArgs = $_ae0f8dhpjfuw8pte.firePastePreProcess(editor, content, internal, isWordHtml);
+ if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) {
+ return postProcessFilter(editor, preProcessArgs.content, internal, isWordHtml);
+ } else {
+ return processResult(preProcessArgs.content, preProcessArgs.isDefaultPrevented());
+ }
+ };
+ var process = function (editor, html, internal) {
+ var isWordHtml = $_8q8fy4i1jfuw8pu5.isWordContent(html);
+ var content = isWordHtml ? $_8q8fy4i1jfuw8pu5.preProcess(editor, html) : html;
+ return filterContent(editor, content, internal, isWordHtml);
+ };
+ var $_g5r539i0jfuw8pu1 = { process: process };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ProcessFilters.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var pasteHtml = function (editor, html) {
+ editor.insertContent(html, {
+ merge: $_dls6llhqjfuw8ptf.shouldMergeFormats(editor),
+ paste: true
+ });
+ return true;
+ };
+ var isAbsoluteUrl = function (url) {
+ return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url);
+ };
+ var isImageUrl = function (url) {
+ return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url);
+ };
+ var createImage = function (editor, url, pasteHtmlFn) {
+ editor.undoManager.extra(function () {
+ pasteHtmlFn(editor, url);
+ }, function () {
+ editor.insertContent('<img src="' + url + '">');
+ });
+ return true;
+ };
+ var createLink = function (editor, url, pasteHtmlFn) {
+ editor.undoManager.extra(function () {
+ pasteHtmlFn(editor, url);
+ }, function () {
+ editor.execCommand('mceInsertLink', false, url);
+ });
+ return true;
+ };
+ var linkSelection = function (editor, html, pasteHtmlFn) {
+ return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false;
+ };
+ var insertImage = function (editor, html, pasteHtmlFn) {
+ return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false;
+ };
+ var smartInsertContent = function (editor, html) {
+ global$3.each([
+ linkSelection,
+ insertImage,
+ pasteHtml
+ ], function (action) {
+ return action(editor, html, pasteHtml) !== true;
+ });
+ };
+ var insertContent = function (editor, html) {
+ if ($_dls6llhqjfuw8ptf.isSmartPasteEnabled(editor) === false) {
+ pasteHtml(editor, html);
+ } else {
+ smartInsertContent(editor, html);
+ }
+ };
+ var $_6s6wwwi7jfuw8puh = {
+ isImageUrl: isImageUrl,
+ isAbsoluteUrl: isAbsoluteUrl,
+ insertContent: insertContent
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.plugins.paste.core.ProcessFilters',
- [
- 'tinymce.plugins.paste.api.Events',
- 'tinymce.plugins.paste.core.WordFilter'
- ],
- function (Events, WordFilter) {
- var processResult = function (content, cancelled) {
- return { content: content, cancelled: cancelled };
- };
-
- var postProcessFilter = function (editor, html, internal, isWordHtml) {
- var tempBody = editor.dom.create('div', { style: 'display:none' }, html);
- var postProcessArgs = Events.firePastePostProcess(editor, tempBody, internal, isWordHtml);
- return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented());
- };
-
- var filterContent = function (editor, content, internal, isWordHtml) {
- var preProcessArgs = Events.firePastePreProcess(editor, content, internal, isWordHtml);
-
- if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) {
- return postProcessFilter(editor, preProcessArgs.content, internal, isWordHtml);
- } else {
- return processResult(preProcessArgs.content, preProcessArgs.isDefaultPrevented());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var pasteHtml$1 = function (editor, html, internalFlag) {
+ var internal = internalFlag ? internalFlag : $_ceqsrthxjfuw8ptx.isMarked(html);
+ var args = $_g5r539i0jfuw8pu1.process(editor, $_ceqsrthxjfuw8ptx.unmark(html), internal);
+ if (args.cancelled === false) {
+ $_6s6wwwi7jfuw8puh.insertContent(editor, args.content);
+ }
+ };
+ var pasteText = function (editor, text) {
+ text = editor.dom.encode(text).replace(/\r\n/g, '\n');
+ text = $_7lc4hihyjfuw8pty.convert(text, editor.settings.forced_root_block, editor.settings.forced_root_block_attrs);
+ pasteHtml$1(editor, text, false);
+ };
+ var getDataTransferItems = function (dataTransfer) {
+ var items = {};
+ var mceInternalUrlPrefix = 'data:text/mce-internal,';
+ if (dataTransfer) {
+ if (dataTransfer.getData) {
+ var legacyText = dataTransfer.getData('Text');
+ if (legacyText && legacyText.length > 0) {
+ if (legacyText.indexOf(mceInternalUrlPrefix) === -1) {
+ items['text/plain'] = legacyText;
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var process = function (editor, html, internal) {
- var isWordHtml = WordFilter.isWordContent(html);
- var content = isWordHtml ? WordFilter.preProcess(editor, html) : html;
-
- return filterContent(editor, content, internal, isWordHtml);
- };
-
- return {
- process: process
- };
- }
-);
-
-/**
- * SmartPaste.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Tries to be smart depending on what the user pastes if it looks like an url
- * it will make a link out of the current selection. If it's an image url that looks
- * like an image it will check if it's an image and insert it as an image.
- *
- * @class tinymce.pasteplugin.SmartPaste
- * @private
- */
-define(
- 'tinymce.plugins.paste.core.SmartPaste',
- [
- 'tinymce.core.util.Tools'
- ],
- function (Tools) {
- var isAbsoluteUrl = function (url) {
- return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url);
- };
-
- var isImageUrl = function (url) {
- return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url);
- };
-
- var createImage = function (editor, url, pasteHtml) {
- editor.undoManager.extra(function () {
- pasteHtml(editor, url);
- }, function () {
- editor.insertContent('<img src="' + url + '">');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (dataTransfer.types) {
+ for (var i = 0; i < dataTransfer.types.length; i++) {
+ var contentType = dataTransfer.types[i];
+ try {
+ items[contentType] = dataTransfer.getData(contentType);
+ } catch (ex) {
+ items[contentType] = '';
+ }
+ }
+ }
+ }
+ return items;
+ };
+ var getClipboardContent = function (editor, clipboardEvent) {
+ var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);
+ return $_cedk7ri6jfuw8pud.isMsEdge() ? global$3.extend(content, { 'text/html': '' }) : content;
+ };
+ var hasContentType = function (clipboardContent, mimeType) {
+ return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;
+ };
+ var hasHtmlOrText = function (content) {
+ return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain');
+ };
+ var getBase64FromUri = function (uri) {
+ var idx;
+ idx = uri.indexOf(',');
+ if (idx !== -1) {
+ return uri.substr(idx + 1);
+ }
+ return null;
+ };
+ var isValidDataUriImage = function (settings, imgElm) {
+ return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true;
+ };
+ var extractFilename = function (editor, str) {
+ var m = str.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i);
+ return m ? editor.dom.encode(m[1]) : null;
+ };
+ var pasteImage = function (editor, rng, reader, blob) {
+ var uniqueId = $_cedk7ri6jfuw8pud.createIdGenerator('mceclip');
+ if (rng) {
+ editor.selection.setRng(rng);
+ rng = null;
+ }
+ var dataUri = reader.result;
+ var base64 = getBase64FromUri(dataUri);
+ var id = uniqueId();
+ var name = editor.settings.images_reuse_filename && blob.name ? extractFilename(editor, blob.name) : id;
+ var img = new Image();
+ img.src = dataUri;
+ if (isValidDataUriImage(editor.settings, img)) {
+ var blobCache = editor.editorUpload.blobCache;
+ var blobInfo = void 0, existingBlobInfo = void 0;
+ existingBlobInfo = blobCache.findFirst(function (cachedBlobInfo) {
+ return cachedBlobInfo.base64() === base64;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return true;
- };
-
- var createLink = function (editor, url, pasteHtml) {
- editor.undoManager.extra(function () {
- pasteHtml(editor, url);
- }, function () {
- editor.execCommand('mceInsertLink', false, url);
- });
-
- return true;
- };
-
- var linkSelection = function (editor, html, pasteHtml) {
- return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtml) : false;
- };
-
- var insertImage = function (editor, html, pasteHtml) {
- return isImageUrl(html) ? createImage(editor, html, pasteHtml) : false;
- };
-
- var pasteHtml = function (editor, html) {
- editor.insertContent(html, {
- merge: editor.settings.paste_merge_formats !== false,
- paste: true
- });
-
- return true;
- };
-
- var smartInsertContent = function (editor, html) {
- Tools.each([
- linkSelection,
- insertImage,
- pasteHtml
- ], function (action) {
- return action(editor, html, pasteHtml) !== true;
- });
- };
-
- var insertContent = function (editor, html) {
- if (editor.settings.smart_paste === false) {
- pasteHtml(editor, html);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!existingBlobInfo) {
+ blobInfo = blobCache.create(id, blob, base64, name);
+ blobCache.add(blobInfo);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- smartInsertContent(editor, html);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ blobInfo = existingBlobInfo;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- return {
- isImageUrl: isImageUrl,
- isAbsoluteUrl: isAbsoluteUrl,
- insertContent: insertContent
- };
- }
-);
-
-/**
- * Clipboard.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains logic for getting HTML contents out of the clipboard.
- *
- * We need to make a lot of ugly hacks to get the contents out of the clipboard since
- * the W3C Clipboard API is broken in all browsers that have it: Gecko/WebKit/Blink.
- * We might rewrite this the way those API:s stabilize. Browsers doesn't handle pasting
- * from applications like Word the same way as it does when pasting into a contentEditable area
- * so we need to do lots of extra work to try to get to this clipboard data.
- *
- * Current implementation steps:
- * 1. On keydown with paste keys Ctrl+V or Shift+Insert create
- * a paste bin element and move focus to that element.
- * 2. Wait for the browser to fire a "paste" event and get the contents out of the paste bin.
- * 3. Check if the paste was successful if true, process the HTML.
- * (4). If the paste was unsuccessful use IE execCommand, Clipboard API, document.dataTransfer old WebKit API etc.
- *
- * @class tinymce.pasteplugin.Clipboard
- * @private
- */
-define(
- 'tinymce.plugins.paste.core.Clipboard',
- [
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.Env',
- 'tinymce.core.util.Delay',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.VK',
- 'tinymce.plugins.paste.core.InternalHtml',
- 'tinymce.plugins.paste.core.Newlines',
- 'tinymce.plugins.paste.core.PasteBin',
- 'tinymce.plugins.paste.core.ProcessFilters',
- 'tinymce.plugins.paste.core.SmartPaste',
- 'tinymce.plugins.paste.core.Utils'
- ],
- function (RangeUtils, Env, Delay, Tools, VK, InternalHtml, Newlines, PasteBin, ProcessFilters, SmartPaste, Utils) {
- return function (editor) {
- var self = this, keyboardPasteTimeStamp = 0, draggingInternally = false;
- var pasteBin = new PasteBin(editor);
- var keyboardPastePlainTextState;
- var mceInternalUrlPrefix = 'data:text/mce-internal,';
- var uniqueId = Utils.createIdGenerator("mceclip");
-
- /**
- * Pastes the specified HTML. This means that the HTML is filtered and then
- * inserted at the current selection in the editor. It will also fire paste events
- * for custom user filtering.
- *
- * @param {String} html HTML code to paste into the current selection.
- * @param {Boolean?} internalFlag Optional true/false flag if the contents is internal or external.
- */
- function pasteHtml(html, internalFlag) {
- var internal = internalFlag ? internalFlag : InternalHtml.isMarked(html);
- var args = ProcessFilters.process(editor, InternalHtml.unmark(html), internal);
-
- if (args.cancelled === false) {
- SmartPaste.insertContent(editor, args.content);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ pasteHtml$1(editor, '<img src="' + blobInfo.blobUri() + '">', false);
+ } else {
+ pasteHtml$1(editor, '<img src="' + dataUri + '">', false);
+ }
+ };
+ var isClipboardEvent = function (event) {
+ return event.type === 'paste';
+ };
+ var pasteImageData = function (editor, e, rng) {
+ var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer;
+ function processItems(items) {
+ var i, item, reader, hadImage = false;
+ if (items) {
+ for (i = 0; i < items.length; i++) {
+ item = items[i];
+ if (/^image\/(jpeg|png|gif|bmp)$/.test(item.type)) {
+ var blob = item.getAsFile ? item.getAsFile() : item;
+ reader = new window.FileReader();
+ reader.onload = pasteImage.bind(null, editor, rng, reader, blob);
+ reader.readAsDataURL(blob);
+ e.preventDefault();
+ hadImage = true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Pastes the specified text. This means that the plain text is processed
- * and converted into BR and P elements. It will fire paste events for custom filtering.
- *
- * @param {String} text Text to paste as the current selection location.
- */
- function pasteText(text) {
- text = editor.dom.encode(text).replace(/\r\n/g, '\n');
- text = Newlines.convert(text, editor.settings.forced_root_block, editor.settings.forced_root_block_attrs);
-
- pasteHtml(text, false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return hadImage;
+ }
+ if (editor.settings.paste_data_images && dataTransfer) {
+ return processItems(dataTransfer.items) || processItems(dataTransfer.files);
+ }
+ };
+ var isBrokenAndroidClipboardEvent = function (e) {
+ var clipboardData = e.clipboardData;
+ return navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;
+ };
+ var isKeyboardPasteEvent = function (e) {
+ return global$4.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45;
+ };
+ var registerEventHandlers = function (editor, pasteBin, pasteFormat) {
+ var keyboardPasteTimeStamp = 0;
+ var keyboardPastePlainTextState;
+ editor.on('keydown', function (e) {
+ function removePasteBinOnKeyUp(e) {
+ if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
+ pasteBin.remove();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
- /**
- * Gets various content types out of a datatransfer object.
- *
- * @param {DataTransfer} dataTransfer Event fired on paste.
- * @return {Object} Object with mime types and data for those mime types.
- */
- function getDataTransferItems(dataTransfer) {
- var items = {};
-
- if (dataTransfer) {
- // Use old WebKit/IE API
- if (dataTransfer.getData) {
- var legacyText = dataTransfer.getData('Text');
- if (legacyText && legacyText.length > 0) {
- if (legacyText.indexOf(mceInternalUrlPrefix) == -1) {
- items['text/plain'] = legacyText;
- }
- }
- }
-
- if (dataTransfer.types) {
- for (var i = 0; i < dataTransfer.types.length; i++) {
- var contentType = dataTransfer.types[i];
- try { // IE11 throws exception when contentType is Files (type is present but data cannot be retrieved via getData())
- items[contentType] = dataTransfer.getData(contentType);
- } catch (ex) {
- items[contentType] = ""; // useless in general, but for consistency across browsers
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
+ keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86;
+ if (keyboardPastePlainTextState && global$1.webkit && navigator.userAgent.indexOf('Version/') !== -1) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return items;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ e.stopImmediatePropagation();
+ keyboardPasteTimeStamp = new Date().getTime();
+ if (global$1.ie && keyboardPastePlainTextState) {
+ e.preventDefault();
+ $_ae0f8dhpjfuw8pte.firePaste(editor, true);
+ return;
+ }
+ pasteBin.remove();
+ pasteBin.create();
+ editor.once('keyup', removePasteBinOnKeyUp);
+ editor.once('paste', function () {
+ editor.off('keyup', removePasteBinOnKeyUp);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Gets various content types out of the Clipboard API. It will also get the
- * plain text using older IE and WebKit API:s.
- *
- * @param {ClipboardEvent} clipboardEvent Event fired on paste.
- * @return {Object} Object with mime types and data for those mime types.
- */
- function getClipboardContent(clipboardEvent) {
- var content = getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);
-
- // Edge 15 has a broken HTML Clipboard API see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11877517/
- return Utils.isMsEdge() ? Tools.extend(content, { 'text/html': '' }) : content;
- }
-
- function hasHtmlOrText(content) {
- return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain');
- }
-
- function getBase64FromUri(uri) {
- var idx;
-
- idx = uri.indexOf(',');
- if (idx !== -1) {
- return uri.substr(idx + 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ function insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal) {
+ var content, isPlainTextHtml;
+ if (hasContentType(clipboardContent, 'text/html')) {
+ content = clipboardContent['text/html'];
+ } else {
+ content = pasteBin.getHtml();
+ internal = internal ? internal : $_ceqsrthxjfuw8ptx.isMarked(content);
+ if (pasteBin.isDefaultContent(content)) {
+ plainTextMode = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isValidDataUriImage(settings, imgElm) {
- return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ content = $_cedk7ri6jfuw8pud.trimHtml(content);
+ pasteBin.remove();
+ isPlainTextHtml = internal === false && $_7lc4hihyjfuw8pty.isPlainText(content);
+ if (!content.length || isPlainTextHtml) {
+ plainTextMode = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function extractFilename(str) {
- var m = str.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i);
- return m ? editor.dom.encode(m[1]) : null;
- }
-
- function pasteImage(rng, reader, blob) {
- if (rng) {
- editor.selection.setRng(rng);
- rng = null;
- }
-
- var dataUri = reader.result;
- var base64 = getBase64FromUri(dataUri);
- var id = uniqueId();
- var name = editor.settings.images_reuse_filename && blob.name ? extractFilename(blob.name) : id;
- var img = new Image();
-
- img.src = dataUri;
-
- // TODO: Move the bulk of the cache logic to EditorUpload
- if (isValidDataUriImage(editor.settings, img)) {
- var blobCache = editor.editorUpload.blobCache;
- var blobInfo, existingBlobInfo;
-
- existingBlobInfo = blobCache.findFirst(function (cachedBlobInfo) {
- return cachedBlobInfo.base64() === base64;
- });
-
- if (!existingBlobInfo) {
- blobInfo = blobCache.create(id, blob, base64, name);
- blobCache.add(blobInfo);
- } else {
- blobInfo = existingBlobInfo;
- }
-
- pasteHtml('<img src="' + blobInfo.blobUri() + '">', false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (plainTextMode) {
+ if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) {
+ content = clipboardContent['text/plain'];
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- pasteHtml('<img src="' + dataUri + '">', false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ content = $_cedk7ri6jfuw8pud.innerText(content);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Checks if the clipboard contains image data if it does it will take that data
- * and convert it into a data url image and paste that image at the caret location.
- *
- * @param {ClipboardEvent} e Paste/drop event object.
- * @param {DOMRange} rng Rng object to move selection to.
- * @return {Boolean} true/false if the image data was found or not.
- */
- function pasteImageData(e, rng) {
- var dataTransfer = e.clipboardData || e.dataTransfer;
-
- function processItems(items) {
- var i, item, reader, hadImage = false;
-
- if (items) {
- for (i = 0; i < items.length; i++) {
- item = items[i];
-
- if (/^image\/(jpeg|png|gif|bmp)$/.test(item.type)) {
- var blob = item.getAsFile ? item.getAsFile() : item;
-
- reader = new FileReader();
- reader.onload = pasteImage.bind(null, rng, reader, blob);
- reader.readAsDataURL(blob);
-
- e.preventDefault();
- hadImage = true;
- }
- }
- }
-
- return hadImage;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (pasteBin.isDefaultContent(content)) {
+ if (!isKeyBoardPaste) {
+ editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (editor.settings.paste_data_images && dataTransfer) {
- return processItems(dataTransfer.items) || processItems(dataTransfer.files);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Chrome on Android doesn't support proper clipboard access so we have no choice but to allow the browser default behavior.
- *
- * @param {Event} e Paste event object to check if it contains any data.
- * @return {Boolean} true/false if the clipboard is empty or not.
- */
- function isBrokenAndroidClipboardEvent(e) {
- var clipboardData = e.clipboardData;
-
- return navigator.userAgent.indexOf('Android') != -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (plainTextMode) {
+ pasteText(editor, content);
+ } else {
+ pasteHtml$1(editor, content, internal);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getCaretRangeFromEvent(e) {
- return RangeUtils.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ var getLastRng = function () {
+ return pasteBin.getLastRng() || editor.selection.getRng();
+ };
+ editor.on('paste', function (e) {
+ var clipboardTimer = new Date().getTime();
+ var clipboardContent = getClipboardContent(editor, e);
+ var clipboardDelay = new Date().getTime() - clipboardTimer;
+ var isKeyBoardPaste = new Date().getTime() - keyboardPasteTimeStamp - clipboardDelay < 1000;
+ var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState;
+ var internal = hasContentType(clipboardContent, $_ceqsrthxjfuw8ptx.internalHtmlMime());
+ keyboardPastePlainTextState = false;
+ if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {
+ pasteBin.remove();
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hasContentType(clipboardContent, mimeType) {
- return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {
+ pasteBin.remove();
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isKeyboardPasteEvent(e) {
- return (VK.metaKeyPressed(e) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!isKeyBoardPaste) {
+ e.preventDefault();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function registerEventHandlers() {
- editor.on('keydown', function (e) {
- function removePasteBinOnKeyUp(e) {
- // Ctrl+V or Shift+Insert
- if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
- pasteBin.remove();
- }
- }
-
- // Ctrl+V or Shift+Insert
- if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {
- keyboardPastePlainTextState = e.shiftKey && e.keyCode == 86;
-
- // Edge case on Safari on Mac where it doesn't handle Cmd+Shift+V correctly
- // it fires the keydown but no paste or keyup so we are left with a paste bin
- if (keyboardPastePlainTextState && Env.webkit && navigator.userAgent.indexOf('Version/') != -1) {
- return;
- }
-
- // Prevent undoManager keydown handler from making an undo level with the pastebin in it
- e.stopImmediatePropagation();
-
- keyboardPasteTimeStamp = new Date().getTime();
-
- // IE doesn't support Ctrl+Shift+V and it doesn't even produce a paste event
- // so lets fake a paste event and let IE use the execCommand/dataTransfer methods
- if (Env.ie && keyboardPastePlainTextState) {
- e.preventDefault();
- editor.fire('paste', { ieFake: true });
- return;
- }
-
- pasteBin.remove();
- pasteBin.create();
-
- // Remove pastebin if we get a keyup and no paste event
- // For example pasting a file in IE 11 will not produce a paste event
- editor.once('keyup', removePasteBinOnKeyUp);
- editor.once('paste', function () {
- editor.off('keyup', removePasteBinOnKeyUp);
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (global$1.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {
+ pasteBin.create();
+ editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {
+ e.stopPropagation();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal) {
- var content, isPlainTextHtml;
-
- // Grab HTML from Clipboard API or paste bin as a fallback
- if (hasContentType(clipboardContent, 'text/html')) {
- content = clipboardContent['text/html'];
- } else {
- content = pasteBin.getHtml();
- internal = internal ? internal : InternalHtml.isMarked(content);
-
- // If paste bin is empty try using plain text mode
- // since that is better than nothing right
- if (pasteBin.isDefaultContent(content)) {
- plainTextMode = true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.getDoc().execCommand('Paste', false, null);
+ clipboardContent['text/html'] = pasteBin.getHtml();
+ }
+ if (hasContentType(clipboardContent, 'text/html')) {
+ e.preventDefault();
+ if (!internal) {
+ internal = $_ceqsrthxjfuw8ptx.isMarked(clipboardContent['text/html']);
+ }
+ insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
+ } else {
+ global$2.setEditorTimeout(editor, function () {
+ insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
+ }, 0);
+ }
+ });
+ };
+ var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) {
+ registerEventHandlers(editor, pasteBin, pasteFormat);
+ var src;
+ editor.parser.addNodeFilter('img', function (nodes, name, args) {
+ var isPasteInsert = function (args) {
+ return args.data && args.data.paste === true;
+ };
+ var remove = function (node) {
+ if (!node.attr('data-mce-object') && src !== global$1.transparentSrc) {
+ node.remove();
+ }
+ };
+ var isWebKitFakeUrl = function (src) {
+ return src.indexOf('webkit-fake-url') === 0;
+ };
+ var isDataUri = function (src) {
+ return src.indexOf('data:') === 0;
+ };
+ if (!editor.settings.paste_data_images && isPasteInsert(args)) {
+ var i = nodes.length;
+ while (i--) {
+ src = nodes[i].attributes.map.src;
+ if (!src) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- content = Utils.trimHtml(content);
-
- pasteBin.remove();
-
- isPlainTextHtml = (internal === false && Newlines.isPlainText(content));
-
- // If we got nothing from clipboard API and pastebin or the content is a plain text (with only
- // some BRs, Ps or DIVs as newlines) then we fallback to plain/text
- if (!content.length || isPlainTextHtml) {
- plainTextMode = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isWebKitFakeUrl(src)) {
+ remove(nodes[i]);
+ } else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {
+ remove(nodes[i]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Grab plain text from Clipboard API or convert existing HTML to plain text
- if (plainTextMode) {
- // Use plain text contents from Clipboard API unless the HTML contains paragraphs then
- // we should convert the HTML to plain text since works better when pasting HTML/Word contents as plain text
- if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) {
- content = clipboardContent['text/plain'];
- } else {
- content = Utils.innerText(content);
- }
- }
-
- // If the content is the paste bin default HTML then it was
- // impossible to get the cliboard data out.
- if (pasteBin.isDefaultContent(content)) {
- if (!isKeyBoardPaste) {
- editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');
- }
-
- return;
- }
-
- if (plainTextMode) {
- pasteText(content);
- } else {
- pasteHtml(content, internal);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getLastRng = function () {
- return pasteBin.getLastRng() || editor.selection.getRng();
- };
-
- editor.on('paste', function (e) {
- // Getting content from the Clipboard can take some time
- var clipboardTimer = new Date().getTime();
- var clipboardContent = getClipboardContent(e);
- var clipboardDelay = new Date().getTime() - clipboardTimer;
-
- var isKeyBoardPaste = (new Date().getTime() - keyboardPasteTimeStamp - clipboardDelay) < 1000;
- var plainTextMode = self.pasteFormat == "text" || keyboardPastePlainTextState;
- var internal = hasContentType(clipboardContent, InternalHtml.internalHtmlMime());
-
- keyboardPastePlainTextState = false;
-
- if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {
- pasteBin.remove();
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var create = function (editor, lastRngCell, pasteBinDefaultContent) {
+ var dom = editor.dom, body = editor.getBody();
+ var viewport = editor.dom.getViewPort(editor.getWin());
+ var scrollTop = viewport.y, top = 20;
+ var pasteBinElm;
+ var scrollContainer;
+ lastRngCell.set(editor.selection.getRng());
+ var lastRng = lastRngCell.get();
+ if (editor.inline) {
+ scrollContainer = editor.selection.getScrollContainer();
+ if (scrollContainer && scrollContainer.scrollTop > 0) {
+ scrollTop = scrollContainer.scrollTop;
+ }
+ }
+ function getCaretRect(rng) {
+ var rects, textNode, node;
+ var container = rng.startContainer;
+ rects = rng.getClientRects();
+ if (rects.length) {
+ return rects[0];
+ }
+ if (!rng.collapsed || container.nodeType !== 1) {
+ return;
+ }
+ node = container.childNodes[lastRng.startOffset];
+ while (node && node.nodeType === 3 && !node.data.length) {
+ node = node.nextSibling;
+ }
+ if (!node) {
+ return;
+ }
+ if (node.tagName === 'BR') {
+ textNode = dom.doc.createTextNode('\uFEFF');
+ node.parentNode.insertBefore(textNode, node);
+ rng = dom.createRng();
+ rng.setStartBefore(textNode);
+ rng.setEndAfter(textNode);
+ rects = rng.getClientRects();
+ dom.remove(textNode);
+ }
+ if (rects.length) {
+ return rects[0];
+ }
+ }
+ if (lastRng.getClientRects) {
+ var rect = getCaretRect(lastRng);
+ if (rect) {
+ top = scrollTop + (rect.top - dom.getPos(body).y);
+ } else {
+ top = scrollTop;
+ var container = lastRng.startContainer;
+ if (container) {
+ if (container.nodeType === 3 && container.parentNode !== body) {
+ container = container.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!hasHtmlOrText(clipboardContent) && pasteImageData(e, getLastRng())) {
- pasteBin.remove();
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (container.nodeType === 1) {
+ top = dom.getPos(container, scrollContainer || body).y;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Not a keyboard paste prevent default paste and try to grab the clipboard contents using different APIs
- if (!isKeyBoardPaste) {
- e.preventDefault();
- }
-
- // Try IE only method if paste isn't a keyboard paste
- if (Env.ie && (!isKeyBoardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {
- pasteBin.create();
-
- editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {
- e.stopPropagation();
- });
-
- editor.getDoc().execCommand('Paste', false, null);
- clipboardContent["text/html"] = pasteBin.getHtml();
- }
-
- // If clipboard API has HTML then use that directly
- if (hasContentType(clipboardContent, 'text/html')) {
- e.preventDefault();
-
- // if clipboard lacks internal mime type, inspect html for internal markings
- if (!internal) {
- internal = InternalHtml.isMarked(clipboardContent['text/html']);
- }
-
- insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
- } else {
- Delay.setEditorTimeout(editor, function () {
- insertClipboardContent(clipboardContent, isKeyBoardPaste, plainTextMode, internal);
- }, 0);
- }
- });
-
- editor.on('dragstart dragend', function (e) {
- draggingInternally = e.type == 'dragstart';
- });
-
- function isPlainTextFileUrl(content) {
- var plainTextContent = content['text/plain'];
- return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.on('drop', function (e) {
- var dropContent, rng;
-
- rng = getCaretRangeFromEvent(e);
-
- if (e.isDefaultPrevented() || draggingInternally) {
- return;
- }
-
- dropContent = getDataTransferItems(e.dataTransfer);
- var internal = hasContentType(dropContent, InternalHtml.internalHtmlMime());
-
- if ((!hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && pasteImageData(e, rng)) {
- return;
- }
-
- if (rng && editor.settings.paste_filter_drop !== false) {
- var content = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
-
- if (content) {
- e.preventDefault();
-
- // FF 45 doesn't paint a caret when dragging in text in due to focus call by execCommand
- Delay.setEditorTimeout(editor, function () {
- editor.undoManager.transact(function () {
- if (dropContent['mce-internal']) {
- editor.execCommand('Delete');
- }
-
- editor.selection.setRng(rng);
-
- content = Utils.trimHtml(content);
-
- if (!dropContent['text/html']) {
- pasteText(content);
- } else {
- pasteHtml(content, internal);
- }
- });
- });
- }
- }
- });
-
- editor.on('dragover dragend', function (e) {
- if (editor.settings.paste_data_images) {
- e.preventDefault();
- }
- });
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.pasteHtml = pasteHtml;
- self.pasteText = pasteText;
- self.pasteImageData = pasteImageData;
-
- editor.on('preInit', function () {
- registerEventHandlers();
-
- // Remove all data images from paste for example from Gecko
- // except internal images like video elements
- editor.parser.addNodeFilter('img', function (nodes, name, args) {
- function isPasteInsert(args) {
- return args.data && args.data.paste === true;
- }
-
- function remove(node) {
- if (!node.attr('data-mce-object') && src !== Env.transparentSrc) {
- node.remove();
- }
- }
-
- function isWebKitFakeUrl(src) {
- return src.indexOf("webkit-fake-url") === 0;
- }
-
- function isDataUri(src) {
- return src.indexOf("data:") === 0;
- }
-
- if (!editor.settings.paste_data_images && isPasteInsert(args)) {
- var i = nodes.length;
-
- while (i--) {
- var src = nodes[i].attributes.map.src;
-
- if (!src) {
- continue;
- }
-
- // Safari on Mac produces webkit-fake-url see: https://bugs.webkit.org/show_bug.cgi?id=49141
- if (isWebKitFakeUrl(src)) {
- remove(nodes[i]);
- } else if (!editor.settings.allow_html_data_urls && isDataUri(src)) {
- remove(nodes[i]);
- }
- }
- }
- });
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ pasteBinElm = editor.dom.add(editor.getBody(), 'div', {
+ 'id': 'mcepastebin',
+ 'contentEditable': true,
+ 'data-mce-bogus': 'all',
+ 'style': 'position: absolute; top: ' + top + 'px; width: 10px; height: 10px; overflow: hidden; opacity: 0'
+ }, pasteBinDefaultContent);
+ if (global$1.ie || global$1.gecko) {
+ dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535);
+ }
+ dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {
+ e.stopPropagation();
+ });
+ pasteBinElm.focus();
+ editor.selection.select(pasteBinElm, true);
+ };
+ var remove = function (editor, lastRngCell) {
+ if (getEl(editor)) {
+ var pasteBinClone = void 0;
+ var lastRng = lastRngCell.get();
+ while (pasteBinClone = editor.dom.get('mcepastebin')) {
+ editor.dom.remove(pasteBinClone);
+ editor.dom.unbind(pasteBinClone);
+ }
+ if (lastRng) {
+ editor.selection.setRng(lastRng);
+ }
+ }
+ lastRngCell.set(null);
+ };
+ var getEl = function (editor) {
+ return editor.dom.get('mcepastebin');
+ };
+ var getHtml = function (editor) {
+ var pasteBinElm, pasteBinClones, i, dirtyWrappers, cleanWrapper;
+ var copyAndRemove = function (toElm, fromElm) {
+ toElm.appendChild(fromElm);
+ editor.dom.remove(fromElm, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * CutCopy.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.plugins.paste.core.CutCopy',
- [
- 'tinymce.core.Env',
- 'tinymce.plugins.paste.core.InternalHtml',
- 'tinymce.plugins.paste.core.Utils'
- ],
- function (Env, InternalHtml, Utils) {
- var noop = function () {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ pasteBinClones = global$3.grep(editor.getBody().childNodes, function (elm) {
+ return elm.id === 'mcepastebin';
+ });
+ pasteBinElm = pasteBinClones.shift();
+ global$3.each(pasteBinClones, function (pasteBinClone) {
+ copyAndRemove(pasteBinElm, pasteBinClone);
+ });
+ dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm);
+ for (i = dirtyWrappers.length - 1; i >= 0; i--) {
+ cleanWrapper = editor.dom.create('div');
+ pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]);
+ copyAndRemove(cleanWrapper, dirtyWrappers[i]);
+ }
+ return pasteBinElm ? pasteBinElm.innerHTML : '';
+ };
+ var getLastRng = function (lastRng) {
+ return lastRng.get();
+ };
+ var isDefaultContent = function (pasteBinDefaultContent, content) {
+ return content === pasteBinDefaultContent;
+ };
+ var isPasteBin = function (elm) {
+ return elm && elm.id === 'mcepastebin';
+ };
+ var isDefault = function (editor, pasteBinDefaultContent) {
+ var pasteBinElm = getEl(editor);
+ return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML);
+ };
+ var PasteBin = function (editor) {
+ var lastRng = Cell(null);
+ var pasteBinDefaultContent = '%MCEPASTEBIN%';
+ return {
+ create: function () {
+ return create(editor, lastRng, pasteBinDefaultContent);
+ },
+ remove: function () {
+ return remove(editor, lastRng);
+ },
+ getEl: function () {
+ return getEl(editor);
+ },
+ getHtml: function () {
+ return getHtml(editor);
+ },
+ getLastRng: function () {
+ return getLastRng(lastRng);
+ },
+ isDefault: function () {
+ return isDefault(editor, pasteBinDefaultContent);
+ },
+ isDefaultContent: function (content) {
+ return isDefaultContent(pasteBinDefaultContent, content);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var hasWorkingClipboardApi = function (clipboardData) {
- // iOS supports the clipboardData API but it doesn't do anything for cut operations
- // Edge 15 has a broken HTML Clipboard API see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11780845/
- return Env.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && Utils.isMsEdge() !== true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Clipboard = function (editor, pasteFormat) {
+ var pasteBin = PasteBin(editor);
+ editor.on('preInit', function () {
+ return registerEventsAndFilters(editor, pasteBin, pasteFormat);
+ });
+ return {
+ pasteFormat: pasteFormat,
+ pasteHtml: function (html, internalFlag) {
+ return pasteHtml$1(editor, html, internalFlag);
+ },
+ pasteText: function (text) {
+ return pasteText(editor, text);
+ },
+ pasteImageData: function (e, rng) {
+ return pasteImageData(editor, e, rng);
+ },
+ getDataTransferItems: getDataTransferItems,
+ hasHtmlOrText: hasHtmlOrText,
+ hasContentType: hasContentType
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var setHtml5Clipboard = function (clipboardData, html, text) {
- if (hasWorkingClipboardApi(clipboardData)) {
- try {
- clipboardData.clearData();
- clipboardData.setData('text/html', html);
- clipboardData.setData('text/plain', text);
- clipboardData.setData(InternalHtml.internalHtmlMime(), html);
- return true;
- } catch (e) {
- return false;
- }
- } else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var noop = function () {
+ };
+ var hasWorkingClipboardApi = function (clipboardData) {
+ return global$1.iOS === false && clipboardData !== undefined && typeof clipboardData.setData === 'function' && $_cedk7ri6jfuw8pud.isMsEdge() !== true;
+ };
+ var setHtml5Clipboard = function (clipboardData, html, text) {
+ if (hasWorkingClipboardApi(clipboardData)) {
+ try {
+ clipboardData.clearData();
+ clipboardData.setData('text/html', html);
+ clipboardData.setData('text/plain', text);
+ clipboardData.setData($_ceqsrthxjfuw8ptx.internalHtmlMime(), html);
+ return true;
+ } catch (e) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var setClipboardData = function (evt, data, fallback, done) {
- if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) {
- evt.preventDefault();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ return false;
+ }
+ };
+ var setClipboardData = function (evt, data, fallback, done) {
+ if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) {
+ evt.preventDefault();
+ done();
+ } else {
+ fallback(data.html, done);
+ }
+ };
+ var fallback = function (editor) {
+ return function (html, done) {
+ var markedHtml = $_ceqsrthxjfuw8ptx.mark(html);
+ var outer = editor.dom.create('div', {
+ 'contenteditable': 'false',
+ 'data-mce-bogus': 'all'
+ });
+ var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml);
+ editor.dom.setStyles(outer, {
+ position: 'fixed',
+ top: '0',
+ left: '-3000px',
+ width: '1000px',
+ overflow: 'hidden'
+ });
+ outer.appendChild(inner);
+ editor.dom.add(editor.getBody(), outer);
+ var range = editor.selection.getRng();
+ inner.focus();
+ var offscreenRange = editor.dom.createRng();
+ offscreenRange.selectNodeContents(inner);
+ editor.selection.setRng(offscreenRange);
+ setTimeout(function () {
+ editor.selection.setRng(range);
+ outer.parentNode.removeChild(outer);
</ins><span class="cx" style="display: block; padding: 0 10px"> done();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- fallback(data.html, done);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var fallback = function (editor) {
- return function (html, done) {
- var markedHtml = InternalHtml.mark(html);
- var outer = editor.dom.create('div', {
- contenteditable: "false",
- "data-mce-bogus": "all"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getData = function (editor) {
+ return {
+ html: editor.selection.getContent({ contextual: true }),
+ text: editor.selection.getContent({ format: 'text' })
+ };
+ };
+ var cut = function (editor) {
+ return function (evt) {
+ if (editor.selection.isCollapsed() === false) {
+ setClipboardData(evt, getData(editor), fallback(editor), function () {
+ setTimeout(function () {
+ editor.execCommand('Delete');
+ }, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var inner = editor.dom.create('div', { contenteditable: "true" }, markedHtml);
- editor.dom.setStyles(outer, {
- position: 'fixed',
- left: '-3000px',
- width: '1000px',
- overflow: 'hidden'
- });
- outer.appendChild(inner);
- editor.dom.add(editor.getBody(), outer);
-
- var range = editor.selection.getRng();
- inner.focus();
-
- var offscreenRange = editor.dom.createRng();
- offscreenRange.selectNodeContents(inner);
- editor.selection.setRng(offscreenRange);
-
- setTimeout(function () {
- outer.parentNode.removeChild(outer);
- editor.selection.setRng(range);
- done();
- }, 0);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getData = function (editor) {
- return {
- html: editor.selection.getContent({ contextual: true }),
- text: editor.selection.getContent({ format: 'text' })
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var copy = function (editor) {
+ return function (evt) {
+ if (editor.selection.isCollapsed() === false) {
+ setClipboardData(evt, getData(editor), fallback(editor), noop);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var register$1 = function (editor) {
+ editor.on('cut', cut(editor));
+ editor.on('copy', copy(editor));
+ };
+ var $_cphe9ai9jfuw8puq = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var cut = function (editor) {
- return function (evt) {
- if (editor.selection.isCollapsed() === false) {
- setClipboardData(evt, getData(editor), fallback(editor), function () {
- // Chrome fails to execCommand from another execCommand with this message:
- // "We don't execute document.execCommand() this time, because it is called recursively.""
- setTimeout(function () { // detach
- editor.execCommand('Delete');
- }, 0);
- });
- }
- };
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$10 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var copy = function (editor) {
- return function (evt) {
- if (editor.selection.isCollapsed() === false) {
- setClipboardData(evt, getData(editor), fallback(editor), noop);
- }
- };
- };
-
- var register = function (editor) {
- editor.on('cut', cut(editor));
- editor.on('copy', copy(editor));
- };
-
- return {
- register: register
- };
- }
-);
-/**
- * Quirks.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains various fixes for browsers. These issues can not be feature
- * detected since we have no direct control over the clipboard. However we might be able
- * to remove some of these fixes once the browsers gets updated/fixed.
- *
- * @class tinymce.pasteplugin.Quirks
- * @private
- */
-define(
- 'tinymce.plugins.paste.core.Quirks',
- [
- 'tinymce.core.Env',
- 'tinymce.core.util.Tools',
- 'tinymce.plugins.paste.core.WordFilter',
- 'tinymce.plugins.paste.core.Utils'
- ],
- function (Env, Tools, WordFilter, Utils) {
- function addPreProcessFilter(editor, filterFunc) {
- editor.on('PastePreProcess', function (e) {
- e.content = filterFunc(editor, e.content, e.internal, e.wordContent);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getCaretRangeFromEvent = function (editor, e) {
+ return global$10.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc());
+ };
+ var isPlainTextFileUrl = function (content) {
+ var plainTextContent = content['text/plain'];
+ return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false;
+ };
+ var setFocusedRange = function (editor, rng) {
+ editor.focus();
+ editor.selection.setRng(rng);
+ };
+ var setup = function (editor, clipboard, draggingInternallyState) {
+ if ($_dls6llhqjfuw8ptf.shouldBlockDrop(editor)) {
+ editor.on('dragend dragover draggesture dragdrop drop drag', function (e) {
+ e.preventDefault();
+ e.stopPropagation();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function addPostProcessFilter(editor, filterFunc) {
- editor.on('PastePostProcess', function (e) {
- filterFunc(editor, e.node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!$_dls6llhqjfuw8ptf.shouldPasteDataImages(editor)) {
+ editor.on('drop', function (e) {
+ var dataTransfer = e.dataTransfer;
+ if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
+ e.preventDefault();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Removes BR elements after block elements. IE9 has a nasty bug where it puts a BR element after each
- * block element when pasting from word. This removes those elements.
- *
- * This:
- * <p>a</p><br><p>b</p>
- *
- * Becomes:
- * <p>a</p><p>b</p>
- */
- function removeExplorerBrElementsAfterBlocks(editor, html) {
- // Only filter word specific content
- if (!WordFilter.isWordContent(html)) {
- return html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('drop', function (e) {
+ var dropContent, rng;
+ rng = getCaretRangeFromEvent(editor, e);
+ if (e.isDefaultPrevented() || draggingInternallyState.get()) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Produce block regexp based on the block elements in schema
- var blockElements = [];
-
- Tools.each(editor.schema.getBlockElements(), function (block, blockName) {
- blockElements.push(blockName);
- });
-
- var explorerBlocksRegExp = new RegExp(
- '(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*',
- 'g'
- );
-
- // Remove BR:s from: <BLOCK>X</BLOCK><BR>
- html = Utils.filter(html, [
- [explorerBlocksRegExp, '$1']
- ]);
-
- // IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
- html = Utils.filter(html, [
- [/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact
- [/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s
- [/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR
- ]);
-
- return html;
- }
-
- /**
- * WebKit has a nasty bug where the all computed styles gets added to style attributes when copy/pasting contents.
- * This fix solves that by simply removing the whole style attribute.
- *
- * The paste_webkit_styles option can be set to specify what to keep:
- * paste_webkit_styles: "none" // Keep no styles
- * paste_webkit_styles: "all", // Keep all of them
- * paste_webkit_styles: "font-weight color" // Keep specific ones
- */
- function removeWebKitStyles(editor, content, internal, isWordHtml) {
- // WordFilter has already processed styles at this point and internal doesn't need any processing
- if (isWordHtml || internal) {
- return content;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dropContent = clipboard.getDataTransferItems(e.dataTransfer);
+ var internal = clipboard.hasContentType(dropContent, $_ceqsrthxjfuw8ptx.internalHtmlMime());
+ if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Filter away styles that isn't matching the target node
- var webKitStyles = editor.settings.paste_webkit_styles;
-
- if (editor.settings.paste_remove_styles_if_webkit === false || webKitStyles == "all") {
- return content;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (rng && $_dls6llhqjfuw8ptf.shouldFilterDrop(editor)) {
+ var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];
+ if (content_1) {
+ e.preventDefault();
+ global$2.setEditorTimeout(editor, function () {
+ editor.undoManager.transact(function () {
+ if (dropContent['mce-internal']) {
+ editor.execCommand('Delete');
+ }
+ setFocusedRange(editor, rng);
+ content_1 = $_cedk7ri6jfuw8pud.trimHtml(content_1);
+ if (!dropContent['text/html']) {
+ clipboard.pasteText(content_1);
+ } else {
+ clipboard.pasteHtml(content_1, internal);
+ }
+ });
+ });
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (webKitStyles) {
- webKitStyles = webKitStyles.split(/[, ]/);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('dragstart', function (e) {
+ draggingInternallyState.set(true);
+ });
+ editor.on('dragover dragend', function (e) {
+ if ($_dls6llhqjfuw8ptf.shouldPasteDataImages(editor) && draggingInternallyState.get() === false) {
+ e.preventDefault();
+ setFocusedRange(editor, getCaretRangeFromEvent(editor, e));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Keep specific styles that doesn't match the current node computed style
- if (webKitStyles) {
- var dom = editor.dom, node = editor.selection.getNode();
-
- content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) {
- var inputStyles = dom.parseStyle(dom.decode(value), 'span');
- var outputStyles = {};
-
- if (webKitStyles === "none") {
- return before + after;
- }
-
- for (var i = 0; i < webKitStyles.length; i++) {
- var inputValue = inputStyles[webKitStyles[i]], currentValue = dom.getStyle(node, webKitStyles[i], true);
-
- if (/color/.test(webKitStyles[i])) {
- inputValue = dom.toHex(inputValue);
- currentValue = dom.toHex(currentValue);
- }
-
- if (currentValue != inputValue) {
- outputStyles[webKitStyles[i]] = inputValue;
- }
- }
-
- outputStyles = dom.serializeStyle(outputStyles, 'span');
- if (outputStyles) {
- return before + ' style="' + outputStyles + '"' + after;
- }
-
- return before + after;
- });
- } else {
- // Remove all external styles
- content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (e.type === 'dragend') {
+ draggingInternallyState.set(false);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var $_2uhmpriajfuw8put = { setup: setup };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Keep internal styles
- content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) {
- return before + ' style="' + value + '"' + after;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setup$1 = function (editor) {
+ var plugin = editor.plugins.paste;
+ var preProcess = $_dls6llhqjfuw8ptf.getPreProcess(editor);
+ if (preProcess) {
+ editor.on('PastePreProcess', function (e) {
+ preProcess.call(plugin, plugin, e);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return content;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function removeUnderlineAndFontInAnchor(editor, root) {
- editor.$('a', root).find('font,u').each(function (i, node) {
- editor.dom.remove(node, true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var postProcess = $_dls6llhqjfuw8ptf.getPostProcess(editor);
+ if (postProcess) {
+ editor.on('PastePostProcess', function (e) {
+ postProcess.call(plugin, plugin, e);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_84oppricjfuw8pux = { setup: setup$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var setup = function (editor) {
- if (Env.webkit) {
- addPreProcessFilter(editor, removeWebKitStyles);
- }
-
- if (Env.ie) {
- addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks);
- addPostProcessFilter(editor, removeUnderlineAndFontInAnchor);
- }
- };
-
- return {
- setup: setup
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function addPreProcessFilter(editor, filterFunc) {
+ editor.on('PastePreProcess', function (e) {
+ e.content = filterFunc(editor, e.content, e.internal, e.wordContent);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains all core logic for the paste plugin.
- *
- * @class tinymce.paste.Plugin
- * @private
- */
-define(
- 'tinymce.plugins.paste.Plugin',
- [
- 'tinymce.core.PluginManager',
- 'tinymce.plugins.paste.api.Events',
- 'tinymce.plugins.paste.core.Clipboard',
- 'tinymce.plugins.paste.core.CutCopy',
- 'tinymce.plugins.paste.core.Quirks'
- ],
- function (PluginManager, Events, Clipboard, CutCopy, Quirks) {
- var userIsInformed;
-
- PluginManager.add('paste', function (editor) {
- var self = this, clipboard, settings = editor.settings;
-
- function isUserInformedAboutPlainText() {
- return userIsInformed || editor.settings.paste_plaintext_inform === false;
- }
-
- function togglePlainTextPaste() {
- if (clipboard.pasteFormat == "text") {
- clipboard.pasteFormat = "html";
- Events.firePastePlainTextToggle(editor, false);
- } else {
- clipboard.pasteFormat = "text";
- Events.firePastePlainTextToggle(editor, true);
-
- if (!isUserInformedAboutPlainText()) {
- var message = editor.translate('Paste is now in plain text mode. Contents will now ' +
- 'be pasted as plain text until you toggle this option off.');
-
- editor.notificationManager.open({
- text: message,
- type: 'info'
- });
-
- userIsInformed = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function addPostProcessFilter(editor, filterFunc) {
+ editor.on('PastePostProcess', function (e) {
+ filterFunc(editor, e.node);
+ });
+ }
+ function removeExplorerBrElementsAfterBlocks(editor, html) {
+ if (!$_8q8fy4i1jfuw8pu5.isWordContent(html)) {
+ return html;
+ }
+ var blockElements = [];
+ global$3.each(editor.schema.getBlockElements(), function (block, blockName) {
+ blockElements.push(blockName);
+ });
+ var explorerBlocksRegExp = new RegExp('(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*', 'g');
+ html = $_cedk7ri6jfuw8pud.filter(html, [[
+ explorerBlocksRegExp,
+ '$1'
+ ]]);
+ html = $_cedk7ri6jfuw8pud.filter(html, [
+ [
+ /<br><br>/g,
+ '<BR><BR>'
+ ],
+ [
+ /<br>/g,
+ ' '
+ ],
+ [
+ /<BR><BR>/g,
+ '<br>'
+ ]
+ ]);
+ return html;
+ }
+ function removeWebKitStyles(editor, content, internal, isWordHtml) {
+ if (isWordHtml || internal) {
+ return content;
+ }
+ var webKitStylesSetting = $_dls6llhqjfuw8ptf.getWebkitStyles(editor);
+ var webKitStyles;
+ if ($_dls6llhqjfuw8ptf.shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') {
+ return content;
+ }
+ if (webKitStylesSetting) {
+ webKitStyles = webKitStylesSetting.split(/[, ]/);
+ }
+ if (webKitStyles) {
+ var dom_1 = editor.dom, node_1 = editor.selection.getNode();
+ content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, function (all, before, value, after) {
+ var inputStyles = dom_1.parseStyle(dom_1.decode(value));
+ var outputStyles = {};
+ if (webKitStyles === 'none') {
+ return before + after;
+ }
+ for (var i = 0; i < webKitStyles.length; i++) {
+ var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true);
+ if (/color/.test(webKitStyles[i])) {
+ inputValue = dom_1.toHex(inputValue);
+ currentValue = dom_1.toHex(currentValue);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (currentValue !== inputValue) {
+ outputStyles[webKitStyles[i]] = inputValue;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.focus();
- }
-
- function stateChange() {
- var self = this;
-
- self.active(clipboard.pasteFormat === 'text');
-
- editor.on('PastePlainTextToggle', function (e) {
- self.active(e.state);
- });
- }
-
- // draw back if power version is requested and registered
- if (/(^|[ ,])powerpaste([, ]|$)/.test(settings.plugins) && PluginManager.get('powerpaste')) {
- /*eslint no-console:0 */
- if (typeof console !== "undefined" && console.log) {
- console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option.");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ outputStyles = dom_1.serializeStyle(outputStyles, 'span');
+ if (outputStyles) {
+ return before + ' style="' + outputStyles + '"' + after;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return before + after;
+ });
+ } else {
+ content = content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi, '$1$3');
+ }
+ content = content.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi, function (all, before, value, after) {
+ return before + ' style="' + value + '"' + after;
+ });
+ return content;
+ }
+ function removeUnderlineAndFontInAnchor(editor, root) {
+ editor.$('a', root).find('font,u').each(function (i, node) {
+ editor.dom.remove(node, true);
+ });
+ }
+ var setup$2 = function (editor) {
+ if (global$1.webkit) {
+ addPreProcessFilter(editor, removeWebKitStyles);
+ }
+ if (global$1.ie) {
+ addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks);
+ addPostProcessFilter(editor, removeUnderlineAndFontInAnchor);
+ }
+ };
+ var $_6bnerjidjfuw8puz = { setup: setup$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.clipboard = clipboard = new Clipboard(editor);
- self.quirks = Quirks.setup(editor);
-
- if (editor.settings.paste_as_text) {
- self.clipboard.pasteFormat = "text";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var noop$1 = function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ };
+ var noarg = function (f) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.paste_preprocess) {
- editor.on('PastePreProcess', function (e) {
- settings.paste_preprocess.call(self, self, e);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return f();
+ };
+ };
+ var compose = function (fa, fb) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.paste_postprocess) {
- editor.on('PastePostProcess', function (e) {
- settings.paste_postprocess.call(self, self, e);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return fa(fb.apply(null, arguments));
+ };
+ };
+ var constant = function (value) {
+ return function () {
+ return value;
+ };
+ };
+ var identity = function (x) {
+ return x;
+ };
+ var tripleEquals = function (a, b) {
+ return a === b;
+ };
+ var curry = function (f) {
+ var x = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ x[_i - 1] = arguments[_i];
+ }
+ var args = new Array(arguments.length - 1);
+ for (var i = 1; i < arguments.length; i++)
+ args[i - 1] = arguments[i];
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.addCommand('mceInsertClipboardContent', function (ui, value) {
- if (value.content) {
- self.clipboard.pasteHtml(value.content, value.internal);
- }
-
- if (value.text) {
- self.clipboard.pasteText(value.text);
- }
- });
-
- // Block all drag/drop events
- if (editor.settings.paste_block_drop) {
- editor.on('dragend dragover draggesture dragdrop drop drag', function (e) {
- e.preventDefault();
- e.stopPropagation();
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var newArgs = new Array(arguments.length);
+ for (var j = 0; j < newArgs.length; j++)
+ newArgs[j] = arguments[j];
+ var all = args.concat(newArgs);
+ return f.apply(null, all);
+ };
+ };
+ var not = function (f) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return !f.apply(null, arguments);
+ };
+ };
+ var die = function (msg) {
+ return function () {
+ throw new Error(msg);
+ };
+ };
+ var apply = function (f) {
+ return f();
+ };
+ var call = function (f) {
+ f();
+ };
+ var never = constant(false);
+ var always = constant(true);
+ var $_avmd1ifjfuw8pv5 = {
+ noop: noop$1,
+ noarg: noarg,
+ compose: compose,
+ constant: constant,
+ identity: identity,
+ tripleEquals: tripleEquals,
+ curry: curry,
+ not: not,
+ die: die,
+ apply: apply,
+ call: call,
+ never: never,
+ always: always
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Prevent users from dropping data images on Gecko
- if (!editor.settings.paste_data_images) {
- editor.on('drop', function (e) {
- var dataTransfer = e.dataTransfer;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var stateChange = function (editor, clipboard, e) {
+ var ctrl = e.control;
+ ctrl.active(clipboard.pasteFormat.get() === 'text');
+ editor.on('PastePlainTextToggle', function (e) {
+ ctrl.active(e.state);
+ });
+ };
+ var register$2 = function (editor, clipboard) {
+ var postRender = $_avmd1ifjfuw8pv5.curry(stateChange, editor, clipboard);
+ editor.addButton('pastetext', {
+ active: false,
+ icon: 'pastetext',
+ tooltip: 'Paste as text',
+ cmd: 'mceTogglePlainTextPaste',
+ onPostRender: postRender
+ });
+ editor.addMenuItem('pastetext', {
+ text: 'Paste as text',
+ selectable: true,
+ active: clipboard.pasteFormat,
+ cmd: 'mceTogglePlainTextPaste',
+ onPostRender: postRender
+ });
+ };
+ var $_3d07oyiejfuw8pv2 = { register: register$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {
- e.preventDefault();
- }
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('paste', function (editor) {
+ if ($_5e30n7hljfuw8pt8.hasProPlugin(editor) === false) {
+ var userIsInformedState = Cell(false);
+ var draggingInternallyState = Cell(false);
+ var pasteFormat = Cell($_dls6llhqjfuw8ptf.isPasteAsTextEnabled(editor) ? 'text' : 'html');
+ var clipboard = Clipboard(editor, pasteFormat);
+ var quirks = $_6bnerjidjfuw8puz.setup(editor);
+ $_3d07oyiejfuw8pv2.register(editor, clipboard);
+ $_a15l7thnjfuw8pta.register(editor, clipboard, userIsInformedState);
+ $_84oppricjfuw8pux.setup(editor);
+ $_cphe9ai9jfuw8puq.register(editor);
+ $_2uhmpriajfuw8put.setup(editor, clipboard, draggingInternallyState);
+ return $_4xrki5hmjfuw8pta.get(clipboard, quirks);
+ }
+ });
+ function Plugin () {
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addCommand('mceTogglePlainTextPaste', togglePlainTextPaste);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addButton('pastetext', {
- icon: 'pastetext',
- tooltip: 'Paste as text',
- onclick: togglePlainTextPaste,
- onPostRender: stateChange
- });
-
- editor.addMenuItem('pastetext', {
- text: 'Paste as text',
- selectable: true,
- active: clipboard.pasteFormat,
- onclick: togglePlainTextPaste,
- onPostRender: stateChange
- });
-
- CutCopy.register(editor);
- });
-
- return function () { };
- }
-);
-dem('tinymce.plugins.paste.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginspastepluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/paste/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/paste/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/paste/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("6",tinymce.util.Tools.resolve),g("1",[&q
uot;6"],function(a){return a("tinymce.PluginManager")}),g("2",[],function(){var a=function(a,b,c,d){return a.fire("PastePreProcess",{content:b,internal:c,wordContent:d})},b=function(a,b,c,d){return a.fire("PastePostProcess",{node:b,internal:c,wordContent:d})},c=function(a,b){return a.fire("PastePlainTextToggle",{state:b})};return{firePastePreProcess:a,firePastePostProcess:b,firePastePlainTextToggle:c}}),g("7",["6"],function(a){return a("tinymce.dom.RangeUtils")}),g("8",["6"],function(a){return a("tinymce.Env")}),g("9",["6"],function(a){return a("tinymce.util.Delay")}),g("a",["6"],function(a){return a("tinymce.util.Tools")}),g("b",["6"],function(a){return a("tinymce.util.VK")}),g("c",[],function(){var a="x-tinymce/html",b="<!-- "+a+" -->"
;,c=function(a){return b+a},d=function(a){return a.replace(b,"")},e=function(a){return a.indexOf(b)!==-1};return{mark:c,unmark:d,isMarked:e,internalHtmlMime:function(){return a}}}),g("j",["6"],function(a){return a("tinymce.html.Entities")}),g("d",["a","j"],function(a,b){var c=function(a){return!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(a)},d=function(a){return a.replace(/\r?\n/g,"<br>")},e=function(a,c){var d,e=[],f="<"+a;if("object"==typeof c){for(d in c)c.hasOwnProperty(d)&&e.push(d+'="'+b.encodeAllRaw(c[d])+'"');e.length&&(f+=" "+e.join(" "))}return f+">"},f=function(b,c,d){var f=b.split(/\n\n/),g=e(c,d),h="</"+c+">",i=a.map(f,function(a){return a.split(/\n/).join("<br />")}),j=fu
nction(a){return g+a+h};return 1===i.length?i[0]:a.map(i,j).join("")},g=function(a,b,c){return b?f(a,b,c):d(a)};return{isPlainText:c,convert:g,toBRs:d,toBlockElements:f}}),g("e",["a","8"],function(a,b){return function(c){var d,e="%MCEPASTEBIN%",f=function(){function a(a){var b,c,e,f=a.startContainer;if(b=a.getClientRects(),b.length)return b[0];if(a.collapsed&&1==f.nodeType){for(e=f.childNodes[d.startOffset];e&&3==e.nodeType&&!e.data.length;)e=e.nextSibling;if(e)return"BR"==e.tagName&&(c=h.doc.createTextNode("\ufeff"),e.parentNode.insertBefore(c,e),a=h.createRng(),a.setStartBefore(c),a.setEndAfter(c),b=a.getClientRects(),h.remove(c)),b.length?b[0]:void 0}}var f,g,h=c.dom,i=c.getBody(),j=c.dom.getViewPort(c.getWin()),k=j.y,l=20;if(d=c.selection.getRng(),c.inline&&(g=c.selection.getScrollContainer(),g&&g.scrollTop>0&&(k=g.scrollTop)),d.getClientRects){var m=a
(d);if(m)l=k+(m.top-h.getPos(i).y);else{l=k;var n=d.startContainer;n&&(3==n.nodeType&&n.parentNode!=i&&(n=n.parentNode),1==n.nodeType&&(l=h.getPos(n,g||i).y))}}f=c.dom.add(c.getBody(),"div",{id:"mcepastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: absolute; top: "+l+"px; width: 10px; height: 10px; overflow: hidden; opacity: 0"},e),(b.ie||b.gecko)&&h.setStyle(f,"left","rtl"==h.getStyle(i,"direction",!0)?65535:-65535),h.bind(f,"beforedeactivate focusin focusout",function(a){a.stopPropagation()}),f.focus(),c.selection.select(f,!0)},g=function(){if(h()){for(var a;a=c.dom.get("mcepastebin");)c.dom.remove(a),c.dom.unbind(a);d&&c.selection.setRng(d)}d=null},h=function(){return c.dom.get("mcepastebin")},i=function(){var b,d,e,f,g,h=function(a,b){a.appendChild(b),c.dom.remove(b,!0)};for(d=a.grep(c.getBody().
childNodes,function(a){return"mcepastebin"===a.id}),b=d.shift(),a.each(d,function(a){h(b,a)}),f=c.dom.select("div[id=mcepastebin]",b),e=f.length-1;e>=0;e--)g=c.dom.create("div"),b.insertBefore(g,f[e]),h(g,f[e]);return b?b.innerHTML:""},j=function(){return d},k=function(a){return a===e},l=function(a){return a&&"mcepastebin"===a.id},m=function(){var a=h();return l(a)&&k(a.innerHTML)};return{create:f,remove:g,getEl:h,getHtml:i,getLastRng:j,isDefault:m,isDefaultContent:k}}}),g("k",["6"],function(a){return a("tinymce.html.DomParser")}),g("l",["6"],function(a){return a("tinymce.html.Schema")}),g("m",["6"],function(a){return a("tinymce.html.Serializer")}),g("n",["6"],function(a){return a("tinymce.html.Node")}),g("h",["a","k","l"],function(a,b,c){function d(b,c){ret
urn a.each(c,function(a){b=a.constructor==RegExp?b.replace(a,""):b.replace(a[0],a[1])}),b}function e(e){function f(a){var b=a.name,c=a;if("br"===b)return void(i+="\n");if(j[b]&&(i+=" "),k[b])return void(i+=" ");if(3==a.type&&(i+=a.value),!a.shortEnded&&(a=a.firstChild))do f(a);while(a=a.next);l[b]&&c.next&&(i+="\n","p"==b&&(i+="\n"))}var g=new c,h=new b({},g),i="",j=g.getShortEndedElements(),k=a.makeMap("script noscript style textarea video audio iframe object"," "),l=g.getBlockElements();return e=d(e,[/<!\[[^\]]+\]>/g]),f(h.parse(e)),i}function f(a){function b(a,b,c){return b||c?"\xa0":" "}return a=d(a,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span&g
t;( ?)/g,b],/<br class="Apple-interchange-newline">/g,/<br>$/i])}function g(a){var b=0;return function(){return a+b++}}var h=function(){return navigator.userAgent.indexOf(" Edge/")!==-1};return{filter:d,innerText:e,trimHtml:f,createIdGenerator:g,isMsEdge:h}}),g("i",["a","k","l","m","n","h"],function(a,b,c,d,e,f){function g(a){return/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(a)||/class="OutlineElement/.test(a)||/id="?docs\-internal\-guid\-/.test(a)}function h(b){var c,d;return d=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/],b=b.replace(/^[\u00
a0 ]+/,""),a.each(d,function(a){if(a.test(b))return c=!0,!1}),c}function i(a){return/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(a)}function j(a){function b(a){var c="";if(3===a.type)return a.value;if(a=a.firstChild)do c+=b(a);while(a=a.next);return c}function c(a,b){if(3===a.type&&b.test(a.value))return a.value=a.value.replace(b,""),!1;if(a=a.firstChild)do if(!c(a,b))return!1;while(a=a.next);return!0}function d(a){if(a._listIgnore)return void a.remove();if(a=a.firstChild)do d(a);while(a=a.next)}function f(a,b,f){var h=a._listLevel||k;h!=k&&(h<k?g&&(g=g.parent.parent):(j=g,g=null)),g&&g.name==b?g.append(a):(j=j||g,g=new e(b,1),f>1&&g.attr("start",""+f),a.wrap(g)),a.name="li",h>k&&j&&j.lastChild.append(g),k=h,d(a),c(a,/^\u00a0+/),c(a,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/),c(a,/^\u00a0+/)}for(var g,j,k=1,l=[],m=a.firstChild;"undefined"!=typeof m
&&null!==m;)if(l.push(m),m=m.walk(),null!==m)for(;"undefined"!=typeof m&&m.parent!==a;)m=m.walk();for(var n=0;n<l.length;n++)if(a=l[n],"p"==a.name&&a.firstChild){var o=b(a);if(i(o)){f(a,"ul");continue}if(h(o)){var p=/([0-9]+)\./.exec(o),q=1;p&&(q=parseInt(p[1],10)),f(a,"ol",q);continue}if(a._listLevel){f(a,"ul",1);continue}g=null}else j=g,g=null}function k(b,c,d,f){var g,h={},i=b.dom.parseStyle(f);return a.each(i,function(a,e){switch(e){case"mso-list":g=/\w+ \w+([0-9]+)/i.exec(f),g&&(d._listLevel=parseInt(g[1],10)),/Ignore/i.test(a)&&d.firstChild&&(d._listIgnore=!0,d.firstChild._listIgnore=!0);break;case"horiz-align":e="text-align";break;case"vert-align":e="vertical-align";break;case"font-color":case"mso-foreground":e="color";break;case"mso-background":case"mso-highlight":e=&qu
ot;background";break;case"font-weight":case"font-style":return void("normal"!=a&&(h[e]=a));case"mso-element":if(/^(comment|comment-list)$/i.test(a))return void d.remove()}return 0===e.indexOf("mso-comment")?void d.remove():void(0!==e.indexOf("mso-")&&("all"==b.settings.paste_retain_style_properties||c&&c[e])&&(h[e]=a))}),/(bold)/i.test(h["font-weight"])&&(delete h["font-weight"],d.wrap(new e("b",1))),/(italic)/i.test(h["font-style"])&&(delete h["font-style"],d.wrap(new e("i",1))),h=b.dom.serializeStyle(h,d.name),h?h:null}var l=function(e,g){var h,i;h=e.settings.paste_retain_style_properties,h&&(i=a.makeMap(h.split(/[, ]/))),g=f.filter(g,[/<br class="?Apple-interchange-newline"?>/gi,/<b[^>]+id="?docs-internal-[^>]*>/gi,/<!--[\s\S]+?-->/gi,/<(!|script[^>
;]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\xa0"],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(a,b){return b.length>0?b.replace(/./," ").slice(Math.floor(b.length/2)).split("").join("\xa0"):""}]]);var l=e.settings.paste_word_valid_elements;l||(l="-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody");var m=new c({valid_elements:l,valid_children:"-li[p]"});a.each(m.elements,function(a){a.attributes["class"]||(a.attributes["class"]={},a.attributesOrder.push("class")),a.attributes.style||(a.attributes.style={},a.attributesOrder.push("style&
quot;))});var n=new b({},m);n.addAttributeFilter("style",function(a){for(var b,c=a.length;c--;)b=a[c],b.attr("style",k(e,i,b,b.attr("style"))),"span"==b.name&&b.parent&&!b.attributes.length&&b.unwrap()}),n.addAttributeFilter("class",function(a){for(var b,c,d=a.length;d--;)b=a[d],c=b.attr("class"),/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(c)&&b.remove(),b.attr("class",null)}),n.addNodeFilter("del",function(a){for(var b=a.length;b--;)a[b].remove()}),n.addNodeFilter("a",function(a){for(var b,c,d,e=a.length;e--;)if(b=a[e],c=b.attr("href"),d=b.attr("name"),c&&c.indexOf("#_msocom_")!=-1)b.remove();else if(c&&0===c.indexOf("file://")&&(c=c.split("#")[1],c&&(c="#"+c)),c||d){if(d&&!/^_?(?:toc|edn|ftn)/i.test(d)){b.unwrap();continue}b.attr({href:c,name:d})}else b
.unwrap()});var o=n.parse(g);return e.settings.paste_convert_word_fake_lists!==!1&&j(o),g=new d({validate:e.settings.validate},m).serialize(o)},m=function(a,b){return a.settings.paste_enable_default_filters===!1?b:l(a,b)};return{preProcess:m,isWordContent:g}}),g("f",["2","i"],function(a,b){var c=function(a,b){return{content:a,cancelled:b}},d=function(b,d,e,f){var g=b.dom.create("div",{style:"display:none"},d),h=a.firePastePostProcess(b,g,e,f);return c(h.node.innerHTML,h.isDefaultPrevented())},e=function(b,e,f,g){var h=a.firePastePreProcess(b,e,f,g);return b.hasEventListeners("PastePostProcess")&&!h.isDefaultPrevented()?d(b,h.content,f,g):c(h.content,h.isDefaultPrevented())},f=function(a,c,d){var f=b.isWordContent(c),g=f?b.preProcess(a,c):c;return e(a,g,d,f)};return{process:f}}),g("g",["a"],function(a){var b=function(a){return/^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(a)},c=function(a){r
eturn b(a)&&/.(gif|jpe?g|png)$/.test(a)},d=function(a,b,c){return a.undoManager.extra(function(){c(a,b)},function(){a.insertContent('<img src="'+b+'">')}),!0},e=function(a,b,c){return a.undoManager.extra(function(){c(a,b)},function(){a.execCommand("mceInsertLink",!1,b)}),!0},f=function(a,c,d){return!(a.selection.isCollapsed()!==!1||!b(c))&&e(a,c,d)},g=function(a,b,e){return!!c(b)&&d(a,b,e)},h=function(a,b){return a.insertContent(b,{merge:a.settings.paste_merge_formats!==!1,paste:!0}),!0},i=function(b,c){a.each([f,g,h],function(a){return a(b,c,h)!==!0})},j=function(a,b){a.settings.smart_paste===!1?h(a,b):i(a,b)};return{isImageUrl:c,isAbsoluteUrl:b,insertContent:j}}),g("3",["7","8","9","a","b","c","d","e","f","g","h"],function(a,b,c,d,e,f,g,h,i,j,k){return function(l){function m(a,b){var c=b?b:f.isMarked(a),d=i.proces
s(l,f.unmark(a),c);d.cancelled===!1&&j.insertContent(l,d.content)}function n(a){a=l.dom.encode(a).replace(/\r\n/g,"\n"),a=g.convert(a,l.settings.forced_root_block,l.settings.forced_root_block_attrs),m(a,!1)}function o(a){var b={};if(a){if(a.getData){var c=a.getData("Text");c&&c.length>0&&c.indexOf(G)==-1&&(b["text/plain"]=c)}if(a.types)for(var d=0;d<a.types.length;d++){var e=a.types[d];try{b[e]=a.getData(e)}catch(a){b[e]=""}}}return b}function p(a){var b=o(a.clipboardData||l.getDoc().dataTransfer);return k.isMsEdge()?d.extend(b,{"text/html":""}):b}function q(a){return y(a,"text/html")||y(a,"text/plain")}function r(a){var b;return b=a.indexOf(","),b!==-1?a.substr(b+1):null}function s(a,b){return!a.images_dataimg_filter||a.images_dataimg_filter(b)}function t(a){var b=a.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i);return b?l.dom.encode(b[1]):null}function u(a,b
,c){a&&(l.selection.setRng(a),a=null);var d=b.result,e=r(d),f=H(),g=l.settings.images_reuse_filename&&c.name?t(c.name):f,h=new Image;if(h.src=d,s(l.settings,h)){var i,j,k=l.editorUpload.blobCache;j=k.findFirst(function(a){return a.base64()===e}),j?i=j:(i=k.create(f,c,e,g),k.add(i)),m('<img src="'+i.blobUri()+'">',!1)}else m('<img src="'+d+'">',!1)}function v(a,b){function c(c){var d,e,f,g=!1;if(c)for(d=0;d<c.length;d++)if(e=c[d],/^image\/(jpeg|png|gif|bmp)$/.test(e.type)){var h=e.getAsFile?e.getAsFile():e;f=new FileReader,f.onload=u.bind(null,b,f,h),f.readAsDataURL(h),a.preventDefault(),g=!0}return g}var d=a.clipboardData||a.dataTransfer;if(l.settings.paste_data_images&&d)return c(d.items)||c(d.files)}function w(a){var b=a.clipboardData;return navigator.userAgent.indexOf("Android")!=-1&&b&&b.items&&0===b.items.length}function x(b){return a.getCaretRangeFromPoint(b.clientX,b.clientY,l.getDoc(
))}function y(a,b){return b in a&&a[b].length>0}function z(a){return e.metaKeyPressed(a)&&86==a.keyCode||a.shiftKey&&45==a.keyCode}function A(){function a(a,b,c,d){var e,h;return y(a,"text/html")?e=a["text/html"]:(e=F.getHtml(),d=d?d:f.isMarked(e),F.isDefaultContent(e)&&(c=!0)),e=k.trimHtml(e),F.remove(),h=d===!1&&g.isPlainText(e),e.length&&!h||(c=!0),c&&(e=y(a,"text/plain")&&h?a["text/plain"]:k.innerText(e)),F.isDefaultContent(e)?void(b||l.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.")):void(c?n(e):m(e,d))}function d(a){var b=a["text/plain"];return!!b&&0===b.indexOf("file://")}l.on("keydown",function(a){function c(a){z(a)&&!a.isDefaultPrevented()&&F.remove()}if(z(a)&&!a.isDefaultPrevented()){if(B=a.shiftKey&&86==a.keyCode,B&&b.webkit&&navigator.
userAgent.indexOf("Version/")!=-1)return;if(a.stopImmediatePropagation(),D=(new Date).getTime(),b.ie&&B)return a.preventDefault(),void l.fire("paste",{ieFake:!0});F.remove(),F.create(),l.once("keyup",c),l.once("paste",function(){l.off("keyup",c)})}});var e=function(){return F.getLastRng()||l.selection.getRng()};l.on("paste",function(d){var g=(new Date).getTime(),h=p(d),i=(new Date).getTime()-g,j=(new Date).getTime()-D-i<1e3,k="text"==C.pasteFormat||B,m=y(h,f.internalHtmlMime());return B=!1,d.isDefaultPrevented()||w(d)?void F.remove():!q(h)&&v(d,e())?void F.remove():(j||d.preventDefault(),!b.ie||j&&!d.ieFake||y(h,"text/html")||(F.create(),l.dom.bind(F.getEl(),"paste",function(a){a.stopPropagation()}),l.getDoc().execCommand("Paste",!1,null),h["text/html"]=F.getHtml()),void(y(h,"text/html")?(d.preventDefault(),m||(m=f.isMarked(h["text/h
tml"])),a(h,j,k,m)):c.setEditorTimeout(l,function(){a(h,j,k,m)},0)))}),l.on("dragstart dragend",function(a){E="dragstart"==a.type}),l.on("drop",function(a){var b,e;if(e=x(a),!a.isDefaultPrevented()&&!E){b=o(a.dataTransfer);var g=y(b,f.internalHtmlMime());if((q(b)&&!d(b)||!v(a,e))&&e&&l.settings.paste_filter_drop!==!1){var h=b["mce-internal"]||b["text/html"]||b["text/plain"];h&&(a.preventDefault(),c.setEditorTimeout(l,function(){l.undoManager.transact(function(){b["mce-internal"]&&l.execCommand("Delete"),l.selection.setRng(e),h=k.trimHtml(h),b["text/html"]?m(h,g):n(h)})}))}}}),l.on("dragover dragend",function(a){l.settings.paste_data_images&&a.preventDefault()})}var B,C=this,D=0,E=!1,F=new h(l),G="data:text/mce-internal,",H=k.createIdGenerator("mceclip");C.pasteHtml=m,C.pasteText=n,C.pasteImageData=v,l.on(
"preInit",function(){A(),l.parser.addNodeFilter("img",function(a,c,d){function e(a){return a.data&&a.data.paste===!0}function f(a){a.attr("data-mce-object")||j===b.transparentSrc||a.remove()}function g(a){return 0===a.indexOf("webkit-fake-url")}function h(a){return 0===a.indexOf("data:")}if(!l.settings.paste_data_images&&e(d))for(var i=a.length;i--;){var j=a[i].attributes.map.src;j&&(g(j)?f(a[i]):!l.settings.allow_html_data_urls&&h(j)&&f(a[i]))}})})}}),g("4",["8","c","h"],function(a,b,c){var d=function(){},e=function(b){return a.iOS===!1&&void 0!==b&&"function"==typeof b.setData&&c.isMsEdge()!==!0},f=function(a,c,d){if(!e(a))return!1;try{return a.clearData(),a.setData("text/html",c),a.setData("text/plain",d),a.setData(b.internalHtmlMime(),c),!0}catch(a){return!1}},g=function(a,b,c,d){f(a.clipboardData,
b.html,b.text)?(a.preventDefault(),d()):c(b.html,d)},h=function(a){return function(c,d){var e=b.mark(c),f=a.dom.create("div",{contenteditable:"false","data-mce-bogus":"all"}),g=a.dom.create("div",{contenteditable:"true"},e);a.dom.setStyles(f,{position:"fixed",left:"-3000px",width:"1000px",overflow:"hidden"}),f.appendChild(g),a.dom.add(a.getBody(),f);var h=a.selection.getRng();g.focus();var i=a.dom.createRng();i.selectNodeContents(g),a.selection.setRng(i),setTimeout(function(){f.parentNode.removeChild(f),a.selection.setRng(h),d()},0)}},i=function(a){return{html:a.selection.getContent({contextual:!0}),text:a.selection.getContent({format:"text"})}},j=function(a){return function(b){a.selection.isCollapsed()===!1&&g(b,i(a),h(a),function(){setTimeout(function(){a.execCommand("Delete")},0)})}},k=function(a){return function(b){a.selection.isCollapsed()===!1&&am
p;g(b,i(a),h(a),d)}},l=function(a){a.on("cut",j(a)),a.on("copy",k(a))};return{register:l}}),g("5",["8","a","i","h"],function(a,b,c,d){function e(a,b){a.on("PastePreProcess",function(c){c.content=b(a,c.content,c.internal,c.wordContent)})}function f(a,b){a.on("PastePostProcess",function(c){b(a,c.node)})}function g(a,e){if(!c.isWordContent(e))return e;var f=[];b.each(a.schema.getBlockElements(),function(a,b){f.push(b)});var g=new RegExp("(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?("+f.join("|")+")[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*","g");return e=d.filter(e,[[g,"$1"]]),e=d.filter(e,[[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}function h(a,b,c,d){if(d||c)return b;var e=a.settings.paste_webkit_styles;if(a.settings.pa
ste_remove_styles_if_webkit===!1||"all"==e)return b;if(e&&(e=e.split(/[, ]/)),e){var f=a.dom,g=a.selection.getNode();b=b.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(a,b,c,d){var h=f.parseStyle(f.decode(c),"span"),i={};if("none"===e)return b+d;for(var j=0;j<e.length;j++){var k=h[e[j]],l=f.getStyle(g,e[j],!0);/color/.test(e[j])&&(k=f.toHex(k),l=f.toHex(l)),l!=k&&(i[e[j]]=k)}return i=f.serializeStyle(i,"span"),i?b+' style="'+i+'"'+d:b+d})}else b=b.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return b=b.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(a,b,c,d){return b+' style="'+c+'"'+d})}function i(a,b){a.$("a",b).find("font,u").each(function(b,c){a.dom.remove(c,!0)})}var j=function(b){a.webkit&&e(b,h),a.ie&&(e(b,g),f(b,i))};return{setup:j}}),
g("0",["1","2","3","4","5"],function(a,b,c,d,e){var f;return a.add("paste",function(g){function h(){return f||g.settings.paste_plaintext_inform===!1}function i(){if("text"==k.pasteFormat)k.pasteFormat="html",b.firePastePlainTextToggle(g,!1);else if(k.pasteFormat="text",b.firePastePlainTextToggle(g,!0),!h()){var a=g.translate("Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.");g.notificationManager.open({text:a,type:"info"}),f=!0}g.focus()}function j(){var a=this;a.active("text"===k.pasteFormat),g.on("PastePlainTextToggle",function(b){a.active(b.state)})}var k,l=this,m=g.settings;return/(^|[ ,])powerpaste([, ]|$)/.test(m.plugins)&&a.get("powerpaste")?void("undefined"!=typeof console&&console.log&&console.log("PowerPaste is incompatible wit
h Paste plugin! Remove 'paste' from the 'plugins' option.")):(l.clipboard=k=new c(g),l.quirks=e.setup(g),g.settings.paste_as_text&&(l.clipboard.pasteFormat="text"),m.paste_preprocess&&g.on("PastePreProcess",function(a){m.paste_preprocess.call(l,l,a)}),m.paste_postprocess&&g.on("PastePostProcess",function(a){m.paste_postprocess.call(l,l,a)}),g.addCommand("mceInsertClipboardContent",function(a,b){b.content&&l.clipboard.pasteHtml(b.content,b.internal),b.text&&l.clipboard.pasteText(b.text)}),g.settings.paste_block_drop&&g.on("dragend dragover draggesture dragdrop drop drag",function(a){a.preventDefault(),a.stopPropagation()}),g.settings.paste_data_images||g.on("drop",function(a){var b=a.dataTransfer;b&&b.files&&b.files.length>0&&a.preventDefault()}),g.addCommand("mceTogglePlainTextPaste",i),g.addButton("pastetext",{icon:"pas
tetext",tooltip:"Paste as text",onclick:i,onPostRender:j}),g.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:k.pasteFormat,onclick:i,onPostRender:j}),void d.register(g))}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var o=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return o(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),s=function(e){return!(!/(^|[ ,])powerpaste([, ]|$)/.test(e.settings.plugins)||!t.get("powerpaste")||("undefined"!=typeof window.console&&window.console.log&&window.console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option."),0))},l=function(e,t){return{clipboard:e,quirks:t}},f=function(e,t,n,r){return e.fire("PastePreProcess",{content:t,internal:n,wordContent:r})},d=function(e,t,n,r){return e.fire("PastePostProcess",{node:t,internal:n,wordContent:r})},u=function(e,t){return e.fire("PastePlainTextToggle",{state:t})},n=function(e,t){return e.fire("paste&quo
t;,{ieFake:t})},m={shouldPlainTextInform:function(e){return e.getParam("paste_plaintext_inform",!0)},shouldBlockDrop:function(e){return e.getParam("paste_block_drop",!1)},shouldPasteDataImages:function(e){return e.getParam("paste_data_images",!1)},shouldFilterDrop:function(e){return e.getParam("paste_filter_drop",!0)},getPreProcess:function(e){return e.getParam("paste_preprocess")},getPostProcess:function(e){return e.getParam("paste_postprocess")},getWebkitStyles:function(e){return e.getParam("paste_webkit_styles")},shouldRemoveWebKitStyles:function(e){return e.getParam("paste_remove_styles_if_webkit",!0)},shouldMergeFormats:function(e){return e.getParam("paste_merge_formats",!0)},isSmartPasteEnabled:function(e){return e.getParam("smart_paste",!0)},isPasteAsTextEnabled:function(e){return e.getParam("paste_as_text",!1)},getRetainStyleProps:function(e){return e.getParam("
paste_retain_style_properties")},getWordValidElements:function(e){return e.getParam("paste_word_valid_elements","-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody")},shouldConvertWordFakeLists:function(e){return e.getParam("paste_convert_word_fake_lists",!0)},shouldUseDefaultFilters:function(e){return e.getParam("paste_enable_default_filters",!0)}},r=function(e,t,n){var r,a,i;"text"===t.pasteFormat.get()?(t.pasteFormat.set("html"),u(e,!1)):(t.pasteFormat.set("text"),u(e,!0),i=e,!1===n.get()&&m.shouldPlainTextInform(i)&&(a="Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.",(r=e).notificationManager.open({text:r.translate(a),type:"info"}),n.set(!0))),e.focus()},c=function(e,n,
t){e.addCommand("mceTogglePlainTextPaste",function(){r(e,n,t)}),e.addCommand("mceInsertClipboardContent",function(e,t){t.content&&n.pasteHtml(t.content,t.internal),t.text&&n.pasteText(t.text)})},v=tinymce.util.Tools.resolve("tinymce.Env"),h=tinymce.util.Tools.resolve("tinymce.util.Delay"),y=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=tinymce.util.Tools.resolve("tinymce.util.VK"),e="x-tinymce/html",i="\x3c!-- "+e+" --\x3e",b={mark:function(e){return i+e},unmark:function(e){return e.replace(i,"")},isMarked:function(e){return-1!==e.indexOf(i)},internalHtmlMime:function(){return e}},g=tinymce.util.Tools.resolve("tinymce.html.Entities"),p=function(e){return e.replace(/\r?\n/g,"<br>")},x=function(e,t,n){var r=e.split(/\n\n/),a=function(e,t){var n,r=[],a="<"+e;if("object"==typeof t){for(n in t)t.hasOwnProperty(n)&&am
p;r.push(n+'="'+g.encodeAllRaw(t[n])+'"');r.length&&(a+=" "+r.join(" "))}return a+">"}(t,n),i="</"+t+">",o=y.map(r,function(e){return e.split(/\n/).join("<br />")});return 1===o.length?o[0]:y.map(o,function(e){return a+e+i}).join("")},P={isPlainText:function(e){return!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e)},convert:function(e,t,n){return t?x(e,t,n):p(e)},toBRs:p,toBlockElements:x},w=tinymce.util.Tools.resolve("tinymce.html.DomParser"),T=tinymce.util.Tools.resolve("tinymce.html.Node"),_=tinymce.util.Tools.resolve("tinymce.html.Schema"),C=tinymce.util.Tools.resolve("tinymce.html.Serializer");function D(t,e){return y.each(e,function(e){t=e.constructor===RegExp?t.replace(e,""):t.replace(e[0],e[1])}),t}var k={filter:D,innerText:function(t
){var n=_(),r=w({},n),a="",i=n.getShortEndedElements(),o=y.makeMap("script noscript style textarea video audio iframe object"," "),s=n.getBlockElements();return t=D(t,[/<!\[[^\]]+\]>/g]),function e(t){var n=t.name,r=t;if("br"!==n)if(i[n]&&(a+=" "),o[n])a+=" ";else{if(3===t.type&&(a+=t.value),!t.shortEnded&&(t=t.firstChild))for(;e(t),t=t.next;);s[n]&&r.next&&(a+="\n","p"===n&&(a+="\n"))}else a+="\n"}(r.parse(t)),a},trimHtml:function(e){return e=D(e,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,function(e,t,n){return t||n?"\xa0":" "}],/<br class="Apple-interchange-newline">/g,/<br>$/i])},createIdGenerator:function(e){var t=0;retur
n function(){return e+t++}},isMsEdge:function(){return-1!==navigator.userAgent.indexOf(" Edge/")}};function R(t){var n,e;return e=[/^[IVXLMCD]{1,2}\.[ \u00a0]/,/^[ivxlmcd]{1,2}\.[ \u00a0]/,/^[a-z]{1,2}[\.\)][ \u00a0]/,/^[A-Z]{1,2}[\.\)][ \u00a0]/,/^[0-9]+\.[ \u00a0]/,/^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/,/^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/],t=t.replace(/^[\u00a0 ]+/,""),y.each(e,function(e){if(e.test(t))return!(n=!0)}),n}function E(e){var i,o,s=1;function n(e){var t="";if(3===e.type)return e.value;if(e=e.firstChild)for(;t+=n(e),e=e.next;);return t}function l(e,t){if(3===e.type&&t.test(e.value))return e.value=e.value.replace(t,""),!1;if(e=e.firstChild)do{if(!l(e,t))return!1}while(e=e.next);return!0}function t(t,n,r){var a=t._listLevel||s;a!==s&&(a<s?i&&(i=i.parent.parent):(o=i,i=null)),i&&i.name===n?i.append(t):(o=o||i,i=new T(n,
1),1<r&&i.attr("start",""+r),t.wrap(i)),t.name="li",s<a&&o&&o.lastChild.append(i),s=a,function e(t){if(t._listIgnore)t.remove();else if(t=t.firstChild)for(;e(t),t=t.next;);}(t),l(t,/^\u00a0+/),l(t,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/),l(t,/^\u00a0+/)}for(var r=[],a=e.firstChild;null!=a;)if(r.push(a),null!==(a=a.walk()))for(;void 0!==a&&a.parent!==e;)a=a.walk();for(var u=0;u<r.length;u++)if("p"===(e=r[u]).name&&e.firstChild){var c=n(e);if(/^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(c)){t(e,"ul");continue}if(R(c)){var f=/([0-9]+)\./.exec(c),d=1;f&&(d=parseInt(f[1],10)),t(e,"ol",d);continue}if(e._listLevel){t(e,"ul",1);continue}i=null}else o=i,i=null}function M(n,r,a,i){var o,s={},e=n.dom.parseStyle(i);return y.each(e,function(e,t){switch(t){case"mso-list":(o=/\w+ \w+([0-9]+)/i.exec(i))&&(a._listLevel=parseInt(o[1],10)),/Ignore/i.test
(e)&&a.firstChild&&(a._listIgnore=!0,a.firstChild._listIgnore=!0);break;case"horiz-align":t="text-align";break;case"vert-align":t="vertical-align";break;case"font-color":case"mso-foreground":t="color";break;case"mso-background":case"mso-highlight":t="background";break;case"font-weight":case"font-style":return void("normal"!==e&&(s[t]=e));case"mso-element":if(/^(comment|comment-list)$/i.test(e))return void a.remove()}0!==t.indexOf("mso-comment")?0!==t.indexOf("mso-")&&("all"===m.getRetainStyleProps(n)||r&&r[t])&&(s[t]=e):a.remove()}),/(bold)/i.test(s["font-weight"])&&(delete s["font-weight"],a.wrap(new T("b",1))),/(italic)/i.test(s["font-style"])&&(delete s["font-style"],a.wrap(new T("i",1))),(s
=n.dom.serializeStyle(s,a.name))||null}var S={preProcess:function(e,t){return m.shouldUseDefaultFilters(e)?function(r,e){var t,a;(t=m.getRetainStyleProps(r))&&(a=y.makeMap(t.split(/[, ]/))),e=k.filter(e,[/<br class="?Apple-interchange-newline"?>/gi,/<b[^>]+id="?docs-internal-[^>]*>/gi,/<!--[\s\S]+?-->/gi,/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[/ /gi,"\xa0"],[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,function(e,t){return 0<t.length?t.replace(/./," ").slice(Math.floor(t.length/2)).split("").join("\xa0"):""}]]);var n=m.getWordValidElements(r),i=_({valid_elements:n,valid_children:"-li[p]"});y.each(i.elements,function(e){e.attributes["class"]||(e.attributes[&q
uot;class"]={},e.attributesOrder.push("class")),e.attributes.style||(e.attributes.style={},e.attributesOrder.push("style"))});var o=w({},i);o.addAttributeFilter("style",function(e){for(var t,n=e.length;n--;)(t=e[n]).attr("style",M(r,a,t,t.attr("style"))),"span"===t.name&&t.parent&&!t.attributes.length&&t.unwrap()}),o.addAttributeFilter("class",function(e){for(var t,n,r=e.length;r--;)n=(t=e[r]).attr("class"),/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(n)&&t.remove(),t.attr("class",null)}),o.addNodeFilter("del",function(e){for(var t=e.length;t--;)e[t].remove()}),o.addNodeFilter("a",function(e){for(var t,n,r,a=e.length;a--;)if(n=(t=e[a]).attr("href"),r=t.attr("name"),n&&-1!==n.indexOf("#_msocom_"))t.remove();else if(n&&0===n.indexOf("file://")&&(n=n.split("#"
)[1])&&(n="#"+n),n||r){if(r&&!/^_?(?:toc|edn|ftn)/i.test(r)){t.unwrap();continue}t.attr({href:n,name:r})}else t.unwrap()});var s=o.parse(e);return m.shouldConvertWordFakeLists(r)&&E(s),e=C({validate:r.settings.validate},i).serialize(s)}(e,t):t},isWordContent:function(e){return/<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(e)||/class="OutlineElement/.test(e)||/id="?docs\-internal\-guid\-/.test(e)}},F=function(e,t){return{content:e,cancelled:t}},I=function(e,t,n,r){var a,i,o,s,l,u,c=f(e,t,n,r);return e.hasEventListeners("PastePostProcess")&&!c.isDefaultPrevented()?(a=e,i=c.content,o=n,s=r,l=a.dom.create("div",{style:"display:none"},i),u=d(a,l,o,s),F(u.node.innerHTML,u.isDefaultPrevented())):F(c.content,c.isDefaultPrevented())},O=function(e,t,n){var r=S.isWordContent(t),a=r?S.preProcess(e,t):t;return I(e,a,n,r)},A=function
(e,t){return e.insertContent(t,{merge:m.shouldMergeFormats(e),paste:!0}),!0},B=function(e){return/^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(e)},H=function(e){return B(e)&&/.(gif|jpe?g|png)$/.test(e)},N=function(e,t,n){return!(!1!==e.selection.isCollapsed()||!B(t)||(a=t,i=n,(r=e).undoManager.extra(function(){i(r,a)},function(){r.execCommand("mceInsertLink",!1,a)}),0));var r,a,i},L=function(e,t,n){return!!H(t)&&(a=t,i=n,(r=e).undoManager.extra(function(){i(r,a)},function(){r.insertContent('<img src="'+a+'">')}),!0);var r,a,i},$=function(e,t){var n,r;!1===m.isSmartPasteEnabled(e)?A(e,t):(n=e,r=t,y.each([N,L,A],function(e){return!0!==e(n,r,A)}))},W=function(e,t,n){var r=n||b.isMarked(t),a=O(e,b.unmark(t),r);!1===a.cancelled&&$(e,a.content)},j=function(e,t){t=e.dom.encode(t).replace(/\r\n/g,"\n"),t=P.convert(t,e.settings.forced_root_block,e.settings.forced_root_block_attrs),W(e,t,!1)},V=function(e){var t={};if(e){if(e.getData)
{var n=e.getData("Text");n&&0<n.length&&-1===n.indexOf("data:text/mce-internal,")&&(t["text/plain"]=n)}if(e.types)for(var r=0;r<e.types.length;r++){var a=e.types[r];try{t[a]=e.getData(a)}catch(i){t[a]=""}}}return t},z=function(e,t){return t in e&&0<e[t].length},K=function(e){return z(e,"text/html")||z(e,"text/plain")},U=function(e,t,n,r){var a=k.createIdGenerator("mceclip");t&&(e.selection.setRng(t),t=null);var i,o,s,l,u,c,f,d=n.result,m=-1!==(o=(i=d).indexOf(","))?i.substr(o+1):null,g=a(),p=e.settings.images_reuse_filename&&r.name?(s=e,l=r.name,(u=l.match(/([\s\S]+?)\.(?:jpeg|jpg|png|gif)$/i))?s.dom.encode(u[1]):null):g,v=new Image;if(v.src=d,c=e.settings,f=v,!c.images_dataimg_filter||c.images_dataimg_filter(f)){var h,y=e.editorUpload.blobCache,b=void 0;(h=y.findFirst(function(e){return e.base64()===m}))?b=h:(b=y.create(g,r,m,p),y.add(b)),W(e,'<
;img src="'+b.blobUri()+'">',!1)}else W(e,'<img src="'+d+'">',!1)},G=function(o,s,l){var e="paste"===s.type?s.clipboardData:s.dataTransfer;function t(e){var t,n,r,a=!1;if(e)for(t=0;t<e.length;t++)if(n=e[t],/^image\/(jpeg|png|gif|bmp)$/.test(n.type)){var i=n.getAsFile?n.getAsFile():n;(r=new window.FileReader).onload=U.bind(null,o,l,r,i),r.readAsDataURL(i),s.preventDefault(),a=!0}return a}if(o.settings.paste_data_images&&e)return t(e.items)||t(e.files)},X=function(e){return a.metaKeyPressed(e)&&86===e.keyCode||e.shiftKey&&45===e.keyCode},q=function(c,f,d){var m,g=0;function p(e,t,n,r){var a,i;z(e,"text/html")?a=e["text/html"]:(a=f.getHtml(),r=r||b.isMarked(a),f.isDefaultContent(a)&&(n=!0)),a=k.trimHtml(a),f.remove(),i=!1===r&&P.isPlainText(a),a.length&&!i||(n=!0),n&&(a=z(e,"text/plain")&&i?e["text/plain"]:k.innerText(a)),f.isDefaultContent(a
)?t||c.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents."):n?j(c,a):W(c,a,r)}c.on("keydown",function(e){function t(e){X(e)&&!e.isDefaultPrevented()&&f.remove()}if(X(e)&&!e.isDefaultPrevented()){if((m=e.shiftKey&&86===e.keyCode)&&v.webkit&&-1!==navigator.userAgent.indexOf("Version/"))return;if(e.stopImmediatePropagation(),g=(new Date).getTime(),v.ie&&m)return e.preventDefault(),void n(c,!0);f.remove(),f.create(),c.once("keyup",t),c.once("paste",function(){c.off("keyup",t)})}}),c.on("paste",function(e){var t,n,r,a=(new Date).getTime(),i=(t=c,n=V(e.clipboardData||t.getDoc().dataTransfer),k.isMsEdge()?y.extend(n,{"text/html":""}):n),o=(new Date).getTime()-a,s=(new Date).getTime()-g-o<1e3,l="text"===d.get()||m,u=z(i,b.internalHtmlMime());m=!1,e.isDefaultPrevented()||(r=e.clipboardData,-1!==navigator
.userAgent.indexOf("Android")&&r&&r.items&&0===r.items.length)?f.remove():K(i)||!G(c,e,f.getLastRng()||c.selection.getRng())?(s||e.preventDefault(),!v.ie||s&&!e.ieFake||z(i,"text/html")||(f.create(),c.dom.bind(f.getEl(),"paste",function(e){e.stopPropagation()}),c.getDoc().execCommand("Paste",!1,null),i["text/html"]=f.getHtml()),z(i,"text/html")?(e.preventDefault(),u||(u=b.isMarked(i["text/html"])),p(i,s,l,u)):h.setEditorTimeout(c,function(){p(i,s,l,u)},0)):f.remove()})},Y=function(e){return e.dom.get("mcepastebin")},Z=function(e,t){return t===e},J=function(r){var e=o(null),a="%MCEPASTEBIN%";return{create:function(){return function(e,t,n){var r,a,i=e.dom,o=e.getBody(),s=e.dom.getViewPort(e.getWin()).y,l=20;t.set(e.selection.getRng());var u=t.get();if(e.inline&&(a=e.selection.getScrollContainer())&&0<a.scrollTop&&(s=a.scrollTop),u.getClie
ntRects){var c=function(e){var t,n,r,a=e.startContainer;if((t=e.getClientRects()).length)return t[0];if(e.collapsed&&1===a.nodeType){for(r=a.childNodes[u.startOffset];r&&3===r.nodeType&&!r.data.length;)r=r.nextSibling;if(r)return"BR"===r.tagName&&(n=i.doc.createTextNode("\ufeff"),r.parentNode.insertBefore(n,r),(e=i.createRng()).setStartBefore(n),e.setEndAfter(n),t=e.getClientRects(),i.remove(n)),t.length?t[0]:void 0}}(u);if(c)l=s+(c.top-i.getPos(o).y);else{l=s;var f=u.startContainer;f&&(3===f.nodeType&&f.parentNode!==o&&(f=f.parentNode),1===f.nodeType&&(l=i.getPos(f,a||o).y))}}r=e.dom.add(e.getBody(),"div",{id:"mcepastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: absolute; top: "+l+"px; width: 10px; height: 10px; overflow: hidden; opacity: 0"},n),(v.ie||v.gecko)&&i.setStyle(r,"left","rtl"===i.ge
tStyle(o,"direction",!0)?65535:-65535),i.bind(r,"beforedeactivate focusin focusout",function(e){e.stopPropagation()}),r.focus(),e.selection.select(r,!0)}(r,e,a)},remove:function(){return function(e,t){if(Y(e)){for(var n=void 0,r=t.get();n=e.dom.get("mcepastebin");)e.dom.remove(n),e.dom.unbind(n);r&&e.selection.setRng(r)}t.set(null)}(r,e)},getEl:function(){return Y(r)},getHtml:function(){return function(n){var t,e,r,a,i,o=function(e,t){e.appendChild(t),n.dom.remove(t,!0)};for(e=y.grep(n.getBody().childNodes,function(e){return"mcepastebin"===e.id}),t=e.shift(),y.each(e,function(e){o(t,e)}),r=(a=n.dom.select("div[id=mcepastebin]",t)).length-1;0<=r;r--)i=n.dom.create("div"),t.insertBefore(i,a[r]),o(i,a[r]);return t?t.innerHTML:""}(r)},getLastRng:function(){return e.get()},isDefault:function(){return e=a,n=Y(r),(t=n)&&"mcepastebin"===t.id&&Z(e,n.innerHTML);var e,t,n},isDefaultConten
t:function(e){return Z(a,e)}}},Q=function(n,e){var t=J(n);return n.on("preInit",function(){return q(o=n,t,e),void o.parser.addNodeFilter("img",function(e,t,n){var r,a=function(e){e.attr("data-mce-object")||s===v.transparentSrc||e.remove()};if(!o.settings.paste_data_images&&(r=n).data&&!0===r.data.paste)for(var i=e.length;i--;)(s=e[i].attributes.map.src)&&(0===s.indexOf("webkit-fake-url")?a(e[i]):o.settings.allow_html_data_urls||0!==s.indexOf("data:")||a(e[i]))});var o,s}),{pasteFormat:e,pasteHtml:function(e,t){return W(n,e,t)},pasteText:function(e){return j(n,e)},pasteImageData:function(e,t){return G(n,e,t)},getDataTransferItems:V,hasHtmlOrText:K,hasContentType:z}},ee=function(){},te=function(e,t,n){if(r=e,!1!==v.iOS||r===undefined||"function"!=typeof r.setData||!0===k.isMsEdge())return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",n),e.setData(b.inter
nalHtmlMime(),t),!0}catch(a){return!1}var r},ne=function(e,t,n,r){te(e.clipboardData,t.html,t.text)?(e.preventDefault(),r()):n(t.html,r)},re=function(s){return function(e,t){var n=b.mark(e),r=s.dom.create("div",{contenteditable:"false","data-mce-bogus":"all"}),a=s.dom.create("div",{contenteditable:"true"},n);s.dom.setStyles(r,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),r.appendChild(a),s.dom.add(s.getBody(),r);var i=s.selection.getRng();a.focus();var o=s.dom.createRng();o.selectNodeContents(a),s.selection.setRng(o),setTimeout(function(){s.selection.setRng(i),r.parentNode.removeChild(r),t()},0)}},ae=function(e){return{html:e.selection.getContent({contextual:!0}),text:e.selection.getContent({format:"text"})}},ie=function(e){var t,n;e.on("cut",(t=e,function(e){!1===t.selection.isCollapsed()&&ne(e,ae(t),re(t),function()
{setTimeout(function(){t.execCommand("Delete")},0)})})),e.on("copy",(n=e,function(e){!1===n.selection.isCollapsed()&&ne(e,ae(n),re(n),ee)}))},oe=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),se=function(e,t){return oe.getCaretRangeFromPoint(t.clientX,t.clientY,e.getDoc())},le=function(e,t){e.focus(),e.selection.setRng(t)},ue=function(o,s,l){m.shouldBlockDrop(o)&&o.on("dragend dragover draggesture dragdrop drop drag",function(e){e.preventDefault(),e.stopPropagation()}),m.shouldPasteDataImages(o)||o.on("drop",function(e){var t=e.dataTransfer;t&&t.files&&0<t.files.length&&e.preventDefault()}),o.on("drop",function(e){var t,n;if(n=se(o,e),!e.isDefaultPrevented()&&!l.get()){t=s.getDataTransferItems(e.dataTransfer);var r,a=s.hasContentType(t,b.internalHtmlMime());if((s.hasHtmlOrText(t)&&(!(r=t["text/plain"])||0!==r.indexOf("file://"))||!s.pasteIm
ageData(e,n))&&n&&m.shouldFilterDrop(o)){var i=t["mce-internal"]||t["text/html"]||t["text/plain"];i&&(e.preventDefault(),h.setEditorTimeout(o,function(){o.undoManager.transact(function(){t["mce-internal"]&&o.execCommand("Delete"),le(o,n),i=k.trimHtml(i),t["text/html"]?s.pasteHtml(i,a):s.pasteText(i)})}))}}}),o.on("dragstart",function(e){l.set(!0)}),o.on("dragover dragend",function(e){m.shouldPasteDataImages(o)&&!1===l.get()&&(e.preventDefault(),le(o,se(o,e))),"dragend"===e.type&&l.set(!1)})},ce=function(e){var t=e.plugins.paste,n=m.getPreProcess(e);n&&e.on("PastePreProcess",function(e){n.call(t,t,e)});var r=m.getPostProcess(e);r&&e.on("PastePostProcess",function(e){r.call(t,t,e)})};function fe(t,n){t.on("PastePreProcess",function(e){e.content=n(t,e.content,e.internal,e.wordContent)})}function d
e(e,t){if(!S.isWordContent(t))return t;var n=[];y.each(e.schema.getBlockElements(),function(e,t){n.push(t)});var r=new RegExp("(?:<br> [\\s\\r\\n]+|<br>)*(<\\/?("+n.join("|")+")[^>]*>)(?:<br> [\\s\\r\\n]+|<br>)*","g");return t=k.filter(t,[[r,"$1"]]),t=k.filter(t,[[/<br><br>/g,"<BR><BR>"],[/<br>/g," "],[/<BR><BR>/g,"<br>"]])}function me(e,t,n,r){if(r||n)return t;var u,a=m.getWebkitStyles(e);if(!1===m.shouldRemoveWebKitStyles(e)||"all"===a)return t;if(a&&(u=a.split(/[, ]/)),u){var c=e.dom,f=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(e,t,n,r){var a=c.parseStyle(c.decode(n)),i={};if("none"===u)return t+r;for(var o=0;o<u.length;o++){var s=a[u[o]],l=c.getStyle(f,u[o],!0);/color/.test(u[o])&&(s=c.toHex(s),l=c.toH
ex(l)),l!==s&&(i[u[o]]=s)}return(i=c.serializeStyle(i,"span"))?t+' style="'+i+'"'+r:t+r})}else t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,function(e,t,n,r){return t+' style="'+n+'"'+r})}function ge(n,e){n.$("a",e).find("font,u").each(function(e,t){n.dom.remove(t,!0)})}var pe=function(e){var t,n;v.webkit&&fe(e,me),v.ie&&(fe(e,de),n=ge,(t=e).on("PastePostProcess",function(e){n(t,e.node)}))},ve=function(e){return function(){return e}},he=(ve(!1),ve(!0),function(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var o=new Array(arguments.length-1),n=1;n<arguments.length;n++)o[n-1]=arguments[n];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=argumen
ts[r];var a=o.concat(n);return i.apply(null,a)}}),ye=function(e,t,n){var r=n.control;r.active("text"===t.pasteFormat.get()),e.on("PastePlainTextToggle",function(e){r.active(e.state)})},be=function(e,t){var n=he(ye,e,t);e.addButton("pastetext",{active:!1,icon:"pastetext",tooltip:"Paste as text",cmd:"mceTogglePlainTextPaste",onPostRender:n}),e.addMenuItem("pastetext",{text:"Paste as text",selectable:!0,active:t.pasteFormat,cmd:"mceTogglePlainTextPaste",onPostRender:n})};t.add("paste",function(e){if(!1===s(e)){var t=o(!1),n=o(!1),r=o(m.isPasteAsTextEnabled(e)?"text":"html"),a=Q(e,r),i=pe(e);return be(e,a),c(e,a,t),ce(e),ie(e),ue(e,a,n),l(a,i)}})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginstabfocuspluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,348 +1,124 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var tabfocus = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$2 = tinymce.util.Tools.resolve('tinymce.EditorManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
- };
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$3 = tinymce.util.Tools.resolve('tinymce.Env');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.Delay');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var ephox = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$6 = tinymce.util.Tools.resolve('tinymce.util.VK');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getTabFocusElements = function (editor) {
+ return editor.getParam('tabfocus_elements', ':prev,:next');
+ };
+ var getTabFocus = function (editor) {
+ return editor.getParam('tab_focus', getTabFocusElements(editor));
+ };
+ var $_54igvnk1jfuw8q35 = { getTabFocus: getTabFocus };
+
+ var DOM = global$1.DOM;
+ var tabCancel = function (e) {
+ if (e.keyCode === global$6.TAB && !e.ctrlKey && !e.altKey && !e.metaKey) {
+ e.preventDefault();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-};
-
-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.tabfocus.Plugin","tinymce.core.PluginManager","tinymce.core.dom.DOMUtils","tinymce.core.util.Tools","tinymce.core.EditorManager","tinymce.core.util.Delay","tinymce.core.Env","global!tinymce.util.Tools.resolve"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.DOMUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.DOMUtils');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.EditorManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.EditorManager');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Delay',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Delay');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.Env',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.Env');
- }
-);
-
-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains all core logic for the code plugin.
- *
- * @class tinymce.tabfocus.Plugin
- * @private
- */
-define(
- 'tinymce.plugins.tabfocus.Plugin',
- [
- 'tinymce.core.PluginManager',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.util.Tools',
- 'tinymce.core.EditorManager',
- 'tinymce.core.util.Delay',
- 'tinymce.core.Env'
- ],
- function (PluginManager, DOMUtils, Tools, EditorManager, Delay, Env) {
- PluginManager.add('tabfocus', function (editor) {
- var DOM = DOMUtils.DOM;
-
- function tabCancel(e) {
- if (e.keyCode === 9 && !e.ctrlKey && !e.altKey && !e.metaKey) {
- e.preventDefault();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var setup = function (editor) {
+ function tabHandler(e) {
+ var x, el, v, i;
+ if (e.keyCode !== global$6.TAB || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function tabHandler(e) {
- var x, el, v, i;
-
- if (e.keyCode !== 9 || e.ctrlKey || e.altKey || e.metaKey || e.isDefaultPrevented()) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function find(direction) {
+ el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
+ function canSelectRecursive(e) {
+ return e.nodeName === 'BODY' || e.type !== 'hidden' && e.style.display !== 'none' && e.style.visibility !== 'hidden' && canSelectRecursive(e.parentNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function find(direction) {
- el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
-
- function canSelectRecursive(e) {
- return e.nodeName === "BODY" || (e.type != 'hidden' &&
- e.style.display != "none" &&
- e.style.visibility != "hidden" && canSelectRecursive(e.parentNode));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function canSelect(el) {
+ return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && global$2.get(e.id) && el.tabIndex !== -1 && canSelectRecursive(el);
+ }
+ global$5.each(el, function (e, i) {
+ if (e.id === editor.id) {
+ x = i;
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function canSelect(el) {
- return /INPUT|TEXTAREA|BUTTON/.test(el.tagName) && EditorManager.get(e.id) && el.tabIndex != -1 && canSelectRecursive(el);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ if (direction > 0) {
+ for (i = x + 1; i < el.length; i++) {
+ if (canSelect(el[i])) {
+ return el[i];
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- Tools.each(el, function (e, i) {
- if (e.id == editor.id) {
- x = i;
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ for (i = x - 1; i >= 0; i--) {
+ if (canSelect(el[i])) {
+ return el[i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- if (direction > 0) {
- for (i = x + 1; i < el.length; i++) {
- if (canSelect(el[i])) {
- return el[i];
- }
- }
- } else {
- for (i = x - 1; i >= 0; i--) {
- if (canSelect(el[i])) {
- return el[i];
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- v = Tools.explode(editor.getParam('tab_focus', editor.getParam('tabfocus_elements', ':prev,:next')));
-
- if (v.length == 1) {
- v[1] = v[0];
- v[0] = ':prev';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
+ }
+ v = global$5.explode($_54igvnk1jfuw8q35.getTabFocus(editor));
+ if (v.length === 1) {
+ v[1] = v[0];
+ v[0] = ':prev';
+ }
+ if (e.shiftKey) {
+ if (v[0] === ':prev') {
+ el = find(-1);
+ } else {
+ el = DOM.get(v[0]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Find element to focus
- if (e.shiftKey) {
- if (v[0] == ':prev') {
- el = find(-1);
- } else {
- el = DOM.get(v[0]);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if (v[1] === ':next') {
+ el = find(1);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (v[1] == ':next') {
- el = find(1);
- } else {
- el = DOM.get(v[1]);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ el = DOM.get(v[1]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (el) {
- var focusEditor = EditorManager.get(el.id || el.name);
-
- if (el.id && focusEditor) {
- focusEditor.focus();
- } else {
- Delay.setTimeout(function () {
- if (!Env.webkit) {
- window.focus();
- }
-
- el.focus();
- }, 10);
- }
-
- e.preventDefault();
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.on('init', function () {
- if (editor.inline) {
- // Remove default tabIndex in inline mode
- DOM.setAttrib(editor.getBody(), 'tabIndex', null);
- }
-
- editor.on('keyup', tabCancel);
-
- if (Env.gecko) {
- editor.on('keypress keydown', tabHandler);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (el) {
+ var focusEditor = global$2.get(el.id || el.name);
+ if (el.id && focusEditor) {
+ focusEditor.focus();
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('keydown', tabHandler);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global$4.setTimeout(function () {
+ if (!global$3.webkit) {
+ window.focus();
+ }
+ el.focus();
+ }, 10);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ e.preventDefault();
+ }
+ }
+ editor.on('init', function () {
+ if (editor.inline) {
+ DOM.setAttrib(editor.getBody(), 'tabIndex', null);
+ }
+ editor.on('keyup', tabCancel);
+ if (global$3.gecko) {
+ editor.on('keypress keydown', tabHandler);
+ } else {
+ editor.on('keydown', tabHandler);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_4nj741jujfuw8q2z = { setup: setup };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('tabfocus', function (editor) {
+ $_4nj741jujfuw8q2z.setup(editor);
+ });
+ function Plugin () {
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return function () { };
- }
-);
-dem('tinymce.plugins.tabfocus.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
+
+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginstabfocuspluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("7",tinymce.util.Tools.resolve),g("1",[&q
uot;7"],function(a){return a("tinymce.PluginManager")}),g("2",["7"],function(a){return a("tinymce.dom.DOMUtils")}),g("3",["7"],function(a){return a("tinymce.util.Tools")}),g("4",["7"],function(a){return a("tinymce.EditorManager")}),g("5",["7"],function(a){return a("tinymce.util.Delay")}),g("6",["7"],function(a){return a("tinymce.Env")}),g("0",["1","2","3","4","5","6"],function(a,b,c,d,e,f){return a.add("tabfocus",function(a){function g(a){9!==a.keyCode||a.ctrlKey||a.altKey||a.metaKey||a.preventDefault()}function h(b){function g(e){function f(a){return"BODY"===a.nodeName||"hidden"!=a.type&&"none"!=a.style.display&&"hidden"!=a.style.visibility&&f(a.parentNode)}function g(a){return/
INPUT|TEXTAREA|BUTTON/.test(a.tagName)&&d.get(b.id)&&a.tabIndex!=-1&&f(a)}if(j=i.select(":input:enabled,*[tabindex]:not(iframe)"),c.each(j,function(b,c){if(b.id==a.id)return h=c,!1}),e>0){for(l=h+1;l<j.length;l++)if(g(j[l]))return j[l]}else for(l=h-1;l>=0;l--)if(g(j[l]))return j[l];return null}var h,j,k,l;if(!(9!==b.keyCode||b.ctrlKey||b.altKey||b.metaKey||b.isDefaultPrevented())&&(k=c.explode(a.getParam("tab_focus",a.getParam("tabfocus_elements",":prev,:next"))),1==k.length&&(k[1]=k[0],k[0]=":prev"),j=b.shiftKey?":prev"==k[0]?g(-1):i.get(k[0]):":next"==k[1]?g(1):i.get(k[1]))){var m=d.get(j.id||j.name);j.id&&m?m.focus():e.setTimeout(function(){f.webkit||window.focus(),j.focus()},10),b.preventDefault()}}var i=b.DOM;a.on("init",function(){a.inline&&i.setAttrib(a.getBody(),"tabIndex",null),a.on("keyup",g),f.gecko?a.on("
;keypress keydown",h):a.on("keydown",h)})}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=tinymce.util.Tools.resolve("tinymce.EditorManager"),s=tinymce.util.Tools.resolve("tinymce.Env"),a=tinymce.util.Tools.resolve("tinymce.util.Delay"),y=tinymce.util.Tools.resolve("tinymce.util.Tools"),f=tinymce.util.Tools.resolve("tinymce.util.VK"),d={getTabFocus:function(e){return e.getParam("tab_focus",e.getParam("tabfocus_elements",":prev,:next"))}},m=t.DOM,n=function(e){e.keyCode!==f.TAB||e.ctrlKey||e.altKey||e.metaKey||e.preventDefault()},i=function(r){function e(n){var i,o,e,l;if(!(n.keyCode!==f.TAB||n.ctrlKey||n.altKey||n.metaKey||n.isDefaultPrevented())&&(1===(e=y.explode(d.getTabFocus(r))).length&&(e[1]=e[0],e[0]=":pr
ev"),o=n.shiftKey?":prev"===e[0]?u(-1):m.get(e[0]):":next"===e[1]?u(1):m.get(e[1]))){var t=c.get(o.id||o.name);o.id&&t?t.focus():a.setTimeout(function(){s.webkit||window.focus(),o.focus()},10),n.preventDefault()}function u(e){function t(t){return/INPUT|TEXTAREA|BUTTON/.test(t.tagName)&&c.get(n.id)&&-1!==t.tabIndex&&function e(t){return"BODY"===t.nodeName||"hidden"!==t.type&&"none"!==t.style.display&&"hidden"!==t.style.visibility&&e(t.parentNode)}(t)}if(o=m.select(":input:enabled,*[tabindex]:not(iframe)"),y.each(o,function(e,t){if(e.id===r.id)return i=t,!1}),0<e){for(l=i+1;l<o.length;l++)if(t(o[l]))return o[l]}else for(l=i-1;0<=l;l--)if(t(o[l]))return o[l];return null}}r.on("init",function(){r.inline&&m.setAttrib(r.getBody(),"tabIndex",null),r.on("keyup",n),s.gecko?r.on("keypress keydown",e):r.on(&q
uot;keydown",e)})};e.add("tabfocus",function(e){i(e)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginstextcolorpluginjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/textcolor/plugin.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/textcolor/plugin.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/textcolor/plugin.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,483 +1,346 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var textcolor = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.PluginManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
-
-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
-
-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getCurrentColor = function (editor, format) {
+ var color;
+ editor.dom.getParents(editor.selection.getStart(), function (elm) {
+ var value;
+ if (value = elm.style[format === 'forecolor' ? 'color' : 'background-color']) {
+ color = value;
+ }
+ });
+ return color;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
-
-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
-
-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
-
-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var mapColors = function (colorMap) {
+ var i;
+ var colors = [];
+ for (i = 0; i < colorMap.length; i += 2) {
+ colors.push({
+ text: colorMap[i + 1],
+ color: '#' + colorMap[i]
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return colors;
+ };
+ var applyFormat = function (editor, format, value) {
+ editor.undoManager.transact(function () {
+ editor.focus();
+ editor.formatter.apply(format, { value: value });
+ editor.nodeChanged();
+ });
+ };
+ var removeFormat = function (editor, format) {
+ editor.undoManager.transact(function () {
+ editor.focus();
+ editor.formatter.remove(format, { value: null }, null, true);
+ editor.nodeChanged();
+ });
+ };
+ var $_4zaeklqljfuw8rym = {
+ getCurrentColor: getCurrentColor,
+ mapColors: mapColors,
+ applyFormat: applyFormat,
+ removeFormat: removeFormat
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.plugins.textcolor.Plugin","tinymce.core.dom.DOMUtils","tinymce.core.PluginManager","tinymce.core.util.I18n","tinymce.core.util.Tools","global!tinymce.util.Tools.resolve"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor) {
+ editor.addCommand('mceApplyTextcolor', function (format, value) {
+ $_4zaeklqljfuw8rym.applyFormat(editor, format, value);
+ });
+ editor.addCommand('mceRemoveTextcolor', function (format) {
+ $_4zaeklqljfuw8rym.removeFormat(editor, format);
+ });
+ };
+ var $_5bxwpcqkjfuw8ryl = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.dom.DOMUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.DOMUtils');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.PluginManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.PluginManager');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var defaultColorMap = [
+ '000000',
+ 'Black',
+ '993300',
+ 'Burnt orange',
+ '333300',
+ 'Dark olive',
+ '003300',
+ 'Dark green',
+ '003366',
+ 'Dark azure',
+ '000080',
+ 'Navy Blue',
+ '333399',
+ 'Indigo',
+ '333333',
+ 'Very dark gray',
+ '800000',
+ 'Maroon',
+ 'FF6600',
+ 'Orange',
+ '808000',
+ 'Olive',
+ '008000',
+ 'Green',
+ '008080',
+ 'Teal',
+ '0000FF',
+ 'Blue',
+ '666699',
+ 'Grayish blue',
+ '808080',
+ 'Gray',
+ 'FF0000',
+ 'Red',
+ 'FF9900',
+ 'Amber',
+ '99CC00',
+ 'Yellow green',
+ '339966',
+ 'Sea green',
+ '33CCCC',
+ 'Turquoise',
+ '3366FF',
+ 'Royal blue',
+ '800080',
+ 'Purple',
+ '999999',
+ 'Medium gray',
+ 'FF00FF',
+ 'Magenta',
+ 'FFCC00',
+ 'Gold',
+ 'FFFF00',
+ 'Yellow',
+ '00FF00',
+ 'Lime',
+ '00FFFF',
+ 'Aqua',
+ '00CCFF',
+ 'Sky blue',
+ '993366',
+ 'Red violet',
+ 'FFFFFF',
+ 'White',
+ 'FF99CC',
+ 'Pink',
+ 'FFCC99',
+ 'Peach',
+ 'FFFF99',
+ 'Light yellow',
+ 'CCFFCC',
+ 'Pale green',
+ 'CCFFFF',
+ 'Pale cyan',
+ '99CCFF',
+ 'Light sky blue',
+ 'CC99FF',
+ 'Plum'
+ ];
+ var getTextColorMap = function (editor) {
+ return editor.getParam('textcolor_map', defaultColorMap);
+ };
+ var getForeColorMap = function (editor) {
+ return editor.getParam('forecolor_map', getTextColorMap(editor));
+ };
+ var getBackColorMap = function (editor) {
+ return editor.getParam('backcolor_map', getTextColorMap(editor));
+ };
+ var getTextColorRows = function (editor) {
+ return editor.getParam('textcolor_rows', 5);
+ };
+ var getTextColorCols = function (editor) {
+ return editor.getParam('textcolor_cols', 8);
+ };
+ var getForeColorRows = function (editor) {
+ return editor.getParam('forecolor_rows', getTextColorRows(editor));
+ };
+ var getBackColorRows = function (editor) {
+ return editor.getParam('backcolor_rows', getTextColorRows(editor));
+ };
+ var getForeColorCols = function (editor) {
+ return editor.getParam('forecolor_cols', getTextColorCols(editor));
+ };
+ var getBackColorCols = function (editor) {
+ return editor.getParam('backcolor_cols', getTextColorCols(editor));
+ };
+ var getColorPickerCallback = function (editor) {
+ return editor.getParam('color_picker_callback', null);
+ };
+ var hasColorPicker = function (editor) {
+ return typeof getColorPickerCallback(editor) === 'function';
+ };
+ var $_92xy2xqpjfuw8ryt = {
+ getForeColorMap: getForeColorMap,
+ getBackColorMap: getBackColorMap,
+ getForeColorRows: getForeColorRows,
+ getBackColorRows: getBackColorRows,
+ getForeColorCols: getForeColorCols,
+ getBackColorCols: getBackColorCols,
+ getColorPickerCallback: getColorPickerCallback,
+ hasColorPicker: hasColorPicker
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$3 = tinymce.util.Tools.resolve('tinymce.util.I18n');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.util.I18n',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.I18n');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getHtml = function (cols, rows, colorMap, hasColorPicker) {
+ var colors, color, html, last, x, y, i, count = 0;
+ var id = global$1.DOM.uniqueId('mcearia');
+ var getColorCellHtml = function (color, title) {
+ var isNoColor = color === 'transparent';
+ return '<td class="mce-grid-cell' + (isNoColor ? ' mce-colorbtn-trans' : '') + '">' + '<div id="' + id + '-' + count++ + '"' + ' data-mce-color="' + (color ? color : '') + '"' + ' role="option"' + ' tabIndex="-1"' + ' style="' + (color ? 'background-color: ' + color : '') + '"' + ' title="' + global$3.translate(title) + '">' + (isNoColor ? '×' : '') + '</div>' + '</td>';
+ };
+ colors = $_4zaeklqljfuw8rym.mapColors(colorMap);
+ colors.push({
+ text: global$3.translate('No color'),
+ color: 'transparent'
+ });
+ html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>';
+ last = colors.length - 1;
+ for (y = 0; y < rows; y++) {
+ html += '<tr>';
+ for (x = 0; x < cols; x++) {
+ i = y * cols + x;
+ if (i > last) {
+ html += '<td></td>';
+ } else {
+ color = colors[i];
+ html += getColorCellHtml(color.color, color.text);
+ }
+ }
+ html += '</tr>';
+ }
+ if (hasColorPicker) {
+ html += '<tr>' + '<td colspan="' + cols + '" class="mce-custom-color-btn">' + '<div id="' + id + '-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" ' + 'role="button" tabindex="-1" aria-labelledby="' + id + '-c" style="width: 100%">' + '<button type="button" role="presentation" tabindex="-1">' + global$3.translate('Custom...') + '</button>' + '</div>' + '</td>' + '</tr>';
+ html += '<tr>';
+ for (x = 0; x < cols; x++) {
+ html += getColorCellHtml('', 'Custom color');
+ }
+ html += '</tr>';
+ }
+ html += '</tbody></table>';
+ return html;
+ };
+ var $_2vokwrqqjfuw8ryv = { getHtml: getHtml };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
- }
-);
-
-/**
- * Plugin.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains all core logic for the code plugin.
- *
- * @class tinymce.textcolor.Plugin
- * @private
- */
-define(
- 'tinymce.plugins.textcolor.Plugin',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.PluginManager',
- 'tinymce.core.util.I18n',
- 'tinymce.core.util.Tools'
- ],
- function (DOMUtils, PluginManager, I18n, Tools) {
- var translate = I18n.translate;
-
- PluginManager.add('textcolor', function (editor) {
- var cols, rows;
-
- rows = {
- forecolor: editor.settings.forecolor_rows || editor.settings.textcolor_rows || 5,
- backcolor: editor.settings.backcolor_rows || editor.settings.textcolor_rows || 5
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setDivColor = function setDivColor(div, value) {
+ div.style.background = value;
+ div.setAttribute('data-mce-color', value);
+ };
+ var onButtonClick = function (editor) {
+ return function (e) {
+ var ctrl = e.control;
+ if (ctrl._color) {
+ editor.execCommand('mceApplyTextcolor', ctrl.settings.format, ctrl._color);
+ } else {
+ editor.execCommand('mceRemoveTextcolor', ctrl.settings.format);
+ }
+ };
+ };
+ var onPanelClick = function (editor, cols) {
+ return function (e) {
+ var buttonCtrl = this.parent();
+ var value;
+ var currentColor = $_4zaeklqljfuw8rym.getCurrentColor(editor, buttonCtrl.settings.format);
+ var selectColor = function (value) {
+ buttonCtrl.hidePanel();
+ buttonCtrl.color(value);
+ editor.execCommand('mceApplyTextcolor', buttonCtrl.settings.format, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- cols = {
- forecolor: editor.settings.forecolor_cols || editor.settings.textcolor_cols || 8,
- backcolor: editor.settings.backcolor_cols || editor.settings.textcolor_cols || 8
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var resetColor = function () {
+ buttonCtrl.hidePanel();
+ buttonCtrl.resetColor();
+ editor.execCommand('mceRemoveTextcolor', buttonCtrl.settings.format);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getCurrentColor(format) {
- var color;
-
- editor.dom.getParents(editor.selection.getStart(), function (elm) {
- var value;
-
- if ((value = elm.style[format == 'forecolor' ? 'color' : 'background-color'])) {
- color = value;
- }
- });
-
- return color;
- }
-
- function mapColors(type) {
- var i, colors = [], colorMap;
-
- colorMap = [
- "000000", "Black",
- "993300", "Burnt orange",
- "333300", "Dark olive",
- "003300", "Dark green",
- "003366", "Dark azure",
- "000080", "Navy Blue",
- "333399", "Indigo",
- "333333", "Very dark gray",
- "800000", "Maroon",
- "FF6600", "Orange",
- "808000", "Olive",
- "008000", "Green",
- "008080", "Teal",
- "0000FF", "Blue",
- "666699", "Grayish blue",
- "808080", "Gray",
- "FF0000", "Red",
- "FF9900", "Amber",
- "99CC00", "Yellow green",
- "339966", "Sea green",
- "33CCCC", "Turquoise",
- "3366FF", "Royal blue",
- "800080", "Purple",
- "999999", "Medium gray",
- "FF00FF", "Magenta",
- "FFCC00", "Gold",
- "FFFF00", "Yellow",
- "00FF00", "Lime",
- "00FFFF", "Aqua",
- "00CCFF", "Sky blue",
- "993366", "Red violet",
- "FFFFFF", "White",
- "FF99CC", "Pink",
- "FFCC99", "Peach",
- "FFFF99", "Light yellow",
- "CCFFCC", "Pale green",
- "CCFFFF", "Pale cyan",
- "99CCFF", "Light sky blue",
- "CC99FF", "Plum"
- ];
-
- colorMap = editor.settings.textcolor_map || colorMap;
- colorMap = editor.settings[type + '_map'] || colorMap;
-
- for (i = 0; i < colorMap.length; i += 2) {
- colors.push({
- text: colorMap[i + 1],
- color: '#' + colorMap[i]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (global$1.DOM.getParent(e.target, '.mce-custom-color-btn')) {
+ buttonCtrl.hidePanel();
+ var colorPickerCallback = $_92xy2xqpjfuw8ryt.getColorPickerCallback(editor);
+ colorPickerCallback.call(editor, function (value) {
+ var tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0];
+ var customColorCells, div, i;
+ customColorCells = global$2.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function (elm) {
+ return elm.firstChild;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return colors;
- }
-
- function renderColorPicker() {
- var self = this, colors, color, html, last, x, y, i, id = self._id, count = 0, type;
-
- type = self.settings.origin;
-
- function getColorCellHtml(color, title) {
- var isNoColor = color == 'transparent';
-
- return (
- '<td class="mce-grid-cell' + (isNoColor ? ' mce-colorbtn-trans' : '') + '">' +
- '<div id="' + id + '-' + (count++) + '"' +
- ' data-mce-color="' + (color ? color : '') + '"' +
- ' role="option"' +
- ' tabIndex="-1"' +
- ' style="' + (color ? 'background-color: ' + color : '') + '"' +
- ' title="' + translate(title) + '">' +
- (isNoColor ? '×' : '') +
- '</div>' +
- '</td>'
- );
- }
-
- colors = mapColors(type);
- colors.push({
- text: translate("No color"),
- color: "transparent"
- });
-
- html = '<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>';
- last = colors.length - 1;
-
- for (y = 0; y < rows[type]; y++) {
- html += '<tr>';
-
- for (x = 0; x < cols[type]; x++) {
- i = y * cols[type] + x;
-
- if (i > last) {
- html += '<td></td>';
- } else {
- color = colors[i];
- html += getColorCellHtml(color.color, color.text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (i = 0; i < customColorCells.length; i++) {
+ div = customColorCells[i];
+ if (!div.getAttribute('data-mce-color')) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- html += '</tr>';
- }
-
- if (editor.settings.color_picker_callback) {
- html += (
- '<tr>' +
- '<td colspan="' + cols[type] + '" class="mce-custom-color-btn">' +
- '<div id="' + id + '-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" ' +
- 'role="button" tabindex="-1" aria-labelledby="' + id + '-c" style="width: 100%">' +
- '<button type="button" role="presentation" tabindex="-1">' + translate('Custom...') + '</button>' +
- '</div>' +
- '</td>' +
- '</tr>'
- );
-
- html += '<tr>';
-
- for (x = 0; x < cols[type]; x++) {
- html += getColorCellHtml('', 'Custom color');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (i === cols) {
+ for (i = 0; i < cols - 1; i++) {
+ setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color'));
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- html += '</tr>';
- }
-
- html += '</tbody></table>';
-
- return html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ setDivColor(div, value);
+ selectColor(value);
+ }, currentColor);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function applyFormat(format, value) {
- editor.undoManager.transact(function () {
- editor.focus();
- editor.formatter.apply(format, { value: value });
- editor.nodeChanged();
- });
- }
-
- function removeFormat(format) {
- editor.undoManager.transact(function () {
- editor.focus();
- editor.formatter.remove(format, { value: null }, null, true);
- editor.nodeChanged();
- });
- }
-
- function onPanelClick(e) {
- var buttonCtrl = this.parent(), value, type;
-
- type = buttonCtrl.settings.origin;
-
- function selectColor(value) {
- buttonCtrl.hidePanel();
- buttonCtrl.color(value);
- applyFormat(buttonCtrl.settings.format, value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ value = e.target.getAttribute('data-mce-color');
+ if (value) {
+ if (this.lastId) {
+ global$1.DOM.get(this.lastId).setAttribute('aria-selected', 'false');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function resetColor() {
- buttonCtrl.hidePanel();
- buttonCtrl.resetColor();
- removeFormat(buttonCtrl.settings.format);
- }
-
- function setDivColor(div, value) {
- div.style.background = value;
- div.setAttribute('data-mce-color', value);
- }
-
- if (DOMUtils.DOM.getParent(e.target, '.mce-custom-color-btn')) {
- buttonCtrl.hidePanel();
-
- editor.settings.color_picker_callback.call(editor, function (value) {
- var tableElm = buttonCtrl.panel.getEl().getElementsByTagName('table')[0];
- var customColorCells, div, i;
-
- customColorCells = Tools.map(tableElm.rows[tableElm.rows.length - 1].childNodes, function (elm) {
- return elm.firstChild;
- });
-
- for (i = 0; i < customColorCells.length; i++) {
- div = customColorCells[i];
- if (!div.getAttribute('data-mce-color')) {
- break;
- }
- }
-
- // Shift colors to the right
- // TODO: Might need to be the left on RTL
- if (i == cols[type]) {
- for (i = 0; i < cols[type] - 1; i++) {
- setDivColor(customColorCells[i], customColorCells[i + 1].getAttribute('data-mce-color'));
- }
- }
-
- setDivColor(div, value);
- selectColor(value);
- }, getCurrentColor(buttonCtrl.settings.format));
- }
-
- value = e.target.getAttribute('data-mce-color');
- if (value) {
- if (this.lastId) {
- document.getElementById(this.lastId).setAttribute('aria-selected', false);
- }
-
- e.target.setAttribute('aria-selected', true);
- this.lastId = e.target.id;
-
- if (value == 'transparent') {
- resetColor();
- } else {
- selectColor(value);
- }
- } else if (value !== null) {
- buttonCtrl.hidePanel();
- }
- }
-
- function onButtonClick() {
- var self = this;
-
- if (self._color) {
- applyFormat(self.settings.format, self._color);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ e.target.setAttribute('aria-selected', true);
+ this.lastId = e.target.id;
+ if (value === 'transparent') {
+ resetColor();
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- removeFormat(self.settings.format);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ selectColor(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (value !== null) {
+ buttonCtrl.hidePanel();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ };
+ var renderColorPicker = function (editor, foreColor) {
+ return function () {
+ var cols = foreColor ? $_92xy2xqpjfuw8ryt.getForeColorCols(editor) : $_92xy2xqpjfuw8ryt.getBackColorCols(editor);
+ var rows = foreColor ? $_92xy2xqpjfuw8ryt.getForeColorRows(editor) : $_92xy2xqpjfuw8ryt.getBackColorRows(editor);
+ var colorMap = foreColor ? $_92xy2xqpjfuw8ryt.getForeColorMap(editor) : $_92xy2xqpjfuw8ryt.getBackColorMap(editor);
+ var hasColorPicker = $_92xy2xqpjfuw8ryt.hasColorPicker(editor);
+ return $_2vokwrqqjfuw8ryv.getHtml(cols, rows, colorMap, hasColorPicker);
+ };
+ };
+ var register$1 = function (editor) {
+ editor.addButton('forecolor', {
+ type: 'colorbutton',
+ tooltip: 'Text color',
+ format: 'forecolor',
+ panel: {
+ role: 'application',
+ ariaRemember: true,
+ html: renderColorPicker(editor, true),
+ onclick: onPanelClick(editor, $_92xy2xqpjfuw8ryt.getForeColorCols(editor))
+ },
+ onclick: onButtonClick(editor)
+ });
+ editor.addButton('backcolor', {
+ type: 'colorbutton',
+ tooltip: 'Background color',
+ format: 'hilitecolor',
+ panel: {
+ role: 'application',
+ ariaRemember: true,
+ html: renderColorPicker(editor, false),
+ onclick: onPanelClick(editor, $_92xy2xqpjfuw8ryt.getBackColorCols(editor))
+ },
+ onclick: onButtonClick(editor)
+ });
+ };
+ var $_f806lqqmjfuw8ryo = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addButton('forecolor', {
- type: 'colorbutton',
- tooltip: 'Text color',
- format: 'forecolor',
- panel: {
- origin: 'forecolor',
- role: 'application',
- ariaRemember: true,
- html: renderColorPicker,
- onclick: onPanelClick
- },
- onclick: onButtonClick
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global.add('textcolor', function (editor) {
+ $_5bxwpcqkjfuw8ryl.register(editor);
+ $_f806lqqmjfuw8ryo.register(editor);
+ });
+ function Plugin () {
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addButton('backcolor', {
- type: 'colorbutton',
- tooltip: 'Background color',
- format: 'hilitecolor',
- panel: {
- origin: 'backcolor',
- role: 'application',
- ariaRemember: true,
- html: renderColorPicker,
- onclick: onPanelClick
- },
- onclick: onButtonClick
- });
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Plugin;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return function () { };
- }
-);
-dem('tinymce.plugins.textcolor.Plugin')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcepluginstextcolorpluginminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/plugins/textcolor/plugin.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/plugins/textcolor/plugin.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/plugins/textcolor/plugin.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("5",tinymce.util.Tools.resolve),g("1",[&q
uot;5"],function(a){return a("tinymce.dom.DOMUtils")}),g("2",["5"],function(a){return a("tinymce.PluginManager")}),g("3",["5"],function(a){return a("tinymce.util.I18n")}),g("4",["5"],function(a){return a("tinymce.util.Tools")}),g("0",["1","2","3","4"],function(a,b,c,d){var e=c.translate;return b.add("textcolor",function(b){function c(a){var c;return b.dom.getParents(b.selection.getStart(),function(b){var d;(d=b.style["forecolor"==a?"color":"background-color"])&&(c=d)}),c}function f(a){var c,d,e=[];for(d=["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo"
;,"333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Magenta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","FFFFFF","White","FF99CC",&qu
ot;Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum"],d=b.settings.textcolor_map||d,d=b.settings[a+"_map"]||d,c=0;c<d.length;c+=2)e.push({text:d[c+1],color:"#"+d[c]});return e}function g(){function a(a,b){var c="transparent"==a;return'<td class="mce-grid-cell'+(c?" mce-colorbtn-trans":"")+'"><div id="'+p+"-"+q++ +'" data-mce-color="'+(a?a:"")+'" role="option" tabIndex="-1" style="'+(a?"background-color: "+a:"")+'" title="'+e(b)+'">'+(c?"×":"")+"</div></td>"}var c,d,g,h,i,j,k,n,o=this,p=o._id,q=0;for(n=o.settings.origin,c=f(n),c.push({text:e("No color&qu
ot;),color:"transparent"}),g='<table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',h=c.length-1,j=0;j<m[n];j++){for(g+="<tr>",i=0;i<l[n];i++)k=j*l[n]+i,k>h?g+="<td></td>":(d=c[k],g+=a(d.color,d.text));g+="</tr>"}if(b.settings.color_picker_callback){for(g+='<tr><td colspan="'+l[n]+'" class="mce-custom-color-btn"><div id="'+p+'-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" role="button" tabindex="-1" aria-labelledby="'+p+'-c" style="width: 100%"><button type="button" role="presentation" tabindex="-1">'+e("Custom...")+"</button></div></td></tr>",g+="<tr>",i=0;i<l[n];i++)g+=a("","Custom color");g+="&l
t;/tr>"}return g+="</tbody></table>"}function h(a,c){b.undoManager.transact(function(){b.focus(),b.formatter.apply(a,{value:c}),b.nodeChanged()})}function i(a){b.undoManager.transact(function(){b.focus(),b.formatter.remove(a,{value:null},null,!0),b.nodeChanged()})}function j(e){function f(a){n.hidePanel(),n.color(a),h(n.settings.format,a)}function g(){n.hidePanel(),n.resetColor(),i(n.settings.format)}function j(a,b){a.style.background=b,a.setAttribute("data-mce-color",b)}var k,m,n=this.parent();m=n.settings.origin,a.DOM.getParent(e.target,".mce-custom-color-btn")&&(n.hidePanel(),b.settings.color_picker_callback.call(b,function(a){var b,c,e,g=n.panel.getEl().getElementsByTagName("table")[0];for(b=d.map(g.rows[g.rows.length-1].childNodes,function(a){return a.firstChild}),e=0;e<b.length&&(c=b[e],c.getAttribute("data-mce-color"));e++);if(e==l[m])for(e=0;e<l[m]-1;e++)j(b[e],b[e+1].getAttribute(&qu
ot;data-mce-color"));j(c,a),f(a)},c(n.settings.format))),k=e.target.getAttribute("data-mce-color"),k?(this.lastId&&document.getElementById(this.lastId).setAttribute("aria-selected",!1),e.target.setAttribute("aria-selected",!0),this.lastId=e.target.id,"transparent"==k?g():f(k)):null!==k&&n.hidePanel()}function k(){var a=this;a._color?h(a.settings.format,a._color):i(a.settings.format)}var l,m;m={forecolor:b.settings.forecolor_rows||b.settings.textcolor_rows||5,backcolor:b.settings.backcolor_rows||b.settings.textcolor_rows||5},l={forecolor:b.settings.forecolor_cols||b.settings.textcolor_cols||8,backcolor:b.settings.backcolor_cols||b.settings.textcolor_cols||8},b.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",format:"forecolor",panel:{origin:"forecolor",role:"application",ariaRemember:!0,html:g,onclick:j},onclick:k}),b.addButton("backcolor",{
type:"colorbutton",tooltip:"Background color",format:"hilitecolor",panel:{origin:"backcolor",role:"application",ariaRemember:!0,html:g,onclick:j},onclick:k})}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(t,o){var r;return t.dom.getParents(t.selection.getStart(),function(t){var e;(e=t.style["forecolor"===o?"color":"background-color"])&&(r=e)}),r},g=function(t){var e,o=[];for(e=0;e<t.length;e+=2)o.push({text:t[e+1],color:"#"+t[e]});return o},r=function(t,e,o){t.undoManager.transact(function(){t.focus(),t.formatter.apply(e,{value:o}),t.nodeChanged()})},e=function(t,e){t.undoManager.transact(function(){t.focus(),t.formatter.remove(e,{value:null},null,!0),t.nodeChanged()})},o=function(o){o.addCommand("mceApplyTextcolor",function(t,e){r(o,t,e)}),o.addCommand("mceRemoveTextcolor",function(t){e(o,t)})},F=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),i=tinymce.util.Tools.resolve("tinymce.util.To
ols"),a=["000000","Black","993300","Burnt orange","333300","Dark olive","003300","Dark green","003366","Dark azure","000080","Navy Blue","333399","Indigo","333333","Very dark gray","800000","Maroon","FF6600","Orange","808000","Olive","008000","Green","008080","Teal","0000FF","Blue","666699","Grayish blue","808080","Gray","FF0000","Red","FF9900","Amber","99CC00","Yellow green","339966","Sea green","33CCCC","Turquoise","3366FF","Royal blue","800080","Purple","999999","Medium gray","FF00FF","Mag
enta","FFCC00","Gold","FFFF00","Yellow","00FF00","Lime","00FFFF","Aqua","00CCFF","Sky blue","993366","Red violet","FFFFFF","White","FF99CC","Pink","FFCC99","Peach","FFFF99","Light yellow","CCFFCC","Pale green","CCFFFF","Pale cyan","99CCFF","Light sky blue","CC99FF","Plum"],l=function(t){return t.getParam("textcolor_map",a)},c=function(t){return t.getParam("textcolor_rows",5)},u=function(t){return t.getParam("textcolor_cols",8)},m=function(t){return t.getParam("color_picker_callback",null)},s=function(t){return t.getParam("forecolor_map",l(t))},d=function(t){return t.getParam("backcolor_map",l(t))},f=function(t){return t.getParam("forecolor
_rows",c(t))},b=function(t){return t.getParam("backcolor_rows",c(t))},p=function(t){return t.getParam("forecolor_cols",u(t))},C=function(t){return t.getParam("backcolor_cols",u(t))},y=m,v=function(t){return"function"==typeof m(t)},h=tinymce.util.Tools.resolve("tinymce.util.I18n"),P=function(t,e,o,r){var n,a,l,c,i,u,m,s=0,d=F.DOM.uniqueId("mcearia"),f=function(t,e){var o="transparent"===t;return'<td class="mce-grid-cell'+(o?" mce-colorbtn-trans":"")+'"><div id="'+d+"-"+s+++'" data-mce-color="'+(t||"")+'" role="option" tabIndex="-1" style="'+(t?"background-color: "+t:"")+'" title="'+h.translate(e)+'">'+(o?"×":"")+"</div></td>"};for((n=g(o)).push({text:h.translate("No color"),color:"transparent"}),l='&l
t;table class="mce-grid mce-grid-border mce-colorbutton-grid" role="list" cellspacing="0"><tbody>',c=n.length-1,u=0;u<e;u++){for(l+="<tr>",i=0;i<t;i++)l+=c<(m=u*t+i)?"<td></td>":f((a=n[m]).color,a.text);l+="</tr>"}if(r){for(l+='<tr><td colspan="'+t+'" class="mce-custom-color-btn"><div id="'+d+'-c" class="mce-widget mce-btn mce-btn-small mce-btn-flat" role="button" tabindex="-1" aria-labelledby="'+d+'-c" style="width: 100%"><button type="button" role="presentation" tabindex="-1">'+h.translate("Custom...")+"</button></div></td></tr>",l+="<tr>",i=0;i<t;i++)l+=f("","Custom color");l+="</tr>"}return l+="</tbody></table>"},k=function(t,e)
{t.style.background=e,t.setAttribute("data-mce-color",e)},x=function(o){return function(t){var e=t.control;e._color?o.execCommand("mceApplyTextcolor",e.settings.format,e._color):o.execCommand("mceRemoveTextcolor",e.settings.format)}},T=function(r,c){return function(t){var e,a=this.parent(),o=n(r,a.settings.format),l=function(t){a.hidePanel(),a.color(t),r.execCommand("mceApplyTextcolor",a.settings.format,t)};F.DOM.getParent(t.target,".mce-custom-color-btn")&&(a.hidePanel(),y(r).call(r,function(t){var e,o,r,n=a.panel.getEl().getElementsByTagName("table")[0];for(e=i.map(n.rows[n.rows.length-1].childNodes,function(t){return t.firstChild}),r=0;r<e.length&&(o=e[r]).getAttribute("data-mce-color");r++);if(r===c)for(r=0;r<c-1;r++)k(e[r],e[r+1].getAttribute("data-mce-color"));k(o,t),l(t)},o)),(e=t.target.getAttribute("data-mce-color"))?(this.lastId&&F.DOM.get(this.lastId).se
tAttribute("aria-selected","false"),t.target.setAttribute("aria-selected",!0),this.lastId=t.target.id,"transparent"===e?(a.hidePanel(),a.resetColor(),r.execCommand("mceRemoveTextcolor",a.settings.format)):l(e)):null!==e&&a.hidePanel()}},_=function(n,a){return function(){var t=a?p(n):C(n),e=a?f(n):b(n),o=a?s(n):d(n),r=v(n);return P(t,e,o,r)}},A=function(t){t.addButton("forecolor",{type:"colorbutton",tooltip:"Text color",format:"forecolor",panel:{role:"application",ariaRemember:!0,html:_(t,!0),onclick:T(t,p(t))},onclick:x(t)}),t.addButton("backcolor",{type:"colorbutton",tooltip:"Background color",format:"hilitecolor",panel:{role:"application",ariaRemember:!0,html:_(t,!1),onclick:T(t,C(t))},onclick:x(t)})};t.add("textcolor",function(t){o(t),A(t)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinslightgraycontentinlinemincss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/skins/lightgray/content.inline.min.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/skins/lightgray/content.inline.min.css 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/skins/lightgray/content.inline.min.css 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected=&quo
t;2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-
only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}.mce-resize-bar-dragging{background-color:blue;opacity:.25;filter:alpha(opacity=25);zoom:1}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2d8ac7}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #7ACAFF}.mce-content-body *[contentEditable=false][data-mce-
selected]{outline:2px solid #2d8ac7}.mce-content-body a[data-mce-selected],.mce-content-body code[data-mce-selected],.mce-content-body b[data-mce-selected],.mce-content-body i[data-mce-selected],.mce-content-body em[data-mce-selected],.mce-content-body strong[data-mce-selected],.mce-content-body sup[data-mce-selected],.mce-content-body sub[data-mce-selected]{background:#bfe6ff}.mce-content-body hr{cursor:default}.mce-content-body{line-height:1.3}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:normal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected=&quo
t;2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{border:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-
only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid rgba(208,2,27,0.5);cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected],th[data-mce-selected]{background-color:#2276d2 !important}.mce-edit-focus{outline:1px dotted #333}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2276d2}.mce-content-body *[data-mce-selected=&qu
ot;inline-boundary"]{background:#bfe6ff}.mce-content-body .mce-item-anchor[data-mce-selected]{background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-content-body hr{cursor:default}.mce-content-body table{-webkit-nbsp-mode:normal}.ephox-snooker-resizer-bar{background-color:#2276d2;opacity:0}.ephox-snooker-resizer-cols{cursor:col-resize}.ephox-snooker-resizer-rows{cursor:row-resize}.ephox-snooker-resizer-bar.ephox-snooker-resizer-bar-dragging{opacity:.2}.mce-content-body{line-height:1.3}
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinslightgraycontentmincss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/skins/lightgray/content.min.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/skins/lightgray/content.min.css 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/skins/lightgray/content.min.css 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;line-height:1.3;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDDDDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px}.word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:nor
mal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{bor
der:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data-mce-selected]
,th[data-mce-selected]{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333}.mce-resize-bar-dragging{background-color:blue;opacity:.25;filter:alpha(opacity=25);zoom:1}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2d8ac7}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #7ACAFF}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2d8ac7}.mce-content-body a[data-mce-selected],.mce-content-body code[data-mce-selected],.mce-content-body b[data-mce-selected],.mce-content-body i[data-mce-selected],.mce-content-body em[data-mce-selected],.mce-content-body strong[data-mce-selected],.mce-content-body sup[data-mce-selected],.mce-content-body sub[data-mce-selected]{background:#bfe6ff}.mce-content-body hr{cursor:default}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;line-height:1.3;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDDDDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px}.word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-content-body .mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:black;font-family:Arial;font-size:11px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;line-height:nor
mal;font-weight:normal;text-align:left;-webkit-tap-highlight-color:transparent;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-object{border:1px dotted #3A3A3A;background:#D5D5D5 url(img/object.gif) no-repeat center}.mce-preview-object{display:inline-block;position:relative;margin:0 2px 0 2px;line-height:0;border:1px solid gray}.mce-preview-object[data-mce-selected="2"] .mce-shim{display:none}.mce-preview-object .mce-shim{position:absolute;top:0;left:0;width:100%;height:100%;background:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)}figure.align-left{float:left}figure.align-right{float:right}figure.image.align-center{display:table;margin-left:auto;margin-right:auto}figure.image{display:inline-block;border:1px solid gray;margin:0 2px 0 1px;background:#f5f2f0}figure.image img{margin:8px 8px 0 8px}figure.image figcaption{margin:6px 8px 6px 8px;text-align:center}.mce-toc{bor
der:1px solid gray}.mce-toc h2{margin:4px}.mce-toc li{list-style-type:none}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-nbsp,.mce-shy{background:#AAA}.mce-shy::after{content:'-'}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid rgba(208,2,27,0.5);cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td[data
-mce-selected],th[data-mce-selected]{background-color:#2276d2 !important}.mce-edit-focus{outline:1px dotted #333}.mce-content-body *[contentEditable=false] *[contentEditable=true]:focus{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false] *[contentEditable=true]:hover{outline:2px solid #2276d2}.mce-content-body *[contentEditable=false][data-mce-selected]{outline:2px solid #2276d2}.mce-content-body *[data-mce-selected="inline-boundary"]{background:#bfe6ff}.mce-content-body .mce-item-anchor[data-mce-selected]{background:#D5D5D5 url(img/anchor.gif) no-repeat center}.mce-content-body hr{cursor:default}.mce-content-body table{-webkit-nbsp-mode:normal}.ephox-snooker-resizer-bar{background-color:#2276d2;opacity:0}.ephox-snooker-resizer-cols{cursor:col-resize}.ephox-snooker-resizer-rows{cursor:row-resize}.ephox-snooker-resizer-bar.ephox-snooker-resizer-bar-dragging{opacity:.2}
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinslightgrayfontstinymceeot"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.eot</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinslightgrayfontstinymcesvg"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.svg</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.svg 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.svg 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -79,7 +79,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <glyph unicode="" glyph-name="tabledeleterow" d="M886.4 572.8l-156.8-156.8 160-160-76.8-76.8-160 160-156.8-156.8-76.8 73.6 160 160-163.2 163.2 76.8 76.8 163.2-163.2 156.8 156.8 73.6-76.8zM0 896v-896h1024v896h-1024zM960 576h-22.4l-64-64h86.4v-192h-89.6l64-64h25.6v-192h-896v192h310.4l64 64h-374.4v192h371.2l-64 64h-307.2v192h896v-192z" />
</span><span class="cx" style="display: block; padding: 0 10px"> <glyph unicode="" glyph-name="tabledeletecol" d="M320 499.2l64-64v-12.8l-64-64v140.8zM640 422.4l64-64v137.6l-64-64v-9.6zM1024 896v-896h-1024v896h1024zM960 768h-256v-51.2l-12.8 12.8-51.2-51.2v89.6h-256v-89.6l-51.2 51.2-12.8-12.8v51.2h-256v-704h256v118.4l35.2-35.2 28.8 28.8v-115.2h256v115.2l48-48 16 16v-83.2h256v707.2zM672 662.4l-156.8-156.8-163.2 163.2-76.8-76.8 163.2-163.2-156.8-156.8 76.8-76.8 156.8 156.8 160-160 76.8 76.8-160 160 156.8 156.8-76.8 76.8z" />
</span><span class="cx" style="display: block; padding: 0 10px"> <glyph unicode="" glyph-name="a11y" d="M960 704v64l-448-128-448 128v-64l320-128v-256l-128-448h64l192 448 192-448h64l-128 448v256zM416 800q0 40 28 68t68 28 68-28 28-68-28-68-68-28-68 28-28 68z" />
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<glyph unicode="" glyph-name="toc" d="M0 896h128v-128h-128v128zM192 896h832v-128h-832v128zM192 704h128v-128h-128v128zM384 704h640v-128h-640v128zM384 512h128v-128h-128v128zM576 512h448v-128h-448v128zM0 320h128v-128h-128v128zM192 320h832v-128h-832v128zM192 128h128v-128h-128v128zM384 128h640v-128h-640v128z" />
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<glyph unicode="" glyph-name="toc" d="M0 896h128v-128h-128v128zM192 896h832v-128h-832v128zM0 512h128v-128h-128v128zM192 512h832v-128h-832v128zM0 128h128v-128h-128v128zM192 128h832v-128h-832v128zM192 704h128v-128h-128v128zM384 704h640v-128h-640v128zM192 320h128v-128h-128v128zM384 320h640v-128h-640v128z" />
</ins><span class="cx" style="display: block; padding: 0 10px"> <glyph unicode="" glyph-name="fill" d="M521.6 915.2l-67.2-67.2-86.4 86.4-86.4-86.4 86.4-86.4-368-368 432-432 518.4 518.4-428.8 435.2zM435.2 134.4l-262.4 262.4 35.2 35.2 576 51.2-348.8-348.8zM953.6 409.6c-6.4-6.4-16-16-28.8-32-28.8-32-41.6-64-41.6-89.6v0 0 0 0 0 0 0c0-16 6.4-35.2 22.4-48 12.8-12.8 32-22.4 48-22.4s35.2 6.4 48 22.4 22.4 32 22.4 48v0 0 0 0 0 0 0c0 25.6-12.8 54.4-41.6 89.6-9.6 16-22.4 25.6-28.8 32v0z" />
</span><span class="cx" style="display: block; padding: 0 10px"> <glyph unicode="" glyph-name="borderwidth" d="M0 265.6h1024v-128h-1024v128zM0 32h1024v-64h-1024v64zM0 566.4h1024v-192h-1024v192zM0 928h1024v-256h-1024v256z" />
</span><span class="cx" style="display: block; padding: 0 10px"> <glyph unicode="" glyph-name="line" d="M739.2 627.2l-502.4-502.4h-185.6v185.6l502.4 502.4 185.6-185.6zM803.2 688l-185.6 185.6 67.2 67.2c22.4 22.4 54.4 22.4 76.8 0l108.8-108.8c22.4-22.4 22.4-54.4 0-76.8l-67.2-67.2zM41.6 48h940.8v-112h-940.8v112z" />
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinslightgrayfontstinymcettf"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.ttf</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinslightgrayfontstinymcewoff"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.woff</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceskinslightgrayskinmincss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/skins/lightgray/skin.min.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/skins/lightgray/skin.min.css 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/skins/lightgray/skin.min.css 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.mce-container,.mce-container *,.mce-widget,.mce-widget *,.mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:#333;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;-webkit-tap-highlight-color:transparent;line-height:normal;font-weight:normal;text-align:left;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-widget button{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.mce-container *[unselectable]{-moz-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none}.word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-m
oz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.mce-fade.mce-in{opacity:1}.mce-tinymce{visibility:inherit !important;position:relative}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;height:100%;z-index:100}div.mce-fullscreen{position:fixed;top:0;left:0;width:100%;height:auto}.mce-tinymce{display:block}.mce-wordcount{position:absolute;top:0;right:0;padding:8px}div.mce-edit-area{background:#FFF;filter:none}.mce-statusbar{position:relative}.mce-statusbar .mce-container-body{position:relative}.mce-fullscreen .mce-resizehandle{display:none}.mce-charmap{border-collapse:collapse}.mce-charmap td{cursor:default;border:1px solid rgba(0,0,0,0.2);width:20px;height:20px;line-height:20px;text-align:center;vertical-align:middle;padding:2px}.mce-charmap td div{text-align:center}.mce-charmap td:hover{background:#D9D9D9}.mce-grid td.mce-grid-cell div{border:1px solid #d6d6d6;width:15px;height:15p
x;margin:0;cursor:pointer}.mce-grid td.mce-grid-cell div:focus{border-color:#3498db}.mce-grid td.mce-grid-cell div[disabled]{cursor:not-allowed}.mce-grid{border-spacing:2px;border-collapse:separate}.mce-grid a{display:block;border:1px solid transparent}.mce-grid a:hover,.mce-grid a:focus{border-color:#3498db}.mce-grid-border{margin:0 4px 0 4px}.mce-grid-border a{border-color:#d6d6d6;width:13px;height:13px}.mce-grid-border a:hover,.mce-grid-border a.mce-active{border-color:#3498db;background:#3498db}.mce-text-center{text-align:center}div.mce-tinymce-inline{width:100%}.mce-colorbtn-trans div{text-align:center;vertical-align:middle;font-weight:bold;font-size:20px;line-height:16px;color:#707070}.mce-monospace{font-family:"Courier New",Courier,monospace}.mce-toolbar-grp{padding:2px 0}.mce-toolbar-grp .mce-flow-layout-item{margin-bottom:0}.mce-rtl .mce-wordcount{left:0;right:auto}.mce-container b{font-weight:bold}.mce-container p{margin-bottom:5px}.mce-container a{cursor:pointer
;color:#2980b9}.mce-container a:hover{text-decoration:underline}.mce-container ul{margin-left:15px}.mce-container .mce-table-striped{border-collapse:collapse;margin:10px}.mce-container .mce-table-striped thead>tr{background-color:#fafafa}.mce-container .mce-table-striped thead>tr th{font-weight:bold}.mce-container .mce-table-striped td,.mce-container .mce-table-striped th{padding:5px}.mce-container .mce-table-striped tr:nth-child(even){background-color:#fafafa}.mce-container .mce-table-striped tbody>tr:hover{background-color:#e1e1e1}.mce-branding-powered-by{background-color:#f0f0f0;position:absolute;right:0;bottom:0;width:91px;height:9px;margin-right:-1px;margin-bottom:-1px;border:1px solid #c5c5c5;border-width:1px 1px 0 1px;padding:6px 6px 0 6px;background-image:url('data:image/gif;base64,R0lGODlhXwAJAIABAIiIiAAAACH5BAEKAAEALAAAAABfAAkAAAJxhBGpy+2PUnzqGNpmPNJqDIZSJY4m+KXLF3At2V6xPFfuvMF6J6fINTnhTr9XcaRC6pKvFYlZjDIszaXRSA3ijlXo9AlWindaldSJthJ55XAz6+ZWbVCOdojP77p8J8vlUSI4SHE
naEiYqOhARdhIWAAAOw');background-repeat:no-repeat;background-position:center center}.mce-croprect-container{position:absolute;top:0;left:0}.mce-croprect-handle{position:absolute;top:0;left:0;width:20px;height:20px;border:2px solid white}.mce-croprect-handle-nw{border-width:2px 0 0 2px;margin:-2px 0 0 -2px;cursor:nw-resize;top:100px;left:100px}.mce-croprect-handle-ne{border-width:2px 2px 0 0;margin:-2px 0 0 -20px;cursor:ne-resize;top:100px;left:200px}.mce-croprect-handle-sw{border-width:0 0 2px 2px;margin:-20px 2px 0 -2px;cursor:sw-resize;top:200px;left:100px}.mce-croprect-handle-se{border-width:0 2px 2px 0;margin:-20px 0 0 -20px;cursor:se-resize;top:200px;left:200px}.mce-croprect-handle-move{position:absolute;cursor:move;border:0}.mce-croprect-block{opacity:.3;filter:alpha(opacity=30);zoom:1;position:absolute;background:black}.mce-croprect-handle:focus{border-color:#3498db}.mce-croprect-handle-move:focus{outline:1px solid #3498db}.mce-imagepanel{overflow:auto;background:black}.mce-i
magepanel-bg{position:absolute;background:url('data:image/gif;base64,R0lGODdhDAAMAIABAMzMzP///ywAAAAADAAMAAACFoQfqYeabNyDMkBQb81Uat85nxguUAEAOw==')}.mce-imagepanel img{position:absolute}.mce-imagetool.mce-btn .mce-ico{display:block;width:20px;height:20px;text-align:center;line-height:20px;font-size:20px;padding:5px}.mce-arrow-up{margin-top:12px}.mce-arrow-down{margin-top:-12px}.mce-arrow:before,.mce-arrow:after{position:absolute;left:50%;display:block;width:0;height:0;border-style:solid;border-color:transparent;content:""}.mce-arrow.mce-arrow-up:before{top:-9px;border-bottom-color:rgba(0,0,0,0.2);border-width:0 9px 9px;margin-left:-9px}.mce-arrow.mce-arrow-down:before{bottom:-9px;border-top-color:rgba(0,0,0,0.2);border-width:9px 9px 0;margin-left:-9px}.mce-arrow.mce-arrow-up:after{top:-8px;border-bottom-color:#f0f0f0;border-width:0 8px 8px;margin-left:-8px}.mce-arrow.mce-arrow-down:after{bottom:-8px;border-top-color:#f0f0f0;border-width:8px 8px 0;margin-left:-8px}.mce-arro
w.mce-arrow-left:before,.mce-arrow.mce-arrow-left:after{margin:0}.mce-arrow.mce-arrow-left:before{left:8px}.mce-arrow.mce-arrow-left:after{left:9px}.mce-arrow.mce-arrow-right:before,.mce-arrow.mce-arrow-right:after{left:auto;margin:0}.mce-arrow.mce-arrow-right:before{right:8px}.mce-arrow.mce-arrow-right:after{right:9px}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-left:before{left:-9px;top:50%;border-right-color:rgba(0,0,0,0.2);border-width:9px 9px 9px 0;margin-top:-9px}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-left:after{left:-8px;top:50%;border-right-color:#f0f0f0;border-width:8px 8px 8px 0;margin-top:-8px}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-left{margin-left:12px}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-right:before{right:-9px;top:50%;border-left-color:rgba(0,0,0,0.2);border-width:9px 0 9px 9px;margin-top:-9px}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-right:after{right:-8px;top:50%;border-left-color:#f0f0f0;border-width:8px 0 8px 8px;margin-top:-8p
x}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-right{margin-left:-14px}.mce-edit-aria-container>.mce-container-body{display:flex}.mce-edit-aria-container>.mce-container-body .mce-edit-area{flex:1}.mce-edit-aria-container>.mce-container-body .mce-sidebar>.mce-container-body{display:flex;align-items:stretch;height:100%}.mce-edit-aria-container>.mce-container-body .mce-sidebar-panel{min-width:250px;max-width:250px;position:relative}.mce-edit-aria-container>.mce-container-body .mce-sidebar-panel>.mce-container-body{position:absolute;width:100%;height:100%;overflow:auto;top:0;left:0}.mce-sidebar-toolbar{border:0 solid rgba(0,0,0,0.2);border-left-width:1px}.mce-sidebar-toolbar .mce-btn.mce-active,.mce-sidebar-toolbar .mce-btn.mce-active:hover{border:1px solid transparent;border-color:transparent;background-color:#2d8ac7}.mce-sidebar-toolbar .mce-btn.mce-active button,.mce-sidebar-toolbar .mce-btn.mce-active:hover button,.mce-sidebar-toolbar .mce-btn.mce-active butt
on i,.mce-sidebar-toolbar .mce-btn.mce-active:hover button i{color:#fff;text-shadow:1px 1px none}.mce-sidebar-panel{border:0 solid rgba(0,0,0,0.2);border-left-width:1px}.mce-container,.mce-container-body{display:block}.mce-autoscroll{overflow:hidden}.mce-scrollbar{position:absolute;width:7px;height:100%;top:2px;right:2px;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-scrollbar-h{top:auto;right:auto;left:2px;bottom:2px;width:100%;height:7px}.mce-scrollbar-thumb{position:absolute;background-color:#000;border:1px solid #888;border-color:rgba(85,85,85,0.6);width:5px;height:100%}.mce-scrollbar-h .mce-scrollbar-thumb{width:100%;height:5px}.mce-scrollbar:hover,.mce-scrollbar.mce-active{background-color:#AAA;opacity:.6;filter:alpha(opacity=60);zoom:1}.mce-scroll{position:relative}.mce-panel{border:0 solid #cacaca;border:0 solid rgba(0,0,0,0.2);background-color:#f0f0f0}.mce-floatpanel{position:absolute}.mce-floatpanel.mce-fixed{position:fixed}.mce-floatpanel .mce-arrow,.mce-floatpanel .mce-
arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.mce-floatpanel .mce-arrow{border-width:11px}.mce-floatpanel .mce-arrow:after{border-width:10px;content:""}.mce-floatpanel.mce-popover{filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;top:0;left:0;background:#FFF;border:1px solid rgba(0,0,0,0.2);border:1px solid rgba(0,0,0,0.25)}.mce-floatpanel.mce-popover.mce-bottom{margin-top:10px;*margin-top:0}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:rgba(0,0,0,0.2);border-bottom-color:rgba(0,0,0,0.25);top:-11px}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#FFF}.mce-floatpanel.mce-popover.mce-bottom.mce-start{margin-left:-22px}.mce-floatpanel.mce-popover.mce-bottom.mce-start>.mce-arrow{left:20px}.mce-floatpanel.mce-popover.mce-bottom.mc
e-end{margin-left:22px}.mce-floatpanel.mce-popover.mce-bottom.mce-end>.mce-arrow{right:10px;left:auto}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;height:100%}div.mce-fullscreen{position:fixed;top:0;left:0}#mce-modal-block{opacity:0;filter:alpha(opacity=0);zoom:1;position:fixed;left:0;top:0;width:100%;height:100%;background:#000}#mce-modal-block.mce-in{opacity:.3;filter:alpha(opacity=30);zoom:1}.mce-window-move{cursor:move}.mce-window{filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;background:#FFF;position:fixed;top:0;left:0;opacity:0;transform:scale(.1);transition:transform 100ms ease-in,opacity 150ms ease-in}.mce-window.mce-in{transform:scale(1);opacity:1}.mce-window-head{padding:9px 15px;border-bottom:1px solid #c5c5c5;position:relative}.mce-window-head .mce-close{position:absolute;right:0;top:0;height:38px;width:38px;text-align:center;cursor:pointer}.mce-window-head .mce-close i{color:#858585}.mce-close:hover i{color:#a
dadad}.mce-window-head .mce-title{line-height:20px;font-size:20px;font-weight:bold;text-rendering:optimizelegibility;padding-right:20px}.mce-window .mce-container-body{display:block}.mce-foot{display:block;background-color:#FFF;border-top:1px solid #c5c5c5}.mce-window-head .mce-dragh{position:absolute;top:0;left:0;cursor:move;width:90%;height:100%}.mce-window iframe{width:100%;height:100%}.mce-window-body .mce-listbox{border-color:#ccc}.mce-rtl .mce-window-head .mce-close{position:absolute;right:auto;left:15px}.mce-rtl .mce-window-head .mce-dragh{left:auto;right:0}.mce-rtl .mce-window-head .mce-title{direction:rtl;text-align:right}.mce-tooltip{position:absolute;padding:5px;opacity:.8;filter:alpha(opacity=80);zoom:1}.mce-tooltip-inner{font-size:11px;background-color:#000;color:white;max-width:200px;padding:5px 8px 4px 8px;text-align:center;white-space:normal}.mce-tooltip-arrow{position:absolute;width:0;height:0;line-height:0;border:5px dashed #000}.mce-tooltip-arrow-n{border-bottom-c
olor:#000}.mce-tooltip-arrow-s{border-top-color:#000}.mce-tooltip-arrow-e{border-left-color:#000}.mce-tooltip-arrow-w{border-right-color:#000}.mce-tooltip-nw,.mce-tooltip-sw{margin-left:-14px}.mce-tooltip-ne,.mce-tooltip-se{margin-left:14px}.mce-tooltip-n .mce-tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-nw .mce-tooltip-arrow{top:0;left:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-ne .mce-tooltip-arrow{top:0;right:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-s .mce-tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-sw .mce-tooltip-arrow{bottom:0;left:10px;border-top-style:solid;border-bottom:none;border-lef
t-color:transparent;border-right-color:transparent}.mce-tooltip-se .mce-tooltip-arrow{bottom:0;right:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-e .mce-tooltip-arrow{right:0;top:50%;margin-top:-5px;border-left-style:solid;border-right:none;border-top-color:transparent;border-bottom-color:transparent}.mce-tooltip-w .mce-tooltip-arrow{left:0;top:50%;margin-top:-5px;border-right-style:solid;border-left:none;border-top-color:transparent;border-bottom-color:transparent}.mce-progress{display:inline-block;position:relative;height:20px}.mce-progress .mce-bar-container{display:inline-block;width:100px;height:100%;margin-right:8px;border:1px solid #ccc;overflow:hidden}.mce-progress .mce-text{display:inline-block;margin-top:auto;margin-bottom:auto;font-size:14px;width:40px;color:#333}.mce-bar{display:block;width:0;height:100%;background-color:#d7d7d7;-webkit-transition:width .2s ease;transition:width .2s ease}.mce-not
ification{position:absolute;background-color:#F0F0F0;padding:5px;margin-top:5px;border-width:1px;border-style:solid;border-color:#CCCCCC;transition:transform 100ms ease-in,opacity 150ms ease-in;opacity:0;box-sizing:border-box}.mce-notification.mce-in{opacity:1}.mce-notification-success{background-color:#dff0d8;border-color:#d6e9c6}.mce-notification-info{background-color:#d9edf7;border-color:#779ECB}.mce-notification-warning{background-color:#fcf8e3;border-color:#faebcc}.mce-notification-error{background-color:#f2dede;border-color:#ebccd1}.mce-notification.mce-has-close{padding-right:15px}.mce-notification .mce-ico{margin-top:5px}.mce-notification-inner{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;display:inline-block;font-size:14px;margin:5px 8px 4px 8px;text-align:center;white-space:normal;color:#31708f}.mce-notification-inner a{text-decoration:underline;cursor:pointer}.
mce-notification .mce-progress{margin-right:8px}.mce-notification .mce-progress .mce-text{margin-top:5px}.mce-notification *,.mce-notification .mce-progress .mce-text{color:#333333}.mce-notification .mce-progress .mce-bar-container{border-color:#CCCCCC}.mce-notification .mce-progress .mce-bar-container .mce-bar{background-color:#333333}.mce-notification-success *,.mce-notification-success .mce-progress .mce-text{color:#3c763d}.mce-notification-success .mce-progress .mce-bar-container{border-color:#d6e9c6}.mce-notification-success .mce-progress .mce-bar-container .mce-bar{background-color:#3c763d}.mce-notification-info *,.mce-notification-info .mce-progress .mce-text{color:#31708f}.mce-notification-info .mce-progress .mce-bar-container{border-color:#779ECB}.mce-notification-info .mce-progress .mce-bar-container .mce-bar{background-color:#31708f}.mce-notification-warning *,.mce-notification-warning .mce-progress .mce-text{color:#8a6d3b}.mce-notification-warning .mce-progress .mce-bar-
container{border-color:#faebcc}.mce-notification-warning .mce-progress .mce-bar-container .mce-bar{background-color:#8a6d3b}.mce-notification-error *,.mce-notification-error .mce-progress .mce-text{color:#a94442}.mce-notification-error .mce-progress .mce-bar-container{border-color:#ebccd1}.mce-notification-error .mce-progress .mce-bar-container .mce-bar{background-color:#a94442}.mce-notification .mce-close{position:absolute;top:6px;right:8px;font-size:20px;font-weight:bold;line-height:20px;color:#858585;cursor:pointer;height:20px;overflow:hidden}.mce-abs-layout{position:relative}body .mce-abs-layout-item,.mce-abs-end{position:absolute}.mce-abs-end{width:1px;height:1px}.mce-container-body.mce-abs-layout{overflow:hidden}.mce-btn{border:1px solid #b1b1b1;border-color:transparent transparent transparent transparent;position:relative;text-shadow:0 1px 1px rgba(255,255,255,0.75);display:inline-block;*display:inline;*zoom:1;background-color:#f0f0f0}.mce-btn:hover,.mce-btn:focus{color:#333;
background-color:#e3e3e3;border-color:#ccc}.mce-btn.mce-disabled button,.mce-btn.mce-disabled:hover button{cursor:default;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-btn.mce-active,.mce-btn.mce-active:hover{background-color:#dbdbdb;border-color:#ccc}.mce-btn:active{background-color:#e0e0e0;border-color:#ccc}.mce-btn button{padding:4px 8px;font-size:14px;line-height:20px;*line-height:16px;cursor:pointer;color:#333;text-align:center;overflow:visible;-webkit-appearance:none}.mce-btn button::-moz-focus-inner{border:0;padding:0}.mce-btn i{text-shadow:1px 1px none}.mce-primary.mce-btn-has-text{min-width:50px}.mce-primary{color:#fff;border:1px solid transparent;border-color:transparent;background-color:#2d8ac7}.mce-primary:hover,.mce-primary:focus{background-color:#257cb6;border-color:transparent}.mce-primary.mce-disabled button,.mce-primary.mce-disabled:hover button{cursor:default;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-primary.mce-active,.mce-primary.mce-active:hover,.mce-pri
mary:not(.mce-disabled):active{background-color:#206ea1}.mce-primary button,.mce-primary button i{color:#fff;text-shadow:1px 1px none}.mce-btn .mce-txt{font-size:inherit;line-height:inherit;color:inherit}.mce-btn-large button{padding:9px 14px;font-size:16px;line-height:normal}.mce-btn-large i{margin-top:2px}.mce-btn-small button{padding:1px 5px;font-size:12px;*padding-bottom:2px}.mce-btn-small i{line-height:20px;vertical-align:top;*line-height:18px}.mce-btn .mce-caret{margin-top:8px;margin-left:0}.mce-btn-small .mce-caret{margin-top:8px;margin-left:0}.mce-caret{display:inline-block;*display:inline;*zoom:1;width:0;height:0;vertical-align:top;border-top:4px solid #333;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.mce-disabled .mce-caret{border-top-color:#aaa}.mce-caret.mce-up{border-bottom:4px solid #333;border-top:0}.mce-btn-flat{border:0;background:transparent;filter:none}.mce-btn-flat:hover,.mce-btn-flat.mce-active,.mce-btn-flat:focus,.m
ce-btn-flat:active{border:0;background:#e6e6e6;filter:none}.mce-btn-has-text .mce-ico{padding-right:5px}.mce-rtl .mce-btn button{direction:rtl}.mce-btn-group .mce-btn{border-width:1px;margin:0;margin-left:2px}.mce-btn-group:not(:first-child){border-left:1px solid #d9d9d9;padding-left:3px;margin-left:3px}.mce-btn-group .mce-first{margin-left:0}.mce-btn-group .mce-btn.mce-flow-layout-item{margin:0}.mce-rtl .mce-btn-group .mce-btn{margin-left:0;margin-right:2px}.mce-rtl .mce-btn-group .mce-first{margin-right:0}.mce-rtl .mce-btn-group:not(:first-child){border-left:none;border-right:1px solid #d9d9d9;padding-right:4px;margin-right:4px}.mce-checkbox{cursor:pointer}i.mce-i-checkbox{margin:0 3px 0 0;border:1px solid #c5c5c5;background-color:#f0f0f0;text-indent:-10em;*font-size:0;*line-height:0;*text-indent:0;overflow:hidden}.mce-checked i.mce-i-checkbox{color:#333;font-size:16px;line-height:16px;text-indent:0}.mce-checkbox:focus i.mce-i-checkbox,.mce-checkbox.mce-focus i.mce-i-checkbox{bord
er:1px solid rgba(82,168,236,0.8)}.mce-checkbox.mce-disabled .mce-label,.mce-checkbox.mce-disabled i.mce-i-checkbox{color:#acacac}.mce-checkbox .mce-label{vertical-align:middle}.mce-rtl .mce-checkbox{direction:rtl;text-align:right}.mce-rtl i.mce-i-checkbox{margin:0 0 0 3px}.mce-combobox{position:relative;display:inline-block;*display:inline;*zoom:1;*height:32px}.mce-combobox input{border:1px solid #c5c5c5;border-right-color:#c5c5c5;height:28px}.mce-combobox.mce-disabled input{color:#adadad}.mce-combobox .mce-btn{border:1px solid #c5c5c5;border-left:0;margin:0}.mce-combobox button{padding-right:8px;padding-left:8px}.mce-combobox.mce-disabled .mce-btn button{cursor:default;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-combobox .mce-status{position:absolute;right:2px;top:50%;line-height:16px;margin-top:-8px;font-size:12px;width:15px;height:15px;text-align:center;cursor:pointer}.mce-combobox.mce-has-status input{padding-right:20px}.mce-combobox.mce-has-open .mce-status{right:37px}.mce
-combobox .mce-status.mce-i-warning{color:#c09853}.mce-combobox .mce-status.mce-i-checkmark{color:#468847}.mce-menu.mce-combobox-menu{border-top:0;margin-top:0;max-height:200px}.mce-menu.mce-combobox-menu .mce-menu-item{padding:4px 6px 4px 4px;font-size:11px}.mce-menu.mce-combobox-menu .mce-menu-item-sep{padding:0}.mce-menu.mce-combobox-menu .mce-text{font-size:11px}.mce-menu.mce-combobox-menu .mce-menu-item-link,.mce-menu.mce-combobox-menu .mce-menu-item-link b{font-size:11px}.mce-menu.mce-combobox-menu .mce-text b{font-size:11px}.mce-colorbox i{border:1px solid #c5c5c5;width:14px;height:14px}.mce-colorbutton .mce-ico{position:relative}.mce-colorbutton-grid{margin:4px}.mce-colorbutton button{padding-right:6px;padding-left:6px}.mce-colorbutton .mce-preview{padding-right:3px;display:block;position:absolute;left:50%;top:50%;margin-left:-17px;margin-top:7px;background:gray;width:13px;height:2px;overflow:hidden}.mce-colorbutton.mce-btn-small .mce-preview{margin-left:-16px;padding-right:
0;width:16px}.mce-colorbutton .mce-open{padding-left:4px;padding-right:4px;border-left:1px solid transparent}.mce-colorbutton:hover .mce-open{border-color:#ccc}.mce-colorbutton.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-colorbutton{direction:rtl}.mce-rtl .mce-colorbutton .mce-preview{margin-left:0;padding-right:0;padding-left:3px}.mce-rtl .mce-colorbutton.mce-btn-small .mce-preview{margin-left:0;padding-right:0;padding-left:2px}.mce-rtl .mce-colorbutton .mce-open{padding-left:4px;padding-right:4px;border-left:0}.mce-colorpicker{position:relative;width:250px;height:220px}.mce-colorpicker-sv{position:absolute;top:0;left:0;width:90%;height:100%;border:1px solid #c5c5c5;cursor:crosshair;overflow:hidden}.mce-colorpicker-h-chunk{width:100%}.mce-colorpicker-overlay1,.mce-colorpicker-overlay2{width:100%;height:100%;position:absolute;top:0;left:0}.mce-colorpicker-overlay1{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#ffffff', endColorstr='#0
0ffffff');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')";background:linear-gradient(to right, #fff, rgba(255,255,255,0))}.mce-colorpicker-overlay2{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#00000000', endColorstr='#000000');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')";background:linear-gradient(to bottom, rgba(0,0,0,0), #000)}.mce-colorpicker-selector1{background:none;position:absolute;width:12px;height:12px;margin:-8px 0 0 -8px;border:1px solid black;border-radius:50%}.mce-colorpicker-selector2{position:absolute;width:10px;height:10px;border:1px solid white;border-radius:50%}.mce-colorpicker-h{position:absolute;top:0;right:0;width:6.5%;height:100%;border:1px solid #c5c5c5;cursor:crosshair}.mce-colorpicker-h-marker{margin-top:-4px;position:absolute;top:0;left:-1px;width:100%;bo
rder:1px solid #333;background:#fff;height:4px;z-index:100}.mce-path{display:inline-block;*display:inline;*zoom:1;padding:8px;white-space:normal}.mce-path .mce-txt{display:inline-block;padding-right:3px}.mce-path .mce-path-body{display:inline-block}.mce-path-item{display:inline-block;*display:inline;*zoom:1;cursor:pointer;color:#333}.mce-path-item:hover{text-decoration:underline}.mce-path-item:focus{background:#666;color:#fff}.mce-path .mce-divider{display:inline}.mce-disabled .mce-path-item{color:#aaa}.mce-rtl .mce-path{direction:rtl}.mce-fieldset{border:0 solid #9E9E9E}.mce-fieldset>.mce-container-body{margin-top:-15px}.mce-fieldset-title{margin-left:5px;padding:0 5px 0 5px}.mce-fit-layout{display:inline-block;*display:inline;*zoom:1}.mce-fit-layout-item{position:absolute}.mce-flow-layout-item{display:inline-block;*display:inline;*zoom:1}.mce-flow-layout-item{margin:2px 0 2px 2px}.mce-flow-layout-item.mce-last{margin-right:2px}.mce-flow-layout{white-space:normal}.mce-tinymce-in
line .mce-flow-layout{white-space:nowrap}.mce-rtl .mce-flow-layout{text-align:right;direction:rtl}.mce-rtl .mce-flow-layout-item{margin:2px 2px 2px 0}.mce-rtl .mce-flow-layout-item.mce-last{margin-left:2px}.mce-iframe{border:0 solid rgba(0,0,0,0.2);width:100%;height:100%}.mce-infobox{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 1px rgba(255,255,255,0.75);overflow:hidden;border:1px solid red}.mce-infobox div{display:block;margin:5px}.mce-infobox div button{position:absolute;top:50%;right:4px;cursor:pointer;margin-top:-8px;display:none}.mce-infobox div button:focus{outline:2px solid #ccc}.mce-infobox.mce-has-help div{margin-right:25px}.mce-infobox.mce-has-help button{display:block}.mce-infobox.mce-success{background:#dff0d8;border-color:#d6e9c6}.mce-infobox.mce-success div{color:#3c763d}.mce-infobox.mce-warning{background:#fcf8e3;border-color:#faebcc}.mce-infobox.mce-warning div{color:#8a6d3b}.mce-infobox.mce-error{background:#f2dede;border-color:#ebccd1}.mce-infobox
.mce-error div{color:#a94442}.mce-rtl .mce-infobox div{text-align:right;direction:rtl}.mce-label{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 1px rgba(255,255,255,0.75);overflow:hidden}.mce-label.mce-autoscroll{overflow:auto}.mce-label.mce-disabled{color:#aaa}.mce-label.mce-multiline{white-space:pre-wrap}.mce-label.mce-success{color:#468847}.mce-label.mce-warning{color:#c09853}.mce-label.mce-error{color:#b94a48}.mce-rtl .mce-label{text-align:right;direction:rtl}.mce-menubar .mce-menubtn{border-color:transparent;background:transparent;filter:none}.mce-menubar .mce-menubtn button{color:#333}.mce-menubar{border:1px solid rgba(217,217,217,0.52)}.mce-menubar .mce-menubtn button span{color:#333}.mce-menubar .mce-caret{border-top-color:#333}.mce-menubar .mce-menubtn:hover,.mce-menubar .mce-menubtn.mce-active,.mce-menubar .mce-menubtn:focus{border-color:#ccc;background:#fff;filter:none}.mce-menubtn button{color:#333}.mce-menubtn.mce-btn-small span{font-size:12px}.mce-menub
tn.mce-fixed-width span{display:inline-block;overflow-x:hidden;text-overflow:ellipsis;width:90px}.mce-menubtn.mce-fixed-width.mce-btn-small span{width:70px}.mce-menubtn .mce-caret{*margin-top:6px}.mce-rtl .mce-menubtn button{direction:rtl;text-align:right}.mce-menu-item{display:block;padding:6px 15px 6px 12px;clear:both;font-weight:normal;line-height:20px;color:#333;white-space:nowrap;cursor:pointer;line-height:normal;border-left:4px solid transparent;margin-bottom:1px}.mce-menu-item .mce-ico,.mce-menu-item .mce-text{color:#333}.mce-menu-item.mce-disabled .mce-text,.mce-menu-item.mce-disabled .mce-ico{color:#adadad}.mce-menu-item:hover .mce-text,.mce-menu-item.mce-selected .mce-text,.mce-menu-item:focus .mce-text{color:white}.mce-menu-item:hover .mce-ico,.mce-menu-item.mce-selected .mce-ico,.mce-menu-item:focus .mce-ico{color:white}.mce-menu-item.mce-disabled:hover{background:#CCC}.mce-menu-shortcut{display:inline-block;color:#adadad}.mce-menu-shortcut{display:inline-block;*display:
inline;*zoom:1;padding:0 15px 0 20px}.mce-menu-item:hover .mce-menu-shortcut,.mce-menu-item.mce-selected .mce-menu-shortcut,.mce-menu-item:focus .mce-menu-shortcut{color:white}.mce-menu-item .mce-caret{margin-top:4px;*margin-top:3px;margin-right:6px;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid #333}.mce-menu-item.mce-selected .mce-caret,.mce-menu-item:focus .mce-caret,.mce-menu-item:hover .mce-caret{border-left-color:white}.mce-menu-align .mce-menu-shortcut{*margin-top:-2px}.mce-menu-align .mce-menu-shortcut,.mce-menu-align .mce-caret{position:absolute;right:0}.mce-menu-item.mce-active i{visibility:visible}.mce-menu-item-normal.mce-active{background-color:#3498db}.mce-menu-item-preview.mce-active{border-left:5px solid #aaa}.mce-menu-item-normal.mce-active .mce-text{color:white}.mce-menu-item-normal.mce-active:hover .mce-text,.mce-menu-item-normal.mce-active:hover .mce-ico{color:white}.mce-menu-item-normal.mce-active:focus .mce-text,.mce-
menu-item-normal.mce-active:focus .mce-ico{color:white}.mce-menu-item:hover,.mce-menu-item.mce-selected,.mce-menu-item:focus{text-decoration:none;color:white;background-color:#2d8ac7}.mce-menu-item-link{color:#093;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mce-menu-item-link b{color:#093}.mce-menu-item-ellipsis{display:block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.mce-menu-item:hover *,.mce-menu-item.mce-selected *,.mce-menu-item:focus *{color:white}div.mce-menu .mce-menu-item-sep,.mce-menu-item-sep:hover{border:0;padding:0;height:1px;margin:9px 1px;overflow:hidden;background:transparent;border-bottom:1px solid rgba(0,0,0,0.1);cursor:default;filter:none}div.mce-menu .mce-menu-item b{font-weight:bold}.mce-menu-item-indent-1{padding-left:20px}.mce-menu-item-indent-2{padding-left:35px}.mce-menu-item-indent-2{padding-left:35px}.mce-menu-item-indent-3{padding-left:40px}.mce-menu-item-indent-4{padding-left:45px}.mce-menu-item-indent-5{padding-left:50px}.
mce-menu-item-indent-6{padding-left:55px}.mce-menu.mce-rtl{direction:rtl}.mce-rtl .mce-menu-item{text-align:right;direction:rtl;padding:6px 12px 6px 15px}.mce-menu-align.mce-rtl .mce-menu-shortcut,.mce-menu-align.mce-rtl .mce-caret{right:auto;left:0}.mce-rtl .mce-menu-item .mce-caret{margin-left:6px;margin-right:0;border-right:4px solid #333;border-left:0}.mce-rtl .mce-menu-item.mce-selected .mce-caret,.mce-rtl .mce-menu-item:focus .mce-caret,.mce-rtl .mce-menu-item:hover .mce-caret{border-left-color:transparent;border-right-color:white}.mce-throbber{position:absolute;top:0;left:0;width:100%;height:100%;opacity:.6;filter:alpha(opacity=60);zoom:1;background:#fff url('img/loader.gif') no-repeat center center}.mce-throbber-inline{position:static;height:50px}.mce-menu .mce-throbber-inline{height:25px;background-size:contain}.mce-menu{position:absolute;left:0;top:0;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;z-index:1000;padding:5px 0 5px 0;m
argin:-1px 0 0;min-width:160px;background:#fff;border:1px solid #989898;border:1px solid rgba(0,0,0,0.2);z-index:1002;max-height:400px;overflow:auto;overflow-x:hidden}.mce-menu i{display:none}.mce-menu-has-icons i{display:inline-block;*display:inline}.mce-menu-sub-tr-tl{margin:-6px 0 0 -1px}.mce-menu-sub-br-bl{margin:6px 0 0 -1px}.mce-menu-sub-tl-tr{margin:-6px 0 0 1px}.mce-menu-sub-bl-br{margin:6px 0 0 1px}.mce-listbox button{text-align:left;padding-right:20px;position:relative}.mce-listbox .mce-caret{position:absolute;margin-top:-2px;right:8px;top:50%}.mce-rtl .mce-listbox .mce-caret{right:auto;left:8px}.mce-rtl .mce-listbox button{padding-right:10px;padding-left:20px}.mce-container-body .mce-resizehandle{position:absolute;right:0;bottom:0;width:16px;height:16px;visibility:visible;cursor:s-resize;margin:0}.mce-container-body .mce-resizehandle-both{cursor:se-resize}i.mce-i-resize{color:#333}.mce-selectbox{background:#fff;border:1px solid #c5c5c5}.mce-slider{border:1px solid #AAA;ba
ckground:#EEE;width:100px;height:10px;position:relative;display:block}.mce-slider.mce-vertical{width:10px;height:100px}.mce-slider-handle{border:1px solid #BBB;background:#DDD;display:block;width:13px;height:13px;position:absolute;top:0;left:0;margin-left:-1px;margin-top:-2px}.mce-slider-handle:focus{background:#BBB}.mce-spacer{visibility:hidden}.mce-splitbtn .mce-open{border-left:1px solid transparent}.mce-splitbtn:hover .mce-open{border-left-color:#ccc}.mce-splitbtn button{padding-right:6px;padding-left:6px}.mce-splitbtn .mce-open{padding-right:4px;padding-left:4px}.mce-splitbtn .mce-open.mce-active{background-color:#dbdbdb;outline:1px solid #ccc}.mce-splitbtn.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-splitbtn{direction:rtl;text-align:right}.mce-rtl .mce-splitbtn button{padding-right:4px;padding-left:4px}.mce-rtl .mce-splitbtn .mce-open{border-left:0}.mce-stack-layout-item{display:block}.mce-tabs{display:block;border-bottom:1px solid #c5c5c5}.mce-tabs,.mce-tabs+.mc
e-container-body{background:#FFF}.mce-tab{display:inline-block;*display:inline;*zoom:1;border:1px solid #c5c5c5;border-width:0 1px 0 0;background:#ffffff;padding:8px;text-shadow:0 1px 1px rgba(255,255,255,0.75);height:13px;cursor:pointer}.mce-tab:hover{background:#FDFDFD}.mce-tab.mce-active{background:#FDFDFD;border-bottom-color:transparent;margin-bottom:-1px;height:14px}.mce-rtl .mce-tabs{text-align:right;direction:rtl}.mce-rtl .mce-tab{border-width:0 0 0 1px}.mce-textbox{background:#fff;border:1px solid #c5c5c5;display:inline-block;-webkit-transition:border linear .2s, box-shadow linear .2s;transition:border linear .2s, box-shadow linear .2s;height:28px;resize:none;padding:0 4px 0 4px;white-space:pre-wrap;*white-space:pre;color:#333}.mce-textbox:focus,.mce-textbox.mce-focus{border-color:#3498db}.mce-placeholder .mce-textbox{color:#aaa}.mce-textbox.mce-multiline{padding:4px;height:auto}.mce-textbox.mce-disabled{color:#adadad}.mce-rtl .mce-textbox{text-align:right;direction:rtl}.mce
-dropzone{border:3px dashed gray;text-align:center}.mce-dropzone span{color:gray;text-transform:uppercase;font-family:Verdana;display:inline-block;vertical-align:middle}.mce-dropzone:after{content:"";height:100%;display:inline-block;vertical-align:middle}.mce-dropzone.mce-disabled{opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-dropzone.mce-disabled.mce-dragenter{cursor:not-allowed}.mce-browsebutton{position:relative;overflow:hidden}.mce-browsebutton button{position:relative;z-index:1}.mce-browsebutton input{opacity:0;filter:alpha(opacity=0);zoom:1;position:absolute;top:0;left:0;width:100%;height:100%;z-index:0}@font-face{font-family:'tinymce';src:url('fonts/tinymce.eot');src:url('fonts/tinymce.eot?#iefix') format('embedded-opentype'),url('fonts/tinymce.woff') format('woff'),url('fonts/tinymce.ttf') format('truetype'),url('fonts/tinymce.svg#tinymce') format('svg');font-weight:normal;font-style:normal}@font-face{font-family:'tinymce-small';src:url('fonts/tinymce-small.eot')
;src:url('fonts/tinymce-small.eot?#iefix') format('embedded-opentype'),url('fonts/tinymce-small.woff') format('woff'),url('fonts/tinymce-small.ttf') format('truetype'),url('fonts/tinymce-small.svg#tinymce') format('svg');font-weight:normal;font-style:normal}.mce-ico{font-family:'tinymce',Arial;font-style:normal;font-weight:normal;font-variant:normal;font-size:16px;line-height:16px;speak:none;vertical-align:text-top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:inline-block;background:transparent center center;background-size:cover;width:16px;height:16px;color:#333}.mce-btn-small .mce-ico{font-family:'tinymce-small',Arial}.mce-i-save:before{content:"\e000"}.mce-i-newdocument:before{content:"\e001"}.mce-i-fullpage:before{content:"\e002"}.mce-i-alignleft:before{content:"\e003"}.mce-i-aligncenter:before{content:"\e004"}.mce-i-alignright:before{content:"\e005"}.mce-i-alignjustify:before{content:&qu
ot;\e006"}.mce-i-alignnone:before{content:"\e003"}.mce-i-cut:before{content:"\e007"}.mce-i-paste:before{content:"\e008"}.mce-i-searchreplace:before{content:"\e009"}.mce-i-bullist:before{content:"\e00a"}.mce-i-numlist:before{content:"\e00b"}.mce-i-indent:before{content:"\e00c"}.mce-i-outdent:before{content:"\e00d"}.mce-i-blockquote:before{content:"\e00e"}.mce-i-undo:before{content:"\e00f"}.mce-i-redo:before{content:"\e010"}.mce-i-link:before{content:"\e011"}.mce-i-unlink:before{content:"\e012"}.mce-i-anchor:before{content:"\e013"}.mce-i-image:before{content:"\e014"}.mce-i-media:before{content:"\e015"}.mce-i-help:before{content:"\e016"}.mce-i-code:before{content:"\e017"}.mce-i-insertdatetime:before{content:"\e018"}.mce-i-preview:before{content:"\e019"}.mce-i-forecolor:before{content:
"\e01a"}.mce-i-backcolor:before{content:"\e01a"}.mce-i-table:before{content:"\e01b"}.mce-i-hr:before{content:"\e01c"}.mce-i-removeformat:before{content:"\e01d"}.mce-i-subscript:before{content:"\e01e"}.mce-i-superscript:before{content:"\e01f"}.mce-i-charmap:before{content:"\e020"}.mce-i-emoticons:before{content:"\e021"}.mce-i-print:before{content:"\e022"}.mce-i-fullscreen:before{content:"\e023"}.mce-i-spellchecker:before{content:"\e024"}.mce-i-nonbreaking:before{content:"\e025"}.mce-i-template:before{content:"\e026"}.mce-i-pagebreak:before{content:"\e027"}.mce-i-restoredraft:before{content:"\e028"}.mce-i-bold:before{content:"\e02a"}.mce-i-italic:before{content:"\e02b"}.mce-i-underline:before{content:"\e02c"}.mce-i-strikethrough:before{content:"\e02d"}.mce-i-visualchars:before{content:&qu
ot;\e02e"}.mce-i-visualblocks:before{content:"\e02e"}.mce-i-ltr:before{content:"\e02f"}.mce-i-rtl:before{content:"\e030"}.mce-i-copy:before{content:"\e031"}.mce-i-resize:before{content:"\e032"}.mce-i-browse:before{content:"\e034"}.mce-i-pastetext:before{content:"\e035"}.mce-i-rotateleft:before{content:"\eaa8"}.mce-i-rotateright:before{content:"\eaa9"}.mce-i-crop:before{content:"\ee78"}.mce-i-editimage:before{content:"\e915"}.mce-i-options:before{content:"\ec6a"}.mce-i-flipv:before{content:"\eaaa"}.mce-i-fliph:before{content:"\eaac"}.mce-i-zoomin:before{content:"\eb35"}.mce-i-zoomout:before{content:"\eb36"}.mce-i-sun:before{content:"\eccc"}.mce-i-moon:before{content:"\eccd"}.mce-i-arrowleft:before{content:"\edc0"}.mce-i-arrowright:before{content:"\e93c"}.mce-i-drop:before{content:&q
uot;\e935"}.mce-i-contrast:before{content:"\ecd4"}.mce-i-sharpen:before{content:"\eba7"}.mce-i-resize2:before{content:"\edf9"}.mce-i-orientation:before{content:"\e601"}.mce-i-invert:before{content:"\e602"}.mce-i-gamma:before{content:"\e600"}.mce-i-remove:before{content:"\ed6a"}.mce-i-tablerowprops:before{content:"\e604"}.mce-i-tablecellprops:before{content:"\e605"}.mce-i-table2:before{content:"\e606"}.mce-i-tablemergecells:before{content:"\e607"}.mce-i-tableinsertcolbefore:before{content:"\e608"}.mce-i-tableinsertcolafter:before{content:"\e609"}.mce-i-tableinsertrowbefore:before{content:"\e60a"}.mce-i-tableinsertrowafter:before{content:"\e60b"}.mce-i-tablesplitcells:before{content:"\e60d"}.mce-i-tabledelete:before{content:"\e60e"}.mce-i-tableleftheader:before{content:"\e62a"}.mce-i-tabletopheader:befo
re{content:"\e62b"}.mce-i-tabledeleterow:before{content:"\e800"}.mce-i-tabledeletecol:before{content:"\e801"}.mce-i-codesample:before{content:"\e603"}.mce-i-fill:before{content:"\e902"}.mce-i-borderwidth:before{content:"\e903"}.mce-i-line:before{content:"\e904"}.mce-i-count:before{content:"\e905"}.mce-i-translate:before{content:"\e907"}.mce-i-drag:before{content:"\e908"}.mce-i-home:before{content:"\e90b"}.mce-i-upload:before{content:"\e914"}.mce-i-bubble:before{content:"\e91c"}.mce-i-user:before{content:"\e91d"}.mce-i-lock:before{content:"\e926"}.mce-i-unlock:before{content:"\e927"}.mce-i-settings:before{content:"\e928"}.mce-i-remove2:before{content:"\e92a"}.mce-i-menu:before{content:"\e92d"}.mce-i-warning:before{content:"\e930"}.mce-i-question:before{content:"\e931"}.mce-i-pl
uscircle:before{content:"\e932"}.mce-i-info:before{content:"\e933"}.mce-i-notice:before{content:"\e934"}.mce-i-arrowup:before{content:"\e93b"}.mce-i-arrowdown:before{content:"\e93d"}.mce-i-arrowup2:before{content:"\e93f"}.mce-i-arrowdown2:before{content:"\e940"}.mce-i-menu2:before{content:"\e941"}.mce-i-newtab:before{content:"\e961"}.mce-i-a11y:before{content:"\e900"}.mce-i-plus:before{content:"\e93a"}.mce-i-insert:before{content:"\e93a"}.mce-i-minus:before{content:"\e939"}.mce-i-books:before{content:"\e911"}.mce-i-reload:before{content:"\e906"}.mce-i-toc:before{content:"\e901"}.mce-i-checkmark:before{content:"\e033"}.mce-i-checkbox:before,.mce-i-selected:before{content:"\e033"}.mce-i-insert{font-size:14px}.mce-i-selected{visibility:hidden}i.mce-i-backcolor{text-shadow:none;background:#BBB}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.mce-container,.mce-container *,.mce-widget,.mce-widget *,.mce-reset{margin:0;padding:0;border:0;outline:0;vertical-align:top;background:transparent;text-decoration:none;color:#595959;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;text-shadow:none;float:none;position:static;width:auto;height:auto;white-space:nowrap;cursor:inherit;-webkit-tap-highlight-color:transparent;line-height:normal;font-weight:normal;text-align:left;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;direction:ltr;max-width:none}.mce-widget button{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.mce-container *[unselectable]{-moz-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none}.word-wrap{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto
;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.mce-fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.mce-fade.mce-in{opacity:1}.mce-tinymce{visibility:inherit !important;position:relative}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;height:100%;z-index:100}div.mce-fullscreen{position:fixed;top:0;left:0;width:100%;height:auto}.mce-tinymce{display:block;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);box-shadow:0 1px 2px rgba(0, 0, 0, 0.2)}.mce-statusbar>.mce-container-body{display:flex;padding-right:16px}.mce-statusbar>.mce-container-body .mce-path{flex:1}.mce-wordcount{font-size:inherit;text-transform:uppercase;padding:8px 0}div.mce-edit-area{background:#FFF;filter:none}.mce-statusbar{position:relative}.mce-statusbar .mce-container-body{position:relative;font-size:11px}.mce-fullscreen .mce-resizehandle{display:none}.mce-statusbar .mce-flow-layout-item{margin:0}.mce-charmap{bo
rder-collapse:collapse}.mce-charmap td{cursor:default;border:1px solid #c5c5c5;width:20px;height:20px;line-height:20px;text-align:center;vertical-align:middle;padding:2px}.mce-charmap td div{text-align:center}.mce-charmap td:hover{background:white}.mce-grid td.mce-grid-cell div{border:1px solid #c5c5c5;width:15px;height:15px;margin:0;cursor:pointer}.mce-grid td.mce-grid-cell div:focus{border-color:#91bbe9}.mce-grid td.mce-grid-cell div[disabled]{cursor:not-allowed}.mce-grid{border-spacing:2px;border-collapse:separate}.mce-grid a{display:block;border:1px solid transparent}.mce-grid a:hover,.mce-grid a:focus{border-color:#91bbe9}.mce-grid-border{margin:0 4px 0 4px}.mce-grid-border a{border-color:#c5c5c5;width:13px;height:13px}.mce-grid-border a:hover,.mce-grid-border a.mce-active{border-color:#91bbe9;background:#bdd6f2}.mce-text-center{text-align:center}div.mce-tinymce-inline{width:100%}.mce-colorbtn-trans div{text-align:center;vertical-align:middle;font-weight:bold;font-size:20px;lin
e-height:16px;color:#8b8b8b}.mce-monospace{font-family:"Courier New",Courier,monospace}.mce-toolbar-grp .mce-flow-layout-item{margin-bottom:0}.mce-container b{font-weight:bold}.mce-container p{margin-bottom:5px}.mce-container a{cursor:pointer;color:#2276d2}.mce-container a:hover{text-decoration:underline}.mce-container ul{margin-left:15px}.mce-container .mce-table-striped{border-collapse:collapse;margin:10px}.mce-container .mce-table-striped thead>tr{background-color:#fafafa}.mce-container .mce-table-striped thead>tr th{font-weight:bold}.mce-container .mce-table-striped td,.mce-container .mce-table-striped th{padding:5px}.mce-container .mce-table-striped tr:nth-child(even){background-color:#fafafa}.mce-container .mce-table-striped tbody>tr:hover{background-color:#e1e1e1}.mce-branding{font-size:inherit;text-transform:uppercase;white-space:pre;padding:8px 0}.mce-branding a{font-size:inherit;color:inherit}.mce-top-part{position:relative}.mce-top-part::before{content:
'';position:absolute;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);top:0;right:0;bottom:0;left:0;pointer-events:none}.mce-rtl .mce-wordcount{left:0;right:auto}.mce-rtl .mce-statusbar>.mce-container-body>*:last-child{padding-right:0;padding-left:10px}.mce-rtl .mce-path{text-align:right;padding-right:16px}.mce-croprect-container{position:absolute;top:0;left:0}.mce-croprect-handle{position:absolute;top:0;left:0;width:20px;height:20px;border:2px solid white}.mce-croprect-handle-nw{border-width:2px 0 0 2px;margin:-2px 0 0 -2px;cursor:nw-resize;top:100px;left:100px}.mce-croprect-handle-ne{border-width:2px 2px 0 0;margin:-2px 0 0 -20px;cursor:ne-resize;top:100px;left:200px}.mce-croprect-handle-sw{border-width:0 0 2px 2px;margin:-20px 2px 0 -2px;cursor:sw-resize;top:200px;left:100px}.mce-croprect-handle-se{border-width:0 2px 2px 0;margin:-20px 0 0 -20px;cursor:se-resize;top:200px;left:200px}.mce-cro
prect-handle-move{position:absolute;cursor:move;border:0}.mce-croprect-block{opacity:.5;filter:alpha(opacity=50);zoom:1;position:absolute;background:black}.mce-croprect-handle:focus{border-color:#2276d2}.mce-croprect-handle-move:focus{outline:1px solid #2276d2}.mce-imagepanel{overflow:auto;background:black}.mce-imagepanel-bg{position:absolute;background:url('data:image/gif;base64,R0lGODdhDAAMAIABAMzMzP///ywAAAAADAAMAAACFoQfqYeabNyDMkBQb81Uat85nxguUAEAOw==')}.mce-imagepanel img{position:absolute}.mce-imagetool.mce-btn .mce-ico{display:block;width:20px;height:20px;text-align:center;line-height:20px;font-size:20px;padding:5px}.mce-arrow-up{margin-top:12px}.mce-arrow-down{margin-top:-12px}.mce-arrow:before,.mce-arrow:after{position:absolute;left:50%;display:block;width:0;height:0;border-style:solid;border-color:transparent;content:""}.mce-arrow.mce-arrow-up:before{top:-9px;border-bottom-color:#c5c5c5;border-width:0 9px 9px;margin-left:-9px}.mce-arrow.mce-arrow-down:before{bott
om:-9px;border-top-color:#c5c5c5;border-width:9px 9px 0;margin-left:-9px}.mce-arrow.mce-arrow-up:after{top:-8px;border-bottom-color:#fff;border-width:0 8px 8px;margin-left:-8px}.mce-arrow.mce-arrow-down:after{bottom:-8px;border-top-color:#fff;border-width:8px 8px 0;margin-left:-8px}.mce-arrow.mce-arrow-left:before,.mce-arrow.mce-arrow-left:after{margin:0}.mce-arrow.mce-arrow-left:before{left:8px}.mce-arrow.mce-arrow-left:after{left:9px}.mce-arrow.mce-arrow-right:before,.mce-arrow.mce-arrow-right:after{left:auto;margin:0}.mce-arrow.mce-arrow-right:before{right:8px}.mce-arrow.mce-arrow-right:after{right:9px}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-left:before{left:-9px;top:50%;border-right-color:#c5c5c5;border-width:9px 9px 9px 0;margin-top:-9px}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-left:after{left:-8px;top:50%;border-right-color:#fff;border-width:8px 8px 8px 0;margin-top:-8px}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-left{margin-left:12px}.mce-arrow.mce-arrow-c
enter.mce-arrow.mce-arrow-right:before{right:-9px;top:50%;border-left-color:#c5c5c5;border-width:9px 0 9px 9px;margin-top:-9px}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-right:after{right:-8px;top:50%;border-left-color:#fff;border-width:8px 0 8px 8px;margin-top:-8px}.mce-arrow.mce-arrow-center.mce-arrow.mce-arrow-right{margin-left:-14px}.mce-edit-aria-container>.mce-container-body{display:flex}.mce-edit-aria-container>.mce-container-body .mce-edit-area{flex:1}.mce-edit-aria-container>.mce-container-body .mce-sidebar>.mce-container-body{display:flex;align-items:stretch;height:100%}.mce-edit-aria-container>.mce-container-body .mce-sidebar-panel{min-width:250px;max-width:250px;position:relative}.mce-edit-aria-container>.mce-container-body .mce-sidebar-panel>.mce-container-body{position:absolute;width:100%;height:100%;overflow:auto;top:0;left:0}.mce-sidebar-toolbar{border:0 solid #c5c5c5;border-left-width:1px}.mce-sidebar-toolbar .mce-btn{border-left:0;border-r
ight:0}.mce-sidebar-toolbar .mce-btn.mce-active,.mce-sidebar-toolbar .mce-btn.mce-active:hover{background-color:#555c66}.mce-sidebar-toolbar .mce-btn.mce-active button,.mce-sidebar-toolbar .mce-btn.mce-active:hover button,.mce-sidebar-toolbar .mce-btn.mce-active button i,.mce-sidebar-toolbar .mce-btn.mce-active:hover button i{color:white;text-shadow:1px 1px none}.mce-sidebar-panel{border:0 solid #c5c5c5;border-left-width:1px}.mce-container,.mce-container-body{display:block}.mce-autoscroll{overflow:hidden}.mce-scrollbar{position:absolute;width:7px;height:100%;top:2px;right:2px;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-scrollbar-h{top:auto;right:auto;left:2px;bottom:2px;width:100%;height:7px}.mce-scrollbar-thumb{position:absolute;background-color:#000;border:1px solid #888;border-color:rgba(85,85,85,0.6);width:5px;height:100%}.mce-scrollbar-h .mce-scrollbar-thumb{width:100%;height:5px}.mce-scrollbar:hover,.mce-scrollbar.mce-active{background-color:#AAA;opacity:.6;filter:alpha(op
acity=60);zoom:1}.mce-scroll{position:relative}.mce-panel{border:0 solid #f3f3f3;border:0 solid #c5c5c5;background-color:#fff}.mce-floatpanel{position:absolute;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);box-shadow:0 1px 2px rgba(0, 0, 0, 0.2)}.mce-floatpanel.mce-fixed{position:fixed}.mce-floatpanel .mce-arrow,.mce-floatpanel .mce-arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.mce-floatpanel .mce-arrow{border-width:11px}.mce-floatpanel .mce-arrow:after{border-width:10px;content:""}.mce-floatpanel.mce-popover{filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);top:0;left:0;background:#FFF;border:1px solid #c5c5c5;border:1px solid rgba(0,0,0,0.25)}.mce-floatpanel.mce-popover.mce-bottom{margin-top:10px
;*margin-top:0}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#c5c5c5;border-bottom-color:rgba(0,0,0,0.25);top:-11px}.mce-floatpanel.mce-popover.mce-bottom>.mce-arrow:after{top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#FFF}.mce-floatpanel.mce-popover.mce-top{margin-top:-10px;*margin-top:0}.mce-floatpanel.mce-popover.mce-top>.mce-arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#c5c5c5;top:auto;bottom:-11px}.mce-floatpanel.mce-popover.mce-top>.mce-arrow:after{bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#FFF}.mce-floatpanel.mce-popover.mce-bottom.mce-start,.mce-floatpanel.mce-popover.mce-top.mce-start{margin-left:-22px}.mce-floatpanel.mce-popover.mce-bottom.mce-start>.mce-arrow,.mce-floatpanel.mce-popover.mce-top.mce-start>.mce-arrow{left:20px}.mce-floatpanel.mce-popover.mce-bottom.mce-end,.mce-floatpanel.mce-popover.mce-top.mce-end{
margin-left:22px}.mce-floatpanel.mce-popover.mce-bottom.mce-end>.mce-arrow,.mce-floatpanel.mce-popover.mce-top.mce-end>.mce-arrow{right:10px;left:auto}.mce-fullscreen{border:0;padding:0;margin:0;overflow:hidden;height:100%}div.mce-fullscreen{position:fixed;top:0;left:0}#mce-modal-block{opacity:0;filter:alpha(opacity=0);zoom:1;position:fixed;left:0;top:0;width:100%;height:100%;background:#FFF}#mce-modal-block.mce-in{opacity:.5;filter:alpha(opacity=50);zoom:1}.mce-window-move{cursor:move}.mce-window{-webkit-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);-moz-box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);box-shadow:0 3px 7px rgba(0, 0, 0, 0.3);filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;background:#FFF;position:fixed;top:0;left:0;opacity:0;transform:scale(.1);transition:transform 100ms ease-in,opacity 150ms ease-in}.mce-window.mce-in{transform:scale(1);opacity:1}.mce-window-head{padding:9px 15px;border-bottom:1px solid #c5c5c5;position:relative}.m
ce-window-head .mce-close{position:absolute;right:0;top:0;height:38px;width:38px;text-align:center;cursor:pointer}.mce-window-head .mce-close i{color:#9b9b9b}.mce-close:hover i{color:#bdbdbd}.mce-window-head .mce-title{line-height:20px;font-size:20px;font-weight:bold;text-rendering:optimizelegibility;padding-right:20px}.mce-window .mce-container-body{display:block}.mce-foot{display:block;background-color:#FFF;border-top:1px solid #c5c5c5}.mce-window-head .mce-dragh{position:absolute;top:0;left:0;cursor:move;width:90%;height:100%}.mce-window iframe{width:100%;height:100%}.mce-window-body .mce-listbox{border-color:#e2e4e7}.mce-window .mce-btn:hover{border-color:#c5c5c5}.mce-window .mce-btn:focus{border-color:#2276d2}.mce-window-body .mce-btn,.mce-foot .mce-btn{border-color:#c5c5c5}.mce-foot .mce-btn.mce-primary{border-color:transparent}.mce-rtl .mce-window-head .mce-close{position:absolute;right:auto;left:0}.mce-rtl .mce-window-head .mce-dragh{left:auto;right:0}.mce-rtl .mce-window-he
ad .mce-title{direction:rtl;text-align:right;padding-right:0;padding-left:20px}.mce-tooltip{position:absolute;padding:5px;opacity:.8;filter:alpha(opacity=80);zoom:1;margin-top:1px}.mce-tooltip-inner{font-size:11px;background-color:#000;color:white;max-width:200px;padding:5px 8px 4px 8px;text-align:center;white-space:normal}.mce-tooltip-inner{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-tooltip-arrow{position:absolute;width:0;height:0;line-height:0;border:5px dashed #000}.mce-tooltip-arrow-n{border-bottom-color:#000}.mce-tooltip-arrow-s{border-top-color:#000}.mce-tooltip-arrow-e{border-left-color:#000}.mce-tooltip-arrow-w{border-right-color:#000}.mce-tooltip-nw,.mce-tooltip-sw{margin-left:-14px}.mce-tooltip-ne,.mce-tooltip-se{margin-left:14px}.mce-tooltip-n .mce-tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-nw .mce-tooltip-arrow{top:0;left:10px;bord
er-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-ne .mce-tooltip-arrow{top:0;right:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-s .mce-tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-sw .mce-tooltip-arrow{bottom:0;left:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-se .mce-tooltip-arrow{bottom:0;right:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.mce-tooltip-e .mce-tooltip-arrow{right:0;top:50%;margin-top:-5px;border-left-style:solid;border-right:none;border-top-color:transparent;border-bottom-color:transparent}.mce-tooltip-w .mce-tooltip-arrow{left:0;top:50%;margin-top:-5px;border-right-style:sol
id;border-left:none;border-top-color:transparent;border-bottom-color:transparent}.mce-progress{display:inline-block;position:relative;height:20px}.mce-progress .mce-bar-container{display:inline-block;width:100px;height:100%;margin-right:8px;border:1px solid #ccc;overflow:hidden}.mce-progress .mce-text{display:inline-block;margin-top:auto;margin-bottom:auto;font-size:14px;width:40px;color:#595959}.mce-bar{display:block;width:0;height:100%;background-color:#dfdfdf;-webkit-transition:width .2s ease;transition:width .2s ease}.mce-notification{position:absolute;background-color:#fff;padding:5px;margin-top:5px;border-width:1px;border-style:solid;border-color:#c5c5c5;transition:transform 100ms ease-in,opacity 150ms ease-in;opacity:0;box-sizing:border-box}.mce-notification.mce-in{opacity:1}.mce-notification-success{background-color:#dff0d8;border-color:#d6e9c6}.mce-notification-info{background-color:#d9edf7;border-color:#779ECB}.mce-notification-warning{background-color:#fcf8e3;border-color
:#faebcc}.mce-notification-error{background-color:#f2dede;border-color:#ebccd1}.mce-notification.mce-has-close{padding-right:15px}.mce-notification .mce-ico{margin-top:5px}.mce-notification-inner{word-wrap:break-word;-ms-word-break:break-all;word-break:break-all;word-break:break-word;-ms-hyphens:auto;-moz-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;display:inline-block;font-size:14px;margin:5px 8px 4px 8px;text-align:center;white-space:normal;color:#31708f}.mce-notification-inner a{text-decoration:underline;cursor:pointer}.mce-notification .mce-progress{margin-right:8px}.mce-notification .mce-progress .mce-text{margin-top:5px}.mce-notification *,.mce-notification .mce-progress .mce-text{color:#595959}.mce-notification .mce-progress .mce-bar-container{border-color:#c5c5c5}.mce-notification .mce-progress .mce-bar-container .mce-bar{background-color:#595959}.mce-notification-success *,.mce-notification-success .mce-progress .mce-text{color:#3c763d}.mce-notification-success .mce-prog
ress .mce-bar-container{border-color:#d6e9c6}.mce-notification-success .mce-progress .mce-bar-container .mce-bar{background-color:#3c763d}.mce-notification-info *,.mce-notification-info .mce-progress .mce-text{color:#31708f}.mce-notification-info .mce-progress .mce-bar-container{border-color:#779ECB}.mce-notification-info .mce-progress .mce-bar-container .mce-bar{background-color:#31708f}.mce-notification-warning *,.mce-notification-warning .mce-progress .mce-text{color:#8a6d3b}.mce-notification-warning .mce-progress .mce-bar-container{border-color:#faebcc}.mce-notification-warning .mce-progress .mce-bar-container .mce-bar{background-color:#8a6d3b}.mce-notification-error *,.mce-notification-error .mce-progress .mce-text{color:#a94442}.mce-notification-error .mce-progress .mce-bar-container{border-color:#ebccd1}.mce-notification-error .mce-progress .mce-bar-container .mce-bar{background-color:#a94442}.mce-notification .mce-close{position:absolute;top:6px;right:8px;font-size:20px;font
-weight:bold;line-height:20px;color:#9b9b9b;cursor:pointer}.mce-abs-layout{position:relative}body .mce-abs-layout-item,.mce-abs-end{position:absolute}.mce-abs-end{width:1px;height:1px}.mce-container-body.mce-abs-layout{overflow:hidden}.mce-btn{border:1px solid #b3b3b3;border-color:transparent transparent transparent transparent;position:relative;text-shadow:0 1px 1px rgba(255,255,255,0.75);background:white;display:inline-block;*display:inline;*zoom:1;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-btn:hover,.mce-btn:active{background:white;color:#595959;border-color:#e2e4e7}.mce-btn:focus{background:white;color:#595959;border-color:#e2e4e7}.mce-btn.mce-disabled button,.mce-btn.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-btn.mce-active,.mce-btn.mce-active:hover,.mce-btn.mce-active:focus,.mce-btn.mce-active:active{-webkit-box-shadow:none;-moz-box-shadow:none;box-
shadow:none;background:#555c66;color:white;border-color:transparent}.mce-btn.mce-active button,.mce-btn.mce-active:hover button,.mce-btn.mce-active i,.mce-btn.mce-active:hover i{color:white}.mce-btn:hover .mce-caret{border-top-color:#b5bcc2}.mce-btn.mce-active .mce-caret,.mce-btn.mce-active:hover .mce-caret{border-top-color:white}.mce-btn button{padding:4px 6px;font-size:14px;line-height:20px;*line-height:16px;cursor:pointer;color:#595959;text-align:center;overflow:visible;-webkit-appearance:none}.mce-btn button::-moz-focus-inner{border:0;padding:0}.mce-btn i{text-shadow:1px 1px none}.mce-primary.mce-btn-has-text{min-width:50px}.mce-primary{color:white;border:1px solid transparent;border-color:transparent;background-color:#2276d2}.mce-primary:hover,.mce-primary:focus{background-color:#1e6abc;border-color:transparent}.mce-primary.mce-disabled button,.mce-primary.mce-disabled:hover button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alp
ha(opacity=40);zoom:1}.mce-primary.mce-active,.mce-primary.mce-active:hover,.mce-primary:not(.mce-disabled):active{background-color:#1e6abc;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-primary button,.mce-primary button i{color:white;text-shadow:1px 1px none}.mce-btn .mce-txt{font-size:inherit;line-height:inherit;color:inherit}.mce-btn-large button{padding:9px 14px;font-size:16px;line-height:normal}.mce-btn-large i{margin-top:2px}.mce-btn-small button{padding:1px 5px;font-size:12px;*padding-bottom:2px}.mce-btn-small i{line-height:20px;vertical-align:top;*line-height:18px}.mce-btn .mce-caret{margin-top:8px;margin-left:0}.mce-btn-small .mce-caret{margin-top:8px;margin-left:0}.mce-caret{display:inline-block;*display:inline;*zoom:1;width:0;height:0;vertical-align:top;border-top:4px solid #b5bcc2;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.mce-disabled .mce-caret{border-top-color:#aaa}.mce-caret.mce-up{border-bottom:4px
solid #b5bcc2;border-top:0}.mce-btn-flat{border:0;background:transparent;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-btn-flat:hover,.mce-btn-flat.mce-active,.mce-btn-flat:focus,.mce-btn-flat:active{border:0;background:#e6e6e6;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-btn-has-text .mce-ico{padding-right:5px}.mce-rtl .mce-btn button{direction:rtl}.mce-toolbar .mce-btn-group{margin:0;padding:2px 0}.mce-btn-group .mce-btn{border-width:1px;margin:0;margin-left:2px}.mce-btn-group:not(:first-child){border-left:1px solid #d9d9d9;padding-left:0;margin-left:2px}.mce-btn-group{margin-left:2px}.mce-btn-group .mce-btn.mce-flow-layout-item{margin:0}.mce-rtl .mce-btn-group .mce-btn{margin-left:0;margin-right:2px}.mce-rtl .mce-btn-group .mce-first{margin-right:0}.mce-rtl .mce-btn-group:not(:first-child){border-left:none;border-right:1px solid #d9d9d9;padding-right:4px;margin-right:4px}.mce-checkbox{cursor:pointer}i.mce-i-checkbox
{margin:0 3px 0 0;border:1px solid #c5c5c5;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;background-color:white;text-indent:-10em;overflow:hidden}.mce-checked i.mce-i-checkbox{color:#595959;font-size:16px;line-height:16px;text-indent:0}.mce-checkbox:focus i.mce-i-checkbox,.mce-checkbox.mce-focus i.mce-i-checkbox{border:1px solid #2276d2;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-checkbox.mce-disabled .mce-label,.mce-checkbox.mce-disabled i.mce-i-checkbox{color:#bdbdbd}.mce-checkbox .mce-label{vertical-align:middle}.mce-rtl .mce-checkbox{direction:rtl;text-align:right}.mce-rtl i.mce-i-checkbox{margin:0 0 0 3px}.mce-combobox{position:relative;display:inline-block;*display:inline;*zoom:1;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;*height:32px}.mce-combobox input{border:1px solid #c5c5c5;border-right-color:#c5c5c5;height:28px}.mce-combobox.mce-disabled input{color:#bdbdbd}.mce-combobox .mce-btn{border:1px solid #c5c5c5;border-left:
0;margin:0}.mce-combobox button{padding-right:8px;padding-left:8px}.mce-combobox.mce-disabled .mce-btn button{cursor:default;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-combobox .mce-status{position:absolute;right:2px;top:50%;line-height:16px;margin-top:-8px;font-size:12px;width:15px;height:15px;text-align:center;cursor:pointer}.mce-combobox.mce-has-status input{padding-right:20px}.mce-combobox.mce-has-open .mce-status{right:37px}.mce-combobox .mce-status.mce-i-warning{color:#c09853}.mce-combobox .mce-status.mce-i-checkmark{color:#468847}.mce-menu.mce-combobox-menu{border-top:0;margin-top:0;max-height:200px}.mce-menu.mce-combobox-menu .mce-menu-item{padding:4px 6px 4px 4px;font-size:11px}.mce-menu.mce-combobox-menu .mce-menu-item-sep{padding:0}.mce-menu.mce-combobox-menu .mce-text,.mce-menu.mce-combobox-menu .mce-text b{font-size:11px}.mce-menu.mce-combobox-menu .mce-menu-item-link,.mce-menu.mce-combobox-menu .mce-menu
-item-link b{font-size:11px}.mce-colorbox i{border:1px solid #c5c5c5;width:14px;height:14px}.mce-colorbutton .mce-ico{position:relative}.mce-colorbutton-grid{margin:4px}.mce-colorbutton .mce-preview{padding-right:3px;display:block;position:absolute;left:50%;top:50%;margin-left:-17px;margin-top:7px;background:gray;width:13px;height:2px;overflow:hidden}.mce-colorbutton.mce-btn-small .mce-preview{margin-left:-16px;padding-right:0;width:16px}.mce-rtl .mce-colorbutton{direction:rtl}.mce-rtl .mce-colorbutton .mce-preview{margin-left:0;padding-right:0;padding-left:3px}.mce-rtl .mce-colorbutton.mce-btn-small .mce-preview{margin-left:0;padding-right:0;padding-left:2px}.mce-rtl .mce-colorbutton .mce-open{padding-left:4px;padding-right:4px;border-left:0}.mce-colorpicker{position:relative;width:250px;height:220px}.mce-colorpicker-sv{position:absolute;top:0;left:0;width:90%;height:100%;border:1px solid #c5c5c5;cursor:crosshair;overflow:hidden}.mce-colorpicker-h-chunk{width:100%}.mce-colorpicker-
overlay1,.mce-colorpicker-overlay2{width:100%;height:100%;position:absolute;top:0;left:0}.mce-colorpicker-overlay1{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=1, startColorstr='#ffffff', endColorstr='#00ffffff');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=1,startColorstr='#ffffff', endColorstr='#00ffffff')";background:linear-gradient(to right, #fff, rgba(255,255,255,0))}.mce-colorpicker-overlay2{filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#00000000', endColorstr='#000000');-ms-filter:"progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#00000000', endColorstr='#000000')";background:linear-gradient(to bottom, rgba(0,0,0,0), #000)}.mce-colorpicker-selector1{background:none;position:absolute;width:12px;height:12px;margin:-8px 0 0 -8px;border:1px solid black;border-radius:50%}.mce-colorpicker-selector2{position:absolute;width:10px;height:10px;border:1px solid white;bo
rder-radius:50%}.mce-colorpicker-h{position:absolute;top:0;right:0;width:6.5%;height:100%;border:1px solid #c5c5c5;cursor:crosshair}.mce-colorpicker-h-marker{margin-top:-4px;position:absolute;top:0;left:-1px;width:100%;border:1px solid black;background:white;height:4px;z-index:100}.mce-path{display:inline-block;*display:inline;*zoom:1;padding:8px;white-space:normal;font-size:inherit}.mce-path .mce-txt{display:inline-block;padding-right:3px}.mce-path .mce-path-body{display:inline-block}.mce-path-item{display:inline-block;*display:inline;*zoom:1;cursor:pointer;color:#595959;font-size:inherit;text-transform:uppercase}.mce-path-item:hover{text-decoration:underline}.mce-path-item:focus{background:#555c66;color:white}.mce-path .mce-divider{display:inline;font-size:inherit}.mce-disabled .mce-path-item{color:#aaa}.mce-rtl .mce-path{direction:rtl}.mce-fieldset{border:0 solid #9E9E9E}.mce-fieldset>.mce-container-body{margin-top:-15px}.mce-fieldset-title{margin-left:5px;padding:0 5px 0 5px}
.mce-fit-layout{display:inline-block;*display:inline;*zoom:1}.mce-fit-layout-item{position:absolute}.mce-flow-layout-item{display:inline-block;*display:inline;*zoom:1}.mce-flow-layout-item{margin:2px 0 2px 2px}.mce-flow-layout-item.mce-last{margin-right:2px}.mce-flow-layout{white-space:normal}.mce-tinymce-inline .mce-flow-layout{white-space:nowrap}.mce-rtl .mce-flow-layout{text-align:right;direction:rtl}.mce-rtl .mce-flow-layout-item{margin:2px 2px 2px 0}.mce-rtl .mce-flow-layout-item.mce-last{margin-left:2px}.mce-iframe{border:0 solid #c5c5c5;width:100%;height:100%}.mce-infobox{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 1px rgba(255,255,255,0.75);overflow:hidden;border:1px solid red}.mce-infobox div{display:block;margin:5px}.mce-infobox div button{position:absolute;top:50%;right:4px;cursor:pointer;margin-top:-8px;display:none}.mce-infobox div button:focus{outline:2px solid #e2e4e7}.mce-infobox.mce-has-help div{margin-right:25px}.mce-infobox.mce-has-help button{d
isplay:block}.mce-infobox.mce-success{background:#dff0d8;border-color:#d6e9c6}.mce-infobox.mce-success div{color:#3c763d}.mce-infobox.mce-warning{background:#fcf8e3;border-color:#faebcc}.mce-infobox.mce-warning div{color:#8a6d3b}.mce-infobox.mce-error{background:#f2dede;border-color:#ebccd1}.mce-infobox.mce-error div{color:#a94442}.mce-rtl .mce-infobox div{text-align:right;direction:rtl}.mce-label{display:inline-block;*display:inline;*zoom:1;text-shadow:0 1px 1px rgba(255,255,255,0.75);overflow:hidden}.mce-label.mce-autoscroll{overflow:auto}.mce-label.mce-disabled{color:#aaa}.mce-label.mce-multiline{white-space:pre-wrap}.mce-label.mce-success{color:#468847}.mce-label.mce-warning{color:#c09853}.mce-label.mce-error{color:#b94a48}.mce-rtl .mce-label{text-align:right;direction:rtl}.mce-menubar{border:1px solid #e2e4e7}.mce-menubar .mce-menubtn{border-color:transparent;background:transparent;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;filter:none}.mce-menubar .mce-menubt
n button span{color:#595959}.mce-menubar .mce-caret{border-top-color:#b5bcc2}.mce-menubar .mce-active .mce-caret,.mce-menubar .mce-menubtn:hover .mce-caret{border-top-color:#b5bcc2}.mce-menubar .mce-menubtn:hover,.mce-menubar .mce-menubtn.mce-active,.mce-menubar .mce-menubtn:focus{border-color:#e2e4e7;background:white;filter:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-menubar .mce-menubtn.mce-active{border-bottom:none;z-index:65537}div.mce-menubtn.mce-opened{border-bottom-color:white;z-index:65537}.mce-menubtn button{color:#595959}.mce-menubtn.mce-btn-small span{font-size:12px}.mce-menubtn.mce-fixed-width span{display:inline-block;overflow-x:hidden;text-overflow:ellipsis;width:90px}.mce-menubtn.mce-fixed-width.mce-btn-small span{width:70px}.mce-menubtn .mce-caret{*margin-top:6px}.mce-rtl .mce-menubtn button{direction:rtl;text-align:right}.mce-rtl .mce-menubtn.mce-fixed-width span{direction:rtl;text-align:right}.mce-menu-item{display:block;padding:6px 4px 6
px 4px;clear:both;font-weight:normal;line-height:20px;color:#595959;white-space:nowrap;cursor:pointer;line-height:normal;border-left:4px solid transparent;margin-bottom:1px}.mce-menu-item .mce-text,.mce-menu-item .mce-text b{line-height:1;vertical-align:initial}.mce-menu-item .mce-caret{margin-top:4px;margin-right:6px;border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid #595959}.mce-menu-item .mce-menu-shortcut{display:inline-block;padding:0 10px 0 20px;color:#aaa}.mce-menu-item .mce-ico{padding-right:4px}.mce-menu-item:hover,.mce-menu-item:focus{background:#ededee}.mce-menu-item:hover .mce-menu-shortcut,.mce-menu-item:focus .mce-menu-shortcut{color:#aaa}.mce-menu-item:hover .mce-text,.mce-menu-item:focus .mce-text,.mce-menu-item:hover .mce-ico,.mce-menu-item:focus .mce-ico{color:#595959}.mce-menu-item.mce-selected{background:#ededee}.mce-menu-item.mce-selected .mce-text,.mce-menu-item.mce-selected .mce-ico{color:#595959}.mce-menu-item.mce-activ
e.mce-menu-item-normal{background:#555c66}.mce-menu-item.mce-active.mce-menu-item-normal .mce-text,.mce-menu-item.mce-active.mce-menu-item-normal .mce-ico{color:white}.mce-menu-item.mce-active.mce-menu-item-checkbox .mce-ico{visibility:visible}.mce-menu-item.mce-disabled,.mce-menu-item.mce-disabled:hover{background:white}.mce-menu-item.mce-disabled:focus,.mce-menu-item.mce-disabled:hover:focus{background:#ededee}.mce-menu-item.mce-disabled .mce-text,.mce-menu-item.mce-disabled:hover .mce-text,.mce-menu-item.mce-disabled .mce-ico,.mce-menu-item.mce-disabled:hover .mce-ico{color:#aaa}.mce-menu-item.mce-menu-item-preview.mce-active{border-left:5px solid #555c66;background:white}.mce-menu-item.mce-menu-item-preview.mce-active .mce-text,.mce-menu-item.mce-menu-item-preview.mce-active .mce-ico{color:#595959}.mce-menu-item.mce-menu-item-preview.mce-active:hover{background:#ededee}.mce-menu-item-link{color:#093;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mce-menu-item-link b{
color:#093}.mce-menu-item-ellipsis{display:block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.mce-menu-item:hover *,.mce-menu-item.mce-selected *,.mce-menu-item:focus *{color:#595959}div.mce-menu .mce-menu-item-sep,.mce-menu-item-sep:hover{border:0;padding:0;height:1px;margin:9px 1px;overflow:hidden;background:transparent;border-bottom:1px solid rgba(0,0,0,0.1);cursor:default;filter:none}div.mce-menu .mce-menu-item b{font-weight:bold}.mce-menu-item-indent-1{padding-left:20px}.mce-menu-item-indent-2{padding-left:35px}.mce-menu-item-indent-2{padding-left:35px}.mce-menu-item-indent-3{padding-left:40px}.mce-menu-item-indent-4{padding-left:45px}.mce-menu-item-indent-5{padding-left:50px}.mce-menu-item-indent-6{padding-left:55px}.mce-menu.mce-rtl{direction:rtl}.mce-rtl .mce-menu-item{text-align:right;direction:rtl;padding:6px 12px 6px 15px}.mce-rtl .mce-menu-item .mce-caret{margin-left:6px;margin-right:0;border-right:4px solid #595959;border-left:0}.mce-rtl .mce-menu-item.mce
-selected .mce-caret,.mce-rtl .mce-menu-item:focus .mce-caret,.mce-rtl .mce-menu-item:hover .mce-caret{border-left-color:transparent;border-right-color:#595959}.mce-rtl .mce-menu-item .mce-ico{padding-right:0;padding-left:4px}.mce-throbber{position:absolute;top:0;left:0;width:100%;height:100%;opacity:.6;filter:alpha(opacity=60);zoom:1;background:#fff url('img/loader.gif') no-repeat center center}.mce-throbber-inline{position:static;height:50px}.mce-menu .mce-throbber-inline{height:25px;background-size:contain}.mce-menu{position:absolute;left:0;top:0;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);background:transparent;z-index:1000;padding:5px 0 5px 0;margin:-1px 0 0;min-width:180px;background:white;border:1px solid #c5c9cf;border:1px solid #e2e4e7;z-index:1002;-webkit-box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);-moz-box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);box-shadow:0 1px 2px rgba(0, 0, 0, 0.2);max-height:500px;overflow:auto;overflow-x:hidden}.mce-menu.mce-animate{op
acity:.01;transform:rotateY(10deg) rotateX(-10deg);transform-origin:left top}.mce-menu.mce-menu-align .mce-menu-shortcut,.mce-menu.mce-menu-align .mce-caret{position:absolute;right:0}.mce-menu i{display:none}.mce-menu-has-icons i{display:inline-block}.mce-menu.mce-in.mce-animate{opacity:1;transform:rotateY(0) rotateX(0);transition:opacity .075s ease,transform .1s ease}.mce-menu-sub-tr-tl{margin:-6px 0 0 -1px}.mce-menu-sub-br-bl{margin:6px 0 0 -1px}.mce-menu-sub-tl-tr{margin:-6px 0 0 1px}.mce-menu-sub-bl-br{margin:6px 0 0 1px}.mce-rtl .mce-menu-item .mce-ico{padding-right:0;padding-left:4px}.mce-rtl.mce-menu-align .mce-caret,.mce-rtl .mce-menu-shortcut{right:auto;left:0}.mce-listbox button{text-align:left;padding-right:20px;position:relative}.mce-listbox .mce-caret{position:absolute;margin-top:-2px;right:8px;top:50%}.mce-rtl .mce-listbox .mce-caret{right:auto;left:8px}.mce-rtl .mce-listbox button{padding-right:10px;padding-left:20px}.mce-container-body .mce-resizehandle{position:abso
lute;right:0;bottom:0;width:16px;height:16px;visibility:visible;cursor:s-resize;margin:0}.mce-container-body .mce-resizehandle-both{cursor:se-resize}i.mce-i-resize{color:#595959}.mce-selectbox{background:#fff;border:1px solid #c5c5c5}.mce-slider{border:1px solid #c5c5c5;background:#fff;width:100px;height:10px;position:relative;display:block}.mce-slider.mce-vertical{width:10px;height:100px}.mce-slider-handle{border:1px solid #c5c5c5;background:#e6e6e6;display:block;width:13px;height:13px;position:absolute;top:0;left:0;margin-left:-1px;margin-top:-2px}.mce-slider-handle:focus{border-color:#2276d2}.mce-spacer{visibility:hidden}.mce-splitbtn:hover .mce-open{border-left:1px solid #e2e4e7}.mce-splitbtn .mce-open{border-left:1px solid transparent;padding-right:4px;padding-left:4px}.mce-splitbtn .mce-open:focus{border-left:1px solid #e2e4e7}.mce-splitbtn .mce-open:hover,.mce-splitbtn .mce-open:active{border-left:1px solid #e2e4e7}.mce-splitbtn.mce-active:hover .mce-open{border-left:1px soli
d white}.mce-splitbtn.mce-opened{border-color:#e2e4e7}.mce-splitbtn.mce-btn-small .mce-open{padding:0 3px 0 3px}.mce-rtl .mce-splitbtn{direction:rtl;text-align:right}.mce-rtl .mce-splitbtn button{padding-right:4px;padding-left:4px}.mce-rtl .mce-splitbtn .mce-open{border-left:0}.mce-stack-layout-item{display:block}.mce-tabs{display:block;border-bottom:1px solid #c5c5c5}.mce-tabs,.mce-tabs+.mce-container-body{background:#fff}.mce-tab{display:inline-block;*display:inline;*zoom:1;border:1px solid #c5c5c5;border-width:0 1px 0 0;background:#fff;padding:8px 15px;text-shadow:0 1px 1px rgba(255,255,255,0.75);height:13px;cursor:pointer}.mce-tab:hover{background:#FDFDFD}.mce-tab.mce-active{background:#FDFDFD;border-bottom-color:transparent;margin-bottom:-1px;height:14px}.mce-tab:focus{color:#2276d2}.mce-rtl .mce-tabs{text-align:right;direction:rtl}.mce-rtl .mce-tab{border-width:0 0 0 1px}.mce-textbox{background:#fff;border:1px solid #c5c5c5;-webkit-box-shadow:none;-moz-box-shadow:none;box-shad
ow:none;display:inline-block;-webkit-transition:border linear .2s, box-shadow linear .2s;transition:border linear .2s, box-shadow linear .2s;height:28px;resize:none;padding:0 4px 0 4px;white-space:pre-wrap;*white-space:pre;color:#595959}.mce-textbox:focus,.mce-textbox.mce-focus{border-color:#2276d2;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.mce-placeholder .mce-textbox{color:#aaa}.mce-textbox.mce-multiline{padding:4px;height:auto}.mce-textbox.mce-disabled{color:#bdbdbd}.mce-rtl .mce-textbox{text-align:right;direction:rtl}.mce-dropzone{border:3px dashed gray;text-align:center}.mce-dropzone span{text-transform:uppercase;display:inline-block;vertical-align:middle}.mce-dropzone:after{content:"";height:100%;display:inline-block;vertical-align:middle}.mce-dropzone.mce-disabled{opacity:.4;filter:alpha(opacity=40);zoom:1}.mce-dropzone.mce-disabled.mce-dragenter{cursor:not-allowed}.mce-browsebutton{position:relative;overflow:hidden}.mce-browsebutton button{positi
on:relative;z-index:1}.mce-browsebutton input{opacity:0;filter:alpha(opacity=0);zoom:1;position:absolute;top:0;left:0;width:100%;height:100%;z-index:0}@font-face{font-family:'tinymce';src:url('fonts/tinymce.eot');src:url('fonts/tinymce.eot?#iefix') format('embedded-opentype'),url('fonts/tinymce.woff') format('woff'),url('fonts/tinymce.ttf') format('truetype'),url('fonts/tinymce.svg#tinymce') format('svg');font-weight:normal;font-style:normal}@font-face{font-family:'tinymce-small';src:url('fonts/tinymce-small.eot');src:url('fonts/tinymce-small.eot?#iefix') format('embedded-opentype'),url('fonts/tinymce-small.woff') format('woff'),url('fonts/tinymce-small.ttf') format('truetype'),url('fonts/tinymce-small.svg#tinymce') format('svg');font-weight:normal;font-style:normal}.mce-ico{font-family:'tinymce',Arial;font-style:normal;font-weight:normal;font-variant:normal;font-size:16px;line-height:16px;speak:none;vertical-align:text-top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:
grayscale;display:inline-block;background:transparent center center;background-size:cover;width:16px;height:16px;color:#595959}.mce-btn-small .mce-ico{font-family:'tinymce-small',Arial}.mce-i-save:before{content:"\e000"}.mce-i-newdocument:before{content:"\e001"}.mce-i-fullpage:before{content:"\e002"}.mce-i-alignleft:before{content:"\e003"}.mce-i-aligncenter:before{content:"\e004"}.mce-i-alignright:before{content:"\e005"}.mce-i-alignjustify:before{content:"\e006"}.mce-i-alignnone:before{content:"\e003"}.mce-i-cut:before{content:"\e007"}.mce-i-paste:before{content:"\e008"}.mce-i-searchreplace:before{content:"\e009"}.mce-i-bullist:before{content:"\e00a"}.mce-i-numlist:before{content:"\e00b"}.mce-i-indent:before{content:"\e00c"}.mce-i-outdent:before{content:"\e00d"}.mce-i-blockquote:before{content:"\e00e"}.mce-i-undo:before{conte
nt:"\e00f"}.mce-i-redo:before{content:"\e010"}.mce-i-link:before{content:"\e011"}.mce-i-unlink:before{content:"\e012"}.mce-i-anchor:before{content:"\e013"}.mce-i-image:before{content:"\e014"}.mce-i-media:before{content:"\e015"}.mce-i-help:before{content:"\e016"}.mce-i-code:before{content:"\e017"}.mce-i-insertdatetime:before{content:"\e018"}.mce-i-preview:before{content:"\e019"}.mce-i-forecolor:before{content:"\e01a"}.mce-i-backcolor:before{content:"\e01a"}.mce-i-table:before{content:"\e01b"}.mce-i-hr:before{content:"\e01c"}.mce-i-removeformat:before{content:"\e01d"}.mce-i-subscript:before{content:"\e01e"}.mce-i-superscript:before{content:"\e01f"}.mce-i-charmap:before{content:"\e020"}.mce-i-emoticons:before{content:"\e021"}.mce-i-print:before{content:"\e022"}.mce-i-fullscreen:b
efore{content:"\e023"}.mce-i-spellchecker:before{content:"\e024"}.mce-i-nonbreaking:before{content:"\e025"}.mce-i-template:before{content:"\e026"}.mce-i-pagebreak:before{content:"\e027"}.mce-i-restoredraft:before{content:"\e028"}.mce-i-bold:before{content:"\e02a"}.mce-i-italic:before{content:"\e02b"}.mce-i-underline:before{content:"\e02c"}.mce-i-strikethrough:before{content:"\e02d"}.mce-i-visualchars:before{content:"\e02e"}.mce-i-visualblocks:before{content:"\e02e"}.mce-i-ltr:before{content:"\e02f"}.mce-i-rtl:before{content:"\e030"}.mce-i-copy:before{content:"\e031"}.mce-i-resize:before{content:"\e032"}.mce-i-browse:before{content:"\e034"}.mce-i-pastetext:before{content:"\e035"}.mce-i-rotateleft:before{content:"\eaa8"}.mce-i-rotateright:before{content:"\eaa9"}.mce-i-crop:before{content:
"\ee78"}.mce-i-editimage:before{content:"\e915"}.mce-i-options:before{content:"\ec6a"}.mce-i-flipv:before{content:"\eaaa"}.mce-i-fliph:before{content:"\eaac"}.mce-i-zoomin:before{content:"\eb35"}.mce-i-zoomout:before{content:"\eb36"}.mce-i-sun:before{content:"\eccc"}.mce-i-moon:before{content:"\eccd"}.mce-i-arrowleft:before{content:"\edc0"}.mce-i-arrowright:before{content:"\e93c"}.mce-i-drop:before{content:"\e935"}.mce-i-contrast:before{content:"\ecd4"}.mce-i-sharpen:before{content:"\eba7"}.mce-i-resize2:before{content:"\edf9"}.mce-i-orientation:before{content:"\e601"}.mce-i-invert:before{content:"\e602"}.mce-i-gamma:before{content:"\e600"}.mce-i-remove:before{content:"\ed6a"}.mce-i-tablerowprops:before{content:"\e604"}.mce-i-tablecellprops:before{content:"\e605"}.mce-i-table2
:before{content:"\e606"}.mce-i-tablemergecells:before{content:"\e607"}.mce-i-tableinsertcolbefore:before{content:"\e608"}.mce-i-tableinsertcolafter:before{content:"\e609"}.mce-i-tableinsertrowbefore:before{content:"\e60a"}.mce-i-tableinsertrowafter:before{content:"\e60b"}.mce-i-tablesplitcells:before{content:"\e60d"}.mce-i-tabledelete:before{content:"\e60e"}.mce-i-tableleftheader:before{content:"\e62a"}.mce-i-tabletopheader:before{content:"\e62b"}.mce-i-tabledeleterow:before{content:"\e800"}.mce-i-tabledeletecol:before{content:"\e801"}.mce-i-codesample:before{content:"\e603"}.mce-i-fill:before{content:"\e902"}.mce-i-borderwidth:before{content:"\e903"}.mce-i-line:before{content:"\e904"}.mce-i-count:before{content:"\e905"}.mce-i-translate:before{content:"\e907"}.mce-i-drag:before{content:"\e908"}.m
ce-i-home:before{content:"\e90b"}.mce-i-upload:before{content:"\e914"}.mce-i-bubble:before{content:"\e91c"}.mce-i-user:before{content:"\e91d"}.mce-i-lock:before{content:"\e926"}.mce-i-unlock:before{content:"\e927"}.mce-i-settings:before{content:"\e928"}.mce-i-remove2:before{content:"\e92a"}.mce-i-menu:before{content:"\e92d"}.mce-i-warning:before{content:"\e930"}.mce-i-question:before{content:"\e931"}.mce-i-pluscircle:before{content:"\e932"}.mce-i-info:before{content:"\e933"}.mce-i-notice:before{content:"\e934"}.mce-i-arrowup:before{content:"\e93b"}.mce-i-arrowdown:before{content:"\e93d"}.mce-i-arrowup2:before{content:"\e93f"}.mce-i-arrowdown2:before{content:"\e940"}.mce-i-menu2:before{content:"\e941"}.mce-i-newtab:before{content:"\e961"}.mce-i-a11y:before{content:"\e900"}.mce-
i-plus:before{content:"\e93a"}.mce-i-insert:before{content:"\e93a"}.mce-i-minus:before{content:"\e939"}.mce-i-books:before{content:"\e911"}.mce-i-reload:before{content:"\e906"}.mce-i-toc:before{content:"\e901"}.mce-i-checkmark:before{content:"\e033"}.mce-i-checkbox:before,.mce-i-selected:before{content:"\e033"}.mce-i-insert{font-size:14px}.mce-i-selected{visibility:hidden}i.mce-i-backcolor{text-shadow:none;background:#BBB}.mce-rtl .mce-filepicker input{direction:ltr}
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcethemesinlitethemejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/themes/inlite/theme.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/themes/inlite/theme.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/themes/inlite/theme.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,2168 +1,10644 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var inlite = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.ThemeManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay');
+
+ var flatten = function (arr) {
+ return arr.reduce(function (results, item) {
+ return Array.isArray(item) ? results.concat(flatten(item)) : results.concat(item);
+ }, []);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_5c3vrp16xjfuw8wdu = { flatten: flatten };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
-
-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
-
-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var result = function (id, rect) {
+ return {
+ id: id,
+ rect: rect
+ };
+ };
+ var match = function (editor, matchers) {
+ for (var i = 0; i < matchers.length; i++) {
+ var f = matchers[i];
+ var result_1 = f(editor);
+ if (result_1) {
+ return result_1;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
+ };
+ var $_8rky1516zjfuw8wdx = {
+ match: match,
+ result: result
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.themes.inlite.Theme","tinymce.core.ThemeManager","tinymce.core.ui.Api","tinymce.core.util.Delay","tinymce.themes.inlite.alien.Arr","tinymce.themes.inlite.alien.EditorSettings","tinymce.themes.inlite.core.ElementMatcher","tinymce.themes.inlite.core.Matcher","tinymce.themes.inlite.core.PredicateId","tinymce.themes.inlite.core.SelectionMatcher","tinymce.themes.inlite.core.SkinLoader","tinymce.themes.inlite.ui.Buttons","tinymce.themes.inlite.ui.Panel","global!tinymce.util.Tools.resolve","tinymce.themes.inlite.alien.Type","tinymce.themes.inlite.core.Measure","tinymce.core.util.Tools","tinymce.core.EditorManager","tinymce.core.dom.DOMUtils","tinymce.core.ui.Factory","tinymce.themes.inlite.ui.Toolbar","tinymce.themes.inlite.ui.Forms","tinymce.themes.inlite.co
re.Layout","tinymce.themes.inlite.file.Conversions","tinymce.themes.inlite.file.Picker","tinymce.themes.inlite.core.Actions","tinymce.themes.inlite.core.Convert","tinymce.core.util.Promise","tinymce.themes.inlite.alien.Uuid","tinymce.themes.inlite.alien.Unlink","tinymce.themes.inlite.core.UrlType","tinymce.core.geom.Rect","tinymce.themes.inlite.alien.Bookmark","tinymce.core.dom.TreeWalker","tinymce.core.dom.RangeUtils"]
-jsc*/
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ThemeManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.ThemeManager');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ui.Api',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.ui.Api');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Delay',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Delay');
- }
-);
-
-/**
- * Arr.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.alien.Arr',
- [
- ],
- function () {
- var flatten = function (arr) {
- return arr.reduce(function (results, item) {
- return Array.isArray(item) ? results.concat(flatten(item)) : results.concat(item);
- }, []);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fromClientRect = function (clientRect) {
+ return {
+ x: clientRect.left,
+ y: clientRect.top,
+ w: clientRect.width,
+ h: clientRect.height
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var toClientRect = function (geomRect) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- flatten: flatten
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ left: geomRect.x,
+ top: geomRect.y,
+ width: geomRect.w,
+ height: geomRect.h,
+ right: geomRect.x + geomRect.w,
+ bottom: geomRect.y + geomRect.h
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_1tf7l3171jfuw8we0 = {
+ fromClientRect: fromClientRect,
+ toClientRect: toClientRect
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Type.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.alien.Type',
- [
- ],
- function () {
- var isType = function (type) {
- return function (value) {
- return typeof value === type;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toAbsolute = function (rect) {
+ var vp = global$2.DOM.getViewPort();
+ return {
+ x: rect.x + vp.x,
+ y: rect.y + vp.y,
+ w: rect.w,
+ h: rect.h
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var measureElement = function (elm) {
+ var clientRect = elm.getBoundingClientRect();
+ return toAbsolute({
+ x: clientRect.left,
+ y: clientRect.top,
+ w: Math.max(elm.clientWidth, elm.offsetWidth),
+ h: Math.max(elm.clientHeight, elm.offsetHeight)
+ });
+ };
+ var getElementRect = function (editor, elm) {
+ return measureElement(elm);
+ };
+ var getPageAreaRect = function (editor) {
+ return measureElement(editor.getElement().ownerDocument.body);
+ };
+ var getContentAreaRect = function (editor) {
+ return measureElement(editor.getContentAreaContainer() || editor.getBody());
+ };
+ var getSelectionRect = function (editor) {
+ var clientRect = editor.selection.getBoundingClientRect();
+ return clientRect ? toAbsolute($_1tf7l3171jfuw8we0.fromClientRect(clientRect)) : null;
+ };
+ var $_eiro29170jfuw8wdy = {
+ getElementRect: getElementRect,
+ getPageAreaRect: getPageAreaRect,
+ getContentAreaRect: getContentAreaRect,
+ getSelectionRect: getSelectionRect
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isArray = function (value) {
- return Array.isArray(value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var element = function (element, predicateIds) {
+ return function (editor) {
+ for (var i = 0; i < predicateIds.length; i++) {
+ if (predicateIds[i].predicate(element)) {
+ var result = $_8rky1516zjfuw8wdx.result(predicateIds[i].id, $_eiro29170jfuw8wdy.getElementRect(editor, element));
+ return result;
+ }
+ }
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isNull = function (value) {
- return value === null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var parent = function (elements, predicateIds) {
+ return function (editor) {
+ for (var i = 0; i < elements.length; i++) {
+ for (var x = 0; x < predicateIds.length; x++) {
+ if (predicateIds[x].predicate(elements[i])) {
+ return $_8rky1516zjfuw8wdx.result(predicateIds[x].id, $_eiro29170jfuw8wdy.getElementRect(editor, elements[i]));
+ }
+ }
+ }
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_9pht4216yjfuw8wdv = {
+ element: element,
+ parent: parent
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isObject = function (predicate) {
- return function (value) {
- return !isNull(value) && !isArray(value) && predicate(value);
- };
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var create = function (id, predicate) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- isString: isType("string"),
- isNumber: isType("number"),
- isBoolean: isType("boolean"),
- isFunction: isType("function"),
- isObject: isObject(isType("object")),
- isNull: isNull,
- isArray: isArray
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ id: id,
+ predicate: predicate
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var fromContextToolbars = function (toolbars) {
+ return global$4.map(toolbars, function (toolbar) {
+ return create(toolbar.id, toolbar.predicate);
+ });
+ };
+ var $_g3lgux172jfuw8we1 = {
+ create: create,
+ fromContextToolbars: fromContextToolbars
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * EditorSettings.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.alien.EditorSettings',
- [
- 'tinymce.themes.inlite.alien.Type'
- ],
- function (Type) {
- var validDefaultOrDie = function (value, predicate) {
- if (predicate(value)) {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var textSelection = function (id) {
+ return function (editor) {
+ if (!editor.selection.isCollapsed()) {
+ var result = $_8rky1516zjfuw8wdx.result(id, $_eiro29170jfuw8wdy.getSelectionRect(editor));
+ return result;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- throw new Error('Default value doesn\'t match requested type.');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getByTypeOr = function (predicate) {
- return function (editor, name, defaultValue) {
- var settings = editor.settings;
- validDefaultOrDie(defaultValue, predicate);
- return name in settings && predicate(settings[name]) ? settings[name] : defaultValue;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var emptyTextBlock = function (elements, id) {
+ return function (editor) {
+ var i;
+ var textBlockElementsMap = editor.schema.getTextBlockElements();
+ for (i = 0; i < elements.length; i++) {
+ if (elements[i].nodeName === 'TABLE') {
+ return null;
+ }
+ }
+ for (i = 0; i < elements.length; i++) {
+ if (elements[i].nodeName in textBlockElementsMap) {
+ if (editor.dom.isEmpty(elements[i])) {
+ return $_8rky1516zjfuw8wdx.result(id, $_eiro29170jfuw8wdy.getSelectionRect(editor));
+ }
+ return null;
+ }
+ }
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_9xiw90174jfuw8we2 = {
+ textSelection: textSelection,
+ emptyTextBlock: emptyTextBlock
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var splitNoEmpty = function (str, delim) {
- return str.split(delim).filter(function (item) {
- return item.length > 0;
- });
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fireSkinLoaded = function (editor) {
+ editor.fire('SkinLoaded');
+ };
+ var fireBeforeRenderUI = function (editor) {
+ return editor.fire('BeforeRenderUI');
+ };
+ var $_5f627b176jfuw8we5 = {
+ fireSkinLoaded: fireSkinLoaded,
+ fireBeforeRenderUI: fireBeforeRenderUI
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var itemsToArray = function (value, defaultValue) {
- var stringToItemsArray = function (value) {
- return typeof value === 'string' ? splitNoEmpty(value, /[ ,]/) : value;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$5 = tinymce.util.Tools.resolve('tinymce.EditorManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var boolToItemsArray = function (value, defaultValue) {
- return value === false ? [] : defaultValue;
- };
-
- if (Type.isArray(value)) {
- return value;
- } else if (Type.isString(value)) {
- return stringToItemsArray(value);
- } else if (Type.isBoolean(value)) {
- return boolToItemsArray(value, defaultValue);
- }
-
- return defaultValue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isType = function (type) {
+ return function (value) {
+ return typeof value === type;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getToolbarItemsOr = function (predicate) {
- return function (editor, name, defaultValue) {
- var value = name in editor.settings ? editor.settings[name] : defaultValue;
- validDefaultOrDie(defaultValue, predicate);
- return itemsToArray(value, defaultValue);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isArray = function (value) {
+ return Array.isArray(value);
+ };
+ var isNull = function (value) {
+ return value === null;
+ };
+ var isObject = function (predicate) {
+ return function (value) {
+ return !isNull(value) && !isArray(value) && predicate(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isString = function (value) {
+ return isType('string')(value);
+ };
+ var isNumber = function (value) {
+ return isType('number')(value);
+ };
+ var isFunction = function (value) {
+ return isType('function')(value);
+ };
+ var isBoolean = function (value) {
+ return isType('boolean')(value);
+ };
+ var $_8t6wb917ajfuw8wec = {
+ isString: isString,
+ isNumber: isNumber,
+ isBoolean: isBoolean,
+ isFunction: isFunction,
+ isObject: isObject(isType('object')),
+ isNull: isNull,
+ isArray: isArray
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- // TODO: Add Option based getString, getBool if merged with core
- getStringOr: getByTypeOr(Type.isString),
- getBoolOr: getByTypeOr(Type.isBoolean),
- getNumberOr: getByTypeOr(Type.isNumber),
- getHandlerOr: getByTypeOr(Type.isFunction),
- getToolbarItemsOr: getToolbarItemsOr(Type.isArray)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var validDefaultOrDie = function (value, predicate) {
+ if (predicate(value)) {
+ return true;
+ }
+ throw new Error('Default value doesn\'t match requested type.');
+ };
+ var getByTypeOr = function (predicate) {
+ return function (editor, name, defaultValue) {
+ var settings = editor.settings;
+ validDefaultOrDie(defaultValue, predicate);
+ return name in settings && predicate(settings[name]) ? settings[name] : defaultValue;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Matcher.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.core.Matcher',
- [
- ],
- function () {
- // result :: String, Rect -> Matcher.result
- var result = function (id, rect) {
- return {
- id: id,
- rect: rect
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var splitNoEmpty = function (str, delim) {
+ return str.split(delim).filter(function (item) {
+ return item.length > 0;
+ });
+ };
+ var itemsToArray = function (value, defaultValue) {
+ var stringToItemsArray = function (value) {
+ return typeof value === 'string' ? splitNoEmpty(value, /[ ,]/) : value;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var boolToItemsArray = function (value, defaultValue) {
+ return value === false ? [] : defaultValue;
+ };
+ if ($_8t6wb917ajfuw8wec.isArray(value)) {
+ return value;
+ } else if ($_8t6wb917ajfuw8wec.isString(value)) {
+ return stringToItemsArray(value);
+ } else if ($_8t6wb917ajfuw8wec.isBoolean(value)) {
+ return boolToItemsArray(value, defaultValue);
+ }
+ return defaultValue;
+ };
+ var getToolbarItemsOr = function (predicate) {
+ return function (editor, name, defaultValue) {
+ var value = name in editor.settings ? editor.settings[name] : defaultValue;
+ validDefaultOrDie(defaultValue, predicate);
+ return itemsToArray(value, defaultValue);
+ };
+ };
+ var $_r1zl2179jfuw8we9 = {
+ getStringOr: getByTypeOr($_8t6wb917ajfuw8wec.isString),
+ getBoolOr: getByTypeOr($_8t6wb917ajfuw8wec.isBoolean),
+ getNumberOr: getByTypeOr($_8t6wb917ajfuw8wec.isNumber),
+ getHandlerOr: getByTypeOr($_8t6wb917ajfuw8wec.isFunction),
+ getToolbarItemsOr: getToolbarItemsOr($_8t6wb917ajfuw8wec.isArray)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // match :: Editor, [(Editor -> Matcher.result | Null)] -> Matcher.result | Null
- var match = function (editor, matchers) {
- for (var i = 0; i < matchers.length; i++) {
- var f = matchers[i];
- var result = f(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$6 = tinymce.util.Tools.resolve('tinymce.geom.Rect');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (result) {
- return result;
- }
- }
-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var result$1 = function (rect, position) {
+ return {
+ rect: rect,
+ position: position
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var moveTo = function (rect, toRect) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- match: match,
- result: result
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ x: toRect.x,
+ y: toRect.y,
+ w: rect.w,
+ h: rect.h
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var calcByPositions = function (testPositions1, testPositions2, targetRect, contentAreaRect, panelRect) {
+ var relPos, relRect, outputPanelRect;
+ var paddedContentRect = {
+ x: contentAreaRect.x,
+ y: contentAreaRect.y,
+ w: contentAreaRect.w + (contentAreaRect.w < panelRect.w + targetRect.w ? panelRect.w : 0),
+ h: contentAreaRect.h + (contentAreaRect.h < panelRect.h + targetRect.h ? panelRect.h : 0)
+ };
+ relPos = global$6.findBestRelativePosition(panelRect, targetRect, paddedContentRect, testPositions1);
+ targetRect = global$6.clamp(targetRect, paddedContentRect);
+ if (relPos) {
+ relRect = global$6.relativePosition(panelRect, targetRect, relPos);
+ outputPanelRect = moveTo(panelRect, relRect);
+ return result$1(outputPanelRect, relPos);
+ }
+ targetRect = global$6.intersect(paddedContentRect, targetRect);
+ if (targetRect) {
+ relPos = global$6.findBestRelativePosition(panelRect, targetRect, paddedContentRect, testPositions2);
+ if (relPos) {
+ relRect = global$6.relativePosition(panelRect, targetRect, relPos);
+ outputPanelRect = moveTo(panelRect, relRect);
+ return result$1(outputPanelRect, relPos);
+ }
+ outputPanelRect = moveTo(panelRect, targetRect);
+ return result$1(outputPanelRect, relPos);
+ }
+ return null;
+ };
+ var calcInsert = function (targetRect, contentAreaRect, panelRect) {
+ return calcByPositions([
+ 'cr-cl',
+ 'cl-cr'
+ ], [
+ 'bc-tc',
+ 'bl-tl',
+ 'br-tr'
+ ], targetRect, contentAreaRect, panelRect);
+ };
+ var calc = function (targetRect, contentAreaRect, panelRect) {
+ return calcByPositions([
+ 'tc-bc',
+ 'bc-tc',
+ 'tl-bl',
+ 'bl-tl',
+ 'tr-br',
+ 'br-tr',
+ 'cr-cl',
+ 'cl-cr'
+ ], [
+ 'bc-tc',
+ 'bl-tl',
+ 'br-tr',
+ 'cr-cl'
+ ], targetRect, contentAreaRect, panelRect);
+ };
+ var userConstrain = function (handler, targetRect, contentAreaRect, panelRect) {
+ var userConstrainedPanelRect;
+ if (typeof handler === 'function') {
+ userConstrainedPanelRect = handler({
+ elementRect: $_1tf7l3171jfuw8we0.toClientRect(targetRect),
+ contentAreaRect: $_1tf7l3171jfuw8we0.toClientRect(contentAreaRect),
+ panelRect: $_1tf7l3171jfuw8we0.toClientRect(panelRect)
+ });
+ return $_1tf7l3171jfuw8we0.fromClientRect(userConstrainedPanelRect);
+ }
+ return panelRect;
+ };
+ var defaultHandler = function (rects) {
+ return rects.panelRect;
+ };
+ var $_4f0zwc17bjfuw8wee = {
+ calcInsert: calcInsert,
+ calc: calc,
+ userConstrain: userConstrain,
+ defaultHandler: defaultHandler
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toAbsoluteUrl = function (editor, url) {
+ return editor.documentBaseURI.toAbsolute(url);
+ };
+ var urlFromName = function (name) {
+ var prefix = global$5.baseURL + '/skins/';
+ return name ? prefix + name : prefix + 'lightgray';
+ };
+ var getTextSelectionToolbarItems = function (editor) {
+ return $_r1zl2179jfuw8we9.getToolbarItemsOr(editor, 'selection_toolbar', [
+ 'bold',
+ 'italic',
+ '|',
+ 'quicklink',
+ 'h2',
+ 'h3',
+ 'blockquote'
+ ]);
+ };
+ var getInsertToolbarItems = function (editor) {
+ return $_r1zl2179jfuw8we9.getToolbarItemsOr(editor, 'insert_toolbar', [
+ 'quickimage',
+ 'quicktable'
+ ]);
+ };
+ var getPositionHandler = function (editor) {
+ return $_r1zl2179jfuw8we9.getHandlerOr(editor, 'inline_toolbar_position_handler', $_4f0zwc17bjfuw8wee.defaultHandler);
+ };
+ var getSkinUrl = function (editor) {
+ var settings = editor.settings;
+ return settings.skin_url ? toAbsoluteUrl(editor, settings.skin_url) : urlFromName(settings.skin);
+ };
+ var isSkinDisabled = function (editor) {
+ return editor.settings.skin === false;
+ };
+ var $_44ho17177jfuw8we6 = {
+ getTextSelectionToolbarItems: getTextSelectionToolbarItems,
+ getInsertToolbarItems: getInsertToolbarItems,
+ getPositionHandler: getPositionHandler,
+ getSkinUrl: getSkinUrl,
+ isSkinDisabled: isSkinDisabled
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.dom.DOMUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.DOMUtils');
- }
-);
-
-/**
- * Convert.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.core.Convert',
- [
- ],
- function () {
- var fromClientRect = function (clientRect) {
- return {
- x: clientRect.left,
- y: clientRect.top,
- w: clientRect.width,
- h: clientRect.height
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fireSkinLoaded$1 = function (editor, callback) {
+ var done = function () {
+ editor._skinLoaded = true;
+ $_5f627b176jfuw8we5.fireSkinLoaded(editor);
+ callback();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (editor.initialized) {
+ done();
+ } else {
+ editor.on('init', done);
+ }
+ };
+ var load = function (editor, callback) {
+ var skinUrl = $_44ho17177jfuw8we6.getSkinUrl(editor);
+ var done = function () {
+ fireSkinLoaded$1(editor, callback);
+ };
+ if ($_44ho17177jfuw8we6.isSkinDisabled(editor)) {
+ done();
+ } else {
+ global$2.DOM.styleSheetLoader.load(skinUrl + '/skin.min.css', done);
+ editor.contentCSS.push(skinUrl + '/content.inline.min.css');
+ }
+ };
+ var $_5qgx51175jfuw8we4 = { load: load };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var toClientRect = function (geomRect) {
- return {
- left: geomRect.x,
- top: geomRect.y,
- width: geomRect.w,
- height: geomRect.h,
- right: geomRect.x + geomRect.w,
- bottom: geomRect.y + geomRect.h
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getSelectionElements = function (editor) {
+ var node = editor.selection.getNode();
+ var elms = editor.dom.getParents(node, '*');
+ return elms;
+ };
+ var createToolbar = function (editor, selector, id, items) {
+ var selectorPredicate = function (elm) {
+ return editor.dom.is(elm, selector);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- fromClientRect: fromClientRect,
- toClientRect: toClientRect
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ predicate: selectorPredicate,
+ id: id,
+ items: items
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Measure.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.core.Measure',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.themes.inlite.core.Convert'
- ],
- function (DOMUtils, Convert) {
- var toAbsolute = function (rect) {
- var vp = DOMUtils.DOM.getViewPort();
-
- return {
- x: rect.x + vp.x,
- y: rect.y + vp.y,
- w: rect.w,
- h: rect.h
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getToolbars = function (editor) {
+ var contextToolbars = editor.contextToolbars;
+ return $_5c3vrp16xjfuw8wdu.flatten([
+ contextToolbars ? contextToolbars : [],
+ createToolbar(editor, 'img', 'image', 'alignleft aligncenter alignright')
+ ]);
+ };
+ var findMatchResult = function (editor, toolbars) {
+ var result, elements, contextToolbarsPredicateIds;
+ elements = getSelectionElements(editor);
+ contextToolbarsPredicateIds = $_g3lgux172jfuw8we1.fromContextToolbars(toolbars);
+ result = $_8rky1516zjfuw8wdx.match(editor, [
+ $_9pht4216yjfuw8wdv.element(elements[0], contextToolbarsPredicateIds),
+ $_9xiw90174jfuw8we2.textSelection('text'),
+ $_9xiw90174jfuw8we2.emptyTextBlock(elements, 'insert'),
+ $_9pht4216yjfuw8wdv.parent(elements, contextToolbarsPredicateIds)
+ ]);
+ return result && result.rect ? result : null;
+ };
+ var editorHasFocus = function (editor) {
+ return document.activeElement === editor.getBody();
+ };
+ var togglePanel = function (editor, panel) {
+ var toggle = function () {
+ var toolbars = getToolbars(editor);
+ var result = findMatchResult(editor, toolbars);
+ if (result) {
+ panel.show(editor, result.id, result.rect, toolbars);
+ } else {
+ panel.hide();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var measureElement = function (elm) {
- var clientRect = elm.getBoundingClientRect();
-
- return toAbsolute({
- x: clientRect.left,
- y: clientRect.top,
- w: Math.max(elm.clientWidth, elm.offsetWidth),
- h: Math.max(elm.clientHeight, elm.offsetHeight)
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return function () {
+ if (!editor.removed && editorHasFocus(editor)) {
+ toggle();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var repositionPanel = function (editor, panel) {
+ return function () {
+ var toolbars = getToolbars(editor);
+ var result = findMatchResult(editor, toolbars);
+ if (result) {
+ panel.reposition(editor, result.id, result.rect);
+ }
+ };
+ };
+ var ignoreWhenFormIsVisible = function (editor, panel, f) {
+ return function () {
+ if (!editor.removed && !panel.inForm()) {
+ f();
+ }
+ };
+ };
+ var bindContextualToolbarsEvents = function (editor, panel) {
+ var throttledTogglePanel = global$3.throttle(togglePanel(editor, panel), 0);
+ var throttledTogglePanelWhenNotInForm = global$3.throttle(ignoreWhenFormIsVisible(editor, panel, togglePanel(editor, panel)), 0);
+ var reposition = repositionPanel(editor, panel);
+ editor.on('blur hide ObjectResizeStart', panel.hide);
+ editor.on('click', throttledTogglePanel);
+ editor.on('nodeChange mouseup', throttledTogglePanelWhenNotInForm);
+ editor.on('ResizeEditor keyup', throttledTogglePanel);
+ editor.on('ResizeWindow', reposition);
+ global$2.DOM.bind(global$1.container, 'scroll', reposition);
+ editor.on('remove', function () {
+ global$2.DOM.unbind(global$1.container, 'scroll', reposition);
+ panel.remove();
+ });
+ editor.shortcuts.add('Alt+F10,F10', '', panel.focus);
+ };
+ var overrideLinkShortcut = function (editor, panel) {
+ editor.shortcuts.remove('meta+k');
+ editor.shortcuts.add('meta+k', '', function () {
+ var toolbars = getToolbars(editor);
+ var result = $_8rky1516zjfuw8wdx.match(editor, [$_9xiw90174jfuw8we2.textSelection('quicklink')]);
+ if (result) {
+ panel.show(editor, result.id, result.rect, toolbars);
+ }
+ });
+ };
+ var renderInlineUI = function (editor, panel) {
+ $_5qgx51175jfuw8we4.load(editor, function () {
+ bindContextualToolbarsEvents(editor, panel);
+ overrideLinkShortcut(editor, panel);
+ });
+ return {};
+ };
+ var fail = function (message) {
+ throw new Error(message);
+ };
+ var renderUI = function (editor, panel) {
+ return editor.inline ? renderInlineUI(editor, panel) : fail('inlite theme only supports inline mode.');
+ };
+ var $_gf138c16tjfuw8wdo = { renderUI: renderUI };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getElementRect = function (editor, elm) {
- return measureElement(elm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var noop = function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ };
+ var noarg = function (f) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return f();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var compose = function (fa, fb) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return fa(fb.apply(null, arguments));
+ };
+ };
+ var constant = function (value) {
+ return function () {
+ return value;
+ };
+ };
+ var identity = function (x) {
+ return x;
+ };
+ var tripleEquals = function (a, b) {
+ return a === b;
+ };
+ var curry = function (f) {
+ var x = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ x[_i - 1] = arguments[_i];
+ }
+ var args = new Array(arguments.length - 1);
+ for (var i = 1; i < arguments.length; i++)
+ args[i - 1] = arguments[i];
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ var newArgs = new Array(arguments.length);
+ for (var j = 0; j < newArgs.length; j++)
+ newArgs[j] = arguments[j];
+ var all = args.concat(newArgs);
+ return f.apply(null, all);
+ };
+ };
+ var not = function (f) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return !f.apply(null, arguments);
+ };
+ };
+ var die = function (msg) {
+ return function () {
+ throw new Error(msg);
+ };
+ };
+ var apply = function (f) {
+ return f();
+ };
+ var call = function (f) {
+ f();
+ };
+ var never = constant(false);
+ var always = constant(true);
+ var $_d9fl1s17gjfuw8wew = {
+ noop: noop,
+ noarg: noarg,
+ compose: compose,
+ constant: constant,
+ identity: identity,
+ tripleEquals: tripleEquals,
+ curry: curry,
+ not: not,
+ die: die,
+ apply: apply,
+ call: call,
+ never: never,
+ always: always
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getPageAreaRect = function (editor) {
- return measureElement(editor.getElement().ownerDocument.body);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var never$1 = $_d9fl1s17gjfuw8wew.never;
+ var always$1 = $_d9fl1s17gjfuw8wew.always;
+ var none = function () {
+ return NONE;
+ };
+ var NONE = function () {
+ var eq = function (o) {
+ return o.isNone();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var call = function (thunk) {
+ return thunk();
+ };
+ var id = function (n) {
+ return n;
+ };
+ var noop = function () {
+ };
+ var me = {
+ fold: function (n, s) {
+ return n();
+ },
+ is: never$1,
+ isSome: never$1,
+ isNone: always$1,
+ getOr: id,
+ getOrThunk: call,
+ getOrDie: function (msg) {
+ throw new Error(msg || 'error: getOrDie called on none.');
+ },
+ or: id,
+ orThunk: call,
+ map: none,
+ ap: none,
+ each: noop,
+ bind: none,
+ flatten: none,
+ exists: never$1,
+ forall: always$1,
+ filter: none,
+ equals: eq,
+ equals_: eq,
+ toArray: function () {
+ return [];
+ },
+ toString: $_d9fl1s17gjfuw8wew.constant('none()')
+ };
+ if (Object.freeze)
+ Object.freeze(me);
+ return me;
+ }();
+ var some = function (a) {
+ var constant_a = function () {
+ return a;
+ };
+ var self = function () {
+ return me;
+ };
+ var map = function (f) {
+ return some(f(a));
+ };
+ var bind = function (f) {
+ return f(a);
+ };
+ var me = {
+ fold: function (n, s) {
+ return s(a);
+ },
+ is: function (v) {
+ return a === v;
+ },
+ isSome: always$1,
+ isNone: never$1,
+ getOr: constant_a,
+ getOrThunk: constant_a,
+ getOrDie: constant_a,
+ or: self,
+ orThunk: self,
+ map: map,
+ ap: function (optfab) {
+ return optfab.fold(none, function (fab) {
+ return some(fab(a));
+ });
+ },
+ each: function (f) {
+ f(a);
+ },
+ bind: bind,
+ flatten: constant_a,
+ exists: bind,
+ forall: bind,
+ filter: function (f) {
+ return f(a) ? me : NONE;
+ },
+ equals: function (o) {
+ return o.is(a);
+ },
+ equals_: function (o, elementEq) {
+ return o.fold(never$1, function (b) {
+ return elementEq(a, b);
+ });
+ },
+ toArray: function () {
+ return [a];
+ },
+ toString: function () {
+ return 'some(' + a + ')';
+ }
+ };
+ return me;
+ };
+ var from = function (value) {
+ return value === null || value === undefined ? NONE : some(value);
+ };
+ var Option = {
+ some: some,
+ none: none,
+ from: from
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getContentAreaRect = function (editor) {
- return measureElement(editor.getContentAreaContainer() || editor.getBody());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var typeOf = function (x) {
+ if (x === null)
+ return 'null';
+ var t = typeof x;
+ if (t === 'object' && Array.prototype.isPrototypeOf(x))
+ return 'array';
+ if (t === 'object' && String.prototype.isPrototypeOf(x))
+ return 'string';
+ return t;
+ };
+ var isType$1 = function (type) {
+ return function (value) {
+ return typeOf(value) === type;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_d02u5u17hjfuw8wey = {
+ isString: isType$1('string'),
+ isObject: isType$1('object'),
+ isArray: isType$1('array'),
+ isNull: isType$1('null'),
+ isBoolean: isType$1('boolean'),
+ isUndefined: isType$1('undefined'),
+ isFunction: isType$1('function'),
+ isNumber: isType$1('number')
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getSelectionRect = function (editor) {
- var clientRect = editor.selection.getBoundingClientRect();
- return clientRect ? toAbsolute(Convert.fromClientRect(clientRect)) : null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var rawIndexOf = function () {
+ var pIndexOf = Array.prototype.indexOf;
+ var fastIndex = function (xs, x) {
+ return pIndexOf.call(xs, x);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var slowIndex = function (xs, x) {
+ return slowIndexOf(xs, x);
+ };
+ return pIndexOf === undefined ? slowIndex : fastIndex;
+ }();
+ var indexOf = function (xs, x) {
+ var r = rawIndexOf(xs, x);
+ return r === -1 ? Option.none() : Option.some(r);
+ };
+ var contains = function (xs, x) {
+ return rawIndexOf(xs, x) > -1;
+ };
+ var exists = function (xs, pred) {
+ return findIndex(xs, pred).isSome();
+ };
+ var range = function (num, f) {
+ var r = [];
+ for (var i = 0; i < num; i++) {
+ r.push(f(i));
+ }
+ return r;
+ };
+ var chunk = function (array, size) {
+ var r = [];
+ for (var i = 0; i < array.length; i += size) {
+ var s = array.slice(i, i + size);
+ r.push(s);
+ }
+ return r;
+ };
+ var map = function (xs, f) {
+ var len = xs.length;
+ var r = new Array(len);
+ for (var i = 0; i < len; i++) {
+ var x = xs[i];
+ r[i] = f(x, i, xs);
+ }
+ return r;
+ };
+ var each = function (xs, f) {
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ f(x, i, xs);
+ }
+ };
+ var eachr = function (xs, f) {
+ for (var i = xs.length - 1; i >= 0; i--) {
+ var x = xs[i];
+ f(x, i, xs);
+ }
+ };
+ var partition = function (xs, pred) {
+ var pass = [];
+ var fail = [];
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ var arr = pred(x, i, xs) ? pass : fail;
+ arr.push(x);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- getElementRect: getElementRect,
- getPageAreaRect: getPageAreaRect,
- getContentAreaRect: getContentAreaRect,
- getSelectionRect: getSelectionRect
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ pass: pass,
+ fail: fail
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var filter = function (xs, pred) {
+ var r = [];
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ if (pred(x, i, xs)) {
+ r.push(x);
+ }
+ }
+ return r;
+ };
+ var groupBy = function (xs, f) {
+ if (xs.length === 0) {
+ return [];
+ } else {
+ var wasType = f(xs[0]);
+ var r = [];
+ var group = [];
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ var type = f(x);
+ if (type !== wasType) {
+ r.push(group);
+ group = [];
+ }
+ wasType = type;
+ group.push(x);
+ }
+ if (group.length !== 0) {
+ r.push(group);
+ }
+ return r;
+ }
+ };
+ var foldr = function (xs, f, acc) {
+ eachr(xs, function (x) {
+ acc = f(acc, x);
+ });
+ return acc;
+ };
+ var foldl = function (xs, f, acc) {
+ each(xs, function (x) {
+ acc = f(acc, x);
+ });
+ return acc;
+ };
+ var find = function (xs, pred) {
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ if (pred(x, i, xs)) {
+ return Option.some(x);
+ }
+ }
+ return Option.none();
+ };
+ var findIndex = function (xs, pred) {
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ if (pred(x, i, xs)) {
+ return Option.some(i);
+ }
+ }
+ return Option.none();
+ };
+ var slowIndexOf = function (xs, x) {
+ for (var i = 0, len = xs.length; i < len; ++i) {
+ if (xs[i] === x) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ var push = Array.prototype.push;
+ var flatten$1 = function (xs) {
+ var r = [];
+ for (var i = 0, len = xs.length; i < len; ++i) {
+ if (!Array.prototype.isPrototypeOf(xs[i]))
+ throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
+ push.apply(r, xs[i]);
+ }
+ return r;
+ };
+ var bind = function (xs, f) {
+ var output = map(xs, f);
+ return flatten$1(output);
+ };
+ var forall = function (xs, pred) {
+ for (var i = 0, len = xs.length; i < len; ++i) {
+ var x = xs[i];
+ if (pred(x, i, xs) !== true) {
+ return false;
+ }
+ }
+ return true;
+ };
+ var equal = function (a1, a2) {
+ return a1.length === a2.length && forall(a1, function (x, i) {
+ return x === a2[i];
+ });
+ };
+ var slice = Array.prototype.slice;
+ var reverse = function (xs) {
+ var r = slice.call(xs, 0);
+ r.reverse();
+ return r;
+ };
+ var difference = function (a1, a2) {
+ return filter(a1, function (x) {
+ return !contains(a2, x);
+ });
+ };
+ var mapToObject = function (xs, f) {
+ var r = {};
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ r[String(x)] = f(x, i);
+ }
+ return r;
+ };
+ var pure = function (x) {
+ return [x];
+ };
+ var sort = function (xs, comparator) {
+ var copy = slice.call(xs, 0);
+ copy.sort(comparator);
+ return copy;
+ };
+ var head = function (xs) {
+ return xs.length === 0 ? Option.none() : Option.some(xs[0]);
+ };
+ var last = function (xs) {
+ return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);
+ };
+ var from$1 = $_d02u5u17hjfuw8wey.isFunction(Array.from) ? Array.from : function (x) {
+ return slice.call(x);
+ };
+ var $_1doq1817ejfuw8wen = {
+ map: map,
+ each: each,
+ eachr: eachr,
+ partition: partition,
+ filter: filter,
+ groupBy: groupBy,
+ indexOf: indexOf,
+ foldr: foldr,
+ foldl: foldl,
+ find: find,
+ findIndex: findIndex,
+ flatten: flatten$1,
+ bind: bind,
+ forall: forall,
+ exists: exists,
+ contains: contains,
+ equal: equal,
+ reverse: reverse,
+ chunk: chunk,
+ difference: difference,
+ mapToObject: mapToObject,
+ pure: pure,
+ sort: sort,
+ range: range,
+ head: head,
+ last: last,
+ from: from$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ElementMatcher.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.core.ElementMatcher',
- [
- 'tinymce.themes.inlite.core.Matcher',
- 'tinymce.themes.inlite.core.Measure'
- ],
- function (Matcher, Measure) {
- // element :: Element, [PredicateId] -> (Editor -> Matcher.result | Null)
- var element = function (element, predicateIds) {
- return function (editor) {
- for (var i = 0; i < predicateIds.length; i++) {
- if (predicateIds[i].predicate(element)) {
- return Matcher.result(predicateIds[i].id, Measure.getElementRect(editor, element));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var count = 0;
+ var funcs = {
+ id: function () {
+ return 'mceu_' + count++;
+ },
+ create: function (name, attrs, children) {
+ var elm = document.createElement(name);
+ global$2.DOM.setAttribs(elm, attrs);
+ if (typeof children === 'string') {
+ elm.innerHTML = children;
+ } else {
+ global$4.each(children, function (child) {
+ if (child.nodeType) {
+ elm.appendChild(child);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ return elm;
+ },
+ createFragment: function (html) {
+ return global$2.DOM.createFragment(html);
+ },
+ getWindowSize: function () {
+ return global$2.DOM.getViewPort();
+ },
+ getSize: function (elm) {
+ var width, height;
+ if (elm.getBoundingClientRect) {
+ var rect = elm.getBoundingClientRect();
+ width = Math.max(rect.width || rect.right - rect.left, elm.offsetWidth);
+ height = Math.max(rect.height || rect.bottom - rect.bottom, elm.offsetHeight);
+ } else {
+ width = elm.offsetWidth;
+ height = elm.offsetHeight;
+ }
+ return {
+ width: width,
+ height: height
+ };
+ },
+ getPos: function (elm, root) {
+ return global$2.DOM.getPos(elm, root || funcs.getContainer());
+ },
+ getContainer: function () {
+ return global$1.container ? global$1.container : document.body;
+ },
+ getViewPort: function (win) {
+ return global$2.DOM.getViewPort(win);
+ },
+ get: function (id) {
+ return document.getElementById(id);
+ },
+ addClass: function (elm, cls) {
+ return global$2.DOM.addClass(elm, cls);
+ },
+ removeClass: function (elm, cls) {
+ return global$2.DOM.removeClass(elm, cls);
+ },
+ hasClass: function (elm, cls) {
+ return global$2.DOM.hasClass(elm, cls);
+ },
+ toggleClass: function (elm, cls, state) {
+ return global$2.DOM.toggleClass(elm, cls, state);
+ },
+ css: function (elm, name, value) {
+ return global$2.DOM.setStyle(elm, name, value);
+ },
+ getRuntimeStyle: function (elm, name) {
+ return global$2.DOM.getStyle(elm, name, true);
+ },
+ on: function (target, name, callback, scope) {
+ return global$2.DOM.bind(target, name, callback, scope);
+ },
+ off: function (target, name, callback) {
+ return global$2.DOM.unbind(target, name, callback);
+ },
+ fire: function (target, name, args) {
+ return global$2.DOM.fire(target, name, args);
+ },
+ innerHtml: function (elm, html) {
+ global$2.DOM.setHTML(elm, html);
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$7 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery');
+
+ var global$8 = tinymce.util.Tools.resolve('tinymce.util.Class');
+
+ var global$9 = tinymce.util.Tools.resolve('tinymce.util.EventDispatcher');
+
+ var $_b17qji17ojfuw8wg0 = {
+ parseBox: function (value) {
+ var len;
+ var radix = 10;
+ if (!value) {
+ return;
+ }
+ if (typeof value === 'number') {
+ value = value || 0;
+ return {
+ top: value,
+ left: value,
+ bottom: value,
+ right: value
+ };
+ }
+ value = value.split(' ');
+ len = value.length;
+ if (len === 1) {
+ value[1] = value[2] = value[3] = value[0];
+ } else if (len === 2) {
+ value[2] = value[0];
+ value[3] = value[1];
+ } else if (len === 3) {
+ value[3] = value[1];
+ }
+ return {
+ top: parseInt(value[0], radix) || 0,
+ right: parseInt(value[1], radix) || 0,
+ bottom: parseInt(value[2], radix) || 0,
+ left: parseInt(value[3], radix) || 0
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- // parent :: [Elements], [PredicateId] -> (Editor -> Matcher.result | Null)
- var parent = function (elements, predicateIds) {
- return function (editor) {
- for (var i = 0; i < elements.length; i++) {
- for (var x = 0; x < predicateIds.length; x++) {
- if (predicateIds[x].predicate(elements[i])) {
- return Matcher.result(predicateIds[x].id, Measure.getElementRect(editor, elements[i]));
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ measureBox: function (elm, prefix) {
+ function getStyle(name) {
+ var defaultView = elm.ownerDocument.defaultView;
+ if (defaultView) {
+ var computedStyle = defaultView.getComputedStyle(elm, null);
+ if (computedStyle) {
+ name = name.replace(/[A-Z]/g, function (a) {
+ return '-' + a;
+ });
+ return computedStyle.getPropertyValue(name);
+ } else {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return elm.currentStyle[name];
+ }
+ function getSide(name) {
+ var val = parseFloat(getStyle(name));
+ return isNaN(val) ? 0 : val;
+ }
+ return {
+ top: getSide(prefix + 'TopWidth'),
+ right: getSide(prefix + 'RightWidth'),
+ bottom: getSide(prefix + 'BottomWidth'),
+ left: getSide(prefix + 'LeftWidth')
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- element: element,
- parent: parent
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function noop$1() {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function ClassList(onchange) {
+ this.cls = [];
+ this.cls._map = {};
+ this.onchange = onchange || noop$1;
+ this.prefix = '';
+ }
+ global$4.extend(ClassList.prototype, {
+ add: function (cls) {
+ if (cls && !this.contains(cls)) {
+ this.cls._map[cls] = true;
+ this.cls.push(cls);
+ this._change();
+ }
+ return this;
+ },
+ remove: function (cls) {
+ if (this.contains(cls)) {
+ var i = void 0;
+ for (i = 0; i < this.cls.length; i++) {
+ if (this.cls[i] === cls) {
+ break;
+ }
+ }
+ this.cls.splice(i, 1);
+ delete this.cls._map[cls];
+ this._change();
+ }
+ return this;
+ },
+ toggle: function (cls, state) {
+ var curState = this.contains(cls);
+ if (curState !== state) {
+ if (curState) {
+ this.remove(cls);
+ } else {
+ this.add(cls);
+ }
+ this._change();
+ }
+ return this;
+ },
+ contains: function (cls) {
+ return !!this.cls._map[cls];
+ },
+ _change: function () {
+ delete this.clsValue;
+ this.onchange.call(this);
+ }
+ });
+ ClassList.prototype.toString = function () {
+ var value;
+ if (this.clsValue) {
+ return this.clsValue;
+ }
+ value = '';
+ for (var i = 0; i < this.cls.length; i++) {
+ if (i > 0) {
+ value += ' ';
+ }
+ value += this.prefix + this.cls[i];
+ }
+ return value;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function unique(array) {
+ var uniqueItems = [];
+ var i = array.length, item;
+ while (i--) {
+ item = array[i];
+ if (!item.__checked) {
+ uniqueItems.push(item);
+ item.__checked = 1;
+ }
+ }
+ i = uniqueItems.length;
+ while (i--) {
+ delete uniqueItems[i].__checked;
+ }
+ return uniqueItems;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var expression = /^([\w\\*]+)?(?:#([\w\-\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i;
+ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g;
+ var whiteSpace = /^\s*|\s*$/g;
+ var Collection;
+ var Selector = global$8.extend({
+ init: function (selector) {
+ var match = this.match;
+ function compileNameFilter(name) {
+ if (name) {
+ name = name.toLowerCase();
+ return function (item) {
+ return name === '*' || item.type === name;
+ };
+ }
+ }
+ function compileIdFilter(id) {
+ if (id) {
+ return function (item) {
+ return item._name === id;
+ };
+ }
+ }
+ function compileClassesFilter(classes) {
+ if (classes) {
+ classes = classes.split('.');
+ return function (item) {
+ var i = classes.length;
+ while (i--) {
+ if (!item.classes.contains(classes[i])) {
+ return false;
+ }
+ }
+ return true;
+ };
+ }
+ }
+ function compileAttrFilter(name, cmp, check) {
+ if (name) {
+ return function (item) {
+ var value = item[name] ? item[name]() : '';
+ return !cmp ? !!check : cmp === '=' ? value === check : cmp === '*=' ? value.indexOf(check) >= 0 : cmp === '~=' ? (' ' + value + ' ').indexOf(' ' + check + ' ') >= 0 : cmp === '!=' ? value !== check : cmp === '^=' ? value.indexOf(check) === 0 : cmp === '$=' ? value.substr(value.length - check.length) === check : false;
+ };
+ }
+ }
+ function compilePsuedoFilter(name) {
+ var notSelectors;
+ if (name) {
+ name = /(?:not\((.+)\))|(.+)/i.exec(name);
+ if (!name[1]) {
+ name = name[2];
+ return function (item, index, length) {
+ return name === 'first' ? index === 0 : name === 'last' ? index === length - 1 : name === 'even' ? index % 2 === 0 : name === 'odd' ? index % 2 === 1 : item[name] ? item[name]() : false;
+ };
+ }
+ notSelectors = parseChunks(name[1], []);
+ return function (item) {
+ return !match(item, notSelectors);
+ };
+ }
+ }
+ function compile(selector, filters, direct) {
+ var parts;
+ function add(filter) {
+ if (filter) {
+ filters.push(filter);
+ }
+ }
+ parts = expression.exec(selector.replace(whiteSpace, ''));
+ add(compileNameFilter(parts[1]));
+ add(compileIdFilter(parts[2]));
+ add(compileClassesFilter(parts[3]));
+ add(compileAttrFilter(parts[4], parts[5], parts[6]));
+ add(compilePsuedoFilter(parts[7]));
+ filters.pseudo = !!parts[7];
+ filters.direct = direct;
+ return filters;
+ }
+ function parseChunks(selector, selectors) {
+ var parts = [];
+ var extra, matches, i;
+ do {
+ chunker.exec('');
+ matches = chunker.exec(selector);
+ if (matches) {
+ selector = matches[3];
+ parts.push(matches[1]);
+ if (matches[2]) {
+ extra = matches[3];
+ break;
+ }
+ }
+ } while (matches);
+ if (extra) {
+ parseChunks(extra, selectors);
+ }
+ selector = [];
+ for (i = 0; i < parts.length; i++) {
+ if (parts[i] !== '>') {
+ selector.push(compile(parts[i], [], parts[i - 1] === '>'));
+ }
+ }
+ selectors.push(selector);
+ return selectors;
+ }
+ this._selectors = parseChunks(selector, []);
+ },
+ match: function (control, selectors) {
+ var i, l, si, sl, selector, fi, fl, filters, index, length, siblings, count, item;
+ selectors = selectors || this._selectors;
+ for (i = 0, l = selectors.length; i < l; i++) {
+ selector = selectors[i];
+ sl = selector.length;
+ item = control;
+ count = 0;
+ for (si = sl - 1; si >= 0; si--) {
+ filters = selector[si];
+ while (item) {
+ if (filters.pseudo) {
+ siblings = item.parent().items();
+ index = length = siblings.length;
+ while (index--) {
+ if (siblings[index] === item) {
+ break;
+ }
+ }
+ }
+ for (fi = 0, fl = filters.length; fi < fl; fi++) {
+ if (!filters[fi](item, index, length)) {
+ fi = fl + 1;
+ break;
+ }
+ }
+ if (fi === fl) {
+ count++;
+ break;
+ } else {
+ if (si === sl - 1) {
+ break;
+ }
+ }
+ item = item.parent();
+ }
+ }
+ if (count === sl) {
+ return true;
+ }
+ }
+ return false;
+ },
+ find: function (container) {
+ var matches = [], i, l;
+ var selectors = this._selectors;
+ function collect(items, selector, index) {
+ var i, l, fi, fl, item;
+ var filters = selector[index];
+ for (i = 0, l = items.length; i < l; i++) {
+ item = items[i];
+ for (fi = 0, fl = filters.length; fi < fl; fi++) {
+ if (!filters[fi](item, i, l)) {
+ fi = fl + 1;
+ break;
+ }
+ }
+ if (fi === fl) {
+ if (index === selector.length - 1) {
+ matches.push(item);
+ } else {
+ if (item.items) {
+ collect(item.items(), selector, index + 1);
+ }
+ }
+ } else if (filters.direct) {
+ return;
+ }
+ if (item.items) {
+ collect(item.items(), selector, index);
+ }
+ }
+ }
+ if (container.items) {
+ for (i = 0, l = selectors.length; i < l; i++) {
+ collect(container.items(), selectors[i], 0);
+ }
+ if (l > 1) {
+ matches = unique(matches);
+ }
+ }
+ if (!Collection) {
+ Collection = Selector.Collection;
+ }
+ return new Collection(matches);
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * PredicateId.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.core.PredicateId',
- [
- 'tinymce.core.util.Tools'
- ],
- function (Tools) {
- var create = function (id, predicate) {
- return {
- id: id,
- predicate: predicate
- };
- };
-
- // fromContextToolbars :: [ContextToolbar] -> [PredicateId]
- var fromContextToolbars = function (toolbars) {
- return Tools.map(toolbars, function (toolbar) {
- return create(toolbar.id, toolbar.predicate);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Collection$1;
+ var proto;
+ var push$1 = Array.prototype.push;
+ var slice$1 = Array.prototype.slice;
+ proto = {
+ length: 0,
+ init: function (items) {
+ if (items) {
+ this.add(items);
+ }
+ },
+ add: function (items) {
+ var self = this;
+ if (!global$4.isArray(items)) {
+ if (items instanceof Collection$1) {
+ self.add(items.toArray());
+ } else {
+ push$1.call(self, items);
+ }
+ } else {
+ push$1.apply(self, items);
+ }
+ return self;
+ },
+ set: function (items) {
+ var self = this;
+ var len = self.length;
+ var i;
+ self.length = 0;
+ self.add(items);
+ for (i = self.length; i < len; i++) {
+ delete self[i];
+ }
+ return self;
+ },
+ filter: function (selector) {
+ var self = this;
+ var i, l;
+ var matches = [];
+ var item, match;
+ if (typeof selector === 'string') {
+ selector = new Selector(selector);
+ match = function (item) {
+ return selector.match(item);
+ };
+ } else {
+ match = selector;
+ }
+ for (i = 0, l = self.length; i < l; i++) {
+ item = self[i];
+ if (match(item)) {
+ matches.push(item);
+ }
+ }
+ return new Collection$1(matches);
+ },
+ slice: function () {
+ return new Collection$1(slice$1.apply(this, arguments));
+ },
+ eq: function (index) {
+ return index === -1 ? this.slice(index) : this.slice(index, +index + 1);
+ },
+ each: function (callback) {
+ global$4.each(this, callback);
+ return this;
+ },
+ toArray: function () {
+ return global$4.toArray(this);
+ },
+ indexOf: function (ctrl) {
+ var self = this;
+ var i = self.length;
+ while (i--) {
+ if (self[i] === ctrl) {
+ break;
+ }
+ }
+ return i;
+ },
+ reverse: function () {
+ return new Collection$1(global$4.toArray(this).reverse());
+ },
+ hasClass: function (cls) {
+ return this[0] ? this[0].classes.contains(cls) : false;
+ },
+ prop: function (name, value) {
+ var self = this;
+ var item;
+ if (value !== undefined) {
+ self.each(function (item) {
+ if (item[name]) {
+ item[name](value);
+ }
+ });
+ return self;
+ }
+ item = self[0];
+ if (item && item[name]) {
+ return item[name]();
+ }
+ },
+ exec: function (name) {
+ var self = this, args = global$4.toArray(arguments).slice(1);
+ self.each(function (item) {
+ if (item[name]) {
+ item[name].apply(item, args);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
+ },
+ remove: function () {
+ var i = this.length;
+ while (i--) {
+ this[i].remove();
+ }
+ return this;
+ },
+ addClass: function (cls) {
+ return this.each(function (item) {
+ item.classes.add(cls);
+ });
+ },
+ removeClass: function (cls) {
+ return this.each(function (item) {
+ item.classes.remove(cls);
+ });
+ }
+ };
+ global$4.each('fire on off show hide append prepend before after reflow'.split(' '), function (name) {
+ proto[name] = function () {
+ var args = global$4.toArray(arguments);
+ this.each(function (ctrl) {
+ if (name in ctrl) {
+ ctrl[name].apply(ctrl, args);
+ }
+ });
+ return this;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- create: create,
- fromContextToolbars: fromContextToolbars
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ global$4.each('text name disabled active selected checked visible parent value data'.split(' '), function (name) {
+ proto[name] = function (value) {
+ return this.prop(name, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ Collection$1 = global$8.extend(proto);
+ Selector.Collection = Collection$1;
+ var Collection$2 = Collection$1;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * SelectionMatcher.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Binding = function (settings) {
+ this.create = settings.create;
+ };
+ Binding.create = function (model, name) {
+ return new Binding({
+ create: function (otherModel, otherName) {
+ var bindings;
+ var fromSelfToOther = function (e) {
+ otherModel.set(otherName, e.value);
+ };
+ var fromOtherToSelf = function (e) {
+ model.set(name, e.value);
+ };
+ otherModel.on('change:' + otherName, fromOtherToSelf);
+ model.on('change:' + name, fromSelfToOther);
+ bindings = otherModel._bindings;
+ if (!bindings) {
+ bindings = otherModel._bindings = [];
+ otherModel.on('destroy', function () {
+ var i = bindings.length;
+ while (i--) {
+ bindings[i]();
+ }
+ });
+ }
+ bindings.push(function () {
+ model.off('change:' + name, fromSelfToOther);
+ });
+ return model.get(name);
+ }
+ });
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.inlite.core.SelectionMatcher',
- [
- 'tinymce.themes.inlite.core.Matcher',
- 'tinymce.themes.inlite.core.Measure'
- ],
- function (Matcher, Measure) {
- // textSelection :: String -> (Editor -> Matcher.result | Null)
- var textSelection = function (id) {
- return function (editor) {
- if (!editor.selection.isCollapsed()) {
- return Matcher.result(id, Measure.getSelectionRect(editor));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$10 = tinymce.util.Tools.resolve('tinymce.util.Observable');
+
+ function isNode(node) {
+ return node.nodeType > 0;
+ }
+ function isEqual(a, b) {
+ var k, checked;
+ if (a === b) {
+ return true;
+ }
+ if (a === null || b === null) {
+ return a === b;
+ }
+ if (typeof a !== 'object' || typeof b !== 'object') {
+ return a === b;
+ }
+ if (global$4.isArray(b)) {
+ if (a.length !== b.length) {
+ return false;
+ }
+ k = a.length;
+ while (k--) {
+ if (!isEqual(a[k], b[k])) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ }
+ if (isNode(a) || isNode(b)) {
+ return a === b;
+ }
+ checked = {};
+ for (k in b) {
+ if (!isEqual(a[k], b[k])) {
+ return false;
+ }
+ checked[k] = true;
+ }
+ for (k in a) {
+ if (!checked[k] && !isEqual(a[k], b[k])) {
+ return false;
+ }
+ }
+ return true;
+ }
+ var ObservableObject = global$8.extend({
+ Mixins: [global$10],
+ init: function (data) {
+ var name, value;
+ data = data || {};
+ for (name in data) {
+ value = data[name];
+ if (value instanceof Binding) {
+ data[name] = value.create(this, name);
+ }
+ }
+ this.data = data;
+ },
+ set: function (name, value) {
+ var key, args;
+ var oldValue = this.data[name];
+ if (value instanceof Binding) {
+ value = value.create(this, name);
+ }
+ if (typeof name === 'object') {
+ for (key in name) {
+ this.set(key, name[key]);
+ }
+ return this;
+ }
+ if (!isEqual(oldValue, value)) {
+ this.data[name] = value;
+ args = {
+ target: this,
+ name: name,
+ value: value,
+ oldValue: oldValue
+ };
+ this.fire('change:' + name, args);
+ this.fire('change', args);
+ }
+ return this;
+ },
+ get: function (name) {
+ return this.data[name];
+ },
+ has: function (name) {
+ return name in this.data;
+ },
+ bind: function (name) {
+ return Binding.create(this, name);
+ },
+ destroy: function () {
+ this.fire('destroy');
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return null;
- };
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var dirtyCtrls = {};
+ var animationFrameRequested;
+ var $_13g7tw17vjfuw8wgk = {
+ add: function (ctrl) {
+ var parent = ctrl.parent();
+ if (parent) {
+ if (!parent._layout || parent._layout.isNative()) {
+ return;
+ }
+ if (!dirtyCtrls[parent._id]) {
+ dirtyCtrls[parent._id] = parent;
+ }
+ if (!animationFrameRequested) {
+ animationFrameRequested = true;
+ global$3.requestAnimationFrame(function () {
+ var id, ctrl;
+ animationFrameRequested = false;
+ for (id in dirtyCtrls) {
+ ctrl = dirtyCtrls[id];
+ if (ctrl.state.get('rendered')) {
+ ctrl.reflow();
+ }
+ }
+ dirtyCtrls = {};
+ }, document.body);
+ }
+ }
+ },
+ remove: function (ctrl) {
+ if (dirtyCtrls[ctrl._id]) {
+ delete dirtyCtrls[ctrl._id];
+ }
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // emptyTextBlock :: [Elements], String -> (Editor -> Matcher.result | Null)
- var emptyTextBlock = function (elements, id) {
- return function (editor) {
- var i, textBlockElementsMap = editor.schema.getTextBlockElements();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getUiContainerDelta = function (ctrl) {
+ var uiContainer = getUiContainer(ctrl);
+ if (uiContainer && global$2.DOM.getStyle(uiContainer, 'position', true) !== 'static') {
+ var containerPos = global$2.DOM.getPos(uiContainer);
+ var dx = uiContainer.scrollLeft - containerPos.x;
+ var dy = uiContainer.scrollTop - containerPos.y;
+ return Option.some({
+ x: dx,
+ y: dy
+ });
+ } else {
+ return Option.none();
+ }
+ };
+ var setUiContainer = function (editor, ctrl) {
+ var uiContainer = global$2.DOM.select(editor.settings.ui_container)[0];
+ ctrl.getRoot().uiContainer = uiContainer;
+ };
+ var getUiContainer = function (ctrl) {
+ return ctrl ? ctrl.getRoot().uiContainer : null;
+ };
+ var inheritUiContainer = function (fromCtrl, toCtrl) {
+ return toCtrl.uiContainer = getUiContainer(fromCtrl);
+ };
+ var $_dbjzo817wjfuw8wgl = {
+ getUiContainerDelta: getUiContainerDelta,
+ setUiContainer: setUiContainer,
+ getUiContainer: getUiContainer,
+ inheritUiContainer: inheritUiContainer
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- for (i = 0; i < elements.length; i++) {
- if (elements[i].nodeName === 'TABLE') {
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasMouseWheelEventSupport = 'onmousewheel' in document;
+ var hasWheelEventSupport = false;
+ var classPrefix = 'mce-';
+ var Control;
+ var idCounter = 0;
+ var proto$1 = {
+ Statics: { classPrefix: classPrefix },
+ isRtl: function () {
+ return Control.rtl;
+ },
+ classPrefix: classPrefix,
+ init: function (settings) {
+ var self = this;
+ var classes, defaultClasses;
+ function applyClasses(classes) {
+ var i;
+ classes = classes.split(' ');
+ for (i = 0; i < classes.length; i++) {
+ self.classes.add(classes[i]);
+ }
+ }
+ self.settings = settings = global$4.extend({}, self.Defaults, settings);
+ self._id = settings.id || 'mceu_' + idCounter++;
+ self._aria = { role: settings.role };
+ self._elmCache = {};
+ self.$ = global$7;
+ self.state = new ObservableObject({
+ visible: true,
+ active: false,
+ disabled: false,
+ value: ''
+ });
+ self.data = new ObservableObject(settings.data);
+ self.classes = new ClassList(function () {
+ if (self.state.get('rendered')) {
+ self.getEl().className = this.toString();
+ }
+ });
+ self.classes.prefix = self.classPrefix;
+ classes = settings.classes;
+ if (classes) {
+ if (self.Defaults) {
+ defaultClasses = self.Defaults.classes;
+ if (defaultClasses && classes !== defaultClasses) {
+ applyClasses(defaultClasses);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (i = 0; i < elements.length; i++) {
- if (elements[i].nodeName in textBlockElementsMap) {
- if (editor.dom.isEmpty(elements[i])) {
- return Matcher.result(id, Measure.getSelectionRect(editor));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ applyClasses(classes);
+ }
+ global$4.each('title text name visible disabled active value'.split(' '), function (name) {
+ if (name in settings) {
+ self[name](settings[name]);
+ }
+ });
+ self.on('click', function () {
+ if (self.disabled()) {
+ return false;
+ }
+ });
+ self.settings = settings;
+ self.borderBox = $_b17qji17ojfuw8wg0.parseBox(settings.border);
+ self.paddingBox = $_b17qji17ojfuw8wg0.parseBox(settings.padding);
+ self.marginBox = $_b17qji17ojfuw8wg0.parseBox(settings.margin);
+ if (settings.hidden) {
+ self.hide();
+ }
+ },
+ Properties: 'parent,name',
+ getContainerElm: function () {
+ var uiContainer = $_dbjzo817wjfuw8wgl.getUiContainer(this);
+ return uiContainer ? uiContainer : funcs.getContainer();
+ },
+ getParentCtrl: function (elm) {
+ var ctrl;
+ var lookup = this.getRoot().controlIdLookup;
+ while (elm && lookup) {
+ ctrl = lookup[elm.id];
+ if (ctrl) {
+ break;
+ }
+ elm = elm.parentNode;
+ }
+ return ctrl;
+ },
+ initLayoutRect: function () {
+ var self = this;
+ var settings = self.settings;
+ var borderBox, layoutRect;
+ var elm = self.getEl();
+ var width, height, minWidth, minHeight, autoResize;
+ var startMinWidth, startMinHeight, initialSize;
+ borderBox = self.borderBox = self.borderBox || $_b17qji17ojfuw8wg0.measureBox(elm, 'border');
+ self.paddingBox = self.paddingBox || $_b17qji17ojfuw8wg0.measureBox(elm, 'padding');
+ self.marginBox = self.marginBox || $_b17qji17ojfuw8wg0.measureBox(elm, 'margin');
+ initialSize = funcs.getSize(elm);
+ startMinWidth = settings.minWidth;
+ startMinHeight = settings.minHeight;
+ minWidth = startMinWidth || initialSize.width;
+ minHeight = startMinHeight || initialSize.height;
+ width = settings.width;
+ height = settings.height;
+ autoResize = settings.autoResize;
+ autoResize = typeof autoResize !== 'undefined' ? autoResize : !width && !height;
+ width = width || minWidth;
+ height = height || minHeight;
+ var deltaW = borderBox.left + borderBox.right;
+ var deltaH = borderBox.top + borderBox.bottom;
+ var maxW = settings.maxWidth || 65535;
+ var maxH = settings.maxHeight || 65535;
+ self._layoutRect = layoutRect = {
+ x: settings.x || 0,
+ y: settings.y || 0,
+ w: width,
+ h: height,
+ deltaW: deltaW,
+ deltaH: deltaH,
+ contentW: width - deltaW,
+ contentH: height - deltaH,
+ innerW: width - deltaW,
+ innerH: height - deltaH,
+ startMinWidth: startMinWidth || 0,
+ startMinHeight: startMinHeight || 0,
+ minW: Math.min(minWidth, maxW),
+ minH: Math.min(minHeight, maxH),
+ maxW: maxW,
+ maxH: maxH,
+ autoResize: autoResize,
+ scrollW: 0
+ };
+ self._lastLayoutRect = {};
+ return layoutRect;
+ },
+ layoutRect: function (newRect) {
+ var self = this;
+ var curRect = self._layoutRect, lastLayoutRect, size, deltaWidth, deltaHeight, repaintControls;
+ if (!curRect) {
+ curRect = self.initLayoutRect();
+ }
+ if (newRect) {
+ deltaWidth = curRect.deltaW;
+ deltaHeight = curRect.deltaH;
+ if (newRect.x !== undefined) {
+ curRect.x = newRect.x;
+ }
+ if (newRect.y !== undefined) {
+ curRect.y = newRect.y;
+ }
+ if (newRect.minW !== undefined) {
+ curRect.minW = newRect.minW;
+ }
+ if (newRect.minH !== undefined) {
+ curRect.minH = newRect.minH;
+ }
+ size = newRect.w;
+ if (size !== undefined) {
+ size = size < curRect.minW ? curRect.minW : size;
+ size = size > curRect.maxW ? curRect.maxW : size;
+ curRect.w = size;
+ curRect.innerW = size - deltaWidth;
+ }
+ size = newRect.h;
+ if (size !== undefined) {
+ size = size < curRect.minH ? curRect.minH : size;
+ size = size > curRect.maxH ? curRect.maxH : size;
+ curRect.h = size;
+ curRect.innerH = size - deltaHeight;
+ }
+ size = newRect.innerW;
+ if (size !== undefined) {
+ size = size < curRect.minW - deltaWidth ? curRect.minW - deltaWidth : size;
+ size = size > curRect.maxW - deltaWidth ? curRect.maxW - deltaWidth : size;
+ curRect.innerW = size;
+ curRect.w = size + deltaWidth;
+ }
+ size = newRect.innerH;
+ if (size !== undefined) {
+ size = size < curRect.minH - deltaHeight ? curRect.minH - deltaHeight : size;
+ size = size > curRect.maxH - deltaHeight ? curRect.maxH - deltaHeight : size;
+ curRect.innerH = size;
+ curRect.h = size + deltaHeight;
+ }
+ if (newRect.contentW !== undefined) {
+ curRect.contentW = newRect.contentW;
+ }
+ if (newRect.contentH !== undefined) {
+ curRect.contentH = newRect.contentH;
+ }
+ lastLayoutRect = self._lastLayoutRect;
+ if (lastLayoutRect.x !== curRect.x || lastLayoutRect.y !== curRect.y || lastLayoutRect.w !== curRect.w || lastLayoutRect.h !== curRect.h) {
+ repaintControls = Control.repaintControls;
+ if (repaintControls) {
+ if (repaintControls.map && !repaintControls.map[self._id]) {
+ repaintControls.push(self);
+ repaintControls.map[self._id] = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ lastLayoutRect.x = curRect.x;
+ lastLayoutRect.y = curRect.y;
+ lastLayoutRect.w = curRect.w;
+ lastLayoutRect.h = curRect.h;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
+ }
+ return curRect;
+ },
+ repaint: function () {
+ var self = this;
+ var style, bodyStyle, bodyElm, rect, borderBox;
+ var borderW, borderH, lastRepaintRect, round, value;
+ round = !document.createRange ? Math.round : function (value) {
+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ style = self.getEl().style;
+ rect = self._layoutRect;
+ lastRepaintRect = self._lastRepaintRect || {};
+ borderBox = self.borderBox;
+ borderW = borderBox.left + borderBox.right;
+ borderH = borderBox.top + borderBox.bottom;
+ if (rect.x !== lastRepaintRect.x) {
+ style.left = round(rect.x) + 'px';
+ lastRepaintRect.x = rect.x;
+ }
+ if (rect.y !== lastRepaintRect.y) {
+ style.top = round(rect.y) + 'px';
+ lastRepaintRect.y = rect.y;
+ }
+ if (rect.w !== lastRepaintRect.w) {
+ value = round(rect.w - borderW);
+ style.width = (value >= 0 ? value : 0) + 'px';
+ lastRepaintRect.w = rect.w;
+ }
+ if (rect.h !== lastRepaintRect.h) {
+ value = round(rect.h - borderH);
+ style.height = (value >= 0 ? value : 0) + 'px';
+ lastRepaintRect.h = rect.h;
+ }
+ if (self._hasBody && rect.innerW !== lastRepaintRect.innerW) {
+ value = round(rect.innerW);
+ bodyElm = self.getEl('body');
+ if (bodyElm) {
+ bodyStyle = bodyElm.style;
+ bodyStyle.width = (value >= 0 ? value : 0) + 'px';
+ }
+ lastRepaintRect.innerW = rect.innerW;
+ }
+ if (self._hasBody && rect.innerH !== lastRepaintRect.innerH) {
+ value = round(rect.innerH);
+ bodyElm = bodyElm || self.getEl('body');
+ if (bodyElm) {
+ bodyStyle = bodyStyle || bodyElm.style;
+ bodyStyle.height = (value >= 0 ? value : 0) + 'px';
+ }
+ lastRepaintRect.innerH = rect.innerH;
+ }
+ self._lastRepaintRect = lastRepaintRect;
+ self.fire('repaint', {}, false);
+ },
+ updateLayoutRect: function () {
+ var self = this;
+ self.parent()._lastRect = null;
+ funcs.css(self.getEl(), {
+ width: '',
+ height: ''
+ });
+ self._layoutRect = self._lastRepaintRect = self._lastLayoutRect = null;
+ self.initLayoutRect();
+ },
+ on: function (name, callback) {
+ var self = this;
+ function resolveCallbackName(name) {
+ var callback, scope;
+ if (typeof name !== 'string') {
+ return name;
+ }
+ return function (e) {
+ if (!callback) {
+ self.parentsAndSelf().each(function (ctrl) {
+ var callbacks = ctrl.settings.callbacks;
+ if (callbacks && (callback = callbacks[name])) {
+ scope = ctrl;
+ return false;
+ }
+ });
+ }
+ if (!callback) {
+ e.action = name;
+ this.fire('execute', e);
+ return;
+ }
+ return callback.call(scope, e);
+ };
+ }
+ getEventDispatcher(self).on(name, resolveCallbackName(callback));
+ return self;
+ },
+ off: function (name, callback) {
+ getEventDispatcher(this).off(name, callback);
+ return this;
+ },
+ fire: function (name, args, bubble) {
+ var self = this;
+ args = args || {};
+ if (!args.control) {
+ args.control = self;
+ }
+ args = getEventDispatcher(self).fire(name, args);
+ if (bubble !== false && self.parent) {
+ var parent_1 = self.parent();
+ while (parent_1 && !args.isPropagationStopped()) {
+ parent_1.fire(name, args, false);
+ parent_1 = parent_1.parent();
+ }
+ }
+ return args;
+ },
+ hasEventListeners: function (name) {
+ return getEventDispatcher(this).has(name);
+ },
+ parents: function (selector) {
+ var self = this;
+ var ctrl, parents = new Collection$2();
+ for (ctrl = self.parent(); ctrl; ctrl = ctrl.parent()) {
+ parents.add(ctrl);
+ }
+ if (selector) {
+ parents = parents.filter(selector);
+ }
+ return parents;
+ },
+ parentsAndSelf: function (selector) {
+ return new Collection$2(this).add(this.parents(selector));
+ },
+ next: function () {
+ var parentControls = this.parent().items();
+ return parentControls[parentControls.indexOf(this) + 1];
+ },
+ prev: function () {
+ var parentControls = this.parent().items();
+ return parentControls[parentControls.indexOf(this) - 1];
+ },
+ innerHtml: function (html) {
+ this.$el.html(html);
+ return this;
+ },
+ getEl: function (suffix) {
+ var id = suffix ? this._id + '-' + suffix : this._id;
+ if (!this._elmCache[id]) {
+ this._elmCache[id] = global$7('#' + id)[0];
+ }
+ return this._elmCache[id];
+ },
+ show: function () {
+ return this.visible(true);
+ },
+ hide: function () {
+ return this.visible(false);
+ },
+ focus: function () {
+ try {
+ this.getEl().focus();
+ } catch (ex) {
+ }
+ return this;
+ },
+ blur: function () {
+ this.getEl().blur();
+ return this;
+ },
+ aria: function (name, value) {
+ var self = this, elm = self.getEl(self.ariaTarget);
+ if (typeof value === 'undefined') {
+ return self._aria[name];
+ }
+ self._aria[name] = value;
+ if (self.state.get('rendered')) {
+ elm.setAttribute(name === 'role' ? name : 'aria-' + name, value);
+ }
+ return self;
+ },
+ encode: function (text, translate) {
+ if (translate !== false) {
+ text = this.translate(text);
+ }
+ return (text || '').replace(/[&<>"]/g, function (match) {
+ return '&#' + match.charCodeAt(0) + ';';
+ });
+ },
+ translate: function (text) {
+ return Control.translate ? Control.translate(text) : text;
+ },
+ before: function (items) {
+ var self = this, parent = self.parent();
+ if (parent) {
+ parent.insert(items, parent.items().indexOf(self), true);
+ }
+ return self;
+ },
+ after: function (items) {
+ var self = this, parent = self.parent();
+ if (parent) {
+ parent.insert(items, parent.items().indexOf(self));
+ }
+ return self;
+ },
+ remove: function () {
+ var self = this;
+ var elm = self.getEl();
+ var parent = self.parent();
+ var newItems, i;
+ if (self.items) {
+ var controls = self.items().toArray();
+ i = controls.length;
+ while (i--) {
+ controls[i].remove();
+ }
+ }
+ if (parent && parent.items) {
+ newItems = [];
+ parent.items().each(function (item) {
+ if (item !== self) {
+ newItems.push(item);
+ }
+ });
+ parent.items().set(newItems);
+ parent._lastRect = null;
+ }
+ if (self._eventsRoot && self._eventsRoot === self) {
+ global$7(elm).off();
+ }
+ var lookup = self.getRoot().controlIdLookup;
+ if (lookup) {
+ delete lookup[self._id];
+ }
+ if (elm && elm.parentNode) {
+ elm.parentNode.removeChild(elm);
+ }
+ self.state.set('rendered', false);
+ self.state.destroy();
+ self.fire('remove');
+ return self;
+ },
+ renderBefore: function (elm) {
+ global$7(elm).before(this.renderHtml());
+ this.postRender();
+ return this;
+ },
+ renderTo: function (elm) {
+ global$7(elm || this.getContainerElm()).append(this.renderHtml());
+ this.postRender();
+ return this;
+ },
+ preRender: function () {
+ },
+ render: function () {
+ },
+ renderHtml: function () {
+ return '<div id="' + this._id + '" class="' + this.classes + '"></div>';
+ },
+ postRender: function () {
+ var self = this;
+ var settings = self.settings;
+ var elm, box, parent, name, parentEventsRoot;
+ self.$el = global$7(self.getEl());
+ self.state.set('rendered', true);
+ for (name in settings) {
+ if (name.indexOf('on') === 0) {
+ self.on(name.substr(2), settings[name]);
+ }
+ }
+ if (self._eventsRoot) {
+ for (parent = self.parent(); !parentEventsRoot && parent; parent = parent.parent()) {
+ parentEventsRoot = parent._eventsRoot;
+ }
+ if (parentEventsRoot) {
+ for (name in parentEventsRoot._nativeEvents) {
+ self._nativeEvents[name] = true;
+ }
+ }
+ }
+ bindPendingEvents(self);
+ if (settings.style) {
+ elm = self.getEl();
+ if (elm) {
+ elm.setAttribute('style', settings.style);
+ elm.style.cssText = settings.style;
+ }
+ }
+ if (self.settings.border) {
+ box = self.borderBox;
+ self.$el.css({
+ 'border-top-width': box.top,
+ 'border-right-width': box.right,
+ 'border-bottom-width': box.bottom,
+ 'border-left-width': box.left
+ });
+ }
+ var root = self.getRoot();
+ if (!root.controlIdLookup) {
+ root.controlIdLookup = {};
+ }
+ root.controlIdLookup[self._id] = self;
+ for (var key in self._aria) {
+ self.aria(key, self._aria[key]);
+ }
+ if (self.state.get('visible') === false) {
+ self.getEl().style.display = 'none';
+ }
+ self.bindStates();
+ self.state.on('change:visible', function (e) {
+ var state = e.value;
+ var parentCtrl;
+ if (self.state.get('rendered')) {
+ self.getEl().style.display = state === false ? 'none' : '';
+ self.getEl().getBoundingClientRect();
+ }
+ parentCtrl = self.parent();
+ if (parentCtrl) {
+ parentCtrl._lastRect = null;
+ }
+ self.fire(state ? 'show' : 'hide');
+ $_13g7tw17vjfuw8wgk.add(self);
+ });
+ self.fire('postrender', {}, false);
+ },
+ bindStates: function () {
+ },
+ scrollIntoView: function (align) {
+ function getOffset(elm, rootElm) {
+ var x, y, parent = elm;
+ x = y = 0;
+ while (parent && parent !== rootElm && parent.nodeType) {
+ x += parent.offsetLeft || 0;
+ y += parent.offsetTop || 0;
+ parent = parent.offsetParent;
+ }
+ return {
+ x: x,
+ y: y
+ };
+ }
+ var elm = this.getEl(), parentElm = elm.parentNode;
+ var x, y, width, height, parentWidth, parentHeight;
+ var pos = getOffset(elm, parentElm);
+ x = pos.x;
+ y = pos.y;
+ width = elm.offsetWidth;
+ height = elm.offsetHeight;
+ parentWidth = parentElm.clientWidth;
+ parentHeight = parentElm.clientHeight;
+ if (align === 'end') {
+ x -= parentWidth - width;
+ y -= parentHeight - height;
+ } else if (align === 'center') {
+ x -= parentWidth / 2 - width / 2;
+ y -= parentHeight / 2 - height / 2;
+ }
+ parentElm.scrollLeft = x;
+ parentElm.scrollTop = y;
+ return this;
+ },
+ getRoot: function () {
+ var ctrl = this, rootControl;
+ var parents = [];
+ while (ctrl) {
+ if (ctrl.rootControl) {
+ rootControl = ctrl.rootControl;
+ break;
+ }
+ parents.push(ctrl);
+ rootControl = ctrl;
+ ctrl = ctrl.parent();
+ }
+ if (!rootControl) {
+ rootControl = this;
+ }
+ var i = parents.length;
+ while (i--) {
+ parents[i].rootControl = rootControl;
+ }
+ return rootControl;
+ },
+ reflow: function () {
+ $_13g7tw17vjfuw8wgk.remove(this);
+ var parent = this.parent();
+ if (parent && parent._layout && !parent._layout.isNative()) {
+ parent.reflow();
+ }
+ return this;
+ }
+ };
+ global$4.each('text title visible disabled active value'.split(' '), function (name) {
+ proto$1[name] = function (value) {
+ if (arguments.length === 0) {
+ return this.state.get(name);
+ }
+ if (typeof value !== 'undefined') {
+ this.state.set(name, value);
+ }
+ return this;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ Control = global$8.extend(proto$1);
+ function getEventDispatcher(obj) {
+ if (!obj._eventDispatcher) {
+ obj._eventDispatcher = new global$9({
+ scope: obj,
+ toggleEvent: function (name, state) {
+ if (state && global$9.isNative(name)) {
+ if (!obj._nativeEvents) {
+ obj._nativeEvents = {};
+ }
+ obj._nativeEvents[name] = true;
+ if (obj.state.get('rendered')) {
+ bindPendingEvents(obj);
+ }
+ }
+ }
+ });
+ }
+ return obj._eventDispatcher;
+ }
+ function bindPendingEvents(eventCtrl) {
+ var i, l, parents, eventRootCtrl, nativeEvents, name;
+ function delegate(e) {
+ var control = eventCtrl.getParentCtrl(e.target);
+ if (control) {
+ control.fire(e.type, e);
+ }
+ }
+ function mouseLeaveHandler() {
+ var ctrl = eventRootCtrl._lastHoverCtrl;
+ if (ctrl) {
+ ctrl.fire('mouseleave', { target: ctrl.getEl() });
+ ctrl.parents().each(function (ctrl) {
+ ctrl.fire('mouseleave', { target: ctrl.getEl() });
+ });
+ eventRootCtrl._lastHoverCtrl = null;
+ }
+ }
+ function mouseEnterHandler(e) {
+ var ctrl = eventCtrl.getParentCtrl(e.target), lastCtrl = eventRootCtrl._lastHoverCtrl, idx = 0, i, parents, lastParents;
+ if (ctrl !== lastCtrl) {
+ eventRootCtrl._lastHoverCtrl = ctrl;
+ parents = ctrl.parents().toArray().reverse();
+ parents.push(ctrl);
+ if (lastCtrl) {
+ lastParents = lastCtrl.parents().toArray().reverse();
+ lastParents.push(lastCtrl);
+ for (idx = 0; idx < lastParents.length; idx++) {
+ if (parents[idx] !== lastParents[idx]) {
+ break;
+ }
+ }
+ for (i = lastParents.length - 1; i >= idx; i--) {
+ lastCtrl = lastParents[i];
+ lastCtrl.fire('mouseleave', { target: lastCtrl.getEl() });
+ }
+ }
+ for (i = idx; i < parents.length; i++) {
+ ctrl = parents[i];
+ ctrl.fire('mouseenter', { target: ctrl.getEl() });
+ }
+ }
+ }
+ function fixWheelEvent(e) {
+ e.preventDefault();
+ if (e.type === 'mousewheel') {
+ e.deltaY = -1 / 40 * e.wheelDelta;
+ if (e.wheelDeltaX) {
+ e.deltaX = -1 / 40 * e.wheelDeltaX;
+ }
+ } else {
+ e.deltaX = 0;
+ e.deltaY = e.detail;
+ }
+ e = eventCtrl.fire('wheel', e);
+ }
+ nativeEvents = eventCtrl._nativeEvents;
+ if (nativeEvents) {
+ parents = eventCtrl.parents().toArray();
+ parents.unshift(eventCtrl);
+ for (i = 0, l = parents.length; !eventRootCtrl && i < l; i++) {
+ eventRootCtrl = parents[i]._eventsRoot;
+ }
+ if (!eventRootCtrl) {
+ eventRootCtrl = parents[parents.length - 1] || eventCtrl;
+ }
+ eventCtrl._eventsRoot = eventRootCtrl;
+ for (l = i, i = 0; i < l; i++) {
+ parents[i]._eventsRoot = eventRootCtrl;
+ }
+ var eventRootDelegates = eventRootCtrl._delegates;
+ if (!eventRootDelegates) {
+ eventRootDelegates = eventRootCtrl._delegates = {};
+ }
+ for (name in nativeEvents) {
+ if (!nativeEvents) {
+ return false;
+ }
+ if (name === 'wheel' && !hasWheelEventSupport) {
+ if (hasMouseWheelEventSupport) {
+ global$7(eventCtrl.getEl()).on('mousewheel', fixWheelEvent);
+ } else {
+ global$7(eventCtrl.getEl()).on('DOMMouseScroll', fixWheelEvent);
+ }
+ continue;
+ }
+ if (name === 'mouseenter' || name === 'mouseleave') {
+ if (!eventRootCtrl._hasMouseEnter) {
+ global$7(eventRootCtrl.getEl()).on('mouseleave', mouseLeaveHandler).on('mouseover', mouseEnterHandler);
+ eventRootCtrl._hasMouseEnter = 1;
+ }
+ } else if (!eventRootDelegates[name]) {
+ global$7(eventRootCtrl.getEl()).on(name, delegate);
+ eventRootDelegates[name] = true;
+ }
+ nativeEvents[name] = false;
+ }
+ }
+ }
+ var Control$1 = Control;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isStatic = function (elm) {
+ return funcs.getRuntimeStyle(elm, 'position') === 'static';
+ };
+ var isFixed = function (ctrl) {
+ return ctrl.state.get('fixed');
+ };
+ function calculateRelativePosition(ctrl, targetElm, rel) {
+ var ctrlElm, pos, x, y, selfW, selfH, targetW, targetH, viewport, size;
+ viewport = getWindowViewPort();
+ pos = funcs.getPos(targetElm, $_dbjzo817wjfuw8wgl.getUiContainer(ctrl));
+ x = pos.x;
+ y = pos.y;
+ if (isFixed(ctrl) && isStatic(document.body)) {
+ x -= viewport.x;
+ y -= viewport.y;
+ }
+ ctrlElm = ctrl.getEl();
+ size = funcs.getSize(ctrlElm);
+ selfW = size.width;
+ selfH = size.height;
+ size = funcs.getSize(targetElm);
+ targetW = size.width;
+ targetH = size.height;
+ rel = (rel || '').split('');
+ if (rel[0] === 'b') {
+ y += targetH;
+ }
+ if (rel[1] === 'r') {
+ x += targetW;
+ }
+ if (rel[0] === 'c') {
+ y += Math.round(targetH / 2);
+ }
+ if (rel[1] === 'c') {
+ x += Math.round(targetW / 2);
+ }
+ if (rel[3] === 'b') {
+ y -= selfH;
+ }
+ if (rel[4] === 'r') {
+ x -= selfW;
+ }
+ if (rel[3] === 'c') {
+ y -= Math.round(selfH / 2);
+ }
+ if (rel[4] === 'c') {
+ x -= Math.round(selfW / 2);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- textSelection: textSelection,
- emptyTextBlock: emptyTextBlock
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ x: x,
+ y: y,
+ w: selfW,
+ h: selfH
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getUiContainerViewPort = function (customUiContainer) {
+ return {
+ x: 0,
+ y: 0,
+ w: customUiContainer.scrollWidth - 1,
+ h: customUiContainer.scrollHeight - 1
+ };
+ };
+ var getWindowViewPort = function () {
+ var win = window;
+ var x = Math.max(win.pageXOffset, document.body.scrollLeft, document.documentElement.scrollLeft);
+ var y = Math.max(win.pageYOffset, document.body.scrollTop, document.documentElement.scrollTop);
+ var w = win.innerWidth || document.documentElement.clientWidth;
+ var h = win.innerHeight || document.documentElement.clientHeight;
+ return {
+ x: x,
+ y: y,
+ w: x + w,
+ h: y + h
+ };
+ };
+ var getViewPortRect = function (ctrl) {
+ var customUiContainer = $_dbjzo817wjfuw8wgl.getUiContainer(ctrl);
+ return customUiContainer && !isFixed(ctrl) ? getUiContainerViewPort(customUiContainer) : getWindowViewPort();
+ };
+ var $_cn53y617xjfuw8wgp = {
+ testMoveRel: function (elm, rels) {
+ var viewPortRect = getViewPortRect(this);
+ for (var i = 0; i < rels.length; i++) {
+ var pos = calculateRelativePosition(this, elm, rels[i]);
+ if (isFixed(this)) {
+ if (pos.x > 0 && pos.x + pos.w < viewPortRect.w && pos.y > 0 && pos.y + pos.h < viewPortRect.h) {
+ return rels[i];
+ }
+ } else {
+ if (pos.x > viewPortRect.x && pos.x + pos.w < viewPortRect.w && pos.y > viewPortRect.y && pos.y + pos.h < viewPortRect.h) {
+ return rels[i];
+ }
+ }
+ }
+ return rels[0];
+ },
+ moveRel: function (elm, rel) {
+ if (typeof rel !== 'string') {
+ rel = this.testMoveRel(elm, rel);
+ }
+ var pos = calculateRelativePosition(this, elm, rel);
+ return this.moveTo(pos.x, pos.y);
+ },
+ moveBy: function (dx, dy) {
+ var self = this, rect = self.layoutRect();
+ self.moveTo(rect.x + dx, rect.y + dy);
+ return self;
+ },
+ moveTo: function (x, y) {
+ var self = this;
+ function constrain(value, max, size) {
+ if (value < 0) {
+ return 0;
+ }
+ if (value + size > max) {
+ value = max - size;
+ return value < 0 ? 0 : value;
+ }
+ return value;
+ }
+ if (self.settings.constrainToViewport) {
+ var viewPortRect = getViewPortRect(this);
+ var layoutRect = self.layoutRect();
+ x = constrain(x, viewPortRect.w, layoutRect.w);
+ y = constrain(y, viewPortRect.h, layoutRect.h);
+ }
+ var uiContainer = $_dbjzo817wjfuw8wgl.getUiContainer(self);
+ if (uiContainer && isStatic(uiContainer) && !isFixed(self)) {
+ x -= uiContainer.scrollLeft;
+ y -= uiContainer.scrollTop;
+ }
+ if (uiContainer) {
+ x += 1;
+ y += 1;
+ }
+ if (self.state.get('rendered')) {
+ self.layoutRect({
+ x: x,
+ y: y
+ }).repaint();
+ } else {
+ self.settings.x = x;
+ self.settings.y = y;
+ }
+ self.fire('move', {
+ x: x,
+ y: y
+ });
+ return self;
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Tooltip = Control$1.extend({
+ Mixins: [$_cn53y617xjfuw8wgp],
+ Defaults: { classes: 'widget tooltip tooltip-n' },
+ renderHtml: function () {
+ var self = this, prefix = self.classPrefix;
+ return '<div id="' + self._id + '" class="' + self.classes + '" role="presentation">' + '<div class="' + prefix + 'tooltip-arrow"></div>' + '<div class="' + prefix + 'tooltip-inner">' + self.encode(self.state.get('text')) + '</div>' + '</div>';
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:text', function (e) {
+ self.getEl().lastChild.innerHTML = self.encode(e.value);
+ });
+ return self._super();
+ },
+ repaint: function () {
+ var self = this;
+ var style, rect;
+ style = self.getEl().style;
+ rect = self._layoutRect;
+ style.left = rect.x + 'px';
+ style.top = rect.y + 'px';
+ style.zIndex = 65535 + 65535;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.EditorManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.EditorManager');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Widget = Control$1.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ settings = self.settings;
+ self.canFocus = true;
+ if (settings.tooltip && Widget.tooltips !== false) {
+ self.on('mouseenter', function (e) {
+ var tooltip = self.tooltip().moveTo(-65535);
+ if (e.control === self) {
+ var rel = tooltip.text(settings.tooltip).show().testMoveRel(self.getEl(), [
+ 'bc-tc',
+ 'bc-tl',
+ 'bc-tr'
+ ]);
+ tooltip.classes.toggle('tooltip-n', rel === 'bc-tc');
+ tooltip.classes.toggle('tooltip-nw', rel === 'bc-tl');
+ tooltip.classes.toggle('tooltip-ne', rel === 'bc-tr');
+ tooltip.moveRel(self.getEl(), rel);
+ } else {
+ tooltip.hide();
+ }
+ });
+ self.on('mouseleave mousedown click', function () {
+ self.tooltip().remove();
+ self._tooltip = null;
+ });
+ }
+ self.aria('label', settings.ariaLabel || settings.tooltip);
+ },
+ tooltip: function () {
+ if (!this._tooltip) {
+ this._tooltip = new Tooltip({ type: 'tooltip' });
+ $_dbjzo817wjfuw8wgl.inheritUiContainer(this, this._tooltip);
+ this._tooltip.renderTo();
+ }
+ return this._tooltip;
+ },
+ postRender: function () {
+ var self = this, settings = self.settings;
+ self._super();
+ if (!self.parent() && (settings.width || settings.height)) {
+ self.initLayoutRect();
+ self.repaint();
+ }
+ if (settings.autofocus) {
+ self.focus();
+ }
+ },
+ bindStates: function () {
+ var self = this;
+ function disable(state) {
+ self.aria('disabled', state);
+ self.classes.toggle('disabled', state);
+ }
+ function active(state) {
+ self.aria('pressed', state);
+ self.classes.toggle('active', state);
+ }
+ self.state.on('change:disabled', function (e) {
+ disable(e.value);
+ });
+ self.state.on('change:active', function (e) {
+ active(e.value);
+ });
+ if (self.state.get('disabled')) {
+ disable(true);
+ }
+ if (self.state.get('active')) {
+ active(true);
+ }
+ return self._super();
+ },
+ remove: function () {
+ this._super();
+ if (this._tooltip) {
+ this._tooltip.remove();
+ this._tooltip = null;
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * SkinLoader.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Progress = Widget.extend({
+ Defaults: { value: 0 },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.classes.add('progress');
+ if (!self.settings.filter) {
+ self.settings.filter = function (value) {
+ return Math.round(value);
+ };
+ }
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = this.classPrefix;
+ return '<div id="' + id + '" class="' + self.classes + '">' + '<div class="' + prefix + 'bar-container">' + '<div class="' + prefix + 'bar"></div>' + '</div>' + '<div class="' + prefix + 'text">0%</div>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ self._super();
+ self.value(self.settings.value);
+ return self;
+ },
+ bindStates: function () {
+ var self = this;
+ function setValue(value) {
+ value = self.settings.filter(value);
+ self.getEl().lastChild.innerHTML = value + '%';
+ self.getEl().firstChild.firstChild.style.width = value + '%';
+ }
+ self.state.on('change:value', function (e) {
+ setValue(e.value);
+ });
+ setValue(self.state.get('value'));
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.inlite.core.SkinLoader',
- [
- 'tinymce.core.EditorManager',
- 'tinymce.core.dom.DOMUtils'
- ],
- function (EditorManager, DOMUtils) {
- var fireSkinLoaded = function (editor, callback) {
- var done = function () {
- editor._skinLoaded = true;
- editor.fire('SkinLoaded');
- callback();
- };
-
- if (editor.initialized) {
- done();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var updateLiveRegion = function (ctx, text) {
+ ctx.getEl().lastChild.textContent = text + (ctx.progressBar ? ' ' + ctx.progressBar.value() + '%' : '');
+ };
+ var Notification = Control$1.extend({
+ Mixins: [$_cn53y617xjfuw8wgp],
+ Defaults: { classes: 'widget notification' },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.maxWidth = settings.maxWidth;
+ if (settings.text) {
+ self.text(settings.text);
+ }
+ if (settings.icon) {
+ self.icon = settings.icon;
+ }
+ if (settings.color) {
+ self.color = settings.color;
+ }
+ if (settings.type) {
+ self.classes.add('notification-' + settings.type);
+ }
+ if (settings.timeout && (settings.timeout < 0 || settings.timeout > 0) && !settings.closeButton) {
+ self.closeButton = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('init', done);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.classes.add('has-close');
+ self.closeButton = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (settings.progressBar) {
+ self.progressBar = new Progress();
+ }
+ self.on('click', function (e) {
+ if (e.target.className.indexOf(self.classPrefix + 'close') !== -1) {
+ self.close();
+ }
+ });
+ },
+ renderHtml: function () {
+ var self = this;
+ var prefix = self.classPrefix;
+ var icon = '', closeButton = '', progressBar = '', notificationStyle = '';
+ if (self.icon) {
+ icon = '<i class="' + prefix + 'ico' + ' ' + prefix + 'i-' + self.icon + '"></i>';
+ }
+ notificationStyle = ' style="max-width: ' + self.maxWidth + 'px;' + (self.color ? 'background-color: ' + self.color + ';"' : '"');
+ if (self.closeButton) {
+ closeButton = '<button type="button" class="' + prefix + 'close" aria-hidden="true">\xD7</button>';
+ }
+ if (self.progressBar) {
+ progressBar = self.progressBar.renderHtml();
+ }
+ return '<div id="' + self._id + '" class="' + self.classes + '"' + notificationStyle + ' role="presentation">' + icon + '<div class="' + prefix + 'notification-inner">' + self.state.get('text') + '</div>' + progressBar + closeButton + '<div style="clip: rect(1px, 1px, 1px, 1px);height: 1px;overflow: hidden;position: absolute;width: 1px;"' + ' aria-live="assertive" aria-relevant="additions" aria-atomic="true"></div>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ global$3.setTimeout(function () {
+ self.$el.addClass(self.classPrefix + 'in');
+ updateLiveRegion(self, self.state.get('text'));
+ }, 100);
+ return self._super();
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:text', function (e) {
+ self.getEl().firstChild.innerHTML = e.value;
+ updateLiveRegion(self, e.value);
+ });
+ if (self.progressBar) {
+ self.progressBar.bindStates();
+ self.progressBar.state.on('change:value', function (e) {
+ updateLiveRegion(self, self.state.get('text'));
+ });
+ }
+ return self._super();
+ },
+ close: function () {
+ var self = this;
+ if (!self.fire('close').isDefaultPrevented()) {
+ self.remove();
+ }
+ return self;
+ },
+ repaint: function () {
+ var self = this;
+ var style, rect;
+ style = self.getEl().style;
+ rect = self._layoutRect;
+ style.left = rect.x + 'px';
+ style.top = rect.y + 'px';
+ style.zIndex = 65535 - 1;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var urlFromName = function (name) {
- var prefix = EditorManager.baseURL + '/skins/';
- return name ? prefix + name : prefix + 'lightgray';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function NotificationManagerImpl (editor) {
+ var getEditorContainer = function (editor) {
+ return editor.inline ? editor.getElement() : editor.getContentAreaContainer();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var toAbsoluteUrl = function (editor, url) {
- return editor.documentBaseURI.toAbsolute(url);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getContainerWidth = function () {
+ var container = getEditorContainer(editor);
+ return funcs.getSize(container).width;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var load = function (editor, callback) {
- var settings = editor.settings;
- var skinUrl = settings.skin_url ? toAbsoluteUrl(editor, settings.skin_url) : urlFromName(settings.skin);
-
- var done = function () {
- fireSkinLoaded(editor, callback);
- };
-
- DOMUtils.DOM.styleSheetLoader.load(skinUrl + '/skin.min.css', done);
- editor.contentCSS.push(skinUrl + '/content.inline.min.css');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var prePositionNotifications = function (notifications) {
+ $_1doq1817ejfuw8wen.each(notifications, function (notification) {
+ notification.moveTo(0, 0);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var positionNotifications = function (notifications) {
+ if (notifications.length > 0) {
+ var firstItem = notifications.slice(0, 1)[0];
+ var container = getEditorContainer(editor);
+ firstItem.moveRel(container, 'tc-tc');
+ $_1doq1817ejfuw8wen.each(notifications, function (notification, index) {
+ if (index > 0) {
+ notification.moveRel(notifications[index - 1].getEl(), 'bc-tc');
+ }
+ });
+ }
+ };
+ var reposition = function (notifications) {
+ prePositionNotifications(notifications);
+ positionNotifications(notifications);
+ };
+ var open = function (args, closeCallback) {
+ var extendedArgs = global$4.extend(args, { maxWidth: getContainerWidth() });
+ var notif = new Notification(extendedArgs);
+ notif.args = extendedArgs;
+ if (extendedArgs.timeout > 0) {
+ notif.timer = setTimeout(function () {
+ notif.close();
+ closeCallback();
+ }, extendedArgs.timeout);
+ }
+ notif.on('close', function () {
+ closeCallback();
+ });
+ notif.renderTo();
+ return notif;
+ };
+ var close = function (notification) {
+ notification.close();
+ };
+ var getArgs = function (notification) {
+ return notification.args;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- load: load
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ open: open,
+ close: close,
+ reposition: reposition,
+ getArgs: getArgs
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ui.Factory',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.ui.Factory');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function getDocumentSize(doc) {
+ var documentElement, body, scrollWidth, clientWidth;
+ var offsetWidth, scrollHeight, clientHeight, offsetHeight;
+ var max = Math.max;
+ documentElement = doc.documentElement;
+ body = doc.body;
+ scrollWidth = max(documentElement.scrollWidth, body.scrollWidth);
+ clientWidth = max(documentElement.clientWidth, body.clientWidth);
+ offsetWidth = max(documentElement.offsetWidth, body.offsetWidth);
+ scrollHeight = max(documentElement.scrollHeight, body.scrollHeight);
+ clientHeight = max(documentElement.clientHeight, body.clientHeight);
+ offsetHeight = max(documentElement.offsetHeight, body.offsetHeight);
+ return {
+ width: scrollWidth < offsetWidth ? clientWidth : scrollWidth,
+ height: scrollHeight < offsetHeight ? clientHeight : scrollHeight
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-
-/**
- * Toolbar.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.ui.Toolbar',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.ui.Factory',
- 'tinymce.themes.inlite.alien.Type'
- ],
- function (Tools, Factory, Type) {
- var getSelectorStateResult = function (itemName, item) {
- var result = function (selector, handler) {
- return {
- selector: selector,
- handler: handler
- };
- };
-
- var activeHandler = function (state) {
- item.active(state);
- };
-
- var disabledHandler = function (state) {
- item.disabled(state);
- };
-
- if (item.settings.stateSelector) {
- return result(item.settings.stateSelector, activeHandler);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function updateWithTouchData(e) {
+ var keys, i;
+ if (e.changedTouches) {
+ keys = 'screenX screenY pageX pageY clientX clientY'.split(' ');
+ for (i = 0; i < keys.length; i++) {
+ e[keys[i]] = e.changedTouches[0][keys[i]];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (item.settings.disabledStateSelector) {
- return result(item.settings.disabledStateSelector, disabledHandler);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ }
+ function DragHelper (id, settings) {
+ var $eventOverlay;
+ var doc = settings.document || document;
+ var downButton;
+ var start, stop, drag, startX, startY;
+ settings = settings || {};
+ var handleElement = doc.getElementById(settings.handle || id);
+ start = function (e) {
+ var docSize = getDocumentSize(doc);
+ var handleElm, cursor;
+ updateWithTouchData(e);
+ e.preventDefault();
+ downButton = e.button;
+ handleElm = handleElement;
+ startX = e.screenX;
+ startY = e.screenY;
+ if (window.getComputedStyle) {
+ cursor = window.getComputedStyle(handleElm, null).getPropertyValue('cursor');
+ } else {
+ cursor = handleElm.runtimeStyle.cursor;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $eventOverlay = global$7('<div></div>').css({
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ width: docSize.width,
+ height: docSize.height,
+ zIndex: 2147483647,
+ opacity: 0.0001,
+ cursor: cursor
+ }).appendTo(doc.body);
+ global$7(doc).on('mousemove touchmove', drag).on('mouseup touchend', stop);
+ settings.start(e);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var bindSelectorChanged = function (editor, itemName, item) {
- return function () {
- var result = getSelectorStateResult(itemName, item);
- if (result !== null) {
- editor.selection.selectorChanged(result.selector, result.handler);
- }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ drag = function (e) {
+ updateWithTouchData(e);
+ if (e.button !== downButton) {
+ return stop(e);
+ }
+ e.deltaX = e.screenX - startX;
+ e.deltaY = e.screenY - startY;
+ e.preventDefault();
+ settings.drag(e);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var itemsToArray = function (items) {
- if (Type.isArray(items)) {
- return items;
- } else if (Type.isString(items)) {
- return items.split(/[ ,]/);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ stop = function (e) {
+ updateWithTouchData(e);
+ global$7(doc).off('mousemove touchmove', drag).off('mouseup touchend', stop);
+ $eventOverlay.remove();
+ if (settings.stop) {
+ settings.stop(e);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return [];
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.destroy = function () {
+ global$7(handleElement).off();
+ };
+ global$7(handleElement).on('mousedown touchstart', start);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var create = function (editor, name, items) {
- var toolbarItems = [], buttonGroup;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$11 = tinymce.util.Tools.resolve('tinymce.ui.Factory');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (!items) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasTabstopData = function (elm) {
+ return elm.getAttribute('data-mce-tabstop') ? true : false;
+ };
+ function KeyboardNavigation (settings) {
+ var root = settings.root;
+ var focusedElement, focusedControl;
+ function isElement(node) {
+ return node && node.nodeType === 1;
+ }
+ try {
+ focusedElement = document.activeElement;
+ } catch (ex) {
+ focusedElement = document.body;
+ }
+ focusedControl = root.getParentCtrl(focusedElement);
+ function getRole(elm) {
+ elm = elm || focusedElement;
+ if (isElement(elm)) {
+ return elm.getAttribute('role');
+ }
+ return null;
+ }
+ function getParentRole(elm) {
+ var role, parent = elm || focusedElement;
+ while (parent = parent.parentNode) {
+ if (role = getRole(parent)) {
+ return role;
+ }
+ }
+ }
+ function getAriaProp(name) {
+ var elm = focusedElement;
+ if (isElement(elm)) {
+ return elm.getAttribute('aria-' + name);
+ }
+ }
+ function isTextInputElement(elm) {
+ var tagName = elm.tagName.toUpperCase();
+ return tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT';
+ }
+ function canFocus(elm) {
+ if (isTextInputElement(elm) && !elm.hidden) {
+ return true;
+ }
+ if (hasTabstopData(elm)) {
+ return true;
+ }
+ if (/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell|slider)$/.test(getRole(elm))) {
+ return true;
+ }
+ return false;
+ }
+ function getFocusElements(elm) {
+ var elements = [];
+ function collect(elm) {
+ if (elm.nodeType !== 1 || elm.style.display === 'none' || elm.disabled) {
+ return;
+ }
+ if (canFocus(elm)) {
+ elements.push(elm);
+ }
+ for (var i = 0; i < elm.childNodes.length; i++) {
+ collect(elm.childNodes[i]);
+ }
+ }
+ collect(elm || root.getEl());
+ return elements;
+ }
+ function getNavigationRoot(targetControl) {
+ var navigationRoot, controls;
+ targetControl = targetControl || focusedControl;
+ controls = targetControl.parents().toArray();
+ controls.unshift(targetControl);
+ for (var i = 0; i < controls.length; i++) {
+ navigationRoot = controls[i];
+ if (navigationRoot.settings.ariaRoot) {
+ break;
+ }
+ }
+ return navigationRoot;
+ }
+ function focusFirst(targetControl) {
+ var navigationRoot = getNavigationRoot(targetControl);
+ var focusElements = getFocusElements(navigationRoot.getEl());
+ if (navigationRoot.settings.ariaRemember && 'lastAriaIndex' in navigationRoot) {
+ moveFocusToIndex(navigationRoot.lastAriaIndex, focusElements);
+ } else {
+ moveFocusToIndex(0, focusElements);
+ }
+ }
+ function moveFocusToIndex(idx, elements) {
+ if (idx < 0) {
+ idx = elements.length - 1;
+ } else if (idx >= elements.length) {
+ idx = 0;
+ }
+ if (elements[idx]) {
+ elements[idx].focus();
+ }
+ return idx;
+ }
+ function moveFocus(dir, elements) {
+ var idx = -1;
+ var navigationRoot = getNavigationRoot();
+ elements = elements || getFocusElements(navigationRoot.getEl());
+ for (var i = 0; i < elements.length; i++) {
+ if (elements[i] === focusedElement) {
+ idx = i;
+ }
+ }
+ idx += dir;
+ navigationRoot.lastAriaIndex = moveFocusToIndex(idx, elements);
+ }
+ function left() {
+ var parentRole = getParentRole();
+ if (parentRole === 'tablist') {
+ moveFocus(-1, getFocusElements(focusedElement.parentNode));
+ } else if (focusedControl.parent().submenu) {
+ cancel();
+ } else {
+ moveFocus(-1);
+ }
+ }
+ function right() {
+ var role = getRole(), parentRole = getParentRole();
+ if (parentRole === 'tablist') {
+ moveFocus(1, getFocusElements(focusedElement.parentNode));
+ } else if (role === 'menuitem' && parentRole === 'menu' && getAriaProp('haspopup')) {
+ enter();
+ } else {
+ moveFocus(1);
+ }
+ }
+ function up() {
+ moveFocus(-1);
+ }
+ function down() {
+ var role = getRole(), parentRole = getParentRole();
+ if (role === 'menuitem' && parentRole === 'menubar') {
+ enter();
+ } else if (role === 'button' && getAriaProp('haspopup')) {
+ enter({ key: 'down' });
+ } else {
+ moveFocus(1);
+ }
+ }
+ function tab(e) {
+ var parentRole = getParentRole();
+ if (parentRole === 'tablist') {
+ var elm = getFocusElements(focusedControl.getEl('body'))[0];
+ if (elm) {
+ elm.focus();
+ }
+ } else {
+ moveFocus(e.shiftKey ? -1 : 1);
+ }
+ }
+ function cancel() {
+ focusedControl.fire('cancel');
+ }
+ function enter(aria) {
+ aria = aria || {};
+ focusedControl.fire('click', {
+ target: focusedElement,
+ aria: aria
+ });
+ }
+ root.on('keydown', function (e) {
+ function handleNonTabOrEscEvent(e, handler) {
+ if (isTextInputElement(focusedElement) || hasTabstopData(focusedElement)) {
+ return;
+ }
+ if (getRole(focusedElement) === 'slider') {
+ return;
+ }
+ if (handler(e) !== false) {
+ e.preventDefault();
+ }
+ }
+ if (e.isDefaultPrevented()) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch (e.keyCode) {
+ case 37:
+ handleNonTabOrEscEvent(e, left);
+ break;
+ case 39:
+ handleNonTabOrEscEvent(e, right);
+ break;
+ case 38:
+ handleNonTabOrEscEvent(e, up);
+ break;
+ case 40:
+ handleNonTabOrEscEvent(e, down);
+ break;
+ case 27:
+ cancel();
+ break;
+ case 14:
+ case 13:
+ case 32:
+ handleNonTabOrEscEvent(e, enter);
+ break;
+ case 9:
+ tab(e);
+ e.preventDefault();
+ break;
+ }
+ });
+ root.on('focusin', function (e) {
+ focusedElement = e.target;
+ focusedControl = e.control;
+ });
+ return { focusFirst: focusFirst };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Tools.each(itemsToArray(items), function (item) {
- var itemName;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var selectorCache = {};
+ var Container = Control$1.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ settings = self.settings;
+ if (settings.fixed) {
+ self.state.set('fixed', true);
+ }
+ self._items = new Collection$2();
+ if (self.isRtl()) {
+ self.classes.add('rtl');
+ }
+ self.bodyClasses = new ClassList(function () {
+ if (self.state.get('rendered')) {
+ self.getEl('body').className = this.toString();
+ }
+ });
+ self.bodyClasses.prefix = self.classPrefix;
+ self.classes.add('container');
+ self.bodyClasses.add('container-body');
+ if (settings.containerCls) {
+ self.classes.add(settings.containerCls);
+ }
+ self._layout = global$11.create((settings.layout || '') + 'layout');
+ if (self.settings.items) {
+ self.add(self.settings.items);
+ } else {
+ self.add(self.render());
+ }
+ self._hasBody = true;
+ },
+ items: function () {
+ return this._items;
+ },
+ find: function (selector) {
+ selector = selectorCache[selector] = selectorCache[selector] || new Selector(selector);
+ return selector.find(this);
+ },
+ add: function (items) {
+ var self = this;
+ self.items().add(self.create(items)).parent(self);
+ return self;
+ },
+ focus: function (keyboard) {
+ var self = this;
+ var focusCtrl, keyboardNav, items;
+ if (keyboard) {
+ keyboardNav = self.keyboardNav || self.parents().eq(-1)[0].keyboardNav;
+ if (keyboardNav) {
+ keyboardNav.focusFirst(self);
+ return;
+ }
+ }
+ items = self.find('*');
+ if (self.statusbar) {
+ items.add(self.statusbar.items());
+ }
+ items.each(function (ctrl) {
+ if (ctrl.settings.autofocus) {
+ focusCtrl = null;
+ return false;
+ }
+ if (ctrl.canFocus) {
+ focusCtrl = focusCtrl || ctrl;
+ }
+ });
+ if (focusCtrl) {
+ focusCtrl.focus();
+ }
+ return self;
+ },
+ replace: function (oldItem, newItem) {
+ var ctrlElm;
+ var items = this.items();
+ var i = items.length;
+ while (i--) {
+ if (items[i] === oldItem) {
+ items[i] = newItem;
+ break;
+ }
+ }
+ if (i >= 0) {
+ ctrlElm = newItem.getEl();
+ if (ctrlElm) {
+ ctrlElm.parentNode.removeChild(ctrlElm);
+ }
+ ctrlElm = oldItem.getEl();
+ if (ctrlElm) {
+ ctrlElm.parentNode.removeChild(ctrlElm);
+ }
+ }
+ newItem.parent(this);
+ },
+ create: function (items) {
+ var self = this;
+ var settings;
+ var ctrlItems = [];
+ if (!global$4.isArray(items)) {
+ items = [items];
+ }
+ global$4.each(items, function (item) {
+ if (item) {
+ if (!(item instanceof Control$1)) {
+ if (typeof item === 'string') {
+ item = { type: item };
+ }
+ settings = global$4.extend({}, self.settings.defaults, item);
+ item.type = settings.type = settings.type || item.type || self.settings.defaultType || (settings.defaults ? settings.defaults.type : null);
+ item = global$11.create(settings);
+ }
+ ctrlItems.push(item);
+ }
+ });
+ return ctrlItems;
+ },
+ renderNew: function () {
+ var self = this;
+ self.items().each(function (ctrl, index) {
+ var containerElm;
+ ctrl.parent(self);
+ if (!ctrl.state.get('rendered')) {
+ containerElm = self.getEl('body');
+ if (containerElm.hasChildNodes() && index <= containerElm.childNodes.length - 1) {
+ global$7(containerElm.childNodes[index]).before(ctrl.renderHtml());
+ } else {
+ global$7(containerElm).append(ctrl.renderHtml());
+ }
+ ctrl.postRender();
+ $_13g7tw17vjfuw8wgk.add(ctrl);
+ }
+ });
+ self._layout.applyClasses(self.items().filter(':visible'));
+ self._lastRect = null;
+ return self;
+ },
+ append: function (items) {
+ return this.add(items).renderNew();
+ },
+ prepend: function (items) {
+ var self = this;
+ self.items().set(self.create(items).concat(self.items().toArray()));
+ return self.renderNew();
+ },
+ insert: function (items, index, before) {
+ var self = this;
+ var curItems, beforeItems, afterItems;
+ items = self.create(items);
+ curItems = self.items();
+ if (!before && index < curItems.length - 1) {
+ index += 1;
+ }
+ if (index >= 0 && index < curItems.length) {
+ beforeItems = curItems.slice(0, index).toArray();
+ afterItems = curItems.slice(index).toArray();
+ curItems.set(beforeItems.concat(items, afterItems));
+ }
+ return self.renderNew();
+ },
+ fromJSON: function (data) {
+ var self = this;
+ for (var name_1 in data) {
+ self.find('#' + name_1).value(data[name_1]);
+ }
+ return self;
+ },
+ toJSON: function () {
+ var self = this, data = {};
+ self.find('*').each(function (ctrl) {
+ var name = ctrl.name(), value = ctrl.value();
+ if (name && typeof value !== 'undefined') {
+ data[name] = value;
+ }
+ });
+ return data;
+ },
+ renderHtml: function () {
+ var self = this, layout = self._layout, role = this.settings.role;
+ self.preRender();
+ layout.preRender(self);
+ return '<div id="' + self._id + '" class="' + self.classes + '"' + (role ? ' role="' + this.settings.role + '"' : '') + '>' + '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' + (self.settings.html || '') + layout.renderHtml(self) + '</div>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ var box;
+ self.items().exec('postRender');
+ self._super();
+ self._layout.postRender(self);
+ self.state.set('rendered', true);
+ if (self.settings.style) {
+ self.$el.css(self.settings.style);
+ }
+ if (self.settings.border) {
+ box = self.borderBox;
+ self.$el.css({
+ 'border-top-width': box.top,
+ 'border-right-width': box.right,
+ 'border-bottom-width': box.bottom,
+ 'border-left-width': box.left
+ });
+ }
+ if (!self.parent()) {
+ self.keyboardNav = KeyboardNavigation({ root: self });
+ }
+ return self;
+ },
+ initLayoutRect: function () {
+ var self = this, layoutRect = self._super();
+ self._layout.recalc(self);
+ return layoutRect;
+ },
+ recalc: function () {
+ var self = this;
+ var rect = self._layoutRect;
+ var lastRect = self._lastRect;
+ if (!lastRect || lastRect.w !== rect.w || lastRect.h !== rect.h) {
+ self._layout.recalc(self);
+ rect = self.layoutRect();
+ self._lastRect = {
+ x: rect.x,
+ y: rect.y,
+ w: rect.w,
+ h: rect.h
+ };
+ return true;
+ }
+ },
+ reflow: function () {
+ var i;
+ $_13g7tw17vjfuw8wgk.remove(this);
+ if (this.visible()) {
+ Control$1.repaintControls = [];
+ Control$1.repaintControls.map = {};
+ this.recalc();
+ i = Control$1.repaintControls.length;
+ while (i--) {
+ Control$1.repaintControls[i].repaint();
+ }
+ if (this.settings.layout !== 'flow' && this.settings.layout !== 'stack') {
+ this.repaint();
+ }
+ Control$1.repaintControls = [];
+ }
+ return this;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (item == '|') {
- buttonGroup = null;
- } else {
- if (editor.buttons[item]) {
- if (!buttonGroup) {
- buttonGroup = { type: 'buttongroup', items: [] };
- toolbarItems.push(buttonGroup);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_7kg51q189jfuw8wiq = {
+ init: function () {
+ var self = this;
+ self.on('repaint', self.renderScroll);
+ },
+ renderScroll: function () {
+ var self = this, margin = 2;
+ function repaintScroll() {
+ var hasScrollH, hasScrollV, bodyElm;
+ function repaintAxis(axisName, posName, sizeName, contentSizeName, hasScroll, ax) {
+ var containerElm, scrollBarElm, scrollThumbElm;
+ var containerSize, scrollSize, ratio, rect;
+ var posNameLower, sizeNameLower;
+ scrollBarElm = self.getEl('scroll' + axisName);
+ if (scrollBarElm) {
+ posNameLower = posName.toLowerCase();
+ sizeNameLower = sizeName.toLowerCase();
+ global$7(self.getEl('absend')).css(posNameLower, self.layoutRect()[contentSizeName] - 1);
+ if (!hasScroll) {
+ global$7(scrollBarElm).css('display', 'none');
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global$7(scrollBarElm).css('display', 'block');
+ containerElm = self.getEl('body');
+ scrollThumbElm = self.getEl('scroll' + axisName + 't');
+ containerSize = containerElm['client' + sizeName] - margin * 2;
+ containerSize -= hasScrollH && hasScrollV ? scrollBarElm['client' + ax] : 0;
+ scrollSize = containerElm['scroll' + sizeName];
+ ratio = containerSize / scrollSize;
+ rect = {};
+ rect[posNameLower] = containerElm['offset' + posName] + margin;
+ rect[sizeNameLower] = containerSize;
+ global$7(scrollBarElm).css(rect);
+ rect = {};
+ rect[posNameLower] = containerElm['scroll' + posName] * ratio;
+ rect[sizeNameLower] = containerSize * ratio;
+ global$7(scrollThumbElm).css(rect);
+ }
+ }
+ bodyElm = self.getEl('body');
+ hasScrollH = bodyElm.scrollWidth > bodyElm.clientWidth;
+ hasScrollV = bodyElm.scrollHeight > bodyElm.clientHeight;
+ repaintAxis('h', 'Left', 'Width', 'contentW', hasScrollH, 'Height');
+ repaintAxis('v', 'Top', 'Height', 'contentH', hasScrollV, 'Width');
+ }
+ function addScroll() {
+ function addScrollAxis(axisName, posName, sizeName, deltaPosName, ax) {
+ var scrollStart;
+ var axisId = self._id + '-scroll' + axisName, prefix = self.classPrefix;
+ global$7(self.getEl()).append('<div id="' + axisId + '" class="' + prefix + 'scrollbar ' + prefix + 'scrollbar-' + axisName + '">' + '<div id="' + axisId + 't" class="' + prefix + 'scrollbar-thumb"></div>' + '</div>');
+ self.draghelper = new DragHelper(axisId + 't', {
+ start: function () {
+ scrollStart = self.getEl('body')['scroll' + posName];
+ global$7('#' + axisId).addClass(prefix + 'active');
+ },
+ drag: function (e) {
+ var ratio, hasScrollH, hasScrollV, containerSize;
+ var layoutRect = self.layoutRect();
+ hasScrollH = layoutRect.contentW > layoutRect.innerW;
+ hasScrollV = layoutRect.contentH > layoutRect.innerH;
+ containerSize = self.getEl('body')['client' + sizeName] - margin * 2;
+ containerSize -= hasScrollH && hasScrollV ? self.getEl('scroll' + axisName)['client' + ax] : 0;
+ ratio = containerSize / self.getEl('body')['scroll' + sizeName];
+ self.getEl('body')['scroll' + posName] = scrollStart + e['delta' + deltaPosName] / ratio;
+ },
+ stop: function () {
+ global$7('#' + axisId).removeClass(prefix + 'active');
+ }
+ });
+ }
+ self.classes.add('scroll');
+ addScrollAxis('v', 'Top', 'Height', 'Y', 'Width');
+ addScrollAxis('h', 'Left', 'Width', 'X', 'Height');
+ }
+ if (self.settings.autoScroll) {
+ if (!self._hasScroll) {
+ self._hasScroll = true;
+ addScroll();
+ self.on('wheel', function (e) {
+ var bodyEl = self.getEl('body');
+ bodyEl.scrollLeft += (e.deltaX || 0) * 10;
+ bodyEl.scrollTop += e.deltaY * 10;
+ repaintScroll();
+ });
+ global$7(self.getEl('body')).on('scroll', repaintScroll);
+ }
+ repaintScroll();
+ }
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- itemName = item;
- item = editor.buttons[itemName];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Panel = Container.extend({
+ Defaults: {
+ layout: 'fit',
+ containerCls: 'panel'
+ },
+ Mixins: [$_7kg51q189jfuw8wiq],
+ renderHtml: function () {
+ var self = this;
+ var layout = self._layout;
+ var innerHtml = self.settings.html;
+ self.preRender();
+ layout.preRender(self);
+ if (typeof innerHtml === 'undefined') {
+ innerHtml = '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' + layout.renderHtml(self) + '</div>';
+ } else {
+ if (typeof innerHtml === 'function') {
+ innerHtml = innerHtml.call(self);
+ }
+ self._hasBody = false;
+ }
+ return '<div id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1" role="group">' + (self._preBodyHtml || '') + innerHtml + '</div>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (typeof item == 'function') {
- item = item();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_f8jegf18ajfuw8wit = {
+ resizeToContent: function () {
+ this._layoutRect.autoResize = true;
+ this._lastRect = null;
+ this.reflow();
+ },
+ resizeTo: function (w, h) {
+ if (w <= 1 || h <= 1) {
+ var rect = funcs.getWindowSize();
+ w = w <= 1 ? w * rect.w : w;
+ h = h <= 1 ? h * rect.h : h;
+ }
+ this._layoutRect.autoResize = false;
+ return this.layoutRect({
+ minW: w,
+ minH: h,
+ w: w,
+ h: h
+ }).reflow();
+ },
+ resizeBy: function (dw, dh) {
+ var self = this, rect = self.layoutRect();
+ return self.resizeTo(rect.w + dw, rect.h + dh);
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- item.type = item.type || 'button';
-
- item = Factory.create(item);
- item.on('postRender', bindSelectorChanged(editor, itemName, item));
- buttonGroup.items.push(item);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var documentClickHandler;
+ var documentScrollHandler;
+ var windowResizeHandler;
+ var visiblePanels = [];
+ var zOrder = [];
+ var hasModal;
+ function isChildOf(ctrl, parent) {
+ while (ctrl) {
+ if (ctrl === parent) {
+ return true;
+ }
+ ctrl = ctrl.parent();
+ }
+ }
+ function skipOrHidePanels(e) {
+ var i = visiblePanels.length;
+ while (i--) {
+ var panel = visiblePanels[i], clickCtrl = panel.getParentCtrl(e.target);
+ if (panel.settings.autohide) {
+ if (clickCtrl) {
+ if (isChildOf(clickCtrl, panel) || panel.parent() === clickCtrl) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ e = panel.fire('autohide', { target: e.target });
+ if (!e.isDefaultPrevented()) {
+ panel.hide();
+ }
+ }
+ }
+ }
+ function bindDocumentClickHandler() {
+ if (!documentClickHandler) {
+ documentClickHandler = function (e) {
+ if (e.button === 2) {
+ return;
+ }
+ skipOrHidePanels(e);
+ };
+ global$7(document).on('click touchstart', documentClickHandler);
+ }
+ }
+ function bindDocumentScrollHandler() {
+ if (!documentScrollHandler) {
+ documentScrollHandler = function () {
+ var i;
+ i = visiblePanels.length;
+ while (i--) {
+ repositionPanel$1(visiblePanels[i]);
+ }
+ };
+ global$7(window).on('scroll', documentScrollHandler);
+ }
+ }
+ function bindWindowResizeHandler() {
+ if (!windowResizeHandler) {
+ var docElm_1 = document.documentElement;
+ var clientWidth_1 = docElm_1.clientWidth, clientHeight_1 = docElm_1.clientHeight;
+ windowResizeHandler = function () {
+ if (!document.all || clientWidth_1 !== docElm_1.clientWidth || clientHeight_1 !== docElm_1.clientHeight) {
+ clientWidth_1 = docElm_1.clientWidth;
+ clientHeight_1 = docElm_1.clientHeight;
+ FloatPanel.hideAll();
+ }
+ };
+ global$7(window).on('resize', windowResizeHandler);
+ }
+ }
+ function repositionPanel$1(panel) {
+ var scrollY = funcs.getViewPort().y;
+ function toggleFixedChildPanels(fixed, deltaY) {
+ var parent;
+ for (var i = 0; i < visiblePanels.length; i++) {
+ if (visiblePanels[i] !== panel) {
+ parent = visiblePanels[i].parent();
+ while (parent && (parent = parent.parent())) {
+ if (parent === panel) {
+ visiblePanels[i].fixed(fixed).moveBy(0, deltaY).repaint();
+ }
+ }
+ }
+ }
+ }
+ if (panel.settings.autofix) {
+ if (!panel.state.get('fixed')) {
+ panel._autoFixY = panel.layoutRect().y;
+ if (panel._autoFixY < scrollY) {
+ panel.fixed(true).layoutRect({ y: 0 }).repaint();
+ toggleFixedChildPanels(true, scrollY - panel._autoFixY);
+ }
+ } else {
+ if (panel._autoFixY > scrollY) {
+ panel.fixed(false).layoutRect({ y: panel._autoFixY }).repaint();
+ toggleFixedChildPanels(false, panel._autoFixY - scrollY);
+ }
+ }
+ }
+ }
+ function addRemove(add, ctrl) {
+ var i, zIndex = FloatPanel.zIndex || 65535, topModal;
+ if (add) {
+ zOrder.push(ctrl);
+ } else {
+ i = zOrder.length;
+ while (i--) {
+ if (zOrder[i] === ctrl) {
+ zOrder.splice(i, 1);
+ }
+ }
+ }
+ if (zOrder.length) {
+ for (i = 0; i < zOrder.length; i++) {
+ if (zOrder[i].modal) {
+ zIndex++;
+ topModal = zOrder[i];
+ }
+ zOrder[i].getEl().style.zIndex = zIndex;
+ zOrder[i].zIndex = zIndex;
+ zIndex++;
+ }
+ }
+ var modalBlockEl = global$7('#' + ctrl.classPrefix + 'modal-block', ctrl.getContainerElm())[0];
+ if (topModal) {
+ global$7(modalBlockEl).css('z-index', topModal.zIndex - 1);
+ } else if (modalBlockEl) {
+ modalBlockEl.parentNode.removeChild(modalBlockEl);
+ hasModal = false;
+ }
+ FloatPanel.currentZIndex = zIndex;
+ }
+ var FloatPanel = Panel.extend({
+ Mixins: [
+ $_cn53y617xjfuw8wgp,
+ $_f8jegf18ajfuw8wit
+ ],
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self._eventsRoot = self;
+ self.classes.add('floatpanel');
+ if (settings.autohide) {
+ bindDocumentClickHandler();
+ bindWindowResizeHandler();
+ visiblePanels.push(self);
+ }
+ if (settings.autofix) {
+ bindDocumentScrollHandler();
+ self.on('move', function () {
+ repositionPanel$1(this);
+ });
+ }
+ self.on('postrender show', function (e) {
+ if (e.control === self) {
+ var $modalBlockEl_1;
+ var prefix_1 = self.classPrefix;
+ if (self.modal && !hasModal) {
+ $modalBlockEl_1 = global$7('#' + prefix_1 + 'modal-block', self.getContainerElm());
+ if (!$modalBlockEl_1[0]) {
+ $modalBlockEl_1 = global$7('<div id="' + prefix_1 + 'modal-block" class="' + prefix_1 + 'reset ' + prefix_1 + 'fade"></div>').appendTo(self.getContainerElm());
+ }
+ global$3.setTimeout(function () {
+ $modalBlockEl_1.addClass(prefix_1 + 'in');
+ global$7(self.getEl()).addClass(prefix_1 + 'in');
+ });
+ hasModal = true;
+ }
+ addRemove(true, self);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Factory.create({
- type: 'toolbar',
- layout: 'flow',
- name: name,
- items: toolbarItems
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.on('show', function () {
+ self.parents().each(function (ctrl) {
+ if (ctrl.state.get('fixed')) {
+ self.fixed(true);
+ return false;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- return {
- create: create
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (settings.popover) {
+ self._preBodyHtml = '<div class="' + self.classPrefix + 'arrow"></div>';
+ self.classes.add('popover').add('bottom').add(self.isRtl() ? 'end' : 'start');
+ }
+ self.aria('label', settings.ariaLabel);
+ self.aria('labelledby', self._id);
+ self.aria('describedby', self.describedBy || self._id + '-none');
+ },
+ fixed: function (state) {
+ var self = this;
+ if (self.state.get('fixed') !== state) {
+ if (self.state.get('rendered')) {
+ var viewport = funcs.getViewPort();
+ if (state) {
+ self.layoutRect().y -= viewport.y;
+ } else {
+ self.layoutRect().y += viewport.y;
+ }
+ }
+ self.classes.toggle('fixed', state);
+ self.state.set('fixed', state);
+ }
+ return self;
+ },
+ show: function () {
+ var self = this;
+ var i;
+ var state = self._super();
+ i = visiblePanels.length;
+ while (i--) {
+ if (visiblePanels[i] === self) {
+ break;
+ }
+ }
+ if (i === -1) {
+ visiblePanels.push(self);
+ }
+ return state;
+ },
+ hide: function () {
+ removeVisiblePanel(this);
+ addRemove(false, this);
+ return this._super();
+ },
+ hideAll: function () {
+ FloatPanel.hideAll();
+ },
+ close: function () {
+ var self = this;
+ if (!self.fire('close').isDefaultPrevented()) {
+ self.remove();
+ addRemove(false, self);
+ }
+ return self;
+ },
+ remove: function () {
+ removeVisiblePanel(this);
+ this._super();
+ },
+ postRender: function () {
+ var self = this;
+ if (self.settings.bodyRole) {
+ this.getEl('body').setAttribute('role', self.settings.bodyRole);
+ }
+ return self._super();
+ }
+ });
+ FloatPanel.hideAll = function () {
+ var i = visiblePanels.length;
+ while (i--) {
+ var panel = visiblePanels[i];
+ if (panel && panel.settings.autohide) {
+ panel.hide();
+ visiblePanels.splice(i, 1);
+ }
+ }
+ };
+ function removeVisiblePanel(panel) {
+ var i;
+ i = visiblePanels.length;
+ while (i--) {
+ if (visiblePanels[i] === panel) {
+ visiblePanels.splice(i, 1);
+ }
+ }
+ i = zOrder.length;
+ while (i--) {
+ if (zOrder[i] === panel) {
+ zOrder.splice(i, 1);
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Promise',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Promise');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var windows = [];
+ var oldMetaValue = '';
+ function toggleFullScreenState(state) {
+ var noScaleMetaValue = 'width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0';
+ var viewport = global$7('meta[name=viewport]')[0], contentValue;
+ if (global$1.overrideViewPort === false) {
+ return;
+ }
+ if (!viewport) {
+ viewport = document.createElement('meta');
+ viewport.setAttribute('name', 'viewport');
+ document.getElementsByTagName('head')[0].appendChild(viewport);
+ }
+ contentValue = viewport.getAttribute('content');
+ if (contentValue && typeof oldMetaValue !== 'undefined') {
+ oldMetaValue = contentValue;
+ }
+ viewport.setAttribute('content', state ? noScaleMetaValue : oldMetaValue);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-
-/**
- * Uuid.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Generates unique ids this is the same as in core but since
- * it's not exposed as a global we can't access it.
- */
-define(
- "tinymce.themes.inlite.alien.Uuid",
- [
- ],
- function () {
- var count = 0;
-
- var seed = function () {
- var rnd = function () {
- return Math.round(Math.random() * 0xFFFFFFFF).toString(36);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function toggleBodyFullScreenClasses(classPrefix, state) {
+ if (checkFullscreenWindows() && state === false) {
+ global$7([
+ document.documentElement,
+ document.body
+ ]).removeClass(classPrefix + 'fullscreen');
+ }
+ }
+ function checkFullscreenWindows() {
+ for (var i = 0; i < windows.length; i++) {
+ if (windows[i]._fullscreen) {
+ return true;
+ }
+ }
+ return false;
+ }
+ function handleWindowResize() {
+ if (!global$1.desktop) {
+ var lastSize_1 = {
+ w: window.innerWidth,
+ h: window.innerHeight
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return 's' + Date.now().toString(36) + rnd() + rnd() + rnd();
- };
-
- var uuid = function (prefix) {
- return prefix + (count++) + seed();
- };
-
- return {
- uuid: uuid
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global$3.setInterval(function () {
+ var w = window.innerWidth, h = window.innerHeight;
+ if (lastSize_1.w !== w || lastSize_1.h !== h) {
+ lastSize_1 = {
+ w: w,
+ h: h
+ };
+ global$7(window).trigger('resize');
+ }
+ }, 100);
+ }
+ function reposition() {
+ var i;
+ var rect = funcs.getWindowSize();
+ var layoutRect;
+ for (i = 0; i < windows.length; i++) {
+ layoutRect = windows[i].layoutRect();
+ windows[i].moveTo(windows[i].settings.x || Math.max(0, rect.w / 2 - layoutRect.w / 2), windows[i].settings.y || Math.max(0, rect.h / 2 - layoutRect.h / 2));
+ }
+ }
+ global$7(window).on('resize', reposition);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-
-/**
- * Bookmark.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.alien.Bookmark',
- [
- ],
- function () {
- /**
- * Returns a range bookmark. This will convert indexed bookmarks into temporary span elements with
- * index 0 so that they can be restored properly after the DOM has been modified. Text bookmarks will not have spans
- * added to them since they can be restored after a dom operation.
- *
- * So this: <p><b>|</b><b>|</b></p>
- * becomes: <p><b><span data-mce-type="bookmark">|</span></b><b data-mce-type="bookmark">|</span></b></p>
- *
- * @param {DOMRange} rng DOM Range to get bookmark on.
- * @return {Object} Bookmark object.
- */
- var create = function (dom, rng) {
- var bookmark = {};
-
- function setupEndPoint(start) {
- var offsetNode, container, offset;
-
- container = rng[start ? 'startContainer' : 'endContainer'];
- offset = rng[start ? 'startOffset' : 'endOffset'];
-
- if (container.nodeType == 1) {
- offsetNode = dom.create('span', { 'data-mce-type': 'bookmark' });
-
- if (container.hasChildNodes()) {
- offset = Math.min(offset, container.childNodes.length - 1);
-
- if (start) {
- container.insertBefore(offsetNode, container.childNodes[offset]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Window = FloatPanel.extend({
+ modal: true,
+ Defaults: {
+ border: 1,
+ layout: 'flex',
+ containerCls: 'panel',
+ role: 'dialog',
+ callbacks: {
+ submit: function () {
+ this.fire('submit', { data: this.toJSON() });
+ },
+ close: function () {
+ this.close();
+ }
+ }
+ },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ if (self.isRtl()) {
+ self.classes.add('rtl');
+ }
+ self.classes.add('window');
+ self.bodyClasses.add('window-body');
+ self.state.set('fixed', true);
+ if (settings.buttons) {
+ self.statusbar = new Panel({
+ layout: 'flex',
+ border: '1 0 0 0',
+ spacing: 3,
+ padding: 10,
+ align: 'center',
+ pack: self.isRtl() ? 'start' : 'end',
+ defaults: { type: 'button' },
+ items: settings.buttons
+ });
+ self.statusbar.classes.add('foot');
+ self.statusbar.parent(self);
+ }
+ self.on('click', function (e) {
+ var closeClass = self.classPrefix + 'close';
+ if (funcs.hasClass(e.target, closeClass) || funcs.hasClass(e.target.parentNode, closeClass)) {
+ self.close();
+ }
+ });
+ self.on('cancel', function () {
+ self.close();
+ });
+ self.on('move', function (e) {
+ if (e.control === self) {
+ FloatPanel.hideAll();
+ }
+ });
+ self.aria('describedby', self.describedBy || self._id + '-none');
+ self.aria('label', settings.title);
+ self._fullscreen = false;
+ },
+ recalc: function () {
+ var self = this;
+ var statusbar = self.statusbar;
+ var layoutRect, width, x, needsRecalc;
+ if (self._fullscreen) {
+ self.layoutRect(funcs.getWindowSize());
+ self.layoutRect().contentH = self.layoutRect().innerH;
+ }
+ self._super();
+ layoutRect = self.layoutRect();
+ if (self.settings.title && !self._fullscreen) {
+ width = layoutRect.headerW;
+ if (width > layoutRect.w) {
+ x = layoutRect.x - Math.max(0, width / 2);
+ self.layoutRect({
+ w: width,
+ x: x
+ });
+ needsRecalc = true;
+ }
+ }
+ if (statusbar) {
+ statusbar.layoutRect({ w: self.layoutRect().innerW }).recalc();
+ width = statusbar.layoutRect().minW + layoutRect.deltaW;
+ if (width > layoutRect.w) {
+ x = layoutRect.x - Math.max(0, width - layoutRect.w);
+ self.layoutRect({
+ w: width,
+ x: x
+ });
+ needsRecalc = true;
+ }
+ }
+ if (needsRecalc) {
+ self.recalc();
+ }
+ },
+ initLayoutRect: function () {
+ var self = this;
+ var layoutRect = self._super();
+ var deltaH = 0, headEl;
+ if (self.settings.title && !self._fullscreen) {
+ headEl = self.getEl('head');
+ var size = funcs.getSize(headEl);
+ layoutRect.headerW = size.width;
+ layoutRect.headerH = size.height;
+ deltaH += layoutRect.headerH;
+ }
+ if (self.statusbar) {
+ deltaH += self.statusbar.layoutRect().h;
+ }
+ layoutRect.deltaH += deltaH;
+ layoutRect.minH += deltaH;
+ layoutRect.h += deltaH;
+ var rect = funcs.getWindowSize();
+ layoutRect.x = self.settings.x || Math.max(0, rect.w / 2 - layoutRect.w / 2);
+ layoutRect.y = self.settings.y || Math.max(0, rect.h / 2 - layoutRect.h / 2);
+ return layoutRect;
+ },
+ renderHtml: function () {
+ var self = this, layout = self._layout, id = self._id, prefix = self.classPrefix;
+ var settings = self.settings;
+ var headerHtml = '', footerHtml = '', html = settings.html;
+ self.preRender();
+ layout.preRender(self);
+ if (settings.title) {
+ headerHtml = '<div id="' + id + '-head" class="' + prefix + 'window-head">' + '<div id="' + id + '-title" class="' + prefix + 'title">' + self.encode(settings.title) + '</div>' + '<div id="' + id + '-dragh" class="' + prefix + 'dragh"></div>' + '<button type="button" class="' + prefix + 'close" aria-hidden="true">' + '<i class="mce-ico mce-i-remove"></i>' + '</button>' + '</div>';
+ }
+ if (settings.url) {
+ html = '<iframe src="' + settings.url + '" tabindex="-1"></iframe>';
+ }
+ if (typeof html === 'undefined') {
+ html = layout.renderHtml(self);
+ }
+ if (self.statusbar) {
+ footerHtml = self.statusbar.renderHtml();
+ }
+ return '<div id="' + id + '" class="' + self.classes + '" hidefocus="1">' + '<div class="' + self.classPrefix + 'reset" role="application">' + headerHtml + '<div id="' + id + '-body" class="' + self.bodyClasses + '">' + html + '</div>' + footerHtml + '</div>' + '</div>';
+ },
+ fullscreen: function (state) {
+ var self = this;
+ var documentElement = document.documentElement;
+ var slowRendering;
+ var prefix = self.classPrefix;
+ var layoutRect;
+ if (state !== self._fullscreen) {
+ global$7(window).on('resize', function () {
+ var time;
+ if (self._fullscreen) {
+ if (!slowRendering) {
+ time = new Date().getTime();
+ var rect = funcs.getWindowSize();
+ self.moveTo(0, 0).resizeTo(rect.w, rect.h);
+ if (new Date().getTime() - time > 50) {
+ slowRendering = true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- dom.insertAfter(offsetNode, container.childNodes[offset]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!self._timer) {
+ self._timer = global$3.setTimeout(function () {
+ var rect = funcs.getWindowSize();
+ self.moveTo(0, 0).resizeTo(rect.w, rect.h);
+ self._timer = 0;
+ }, 50);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- container.appendChild(offsetNode);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- container = offsetNode;
- offset = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ layoutRect = self.layoutRect();
+ self._fullscreen = state;
+ if (!state) {
+ self.borderBox = $_b17qji17ojfuw8wg0.parseBox(self.settings.border);
+ self.getEl('head').style.display = '';
+ layoutRect.deltaH += layoutRect.headerH;
+ global$7([
+ documentElement,
+ document.body
+ ]).removeClass(prefix + 'fullscreen');
+ self.classes.remove('fullscreen');
+ self.moveTo(self._initial.x, self._initial.y).resizeTo(self._initial.w, self._initial.h);
+ } else {
+ self._initial = {
+ x: layoutRect.x,
+ y: layoutRect.y,
+ w: layoutRect.w,
+ h: layoutRect.h
+ };
+ self.borderBox = $_b17qji17ojfuw8wg0.parseBox('0');
+ self.getEl('head').style.display = 'none';
+ layoutRect.deltaH -= layoutRect.headerH + 2;
+ global$7([
+ documentElement,
+ document.body
+ ]).addClass(prefix + 'fullscreen');
+ self.classes.add('fullscreen');
+ var rect = funcs.getWindowSize();
+ self.moveTo(0, 0).resizeTo(rect.w, rect.h);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- bookmark[start ? 'startContainer' : 'endContainer'] = container;
- bookmark[start ? 'startOffset' : 'endOffset'] = offset;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- setupEndPoint(true);
-
- if (!rng.collapsed) {
- setupEndPoint();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self.reflow();
+ },
+ postRender: function () {
+ var self = this;
+ var startPos;
+ setTimeout(function () {
+ self.classes.add('in');
+ self.fire('open');
+ }, 0);
+ self._super();
+ if (self.statusbar) {
+ self.statusbar.postRender();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.focus();
+ this.dragHelper = new DragHelper(self._id + '-dragh', {
+ start: function () {
+ startPos = {
+ x: self.layoutRect().x,
+ y: self.layoutRect().y
+ };
+ },
+ drag: function (e) {
+ self.moveTo(startPos.x + e.deltaX, startPos.y + e.deltaY);
+ }
+ });
+ self.on('submit', function (e) {
+ if (!e.isDefaultPrevented()) {
+ self.close();
+ }
+ });
+ windows.push(self);
+ toggleFullScreenState(true);
+ },
+ submit: function () {
+ return this.fire('submit', { data: this.toJSON() });
+ },
+ remove: function () {
+ var self = this;
+ var i;
+ self.dragHelper.destroy();
+ self._super();
+ if (self.statusbar) {
+ this.statusbar.remove();
+ }
+ toggleBodyFullScreenClasses(self.classPrefix, false);
+ i = windows.length;
+ while (i--) {
+ if (windows[i] === self) {
+ windows.splice(i, 1);
+ }
+ }
+ toggleFullScreenState(windows.length > 0);
+ },
+ getContentWindow: function () {
+ var ifr = this.getEl().getElementsByTagName('iframe')[0];
+ return ifr ? ifr.contentWindow : null;
+ }
+ });
+ handleWindowResize();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return bookmark;
- };
-
- /**
- * Moves the selection to the current bookmark and removes any selection container wrappers.
- *
- * @param {Object} bookmark Bookmark object to move selection to.
- */
- var resolve = function (dom, bookmark) {
- function restoreEndPoint(start) {
- var container, offset, node;
-
- function nodeIndex(container) {
- var node = container.parentNode.firstChild, idx = 0;
-
- while (node) {
- if (node == container) {
- return idx;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var MessageBox = Window.extend({
+ init: function (settings) {
+ settings = {
+ border: 1,
+ padding: 20,
+ layout: 'flex',
+ pack: 'center',
+ align: 'center',
+ containerCls: 'panel',
+ autoScroll: true,
+ buttons: {
+ type: 'button',
+ text: 'Ok',
+ action: 'ok'
+ },
+ items: {
+ type: 'label',
+ multiline: true,
+ maxWidth: 500,
+ maxHeight: 200
+ }
+ };
+ this._super(settings);
+ },
+ Statics: {
+ OK: 1,
+ OK_CANCEL: 2,
+ YES_NO: 3,
+ YES_NO_CANCEL: 4,
+ msgBox: function (settings) {
+ var buttons;
+ var callback = settings.callback || function () {
+ };
+ function createButton(text, status, primary) {
+ return {
+ type: 'button',
+ text: text,
+ subtype: primary ? 'primary' : '',
+ onClick: function (e) {
+ e.control.parents()[1].close();
+ callback(status);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Skip data-mce-type=bookmark nodes
- if (node.nodeType != 1 || node.getAttribute('data-mce-type') != 'bookmark') {
- idx++;
- }
-
- node = node.nextSibling;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ }
+ switch (settings.buttons) {
+ case MessageBox.OK_CANCEL:
+ buttons = [
+ createButton('Ok', true, true),
+ createButton('Cancel', false)
+ ];
+ break;
+ case MessageBox.YES_NO:
+ case MessageBox.YES_NO_CANCEL:
+ buttons = [
+ createButton('Yes', 1, true),
+ createButton('No', 0)
+ ];
+ if (settings.buttons === MessageBox.YES_NO_CANCEL) {
+ buttons.push(createButton('Cancel', -1));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return -1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
+ default:
+ buttons = [createButton('Ok', true, true)];
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- container = node = bookmark[start ? 'startContainer' : 'endContainer'];
- offset = bookmark[start ? 'startOffset' : 'endOffset'];
-
- if (!container) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return new Window({
+ padding: 20,
+ x: settings.x,
+ y: settings.y,
+ minWidth: 300,
+ minHeight: 100,
+ layout: 'flex',
+ pack: 'center',
+ align: 'center',
+ buttons: buttons,
+ title: settings.title,
+ role: 'alertdialog',
+ items: {
+ type: 'label',
+ multiline: true,
+ maxWidth: 500,
+ maxHeight: 200,
+ text: settings.text
+ },
+ onPostRender: function () {
+ this.aria('describedby', this.items()[0]._id);
+ },
+ onClose: settings.onClose,
+ onCancel: function () {
+ callback(false);
+ }
+ }).renderTo(document.body).reflow();
+ },
+ alert: function (settings, callback) {
+ if (typeof settings === 'string') {
+ settings = { text: settings };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (container.nodeType == 1) {
- offset = nodeIndex(container);
- container = container.parentNode;
- dom.remove(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ settings.callback = callback;
+ return MessageBox.msgBox(settings);
+ },
+ confirm: function (settings, callback) {
+ if (typeof settings === 'string') {
+ settings = { text: settings };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- bookmark[start ? 'startContainer' : 'endContainer'] = container;
- bookmark[start ? 'startOffset' : 'endOffset'] = offset;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ settings.callback = callback;
+ settings.buttons = MessageBox.OK_CANCEL;
+ return MessageBox.msgBox(settings);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- restoreEndPoint(true);
- restoreEndPoint();
-
- var rng = dom.createRng();
-
- rng.setStart(bookmark.startContainer, bookmark.startOffset);
-
- if (bookmark.endContainer) {
- rng.setEnd(bookmark.endContainer, bookmark.endOffset);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function WindowManagerImpl (editor) {
+ var open = function (args, params, closeCallback) {
+ var win;
+ args.title = args.title || ' ';
+ args.url = args.url || args.file;
+ if (args.url) {
+ args.width = parseInt(args.width || 320, 10);
+ args.height = parseInt(args.height || 240, 10);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return rng;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (args.body) {
+ args.items = {
+ defaults: args.defaults,
+ type: args.bodyType || 'form',
+ items: args.body,
+ data: args.data,
+ callbacks: args.commands
+ };
+ }
+ if (!args.url && !args.buttons) {
+ args.buttons = [
+ {
+ text: 'Ok',
+ subtype: 'primary',
+ onclick: function () {
+ win.find('form')[0].submit();
+ }
+ },
+ {
+ text: 'Cancel',
+ onclick: function () {
+ win.close();
+ }
+ }
+ ];
+ }
+ win = new Window(args);
+ win.on('close', function () {
+ closeCallback(win);
+ });
+ if (args.data) {
+ win.on('postRender', function () {
+ this.find('*').each(function (ctrl) {
+ var name = ctrl.name();
+ if (name in args.data) {
+ ctrl.value(args.data[name]);
+ }
+ });
+ });
+ }
+ win.features = args || {};
+ win.params = params || {};
+ win = win.renderTo(document.body).reflow();
+ return win;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var alert = function (message, choiceCallback, closeCallback) {
+ var win;
+ win = MessageBox.alert(message, function () {
+ choiceCallback();
+ });
+ win.on('close', function () {
+ closeCallback(win);
+ });
+ return win;
+ };
+ var confirm = function (message, choiceCallback, closeCallback) {
+ var win;
+ win = MessageBox.confirm(message, function (state) {
+ choiceCallback(state);
+ });
+ win.on('close', function () {
+ closeCallback(win);
+ });
+ return win;
+ };
+ var close = function (window) {
+ window.close();
+ };
+ var getParams = function (window) {
+ return window.params;
+ };
+ var setParams = function (window, params) {
+ window.params = params;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- create: create,
- resolve: resolve
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ open: open,
+ alert: alert,
+ confirm: confirm,
+ close: close,
+ getParams: getParams,
+ setParams: setParams
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get = function (editor, panel) {
+ var renderUI = function () {
+ return $_gf138c16tjfuw8wdo.renderUI(editor, panel);
+ };
+ return {
+ renderUI: renderUI,
+ getNotificationManagerImpl: function () {
+ return NotificationManagerImpl(editor);
+ },
+ getWindowManagerImpl: function () {
+ return WindowManagerImpl(editor);
+ }
+ };
+ };
+ var $_5lg8ed16sjfuw8wdm = { get: get };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$12 = typeof window !== 'undefined' ? window : Function('return this;')();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var path = function (parts, scope) {
+ var o = scope !== undefined && scope !== null ? scope : global$12;
+ for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
+ o = o[parts[i]];
+ return o;
+ };
+ var resolve = function (p, scope) {
+ var parts = p.split('.');
+ return path(parts, scope);
+ };
+ var step = function (o, part) {
+ if (o[part] === undefined || o[part] === null)
+ o[part] = {};
+ return o[part];
+ };
+ var forge = function (parts, target) {
+ var o = target !== undefined ? target : global$12;
+ for (var i = 0; i < parts.length; ++i)
+ o = step(o, parts[i]);
+ return o;
+ };
+ var namespace = function (name, target) {
+ var parts = name.split('.');
+ return forge(parts, target);
+ };
+ var $_a30ijl18gjfuw8wjm = {
+ path: path,
+ resolve: resolve,
+ forge: forge,
+ namespace: namespace
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.dom.TreeWalker',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.TreeWalker');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var unsafe = function (name, scope) {
+ return $_a30ijl18gjfuw8wjm.resolve(name, scope);
+ };
+ var getOrDie = function (name, scope) {
+ var actual = unsafe(name, scope);
+ if (actual === undefined || actual === null)
+ throw name + ' not available on this browser';
+ return actual;
+ };
+ var $_clbxy018fjfuw8wjj = { getOrDie: getOrDie };
+
+ function FileReader () {
+ var f = $_clbxy018fjfuw8wjj.getOrDie('FileReader');
+ return new f();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$13 = tinymce.util.Tools.resolve('tinymce.util.Promise');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.dom.RangeUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.RangeUtils');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var blobToBase64 = function (blob) {
+ return new global$13(function (resolve) {
+ var reader = new FileReader();
+ reader.onloadend = function () {
+ resolve(reader.result.split(',')[1]);
+ };
+ reader.readAsDataURL(blob);
+ });
+ };
+ var $_ajs38u18djfuw8wjf = { blobToBase64: blobToBase64 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Unlink.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var pickFile = function () {
+ return new global$13(function (resolve) {
+ var fileInput;
+ fileInput = document.createElement('input');
+ fileInput.type = 'file';
+ fileInput.style.position = 'fixed';
+ fileInput.style.left = 0;
+ fileInput.style.top = 0;
+ fileInput.style.opacity = 0.001;
+ document.body.appendChild(fileInput);
+ fileInput.onchange = function (e) {
+ resolve(Array.prototype.slice.call(e.target.files));
+ };
+ fileInput.click();
+ fileInput.parentNode.removeChild(fileInput);
+ });
+ };
+ var $_4b877v18jjfuw8wjp = { pickFile: pickFile };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Unlink implementation that doesn't leave partial links for example it would produce:
- * a[b<a href="x">c]d</a>e -> a[bc]de
- * instead of:
- * a[b<a href="x">c]d</a>e -> a[bc]<a href="x">d</a>e
- */
-define(
- "tinymce.themes.inlite.alien.Unlink",
- [
- 'tinymce.themes.inlite.alien.Bookmark',
- 'tinymce.core.util.Tools',
- 'tinymce.core.dom.TreeWalker',
- 'tinymce.core.dom.RangeUtils'
- ],
- function (Bookmark, Tools, TreeWalker, RangeUtils) {
- var getSelectedElements = function (rootElm, startNode, endNode) {
- var walker, node, elms = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var count$1 = 0;
+ var seed = function () {
+ var rnd = function () {
+ return Math.round(Math.random() * 4294967295).toString(36);
+ };
+ return 's' + Date.now().toString(36) + rnd() + rnd() + rnd();
+ };
+ var uuid = function (prefix) {
+ return prefix + count$1++ + seed();
+ };
+ var $_ex7l8618ljfuw8wjt = { uuid: uuid };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- walker = new TreeWalker(startNode, rootElm);
- for (node = startNode; node; node = walker.next()) {
- if (node.nodeType === 1) {
- elms.push(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var create$1 = function (dom, rng) {
+ var bookmark = {};
+ function setupEndPoint(start) {
+ var offsetNode, container, offset;
+ container = rng[start ? 'startContainer' : 'endContainer'];
+ offset = rng[start ? 'startOffset' : 'endOffset'];
+ if (container.nodeType === 1) {
+ offsetNode = dom.create('span', { 'data-mce-type': 'bookmark' });
+ if (container.hasChildNodes()) {
+ offset = Math.min(offset, container.childNodes.length - 1);
+ if (start) {
+ container.insertBefore(offsetNode, container.childNodes[offset]);
+ } else {
+ dom.insertAfter(offsetNode, container.childNodes[offset]);
+ }
+ } else {
+ container.appendChild(offsetNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (node === endNode) {
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = offsetNode;
+ offset = 0;
+ }
+ bookmark[start ? 'startContainer' : 'endContainer'] = container;
+ bookmark[start ? 'startOffset' : 'endOffset'] = offset;
+ }
+ setupEndPoint(true);
+ if (!rng.collapsed) {
+ setupEndPoint();
+ }
+ return bookmark;
+ };
+ var resolve$1 = function (dom, bookmark) {
+ function restoreEndPoint(start) {
+ var container, offset, node;
+ function nodeIndex(container) {
+ var node = container.parentNode.firstChild, idx = 0;
+ while (node) {
+ if (node === container) {
+ return idx;
+ }
+ if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') {
+ idx++;
+ }
+ node = node.nextSibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return -1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = node = bookmark[start ? 'startContainer' : 'endContainer'];
+ offset = bookmark[start ? 'startOffset' : 'endOffset'];
+ if (!container) {
+ return;
+ }
+ if (container.nodeType === 1) {
+ offset = nodeIndex(container);
+ container = container.parentNode;
+ dom.remove(node);
+ }
+ bookmark[start ? 'startContainer' : 'endContainer'] = container;
+ bookmark[start ? 'startOffset' : 'endOffset'] = offset;
+ }
+ restoreEndPoint(true);
+ restoreEndPoint();
+ var rng = dom.createRng();
+ rng.setStart(bookmark.startContainer, bookmark.startOffset);
+ if (bookmark.endContainer) {
+ rng.setEnd(bookmark.endContainer, bookmark.endOffset);
+ }
+ return rng;
+ };
+ var $_8jsybd18njfuw8wjw = {
+ create: create$1,
+ resolve: resolve$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return elms;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$14 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var unwrapElements = function (editor, elms) {
- var bookmark, dom, selection;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$15 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- dom = editor.dom;
- selection = editor.selection;
- bookmark = Bookmark.create(dom, selection.getRng());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getSelectedElements = function (rootElm, startNode, endNode) {
+ var walker, node;
+ var elms = [];
+ walker = new global$14(startNode, rootElm);
+ for (node = startNode; node; node = walker.next()) {
+ if (node.nodeType === 1) {
+ elms.push(node);
+ }
+ if (node === endNode) {
+ break;
+ }
+ }
+ return elms;
+ };
+ var unwrapElements = function (editor, elms) {
+ var bookmark, dom, selection;
+ dom = editor.dom;
+ selection = editor.selection;
+ bookmark = $_8jsybd18njfuw8wjw.create(dom, selection.getRng());
+ global$4.each(elms, function (elm) {
+ editor.dom.remove(elm, true);
+ });
+ selection.setRng($_8jsybd18njfuw8wjw.resolve(dom, bookmark));
+ };
+ var isLink = function (elm) {
+ return elm.nodeName === 'A' && elm.hasAttribute('href');
+ };
+ var getParentAnchorOrSelf = function (dom, elm) {
+ var anchorElm = dom.getParent(elm, isLink);
+ return anchorElm ? anchorElm : elm;
+ };
+ var getSelectedAnchors = function (editor) {
+ var startElm, endElm, rootElm, anchorElms, selection, dom, rng;
+ selection = editor.selection;
+ dom = editor.dom;
+ rng = selection.getRng();
+ startElm = getParentAnchorOrSelf(dom, global$15.getNode(rng.startContainer, rng.startOffset));
+ endElm = global$15.getNode(rng.endContainer, rng.endOffset);
+ rootElm = editor.getBody();
+ anchorElms = global$4.grep(getSelectedElements(rootElm, startElm, endElm), isLink);
+ return anchorElms;
+ };
+ var unlinkSelection = function (editor) {
+ unwrapElements(editor, getSelectedAnchors(editor));
+ };
+ var $_1tu4nv18mjfuw8wju = { unlinkSelection: unlinkSelection };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Tools.each(elms, function (elm) {
- editor.dom.remove(elm, true);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createTableHtml = function (cols, rows) {
+ var x, y, html;
+ html = '<table data-mce-id="mce" style="width: 100%">';
+ html += '<tbody>';
+ for (y = 0; y < rows; y++) {
+ html += '<tr>';
+ for (x = 0; x < cols; x++) {
+ html += '<td><br></td>';
+ }
+ html += '</tr>';
+ }
+ html += '</tbody>';
+ html += '</table>';
+ return html;
+ };
+ var getInsertedElement = function (editor) {
+ var elms = editor.dom.select('*[data-mce-id]');
+ return elms[0];
+ };
+ var insertTableHtml = function (editor, cols, rows) {
+ editor.undoManager.transact(function () {
+ var tableElm, cellElm;
+ editor.insertContent(createTableHtml(cols, rows));
+ tableElm = getInsertedElement(editor);
+ tableElm.removeAttribute('data-mce-id');
+ cellElm = editor.dom.select('td,th', tableElm);
+ editor.selection.setCursorLocation(cellElm[0], 0);
+ });
+ };
+ var insertTable = function (editor, cols, rows) {
+ editor.plugins.table ? editor.plugins.table.insertTable(cols, rows) : insertTableHtml(editor, cols, rows);
+ };
+ var formatBlock = function (editor, formatName) {
+ editor.execCommand('FormatBlock', false, formatName);
+ };
+ var insertBlob = function (editor, base64, blob) {
+ var blobCache, blobInfo;
+ blobCache = editor.editorUpload.blobCache;
+ blobInfo = blobCache.create($_ex7l8618ljfuw8wjt.uuid('mceu'), blob, base64);
+ blobCache.add(blobInfo);
+ editor.insertContent(editor.dom.createHTML('img', { src: blobInfo.blobUri() }));
+ };
+ var collapseSelectionToEnd = function (editor) {
+ editor.selection.collapse(false);
+ };
+ var unlink = function (editor) {
+ editor.focus();
+ $_1tu4nv18mjfuw8wju.unlinkSelection(editor);
+ collapseSelectionToEnd(editor);
+ };
+ var changeHref = function (editor, elm, url) {
+ editor.focus();
+ editor.dom.setAttrib(elm, 'href', url);
+ collapseSelectionToEnd(editor);
+ };
+ var insertLink = function (editor, url) {
+ editor.execCommand('mceInsertLink', false, { href: url });
+ collapseSelectionToEnd(editor);
+ };
+ var updateOrInsertLink = function (editor, url) {
+ var elm = editor.dom.getParent(editor.selection.getStart(), 'a[href]');
+ elm ? changeHref(editor, elm, url) : insertLink(editor, url);
+ };
+ var createLink = function (editor, url) {
+ url.trim().length === 0 ? unlink(editor) : updateOrInsertLink(editor, url);
+ };
+ var $_bjueuw18kjfuw8wjq = {
+ insertTable: insertTable,
+ formatBlock: formatBlock,
+ insertBlob: insertBlob,
+ createLink: createLink,
+ unlink: unlink
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- selection.setRng(Bookmark.resolve(dom, bookmark));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addHeaderButtons = function (editor) {
+ var formatBlock = function (name) {
+ return function () {
+ $_bjueuw18kjfuw8wjq.formatBlock(editor, name);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (var i = 1; i < 6; i++) {
+ var name_1 = 'h' + i;
+ editor.addButton(name_1, {
+ text: name_1.toUpperCase(),
+ tooltip: 'Heading ' + i,
+ stateSelector: name_1,
+ onclick: formatBlock(name_1),
+ onPostRender: function () {
+ var span = this.getEl().firstChild.firstChild;
+ span.style.fontWeight = 'bold';
+ }
+ });
+ }
+ };
+ var addToEditor = function (editor, panel) {
+ editor.addButton('quicklink', {
+ icon: 'link',
+ tooltip: 'Insert/Edit link',
+ stateSelector: 'a[href]',
+ onclick: function () {
+ panel.showForm(editor, 'quicklink');
+ }
+ });
+ editor.addButton('quickimage', {
+ icon: 'image',
+ tooltip: 'Insert image',
+ onclick: function () {
+ $_4b877v18jjfuw8wjp.pickFile().then(function (files) {
+ var blob = files[0];
+ $_ajs38u18djfuw8wjf.blobToBase64(blob).then(function (base64) {
+ $_bjueuw18kjfuw8wjq.insertBlob(editor, base64, blob);
+ });
+ });
+ }
+ });
+ editor.addButton('quicktable', {
+ icon: 'table',
+ tooltip: 'Insert table',
+ onclick: function () {
+ panel.hide();
+ $_bjueuw18kjfuw8wjq.insertTable(editor, 2, 2);
+ }
+ });
+ addHeaderButtons(editor);
+ };
+ var $_cb0m4418cjfuw8wiy = { addToEditor: addToEditor };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isLink = function (elm) {
- return elm.nodeName === 'A' && elm.hasAttribute('href');
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getUiContainerDelta$1 = function () {
+ var uiContainer = global$1.container;
+ if (uiContainer && global$2.DOM.getStyle(uiContainer, 'position', true) !== 'static') {
+ var containerPos = global$2.DOM.getPos(uiContainer);
+ var dx = containerPos.x - uiContainer.scrollLeft;
+ var dy = containerPos.y - uiContainer.scrollTop;
+ return Option.some({
+ x: dx,
+ y: dy
+ });
+ } else {
+ return Option.none();
+ }
+ };
+ var $_1lziwq18rjfuw8wk4 = { getUiContainerDelta: getUiContainerDelta$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getParentAnchorOrSelf = function (dom, elm) {
- var anchorElm = dom.getParent(elm, isLink);
- return anchorElm ? anchorElm : elm;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isDomainLike = function (href) {
+ return /^www\.|\.(com|org|edu|gov|uk|net|ca|de|jp|fr|au|us|ru|ch|it|nl|se|no|es|mil)$/i.test(href.trim());
+ };
+ var isAbsolute = function (href) {
+ return /^https?:\/\//.test(href.trim());
+ };
+ var $_7ouuxp18tjfuw8wkn = {
+ isDomainLike: isDomainLike,
+ isAbsolute: isAbsolute
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getSelectedAnchors = function (editor) {
- var startElm, endElm, rootElm, anchorElms, selection, dom, rng;
-
- selection = editor.selection;
- dom = editor.dom;
- rng = selection.getRng();
- startElm = getParentAnchorOrSelf(dom, RangeUtils.getNode(rng.startContainer, rng.startOffset));
- endElm = RangeUtils.getNode(rng.endContainer, rng.endOffset);
- rootElm = editor.getBody();
- anchorElms = Tools.grep(getSelectedElements(rootElm, startElm, endElm), isLink);
-
- return anchorElms;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var focusFirstTextBox = function (form) {
+ form.find('textbox').eq(0).each(function (ctrl) {
+ ctrl.focus();
+ });
+ };
+ var createForm = function (name, spec) {
+ var form = global$11.create(global$4.extend({
+ type: 'form',
+ layout: 'flex',
+ direction: 'row',
+ padding: 5,
+ name: name,
+ spacing: 3
+ }, spec));
+ form.on('show', function () {
+ focusFirstTextBox(form);
+ });
+ return form;
+ };
+ var toggleVisibility = function (ctrl, state) {
+ return state ? ctrl.show() : ctrl.hide();
+ };
+ var askAboutPrefix = function (editor, href) {
+ return new global$13(function (resolve) {
+ editor.windowManager.confirm('The URL you entered seems to be an external link. Do you want to add the required http:// prefix?', function (result) {
+ var output = result === true ? 'http://' + href : href;
+ resolve(output);
+ });
+ });
+ };
+ var convertLinkToAbsolute = function (editor, href) {
+ return !$_7ouuxp18tjfuw8wkn.isAbsolute(href) && $_7ouuxp18tjfuw8wkn.isDomainLike(href) ? askAboutPrefix(editor, href) : global$13.resolve(href);
+ };
+ var createQuickLinkForm = function (editor, hide) {
+ var attachState = {};
+ var unlink = function () {
+ editor.focus();
+ $_bjueuw18kjfuw8wjq.unlink(editor);
+ hide();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var unlinkSelection = function (editor) {
- unwrapElements(editor, getSelectedAnchors(editor));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var onChangeHandler = function (e) {
+ var meta = e.meta;
+ if (meta && meta.attach) {
+ attachState = {
+ href: this.value(),
+ attach: meta.attach
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- unlinkSelection: unlinkSelection
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var onShowHandler = function (e) {
+ if (e.control === this) {
+ var elm = void 0, linkurl = '';
+ elm = editor.dom.getParent(editor.selection.getStart(), 'a[href]');
+ if (elm) {
+ linkurl = editor.dom.getAttrib(elm, 'href');
+ }
+ this.fromJSON({ linkurl: linkurl });
+ toggleVisibility(this.find('#unlink'), elm);
+ this.find('#linkurl')[0].focus();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Actions.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.core.Actions',
- [
- 'tinymce.themes.inlite.alien.Uuid',
- 'tinymce.themes.inlite.alien.Unlink'
- ],
- function (Uuid, Unlink) {
- var createTableHtml = function (cols, rows) {
- var x, y, html;
-
- html = '<table data-mce-id="mce" style="width: 100%">';
- html += '<tbody>';
-
- for (y = 0; y < rows; y++) {
- html += '<tr>';
-
- for (x = 0; x < cols; x++) {
- html += '<td><br></td>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return createForm('quicklink', {
+ items: [
+ {
+ type: 'button',
+ name: 'unlink',
+ icon: 'unlink',
+ onclick: unlink,
+ tooltip: 'Remove link'
+ },
+ {
+ type: 'filepicker',
+ name: 'linkurl',
+ placeholder: 'Paste or type a link',
+ filetype: 'file',
+ onchange: onChangeHandler
+ },
+ {
+ type: 'button',
+ icon: 'checkmark',
+ subtype: 'primary',
+ tooltip: 'Ok',
+ onclick: 'submit'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- html += '</tr>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ],
+ onshow: onShowHandler,
+ onsubmit: function (e) {
+ convertLinkToAbsolute(editor, e.data.linkurl).then(function (url) {
+ editor.undoManager.transact(function () {
+ if (url === attachState.href) {
+ attachState.attach();
+ attachState = {};
+ }
+ $_bjueuw18kjfuw8wjq.createLink(editor, url);
+ });
+ hide();
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var $_8xajew18sjfuw8wkl = { createQuickLinkForm: createQuickLinkForm };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- html += '</tbody>';
- html += '</table>';
-
- return html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getSelectorStateResult = function (itemName, item) {
+ var result = function (selector, handler) {
+ return {
+ selector: selector,
+ handler: handler
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getInsertedElement = function (editor) {
- var elms = editor.dom.select('*[data-mce-id]');
- return elms[0];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var activeHandler = function (state) {
+ item.active(state);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var disabledHandler = function (state) {
+ item.disabled(state);
+ };
+ if (item.settings.stateSelector) {
+ return result(item.settings.stateSelector, activeHandler);
+ }
+ if (item.settings.disabledStateSelector) {
+ return result(item.settings.disabledStateSelector, disabledHandler);
+ }
+ return null;
+ };
+ var bindSelectorChanged = function (editor, itemName, item) {
+ return function () {
+ var result = getSelectorStateResult(itemName, item);
+ if (result !== null) {
+ editor.selection.selectorChanged(result.selector, result.handler);
+ }
+ };
+ };
+ var itemsToArray$1 = function (items) {
+ if ($_8t6wb917ajfuw8wec.isArray(items)) {
+ return items;
+ } else if ($_8t6wb917ajfuw8wec.isString(items)) {
+ return items.split(/[ ,]/);
+ }
+ return [];
+ };
+ var create$2 = function (editor, name, items) {
+ var toolbarItems = [];
+ var buttonGroup;
+ if (!items) {
+ return;
+ }
+ global$4.each(itemsToArray$1(items), function (item) {
+ if (item === '|') {
+ buttonGroup = null;
+ } else {
+ if (editor.buttons[item]) {
+ if (!buttonGroup) {
+ buttonGroup = {
+ type: 'buttongroup',
+ items: []
+ };
+ toolbarItems.push(buttonGroup);
+ }
+ var button = editor.buttons[item];
+ if ($_8t6wb917ajfuw8wec.isFunction(button)) {
+ button = button();
+ }
+ button.type = button.type || 'button';
+ button = global$11.create(button);
+ button.on('postRender', bindSelectorChanged(editor, item, button));
+ buttonGroup.items.push(button);
+ }
+ }
+ });
+ return global$11.create({
+ type: 'toolbar',
+ layout: 'flow',
+ name: name,
+ items: toolbarItems
+ });
+ };
+ var $_8elil818ujfuw8wko = { create: create$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var insertTable = function (editor, cols, rows) {
- editor.undoManager.transact(function () {
- var tableElm, cellElm;
-
- editor.insertContent(createTableHtml(cols, rows));
-
- tableElm = getInsertedElement(editor);
- tableElm.removeAttribute('data-mce-id');
- cellElm = editor.dom.select('td,th', tableElm);
- editor.selection.setCursorLocation(cellElm[0], 0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var create$3 = function () {
+ var panel, currentRect;
+ var createToolbars = function (editor, toolbars) {
+ return global$4.map(toolbars, function (toolbar) {
+ return $_8elil818ujfuw8wko.create(editor, toolbar.id, toolbar.items);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var formatBlock = function (editor, formatName) {
- editor.execCommand('FormatBlock', false, formatName);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasToolbarItems = function (toolbar) {
+ return toolbar.items().length > 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var insertBlob = function (editor, base64, blob) {
- var blobCache, blobInfo;
-
- blobCache = editor.editorUpload.blobCache;
- blobInfo = blobCache.create(Uuid.uuid('mceu'), blob, base64);
- blobCache.add(blobInfo);
-
- editor.insertContent(editor.dom.createHTML('img', { src: blobInfo.blobUri() }));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var create = function (editor, toolbars) {
+ var items = createToolbars(editor, toolbars).concat([
+ $_8elil818ujfuw8wko.create(editor, 'text', $_44ho17177jfuw8we6.getTextSelectionToolbarItems(editor)),
+ $_8elil818ujfuw8wko.create(editor, 'insert', $_44ho17177jfuw8we6.getInsertToolbarItems(editor)),
+ $_8xajew18sjfuw8wkl.createQuickLinkForm(editor, hide)
+ ]);
+ return global$11.create({
+ type: 'floatpanel',
+ role: 'dialog',
+ classes: 'tinymce tinymce-inline arrow',
+ ariaLabel: 'Inline toolbar',
+ layout: 'flex',
+ direction: 'column',
+ align: 'stretch',
+ autohide: false,
+ autofix: true,
+ fixed: true,
+ border: 1,
+ items: global$4.grep(items, hasToolbarItems),
+ oncancel: function () {
+ editor.focus();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var collapseSelectionToEnd = function (editor) {
- editor.selection.collapse(false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var showPanel = function (panel) {
+ if (panel) {
+ panel.show();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var unlink = function (editor) {
- editor.focus();
- Unlink.unlinkSelection(editor);
- collapseSelectionToEnd(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var movePanelTo = function (panel, pos) {
+ panel.moveTo(pos.x, pos.y);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var changeHref = function (editor, elm, url) {
- editor.focus();
- editor.dom.setAttrib(elm, 'href', url);
- collapseSelectionToEnd(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var togglePositionClass = function (panel, relPos) {
+ relPos = relPos ? relPos.substr(0, 2) : '';
+ global$4.each({
+ t: 'down',
+ b: 'up',
+ c: 'center'
+ }, function (cls, pos) {
+ panel.classes.toggle('arrow-' + cls, pos === relPos.substr(0, 1));
+ });
+ if (relPos === 'cr') {
+ panel.classes.toggle('arrow-left', true);
+ panel.classes.toggle('arrow-right', false);
+ } else if (relPos === 'cl') {
+ panel.classes.toggle('arrow-left', true);
+ panel.classes.toggle('arrow-right', true);
+ } else {
+ global$4.each({
+ l: 'left',
+ r: 'right'
+ }, function (cls, pos) {
+ panel.classes.toggle('arrow-' + cls, pos === relPos.substr(1, 1));
+ });
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var insertLink = function (editor, url) {
- editor.execCommand('mceInsertLink', false, { href: url });
- collapseSelectionToEnd(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var showToolbar = function (panel, id) {
+ var toolbars = panel.items().filter('#' + id);
+ if (toolbars.length > 0) {
+ toolbars[0].show();
+ panel.reflow();
+ return true;
+ }
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var updateOrInsertLink = function (editor, url) {
- var elm = editor.dom.getParent(editor.selection.getStart(), 'a[href]');
- elm ? changeHref(editor, elm, url) : insertLink(editor, url);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var repositionPanelAt = function (panel, id, editor, targetRect) {
+ var contentAreaRect, panelRect, result, userConstainHandler;
+ userConstainHandler = $_44ho17177jfuw8we6.getPositionHandler(editor);
+ contentAreaRect = $_eiro29170jfuw8wdy.getContentAreaRect(editor);
+ panelRect = global$2.DOM.getRect(panel.getEl());
+ if (id === 'insert') {
+ result = $_4f0zwc17bjfuw8wee.calcInsert(targetRect, contentAreaRect, panelRect);
+ } else {
+ result = $_4f0zwc17bjfuw8wee.calc(targetRect, contentAreaRect, panelRect);
+ }
+ if (result) {
+ var delta = $_1lziwq18rjfuw8wk4.getUiContainerDelta().getOr({
+ x: 0,
+ y: 0
+ });
+ var transposedPanelRect = {
+ x: result.rect.x - delta.x,
+ y: result.rect.y - delta.y,
+ w: result.rect.w,
+ h: result.rect.h
+ };
+ currentRect = targetRect;
+ movePanelTo(panel, $_4f0zwc17bjfuw8wee.userConstrain(userConstainHandler, targetRect, contentAreaRect, transposedPanelRect));
+ togglePositionClass(panel, result.position);
+ return true;
+ } else {
+ return false;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var createLink = function (editor, url) {
- url.trim().length === 0 ? unlink(editor) : updateOrInsertLink(editor, url);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var showPanelAt = function (panel, id, editor, targetRect) {
+ showPanel(panel);
+ panel.items().hide();
+ if (!showToolbar(panel, id)) {
+ hide();
+ return;
+ }
+ if (repositionPanelAt(panel, id, editor, targetRect) === false) {
+ hide();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- insertTable: insertTable,
- formatBlock: formatBlock,
- insertBlob: insertBlob,
- createLink: createLink,
- unlink: unlink
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasFormVisible = function () {
+ return panel.items().filter('form:visible').length > 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * UrlType.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.core.UrlType',
- [
- ],
- function () {
- var isDomainLike = function (href) {
- return /^www\.|\.(com|org|edu|gov|uk|net|ca|de|jp|fr|au|us|ru|ch|it|nl|se|no|es|mil)$/i.test(href.trim());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var showForm = function (editor, id) {
+ if (panel) {
+ panel.items().hide();
+ if (!showToolbar(panel, id)) {
+ hide();
+ return;
+ }
+ var contentAreaRect = void 0, panelRect = void 0, result = void 0, userConstainHandler = void 0;
+ showPanel(panel);
+ panel.items().hide();
+ showToolbar(panel, id);
+ userConstainHandler = $_44ho17177jfuw8we6.getPositionHandler(editor);
+ contentAreaRect = $_eiro29170jfuw8wdy.getContentAreaRect(editor);
+ panelRect = global$2.DOM.getRect(panel.getEl());
+ result = $_4f0zwc17bjfuw8wee.calc(currentRect, contentAreaRect, panelRect);
+ if (result) {
+ panelRect = result.rect;
+ movePanelTo(panel, $_4f0zwc17bjfuw8wee.userConstrain(userConstainHandler, currentRect, contentAreaRect, panelRect));
+ togglePositionClass(panel, result.position);
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isAbsolute = function (href) {
- return /^https?:\/\//.test(href.trim());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var show = function (editor, id, targetRect, toolbars) {
+ if (!panel) {
+ $_5f627b176jfuw8we5.fireBeforeRenderUI(editor);
+ panel = create(editor, toolbars);
+ panel.renderTo().reflow().moveTo(targetRect.x, targetRect.y);
+ editor.nodeChanged();
+ }
+ showPanelAt(panel, id, editor, targetRect);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var reposition = function (editor, id, targetRect) {
+ if (panel) {
+ repositionPanelAt(panel, id, editor, targetRect);
+ }
+ };
+ var hide = function () {
+ if (panel) {
+ panel.hide();
+ }
+ };
+ var focus = function () {
+ if (panel) {
+ panel.find('toolbar:visible').eq(0).each(function (item) {
+ item.focus(true);
+ });
+ }
+ };
+ var remove = function () {
+ if (panel) {
+ panel.remove();
+ panel = null;
+ }
+ };
+ var inForm = function () {
+ return panel && panel.visible() && hasFormVisible();
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- isDomainLike: isDomainLike,
- isAbsolute: isAbsolute
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ show: show,
+ showForm: showForm,
+ reposition: reposition,
+ inForm: inForm,
+ hide: hide,
+ focus: focus,
+ remove: remove
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Layout$1 = global$8.extend({
+ Defaults: {
+ firstControlClass: 'first',
+ lastControlClass: 'last'
+ },
+ init: function (settings) {
+ this.settings = global$4.extend({}, this.Defaults, settings);
+ },
+ preRender: function (container) {
+ container.bodyClasses.add(this.settings.containerClass);
+ },
+ applyClasses: function (items) {
+ var self = this;
+ var settings = self.settings;
+ var firstClass, lastClass, firstItem, lastItem;
+ firstClass = settings.firstControlClass;
+ lastClass = settings.lastControlClass;
+ items.each(function (item) {
+ item.classes.remove(firstClass).remove(lastClass).add(settings.controlClass);
+ if (item.visible()) {
+ if (!firstItem) {
+ firstItem = item;
+ }
+ lastItem = item;
+ }
+ });
+ if (firstItem) {
+ firstItem.classes.add(firstClass);
+ }
+ if (lastItem) {
+ lastItem.classes.add(lastClass);
+ }
+ },
+ renderHtml: function (container) {
+ var self = this;
+ var html = '';
+ self.applyClasses(container.items());
+ container.items().each(function (item) {
+ html += item.renderHtml();
+ });
+ return html;
+ },
+ recalc: function () {
+ },
+ postRender: function () {
+ },
+ isNative: function () {
+ return false;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var AbsoluteLayout = Layout$1.extend({
+ Defaults: {
+ containerClass: 'abs-layout',
+ controlClass: 'abs-layout-item'
+ },
+ recalc: function (container) {
+ container.items().filter(':visible').each(function (ctrl) {
+ var settings = ctrl.settings;
+ ctrl.layoutRect({
+ x: settings.x,
+ y: settings.y,
+ w: settings.w,
+ h: settings.h
+ });
+ if (ctrl.recalc) {
+ ctrl.recalc();
+ }
+ });
+ },
+ renderHtml: function (container) {
+ return '<div id="' + container._id + '-absend" class="' + container.classPrefix + 'abs-end"></div>' + this._super(container);
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Forms.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Button = Widget.extend({
+ Defaults: {
+ classes: 'widget btn',
+ role: 'button'
+ },
+ init: function (settings) {
+ var self = this;
+ var size;
+ self._super(settings);
+ settings = self.settings;
+ size = self.settings.size;
+ self.on('click mousedown', function (e) {
+ e.preventDefault();
+ });
+ self.on('touchstart', function (e) {
+ self.fire('click', e);
+ e.preventDefault();
+ });
+ if (settings.subtype) {
+ self.classes.add(settings.subtype);
+ }
+ if (size) {
+ self.classes.add('btn-' + size);
+ }
+ if (settings.icon) {
+ self.icon(settings.icon);
+ }
+ },
+ icon: function (icon) {
+ if (!arguments.length) {
+ return this.state.get('icon');
+ }
+ this.state.set('icon', icon);
+ return this;
+ },
+ repaint: function () {
+ var btnElm = this.getEl().firstChild;
+ var btnStyle;
+ if (btnElm) {
+ btnStyle = btnElm.style;
+ btnStyle.width = btnStyle.height = '100%';
+ }
+ this._super();
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = self.classPrefix;
+ var icon = self.state.get('icon'), image;
+ var text = self.state.get('text');
+ var textHtml = '';
+ var ariaPressed;
+ var settings = self.settings;
+ image = settings.image;
+ if (image) {
+ icon = 'none';
+ if (typeof image !== 'string') {
+ image = window.getSelection ? image[0] : image[1];
+ }
+ image = ' style="background-image: url(\'' + image + '\')"';
+ } else {
+ image = '';
+ }
+ if (text) {
+ self.classes.add('btn-has-text');
+ textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
+ }
+ icon = icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
+ ariaPressed = typeof settings.active === 'boolean' ? ' aria-pressed="' + settings.active + '"' : '';
+ return '<div id="' + id + '" class="' + self.classes + '" tabindex="-1"' + ariaPressed + '>' + '<button id="' + id + '-button" role="presentation" type="button" tabindex="-1">' + (icon ? '<i class="' + icon + '"' + image + '></i>' : '') + textHtml + '</button>' + '</div>';
+ },
+ bindStates: function () {
+ var self = this, $ = self.$, textCls = self.classPrefix + 'txt';
+ function setButtonText(text) {
+ var $span = $('span.' + textCls, self.getEl());
+ if (text) {
+ if (!$span[0]) {
+ $('button:first', self.getEl()).append('<span class="' + textCls + '"></span>');
+ $span = $('span.' + textCls, self.getEl());
+ }
+ $span.html(self.encode(text));
+ } else {
+ $span.remove();
+ }
+ self.classes.toggle('btn-has-text', !!text);
+ }
+ self.state.on('change:text', function (e) {
+ setButtonText(e.value);
+ });
+ self.state.on('change:icon', function (e) {
+ var icon = e.value;
+ var prefix = self.classPrefix;
+ self.settings.icon = icon;
+ icon = icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
+ var btnElm = self.getEl().firstChild;
+ var iconElm = btnElm.getElementsByTagName('i')[0];
+ if (icon) {
+ if (!iconElm || iconElm !== btnElm.firstChild) {
+ iconElm = document.createElement('i');
+ btnElm.insertBefore(iconElm, btnElm.firstChild);
+ }
+ iconElm.className = icon;
+ } else if (iconElm) {
+ btnElm.removeChild(iconElm);
+ }
+ setButtonText(self.state.get('text'));
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.inlite.ui.Forms',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.ui.Factory',
- 'tinymce.core.util.Promise',
- 'tinymce.themes.inlite.core.Actions',
- 'tinymce.themes.inlite.core.UrlType'
- ],
- function (Tools, Factory, Promise, Actions, UrlType) {
- var focusFirstTextBox = function (form) {
- form.find('textbox').eq(0).each(function (ctrl) {
- ctrl.focus();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var BrowseButton = Button.extend({
+ init: function (settings) {
+ var self = this;
+ settings = global$4.extend({
+ text: 'Browse...',
+ multiple: false,
+ accept: null
+ }, settings);
+ self._super(settings);
+ self.classes.add('browsebutton');
+ if (settings.multiple) {
+ self.classes.add('multiple');
+ }
+ },
+ postRender: function () {
+ var self = this;
+ var input = funcs.create('input', {
+ type: 'file',
+ id: self._id + '-browse',
+ accept: self.settings.accept
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self._super();
+ global$7(input).on('change', function (e) {
+ var files = e.target.files;
+ self.value = function () {
+ if (!files.length) {
+ return null;
+ } else if (self.settings.multiple) {
+ return files;
+ } else {
+ return files[0];
+ }
+ };
+ e.preventDefault();
+ if (files.length) {
+ self.fire('change', e);
+ }
+ });
+ global$7(input).on('click', function (e) {
+ e.stopPropagation();
+ });
+ global$7(self.getEl('button')).on('click', function (e) {
+ e.stopPropagation();
+ input.click();
+ });
+ self.getEl().appendChild(input);
+ },
+ remove: function () {
+ global$7(this.getEl('button')).off();
+ global$7(this.getEl('input')).off();
+ this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var createForm = function (name, spec) {
- var form = Factory.create(
- Tools.extend({
- type: 'form',
- layout: 'flex',
- direction: 'row',
- padding: 5,
- name: name,
- spacing: 3
- }, spec)
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ButtonGroup = Container.extend({
+ Defaults: {
+ defaultType: 'button',
+ role: 'group'
+ },
+ renderHtml: function () {
+ var self = this, layout = self._layout;
+ self.classes.add('btn-group');
+ self.preRender();
+ layout.preRender(self);
+ return '<div id="' + self._id + '" class="' + self.classes + '">' + '<div id="' + self._id + '-body">' + (self.settings.html || '') + layout.renderHtml(self) + '</div>' + '</div>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- form.on('show', function () {
- focusFirstTextBox(form);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Checkbox = Widget.extend({
+ Defaults: {
+ classes: 'checkbox',
+ role: 'checkbox',
+ checked: false
+ },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.on('click mousedown', function (e) {
+ e.preventDefault();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.on('click', function (e) {
+ e.preventDefault();
+ if (!self.disabled()) {
+ self.checked(!self.checked());
+ }
+ });
+ self.checked(self.settings.checked);
+ },
+ checked: function (state) {
+ if (!arguments.length) {
+ return this.state.get('checked');
+ }
+ this.state.set('checked', state);
+ return this;
+ },
+ value: function (state) {
+ if (!arguments.length) {
+ return this.checked();
+ }
+ return this.checked(state);
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = self.classPrefix;
+ return '<div id="' + id + '" class="' + self.classes + '" unselectable="on" aria-labelledby="' + id + '-al" tabindex="-1">' + '<i class="' + prefix + 'ico ' + prefix + 'i-checkbox"></i>' + '<span id="' + id + '-al" class="' + prefix + 'label">' + self.encode(self.state.get('text')) + '</span>' + '</div>';
+ },
+ bindStates: function () {
+ var self = this;
+ function checked(state) {
+ self.classes.toggle('checked', state);
+ self.aria('checked', state);
+ }
+ self.state.on('change:text', function (e) {
+ self.getEl('al').firstChild.data = self.translate(e.value);
+ });
+ self.state.on('change:checked change:value', function (e) {
+ self.fire('change');
+ checked(e.value);
+ });
+ self.state.on('change:icon', function (e) {
+ var icon = e.value;
+ var prefix = self.classPrefix;
+ if (typeof icon === 'undefined') {
+ return self.settings.icon;
+ }
+ self.settings.icon = icon;
+ icon = icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
+ var btnElm = self.getEl().firstChild;
+ var iconElm = btnElm.getElementsByTagName('i')[0];
+ if (icon) {
+ if (!iconElm || iconElm !== btnElm.firstChild) {
+ iconElm = document.createElement('i');
+ btnElm.insertBefore(iconElm, btnElm.firstChild);
+ }
+ iconElm.className = icon;
+ } else if (iconElm) {
+ btnElm.removeChild(iconElm);
+ }
+ });
+ if (self.state.get('checked')) {
+ checked(true);
+ }
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return form;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$16 = tinymce.util.Tools.resolve('tinymce.util.VK');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var toggleVisibility = function (ctrl, state) {
- return state ? ctrl.show() : ctrl.hide();
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ComboBox = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ settings = self.settings;
+ self.classes.add('combobox');
+ self.subinput = true;
+ self.ariaTarget = 'inp';
+ settings.menu = settings.menu || settings.values;
+ if (settings.menu) {
+ settings.icon = 'caret';
+ }
+ self.on('click', function (e) {
+ var elm = e.target;
+ var root = self.getEl();
+ if (!global$7.contains(root, elm) && elm !== root) {
+ return;
+ }
+ while (elm && elm !== root) {
+ if (elm.id && elm.id.indexOf('-open') !== -1) {
+ self.fire('action');
+ if (settings.menu) {
+ self.showMenu();
+ if (e.aria) {
+ self.menu.items()[0].focus();
+ }
+ }
+ }
+ elm = elm.parentNode;
+ }
+ });
+ self.on('keydown', function (e) {
+ var rootControl;
+ if (e.keyCode === 13 && e.target.nodeName === 'INPUT') {
+ e.preventDefault();
+ self.parents().reverse().each(function (ctrl) {
+ if (ctrl.toJSON) {
+ rootControl = ctrl;
+ return false;
+ }
+ });
+ self.fire('submit', { data: rootControl.toJSON() });
+ }
+ });
+ self.on('keyup', function (e) {
+ if (e.target.nodeName === 'INPUT') {
+ var oldValue = self.state.get('value');
+ var newValue = e.target.value;
+ if (newValue !== oldValue) {
+ self.state.set('value', newValue);
+ self.fire('autocomplete', e);
+ }
+ }
+ });
+ self.on('mouseover', function (e) {
+ var tooltip = self.tooltip().moveTo(-65535);
+ if (self.statusLevel() && e.target.className.indexOf(self.classPrefix + 'status') !== -1) {
+ var statusMessage = self.statusMessage() || 'Ok';
+ var rel = tooltip.text(statusMessage).show().testMoveRel(e.target, [
+ 'bc-tc',
+ 'bc-tl',
+ 'bc-tr'
+ ]);
+ tooltip.classes.toggle('tooltip-n', rel === 'bc-tc');
+ tooltip.classes.toggle('tooltip-nw', rel === 'bc-tl');
+ tooltip.classes.toggle('tooltip-ne', rel === 'bc-tr');
+ tooltip.moveRel(e.target, rel);
+ }
+ });
+ },
+ statusLevel: function (value) {
+ if (arguments.length > 0) {
+ this.state.set('statusLevel', value);
+ }
+ return this.state.get('statusLevel');
+ },
+ statusMessage: function (value) {
+ if (arguments.length > 0) {
+ this.state.set('statusMessage', value);
+ }
+ return this.state.get('statusMessage');
+ },
+ showMenu: function () {
+ var self = this;
+ var settings = self.settings;
+ var menu;
+ if (!self.menu) {
+ menu = settings.menu || [];
+ if (menu.length) {
+ menu = {
+ type: 'menu',
+ items: menu
+ };
+ } else {
+ menu.type = menu.type || 'menu';
+ }
+ self.menu = global$11.create(menu).parent(self).renderTo(self.getContainerElm());
+ self.fire('createmenu');
+ self.menu.reflow();
+ self.menu.on('cancel', function (e) {
+ if (e.control === self.menu) {
+ self.focus();
+ }
+ });
+ self.menu.on('show hide', function (e) {
+ e.control.items().each(function (ctrl) {
+ ctrl.active(ctrl.value() === self.value());
+ });
+ }).fire('show');
+ self.menu.on('select', function (e) {
+ self.value(e.control.value());
+ });
+ self.on('focusin', function (e) {
+ if (e.target.tagName.toUpperCase() === 'INPUT') {
+ self.menu.hide();
+ }
+ });
+ self.aria('expanded', true);
+ }
+ self.menu.show();
+ self.menu.layoutRect({ w: self.layoutRect().w });
+ self.menu.moveRel(self.getEl(), self.isRtl() ? [
+ 'br-tr',
+ 'tr-br'
+ ] : [
+ 'bl-tl',
+ 'tl-bl'
+ ]);
+ },
+ focus: function () {
+ this.getEl('inp').focus();
+ },
+ repaint: function () {
+ var self = this, elm = self.getEl(), openElm = self.getEl('open'), rect = self.layoutRect();
+ var width, lineHeight, innerPadding = 0;
+ var inputElm = elm.firstChild;
+ if (self.statusLevel() && self.statusLevel() !== 'none') {
+ innerPadding = parseInt(funcs.getRuntimeStyle(inputElm, 'padding-right'), 10) - parseInt(funcs.getRuntimeStyle(inputElm, 'padding-left'), 10);
+ }
+ if (openElm) {
+ width = rect.w - funcs.getSize(openElm).width - 10;
+ } else {
+ width = rect.w - 10;
+ }
+ var doc = document;
+ if (doc.all && (!doc.documentMode || doc.documentMode <= 8)) {
+ lineHeight = self.layoutRect().h - 2 + 'px';
+ }
+ global$7(inputElm).css({
+ width: width - innerPadding,
+ lineHeight: lineHeight
+ });
+ self._super();
+ return self;
+ },
+ postRender: function () {
+ var self = this;
+ global$7(this.getEl('inp')).on('change', function (e) {
+ self.state.set('value', e.target.value);
+ self.fire('change', e);
+ });
+ return self._super();
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix;
+ var value = self.state.get('value') || '';
+ var icon, text, openBtnHtml = '', extraAttrs = '', statusHtml = '';
+ if ('spellcheck' in settings) {
+ extraAttrs += ' spellcheck="' + settings.spellcheck + '"';
+ }
+ if (settings.maxLength) {
+ extraAttrs += ' maxlength="' + settings.maxLength + '"';
+ }
+ if (settings.size) {
+ extraAttrs += ' size="' + settings.size + '"';
+ }
+ if (settings.subtype) {
+ extraAttrs += ' type="' + settings.subtype + '"';
+ }
+ statusHtml = '<i id="' + id + '-status" class="mce-status mce-ico" style="display: none"></i>';
+ if (self.disabled()) {
+ extraAttrs += ' disabled="disabled"';
+ }
+ icon = settings.icon;
+ if (icon && icon !== 'caret') {
+ icon = prefix + 'ico ' + prefix + 'i-' + settings.icon;
+ }
+ text = self.state.get('text');
+ if (icon || text) {
+ openBtnHtml = '<div id="' + id + '-open" class="' + prefix + 'btn ' + prefix + 'open" tabIndex="-1" role="button">' + '<button id="' + id + '-action" type="button" hidefocus="1" tabindex="-1">' + (icon !== 'caret' ? '<i class="' + icon + '"></i>' : '<i class="' + prefix + 'caret"></i>') + (text ? (icon ? ' ' : '') + text : '') + '</button>' + '</div>';
+ self.classes.add('has-open');
+ }
+ return '<div id="' + id + '" class="' + self.classes + '">' + '<input id="' + id + '-inp" class="' + prefix + 'textbox" value="' + self.encode(value, false) + '" hidefocus="1"' + extraAttrs + ' placeholder="' + self.encode(settings.placeholder) + '" />' + statusHtml + openBtnHtml + '</div>';
+ },
+ value: function (value) {
+ if (arguments.length) {
+ this.state.set('value', value);
+ return this;
+ }
+ if (this.state.get('rendered')) {
+ this.state.set('value', this.getEl('inp').value);
+ }
+ return this.state.get('value');
+ },
+ showAutoComplete: function (items, term) {
+ var self = this;
+ if (items.length === 0) {
+ self.hideMenu();
+ return;
+ }
+ var insert = function (value, title) {
+ return function () {
+ self.fire('selectitem', {
+ title: title,
+ value: value
+ });
+ };
+ };
+ if (self.menu) {
+ self.menu.items().remove();
+ } else {
+ self.menu = global$11.create({
+ type: 'menu',
+ classes: 'combobox-menu',
+ layout: 'flow'
+ }).parent(self).renderTo();
+ }
+ global$4.each(items, function (item) {
+ self.menu.add({
+ text: item.title,
+ url: item.previewUrl,
+ match: term,
+ classes: 'menu-item-ellipsis',
+ onclick: insert(item.value, item.title)
+ });
+ });
+ self.menu.renderNew();
+ self.hideMenu();
+ self.menu.on('cancel', function (e) {
+ if (e.control.parent() === self.menu) {
+ e.stopPropagation();
+ self.focus();
+ self.hideMenu();
+ }
+ });
+ self.menu.on('select', function () {
+ self.focus();
+ });
+ var maxW = self.layoutRect().w;
+ self.menu.layoutRect({
+ w: maxW,
+ minW: 0,
+ maxW: maxW
+ });
+ self.menu.repaint();
+ self.menu.reflow();
+ self.menu.show();
+ self.menu.moveRel(self.getEl(), self.isRtl() ? [
+ 'br-tr',
+ 'tr-br'
+ ] : [
+ 'bl-tl',
+ 'tl-bl'
+ ]);
+ },
+ hideMenu: function () {
+ if (this.menu) {
+ this.menu.hide();
+ }
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:value', function (e) {
+ if (self.getEl('inp').value !== e.value) {
+ self.getEl('inp').value = e.value;
+ }
+ });
+ self.state.on('change:disabled', function (e) {
+ self.getEl('inp').disabled = e.value;
+ });
+ self.state.on('change:statusLevel', function (e) {
+ var statusIconElm = self.getEl('status');
+ var prefix = self.classPrefix, value = e.value;
+ funcs.css(statusIconElm, 'display', value === 'none' ? 'none' : '');
+ funcs.toggleClass(statusIconElm, prefix + 'i-checkmark', value === 'ok');
+ funcs.toggleClass(statusIconElm, prefix + 'i-warning', value === 'warn');
+ funcs.toggleClass(statusIconElm, prefix + 'i-error', value === 'error');
+ self.classes.toggle('has-status', value !== 'none');
+ self.repaint();
+ });
+ funcs.on(self.getEl('status'), 'mouseleave', function () {
+ self.tooltip().hide();
+ });
+ self.on('cancel', function (e) {
+ if (self.menu && self.menu.visible()) {
+ e.stopPropagation();
+ self.hideMenu();
+ }
+ });
+ var focusIdx = function (idx, menu) {
+ if (menu && menu.items().length > 0) {
+ menu.items().eq(idx)[0].focus();
+ }
+ };
+ self.on('keydown', function (e) {
+ var keyCode = e.keyCode;
+ if (e.target.nodeName === 'INPUT') {
+ if (keyCode === global$16.DOWN) {
+ e.preventDefault();
+ self.fire('autocomplete');
+ focusIdx(0, self.menu);
+ } else if (keyCode === global$16.UP) {
+ e.preventDefault();
+ focusIdx(-1, self.menu);
+ }
+ }
+ });
+ return self._super();
+ },
+ remove: function () {
+ global$7(this.getEl('inp')).off();
+ if (this.menu) {
+ this.menu.remove();
+ }
+ this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var askAboutPrefix = function (editor, href) {
- return new Promise(function (resolve) {
- editor.windowManager.confirm(
- 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?',
- function (result) {
- var output = result === true ? 'http://' + href : href;
- resolve(output);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ColorBox = ComboBox.extend({
+ init: function (settings) {
+ var self = this;
+ settings.spellcheck = false;
+ if (settings.onaction) {
+ settings.icon = 'none';
+ }
+ self._super(settings);
+ self.classes.add('colorbox');
+ self.on('change keyup postrender', function () {
+ self.repaintColor(self.value());
+ });
+ },
+ repaintColor: function (value) {
+ var openElm = this.getEl('open');
+ var elm = openElm ? openElm.getElementsByTagName('i')[0] : null;
+ if (elm) {
+ try {
+ elm.style.background = value;
+ } catch (ex) {
+ }
+ }
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:value', function (e) {
+ if (self.state.get('rendered')) {
+ self.repaintColor(e.value);
+ }
+ });
+ return self._super();
+ }
+ });
+
+ var PanelButton = Button.extend({
+ showPanel: function () {
+ var self = this, settings = self.settings;
+ self.classes.add('opened');
+ if (!self.panel) {
+ var panelSettings = settings.panel;
+ if (panelSettings.type) {
+ panelSettings = {
+ layout: 'grid',
+ items: panelSettings
+ };
+ }
+ panelSettings.role = panelSettings.role || 'dialog';
+ panelSettings.popover = true;
+ panelSettings.autohide = true;
+ panelSettings.ariaRoot = true;
+ self.panel = new FloatPanel(panelSettings).on('hide', function () {
+ self.classes.remove('opened');
+ }).on('cancel', function (e) {
+ e.stopPropagation();
+ self.focus();
+ self.hidePanel();
+ }).parent(self).renderTo(self.getContainerElm());
+ self.panel.fire('show');
+ self.panel.reflow();
+ } else {
+ self.panel.show();
+ }
+ var rtlRels = [
+ 'bc-tc',
+ 'bc-tl',
+ 'bc-tr'
+ ];
+ var ltrRels = [
+ 'bc-tc',
+ 'bc-tr',
+ 'bc-tl',
+ 'tc-bc',
+ 'tc-br',
+ 'tc-bl'
+ ];
+ var rel = self.panel.testMoveRel(self.getEl(), settings.popoverAlign || (self.isRtl() ? rtlRels : ltrRels));
+ self.panel.classes.toggle('start', rel.substr(-1) === 'l');
+ self.panel.classes.toggle('end', rel.substr(-1) === 'r');
+ var isTop = rel.substr(0, 1) === 't';
+ self.panel.classes.toggle('bottom', !isTop);
+ self.panel.classes.toggle('top', isTop);
+ self.panel.moveRel(self.getEl(), rel);
+ },
+ hidePanel: function () {
+ var self = this;
+ if (self.panel) {
+ self.panel.hide();
+ }
+ },
+ postRender: function () {
+ var self = this;
+ self.aria('haspopup', true);
+ self.on('click', function (e) {
+ if (e.control === self) {
+ if (self.panel && self.panel.visible()) {
+ self.hidePanel();
+ } else {
+ self.showPanel();
+ self.panel.focus(!!e.aria);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self._super();
+ },
+ remove: function () {
+ if (this.panel) {
+ this.panel.remove();
+ this.panel = null;
+ }
+ return this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var convertLinkToAbsolute = function (editor, href) {
- return !UrlType.isAbsolute(href) && UrlType.isDomainLike(href) ? askAboutPrefix(editor, href) : Promise.resolve(href);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM = global$2.DOM;
+ var ColorButton = PanelButton.extend({
+ init: function (settings) {
+ this._super(settings);
+ this.classes.add('splitbtn');
+ this.classes.add('colorbutton');
+ },
+ color: function (color) {
+ if (color) {
+ this._color = color;
+ this.getEl('preview').style.backgroundColor = color;
+ return this;
+ }
+ return this._color;
+ },
+ resetColor: function () {
+ this._color = null;
+ this.getEl('preview').style.backgroundColor = null;
+ return this;
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = self.classPrefix, text = self.state.get('text');
+ var icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
+ var image = self.settings.image ? ' style="background-image: url(\'' + self.settings.image + '\')"' : '';
+ var textHtml = '';
+ if (text) {
+ self.classes.add('btn-has-text');
+ textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
+ }
+ return '<div id="' + id + '" class="' + self.classes + '" role="button" tabindex="-1" aria-haspopup="true">' + '<button role="presentation" hidefocus="1" type="button" tabindex="-1">' + (icon ? '<i class="' + icon + '"' + image + '></i>' : '') + '<span id="' + id + '-preview" class="' + prefix + 'preview"></span>' + textHtml + '</button>' + '<button type="button" class="' + prefix + 'open" hidefocus="1" tabindex="-1">' + ' <i class="' + prefix + 'caret"></i>' + '</button>' + '</div>';
+ },
+ postRender: function () {
+ var self = this, onClickHandler = self.settings.onclick;
+ self.on('click', function (e) {
+ if (e.aria && e.aria.key === 'down') {
+ return;
+ }
+ if (e.control === self && !DOM.getParent(e.target, '.' + self.classPrefix + 'open')) {
+ e.stopImmediatePropagation();
+ onClickHandler.call(self, e);
+ }
+ });
+ delete self.settings.onclick;
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var createQuickLinkForm = function (editor, hide) {
- var attachState = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$17 = tinymce.util.Tools.resolve('tinymce.util.Color');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var unlink = function () {
- editor.focus();
- Actions.unlink(editor);
- hide();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ColorPicker = Widget.extend({
+ Defaults: { classes: 'widget colorpicker' },
+ init: function (settings) {
+ this._super(settings);
+ },
+ postRender: function () {
+ var self = this;
+ var color = self.color();
+ var hsv, hueRootElm, huePointElm, svRootElm, svPointElm;
+ hueRootElm = self.getEl('h');
+ huePointElm = self.getEl('hp');
+ svRootElm = self.getEl('sv');
+ svPointElm = self.getEl('svp');
+ function getPos(elm, event) {
+ var pos = funcs.getPos(elm);
+ var x, y;
+ x = event.pageX - pos.x;
+ y = event.pageY - pos.y;
+ x = Math.max(0, Math.min(x / elm.clientWidth, 1));
+ y = Math.max(0, Math.min(y / elm.clientHeight, 1));
+ return {
+ x: x,
+ y: y
+ };
+ }
+ function updateColor(hsv, hueUpdate) {
+ var hue = (360 - hsv.h) / 360;
+ funcs.css(huePointElm, { top: hue * 100 + '%' });
+ if (!hueUpdate) {
+ funcs.css(svPointElm, {
+ left: hsv.s + '%',
+ top: 100 - hsv.v + '%'
+ });
+ }
+ svRootElm.style.background = global$17({
+ s: 100,
+ v: 100,
+ h: hsv.h
+ }).toHex();
+ self.color().parse({
+ s: hsv.s,
+ v: hsv.v,
+ h: hsv.h
+ });
+ }
+ function updateSaturationAndValue(e) {
+ var pos;
+ pos = getPos(svRootElm, e);
+ hsv.s = pos.x * 100;
+ hsv.v = (1 - pos.y) * 100;
+ updateColor(hsv);
+ self.fire('change');
+ }
+ function updateHue(e) {
+ var pos;
+ pos = getPos(hueRootElm, e);
+ hsv = color.toHsv();
+ hsv.h = (1 - pos.y) * 360;
+ updateColor(hsv, true);
+ self.fire('change');
+ }
+ self._repaint = function () {
+ hsv = color.toHsv();
+ updateColor(hsv);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self._super();
+ self._svdraghelper = new DragHelper(self._id + '-sv', {
+ start: updateSaturationAndValue,
+ drag: updateSaturationAndValue
+ });
+ self._hdraghelper = new DragHelper(self._id + '-h', {
+ start: updateHue,
+ drag: updateHue
+ });
+ self._repaint();
+ },
+ rgb: function () {
+ return this.color().toRgb();
+ },
+ value: function (value) {
+ var self = this;
+ if (arguments.length) {
+ self.color().parse(value);
+ if (self._rendered) {
+ self._repaint();
+ }
+ } else {
+ return self.color().toHex();
+ }
+ },
+ color: function () {
+ if (!this._color) {
+ this._color = global$17();
+ }
+ return this._color;
+ },
+ renderHtml: function () {
+ var self = this;
+ var id = self._id;
+ var prefix = self.classPrefix;
+ var hueHtml;
+ var stops = '#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000';
+ function getOldIeFallbackHtml() {
+ var i, l, html = '', gradientPrefix, stopsList;
+ gradientPrefix = 'filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=';
+ stopsList = stops.split(',');
+ for (i = 0, l = stopsList.length - 1; i < l; i++) {
+ html += '<div class="' + prefix + 'colorpicker-h-chunk" style="' + 'height:' + 100 / l + '%;' + gradientPrefix + stopsList[i] + ',endColorstr=' + stopsList[i + 1] + ');' + '-ms-' + gradientPrefix + stopsList[i] + ',endColorstr=' + stopsList[i + 1] + ')' + '"></div>';
+ }
+ return html;
+ }
+ var gradientCssText = 'background: -ms-linear-gradient(top,' + stops + ');' + 'background: linear-gradient(to bottom,' + stops + ');';
+ hueHtml = '<div id="' + id + '-h" class="' + prefix + 'colorpicker-h" style="' + gradientCssText + '">' + getOldIeFallbackHtml() + '<div id="' + id + '-hp" class="' + prefix + 'colorpicker-h-marker"></div>' + '</div>';
+ return '<div id="' + id + '" class="' + self.classes + '">' + '<div id="' + id + '-sv" class="' + prefix + 'colorpicker-sv">' + '<div class="' + prefix + 'colorpicker-overlay1">' + '<div class="' + prefix + 'colorpicker-overlay2">' + '<div id="' + id + '-svp" class="' + prefix + 'colorpicker-selector1">' + '<div class="' + prefix + 'colorpicker-selector2"></div>' + '</div>' + '</div>' + '</div>' + '</div>' + hueHtml + '</div>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var onChangeHandler = function (e) {
- var meta = e.meta;
-
- if (meta && meta.attach) {
- attachState = {
- href: this.value(),
- attach: meta.attach
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DropZone = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ settings = global$4.extend({
+ height: 100,
+ text: 'Drop an image here',
+ multiple: false,
+ accept: null
+ }, settings);
+ self._super(settings);
+ self.classes.add('dropzone');
+ if (settings.multiple) {
+ self.classes.add('multiple');
+ }
+ },
+ renderHtml: function () {
+ var self = this;
+ var attrs, elm;
+ var cfg = self.settings;
+ attrs = {
+ id: self._id,
+ hidefocus: '1'
+ };
+ elm = funcs.create('div', attrs, '<span>' + this.translate(cfg.text) + '</span>');
+ if (cfg.height) {
+ funcs.css(elm, 'height', cfg.height + 'px');
+ }
+ if (cfg.width) {
+ funcs.css(elm, 'width', cfg.width + 'px');
+ }
+ elm.className = self.classes;
+ return elm.outerHTML;
+ },
+ postRender: function () {
+ var self = this;
+ var toggleDragClass = function (e) {
+ e.preventDefault();
+ self.classes.toggle('dragenter');
+ self.getEl().className = self.classes;
+ };
+ var filter = function (files) {
+ var accept = self.settings.accept;
+ if (typeof accept !== 'string') {
+ return files;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var re = new RegExp('(' + accept.split(/\s*,\s*/).join('|') + ')$', 'i');
+ return global$4.grep(files, function (file) {
+ return re.test(file.name);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var onShowHandler = function (e) {
- if (e.control === this) {
- var elm, linkurl = '';
-
- elm = editor.dom.getParent(editor.selection.getStart(), 'a[href]');
- if (elm) {
- linkurl = editor.dom.getAttrib(elm, 'href');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self._super();
+ self.$el.on('dragover', function (e) {
+ e.preventDefault();
+ });
+ self.$el.on('dragenter', toggleDragClass);
+ self.$el.on('dragleave', toggleDragClass);
+ self.$el.on('drop', function (e) {
+ e.preventDefault();
+ if (self.state.get('disabled')) {
+ return;
+ }
+ var files = filter(e.dataTransfer.files);
+ self.value = function () {
+ if (!files.length) {
+ return null;
+ } else if (self.settings.multiple) {
+ return files;
+ } else {
+ return files[0];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (files.length) {
+ self.fire('change', e);
+ }
+ });
+ },
+ remove: function () {
+ this.$el.off();
+ this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- this.fromJSON({
- linkurl: linkurl
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Path = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ if (!settings.delimiter) {
+ settings.delimiter = '\xBB';
+ }
+ self._super(settings);
+ self.classes.add('path');
+ self.canFocus = true;
+ self.on('click', function (e) {
+ var index;
+ var target = e.target;
+ if (index = target.getAttribute('data-index')) {
+ self.fire('select', {
+ value: self.row()[index],
+ index: index
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ self.row(self.settings.row);
+ },
+ focus: function () {
+ var self = this;
+ self.getEl().firstChild.focus();
+ return self;
+ },
+ row: function (row) {
+ if (!arguments.length) {
+ return this.state.get('row');
+ }
+ this.state.set('row', row);
+ return this;
+ },
+ renderHtml: function () {
+ var self = this;
+ return '<div id="' + self._id + '" class="' + self.classes + '">' + self._getDataPathHtml(self.state.get('row')) + '</div>';
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:row', function (e) {
+ self.innerHtml(self._getDataPathHtml(e.value));
+ });
+ return self._super();
+ },
+ _getDataPathHtml: function (data) {
+ var self = this;
+ var parts = data || [];
+ var i, l, html = '';
+ var prefix = self.classPrefix;
+ for (i = 0, l = parts.length; i < l; i++) {
+ html += (i > 0 ? '<div class="' + prefix + 'divider" aria-hidden="true"> ' + self.settings.delimiter + ' </div>' : '') + '<div role="button" class="' + prefix + 'path-item' + (i === l - 1 ? ' ' + prefix + 'last' : '') + '" data-index="' + i + '" tabindex="-1" id="' + self._id + '-' + i + '" aria-level="' + (i + 1) + '">' + parts[i].name + '</div>';
+ }
+ if (!html) {
+ html = '<div class="' + prefix + 'path-item">\xA0</div>';
+ }
+ return html;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- toggleVisibility(this.find('#unlink'), elm);
- this.find('#linkurl')[0].focus();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ElementPath = Path.extend({
+ postRender: function () {
+ var self = this, editor = self.settings.editor;
+ function isHidden(elm) {
+ if (elm.nodeType === 1) {
+ if (elm.nodeName === 'BR' || !!elm.getAttribute('data-mce-bogus')) {
+ return true;
+ }
+ if (elm.getAttribute('data-mce-type') === 'bookmark') {
+ return true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- return createForm('quicklink', {
- items: [
- { type: 'button', name: 'unlink', icon: 'unlink', onclick: unlink, tooltip: 'Remove link' },
- { type: 'filepicker', name: 'linkurl', placeholder: 'Paste or type a link', filetype: 'file', onchange: onChangeHandler },
- { type: 'button', icon: 'checkmark', subtype: 'primary', tooltip: 'Ok', onclick: 'submit' }
- ],
- onshow: onShowHandler,
- onsubmit: function (e) {
- convertLinkToAbsolute(editor, e.data.linkurl).then(function (url) {
- editor.undoManager.transact(function () {
- if (url === attachState.href) {
- attachState.attach();
- attachState = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
+ }
+ if (editor.settings.elementpath !== false) {
+ self.on('select', function (e) {
+ editor.focus();
+ editor.selection.select(this.row()[e.index].element);
+ editor.nodeChanged();
+ });
+ editor.on('nodeChange', function (e) {
+ var outParents = [];
+ var parents = e.parents;
+ var i = parents.length;
+ while (i--) {
+ if (parents[i].nodeType === 1 && !isHidden(parents[i])) {
+ var args = editor.fire('ResolveName', {
+ name: parents[i].nodeName.toLowerCase(),
+ target: parents[i]
+ });
+ if (!args.isDefaultPrevented()) {
+ outParents.push({
+ name: args.name,
+ element: parents[i]
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (args.isPropagationStopped()) {
+ break;
+ }
+ }
+ }
+ self.row(outParents);
+ });
+ }
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Actions.createLink(editor, url);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var FormItem = Container.extend({
+ Defaults: {
+ layout: 'flex',
+ align: 'center',
+ defaults: { flex: 1 }
+ },
+ renderHtml: function () {
+ var self = this, layout = self._layout, prefix = self.classPrefix;
+ self.classes.add('formitem');
+ layout.preRender(self);
+ return '<div id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1">' + (self.settings.title ? '<div id="' + self._id + '-title" class="' + prefix + 'title">' + self.settings.title + '</div>' : '') + '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' + (self.settings.html || '') + layout.renderHtml(self) + '</div>' + '</div>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- hide();
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Form = Container.extend({
+ Defaults: {
+ containerCls: 'form',
+ layout: 'flex',
+ direction: 'column',
+ align: 'stretch',
+ flex: 1,
+ padding: 15,
+ labelGap: 30,
+ spacing: 10,
+ callbacks: {
+ submit: function () {
+ this.submit();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ },
+ preRender: function () {
+ var self = this, items = self.items();
+ if (!self.settings.formItemDefaults) {
+ self.settings.formItemDefaults = {
+ layout: 'flex',
+ autoResize: 'overflow',
+ defaults: { flex: 1 }
+ };
+ }
+ items.each(function (ctrl) {
+ var formItem;
+ var label = ctrl.settings.label;
+ if (label) {
+ formItem = new FormItem(global$4.extend({
+ items: {
+ type: 'label',
+ id: ctrl._id + '-l',
+ text: label,
+ flex: 0,
+ forId: ctrl._id,
+ disabled: ctrl.disabled()
+ }
+ }, self.settings.formItemDefaults));
+ formItem.type = 'formitem';
+ ctrl.aria('labelledby', ctrl._id + '-l');
+ if (typeof ctrl.settings.flex === 'undefined') {
+ ctrl.settings.flex = 1;
+ }
+ self.replace(ctrl, formItem);
+ formItem.add(ctrl);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ submit: function () {
+ return this.fire('submit', { data: this.toJSON() });
+ },
+ postRender: function () {
+ var self = this;
+ self._super();
+ self.fromJSON(self.settings.data);
+ },
+ bindStates: function () {
+ var self = this;
+ self._super();
+ function recalcLabels() {
+ var maxLabelWidth = 0;
+ var labels = [];
+ var i, labelGap, items;
+ if (self.settings.labelGapCalc === false) {
+ return;
+ }
+ if (self.settings.labelGapCalc === 'children') {
+ items = self.find('formitem');
+ } else {
+ items = self.items();
+ }
+ items.filter('formitem').each(function (item) {
+ var labelCtrl = item.items()[0], labelWidth = labelCtrl.getEl().clientWidth;
+ maxLabelWidth = labelWidth > maxLabelWidth ? labelWidth : maxLabelWidth;
+ labels.push(labelCtrl);
+ });
+ labelGap = self.settings.labelGap || 0;
+ i = labels.length;
+ while (i--) {
+ labels[i].settings.minWidth = maxLabelWidth + labelGap;
+ }
+ }
+ self.on('show', recalcLabels);
+ recalcLabels();
+ }
+ });
+
+ var FieldSet = Form.extend({
+ Defaults: {
+ containerCls: 'fieldset',
+ layout: 'flex',
+ direction: 'column',
+ align: 'stretch',
+ flex: 1,
+ padding: '25 15 5 15',
+ labelGap: 30,
+ spacing: 10,
+ border: 1
+ },
+ renderHtml: function () {
+ var self = this, layout = self._layout, prefix = self.classPrefix;
+ self.preRender();
+ layout.preRender(self);
+ return '<fieldset id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1">' + (self.settings.title ? '<legend id="' + self._id + '-title" class="' + prefix + 'fieldset-title">' + self.settings.title + '</legend>' : '') + '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' + (self.settings.html || '') + layout.renderHtml(self) + '</div>' + '</fieldset>';
+ }
+ });
+
+ var unique$1 = 0;
+ var generate = function (prefix) {
+ var date = new Date();
+ var time = date.getTime();
+ var random = Math.floor(Math.random() * 1000000000);
+ unique$1++;
+ return prefix + '_' + random + unique$1 + String(time);
+ };
+ var $_2kv8f219hjfuw8wmw = { generate: generate };
+
+ var fromHtml = function (html, scope) {
+ var doc = scope || document;
+ var div = doc.createElement('div');
+ div.innerHTML = html;
+ if (!div.hasChildNodes() || div.childNodes.length > 1) {
+ console.error('HTML does not have a single root node', html);
+ throw 'HTML must have a single root node';
+ }
+ return fromDom(div.childNodes[0]);
+ };
+ var fromTag = function (tag, scope) {
+ var doc = scope || document;
+ var node = doc.createElement(tag);
+ return fromDom(node);
+ };
+ var fromText = function (text, scope) {
+ var doc = scope || document;
+ var node = doc.createTextNode(text);
+ return fromDom(node);
+ };
+ var fromDom = function (node) {
+ if (node === null || node === undefined)
+ throw new Error('Node cannot be null or undefined');
+ return { dom: $_d9fl1s17gjfuw8wew.constant(node) };
+ };
+ var fromPoint = function (doc, x, y) {
+ return Option.from(doc.dom().elementFromPoint(x, y)).map(fromDom);
+ };
+ var $_fmubbj19ijfuw8wmy = {
+ fromHtml: fromHtml,
+ fromTag: fromTag,
+ fromText: fromText,
+ fromDom: fromDom,
+ fromPoint: fromPoint
+ };
+
+ var cached = function (f) {
+ var called = false;
+ var r;
+ return function () {
+ if (!called) {
+ called = true;
+ r = f.apply(null, arguments);
+ }
+ return r;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_7dlbos19mjfuw8wnb = { cached: cached };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- createQuickLinkForm: createQuickLinkForm
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_8v84g119ojfuw8wnd = {
+ ATTRIBUTE: 2,
+ CDATA_SECTION: 4,
+ COMMENT: 8,
+ DOCUMENT: 9,
+ DOCUMENT_TYPE: 10,
+ DOCUMENT_FRAGMENT: 11,
+ ELEMENT: 1,
+ TEXT: 3,
+ PROCESSING_INSTRUCTION: 7,
+ ENTITY_REFERENCE: 5,
+ ENTITY: 6,
+ NOTATION: 12
+ };
+
+ var name = function (element) {
+ var r = element.dom().nodeName;
+ return r.toLowerCase();
+ };
+ var type = function (element) {
+ return element.dom().nodeType;
+ };
+ var value = function (element) {
+ return element.dom().nodeValue;
+ };
+ var isType$2 = function (t) {
+ return function (element) {
+ return type(element) === t;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isComment = function (element) {
+ return type(element) === $_8v84g119ojfuw8wnd.COMMENT || name(element) === '#comment';
+ };
+ var isElement = isType$2($_8v84g119ojfuw8wnd.ELEMENT);
+ var isText = isType$2($_8v84g119ojfuw8wnd.TEXT);
+ var isDocument = isType$2($_8v84g119ojfuw8wnd.DOCUMENT);
+ var $_a06ojb19njfuw8wnc = {
+ name: name,
+ type: type,
+ value: value,
+ isElement: isElement,
+ isText: isText,
+ isDocument: isDocument,
+ isComment: isComment
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var inBody = function (element) {
+ var dom = $_a06ojb19njfuw8wnc.isText(element) ? element.dom().parentNode : element.dom();
+ return dom !== undefined && dom !== null && dom.ownerDocument.body.contains(dom);
+ };
+ var body = $_7dlbos19mjfuw8wnb.cached(function () {
+ return getBody($_fmubbj19ijfuw8wmy.fromDom(document));
+ });
+ var getBody = function (doc) {
+ var body = doc.dom().body;
+ if (body === null || body === undefined)
+ throw 'Body is not available yet';
+ return $_fmubbj19ijfuw8wmy.fromDom(body);
+ };
+ var $_9dfew519ljfuw8wn8 = {
+ body: body,
+ getBody: getBody,
+ inBody: inBody
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.geom.Rect',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.geom.Rect');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function Immutable () {
+ var fields = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ fields[_i] = arguments[_i];
+ }
+ return function () {
+ var values = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ values[_i] = arguments[_i];
+ }
+ if (fields.length !== values.length) {
+ throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments');
+ }
+ var struct = {};
+ $_1doq1817ejfuw8wen.each(fields, function (name, i) {
+ struct[name] = $_d9fl1s17gjfuw8wew.constant(values[i]);
+ });
+ return struct;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Layout.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.core.Layout',
- [
- 'tinymce.core.geom.Rect',
- 'tinymce.themes.inlite.core.Convert'
- ],
- function (Rect, Convert) {
- var result = function (rect, position) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var keys = function () {
+ var fastKeys = Object.keys;
+ var slowKeys = function (o) {
+ var r = [];
+ for (var i in o) {
+ if (o.hasOwnProperty(i)) {
+ r.push(i);
+ }
+ }
+ return r;
+ };
+ return fastKeys === undefined ? slowKeys : fastKeys;
+ }();
+ var each$1 = function (obj, f) {
+ var props = keys(obj);
+ for (var k = 0, len = props.length; k < len; k++) {
+ var i = props[k];
+ var x = obj[i];
+ f(x, i, obj);
+ }
+ };
+ var objectMap = function (obj, f) {
+ return tupleMap(obj, function (x, i, obj) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rect: rect,
- position: position
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ k: i,
+ v: f(x, i, obj)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var tupleMap = function (obj, f) {
+ var r = {};
+ each$1(obj, function (x, i) {
+ var tuple = f(x, i, obj);
+ r[tuple.k] = tuple.v;
+ });
+ return r;
+ };
+ var bifilter = function (obj, pred) {
+ var t = {};
+ var f = {};
+ each$1(obj, function (x, i) {
+ var branch = pred(x, i) ? t : f;
+ branch[i] = x;
+ });
+ return {
+ t: t,
+ f: f
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var mapToArray = function (obj, f) {
+ var r = [];
+ each$1(obj, function (value, name) {
+ r.push(f(value, name));
+ });
+ return r;
+ };
+ var find$1 = function (obj, pred) {
+ var props = keys(obj);
+ for (var k = 0, len = props.length; k < len; k++) {
+ var i = props[k];
+ var x = obj[i];
+ if (pred(x, i, obj)) {
+ return Option.some(x);
+ }
+ }
+ return Option.none();
+ };
+ var values = function (obj) {
+ return mapToArray(obj, function (v) {
+ return v;
+ });
+ };
+ var size = function (obj) {
+ return values(obj).length;
+ };
+ var $_al3re919tjfuw8wo6 = {
+ bifilter: bifilter,
+ each: each$1,
+ map: objectMap,
+ mapToArray: mapToArray,
+ tupleMap: tupleMap,
+ find: find$1,
+ keys: keys,
+ values: values,
+ size: size
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var moveTo = function (rect, toRect) {
- return { x: toRect.x, y: toRect.y, w: rect.w, h: rect.h };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var sort$1 = function (arr) {
+ return arr.slice(0).sort();
+ };
+ var reqMessage = function (required, keys) {
+ throw new Error('All required keys (' + sort$1(required).join(', ') + ') were not specified. Specified keys were: ' + sort$1(keys).join(', ') + '.');
+ };
+ var unsuppMessage = function (unsupported) {
+ throw new Error('Unsupported keys for object: ' + sort$1(unsupported).join(', '));
+ };
+ var validateStrArr = function (label, array) {
+ if (!$_d02u5u17hjfuw8wey.isArray(array))
+ throw new Error('The ' + label + ' fields must be an array. Was: ' + array + '.');
+ $_1doq1817ejfuw8wen.each(array, function (a) {
+ if (!$_d02u5u17hjfuw8wey.isString(a))
+ throw new Error('The value ' + a + ' in the ' + label + ' fields was not a string.');
+ });
+ };
+ var invalidTypeMessage = function (incorrect, type) {
+ throw new Error('All values need to be of type: ' + type + '. Keys (' + sort$1(incorrect).join(', ') + ') were not.');
+ };
+ var checkDupes = function (everything) {
+ var sorted = sort$1(everything);
+ var dupe = $_1doq1817ejfuw8wen.find(sorted, function (s, i) {
+ return i < sorted.length - 1 && s === sorted[i + 1];
+ });
+ dupe.each(function (d) {
+ throw new Error('The field: ' + d + ' occurs more than once in the combined fields: [' + sorted.join(', ') + '].');
+ });
+ };
+ var $_2f7evl19ujfuw8wo9 = {
+ sort: sort$1,
+ reqMessage: reqMessage,
+ unsuppMessage: unsuppMessage,
+ validateStrArr: validateStrArr,
+ invalidTypeMessage: invalidTypeMessage,
+ checkDupes: checkDupes
+ };
+
+ function MixedBag (required, optional) {
+ var everything = required.concat(optional);
+ if (everything.length === 0)
+ throw new Error('You must specify at least one required or optional field.');
+ $_2f7evl19ujfuw8wo9.validateStrArr('required', required);
+ $_2f7evl19ujfuw8wo9.validateStrArr('optional', optional);
+ $_2f7evl19ujfuw8wo9.checkDupes(everything);
+ return function (obj) {
+ var keys = $_al3re919tjfuw8wo6.keys(obj);
+ var allReqd = $_1doq1817ejfuw8wen.forall(required, function (req) {
+ return $_1doq1817ejfuw8wen.contains(keys, req);
+ });
+ if (!allReqd)
+ $_2f7evl19ujfuw8wo9.reqMessage(required, keys);
+ var unsupported = $_1doq1817ejfuw8wen.filter(keys, function (key) {
+ return !$_1doq1817ejfuw8wen.contains(everything, key);
+ });
+ if (unsupported.length > 0)
+ $_2f7evl19ujfuw8wo9.unsuppMessage(unsupported);
+ var r = {};
+ $_1doq1817ejfuw8wen.each(required, function (req) {
+ r[req] = $_d9fl1s17gjfuw8wew.constant(obj[req]);
+ });
+ $_1doq1817ejfuw8wen.each(optional, function (opt) {
+ r[opt] = $_d9fl1s17gjfuw8wew.constant(Object.prototype.hasOwnProperty.call(obj, opt) ? Option.some(obj[opt]) : Option.none());
+ });
+ return r;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var calcByPositions = function (testPositions1, testPositions2, targetRect, contentAreaRect, panelRect) {
- var relPos, relRect, outputPanelRect;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_f4h5y919qjfuw8wnr = {
+ immutable: Immutable,
+ immutableBag: MixedBag
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var paddedContentRect = {
- x: contentAreaRect.x,
- y: contentAreaRect.y,
- w: contentAreaRect.w + (contentAreaRect.w < (panelRect.w + targetRect.w) ? panelRect.w : 0),
- h: contentAreaRect.h + (contentAreaRect.h < (panelRect.h + targetRect.h) ? panelRect.h : 0)
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toArray = function (target, f) {
+ var r = [];
+ var recurse = function (e) {
+ r.push(e);
+ return f(e);
+ };
+ var cur = f(target);
+ do {
+ cur = cur.bind(recurse);
+ } while (cur.isSome());
+ return r;
+ };
+ var $_alx4av19vjfuw8woa = { toArray: toArray };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- relPos = Rect.findBestRelativePosition(panelRect, targetRect, paddedContentRect, testPositions1);
- targetRect = Rect.clamp(targetRect, paddedContentRect);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var node = function () {
+ var f = $_clbxy018fjfuw8wjj.getOrDie('Node');
+ return f;
+ };
+ var compareDocumentPosition = function (a, b, match) {
+ return (a.compareDocumentPosition(b) & match) !== 0;
+ };
+ var documentPositionPreceding = function (a, b) {
+ return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);
+ };
+ var documentPositionContainedBy = function (a, b) {
+ return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);
+ };
+ var $_8mu6t19xjfuw8wol = {
+ documentPositionPreceding: documentPositionPreceding,
+ documentPositionContainedBy: documentPositionContainedBy
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (relPos) {
- relRect = Rect.relativePosition(panelRect, targetRect, relPos);
- outputPanelRect = moveTo(panelRect, relRect);
- return result(outputPanelRect, relPos);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var firstMatch = function (regexes, s) {
+ for (var i = 0; i < regexes.length; i++) {
+ var x = regexes[i];
+ if (x.test(s))
+ return x;
+ }
+ return undefined;
+ };
+ var find$2 = function (regexes, agent) {
+ var r = firstMatch(regexes, agent);
+ if (!r)
+ return {
+ major: 0,
+ minor: 0
+ };
+ var group = function (i) {
+ return Number(agent.replace(r, '$' + i));
+ };
+ return nu(group(1), group(2));
+ };
+ var detect = function (versionRegexes, agent) {
+ var cleanedAgent = String(agent).toLowerCase();
+ if (versionRegexes.length === 0)
+ return unknown();
+ return find$2(versionRegexes, cleanedAgent);
+ };
+ var unknown = function () {
+ return nu(0, 0);
+ };
+ var nu = function (major, minor) {
+ return {
+ major: major,
+ minor: minor
+ };
+ };
+ var $_g5cbf01a1jfuw8wou = {
+ nu: nu,
+ detect: detect,
+ unknown: unknown
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- targetRect = Rect.intersect(paddedContentRect, targetRect);
- if (targetRect) {
- relPos = Rect.findBestRelativePosition(panelRect, targetRect, paddedContentRect, testPositions2);
-
- if (relPos) {
- relRect = Rect.relativePosition(panelRect, targetRect, relPos);
- outputPanelRect = moveTo(panelRect, relRect);
- return result(outputPanelRect, relPos);
- }
-
- outputPanelRect = moveTo(panelRect, targetRect);
- return result(outputPanelRect, relPos);
- }
-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var edge = 'Edge';
+ var chrome = 'Chrome';
+ var ie = 'IE';
+ var opera = 'Opera';
+ var firefox = 'Firefox';
+ var safari = 'Safari';
+ var isBrowser = function (name, current) {
+ return function () {
+ return current === name;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var unknown$1 = function () {
+ return nu$1({
+ current: undefined,
+ version: $_g5cbf01a1jfuw8wou.unknown()
+ });
+ };
+ var nu$1 = function (info) {
+ var current = info.current;
+ var version = info.version;
+ return {
+ current: current,
+ version: version,
+ isEdge: isBrowser(edge, current),
+ isChrome: isBrowser(chrome, current),
+ isIE: isBrowser(ie, current),
+ isOpera: isBrowser(opera, current),
+ isFirefox: isBrowser(firefox, current),
+ isSafari: isBrowser(safari, current)
+ };
+ };
+ var $_ddjyrg1a0jfuw8wor = {
+ unknown: unknown$1,
+ nu: nu$1,
+ edge: $_d9fl1s17gjfuw8wew.constant(edge),
+ chrome: $_d9fl1s17gjfuw8wew.constant(chrome),
+ ie: $_d9fl1s17gjfuw8wew.constant(ie),
+ opera: $_d9fl1s17gjfuw8wew.constant(opera),
+ firefox: $_d9fl1s17gjfuw8wew.constant(firefox),
+ safari: $_d9fl1s17gjfuw8wew.constant(safari)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var calcInsert = function (targetRect, contentAreaRect, panelRect) {
- return calcByPositions(
- ['cr-cl', 'cl-cr'],
- ['bc-tc', 'bl-tl', 'br-tr'],
- targetRect,
- contentAreaRect,
- panelRect
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var windows$1 = 'Windows';
+ var ios = 'iOS';
+ var android = 'Android';
+ var linux = 'Linux';
+ var osx = 'OSX';
+ var solaris = 'Solaris';
+ var freebsd = 'FreeBSD';
+ var isOS = function (name, current) {
+ return function () {
+ return current === name;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var unknown$2 = function () {
+ return nu$2({
+ current: undefined,
+ version: $_g5cbf01a1jfuw8wou.unknown()
+ });
+ };
+ var nu$2 = function (info) {
+ var current = info.current;
+ var version = info.version;
+ return {
+ current: current,
+ version: version,
+ isWindows: isOS(windows$1, current),
+ isiOS: isOS(ios, current),
+ isAndroid: isOS(android, current),
+ isOSX: isOS(osx, current),
+ isLinux: isOS(linux, current),
+ isSolaris: isOS(solaris, current),
+ isFreeBSD: isOS(freebsd, current)
+ };
+ };
+ var $_2otgg1a2jfuw8wow = {
+ unknown: unknown$2,
+ nu: nu$2,
+ windows: $_d9fl1s17gjfuw8wew.constant(windows$1),
+ ios: $_d9fl1s17gjfuw8wew.constant(ios),
+ android: $_d9fl1s17gjfuw8wew.constant(android),
+ linux: $_d9fl1s17gjfuw8wew.constant(linux),
+ osx: $_d9fl1s17gjfuw8wew.constant(osx),
+ solaris: $_d9fl1s17gjfuw8wew.constant(solaris),
+ freebsd: $_d9fl1s17gjfuw8wew.constant(freebsd)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var calc = function (targetRect, contentAreaRect, panelRect) {
- return calcByPositions(
- ['tc-bc', 'bc-tc', 'tl-bl', 'bl-tl', 'tr-br', 'br-tr', 'cr-cl', 'cl-cr'],
- ['bc-tc', 'bl-tl', 'br-tr', 'cr-cl'],
- targetRect,
- contentAreaRect,
- panelRect
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function DeviceType (os, browser, userAgent) {
+ var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
+ var isiPhone = os.isiOS() && !isiPad;
+ var isAndroid3 = os.isAndroid() && os.version.major === 3;
+ var isAndroid4 = os.isAndroid() && os.version.major === 4;
+ var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true;
+ var isTouch = os.isiOS() || os.isAndroid();
+ var isPhone = isTouch && !isTablet;
+ var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
+ return {
+ isiPad: $_d9fl1s17gjfuw8wew.constant(isiPad),
+ isiPhone: $_d9fl1s17gjfuw8wew.constant(isiPhone),
+ isTablet: $_d9fl1s17gjfuw8wew.constant(isTablet),
+ isPhone: $_d9fl1s17gjfuw8wew.constant(isPhone),
+ isTouch: $_d9fl1s17gjfuw8wew.constant(isTouch),
+ isAndroid: os.isAndroid,
+ isiOS: os.isiOS,
+ isWebView: $_d9fl1s17gjfuw8wew.constant(iOSwebview)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var userConstrain = function (handler, targetRect, contentAreaRect, panelRect) {
- var userConstrainedPanelRect;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var detect$1 = function (candidates, userAgent) {
+ var agent = String(userAgent).toLowerCase();
+ return $_1doq1817ejfuw8wen.find(candidates, function (candidate) {
+ return candidate.search(agent);
+ });
+ };
+ var detectBrowser = function (browsers, userAgent) {
+ return detect$1(browsers, userAgent).map(function (browser) {
+ var version = $_g5cbf01a1jfuw8wou.detect(browser.versionRegexes, userAgent);
+ return {
+ current: browser.name,
+ version: version
+ };
+ });
+ };
+ var detectOs = function (oses, userAgent) {
+ return detect$1(oses, userAgent).map(function (os) {
+ var version = $_g5cbf01a1jfuw8wou.detect(os.versionRegexes, userAgent);
+ return {
+ current: os.name,
+ version: version
+ };
+ });
+ };
+ var $_kiexy1a4jfuw8wp2 = {
+ detectBrowser: detectBrowser,
+ detectOs: detectOs
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (typeof handler === 'function') {
- userConstrainedPanelRect = handler({
- elementRect: Convert.toClientRect(targetRect),
- contentAreaRect: Convert.toClientRect(contentAreaRect),
- panelRect: Convert.toClientRect(panelRect)
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addToStart = function (str, prefix) {
+ return prefix + str;
+ };
+ var addToEnd = function (str, suffix) {
+ return str + suffix;
+ };
+ var removeFromStart = function (str, numChars) {
+ return str.substring(numChars);
+ };
+ var removeFromEnd = function (str, numChars) {
+ return str.substring(0, str.length - numChars);
+ };
+ var $_52l0y51a7jfuw8wpe = {
+ addToStart: addToStart,
+ addToEnd: addToEnd,
+ removeFromStart: removeFromStart,
+ removeFromEnd: removeFromEnd
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Convert.fromClientRect(userConstrainedPanelRect);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var first = function (str, count) {
+ return str.substr(0, count);
+ };
+ var last$1 = function (str, count) {
+ return str.substr(str.length - count, str.length);
+ };
+ var head$1 = function (str) {
+ return str === '' ? Option.none() : Option.some(str.substr(0, 1));
+ };
+ var tail = function (str) {
+ return str === '' ? Option.none() : Option.some(str.substring(1));
+ };
+ var $_7llj9o1a8jfuw8wpf = {
+ first: first,
+ last: last$1,
+ head: head$1,
+ tail: tail
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return panelRect;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var checkRange = function (str, substr, start) {
+ if (substr === '')
+ return true;
+ if (str.length < substr.length)
+ return false;
+ var x = str.substr(start, start + substr.length);
+ return x === substr;
+ };
+ var supplant = function (str, obj) {
+ var isStringOrNumber = function (a) {
+ var t = typeof a;
+ return t === 'string' || t === 'number';
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return str.replace(/\${([^{}]*)}/g, function (a, b) {
+ var value = obj[b];
+ return isStringOrNumber(value) ? value : a;
+ });
+ };
+ var removeLeading = function (str, prefix) {
+ return startsWith(str, prefix) ? $_52l0y51a7jfuw8wpe.removeFromStart(str, prefix.length) : str;
+ };
+ var removeTrailing = function (str, prefix) {
+ return endsWith(str, prefix) ? $_52l0y51a7jfuw8wpe.removeFromEnd(str, prefix.length) : str;
+ };
+ var ensureLeading = function (str, prefix) {
+ return startsWith(str, prefix) ? str : $_52l0y51a7jfuw8wpe.addToStart(str, prefix);
+ };
+ var ensureTrailing = function (str, prefix) {
+ return endsWith(str, prefix) ? str : $_52l0y51a7jfuw8wpe.addToEnd(str, prefix);
+ };
+ var contains$1 = function (str, substr) {
+ return str.indexOf(substr) !== -1;
+ };
+ var capitalize = function (str) {
+ return $_7llj9o1a8jfuw8wpf.head(str).bind(function (head) {
+ return $_7llj9o1a8jfuw8wpf.tail(str).map(function (tail) {
+ return head.toUpperCase() + tail;
+ });
+ }).getOr(str);
+ };
+ var startsWith = function (str, prefix) {
+ return checkRange(str, prefix, 0);
+ };
+ var endsWith = function (str, suffix) {
+ return checkRange(str, suffix, str.length - suffix.length);
+ };
+ var trim = function (str) {
+ return str.replace(/^\s+|\s+$/g, '');
+ };
+ var lTrim = function (str) {
+ return str.replace(/^\s+/g, '');
+ };
+ var rTrim = function (str) {
+ return str.replace(/\s+$/g, '');
+ };
+ var $_1vh2q91a6jfuw8wpc = {
+ supplant: supplant,
+ startsWith: startsWith,
+ removeLeading: removeLeading,
+ removeTrailing: removeTrailing,
+ ensureLeading: ensureLeading,
+ ensureTrailing: ensureTrailing,
+ endsWith: endsWith,
+ contains: contains$1,
+ trim: trim,
+ lTrim: lTrim,
+ rTrim: rTrim,
+ capitalize: capitalize
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var defaultHandler = function (rects) {
- return rects.panelRect;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
+ var checkContains = function (target) {
+ return function (uastring) {
+ return $_1vh2q91a6jfuw8wpc.contains(uastring, target);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var browsers = [
+ {
+ name: 'Edge',
+ versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
+ search: function (uastring) {
+ var monstrosity = $_1vh2q91a6jfuw8wpc.contains(uastring, 'edge/') && $_1vh2q91a6jfuw8wpc.contains(uastring, 'chrome') && $_1vh2q91a6jfuw8wpc.contains(uastring, 'safari') && $_1vh2q91a6jfuw8wpc.contains(uastring, 'applewebkit');
+ return monstrosity;
+ }
+ },
+ {
+ name: 'Chrome',
+ versionRegexes: [
+ /.*?chrome\/([0-9]+)\.([0-9]+).*/,
+ normalVersionRegex
+ ],
+ search: function (uastring) {
+ return $_1vh2q91a6jfuw8wpc.contains(uastring, 'chrome') && !$_1vh2q91a6jfuw8wpc.contains(uastring, 'chromeframe');
+ }
+ },
+ {
+ name: 'IE',
+ versionRegexes: [
+ /.*?msie\ ?([0-9]+)\.([0-9]+).*/,
+ /.*?rv:([0-9]+)\.([0-9]+).*/
+ ],
+ search: function (uastring) {
+ return $_1vh2q91a6jfuw8wpc.contains(uastring, 'msie') || $_1vh2q91a6jfuw8wpc.contains(uastring, 'trident');
+ }
+ },
+ {
+ name: 'Opera',
+ versionRegexes: [
+ normalVersionRegex,
+ /.*?opera\/([0-9]+)\.([0-9]+).*/
+ ],
+ search: checkContains('opera')
+ },
+ {
+ name: 'Firefox',
+ versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
+ search: checkContains('firefox')
+ },
+ {
+ name: 'Safari',
+ versionRegexes: [
+ normalVersionRegex,
+ /.*?cpu os ([0-9]+)_([0-9]+).*/
+ ],
+ search: function (uastring) {
+ return ($_1vh2q91a6jfuw8wpc.contains(uastring, 'safari') || $_1vh2q91a6jfuw8wpc.contains(uastring, 'mobile/')) && $_1vh2q91a6jfuw8wpc.contains(uastring, 'applewebkit');
+ }
+ }
+ ];
+ var oses = [
+ {
+ name: 'Windows',
+ search: checkContains('win'),
+ versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
+ },
+ {
+ name: 'iOS',
+ search: function (uastring) {
+ return $_1vh2q91a6jfuw8wpc.contains(uastring, 'iphone') || $_1vh2q91a6jfuw8wpc.contains(uastring, 'ipad');
+ },
+ versionRegexes: [
+ /.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
+ /.*cpu os ([0-9]+)_([0-9]+).*/,
+ /.*cpu iphone os ([0-9]+)_([0-9]+).*/
+ ]
+ },
+ {
+ name: 'Android',
+ search: checkContains('android'),
+ versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
+ },
+ {
+ name: 'OSX',
+ search: checkContains('os x'),
+ versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]
+ },
+ {
+ name: 'Linux',
+ search: checkContains('linux'),
+ versionRegexes: []
+ },
+ {
+ name: 'Solaris',
+ search: checkContains('sunos'),
+ versionRegexes: []
+ },
+ {
+ name: 'FreeBSD',
+ search: checkContains('freebsd'),
+ versionRegexes: []
+ }
+ ];
+ var $_bavmlr1a5jfuw8wp6 = {
+ browsers: $_d9fl1s17gjfuw8wew.constant(browsers),
+ oses: $_d9fl1s17gjfuw8wew.constant(oses)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var detect$2 = function (userAgent) {
+ var browsers = $_bavmlr1a5jfuw8wp6.browsers();
+ var oses = $_bavmlr1a5jfuw8wp6.oses();
+ var browser = $_kiexy1a4jfuw8wp2.detectBrowser(browsers, userAgent).fold($_ddjyrg1a0jfuw8wor.unknown, $_ddjyrg1a0jfuw8wor.nu);
+ var os = $_kiexy1a4jfuw8wp2.detectOs(oses, userAgent).fold($_2otgg1a2jfuw8wow.unknown, $_2otgg1a2jfuw8wow.nu);
+ var deviceType = DeviceType(os, browser, userAgent);
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- calcInsert: calcInsert,
- calc: calc,
- userConstrain: userConstrain,
- defaultHandler: defaultHandler
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ browser: browser,
+ os: os,
+ deviceType: deviceType
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_5balgb19zjfuw8woq = { detect: detect$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Panel.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var detect$3 = $_7dlbos19mjfuw8wnb.cached(function () {
+ var userAgent = navigator.userAgent;
+ return $_5balgb19zjfuw8woq.detect(userAgent);
+ });
+ var $_44fif19yjfuw8wom = { detect: detect$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.inlite.ui.Panel',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.ui.Factory',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.themes.inlite.ui.Toolbar',
- 'tinymce.themes.inlite.ui.Forms',
- 'tinymce.themes.inlite.core.Measure',
- 'tinymce.themes.inlite.core.Layout',
- 'tinymce.themes.inlite.alien.EditorSettings'
- ],
- function (Tools, Factory, DOMUtils, Toolbar, Forms, Measure, Layout, EditorSettings) {
- return function () {
- var DEFAULT_TEXT_SELECTION_ITEMS = ['bold', 'italic', '|', 'quicklink', 'h2', 'h3', 'blockquote'];
- var DEFAULT_INSERT_TOOLBAR_ITEMS = ['quickimage', 'quicktable'];
- var panel, currentRect;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ELEMENT = $_8v84g119ojfuw8wnd.ELEMENT;
+ var DOCUMENT = $_8v84g119ojfuw8wnd.DOCUMENT;
+ var is = function (element, selector) {
+ var elem = element.dom();
+ if (elem.nodeType !== ELEMENT)
+ return false;
+ else if (elem.matches !== undefined)
+ return elem.matches(selector);
+ else if (elem.msMatchesSelector !== undefined)
+ return elem.msMatchesSelector(selector);
+ else if (elem.webkitMatchesSelector !== undefined)
+ return elem.webkitMatchesSelector(selector);
+ else if (elem.mozMatchesSelector !== undefined)
+ return elem.mozMatchesSelector(selector);
+ else
+ throw new Error('Browser lacks native selectors');
+ };
+ var bypassSelector = function (dom) {
+ return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT || dom.childElementCount === 0;
+ };
+ var all = function (selector, scope) {
+ var base = scope === undefined ? document : scope.dom();
+ return bypassSelector(base) ? [] : $_1doq1817ejfuw8wen.map(base.querySelectorAll(selector), $_fmubbj19ijfuw8wmy.fromDom);
+ };
+ var one = function (selector, scope) {
+ var base = scope === undefined ? document : scope.dom();
+ return bypassSelector(base) ? Option.none() : Option.from(base.querySelector(selector)).map($_fmubbj19ijfuw8wmy.fromDom);
+ };
+ var $_9hz7rv1a9jfuw8wpg = {
+ all: all,
+ is: is,
+ one: one
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var createToolbars = function (editor, toolbars) {
- return Tools.map(toolbars, function (toolbar) {
- return Toolbar.create(editor, toolbar.id, toolbar.items);
- });
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var eq = function (e1, e2) {
+ return e1.dom() === e2.dom();
+ };
+ var isEqualNode = function (e1, e2) {
+ return e1.dom().isEqualNode(e2.dom());
+ };
+ var member = function (element, elements) {
+ return $_1doq1817ejfuw8wen.exists(elements, $_d9fl1s17gjfuw8wew.curry(eq, element));
+ };
+ var regularContains = function (e1, e2) {
+ var d1 = e1.dom(), d2 = e2.dom();
+ return d1 === d2 ? false : d1.contains(d2);
+ };
+ var ieContains = function (e1, e2) {
+ return $_8mu6t19xjfuw8wol.documentPositionContainedBy(e1.dom(), e2.dom());
+ };
+ var browser = $_44fif19yjfuw8wom.detect().browser;
+ var contains$2 = browser.isIE() ? ieContains : regularContains;
+ var $_ab91p919wjfuw8woc = {
+ eq: eq,
+ isEqualNode: isEqualNode,
+ member: member,
+ contains: contains$2,
+ is: $_9hz7rv1a9jfuw8wpg.is
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getTextSelectionToolbarItems = function (editor) {
- return EditorSettings.getToolbarItemsOr(editor, 'selection_toolbar', DEFAULT_TEXT_SELECTION_ITEMS);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var owner = function (element) {
+ return $_fmubbj19ijfuw8wmy.fromDom(element.dom().ownerDocument);
+ };
+ var documentElement = function (element) {
+ var doc = owner(element);
+ return $_fmubbj19ijfuw8wmy.fromDom(doc.dom().documentElement);
+ };
+ var defaultView = function (element) {
+ var el = element.dom();
+ var defaultView = el.ownerDocument.defaultView;
+ return $_fmubbj19ijfuw8wmy.fromDom(defaultView);
+ };
+ var parent$1 = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.parentNode).map($_fmubbj19ijfuw8wmy.fromDom);
+ };
+ var findIndex$1 = function (element) {
+ return parent$1(element).bind(function (p) {
+ var kin = children(p);
+ return $_1doq1817ejfuw8wen.findIndex(kin, function (elem) {
+ return $_ab91p919wjfuw8woc.eq(element, elem);
+ });
+ });
+ };
+ var parents = function (element, isRoot) {
+ var stop = $_d02u5u17hjfuw8wey.isFunction(isRoot) ? isRoot : $_d9fl1s17gjfuw8wew.constant(false);
+ var dom = element.dom();
+ var ret = [];
+ while (dom.parentNode !== null && dom.parentNode !== undefined) {
+ var rawParent = dom.parentNode;
+ var parent = $_fmubbj19ijfuw8wmy.fromDom(rawParent);
+ ret.push(parent);
+ if (stop(parent) === true)
+ break;
+ else
+ dom = rawParent;
+ }
+ return ret;
+ };
+ var siblings = function (element) {
+ var filterSelf = function (elements) {
+ return $_1doq1817ejfuw8wen.filter(elements, function (x) {
+ return !$_ab91p919wjfuw8woc.eq(element, x);
+ });
+ };
+ return parent$1(element).map(children).map(filterSelf).getOr([]);
+ };
+ var offsetParent = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.offsetParent).map($_fmubbj19ijfuw8wmy.fromDom);
+ };
+ var prevSibling = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.previousSibling).map($_fmubbj19ijfuw8wmy.fromDom);
+ };
+ var nextSibling = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.nextSibling).map($_fmubbj19ijfuw8wmy.fromDom);
+ };
+ var prevSiblings = function (element) {
+ return $_1doq1817ejfuw8wen.reverse($_alx4av19vjfuw8woa.toArray(element, prevSibling));
+ };
+ var nextSiblings = function (element) {
+ return $_alx4av19vjfuw8woa.toArray(element, nextSibling);
+ };
+ var children = function (element) {
+ var dom = element.dom();
+ return $_1doq1817ejfuw8wen.map(dom.childNodes, $_fmubbj19ijfuw8wmy.fromDom);
+ };
+ var child = function (element, index) {
+ var children = element.dom().childNodes;
+ return Option.from(children[index]).map($_fmubbj19ijfuw8wmy.fromDom);
+ };
+ var firstChild = function (element) {
+ return child(element, 0);
+ };
+ var lastChild = function (element) {
+ return child(element, element.dom().childNodes.length - 1);
+ };
+ var childNodesCount = function (element) {
+ return element.dom().childNodes.length;
+ };
+ var hasChildNodes = function (element) {
+ return element.dom().hasChildNodes();
+ };
+ var spot = $_f4h5y919qjfuw8wnr.immutable('element', 'offset');
+ var leaf = function (element, offset) {
+ var cs = children(element);
+ return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
+ };
+ var $_g7tj5v19pjfuw8wnf = {
+ owner: owner,
+ defaultView: defaultView,
+ documentElement: documentElement,
+ parent: parent$1,
+ findIndex: findIndex$1,
+ parents: parents,
+ siblings: siblings,
+ prevSibling: prevSibling,
+ offsetParent: offsetParent,
+ prevSiblings: prevSiblings,
+ nextSibling: nextSibling,
+ nextSiblings: nextSiblings,
+ children: children,
+ child: child,
+ firstChild: firstChild,
+ lastChild: lastChild,
+ childNodesCount: childNodesCount,
+ hasChildNodes: hasChildNodes,
+ leaf: leaf
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getInsertToolbarItems = function (editor) {
- return EditorSettings.getToolbarItemsOr(editor, 'insert_toolbar', DEFAULT_INSERT_TOOLBAR_ITEMS);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var all$1 = function (predicate) {
+ return descendants($_9dfew519ljfuw8wn8.body(), predicate);
+ };
+ var ancestors = function (scope, predicate, isRoot) {
+ return $_1doq1817ejfuw8wen.filter($_g7tj5v19pjfuw8wnf.parents(scope, isRoot), predicate);
+ };
+ var siblings$1 = function (scope, predicate) {
+ return $_1doq1817ejfuw8wen.filter($_g7tj5v19pjfuw8wnf.siblings(scope), predicate);
+ };
+ var children$1 = function (scope, predicate) {
+ return $_1doq1817ejfuw8wen.filter($_g7tj5v19pjfuw8wnf.children(scope), predicate);
+ };
+ var descendants = function (scope, predicate) {
+ var result = [];
+ $_1doq1817ejfuw8wen.each($_g7tj5v19pjfuw8wnf.children(scope), function (x) {
+ if (predicate(x)) {
+ result = result.concat([x]);
+ }
+ result = result.concat(descendants(x, predicate));
+ });
+ return result;
+ };
+ var $_bavy9s19kjfuw8wn5 = {
+ all: all$1,
+ ancestors: ancestors,
+ siblings: siblings$1,
+ children: children$1,
+ descendants: descendants
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var hasToolbarItems = function (toolbar) {
- return toolbar.items().length > 0;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var all$2 = function (selector) {
+ return $_9hz7rv1a9jfuw8wpg.all(selector);
+ };
+ var ancestors$1 = function (scope, selector, isRoot) {
+ return $_bavy9s19kjfuw8wn5.ancestors(scope, function (e) {
+ return $_9hz7rv1a9jfuw8wpg.is(e, selector);
+ }, isRoot);
+ };
+ var siblings$2 = function (scope, selector) {
+ return $_bavy9s19kjfuw8wn5.siblings(scope, function (e) {
+ return $_9hz7rv1a9jfuw8wpg.is(e, selector);
+ });
+ };
+ var children$2 = function (scope, selector) {
+ return $_bavy9s19kjfuw8wn5.children(scope, function (e) {
+ return $_9hz7rv1a9jfuw8wpg.is(e, selector);
+ });
+ };
+ var descendants$1 = function (scope, selector) {
+ return $_9hz7rv1a9jfuw8wpg.all(selector, scope);
+ };
+ var $_b2no8419jjfuw8wn4 = {
+ all: all$2,
+ ancestors: ancestors$1,
+ siblings: siblings$2,
+ children: children$2,
+ descendants: descendants$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var create = function (editor, toolbars) {
- var items = createToolbars(editor, toolbars).concat([
- Toolbar.create(editor, 'text', getTextSelectionToolbarItems(editor)),
- Toolbar.create(editor, 'insert', getInsertToolbarItems(editor)),
- Forms.createQuickLinkForm(editor, hide)
- ]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var trim$1 = global$4.trim;
+ var hasContentEditableState = function (value) {
+ return function (node) {
+ if (node && node.nodeType === 1) {
+ if (node.contentEditable === value) {
+ return true;
+ }
+ if (node.getAttribute('data-mce-contenteditable') === value) {
+ return true;
+ }
+ }
+ return false;
+ };
+ };
+ var isContentEditableTrue = hasContentEditableState('true');
+ var isContentEditableFalse = hasContentEditableState('false');
+ var create$4 = function (type, title, url, level, attach) {
+ return {
+ type: type,
+ title: title,
+ url: url,
+ level: level,
+ attach: attach
+ };
+ };
+ var isChildOfContentEditableTrue = function (node) {
+ while (node = node.parentNode) {
+ var value = node.contentEditable;
+ if (value && value !== 'inherit') {
+ return isContentEditableTrue(node);
+ }
+ }
+ return false;
+ };
+ var select = function (selector, root) {
+ return $_1doq1817ejfuw8wen.map($_b2no8419jjfuw8wn4.descendants($_fmubbj19ijfuw8wmy.fromDom(root), selector), function (element) {
+ return element.dom();
+ });
+ };
+ var getElementText = function (elm) {
+ return elm.innerText || elm.textContent;
+ };
+ var getOrGenerateId = function (elm) {
+ return elm.id ? elm.id : $_2kv8f219hjfuw8wmw.generate('h');
+ };
+ var isAnchor = function (elm) {
+ return elm && elm.nodeName === 'A' && (elm.id || elm.name);
+ };
+ var isValidAnchor = function (elm) {
+ return isAnchor(elm) && isEditable(elm);
+ };
+ var isHeader = function (elm) {
+ return elm && /^(H[1-6])$/.test(elm.nodeName);
+ };
+ var isEditable = function (elm) {
+ return isChildOfContentEditableTrue(elm) && !isContentEditableFalse(elm);
+ };
+ var isValidHeader = function (elm) {
+ return isHeader(elm) && isEditable(elm);
+ };
+ var getLevel = function (elm) {
+ return isHeader(elm) ? parseInt(elm.nodeName.substr(1), 10) : 0;
+ };
+ var headerTarget = function (elm) {
+ var headerId = getOrGenerateId(elm);
+ var attach = function () {
+ elm.id = headerId;
+ };
+ return create$4('header', getElementText(elm), '#' + headerId, getLevel(elm), attach);
+ };
+ var anchorTarget = function (elm) {
+ var anchorId = elm.id || elm.name;
+ var anchorText = getElementText(elm);
+ return create$4('anchor', anchorText ? anchorText : '#' + anchorId, '#' + anchorId, 0, $_d9fl1s17gjfuw8wew.noop);
+ };
+ var getHeaderTargets = function (elms) {
+ return $_1doq1817ejfuw8wen.map($_1doq1817ejfuw8wen.filter(elms, isValidHeader), headerTarget);
+ };
+ var getAnchorTargets = function (elms) {
+ return $_1doq1817ejfuw8wen.map($_1doq1817ejfuw8wen.filter(elms, isValidAnchor), anchorTarget);
+ };
+ var getTargetElements = function (elm) {
+ var elms = select('h1,h2,h3,h4,h5,h6,a:not([href])', elm);
+ return elms;
+ };
+ var hasTitle = function (target) {
+ return trim$1(target.title).length > 0;
+ };
+ var find$3 = function (elm) {
+ var elms = getTargetElements(elm);
+ return $_1doq1817ejfuw8wen.filter(getHeaderTargets(elms).concat(getAnchorTargets(elms)), hasTitle);
+ };
+ var $_bmqeu519gjfuw8wmn = { find: find$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Factory.create({
- type: 'floatpanel',
- role: 'dialog',
- classes: 'tinymce tinymce-inline arrow',
- ariaLabel: 'Inline toolbar',
- layout: 'flex',
- direction: 'column',
- align: 'stretch',
- autohide: false,
- autofix: true,
- fixed: true,
- border: 1,
- items: Tools.grep(items, hasToolbarItems),
- oncancel: function () {
- editor.focus();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getActiveEditor = function () {
+ return window.tinymce ? window.tinymce.activeEditor : global$5.activeEditor;
+ };
+ var history = {};
+ var HISTORY_LENGTH = 5;
+ var clearHistory = function () {
+ history = {};
+ };
+ var toMenuItem = function (target) {
+ return {
+ title: target.title,
+ value: {
+ title: { raw: target.title },
+ url: target.url,
+ attach: target.attach
+ }
+ };
+ };
+ var toMenuItems = function (targets) {
+ return global$4.map(targets, toMenuItem);
+ };
+ var staticMenuItem = function (title, url) {
+ return {
+ title: title,
+ value: {
+ title: title,
+ url: url,
+ attach: $_d9fl1s17gjfuw8wew.noop
+ }
+ };
+ };
+ var isUniqueUrl = function (url, targets) {
+ var foundTarget = $_1doq1817ejfuw8wen.exists(targets, function (target) {
+ return target.url === url;
+ });
+ return !foundTarget;
+ };
+ var getSetting = function (editorSettings, name, defaultValue) {
+ var value = name in editorSettings ? editorSettings[name] : defaultValue;
+ return value === false ? null : value;
+ };
+ var createMenuItems = function (term, targets, fileType, editorSettings) {
+ var separator = { title: '-' };
+ var fromHistoryMenuItems = function (history) {
+ var historyItems = history.hasOwnProperty(fileType) ? history[fileType] : [];
+ var uniqueHistory = $_1doq1817ejfuw8wen.filter(historyItems, function (url) {
+ return isUniqueUrl(url, targets);
+ });
+ return global$4.map(uniqueHistory, function (url) {
+ return {
+ title: url,
+ value: {
+ title: url,
+ url: url,
+ attach: $_d9fl1s17gjfuw8wew.noop
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ });
+ };
+ var fromMenuItems = function (type) {
+ var filteredTargets = $_1doq1817ejfuw8wen.filter(targets, function (target) {
+ return target.type === type;
+ });
+ return toMenuItems(filteredTargets);
+ };
+ var anchorMenuItems = function () {
+ var anchorMenuItems = fromMenuItems('anchor');
+ var topAnchor = getSetting(editorSettings, 'anchor_top', '#top');
+ var bottomAchor = getSetting(editorSettings, 'anchor_bottom', '#bottom');
+ if (topAnchor !== null) {
+ anchorMenuItems.unshift(staticMenuItem('<top>', topAnchor));
+ }
+ if (bottomAchor !== null) {
+ anchorMenuItems.push(staticMenuItem('<bottom>', bottomAchor));
+ }
+ return anchorMenuItems;
+ };
+ var join = function (items) {
+ return $_1doq1817ejfuw8wen.foldl(items, function (a, b) {
+ var bothEmpty = a.length === 0 || b.length === 0;
+ return bothEmpty ? a.concat(b) : a.concat(separator, b);
+ }, []);
+ };
+ if (editorSettings.typeahead_urls === false) {
+ return [];
+ }
+ return fileType === 'file' ? join([
+ filterByQuery(term, fromHistoryMenuItems(history)),
+ filterByQuery(term, fromMenuItems('header')),
+ filterByQuery(term, anchorMenuItems())
+ ]) : filterByQuery(term, fromHistoryMenuItems(history));
+ };
+ var addToHistory = function (url, fileType) {
+ var items = history[fileType];
+ if (!/^https?/.test(url)) {
+ return;
+ }
+ if (items) {
+ if ($_1doq1817ejfuw8wen.indexOf(items, url).isNone()) {
+ history[fileType] = items.slice(0, HISTORY_LENGTH).concat(url);
+ }
+ } else {
+ history[fileType] = [url];
+ }
+ };
+ var filterByQuery = function (term, menuItems) {
+ var lowerCaseTerm = term.toLowerCase();
+ var result = global$4.grep(menuItems, function (item) {
+ return item.title.toLowerCase().indexOf(lowerCaseTerm) !== -1;
+ });
+ return result.length === 1 && result[0].title === term ? [] : result;
+ };
+ var getTitle = function (linkDetails) {
+ var title = linkDetails.title;
+ return title.raw ? title.raw : title;
+ };
+ var setupAutoCompleteHandler = function (ctrl, editorSettings, bodyElm, fileType) {
+ var autocomplete = function (term) {
+ var linkTargets = $_bmqeu519gjfuw8wmn.find(bodyElm);
+ var menuItems = createMenuItems(term, linkTargets, fileType, editorSettings);
+ ctrl.showAutoComplete(menuItems, term);
+ };
+ ctrl.on('autocomplete', function () {
+ autocomplete(ctrl.value());
+ });
+ ctrl.on('selectitem', function (e) {
+ var linkDetails = e.value;
+ ctrl.value(linkDetails.url);
+ var title = getTitle(linkDetails);
+ if (fileType === 'image') {
+ ctrl.fire('change', {
+ meta: {
+ alt: title,
+ attach: linkDetails.attach
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var showPanel = function (panel) {
- if (panel) {
- panel.show();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ ctrl.fire('change', {
+ meta: {
+ text: title,
+ attach: linkDetails.attach
+ }
+ });
+ }
+ ctrl.focus();
+ });
+ ctrl.on('click', function (e) {
+ if (ctrl.value().length === 0 && e.target.nodeName === 'INPUT') {
+ autocomplete('');
+ }
+ });
+ ctrl.on('PostRender', function () {
+ ctrl.getRoot().on('submit', function (e) {
+ if (!e.isDefaultPrevented()) {
+ addToHistory(ctrl.value(), fileType);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ });
+ };
+ var statusToUiState = function (result) {
+ var status = result.status, message = result.message;
+ if (status === 'valid') {
+ return {
+ status: 'ok',
+ message: message
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var movePanelTo = function (panel, pos) {
- panel.moveTo(pos.x, pos.y);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (status === 'unknown') {
+ return {
+ status: 'warn',
+ message: message
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var togglePositionClass = function (panel, relPos) {
- relPos = relPos ? relPos.substr(0, 2) : '';
-
- Tools.each({
- t: 'down',
- b: 'up',
- c: 'center'
- }, function (cls, pos) {
- panel.classes.toggle('arrow-' + cls, pos === relPos.substr(0, 1));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (status === 'invalid') {
+ return {
+ status: 'warn',
+ message: message
+ };
+ } else {
+ return {
+ status: 'none',
+ message: ''
+ };
+ }
+ };
+ var setupLinkValidatorHandler = function (ctrl, editorSettings, fileType) {
+ var validatorHandler = editorSettings.filepicker_validator_handler;
+ if (validatorHandler) {
+ var validateUrl_1 = function (url) {
+ if (url.length === 0) {
+ ctrl.statusLevel('none');
+ return;
+ }
+ validatorHandler({
+ url: url,
+ type: fileType
+ }, function (result) {
+ var uiState = statusToUiState(result);
+ ctrl.statusMessage(uiState.message);
+ ctrl.statusLevel(uiState.status);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (relPos === 'cr') {
- panel.classes.toggle('arrow-left', true);
- panel.classes.toggle('arrow-right', false);
- } else if (relPos === 'cl') {
- panel.classes.toggle('arrow-left', true);
- panel.classes.toggle('arrow-right', true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ ctrl.state.on('change:value', function (e) {
+ validateUrl_1(e.value);
+ });
+ }
+ };
+ var FilePicker = ComboBox.extend({
+ Statics: { clearHistory: clearHistory },
+ init: function (settings) {
+ var self = this, editor = getActiveEditor(), editorSettings = editor.settings;
+ var actionCallback, fileBrowserCallback, fileBrowserCallbackTypes;
+ var fileType = settings.filetype;
+ settings.spellcheck = false;
+ fileBrowserCallbackTypes = editorSettings.file_picker_types || editorSettings.file_browser_callback_types;
+ if (fileBrowserCallbackTypes) {
+ fileBrowserCallbackTypes = global$4.makeMap(fileBrowserCallbackTypes, /[, ]/);
+ }
+ if (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[fileType]) {
+ fileBrowserCallback = editorSettings.file_picker_callback;
+ if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[fileType])) {
+ actionCallback = function () {
+ var meta = self.fire('beforecall').meta;
+ meta = global$4.extend({ filetype: fileType }, meta);
+ fileBrowserCallback.call(editor, function (value, meta) {
+ self.value(value).fire('change', { meta: meta });
+ }, self.value(), meta);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Tools.each({
- l: 'left',
- r: 'right'
- }, function (cls, pos) {
- panel.classes.toggle('arrow-' + cls, pos === relPos.substr(1, 1));
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ fileBrowserCallback = editorSettings.file_browser_callback;
+ if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[fileType])) {
+ actionCallback = function () {
+ fileBrowserCallback(self.getEl('inp').id, self.value(), fileType, window);
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (actionCallback) {
+ settings.icon = 'browse';
+ settings.onaction = actionCallback;
+ }
+ self._super(settings);
+ self.classes.add('filepicker');
+ setupAutoCompleteHandler(self, editorSettings, editor.getBody(), fileType);
+ setupLinkValidatorHandler(self, editorSettings, fileType);
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var showToolbar = function (panel, id) {
- var toolbars = panel.items().filter('#' + id);
-
- if (toolbars.length > 0) {
- toolbars[0].show();
- panel.reflow();
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var FitLayout = AbsoluteLayout.extend({
+ recalc: function (container) {
+ var contLayoutRect = container.layoutRect(), paddingBox = container.paddingBox;
+ container.items().filter(':visible').each(function (ctrl) {
+ ctrl.layoutRect({
+ x: paddingBox.left,
+ y: paddingBox.top,
+ w: contLayoutRect.innerW - paddingBox.right - paddingBox.left,
+ h: contLayoutRect.innerH - paddingBox.top - paddingBox.bottom
+ });
+ if (ctrl.recalc) {
+ ctrl.recalc();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return false;
- };
-
- var repositionPanelAt = function (panel, id, editor, targetRect) {
- var contentAreaRect, panelRect, result, userConstainHandler;
-
- userConstainHandler = EditorSettings.getHandlerOr(editor, 'inline_toolbar_position_handler', Layout.defaultHandler);
- contentAreaRect = Measure.getContentAreaRect(editor);
- panelRect = DOMUtils.DOM.getRect(panel.getEl());
-
- if (id === 'insert') {
- result = Layout.calcInsert(targetRect, contentAreaRect, panelRect);
- } else {
- result = Layout.calc(targetRect, contentAreaRect, panelRect);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var FlexLayout = AbsoluteLayout.extend({
+ recalc: function (container) {
+ var i, l, items, contLayoutRect, contPaddingBox, contSettings, align, pack, spacing, totalFlex, availableSpace, direction;
+ var ctrl, ctrlLayoutRect, ctrlSettings, flex;
+ var maxSizeItems = [];
+ var size, maxSize, ratio, rect, pos, maxAlignEndPos;
+ var sizeName, minSizeName, posName, maxSizeName, beforeName, innerSizeName, deltaSizeName, contentSizeName;
+ var alignAxisName, alignInnerSizeName, alignSizeName, alignMinSizeName, alignBeforeName, alignAfterName;
+ var alignDeltaSizeName, alignContentSizeName;
+ var max = Math.max, min = Math.min;
+ items = container.items().filter(':visible');
+ contLayoutRect = container.layoutRect();
+ contPaddingBox = container.paddingBox;
+ contSettings = container.settings;
+ direction = container.isRtl() ? contSettings.direction || 'row-reversed' : contSettings.direction;
+ align = contSettings.align;
+ pack = container.isRtl() ? contSettings.pack || 'end' : contSettings.pack;
+ spacing = contSettings.spacing || 0;
+ if (direction === 'row-reversed' || direction === 'column-reverse') {
+ items = items.set(items.toArray().reverse());
+ direction = direction.split('-')[0];
+ }
+ if (direction === 'column') {
+ posName = 'y';
+ sizeName = 'h';
+ minSizeName = 'minH';
+ maxSizeName = 'maxH';
+ innerSizeName = 'innerH';
+ beforeName = 'top';
+ deltaSizeName = 'deltaH';
+ contentSizeName = 'contentH';
+ alignBeforeName = 'left';
+ alignSizeName = 'w';
+ alignAxisName = 'x';
+ alignInnerSizeName = 'innerW';
+ alignMinSizeName = 'minW';
+ alignAfterName = 'right';
+ alignDeltaSizeName = 'deltaW';
+ alignContentSizeName = 'contentW';
+ } else {
+ posName = 'x';
+ sizeName = 'w';
+ minSizeName = 'minW';
+ maxSizeName = 'maxW';
+ innerSizeName = 'innerW';
+ beforeName = 'left';
+ deltaSizeName = 'deltaW';
+ contentSizeName = 'contentW';
+ alignBeforeName = 'top';
+ alignSizeName = 'h';
+ alignAxisName = 'y';
+ alignInnerSizeName = 'innerH';
+ alignMinSizeName = 'minH';
+ alignAfterName = 'bottom';
+ alignDeltaSizeName = 'deltaH';
+ alignContentSizeName = 'contentH';
+ }
+ availableSpace = contLayoutRect[innerSizeName] - contPaddingBox[beforeName] - contPaddingBox[beforeName];
+ maxAlignEndPos = totalFlex = 0;
+ for (i = 0, l = items.length; i < l; i++) {
+ ctrl = items[i];
+ ctrlLayoutRect = ctrl.layoutRect();
+ ctrlSettings = ctrl.settings;
+ flex = ctrlSettings.flex;
+ availableSpace -= i < l - 1 ? spacing : 0;
+ if (flex > 0) {
+ totalFlex += flex;
+ if (ctrlLayoutRect[maxSizeName]) {
+ maxSizeItems.push(ctrl);
+ }
+ ctrlLayoutRect.flex = flex;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (result) {
- panelRect = result.rect;
- currentRect = targetRect;
- movePanelTo(panel, Layout.userConstrain(userConstainHandler, targetRect, contentAreaRect, panelRect));
- togglePositionClass(panel, result.position);
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ availableSpace -= ctrlLayoutRect[minSizeName];
+ size = contPaddingBox[alignBeforeName] + ctrlLayoutRect[alignMinSizeName] + contPaddingBox[alignAfterName];
+ if (size > maxAlignEndPos) {
+ maxAlignEndPos = size;
+ }
+ }
+ rect = {};
+ if (availableSpace < 0) {
+ rect[minSizeName] = contLayoutRect[minSizeName] - availableSpace + contLayoutRect[deltaSizeName];
+ } else {
+ rect[minSizeName] = contLayoutRect[innerSizeName] - availableSpace + contLayoutRect[deltaSizeName];
+ }
+ rect[alignMinSizeName] = maxAlignEndPos + contLayoutRect[alignDeltaSizeName];
+ rect[contentSizeName] = contLayoutRect[innerSizeName] - availableSpace;
+ rect[alignContentSizeName] = maxAlignEndPos;
+ rect.minW = min(rect.minW, contLayoutRect.maxW);
+ rect.minH = min(rect.minH, contLayoutRect.maxH);
+ rect.minW = max(rect.minW, contLayoutRect.startMinWidth);
+ rect.minH = max(rect.minH, contLayoutRect.startMinHeight);
+ if (contLayoutRect.autoResize && (rect.minW !== contLayoutRect.minW || rect.minH !== contLayoutRect.minH)) {
+ rect.w = rect.minW;
+ rect.h = rect.minH;
+ container.layoutRect(rect);
+ this.recalc(container);
+ if (container._lastRect === null) {
+ var parentCtrl = container.parent();
+ if (parentCtrl) {
+ parentCtrl._lastRect = null;
+ parentCtrl.recalc();
+ }
+ }
+ return;
+ }
+ ratio = availableSpace / totalFlex;
+ for (i = 0, l = maxSizeItems.length; i < l; i++) {
+ ctrl = maxSizeItems[i];
+ ctrlLayoutRect = ctrl.layoutRect();
+ maxSize = ctrlLayoutRect[maxSizeName];
+ size = ctrlLayoutRect[minSizeName] + ctrlLayoutRect.flex * ratio;
+ if (size > maxSize) {
+ availableSpace -= ctrlLayoutRect[maxSizeName] - ctrlLayoutRect[minSizeName];
+ totalFlex -= ctrlLayoutRect.flex;
+ ctrlLayoutRect.flex = 0;
+ ctrlLayoutRect.maxFlexSize = maxSize;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ctrlLayoutRect.maxFlexSize = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var showPanelAt = function (panel, id, editor, targetRect) {
- showPanel(panel);
- panel.items().hide();
-
- if (!showToolbar(panel, id)) {
- hide(panel);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ ratio = availableSpace / totalFlex;
+ pos = contPaddingBox[beforeName];
+ rect = {};
+ if (totalFlex === 0) {
+ if (pack === 'end') {
+ pos = availableSpace + contPaddingBox[beforeName];
+ } else if (pack === 'center') {
+ pos = Math.round(contLayoutRect[innerSizeName] / 2 - (contLayoutRect[innerSizeName] - availableSpace) / 2) + contPaddingBox[beforeName];
+ if (pos < 0) {
+ pos = contPaddingBox[beforeName];
+ }
+ } else if (pack === 'justify') {
+ pos = contPaddingBox[beforeName];
+ spacing = Math.floor(availableSpace / (items.length - 1));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ rect[alignAxisName] = contPaddingBox[alignBeforeName];
+ for (i = 0, l = items.length; i < l; i++) {
+ ctrl = items[i];
+ ctrlLayoutRect = ctrl.layoutRect();
+ size = ctrlLayoutRect.maxFlexSize || ctrlLayoutRect[minSizeName];
+ if (align === 'center') {
+ rect[alignAxisName] = Math.round(contLayoutRect[alignInnerSizeName] / 2 - ctrlLayoutRect[alignSizeName] / 2);
+ } else if (align === 'stretch') {
+ rect[alignSizeName] = max(ctrlLayoutRect[alignMinSizeName] || 0, contLayoutRect[alignInnerSizeName] - contPaddingBox[alignBeforeName] - contPaddingBox[alignAfterName]);
+ rect[alignAxisName] = contPaddingBox[alignBeforeName];
+ } else if (align === 'end') {
+ rect[alignAxisName] = contLayoutRect[alignInnerSizeName] - ctrlLayoutRect[alignSizeName] - contPaddingBox.top;
+ }
+ if (ctrlLayoutRect.flex > 0) {
+ size += ctrlLayoutRect.flex * ratio;
+ }
+ rect[sizeName] = size;
+ rect[posName] = pos;
+ ctrl.layoutRect(rect);
+ if (ctrl.recalc) {
+ ctrl.recalc();
+ }
+ pos += size + spacing;
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (repositionPanelAt(panel, id, editor, targetRect) === false) {
- hide(panel);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var FlowLayout = Layout$1.extend({
+ Defaults: {
+ containerClass: 'flow-layout',
+ controlClass: 'flow-layout-item',
+ endClass: 'break'
+ },
+ recalc: function (container) {
+ container.items().filter(':visible').each(function (ctrl) {
+ if (ctrl.recalc) {
+ ctrl.recalc();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ },
+ isNative: function () {
+ return true;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var hasFormVisible = function () {
- return panel.items().filter('form:visible').length > 0;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {
+ return is(scope, a) ? Option.some(scope) : $_d02u5u17hjfuw8wey.isFunction(isRoot) && isRoot(scope) ? Option.none() : ancestor(scope, a, isRoot);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var showForm = function (editor, id) {
- if (panel) {
- panel.items().hide();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var first$1 = function (predicate) {
+ return descendant($_9dfew519ljfuw8wn8.body(), predicate);
+ };
+ var ancestor = function (scope, predicate, isRoot) {
+ var element = scope.dom();
+ var stop = $_d02u5u17hjfuw8wey.isFunction(isRoot) ? isRoot : $_d9fl1s17gjfuw8wew.constant(false);
+ while (element.parentNode) {
+ element = element.parentNode;
+ var el = $_fmubbj19ijfuw8wmy.fromDom(element);
+ if (predicate(el))
+ return Option.some(el);
+ else if (stop(el))
+ break;
+ }
+ return Option.none();
+ };
+ var closest = function (scope, predicate, isRoot) {
+ var is = function (scope) {
+ return predicate(scope);
+ };
+ return ClosestOrAncestor(is, ancestor, scope, predicate, isRoot);
+ };
+ var sibling = function (scope, predicate) {
+ var element = scope.dom();
+ if (!element.parentNode)
+ return Option.none();
+ return child$1($_fmubbj19ijfuw8wmy.fromDom(element.parentNode), function (x) {
+ return !$_ab91p919wjfuw8woc.eq(scope, x) && predicate(x);
+ });
+ };
+ var child$1 = function (scope, predicate) {
+ var result = $_1doq1817ejfuw8wen.find(scope.dom().childNodes, $_d9fl1s17gjfuw8wew.compose(predicate, $_fmubbj19ijfuw8wmy.fromDom));
+ return result.map($_fmubbj19ijfuw8wmy.fromDom);
+ };
+ var descendant = function (scope, predicate) {
+ var descend = function (element) {
+ for (var i = 0; i < element.childNodes.length; i++) {
+ if (predicate($_fmubbj19ijfuw8wmy.fromDom(element.childNodes[i])))
+ return Option.some($_fmubbj19ijfuw8wmy.fromDom(element.childNodes[i]));
+ var res = descend(element.childNodes[i]);
+ if (res.isSome())
+ return res;
+ }
+ return Option.none();
+ };
+ return descend(scope.dom());
+ };
+ var $_7vqge21afjfuw8wq8 = {
+ first: first$1,
+ ancestor: ancestor,
+ closest: closest,
+ sibling: sibling,
+ child: child$1,
+ descendant: descendant
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (!showToolbar(panel, id)) {
- hide(panel);
- return;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var first$2 = function (selector) {
+ return $_9hz7rv1a9jfuw8wpg.one(selector);
+ };
+ var ancestor$1 = function (scope, selector, isRoot) {
+ return $_7vqge21afjfuw8wq8.ancestor(scope, function (e) {
+ return $_9hz7rv1a9jfuw8wpg.is(e, selector);
+ }, isRoot);
+ };
+ var sibling$1 = function (scope, selector) {
+ return $_7vqge21afjfuw8wq8.sibling(scope, function (e) {
+ return $_9hz7rv1a9jfuw8wpg.is(e, selector);
+ });
+ };
+ var child$2 = function (scope, selector) {
+ return $_7vqge21afjfuw8wq8.child(scope, function (e) {
+ return $_9hz7rv1a9jfuw8wpg.is(e, selector);
+ });
+ };
+ var descendant$1 = function (scope, selector) {
+ return $_9hz7rv1a9jfuw8wpg.one(selector, scope);
+ };
+ var closest$1 = function (scope, selector, isRoot) {
+ return ClosestOrAncestor($_9hz7rv1a9jfuw8wpg.is, ancestor$1, scope, selector, isRoot);
+ };
+ var $_fms31h1aejfuw8wq6 = {
+ first: first$2,
+ ancestor: ancestor$1,
+ sibling: sibling$1,
+ child: child$2,
+ descendant: descendant$1,
+ closest: closest$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var contentAreaRect, panelRect, result, userConstainHandler;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toggleFormat = function (editor, fmt) {
+ return function () {
+ editor.execCommand('mceToggleFormat', false, fmt);
+ };
+ };
+ var postRenderFormat = function (editor, name) {
+ return function () {
+ var self = this;
+ if (editor.formatter) {
+ editor.formatter.formatChanged(name, function (state) {
+ self.active(state);
+ });
+ } else {
+ editor.on('init', function () {
+ editor.formatter.formatChanged(name, function (state) {
+ self.active(state);
+ });
+ });
+ }
+ };
+ };
+ var $_ihu3w1aijfuw8wqo = {
+ toggleFormat: toggleFormat,
+ postRenderFormat: postRenderFormat
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- showPanel(panel);
- panel.items().hide();
- showToolbar(panel, id);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor) {
+ editor.addMenuItem('align', {
+ text: 'Align',
+ menu: [
+ {
+ text: 'Left',
+ icon: 'alignleft',
+ onclick: $_ihu3w1aijfuw8wqo.toggleFormat(editor, 'alignleft')
+ },
+ {
+ text: 'Center',
+ icon: 'aligncenter',
+ onclick: $_ihu3w1aijfuw8wqo.toggleFormat(editor, 'aligncenter')
+ },
+ {
+ text: 'Right',
+ icon: 'alignright',
+ onclick: $_ihu3w1aijfuw8wqo.toggleFormat(editor, 'alignright')
+ },
+ {
+ text: 'Justify',
+ icon: 'alignjustify',
+ onclick: $_ihu3w1aijfuw8wqo.toggleFormat(editor, 'alignjustify')
+ }
+ ]
+ });
+ global$4.each({
+ alignleft: [
+ 'Align left',
+ 'JustifyLeft'
+ ],
+ aligncenter: [
+ 'Align center',
+ 'JustifyCenter'
+ ],
+ alignright: [
+ 'Align right',
+ 'JustifyRight'
+ ],
+ alignjustify: [
+ 'Justify',
+ 'JustifyFull'
+ ],
+ alignnone: [
+ 'No alignment',
+ 'JustifyNone'
+ ]
+ }, function (item, name) {
+ editor.addButton(name, {
+ active: false,
+ tooltip: item[0],
+ cmd: item[1],
+ onPostRender: $_ihu3w1aijfuw8wqo.postRenderFormat(editor, name)
+ });
+ });
+ };
+ var $_ezm9hv1ahjfuw8wqn = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- userConstainHandler = EditorSettings.getHandlerOr(editor, 'inline_toolbar_position_handler', Layout.defaultHandler);
- contentAreaRect = Measure.getContentAreaRect(editor);
- panelRect = DOMUtils.DOM.getRect(panel.getEl());
-
- result = Layout.calc(currentRect, contentAreaRect, panelRect);
-
- if (result) {
- panelRect = result.rect;
- movePanelTo(panel, Layout.userConstrain(userConstainHandler, currentRect, contentAreaRect, panelRect));
- togglePositionClass(panel, result.position);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getFirstFont = function (fontFamily) {
+ return fontFamily ? fontFamily.split(',')[0] : '';
+ };
+ var findMatchingValue = function (items, fontFamily) {
+ var value;
+ global$4.each(items, function (item) {
+ if (item.value.toLowerCase() === fontFamily.toLowerCase()) {
+ value = item.value;
+ }
+ });
+ global$4.each(items, function (item) {
+ if (!value && getFirstFont(item.value).toLowerCase() === getFirstFont(fontFamily).toLowerCase()) {
+ value = item.value;
+ }
+ });
+ return value;
+ };
+ var createFontNameListBoxChangeHandler = function (editor, items) {
+ return function () {
+ var self = this;
+ editor.on('init nodeChange', function (e) {
+ var fontFamily = editor.queryCommandValue('FontName');
+ var match = findMatchingValue(items, fontFamily);
+ self.value(match ? match : null);
+ if (!match && fontFamily) {
+ self.text(getFirstFont(fontFamily));
+ }
+ });
+ };
+ };
+ var createFormats = function (formats) {
+ formats = formats.replace(/;$/, '').split(';');
+ var i = formats.length;
+ while (i--) {
+ formats[i] = formats[i].split('=');
+ }
+ return formats;
+ };
+ var getFontItems = function (editor) {
+ var defaultFontsFormats = 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats';
+ var fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);
+ return global$4.map(fonts, function (font) {
+ return {
+ text: { raw: font[0] },
+ value: font[1],
+ textStyle: font[1].indexOf('dings') === -1 ? 'font-family:' + font[1] : ''
+ };
+ });
+ };
+ var registerButtons = function (editor) {
+ editor.addButton('fontselect', function () {
+ var items = getFontItems(editor);
+ return {
+ type: 'listbox',
+ text: 'Font Family',
+ tooltip: 'Font Family',
+ values: items,
+ fixedWidth: true,
+ onPostRender: createFontNameListBoxChangeHandler(editor, items),
+ onselect: function (e) {
+ if (e.control.settings.value) {
+ editor.execCommand('FontName', false, e.control.settings.value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var register$1 = function (editor) {
+ registerButtons(editor);
+ };
+ var $_1fynbv1ajjfuw8wqp = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var show = function (editor, id, targetRect, toolbars) {
- if (!panel) {
- panel = create(editor, toolbars);
- panel.renderTo(document.body).reflow().moveTo(targetRect.x, targetRect.y);
- editor.nodeChanged();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var round = function (number, precision) {
+ var factor = Math.pow(10, precision);
+ return Math.round(number * factor) / factor;
+ };
+ var toPt = function (fontSize, precision) {
+ if (/[0-9.]+px$/.test(fontSize)) {
+ return round(parseInt(fontSize, 10) * 72 / 96, precision || 0) + 'pt';
+ }
+ return fontSize;
+ };
+ var findMatchingValue$1 = function (items, pt, px) {
+ var value;
+ global$4.each(items, function (item) {
+ if (item.value === px) {
+ value = px;
+ } else if (item.value === pt) {
+ value = pt;
+ }
+ });
+ return value;
+ };
+ var createFontSizeListBoxChangeHandler = function (editor, items) {
+ return function () {
+ var self = this;
+ editor.on('init nodeChange', function (e) {
+ var px, pt, precision, match;
+ px = editor.queryCommandValue('FontSize');
+ if (px) {
+ for (precision = 3; !match && precision >= 0; precision--) {
+ pt = toPt(px, precision);
+ match = findMatchingValue$1(items, pt, px);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- showPanelAt(panel, id, editor, targetRect);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.value(match ? match : null);
+ if (!match) {
+ self.text(pt);
+ }
+ });
+ };
+ };
+ var getFontSizeItems = function (editor) {
+ var defaultFontsizeFormats = '8pt 10pt 12pt 14pt 18pt 24pt 36pt';
+ var fontsizeFormats = editor.settings.fontsize_formats || defaultFontsizeFormats;
+ return global$4.map(fontsizeFormats.split(' '), function (item) {
+ var text = item, value = item;
+ var values = item.split('=');
+ if (values.length > 1) {
+ text = values[0];
+ value = values[1];
+ }
+ return {
+ text: text,
+ value: value
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var reposition = function (editor, id, targetRect) {
- if (panel) {
- repositionPanelAt(panel, id, editor, targetRect);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var registerButtons$1 = function (editor) {
+ editor.addButton('fontsizeselect', function () {
+ var items = getFontSizeItems(editor);
+ return {
+ type: 'listbox',
+ text: 'Font Sizes',
+ tooltip: 'Font Sizes',
+ values: items,
+ fixedWidth: true,
+ onPostRender: createFontSizeListBoxChangeHandler(editor, items),
+ onclick: function (e) {
+ if (e.control.settings.value) {
+ editor.execCommand('FontSize', false, e.control.settings.value);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var register$2 = function (editor) {
+ registerButtons$1(editor);
+ };
+ var $_4s7fmc1akjfuw8wqs = { register: register$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var hide = function () {
- if (panel) {
- panel.hide();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hideMenuObjects = function (editor, menu) {
+ var count = menu.length;
+ global$4.each(menu, function (item) {
+ if (item.menu) {
+ item.hidden = hideMenuObjects(editor, item.menu) === 0;
+ }
+ var formatName = item.format;
+ if (formatName) {
+ item.hidden = !editor.formatter.canApply(formatName);
+ }
+ if (item.hidden) {
+ count--;
+ }
+ });
+ return count;
+ };
+ var hideFormatMenuItems = function (editor, menu) {
+ var count = menu.items().length;
+ menu.items().each(function (item) {
+ if (item.menu) {
+ item.visible(hideFormatMenuItems(editor, item.menu) > 0);
+ }
+ if (!item.menu && item.settings.menu) {
+ item.visible(hideMenuObjects(editor, item.settings.menu) > 0);
+ }
+ var formatName = item.settings.format;
+ if (formatName) {
+ item.visible(editor.formatter.canApply(formatName));
+ }
+ if (!item.visible()) {
+ count--;
+ }
+ });
+ return count;
+ };
+ var createFormatMenu = function (editor) {
+ var count = 0;
+ var newFormats = [];
+ var defaultStyleFormats = [
+ {
+ title: 'Headings',
+ items: [
+ {
+ title: 'Heading 1',
+ format: 'h1'
+ },
+ {
+ title: 'Heading 2',
+ format: 'h2'
+ },
+ {
+ title: 'Heading 3',
+ format: 'h3'
+ },
+ {
+ title: 'Heading 4',
+ format: 'h4'
+ },
+ {
+ title: 'Heading 5',
+ format: 'h5'
+ },
+ {
+ title: 'Heading 6',
+ format: 'h6'
+ }
+ ]
+ },
+ {
+ title: 'Inline',
+ items: [
+ {
+ title: 'Bold',
+ icon: 'bold',
+ format: 'bold'
+ },
+ {
+ title: 'Italic',
+ icon: 'italic',
+ format: 'italic'
+ },
+ {
+ title: 'Underline',
+ icon: 'underline',
+ format: 'underline'
+ },
+ {
+ title: 'Strikethrough',
+ icon: 'strikethrough',
+ format: 'strikethrough'
+ },
+ {
+ title: 'Superscript',
+ icon: 'superscript',
+ format: 'superscript'
+ },
+ {
+ title: 'Subscript',
+ icon: 'subscript',
+ format: 'subscript'
+ },
+ {
+ title: 'Code',
+ icon: 'code',
+ format: 'code'
+ }
+ ]
+ },
+ {
+ title: 'Blocks',
+ items: [
+ {
+ title: 'Paragraph',
+ format: 'p'
+ },
+ {
+ title: 'Blockquote',
+ format: 'blockquote'
+ },
+ {
+ title: 'Div',
+ format: 'div'
+ },
+ {
+ title: 'Pre',
+ format: 'pre'
+ }
+ ]
+ },
+ {
+ title: 'Alignment',
+ items: [
+ {
+ title: 'Left',
+ icon: 'alignleft',
+ format: 'alignleft'
+ },
+ {
+ title: 'Center',
+ icon: 'aligncenter',
+ format: 'aligncenter'
+ },
+ {
+ title: 'Right',
+ icon: 'alignright',
+ format: 'alignright'
+ },
+ {
+ title: 'Justify',
+ icon: 'alignjustify',
+ format: 'alignjustify'
+ }
+ ]
+ }
+ ];
+ var createMenu = function (formats) {
+ var menu = [];
+ if (!formats) {
+ return;
+ }
+ global$4.each(formats, function (format) {
+ var menuItem = {
+ text: format.title,
+ icon: format.icon
+ };
+ if (format.items) {
+ menuItem.menu = createMenu(format.items);
+ } else {
+ var formatName = format.format || 'custom' + count++;
+ if (!format.format) {
+ format.name = formatName;
+ newFormats.push(format);
+ }
+ menuItem.format = formatName;
+ menuItem.cmd = format.cmd;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var focus = function () {
- if (panel) {
- panel.find('toolbar:visible').eq(0).each(function (item) {
- item.focus(true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ menu.push(menuItem);
+ });
+ return menu;
+ };
+ var createStylesMenu = function () {
+ var menu;
+ if (editor.settings.style_formats_merge) {
+ if (editor.settings.style_formats) {
+ menu = createMenu(defaultStyleFormats.concat(editor.settings.style_formats));
+ } else {
+ menu = createMenu(defaultStyleFormats);
+ }
+ } else {
+ menu = createMenu(editor.settings.style_formats || defaultStyleFormats);
+ }
+ return menu;
+ };
+ editor.on('init', function () {
+ global$4.each(newFormats, function (format) {
+ editor.formatter.register(format.name, format);
+ });
+ });
+ return {
+ type: 'menu',
+ items: createStylesMenu(),
+ onPostRender: function (e) {
+ editor.fire('renderFormatsMenu', { control: e.control });
+ },
+ itemDefaults: {
+ preview: true,
+ textStyle: function () {
+ if (this.settings.format) {
+ return editor.formatter.getCssText(this.settings.format);
+ }
+ },
+ onPostRender: function () {
+ var self = this;
+ self.parent().on('show', function () {
+ var formatName, command;
+ formatName = self.settings.format;
+ if (formatName) {
+ self.disabled(!editor.formatter.canApply(formatName));
+ self.active(editor.formatter.match(formatName));
+ }
+ command = self.settings.cmd;
+ if (command) {
+ self.active(editor.queryCommandState(command));
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ onclick: function () {
+ if (this.settings.format) {
+ $_ihu3w1aijfuw8wqo.toggleFormat(editor, this.settings.format)();
+ }
+ if (this.settings.cmd) {
+ editor.execCommand(this.settings.cmd);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var remove = function () {
- if (panel) {
- panel.remove();
- panel = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ };
+ var registerMenuItems = function (editor, formatMenu) {
+ editor.addMenuItem('formats', {
+ text: 'Formats',
+ menu: formatMenu
+ });
+ };
+ var registerButtons$2 = function (editor, formatMenu) {
+ editor.addButton('styleselect', {
+ type: 'menubutton',
+ text: 'Formats',
+ menu: formatMenu,
+ onShowMenu: function () {
+ if (editor.settings.style_formats_autohide) {
+ hideFormatMenuItems(editor, this.menu);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ };
+ var register$3 = function (editor) {
+ var formatMenu = createFormatMenu(editor);
+ registerMenuItems(editor, formatMenu);
+ registerButtons$2(editor, formatMenu);
+ };
+ var $_2dqx6v1aljfuw8wqv = { register: register$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var inForm = function () {
- return panel && panel.visible() && hasFormVisible();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var defaultBlocks = 'Paragraph=p;' + 'Heading 1=h1;' + 'Heading 2=h2;' + 'Heading 3=h3;' + 'Heading 4=h4;' + 'Heading 5=h5;' + 'Heading 6=h6;' + 'Preformatted=pre';
+ var createFormats$1 = function (formats) {
+ formats = formats.replace(/;$/, '').split(';');
+ var i = formats.length;
+ while (i--) {
+ formats[i] = formats[i].split('=');
+ }
+ return formats;
+ };
+ var createListBoxChangeHandler = function (editor, items, formatName) {
+ return function () {
+ var self = this;
+ editor.on('nodeChange', function (e) {
+ var formatter = editor.formatter;
+ var value = null;
+ global$4.each(e.parents, function (node) {
+ global$4.each(items, function (item) {
+ if (formatName) {
+ if (formatter.matchNode(node, formatName, { value: item.value })) {
+ value = item.value;
+ }
+ } else {
+ if (formatter.matchNode(node, item.value)) {
+ value = item.value;
+ }
+ }
+ if (value) {
+ return false;
+ }
+ });
+ if (value) {
+ return false;
+ }
+ });
+ self.value(value);
+ });
+ };
+ };
+ var lazyFormatSelectBoxItems = function (editor, blocks) {
+ return function () {
+ var items = [];
+ global$4.each(blocks, function (block) {
+ items.push({
+ text: block[0],
+ value: block[1],
+ textStyle: function () {
+ return editor.formatter.getCssText(block[1]);
+ }
+ });
+ });
+ return {
+ type: 'listbox',
+ text: blocks[0][0],
+ values: items,
+ fixedWidth: true,
+ onselect: function (e) {
+ if (e.control) {
+ var fmt = e.control.value();
+ $_ihu3w1aijfuw8wqo.toggleFormat(editor, fmt)();
+ }
+ },
+ onPostRender: createListBoxChangeHandler(editor, items)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ };
+ var buildMenuItems = function (editor, blocks) {
+ return global$4.map(blocks, function (block) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- show: show,
- showForm: showForm,
- reposition: reposition,
- inForm: inForm,
- hide: hide,
- focus: focus,
- remove: remove
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ text: block[0],
+ onclick: $_ihu3w1aijfuw8wqo.toggleFormat(editor, block[1]),
+ textStyle: function () {
+ return editor.formatter.getCssText(block[1]);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var register$4 = function (editor) {
+ var blocks = createFormats$1(editor.settings.block_formats || defaultBlocks);
+ editor.addMenuItem('blockformats', {
+ text: 'Blocks',
+ menu: buildMenuItems(editor, blocks)
+ });
+ editor.addButton('formatselect', lazyFormatSelectBoxItems(editor, blocks));
+ };
+ var $_8bezlh1amjfuw8wqz = { register: register$4 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Conversions.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createCustomMenuItems = function (editor, names) {
+ var items, nameList;
+ if (typeof names === 'string') {
+ nameList = names.split(' ');
+ } else if (global$4.isArray(names)) {
+ return $_1doq1817ejfuw8wen.flatten(global$4.map(names, function (names) {
+ return createCustomMenuItems(editor, names);
+ }));
+ }
+ items = global$4.grep(nameList, function (name) {
+ return name === '|' || name in editor.menuItems;
+ });
+ return global$4.map(items, function (name) {
+ return name === '|' ? { text: '-' } : editor.menuItems[name];
+ });
+ };
+ var isSeparator = function (menuItem) {
+ return menuItem && menuItem.text === '-';
+ };
+ var trimMenuItems = function (menuItems) {
+ var menuItems2 = $_1doq1817ejfuw8wen.filter(menuItems, function (menuItem, i, menuItems) {
+ return !isSeparator(menuItem) || !isSeparator(menuItems[i - 1]);
+ });
+ return $_1doq1817ejfuw8wen.filter(menuItems2, function (menuItem, i, menuItems) {
+ return !isSeparator(menuItem) || i > 0 && i < menuItems.length - 1;
+ });
+ };
+ var createContextMenuItems = function (editor, context) {
+ var outputMenuItems = [{ text: '-' }];
+ var menuItems = global$4.grep(editor.menuItems, function (menuItem) {
+ return menuItem.context === context;
+ });
+ global$4.each(menuItems, function (menuItem) {
+ if (menuItem.separator === 'before') {
+ outputMenuItems.push({ text: '|' });
+ }
+ if (menuItem.prependToContext) {
+ outputMenuItems.unshift(menuItem);
+ } else {
+ outputMenuItems.push(menuItem);
+ }
+ if (menuItem.separator === 'after') {
+ outputMenuItems.push({ text: '|' });
+ }
+ });
+ return outputMenuItems;
+ };
+ var createInsertMenu = function (editor) {
+ var insertButtonItems = editor.settings.insert_button_items;
+ if (insertButtonItems) {
+ return trimMenuItems(createCustomMenuItems(editor, insertButtonItems));
+ } else {
+ return trimMenuItems(createContextMenuItems(editor, 'insert'));
+ }
+ };
+ var registerButtons$3 = function (editor) {
+ editor.addButton('insert', {
+ type: 'menubutton',
+ icon: 'insert',
+ menu: [],
+ oncreatemenu: function () {
+ this.menu.add(createInsertMenu(editor));
+ this.menu.renderNew();
+ }
+ });
+ };
+ var register$5 = function (editor) {
+ registerButtons$3(editor);
+ };
+ var $_46740k1anjfuw8wr1 = { register: register$5 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.inlite.file.Conversions',
- [
- 'tinymce.core.util.Promise'
- ],
- function (Promise) {
- var blobToBase64 = function (blob) {
- return new Promise(function (resolve) {
- var reader = new FileReader();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var registerFormatButtons = function (editor) {
+ global$4.each({
+ bold: 'Bold',
+ italic: 'Italic',
+ underline: 'Underline',
+ strikethrough: 'Strikethrough',
+ subscript: 'Subscript',
+ superscript: 'Superscript'
+ }, function (text, name) {
+ editor.addButton(name, {
+ active: false,
+ tooltip: text,
+ onPostRender: $_ihu3w1aijfuw8wqo.postRenderFormat(editor, name),
+ onclick: $_ihu3w1aijfuw8wqo.toggleFormat(editor, name)
+ });
+ });
+ };
+ var registerCommandButtons = function (editor) {
+ global$4.each({
+ outdent: [
+ 'Decrease indent',
+ 'Outdent'
+ ],
+ indent: [
+ 'Increase indent',
+ 'Indent'
+ ],
+ cut: [
+ 'Cut',
+ 'Cut'
+ ],
+ copy: [
+ 'Copy',
+ 'Copy'
+ ],
+ paste: [
+ 'Paste',
+ 'Paste'
+ ],
+ help: [
+ 'Help',
+ 'mceHelp'
+ ],
+ selectall: [
+ 'Select all',
+ 'SelectAll'
+ ],
+ visualaid: [
+ 'Visual aids',
+ 'mceToggleVisualAid'
+ ],
+ newdocument: [
+ 'New document',
+ 'mceNewDocument'
+ ],
+ removeformat: [
+ 'Clear formatting',
+ 'RemoveFormat'
+ ],
+ remove: [
+ 'Remove',
+ 'Delete'
+ ]
+ }, function (item, name) {
+ editor.addButton(name, {
+ tooltip: item[0],
+ cmd: item[1]
+ });
+ });
+ };
+ var registerCommandToggleButtons = function (editor) {
+ global$4.each({
+ blockquote: [
+ 'Blockquote',
+ 'mceBlockQuote'
+ ],
+ subscript: [
+ 'Subscript',
+ 'Subscript'
+ ],
+ superscript: [
+ 'Superscript',
+ 'Superscript'
+ ]
+ }, function (item, name) {
+ editor.addButton(name, {
+ active: false,
+ tooltip: item[0],
+ cmd: item[1],
+ onPostRender: $_ihu3w1aijfuw8wqo.postRenderFormat(editor, name)
+ });
+ });
+ };
+ var registerButtons$4 = function (editor) {
+ registerFormatButtons(editor);
+ registerCommandButtons(editor);
+ registerCommandToggleButtons(editor);
+ };
+ var registerMenuItems$1 = function (editor) {
+ global$4.each({
+ bold: [
+ 'Bold',
+ 'Bold',
+ 'Meta+B'
+ ],
+ italic: [
+ 'Italic',
+ 'Italic',
+ 'Meta+I'
+ ],
+ underline: [
+ 'Underline',
+ 'Underline',
+ 'Meta+U'
+ ],
+ strikethrough: [
+ 'Strikethrough',
+ 'Strikethrough'
+ ],
+ subscript: [
+ 'Subscript',
+ 'Subscript'
+ ],
+ superscript: [
+ 'Superscript',
+ 'Superscript'
+ ],
+ removeformat: [
+ 'Clear formatting',
+ 'RemoveFormat'
+ ],
+ newdocument: [
+ 'New document',
+ 'mceNewDocument'
+ ],
+ cut: [
+ 'Cut',
+ 'Cut',
+ 'Meta+X'
+ ],
+ copy: [
+ 'Copy',
+ 'Copy',
+ 'Meta+C'
+ ],
+ paste: [
+ 'Paste',
+ 'Paste',
+ 'Meta+V'
+ ],
+ selectall: [
+ 'Select all',
+ 'SelectAll',
+ 'Meta+A'
+ ]
+ }, function (item, name) {
+ editor.addMenuItem(name, {
+ text: item[0],
+ icon: name,
+ shortcut: item[2],
+ cmd: item[1]
+ });
+ });
+ editor.addMenuItem('codeformat', {
+ text: 'Code',
+ icon: 'code',
+ onclick: $_ihu3w1aijfuw8wqo.toggleFormat(editor, 'code')
+ });
+ };
+ var register$6 = function (editor) {
+ registerButtons$4(editor);
+ registerMenuItems$1(editor);
+ };
+ var $_bith3p1aojfuw8wr6 = { register: register$6 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- reader.onloadend = function () {
- resolve(reader.result.split(',')[1]);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toggleUndoRedoState = function (editor, type) {
+ return function () {
+ var self = this;
+ var checkState = function () {
+ var typeFn = type === 'redo' ? 'hasRedo' : 'hasUndo';
+ return editor.undoManager ? editor.undoManager[typeFn]() : false;
+ };
+ self.disabled(!checkState());
+ editor.on('Undo Redo AddUndo TypingUndo ClearUndos SwitchMode', function () {
+ self.disabled(editor.readonly || !checkState());
+ });
+ };
+ };
+ var registerMenuItems$2 = function (editor) {
+ editor.addMenuItem('undo', {
+ text: 'Undo',
+ icon: 'undo',
+ shortcut: 'Meta+Z',
+ onPostRender: toggleUndoRedoState(editor, 'undo'),
+ cmd: 'undo'
+ });
+ editor.addMenuItem('redo', {
+ text: 'Redo',
+ icon: 'redo',
+ shortcut: 'Meta+Y',
+ onPostRender: toggleUndoRedoState(editor, 'redo'),
+ cmd: 'redo'
+ });
+ };
+ var registerButtons$5 = function (editor) {
+ editor.addButton('undo', {
+ tooltip: 'Undo',
+ onPostRender: toggleUndoRedoState(editor, 'undo'),
+ cmd: 'undo'
+ });
+ editor.addButton('redo', {
+ tooltip: 'Redo',
+ onPostRender: toggleUndoRedoState(editor, 'redo'),
+ cmd: 'redo'
+ });
+ };
+ var register$7 = function (editor) {
+ registerMenuItems$2(editor);
+ registerButtons$5(editor);
+ };
+ var $_2t0cyf1apjfuw8wr8 = { register: register$7 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- reader.readAsDataURL(blob);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toggleVisualAidState = function (editor) {
+ return function () {
+ var self = this;
+ editor.on('VisualAid', function (e) {
+ self.active(e.hasVisual);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.active(editor.hasVisual);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var registerMenuItems$3 = function (editor) {
+ editor.addMenuItem('visualaid', {
+ text: 'Visual aids',
+ selectable: true,
+ onPostRender: toggleVisualAidState(editor),
+ cmd: 'mceToggleVisualAid'
+ });
+ };
+ var register$8 = function (editor) {
+ registerMenuItems$3(editor);
+ };
+ var $_7bn4in1aqjfuw8wra = { register: register$8 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- blobToBase64: blobToBase64
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setupEnvironment = function () {
+ Widget.tooltips = !global$1.iOS;
+ Control$1.translate = function (text) {
+ return global$5.translate(text);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var setupUiContainer = function (editor) {
+ if (editor.settings.ui_container) {
+ global$1.container = $_fms31h1aejfuw8wq6.descendant($_fmubbj19ijfuw8wmy.fromDom(document.body), editor.settings.ui_container).fold($_d9fl1s17gjfuw8wew.constant(null), function (elm) {
+ return elm.dom();
+ });
+ }
+ };
+ var setupRtlMode = function (editor) {
+ if (editor.rtl) {
+ Control$1.rtl = true;
+ }
+ };
+ var setupHideFloatPanels = function (editor) {
+ editor.on('mousedown', function () {
+ FloatPanel.hideAll();
+ });
+ };
+ var setup = function (editor) {
+ setupRtlMode(editor);
+ setupHideFloatPanels(editor);
+ setupUiContainer(editor);
+ setupEnvironment();
+ $_8bezlh1amjfuw8wqz.register(editor);
+ $_ezm9hv1ahjfuw8wqn.register(editor);
+ $_bith3p1aojfuw8wr6.register(editor);
+ $_2t0cyf1apjfuw8wr8.register(editor);
+ $_4s7fmc1akjfuw8wqs.register(editor);
+ $_1fynbv1ajjfuw8wqp.register(editor);
+ $_2dqx6v1aljfuw8wqv.register(editor);
+ $_7bn4in1aqjfuw8wra.register(editor);
+ $_46740k1anjfuw8wr1.register(editor);
+ };
+ var $_5jc0r41adjfuw8wpt = { setup: setup };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var GridLayout = AbsoluteLayout.extend({
+ recalc: function (container) {
+ var settings, rows, cols, items, contLayoutRect, width, height, rect, ctrlLayoutRect, ctrl, x, y, posX, posY, ctrlSettings, contPaddingBox, align, spacingH, spacingV, alignH, alignV, maxX, maxY;
+ var colWidths = [];
+ var rowHeights = [];
+ var ctrlMinWidth, ctrlMinHeight, availableWidth, availableHeight, reverseRows, idx;
+ settings = container.settings;
+ items = container.items().filter(':visible');
+ contLayoutRect = container.layoutRect();
+ cols = settings.columns || Math.ceil(Math.sqrt(items.length));
+ rows = Math.ceil(items.length / cols);
+ spacingH = settings.spacingH || settings.spacing || 0;
+ spacingV = settings.spacingV || settings.spacing || 0;
+ alignH = settings.alignH || settings.align;
+ alignV = settings.alignV || settings.align;
+ contPaddingBox = container.paddingBox;
+ reverseRows = 'reverseRows' in settings ? settings.reverseRows : container.isRtl();
+ if (alignH && typeof alignH === 'string') {
+ alignH = [alignH];
+ }
+ if (alignV && typeof alignV === 'string') {
+ alignV = [alignV];
+ }
+ for (x = 0; x < cols; x++) {
+ colWidths.push(0);
+ }
+ for (y = 0; y < rows; y++) {
+ rowHeights.push(0);
+ }
+ for (y = 0; y < rows; y++) {
+ for (x = 0; x < cols; x++) {
+ ctrl = items[y * cols + x];
+ if (!ctrl) {
+ break;
+ }
+ ctrlLayoutRect = ctrl.layoutRect();
+ ctrlMinWidth = ctrlLayoutRect.minW;
+ ctrlMinHeight = ctrlLayoutRect.minH;
+ colWidths[x] = ctrlMinWidth > colWidths[x] ? ctrlMinWidth : colWidths[x];
+ rowHeights[y] = ctrlMinHeight > rowHeights[y] ? ctrlMinHeight : rowHeights[y];
+ }
+ }
+ availableWidth = contLayoutRect.innerW - contPaddingBox.left - contPaddingBox.right;
+ for (maxX = 0, x = 0; x < cols; x++) {
+ maxX += colWidths[x] + (x > 0 ? spacingH : 0);
+ availableWidth -= (x > 0 ? spacingH : 0) + colWidths[x];
+ }
+ availableHeight = contLayoutRect.innerH - contPaddingBox.top - contPaddingBox.bottom;
+ for (maxY = 0, y = 0; y < rows; y++) {
+ maxY += rowHeights[y] + (y > 0 ? spacingV : 0);
+ availableHeight -= (y > 0 ? spacingV : 0) + rowHeights[y];
+ }
+ maxX += contPaddingBox.left + contPaddingBox.right;
+ maxY += contPaddingBox.top + contPaddingBox.bottom;
+ rect = {};
+ rect.minW = maxX + (contLayoutRect.w - contLayoutRect.innerW);
+ rect.minH = maxY + (contLayoutRect.h - contLayoutRect.innerH);
+ rect.contentW = rect.minW - contLayoutRect.deltaW;
+ rect.contentH = rect.minH - contLayoutRect.deltaH;
+ rect.minW = Math.min(rect.minW, contLayoutRect.maxW);
+ rect.minH = Math.min(rect.minH, contLayoutRect.maxH);
+ rect.minW = Math.max(rect.minW, contLayoutRect.startMinWidth);
+ rect.minH = Math.max(rect.minH, contLayoutRect.startMinHeight);
+ if (contLayoutRect.autoResize && (rect.minW !== contLayoutRect.minW || rect.minH !== contLayoutRect.minH)) {
+ rect.w = rect.minW;
+ rect.h = rect.minH;
+ container.layoutRect(rect);
+ this.recalc(container);
+ if (container._lastRect === null) {
+ var parentCtrl = container.parent();
+ if (parentCtrl) {
+ parentCtrl._lastRect = null;
+ parentCtrl.recalc();
+ }
+ }
+ return;
+ }
+ if (contLayoutRect.autoResize) {
+ rect = container.layoutRect(rect);
+ rect.contentW = rect.minW - contLayoutRect.deltaW;
+ rect.contentH = rect.minH - contLayoutRect.deltaH;
+ }
+ var flexV;
+ if (settings.packV === 'start') {
+ flexV = 0;
+ } else {
+ flexV = availableHeight > 0 ? Math.floor(availableHeight / rows) : 0;
+ }
+ var totalFlex = 0;
+ var flexWidths = settings.flexWidths;
+ if (flexWidths) {
+ for (x = 0; x < flexWidths.length; x++) {
+ totalFlex += flexWidths[x];
+ }
+ } else {
+ totalFlex = cols;
+ }
+ var ratio = availableWidth / totalFlex;
+ for (x = 0; x < cols; x++) {
+ colWidths[x] += flexWidths ? flexWidths[x] * ratio : ratio;
+ }
+ posY = contPaddingBox.top;
+ for (y = 0; y < rows; y++) {
+ posX = contPaddingBox.left;
+ height = rowHeights[y] + flexV;
+ for (x = 0; x < cols; x++) {
+ if (reverseRows) {
+ idx = y * cols + cols - 1 - x;
+ } else {
+ idx = y * cols + x;
+ }
+ ctrl = items[idx];
+ if (!ctrl) {
+ break;
+ }
+ ctrlSettings = ctrl.settings;
+ ctrlLayoutRect = ctrl.layoutRect();
+ width = Math.max(colWidths[x], ctrlLayoutRect.startMinWidth);
+ ctrlLayoutRect.x = posX;
+ ctrlLayoutRect.y = posY;
+ align = ctrlSettings.alignH || (alignH ? alignH[x] || alignH[0] : null);
+ if (align === 'center') {
+ ctrlLayoutRect.x = posX + width / 2 - ctrlLayoutRect.w / 2;
+ } else if (align === 'right') {
+ ctrlLayoutRect.x = posX + width - ctrlLayoutRect.w;
+ } else if (align === 'stretch') {
+ ctrlLayoutRect.w = width;
+ }
+ align = ctrlSettings.alignV || (alignV ? alignV[x] || alignV[0] : null);
+ if (align === 'center') {
+ ctrlLayoutRect.y = posY + height / 2 - ctrlLayoutRect.h / 2;
+ } else if (align === 'bottom') {
+ ctrlLayoutRect.y = posY + height - ctrlLayoutRect.h;
+ } else if (align === 'stretch') {
+ ctrlLayoutRect.h = height;
+ }
+ ctrl.layoutRect(ctrlLayoutRect);
+ posX += width + spacingH;
+ if (ctrl.recalc) {
+ ctrl.recalc();
+ }
+ }
+ posY += height + spacingV;
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Iframe = Widget.extend({
+ renderHtml: function () {
+ var self = this;
+ self.classes.add('iframe');
+ self.canFocus = false;
+ return '<iframe id="' + self._id + '" class="' + self.classes + '" tabindex="-1" src="' + (self.settings.url || 'javascript:\'\'') + '" frameborder="0"></iframe>';
+ },
+ src: function (src) {
+ this.getEl().src = src;
+ },
+ html: function (html, callback) {
+ var self = this, body = this.getEl().contentWindow.document.body;
+ if (!body) {
+ global$3.setTimeout(function () {
+ self.html(html);
+ });
+ } else {
+ body.innerHTML = html;
+ if (callback) {
+ callback();
+ }
+ }
+ return this;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Picker.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var InfoBox = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.classes.add('widget').add('infobox');
+ self.canFocus = false;
+ },
+ severity: function (level) {
+ this.classes.remove('error');
+ this.classes.remove('warning');
+ this.classes.remove('success');
+ this.classes.add(level);
+ },
+ help: function (state) {
+ this.state.set('help', state);
+ },
+ renderHtml: function () {
+ var self = this, prefix = self.classPrefix;
+ return '<div id="' + self._id + '" class="' + self.classes + '">' + '<div id="' + self._id + '-body">' + self.encode(self.state.get('text')) + '<button role="button" tabindex="-1">' + '<i class="' + prefix + 'ico ' + prefix + 'i-help"></i>' + '</button>' + '</div>' + '</div>';
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:text', function (e) {
+ self.getEl('body').firstChild.data = self.encode(e.value);
+ if (self.state.get('rendered')) {
+ self.updateLayoutRect();
+ }
+ });
+ self.state.on('change:help', function (e) {
+ self.classes.toggle('has-help', e.value);
+ if (self.state.get('rendered')) {
+ self.updateLayoutRect();
+ }
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.inlite.file.Picker',
- [
- 'tinymce.core.util.Promise'
- ],
- function (Promise) {
- var pickFile = function () {
- return new Promise(function (resolve) {
- var fileInput;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Label = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.classes.add('widget').add('label');
+ self.canFocus = false;
+ if (settings.multiline) {
+ self.classes.add('autoscroll');
+ }
+ if (settings.strong) {
+ self.classes.add('strong');
+ }
+ },
+ initLayoutRect: function () {
+ var self = this, layoutRect = self._super();
+ if (self.settings.multiline) {
+ var size = funcs.getSize(self.getEl());
+ if (size.width > layoutRect.maxW) {
+ layoutRect.minW = layoutRect.maxW;
+ self.classes.add('multiline');
+ }
+ self.getEl().style.width = layoutRect.minW + 'px';
+ layoutRect.startMinH = layoutRect.h = layoutRect.minH = Math.min(layoutRect.maxH, funcs.getSize(self.getEl()).height);
+ }
+ return layoutRect;
+ },
+ repaint: function () {
+ var self = this;
+ if (!self.settings.multiline) {
+ self.getEl().style.lineHeight = self.layoutRect().h + 'px';
+ }
+ return self._super();
+ },
+ severity: function (level) {
+ this.classes.remove('error');
+ this.classes.remove('warning');
+ this.classes.remove('success');
+ this.classes.add(level);
+ },
+ renderHtml: function () {
+ var self = this;
+ var targetCtrl, forName, forId = self.settings.forId;
+ var text = self.settings.html ? self.settings.html : self.encode(self.state.get('text'));
+ if (!forId && (forName = self.settings.forName)) {
+ targetCtrl = self.getRoot().find('#' + forName)[0];
+ if (targetCtrl) {
+ forId = targetCtrl._id;
+ }
+ }
+ if (forId) {
+ return '<label id="' + self._id + '" class="' + self.classes + '"' + (forId ? ' for="' + forId + '"' : '') + '>' + text + '</label>';
+ }
+ return '<span id="' + self._id + '" class="' + self.classes + '">' + text + '</span>';
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:text', function (e) {
+ self.innerHtml(self.encode(e.value));
+ if (self.state.get('rendered')) {
+ self.updateLayoutRect();
+ }
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- fileInput = document.createElement("input");
- fileInput.type = "file";
- fileInput.style.position = 'fixed';
- fileInput.style.left = 0;
- fileInput.style.top = 0;
- fileInput.style.opacity = 0.001;
- document.body.appendChild(fileInput);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Toolbar$1 = Container.extend({
+ Defaults: {
+ role: 'toolbar',
+ layout: 'flow'
+ },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.classes.add('toolbar');
+ },
+ postRender: function () {
+ var self = this;
+ self.items().each(function (ctrl) {
+ ctrl.classes.add('toolbar-item');
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- fileInput.onchange = function (e) {
- resolve(Array.prototype.slice.call(e.target.files));
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var MenuBar = Toolbar$1.extend({
+ Defaults: {
+ role: 'menubar',
+ containerCls: 'menubar',
+ ariaRoot: true,
+ defaults: { type: 'menubutton' }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- fileInput.click();
- fileInput.parentNode.removeChild(fileInput);
- });
- };
-
- return {
- pickFile: pickFile
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function isChildOf$1(node, parent) {
+ while (node) {
+ if (parent === node) {
+ return true;
+ }
+ node = node.parentNode;
+ }
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-
-
-
-/**
- * Buttons.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.inlite.ui.Buttons',
- [
- 'tinymce.themes.inlite.ui.Panel',
- 'tinymce.themes.inlite.file.Conversions',
- 'tinymce.themes.inlite.file.Picker',
- 'tinymce.themes.inlite.core.Actions'
- ],
- function (Panel, Conversions, Picker, Actions) {
- var addHeaderButtons = function (editor) {
- var formatBlock = function (name) {
- return function () {
- Actions.formatBlock(editor, name);
- };
- };
-
- for (var i = 1; i < 6; i++) {
- var name = 'h' + i;
-
- editor.addButton(name, {
- text: name.toUpperCase(),
- tooltip: 'Heading ' + i,
- stateSelector: name,
- onclick: formatBlock(name),
- onPostRender: function () {
- // TODO: Remove this hack that produces bold H1-H6 when we have proper icons
- var span = this.getEl().firstChild.firstChild;
- span.style.fontWeight = 'bold';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var MenuButton = Button.extend({
+ init: function (settings) {
+ var self = this;
+ self._renderOpen = true;
+ self._super(settings);
+ settings = self.settings;
+ self.classes.add('menubtn');
+ if (settings.fixedWidth) {
+ self.classes.add('fixed-width');
+ }
+ self.aria('haspopup', true);
+ self.state.set('menu', settings.menu || self.render());
+ },
+ showMenu: function (toggle) {
+ var self = this;
+ var menu;
+ if (self.menu && self.menu.visible() && toggle !== false) {
+ return self.hideMenu();
+ }
+ if (!self.menu) {
+ menu = self.state.get('menu') || [];
+ self.classes.add('opened');
+ if (menu.length) {
+ menu = {
+ type: 'menu',
+ animate: true,
+ items: menu
+ };
+ } else {
+ menu.type = menu.type || 'menu';
+ menu.animate = true;
+ }
+ if (!menu.renderTo) {
+ self.menu = global$11.create(menu).parent(self).renderTo();
+ } else {
+ self.menu = menu.parent(self).show().renderTo();
+ }
+ self.fire('createmenu');
+ self.menu.reflow();
+ self.menu.on('cancel', function (e) {
+ if (e.control.parent() === self.menu) {
+ e.stopPropagation();
+ self.focus();
+ self.hideMenu();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.menu.on('select', function () {
+ self.focus();
+ });
+ self.menu.on('show hide', function (e) {
+ if (e.control === self.menu) {
+ self.activeMenu(e.type === 'show');
+ self.classes.toggle('opened', e.type === 'show');
+ }
+ self.aria('expanded', e.type === 'show');
+ }).fire('show');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var addToEditor = function (editor, panel) {
- editor.addButton('quicklink', {
- icon: 'link',
- tooltip: 'Insert/Edit link',
- stateSelector: 'a[href]',
- onclick: function () {
- panel.showForm(editor, 'quicklink');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.menu.show();
+ self.menu.layoutRect({ w: self.layoutRect().w });
+ self.menu.repaint();
+ self.menu.moveRel(self.getEl(), self.isRtl() ? [
+ 'br-tr',
+ 'tr-br'
+ ] : [
+ 'bl-tl',
+ 'tl-bl'
+ ]);
+ self.fire('showmenu');
+ },
+ hideMenu: function () {
+ var self = this;
+ if (self.menu) {
+ self.menu.items().each(function (item) {
+ if (item.hideMenu) {
+ item.hideMenu();
+ }
+ });
+ self.menu.hide();
+ }
+ },
+ activeMenu: function (state) {
+ this.classes.toggle('active', state);
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = self.classPrefix;
+ var icon = self.settings.icon, image;
+ var text = self.state.get('text');
+ var textHtml = '';
+ image = self.settings.image;
+ if (image) {
+ icon = 'none';
+ if (typeof image !== 'string') {
+ image = window.getSelection ? image[0] : image[1];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ image = ' style="background-image: url(\'' + image + '\')"';
+ } else {
+ image = '';
+ }
+ if (text) {
+ self.classes.add('btn-has-text');
+ textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
+ }
+ icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
+ self.aria('role', self.parent() instanceof MenuBar ? 'menuitem' : 'button');
+ return '<div id="' + id + '" class="' + self.classes + '" tabindex="-1" aria-labelledby="' + id + '">' + '<button id="' + id + '-open" role="presentation" type="button" tabindex="-1">' + (icon ? '<i class="' + icon + '"' + image + '></i>' : '') + textHtml + ' <i class="' + prefix + 'caret"></i>' + '</button>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ self.on('click', function (e) {
+ if (e.control === self && isChildOf$1(e.target, self.getEl())) {
+ self.focus();
+ self.showMenu(!e.aria);
+ if (e.aria) {
+ self.menu.items().filter(':visible')[0].focus();
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.addButton('quickimage', {
- icon: 'image',
- tooltip: 'Insert image',
- onclick: function () {
- Picker.pickFile().then(function (files) {
- var blob = files[0];
-
- Conversions.blobToBase64(blob).then(function (base64) {
- Actions.insertBlob(editor, base64, blob);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.on('mouseenter', function (e) {
+ var overCtrl = e.control;
+ var parent = self.parent();
+ var hasVisibleSiblingMenu;
+ if (overCtrl && parent && overCtrl instanceof MenuButton && overCtrl.parent() === parent) {
+ parent.items().filter('MenuButton').each(function (ctrl) {
+ if (ctrl.hideMenu && ctrl !== overCtrl) {
+ if (ctrl.menu && ctrl.menu.visible()) {
+ hasVisibleSiblingMenu = true;
+ }
+ ctrl.hideMenu();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (hasVisibleSiblingMenu) {
+ overCtrl.focus();
+ overCtrl.showMenu();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.addButton('quicktable', {
- icon: 'table',
- tooltip: 'Insert table',
- onclick: function () {
- panel.hide();
- Actions.insertTable(editor, 2, 2);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self._super();
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:menu', function () {
+ if (self.menu) {
+ self.menu.remove();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.menu = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self._super();
+ },
+ remove: function () {
+ this._super();
+ if (this.menu) {
+ this.menu.remove();
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- addHeaderButtons(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function Throbber (elm, inline) {
+ var self = this;
+ var state;
+ var classPrefix = Control$1.classPrefix;
+ var timer;
+ self.show = function (time, callback) {
+ function render() {
+ if (state) {
+ global$7(elm).append('<div class="' + classPrefix + 'throbber' + (inline ? ' ' + classPrefix + 'throbber-inline' : '') + '"></div>');
+ if (callback) {
+ callback();
+ }
+ }
+ }
+ self.hide();
+ state = true;
+ if (time) {
+ timer = global$3.setTimeout(render, time);
+ } else {
+ render();
+ }
+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- addToEditor: addToEditor
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.hide = function () {
+ var child = elm.lastChild;
+ global$3.clearTimeout(timer);
+ if (child && child.className.indexOf('throbber') !== -1) {
+ child.parentNode.removeChild(child);
+ }
+ state = false;
+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Theme.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Menu = FloatPanel.extend({
+ Defaults: {
+ defaultType: 'menuitem',
+ border: 1,
+ layout: 'stack',
+ role: 'application',
+ bodyRole: 'menu',
+ ariaRoot: true
+ },
+ init: function (settings) {
+ var self = this;
+ settings.autohide = true;
+ settings.constrainToViewport = true;
+ if (typeof settings.items === 'function') {
+ settings.itemsFactory = settings.items;
+ settings.items = [];
+ }
+ if (settings.itemDefaults) {
+ var items = settings.items;
+ var i = items.length;
+ while (i--) {
+ items[i] = global$4.extend({}, settings.itemDefaults, items[i]);
+ }
+ }
+ self._super(settings);
+ self.classes.add('menu');
+ if (settings.animate && global$1.ie !== 11) {
+ self.classes.add('animate');
+ }
+ },
+ repaint: function () {
+ this.classes.toggle('menu-align', true);
+ this._super();
+ this.getEl().style.height = '';
+ this.getEl('body').style.height = '';
+ return this;
+ },
+ cancel: function () {
+ var self = this;
+ self.hideAll();
+ self.fire('select');
+ },
+ load: function () {
+ var self = this;
+ var time, factory;
+ function hideThrobber() {
+ if (self.throbber) {
+ self.throbber.hide();
+ self.throbber = null;
+ }
+ }
+ factory = self.settings.itemsFactory;
+ if (!factory) {
+ return;
+ }
+ if (!self.throbber) {
+ self.throbber = new Throbber(self.getEl('body'), true);
+ if (self.items().length === 0) {
+ self.throbber.show();
+ self.fire('loading');
+ } else {
+ self.throbber.show(100, function () {
+ self.items().remove();
+ self.fire('loading');
+ });
+ }
+ self.on('hide close', hideThrobber);
+ }
+ self.requestTime = time = new Date().getTime();
+ self.settings.itemsFactory(function (items) {
+ if (items.length === 0) {
+ self.hide();
+ return;
+ }
+ if (self.requestTime !== time) {
+ return;
+ }
+ self.getEl().style.width = '';
+ self.getEl('body').style.width = '';
+ hideThrobber();
+ self.items().remove();
+ self.getEl('body').innerHTML = '';
+ self.add(items);
+ self.renderNew();
+ self.fire('loaded');
+ });
+ },
+ hideAll: function () {
+ var self = this;
+ this.find('menuitem').exec('hideMenu');
+ return self._super();
+ },
+ preRender: function () {
+ var self = this;
+ self.items().each(function (ctrl) {
+ var settings = ctrl.settings;
+ if (settings.icon || settings.image || settings.selectable) {
+ self._hasIcons = true;
+ return false;
+ }
+ });
+ if (self.settings.itemsFactory) {
+ self.on('postrender', function () {
+ if (self.settings.itemsFactory) {
+ self.load();
+ }
+ });
+ }
+ self.on('show hide', function (e) {
+ if (e.control === self) {
+ if (e.type === 'show') {
+ global$3.setTimeout(function () {
+ self.classes.add('in');
+ }, 0);
+ } else {
+ self.classes.remove('in');
+ }
+ }
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.inlite.Theme',
- [
- 'tinymce.core.ThemeManager',
- 'tinymce.core.ui.Api',
- 'tinymce.core.util.Delay',
- 'tinymce.themes.inlite.alien.Arr',
- 'tinymce.themes.inlite.alien.EditorSettings',
- 'tinymce.themes.inlite.core.ElementMatcher',
- 'tinymce.themes.inlite.core.Matcher',
- 'tinymce.themes.inlite.core.PredicateId',
- 'tinymce.themes.inlite.core.SelectionMatcher',
- 'tinymce.themes.inlite.core.SkinLoader',
- 'tinymce.themes.inlite.ui.Buttons',
- 'tinymce.themes.inlite.ui.Panel'
- ],
- function (
- ThemeManager, Api, Delay, Arr, EditorSettings, ElementMatcher, Matcher,
- PredicateId, SelectionMatcher, SkinLoader, Buttons, Panel
- ) {
- var getSelectionElements = function (editor) {
- var node = editor.selection.getNode();
- var elms = editor.dom.getParents(node);
- return elms;
- };
-
- var createToolbar = function (editor, selector, id, items) {
- var selectorPredicate = function (elm) {
- return editor.dom.is(elm, selector);
- };
-
- return {
- predicate: selectorPredicate,
- id: id,
- items: items
- };
- };
-
- var getToolbars = function (editor) {
- var contextToolbars = editor.contextToolbars;
-
- return Arr.flatten([
- contextToolbars ? contextToolbars : [],
- createToolbar(editor, 'img', 'image', 'alignleft aligncenter alignright')
- ]);
- };
-
- var findMatchResult = function (editor, toolbars) {
- var result, elements, contextToolbarsPredicateIds;
-
- elements = getSelectionElements(editor);
- contextToolbarsPredicateIds = PredicateId.fromContextToolbars(toolbars);
-
- result = Matcher.match(editor, [
- ElementMatcher.element(elements[0], contextToolbarsPredicateIds),
- SelectionMatcher.textSelection('text'),
- SelectionMatcher.emptyTextBlock(elements, 'insert'),
- ElementMatcher.parent(elements, contextToolbarsPredicateIds)
- ]);
-
- return result && result.rect ? result : null;
- };
-
- var togglePanel = function (editor, panel) {
- var toggle = function () {
- var toolbars = getToolbars(editor);
- var result = findMatchResult(editor, toolbars);
-
- if (result) {
- panel.show(editor, result.id, result.rect, toolbars);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ListBox = MenuButton.extend({
+ init: function (settings) {
+ var self = this;
+ var values, selected, selectedText, lastItemCtrl;
+ function setSelected(menuValues) {
+ for (var i = 0; i < menuValues.length; i++) {
+ selected = menuValues[i].selected || settings.value === menuValues[i].value;
+ if (selected) {
+ selectedText = selectedText || menuValues[i].text;
+ self.state.set('value', menuValues[i].value);
+ return true;
+ }
+ if (menuValues[i].menu) {
+ if (setSelected(menuValues[i].menu)) {
+ return true;
+ }
+ }
+ }
+ }
+ self._super(settings);
+ settings = self.settings;
+ self._values = values = settings.values;
+ if (values) {
+ if (typeof settings.value !== 'undefined') {
+ setSelected(values);
+ }
+ if (!selected && values.length > 0) {
+ selectedText = values[0].text;
+ self.state.set('value', values[0].value);
+ }
+ self.state.set('menu', values);
+ }
+ self.state.set('text', settings.text || selectedText);
+ self.classes.add('listbox');
+ self.on('select', function (e) {
+ var ctrl = e.control;
+ if (lastItemCtrl) {
+ e.lastControl = lastItemCtrl;
+ }
+ if (settings.multiple) {
+ ctrl.active(!ctrl.active());
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- panel.hide();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.value(e.control.value());
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ lastItemCtrl = ctrl;
+ });
+ },
+ value: function (value) {
+ if (arguments.length === 0) {
+ return this.state.get('value');
+ }
+ if (typeof value === 'undefined') {
+ return this;
+ }
+ if (this.settings.values) {
+ var matchingValues = global$4.grep(this.settings.values, function (a) {
+ return a.value === value;
+ });
+ if (matchingValues.length > 0) {
+ this.state.set('value', value);
+ } else if (value === null) {
+ this.state.set('value', null);
+ }
+ } else {
+ this.state.set('value', value);
+ }
+ return this;
+ },
+ bindStates: function () {
+ var self = this;
+ function activateMenuItemsByValue(menu, value) {
+ if (menu instanceof Menu) {
+ menu.items().each(function (ctrl) {
+ if (!ctrl.hasMenus()) {
+ ctrl.active(ctrl.value() === value);
+ }
+ });
+ }
+ }
+ function getSelectedItem(menuValues, value) {
+ var selectedItem;
+ if (!menuValues) {
+ return;
+ }
+ for (var i = 0; i < menuValues.length; i++) {
+ if (menuValues[i].value === value) {
+ return menuValues[i];
+ }
+ if (menuValues[i].menu) {
+ selectedItem = getSelectedItem(menuValues[i].menu, value);
+ if (selectedItem) {
+ return selectedItem;
+ }
+ }
+ }
+ }
+ self.on('show', function (e) {
+ activateMenuItemsByValue(e.control, self.value());
+ });
+ self.state.on('change:value', function (e) {
+ var selectedItem = getSelectedItem(self.state.get('menu'), e.value);
+ if (selectedItem) {
+ self.text(selectedItem.text);
+ } else {
+ self.text(self.settings.text);
+ }
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return function () {
- if (!editor.removed) {
- toggle();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toggleTextStyle = function (ctrl, state) {
+ var textStyle = ctrl._textStyle;
+ if (textStyle) {
+ var textElm = ctrl.getEl('text');
+ textElm.setAttribute('style', textStyle);
+ if (state) {
+ textElm.style.color = '';
+ textElm.style.backgroundColor = '';
+ }
+ }
+ };
+ var MenuItem = Widget.extend({
+ Defaults: {
+ border: 0,
+ role: 'menuitem'
+ },
+ init: function (settings) {
+ var self = this;
+ var text;
+ self._super(settings);
+ settings = self.settings;
+ self.classes.add('menu-item');
+ if (settings.menu) {
+ self.classes.add('menu-item-expand');
+ }
+ if (settings.preview) {
+ self.classes.add('menu-item-preview');
+ }
+ text = self.state.get('text');
+ if (text === '-' || text === '|') {
+ self.classes.add('menu-item-sep');
+ self.aria('role', 'separator');
+ self.state.set('text', '-');
+ }
+ if (settings.selectable) {
+ self.aria('role', 'menuitemcheckbox');
+ self.classes.add('menu-item-checkbox');
+ settings.icon = 'selected';
+ }
+ if (!settings.preview && !settings.selectable) {
+ self.classes.add('menu-item-normal');
+ }
+ self.on('mousedown', function (e) {
+ e.preventDefault();
+ });
+ if (settings.menu && !settings.ariaHideMenu) {
+ self.aria('haspopup', true);
+ }
+ },
+ hasMenus: function () {
+ return !!this.settings.menu;
+ },
+ showMenu: function () {
+ var self = this;
+ var settings = self.settings;
+ var menu;
+ var parent = self.parent();
+ parent.items().each(function (ctrl) {
+ if (ctrl !== self) {
+ ctrl.hideMenu();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ if (settings.menu) {
+ menu = self.menu;
+ if (!menu) {
+ menu = settings.menu;
+ if (menu.length) {
+ menu = {
+ type: 'menu',
+ items: menu
+ };
+ } else {
+ menu.type = menu.type || 'menu';
+ }
+ if (parent.settings.itemDefaults) {
+ menu.itemDefaults = parent.settings.itemDefaults;
+ }
+ menu = self.menu = global$11.create(menu).parent(self).renderTo();
+ menu.reflow();
+ menu.on('cancel', function (e) {
+ e.stopPropagation();
+ self.focus();
+ menu.hide();
+ });
+ menu.on('show hide', function (e) {
+ if (e.control.items) {
+ e.control.items().each(function (ctrl) {
+ ctrl.active(ctrl.settings.selected);
+ });
+ }
+ }).fire('show');
+ menu.on('hide', function (e) {
+ if (e.control === menu) {
+ self.classes.remove('selected');
+ }
+ });
+ menu.submenu = true;
+ } else {
+ menu.show();
+ }
+ menu._parentMenu = parent;
+ menu.classes.add('menu-sub');
+ var rel = menu.testMoveRel(self.getEl(), self.isRtl() ? [
+ 'tl-tr',
+ 'bl-br',
+ 'tr-tl',
+ 'br-bl'
+ ] : [
+ 'tr-tl',
+ 'br-bl',
+ 'tl-tr',
+ 'bl-br'
+ ]);
+ menu.moveRel(self.getEl(), rel);
+ menu.rel = rel;
+ rel = 'menu-sub-' + rel;
+ menu.classes.remove(menu._lastRel).add(rel);
+ menu._lastRel = rel;
+ self.classes.add('selected');
+ self.aria('expanded', true);
+ }
+ },
+ hideMenu: function () {
+ var self = this;
+ if (self.menu) {
+ self.menu.items().each(function (item) {
+ if (item.hideMenu) {
+ item.hideMenu();
+ }
+ });
+ self.menu.hide();
+ self.aria('expanded', false);
+ }
+ return self;
+ },
+ renderHtml: function () {
+ var self = this;
+ var id = self._id;
+ var settings = self.settings;
+ var prefix = self.classPrefix;
+ var text = self.state.get('text');
+ var icon = self.settings.icon, image = '', shortcut = settings.shortcut;
+ var url = self.encode(settings.url), iconHtml = '';
+ function convertShortcut(shortcut) {
+ var i, value, replace = {};
+ if (global$1.mac) {
+ replace = {
+ alt: '⌥',
+ ctrl: '⌘',
+ shift: '⇧',
+ meta: '⌘'
+ };
+ } else {
+ replace = { meta: 'Ctrl' };
+ }
+ shortcut = shortcut.split('+');
+ for (i = 0; i < shortcut.length; i++) {
+ value = replace[shortcut[i].toLowerCase()];
+ if (value) {
+ shortcut[i] = value;
+ }
+ }
+ return shortcut.join('+');
+ }
+ function escapeRegExp(str) {
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ }
+ function markMatches(text) {
+ var match = settings.match || '';
+ return match ? text.replace(new RegExp(escapeRegExp(match), 'gi'), function (match) {
+ return '!mce~match[' + match + ']mce~match!';
+ }) : text;
+ }
+ function boldMatches(text) {
+ return text.replace(new RegExp(escapeRegExp('!mce~match['), 'g'), '<b>').replace(new RegExp(escapeRegExp(']mce~match!'), 'g'), '</b>');
+ }
+ if (icon) {
+ self.parent().classes.add('menu-has-icons');
+ }
+ if (settings.image) {
+ image = ' style="background-image: url(\'' + settings.image + '\')"';
+ }
+ if (shortcut) {
+ shortcut = convertShortcut(shortcut);
+ }
+ icon = prefix + 'ico ' + prefix + 'i-' + (self.settings.icon || 'none');
+ iconHtml = text !== '-' ? '<i class="' + icon + '"' + image + '></i>\xA0' : '';
+ text = boldMatches(self.encode(markMatches(text)));
+ url = boldMatches(self.encode(markMatches(url)));
+ return '<div id="' + id + '" class="' + self.classes + '" tabindex="-1">' + iconHtml + (text !== '-' ? '<span id="' + id + '-text" class="' + prefix + 'text">' + text + '</span>' : '') + (shortcut ? '<div id="' + id + '-shortcut" class="' + prefix + 'menu-shortcut">' + shortcut + '</div>' : '') + (settings.menu ? '<div class="' + prefix + 'caret"></div>' : '') + (url ? '<div class="' + prefix + 'menu-item-link">' + url + '</div>' : '') + '</div>';
+ },
+ postRender: function () {
+ var self = this, settings = self.settings;
+ var textStyle = settings.textStyle;
+ if (typeof textStyle === 'function') {
+ textStyle = textStyle.call(this);
+ }
+ if (textStyle) {
+ var textElm = self.getEl('text');
+ if (textElm) {
+ textElm.setAttribute('style', textStyle);
+ self._textStyle = textStyle;
+ }
+ }
+ self.on('mouseenter click', function (e) {
+ if (e.control === self) {
+ if (!settings.menu && e.type === 'click') {
+ self.fire('select');
+ global$3.requestAnimationFrame(function () {
+ self.parent().hideAll();
+ });
+ } else {
+ self.showMenu();
+ if (e.aria) {
+ self.menu.focus(true);
+ }
+ }
+ }
+ });
+ self._super();
+ return self;
+ },
+ hover: function () {
+ var self = this;
+ self.parent().items().each(function (ctrl) {
+ ctrl.classes.remove('selected');
+ });
+ self.classes.toggle('selected', true);
+ return self;
+ },
+ active: function (state) {
+ toggleTextStyle(this, state);
+ if (typeof state !== 'undefined') {
+ this.aria('checked', state);
+ }
+ return this._super(state);
+ },
+ remove: function () {
+ this._super();
+ if (this.menu) {
+ this.menu.remove();
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var repositionPanel = function (editor, panel) {
- return function () {
- var toolbars = getToolbars(editor);
- var result = findMatchResult(editor, toolbars);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Radio = Checkbox.extend({
+ Defaults: {
+ classes: 'radio',
+ role: 'radio'
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (result) {
- panel.reposition(editor, result.id, result.rect);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ResizeHandle = Widget.extend({
+ renderHtml: function () {
+ var self = this, prefix = self.classPrefix;
+ self.classes.add('resizehandle');
+ if (self.settings.direction === 'both') {
+ self.classes.add('resizehandle-both');
+ }
+ self.canFocus = false;
+ return '<div id="' + self._id + '" class="' + self.classes + '">' + '<i class="' + prefix + 'ico ' + prefix + 'i-resize"></i>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ self._super();
+ self.resizeDragHelper = new DragHelper(this._id, {
+ start: function () {
+ self.fire('ResizeStart');
+ },
+ drag: function (e) {
+ if (self.settings.direction !== 'both') {
+ e.deltaX = 0;
+ }
+ self.fire('Resize', e);
+ },
+ stop: function () {
+ self.fire('ResizeEnd');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ },
+ remove: function () {
+ if (this.resizeDragHelper) {
+ this.resizeDragHelper.destroy();
+ }
+ return this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var ignoreWhenFormIsVisible = function (editor, panel, f) {
- return function () {
- if (!editor.removed && !panel.inForm()) {
- f();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function createOptions(options) {
+ var strOptions = '';
+ if (options) {
+ for (var i = 0; i < options.length; i++) {
+ strOptions += '<option value="' + options[i] + '">' + options[i] + '</option>';
+ }
+ }
+ return strOptions;
+ }
+ var SelectBox = Widget.extend({
+ Defaults: {
+ classes: 'selectbox',
+ role: 'selectbox',
+ options: []
+ },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ if (self.settings.size) {
+ self.size = self.settings.size;
+ }
+ if (self.settings.options) {
+ self._options = self.settings.options;
+ }
+ self.on('keydown', function (e) {
+ var rootControl;
+ if (e.keyCode === 13) {
+ e.preventDefault();
+ self.parents().reverse().each(function (ctrl) {
+ if (ctrl.toJSON) {
+ rootControl = ctrl;
+ return false;
+ }
+ });
+ self.fire('submit', { data: rootControl.toJSON() });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ },
+ options: function (state) {
+ if (!arguments.length) {
+ return this.state.get('options');
+ }
+ this.state.set('options', state);
+ return this;
+ },
+ renderHtml: function () {
+ var self = this;
+ var options, size = '';
+ options = createOptions(self._options);
+ if (self.size) {
+ size = ' size = "' + self.size + '"';
+ }
+ return '<select id="' + self._id + '" class="' + self.classes + '"' + size + '>' + options + '</select>';
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:options', function (e) {
+ self.getEl().innerHTML = createOptions(e.value);
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var bindContextualToolbarsEvents = function (editor, panel) {
- var throttledTogglePanel = Delay.throttle(togglePanel(editor, panel), 0);
- var throttledTogglePanelWhenNotInForm = Delay.throttle(ignoreWhenFormIsVisible(editor, panel, togglePanel(editor, panel)), 0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function constrain(value, minVal, maxVal) {
+ if (value < minVal) {
+ value = minVal;
+ }
+ if (value > maxVal) {
+ value = maxVal;
+ }
+ return value;
+ }
+ function setAriaProp(el, name, value) {
+ el.setAttribute('aria-' + name, value);
+ }
+ function updateSliderHandle(ctrl, value) {
+ var maxHandlePos, shortSizeName, sizeName, stylePosName, styleValue, handleEl;
+ if (ctrl.settings.orientation === 'v') {
+ stylePosName = 'top';
+ sizeName = 'height';
+ shortSizeName = 'h';
+ } else {
+ stylePosName = 'left';
+ sizeName = 'width';
+ shortSizeName = 'w';
+ }
+ handleEl = ctrl.getEl('handle');
+ maxHandlePos = (ctrl.layoutRect()[shortSizeName] || 100) - funcs.getSize(handleEl)[sizeName];
+ styleValue = maxHandlePos * ((value - ctrl._minValue) / (ctrl._maxValue - ctrl._minValue)) + 'px';
+ handleEl.style[stylePosName] = styleValue;
+ handleEl.style.height = ctrl.layoutRect().h + 'px';
+ setAriaProp(handleEl, 'valuenow', value);
+ setAriaProp(handleEl, 'valuetext', '' + ctrl.settings.previewFilter(value));
+ setAriaProp(handleEl, 'valuemin', ctrl._minValue);
+ setAriaProp(handleEl, 'valuemax', ctrl._maxValue);
+ }
+ var Slider = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ if (!settings.previewFilter) {
+ settings.previewFilter = function (value) {
+ return Math.round(value * 100) / 100;
+ };
+ }
+ self._super(settings);
+ self.classes.add('slider');
+ if (settings.orientation === 'v') {
+ self.classes.add('vertical');
+ }
+ self._minValue = $_d02u5u17hjfuw8wey.isNumber(settings.minValue) ? settings.minValue : 0;
+ self._maxValue = $_d02u5u17hjfuw8wey.isNumber(settings.maxValue) ? settings.maxValue : 100;
+ self._initValue = self.state.get('value');
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = self.classPrefix;
+ return '<div id="' + id + '" class="' + self.classes + '">' + '<div id="' + id + '-handle" class="' + prefix + 'slider-handle" role="slider" tabindex="-1"></div>' + '</div>';
+ },
+ reset: function () {
+ this.value(this._initValue).repaint();
+ },
+ postRender: function () {
+ var self = this;
+ var minValue, maxValue, screenCordName, stylePosName, sizeName, shortSizeName;
+ function toFraction(min, max, val) {
+ return (val + min) / (max - min);
+ }
+ function fromFraction(min, max, val) {
+ return val * (max - min) - min;
+ }
+ function handleKeyboard(minValue, maxValue) {
+ function alter(delta) {
+ var value;
+ value = self.value();
+ value = fromFraction(minValue, maxValue, toFraction(minValue, maxValue, value) + delta * 0.05);
+ value = constrain(value, minValue, maxValue);
+ self.value(value);
+ self.fire('dragstart', { value: value });
+ self.fire('drag', { value: value });
+ self.fire('dragend', { value: value });
+ }
+ self.on('keydown', function (e) {
+ switch (e.keyCode) {
+ case 37:
+ case 38:
+ alter(-1);
+ break;
+ case 39:
+ case 40:
+ alter(1);
+ break;
+ }
+ });
+ }
+ function handleDrag(minValue, maxValue, handleEl) {
+ var startPos, startHandlePos, maxHandlePos, handlePos, value;
+ self._dragHelper = new DragHelper(self._id, {
+ handle: self._id + '-handle',
+ start: function (e) {
+ startPos = e[screenCordName];
+ startHandlePos = parseInt(self.getEl('handle').style[stylePosName], 10);
+ maxHandlePos = (self.layoutRect()[shortSizeName] || 100) - funcs.getSize(handleEl)[sizeName];
+ self.fire('dragstart', { value: value });
+ },
+ drag: function (e) {
+ var delta = e[screenCordName] - startPos;
+ handlePos = constrain(startHandlePos + delta, 0, maxHandlePos);
+ handleEl.style[stylePosName] = handlePos + 'px';
+ value = minValue + handlePos / maxHandlePos * (maxValue - minValue);
+ self.value(value);
+ self.tooltip().text('' + self.settings.previewFilter(value)).show().moveRel(handleEl, 'bc tc');
+ self.fire('drag', { value: value });
+ },
+ stop: function () {
+ self.tooltip().hide();
+ self.fire('dragend', { value: value });
+ }
+ });
+ }
+ minValue = self._minValue;
+ maxValue = self._maxValue;
+ if (self.settings.orientation === 'v') {
+ screenCordName = 'screenY';
+ stylePosName = 'top';
+ sizeName = 'height';
+ shortSizeName = 'h';
+ } else {
+ screenCordName = 'screenX';
+ stylePosName = 'left';
+ sizeName = 'width';
+ shortSizeName = 'w';
+ }
+ self._super();
+ handleKeyboard(minValue, maxValue);
+ handleDrag(minValue, maxValue, self.getEl('handle'));
+ },
+ repaint: function () {
+ this._super();
+ updateSliderHandle(this, this.value());
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:value', function (e) {
+ updateSliderHandle(self, e.value);
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('blur hide ObjectResizeStart', panel.hide);
- editor.on('click', throttledTogglePanel);
- editor.on('nodeChange mouseup', throttledTogglePanelWhenNotInForm);
- editor.on('ResizeEditor keyup', throttledTogglePanel);
- editor.on('ResizeWindow', repositionPanel(editor, panel));
- editor.on('remove', panel.remove);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Spacer = Widget.extend({
+ renderHtml: function () {
+ var self = this;
+ self.classes.add('spacer');
+ self.canFocus = false;
+ return '<div id="' + self._id + '" class="' + self.classes + '"></div>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.shortcuts.add('Alt+F10', '', panel.focus);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var SplitButton = MenuButton.extend({
+ Defaults: {
+ classes: 'widget btn splitbtn',
+ role: 'button'
+ },
+ repaint: function () {
+ var self = this;
+ var elm = self.getEl();
+ var rect = self.layoutRect();
+ var mainButtonElm, menuButtonElm;
+ self._super();
+ mainButtonElm = elm.firstChild;
+ menuButtonElm = elm.lastChild;
+ global$7(mainButtonElm).css({
+ width: rect.w - funcs.getSize(menuButtonElm).width,
+ height: rect.h - 2
+ });
+ global$7(menuButtonElm).css({ height: rect.h - 2 });
+ return self;
+ },
+ activeMenu: function (state) {
+ var self = this;
+ global$7(self.getEl().lastChild).toggleClass(self.classPrefix + 'active', state);
+ },
+ renderHtml: function () {
+ var self = this;
+ var id = self._id;
+ var prefix = self.classPrefix;
+ var image;
+ var icon = self.state.get('icon');
+ var text = self.state.get('text');
+ var settings = self.settings;
+ var textHtml = '', ariaPressed;
+ image = settings.image;
+ if (image) {
+ icon = 'none';
+ if (typeof image !== 'string') {
+ image = window.getSelection ? image[0] : image[1];
+ }
+ image = ' style="background-image: url(\'' + image + '\')"';
+ } else {
+ image = '';
+ }
+ icon = settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
+ if (text) {
+ self.classes.add('btn-has-text');
+ textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
+ }
+ ariaPressed = typeof settings.active === 'boolean' ? ' aria-pressed="' + settings.active + '"' : '';
+ return '<div id="' + id + '" class="' + self.classes + '" role="button"' + ariaPressed + ' tabindex="-1">' + '<button type="button" hidefocus="1" tabindex="-1">' + (icon ? '<i class="' + icon + '"' + image + '></i>' : '') + textHtml + '</button>' + '<button type="button" class="' + prefix + 'open" hidefocus="1" tabindex="-1">' + (self._menuBtnText ? (icon ? '\xA0' : '') + self._menuBtnText : '') + ' <i class="' + prefix + 'caret"></i>' + '</button>' + '</div>';
+ },
+ postRender: function () {
+ var self = this, onClickHandler = self.settings.onclick;
+ self.on('click', function (e) {
+ var node = e.target;
+ if (e.control === this) {
+ while (node) {
+ if (e.aria && e.aria.key !== 'down' || node.nodeName === 'BUTTON' && node.className.indexOf('open') === -1) {
+ e.stopImmediatePropagation();
+ if (onClickHandler) {
+ onClickHandler.call(this, e);
+ }
+ return;
+ }
+ node = node.parentNode;
+ }
+ }
+ });
+ delete self.settings.onclick;
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var overrideLinkShortcut = function (editor, panel) {
- editor.shortcuts.remove('meta+k');
- editor.shortcuts.add('meta+k', '', function () {
- var toolbars = getToolbars(editor);
- var result = result = Matcher.match(editor, [
- SelectionMatcher.textSelection('quicklink')
- ]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var StackLayout = FlowLayout.extend({
+ Defaults: {
+ containerClass: 'stack-layout',
+ controlClass: 'stack-layout-item',
+ endClass: 'break'
+ },
+ isNative: function () {
+ return true;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (result) {
- panel.show(editor, result.id, result.rect, toolbars);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var TabPanel = Panel.extend({
+ Defaults: {
+ layout: 'absolute',
+ defaults: { type: 'panel' }
+ },
+ activateTab: function (idx) {
+ var activeTabElm;
+ if (this.activeTabId) {
+ activeTabElm = this.getEl(this.activeTabId);
+ global$7(activeTabElm).removeClass(this.classPrefix + 'active');
+ activeTabElm.setAttribute('aria-selected', 'false');
+ }
+ this.activeTabId = 't' + idx;
+ activeTabElm = this.getEl('t' + idx);
+ activeTabElm.setAttribute('aria-selected', 'true');
+ global$7(activeTabElm).addClass(this.classPrefix + 'active');
+ this.items()[idx].show().fire('showtab');
+ this.reflow();
+ this.items().each(function (item, i) {
+ if (idx !== i) {
+ item.hide();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ renderHtml: function () {
+ var self = this;
+ var layout = self._layout;
+ var tabsHtml = '';
+ var prefix = self.classPrefix;
+ self.preRender();
+ layout.preRender(self);
+ self.items().each(function (ctrl, i) {
+ var id = self._id + '-t' + i;
+ ctrl.aria('role', 'tabpanel');
+ ctrl.aria('labelledby', id);
+ tabsHtml += '<div id="' + id + '" class="' + prefix + 'tab" ' + 'unselectable="on" role="tab" aria-controls="' + ctrl._id + '" aria-selected="false" tabIndex="-1">' + self.encode(ctrl.settings.title) + '</div>';
+ });
+ return '<div id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1">' + '<div id="' + self._id + '-head" class="' + prefix + 'tabs" role="tablist">' + tabsHtml + '</div>' + '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' + layout.renderHtml(self) + '</div>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ self._super();
+ self.settings.activeTab = self.settings.activeTab || 0;
+ self.activateTab(self.settings.activeTab);
+ this.on('click', function (e) {
+ var targetParent = e.target.parentNode;
+ if (targetParent && targetParent.id === self._id + '-head') {
+ var i = targetParent.childNodes.length;
+ while (i--) {
+ if (targetParent.childNodes[i] === e.target) {
+ self.activateTab(i);
+ }
+ }
+ }
+ });
+ },
+ initLayoutRect: function () {
+ var self = this;
+ var rect, minW, minH;
+ minW = funcs.getSize(self.getEl('head')).width;
+ minW = minW < 0 ? 0 : minW;
+ minH = 0;
+ self.items().each(function (item) {
+ minW = Math.max(minW, item.layoutRect().minW);
+ minH = Math.max(minH, item.layoutRect().minH);
+ });
+ self.items().each(function (ctrl) {
+ ctrl.settings.x = 0;
+ ctrl.settings.y = 0;
+ ctrl.settings.w = minW;
+ ctrl.settings.h = minH;
+ ctrl.layoutRect({
+ x: 0,
+ y: 0,
+ w: minW,
+ h: minH
+ });
+ });
+ var headH = funcs.getSize(self.getEl('head')).height;
+ self.settings.minWidth = minW;
+ self.settings.minHeight = minH + headH;
+ rect = self._super();
+ rect.deltaH += headH;
+ rect.innerH = rect.h - rect.deltaH;
+ return rect;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var renderInlineUI = function (editor, panel) {
- SkinLoader.load(editor, function () {
- bindContextualToolbarsEvents(editor, panel);
- overrideLinkShortcut(editor, panel);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var TextBox = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.classes.add('textbox');
+ if (settings.multiline) {
+ self.classes.add('multiline');
+ } else {
+ self.on('keydown', function (e) {
+ var rootControl;
+ if (e.keyCode === 13) {
+ e.preventDefault();
+ self.parents().reverse().each(function (ctrl) {
+ if (ctrl.toJSON) {
+ rootControl = ctrl;
+ return false;
+ }
+ });
+ self.fire('submit', { data: rootControl.toJSON() });
+ }
+ });
+ self.on('keyup', function (e) {
+ self.state.set('value', e.target.value);
+ });
+ }
+ },
+ repaint: function () {
+ var self = this;
+ var style, rect, borderBox, borderW, borderH = 0, lastRepaintRect;
+ style = self.getEl().style;
+ rect = self._layoutRect;
+ lastRepaintRect = self._lastRepaintRect || {};
+ var doc = document;
+ if (!self.settings.multiline && doc.all && (!doc.documentMode || doc.documentMode <= 8)) {
+ style.lineHeight = rect.h - borderH + 'px';
+ }
+ borderBox = self.borderBox;
+ borderW = borderBox.left + borderBox.right + 8;
+ borderH = borderBox.top + borderBox.bottom + (self.settings.multiline ? 8 : 0);
+ if (rect.x !== lastRepaintRect.x) {
+ style.left = rect.x + 'px';
+ lastRepaintRect.x = rect.x;
+ }
+ if (rect.y !== lastRepaintRect.y) {
+ style.top = rect.y + 'px';
+ lastRepaintRect.y = rect.y;
+ }
+ if (rect.w !== lastRepaintRect.w) {
+ style.width = rect.w - borderW + 'px';
+ lastRepaintRect.w = rect.w;
+ }
+ if (rect.h !== lastRepaintRect.h) {
+ style.height = rect.h - borderH + 'px';
+ lastRepaintRect.h = rect.h;
+ }
+ self._lastRepaintRect = lastRepaintRect;
+ self.fire('repaint', {}, false);
+ return self;
+ },
+ renderHtml: function () {
+ var self = this;
+ var settings = self.settings;
+ var attrs, elm;
+ attrs = {
+ id: self._id,
+ hidefocus: '1'
+ };
+ global$4.each([
+ 'rows',
+ 'spellcheck',
+ 'maxLength',
+ 'size',
+ 'readonly',
+ 'min',
+ 'max',
+ 'step',
+ 'list',
+ 'pattern',
+ 'placeholder',
+ 'required',
+ 'multiple'
+ ], function (name) {
+ attrs[name] = settings[name];
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.disabled()) {
+ attrs.disabled = 'disabled';
+ }
+ if (settings.subtype) {
+ attrs.type = settings.subtype;
+ }
+ elm = funcs.create(settings.multiline ? 'textarea' : 'input', attrs);
+ elm.value = self.state.get('value');
+ elm.className = self.classes;
+ return elm.outerHTML;
+ },
+ value: function (value) {
+ if (arguments.length) {
+ this.state.set('value', value);
+ return this;
+ }
+ if (this.state.get('rendered')) {
+ this.state.set('value', this.getEl().value);
+ }
+ return this.state.get('value');
+ },
+ postRender: function () {
+ var self = this;
+ self.getEl().value = self.state.get('value');
+ self._super();
+ self.$el.on('change', function (e) {
+ self.state.set('value', e.target.value);
+ self.fire('change', e);
+ });
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:value', function (e) {
+ if (self.getEl().value !== e.value) {
+ self.getEl().value = e.value;
+ }
+ });
+ self.state.on('change:disabled', function (e) {
+ self.getEl().disabled = e.value;
+ });
+ return self._super();
+ },
+ remove: function () {
+ this.$el.off();
+ this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getApi = function () {
+ return {
+ Selector: Selector,
+ Collection: Collection$2,
+ ReflowQueue: $_13g7tw17vjfuw8wgk,
+ Control: Control$1,
+ Factory: global$11,
+ KeyboardNavigation: KeyboardNavigation,
+ Container: Container,
+ DragHelper: DragHelper,
+ Scrollable: $_7kg51q189jfuw8wiq,
+ Panel: Panel,
+ Movable: $_cn53y617xjfuw8wgp,
+ Resizable: $_f8jegf18ajfuw8wit,
+ FloatPanel: FloatPanel,
+ Window: Window,
+ MessageBox: MessageBox,
+ Tooltip: Tooltip,
+ Widget: Widget,
+ Progress: Progress,
+ Notification: Notification,
+ Layout: Layout$1,
+ AbsoluteLayout: AbsoluteLayout,
+ Button: Button,
+ ButtonGroup: ButtonGroup,
+ Checkbox: Checkbox,
+ ComboBox: ComboBox,
+ ColorBox: ColorBox,
+ PanelButton: PanelButton,
+ ColorButton: ColorButton,
+ ColorPicker: ColorPicker,
+ Path: Path,
+ ElementPath: ElementPath,
+ FormItem: FormItem,
+ Form: Form,
+ FieldSet: FieldSet,
+ FilePicker: FilePicker,
+ FitLayout: FitLayout,
+ FlexLayout: FlexLayout,
+ FlowLayout: FlowLayout,
+ FormatControls: $_5jc0r41adjfuw8wpt,
+ GridLayout: GridLayout,
+ Iframe: Iframe,
+ InfoBox: InfoBox,
+ Label: Label,
+ Toolbar: Toolbar$1,
+ MenuBar: MenuBar,
+ MenuButton: MenuButton,
+ MenuItem: MenuItem,
+ Throbber: Throbber,
+ Menu: Menu,
+ ListBox: ListBox,
+ Radio: Radio,
+ ResizeHandle: ResizeHandle,
+ SelectBox: SelectBox,
+ Slider: Slider,
+ Spacer: Spacer,
+ SplitButton: SplitButton,
+ StackLayout: StackLayout,
+ TabPanel: TabPanel,
+ TextBox: TextBox,
+ DropZone: DropZone,
+ BrowseButton: BrowseButton
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var fail = function (message) {
- throw new Error(message);
- };
-
- ThemeManager.add('inlite', function (editor) {
- var panel = new Panel();
-
- Buttons.addToEditor(editor, panel);
-
- var renderUI = function () {
- return editor.inline ? renderInlineUI(editor, panel) : fail('inlite theme only supports inline mode.');
- };
-
- return {
- renderUI: renderUI
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var appendTo = function (target) {
+ if (target.ui) {
+ global$4.each(getApi(), function (ref, key) {
+ target.ui[key] = ref;
+ });
+ } else {
+ target.ui = getApi();
+ }
+ };
+ var registerToFactory = function () {
+ global$4.each(getApi(), function (ref, key) {
+ global$11.add(key, ref);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var Api = {
+ appendTo: appendTo,
+ registerToFactory: registerToFactory
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Api.appendTo(window.tinymce ? window.tinymce : {});
-
- return function () { };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Api.registerToFactory();
+ Api.appendTo(window.tinymce ? window.tinymce : {});
+ global.add('inlite', function (editor) {
+ var panel = create$3();
+ $_5jc0r41adjfuw8wpt.setup(editor);
+ $_cb0m4418cjfuw8wiy.addToEditor(editor, panel);
+ return $_5lg8ed16sjfuw8wdm.get(editor, panel);
+ });
+ function Theme () {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-dem('tinymce.themes.inlite.Theme')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Theme;
+
+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcethemesinlitethememinjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/themes/inlite/theme.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/themes/inlite/theme.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/themes/inlite/theme.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("d",tinymce.util.Tools.resolve),g("1",[&q
uot;d"],function(a){return a("tinymce.ThemeManager")}),g("2",["d"],function(a){return a("tinymce.ui.Api")}),g("3",["d"],function(a){return a("tinymce.util.Delay")}),g("4",[],function(){var a=function(b){return b.reduce(function(b,c){return Array.isArray(c)?b.concat(a(c)):b.concat(c)},[])};return{flatten:a}}),g("e",[],function(){var a=function(a){return function(b){return typeof b===a}},b=function(a){return Array.isArray(a)},c=function(a){return null===a},d=function(a){return function(d){return!c(d)&&!b(d)&&a(d)}};return{isString:a("string"),isNumber:a("number"),isBoolean:a("boolean"),isFunction:a("function"),isObject:d(a("object")),isNull:c,isArray:b}}),g("5",["e"],function(a){var b=function(a,b){if(b(a))return!0;throw new Error("Default value doesn't match requested type.")},c=function(a){retur
n function(c,d,e){var f=c.settings;return b(e,a),d in f&&a(f[d])?f[d]:e}},d=function(a,b){return a.split(b).filter(function(a){return a.length>0})},e=function(b,c){var e=function(a){return"string"==typeof a?d(a,/[ ,]/):a},f=function(a,b){return a===!1?[]:b};return a.isArray(b)?b:a.isString(b)?e(b):a.isBoolean(b)?f(b,c):c},f=function(a){return function(c,d,f){var g=d in c.settings?c.settings[d]:f;return b(f,a),e(g,f)}};return{getStringOr:c(a.isString),getBoolOr:c(a.isBoolean),getNumberOr:c(a.isNumber),getHandlerOr:c(a.isFunction),getToolbarItemsOr:f(a.isArray)}}),g("7",[],function(){var a=function(a,b){return{id:a,rect:b}},b=function(a,b){for(var c=0;c<b.length;c++){var d=b[c],e=d(a);if(e)return e}return null};return{match:b,result:a}}),g("i",["d"],function(a){return a("tinymce.dom.DOMUtils")}),g("q",[],function(){var a=function(a){return{x:a.left,y:a.top,w:a.width,h:a.height}},b=function(a){return{left:a.x,top
:a.y,width:a.w,height:a.h,right:a.x+a.w,bottom:a.y+a.h}};return{fromClientRect:a,toClientRect:b}}),g("f",["i","q"],function(a,b){var c=function(b){var c=a.DOM.getViewPort();return{x:b.x+c.x,y:b.y+c.y,w:b.w,h:b.h}},d=function(a){var b=a.getBoundingClientRect();return c({x:b.left,y:b.top,w:Math.max(a.clientWidth,a.offsetWidth),h:Math.max(a.clientHeight,a.offsetHeight)})},e=function(a,b){return d(b)},f=function(a){return d(a.getElement().ownerDocument.body)},g=function(a){return d(a.getContentAreaContainer()||a.getBody())},h=function(a){var d=a.selection.getBoundingClientRect();return d?c(b.fromClientRect(d)):null};return{getElementRect:e,getPageAreaRect:f,getContentAreaRect:g,getSelectionRect:h}}),g("6",["7","f"],function(a,b){var c=function(c,d){return function(e){for(var f=0;f<d.length;f++)if(d[f].predicate(c))return a.result(d[f].id,b.getElementRect(e,c));return null}},d=function(c,d){return function(e){for(var f=0;f<
;c.length;f++)for(var g=0;g<d.length;g++)if(d[g].predicate(c[f]))return a.result(d[g].id,b.getElementRect(e,c[f]));return null}};return{element:c,parent:d}}),g("g",["d"],function(a){return a("tinymce.util.Tools")}),g("8",["g"],function(a){var b=function(a,b){return{id:a,predicate:b}},c=function(c){return a.map(c,function(a){return b(a.id,a.predicate)})};return{create:b,fromContextToolbars:c}}),g("9",["7","f"],function(a,b){var c=function(c){return function(d){return d.selection.isCollapsed()?null:a.result(c,b.getSelectionRect(d))}},d=function(c,d){return function(e){var f,g=e.schema.getTextBlockElements();for(f=0;f<c.length;f++)if("TABLE"===c[f].nodeName)return null;for(f=0;f<c.length;f++)if(c[f].nodeName in g)return e.dom.isEmpty(c[f])?a.result(d,b.getSelectionRect(e)):null;return null}};return{textSelection:c,emptyTextBlock:d}}),g("h",["d"],function(a){return a(&q
uot;tinymce.EditorManager")}),g("a",["h","i"],function(a,b){var c=function(a,b){var c=function(){a._skinLoaded=!0,a.fire("SkinLoaded"),b()};a.initialized?c():a.on("init",c)},d=function(b){var c=a.baseURL+"/skins/";return b?c+b:c+"lightgray"},e=function(a,b){return a.documentBaseURI.toAbsolute(b)},f=function(a,f){var g=a.settings,h=g.skin_url?e(a,g.skin_url):d(g.skin),i=function(){c(a,f)};b.DOM.styleSheetLoader.load(h+"/skin.min.css",i),a.contentCSS.push(h+"/content.inline.min.css")};return{load:f}}),g("j",["d"],function(a){return a("tinymce.ui.Factory")}),g("k",["g","j","e"],function(a,b,c){var d=function(a,b){var c=function(a,b){return{selector:a,handler:b}},d=function(a){b.active(a)},e=function(a){b.disabled(a)};return b.settings.stateSelector?c(b.settings.stateSelector,d):b.settings.disabledStateSelector?c(b.settings.
disabledStateSelector,e):null},e=function(a,b,c){return function(){var e=d(b,c);null!==e&&a.selection.selectorChanged(e.selector,e.handler)}},f=function(a){return c.isArray(a)?a:c.isString(a)?a.split(/[ ,]/):[]},g=function(c,d,g){var h,i=[];if(g)return a.each(f(g),function(a){var d;"|"==a?h=null:c.buttons[a]&&(h||(h={type:"buttongroup",items:[]},i.push(h)),d=a,a=c.buttons[d],"function"==typeof a&&(a=a()),a.type=a.type||"button",a=b.create(a),a.on("postRender",e(c,d,a)),h.items.push(a))}),b.create({type:"toolbar",layout:"flow",name:d,items:i})};return{create:g}}),g("r",["d"],function(a){return a("tinymce.util.Promise")}),g("s",[],function(){var a=0,b=function(){var a=function(){return Math.round(4294967295*Math.random()).toString(36)};return"s"+Date.now().toString(36)+a()+a()+a()},c=function(c){return c+a++ +b()};return{uuid:c}}),g("w&qu
ot;,[],function(){var a=function(a,b){function c(c){var e,f,g;f=b[c?"startContainer":"endContainer"],g=b[c?"startOffset":"endOffset"],1==f.nodeType&&(e=a.create("span",{"data-mce-type":"bookmark"}),f.hasChildNodes()?(g=Math.min(g,f.childNodes.length-1),c?f.insertBefore(e,f.childNodes[g]):a.insertAfter(e,f.childNodes[g])):f.appendChild(e),f=e,g=0),d[c?"startContainer":"endContainer"]=f,d[c?"startOffset":"endOffset"]=g}var d={};return c(!0),b.collapsed||c(),d},b=function(a,b){function c(c){function d(a){for(var b=a.parentNode.firstChild,c=0;b;){if(b==a)return c;1==b.nodeType&&"bookmark"==b.getAttribute("data-mce-type")||c++,b=b.nextSibling}return-1}var e,f,g;e=g=b[c?"startContainer":"endContainer"],f=b[c?"startOffset":"endOffset"],e&&(1==e.nodeType&&(f=d(e),e=e.parentNode,a.remove(g)),b
[c?"startContainer":"endContainer"]=e,b[c?"startOffset":"endOffset"]=f)}c(!0),c();var d=a.createRng();return d.setStart(b.startContainer,b.startOffset),b.endContainer&&d.setEnd(b.endContainer,b.endOffset),d};return{create:a,resolve:b}}),g("x",["d"],function(a){return a("tinymce.dom.TreeWalker")}),g("y",["d"],function(a){return a("tinymce.dom.RangeUtils")}),g("t",["w","g","x","y"],function(a,b,c,d){var e=function(a,b,d){var e,f,g=[];for(e=new c(b,a),f=b;f&&(1===f.nodeType&&g.push(f),f!==d);f=e.next());return g},f=function(c,d){var e,f,g;f=c.dom,g=c.selection,e=a.create(f,g.getRng()),b.each(d,function(a){c.dom.remove(a,!0)}),g.setRng(a.resolve(f,e))},g=function(a){return"A"===a.nodeName&&a.hasAttribute("href")},h=function(a,b){var c=a.getParent(b,g);return c?c:b},i=function(a){var c,f,i
,j,k,l,m;return k=a.selection,l=a.dom,m=k.getRng(),c=h(l,d.getNode(m.startContainer,m.startOffset)),f=d.getNode(m.endContainer,m.endOffset),i=a.getBody(),j=b.grep(e(i,c,f),g)},j=function(a){f(a,i(a))};return{unlinkSelection:j}}),g("p",["s","t"],function(a,b){var c=function(a,b){var c,d,e;for(e='<table data-mce-id="mce" style="width: 100%">',e+="<tbody>",d=0;d<b;d++){for(e+="<tr>",c=0;c<a;c++)e+="<td><br></td>";e+="</tr>"}return e+="</tbody>",e+="</table>"},d=function(a){var b=a.dom.select("*[data-mce-id]");return b[0]},e=function(a,b,e){a.undoManager.transact(function(){var f,g;a.insertContent(c(b,e)),f=d(a),f.removeAttribute("data-mce-id"),g=a.dom.select("td,th",f),a.selection.setCursorLocation(g[0],0)})},f=function(a,b){a.execCommand("FormatBlock",!1,b)},g=function(b,c,d){va
r e,f;e=b.editorUpload.blobCache,f=e.create(a.uuid("mceu"),d,c),e.add(f),b.insertContent(b.dom.createHTML("img",{src:f.blobUri()}))},h=function(a){a.selection.collapse(!1)},i=function(a){a.focus(),b.unlinkSelection(a),h(a)},j=function(a,b,c){a.focus(),a.dom.setAttrib(b,"href",c),h(a)},k=function(a,b){a.execCommand("mceInsertLink",!1,{href:b}),h(a)},l=function(a,b){var c=a.dom.getParent(a.selection.getStart(),"a[href]");c?j(a,c,b):k(a,b)},m=function(a,b){0===b.trim().length?i(a):l(a,b)};return{insertTable:e,formatBlock:f,insertBlob:g,createLink:m,unlink:i}}),g("u",[],function(){var a=function(a){return/^www\.|\.(com|org|edu|gov|uk|net|ca|de|jp|fr|au|us|ru|ch|it|nl|se|no|es|mil)$/i.test(a.trim())},b=function(a){return/^https?:\/\//.test(a.trim())};return{isDomainLike:a,isAbsolute:b}}),g("l",["g","j","r","p","u"],function(a,b,c,d,e){var f=function(a){a.find("text
box").eq(0).each(function(a){a.focus()})},g=function(c,d){var e=b.create(a.extend({type:"form",layout:"flex",direction:"row",padding:5,name:c,spacing:3},d));return e.on("show",function(){f(e)}),e},h=function(a,b){return b?a.show():a.hide()},i=function(a,b){return new c(function(c){a.windowManager.confirm("The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",function(a){var d=a===!0?"http://"+b:b;c(d)})})},j=function(a,b){return!e.isAbsolute(b)&&e.isDomainLike(b)?i(a,b):c.resolve(b)},k=function(a,b){var c={},e=function(){a.focus(),d.unlink(a),b()},f=function(a){var b=a.meta;b&&b.attach&&(c={href:this.value(),attach:b.attach})},i=function(b){if(b.control===this){var c,d="";c=a.dom.getParent(a.selection.getStart(),"a[href]"),c&&(d=a.dom.getAttrib(c,"href")),this.fromJSON({linkurl:d}),h(this.find("#unlink")
,c),this.find("#linkurl")[0].focus()}};return g("quicklink",{items:[{type:"button",name:"unlink",icon:"unlink",onclick:e,tooltip:"Remove link"},{type:"filepicker",name:"linkurl",placeholder:"Paste or type a link",filetype:"file",onchange:f},{type:"button",icon:"checkmark",subtype:"primary",tooltip:"Ok",onclick:"submit"}],onshow:i,onsubmit:function(e){j(a,e.data.linkurl).then(function(e){a.undoManager.transact(function(){e===c.href&&(c.attach(),c={}),d.createLink(a,e)}),b()})}})};return{createQuickLinkForm:k}}),g("v",["d"],function(a){return a("tinymce.geom.Rect")}),g("m",["v","q"],function(a,b){var c=function(a,b){return{rect:a,position:b}},d=function(a,b){return{x:b.x,y:b.y,w:a.w,h:a.h}},e=function(b,e,f,g,h){var i,j,k,l={x:g.x,y:g.y,w:g.w+(g.w<h.w+f.w?h.w:0),h:g.h
+(g.h<h.h+f.h?h.h:0)};return i=a.findBestRelativePosition(h,f,l,b),f=a.clamp(f,l),i?(j=a.relativePosition(h,f,i),k=d(h,j),c(k,i)):(f=a.intersect(l,f),f?(i=a.findBestRelativePosition(h,f,l,e))?(j=a.relativePosition(h,f,i),k=d(h,j),c(k,i)):(k=d(h,f),c(k,i)):null)},f=function(a,b,c){return e(["cr-cl","cl-cr"],["bc-tc","bl-tl","br-tr"],a,b,c)},g=function(a,b,c){return e(["tc-bc","bc-tc","tl-bl","bl-tl","tr-br","br-tr","cr-cl","cl-cr"],["bc-tc","bl-tl","br-tr","cr-cl"],a,b,c)},h=function(a,c,d,e){var f;return"function"==typeof a?(f=a({elementRect:b.toClientRect(c),contentAreaRect:b.toClientRect(d),panelRect:b.toClientRect(e)}),b.fromClientRect(f)):e},i=function(a){return a.panelRect};return{calcInsert:f,calc:g,userConstrain:h,defaultHandler:i}}),g("c",["g","j","i",&quo
t;k","l","f","m","5"],function(a,b,c,d,e,f,g,h){return function(){var i,j,k=["bold","italic","|","quicklink","h2","h3","blockquote"],l=["quickimage","quicktable"],m=function(b,c){return a.map(c,function(a){return d.create(b,a.id,a.items)})},n=function(a){return h.getToolbarItemsOr(a,"selection_toolbar",k)},o=function(a){return h.getToolbarItemsOr(a,"insert_toolbar",l)},p=function(a){return a.items().length>0},q=function(c,f){var g=m(c,f).concat([d.create(c,"text",n(c)),d.create(c,"insert",o(c)),e.createQuickLinkForm(c,B)]);return b.create({type:"floatpanel",role:"dialog",classes:"tinymce tinymce-inline arrow",ariaLabel:"Inline toolbar",layout:"flex",direction:"column",align:"stretch",autohide:!1,autofix:!0,fixed:!0,border:1,items:a.grep(g,
p),oncancel:function(){c.focus()}})},r=function(a){a&&a.show()},s=function(a,b){a.moveTo(b.x,b.y)},t=function(b,c){c=c?c.substr(0,2):"",a.each({t:"down",b:"up",c:"center"},function(a,d){b.classes.toggle("arrow-"+a,d===c.substr(0,1))}),"cr"===c?(b.classes.toggle("arrow-left",!0),b.classes.toggle("arrow-right",!1)):"cl"===c?(b.classes.toggle("arrow-left",!0),b.classes.toggle("arrow-right",!0)):a.each({l:"left",r:"right"},function(a,d){b.classes.toggle("arrow-"+a,d===c.substr(1,1))})},u=function(a,b){var c=a.items().filter("#"+b);return c.length>0&&(c[0].show(),a.reflow(),!0)},v=function(a,b,d,e){var i,k,l,m;return m=h.getHandlerOr(d,"inline_toolbar_position_handler",g.defaultHandler),i=f.getContentAreaRect(d),k=c.DOM.getRect(a.getEl()),l="insert"===b?g.calcInsert(e,i,k):g.calc(e,i,k),!!l&&(k
=l.rect,j=e,s(a,g.userConstrain(m,e,i,k)),t(a,l.position),!0)},w=function(a,b,c,d){return r(a),a.items().hide(),u(a,b)?void(v(a,b,c,d)===!1&&B(a)):void B(a)},x=function(){return i.items().filter("form:visible").length>0},y=function(a,b){if(i){if(i.items().hide(),!u(i,b))return void B(i);var d,e,k,l;r(i),i.items().hide(),u(i,b),l=h.getHandlerOr(a,"inline_toolbar_position_handler",g.defaultHandler),d=f.getContentAreaRect(a),e=c.DOM.getRect(i.getEl()),k=g.calc(j,d,e),k&&(e=k.rect,s(i,g.userConstrain(l,j,d,e)),t(i,k.position))}},z=function(a,b,c,d){i||(i=q(a,d),i.renderTo(document.body).reflow().moveTo(c.x,c.y),a.nodeChanged()),w(i,b,a,c)},A=function(a,b,c){i&&v(i,b,a,c)},B=function(){i&&i.hide()},C=function(){i&&i.find("toolbar:visible").eq(0).each(function(a){a.focus(!0)})},D=function(){i&&(i.remove(),i=null)},E=function(){return i&&i.visible()&&x()};return{show:z,showForm:y,reposition:A,i
nForm:E,hide:B,focus:C,remove:D}}}),g("n",["r"],function(a){var b=function(b){return new a(function(a){var c=new FileReader;c.onloadend=function(){a(c.result.split(",")[1])},c.readAsDataURL(b)})};return{blobToBase64:b}}),g("o",["r"],function(a){var b=function(){return new a(function(a){var b;b=document.createElement("input"),b.type="file",b.style.position="fixed",b.style.left=0,b.style.top=0,b.style.opacity=.001,document.body.appendChild(b),b.onchange=function(b){a(Array.prototype.slice.call(b.target.files))},b.click(),b.parentNode.removeChild(b)})};return{pickFile:b}}),g("b",["c","n","o","p"],function(a,b,c,d){var e=function(a){for(var b=function(b){return function(){d.formatBlock(a,b)}},c=1;c<6;c++){var e="h"+c;a.addButton(e,{text:e.toUpperCase(),tooltip:"Heading "+c,stateSelector:e,onclick:b(e),onPostRender:function(){var a=this.
getEl().firstChild.firstChild;a.style.fontWeight="bold"}})}},f=function(a,f){a.addButton("quicklink",{icon:"link",tooltip:"Insert/Edit link",stateSelector:"a[href]",onclick:function(){f.showForm(a,"quicklink")}}),a.addButton("quickimage",{icon:"image",tooltip:"Insert image",onclick:function(){c.pickFile().then(function(c){var e=c[0];b.blobToBase64(e).then(function(b){d.insertBlob(a,b,e)})})}}),a.addButton("quicktable",{icon:"table",tooltip:"Insert table",onclick:function(){f.hide(),d.insertTable(a,2,2)}}),e(a)};return{addToEditor:f}}),g("0",["1","2","3","4","5","6","7","8","9","a","b","c"],function(a,b,c,d,e,f,g,h,i,j,k,l){var m=function(a){var b=a.selection.getNode(),c=a.dom.getParents(b);return c},n=function(a,b,c,d){var e=function(c){
return a.dom.is(c,b)};return{predicate:e,id:c,items:d}},o=function(a){var b=a.contextToolbars;return d.flatten([b?b:[],n(a,"img","image","alignleft aligncenter alignright")])},p=function(a,b){var c,d,e;return d=m(a),e=h.fromContextToolbars(b),c=g.match(a,[f.element(d[0],e),i.textSelection("text"),i.emptyTextBlock(d,"insert"),f.parent(d,e)]),c&&c.rect?c:null},q=function(a,b){var c=function(){var c=o(a),d=p(a,c);d?b.show(a,d.id,d.rect,c):b.hide()};return function(){a.removed||c()}},r=function(a,b){return function(){var c=o(a),d=p(a,c);d&&b.reposition(a,d.id,d.rect)}},s=function(a,b,c){return function(){a.removed||b.inForm()||c()}},t=function(a,b){var d=c.throttle(q(a,b),0),e=c.throttle(s(a,b,q(a,b)),0);a.on("blur hide ObjectResizeStart",b.hide),a.on("click",d),a.on("nodeChange mouseup",e),a.on("ResizeEditor keyup",d),a.on("ResizeWindow",r(a,b)),a.on("remove",b.
remove),a.shortcuts.add("Alt+F10","",b.focus)},u=function(a,b){a.shortcuts.remove("meta+k"),a.shortcuts.add("meta+k","",function(){var c=o(a),d=d=g.match(a,[i.textSelection("quicklink")]);d&&b.show(a,d.id,d.rect,c)})},v=function(a,b){return j.load(a,function(){t(a,b),u(a,b)}),{}},w=function(a){throw new Error(a)};return a.add("inlite",function(a){var b=new l;k.addToEditor(a,b);var c=function(){return a.inline?v(a,b):w("inlite theme only supports inline mode.")};return{renderUI:c}}),b.appendTo(window.tinymce?window.tinymce:{}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var u,t,e,n,i,r,o=tinymce.util.Tools.resolve("tinymce.ThemeManager"),h=tinymce.util.Tools.resolve("tinymce.Env"),v=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),c=tinymce.util.Tools.resolve("tinymce.util.Delay"),s=function(t){return t.reduce(function(t,e){return Array.isArray(e)?t.concat(s(e)):t.concat(e)},[])},a={flatten:s},l=function(t,e){for(var n=0;n<e.length;n++){var i=(0,e[n])(t);if(i)return i}return null},d=function(t,e){return{id:t,rect:e}},f=function(t){return{x:t.left,y:t.top,w:t.width,h:t.height}},m=function(t){return{left:t.x,top:t.y,width:t.w,height:t.h,right:t.x+t.w,bottom:t.y+t.h}},g=function(t){var e=v.DOM.getViewPort();return{x:t.x+e.x,y:t.y+e.y,w:t.w,h:t.h}},p=function(t){var e=t.getBoundingClientRect();return g({x:e.left,y:e.top,w:Math.max(t.clientWidth,t.offsetWidth),h:Math.max(t.client
Height,t.offsetHeight)})},y=function(t,e){return p(e)},b=function(t){return p(t.getContentAreaContainer()||t.getBody())},x=function(t){var e=t.selection.getBoundingClientRect();return e?g(f(e)):null},w=function(n,i){return function(t){for(var e=0;e<i.length;e++)if(i[e].predicate(n))return d(i[e].id,y(t,n));return null}},_=function(i,r){return function(t){for(var e=0;e<i.length;e++)for(var n=0;n<r.length;n++)if(r[n].predicate(i[e]))return d(r[n].id,y(t,i[e]));return null}},R=tinymce.util.Tools.resolve("tinymce.util.Tools"),C=function(t,e){return{id:t,predicate:e}},k=function(t){return R.map(t,function(t){return C(t.id,t.predicate)})},E=function(e){return function(t){return t.selection.isCollapsed()?null:d(e,x(t))}},H=function(i,r){return function(t){var e,n=t.schema.getTextBlockElements();for(e=0;e<i.length;e++)if("TABLE"===i[e].nodeName)return null;for(e=0;e<i.length;e++)if(i[e].nodeName in n)return t.dom.isEmpty(i[e])?d(r,x(t)):null;return null}},
S=function(t){t.fire("SkinLoaded")},M=function(t){return t.fire("BeforeRenderUI")},T=tinymce.util.Tools.resolve("tinymce.EditorManager"),W=function(e){return function(t){return typeof t===e}},P=function(t){return Array.isArray(t)},N=function(t){return W("string")(t)},O=function(t){return W("number")(t)},D=function(t){return W("boolean")(t)},A=function(t){return W("function")(t)},B=(W("object"),P),L=function(t,e){if(e(t))return!0;throw new Error("Default value doesn't match requested type.")},I=function(r){return function(t,e,n){var i=t.settings;return L(n,r),e in i&&r(i[e])?i[e]:n}},z={getStringOr:I(N),getBoolOr:I(D),getNumberOr:I(O),getHandlerOr:I(A),getToolbarItemsOr:(u=B,function(t,e,n){var i,r,o,s,a,l=e in t.settings?t.settings[e]:n;return L(n,u),r=n,B(i=l)?i:N(i)?"string"==typeof(s=i)?(a=/[ ,]/,s.split(a).filter(function(t){return 0<t.length})):s:D(i)?(o=r,!1===i?[]:o)
:r})},F=tinymce.util.Tools.resolve("tinymce.geom.Rect"),V=function(t,e){return{rect:t,position:e}},q=function(t,e){return{x:e.x,y:e.y,w:t.w,h:t.h}},U=function(t,e,n,i,r){var o,s,a,l={x:i.x,y:i.y,w:i.w+(i.w<r.w+n.w?r.w:0),h:i.h+(i.h<r.h+n.h?r.h:0)};return o=F.findBestRelativePosition(r,n,l,t),n=F.clamp(n,l),o?(s=F.relativePosition(r,n,o),a=q(r,s),V(a,o)):(n=F.intersect(l,n))?((o=F.findBestRelativePosition(r,n,l,e))?(s=F.relativePosition(r,n,o),a=q(r,s)):a=q(r,n),V(a,o)):null},j=function(t,e,n){return U(["cr-cl","cl-cr"],["bc-tc","bl-tl","br-tr"],t,e,n)},$=function(t,e,n){return U(["tc-bc","bc-tc","tl-bl","bl-tl","tr-br","br-tr","cr-cl","cl-cr"],["bc-tc","bl-tl","br-tr","cr-cl"],t,e,n)},Y=function(t,e,n,i){var r;return"function"==typeof t?(r=t({elementRect:m(e),contentAreaRect:m(n),panelRect:
m(i)}),f(r)):i},X=function(t){return t.panelRect},J=function(t){return z.getToolbarItemsOr(t,"selection_toolbar",["bold","italic","|","quicklink","h2","h3","blockquote"])},G=function(t){return z.getToolbarItemsOr(t,"insert_toolbar",["quickimage","quicktable"])},K=function(t){return z.getHandlerOr(t,"inline_toolbar_position_handler",X)},Z=function(t){var e,n,i,r,o=t.settings;return o.skin_url?(i=t,r=o.skin_url,i.documentBaseURI.toAbsolute(r)):(e=o.skin,n=T.baseURL+"/skins/",e?n+e:n+"lightgray")},Q=function(t){return!1===t.settings.skin},tt=function(i,r){var t=Z(i),e=function(){var t,e,n;e=r,n=function(){t._skinLoaded=!0,S(t),e()},(t=i).initialized?n():t.on("init",n)};Q(i)?e():(v.DOM.styleSheetLoader.load(t+"/skin.min.css",e),i.contentCSS.push(t+"/content.inline.min.css"))},et=function(t){var e,n,i,r,o=t.contextToolba
rs;return a.flatten([o||[],(e=t,n="img",i="image",r="alignleft aligncenter alignright",{predicate:function(t){return e.dom.is(t,n)},id:i,items:r})])},nt=function(t,e){var n,i,r,o,s;return s=(o=t).selection.getNode(),i=o.dom.getParents(s,"*"),r=k(e),(n=l(t,[w(i[0],r),E("text"),H(i,"insert"),_(i,r)]))&&n.rect?n:null},it=function(i,r){return function(){var t,e,n;i.removed||(n=i,document.activeElement!==n.getBody())||(t=et(i),(e=nt(i,t))?r.show(i,e.id,e.rect,t):r.hide())}},rt=function(t,e){var n,i,r,o,s,a=c.throttle(it(t,e),0),l=c.throttle((r=it(n=t,i=e),function(){n.removed||i.inForm()||r()}),0),u=(o=t,s=e,function(){var t=et(o),e=nt(o,t);e&&s.reposition(o,e.id,e.rect)});t.on("blur hide ObjectResizeStart",e.hide),t.on("click",a),t.on("nodeChange mouseup",l),t.on("ResizeEditor keyup",a),t.on("ResizeWindow",u),v.DOM.bind(h.container,"scroll",u),t.on(&quo
t;remove",function(){v.DOM.unbind(h.container,"scroll",u),e.remove()}),t.shortcuts.add("Alt+F10,F10","",e.focus)},ot=function(t,e){return tt(t,function(){var n,i;rt(t,e),i=e,(n=t).shortcuts.remove("meta+k"),n.shortcuts.add("meta+k","",function(){var t=et(n),e=l(n,[E("quicklink")]);e&&i.show(n,e.id,e.rect,t)})}),{}},st=function(t,e){return t.inline?ot(t,e):function(t){throw new Error(t)}("inlite theme only supports inline mode.")},at=function(t){return function(){return t}},lt={noop:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},noarg:function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n()}},compose:function(n,i){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n(i.apply(null,arguments))}},constant:at,identity:function(t){return t},tripleEquals:function(t,e){return t===e},curry:functio
n(o){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var s=new Array(arguments.length-1),n=1;n<arguments.length;n++)s[n-1]=arguments[n];return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];var r=s.concat(n);return o.apply(null,r)}},not:function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return!n.apply(null,arguments)}},die:function(t){return function(){throw new Error(t)}},apply:function(t){return t()},call:function(t){t()},never:at(!1),always:at(!0)},ut=lt.never,ct=lt.always,dt=function(){return ft},ft=(i={fold:function(t,e){return t()},is:ut,isSome:ut,isNone:ct,getOr:n=function(t){return t},getOrThunk:e=function(t){return t()},getOrDie:function(t){throw new Error(t||"error: getOrDie called on none.")},or:n,orThunk:e,map:dt,ap:dt,each:function(){},bind:dt,flatten:dt,exists:ut,forall:ct,filter:dt,equals:t=funct
ion(t){return t.isNone()},equals_:t,toArray:function(){return[]},toString:lt.constant("none()")},Object.freeze&&Object.freeze(i),i),ht=function(n){var t=function(){return n},e=function(){return r},i=function(t){return t(n)},r={fold:function(t,e){return e(n)},is:function(t){return n===t},isSome:ct,isNone:ut,getOr:t,getOrThunk:t,getOrDie:t,or:e,orThunk:e,map:function(t){return ht(t(n))},ap:function(t){return t.fold(dt,function(t){return ht(t(n))})},each:function(t){t(n)},bind:i,flatten:t,exists:i,forall:i,filter:function(t){return t(n)?r:ft},equals:function(t){return t.is(n)},equals_:function(t,e){return t.fold(ut,function(t){return e(n,t)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return r},mt={some:ht,none:dt,from:function(t){return null===t||t===undefined?ft:ht(t)}},gt=function(e){return function(t){return function(t){if(null===t)return"null";var e=typeof t;return"object"===e&&Array.pr
ototype.isPrototypeOf(t)?"array":"object"===e&&String.prototype.isPrototypeOf(t)?"string":e}(t)===e}},pt={isString:gt("string"),isObject:gt("object"),isArray:gt("array"),isNull:gt("null"),isBoolean:gt("boolean"),isUndefined:gt("undefined"),isFunction:gt("function"),isNumber:gt("number")},vt=(r=Array.prototype.indexOf)===undefined?function(t,e){return Ct(t,e)}:function(t,e){return r.call(t,e)},yt=function(t,e){return-1<vt(t,e)},bt=function(t,e){for(var n=t.length,i=new Array(n),r=0;r<n;r++){var o=t[r];i[r]=e(o,r,t)}return i},xt=function(t,e){for(var n=0,i=t.length;n<i;n++)e(t[n],n,t)},wt=function(t,e){for(var n=t.length-1;0<=n;n--)e(t[n],n,t)},_t=function(t,e){for(var n=[],i=0,r=t.length;i<r;i++){var o=t[i];e(o,i,t)&&n.push(o)}return n},Rt=function(t,e){for(var n=0,i=t.length;n<i;n++)if(e(t[n],n,t))return mt.some(n);return mt.none()},Ct=funct
ion(t,e){for(var n=0,i=t.length;n<i;++n)if(t[n]===e)return n;return-1},kt=Array.prototype.push,Et=function(t){for(var e=[],n=0,i=t.length;n<i;++n){if(!Array.prototype.isPrototypeOf(t[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+t);kt.apply(e,t[n])}return e},Ht=function(t,e){for(var n=0,i=t.length;n<i;++n)if(!0!==e(t[n],n,t))return!1;return!0},St=Array.prototype.slice,Mt=pt.isFunction(Array.from)?Array.from:function(t){return St.call(t)},Tt={map:bt,each:xt,eachr:wt,partition:function(t,e){for(var n=[],i=[],r=0,o=t.length;r<o;r++){var s=t[r];(e(s,r,t)?n:i).push(s)}return{pass:n,fail:i}},filter:_t,groupBy:function(t,e){if(0===t.length)return[];for(var n=e(t[0]),i=[],r=[],o=0,s=t.length;o<s;o++){var a=t[o],l=e(a);l!==n&&(i.push(r),r=[]),n=l,r.push(a)}return 0!==r.length&&i.push(r),i},indexOf:function(t,e){var n=vt(t,e);return-1===n?mt.none():mt.some(n)},foldr:function(t,e,n){return wt(t,function(t){n=e(n,t)}),n
},foldl:function(t,e,n){return xt(t,function(t){n=e(n,t)}),n},find:function(t,e){for(var n=0,i=t.length;n<i;n++){var r=t[n];if(e(r,n,t))return mt.some(r)}return mt.none()},findIndex:Rt,flatten:Et,bind:function(t,e){var n=bt(t,e);return Et(n)},forall:Ht,exists:function(t,e){return Rt(t,e).isSome()},contains:yt,equal:function(t,n){return t.length===n.length&&Ht(t,function(t,e){return t===n[e]})},reverse:function(t){var e=St.call(t,0);return e.reverse(),e},chunk:function(t,e){for(var n=[],i=0;i<t.length;i+=e){var r=t.slice(i,i+e);n.push(r)}return n},difference:function(t,e){return _t(t,function(t){return!yt(e,t)})},mapToObject:function(t,e){for(var n={},i=0,r=t.length;i<r;i++){var o=t[i];n[String(o)]=e(o,i)}return n},pure:function(t){return[t]},sort:function(t,e){var n=St.call(t,0);return n.sort(e),n},range:function(t,e){for(var n=[],i=0;i<t;i++)n.push(e(i));return n},head:function(t){return 0===t.length?mt.none():mt.some(t[0])},last:function(t){return 0===t.length?
mt.none():mt.some(t[t.length-1])},from:Mt},Wt=0,Pt={id:function(){return"mceu_"+Wt++},create:function(t,e,n){var i=document.createElement(t);return v.DOM.setAttribs(i,e),"string"==typeof n?i.innerHTML=n:R.each(n,function(t){t.nodeType&&i.appendChild(t)}),i},createFragment:function(t){return v.DOM.createFragment(t)},getWindowSize:function(){return v.DOM.getViewPort()},getSize:function(t){var e,n;if(t.getBoundingClientRect){var i=t.getBoundingClientRect();e=Math.max(i.width||i.right-i.left,t.offsetWidth),n=Math.max(i.height||i.bottom-i.bottom,t.offsetHeight)}else e=t.offsetWidth,n=t.offsetHeight;return{width:e,height:n}},getPos:function(t,e){return v.DOM.getPos(t,e||Pt.getContainer())},getContainer:function(){return h.container?h.container:document.body},getViewPort:function(t){return v.DOM.getViewPort(t)},get:function(t){return document.getElementById(t)},addClass:function(t,e){return v.DOM.addClass(t,e)},removeClass:function(t,e){return v.DOM.removeClass(
t,e)},hasClass:function(t,e){return v.DOM.hasClass(t,e)},toggleClass:function(t,e,n){return v.DOM.toggleClass(t,e,n)},css:function(t,e,n){return v.DOM.setStyle(t,e,n)},getRuntimeStyle:function(t,e){return v.DOM.getStyle(t,e,!0)},on:function(t,e,n,i){return v.DOM.bind(t,e,n,i)},off:function(t,e,n){return v.DOM.unbind(t,e,n)},fire:function(t,e,n){return v.DOM.fire(t,e,n)},innerHtml:function(t,e){v.DOM.setHTML(t,e)}},Nt=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),Ot=tinymce.util.Tools.resolve("tinymce.util.Class"),Dt=tinymce.util.Tools.resolve("tinymce.util.EventDispatcher"),At=function(t){var e;if(t)return"number"==typeof t?{top:t=t||0,left:t,bottom:t,right:t}:(1===(e=(t=t.split(" ")).length)?t[1]=t[2]=t[3]=t[0]:2===e?(t[2]=t[0],t[3]=t[1]):3===e&&(t[3]=t[1]),{top:parseInt(t[0],10)||0,right:parseInt(t[1],10)||0,bottom:parseInt(t[2],10)||0,left:parseInt(t[3],10)||0})},Bt=function(i,t){function e(t){var e=parseFloat(functio
n(t){var e=i.ownerDocument.defaultView;if(e){var n=e.getComputedStyle(i,null);return n?(t=t.replace(/[A-Z]/g,function(t){return"-"+t}),n.getPropertyValue(t)):null}return i.currentStyle[t]}(t));return isNaN(e)?0:e}return{top:e(t+"TopWidth"),right:e(t+"RightWidth"),bottom:e(t+"BottomWidth"),left:e(t+"LeftWidth")}};function Lt(){}function It(t){this.cls=[],this.cls._map={},this.onchange=t||Lt,this.prefix=""}R.extend(It.prototype,{add:function(t){return t&&!this.contains(t)&&(this.cls._map[t]=!0,this.cls.push(t),this._change()),this},remove:function(t){if(this.contains(t)){var e=void 0;for(e=0;e<this.cls.length&&this.cls[e]!==t;e++);this.cls.splice(e,1),delete this.cls._map[t],this._change()}return this},toggle:function(t,e){var n=this.contains(t);return n!==e&&(n?this.remove(t):this.add(t),this._change()),this},contains:function(t){return!!this.cls._map[t]},_change:function(){delete this.clsV
alue,this.onchange.call(this)}}),It.prototype.toString=function(){var t;if(this.clsValue)return this.clsValue;t="";for(var e=0;e<this.cls.length;e++)0<e&&(t+=" "),t+=this.prefix+this.cls[e];return t};var zt,Ft,Vt,qt=/^([\w\\*]+)?(?:#([\w\-\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i,Ut=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,jt=/^\s*|\s*$/g,$t=Ot.extend({init:function(t){var o=this.match;function s(t,e,n){var i;function r(t){t&&e.push(t)}return r(function(e){if(e)return e=e.toLowerCase(),function(t){return"*"===e||t.type===e}}((i=qt.exec(t.replace(jt,"")))[1])),r(function(e){if(e)return function(t){return t._name===e}}(i[2])),r(function(n){if(n)return n=n.split("."),function(t){for(var e=n.length;e--;)if(!t.classes.contains(n[e]))return!1;return!0}}(i[3])),
r(function(n,i,r){if(n)return function(t){var e=t[n]?t[n]():"";return i?"="===i?e===r:"*="===i?0<=e.indexOf(r):"~="===i?0<=(" "+e+" ").indexOf(" "+r+" "):"!="===i?e!==r:"^="===i?0===e.indexOf(r):"$="===i&&e.substr(e.length-r.length)===r:!!r}}(i[4],i[5],i[6])),r(function(i){var e;if(i)return(i=/(?:not\((.+)\))|(.+)/i.exec(i))[1]?(e=a(i[1],[]),function(t){return!o(t,e)}):(i=i[2],function(t,e,n){return"first"===i?0===e:"last"===i?e===n-1:"even"===i?e%2==0:"odd"===i?e%2==1:!!t[i]&&t[i]()})}(i[7])),e.pseudo=!!i[7],e.direct=n,e}function a(t,e){var n,i,r,o=[];do{if(Ut.exec(""),(i=Ut.exec(t))&&(t=i[3],o.push(i[1]),i[2])){n=i[3];break}}while(i);for(n&&a(n,e),t=[],r=0;r<o.length;r++)">"!==o[r]&&t.push(s(o[r],[],">"===o[r-1]));return e.push(t),e}this._selectors=a
(t,[])},match:function(t,e){var n,i,r,o,s,a,l,u,c,d,f,h,m;for(n=0,i=(e=e||this._selectors).length;n<i;n++){for(m=t,h=0,r=(o=(s=e[n]).length)-1;0<=r;r--)for(u=s[r];m;){if(u.pseudo)for(c=d=(f=m.parent().items()).length;c--&&f[c]!==m;);for(a=0,l=u.length;a<l;a++)if(!u[a](m,c,d)){a=l+1;break}if(a===l){h++;break}if(r===o-1)break;m=m.parent()}if(h===o)return!0}return!1},find:function(t){var e,n,u=[],i=this._selectors;function c(t,e,n){var i,r,o,s,a,l=e[n];for(i=0,r=t.length;i<r;i++){for(a=t[i],o=0,s=l.length;o<s;o++)if(!l[o](a,i,r)){o=s+1;break}if(o===s)n===e.length-1?u.push(a):a.items&&c(a.items(),e,n+1);else if(l.direct)return;a.items&&c(a.items(),e,n)}}if(t.items){for(e=0,n=i.length;e<n;e++)c(t.items(),i[e],0);1<n&&(u=function(t){for(var e,n=[],i=t.length;i--;)(e=t[i]).__checked||(n.push(e),e.__checked=1);for(i=n.length;i--;)delete n[i].__checked;return n}(u))}return zt||(zt=$t.Collection),new zt(u)}}),Yt=Array.prototype.push,Xt=Arra
y.prototype.slice;Vt={length:0,init:function(t){t&&this.add(t)},add:function(t){return R.isArray(t)?Yt.apply(this,t):t instanceof Ft?this.add(t.toArray()):Yt.call(this,t),this},set:function(t){var e,n=this,i=n.length;for(n.length=0,n.add(t),e=n.length;e<i;e++)delete n[e];return n},filter:function(e){var t,n,i,r,o=[];for("string"==typeof e?(e=new $t(e),r=function(t){return e.match(t)}):r=e,t=0,n=this.length;t<n;t++)r(i=this[t])&&o.push(i);return new Ft(o)},slice:function(){return new Ft(Xt.apply(this,arguments))},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},each:function(t){return R.each(this,t),this},toArray:function(){return R.toArray(this)},indexOf:function(t){for(var e=this.length;e--&&this[e]!==t;);return e},reverse:function(){return new Ft(R.toArray(this).reverse())},hasClass:function(t){return!!this[0]&&this[0].classes.contains(t)},prop:function(e,n){var t;return n!==undefined?(this.each(function(t){t[e]&&
;t[e](n)}),this):(t=this[0])&&t[e]?t[e]():void 0},exec:function(e){var n=R.toArray(arguments).slice(1);return this.each(function(t){t[e]&&t[e].apply(t,n)}),this},remove:function(){for(var t=this.length;t--;)this[t].remove();return this},addClass:function(e){return this.each(function(t){t.classes.add(e)})},removeClass:function(e){return this.each(function(t){t.classes.remove(e)})}},R.each("fire on off show hide append prepend before after reflow".split(" "),function(n){Vt[n]=function(){var e=R.toArray(arguments);return this.each(function(t){n in t&&t[n].apply(t,e)}),this}}),R.each("text name disabled active selected checked visible parent value data".split(" "),function(e){Vt[e]=function(t){return this.prop(e,t)}}),Ft=Ot.extend(Vt);var Jt=$t.Collection=Ft,Gt=function(t){this.create=t.create};Gt.create=function(r,o){return new Gt({create:function(e,n){var i,t=function(t){e.set(n,t.value)};return e.on("change:"+n
,function(t){r.set(o,t.value)}),r.on("change:"+o,t),(i=e._bindings)||(i=e._bindings=[],e.on("destroy",function(){for(var t=i.length;t--;)i[t]()})),i.push(function(){r.off("change:"+o,t)}),r.get(o)}})};var Kt=tinymce.util.Tools.resolve("tinymce.util.Observable");function Zt(t){return 0<t.nodeType}var Qt,te,ee=Ot.extend({Mixins:[Kt],init:function(t){var e,n;for(e in t=t||{})(n=t[e])instanceof Gt&&(t[e]=n.create(this,e));this.data=t},set:function(e,n){var i,r,o=this.data[e];if(n instanceof Gt&&(n=n.create(this,e)),"object"==typeof e){for(i in e)this.set(i,e[i]);return this}return function t(e,n){var i,r;if(e===n)return!0;if(null===e||null===n)return e===n;if("object"!=typeof e||"object"!=typeof n)return e===n;if(R.isArray(n)){if(e.length!==n.length)return!1;for(i=e.length;i--;)if(!t(e[i],n[i]))return!1}if(Zt(e)||Zt(n))return e===n;for(i in r={},n){if(!t(e[i],n[i]))return!1;r[i]=!0}for(i in e)if(!r[
i]&&!t(e[i],n[i]))return!1;return!0}(o,n)||(this.data[e]=n,r={target:this,name:e,value:n,oldValue:o},this.fire("change:"+e,r),this.fire("change",r)),this},get:function(t){return this.data[t]},has:function(t){return t in this.data},bind:function(t){return Gt.create(this,t)},destroy:function(){this.fire("destroy")}}),ne={},ie={add:function(t){var e=t.parent();if(e){if(!e._layout||e._layout.isNative())return;ne[e._id]||(ne[e._id]=e),Qt||(Qt=!0,c.requestAnimationFrame(function(){var t,e;for(t in Qt=!1,ne)(e=ne[t]).state.get("rendered")&&e.reflow();ne={}},document.body))}},remove:function(t){ne[t._id]&&delete ne[t._id]}},re=function(t){return t?t.getRoot().uiContainer:null},oe={getUiContainerDelta:function(t){var e=re(t);if(e&&"static"!==v.DOM.getStyle(e,"position",!0)){var n=v.DOM.getPos(e),i=e.scrollLeft-n.x,r=e.scrollTop-n.y;return mt.some({x:i,y:r})}return mt.none()},setUiContainer:function(t,
e){var n=v.DOM.select(t.settings.ui_container)[0];e.getRoot().uiContainer=n},getUiContainer:re,inheritUiContainer:function(t,e){return e.uiContainer=re(t)}},se="onmousewheel"in document,ae=!1,le=0,ue={Statics:{classPrefix:"mce-"},isRtl:function(){return te.rtl},classPrefix:"mce-",init:function(e){var t,n,i=this;function r(t){var e;for(t=t.split(" "),e=0;e<t.length;e++)i.classes.add(t[e])}i.settings=e=R.extend({},i.Defaults,e),i._id=e.id||"mceu_"+le++,i._aria={role:e.role},i._elmCache={},i.$=Nt,i.state=new ee({visible:!0,active:!1,disabled:!1,value:""}),i.data=new ee(e.data),i.classes=new It(function(){i.state.get("rendered")&&(i.getEl().className=this.toString())}),i.classes.prefix=i.classPrefix,(t=e.classes)&&(i.Defaults&&(n=i.Defaults.classes)&&t!==n&&r(n),r(t)),R.each("title text name visible disabled active value".split(" "),function(t){t in e&
&i[t](e[t])}),i.on("click",function(){if(i.disabled())return!1}),i.settings=e,i.borderBox=At(e.border),i.paddingBox=At(e.padding),i.marginBox=At(e.margin),e.hidden&&i.hide()},Properties:"parent,name",getContainerElm:function(){var t=oe.getUiContainer(this);return t||Pt.getContainer()},getParentCtrl:function(t){for(var e,n=this.getRoot().controlIdLookup;t&&n&&!(e=n[t.id]);)t=t.parentNode;return e},initLayoutRect:function(){var t,e,n,i,r,o,s,a,l,u,c=this,d=c.settings,f=c.getEl();t=c.borderBox=c.borderBox||Bt(f,"border"),c.paddingBox=c.paddingBox||Bt(f,"padding"),c.marginBox=c.marginBox||Bt(f,"margin"),u=Pt.getSize(f),a=d.minWidth,l=d.minHeight,r=a||u.width,o=l||u.height,n=d.width,i=d.height,s=void 0!==(s=d.autoResize)?s:!n&&!i,n=n||r,i=i||o;var h=t.left+t.right,m=t.top+t.bottom,g=d.maxWidth||65535,p=d.maxHeight||65535;return c._layoutRect=e={x:d.x||0,y:d.y||0,w:n,h:i,deltaW:h,deltaH:m,contentW:n-h,co
ntentH:i-m,innerW:n-h,innerH:i-m,startMinWidth:a||0,startMinHeight:l||0,minW:Math.min(r,g),minH:Math.min(o,p),maxW:g,maxH:p,autoResize:s,scrollW:0},c._lastLayoutRect={},e},layoutRect:function(t){var e,n,i,r,o,s=this,a=s._layoutRect;return a||(a=s.initLayoutRect()),t?(i=a.deltaW,r=a.deltaH,t.x!==undefined&&(a.x=t.x),t.y!==undefined&&(a.y=t.y),t.minW!==undefined&&(a.minW=t.minW),t.minH!==undefined&&(a.minH=t.minH),(n=t.w)!==undefined&&(n=(n=n<a.minW?a.minW:n)>a.maxW?a.maxW:n,a.w=n,a.innerW=n-i),(n=t.h)!==undefined&&(n=(n=n<a.minH?a.minH:n)>a.maxH?a.maxH:n,a.h=n,a.innerH=n-r),(n=t.innerW)!==undefined&&(n=(n=n<a.minW-i?a.minW-i:n)>a.maxW-i?a.maxW-i:n,a.innerW=n,a.w=n+i),(n=t.innerH)!==undefined&&(n=(n=n<a.minH-r?a.minH-r:n)>a.maxH-r?a.maxH-r:n,a.innerH=n,a.h=n+r),t.contentW!==undefined&&(a.contentW=t.contentW),t.contentH!==undefined&&(a.contentH=t.contentH),(e=s._lastLayoutRect).x===a
.x&&e.y===a.y&&e.w===a.w&&e.h===a.h||((o=te.repaintControls)&&o.map&&!o.map[s._id]&&(o.push(s),o.map[s._id]=!0),e.x=a.x,e.y=a.y,e.w=a.w,e.h=a.h),s):a},repaint:function(){var t,e,n,i,r,o,s,a,l,u,c=this;l=document.createRange?function(t){return t}:Math.round,t=c.getEl().style,i=c._layoutRect,a=c._lastRepaintRect||{},o=(r=c.borderBox).left+r.right,s=r.top+r.bottom,i.x!==a.x&&(t.left=l(i.x)+"px",a.x=i.x),i.y!==a.y&&(t.top=l(i.y)+"px",a.y=i.y),i.w!==a.w&&(u=l(i.w-o),t.width=(0<=u?u:0)+"px",a.w=i.w),i.h!==a.h&&(u=l(i.h-s),t.height=(0<=u?u:0)+"px",a.h=i.h),c._hasBody&&i.innerW!==a.innerW&&(u=l(i.innerW),(n=c.getEl("body"))&&((e=n.style).width=(0<=u?u:0)+"px"),a.innerW=i.innerW),c._hasBody&&i.innerH!==a.innerH&&(u=l(i.innerH),(n=n||c.getEl("body"))&&((e=e||n.style).height=(0<=u?u:0)+&
quot;px"),a.innerH=i.innerH),c._lastRepaintRect=a,c.fire("repaint",{},!1)},updateLayoutRect:function(){var t=this;t.parent()._lastRect=null,Pt.css(t.getEl(),{width:"",height:""}),t._layoutRect=t._lastRepaintRect=t._lastLayoutRect=null,t.initLayoutRect()},on:function(t,e){var n,i,r,o=this;return ce(o).on(t,"string"!=typeof(n=e)?n:function(t){return i||o.parentsAndSelf().each(function(t){var e=t.settings.callbacks;if(e&&(i=e[n]))return r=t,!1}),i?i.call(r,t):(t.action=n,void this.fire("execute",t))}),o},off:function(t,e){return ce(this).off(t,e),this},fire:function(t,e,n){if((e=e||{}).control||(e.control=this),e=ce(this).fire(t,e),!1!==n&&this.parent)for(var i=this.parent();i&&!e.isPropagationStopped();)i.fire(t,e,!1),i=i.parent();return e},hasEventListeners:function(t){return ce(this).has(t)},parents:function(t){var e,n=new Jt;for(e=this.parent();e;e=e.parent())n.add(e);return t&&(n=n.filter(t)),n}
,parentsAndSelf:function(t){return new Jt(this).add(this.parents(t))},next:function(){var t=this.parent().items();return t[t.indexOf(this)+1]},prev:function(){var t=this.parent().items();return t[t.indexOf(this)-1]},innerHtml:function(t){return this.$el.html(t),this},getEl:function(t){var e=t?this._id+"-"+t:this._id;return this._elmCache[e]||(this._elmCache[e]=Nt("#"+e)[0]),this._elmCache[e]},show:function(){return this.visible(!0)},hide:function(){return this.visible(!1)},focus:function(){try{this.getEl().focus()}catch(t){}return this},blur:function(){return this.getEl().blur(),this},aria:function(t,e){var n=this,i=n.getEl(n.ariaTarget);return void 0===e?n._aria[t]:(n._aria[t]=e,n.state.get("rendered")&&i.setAttribute("role"===t?t:"aria-"+t,e),n)},encode:function(t,e){return!1!==e&&(t=this.translate(t)),(t||"").replace(/[&<>"]/g,function(t){return"&#"+t.charCodeAt(0)+";&quo
t;})},translate:function(t){return te.translate?te.translate(t):t},before:function(t){var e=this.parent();return e&&e.insert(t,e.items().indexOf(this),!0),this},after:function(t){var e=this.parent();return e&&e.insert(t,e.items().indexOf(this)),this},remove:function(){var e,t,n=this,i=n.getEl(),r=n.parent();if(n.items){var o=n.items().toArray();for(t=o.length;t--;)o[t].remove()}r&&r.items&&(e=[],r.items().each(function(t){t!==n&&e.push(t)}),r.items().set(e),r._lastRect=null),n._eventsRoot&&n._eventsRoot===n&&Nt(i).off();var s=n.getRoot().controlIdLookup;return s&&delete s[n._id],i&&i.parentNode&&i.parentNode.removeChild(i),n.state.set("rendered",!1),n.state.destroy(),n.fire("remove"),n},renderBefore:function(t){return Nt(t).before(this.renderHtml()),this.postRender(),this},renderTo:function(t){return Nt(t||this.getContainerElm()).append(this.renderHtml()),this.postRender(),this},preRe
nder:function(){},render:function(){},renderHtml:function(){return'<div id="'+this._id+'" class="'+this.classes+'"></div>'},postRender:function(){var t,e,n,i,r,o=this,s=o.settings;for(i in o.$el=Nt(o.getEl()),o.state.set("rendered",!0),s)0===i.indexOf("on")&&o.on(i.substr(2),s[i]);if(o._eventsRoot){for(n=o.parent();!r&&n;n=n.parent())r=n._eventsRoot;if(r)for(i in r._nativeEvents)o._nativeEvents[i]=!0}de(o),s.style&&(t=o.getEl())&&(t.setAttribute("style",s.style),t.style.cssText=s.style),o.settings.border&&(e=o.borderBox,o.$el.css({"border-top-width":e.top,"border-right-width":e.right,"border-bottom-width":e.bottom,"border-left-width":e.left}));var a=o.getRoot();for(var l in a.controlIdLookup||(a.controlIdLookup={}),(a.controlIdLookup[o._id]=o)._aria)o.aria(l,o._aria[l]);!1===o.state.get("visible")&&(o.getEl().style.display=&q
uot;none"),o.bindStates(),o.state.on("change:visible",function(t){var e,n=t.value;o.state.get("rendered")&&(o.getEl().style.display=!1===n?"none":"",o.getEl().getBoundingClientRect()),(e=o.parent())&&(e._lastRect=null),o.fire(n?"show":"hide"),ie.add(o)}),o.fire("postrender",{},!1)},bindStates:function(){},scrollIntoView:function(t){var e,n,i,r,o,s,a=this.getEl(),l=a.parentNode,u=function(t,e){var n,i,r=t;for(n=i=0;r&&r!==e&&r.nodeType;)n+=r.offsetLeft||0,i+=r.offsetTop||0,r=r.offsetParent;return{x:n,y:i}}(a,l);return e=u.x,n=u.y,i=a.offsetWidth,r=a.offsetHeight,o=l.clientWidth,s=l.clientHeight,"end"===t?(e-=o-i,n-=s-r):"center"===t&&(e-=o/2-i/2,n-=s/2-r/2),l.scrollLeft=e,l.scrollTop=n,this},getRoot:function(){for(var t,e=this,n=[];e;){if(e.rootControl){t=e.rootControl;break}n.push(e),e=(t=e).parent()}t||(t=this);for(var i=n.length;i--;)n[i].rootContr
ol=t;return t},reflow:function(){ie.remove(this);var t=this.parent();return t&&t._layout&&!t._layout.isNative()&&t.reflow(),this}};function ce(n){return n._eventDispatcher||(n._eventDispatcher=new Dt({scope:n,toggleEvent:function(t,e){e&&Dt.isNative(t)&&(n._nativeEvents||(n._nativeEvents={}),n._nativeEvents[t]=!0,n.state.get("rendered")&&de(n))}})),n._eventDispatcher}function de(a){var t,e,n,l,i,r;function o(t){var e=a.getParentCtrl(t.target);e&&e.fire(t.type,t)}function s(){var t=l._lastHoverCtrl;t&&(t.fire("mouseleave",{target:t.getEl()}),t.parents().each(function(t){t.fire("mouseleave",{target:t.getEl()})}),l._lastHoverCtrl=null)}function u(t){var e,n,i,r=a.getParentCtrl(t.target),o=l._lastHoverCtrl,s=0;if(r!==o){if((n=(l._lastHoverCtrl=r).parents().toArray().reverse()).push(r),o){for((i=o.parents().toArray().reverse()).push(o),s=0;s<i.length&&n[s]===i[s];s++);for(e=i.length-1
;s<=e;e--)(o=i[e]).fire("mouseleave",{target:o.getEl()})}for(e=s;e<n.length;e++)(r=n[e]).fire("mouseenter",{target:r.getEl()})}}function c(t){t.preventDefault(),"mousewheel"===t.type?(t.deltaY=-.025*t.wheelDelta,t.wheelDeltaX&&(t.deltaX=-.025*t.wheelDeltaX)):(t.deltaX=0,t.deltaY=t.detail),t=a.fire("wheel",t)}if(i=a._nativeEvents){for((n=a.parents().toArray()).unshift(a),t=0,e=n.length;!l&&t<e;t++)l=n[t]._eventsRoot;for(l||(l=n[n.length-1]||a),a._eventsRoot=l,e=t,t=0;t<e;t++)n[t]._eventsRoot=l;var d=l._delegates;for(r in d||(d=l._delegates={}),i){if(!i)return!1;"wheel"!==r||ae?("mouseenter"===r||"mouseleave"===r?l._hasMouseEnter||(Nt(l.getEl()).on("mouseleave",s).on("mouseover",u),l._hasMouseEnter=1):d[r]||(Nt(l.getEl()).on(r,o),d[r]=!0),i[r]=!1):se?Nt(a.getEl()).on("mousewheel",c):Nt(a.getEl()).on("DOMMouseScroll",c)}}}R.each("text title visi
ble disabled active value".split(" "),function(e){ue[e]=function(t){return 0===arguments.length?this.state.get(e):(void 0!==t&&this.state.set(e,t),this)}});var fe=te=Ot.extend(ue),he=function(t){return"static"===Pt.getRuntimeStyle(t,"position")},me=function(t){return t.state.get("fixed")};function ge(t,e,n){var i,r,o,s,a,l,u,c,d,f;return d=pe(),o=(r=Pt.getPos(e,oe.getUiContainer(t))).x,s=r.y,me(t)&&he(document.body)&&(o-=d.x,s-=d.y),i=t.getEl(),a=(f=Pt.getSize(i)).width,l=f.height,u=(f=Pt.getSize(e)).width,c=f.height,"b"===(n=(n||"").split(""))[0]&&(s+=c),"r"===n[1]&&(o+=u),"c"===n[0]&&(s+=Math.round(c/2)),"c"===n[1]&&(o+=Math.round(u/2)),"b"===n[3]&&(s-=l),"r"===n[4]&&(o-=a),"c"===n[3]&&(s-=Math.round(l/2)),"c"===n[4]&&(o-=Math.round(a/2)),{x:o,y:s,w:a,
h:l}}var pe=function(){var t=window,e=Math.max(t.pageXOffset,document.body.scrollLeft,document.documentElement.scrollLeft),n=Math.max(t.pageYOffset,document.body.scrollTop,document.documentElement.scrollTop);return{x:e,y:n,w:e+(t.innerWidth||document.documentElement.clientWidth),h:n+(t.innerHeight||document.documentElement.clientHeight)}},ve=function(t){var e,n=oe.getUiContainer(t);return n&&!me(t)?{x:0,y:0,w:(e=n).scrollWidth-1,h:e.scrollHeight-1}:pe()},ye={testMoveRel:function(t,e){for(var n=ve(this),i=0;i<e.length;i++){var r=ge(this,t,e[i]);if(me(this)){if(0<r.x&&r.x+r.w<n.w&&0<r.y&&r.y+r.h<n.h)return e[i]}else if(r.x>n.x&&r.x+r.w<n.w&&r.y>n.y&&r.y+r.h<n.h)return e[i]}return e[0]},moveRel:function(t,e){"string"!=typeof e&&(e=this.testMoveRel(t,e));var n=ge(this,t,e);return this.moveTo(n.x,n.y)},moveBy:function(t,e){var n=this.layoutRect();return this.moveTo(n.x+t,n.y+e),this},move
To:function(t,e){var n=this;function i(t,e,n){return t<0?0:e<t+n&&(t=e-n)<0?0:t}if(n.settings.constrainToViewport){var r=ve(this),o=n.layoutRect();t=i(t,r.w,o.w),e=i(e,r.h,o.h)}var s=oe.getUiContainer(n);return s&&he(s)&&!me(n)&&(t-=s.scrollLeft,e-=s.scrollTop),s&&(t+=1,e+=1),n.state.get("rendered")?n.layoutRect({x:t,y:e}).repaint():(n.settings.x=t,n.settings.y=e),n.fire("move",{x:t,y:e}),n}},be=fe.extend({Mixins:[ye],Defaults:{classes:"widget tooltip tooltip-n"},renderHtml:function(){var t=this,e=t.classPrefix;return'<div id="'+t._id+'" class="'+t.classes+'" role="presentation"><div class="'+e+'tooltip-arrow"></div><div class="'+e+'tooltip-inner">'+t.encode(t.state.get("text"))+"</div></div>"},bindStates:function(){var e=this;return e.state.on("change:text",function(t){e.getEl().lastChild.i
nnerHTML=e.encode(t.value)}),e._super()},repaint:function(){var t,e;t=this.getEl().style,e=this._layoutRect,t.left=e.x+"px",t.top=e.y+"px",t.zIndex=131070}}),xe=fe.extend({init:function(i){var r=this;r._super(i),i=r.settings,r.canFocus=!0,i.tooltip&&!1!==xe.tooltips&&(r.on("mouseenter",function(t){var e=r.tooltip().moveTo(-65535);if(t.control===r){var n=e.text(i.tooltip).show().testMoveRel(r.getEl(),["bc-tc","bc-tl","bc-tr"]);e.classes.toggle("tooltip-n","bc-tc"===n),e.classes.toggle("tooltip-nw","bc-tl"===n),e.classes.toggle("tooltip-ne","bc-tr"===n),e.moveRel(r.getEl(),n)}else e.hide()}),r.on("mouseleave mousedown click",function(){r.tooltip().remove(),r._tooltip=null})),r.aria("label",i.ariaLabel||i.tooltip)},tooltip:function(){return this._tooltip||(this._tooltip=new be({type:"tooltip"}),oe.inheritUiContainer(this,t
his._tooltip),this._tooltip.renderTo()),this._tooltip},postRender:function(){var t=this,e=t.settings;t._super(),t.parent()||!e.width&&!e.height||(t.initLayoutRect(),t.repaint()),e.autofocus&&t.focus()},bindStates:function(){var e=this;function n(t){e.aria("disabled",t),e.classes.toggle("disabled",t)}function i(t){e.aria("pressed",t),e.classes.toggle("active",t)}return e.state.on("change:disabled",function(t){n(t.value)}),e.state.on("change:active",function(t){i(t.value)}),e.state.get("disabled")&&n(!0),e.state.get("active")&&i(!0),e._super()},remove:function(){this._super(),this._tooltip&&(this._tooltip.remove(),this._tooltip=null)}}),we=xe.extend({Defaults:{value:0},init:function(t){this._super(t),this.classes.add("progress"),this.settings.filter||(this.settings.filter=function(t){return Math.round(t)})},renderHtml:function(){var t=this._id,e=this.classP
refix;return'<div id="'+t+'" class="'+this.classes+'"><div class="'+e+'bar-container"><div class="'+e+'bar"></div></div><div class="'+e+'text">0%</div></div>'},postRender:function(){return this._super(),this.value(this.settings.value),this},bindStates:function(){var e=this;function n(t){t=e.settings.filter(t),e.getEl().lastChild.innerHTML=t+"%",e.getEl().firstChild.firstChild.style.width=t+"%"}return e.state.on("change:value",function(t){n(t.value)}),n(e.state.get("value")),e._super()}}),_e=function(t,e){t.getEl().lastChild.textContent=e+(t.progressBar?" "+t.progressBar.value()+"%":"")},Re=fe.extend({Mixins:[ye],Defaults:{classes:"widget notification"},init:function(t){var e=this;e._super(t),e.maxWidth=t.maxWidth,t.text&&e.text(t.text),t.icon&&(e.icon=t.icon),t.color&&(e.color=t.color
),t.type&&e.classes.add("notification-"+t.type),t.timeout&&(t.timeout<0||0<t.timeout)&&!t.closeButton?e.closeButton=!1:(e.classes.add("has-close"),e.closeButton=!0),t.progressBar&&(e.progressBar=new we),e.on("click",function(t){-1!==t.target.className.indexOf(e.classPrefix+"close")&&e.close()})},renderHtml:function(){var t,e=this,n=e.classPrefix,i="",r="",o="";return e.icon&&(i='<i class="'+n+"ico "+n+"i-"+e.icon+'"></i>'),t=' style="max-width: '+e.maxWidth+"px;"+(e.color?"background-color: "+e.color+';"':'"'),e.closeButton&&(r='<button type="button" class="'+n+'close" aria-hidden="true">\xd7</button>'),e.progressBar&&(o=e.progressBar.renderHtml()),'<div id="'+e._id+'" class="'+e.classes+'"'+t+' role="
;presentation">'+i+'<div class="'+n+'notification-inner">'+e.state.get("text")+"</div>"+o+r+'<div style="clip: rect(1px, 1px, 1px, 1px);height: 1px;overflow: hidden;position: absolute;width: 1px;" aria-live="assertive" aria-relevant="additions" aria-atomic="true"></div></div>'},postRender:function(){var t=this;return c.setTimeout(function(){t.$el.addClass(t.classPrefix+"in"),_e(t,t.state.get("text"))},100),t._super()},bindStates:function(){var e=this;return e.state.on("change:text",function(t){e.getEl().firstChild.innerHTML=t.value,_e(e,t.value)}),e.progressBar&&(e.progressBar.bindStates(),e.progressBar.state.on("change:value",function(t){_e(e,e.state.get("text"))})),e._super()},close:function(){return this.fire("close").isDefaultPrevented()||this.remove(),this},repaint:function(){var t,e;t=this.getEl().style,
e=this._layoutRect,t.left=e.x+"px",t.top=e.y+"px",t.zIndex=65534}});function Ce(o){var s=function(t){return t.inline?t.getElement():t.getContentAreaContainer()};return{open:function(t,e){var n,i=R.extend(t,{maxWidth:(n=s(o),Pt.getSize(n).width)}),r=new Re(i);return 0<(r.args=i).timeout&&(r.timer=setTimeout(function(){r.close(),e()},i.timeout)),r.on("close",function(){e()}),r.renderTo(),r},close:function(t){t.close()},reposition:function(t){var e;e=t,Tt.each(e,function(t){t.moveTo(0,0)}),function(n){if(0<n.length){var t=n.slice(0,1)[0],e=s(o);t.moveRel(e,"tc-tc"),Tt.each(n,function(t,e){0<e&&t.moveRel(n[e-1].getEl(),"bc-tc")})}}(t)},getArgs:function(t){return t.args}}}function ke(t){var e,n;if(t.changedTouches)for(e="screenX screenY pageX pageY clientX clientY".split(" "),n=0;n<e.length;n++)t[e[n]]=t.changedTouches[0][e[n]]}function Ee(t,h){var m,g,e,p,v,y,b,x=h.document||document;h=h||{
};var w=x.getElementById(h.handle||t);e=function(t){var e,n,i,r,o,s,a,l,u,c,d,f=(e=x,u=Math.max,n=e.documentElement,i=e.body,r=u(n.scrollWidth,i.scrollWidth),o=u(n.clientWidth,i.clientWidth),s=u(n.offsetWidth,i.offsetWidth),a=u(n.scrollHeight,i.scrollHeight),l=u(n.clientHeight,i.clientHeight),{width:r<s?o:r,height:a<u(n.offsetHeight,i.offsetHeight)?l:a});ke(t),t.preventDefault(),g=t.button,c=w,y=t.screenX,b=t.screenY,d=window.getComputedStyle?window.getComputedStyle(c,null).getPropertyValue("cursor"):c.runtimeStyle.cursor,m=Nt("<div></div>").css({position:"absolute",top:0,left:0,width:f.width,height:f.height,zIndex:2147483647,opacity:1e-4,cursor:d}).appendTo(x.body),Nt(x).on("mousemove touchmove",v).on("mouseup touchend",p),h.start(t)},v=function(t){if(ke(t),t.button!==g)return p(t);t.deltaX=t.screenX-y,t.deltaY=t.screenY-b,t.preventDefault(),h.drag(t)},p=function(t){ke(t),Nt(x).off("mousemove touchmove",v
).off("mouseup touchend",p),m.remove(),h.stop&&h.stop(t)},this.destroy=function(){Nt(w).off()},Nt(w).on("mousedown touchstart",e)}var He=tinymce.util.Tools.resolve("tinymce.ui.Factory"),Se=function(t){return!!t.getAttribute("data-mce-tabstop")};function Me(t){var o,r,n=t.root;function i(t){return t&&1===t.nodeType}try{o=document.activeElement}catch(e){o=document.body}function s(t){return i(t=t||o)?t.getAttribute("role"):null}function a(t){for(var e,n=t||o;n=n.parentNode;)if(e=s(n))return e}function l(t){var e=o;if(i(e))return e.getAttribute("aria-"+t)}function u(t){var e=t.tagName.toUpperCase();return"INPUT"===e||"TEXTAREA"===e||"SELECT"===e}function c(e){var r=[];return function t(e){if(1===e.nodeType&&"none"!==e.style.display&&!e.disabled){var n;(u(n=e)&&!n.hidden||Se(n)||/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell|slider)
$/.test(s(n)))&&r.push(e);for(var i=0;i<e.childNodes.length;i++)t(e.childNodes[i])}}(e||n.getEl()),r}function d(t){var e,n;(n=(t=t||r).parents().toArray()).unshift(t);for(var i=0;i<n.length&&!(e=n[i]).settings.ariaRoot;i++);return e}function f(t,e){return t<0?t=e.length-1:t>=e.length&&(t=0),e[t]&&e[t].focus(),t}function h(t,e){var n=-1,i=d();e=e||c(i.getEl());for(var r=0;r<e.length;r++)e[r]===o&&(n=r);n+=t,i.lastAriaIndex=f(n,e)}function m(){"tablist"===a()?h(-1,c(o.parentNode)):r.parent().submenu?y():h(-1)}function g(){var t=s(),e=a();"tablist"===e?h(1,c(o.parentNode)):"menuitem"===t&&"menu"===e&&l("haspopup")?b():h(1)}function p(){h(-1)}function v(){var t=s(),e=a();"menuitem"===t&&"menubar"===e?b():"button"===t&&l("haspopup")?b({key:"down"}):h(1)}function y(){r.fire("cancel")}function b(
t){t=t||{},r.fire("click",{target:o,aria:t})}return r=n.getParentCtrl(o),n.on("keydown",function(t){function e(t,e){u(o)||Se(o)||"slider"!==s(o)&&!1!==e(t)&&t.preventDefault()}if(!t.isDefaultPrevented())switch(t.keyCode){case 37:e(t,m);break;case 39:e(t,g);break;case 38:e(t,p);break;case 40:e(t,v);break;case 27:y();break;case 14:case 13:case 32:e(t,b);break;case 9:!function(t){if("tablist"===a()){var e=c(r.getEl("body"))[0];e&&e.focus()}else h(t.shiftKey?-1:1)}(t),t.preventDefault()}}),n.on("focusin",function(t){o=t.target,r=t.control}),{focusFirst:function(t){var e=d(t),n=c(e.getEl());e.settings.ariaRemember&&"lastAriaIndex"in e?f(e.lastAriaIndex,n):f(0,n)}}}var Te,We,Pe,Ne,Oe={},De=fe.extend({init:function(t){var e=this;e._super(t),(t=e.settings).fixed&&e.state.set("fixed",!0),e._items=new Jt,e.isRtl()&&e.classes.add("rtl"),e.bodyClasses=new It(
function(){e.state.get("rendered")&&(e.getEl("body").className=this.toString())}),e.bodyClasses.prefix=e.classPrefix,e.classes.add("container"),e.bodyClasses.add("container-body"),t.containerCls&&e.classes.add(t.containerCls),e._layout=He.create((t.layout||"")+"layout"),e.settings.items?e.add(e.settings.items):e.add(e.render()),e._hasBody=!0},items:function(){return this._items},find:function(t){return(t=Oe[t]=Oe[t]||new $t(t)).find(this)},add:function(t){return this.items().add(this.create(t)).parent(this),this},focus:function(t){var e,n,i,r=this;if(!t||!(n=r.keyboardNav||r.parents().eq(-1)[0].keyboardNav))return i=r.find("*"),r.statusbar&&i.add(r.statusbar.items()),i.each(function(t){if(t.settings.autofocus)return e=null,!1;t.canFocus&&(e=e||t)}),e&&e.focus(),r;n.focusFirst(r)},replace:function(t,e){for(var n,i=this.items(),r=i.length;r--;)if(i[r]===t){i[r]=e;break}0<=r
&&((n=e.getEl())&&n.parentNode.removeChild(n),(n=t.getEl())&&n.parentNode.removeChild(n)),e.parent(this)},create:function(t){var e,n=this,i=[];return R.isArray(t)||(t=[t]),R.each(t,function(t){t&&(t instanceof fe||("string"==typeof t&&(t={type:t}),e=R.extend({},n.settings.defaults,t),t.type=e.type=e.type||t.type||n.settings.defaultType||(e.defaults?e.defaults.type:null),t=He.create(e)),i.push(t))}),i},renderNew:function(){var i=this;return i.items().each(function(t,e){var n;t.parent(i),t.state.get("rendered")||((n=i.getEl("body")).hasChildNodes()&&e<=n.childNodes.length-1?Nt(n.childNodes[e]).before(t.renderHtml()):Nt(n).append(t.renderHtml()),t.postRender(),ie.add(t))}),i._layout.applyClasses(i.items().filter(":visible")),i._lastRect=null,i},append:function(t){return this.add(t).renderNew()},prepend:function(t){return this.items().set(this.create(t).concat(this.items().toArray())),this.renderN
ew()},insert:function(t,e,n){var i,r,o;return t=this.create(t),i=this.items(),!n&&e<i.length-1&&(e+=1),0<=e&&e<i.length&&(r=i.slice(0,e).toArray(),o=i.slice(e).toArray(),i.set(r.concat(t,o))),this.renderNew()},fromJSON:function(t){for(var e in t)this.find("#"+e).value(t[e]);return this},toJSON:function(){var i={};return this.find("*").each(function(t){var e=t.name(),n=t.value();e&&void 0!==n&&(i[e]=n)}),i},renderHtml:function(){var t=this,e=t._layout,n=this.settings.role;return t.preRender(),e.preRender(t),'<div id="'+t._id+'" class="'+t.classes+'"'+(n?' role="'+this.settings.role+'"':"")+'><div id="'+t._id+'-body" class="'+t.bodyClasses+'">'+(t.settings.html||"")+e.renderHtml(t)+"</div></div>"},postRender:function(){var t,e=this;return e.items().exec("postRender"),e._super(),e._layout.postRende
r(e),e.state.set("rendered",!0),e.settings.style&&e.$el.css(e.settings.style),e.settings.border&&(t=e.borderBox,e.$el.css({"border-top-width":t.top,"border-right-width":t.right,"border-bottom-width":t.bottom,"border-left-width":t.left})),e.parent()||(e.keyboardNav=Me({root:e})),e},initLayoutRect:function(){var t=this._super();return this._layout.recalc(this),t},recalc:function(){var t=this,e=t._layoutRect,n=t._lastRect;if(!n||n.w!==e.w||n.h!==e.h)return t._layout.recalc(t),e=t.layoutRect(),t._lastRect={x:e.x,y:e.y,w:e.w,h:e.h},!0},reflow:function(){var t;if(ie.remove(this),this.visible()){for(fe.repaintControls=[],fe.repaintControls.map={},this.recalc(),t=fe.repaintControls.length;t--;)fe.repaintControls[t].repaint();"flow"!==this.settings.layout&&"stack"!==this.settings.layout&&this.repaint(),fe.repaintControls=[]}return this}}),Ae={init:function(){this.on("repaint",this.
renderScroll)},renderScroll:function(){var p=this,v=2;function n(){var m,g,t;function e(t,e,n,i,r,o){var s,a,l,u,c,d,f,h;if(a=p.getEl("scroll"+t)){if(f=e.toLowerCase(),h=n.toLowerCase(),Nt(p.getEl("absend")).css(f,p.layoutRect()[i]-1),!r)return void Nt(a).css("display","none");Nt(a).css("display","block"),s=p.getEl("body"),l=p.getEl("scroll"+t+"t"),u=s["client"+n]-2*v,c=(u-=m&&g?a["client"+o]:0)/s["scroll"+n],(d={})[f]=s["offset"+e]+v,d[h]=u,Nt(a).css(d),(d={})[f]=s["scroll"+e]*c,d[h]=u*c,Nt(l).css(d)}}t=p.getEl("body"),m=t.scrollWidth>t.clientWidth,g=t.scrollHeight>t.clientHeight,e("h","Left","Width","contentW",m,"Height"),e("v","Top","Height","contentH",g,"Width")}p.settings.autoScroll&&(p._hasScroll||(p._hasScrol
l=!0,function(){function t(s,a,l,u,c){var d,t=p._id+"-scroll"+s,e=p.classPrefix;Nt(p.getEl()).append('<div id="'+t+'" class="'+e+"scrollbar "+e+"scrollbar-"+s+'"><div id="'+t+'t" class="'+e+'scrollbar-thumb"></div></div>'),p.draghelper=new Ee(t+"t",{start:function(){d=p.getEl("body")["scroll"+a],Nt("#"+t).addClass(e+"active")},drag:function(t){var e,n,i,r,o=p.layoutRect();n=o.contentW>o.innerW,i=o.contentH>o.innerH,r=p.getEl("body")["client"+l]-2*v,e=(r-=n&&i?p.getEl("scroll"+s)["client"+c]:0)/p.getEl("body")["scroll"+l],p.getEl("body")["scroll"+a]=d+t["delta"+u]/e},stop:function(){Nt("#"+t).removeClass(e+"active")}})}p.classes.add("scroll"),t("v","Top","Height","Y",&quo
t;Width"),t("h","Left","Width","X","Height")}(),p.on("wheel",function(t){var e=p.getEl("body");e.scrollLeft+=10*(t.deltaX||0),e.scrollTop+=10*t.deltaY,n()}),Nt(p.getEl("body")).on("scroll",n)),n())}},Be=De.extend({Defaults:{layout:"fit",containerCls:"panel"},Mixins:[Ae],renderHtml:function(){var t=this,e=t._layout,n=t.settings.html;return t.preRender(),e.preRender(t),void 0===n?n='<div id="'+t._id+'-body" class="'+t.bodyClasses+'">'+e.renderHtml(t)+"</div>":("function"==typeof n&&(n=n.call(t)),t._hasBody=!1),'<div id="'+t._id+'" class="'+t.classes+'" hidefocus="1" tabindex="-1" role="group">'+(t._preBodyHtml||"")+n+"</div>"}}),Le={resizeToContent:function(){this._layoutRect.autoResize=!0,this._lastRect=null,this.reflow()},resizeTo
:function(t,e){if(t<=1||e<=1){var n=Pt.getWindowSize();t=t<=1?t*n.w:t,e=e<=1?e*n.h:e}return this._layoutRect.autoResize=!1,this.layoutRect({minW:t,minH:e,w:t,h:e}).reflow()},resizeBy:function(t,e){var n=this.layoutRect();return this.resizeTo(n.w+t,n.h+e)}},Ie=[],ze=[];function Fe(t,e){for(;t;){if(t===e)return!0;t=t.parent()}}function Ve(){Te||(Te=function(t){2!==t.button&&function(t){for(var e=Ie.length;e--;){var n=Ie[e],i=n.getParentCtrl(t.target);if(n.settings.autohide){if(i&&(Fe(i,n)||n.parent()===i))continue;(t=n.fire("autohide",{target:t.target})).isDefaultPrevented()||n.hide()}}}(t)},Nt(document).on("click touchstart",Te))}function qe(r){var t=Pt.getViewPort().y;function e(t,e){for(var n,i=0;i<Ie.length;i++)if(Ie[i]!==r)for(n=Ie[i].parent();n&&(n=n.parent());)n===r&&Ie[i].fixed(t).moveBy(0,e).repaint()}r.settings.autofix&&(r.state.get("fixed")?r._autoFixY>t&&(r.fixed(!1).layoutRect(
{y:r._autoFixY}).repaint(),e(!1,r._autoFixY-t)):(r._autoFixY=r.layoutRect().y,r._autoFixY<t&&(r.fixed(!0).layoutRect({y:0}).repaint(),e(!0,t-r._autoFixY))))}function Ue(t,e){var n,i,r=je.zIndex||65535;if(t)ze.push(e);else for(n=ze.length;n--;)ze[n]===e&&ze.splice(n,1);if(ze.length)for(n=0;n<ze.length;n++)ze[n].modal&&(r++,i=ze[n]),ze[n].getEl().style.zIndex=r,ze[n].zIndex=r,r++;var o=Nt("#"+e.classPrefix+"modal-block",e.getContainerElm())[0];i?Nt(o).css("z-index",i.zIndex-1):o&&(o.parentNode.removeChild(o),Ne=!1),je.currentZIndex=r}var je=Be.extend({Mixins:[ye,Le],init:function(t){var i=this;i._super(t),(i._eventsRoot=i).classes.add("floatpanel"),t.autohide&&(Ve(),function(){if(!Pe){var t=document.documentElement,e=t.clientWidth,n=t.clientHeight;Pe=function(){document.all&&e===t.clientWidth&&n===t.clientHeight||(e=t.clientWidth,n=t.clientHeight,je.hideAll())},Nt(window).on("res
ize",Pe)}}(),Ie.push(i)),t.autofix&&(We||(We=function(){var t;for(t=Ie.length;t--;)qe(Ie[t])},Nt(window).on("scroll",We)),i.on("move",function(){qe(this)})),i.on("postrender show",function(t){if(t.control===i){var e,n=i.classPrefix;i.modal&&!Ne&&((e=Nt("#"+n+"modal-block",i.getContainerElm()))[0]||(e=Nt('<div id="'+n+'modal-block" class="'+n+"reset "+n+'fade"></div>').appendTo(i.getContainerElm())),c.setTimeout(function(){e.addClass(n+"in"),Nt(i.getEl()).addClass(n+"in")}),Ne=!0),Ue(!0,i)}}),i.on("show",function(){i.parents().each(function(t){if(t.state.get("fixed"))return i.fixed(!0),!1})}),t.popover&&(i._preBodyHtml='<div class="'+i.classPrefix+'arrow"></div>',i.classes.add("popover").add("bottom").add(i.isRtl()?"end":"start")),i.aria("label",t
.ariaLabel),i.aria("labelledby",i._id),i.aria("describedby",i.describedBy||i._id+"-none")},fixed:function(t){var e=this;if(e.state.get("fixed")!==t){if(e.state.get("rendered")){var n=Pt.getViewPort();t?e.layoutRect().y-=n.y:e.layoutRect().y+=n.y}e.classes.toggle("fixed",t),e.state.set("fixed",t)}return e},show:function(){var t,e=this._super();for(t=Ie.length;t--&&Ie[t]!==this;);return-1===t&&Ie.push(this),e},hide:function(){return $e(this),Ue(!1,this),this._super()},hideAll:function(){je.hideAll()},close:function(){return this.fire("close").isDefaultPrevented()||(this.remove(),Ue(!1,this)),this},remove:function(){$e(this),this._super()},postRender:function(){return this.settings.bodyRole&&this.getEl("body").setAttribute("role",this.settings.bodyRole),this._super()}});function $e(t){var e;for(e=Ie.length;e--;)Ie[e]===t&&Ie.splice(e,1);for(e=ze.length;e--
;)ze[e]===t&&ze.splice(e,1)}je.hideAll=function(){for(var t=Ie.length;t--;){var e=Ie[t];e&&e.settings.autohide&&(e.hide(),Ie.splice(t,1))}};var Ye=[],Xe="";function Je(t){var e,n=Nt("meta[name=viewport]")[0];!1!==h.overrideViewPort&&(n||((n=document.createElement("meta")).setAttribute("name","viewport"),document.getElementsByTagName("head")[0].appendChild(n)),(e=n.getAttribute("content"))&&void 0!==Xe&&(Xe=e),n.setAttribute("content",t?"width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0":Xe))}function Ge(t,e){(function(){for(var t=0;t<Ye.length;t++)if(Ye[t]._fullscreen)return!0;return!1})()&&!1===e&&Nt([document.documentElement,document.body]).removeClass(t+"fullscreen")}var Ke=je.extend({modal:!0,Defaults:{border:1,layout:"flex",containerCls:"panel",role:"
dialog",callbacks:{submit:function(){this.fire("submit",{data:this.toJSON()})},close:function(){this.close()}}},init:function(t){var n=this;n._super(t),n.isRtl()&&n.classes.add("rtl"),n.classes.add("window"),n.bodyClasses.add("window-body"),n.state.set("fixed",!0),t.buttons&&(n.statusbar=new Be({layout:"flex",border:"1 0 0 0",spacing:3,padding:10,align:"center",pack:n.isRtl()?"start":"end",defaults:{type:"button"},items:t.buttons}),n.statusbar.classes.add("foot"),n.statusbar.parent(n)),n.on("click",function(t){var e=n.classPrefix+"close";(Pt.hasClass(t.target,e)||Pt.hasClass(t.target.parentNode,e))&&n.close()}),n.on("cancel",function(){n.close()}),n.on("move",function(t){t.control===n&&je.hideAll()}),n.aria("describedby",n.describedBy||n._id+"-none"),n.aria("label&
quot;,t.title),n._fullscreen=!1},recalc:function(){var t,e,n,i,r=this,o=r.statusbar;r._fullscreen&&(r.layoutRect(Pt.getWindowSize()),r.layoutRect().contentH=r.layoutRect().innerH),r._super(),t=r.layoutRect(),r.settings.title&&!r._fullscreen&&(e=t.headerW)>t.w&&(n=t.x-Math.max(0,e/2),r.layoutRect({w:e,x:n}),i=!0),o&&(o.layoutRect({w:r.layoutRect().innerW}).recalc(),(e=o.layoutRect().minW+t.deltaW)>t.w&&(n=t.x-Math.max(0,e-t.w),r.layoutRect({w:e,x:n}),i=!0)),i&&r.recalc()},initLayoutRect:function(){var t,e=this,n=e._super(),i=0;if(e.settings.title&&!e._fullscreen){t=e.getEl("head");var r=Pt.getSize(t);n.headerW=r.width,n.headerH=r.height,i+=n.headerH}e.statusbar&&(i+=e.statusbar.layoutRect().h),n.deltaH+=i,n.minH+=i,n.h+=i;var o=Pt.getWindowSize();return n.x=e.settings.x||Math.max(0,o.w/2-n.w/2),n.y=e.settings.y||Math.max(0,o.h/2-n.h/2),n},renderHtml:function(){var t=this,e=t._layout,n=t._id,i=t.cl
assPrefix,r=t.settings,o="",s="",a=r.html;return t.preRender(),e.preRender(t),r.title&&(o='<div id="'+n+'-head" class="'+i+'window-head"><div id="'+n+'-title" class="'+i+'title">'+t.encode(r.title)+'</div><div id="'+n+'-dragh" class="'+i+'dragh"></div><button type="button" class="'+i+'close" aria-hidden="true"><i class="mce-ico mce-i-remove"></i></button></div>'),r.url&&(a='<iframe src="'+r.url+'" tabindex="-1"></iframe>'),void 0===a&&(a=e.renderHtml(t)),t.statusbar&&(s=t.statusbar.renderHtml()),'<div id="'+n+'" class="'+t.classes+'" hidefocus="1"><div class="'+t.classPrefix+'reset" role="application">'+o+'<div id="'+n+'-body" class="'+t.bodyClasses+'">'+a+
"</div>"+s+"</div></div>"},fullscreen:function(t){var n,e,i=this,r=document.documentElement,o=i.classPrefix;if(t!==i._fullscreen)if(Nt(window).on("resize",function(){var t;if(i._fullscreen)if(n)i._timer||(i._timer=c.setTimeout(function(){var t=Pt.getWindowSize();i.moveTo(0,0).resizeTo(t.w,t.h),i._timer=0},50));else{t=(new Date).getTime();var e=Pt.getWindowSize();i.moveTo(0,0).resizeTo(e.w,e.h),50<(new Date).getTime()-t&&(n=!0)}}),e=i.layoutRect(),i._fullscreen=t){i._initial={x:e.x,y:e.y,w:e.w,h:e.h},i.borderBox=At("0"),i.getEl("head").style.display="none",e.deltaH-=e.headerH+2,Nt([r,document.body]).addClass(o+"fullscreen"),i.classes.add("fullscreen");var s=Pt.getWindowSize();i.moveTo(0,0).resizeTo(s.w,s.h)}else i.borderBox=At(i.settings.border),i.getEl("head").style.display="",e.deltaH+=e.headerH,Nt([r,document.body]).removeClass(o+"fullscreen"),
i.classes.remove("fullscreen"),i.moveTo(i._initial.x,i._initial.y).resizeTo(i._initial.w,i._initial.h);return i.reflow()},postRender:function(){var e,n=this;setTimeout(function(){n.classes.add("in"),n.fire("open")},0),n._super(),n.statusbar&&n.statusbar.postRender(),n.focus(),this.dragHelper=new Ee(n._id+"-dragh",{start:function(){e={x:n.layoutRect().x,y:n.layoutRect().y}},drag:function(t){n.moveTo(e.x+t.deltaX,e.y+t.deltaY)}}),n.on("submit",function(t){t.isDefaultPrevented()||n.close()}),Ye.push(n),Je(!0)},submit:function(){return this.fire("submit",{data:this.toJSON()})},remove:function(){var t,e=this;for(e.dragHelper.destroy(),e._super(),e.statusbar&&this.statusbar.remove(),Ge(e.classPrefix,!1),t=Ye.length;t--;)Ye[t]===e&&Ye.splice(t,1);Je(0<Ye.length)},getContentWindow:function(){var t=this.getEl().getElementsByTagName("iframe")[0];return t?t.contentWindow:null}});!function(){if(!h.d
esktop){var n={w:window.innerWidth,h:window.innerHeight};c.setInterval(function(){var t=window.innerWidth,e=window.innerHeight;n.w===t&&n.h===e||(n={w:t,h:e},Nt(window).trigger("resize"))},100)}Nt(window).on("resize",function(){var t,e,n=Pt.getWindowSize();for(t=0;t<Ye.length;t++)e=Ye[t].layoutRect(),Ye[t].moveTo(Ye[t].settings.x||Math.max(0,n.w/2-e.w/2),Ye[t].settings.y||Math.max(0,n.h/2-e.h/2))})}();var Ze=Ke.extend({init:function(t){t={border:1,padding:20,layout:"flex",pack:"center",align:"center",containerCls:"panel",autoScroll:!0,buttons:{type:"button",text:"Ok",action:"ok"},items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200}},this._super(t)},Statics:{OK:1,OK_CANCEL:2,YES_NO:3,YES_NO_CANCEL:4,msgBox:function(t){var e,i=t.callback||function(){};function n(t,e,n){return{type:"button",text:t,subtype:n?"primary":"",onClick:function(t)
{t.control.parents()[1].close(),i(e)}}}switch(t.buttons){case Ze.OK_CANCEL:e=[n("Ok",!0,!0),n("Cancel",!1)];break;case Ze.YES_NO:case Ze.YES_NO_CANCEL:e=[n("Yes",1,!0),n("No",0)],t.buttons===Ze.YES_NO_CANCEL&&e.push(n("Cancel",-1));break;default:e=[n("Ok",!0,!0)]}return new Ke({padding:20,x:t.x,y:t.y,minWidth:300,minHeight:100,layout:"flex",pack:"center",align:"center",buttons:e,title:t.title,role:"alertdialog",items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200,text:t.text},onPostRender:function(){this.aria("describedby",this.items()[0]._id)},onClose:t.onClose,onCancel:function(){i(!1)}}).renderTo(document.body).reflow()},alert:function(t,e){return"string"==typeof t&&(t={text:t}),t.callback=e,Ze.msgBox(t)},confirm:function(t,e){return"string"==typeof t&&(t={text:t}),t.callback=e,t.buttons=Ze.OK_CANCEL,Ze.msgBox(t
)}}}),Qe=function(t,e){return{renderUI:function(){return st(t,e)},getNotificationManagerImpl:function(){return Ce(t)},getWindowManagerImpl:function(){return{open:function(n,t,e){var i;return n.title=n.title||" ",n.url=n.url||n.file,n.url&&(n.width=parseInt(n.width||320,10),n.height=parseInt(n.height||240,10)),n.body&&(n.items={defaults:n.defaults,type:n.bodyType||"form",items:n.body,data:n.data,callbacks:n.commands}),n.url||n.buttons||(n.buttons=[{text:"Ok",subtype:"primary",onclick:function(){i.find("form")[0].submit()}},{text:"Cancel",onclick:function(){i.close()}}]),(i=new Ke(n)).on("close",function(){e(i)}),n.data&&i.on("postRender",function(){this.find("*").each(function(t){var e=t.name();e in n.data&&t.value(n.data[e])})}),i.features=n||{},i.params=t||{},i=i.renderTo(document.body).reflow()},alert:function(t,e,n){var i;return(i=Ze.alert(t,function(){e()})).
on("close",function(){n(i)}),i},confirm:function(t,e,n){var i;return(i=Ze.confirm(t,function(t){e(t)})).on("close",function(){n(i)}),i},close:function(t){t.close()},getParams:function(t){return t.params},setParams:function(t,e){t.params=e}}}}},tn="undefined"!=typeof window?window:Function("return this;")(),en=function(t,e){for(var n=e!==undefined&&null!==e?e:tn,i=0;i<t.length&&n!==undefined&&null!==n;++i)n=n[t[i]];return n},nn=function(t,e){var n=t.split(".");return en(n,e)},rn={getOrDie:function(t,e){var n=nn(t,e);if(n===undefined||null===n)throw t+" not available on this browser";return n}};function on(){return new(rn.getOrDie("FileReader"))}var sn,an=tinymce.util.Tools.resolve("tinymce.util.Promise"),ln=function(n){return new an(function(t){var e=new on;e.onloadend=function(){t(e.result.split(",")[1])},e.readAsDataURL(n)})},un=function(){return new an(function(e){v
ar t;(t=document.createElement("input")).type="file",t.style.position="fixed",t.style.left=0,t.style.top=0,t.style.opacity=.001,document.body.appendChild(t),t.onchange=function(t){e(Array.prototype.slice.call(t.target.files))},t.click(),t.parentNode.removeChild(t)})},cn=0,dn=function(t){return t+cn+++(e=function(){return Math.round(4294967295*Math.random()).toString(36)},"s"+Date.now().toString(36)+e()+e()+e());var e},fn=function(r,o){var s={};function t(t){var e,n,i;n=o[t?"startContainer":"endContainer"],i=o[t?"startOffset":"endOffset"],1===n.nodeType&&(e=r.create("span",{"data-mce-type":"bookmark"}),n.hasChildNodes()?(i=Math.min(i,n.childNodes.length-1),t?n.insertBefore(e,n.childNodes[i]):r.insertAfter(e,n.childNodes[i])):n.appendChild(e),n=e,i=0),s[t?"startContainer":"endContainer"]=n,s[t?"startOffset":"endOffset"]=i}return
t(!0),o.collapsed||t(),s},hn=function(r,o){function t(t){var e,n,i;e=i=o[t?"startContainer":"endContainer"],n=o[t?"startOffset":"endOffset"],e&&(1===e.nodeType&&(n=function(t){for(var e=t.parentNode.firstChild,n=0;e;){if(e===t)return n;1===e.nodeType&&"bookmark"===e.getAttribute("data-mce-type")||n++,e=e.nextSibling}return-1}(e),e=e.parentNode,r.remove(i)),o[t?"startContainer":"endContainer"]=e,o[t?"startOffset":"endOffset"]=n)}t(!0),t();var e=r.createRng();return e.setStart(o.startContainer,o.startOffset),o.endContainer&&e.setEnd(o.endContainer,o.endOffset),e},mn=tinymce.util.Tools.resolve("tinymce.dom.TreeWalker"),gn=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),pn=function(t){return"A"===t.nodeName&&t.hasAttribute("href")},vn=function(t){var e,n,i,r,o,s,a,l;return r=t.selection,o=t.dom,s=r.getRng
(),a=o,l=gn.getNode(s.startContainer,s.startOffset),e=a.getParent(l,pn)||l,n=gn.getNode(s.endContainer,s.endOffset),i=t.getBody(),R.grep(function(t,e,n){var i,r,o=[];for(i=new mn(e,t),r=e;r&&(1===r.nodeType&&o.push(r),r!==n);r=i.next());return o}(i,e,n),pn)},yn=function(t){var e,n,i,r,o;n=vn(e=t),r=e.dom,o=e.selection,i=fn(r,o.getRng()),R.each(n,function(t){e.dom.remove(t,!0)}),o.setRng(hn(r,i))},bn=function(t){t.selection.collapse(!1)},xn=function(t){t.focus(),yn(t),bn(t)},wn=function(t,e){var n,i,r,o,s,a=t.dom.getParent(t.selection.getStart(),"a[href]");a?(o=a,s=e,(r=t).focus(),r.dom.setAttrib(o,"href",s),bn(r)):(i=e,(n=t).execCommand("mceInsertLink",!1,{href:i}),bn(n))},_n=function(t,e,n){var i,r,o;t.plugins.table?t.plugins.table.insertTable(e,n):(r=e,o=n,(i=t).undoManager.transact(function(){var t,e;i.insertContent(function(t,e){var n,i,r;for(r='<table data-mce-id="mce" style="width: 100%">',r+="<tbo
dy>",i=0;i<e;i++){for(r+="<tr>",n=0;n<t;n++)r+="<td><br></td>";r+="</tr>"}return r+="</tbody>",r+="</table>"}(r,o)),(t=i.dom.select("*[data-mce-id]")[0]).removeAttribute("data-mce-id"),e=i.dom.select("td,th",t),i.selection.setCursorLocation(e[0],0)}))},Rn=function(t,e){t.execCommand("FormatBlock",!1,e)},Cn=function(t,e,n){var i,r;r=(i=t.editorUpload.blobCache).create(dn("mceu"),n,e),i.add(r),t.insertContent(t.dom.createHTML("img",{src:r.blobUri()}))},kn=function(t,e){0===e.trim().length?xn(t):wn(t,e)},En=xn,Hn=function(n,t){n.addButton("quicklink",{icon:"link",tooltip:"Insert/Edit link",stateSelector:"a[href]",onclick:function(){t.showForm(n,"quicklink")}}),n.addButton("quickimage",{icon:"image",tooltip:"Insert image",onclick:function(){un()
.then(function(t){var e=t[0];ln(e).then(function(t){Cn(n,t,e)})})}}),n.addButton("quicktable",{icon:"table",tooltip:"Insert table",onclick:function(){t.hide(),_n(n,2,2)}}),function(e){for(var t=function(t){return function(){Rn(e,t)}},n=1;n<6;n++){var i="h"+n;e.addButton(i,{text:i.toUpperCase(),tooltip:"Heading "+n,stateSelector:i,onclick:t(i),onPostRender:function(){this.getEl().firstChild.firstChild.style.fontWeight="bold"}})}}(n)},Sn=function(){var t=h.container;if(t&&"static"!==v.DOM.getStyle(t,"position",!0)){var e=v.DOM.getPos(t),n=e.x-t.scrollLeft,i=e.y-t.scrollTop;return mt.some({x:n,y:i})}return mt.none()},Mn=function(t){return/^www\.|\.(com|org|edu|gov|uk|net|ca|de|jp|fr|au|us|ru|ch|it|nl|se|no|es|mil)$/i.test(t.trim())},Tn=function(t){return/^https?:\/\//.test(t.trim())},Wn=function(t,e){return!Tn(e)&&Mn(e)?(n=t,i=e,new an(function(e){n.windowManager.confirm("The URL you
entered seems to be an external link. Do you want to add the required http:// prefix?",function(t){e(!0===t?"http://"+i:i)})})):an.resolve(e);var n,i},Pn=function(r,e){var t,n,i,o={};return t="quicklink",n={items:[{type:"button",name:"unlink",icon:"unlink",onclick:function(){r.focus(),En(r),e()},tooltip:"Remove link"},{type:"filepicker",name:"linkurl",placeholder:"Paste or type a link",filetype:"file",onchange:function(t){var e=t.meta;e&&e.attach&&(o={href:this.value(),attach:e.attach})}},{type:"button",icon:"checkmark",subtype:"primary",tooltip:"Ok",onclick:"submit"}],onshow:function(t){if(t.control===this){var e,n="";(e=r.dom.getParent(r.selection.getStart(),"a[href]"))&&(n=r.dom.getAttrib(e,"href")),this.fromJSON({linkurl:n}),i=this.find("#unlink"),e?i.show():i.hi
de(),this.find("#linkurl")[0].focus()}var i},onsubmit:function(t){Wn(r,t.data.linkurl).then(function(t){r.undoManager.transact(function(){t===o.href&&(o.attach(),o={}),kn(r,t)}),e()})}},(i=He.create(R.extend({type:"form",layout:"flex",direction:"row",padding:5,name:t,spacing:3},n))).on("show",function(){i.find("textbox").eq(0).each(function(t){t.focus()})}),i},Nn=function(n,t,e){var o,i,s=[];if(e)return R.each(B(i=e)?i:N(i)?i.split(/[ ,]/):[],function(t){if("|"===t)o=null;else if(n.buttons[t]){o||(o={type:"buttongroup",items:[]},s.push(o));var e=n.buttons[t];A(e)&&(e=e()),e.type=e.type||"button",(e=He.create(e)).on("postRender",(i=n,r=e,function(){var e,t,n=(t=function(t,e){return{selector:t,handler:e}},(e=r).settings.stateSelector?t(e.settings.stateSelector,function(t){e.active(t)}):e.settings.disabledStateSelector?t(e.settings.disabledStateSelector,function(t){e.disa
bled(t)}):null);null!==n&&i.selection.selectorChanged(n.selector,n.handler)})),o.items.push(e)}var i,r}),He.create({type:"toolbar",layout:"flow",name:t,items:s})},On=function(){var l,c,o=function(t){return 0<t.items().length},u=function(t,e){var n,i,r=(n=t,i=e,R.map(i,function(t){return Nn(n,t.id,t.items)})).concat([Nn(t,"text",J(t)),Nn(t,"insert",G(t)),Pn(t,p)]);return He.create({type:"floatpanel",role:"dialog",classes:"tinymce tinymce-inline arrow",ariaLabel:"Inline toolbar",layout:"flex",direction:"column",align:"stretch",autohide:!1,autofix:!0,fixed:!0,border:1,items:R.grep(r,o),oncancel:function(){t.focus()}})},d=function(t){t&&t.show()},f=function(t,e){t.moveTo(e.x,e.y)},h=function(n,i){i=i?i.substr(0,2):"",R.each({t:"down",b:"up",c:"center"},function(t,e){n.classes.toggle("arrow-"+t,e===i.substr(0,1)
)}),"cr"===i?(n.classes.toggle("arrow-left",!0),n.classes.toggle("arrow-right",!1)):"cl"===i?(n.classes.toggle("arrow-left",!0),n.classes.toggle("arrow-right",!0)):R.each({l:"left",r:"right"},function(t,e){n.classes.toggle("arrow-"+t,e===i.substr(1,1))})},m=function(t,e){var n=t.items().filter("#"+e);return 0<n.length&&(n[0].show(),t.reflow(),!0)},g=function(t,e,n,i){var r,o,s,a;if(a=K(n),r=b(n),o=v.DOM.getRect(t.getEl()),s="insert"===e?j(i,r,o):$(i,r,o)){var l=Sn().getOr({x:0,y:0}),u={x:s.rect.x-l.x,y:s.rect.y-l.y,w:s.rect.w,h:s.rect.h};return f(t,Y(a,c=i,r,u)),h(t,s.position),!0}return!1},p=function(){l&&l.hide()};return{show:function(t,e,n,i){var r,o,s,a;l||(M(t),(l=u(t,i)).renderTo().reflow().moveTo(n.x,n.y),t.nodeChanged()),o=e,s=t,a=n,d(r=l),r.items().hide(),m(r,o)?!1===g(r,o,s,a)&&p():p()},showForm:function(t,e){if(l){if(l.items().hide(),!m(
l,e))return void p();var n,i,r,o=void 0;d(l),l.items().hide(),m(l,e),r=K(t),n=b(t),o=v.DOM.getRect(l.getEl()),(i=$(c,n,o))&&(o=i.rect,f(l,Y(r,c,n,o)),h(l,i.position))}},reposition:function(t,e,n){l&&g(l,e,t,n)},inForm:function(){return l&&l.visible()&&0<l.items().filter("form:visible").length},hide:p,focus:function(){l&&l.find("toolbar:visible").eq(0).each(function(t){t.focus(!0)})},remove:function(){l&&(l.remove(),l=null)}}},Dn=Ot.extend({Defaults:{firstControlClass:"first",lastControlClass:"last"},init:function(t){this.settings=R.extend({},this.Defaults,t)},preRender:function(t){t.bodyClasses.add(this.settings.containerClass)},applyClasses:function(t){var e,n,i,r,o=this.settings;e=o.firstControlClass,n=o.lastControlClass,t.each(function(t){t.classes.remove(e).remove(n).add(o.controlClass),t.visible()&&(i||(i=t),r=t)}),i&&i.classes.add(e),r&&r.classes.add(n)},renderHtm
l:function(t){var e="";return this.applyClasses(t.items()),t.items().each(function(t){e+=t.renderHtml()}),e},recalc:function(){},postRender:function(){},isNative:function(){return!1}}),An=Dn.extend({Defaults:{containerClass:"abs-layout",controlClass:"abs-layout-item"},recalc:function(t){t.items().filter(":visible").each(function(t){var e=t.settings;t.layoutRect({x:e.x,y:e.y,w:e.w,h:e.h}),t.recalc&&t.recalc()})},renderHtml:function(t){return'<div id="'+t._id+'-absend" class="'+t.classPrefix+'abs-end"></div>'+this._super(t)}}),Bn=xe.extend({Defaults:{classes:"widget btn",role:"button"},init:function(t){var e,n=this;n._super(t),t=n.settings,e=n.settings.size,n.on("click mousedown",function(t){t.preventDefault()}),n.on("touchstart",function(t){n.fire("click",t),t.preventDefault()}),t.subtype&&n.classes.add(t.subtype),e&&n.classes.add("btn
-"+e),t.icon&&n.icon(t.icon)},icon:function(t){return arguments.length?(this.state.set("icon",t),this):this.state.get("icon")},repaint:function(){var t,e=this.getEl().firstChild;e&&((t=e.style).width=t.height="100%"),this._super()},renderHtml:function(){var t,e,n=this,i=n._id,r=n.classPrefix,o=n.state.get("icon"),s=n.state.get("text"),a="",l=n.settings;return(t=l.image)?(o="none","string"!=typeof t&&(t=window.getSelection?t[0]:t[1]),t=" style=\"background-image: url('"+t+"')\""):t="",s&&(n.classes.add("btn-has-text"),a='<span class="'+r+'txt">'+n.encode(s)+"</span>"),o=o?r+"ico "+r+"i-"+o:"",e="boolean"==typeof l.active?' aria-pressed="'+l.active+'"':"",'<div id="'+i+'" class="'+n.classes+'" tabindex="
;-1"'+e+'><button id="'+i+'-button" role="presentation" type="button" tabindex="-1">'+(o?'<i class="'+o+'"'+t+"></i>":"")+a+"</button></div>"},bindStates:function(){var o=this,n=o.$,i=o.classPrefix+"txt";function s(t){var e=n("span."+i,o.getEl());t?(e[0]||(n("button:first",o.getEl()).append('<span class="'+i+'"></span>'),e=n("span."+i,o.getEl())),e.html(o.encode(t))):e.remove(),o.classes.toggle("btn-has-text",!!t)}return o.state.on("change:text",function(t){s(t.value)}),o.state.on("change:icon",function(t){var e=t.value,n=o.classPrefix;e=(o.settings.icon=e)?n+"ico "+n+"i-"+o.settings.icon:"";var i=o.getEl().firstChild,r=i.getElementsByTagName("i")[0];e?(r&&r===i.firstChild||(r=document.createElement("i"),i.insertBefore(
r,i.firstChild)),r.className=e):r&&i.removeChild(r),s(o.state.get("text"))}),o._super()}}),Ln=Bn.extend({init:function(t){t=R.extend({text:"Browse...",multiple:!1,accept:null},t),this._super(t),this.classes.add("browsebutton"),t.multiple&&this.classes.add("multiple")},postRender:function(){var n=this,e=Pt.create("input",{type:"file",id:n._id+"-browse",accept:n.settings.accept});n._super(),Nt(e).on("change",function(t){var e=t.target.files;n.value=function(){return e.length?n.settings.multiple?e:e[0]:null},t.preventDefault(),e.length&&n.fire("change",t)}),Nt(e).on("click",function(t){t.stopPropagation()}),Nt(n.getEl("button")).on("click",function(t){t.stopPropagation(),e.click()}),n.getEl().appendChild(e)},remove:function(){Nt(this.getEl("button")).off(),Nt(this.getEl("input")).off(),this._super()}}),In=De.extend({Defaults
:{defaultType:"button",role:"group"},renderHtml:function(){var t=this,e=t._layout;return t.classes.add("btn-group"),t.preRender(),e.preRender(t),'<div id="'+t._id+'" class="'+t.classes+'"><div id="'+t._id+'-body">'+(t.settings.html||"")+e.renderHtml(t)+"</div></div>"}}),zn=xe.extend({Defaults:{classes:"checkbox",role:"checkbox",checked:!1},init:function(t){var e=this;e._super(t),e.on("click mousedown",function(t){t.preventDefault()}),e.on("click",function(t){t.preventDefault(),e.disabled()||e.checked(!e.checked())}),e.checked(e.settings.checked)},checked:function(t){return arguments.length?(this.state.set("checked",t),this):this.state.get("checked")},value:function(t){return arguments.length?this.checked(t):this.checked()},renderHtml:function(){var t=this,e=t._id,n=t.classPrefix;return'<div id="'+e+'" class=&
quot;'+t.classes+'" unselectable="on" aria-labelledby="'+e+'-al" tabindex="-1"><i class="'+n+"ico "+n+'i-checkbox"></i><span id="'+e+'-al" class="'+n+'label">'+t.encode(t.state.get("text"))+"</span></div>"},bindStates:function(){var o=this;function e(t){o.classes.toggle("checked",t),o.aria("checked",t)}return o.state.on("change:text",function(t){o.getEl("al").firstChild.data=o.translate(t.value)}),o.state.on("change:checked change:value",function(t){o.fire("change"),e(t.value)}),o.state.on("change:icon",function(t){var e=t.value,n=o.classPrefix;if(void 0===e)return o.settings.icon;e=(o.settings.icon=e)?n+"ico "+n+"i-"+o.settings.icon:"";var i=o.getEl().firstChild,r=i.getElementsByTagName("i")[0];e?(r&&r===i.firstChild||(r=document.createElem
ent("i"),i.insertBefore(r,i.firstChild)),r.className=e):r&&i.removeChild(r)}),o.state.get("checked")&&e(!0),o._super()}}),Fn=tinymce.util.Tools.resolve("tinymce.util.VK"),Vn=xe.extend({init:function(i){var r=this;r._super(i),i=r.settings,r.classes.add("combobox"),r.subinput=!0,r.ariaTarget="inp",i.menu=i.menu||i.values,i.menu&&(i.icon="caret"),r.on("click",function(t){var e=t.target,n=r.getEl();if(Nt.contains(n,e)||e===n)for(;e&&e!==n;)e.id&&-1!==e.id.indexOf("-open")&&(r.fire("action"),i.menu&&(r.showMenu(),t.aria&&r.menu.items()[0].focus())),e=e.parentNode}),r.on("keydown",function(t){var e;13===t.keyCode&&"INPUT"===t.target.nodeName&&(t.preventDefault(),r.parents().reverse().each(function(t){if(t.toJSON)return e=t,!1}),r.fire("submit",{data:e.toJSON()}))}),r.on("keyup",func
tion(t){if("INPUT"===t.target.nodeName){var e=r.state.get("value"),n=t.target.value;n!==e&&(r.state.set("value",n),r.fire("autocomplete",t))}}),r.on("mouseover",function(t){var e=r.tooltip().moveTo(-65535);if(r.statusLevel()&&-1!==t.target.className.indexOf(r.classPrefix+"status")){var n=r.statusMessage()||"Ok",i=e.text(n).show().testMoveRel(t.target,["bc-tc","bc-tl","bc-tr"]);e.classes.toggle("tooltip-n","bc-tc"===i),e.classes.toggle("tooltip-nw","bc-tl"===i),e.classes.toggle("tooltip-ne","bc-tr"===i),e.moveRel(t.target,i)}})},statusLevel:function(t){return 0<arguments.length&&this.state.set("statusLevel",t),this.state.get("statusLevel")},statusMessage:function(t){return 0<arguments.length&&this.state.set("statusMessage",t),this.state.get("statusMessage
")},showMenu:function(){var t,e=this,n=e.settings;e.menu||((t=n.menu||[]).length?t={type:"menu",items:t}:t.type=t.type||"menu",e.menu=He.create(t).parent(e).renderTo(e.getContainerElm()),e.fire("createmenu"),e.menu.reflow(),e.menu.on("cancel",function(t){t.control===e.menu&&e.focus()}),e.menu.on("show hide",function(t){t.control.items().each(function(t){t.active(t.value()===e.value())})}).fire("show"),e.menu.on("select",function(t){e.value(t.control.value())}),e.on("focusin",function(t){"INPUT"===t.target.tagName.toUpperCase()&&e.menu.hide()}),e.aria("expanded",!0)),e.menu.show(),e.menu.layoutRect({w:e.layoutRect().w}),e.menu.moveRel(e.getEl(),e.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},focus:function(){this.getEl("inp").focus()},repaint:function(){var t,e,n=this,i=n.getEl(),r=n.getEl("open"),o=n.layo
utRect(),s=0,a=i.firstChild;n.statusLevel()&&"none"!==n.statusLevel()&&(s=parseInt(Pt.getRuntimeStyle(a,"padding-right"),10)-parseInt(Pt.getRuntimeStyle(a,"padding-left"),10)),t=r?o.w-Pt.getSize(r).width-10:o.w-10;var l=document;return l.all&&(!l.documentMode||l.documentMode<=8)&&(e=n.layoutRect().h-2+"px"),Nt(a).css({width:t-s,lineHeight:e}),n._super(),n},postRender:function(){var e=this;return Nt(this.getEl("inp")).on("change",function(t){e.state.set("value",t.target.value),e.fire("change",t)}),e._super()},renderHtml:function(){var t,e,n,i=this,r=i._id,o=i.settings,s=i.classPrefix,a=i.state.get("value")||"",l="",u="";return"spellcheck"in o&&(u+=' spellcheck="'+o.spellcheck+'"'),o.maxLength&&(u+=' maxlength="'+o.maxLength+'"'),o.size&&(u+=' size="'+o.size+'"'),o.subt
ype&&(u+=' type="'+o.subtype+'"'),n='<i id="'+r+'-status" class="mce-status mce-ico" style="display: none"></i>',i.disabled()&&(u+=' disabled="disabled"'),(t=o.icon)&&"caret"!==t&&(t=s+"ico "+s+"i-"+o.icon),e=i.state.get("text"),(t||e)&&(l='<div id="'+r+'-open" class="'+s+"btn "+s+'open" tabIndex="-1" role="button"><button id="'+r+'-action" type="button" hidefocus="1" tabindex="-1">'+("caret"!==t?'<i class="'+t+'"></i>':'<i class="'+s+'caret"></i>')+(e?(t?" ":"")+e:"")+"</button></div>",i.classes.add("has-open")),'<div id="'+r+'" class="'+i.classes+'"><input id="'+r+'-inp" class="'+s+'t
extbox" value="'+i.encode(a,!1)+'" hidefocus="1"'+u+' placeholder="'+i.encode(o.placeholder)+'" />'+n+l+"</div>"},value:function(t){return arguments.length?(this.state.set("value",t),this):(this.state.get("rendered")&&this.state.set("value",this.getEl("inp").value),this.state.get("value"))},showAutoComplete:function(t,i){var r=this;if(0!==t.length){r.menu?r.menu.items().remove():r.menu=He.create({type:"menu",classes:"combobox-menu",layout:"flow"}).parent(r).renderTo(),R.each(t,function(t){var e,n;r.menu.add({text:t.title,url:t.previewUrl,match:i,classes:"menu-item-ellipsis",onclick:(e=t.value,n=t.title,function(){r.fire("selectitem",{title:n,value:e})})})}),r.menu.renderNew(),r.hideMenu(),r.menu.on("cancel",function(t){t.control.parent()===r.menu&&(t.stopPropagation(),r.focus(),r.hideMenu())}),r.menu.on(&q
uot;select",function(){r.focus()});var e=r.layoutRect().w;r.menu.layoutRect({w:e,minW:0,maxW:e}),r.menu.repaint(),r.menu.reflow(),r.menu.show(),r.menu.moveRel(r.getEl(),r.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])}else r.hideMenu()},hideMenu:function(){this.menu&&this.menu.hide()},bindStates:function(){var r=this;r.state.on("change:value",function(t){r.getEl("inp").value!==t.value&&(r.getEl("inp").value=t.value)}),r.state.on("change:disabled",function(t){r.getEl("inp").disabled=t.value}),r.state.on("change:statusLevel",function(t){var e=r.getEl("status"),n=r.classPrefix,i=t.value;Pt.css(e,"display","none"===i?"none":""),Pt.toggleClass(e,n+"i-checkmark","ok"===i),Pt.toggleClass(e,n+"i-warning","warn"===i),Pt.toggleClass(e,n+"i-error","error"===i),r.classe
s.toggle("has-status","none"!==i),r.repaint()}),Pt.on(r.getEl("status"),"mouseleave",function(){r.tooltip().hide()}),r.on("cancel",function(t){r.menu&&r.menu.visible()&&(t.stopPropagation(),r.hideMenu())});var n=function(t,e){e&&0<e.items().length&&e.items().eq(t)[0].focus()};return r.on("keydown",function(t){var e=t.keyCode;"INPUT"===t.target.nodeName&&(e===Fn.DOWN?(t.preventDefault(),r.fire("autocomplete"),n(0,r.menu)):e===Fn.UP&&(t.preventDefault(),n(-1,r.menu)))}),r._super()},remove:function(){Nt(this.getEl("inp")).off(),this.menu&&this.menu.remove(),this._super()}}),qn=Vn.extend({init:function(t){var e=this;t.spellcheck=!1,t.onaction&&(t.icon="none"),e._super(t),e.classes.add("colorbox"),e.on("change keyup postrender",function(){e.repaintColor(e.value())})},repaintColor:function(t){var e=this.g
etEl("open"),n=e?e.getElementsByTagName("i")[0]:null;if(n)try{n.style.background=t}catch(i){}},bindStates:function(){var e=this;return e.state.on("change:value",function(t){e.state.get("rendered")&&e.repaintColor(t.value)}),e._super()}}),Un=Bn.extend({showPanel:function(){var e=this,t=e.settings;if(e.classes.add("opened"),e.panel)e.panel.show();else{var n=t.panel;n.type&&(n={layout:"grid",items:n}),n.role=n.role||"dialog",n.popover=!0,n.autohide=!0,n.ariaRoot=!0,e.panel=new je(n).on("hide",function(){e.classes.remove("opened")}).on("cancel",function(t){t.stopPropagation(),e.focus(),e.hidePanel()}).parent(e).renderTo(e.getContainerElm()),e.panel.fire("show"),e.panel.reflow()}var i=e.panel.testMoveRel(e.getEl(),t.popoverAlign||(e.isRtl()?["bc-tc","bc-tl","bc-tr"]:["bc-tc","bc-tr","bc-tl","tc-bc&qu
ot;,"tc-br","tc-bl"]));e.panel.classes.toggle("start","l"===i.substr(-1)),e.panel.classes.toggle("end","r"===i.substr(-1));var r="t"===i.substr(0,1);e.panel.classes.toggle("bottom",!r),e.panel.classes.toggle("top",r),e.panel.moveRel(e.getEl(),i)},hidePanel:function(){this.panel&&this.panel.hide()},postRender:function(){var e=this;return e.aria("haspopup",!0),e.on("click",function(t){t.control===e&&(e.panel&&e.panel.visible()?e.hidePanel():(e.showPanel(),e.panel.focus(!!t.aria)))}),e._super()},remove:function(){return this.panel&&(this.panel.remove(),this.panel=null),this._super()}}),jn=v.DOM,$n=Un.extend({init:function(t){this._super(t),this.classes.add("splitbtn"),this.classes.add("colorbutton")},color:function(t){return t?(this._color=t,this.getEl("preview").style.backgroundColor=t,this):this._color},resetColor:
function(){return this._color=null,this.getEl("preview").style.backgroundColor=null,this},renderHtml:function(){var t=this,e=t._id,n=t.classPrefix,i=t.state.get("text"),r=t.settings.icon?n+"ico "+n+"i-"+t.settings.icon:"",o=t.settings.image?" style=\"background-image: url('"+t.settings.image+"')\"":"",s="";return i&&(t.classes.add("btn-has-text"),s='<span class="'+n+'txt">'+t.encode(i)+"</span>"),'<div id="'+e+'" class="'+t.classes+'" role="button" tabindex="-1" aria-haspopup="true"><button role="presentation" hidefocus="1" type="button" tabindex="-1">'+(r?'<i class="'+r+'"'+o+"></i>":"")+'<span id="'+e+'-preview" class="'+n+'preview"></span>'+s+'</button>&
lt;button type="button" class="'+n+'open" hidefocus="1" tabindex="-1"> <i class="'+n+'caret"></i></button></div>'},postRender:function(){var e=this,n=e.settings.onclick;return e.on("click",function(t){t.aria&&"down"===t.aria.key||t.control!==e||jn.getParent(t.target,"."+e.classPrefix+"open")||(t.stopImmediatePropagation(),n.call(e,t))}),delete e.settings.onclick,e._super()}}),Yn=tinymce.util.Tools.resolve("tinymce.util.Color"),Xn=xe.extend({Defaults:{classes:"widget colorpicker"},init:function(t){this._super(t)},postRender:function(){var n,i,r,o,s,a=this,l=a.color();function u(t,e){var n,i,r=Pt.getPos(t);return n=e.pageX-r.x,i=e.pageY-r.y,{x:n=Math.max(0,Math.min(n/t.clientWidth,1)),y:i=Math.max(0,Math.min(i/t.clientHeight,1))}}function c(t,e){var n=(360-t.h)/360;Pt.css(r,{top:100*n+"%"}),e||Pt.css(s,{left:t.s+"%",top:10
0-t.v+"%"}),o.style.background=Yn({s:100,v:100,h:t.h}).toHex(),a.color().parse({s:t.s,v:t.v,h:t.h})}function t(t){var e;e=u(o,t),n.s=100*e.x,n.v=100*(1-e.y),c(n),a.fire("change")}function e(t){var e;e=u(i,t),(n=l.toHsv()).h=360*(1-e.y),c(n,!0),a.fire("change")}i=a.getEl("h"),r=a.getEl("hp"),o=a.getEl("sv"),s=a.getEl("svp"),a._repaint=function(){c(n=l.toHsv())},a._super(),a._svdraghelper=new Ee(a._id+"-sv",{start:t,drag:t}),a._hdraghelper=new Ee(a._id+"-h",{start:e,drag:e}),a._repaint()},rgb:function(){return this.color().toRgb()},value:function(t){if(!arguments.length)return this.color().toHex();this.color().parse(t),this._rendered&&this._repaint()},color:function(){return this._color||(this._color=Yn()),this._color},renderHtml:function(){var t,e=this._id,o=this.classPrefix,s="#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000&qu
ot;;return t='<div id="'+e+'-h" class="'+o+'colorpicker-h" style="background: -ms-linear-gradient(top,'+s+");background: linear-gradient(to bottom,"+s+');">'+function(){var t,e,n,i,r="";for(n="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=",t=0,e=(i=s.split(",")).length-1;t<e;t++)r+='<div class="'+o+'colorpicker-h-chunk" style="height:'+100/e+"%;"+n+i[t]+",endColorstr="+i[t+1]+");-ms-"+n+i[t]+",endColorstr="+i[t+1]+')"></div>';return r}()+'<div id="'+e+'-hp" class="'+o+'colorpicker-h-marker"></div></div>','<div id="'+e+'" class="'+this.classes+'"><div id="'+e+'-sv" class="'+o+'colorpicker-sv"><div class="'+o+'colorpicker-overlay1"><div class="'+o+'colorpicker-overlay2"><div id=&q
uot;'+e+'-svp" class="'+o+'colorpicker-selector1"><div class="'+o+'colorpicker-selector2"></div></div></div></div></div>'+t+"</div>"}}),Jn=xe.extend({init:function(t){t=R.extend({height:100,text:"Drop an image here",multiple:!1,accept:null},t),this._super(t),this.classes.add("dropzone"),t.multiple&&this.classes.add("multiple")},renderHtml:function(){var t,e,n=this.settings;return t={id:this._id,hidefocus:"1"},e=Pt.create("div",t,"<span>"+this.translate(n.text)+"</span>"),n.height&&Pt.css(e,"height",n.height+"px"),n.width&&Pt.css(e,"width",n.width+"px"),e.className=this.classes,e.outerHTML},postRender:function(){var i=this,t=function(t){t.preventDefault(),i.classes.toggle("dragenter"),i.getEl().className=i.classes};i._super(),i.$el.on("dragover&qu
ot;,function(t){t.preventDefault()}),i.$el.on("dragenter",t),i.$el.on("dragleave",t),i.$el.on("drop",function(t){if(t.preventDefault(),!i.state.get("disabled")){var e=function(t){var e=i.settings.accept;if("string"!=typeof e)return t;var n=new RegExp("("+e.split(/\s*,\s*/).join("|")+")$","i");return R.grep(t,function(t){return n.test(t.name)})}(t.dataTransfer.files);i.value=function(){return e.length?i.settings.multiple?e:e[0]:null},e.length&&i.fire("change",t)}})},remove:function(){this.$el.off(),this._super()}}),Gn=xe.extend({init:function(t){var n=this;t.delimiter||(t.delimiter="\xbb"),n._super(t),n.classes.add("path"),n.canFocus=!0,n.on("click",function(t){var e;(e=t.target.getAttribute("data-index"))&&n.fire("select",{value:n.row()[e],index:e})}),n.row(n.settings.row)},focus:function(){return this.getEl().firstChil
d.focus(),this},row:function(t){return arguments.length?(this.state.set("row",t),this):this.state.get("row")},renderHtml:function(){return'<div id="'+this._id+'" class="'+this.classes+'">'+this._getDataPathHtml(this.state.get("row"))+"</div>"},bindStates:function(){var e=this;return e.state.on("change:row",function(t){e.innerHtml(e._getDataPathHtml(t.value))}),e._super()},_getDataPathHtml:function(t){var e,n,i=t||[],r="",o=this.classPrefix;for(e=0,n=i.length;e<n;e++)r+=(0<e?'<div class="'+o+'divider" aria-hidden="true"> '+this.settings.delimiter+" </div>":"")+'<div role="button" class="'+o+"path-item"+(e===n-1?" "+o+"last":"")+'" data-index="'+e+'" tabindex="-1" id="'+this._id+"-"+e+'" aria-level="'+(e+1)+'">'+i[e].name+&
quot;</div>";return r||(r='<div class="'+o+'path-item">\xa0</div>'),r}}),Kn=Gn.extend({postRender:function(){var o=this,s=o.settings.editor;function a(t){if(1===t.nodeType){if("BR"===t.nodeName||t.getAttribute("data-mce-bogus"))return!0;if("bookmark"===t.getAttribute("data-mce-type"))return!0}return!1}return!1!==s.settings.elementpath&&(o.on("select",function(t){s.focus(),s.selection.select(this.row()[t.index].element),s.nodeChanged()}),s.on("nodeChange",function(t){for(var e=[],n=t.parents,i=n.length;i--;)if(1===n[i].nodeType&&!a(n[i])){var r=s.fire("ResolveName",{name:n[i].nodeName.toLowerCase(),target:n[i]});if(r.isDefaultPrevented()||e.push({name:r.name,element:n[i]}),r.isPropagationStopped())break}o.row(e)})),o._super()}}),Zn=De.extend({Defaults:{layout:"flex",align:"center",defaults:{flex:1}},renderHtml:function(){var t=this,e=t._layout,n=t
.classPrefix;return t.classes.add("formitem"),e.preRender(t),'<div id="'+t._id+'" class="'+t.classes+'" hidefocus="1" tabindex="-1">'+(t.settings.title?'<div id="'+t._id+'-title" class="'+n+'title">'+t.settings.title+"</div>":"")+'<div id="'+t._id+'-body" class="'+t.bodyClasses+'">'+(t.settings.html||"")+e.renderHtml(t)+"</div></div>"}}),Qn=De.extend({Defaults:{containerCls:"form",layout:"flex",direction:"column",align:"stretch",flex:1,padding:15,labelGap:30,spacing:10,callbacks:{submit:function(){this.submit()}}},preRender:function(){var i=this,t=i.items();i.settings.formItemDefaults||(i.settings.formItemDefaults={layout:"flex",autoResize:"overflow",defaults:{flex:1}}),t.each(function(t){var e,n=t.settings.label;n&&((e=new Zn(R.extend({items:{type:&quo
t;label",id:t._id+"-l",text:n,flex:0,forId:t._id,disabled:t.disabled()}},i.settings.formItemDefaults))).type="formitem",t.aria("labelledby",t._id+"-l"),"undefined"==typeof t.settings.flex&&(t.settings.flex=1),i.replace(t,e),e.add(t))})},submit:function(){return this.fire("submit",{data:this.toJSON()})},postRender:function(){this._super(),this.fromJSON(this.settings.data)},bindStates:function(){var n=this;function t(){var t,e,i=0,r=[];if(!1!==n.settings.labelGapCalc)for(("children"===n.settings.labelGapCalc?n.find("formitem"):n.items()).filter("formitem").each(function(t){var e=t.items()[0],n=e.getEl().clientWidth;i=i<n?n:i,r.push(e)}),e=n.settings.labelGap||0,t=r.length;t--;)r[t].settings.minWidth=i+e}n._super(),n.on("show",t),t()}}),ti=Qn.extend({Defaults:{containerCls:"fieldset",layout:"flex",direction:"column",align:"stretch",
flex:1,padding:"25 15 5 15",labelGap:30,spacing:10,border:1},renderHtml:function(){var t=this,e=t._layout,n=t.classPrefix;return t.preRender(),e.preRender(t),'<fieldset id="'+t._id+'" class="'+t.classes+'" hidefocus="1" tabindex="-1">'+(t.settings.title?'<legend id="'+t._id+'-title" class="'+n+'fieldset-title">'+t.settings.title+"</legend>":"")+'<div id="'+t._id+'-body" class="'+t.bodyClasses+'">'+(t.settings.html||"")+e.renderHtml(t)+"</div></fieldset>"}}),ei=0,ni=function(t){var e=(new Date).getTime();return t+"_"+Math.floor(1e9*Math.random())+ ++ei+String(e)},ii=function(t){if(null===t||t===undefined)throw new Error("Node cannot be null or undefined");return{dom:lt.constant(t)}},ri={fromHtml:function(t,e){var n=(e||document).createElement("div");if(n.innerHTML=t,!n.hasChildNodes()||1<
n.childNodes.length)throw console.error("HTML does not have a single root node",t),"HTML must have a single root node";return ii(n.childNodes[0])},fromTag:function(t,e){var n=(e||document).createElement(t);return ii(n)},fromText:function(t,e){var n=(e||document).createTextNode(t);return ii(n)},fromDom:ii,fromPoint:function(t,e,n){return mt.from(t.dom().elementFromPoint(e,n)).map(ii)}},oi=function(t){var e,n=!1;return function(){return n||(n=!0,e=t.apply(null,arguments)),e}},si=9,ai=1,li=3,ui=function(t){return t.dom().nodeType},ci=function(e){return function(t){return ui(t)===e}},di=(ci(ai),ci(li),ci(si),oi(function(){return di(ri.fromDom(document))}),function(t){var e=t.dom().body;if(null===e||e===undefined)throw"Body is not available yet";return ri.fromDom(e)}),fi=(sn=Object.keys)===undefined?function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}:sn,hi=function(t,e){for(var n=fi(t),i=0,r=n.length;i<r;i++){var o=n[i];e(
t[o],o,t)}},mi=function(i,r){var o={};return hi(i,function(t,e){var n=r(t,e,i);o[n.k]=n.v}),o},gi=function(t,n){var i=[];return hi(t,function(t,e){i.push(n(t,e))}),i},pi=function(t){return gi(t,function(t){return t})},vi={bifilter:function(t,n){var i={},r={};return hi(t,function(t,e){(n(t,e)?i:r)[e]=t}),{t:i,f:r}},each:hi,map:function(t,i){return mi(t,function(t,e,n){return{k:e,v:i(t,e,n)}})},mapToArray:gi,tupleMap:mi,find:function(t,e){for(var n=fi(t),i=0,r=n.length;i<r;i++){var o=n[i],s=t[o];if(e(s,o,t))return mt.some(s)}return mt.none()},keys:fi,values:pi,size:function(t){return pi(t).length}},yi=function(t){return t.slice(0).sort()},bi={sort:yi,reqMessage:function(t,e){throw new Error("All required keys ("+yi(t).join(", ")+") were not specified. Specified keys were: "+yi(e).join(", ")+".")},unsuppMessage:function(t){throw new Error("Unsupported keys for object: "+yi(t).join(", "))},validateStrArr:function(e
,t){if(!pt.isArray(t))throw new Error("The "+e+" fields must be an array. Was: "+t+".");Tt.each(t,function(t){if(!pt.isString(t))throw new Error("The value "+t+" in the "+e+" fields was not a string.")})},invalidTypeMessage:function(t,e){throw new Error("All values need to be of type: "+e+". Keys ("+yi(t).join(", ")+") were not.")},checkDupes:function(t){var n=yi(t);Tt.find(n,function(t,e){return e<n.length-1&&t===n[e+1]}).each(function(t){throw new Error("The field: "+t+" occurs more than once in the combined fields: ["+n.join(", ")+"].")})}},xi={immutable:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];if(e.length!==n.length)throw new Error('Wrong number of arguments to struct. Expected "['+e.length+']", got '+n.length+&q
uot; arguments");var i={};return Tt.each(e,function(t,e){i[t]=lt.constant(n[e])}),i}},immutableBag:function(r,o){var s=r.concat(o);if(0===s.length)throw new Error("You must specify at least one required or optional field.");return bi.validateStrArr("required",r),bi.validateStrArr("optional",o),bi.checkDupes(s),function(e){var n=vi.keys(e);Tt.forall(r,function(t){return Tt.contains(n,t)})||bi.reqMessage(r,n);var t=Tt.filter(n,function(t){return!Tt.contains(s,t)});0<t.length&&bi.unsuppMessage(t);var i={};return Tt.each(r,function(t){i[t]=lt.constant(e[t])}),Tt.each(o,function(t){i[t]=lt.constant(Object.prototype.hasOwnProperty.call(e,t)?mt.some(e[t]):mt.none())}),i}}},wi=function(t,e){var n=function(t,e){for(var n=0;n<t.length;n++){var i=t[n];if(i.test(e))return i}return undefined}(t,e);if(!n)return{major:0,minor:0};var i=function(t){return Number(e.replace(n,"$"+t))};return Ri(i(1),i(2))},_i=function(){return Ri(0,0)},Ri=func
tion(t,e){return{major:t,minor:e}},Ci={nu:Ri,detect:function(t,e){var n=String(e).toLowerCase();return 0===t.length?_i():wi(t,n)},unknown:_i},ki="Firefox",Ei=function(t,e){return function(){return e===t}},Hi=function(t){var e=t.current;return{current:e,version:t.version,isEdge:Ei("Edge",e),isChrome:Ei("Chrome",e),isIE:Ei("IE",e),isOpera:Ei("Opera",e),isFirefox:Ei(ki,e),isSafari:Ei("Safari",e)}},Si={unknown:function(){return Hi({current:undefined,version:Ci.unknown()})},nu:Hi,edge:lt.constant("Edge"),chrome:lt.constant("Chrome"),ie:lt.constant("IE"),opera:lt.constant("Opera"),firefox:lt.constant(ki),safari:lt.constant("Safari")},Mi="Windows",Ti="Android",Wi="Solaris",Pi="FreeBSD",Ni=function(t,e){return function(){return e===t}},Oi=function(t){var e=t.current;return{current:e,version:t.version,isWindows:Ni(Mi,e),isiOS:Ni("iOS"
,e),isAndroid:Ni(Ti,e),isOSX:Ni("OSX",e),isLinux:Ni("Linux",e),isSolaris:Ni(Wi,e),isFreeBSD:Ni(Pi,e)}},Di={unknown:function(){return Oi({current:undefined,version:Ci.unknown()})},nu:Oi,windows:lt.constant(Mi),ios:lt.constant("iOS"),android:lt.constant(Ti),linux:lt.constant("Linux"),osx:lt.constant("OSX"),solaris:lt.constant(Wi),freebsd:lt.constant(Pi)},Ai=function(t,e){var n=String(e).toLowerCase();return Tt.find(t,function(t){return t.search(n)})},Bi=function(t,n){return Ai(t,n).map(function(t){var e=Ci.detect(t.versionRegexes,n);return{current:t.name,version:e}})},Li=function(t,n){return Ai(t,n).map(function(t){var e=Ci.detect(t.versionRegexes,n);return{current:t.name,version:e}})},Ii=function(t,e){return-1!==t.indexOf(e)},zi=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Fi=function(e){return function(t){return Ii(t,e)}},Vi=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(t){return Ii(t,"edge/&
quot;)&&Ii(t,"chrome")&&Ii(t,"safari")&&Ii(t,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,zi],search:function(t){return Ii(t,"chrome")&&!Ii(t,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(t){return Ii(t,"msie")||Ii(t,"trident")}},{name:"Opera",versionRegexes:[zi,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Fi("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Fi("firefox")},{name:"Safari",versionRegexes:[zi,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(t){return(Ii(t,"safari")||Ii(t,"mobile/"))&&Ii(t,"applewebkit")}}],qi=[{name:"Windows",search:Fi("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
},{name:"iOS",search:function(t){return Ii(t,"iphone")||Ii(t,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Fi("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Fi("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Fi("linux"),versionRegexes:[]},{name:"Solaris",search:Fi("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Fi("freebsd"),versionRegexes:[]}],Ui={browsers:lt.constant(Vi),oses:lt.constant(qi)},ji=function(t){var e,n,i,r,o,s,a,l,u,c,d,f=Ui.browsers(),h=Ui.oses(),m=Bi(f,t).fold(Si.unknown,Si.nu),g=Li(h,t).fold(Di.unknown,Di.nu);return{browser:m,os:g,deviceType:(n=m,i=t,r=(e=g).isiOS()&&!0===/ipad/i.test(i),o=e.isiOS()&&!r,s=e.isAndroid()&&3===e.version.
major,a=e.isAndroid()&&4===e.version.major,l=r||s||a&&!0===/mobile/i.test(i),u=e.isiOS()||e.isAndroid(),c=u&&!l,d=n.isSafari()&&e.isiOS()&&!1===/safari/i.test(i),{isiPad:lt.constant(r),isiPhone:lt.constant(o),isTablet:lt.constant(l),isPhone:lt.constant(c),isTouch:lt.constant(u),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:lt.constant(d)})}},$i=oi(function(){var t=navigator.userAgent;return ji(t)}),Yi=ai,Xi=si,Ji=function(t){return t.nodeType!==Yi&&t.nodeType!==Xi||0===t.childElementCount},Gi={all:function(t,e){var n=e===undefined?document:e.dom();return Ji(n)?[]:Tt.map(n.querySelectorAll(t),ri.fromDom)},is:function(t,e){var n=t.dom();if(n.nodeType!==Yi)return!1;if(n.matches!==undefined)return n.matches(e);if(n.msMatchesSelector!==undefined)return n.msMatchesSelector(e);if(n.webkitMatchesSelector!==undefined)return n.webkitMatchesSelector(e);if(n.mozMatchesSelector!==undefined)return n.mozMatchesSelector(e);throw new Error("Browse
r lacks native selectors")},one:function(t,e){var n=e===undefined?document:e.dom();return Ji(n)?mt.none():mt.from(n.querySelector(t)).map(ri.fromDom)}},Ki=($i().browser.isIE(),xi.immutable("element","offset"),function(t,e){return Gi.all(e,t)}),Zi=R.trim,Qi=function(e){return function(t){if(t&&1===t.nodeType){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1}},tr=Qi("true"),er=Qi("false"),nr=function(t,e,n,i,r){return{type:t,title:e,url:n,level:i,attach:r}},ir=function(t){return t.innerText||t.textContent},rr=function(t){return(e=t)&&"A"===e.nodeName&&(e.id||e.name)&&sr(t);var e},or=function(t){return t&&/^(H[1-6])$/.test(t.nodeName)},sr=function(t){return function(t){for(;t=t.parentNode;){var e=t.contentEditable;if(e&&"inherit"!==e)return tr(t)}return!1}(t)&&!er(t)},ar=function(t){return or(t)&&
sr(t)},lr=function(t){var e,n,i=(e=t).id?e.id:ni("h");return nr("header",ir(t),"#"+i,or(n=t)?parseInt(n.nodeName.substr(1),10):0,function(){t.id=i})},ur=function(t){var e=t.id||t.name,n=ir(t);return nr("anchor",n||"#"+e,"#"+e,0,lt.noop)},cr=function(t){var e,n;return e="h1,h2,h3,h4,h5,h6,a:not([href])",n=t,Tt.map(Ki(ri.fromDom(n),e),function(t){return t.dom()})},dr=function(t){return 0<Zi(t.title).length},fr=function(t){var e,n,i=cr(t);return Tt.filter((n=i,Tt.map(Tt.filter(n,ar),lr)).concat((e=i,Tt.map(Tt.filter(e,rr),ur))),dr)},hr={},mr=function(t){return{title:t.title,value:{title:{raw:t.title},url:t.url,attach:t.attach}}},gr=function(t,e){return{title:t,value:{title:t,url:e,attach:lt.noop}}},pr=function(t,e,n){var i=e in t?t[e]:n;return!1===i?null:i},vr=function(t,i,r,e){var n,o,s,a,l={title:"-"},u=function(t){var e=t.hasOwnProperty(r)?t[r]:[],n=Tt.filter(e,function(t){return e=t,n=i,!Tt.exists(n,
function(t){return t.url===e});var e,n});return R.map(n,function(t){return{title:t,value:{title:t,url:t,attach:lt.noop}}})},c=function(e){var t,n=Tt.filter(i,function(t){return t.type===e});return t=n,R.map(t,mr)};return!1===e.typeahead_urls?[]:"file"===r?(n=[yr(t,u(hr)),yr(t,c("header")),yr(t,(o=c("anchor"),s=pr(e,"anchor_top","#top"),a=pr(e,"anchor_bottom","#bottom"),null!==s&&o.unshift(gr("<top>",s)),null!==a&&o.push(gr("<bottom>",a)),o))],Tt.foldl(n,function(t,e){return 0===t.length||0===e.length?t.concat(e):t.concat(l,e)},[])):yr(t,u(hr))},yr=function(t,e){var n=t.toLowerCase(),i=R.grep(e,function(t){return-1!==t.title.toLowerCase().indexOf(n)});return 1===i.length&&i[0].title===t?[]:i},br=function(r,i,o,s){var e=function(t){var e=fr(o),n=vr(t,e,s,i);r.showAutoComplete(n,t)};r.on("autocomplete",function(){e(r.value())}),r.on("selectitem&qu
ot;,function(t){var e=t.value;r.value(e.url);var n,i=(n=e.title).raw?n.raw:n;"image"===s?r.fire("change",{meta:{alt:i,attach:e.attach}}):r.fire("change",{meta:{text:i,attach:e.attach}}),r.focus()}),r.on("click",function(t){0===r.value().length&&"INPUT"===t.target.nodeName&&e("")}),r.on("PostRender",function(){r.getRoot().on("submit",function(t){var e,n,i;t.isDefaultPrevented()||(e=r.value(),i=hr[n=s],/^https?/.test(e)&&(i?Tt.indexOf(i,e).isNone()&&(hr[n]=i.slice(0,5).concat(e)):hr[n]=[e]))})})},xr=function(o,t,n){var i=t.filepicker_validator_handler;i&&o.state.on("change:value",function(t){var e;0!==(e=t.value).length?i({url:e,type:n},function(t){var e,n,i,r=(n=(e=t).status,i=e.message,"valid"===n?{status:"ok",message:i}:"unknown"===n?{status:"warn",message:i}:"invalid"===n?{status:"warn",message
:i}:{status:"none",message:""});o.statusMessage(r.message),o.statusLevel(r.status)}):o.statusLevel("none")})},wr=Vn.extend({Statics:{clearHistory:function(){hr={}}},init:function(t){var e,n,i,r=this,o=window.tinymce?window.tinymce.activeEditor:T.activeEditor,s=o.settings,a=t.filetype;t.spellcheck=!1,(i=s.file_picker_types||s.file_browser_callback_types)&&(i=R.makeMap(i,/[, ]/)),i&&!i[a]||(!(n=s.file_picker_callback)||i&&!i[a]?!(n=s.file_browser_callback)||i&&!i[a]||(e=function(){n(r.getEl("inp").id,r.value(),a,window)}):e=function(){var t=r.fire("beforecall").meta;t=R.extend({filetype:a},t),n.call(o,function(t,e){r.value(t).fire("change",{meta:e})},r.value(),t)}),e&&(t.icon="browse",t.onaction=e),r._super(t),r.classes.add("filepicker"),br(r,s,o.getBody(),a),xr(r,s,a)}}),_r=An.extend({recalc:function(t){var e=t.layoutRect(),n=t.paddingBox;t.items().filter(":vis
ible").each(function(t){t.layoutRect({x:n.left,y:n.top,w:e.innerW-n.right-n.left,h:e.innerH-n.top-n.bottom}),t.recalc&&t.recalc()})}}),Rr=An.extend({recalc:function(t){var e,n,i,r,o,s,a,l,u,c,d,f,h,m,g,p,v,y,b,x,w,_,R,C,k,E,H,S,M,T,W,P,N,O,D,A,B,L=[],I=Math.max,z=Math.min;for(i=t.items().filter(":visible"),r=t.layoutRect(),o=t.paddingBox,s=t.settings,f=t.isRtl()?s.direction||"row-reversed":s.direction,a=s.align,l=t.isRtl()?s.pack||"end":s.pack,u=s.spacing||0,"row-reversed"!==f&&"column-reverse"!==f||(i=i.set(i.toArray().reverse()),f=f.split("-")[0]),"column"===f?(C="y",_="h",R="minH",k="maxH",H="innerH",E="top",S="deltaH",M="contentH",O="left",P="w",T="x",W="innerW",N="minW",D="right",A="deltaW",B="contentW"):(C="x",_="w&
quot;,R="minW",k="maxW",H="innerW",E="left",S="deltaW",M="contentW",O="top",P="h",T="y",W="innerH",N="minH",D="bottom",A="deltaH",B="contentH"),d=r[H]-o[E]-o[E],w=c=0,e=0,n=i.length;e<n;e++)m=(h=i[e]).layoutRect(),d-=e<n-1?u:0,0<(g=h.settings.flex)&&(c+=g,m[k]&&L.push(h),m.flex=g),d-=m[R],w<(p=o[O]+m[N]+o[D])&&(w=p);if((b={})[R]=d<0?r[R]-d+r[S]:r[H]-d+r[S],b[N]=w+r[A],b[M]=r[H]-d,b[B]=w,b.minW=z(b.minW,r.maxW),b.minH=z(b.minH,r.maxH),b.minW=I(b.minW,r.startMinWidth),b.minH=I(b.minH,r.startMinHeight),!r.autoResize||b.minW===r.minW&&b.minH===r.minH){for(y=d/c,e=0,n=L.length;e<n;e++)(v=(m=(h=L[e]).layoutRect())[k])<(p=m[R]+m.flex*y)?(d-=m[k]-m[R],c-=m.flex,m.flex=0,m.maxFlexSize=v):m.maxFlexSize=0;for(y=d/c,x=o[E],b={},0===c&&("end"===l?x=d+o[E]:"center"===l?(x=Math.ro
und(r[H]/2-(r[H]-d)/2)+o[E])<0&&(x=o[E]):"justify"===l&&(x=o[E],u=Math.floor(d/(i.length-1)))),b[T]=o[O],e=0,n=i.length;e<n;e++)p=(m=(h=i[e]).layoutRect()).maxFlexSize||m[R],"center"===a?b[T]=Math.round(r[W]/2-m[P]/2):"stretch"===a?(b[P]=I(m[N]||0,r[W]-o[O]-o[D]),b[T]=o[O]):"end"===a&&(b[T]=r[W]-m[P]-o.top),0<m.flex&&(p+=m.flex*y),b[_]=p,b[C]=x,h.layoutRect(b),h.recalc&&h.recalc(),x+=p+u}else if(b.w=b.minW,b.h=b.minH,t.layoutRect(b),this.recalc(t),null===t._lastRect){var F=t.parent();F&&(F._lastRect=null,F.recalc())}}}),Cr=Dn.extend({Defaults:{containerClass:"flow-layout",controlClass:"flow-layout-item",endClass:"break"},recalc:function(t){t.items().filter(":visible").each(function(t){t.recalc&&t.recalc()})},isNative:function(){return!0}}),kr=function(t,e){return Gi.one(e,t)},Er=function(t,e){return function(){t.execCommand("mceToggleF
ormat",!1,e)}},Hr=function(t,n){return function(){var e=this;t.formatter?t.formatter.formatChanged(n,function(t){e.active(t)}):t.on("init",function(){t.formatter.formatChanged(n,function(t){e.active(t)})})}},Sr=function(n){n.addMenuItem("align",{text:"Align",menu:[{text:"Left",icon:"alignleft",onclick:Er(n,"alignleft")},{text:"Center",icon:"aligncenter",onclick:Er(n,"aligncenter")},{text:"Right",icon:"alignright",onclick:Er(n,"alignright")},{text:"Justify",icon:"alignjustify",onclick:Er(n,"alignjustify")}]}),R.each({alignleft:["Align left","JustifyLeft"],aligncenter:["Align center","JustifyCenter"],alignright:["Align right","JustifyRight"],alignjustify:["Justify","JustifyFull"],alignnone:["No alignment","JustifyNone"]},function(t,e)
{n.addButton(e,{active:!1,tooltip:t[0],cmd:t[1],onPostRender:Hr(n,e)})})},Mr=function(t){return t?t.split(",")[0]:""},Tr=function(a,l){return function(){var s=this;a.on("init nodeChange",function(t){var e,n,i,r=a.queryCommandValue("FontName"),o=(e=l,n=r,R.each(e,function(t){t.value.toLowerCase()===n.toLowerCase()&&(i=t.value)}),R.each(e,function(t){i||Mr(t.value).toLowerCase()!==Mr(n).toLowerCase()||(i=t.value)}),i);s.value(o||null),!o&&r&&s.text(Mr(r))})}},Wr=function(n){n.addButton("fontselect",function(){var t,e=(t=function(t){for(var e=(t=t.replace(/;$/,"").split(";")).length;e--;)t[e]=t[e].split("=");return t}(n.settings.font_formats||"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia
,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"),R.map(t,function(t){return{text:{raw:t[0]},value:t[1],textStyle:-1===t[1].indexOf("dings")?"font-family:"+t[1]:""}}));return{type:"listbox",text:"Font Family",tooltip:"Font Family",values:e,fixedWidth:!0,onPostRender:Tr(n,e),onselect:function(t){t.control.settings.value&&n.execCommand("FontName",!1,t.control.settings.value)}}})},Pr=function(t){Wr(t)},Nr=function(t,e){return/[0-9.]+px$/.test(t)?(n=72*parseInt(t,10)/96,i=e||0,r=Math.pow(10,i),Math.round(n*r)/r+"pt"):t;var n,i,r},Or=function(t,e,n){var i;return R.each(t,function(t){t.value===n?i=n:t.value==
=e&&(i=e)}),i},Dr=function(n){n.addButton("fontsizeselect",function(){var t,s,a,e=(t=n.settings.fontsize_formats||"8pt 10pt 12pt 14pt 18pt 24pt 36pt",R.map(t.split(" "),function(t){var e=t,n=t,i=t.split("=");return 1<i.length&&(e=i[0],n=i[1]),{text:e,value:n}}));return{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:e,fixedWidth:!0,onPostRender:(s=n,a=e,function(){var o=this;s.on("init nodeChange",function(t){var e,n,i,r;if(e=s.queryCommandValue("FontSize"))for(i=3;!r&&0<=i;i--)n=Nr(e,i),r=Or(a,n,e);o.value(r||null),r||o.text(n)})}),onclick:function(t){t.control.settings.value&&n.execCommand("FontSize",!1,t.control.settings.value)}}})},Ar=function(t){Dr(t)},Br=function(n,t){var i=t.length;return R.each(t,function(t){t.menu&&(t.hidden=0===Br(n,t.menu));var e=t.format;e&&(t.hidden=!n.formatter.canApply(e)),t.hidden&&
amp;i--}),i},Lr=function(n,t){var i=t.items().length;return t.items().each(function(t){t.menu&&t.visible(0<Lr(n,t.menu)),!t.menu&&t.settings.menu&&t.visible(0<Br(n,t.settings.menu));var e=t.settings.format;e&&t.visible(n.formatter.canApply(e)),t.visible()||i--}),i},Ir=function(t){var i,r,o,e,s,n,a,l,u=(r=0,o=[],e=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough&
quot;,icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}],s=function(t){var i=[];if(t)return R.each(t,function(
t){var e={text:t.title,icon:t.icon};if(t.items)e.menu=s(t.items);else{var n=t.format||"custom"+r++;t.format||(t.name=n,o.push(t)),e.format=n,e.cmd=t.cmd}i.push(e)}),i},(i=t).on("init",function(){R.each(o,function(t){i.formatter.register(t.name,t)})}),{type:"menu",items:i.settings.style_formats_merge?i.settings.style_formats?s(e.concat(i.settings.style_formats)):s(e):s(i.settings.style_formats||e),onPostRender:function(t){i.fire("renderFormatsMenu",{control:t.control})},itemDefaults:{preview:!0,textStyle:function(){if(this.settings.format)return i.formatter.getCssText(this.settings.format)},onPostRender:function(){var n=this;n.parent().on("show",function(){var t,e;(t=n.settings.format)&&(n.disabled(!i.formatter.canApply(t)),n.active(i.formatter.match(t))),(e=n.settings.cmd)&&n.active(i.queryCommandState(e))})},onclick:function(){this.settings.format&&Er(i,this.settings.format)(),this.settings.cmd&&i.exe
cCommand(this.settings.cmd)}}});n=u,t.addMenuItem("formats",{text:"Formats",menu:n}),l=u,(a=t).addButton("styleselect",{type:"menubutton",text:"Formats",menu:l,onShowMenu:function(){a.settings.style_formats_autohide&&Lr(a,this.menu)}})},zr=function(n,t){return function(){var r,o,s,e=[];return R.each(t,function(t){e.push({text:t[0],value:t[1],textStyle:function(){return n.formatter.getCssText(t[1])}})}),{type:"listbox",text:t[0][0],values:e,fixedWidth:!0,onselect:function(t){if(t.control){var e=t.control.value();Er(n,e)()}},onPostRender:(r=n,o=e,function(){var e=this;r.on("nodeChange",function(t){var n=r.formatter,i=null;R.each(t.parents,function(e){if(R.each(o,function(t){if(s?n.matchNode(e,s,{value:t.value})&&(i=t.value):n.matchNode(e,t.value)&&(i=t.value),i)return!1}),i)return!1}),e.value(i)})})}}},Fr=function(t){var e,n,i=function(t){for(var e=(t=t.replace(/;$/,"").split("
;")).length;e--;)t[e]=t[e].split("=");return t}(t.settings.block_formats||"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre");t.addMenuItem("blockformats",{text:"Blocks",menu:(e=t,n=i,R.map(n,function(t){return{text:t[0],onclick:Er(e,t[1]),textStyle:function(){return e.formatter.getCssText(t[1])}}}))}),t.addButton("formatselect",zr(t,i))},Vr=function(e,t){var n,i;if("string"==typeof t)i=t.split(" ");else if(R.isArray(t))return Tt.flatten(R.map(t,function(t){return Vr(e,t)}));return n=R.grep(i,function(t){return"|"===t||t in e.menuItems}),R.map(n,function(t){return"|"===t?{text:"-"}:e.menuItems[t]})},qr=function(t){return t&&"-"===t.text},Ur=function(t){var e=Tt.filter(t,function(t,e,n){return!qr(t)||!qr(n[e-1])});return Tt.filter(e,function(t,e,n){return!qr(t)||0<e&&e<n.length-1})},jr=functi
on(t){var e,n,i,r,o=t.settings.insert_button_items;return Ur(o?Vr(t,o):(e=t,n="insert",i=[{text:"-"}],r=R.grep(e.menuItems,function(t){return t.context===n}),R.each(r,function(t){"before"===t.separator&&i.push({text:"|"}),t.prependToContext?i.unshift(t):i.push(t),"after"===t.separator&&i.push({text:"|"})}),i))},$r=function(t){var e;(e=t).addButton("insert",{type:"menubutton",icon:"insert",menu:[],oncreatemenu:function(){this.menu.add(jr(e)),this.menu.renderNew()}})},Yr=function(t){var n,i,r;n=t,R.each({bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript"},function(t,e){n.addButton(e,{active:!1,tooltip:t,onPostRender:Hr(n,e),onclick:Er(n,e)})}),i=t,R.each({outdent:["Decrease indent","Outdent"],indent:["Increase indent"
;,"Indent"],cut:["Cut","Cut"],copy:["Copy","Copy"],paste:["Paste","Paste"],help:["Help","mceHelp"],selectall:["Select all","SelectAll"],visualaid:["Visual aids","mceToggleVisualAid"],newdocument:["New document","mceNewDocument"],removeformat:["Clear formatting","RemoveFormat"],remove:["Remove","Delete"]},function(t,e){i.addButton(e,{tooltip:t[0],cmd:t[1]})}),r=t,R.each({blockquote:["Blockquote","mceBlockQuote"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"]},function(t,e){r.addButton(e,{active:!1,tooltip:t[0],cmd:t[1],onPostRender:Hr(r,e)})})},Xr=function(t){var n;Yr(t),n=t,R.each({bold:["Bold","Bold","Meta+B"],italic:["Italic","Italic","Meta+I"],u
nderline:["Underline","Underline","Meta+U"],strikethrough:["Strikethrough","Strikethrough"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],removeformat:["Clear formatting","RemoveFormat"],newdocument:["New document","mceNewDocument"],cut:["Cut","Cut","Meta+X"],copy:["Copy","Copy","Meta+C"],paste:["Paste","Paste","Meta+V"],selectall:["Select all","SelectAll","Meta+A"]},function(t,e){n.addMenuItem(e,{text:t[0],icon:e,shortcut:t[2],cmd:t[1]})}),n.addMenuItem("codeformat",{text:"Code",icon:"code",onclick:Er(n,"code")})},Jr=function(n,i){return function(){var t=this,e=function(){var t="redo"===i?"hasRedo":"hasUndo";return!!n.undoManager&&a
mp;n.undoManager[t]()};t.disabled(!e()),n.on("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",function(){t.disabled(n.readonly||!e())})}},Gr=function(t){var e,n;(e=t).addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onPostRender:Jr(e,"undo"),cmd:"undo"}),e.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onPostRender:Jr(e,"redo"),cmd:"redo"}),(n=t).addButton("undo",{tooltip:"Undo",onPostRender:Jr(n,"undo"),cmd:"undo"}),n.addButton("redo",{tooltip:"Redo",onPostRender:Jr(n,"redo"),cmd:"redo"})},Kr=function(t){var e,n;(e=t).addMenuItem("visualaid",{text:"Visual aids",selectable:!0,onPostRender:(n=e,function(){var e=this;n.on("VisualAid",function(t){e.active(t.hasVisual)}),e.active(n.hasVisual)}),cmd:"mceToggleVisual
Aid"})},Zr={setup:function(t){var e;t.rtl&&(fe.rtl=!0),t.on("mousedown",function(){je.hideAll()}),(e=t).settings.ui_container&&(h.container=kr(ri.fromDom(document.body),e.settings.ui_container).fold(lt.constant(null),function(t){return t.dom()})),xe.tooltips=!h.iOS,fe.translate=function(t){return T.translate(t)},Fr(t),Sr(t),Xr(t),Gr(t),Ar(t),Pr(t),Ir(t),Kr(t),$r(t)}},Qr=An.extend({recalc:function(t){var e,n,i,r,o,s,a,l,u,c,d,f,h,m,g,p,v,y,b,x,w,_,R,C,k,E,H,S,M=[],T=[];e=t.settings,r=t.items().filter(":visible"),o=t.layoutRect(),i=e.columns||Math.ceil(Math.sqrt(r.length)),n=Math.ceil(r.length/i),y=e.spacingH||e.spacing||0,b=e.spacingV||e.spacing||0,x=e.alignH||e.align,w=e.alignV||e.align,p=t.paddingBox,S="reverseRows"in e?e.reverseRows:t.isRtl(),x&&"string"==typeof x&&(x=[x]),w&&"string"==typeof w&&(w=[w]);for(d=0;d<i;d++)M.push(0);for(f=0;f<n;f++)T.push(0);for(f=0;f<n;f++)
for(d=0;d<i&&(c=r[f*i+d]);d++)C=(u=c.layoutRect()).minW,k=u.minH,M[d]=C>M[d]?C:M[d],T[f]=k>T[f]?k:T[f];for(E=o.innerW-p.left-p.right,d=_=0;d<i;d++)_+=M[d]+(0<d?y:0),E-=(0<d?y:0)+M[d];for(H=o.innerH-p.top-p.bottom,f=R=0;f<n;f++)R+=T[f]+(0<f?b:0),H-=(0<f?b:0)+T[f];if(_+=p.left+p.right,R+=p.top+p.bottom,(l={}).minW=_+(o.w-o.innerW),l.minH=R+(o.h-o.innerH),l.contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH,l.minW=Math.min(l.minW,o.maxW),l.minH=Math.min(l.minH,o.maxH),l.minW=Math.max(l.minW,o.startMinWidth),l.minH=Math.max(l.minH,o.startMinHeight),!o.autoResize||l.minW===o.minW&&l.minH===o.minH){var W;o.autoResize&&((l=t.layoutRect(l)).contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH),W="start"===e.packV?0:0<H?Math.floor(H/n):0;var P=0,N=e.flexWidths;if(N)for(d=0;d<N.length;d++)P+=N[d];else P=i;var O=E/P;for(d=0;d<i;d++)M[d]+=N?N[d]*O:O;for(m=p.top,f=0;f<n;f++){for(h=p.left,a=T[f]+W,d=0;d<i&&(c=r[S?
f*i+i-1-d:f*i+d]);d++)g=c.settings,u=c.layoutRect(),s=Math.max(M[d],u.startMinWidth),u.x=h,u.y=m,"center"===(v=g.alignH||(x?x[d]||x[0]:null))?u.x=h+s/2-u.w/2:"right"===v?u.x=h+s-u.w:"stretch"===v&&(u.w=s),"center"===(v=g.alignV||(w?w[d]||w[0]:null))?u.y=m+a/2-u.h/2:"bottom"===v?u.y=m+a-u.h:"stretch"===v&&(u.h=a),c.layoutRect(u),h+=s+y,c.recalc&&c.recalc();m+=a+b}}else if(l.w=l.minW,l.h=l.minH,t.layoutRect(l),this.recalc(t),null===t._lastRect){var D=t.parent();D&&(D._lastRect=null,D.recalc())}}}),to=xe.extend({renderHtml:function(){var t=this;return t.classes.add("iframe"),t.canFocus=!1,'<iframe id="'+t._id+'" class="'+t.classes+'" tabindex="-1" src="'+(t.settings.url||"javascript:''")+'" frameborder="0"></iframe>'},src:function(t){this.getEl().src=t},html:function(t,e){var n=this,i=this.getEl().contentWindow.doc
ument.body;return i?(i.innerHTML=t,e&&e()):c.setTimeout(function(){n.html(t)}),this}}),eo=xe.extend({init:function(t){this._super(t),this.classes.add("widget").add("infobox"),this.canFocus=!1},severity:function(t){this.classes.remove("error"),this.classes.remove("warning"),this.classes.remove("success"),this.classes.add(t)},help:function(t){this.state.set("help",t)},renderHtml:function(){var t=this,e=t.classPrefix;return'<div id="'+t._id+'" class="'+t.classes+'"><div id="'+t._id+'-body">'+t.encode(t.state.get("text"))+'<button role="button" tabindex="-1"><i class="'+e+"ico "+e+'i-help"></i></button></div></div>'},bindStates:function(){var e=this;return e.state.on("change:text",function(t){e.getEl("body").firstChild.data=e.encode(t.value),e.state.get("rendered")
&&e.updateLayoutRect()}),e.state.on("change:help",function(t){e.classes.toggle("has-help",t.value),e.state.get("rendered")&&e.updateLayoutRect()}),e._super()}}),no=xe.extend({init:function(t){var e=this;e._super(t),e.classes.add("widget").add("label"),e.canFocus=!1,t.multiline&&e.classes.add("autoscroll"),t.strong&&e.classes.add("strong")},initLayoutRect:function(){var t=this,e=t._super();return t.settings.multiline&&(Pt.getSize(t.getEl()).width>e.maxW&&(e.minW=e.maxW,t.classes.add("multiline")),t.getEl().style.width=e.minW+"px",e.startMinH=e.h=e.minH=Math.min(e.maxH,Pt.getSize(t.getEl()).height)),e},repaint:function(){return this.settings.multiline||(this.getEl().style.lineHeight=this.layoutRect().h+"px"),this._super()},severity:function(t){this.classes.remove("error"),this.classes.remove("warning"),this.classes.r
emove("success"),this.classes.add(t)},renderHtml:function(){var t,e,n=this,i=n.settings.forId,r=n.settings.html?n.settings.html:n.encode(n.state.get("text"));return!i&&(e=n.settings.forName)&&(t=n.getRoot().find("#"+e)[0])&&(i=t._id),i?'<label id="'+n._id+'" class="'+n.classes+'"'+(i?' for="'+i+'"':"")+">"+r+"</label>":'<span id="'+n._id+'" class="'+n.classes+'">'+r+"</span>"},bindStates:function(){var e=this;return e.state.on("change:text",function(t){e.innerHtml(e.encode(t.value)),e.state.get("rendered")&&e.updateLayoutRect()}),e._super()}}),io=De.extend({Defaults:{role:"toolbar",layout:"flow"},init:function(t){this._super(t),this.classes.add("toolbar")},postRender:function(){return this.items().each(function(t){t.classes.add("toolbar-item")}),this.
_super()}}),ro=io.extend({Defaults:{role:"menubar",containerCls:"menubar",ariaRoot:!0,defaults:{type:"menubutton"}}}),oo=Bn.extend({init:function(t){var e=this;e._renderOpen=!0,e._super(t),t=e.settings,e.classes.add("menubtn"),t.fixedWidth&&e.classes.add("fixed-width"),e.aria("haspopup",!0),e.state.set("menu",t.menu||e.render())},showMenu:function(t){var e,n=this;if(n.menu&&n.menu.visible()&&!1!==t)return n.hideMenu();n.menu||(e=n.state.get("menu")||[],n.classes.add("opened"),e.length?e={type:"menu",animate:!0,items:e}:(e.type=e.type||"menu",e.animate=!0),e.renderTo?n.menu=e.parent(n).show().renderTo():n.menu=He.create(e).parent(n).renderTo(),n.fire("createmenu"),n.menu.reflow(),n.menu.on("cancel",function(t){t.control.parent()===n.menu&&(t.stopPropagation(),n.focus(),n.hideMenu())}),n.menu.on("select",function(){
n.focus()}),n.menu.on("show hide",function(t){t.control===n.menu&&(n.activeMenu("show"===t.type),n.classes.toggle("opened","show"===t.type)),n.aria("expanded","show"===t.type)}).fire("show")),n.menu.show(),n.menu.layoutRect({w:n.layoutRect().w}),n.menu.repaint(),n.menu.moveRel(n.getEl(),n.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"]),n.fire("showmenu")},hideMenu:function(){this.menu&&(this.menu.items().each(function(t){t.hideMenu&&t.hideMenu()}),this.menu.hide())},activeMenu:function(t){this.classes.toggle("active",t)},renderHtml:function(){var t,e=this,n=e._id,i=e.classPrefix,r=e.settings.icon,o=e.state.get("text"),s="";return(t=e.settings.image)?(r="none","string"!=typeof t&&(t=window.getSelection?t[0]:t[1]),t=" style=\"background-image: url('"+t+"')\"")
:t="",o&&(e.classes.add("btn-has-text"),s='<span class="'+i+'txt">'+e.encode(o)+"</span>"),r=e.settings.icon?i+"ico "+i+"i-"+r:"",e.aria("role",e.parent()instanceof ro?"menuitem":"button"),'<div id="'+n+'" class="'+e.classes+'" tabindex="-1" aria-labelledby="'+n+'"><button id="'+n+'-open" role="presentation" type="button" tabindex="-1">'+(r?'<i class="'+r+'"'+t+"></i>":"")+s+' <i class="'+i+'caret"></i></button></div>'},postRender:function(){var r=this;return r.on("click",function(t){t.control===r&&function(t,e){for(;t;){if(e===t)return!0;t=t.parentNode}return!1}(t.target,r.getEl())&&(r.focus(),r.showMenu(!t.aria),t.aria&&r.menu.items().filter(":visible")[0
].focus())}),r.on("mouseenter",function(t){var e,n=t.control,i=r.parent();n&&i&&n instanceof oo&&n.parent()===i&&(i.items().filter("MenuButton").each(function(t){t.hideMenu&&t!==n&&(t.menu&&t.menu.visible()&&(e=!0),t.hideMenu())}),e&&(n.focus(),n.showMenu()))}),r._super()},bindStates:function(){var t=this;return t.state.on("change:menu",function(){t.menu&&t.menu.remove(),t.menu=null}),t._super()},remove:function(){this._super(),this.menu&&this.menu.remove()}});function so(i,r){var o,s,a=this,l=fe.classPrefix;a.show=function(t,e){function n(){o&&(Nt(i).append('<div class="'+l+"throbber"+(r?" "+l+"throbber-inline":"")+'"></div>'),e&&e())}return a.hide(),o=!0,t?s=c.setTimeout(n,t):n(),a},a.hide=function(){var t=i.lastChild;return c.clearTimeout(s),t&&-1!==t.className.indexOf("thro
bber")&&t.parentNode.removeChild(t),o=!1,a}}var ao=je.extend({Defaults:{defaultType:"menuitem",border:1,layout:"stack",role:"application",bodyRole:"menu",ariaRoot:!0},init:function(t){if(t.autohide=!0,t.constrainToViewport=!0,"function"==typeof t.items&&(t.itemsFactory=t.items,t.items=[]),t.itemDefaults)for(var e=t.items,n=e.length;n--;)e[n]=R.extend({},t.itemDefaults,e[n]);this._super(t),this.classes.add("menu"),t.animate&&11!==h.ie&&this.classes.add("animate")},repaint:function(){return this.classes.toggle("menu-align",!0),this._super(),this.getEl().style.height="",this.getEl("body").style.height="",this},cancel:function(){this.hideAll(),this.fire("select")},load:function(){var e,n=this;function i(){n.throbber&&(n.throbber.hide(),n.throbber=null)}n.settings.itemsFactory&&(n.throbber||(n.throbber=new so(n.getEl(
"body"),!0),0===n.items().length?(n.throbber.show(),n.fire("loading")):n.throbber.show(100,function(){n.items().remove(),n.fire("loading")}),n.on("hide close",i)),n.requestTime=e=(new Date).getTime(),n.settings.itemsFactory(function(t){0!==t.length?n.requestTime===e&&(n.getEl().style.width="",n.getEl("body").style.width="",i(),n.items().remove(),n.getEl("body").innerHTML="",n.add(t),n.renderNew(),n.fire("loaded")):n.hide()}))},hideAll:function(){return this.find("menuitem").exec("hideMenu"),this._super()},preRender:function(){var n=this;return n.items().each(function(t){var e=t.settings;if(e.icon||e.image||e.selectable)return!(n._hasIcons=!0)}),n.settings.itemsFactory&&n.on("postrender",function(){n.settings.itemsFactory&&n.load()}),n.on("show hide",function(t){t.control===n&&("show"===t.type?c.setTimeou
t(function(){n.classes.add("in")},0):n.classes.remove("in"))}),n._super()}}),lo=oo.extend({init:function(i){var e,r,o,n,s=this;s._super(i),i=s.settings,s._values=e=i.values,e&&("undefined"!=typeof i.value&&function t(e){for(var n=0;n<e.length;n++){if(r=e[n].selected||i.value===e[n].value)return o=o||e[n].text,s.state.set("value",e[n].value),!0;if(e[n].menu&&t(e[n].menu))return!0}}(e),!r&&0<e.length&&(o=e[0].text,s.state.set("value",e[0].value)),s.state.set("menu",e)),s.state.set("text",i.text||o),s.classes.add("listbox"),s.on("select",function(t){var e=t.control;n&&(t.lastControl=n),i.multiple?e.active(!e.active()):s.value(t.control.value()),n=e})},value:function(e){return 0===arguments.length?this.state.get("value"):(void 0===e||(this.settings.values?0<R.grep(this.settings.values,function(t){return t.value===e}).length?this.sta
te.set("value",e):null===e&&this.state.set("value",null):this.state.set("value",e)),this)},bindStates:function(){var i=this;return i.on("show",function(t){var e,n;e=t.control,n=i.value(),e instanceof ao&&e.items().each(function(t){t.hasMenus()||t.active(t.value()===n)})}),i.state.on("change:value",function(e){var n=function t(e,n){var i;if(e)for(var r=0;r<e.length;r++){if(e[r].value===n)return e[r];if(e[r].menu&&(i=t(e[r].menu,n)))return i}}(i.state.get("menu"),e.value);n?i.text(n.text):i.text(i.settings.text)}),i._super()}}),uo=xe.extend({Defaults:{border:0,role:"menuitem"},init:function(t){var e,n=this;n._super(t),t=n.settings,n.classes.add("menu-item"),t.menu&&n.classes.add("menu-item-expand"),t.preview&&n.classes.add("menu-item-preview"),"-"!==(e=n.state.get("text"))&&"|"!==e||(n.classes.add("men
u-item-sep"),n.aria("role","separator"),n.state.set("text","-")),t.selectable&&(n.aria("role","menuitemcheckbox"),n.classes.add("menu-item-checkbox"),t.icon="selected"),t.preview||t.selectable||n.classes.add("menu-item-normal"),n.on("mousedown",function(t){t.preventDefault()}),t.menu&&!t.ariaHideMenu&&n.aria("haspopup",!0)},hasMenus:function(){return!!this.settings.menu},showMenu:function(){var e,n=this,t=n.settings,i=n.parent();if(i.items().each(function(t){t!==n&&t.hideMenu()}),t.menu){(e=n.menu)?e.show():((e=t.menu).length?e={type:"menu",items:e}:e.type=e.type||"menu",i.settings.itemDefaults&&(e.itemDefaults=i.settings.itemDefaults),(e=n.menu=He.create(e).parent(n).renderTo()).reflow(),e.on("cancel",function(t){t.stopPropagation(),n.focus(),e.hide()}),e.on("show hide",function(t){t.contro
l.items&&t.control.items().each(function(t){t.active(t.settings.selected)})}).fire("show"),e.on("hide",function(t){t.control===e&&n.classes.remove("selected")}),e.submenu=!0),e._parentMenu=i,e.classes.add("menu-sub");var r=e.testMoveRel(n.getEl(),n.isRtl()?["tl-tr","bl-br","tr-tl","br-bl"]:["tr-tl","br-bl","tl-tr","bl-br"]);e.moveRel(n.getEl(),r),r="menu-sub-"+(e.rel=r),e.classes.remove(e._lastRel).add(r),e._lastRel=r,n.classes.add("selected"),n.aria("expanded",!0)}},hideMenu:function(){var t=this;return t.menu&&(t.menu.items().each(function(t){t.hideMenu&&t.hideMenu()}),t.menu.hide(),t.aria("expanded",!1)),t},renderHtml:function(){var t,e=this,n=e._id,i=e.settings,r=e.classPrefix,o=e.state.get("text"),s=e.settings.icon,a="",l=i.shortcut,u=e.encode(i.url);function c(t){retur
n t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function d(t){var e=i.match||"";return e?t.replace(new RegExp(c(e),"gi"),function(t){return"!mce~match["+t+"]mce~match!"}):t}function f(t){return t.replace(new RegExp(c("!mce~match["),"g"),"<b>").replace(new RegExp(c("]mce~match!"),"g"),"</b>")}return s&&e.parent().classes.add("menu-has-icons"),i.image&&(a=" style=\"background-image: url('"+i.image+"')\""),l&&(l=function(t){var e,n,i={};for(i=h.mac?{alt:"⌥",ctrl:"⌘",shift:"⇧",meta:"⌘"}:{meta:"Ctrl"},t=t.split("+"),e=0;e<t.length;e++)(n=i[t[e].toLowerCase()])&&(t[e]=n);return t.join("+")}(l)),s=r+"ico "+r+"i-"+(e.settings.icon||"none"),t="-"!==
o?'<i class="'+s+'"'+a+"></i>\xa0":"",o=f(e.encode(d(o))),u=f(e.encode(d(u))),'<div id="'+n+'" class="'+e.classes+'" tabindex="-1">'+t+("-"!==o?'<span id="'+n+'-text" class="'+r+'text">'+o+"</span>":"")+(l?'<div id="'+n+'-shortcut" class="'+r+'menu-shortcut">'+l+"</div>":"")+(i.menu?'<div class="'+r+'caret"></div>':"")+(u?'<div class="'+r+'menu-item-link">'+u+"</div>":"")+"</div>"},postRender:function(){var e=this,n=e.settings,t=n.textStyle;if("function"==typeof t&&(t=t.call(this)),t){var i=e.getEl("text");i&&(i.setAttribute("style",t),e._textStyle=t)}return e.on("mouseenter click",function(t){t.control===e&&(n.menu||"click"!==t.type
?(e.showMenu(),t.aria&&e.menu.focus(!0)):(e.fire("select"),c.requestAnimationFrame(function(){e.parent().hideAll()})))}),e._super(),e},hover:function(){return this.parent().items().each(function(t){t.classes.remove("selected")}),this.classes.toggle("selected",!0),this},active:function(t){return function(t,e){var n=t._textStyle;if(n){var i=t.getEl("text");i.setAttribute("style",n),e&&(i.style.color="",i.style.backgroundColor="")}}(this,t),void 0!==t&&this.aria("checked",t),this._super(t)},remove:function(){this._super(),this.menu&&this.menu.remove()}}),co=zn.extend({Defaults:{classes:"radio",role:"radio"}}),fo=xe.extend({renderHtml:function(){var t=this,e=t.classPrefix;return t.classes.add("resizehandle"),"both"===t.settings.direction&&t.classes.add("resizehandle-both"),t.canFocus=!1,'<div id="'+t._id+'"
class="'+t.classes+'"><i class="'+e+"ico "+e+'i-resize"></i></div>'},postRender:function(){var e=this;e._super(),e.resizeDragHelper=new Ee(this._id,{start:function(){e.fire("ResizeStart")},drag:function(t){"both"!==e.settings.direction&&(t.deltaX=0),e.fire("Resize",t)},stop:function(){e.fire("ResizeEnd")}})},remove:function(){return this.resizeDragHelper&&this.resizeDragHelper.destroy(),this._super()}});function ho(t){var e="";if(t)for(var n=0;n<t.length;n++)e+='<option value="'+t[n]+'">'+t[n]+"</option>";return e}var mo=xe.extend({Defaults:{classes:"selectbox",role:"selectbox",options:[]},init:function(t){var n=this;n._super(t),n.settings.size&&(n.size=n.settings.size),n.settings.options&&(n._options=n.settings.options),n.on("keydown",function(t){var e;13===t.keyCode&&(t.prevent
Default(),n.parents().reverse().each(function(t){if(t.toJSON)return e=t,!1}),n.fire("submit",{data:e.toJSON()}))})},options:function(t){return arguments.length?(this.state.set("options",t),this):this.state.get("options")},renderHtml:function(){var t,e=this,n="";return t=ho(e._options),e.size&&(n=' size = "'+e.size+'"'),'<select id="'+e._id+'" class="'+e.classes+'"'+n+">"+t+"</select>"},bindStates:function(){var e=this;return e.state.on("change:options",function(t){e.getEl().innerHTML=ho(t.value)}),e._super()}});function go(t,e,n){return t<e&&(t=e),n<t&&(t=n),t}function po(t,e,n){t.setAttribute("aria-"+e,n)}function vo(t,e){var n,i,r,o,s;"v"===t.settings.orientation?(r="top",i="height",n="h"):(r="left",i="width",n="w"),s=t.getEl("handle"),o=((t.layoutRect(
)[n]||100)-Pt.getSize(s)[i])*((e-t._minValue)/(t._maxValue-t._minValue))+"px",s.style[r]=o,s.style.height=t.layoutRect().h+"px",po(s,"valuenow",e),po(s,"valuetext",""+t.settings.previewFilter(e)),po(s,"valuemin",t._minValue),po(s,"valuemax",t._maxValue)}var yo=xe.extend({init:function(t){var e=this;t.previewFilter||(t.previewFilter=function(t){return Math.round(100*t)/100}),e._super(t),e.classes.add("slider"),"v"===t.orientation&&e.classes.add("vertical"),e._minValue=pt.isNumber(t.minValue)?t.minValue:0,e._maxValue=pt.isNumber(t.maxValue)?t.maxValue:100,e._initValue=e.state.get("value")},renderHtml:function(){var t=this._id,e=this.classPrefix;return'<div id="'+t+'" class="'+this.classes+'"><div id="'+t+'-handle" class="'+e+'slider-handle" role="slider" tabindex="-1"></div></div>'},res
et:function(){this.value(this._initValue).repaint()},postRender:function(){var t,e,n,i,r,o,s,a,l,u,c,d,f,h,m=this;t=m._minValue,e=m._maxValue,"v"===m.settings.orientation?(n="screenY",i="top",r="height",o="h"):(n="screenX",i="left",r="width",o="w"),m._super(),function(o,s){function e(t){var e,n,i,r;e=go(e=(((e=m.value())+(r=n=o))/((i=s)-r)+.05*t)*(i-n)-n,o,s),m.value(e),m.fire("dragstart",{value:e}),m.fire("drag",{value:e}),m.fire("dragend",{value:e})}m.on("keydown",function(t){switch(t.keyCode){case 37:case 38:e(-1);break;case 39:case 40:e(1)}})}(t,e),s=t,a=e,l=m.getEl("handle"),m._dragHelper=new Ee(m._id,{handle:m._id+"-handle",start:function(t){u=t[n],c=parseInt(m.getEl("handle").style[i],10),d=(m.layoutRect()[o]||100)-Pt.getSize(l)[r],m.fire("dragstart",{value:h})},drag:function(t){var e=t[n]-u;f=go(c+e,0,d),l.s
tyle[i]=f+"px",h=s+f/d*(a-s),m.value(h),m.tooltip().text(""+m.settings.previewFilter(h)).show().moveRel(l,"bc tc"),m.fire("drag",{value:h})},stop:function(){m.tooltip().hide(),m.fire("dragend",{value:h})}})},repaint:function(){this._super(),vo(this,this.value())},bindStates:function(){var e=this;return e.state.on("change:value",function(t){vo(e,t.value)}),e._super()}}),bo=xe.extend({renderHtml:function(){return this.classes.add("spacer"),this.canFocus=!1,'<div id="'+this._id+'" class="'+this.classes+'"></div>'}}),xo=oo.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var t,e,n=this.getEl(),i=this.layoutRect();return this._super(),t=n.firstChild,e=n.lastChild,Nt(t).css({width:i.w-Pt.getSize(e).width,height:i.h-2}),Nt(e).css({height:i.h-2}),this},activeMenu:function(t){Nt(this.getEl().lastChild).toggleClass(this.classPrefix+"ac
tive",t)},renderHtml:function(){var t,e,n=this,i=n._id,r=n.classPrefix,o=n.state.get("icon"),s=n.state.get("text"),a=n.settings,l="";return(t=a.image)?(o="none","string"!=typeof t&&(t=window.getSelection?t[0]:t[1]),t=" style=\"background-image: url('"+t+"')\""):t="",o=a.icon?r+"ico "+r+"i-"+o:"",s&&(n.classes.add("btn-has-text"),l='<span class="'+r+'txt">'+n.encode(s)+"</span>"),e="boolean"==typeof a.active?' aria-pressed="'+a.active+'"':"",'<div id="'+i+'" class="'+n.classes+'" role="button"'+e+' tabindex="-1"><button type="button" hidefocus="1" tabindex="-1">'+(o?'<i class="'+o+'"'+t+"></i>":"")+l+'</button><button type="button" cl
ass="'+r+'open" hidefocus="1" tabindex="-1">'+(n._menuBtnText?(o?"\xa0":"")+n._menuBtnText:"")+' <i class="'+r+'caret"></i></button></div>'},postRender:function(){var n=this.settings.onclick;return this.on("click",function(t){var e=t.target;if(t.control===this)for(;e;){if(t.aria&&"down"!==t.aria.key||"BUTTON"===e.nodeName&&-1===e.className.indexOf("open"))return t.stopImmediatePropagation(),void(n&&n.call(this,t));e=e.parentNode}}),delete this.settings.onclick,this._super()}}),wo=Cr.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"},isNative:function(){return!0}}),_o=Be.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(n){var t;this.activeTabId&&(t=this.getEl(this.activeTabId),Nt(t).remove
Class(this.classPrefix+"active"),t.setAttribute("aria-selected","false")),this.activeTabId="t"+n,(t=this.getEl("t"+n)).setAttribute("aria-selected","true"),Nt(t).addClass(this.classPrefix+"active"),this.items()[n].show().fire("showtab"),this.reflow(),this.items().each(function(t,e){n!==e&&t.hide()})},renderHtml:function(){var i=this,t=i._layout,r="",o=i.classPrefix;return i.preRender(),t.preRender(i),i.items().each(function(t,e){var n=i._id+"-t"+e;t.aria("role","tabpanel"),t.aria("labelledby",n),r+='<div id="'+n+'" class="'+o+'tab" unselectable="on" role="tab" aria-controls="'+t._id+'" aria-selected="false" tabIndex="-1">'+i.encode(t.settings.title)+"</div>"}),'<div id="'+i._id+'" class="'+i.classes+'" hidefocus="1"
; tabindex="-1"><div id="'+i._id+'-head" class="'+o+'tabs" role="tablist">'+r+'</div><div id="'+i._id+'-body" class="'+i.bodyClasses+'">'+t.renderHtml(i)+"</div></div>"},postRender:function(){var i=this;i._super(),i.settings.activeTab=i.settings.activeTab||0,i.activateTab(i.settings.activeTab),this.on("click",function(t){var e=t.target.parentNode;if(e&&e.id===i._id+"-head")for(var n=e.childNodes.length;n--;)e.childNodes[n]===t.target&&i.activateTab(n)})},initLayoutRect:function(){var t,e,n,i=this;e=(e=Pt.getSize(i.getEl("head")).width)<0?0:e,n=0,i.items().each(function(t){e=Math.max(e,t.layoutRect().minW),n=Math.max(n,t.layoutRect().minH)}),i.items().each(function(t){t.settings.x=0,t.settings.y=0,t.settings.w=e,t.settings.h=n,t.layoutRect({x:0,y:0,w:e,h:n})});var r=Pt.getSize(i.getEl("head")).height;return i.settings.minWid
th=e,i.settings.minHeight=n+r,(t=i._super()).deltaH+=r,t.innerH=t.h-t.deltaH,t}}),Ro=xe.extend({init:function(t){var n=this;n._super(t),n.classes.add("textbox"),t.multiline?n.classes.add("multiline"):(n.on("keydown",function(t){var e;13===t.keyCode&&(t.preventDefault(),n.parents().reverse().each(function(t){if(t.toJSON)return e=t,!1}),n.fire("submit",{data:e.toJSON()}))}),n.on("keyup",function(t){n.state.set("value",t.target.value)}))},repaint:function(){var t,e,n,i,r,o=this,s=0;t=o.getEl().style,e=o._layoutRect,r=o._lastRepaintRect||{};var a=document;return!o.settings.multiline&&a.all&&(!a.documentMode||a.documentMode<=8)&&(t.lineHeight=e.h-s+"px"),i=(n=o.borderBox).left+n.right+8,s=n.top+n.bottom+(o.settings.multiline?8:0),e.x!==r.x&&(t.left=e.x+"px",r.x=e.x),e.y!==r.y&&(t.top=e.y+"px",r.y=e.y),e.w!==r.w&&(t.width=e.w-i+"px"
,r.w=e.w),e.h!==r.h&&(t.height=e.h-s+"px",r.h=e.h),o._lastRepaintRect=r,o.fire("repaint",{},!1),o},renderHtml:function(){var e,t,n=this,i=n.settings;return e={id:n._id,hidefocus:"1"},R.each(["rows","spellcheck","maxLength","size","readonly","min","max","step","list","pattern","placeholder","required","multiple"],function(t){e[t]=i[t]}),n.disabled()&&(e.disabled="disabled"),i.subtype&&(e.type=i.subtype),(t=Pt.create(i.multiline?"textarea":"input",e)).value=n.state.get("value"),t.className=n.classes,t.outerHTML},value:function(t){return arguments.length?(this.state.set("value",t),this):(this.state.get("rendered")&&this.state.set("value",this.getEl().value),this.state.get("value"))},postRender:function(){var e=this;e.g
etEl().value=e.state.get("value"),e._super(),e.$el.on("change",function(t){e.state.set("value",t.target.value),e.fire("change",t)})},bindStates:function(){var e=this;return e.state.on("change:value",function(t){e.getEl().value!==t.value&&(e.getEl().value=t.value)}),e.state.on("change:disabled",function(t){e.getEl().disabled=t.value}),e._super()},remove:function(){this.$el.off(),this._super()}}),Co=function(){return{Selector:$t,Collection:Jt,ReflowQueue:ie,Control:fe,Factory:He,KeyboardNavigation:Me,Container:De,DragHelper:Ee,Scrollable:Ae,Panel:Be,Movable:ye,Resizable:Le,FloatPanel:je,Window:Ke,MessageBox:Ze,Tooltip:be,Widget:xe,Progress:we,Notification:Re,Layout:Dn,AbsoluteLayout:An,Button:Bn,ButtonGroup:In,Checkbox:zn,ComboBox:Vn,ColorBox:qn,PanelButton:Un,ColorButton:$n,ColorPicker:Xn,Path:Gn,ElementPath:Kn,FormItem:Zn,Form:Qn,FieldSet:ti,FilePicker:wr,FitLayout:_r,FlexLayout:Rr,FlowLayout:Cr,FormatControls:Zr,Gr
idLayout:Qr,Iframe:to,InfoBox:eo,Label:no,Toolbar:io,MenuBar:ro,MenuButton:oo,MenuItem:uo,Throbber:so,Menu:ao,ListBox:lo,Radio:co,ResizeHandle:fo,SelectBox:mo,Slider:yo,Spacer:bo,SplitButton:xo,StackLayout:wo,TabPanel:_o,TextBox:Ro,DropZone:Jn,BrowseButton:Ln}},ko=function(n){n.ui?R.each(Co(),function(t,e){n.ui[e]=t}):n.ui=Co()};R.each(Co(),function(t,e){He.add(e,t)}),ko(window.tinymce?window.tinymce:{}),o.add("inlite",function(t){var e=On();return Zr.setup(t),Hn(t,e),Qe(t,e)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcethemesmodernthemejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/themes/modern/theme.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/themes/modern/theme.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/themes/modern/theme.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,1681 +1,10450 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var modern = (function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = tinymce.util.Tools.resolve('tinymce.ThemeManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$1 = tinymce.util.Tools.resolve('tinymce.EditorManager');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isBrandingEnabled = function (editor) {
+ return editor.getParam('branding', true, 'boolean');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
-
-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
-
-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
-
-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasMenubar = function (editor) {
+ return getMenubar(editor) !== false;
+ };
+ var getMenubar = function (editor) {
+ return editor.getParam('menubar');
+ };
+ var hasStatusbar = function (editor) {
+ return editor.getParam('statusbar', true, 'boolean');
+ };
+ var getToolbarSize = function (editor) {
+ return editor.getParam('toolbar_items_size');
+ };
+ var isReadOnly = function (editor) {
+ return editor.getParam('readonly', false, 'boolean');
+ };
+ var getFixedToolbarContainer = function (editor) {
+ return editor.getParam('fixed_toolbar_container');
+ };
+ var getInlineToolbarPositionHandler = function (editor) {
+ return editor.getParam('inline_toolbar_position_handler');
+ };
+ var getMenu = function (editor) {
+ return editor.getParam('menu');
+ };
+ var getRemovedMenuItems = function (editor) {
+ return editor.getParam('removed_menuitems', '');
+ };
+ var getMinWidth = function (editor) {
+ return editor.getParam('min_width', 100, 'number');
+ };
+ var getMinHeight = function (editor) {
+ return editor.getParam('min_height', 100, 'number');
+ };
+ var getMaxWidth = function (editor) {
+ return editor.getParam('max_width', 65535, 'number');
+ };
+ var getMaxHeight = function (editor) {
+ return editor.getParam('max_height', 65535, 'number');
+ };
+ var isSkinDisabled = function (editor) {
+ return editor.settings.skin === false;
+ };
+ var isInline = function (editor) {
+ return editor.getParam('inline', false, 'boolean');
+ };
+ var getResize = function (editor) {
+ var resize = editor.getParam('resize', 'vertical');
+ if (resize === false) {
+ return 'none';
+ } else if (resize === 'both') {
+ return 'both';
+ } else {
+ return 'vertical';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getSkinUrl = function (editor) {
+ var settings = editor.settings;
+ var skin = settings.skin;
+ var skinUrl = settings.skin_url;
+ if (skin !== false) {
+ var skinName = skin ? skin : 'lightgray';
+ if (skinUrl) {
+ skinUrl = editor.documentBaseURI.toAbsolute(skinUrl);
+ } else {
+ skinUrl = global$1.baseURL + '/skins/' + skinName;
+ }
+ }
+ return skinUrl;
+ };
+ var getIndexedToolbars = function (settings, defaultToolbar) {
+ var toolbars = [];
+ for (var i = 1; i < 10; i++) {
+ var toolbar_1 = settings['toolbar' + i];
+ if (!toolbar_1) {
+ break;
+ }
+ toolbars.push(toolbar_1);
+ }
+ var mainToolbar = settings.toolbar ? [settings.toolbar] : [defaultToolbar];
+ return toolbars.length > 0 ? toolbars : mainToolbar;
+ };
+ var getToolbars = function (editor) {
+ var toolbar = editor.getParam('toolbar');
+ var defaultToolbar = 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image';
+ if (toolbar === false) {
+ return [];
+ } else if (global$2.isArray(toolbar)) {
+ return global$2.grep(toolbar, function (toolbar) {
+ return toolbar.length > 0;
+ });
+ } else {
+ return getIndexedToolbars(editor.settings, defaultToolbar);
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.themes.modern.Theme","global!window","tinymce.core.AddOnManager","tinymce.core.EditorManager","tinymce.core.Env","tinymce.core.ui.Api","tinymce.themes.modern.modes.Iframe","tinymce.themes.modern.modes.Inline","tinymce.themes.modern.ui.ProgressState","tinymce.themes.modern.ui.Resize","global!tinymce.util.Tools.resolve","tinymce.core.dom.DOMUtils","tinymce.core.ui.Factory","tinymce.core.util.Tools","tinymce.themes.modern.ui.A11y","tinymce.themes.modern.ui.Branding","tinymce.themes.modern.ui.ContextToolbars","tinymce.themes.modern.ui.Menubar","tinymce.themes.modern.ui.Sidebar","tinymce.themes.modern.ui.SkinLoaded","tinymce.themes.modern.ui.Toolbar","tinymce.core.ui.FloatPanel","tinymce.core.ui.Throbber","tinymce.core.util.Delay","tinym
ce.core.geom.Rect"]
-jsc*/
-defineGlobal("global!window", window);
-defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$3 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.AddOnManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.AddOnManager');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$4 = tinymce.util.Tools.resolve('tinymce.ui.Factory');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$5 = tinymce.util.Tools.resolve('tinymce.util.I18n');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.EditorManager',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.EditorManager');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fireSkinLoaded = function (editor) {
+ return editor.fire('SkinLoaded');
+ };
+ var fireResizeEditor = function (editor) {
+ return editor.fire('ResizeEditor');
+ };
+ var fireBeforeRenderUI = function (editor) {
+ return editor.fire('BeforeRenderUI');
+ };
+ var $_b6da16t0jfuw8sbv = {
+ fireSkinLoaded: fireSkinLoaded,
+ fireResizeEditor: fireResizeEditor,
+ fireBeforeRenderUI: fireBeforeRenderUI
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var focus = function (panel, type) {
+ return function () {
+ var item = panel.find(type)[0];
+ if (item) {
+ item.focus(true);
+ }
+ };
+ };
+ var addKeys = function (editor, panel) {
+ editor.shortcuts.add('Alt+F9', '', focus(panel, 'menubar'));
+ editor.shortcuts.add('Alt+F10,F10', '', focus(panel, 'toolbar'));
+ editor.shortcuts.add('Alt+F11', '', focus(panel, 'elementpath'));
+ panel.on('cancel', function () {
+ editor.focus();
+ });
+ };
+ var $_gaf3jet1jfuw8sbw = { addKeys: addKeys };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.Env',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.Env');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$6 = tinymce.util.Tools.resolve('tinymce.geom.Rect');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$7 = tinymce.util.Tools.resolve('tinymce.util.Delay');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.ui.Api',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.ui.Api');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var noop = function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ };
+ var noarg = function (f) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return f();
+ };
+ };
+ var compose = function (fa, fb) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return fa(fb.apply(null, arguments));
+ };
+ };
+ var constant = function (value) {
+ return function () {
+ return value;
+ };
+ };
+ var identity = function (x) {
+ return x;
+ };
+ var tripleEquals = function (a, b) {
+ return a === b;
+ };
+ var curry = function (f) {
+ var x = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ x[_i - 1] = arguments[_i];
+ }
+ var args = new Array(arguments.length - 1);
+ for (var i = 1; i < arguments.length; i++)
+ args[i - 1] = arguments[i];
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ var newArgs = new Array(arguments.length);
+ for (var j = 0; j < newArgs.length; j++)
+ newArgs[j] = arguments[j];
+ var all = args.concat(newArgs);
+ return f.apply(null, all);
+ };
+ };
+ var not = function (f) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return !f.apply(null, arguments);
+ };
+ };
+ var die = function (msg) {
+ return function () {
+ throw new Error(msg);
+ };
+ };
+ var apply = function (f) {
+ return f();
+ };
+ var call = function (f) {
+ f();
+ };
+ var never = constant(false);
+ var always = constant(true);
+ var $_cun2p5t7jfuw8scg = {
+ noop: noop,
+ noarg: noarg,
+ compose: compose,
+ constant: constant,
+ identity: identity,
+ tripleEquals: tripleEquals,
+ curry: curry,
+ not: not,
+ die: die,
+ apply: apply,
+ call: call,
+ never: never,
+ always: always
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var never$1 = $_cun2p5t7jfuw8scg.never;
+ var always$1 = $_cun2p5t7jfuw8scg.always;
+ var none = function () {
+ return NONE;
+ };
+ var NONE = function () {
+ var eq = function (o) {
+ return o.isNone();
+ };
+ var call = function (thunk) {
+ return thunk();
+ };
+ var id = function (n) {
+ return n;
+ };
+ var noop = function () {
+ };
+ var me = {
+ fold: function (n, s) {
+ return n();
+ },
+ is: never$1,
+ isSome: never$1,
+ isNone: always$1,
+ getOr: id,
+ getOrThunk: call,
+ getOrDie: function (msg) {
+ throw new Error(msg || 'error: getOrDie called on none.');
+ },
+ or: id,
+ orThunk: call,
+ map: none,
+ ap: none,
+ each: noop,
+ bind: none,
+ flatten: none,
+ exists: never$1,
+ forall: always$1,
+ filter: none,
+ equals: eq,
+ equals_: eq,
+ toArray: function () {
+ return [];
+ },
+ toString: $_cun2p5t7jfuw8scg.constant('none()')
+ };
+ if (Object.freeze)
+ Object.freeze(me);
+ return me;
+ }();
+ var some = function (a) {
+ var constant_a = function () {
+ return a;
+ };
+ var self = function () {
+ return me;
+ };
+ var map = function (f) {
+ return some(f(a));
+ };
+ var bind = function (f) {
+ return f(a);
+ };
+ var me = {
+ fold: function (n, s) {
+ return s(a);
+ },
+ is: function (v) {
+ return a === v;
+ },
+ isSome: always$1,
+ isNone: never$1,
+ getOr: constant_a,
+ getOrThunk: constant_a,
+ getOrDie: constant_a,
+ or: self,
+ orThunk: self,
+ map: map,
+ ap: function (optfab) {
+ return optfab.fold(none, function (fab) {
+ return some(fab(a));
+ });
+ },
+ each: function (f) {
+ f(a);
+ },
+ bind: bind,
+ flatten: constant_a,
+ exists: bind,
+ forall: bind,
+ filter: function (f) {
+ return f(a) ? me : NONE;
+ },
+ equals: function (o) {
+ return o.is(a);
+ },
+ equals_: function (o, elementEq) {
+ return o.fold(never$1, function (b) {
+ return elementEq(a, b);
+ });
+ },
+ toArray: function () {
+ return [a];
+ },
+ toString: function () {
+ return 'some(' + a + ')';
+ }
+ };
+ return me;
+ };
+ var from = function (value) {
+ return value === null || value === undefined ? NONE : some(value);
+ };
+ var Option = {
+ some: some,
+ none: none,
+ from: from
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.dom.DOMUtils',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.dom.DOMUtils');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getUiContainerDelta = function (ctrl) {
+ var uiContainer = getUiContainer(ctrl);
+ if (uiContainer && global$3.DOM.getStyle(uiContainer, 'position', true) !== 'static') {
+ var containerPos = global$3.DOM.getPos(uiContainer);
+ var dx = uiContainer.scrollLeft - containerPos.x;
+ var dy = uiContainer.scrollTop - containerPos.y;
+ return Option.some({
+ x: dx,
+ y: dy
+ });
+ } else {
+ return Option.none();
+ }
+ };
+ var setUiContainer = function (editor, ctrl) {
+ var uiContainer = global$3.DOM.select(editor.settings.ui_container)[0];
+ ctrl.getRoot().uiContainer = uiContainer;
+ };
+ var getUiContainer = function (ctrl) {
+ return ctrl ? ctrl.getRoot().uiContainer : null;
+ };
+ var inheritUiContainer = function (fromCtrl, toCtrl) {
+ return toCtrl.uiContainer = getUiContainer(fromCtrl);
+ };
+ var $_435hnxt5jfuw8sc9 = {
+ getUiContainerDelta: getUiContainerDelta,
+ setUiContainer: setUiContainer,
+ getUiContainer: getUiContainer,
+ inheritUiContainer: inheritUiContainer
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ui.Factory',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.ui.Factory');
- }
-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.Tools',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Tools');
- }
-);
-
-/**
- * A11y.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.modern.ui.A11y',
- [
- ],
- function () {
- var focus = function (panel, type) {
- return function () {
- var item = panel.find(type)[0];
-
- if (item) {
- item.focus(true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createToolbar = function (editor, items, size) {
+ var toolbarItems = [];
+ var buttonGroup;
+ if (!items) {
+ return;
+ }
+ global$2.each(items.split(/[ ,]/), function (item) {
+ var itemName;
+ var bindSelectorChanged = function () {
+ var selection = editor.selection;
+ if (item.settings.stateSelector) {
+ selection.selectorChanged(item.settings.stateSelector, function (state) {
+ item.active(state);
+ }, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (item.settings.disabledStateSelector) {
+ selection.selectorChanged(item.settings.disabledStateSelector, function (state) {
+ item.disabled(state);
+ });
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (item === '|') {
+ buttonGroup = null;
+ } else {
+ if (!buttonGroup) {
+ buttonGroup = {
+ type: 'buttongroup',
+ items: []
+ };
+ toolbarItems.push(buttonGroup);
+ }
+ if (editor.buttons[item]) {
+ itemName = item;
+ item = editor.buttons[itemName];
+ if (typeof item === 'function') {
+ item = item();
+ }
+ item.type = item.type || 'button';
+ item.size = size;
+ item = global$4.create(item);
+ buttonGroup.items.push(item);
+ if (editor.initialized) {
+ bindSelectorChanged();
+ } else {
+ editor.on('init', bindSelectorChanged);
+ }
+ }
+ }
+ });
+ return {
+ type: 'toolbar',
+ layout: 'flow',
+ items: toolbarItems
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var addKeys = function (editor, panel) {
- editor.shortcuts.add('Alt+F9', '', focus(panel, 'menubar'));
- editor.shortcuts.add('Alt+F10,F10', '', focus(panel, 'toolbar'));
- editor.shortcuts.add('Alt+F11', '', focus(panel, 'elementpath'));
- panel.on('cancel', function () {
- editor.focus();
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var createToolbars = function (editor, size) {
+ var toolbars = [];
+ var addToolbar = function (items) {
+ if (items) {
+ toolbars.push(createToolbar(editor, items, size));
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global$2.each(getToolbars(editor), function (toolbar) {
+ addToolbar(toolbar);
+ });
+ if (toolbars.length) {
+ return {
+ type: 'panel',
+ layout: 'stack',
+ classes: 'toolbar-grp',
+ ariaRoot: true,
+ ariaRemember: true,
+ items: toolbars
+ };
+ }
+ };
+ var $_457dd7t8jfuw8scj = {
+ createToolbar: createToolbar,
+ createToolbars: createToolbars
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM = global$3.DOM;
+ var toClientRect = function (geomRect) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- addKeys: addKeys
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ left: geomRect.x,
+ top: geomRect.y,
+ width: geomRect.w,
+ height: geomRect.h,
+ right: geomRect.x + geomRect.w,
+ bottom: geomRect.y + geomRect.h
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Branding.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.modern.ui.Branding',
- [
- 'tinymce.core.dom.DOMUtils'
- ],
- function (DOMUtils) {
- var DOM = DOMUtils.DOM;
-
- var reposition = function (editor, poweredByElm, hasStatusbar) {
- return function () {
- var iframeWidth = editor.getContentAreaContainer().querySelector('iframe').offsetWidth;
- var scrollbarWidth = Math.max(iframeWidth - editor.getDoc().documentElement.offsetWidth, 0);
-
- DOM.setStyle(poweredByElm, 'right', scrollbarWidth + 'px');
- if (hasStatusbar) {
- DOM.setStyle(poweredByElm, 'top', '-16px');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var hideAllFloatingPanels = function (editor) {
+ global$2.each(editor.contextToolbars, function (toolbar) {
+ if (toolbar.panel) {
+ toolbar.panel.hide();
+ }
+ });
+ };
+ var movePanelTo = function (panel, pos) {
+ panel.moveTo(pos.left, pos.top);
+ };
+ var togglePositionClass = function (panel, relPos, predicate) {
+ relPos = relPos ? relPos.substr(0, 2) : '';
+ global$2.each({
+ t: 'down',
+ b: 'up'
+ }, function (cls, pos) {
+ panel.classes.toggle('arrow-' + cls, predicate(pos, relPos.substr(0, 1)));
+ });
+ global$2.each({
+ l: 'left',
+ r: 'right'
+ }, function (cls, pos) {
+ panel.classes.toggle('arrow-' + cls, predicate(pos, relPos.substr(1, 1)));
+ });
+ };
+ var userConstrain = function (handler, x, y, elementRect, contentAreaRect, panelRect) {
+ panelRect = toClientRect({
+ x: x,
+ y: y,
+ w: panelRect.w,
+ h: panelRect.h
+ });
+ if (handler) {
+ panelRect = handler({
+ elementRect: toClientRect(elementRect),
+ contentAreaRect: toClientRect(contentAreaRect),
+ panelRect: panelRect
+ });
+ }
+ return panelRect;
+ };
+ var addContextualToolbars = function (editor) {
+ var scrollContainer;
+ var getContextToolbars = function () {
+ return editor.contextToolbars || [];
+ };
+ var getElementRect = function (elm) {
+ var pos, targetRect, root;
+ pos = DOM.getPos(editor.getContentAreaContainer());
+ targetRect = editor.dom.getRect(elm);
+ root = editor.dom.getRoot();
+ if (root.nodeName === 'BODY') {
+ targetRect.x -= root.ownerDocument.documentElement.scrollLeft || root.scrollLeft;
+ targetRect.y -= root.ownerDocument.documentElement.scrollTop || root.scrollTop;
+ }
+ targetRect.x += pos.x;
+ targetRect.y += pos.y;
+ return targetRect;
+ };
+ var reposition = function (match, shouldShow) {
+ var relPos, panelRect, elementRect, contentAreaRect, panel, relRect, testPositions, smallElementWidthThreshold;
+ var handler = getInlineToolbarPositionHandler(editor);
+ if (editor.removed) {
+ return;
+ }
+ if (!match || !match.toolbar.panel) {
+ hideAllFloatingPanels(editor);
+ return;
+ }
+ testPositions = [
+ 'bc-tc',
+ 'tc-bc',
+ 'tl-bl',
+ 'bl-tl',
+ 'tr-br',
+ 'br-tr'
+ ];
+ panel = match.toolbar.panel;
+ if (shouldShow) {
+ panel.show();
+ }
+ elementRect = getElementRect(match.element);
+ panelRect = DOM.getRect(panel.getEl());
+ contentAreaRect = DOM.getRect(editor.getContentAreaContainer() || editor.getBody());
+ var delta = $_435hnxt5jfuw8sc9.getUiContainerDelta(panel).getOr({
+ x: 0,
+ y: 0
+ });
+ elementRect.x += delta.x;
+ elementRect.y += delta.y;
+ panelRect.x += delta.x;
+ panelRect.y += delta.y;
+ contentAreaRect.x += delta.x;
+ contentAreaRect.y += delta.y;
+ smallElementWidthThreshold = 25;
+ if (DOM.getStyle(match.element, 'display', true) !== 'inline') {
+ var clientRect = match.element.getBoundingClientRect();
+ elementRect.w = clientRect.width;
+ elementRect.h = clientRect.height;
+ }
+ if (!editor.inline) {
+ contentAreaRect.w = editor.getDoc().documentElement.offsetWidth;
+ }
+ if (editor.selection.controlSelection.isResizable(match.element) && elementRect.w < smallElementWidthThreshold) {
+ elementRect = global$6.inflate(elementRect, 0, 8);
+ }
+ relPos = global$6.findBestRelativePosition(panelRect, elementRect, contentAreaRect, testPositions);
+ elementRect = global$6.clamp(elementRect, contentAreaRect);
+ if (relPos) {
+ relRect = global$6.relativePosition(panelRect, elementRect, relPos);
+ movePanelTo(panel, userConstrain(handler, relRect.x, relRect.y, elementRect, contentAreaRect, panelRect));
+ } else {
+ contentAreaRect.h += panelRect.h;
+ elementRect = global$6.intersect(contentAreaRect, elementRect);
+ if (elementRect) {
+ relPos = global$6.findBestRelativePosition(panelRect, elementRect, contentAreaRect, [
+ 'bc-tc',
+ 'bl-tl',
+ 'br-tr'
+ ]);
+ if (relPos) {
+ relRect = global$6.relativePosition(panelRect, elementRect, relPos);
+ movePanelTo(panel, userConstrain(handler, relRect.x, relRect.y, elementRect, contentAreaRect, panelRect));
+ } else {
+ movePanelTo(panel, userConstrain(handler, elementRect.x, elementRect.y, elementRect, contentAreaRect, panelRect));
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- DOM.setStyle(poweredByElm, 'bottom', '1px');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ panel.hide();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ togglePositionClass(panel, relPos, function (pos1, pos2) {
+ return pos1 === pos2;
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var hide = function (poweredByElm) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var repositionHandler = function (show) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return function () {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- DOM.hide(poweredByElm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var execute = function () {
+ if (editor.selection) {
+ reposition(findFrontMostMatch(editor.selection.getNode()), show);
+ }
+ };
+ global$7.requestAnimationFrame(execute);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var bindScrollEvent = function (panel) {
+ if (!scrollContainer) {
+ var reposition_1 = repositionHandler(true);
+ var uiContainer_1 = $_435hnxt5jfuw8sc9.getUiContainer(panel);
+ scrollContainer = editor.selection.getScrollContainer() || editor.getWin();
+ DOM.bind(scrollContainer, 'scroll', reposition_1);
+ DOM.bind(uiContainer_1, 'scroll', reposition_1);
+ editor.on('remove', function () {
+ DOM.unbind(scrollContainer, 'scroll', reposition_1);
+ DOM.unbind(uiContainer_1, 'scroll', reposition_1);
+ });
+ }
+ };
+ var showContextToolbar = function (match) {
+ var panel;
+ if (match.toolbar.panel) {
+ match.toolbar.panel.show();
+ reposition(match);
+ return;
+ }
+ panel = global$4.create({
+ type: 'floatpanel',
+ role: 'dialog',
+ classes: 'tinymce tinymce-inline arrow',
+ ariaLabel: 'Inline toolbar',
+ layout: 'flex',
+ direction: 'column',
+ align: 'stretch',
+ autohide: false,
+ autofix: true,
+ fixed: true,
+ border: 1,
+ items: $_457dd7t8jfuw8scj.createToolbar(editor, match.toolbar.items),
+ oncancel: function () {
+ editor.focus();
+ }
+ });
+ $_435hnxt5jfuw8sc9.setUiContainer(editor, panel);
+ bindScrollEvent(panel);
+ match.toolbar.panel = panel;
+ panel.renderTo().reflow();
+ reposition(match);
+ };
+ var hideAllContextToolbars = function () {
+ global$2.each(getContextToolbars(), function (toolbar) {
+ if (toolbar.panel) {
+ toolbar.panel.hide();
+ }
+ });
+ };
+ var findFrontMostMatch = function (targetElm) {
+ var i, y, parentsAndSelf;
+ var toolbars = getContextToolbars();
+ parentsAndSelf = editor.$(targetElm).parents().add(targetElm);
+ for (i = parentsAndSelf.length - 1; i >= 0; i--) {
+ for (y = toolbars.length - 1; y >= 0; y--) {
+ if (toolbars[y].predicate(parentsAndSelf[i])) {
+ return {
+ toolbar: toolbars[y],
+ element: parentsAndSelf[i]
+ };
+ }
+ }
+ }
+ return null;
+ };
+ editor.on('click keyup setContent ObjectResized', function (e) {
+ if (e.type === 'setcontent' && !e.selection) {
+ return;
+ }
+ global$7.setEditorTimeout(editor, function () {
+ var match;
+ match = findFrontMostMatch(editor.selection.getNode());
+ if (match) {
+ hideAllContextToolbars();
+ showContextToolbar(match);
+ } else {
+ hideAllContextToolbars();
+ }
+ });
+ });
+ editor.on('blur hide contextmenu', hideAllContextToolbars);
+ editor.on('ObjectResizeStart', function () {
+ var match = findFrontMostMatch(editor.selection.getNode());
+ if (match && match.toolbar.panel) {
+ match.toolbar.panel.hide();
+ }
+ });
+ editor.on('ResizeEditor ResizeWindow', repositionHandler(true));
+ editor.on('nodeChange', repositionHandler(false));
+ editor.on('remove', function () {
+ global$2.each(getContextToolbars(), function (toolbar) {
+ if (toolbar.panel) {
+ toolbar.panel.remove();
+ }
+ });
+ editor.contextToolbars = {};
+ });
+ editor.shortcuts.add('ctrl+shift+e > ctrl+shift+p', '', function () {
+ var match = findFrontMostMatch(editor.selection.getNode());
+ if (match && match.toolbar.panel) {
+ match.toolbar.panel.items()[0].focus();
+ }
+ });
+ };
+ var $_v47mpt2jfuw8sc3 = { addContextualToolbars: addContextualToolbars };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var setupReposition = function (editor, poweredByElm, hasStatusbar) {
- reposition(editor, poweredByElm, hasStatusbar)();
- editor.on('NodeChange ResizeEditor', reposition(editor, poweredByElm, hasStatusbar));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var typeOf = function (x) {
+ if (x === null)
+ return 'null';
+ var t = typeof x;
+ if (t === 'object' && Array.prototype.isPrototypeOf(x))
+ return 'array';
+ if (t === 'object' && String.prototype.isPrototypeOf(x))
+ return 'string';
+ return t;
+ };
+ var isType = function (type) {
+ return function (value) {
+ return typeOf(value) === type;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_e8diihtbjfuw8scy = {
+ isString: isType('string'),
+ isObject: isType('object'),
+ isArray: isType('array'),
+ isNull: isType('null'),
+ isBoolean: isType('boolean'),
+ isUndefined: isType('undefined'),
+ isFunction: isType('function'),
+ isNumber: isType('number')
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var appendToStatusbar = function (editor, poweredByElm, statusbarElm) {
- statusbarElm.appendChild(poweredByElm);
- setupReposition(editor, poweredByElm, true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var rawIndexOf = function () {
+ var pIndexOf = Array.prototype.indexOf;
+ var fastIndex = function (xs, x) {
+ return pIndexOf.call(xs, x);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var slowIndex = function (xs, x) {
+ return slowIndexOf(xs, x);
+ };
+ return pIndexOf === undefined ? slowIndex : fastIndex;
+ }();
+ var indexOf = function (xs, x) {
+ var r = rawIndexOf(xs, x);
+ return r === -1 ? Option.none() : Option.some(r);
+ };
+ var contains = function (xs, x) {
+ return rawIndexOf(xs, x) > -1;
+ };
+ var exists = function (xs, pred) {
+ return findIndex(xs, pred).isSome();
+ };
+ var range = function (num, f) {
+ var r = [];
+ for (var i = 0; i < num; i++) {
+ r.push(f(i));
+ }
+ return r;
+ };
+ var chunk = function (array, size) {
+ var r = [];
+ for (var i = 0; i < array.length; i += size) {
+ var s = array.slice(i, i + size);
+ r.push(s);
+ }
+ return r;
+ };
+ var map = function (xs, f) {
+ var len = xs.length;
+ var r = new Array(len);
+ for (var i = 0; i < len; i++) {
+ var x = xs[i];
+ r[i] = f(x, i, xs);
+ }
+ return r;
+ };
+ var each = function (xs, f) {
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ f(x, i, xs);
+ }
+ };
+ var eachr = function (xs, f) {
+ for (var i = xs.length - 1; i >= 0; i--) {
+ var x = xs[i];
+ f(x, i, xs);
+ }
+ };
+ var partition = function (xs, pred) {
+ var pass = [];
+ var fail = [];
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ var arr = pred(x, i, xs) ? pass : fail;
+ arr.push(x);
+ }
+ return {
+ pass: pass,
+ fail: fail
+ };
+ };
+ var filter = function (xs, pred) {
+ var r = [];
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ if (pred(x, i, xs)) {
+ r.push(x);
+ }
+ }
+ return r;
+ };
+ var groupBy = function (xs, f) {
+ if (xs.length === 0) {
+ return [];
+ } else {
+ var wasType = f(xs[0]);
+ var r = [];
+ var group = [];
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ var type = f(x);
+ if (type !== wasType) {
+ r.push(group);
+ group = [];
+ }
+ wasType = type;
+ group.push(x);
+ }
+ if (group.length !== 0) {
+ r.push(group);
+ }
+ return r;
+ }
+ };
+ var foldr = function (xs, f, acc) {
+ eachr(xs, function (x) {
+ acc = f(acc, x);
+ });
+ return acc;
+ };
+ var foldl = function (xs, f, acc) {
+ each(xs, function (x) {
+ acc = f(acc, x);
+ });
+ return acc;
+ };
+ var find = function (xs, pred) {
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ if (pred(x, i, xs)) {
+ return Option.some(x);
+ }
+ }
+ return Option.none();
+ };
+ var findIndex = function (xs, pred) {
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ if (pred(x, i, xs)) {
+ return Option.some(i);
+ }
+ }
+ return Option.none();
+ };
+ var slowIndexOf = function (xs, x) {
+ for (var i = 0, len = xs.length; i < len; ++i) {
+ if (xs[i] === x) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ var push = Array.prototype.push;
+ var flatten = function (xs) {
+ var r = [];
+ for (var i = 0, len = xs.length; i < len; ++i) {
+ if (!Array.prototype.isPrototypeOf(xs[i]))
+ throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
+ push.apply(r, xs[i]);
+ }
+ return r;
+ };
+ var bind = function (xs, f) {
+ var output = map(xs, f);
+ return flatten(output);
+ };
+ var forall = function (xs, pred) {
+ for (var i = 0, len = xs.length; i < len; ++i) {
+ var x = xs[i];
+ if (pred(x, i, xs) !== true) {
+ return false;
+ }
+ }
+ return true;
+ };
+ var equal = function (a1, a2) {
+ return a1.length === a2.length && forall(a1, function (x, i) {
+ return x === a2[i];
+ });
+ };
+ var slice = Array.prototype.slice;
+ var reverse = function (xs) {
+ var r = slice.call(xs, 0);
+ r.reverse();
+ return r;
+ };
+ var difference = function (a1, a2) {
+ return filter(a1, function (x) {
+ return !contains(a2, x);
+ });
+ };
+ var mapToObject = function (xs, f) {
+ var r = {};
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ r[String(x)] = f(x, i);
+ }
+ return r;
+ };
+ var pure = function (x) {
+ return [x];
+ };
+ var sort = function (xs, comparator) {
+ var copy = slice.call(xs, 0);
+ copy.sort(comparator);
+ return copy;
+ };
+ var head = function (xs) {
+ return xs.length === 0 ? Option.none() : Option.some(xs[0]);
+ };
+ var last = function (xs) {
+ return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);
+ };
+ var from$1 = $_e8diihtbjfuw8scy.isFunction(Array.from) ? Array.from : function (x) {
+ return slice.call(x);
+ };
+ var $_anxm1mtajfuw8sct = {
+ map: map,
+ each: each,
+ eachr: eachr,
+ partition: partition,
+ filter: filter,
+ groupBy: groupBy,
+ indexOf: indexOf,
+ foldr: foldr,
+ foldl: foldl,
+ find: find,
+ findIndex: findIndex,
+ flatten: flatten,
+ bind: bind,
+ forall: forall,
+ exists: exists,
+ contains: contains,
+ equal: equal,
+ reverse: reverse,
+ chunk: chunk,
+ difference: difference,
+ mapToObject: mapToObject,
+ pure: pure,
+ sort: sort,
+ range: range,
+ head: head,
+ last: last,
+ from: from$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var appendToContainer = function (editor, poweredByElm) {
- editor.getContainer().appendChild(poweredByElm);
- setupReposition(editor, poweredByElm, false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var defaultMenus = {
+ file: {
+ title: 'File',
+ items: 'newdocument restoredraft | preview | print'
+ },
+ edit: {
+ title: 'Edit',
+ items: 'undo redo | cut copy paste pastetext | selectall'
+ },
+ view: {
+ title: 'View',
+ items: 'code | visualaid visualchars visualblocks | spellchecker | preview fullscreen'
+ },
+ insert: {
+ title: 'Insert',
+ items: 'image link media template codesample inserttable | charmap hr | pagebreak nonbreaking anchor toc | insertdatetime'
+ },
+ format: {
+ title: 'Format',
+ items: 'bold italic underline strikethrough superscript subscript codeformat | blockformats align | removeformat'
+ },
+ tools: {
+ title: 'Tools',
+ items: 'spellchecker spellcheckerlanguage | a11ycheck'
+ },
+ table: { title: 'Table' },
+ help: { title: 'Help' }
+ };
+ var delimiterMenuNamePair = function () {
+ return {
+ name: '|',
+ item: { text: '|' }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var createMenuNameItemPair = function (name, item) {
+ var menuItem = item ? {
+ name: name,
+ item: item
+ } : null;
+ return name === '|' ? delimiterMenuNamePair() : menuItem;
+ };
+ var hasItemName = function (namedMenuItems, name) {
+ return $_anxm1mtajfuw8sct.findIndex(namedMenuItems, function (namedMenuItem) {
+ return namedMenuItem.name === name;
+ }).isSome();
+ };
+ var isSeparator = function (namedMenuItem) {
+ return namedMenuItem && namedMenuItem.item.text === '|';
+ };
+ var cleanupMenu = function (namedMenuItems, removedMenuItems) {
+ var menuItemsPass1 = $_anxm1mtajfuw8sct.filter(namedMenuItems, function (namedMenuItem) {
+ return removedMenuItems.hasOwnProperty(namedMenuItem.name) === false;
+ });
+ var menuItemsPass2 = $_anxm1mtajfuw8sct.filter(menuItemsPass1, function (namedMenuItem, i, namedMenuItems) {
+ return !isSeparator(namedMenuItem) || !isSeparator(namedMenuItems[i - 1]);
+ });
+ return $_anxm1mtajfuw8sct.filter(menuItemsPass2, function (namedMenuItem, i, namedMenuItems) {
+ return !isSeparator(namedMenuItem) || i > 0 && i < namedMenuItems.length - 1;
+ });
+ };
+ var createMenu = function (editorMenuItems, menus, removedMenuItems, context) {
+ var menuButton, menu, namedMenuItems, isUserDefined;
+ if (menus) {
+ menu = menus[context];
+ isUserDefined = true;
+ } else {
+ menu = defaultMenus[context];
+ }
+ if (menu) {
+ menuButton = { text: menu.title };
+ namedMenuItems = [];
+ global$2.each((menu.items || '').split(/[ ,]/), function (name) {
+ var namedMenuItem = createMenuNameItemPair(name, editorMenuItems[name]);
+ if (namedMenuItem) {
+ namedMenuItems.push(namedMenuItem);
+ }
+ });
+ if (!isUserDefined) {
+ global$2.each(editorMenuItems, function (item, name) {
+ if (item.context === context && !hasItemName(namedMenuItems, name)) {
+ if (item.separator === 'before') {
+ namedMenuItems.push(delimiterMenuNamePair());
+ }
+ if (item.prependToContext) {
+ namedMenuItems.unshift(createMenuNameItemPair(name, item));
+ } else {
+ namedMenuItems.push(createMenuNameItemPair(name, item));
+ }
+ if (item.separator === 'after') {
+ namedMenuItems.push(delimiterMenuNamePair());
+ }
+ }
+ });
+ }
+ menuButton.menu = $_anxm1mtajfuw8sct.map(cleanupMenu(namedMenuItems, removedMenuItems), function (menuItem) {
+ return menuItem.item;
+ });
+ if (!menuButton.menu.length) {
+ return null;
+ }
+ }
+ return menuButton;
+ };
+ var getDefaultMenubar = function (editor) {
+ var name;
+ var defaultMenuBar = [];
+ var menu = getMenu(editor);
+ if (menu) {
+ for (name in menu) {
+ defaultMenuBar.push(name);
+ }
+ } else {
+ for (name in defaultMenus) {
+ defaultMenuBar.push(name);
+ }
+ }
+ return defaultMenuBar;
+ };
+ var createMenuButtons = function (editor) {
+ var menuButtons = [];
+ var defaultMenuBar = getDefaultMenubar(editor);
+ var removedMenuItems = global$2.makeMap(getRemovedMenuItems(editor).split(/[ ,]/));
+ var menubar = getMenubar(editor);
+ var enabledMenuNames = typeof menubar === 'string' ? menubar.split(/[ ,]/) : defaultMenuBar;
+ for (var i = 0; i < enabledMenuNames.length; i++) {
+ var menuItems = enabledMenuNames[i];
+ var menu = createMenu(editor.menuItems, getMenu(editor), removedMenuItems, menuItems);
+ if (menu) {
+ menuButtons.push(menu);
+ }
+ }
+ return menuButtons;
+ };
+ var $_armr7nt9jfuw8scm = { createMenuButtons: createMenuButtons };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var setupEventListeners = function (editor) {
- editor.on('SkinLoaded', function () {
- var poweredByElm = DOM.create('div', { 'class': 'mce-branding-powered-by' });
- var statusbarElm = editor.getContainer().querySelector('.mce-statusbar');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$1 = global$3.DOM;
+ var getSize = function (elm) {
+ return {
+ width: elm.clientWidth,
+ height: elm.clientHeight
+ };
+ };
+ var resizeTo = function (editor, width, height) {
+ var containerElm, iframeElm, containerSize, iframeSize;
+ containerElm = editor.getContainer();
+ iframeElm = editor.getContentAreaContainer().firstChild;
+ containerSize = getSize(containerElm);
+ iframeSize = getSize(iframeElm);
+ if (width !== null) {
+ width = Math.max(getMinWidth(editor), width);
+ width = Math.min(getMaxWidth(editor), width);
+ DOM$1.setStyle(containerElm, 'width', width + (containerSize.width - iframeSize.width));
+ DOM$1.setStyle(iframeElm, 'width', width);
+ }
+ height = Math.max(getMinHeight(editor), height);
+ height = Math.min(getMaxHeight(editor), height);
+ DOM$1.setStyle(iframeElm, 'height', height);
+ $_b6da16t0jfuw8sbv.fireResizeEditor(editor);
+ };
+ var resizeBy = function (editor, dw, dh) {
+ var elm = editor.getContentAreaContainer();
+ resizeTo(editor, elm.clientWidth + dw, elm.clientHeight + dh);
+ };
+ var $_4yyb9xtcjfuw8scz = {
+ resizeTo: resizeTo,
+ resizeBy: resizeBy
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (statusbarElm) {
- appendToStatusbar(editor, poweredByElm, statusbarElm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$8 = tinymce.util.Tools.resolve('tinymce.Env');
+
+ var api = function (elm) {
+ return {
+ element: function () {
+ return elm;
+ }
+ };
+ };
+ var trigger = function (sidebar, panel, callbackName) {
+ var callback = sidebar.settings[callbackName];
+ if (callback) {
+ callback(api(panel.getEl('body')));
+ }
+ };
+ var hidePanels = function (name, container, sidebars) {
+ global$2.each(sidebars, function (sidebar) {
+ var panel = container.items().filter('#' + sidebar.name)[0];
+ if (panel && panel.visible() && sidebar.name !== name) {
+ trigger(sidebar, panel, 'onhide');
+ panel.visible(false);
+ }
+ });
+ };
+ var deactivateButtons = function (toolbar) {
+ toolbar.items().each(function (ctrl) {
+ ctrl.active(false);
+ });
+ };
+ var findSidebar = function (sidebars, name) {
+ return global$2.grep(sidebars, function (sidebar) {
+ return sidebar.name === name;
+ })[0];
+ };
+ var showPanel = function (editor, name, sidebars) {
+ return function (e) {
+ var btnCtrl = e.control;
+ var container = btnCtrl.parents().filter('panel')[0];
+ var panel = container.find('#' + name)[0];
+ var sidebar = findSidebar(sidebars, name);
+ hidePanels(name, container, sidebars);
+ deactivateButtons(btnCtrl.parent());
+ if (panel && panel.visible()) {
+ trigger(sidebar, panel, 'onhide');
+ panel.hide();
+ btnCtrl.active(false);
+ } else {
+ if (panel) {
+ panel.show();
+ trigger(sidebar, panel, 'onshow');
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- appendToContainer(editor, poweredByElm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ panel = global$4.create({
+ type: 'container',
+ name: name,
+ layout: 'stack',
+ classes: 'sidebar-panel',
+ html: ''
+ });
+ container.prepend(panel);
+ trigger(sidebar, panel, 'onrender');
+ trigger(sidebar, panel, 'onshow');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ btnCtrl.active(true);
+ }
+ $_b6da16t0jfuw8sbv.fireResizeEditor(editor);
+ };
+ };
+ var isModernBrowser = function () {
+ return !global$8.ie || global$8.ie >= 11;
+ };
+ var hasSidebar = function (editor) {
+ return isModernBrowser() && editor.sidebars ? editor.sidebars.length > 0 : false;
+ };
+ var createSidebar = function (editor) {
+ var buttons = global$2.map(editor.sidebars, function (sidebar) {
+ var settings = sidebar.settings;
+ return {
+ type: 'button',
+ icon: settings.icon,
+ image: settings.image,
+ tooltip: settings.tooltip,
+ onclick: showPanel(editor, sidebar.name, editor.sidebars)
+ };
+ });
+ return {
+ type: 'panel',
+ name: 'sidebar',
+ layout: 'stack',
+ classes: 'sidebar',
+ items: [{
+ type: 'toolbar',
+ layout: 'stack',
+ classes: 'sidebar-toolbar',
+ items: buttons
+ }]
+ };
+ };
+ var $_g06972tdjfuw8sd2 = {
+ hasSidebar: hasSidebar,
+ createSidebar: createSidebar
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- DOM.bind(poweredByElm, 'click', hide(poweredByElm));
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fireSkinLoaded$1 = function (editor) {
+ var done = function () {
+ editor._skinLoaded = true;
+ $_b6da16t0jfuw8sbv.fireSkinLoaded(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var setup = function (editor) {
- if (editor.settings.branding !== false) {
- setupEventListeners(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return function () {
+ if (editor.initialized) {
+ done();
+ } else {
+ editor.on('init', done);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_g47gistfjfuw8sd5 = { fireSkinLoaded: fireSkinLoaded$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$2 = global$3.DOM;
+ var switchMode = function (panel) {
+ return function (e) {
+ panel.find('*').disabled(e.mode === 'readonly');
+ };
+ };
+ var editArea = function (border) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- setup: setup
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type: 'panel',
+ name: 'iframe',
+ layout: 'stack',
+ classes: 'edit-area',
+ border: border,
+ html: ''
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var editAreaContainer = function (editor) {
+ return {
+ type: 'panel',
+ layout: 'stack',
+ classes: 'edit-aria-container',
+ border: '1 0 0 0',
+ items: [
+ editArea('0'),
+ $_g06972tdjfuw8sd2.createSidebar(editor)
+ ]
+ };
+ };
+ var render = function (editor, theme, args) {
+ var panel, resizeHandleCtrl, startSize;
+ if (isSkinDisabled(editor) === false && args.skinUiCss) {
+ DOM$2.styleSheetLoader.load(args.skinUiCss, $_g47gistfjfuw8sd5.fireSkinLoaded(editor));
+ } else {
+ $_g47gistfjfuw8sd5.fireSkinLoaded(editor)();
+ }
+ panel = theme.panel = global$4.create({
+ type: 'panel',
+ role: 'application',
+ classes: 'tinymce',
+ style: 'visibility: hidden',
+ layout: 'stack',
+ border: 1,
+ items: [
+ {
+ type: 'container',
+ classes: 'top-part',
+ items: [
+ hasMenubar(editor) === false ? null : {
+ type: 'menubar',
+ border: '0 0 1 0',
+ items: $_armr7nt9jfuw8scm.createMenuButtons(editor)
+ },
+ $_457dd7t8jfuw8scj.createToolbars(editor, getToolbarSize(editor))
+ ]
+ },
+ $_g06972tdjfuw8sd2.hasSidebar(editor) ? editAreaContainer(editor) : editArea('1 0 0 0')
+ ]
+ });
+ $_435hnxt5jfuw8sc9.setUiContainer(editor, panel);
+ if (getResize(editor) !== 'none') {
+ resizeHandleCtrl = {
+ type: 'resizehandle',
+ direction: getResize(editor),
+ onResizeStart: function () {
+ var elm = editor.getContentAreaContainer().firstChild;
+ startSize = {
+ width: elm.clientWidth,
+ height: elm.clientHeight
+ };
+ },
+ onResize: function (e) {
+ if (getResize(editor) === 'both') {
+ $_4yyb9xtcjfuw8scz.resizeTo(editor, startSize.width + e.deltaX, startSize.height + e.deltaY);
+ } else {
+ $_4yyb9xtcjfuw8scz.resizeTo(editor, null, startSize.height + e.deltaY);
+ }
+ }
+ };
+ }
+ if (hasStatusbar(editor)) {
+ var linkHtml = '<a href="https://www.tinymce.com/?utm_campaign=editor_referral&utm_medium=poweredby&utm_source=tinymce" rel="noopener" target="_blank" role="presentation" tabindex="-1">tinymce</a>';
+ var html = global$5.translate([
+ 'Powered by {0}',
+ linkHtml
+ ]);
+ var brandingLabel = isBrandingEnabled(editor) ? {
+ type: 'label',
+ classes: 'branding',
+ html: ' ' + html
+ } : null;
+ panel.add({
+ type: 'panel',
+ name: 'statusbar',
+ classes: 'statusbar',
+ layout: 'flow',
+ border: '1 0 0 0',
+ ariaRoot: true,
+ items: [
+ {
+ type: 'elementpath',
+ editor: editor
+ },
+ resizeHandleCtrl,
+ brandingLabel
+ ]
+ });
+ }
+ $_b6da16t0jfuw8sbv.fireBeforeRenderUI(editor);
+ editor.on('SwitchMode', switchMode(panel));
+ panel.renderBefore(args.targetNode).reflow();
+ if (isReadOnly(editor)) {
+ editor.setMode('readonly');
+ }
+ if (args.width) {
+ DOM$2.setStyle(panel.getEl(), 'width', args.width);
+ }
+ editor.on('remove', function () {
+ panel.remove();
+ panel = null;
+ });
+ $_gaf3jet1jfuw8sbw.addKeys(editor, panel);
+ $_v47mpt2jfuw8sc3.addContextualToolbars(editor);
+ return {
+ iframeContainer: panel.find('#iframe')[0].getEl(),
+ editorContainer: panel.getEl()
+ };
+ };
+ var $_6amrhfswjfuw8sbr = { render: render };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$9 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.util.Delay',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.util.Delay');
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var count = 0;
+ var funcs = {
+ id: function () {
+ return 'mceu_' + count++;
+ },
+ create: function (name, attrs, children) {
+ var elm = document.createElement(name);
+ global$3.DOM.setAttribs(elm, attrs);
+ if (typeof children === 'string') {
+ elm.innerHTML = children;
+ } else {
+ global$2.each(children, function (child) {
+ if (child.nodeType) {
+ elm.appendChild(child);
+ }
+ });
+ }
+ return elm;
+ },
+ createFragment: function (html) {
+ return global$3.DOM.createFragment(html);
+ },
+ getWindowSize: function () {
+ return global$3.DOM.getViewPort();
+ },
+ getSize: function (elm) {
+ var width, height;
+ if (elm.getBoundingClientRect) {
+ var rect = elm.getBoundingClientRect();
+ width = Math.max(rect.width || rect.right - rect.left, elm.offsetWidth);
+ height = Math.max(rect.height || rect.bottom - rect.bottom, elm.offsetHeight);
+ } else {
+ width = elm.offsetWidth;
+ height = elm.offsetHeight;
+ }
+ return {
+ width: width,
+ height: height
+ };
+ },
+ getPos: function (elm, root) {
+ return global$3.DOM.getPos(elm, root || funcs.getContainer());
+ },
+ getContainer: function () {
+ return global$8.container ? global$8.container : document.body;
+ },
+ getViewPort: function (win) {
+ return global$3.DOM.getViewPort(win);
+ },
+ get: function (id) {
+ return document.getElementById(id);
+ },
+ addClass: function (elm, cls) {
+ return global$3.DOM.addClass(elm, cls);
+ },
+ removeClass: function (elm, cls) {
+ return global$3.DOM.removeClass(elm, cls);
+ },
+ hasClass: function (elm, cls) {
+ return global$3.DOM.hasClass(elm, cls);
+ },
+ toggleClass: function (elm, cls, state) {
+ return global$3.DOM.toggleClass(elm, cls, state);
+ },
+ css: function (elm, name, value) {
+ return global$3.DOM.setStyle(elm, name, value);
+ },
+ getRuntimeStyle: function (elm, name) {
+ return global$3.DOM.getStyle(elm, name, true);
+ },
+ on: function (target, name, callback, scope) {
+ return global$3.DOM.bind(target, name, callback, scope);
+ },
+ off: function (target, name, callback) {
+ return global$3.DOM.unbind(target, name, callback);
+ },
+ fire: function (target, name, args) {
+ return global$3.DOM.fire(target, name, args);
+ },
+ innerHtml: function (elm, html) {
+ global$3.DOM.setHTML(elm, html);
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.geom.Rect',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.geom.Rect');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isStatic = function (elm) {
+ return funcs.getRuntimeStyle(elm, 'position') === 'static';
+ };
+ var isFixed = function (ctrl) {
+ return ctrl.state.get('fixed');
+ };
+ function calculateRelativePosition(ctrl, targetElm, rel) {
+ var ctrlElm, pos, x, y, selfW, selfH, targetW, targetH, viewport, size;
+ viewport = getWindowViewPort();
+ pos = funcs.getPos(targetElm, $_435hnxt5jfuw8sc9.getUiContainer(ctrl));
+ x = pos.x;
+ y = pos.y;
+ if (isFixed(ctrl) && isStatic(document.body)) {
+ x -= viewport.x;
+ y -= viewport.y;
+ }
+ ctrlElm = ctrl.getEl();
+ size = funcs.getSize(ctrlElm);
+ selfW = size.width;
+ selfH = size.height;
+ size = funcs.getSize(targetElm);
+ targetW = size.width;
+ targetH = size.height;
+ rel = (rel || '').split('');
+ if (rel[0] === 'b') {
+ y += targetH;
+ }
+ if (rel[1] === 'r') {
+ x += targetW;
+ }
+ if (rel[0] === 'c') {
+ y += Math.round(targetH / 2);
+ }
+ if (rel[1] === 'c') {
+ x += Math.round(targetW / 2);
+ }
+ if (rel[3] === 'b') {
+ y -= selfH;
+ }
+ if (rel[4] === 'r') {
+ x -= selfW;
+ }
+ if (rel[3] === 'c') {
+ y -= Math.round(selfH / 2);
+ }
+ if (rel[4] === 'c') {
+ x -= Math.round(selfW / 2);
+ }
+ return {
+ x: x,
+ y: y,
+ w: selfW,
+ h: selfH
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getUiContainerViewPort = function (customUiContainer) {
+ return {
+ x: 0,
+ y: 0,
+ w: customUiContainer.scrollWidth - 1,
+ h: customUiContainer.scrollHeight - 1
+ };
+ };
+ var getWindowViewPort = function () {
+ var win = window;
+ var x = Math.max(win.pageXOffset, document.body.scrollLeft, document.documentElement.scrollLeft);
+ var y = Math.max(win.pageYOffset, document.body.scrollTop, document.documentElement.scrollTop);
+ var w = win.innerWidth || document.documentElement.clientWidth;
+ var h = win.innerHeight || document.documentElement.clientHeight;
+ return {
+ x: x,
+ y: y,
+ w: x + w,
+ h: y + h
+ };
+ };
+ var getViewPortRect = function (ctrl) {
+ var customUiContainer = $_435hnxt5jfuw8sc9.getUiContainer(ctrl);
+ return customUiContainer && !isFixed(ctrl) ? getUiContainerViewPort(customUiContainer) : getWindowViewPort();
+ };
+ var $_831wnjtkjfuw8sdt = {
+ testMoveRel: function (elm, rels) {
+ var viewPortRect = getViewPortRect(this);
+ for (var i = 0; i < rels.length; i++) {
+ var pos = calculateRelativePosition(this, elm, rels[i]);
+ if (isFixed(this)) {
+ if (pos.x > 0 && pos.x + pos.w < viewPortRect.w && pos.y > 0 && pos.y + pos.h < viewPortRect.h) {
+ return rels[i];
+ }
+ } else {
+ if (pos.x > viewPortRect.x && pos.x + pos.w < viewPortRect.w && pos.y > viewPortRect.y && pos.y + pos.h < viewPortRect.h) {
+ return rels[i];
+ }
+ }
+ }
+ return rels[0];
+ },
+ moveRel: function (elm, rel) {
+ if (typeof rel !== 'string') {
+ rel = this.testMoveRel(elm, rel);
+ }
+ var pos = calculateRelativePosition(this, elm, rel);
+ return this.moveTo(pos.x, pos.y);
+ },
+ moveBy: function (dx, dy) {
+ var self = this, rect = self.layoutRect();
+ self.moveTo(rect.x + dx, rect.y + dy);
+ return self;
+ },
+ moveTo: function (x, y) {
+ var self = this;
+ function constrain(value, max, size) {
+ if (value < 0) {
+ return 0;
+ }
+ if (value + size > max) {
+ value = max - size;
+ return value < 0 ? 0 : value;
+ }
+ return value;
+ }
+ if (self.settings.constrainToViewport) {
+ var viewPortRect = getViewPortRect(this);
+ var layoutRect = self.layoutRect();
+ x = constrain(x, viewPortRect.w, layoutRect.w);
+ y = constrain(y, viewPortRect.h, layoutRect.h);
+ }
+ var uiContainer = $_435hnxt5jfuw8sc9.getUiContainer(self);
+ if (uiContainer && isStatic(uiContainer) && !isFixed(self)) {
+ x -= uiContainer.scrollLeft;
+ y -= uiContainer.scrollTop;
+ }
+ if (uiContainer) {
+ x += 1;
+ y += 1;
+ }
+ if (self.state.get('rendered')) {
+ self.layoutRect({
+ x: x,
+ y: y
+ }).repaint();
+ } else {
+ self.settings.x = x;
+ self.settings.y = y;
+ }
+ self.fire('move', {
+ x: x,
+ y: y
+ });
+ return self;
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Toolbar.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$10 = tinymce.util.Tools.resolve('tinymce.util.Class');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.modern.ui.Toolbar',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.ui.Factory'
- ],
- function (Tools, Factory) {
- var defaultToolbar = "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | " +
- "bullist numlist outdent indent | link image";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$11 = tinymce.util.Tools.resolve('tinymce.util.EventDispatcher');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var createToolbar = function (editor, items, size) {
- var toolbarItems = [], buttonGroup;
-
- if (!items) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_xw61vtqjfuw8sep = {
+ parseBox: function (value) {
+ var len;
+ var radix = 10;
+ if (!value) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (typeof value === 'number') {
+ value = value || 0;
+ return {
+ top: value,
+ left: value,
+ bottom: value,
+ right: value
+ };
+ }
+ value = value.split(' ');
+ len = value.length;
+ if (len === 1) {
+ value[1] = value[2] = value[3] = value[0];
+ } else if (len === 2) {
+ value[2] = value[0];
+ value[3] = value[1];
+ } else if (len === 3) {
+ value[3] = value[1];
+ }
+ return {
+ top: parseInt(value[0], radix) || 0,
+ right: parseInt(value[1], radix) || 0,
+ bottom: parseInt(value[2], radix) || 0,
+ left: parseInt(value[3], radix) || 0
+ };
+ },
+ measureBox: function (elm, prefix) {
+ function getStyle(name) {
+ var defaultView = elm.ownerDocument.defaultView;
+ if (defaultView) {
+ var computedStyle = defaultView.getComputedStyle(elm, null);
+ if (computedStyle) {
+ name = name.replace(/[A-Z]/g, function (a) {
+ return '-' + a;
+ });
+ return computedStyle.getPropertyValue(name);
+ } else {
+ return null;
+ }
+ }
+ return elm.currentStyle[name];
+ }
+ function getSide(name) {
+ var val = parseFloat(getStyle(name));
+ return isNaN(val) ? 0 : val;
+ }
+ return {
+ top: getSide(prefix + 'TopWidth'),
+ right: getSide(prefix + 'RightWidth'),
+ bottom: getSide(prefix + 'BottomWidth'),
+ left: getSide(prefix + 'LeftWidth')
+ };
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Tools.each(items.split(/[ ,]/), function (item) {
- var itemName;
-
- var bindSelectorChanged = function () {
- var selection = editor.selection;
-
- if (item.settings.stateSelector) {
- selection.selectorChanged(item.settings.stateSelector, function (state) {
- item.active(state);
- }, true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function noop$1() {
+ }
+ function ClassList(onchange) {
+ this.cls = [];
+ this.cls._map = {};
+ this.onchange = onchange || noop$1;
+ this.prefix = '';
+ }
+ global$2.extend(ClassList.prototype, {
+ add: function (cls) {
+ if (cls && !this.contains(cls)) {
+ this.cls._map[cls] = true;
+ this.cls.push(cls);
+ this._change();
+ }
+ return this;
+ },
+ remove: function (cls) {
+ if (this.contains(cls)) {
+ var i = void 0;
+ for (i = 0; i < this.cls.length; i++) {
+ if (this.cls[i] === cls) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ this.cls.splice(i, 1);
+ delete this.cls._map[cls];
+ this._change();
+ }
+ return this;
+ },
+ toggle: function (cls, state) {
+ var curState = this.contains(cls);
+ if (curState !== state) {
+ if (curState) {
+ this.remove(cls);
+ } else {
+ this.add(cls);
+ }
+ this._change();
+ }
+ return this;
+ },
+ contains: function (cls) {
+ return !!this.cls._map[cls];
+ },
+ _change: function () {
+ delete this.clsValue;
+ this.onchange.call(this);
+ }
+ });
+ ClassList.prototype.toString = function () {
+ var value;
+ if (this.clsValue) {
+ return this.clsValue;
+ }
+ value = '';
+ for (var i = 0; i < this.cls.length; i++) {
+ if (i > 0) {
+ value += ' ';
+ }
+ value += this.prefix + this.cls[i];
+ }
+ return value;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (item.settings.disabledStateSelector) {
- selection.selectorChanged(item.settings.disabledStateSelector, function (state) {
- item.disabled(state);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function unique(array) {
+ var uniqueItems = [];
+ var i = array.length, item;
+ while (i--) {
+ item = array[i];
+ if (!item.__checked) {
+ uniqueItems.push(item);
+ item.__checked = 1;
+ }
+ }
+ i = uniqueItems.length;
+ while (i--) {
+ delete uniqueItems[i].__checked;
+ }
+ return uniqueItems;
+ }
+ var expression = /^([\w\\*]+)?(?:#([\w\-\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i;
+ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g;
+ var whiteSpace = /^\s*|\s*$/g;
+ var Collection;
+ var Selector = global$10.extend({
+ init: function (selector) {
+ var match = this.match;
+ function compileNameFilter(name) {
+ if (name) {
+ name = name.toLowerCase();
+ return function (item) {
+ return name === '*' || item.type === name;
+ };
+ }
+ }
+ function compileIdFilter(id) {
+ if (id) {
+ return function (item) {
+ return item._name === id;
+ };
+ }
+ }
+ function compileClassesFilter(classes) {
+ if (classes) {
+ classes = classes.split('.');
+ return function (item) {
+ var i = classes.length;
+ while (i--) {
+ if (!item.classes.contains(classes[i])) {
+ return false;
+ }
+ }
+ return true;
+ };
+ }
+ }
+ function compileAttrFilter(name, cmp, check) {
+ if (name) {
+ return function (item) {
+ var value = item[name] ? item[name]() : '';
+ return !cmp ? !!check : cmp === '=' ? value === check : cmp === '*=' ? value.indexOf(check) >= 0 : cmp === '~=' ? (' ' + value + ' ').indexOf(' ' + check + ' ') >= 0 : cmp === '!=' ? value !== check : cmp === '^=' ? value.indexOf(check) === 0 : cmp === '$=' ? value.substr(value.length - check.length) === check : false;
+ };
+ }
+ }
+ function compilePsuedoFilter(name) {
+ var notSelectors;
+ if (name) {
+ name = /(?:not\((.+)\))|(.+)/i.exec(name);
+ if (!name[1]) {
+ name = name[2];
+ return function (item, index, length) {
+ return name === 'first' ? index === 0 : name === 'last' ? index === length - 1 : name === 'even' ? index % 2 === 0 : name === 'odd' ? index % 2 === 1 : item[name] ? item[name]() : false;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ notSelectors = parseChunks(name[1], []);
+ return function (item) {
+ return !match(item, notSelectors);
+ };
+ }
+ }
+ function compile(selector, filters, direct) {
+ var parts;
+ function add(filter) {
+ if (filter) {
+ filters.push(filter);
+ }
+ }
+ parts = expression.exec(selector.replace(whiteSpace, ''));
+ add(compileNameFilter(parts[1]));
+ add(compileIdFilter(parts[2]));
+ add(compileClassesFilter(parts[3]));
+ add(compileAttrFilter(parts[4], parts[5], parts[6]));
+ add(compilePsuedoFilter(parts[7]));
+ filters.pseudo = !!parts[7];
+ filters.direct = direct;
+ return filters;
+ }
+ function parseChunks(selector, selectors) {
+ var parts = [];
+ var extra, matches, i;
+ do {
+ chunker.exec('');
+ matches = chunker.exec(selector);
+ if (matches) {
+ selector = matches[3];
+ parts.push(matches[1]);
+ if (matches[2]) {
+ extra = matches[3];
+ break;
+ }
+ }
+ } while (matches);
+ if (extra) {
+ parseChunks(extra, selectors);
+ }
+ selector = [];
+ for (i = 0; i < parts.length; i++) {
+ if (parts[i] !== '>') {
+ selector.push(compile(parts[i], [], parts[i - 1] === '>'));
+ }
+ }
+ selectors.push(selector);
+ return selectors;
+ }
+ this._selectors = parseChunks(selector, []);
+ },
+ match: function (control, selectors) {
+ var i, l, si, sl, selector, fi, fl, filters, index, length, siblings, count, item;
+ selectors = selectors || this._selectors;
+ for (i = 0, l = selectors.length; i < l; i++) {
+ selector = selectors[i];
+ sl = selector.length;
+ item = control;
+ count = 0;
+ for (si = sl - 1; si >= 0; si--) {
+ filters = selector[si];
+ while (item) {
+ if (filters.pseudo) {
+ siblings = item.parent().items();
+ index = length = siblings.length;
+ while (index--) {
+ if (siblings[index] === item) {
+ break;
+ }
+ }
+ }
+ for (fi = 0, fl = filters.length; fi < fl; fi++) {
+ if (!filters[fi](item, index, length)) {
+ fi = fl + 1;
+ break;
+ }
+ }
+ if (fi === fl) {
+ count++;
+ break;
+ } else {
+ if (si === sl - 1) {
+ break;
+ }
+ }
+ item = item.parent();
+ }
+ }
+ if (count === sl) {
+ return true;
+ }
+ }
+ return false;
+ },
+ find: function (container) {
+ var matches = [], i, l;
+ var selectors = this._selectors;
+ function collect(items, selector, index) {
+ var i, l, fi, fl, item;
+ var filters = selector[index];
+ for (i = 0, l = items.length; i < l; i++) {
+ item = items[i];
+ for (fi = 0, fl = filters.length; fi < fl; fi++) {
+ if (!filters[fi](item, i, l)) {
+ fi = fl + 1;
+ break;
+ }
+ }
+ if (fi === fl) {
+ if (index === selector.length - 1) {
+ matches.push(item);
+ } else {
+ if (item.items) {
+ collect(item.items(), selector, index + 1);
+ }
+ }
+ } else if (filters.direct) {
+ return;
+ }
+ if (item.items) {
+ collect(item.items(), selector, index);
+ }
+ }
+ }
+ if (container.items) {
+ for (i = 0, l = selectors.length; i < l; i++) {
+ collect(container.items(), selectors[i], 0);
+ }
+ if (l > 1) {
+ matches = unique(matches);
+ }
+ }
+ if (!Collection) {
+ Collection = Selector.Collection;
+ }
+ return new Collection(matches);
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (item == "|") {
- buttonGroup = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Collection$1;
+ var proto;
+ var push$1 = Array.prototype.push;
+ var slice$1 = Array.prototype.slice;
+ proto = {
+ length: 0,
+ init: function (items) {
+ if (items) {
+ this.add(items);
+ }
+ },
+ add: function (items) {
+ var self = this;
+ if (!global$2.isArray(items)) {
+ if (items instanceof Collection$1) {
+ self.add(items.toArray());
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (!buttonGroup) {
- buttonGroup = { type: 'buttongroup', items: [] };
- toolbarItems.push(buttonGroup);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ push$1.call(self, items);
+ }
+ } else {
+ push$1.apply(self, items);
+ }
+ return self;
+ },
+ set: function (items) {
+ var self = this;
+ var len = self.length;
+ var i;
+ self.length = 0;
+ self.add(items);
+ for (i = self.length; i < len; i++) {
+ delete self[i];
+ }
+ return self;
+ },
+ filter: function (selector) {
+ var self = this;
+ var i, l;
+ var matches = [];
+ var item, match;
+ if (typeof selector === 'string') {
+ selector = new Selector(selector);
+ match = function (item) {
+ return selector.match(item);
+ };
+ } else {
+ match = selector;
+ }
+ for (i = 0, l = self.length; i < l; i++) {
+ item = self[i];
+ if (match(item)) {
+ matches.push(item);
+ }
+ }
+ return new Collection$1(matches);
+ },
+ slice: function () {
+ return new Collection$1(slice$1.apply(this, arguments));
+ },
+ eq: function (index) {
+ return index === -1 ? this.slice(index) : this.slice(index, +index + 1);
+ },
+ each: function (callback) {
+ global$2.each(this, callback);
+ return this;
+ },
+ toArray: function () {
+ return global$2.toArray(this);
+ },
+ indexOf: function (ctrl) {
+ var self = this;
+ var i = self.length;
+ while (i--) {
+ if (self[i] === ctrl) {
+ break;
+ }
+ }
+ return i;
+ },
+ reverse: function () {
+ return new Collection$1(global$2.toArray(this).reverse());
+ },
+ hasClass: function (cls) {
+ return this[0] ? this[0].classes.contains(cls) : false;
+ },
+ prop: function (name, value) {
+ var self = this;
+ var item;
+ if (value !== undefined) {
+ self.each(function (item) {
+ if (item[name]) {
+ item[name](value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ return self;
+ }
+ item = self[0];
+ if (item && item[name]) {
+ return item[name]();
+ }
+ },
+ exec: function (name) {
+ var self = this, args = global$2.toArray(arguments).slice(1);
+ self.each(function (item) {
+ if (item[name]) {
+ item[name].apply(item, args);
+ }
+ });
+ return self;
+ },
+ remove: function () {
+ var i = this.length;
+ while (i--) {
+ this[i].remove();
+ }
+ return this;
+ },
+ addClass: function (cls) {
+ return this.each(function (item) {
+ item.classes.add(cls);
+ });
+ },
+ removeClass: function (cls) {
+ return this.each(function (item) {
+ item.classes.remove(cls);
+ });
+ }
+ };
+ global$2.each('fire on off show hide append prepend before after reflow'.split(' '), function (name) {
+ proto[name] = function () {
+ var args = global$2.toArray(arguments);
+ this.each(function (ctrl) {
+ if (name in ctrl) {
+ ctrl[name].apply(ctrl, args);
+ }
+ });
+ return this;
+ };
+ });
+ global$2.each('text name disabled active selected checked visible parent value data'.split(' '), function (name) {
+ proto[name] = function (value) {
+ return this.prop(name, value);
+ };
+ });
+ Collection$1 = global$10.extend(proto);
+ Selector.Collection = Collection$1;
+ var Collection$2 = Collection$1;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (editor.buttons[item]) {
- // TODO: Move control creation to some UI class
- itemName = item;
- item = editor.buttons[itemName];
-
- if (typeof item == "function") {
- item = item();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Binding = function (settings) {
+ this.create = settings.create;
+ };
+ Binding.create = function (model, name) {
+ return new Binding({
+ create: function (otherModel, otherName) {
+ var bindings;
+ var fromSelfToOther = function (e) {
+ otherModel.set(otherName, e.value);
+ };
+ var fromOtherToSelf = function (e) {
+ model.set(name, e.value);
+ };
+ otherModel.on('change:' + otherName, fromOtherToSelf);
+ model.on('change:' + name, fromSelfToOther);
+ bindings = otherModel._bindings;
+ if (!bindings) {
+ bindings = otherModel._bindings = [];
+ otherModel.on('destroy', function () {
+ var i = bindings.length;
+ while (i--) {
+ bindings[i]();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ bindings.push(function () {
+ model.off('change:' + name, fromSelfToOther);
+ });
+ return model.get(name);
+ }
+ });
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- item.type = item.type || 'button';
- item.size = size;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$12 = tinymce.util.Tools.resolve('tinymce.util.Observable');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- item = Factory.create(item);
- buttonGroup.items.push(item);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function isNode(node) {
+ return node.nodeType > 0;
+ }
+ function isEqual(a, b) {
+ var k, checked;
+ if (a === b) {
+ return true;
+ }
+ if (a === null || b === null) {
+ return a === b;
+ }
+ if (typeof a !== 'object' || typeof b !== 'object') {
+ return a === b;
+ }
+ if (global$2.isArray(b)) {
+ if (a.length !== b.length) {
+ return false;
+ }
+ k = a.length;
+ while (k--) {
+ if (!isEqual(a[k], b[k])) {
+ return false;
+ }
+ }
+ }
+ if (isNode(a) || isNode(b)) {
+ return a === b;
+ }
+ checked = {};
+ for (k in b) {
+ if (!isEqual(a[k], b[k])) {
+ return false;
+ }
+ checked[k] = true;
+ }
+ for (k in a) {
+ if (!checked[k] && !isEqual(a[k], b[k])) {
+ return false;
+ }
+ }
+ return true;
+ }
+ var ObservableObject = global$10.extend({
+ Mixins: [global$12],
+ init: function (data) {
+ var name, value;
+ data = data || {};
+ for (name in data) {
+ value = data[name];
+ if (value instanceof Binding) {
+ data[name] = value.create(this, name);
+ }
+ }
+ this.data = data;
+ },
+ set: function (name, value) {
+ var key, args;
+ var oldValue = this.data[name];
+ if (value instanceof Binding) {
+ value = value.create(this, name);
+ }
+ if (typeof name === 'object') {
+ for (key in name) {
+ this.set(key, name[key]);
+ }
+ return this;
+ }
+ if (!isEqual(oldValue, value)) {
+ this.data[name] = value;
+ args = {
+ target: this,
+ name: name,
+ value: value,
+ oldValue: oldValue
+ };
+ this.fire('change:' + name, args);
+ this.fire('change', args);
+ }
+ return this;
+ },
+ get: function (name) {
+ return this.data[name];
+ },
+ has: function (name) {
+ return name in this.data;
+ },
+ bind: function (name) {
+ return Binding.create(this, name);
+ },
+ destroy: function () {
+ this.fire('destroy');
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (editor.initialized) {
- bindSelectorChanged();
- } else {
- editor.on('init', bindSelectorChanged);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var dirtyCtrls = {};
+ var animationFrameRequested;
+ var $_5c4g75txjfuw8sfo = {
+ add: function (ctrl) {
+ var parent = ctrl.parent();
+ if (parent) {
+ if (!parent._layout || parent._layout.isNative()) {
+ return;
+ }
+ if (!dirtyCtrls[parent._id]) {
+ dirtyCtrls[parent._id] = parent;
+ }
+ if (!animationFrameRequested) {
+ animationFrameRequested = true;
+ global$7.requestAnimationFrame(function () {
+ var id, ctrl;
+ animationFrameRequested = false;
+ for (id in dirtyCtrls) {
+ ctrl = dirtyCtrls[id];
+ if (ctrl.state.get('rendered')) {
+ ctrl.reflow();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dirtyCtrls = {};
+ }, document.body);
+ }
+ }
+ },
+ remove: function (ctrl) {
+ if (dirtyCtrls[ctrl._id]) {
+ delete dirtyCtrls[ctrl._id];
+ }
+ }
+ };
+
+ var hasMouseWheelEventSupport = 'onmousewheel' in document;
+ var hasWheelEventSupport = false;
+ var classPrefix = 'mce-';
+ var Control;
+ var idCounter = 0;
+ var proto$1 = {
+ Statics: { classPrefix: classPrefix },
+ isRtl: function () {
+ return Control.rtl;
+ },
+ classPrefix: classPrefix,
+ init: function (settings) {
+ var self = this;
+ var classes, defaultClasses;
+ function applyClasses(classes) {
+ var i;
+ classes = classes.split(' ');
+ for (i = 0; i < classes.length; i++) {
+ self.classes.add(classes[i]);
+ }
+ }
+ self.settings = settings = global$2.extend({}, self.Defaults, settings);
+ self._id = settings.id || 'mceu_' + idCounter++;
+ self._aria = { role: settings.role };
+ self._elmCache = {};
+ self.$ = global$9;
+ self.state = new ObservableObject({
+ visible: true,
+ active: false,
+ disabled: false,
+ value: ''
+ });
+ self.data = new ObservableObject(settings.data);
+ self.classes = new ClassList(function () {
+ if (self.state.get('rendered')) {
+ self.getEl().className = this.toString();
+ }
+ });
+ self.classes.prefix = self.classPrefix;
+ classes = settings.classes;
+ if (classes) {
+ if (self.Defaults) {
+ defaultClasses = self.Defaults.classes;
+ if (defaultClasses && classes !== defaultClasses) {
+ applyClasses(defaultClasses);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ applyClasses(classes);
+ }
+ global$2.each('title text name visible disabled active value'.split(' '), function (name) {
+ if (name in settings) {
+ self[name](settings[name]);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- type: 'toolbar',
- layout: 'flow',
- items: toolbarItems
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.on('click', function () {
+ if (self.disabled()) {
+ return false;
+ }
+ });
+ self.settings = settings;
+ self.borderBox = $_xw61vtqjfuw8sep.parseBox(settings.border);
+ self.paddingBox = $_xw61vtqjfuw8sep.parseBox(settings.padding);
+ self.marginBox = $_xw61vtqjfuw8sep.parseBox(settings.margin);
+ if (settings.hidden) {
+ self.hide();
+ }
+ },
+ Properties: 'parent,name',
+ getContainerElm: function () {
+ var uiContainer = $_435hnxt5jfuw8sc9.getUiContainer(this);
+ return uiContainer ? uiContainer : funcs.getContainer();
+ },
+ getParentCtrl: function (elm) {
+ var ctrl;
+ var lookup = this.getRoot().controlIdLookup;
+ while (elm && lookup) {
+ ctrl = lookup[elm.id];
+ if (ctrl) {
+ break;
+ }
+ elm = elm.parentNode;
+ }
+ return ctrl;
+ },
+ initLayoutRect: function () {
+ var self = this;
+ var settings = self.settings;
+ var borderBox, layoutRect;
+ var elm = self.getEl();
+ var width, height, minWidth, minHeight, autoResize;
+ var startMinWidth, startMinHeight, initialSize;
+ borderBox = self.borderBox = self.borderBox || $_xw61vtqjfuw8sep.measureBox(elm, 'border');
+ self.paddingBox = self.paddingBox || $_xw61vtqjfuw8sep.measureBox(elm, 'padding');
+ self.marginBox = self.marginBox || $_xw61vtqjfuw8sep.measureBox(elm, 'margin');
+ initialSize = funcs.getSize(elm);
+ startMinWidth = settings.minWidth;
+ startMinHeight = settings.minHeight;
+ minWidth = startMinWidth || initialSize.width;
+ minHeight = startMinHeight || initialSize.height;
+ width = settings.width;
+ height = settings.height;
+ autoResize = settings.autoResize;
+ autoResize = typeof autoResize !== 'undefined' ? autoResize : !width && !height;
+ width = width || minWidth;
+ height = height || minHeight;
+ var deltaW = borderBox.left + borderBox.right;
+ var deltaH = borderBox.top + borderBox.bottom;
+ var maxW = settings.maxWidth || 65535;
+ var maxH = settings.maxHeight || 65535;
+ self._layoutRect = layoutRect = {
+ x: settings.x || 0,
+ y: settings.y || 0,
+ w: width,
+ h: height,
+ deltaW: deltaW,
+ deltaH: deltaH,
+ contentW: width - deltaW,
+ contentH: height - deltaH,
+ innerW: width - deltaW,
+ innerH: height - deltaH,
+ startMinWidth: startMinWidth || 0,
+ startMinHeight: startMinHeight || 0,
+ minW: Math.min(minWidth, maxW),
+ minH: Math.min(minHeight, maxH),
+ maxW: maxW,
+ maxH: maxH,
+ autoResize: autoResize,
+ scrollW: 0
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- /**
- * Creates the toolbars from config and returns a toolbar array.
- *
- * @param {String} size Optional toolbar item size.
- * @return {Array} Array with toolbars.
- */
- var createToolbars = function (editor, size) {
- var toolbars = [], settings = editor.settings;
-
- var addToolbar = function (items) {
- if (items) {
- toolbars.push(createToolbar(editor, items, size));
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self._lastLayoutRect = {};
+ return layoutRect;
+ },
+ layoutRect: function (newRect) {
+ var self = this;
+ var curRect = self._layoutRect, lastLayoutRect, size, deltaWidth, deltaHeight, repaintControls;
+ if (!curRect) {
+ curRect = self.initLayoutRect();
+ }
+ if (newRect) {
+ deltaWidth = curRect.deltaW;
+ deltaHeight = curRect.deltaH;
+ if (newRect.x !== undefined) {
+ curRect.x = newRect.x;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (newRect.y !== undefined) {
+ curRect.y = newRect.y;
+ }
+ if (newRect.minW !== undefined) {
+ curRect.minW = newRect.minW;
+ }
+ if (newRect.minH !== undefined) {
+ curRect.minH = newRect.minH;
+ }
+ size = newRect.w;
+ if (size !== undefined) {
+ size = size < curRect.minW ? curRect.minW : size;
+ size = size > curRect.maxW ? curRect.maxW : size;
+ curRect.w = size;
+ curRect.innerW = size - deltaWidth;
+ }
+ size = newRect.h;
+ if (size !== undefined) {
+ size = size < curRect.minH ? curRect.minH : size;
+ size = size > curRect.maxH ? curRect.maxH : size;
+ curRect.h = size;
+ curRect.innerH = size - deltaHeight;
+ }
+ size = newRect.innerW;
+ if (size !== undefined) {
+ size = size < curRect.minW - deltaWidth ? curRect.minW - deltaWidth : size;
+ size = size > curRect.maxW - deltaWidth ? curRect.maxW - deltaWidth : size;
+ curRect.innerW = size;
+ curRect.w = size + deltaWidth;
+ }
+ size = newRect.innerH;
+ if (size !== undefined) {
+ size = size < curRect.minH - deltaHeight ? curRect.minH - deltaHeight : size;
+ size = size > curRect.maxH - deltaHeight ? curRect.maxH - deltaHeight : size;
+ curRect.innerH = size;
+ curRect.h = size + deltaHeight;
+ }
+ if (newRect.contentW !== undefined) {
+ curRect.contentW = newRect.contentW;
+ }
+ if (newRect.contentH !== undefined) {
+ curRect.contentH = newRect.contentH;
+ }
+ lastLayoutRect = self._lastLayoutRect;
+ if (lastLayoutRect.x !== curRect.x || lastLayoutRect.y !== curRect.y || lastLayoutRect.w !== curRect.w || lastLayoutRect.h !== curRect.h) {
+ repaintControls = Control.repaintControls;
+ if (repaintControls) {
+ if (repaintControls.map && !repaintControls.map[self._id]) {
+ repaintControls.push(self);
+ repaintControls.map[self._id] = true;
+ }
+ }
+ lastLayoutRect.x = curRect.x;
+ lastLayoutRect.y = curRect.y;
+ lastLayoutRect.w = curRect.w;
+ lastLayoutRect.h = curRect.h;
+ }
+ return self;
+ }
+ return curRect;
+ },
+ repaint: function () {
+ var self = this;
+ var style, bodyStyle, bodyElm, rect, borderBox;
+ var borderW, borderH, lastRepaintRect, round, value;
+ round = !document.createRange ? Math.round : function (value) {
+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Convert toolbar array to multiple options
- if (Tools.isArray(settings.toolbar)) {
- // Empty toolbar array is the same as a disabled toolbar
- if (settings.toolbar.length === 0) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ style = self.getEl().style;
+ rect = self._layoutRect;
+ lastRepaintRect = self._lastRepaintRect || {};
+ borderBox = self.borderBox;
+ borderW = borderBox.left + borderBox.right;
+ borderH = borderBox.top + borderBox.bottom;
+ if (rect.x !== lastRepaintRect.x) {
+ style.left = round(rect.x) + 'px';
+ lastRepaintRect.x = rect.x;
+ }
+ if (rect.y !== lastRepaintRect.y) {
+ style.top = round(rect.y) + 'px';
+ lastRepaintRect.y = rect.y;
+ }
+ if (rect.w !== lastRepaintRect.w) {
+ value = round(rect.w - borderW);
+ style.width = (value >= 0 ? value : 0) + 'px';
+ lastRepaintRect.w = rect.w;
+ }
+ if (rect.h !== lastRepaintRect.h) {
+ value = round(rect.h - borderH);
+ style.height = (value >= 0 ? value : 0) + 'px';
+ lastRepaintRect.h = rect.h;
+ }
+ if (self._hasBody && rect.innerW !== lastRepaintRect.innerW) {
+ value = round(rect.innerW);
+ bodyElm = self.getEl('body');
+ if (bodyElm) {
+ bodyStyle = bodyElm.style;
+ bodyStyle.width = (value >= 0 ? value : 0) + 'px';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- Tools.each(settings.toolbar, function (toolbar, i) {
- settings["toolbar" + (i + 1)] = toolbar;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ lastRepaintRect.innerW = rect.innerW;
+ }
+ if (self._hasBody && rect.innerH !== lastRepaintRect.innerH) {
+ value = round(rect.innerH);
+ bodyElm = bodyElm || self.getEl('body');
+ if (bodyElm) {
+ bodyStyle = bodyStyle || bodyElm.style;
+ bodyStyle.height = (value >= 0 ? value : 0) + 'px';
+ }
+ lastRepaintRect.innerH = rect.innerH;
+ }
+ self._lastRepaintRect = lastRepaintRect;
+ self.fire('repaint', {}, false);
+ },
+ updateLayoutRect: function () {
+ var self = this;
+ self.parent()._lastRect = null;
+ funcs.css(self.getEl(), {
+ width: '',
+ height: ''
+ });
+ self._layoutRect = self._lastRepaintRect = self._lastLayoutRect = null;
+ self.initLayoutRect();
+ },
+ on: function (name, callback) {
+ var self = this;
+ function resolveCallbackName(name) {
+ var callback, scope;
+ if (typeof name !== 'string') {
+ return name;
+ }
+ return function (e) {
+ if (!callback) {
+ self.parentsAndSelf().each(function (ctrl) {
+ var callbacks = ctrl.settings.callbacks;
+ if (callbacks && (callback = callbacks[name])) {
+ scope = ctrl;
+ return false;
+ }
+ });
+ }
+ if (!callback) {
+ e.action = name;
+ this.fire('execute', e);
+ return;
+ }
+ return callback.call(scope, e);
+ };
+ }
+ getEventDispatcher(self).on(name, resolveCallbackName(callback));
+ return self;
+ },
+ off: function (name, callback) {
+ getEventDispatcher(this).off(name, callback);
+ return this;
+ },
+ fire: function (name, args, bubble) {
+ var self = this;
+ args = args || {};
+ if (!args.control) {
+ args.control = self;
+ }
+ args = getEventDispatcher(self).fire(name, args);
+ if (bubble !== false && self.parent) {
+ var parent_1 = self.parent();
+ while (parent_1 && !args.isPropagationStopped()) {
+ parent_1.fire(name, args, false);
+ parent_1 = parent_1.parent();
+ }
+ }
+ return args;
+ },
+ hasEventListeners: function (name) {
+ return getEventDispatcher(this).has(name);
+ },
+ parents: function (selector) {
+ var self = this;
+ var ctrl, parents = new Collection$2();
+ for (ctrl = self.parent(); ctrl; ctrl = ctrl.parent()) {
+ parents.add(ctrl);
+ }
+ if (selector) {
+ parents = parents.filter(selector);
+ }
+ return parents;
+ },
+ parentsAndSelf: function (selector) {
+ return new Collection$2(this).add(this.parents(selector));
+ },
+ next: function () {
+ var parentControls = this.parent().items();
+ return parentControls[parentControls.indexOf(this) + 1];
+ },
+ prev: function () {
+ var parentControls = this.parent().items();
+ return parentControls[parentControls.indexOf(this) - 1];
+ },
+ innerHtml: function (html) {
+ this.$el.html(html);
+ return this;
+ },
+ getEl: function (suffix) {
+ var id = suffix ? this._id + '-' + suffix : this._id;
+ if (!this._elmCache[id]) {
+ this._elmCache[id] = global$9('#' + id)[0];
+ }
+ return this._elmCache[id];
+ },
+ show: function () {
+ return this.visible(true);
+ },
+ hide: function () {
+ return this.visible(false);
+ },
+ focus: function () {
+ try {
+ this.getEl().focus();
+ } catch (ex) {
+ }
+ return this;
+ },
+ blur: function () {
+ this.getEl().blur();
+ return this;
+ },
+ aria: function (name, value) {
+ var self = this, elm = self.getEl(self.ariaTarget);
+ if (typeof value === 'undefined') {
+ return self._aria[name];
+ }
+ self._aria[name] = value;
+ if (self.state.get('rendered')) {
+ elm.setAttribute(name === 'role' ? name : 'aria-' + name, value);
+ }
+ return self;
+ },
+ encode: function (text, translate) {
+ if (translate !== false) {
+ text = this.translate(text);
+ }
+ return (text || '').replace(/[&<>"]/g, function (match) {
+ return '&#' + match.charCodeAt(0) + ';';
+ });
+ },
+ translate: function (text) {
+ return Control.translate ? Control.translate(text) : text;
+ },
+ before: function (items) {
+ var self = this, parent = self.parent();
+ if (parent) {
+ parent.insert(items, parent.items().indexOf(self), true);
+ }
+ return self;
+ },
+ after: function (items) {
+ var self = this, parent = self.parent();
+ if (parent) {
+ parent.insert(items, parent.items().indexOf(self));
+ }
+ return self;
+ },
+ remove: function () {
+ var self = this;
+ var elm = self.getEl();
+ var parent = self.parent();
+ var newItems, i;
+ if (self.items) {
+ var controls = self.items().toArray();
+ i = controls.length;
+ while (i--) {
+ controls[i].remove();
+ }
+ }
+ if (parent && parent.items) {
+ newItems = [];
+ parent.items().each(function (item) {
+ if (item !== self) {
+ newItems.push(item);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent.items().set(newItems);
+ parent._lastRect = null;
+ }
+ if (self._eventsRoot && self._eventsRoot === self) {
+ global$9(elm).off();
+ }
+ var lookup = self.getRoot().controlIdLookup;
+ if (lookup) {
+ delete lookup[self._id];
+ }
+ if (elm && elm.parentNode) {
+ elm.parentNode.removeChild(elm);
+ }
+ self.state.set('rendered', false);
+ self.state.destroy();
+ self.fire('remove');
+ return self;
+ },
+ renderBefore: function (elm) {
+ global$9(elm).before(this.renderHtml());
+ this.postRender();
+ return this;
+ },
+ renderTo: function (elm) {
+ global$9(elm || this.getContainerElm()).append(this.renderHtml());
+ this.postRender();
+ return this;
+ },
+ preRender: function () {
+ },
+ render: function () {
+ },
+ renderHtml: function () {
+ return '<div id="' + this._id + '" class="' + this.classes + '"></div>';
+ },
+ postRender: function () {
+ var self = this;
+ var settings = self.settings;
+ var elm, box, parent, name, parentEventsRoot;
+ self.$el = global$9(self.getEl());
+ self.state.set('rendered', true);
+ for (name in settings) {
+ if (name.indexOf('on') === 0) {
+ self.on(name.substr(2), settings[name]);
+ }
+ }
+ if (self._eventsRoot) {
+ for (parent = self.parent(); !parentEventsRoot && parent; parent = parent.parent()) {
+ parentEventsRoot = parent._eventsRoot;
+ }
+ if (parentEventsRoot) {
+ for (name in parentEventsRoot._nativeEvents) {
+ self._nativeEvents[name] = true;
+ }
+ }
+ }
+ bindPendingEvents(self);
+ if (settings.style) {
+ elm = self.getEl();
+ if (elm) {
+ elm.setAttribute('style', settings.style);
+ elm.style.cssText = settings.style;
+ }
+ }
+ if (self.settings.border) {
+ box = self.borderBox;
+ self.$el.css({
+ 'border-top-width': box.top,
+ 'border-right-width': box.right,
+ 'border-bottom-width': box.bottom,
+ 'border-left-width': box.left
+ });
+ }
+ var root = self.getRoot();
+ if (!root.controlIdLookup) {
+ root.controlIdLookup = {};
+ }
+ root.controlIdLookup[self._id] = self;
+ for (var key in self._aria) {
+ self.aria(key, self._aria[key]);
+ }
+ if (self.state.get('visible') === false) {
+ self.getEl().style.display = 'none';
+ }
+ self.bindStates();
+ self.state.on('change:visible', function (e) {
+ var state = e.value;
+ var parentCtrl;
+ if (self.state.get('rendered')) {
+ self.getEl().style.display = state === false ? 'none' : '';
+ self.getEl().getBoundingClientRect();
+ }
+ parentCtrl = self.parent();
+ if (parentCtrl) {
+ parentCtrl._lastRect = null;
+ }
+ self.fire(state ? 'show' : 'hide');
+ $_5c4g75txjfuw8sfo.add(self);
+ });
+ self.fire('postrender', {}, false);
+ },
+ bindStates: function () {
+ },
+ scrollIntoView: function (align) {
+ function getOffset(elm, rootElm) {
+ var x, y, parent = elm;
+ x = y = 0;
+ while (parent && parent !== rootElm && parent.nodeType) {
+ x += parent.offsetLeft || 0;
+ y += parent.offsetTop || 0;
+ parent = parent.offsetParent;
+ }
+ return {
+ x: x,
+ y: y
+ };
+ }
+ var elm = this.getEl(), parentElm = elm.parentNode;
+ var x, y, width, height, parentWidth, parentHeight;
+ var pos = getOffset(elm, parentElm);
+ x = pos.x;
+ y = pos.y;
+ width = elm.offsetWidth;
+ height = elm.offsetHeight;
+ parentWidth = parentElm.clientWidth;
+ parentHeight = parentElm.clientHeight;
+ if (align === 'end') {
+ x -= parentWidth - width;
+ y -= parentHeight - height;
+ } else if (align === 'center') {
+ x -= parentWidth / 2 - width / 2;
+ y -= parentHeight / 2 - height / 2;
+ }
+ parentElm.scrollLeft = x;
+ parentElm.scrollTop = y;
+ return this;
+ },
+ getRoot: function () {
+ var ctrl = this, rootControl;
+ var parents = [];
+ while (ctrl) {
+ if (ctrl.rootControl) {
+ rootControl = ctrl.rootControl;
+ break;
+ }
+ parents.push(ctrl);
+ rootControl = ctrl;
+ ctrl = ctrl.parent();
+ }
+ if (!rootControl) {
+ rootControl = this;
+ }
+ var i = parents.length;
+ while (i--) {
+ parents[i].rootControl = rootControl;
+ }
+ return rootControl;
+ },
+ reflow: function () {
+ $_5c4g75txjfuw8sfo.remove(this);
+ var parent = this.parent();
+ if (parent && parent._layout && !parent._layout.isNative()) {
+ parent.reflow();
+ }
+ return this;
+ }
+ };
+ global$2.each('text title visible disabled active value'.split(' '), function (name) {
+ proto$1[name] = function (value) {
+ if (arguments.length === 0) {
+ return this.state.get(name);
+ }
+ if (typeof value !== 'undefined') {
+ this.state.set(name, value);
+ }
+ return this;
+ };
+ });
+ Control = global$10.extend(proto$1);
+ function getEventDispatcher(obj) {
+ if (!obj._eventDispatcher) {
+ obj._eventDispatcher = new global$11({
+ scope: obj,
+ toggleEvent: function (name, state) {
+ if (state && global$11.isNative(name)) {
+ if (!obj._nativeEvents) {
+ obj._nativeEvents = {};
+ }
+ obj._nativeEvents[name] = true;
+ if (obj.state.get('rendered')) {
+ bindPendingEvents(obj);
+ }
+ }
+ }
+ });
+ }
+ return obj._eventDispatcher;
+ }
+ function bindPendingEvents(eventCtrl) {
+ var i, l, parents, eventRootCtrl, nativeEvents, name;
+ function delegate(e) {
+ var control = eventCtrl.getParentCtrl(e.target);
+ if (control) {
+ control.fire(e.type, e);
+ }
+ }
+ function mouseLeaveHandler() {
+ var ctrl = eventRootCtrl._lastHoverCtrl;
+ if (ctrl) {
+ ctrl.fire('mouseleave', { target: ctrl.getEl() });
+ ctrl.parents().each(function (ctrl) {
+ ctrl.fire('mouseleave', { target: ctrl.getEl() });
+ });
+ eventRootCtrl._lastHoverCtrl = null;
+ }
+ }
+ function mouseEnterHandler(e) {
+ var ctrl = eventCtrl.getParentCtrl(e.target), lastCtrl = eventRootCtrl._lastHoverCtrl, idx = 0, i, parents, lastParents;
+ if (ctrl !== lastCtrl) {
+ eventRootCtrl._lastHoverCtrl = ctrl;
+ parents = ctrl.parents().toArray().reverse();
+ parents.push(ctrl);
+ if (lastCtrl) {
+ lastParents = lastCtrl.parents().toArray().reverse();
+ lastParents.push(lastCtrl);
+ for (idx = 0; idx < lastParents.length; idx++) {
+ if (parents[idx] !== lastParents[idx]) {
+ break;
+ }
+ }
+ for (i = lastParents.length - 1; i >= idx; i--) {
+ lastCtrl = lastParents[i];
+ lastCtrl.fire('mouseleave', { target: lastCtrl.getEl() });
+ }
+ }
+ for (i = idx; i < parents.length; i++) {
+ ctrl = parents[i];
+ ctrl.fire('mouseenter', { target: ctrl.getEl() });
+ }
+ }
+ }
+ function fixWheelEvent(e) {
+ e.preventDefault();
+ if (e.type === 'mousewheel') {
+ e.deltaY = -1 / 40 * e.wheelDelta;
+ if (e.wheelDeltaX) {
+ e.deltaX = -1 / 40 * e.wheelDeltaX;
+ }
+ } else {
+ e.deltaX = 0;
+ e.deltaY = e.detail;
+ }
+ e = eventCtrl.fire('wheel', e);
+ }
+ nativeEvents = eventCtrl._nativeEvents;
+ if (nativeEvents) {
+ parents = eventCtrl.parents().toArray();
+ parents.unshift(eventCtrl);
+ for (i = 0, l = parents.length; !eventRootCtrl && i < l; i++) {
+ eventRootCtrl = parents[i]._eventsRoot;
+ }
+ if (!eventRootCtrl) {
+ eventRootCtrl = parents[parents.length - 1] || eventCtrl;
+ }
+ eventCtrl._eventsRoot = eventRootCtrl;
+ for (l = i, i = 0; i < l; i++) {
+ parents[i]._eventsRoot = eventRootCtrl;
+ }
+ var eventRootDelegates = eventRootCtrl._delegates;
+ if (!eventRootDelegates) {
+ eventRootDelegates = eventRootCtrl._delegates = {};
+ }
+ for (name in nativeEvents) {
+ if (!nativeEvents) {
+ return false;
+ }
+ if (name === 'wheel' && !hasWheelEventSupport) {
+ if (hasMouseWheelEventSupport) {
+ global$9(eventCtrl.getEl()).on('mousewheel', fixWheelEvent);
+ } else {
+ global$9(eventCtrl.getEl()).on('DOMMouseScroll', fixWheelEvent);
+ }
+ continue;
+ }
+ if (name === 'mouseenter' || name === 'mouseleave') {
+ if (!eventRootCtrl._hasMouseEnter) {
+ global$9(eventRootCtrl.getEl()).on('mouseleave', mouseLeaveHandler).on('mouseover', mouseEnterHandler);
+ eventRootCtrl._hasMouseEnter = 1;
+ }
+ } else if (!eventRootDelegates[name]) {
+ global$9(eventRootCtrl.getEl()).on(name, delegate);
+ eventRootDelegates[name] = true;
+ }
+ nativeEvents[name] = false;
+ }
+ }
+ }
+ var Control$1 = Control;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- delete settings.toolbar;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasTabstopData = function (elm) {
+ return elm.getAttribute('data-mce-tabstop') ? true : false;
+ };
+ function KeyboardNavigation (settings) {
+ var root = settings.root;
+ var focusedElement, focusedControl;
+ function isElement(node) {
+ return node && node.nodeType === 1;
+ }
+ try {
+ focusedElement = document.activeElement;
+ } catch (ex) {
+ focusedElement = document.body;
+ }
+ focusedControl = root.getParentCtrl(focusedElement);
+ function getRole(elm) {
+ elm = elm || focusedElement;
+ if (isElement(elm)) {
+ return elm.getAttribute('role');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Generate toolbar<n>
- for (var i = 1; i < 10; i++) {
- if (!addToolbar(settings["toolbar" + i])) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
+ }
+ function getParentRole(elm) {
+ var role, parent = elm || focusedElement;
+ while (parent = parent.parentNode) {
+ if (role = getRole(parent)) {
+ return role;
+ }
+ }
+ }
+ function getAriaProp(name) {
+ var elm = focusedElement;
+ if (isElement(elm)) {
+ return elm.getAttribute('aria-' + name);
+ }
+ }
+ function isTextInputElement(elm) {
+ var tagName = elm.tagName.toUpperCase();
+ return tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT';
+ }
+ function canFocus(elm) {
+ if (isTextInputElement(elm) && !elm.hidden) {
+ return true;
+ }
+ if (hasTabstopData(elm)) {
+ return true;
+ }
+ if (/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell|slider)$/.test(getRole(elm))) {
+ return true;
+ }
+ return false;
+ }
+ function getFocusElements(elm) {
+ var elements = [];
+ function collect(elm) {
+ if (elm.nodeType !== 1 || elm.style.display === 'none' || elm.disabled) {
+ return;
+ }
+ if (canFocus(elm)) {
+ elements.push(elm);
+ }
+ for (var i = 0; i < elm.childNodes.length; i++) {
+ collect(elm.childNodes[i]);
+ }
+ }
+ collect(elm || root.getEl());
+ return elements;
+ }
+ function getNavigationRoot(targetControl) {
+ var navigationRoot, controls;
+ targetControl = targetControl || focusedControl;
+ controls = targetControl.parents().toArray();
+ controls.unshift(targetControl);
+ for (var i = 0; i < controls.length; i++) {
+ navigationRoot = controls[i];
+ if (navigationRoot.settings.ariaRoot) {
</ins><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return navigationRoot;
+ }
+ function focusFirst(targetControl) {
+ var navigationRoot = getNavigationRoot(targetControl);
+ var focusElements = getFocusElements(navigationRoot.getEl());
+ if (navigationRoot.settings.ariaRemember && 'lastAriaIndex' in navigationRoot) {
+ moveFocusToIndex(navigationRoot.lastAriaIndex, focusElements);
+ } else {
+ moveFocusToIndex(0, focusElements);
+ }
+ }
+ function moveFocusToIndex(idx, elements) {
+ if (idx < 0) {
+ idx = elements.length - 1;
+ } else if (idx >= elements.length) {
+ idx = 0;
+ }
+ if (elements[idx]) {
+ elements[idx].focus();
+ }
+ return idx;
+ }
+ function moveFocus(dir, elements) {
+ var idx = -1;
+ var navigationRoot = getNavigationRoot();
+ elements = elements || getFocusElements(navigationRoot.getEl());
+ for (var i = 0; i < elements.length; i++) {
+ if (elements[i] === focusedElement) {
+ idx = i;
+ }
+ }
+ idx += dir;
+ navigationRoot.lastAriaIndex = moveFocusToIndex(idx, elements);
+ }
+ function left() {
+ var parentRole = getParentRole();
+ if (parentRole === 'tablist') {
+ moveFocus(-1, getFocusElements(focusedElement.parentNode));
+ } else if (focusedControl.parent().submenu) {
+ cancel();
+ } else {
+ moveFocus(-1);
+ }
+ }
+ function right() {
+ var role = getRole(), parentRole = getParentRole();
+ if (parentRole === 'tablist') {
+ moveFocus(1, getFocusElements(focusedElement.parentNode));
+ } else if (role === 'menuitem' && parentRole === 'menu' && getAriaProp('haspopup')) {
+ enter();
+ } else {
+ moveFocus(1);
+ }
+ }
+ function up() {
+ moveFocus(-1);
+ }
+ function down() {
+ var role = getRole(), parentRole = getParentRole();
+ if (role === 'menuitem' && parentRole === 'menubar') {
+ enter();
+ } else if (role === 'button' && getAriaProp('haspopup')) {
+ enter({ key: 'down' });
+ } else {
+ moveFocus(1);
+ }
+ }
+ function tab(e) {
+ var parentRole = getParentRole();
+ if (parentRole === 'tablist') {
+ var elm = getFocusElements(focusedControl.getEl('body'))[0];
+ if (elm) {
+ elm.focus();
+ }
+ } else {
+ moveFocus(e.shiftKey ? -1 : 1);
+ }
+ }
+ function cancel() {
+ focusedControl.fire('cancel');
+ }
+ function enter(aria) {
+ aria = aria || {};
+ focusedControl.fire('click', {
+ target: focusedElement,
+ aria: aria
+ });
+ }
+ root.on('keydown', function (e) {
+ function handleNonTabOrEscEvent(e, handler) {
+ if (isTextInputElement(focusedElement) || hasTabstopData(focusedElement)) {
+ return;
+ }
+ if (getRole(focusedElement) === 'slider') {
+ return;
+ }
+ if (handler(e) !== false) {
+ e.preventDefault();
+ }
+ }
+ if (e.isDefaultPrevented()) {
+ return;
+ }
+ switch (e.keyCode) {
+ case 37:
+ handleNonTabOrEscEvent(e, left);
+ break;
+ case 39:
+ handleNonTabOrEscEvent(e, right);
+ break;
+ case 38:
+ handleNonTabOrEscEvent(e, up);
+ break;
+ case 40:
+ handleNonTabOrEscEvent(e, down);
+ break;
+ case 27:
+ cancel();
+ break;
+ case 14:
+ case 13:
+ case 32:
+ handleNonTabOrEscEvent(e, enter);
+ break;
+ case 9:
+ tab(e);
+ e.preventDefault();
+ break;
+ }
+ });
+ root.on('focusin', function (e) {
+ focusedElement = e.target;
+ focusedControl = e.control;
+ });
+ return { focusFirst: focusFirst };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Generate toolbar or default toolbar unless it's disabled
- if (!toolbars.length && settings.toolbar !== false) {
- addToolbar(settings.toolbar || defaultToolbar);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var selectorCache = {};
+ var Container = Control$1.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ settings = self.settings;
+ if (settings.fixed) {
+ self.state.set('fixed', true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (toolbars.length) {
- return {
- type: 'panel',
- layout: 'stack',
- classes: "toolbar-grp",
- ariaRoot: true,
- ariaRemember: true,
- items: toolbars
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self._items = new Collection$2();
+ if (self.isRtl()) {
+ self.classes.add('rtl');
+ }
+ self.bodyClasses = new ClassList(function () {
+ if (self.state.get('rendered')) {
+ self.getEl('body').className = this.toString();
+ }
+ });
+ self.bodyClasses.prefix = self.classPrefix;
+ self.classes.add('container');
+ self.bodyClasses.add('container-body');
+ if (settings.containerCls) {
+ self.classes.add(settings.containerCls);
+ }
+ self._layout = global$4.create((settings.layout || '') + 'layout');
+ if (self.settings.items) {
+ self.add(self.settings.items);
+ } else {
+ self.add(self.render());
+ }
+ self._hasBody = true;
+ },
+ items: function () {
+ return this._items;
+ },
+ find: function (selector) {
+ selector = selectorCache[selector] = selectorCache[selector] || new Selector(selector);
+ return selector.find(this);
+ },
+ add: function (items) {
+ var self = this;
+ self.items().add(self.create(items)).parent(self);
+ return self;
+ },
+ focus: function (keyboard) {
+ var self = this;
+ var focusCtrl, keyboardNav, items;
+ if (keyboard) {
+ keyboardNav = self.keyboardNav || self.parents().eq(-1)[0].keyboardNav;
+ if (keyboardNav) {
+ keyboardNav.focusFirst(self);
+ return;
+ }
+ }
+ items = self.find('*');
+ if (self.statusbar) {
+ items.add(self.statusbar.items());
+ }
+ items.each(function (ctrl) {
+ if (ctrl.settings.autofocus) {
+ focusCtrl = null;
+ return false;
+ }
+ if (ctrl.canFocus) {
+ focusCtrl = focusCtrl || ctrl;
+ }
+ });
+ if (focusCtrl) {
+ focusCtrl.focus();
+ }
+ return self;
+ },
+ replace: function (oldItem, newItem) {
+ var ctrlElm;
+ var items = this.items();
+ var i = items.length;
+ while (i--) {
+ if (items[i] === oldItem) {
+ items[i] = newItem;
+ break;
+ }
+ }
+ if (i >= 0) {
+ ctrlElm = newItem.getEl();
+ if (ctrlElm) {
+ ctrlElm.parentNode.removeChild(ctrlElm);
+ }
+ ctrlElm = oldItem.getEl();
+ if (ctrlElm) {
+ ctrlElm.parentNode.removeChild(ctrlElm);
+ }
+ }
+ newItem.parent(this);
+ },
+ create: function (items) {
+ var self = this;
+ var settings;
+ var ctrlItems = [];
+ if (!global$2.isArray(items)) {
+ items = [items];
+ }
+ global$2.each(items, function (item) {
+ if (item) {
+ if (!(item instanceof Control$1)) {
+ if (typeof item === 'string') {
+ item = { type: item };
+ }
+ settings = global$2.extend({}, self.settings.defaults, item);
+ item.type = settings.type = settings.type || item.type || self.settings.defaultType || (settings.defaults ? settings.defaults.type : null);
+ item = global$4.create(settings);
+ }
+ ctrlItems.push(item);
+ }
+ });
+ return ctrlItems;
+ },
+ renderNew: function () {
+ var self = this;
+ self.items().each(function (ctrl, index) {
+ var containerElm;
+ ctrl.parent(self);
+ if (!ctrl.state.get('rendered')) {
+ containerElm = self.getEl('body');
+ if (containerElm.hasChildNodes() && index <= containerElm.childNodes.length - 1) {
+ global$9(containerElm.childNodes[index]).before(ctrl.renderHtml());
+ } else {
+ global$9(containerElm).append(ctrl.renderHtml());
+ }
+ ctrl.postRender();
+ $_5c4g75txjfuw8sfo.add(ctrl);
+ }
+ });
+ self._layout.applyClasses(self.items().filter(':visible'));
+ self._lastRect = null;
+ return self;
+ },
+ append: function (items) {
+ return this.add(items).renderNew();
+ },
+ prepend: function (items) {
+ var self = this;
+ self.items().set(self.create(items).concat(self.items().toArray()));
+ return self.renderNew();
+ },
+ insert: function (items, index, before) {
+ var self = this;
+ var curItems, beforeItems, afterItems;
+ items = self.create(items);
+ curItems = self.items();
+ if (!before && index < curItems.length - 1) {
+ index += 1;
+ }
+ if (index >= 0 && index < curItems.length) {
+ beforeItems = curItems.slice(0, index).toArray();
+ afterItems = curItems.slice(index).toArray();
+ curItems.set(beforeItems.concat(items, afterItems));
+ }
+ return self.renderNew();
+ },
+ fromJSON: function (data) {
+ var self = this;
+ for (var name_1 in data) {
+ self.find('#' + name_1).value(data[name_1]);
+ }
+ return self;
+ },
+ toJSON: function () {
+ var self = this, data = {};
+ self.find('*').each(function (ctrl) {
+ var name = ctrl.name(), value = ctrl.value();
+ if (name && typeof value !== 'undefined') {
+ data[name] = value;
+ }
+ });
+ return data;
+ },
+ renderHtml: function () {
+ var self = this, layout = self._layout, role = this.settings.role;
+ self.preRender();
+ layout.preRender(self);
+ return '<div id="' + self._id + '" class="' + self.classes + '"' + (role ? ' role="' + this.settings.role + '"' : '') + '>' + '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' + (self.settings.html || '') + layout.renderHtml(self) + '</div>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ var box;
+ self.items().exec('postRender');
+ self._super();
+ self._layout.postRender(self);
+ self.state.set('rendered', true);
+ if (self.settings.style) {
+ self.$el.css(self.settings.style);
+ }
+ if (self.settings.border) {
+ box = self.borderBox;
+ self.$el.css({
+ 'border-top-width': box.top,
+ 'border-right-width': box.right,
+ 'border-bottom-width': box.bottom,
+ 'border-left-width': box.left
+ });
+ }
+ if (!self.parent()) {
+ self.keyboardNav = KeyboardNavigation({ root: self });
+ }
+ return self;
+ },
+ initLayoutRect: function () {
+ var self = this, layoutRect = self._super();
+ self._layout.recalc(self);
+ return layoutRect;
+ },
+ recalc: function () {
+ var self = this;
+ var rect = self._layoutRect;
+ var lastRect = self._lastRect;
+ if (!lastRect || lastRect.w !== rect.w || lastRect.h !== rect.h) {
+ self._layout.recalc(self);
+ rect = self.layoutRect();
+ self._lastRect = {
+ x: rect.x,
+ y: rect.y,
+ w: rect.w,
+ h: rect.h
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ reflow: function () {
+ var i;
+ $_5c4g75txjfuw8sfo.remove(this);
+ if (this.visible()) {
+ Control$1.repaintControls = [];
+ Control$1.repaintControls.map = {};
+ this.recalc();
+ i = Control$1.repaintControls.length;
+ while (i--) {
+ Control$1.repaintControls[i].repaint();
+ }
+ if (this.settings.layout !== 'flow' && this.settings.layout !== 'stack') {
+ this.repaint();
+ }
+ Control$1.repaintControls = [];
+ }
+ return this;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function getDocumentSize(doc) {
+ var documentElement, body, scrollWidth, clientWidth;
+ var offsetWidth, scrollHeight, clientHeight, offsetHeight;
+ var max = Math.max;
+ documentElement = doc.documentElement;
+ body = doc.body;
+ scrollWidth = max(documentElement.scrollWidth, body.scrollWidth);
+ clientWidth = max(documentElement.clientWidth, body.clientWidth);
+ offsetWidth = max(documentElement.offsetWidth, body.offsetWidth);
+ scrollHeight = max(documentElement.scrollHeight, body.scrollHeight);
+ clientHeight = max(documentElement.clientHeight, body.clientHeight);
+ offsetHeight = max(documentElement.offsetHeight, body.offsetHeight);
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- createToolbar: createToolbar,
- createToolbars: createToolbars
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ width: scrollWidth < offsetWidth ? clientWidth : scrollWidth,
+ height: scrollHeight < offsetHeight ? clientHeight : scrollHeight
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function updateWithTouchData(e) {
+ var keys, i;
+ if (e.changedTouches) {
+ keys = 'screenX screenY pageX pageY clientX clientY'.split(' ');
+ for (i = 0; i < keys.length; i++) {
+ e[keys[i]] = e.changedTouches[0][keys[i]];
+ }
+ }
+ }
+ function DragHelper (id, settings) {
+ var $eventOverlay;
+ var doc = settings.document || document;
+ var downButton;
+ var start, stop, drag, startX, startY;
+ settings = settings || {};
+ var handleElement = doc.getElementById(settings.handle || id);
+ start = function (e) {
+ var docSize = getDocumentSize(doc);
+ var handleElm, cursor;
+ updateWithTouchData(e);
+ e.preventDefault();
+ downButton = e.button;
+ handleElm = handleElement;
+ startX = e.screenX;
+ startY = e.screenY;
+ if (window.getComputedStyle) {
+ cursor = window.getComputedStyle(handleElm, null).getPropertyValue('cursor');
+ } else {
+ cursor = handleElm.runtimeStyle.cursor;
+ }
+ $eventOverlay = global$9('<div></div>').css({
+ position: 'absolute',
+ top: 0,
+ left: 0,
+ width: docSize.width,
+ height: docSize.height,
+ zIndex: 2147483647,
+ opacity: 0.0001,
+ cursor: cursor
+ }).appendTo(doc.body);
+ global$9(doc).on('mousemove touchmove', drag).on('mouseup touchend', stop);
+ settings.start(e);
+ };
+ drag = function (e) {
+ updateWithTouchData(e);
+ if (e.button !== downButton) {
+ return stop(e);
+ }
+ e.deltaX = e.screenX - startX;
+ e.deltaY = e.screenY - startY;
+ e.preventDefault();
+ settings.drag(e);
+ };
+ stop = function (e) {
+ updateWithTouchData(e);
+ global$9(doc).off('mousemove touchmove', drag).off('mouseup touchend', stop);
+ $eventOverlay.remove();
+ if (settings.stop) {
+ settings.stop(e);
+ }
+ };
+ this.destroy = function () {
+ global$9(handleElement).off();
+ };
+ global$9(handleElement).on('mousedown touchstart', start);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ContextToolbars.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_8d5ltqtzjfuw8sfw = {
+ init: function () {
+ var self = this;
+ self.on('repaint', self.renderScroll);
+ },
+ renderScroll: function () {
+ var self = this, margin = 2;
+ function repaintScroll() {
+ var hasScrollH, hasScrollV, bodyElm;
+ function repaintAxis(axisName, posName, sizeName, contentSizeName, hasScroll, ax) {
+ var containerElm, scrollBarElm, scrollThumbElm;
+ var containerSize, scrollSize, ratio, rect;
+ var posNameLower, sizeNameLower;
+ scrollBarElm = self.getEl('scroll' + axisName);
+ if (scrollBarElm) {
+ posNameLower = posName.toLowerCase();
+ sizeNameLower = sizeName.toLowerCase();
+ global$9(self.getEl('absend')).css(posNameLower, self.layoutRect()[contentSizeName] - 1);
+ if (!hasScroll) {
+ global$9(scrollBarElm).css('display', 'none');
+ return;
+ }
+ global$9(scrollBarElm).css('display', 'block');
+ containerElm = self.getEl('body');
+ scrollThumbElm = self.getEl('scroll' + axisName + 't');
+ containerSize = containerElm['client' + sizeName] - margin * 2;
+ containerSize -= hasScrollH && hasScrollV ? scrollBarElm['client' + ax] : 0;
+ scrollSize = containerElm['scroll' + sizeName];
+ ratio = containerSize / scrollSize;
+ rect = {};
+ rect[posNameLower] = containerElm['offset' + posName] + margin;
+ rect[sizeNameLower] = containerSize;
+ global$9(scrollBarElm).css(rect);
+ rect = {};
+ rect[posNameLower] = containerElm['scroll' + posName] * ratio;
+ rect[sizeNameLower] = containerSize * ratio;
+ global$9(scrollThumbElm).css(rect);
+ }
+ }
+ bodyElm = self.getEl('body');
+ hasScrollH = bodyElm.scrollWidth > bodyElm.clientWidth;
+ hasScrollV = bodyElm.scrollHeight > bodyElm.clientHeight;
+ repaintAxis('h', 'Left', 'Width', 'contentW', hasScrollH, 'Height');
+ repaintAxis('v', 'Top', 'Height', 'contentH', hasScrollV, 'Width');
+ }
+ function addScroll() {
+ function addScrollAxis(axisName, posName, sizeName, deltaPosName, ax) {
+ var scrollStart;
+ var axisId = self._id + '-scroll' + axisName, prefix = self.classPrefix;
+ global$9(self.getEl()).append('<div id="' + axisId + '" class="' + prefix + 'scrollbar ' + prefix + 'scrollbar-' + axisName + '">' + '<div id="' + axisId + 't" class="' + prefix + 'scrollbar-thumb"></div>' + '</div>');
+ self.draghelper = new DragHelper(axisId + 't', {
+ start: function () {
+ scrollStart = self.getEl('body')['scroll' + posName];
+ global$9('#' + axisId).addClass(prefix + 'active');
+ },
+ drag: function (e) {
+ var ratio, hasScrollH, hasScrollV, containerSize;
+ var layoutRect = self.layoutRect();
+ hasScrollH = layoutRect.contentW > layoutRect.innerW;
+ hasScrollV = layoutRect.contentH > layoutRect.innerH;
+ containerSize = self.getEl('body')['client' + sizeName] - margin * 2;
+ containerSize -= hasScrollH && hasScrollV ? self.getEl('scroll' + axisName)['client' + ax] : 0;
+ ratio = containerSize / self.getEl('body')['scroll' + sizeName];
+ self.getEl('body')['scroll' + posName] = scrollStart + e['delta' + deltaPosName] / ratio;
+ },
+ stop: function () {
+ global$9('#' + axisId).removeClass(prefix + 'active');
+ }
+ });
+ }
+ self.classes.add('scroll');
+ addScrollAxis('v', 'Top', 'Height', 'Y', 'Width');
+ addScrollAxis('h', 'Left', 'Width', 'X', 'Height');
+ }
+ if (self.settings.autoScroll) {
+ if (!self._hasScroll) {
+ self._hasScroll = true;
+ addScroll();
+ self.on('wheel', function (e) {
+ var bodyEl = self.getEl('body');
+ bodyEl.scrollLeft += (e.deltaX || 0) * 10;
+ bodyEl.scrollTop += e.deltaY * 10;
+ repaintScroll();
+ });
+ global$9(self.getEl('body')).on('scroll', repaintScroll);
+ }
+ repaintScroll();
+ }
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.modern.ui.ContextToolbars',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.Delay',
- 'tinymce.core.ui.Factory',
- 'tinymce.core.geom.Rect',
- 'tinymce.themes.modern.ui.Toolbar'
- ],
- function (DOMUtils, Tools, Delay, Factory, Rect, Toolbar) {
- var DOM = DOMUtils.DOM;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Panel = Container.extend({
+ Defaults: {
+ layout: 'fit',
+ containerCls: 'panel'
+ },
+ Mixins: [$_8d5ltqtzjfuw8sfw],
+ renderHtml: function () {
+ var self = this;
+ var layout = self._layout;
+ var innerHtml = self.settings.html;
+ self.preRender();
+ layout.preRender(self);
+ if (typeof innerHtml === 'undefined') {
+ innerHtml = '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' + layout.renderHtml(self) + '</div>';
+ } else {
+ if (typeof innerHtml === 'function') {
+ innerHtml = innerHtml.call(self);
+ }
+ self._hasBody = false;
+ }
+ return '<div id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1" role="group">' + (self._preBodyHtml || '') + innerHtml + '</div>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var toClientRect = function (geomRect) {
- return {
- left: geomRect.x,
- top: geomRect.y,
- width: geomRect.w,
- height: geomRect.h,
- right: geomRect.x + geomRect.w,
- bottom: geomRect.y + geomRect.h
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_4ucwx9u1jfuw8sg2 = {
+ resizeToContent: function () {
+ this._layoutRect.autoResize = true;
+ this._lastRect = null;
+ this.reflow();
+ },
+ resizeTo: function (w, h) {
+ if (w <= 1 || h <= 1) {
+ var rect = funcs.getWindowSize();
+ w = w <= 1 ? w * rect.w : w;
+ h = h <= 1 ? h * rect.h : h;
+ }
+ this._layoutRect.autoResize = false;
+ return this.layoutRect({
+ minW: w,
+ minH: h,
+ w: w,
+ h: h
+ }).reflow();
+ },
+ resizeBy: function (dw, dh) {
+ var self = this, rect = self.layoutRect();
+ return self.resizeTo(rect.w + dw, rect.h + dh);
+ }
+ };
+
+ var documentClickHandler;
+ var documentScrollHandler;
+ var windowResizeHandler;
+ var visiblePanels = [];
+ var zOrder = [];
+ var hasModal;
+ function isChildOf(ctrl, parent) {
+ while (ctrl) {
+ if (ctrl === parent) {
+ return true;
+ }
+ ctrl = ctrl.parent();
+ }
+ }
+ function skipOrHidePanels(e) {
+ var i = visiblePanels.length;
+ while (i--) {
+ var panel = visiblePanels[i], clickCtrl = panel.getParentCtrl(e.target);
+ if (panel.settings.autohide) {
+ if (clickCtrl) {
+ if (isChildOf(clickCtrl, panel) || panel.parent() === clickCtrl) {
+ continue;
+ }
+ }
+ e = panel.fire('autohide', { target: e.target });
+ if (!e.isDefaultPrevented()) {
+ panel.hide();
+ }
+ }
+ }
+ }
+ function bindDocumentClickHandler() {
+ if (!documentClickHandler) {
+ documentClickHandler = function (e) {
+ if (e.button === 2) {
+ return;
+ }
+ skipOrHidePanels(e);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global$9(document).on('click touchstart', documentClickHandler);
+ }
+ }
+ function bindDocumentScrollHandler() {
+ if (!documentScrollHandler) {
+ documentScrollHandler = function () {
+ var i;
+ i = visiblePanels.length;
+ while (i--) {
+ repositionPanel(visiblePanels[i]);
+ }
+ };
+ global$9(window).on('scroll', documentScrollHandler);
+ }
+ }
+ function bindWindowResizeHandler() {
+ if (!windowResizeHandler) {
+ var docElm_1 = document.documentElement;
+ var clientWidth_1 = docElm_1.clientWidth, clientHeight_1 = docElm_1.clientHeight;
+ windowResizeHandler = function () {
+ if (!document.all || clientWidth_1 !== docElm_1.clientWidth || clientHeight_1 !== docElm_1.clientHeight) {
+ clientWidth_1 = docElm_1.clientWidth;
+ clientHeight_1 = docElm_1.clientHeight;
+ FloatPanel.hideAll();
+ }
+ };
+ global$9(window).on('resize', windowResizeHandler);
+ }
+ }
+ function repositionPanel(panel) {
+ var scrollY = funcs.getViewPort().y;
+ function toggleFixedChildPanels(fixed, deltaY) {
+ var parent;
+ for (var i = 0; i < visiblePanels.length; i++) {
+ if (visiblePanels[i] !== panel) {
+ parent = visiblePanels[i].parent();
+ while (parent && (parent = parent.parent())) {
+ if (parent === panel) {
+ visiblePanels[i].fixed(fixed).moveBy(0, deltaY).repaint();
+ }
+ }
+ }
+ }
+ }
+ if (panel.settings.autofix) {
+ if (!panel.state.get('fixed')) {
+ panel._autoFixY = panel.layoutRect().y;
+ if (panel._autoFixY < scrollY) {
+ panel.fixed(true).layoutRect({ y: 0 }).repaint();
+ toggleFixedChildPanels(true, scrollY - panel._autoFixY);
+ }
+ } else {
+ if (panel._autoFixY > scrollY) {
+ panel.fixed(false).layoutRect({ y: panel._autoFixY }).repaint();
+ toggleFixedChildPanels(false, panel._autoFixY - scrollY);
+ }
+ }
+ }
+ }
+ function addRemove(add, ctrl) {
+ var i, zIndex = FloatPanel.zIndex || 65535, topModal;
+ if (add) {
+ zOrder.push(ctrl);
+ } else {
+ i = zOrder.length;
+ while (i--) {
+ if (zOrder[i] === ctrl) {
+ zOrder.splice(i, 1);
+ }
+ }
+ }
+ if (zOrder.length) {
+ for (i = 0; i < zOrder.length; i++) {
+ if (zOrder[i].modal) {
+ zIndex++;
+ topModal = zOrder[i];
+ }
+ zOrder[i].getEl().style.zIndex = zIndex;
+ zOrder[i].zIndex = zIndex;
+ zIndex++;
+ }
+ }
+ var modalBlockEl = global$9('#' + ctrl.classPrefix + 'modal-block', ctrl.getContainerElm())[0];
+ if (topModal) {
+ global$9(modalBlockEl).css('z-index', topModal.zIndex - 1);
+ } else if (modalBlockEl) {
+ modalBlockEl.parentNode.removeChild(modalBlockEl);
+ hasModal = false;
+ }
+ FloatPanel.currentZIndex = zIndex;
+ }
+ var FloatPanel = Panel.extend({
+ Mixins: [
+ $_831wnjtkjfuw8sdt,
+ $_4ucwx9u1jfuw8sg2
+ ],
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self._eventsRoot = self;
+ self.classes.add('floatpanel');
+ if (settings.autohide) {
+ bindDocumentClickHandler();
+ bindWindowResizeHandler();
+ visiblePanels.push(self);
+ }
+ if (settings.autofix) {
+ bindDocumentScrollHandler();
+ self.on('move', function () {
+ repositionPanel(this);
+ });
+ }
+ self.on('postrender show', function (e) {
+ if (e.control === self) {
+ var $modalBlockEl_1;
+ var prefix_1 = self.classPrefix;
+ if (self.modal && !hasModal) {
+ $modalBlockEl_1 = global$9('#' + prefix_1 + 'modal-block', self.getContainerElm());
+ if (!$modalBlockEl_1[0]) {
+ $modalBlockEl_1 = global$9('<div id="' + prefix_1 + 'modal-block" class="' + prefix_1 + 'reset ' + prefix_1 + 'fade"></div>').appendTo(self.getContainerElm());
+ }
+ global$7.setTimeout(function () {
+ $modalBlockEl_1.addClass(prefix_1 + 'in');
+ global$9(self.getEl()).addClass(prefix_1 + 'in');
+ });
+ hasModal = true;
+ }
+ addRemove(true, self);
+ }
+ });
+ self.on('show', function () {
+ self.parents().each(function (ctrl) {
+ if (ctrl.state.get('fixed')) {
+ self.fixed(true);
+ return false;
+ }
+ });
+ });
+ if (settings.popover) {
+ self._preBodyHtml = '<div class="' + self.classPrefix + 'arrow"></div>';
+ self.classes.add('popover').add('bottom').add(self.isRtl() ? 'end' : 'start');
+ }
+ self.aria('label', settings.ariaLabel);
+ self.aria('labelledby', self._id);
+ self.aria('describedby', self.describedBy || self._id + '-none');
+ },
+ fixed: function (state) {
+ var self = this;
+ if (self.state.get('fixed') !== state) {
+ if (self.state.get('rendered')) {
+ var viewport = funcs.getViewPort();
+ if (state) {
+ self.layoutRect().y -= viewport.y;
+ } else {
+ self.layoutRect().y += viewport.y;
+ }
+ }
+ self.classes.toggle('fixed', state);
+ self.state.set('fixed', state);
+ }
+ return self;
+ },
+ show: function () {
+ var self = this;
+ var i;
+ var state = self._super();
+ i = visiblePanels.length;
+ while (i--) {
+ if (visiblePanels[i] === self) {
+ break;
+ }
+ }
+ if (i === -1) {
+ visiblePanels.push(self);
+ }
+ return state;
+ },
+ hide: function () {
+ removeVisiblePanel(this);
+ addRemove(false, this);
+ return this._super();
+ },
+ hideAll: function () {
+ FloatPanel.hideAll();
+ },
+ close: function () {
+ var self = this;
+ if (!self.fire('close').isDefaultPrevented()) {
+ self.remove();
+ addRemove(false, self);
+ }
+ return self;
+ },
+ remove: function () {
+ removeVisiblePanel(this);
+ this._super();
+ },
+ postRender: function () {
+ var self = this;
+ if (self.settings.bodyRole) {
+ this.getEl('body').setAttribute('role', self.settings.bodyRole);
+ }
+ return self._super();
+ }
+ });
+ FloatPanel.hideAll = function () {
+ var i = visiblePanels.length;
+ while (i--) {
+ var panel = visiblePanels[i];
+ if (panel && panel.settings.autohide) {
+ panel.hide();
+ visiblePanels.splice(i, 1);
+ }
+ }
+ };
+ function removeVisiblePanel(panel) {
+ var i;
+ i = visiblePanels.length;
+ while (i--) {
+ if (visiblePanels[i] === panel) {
+ visiblePanels.splice(i, 1);
+ }
+ }
+ i = zOrder.length;
+ while (i--) {
+ if (zOrder[i] === panel) {
+ zOrder.splice(i, 1);
+ }
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var hideAllFloatingPanels = function (editor) {
- Tools.each(editor.contextToolbars, function (toolbar) {
- if (toolbar.panel) {
- toolbar.panel.hide();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isFixed$1 = function (inlineToolbarContainer, editor) {
+ return !!(inlineToolbarContainer && !editor.settings.ui_container);
+ };
+ var render$1 = function (editor, theme, args) {
+ var panel, inlineToolbarContainer;
+ var DOM = global$3.DOM;
+ var fixedToolbarContainer = getFixedToolbarContainer(editor);
+ if (fixedToolbarContainer) {
+ inlineToolbarContainer = DOM.select(fixedToolbarContainer)[0];
+ }
+ var reposition = function () {
+ if (panel && panel.moveRel && panel.visible() && !panel._fixed) {
+ var scrollContainer = editor.selection.getScrollContainer(), body = editor.getBody();
+ var deltaX = 0, deltaY = 0;
+ if (scrollContainer) {
+ var bodyPos = DOM.getPos(body), scrollContainerPos = DOM.getPos(scrollContainer);
+ deltaX = Math.max(0, scrollContainerPos.x - bodyPos.x);
+ deltaY = Math.max(0, scrollContainerPos.y - bodyPos.y);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ panel.fixed(false).moveRel(body, editor.rtl ? [
+ 'tr-br',
+ 'br-tr'
+ ] : [
+ 'tl-bl',
+ 'bl-tl',
+ 'tr-br'
+ ]).moveBy(deltaX, deltaY);
+ }
+ };
+ var show = function () {
+ if (panel) {
+ panel.show();
+ reposition();
+ DOM.addClass(editor.getBody(), 'mce-edit-focus');
+ }
+ };
+ var hide = function () {
+ if (panel) {
+ panel.hide();
+ FloatPanel.hideAll();
+ DOM.removeClass(editor.getBody(), 'mce-edit-focus');
+ }
+ };
+ var render = function () {
+ if (panel) {
+ if (!panel.visible()) {
+ show();
+ }
+ return;
+ }
+ panel = theme.panel = global$4.create({
+ type: inlineToolbarContainer ? 'panel' : 'floatpanel',
+ role: 'application',
+ classes: 'tinymce tinymce-inline',
+ layout: 'flex',
+ direction: 'column',
+ align: 'stretch',
+ autohide: false,
+ autofix: isFixed$1(inlineToolbarContainer, editor),
+ fixed: isFixed$1(inlineToolbarContainer, editor),
+ border: 1,
+ items: [
+ hasMenubar(editor) === false ? null : {
+ type: 'menubar',
+ border: '0 0 1 0',
+ items: $_armr7nt9jfuw8scm.createMenuButtons(editor)
+ },
+ $_457dd7t8jfuw8scj.createToolbars(editor, getToolbarSize(editor))
+ ]
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_435hnxt5jfuw8sc9.setUiContainer(editor, panel);
+ $_b6da16t0jfuw8sbv.fireBeforeRenderUI(editor);
+ if (inlineToolbarContainer) {
+ panel.renderTo(inlineToolbarContainer).reflow();
+ } else {
+ panel.renderTo().reflow();
+ }
+ $_gaf3jet1jfuw8sbw.addKeys(editor, panel);
+ show();
+ $_v47mpt2jfuw8sc3.addContextualToolbars(editor);
+ editor.on('nodeChange', reposition);
+ editor.on('ResizeWindow', reposition);
+ editor.on('activate', show);
+ editor.on('deactivate', hide);
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.settings.content_editable = true;
+ editor.on('focus', function () {
+ if (isSkinDisabled(editor) === false && args.skinUiCss) {
+ DOM.styleSheetLoader.load(args.skinUiCss, render, render);
+ } else {
+ render();
+ }
+ });
+ editor.on('blur hide', hide);
+ editor.on('remove', function () {
+ if (panel) {
+ panel.remove();
+ panel = null;
+ }
+ });
+ if (isSkinDisabled(editor) === false && args.skinUiCss) {
+ DOM.styleSheetLoader.load(args.skinUiCss, $_g47gistfjfuw8sd5.fireSkinLoaded(editor));
+ } else {
+ $_g47gistfjfuw8sd5.fireSkinLoaded(editor)();
+ }
+ return {};
+ };
+ var $_g6zuymtgjfuw8sd6 = { render: render$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var movePanelTo = function (panel, pos) {
- panel.moveTo(pos.left, pos.top);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function Throbber (elm, inline) {
+ var self = this;
+ var state;
+ var classPrefix = Control$1.classPrefix;
+ var timer;
+ self.show = function (time, callback) {
+ function render() {
+ if (state) {
+ global$9(elm).append('<div class="' + classPrefix + 'throbber' + (inline ? ' ' + classPrefix + 'throbber-inline' : '') + '"></div>');
+ if (callback) {
+ callback();
+ }
+ }
+ }
+ self.hide();
+ state = true;
+ if (time) {
+ timer = global$7.setTimeout(render, time);
+ } else {
+ render();
+ }
+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.hide = function () {
+ var child = elm.lastChild;
+ global$7.clearTimeout(timer);
+ if (child && child.className.indexOf('throbber') !== -1) {
+ child.parentNode.removeChild(child);
+ }
+ state = false;
+ return self;
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var togglePositionClass = function (panel, relPos, predicate) {
- relPos = relPos ? relPos.substr(0, 2) : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setup = function (editor, theme) {
+ var throbber;
+ editor.on('ProgressState', function (e) {
+ throbber = throbber || new Throbber(theme.panel.getEl('body'));
+ if (e.state) {
+ throbber.show(e.time);
+ } else {
+ throbber.hide();
+ }
+ });
+ };
+ var $_bm31cfu2jfuw8sg3 = { setup: setup };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Tools.each({
- t: 'down',
- b: 'up'
- }, function (cls, pos) {
- panel.classes.toggle('arrow-' + cls, predicate(pos, relPos.substr(0, 1)));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var renderUI = function (editor, theme, args) {
+ var skinUrl = getSkinUrl(editor);
+ if (skinUrl) {
+ args.skinUiCss = skinUrl + '/skin.min.css';
+ editor.contentCSS.push(skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css');
+ }
+ $_bm31cfu2jfuw8sg3.setup(editor, theme);
+ return isInline(editor) ? $_g6zuymtgjfuw8sd6.render(editor, theme, args) : $_6amrhfswjfuw8sbr.render(editor, theme, args);
+ };
+ var $_5dgseussjfuw8sbh = { renderUI: renderUI };
+
+ var Tooltip = Control$1.extend({
+ Mixins: [$_831wnjtkjfuw8sdt],
+ Defaults: { classes: 'widget tooltip tooltip-n' },
+ renderHtml: function () {
+ var self = this, prefix = self.classPrefix;
+ return '<div id="' + self._id + '" class="' + self.classes + '" role="presentation">' + '<div class="' + prefix + 'tooltip-arrow"></div>' + '<div class="' + prefix + 'tooltip-inner">' + self.encode(self.state.get('text')) + '</div>' + '</div>';
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:text', function (e) {
+ self.getEl().lastChild.innerHTML = self.encode(e.value);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self._super();
+ },
+ repaint: function () {
+ var self = this;
+ var style, rect;
+ style = self.getEl().style;
+ rect = self._layoutRect;
+ style.left = rect.x + 'px';
+ style.top = rect.y + 'px';
+ style.zIndex = 65535 + 65535;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Tools.each({
- l: 'left',
- r: 'right'
- }, function (cls, pos) {
- panel.classes.toggle('arrow-' + cls, predicate(pos, relPos.substr(1, 1)));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Widget = Control$1.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ settings = self.settings;
+ self.canFocus = true;
+ if (settings.tooltip && Widget.tooltips !== false) {
+ self.on('mouseenter', function (e) {
+ var tooltip = self.tooltip().moveTo(-65535);
+ if (e.control === self) {
+ var rel = tooltip.text(settings.tooltip).show().testMoveRel(self.getEl(), [
+ 'bc-tc',
+ 'bc-tl',
+ 'bc-tr'
+ ]);
+ tooltip.classes.toggle('tooltip-n', rel === 'bc-tc');
+ tooltip.classes.toggle('tooltip-nw', rel === 'bc-tl');
+ tooltip.classes.toggle('tooltip-ne', rel === 'bc-tr');
+ tooltip.moveRel(self.getEl(), rel);
+ } else {
+ tooltip.hide();
+ }
+ });
+ self.on('mouseleave mousedown click', function () {
+ self.tooltip().remove();
+ self._tooltip = null;
+ });
+ }
+ self.aria('label', settings.ariaLabel || settings.tooltip);
+ },
+ tooltip: function () {
+ if (!this._tooltip) {
+ this._tooltip = new Tooltip({ type: 'tooltip' });
+ $_435hnxt5jfuw8sc9.inheritUiContainer(this, this._tooltip);
+ this._tooltip.renderTo();
+ }
+ return this._tooltip;
+ },
+ postRender: function () {
+ var self = this, settings = self.settings;
+ self._super();
+ if (!self.parent() && (settings.width || settings.height)) {
+ self.initLayoutRect();
+ self.repaint();
+ }
+ if (settings.autofocus) {
+ self.focus();
+ }
+ },
+ bindStates: function () {
+ var self = this;
+ function disable(state) {
+ self.aria('disabled', state);
+ self.classes.toggle('disabled', state);
+ }
+ function active(state) {
+ self.aria('pressed', state);
+ self.classes.toggle('active', state);
+ }
+ self.state.on('change:disabled', function (e) {
+ disable(e.value);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.state.on('change:active', function (e) {
+ active(e.value);
+ });
+ if (self.state.get('disabled')) {
+ disable(true);
+ }
+ if (self.state.get('active')) {
+ active(true);
+ }
+ return self._super();
+ },
+ remove: function () {
+ this._super();
+ if (this._tooltip) {
+ this._tooltip.remove();
+ this._tooltip = null;
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var userConstrain = function (handler, x, y, elementRect, contentAreaRect, panelRect) {
- panelRect = toClientRect({ x: x, y: y, w: panelRect.w, h: panelRect.h });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Progress = Widget.extend({
+ Defaults: { value: 0 },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.classes.add('progress');
+ if (!self.settings.filter) {
+ self.settings.filter = function (value) {
+ return Math.round(value);
+ };
+ }
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = this.classPrefix;
+ return '<div id="' + id + '" class="' + self.classes + '">' + '<div class="' + prefix + 'bar-container">' + '<div class="' + prefix + 'bar"></div>' + '</div>' + '<div class="' + prefix + 'text">0%</div>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ self._super();
+ self.value(self.settings.value);
+ return self;
+ },
+ bindStates: function () {
+ var self = this;
+ function setValue(value) {
+ value = self.settings.filter(value);
+ self.getEl().lastChild.innerHTML = value + '%';
+ self.getEl().firstChild.firstChild.style.width = value + '%';
+ }
+ self.state.on('change:value', function (e) {
+ setValue(e.value);
+ });
+ setValue(self.state.get('value'));
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (handler) {
- panelRect = handler({
- elementRect: toClientRect(elementRect),
- contentAreaRect: toClientRect(contentAreaRect),
- panelRect: panelRect
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var updateLiveRegion = function (ctx, text) {
+ ctx.getEl().lastChild.textContent = text + (ctx.progressBar ? ' ' + ctx.progressBar.value() + '%' : '');
+ };
+ var Notification = Control$1.extend({
+ Mixins: [$_831wnjtkjfuw8sdt],
+ Defaults: { classes: 'widget notification' },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.maxWidth = settings.maxWidth;
+ if (settings.text) {
+ self.text(settings.text);
+ }
+ if (settings.icon) {
+ self.icon = settings.icon;
+ }
+ if (settings.color) {
+ self.color = settings.color;
+ }
+ if (settings.type) {
+ self.classes.add('notification-' + settings.type);
+ }
+ if (settings.timeout && (settings.timeout < 0 || settings.timeout > 0) && !settings.closeButton) {
+ self.closeButton = false;
+ } else {
+ self.classes.add('has-close');
+ self.closeButton = true;
+ }
+ if (settings.progressBar) {
+ self.progressBar = new Progress();
+ }
+ self.on('click', function (e) {
+ if (e.target.className.indexOf(self.classPrefix + 'close') !== -1) {
+ self.close();
+ }
+ });
+ },
+ renderHtml: function () {
+ var self = this;
+ var prefix = self.classPrefix;
+ var icon = '', closeButton = '', progressBar = '', notificationStyle = '';
+ if (self.icon) {
+ icon = '<i class="' + prefix + 'ico' + ' ' + prefix + 'i-' + self.icon + '"></i>';
+ }
+ notificationStyle = ' style="max-width: ' + self.maxWidth + 'px;' + (self.color ? 'background-color: ' + self.color + ';"' : '"');
+ if (self.closeButton) {
+ closeButton = '<button type="button" class="' + prefix + 'close" aria-hidden="true">\xD7</button>';
+ }
+ if (self.progressBar) {
+ progressBar = self.progressBar.renderHtml();
+ }
+ return '<div id="' + self._id + '" class="' + self.classes + '"' + notificationStyle + ' role="presentation">' + icon + '<div class="' + prefix + 'notification-inner">' + self.state.get('text') + '</div>' + progressBar + closeButton + '<div style="clip: rect(1px, 1px, 1px, 1px);height: 1px;overflow: hidden;position: absolute;width: 1px;"' + ' aria-live="assertive" aria-relevant="additions" aria-atomic="true"></div>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ global$7.setTimeout(function () {
+ self.$el.addClass(self.classPrefix + 'in');
+ updateLiveRegion(self, self.state.get('text'));
+ }, 100);
+ return self._super();
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:text', function (e) {
+ self.getEl().firstChild.innerHTML = e.value;
+ updateLiveRegion(self, e.value);
+ });
+ if (self.progressBar) {
+ self.progressBar.bindStates();
+ self.progressBar.state.on('change:value', function (e) {
+ updateLiveRegion(self, self.state.get('text'));
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self._super();
+ },
+ close: function () {
+ var self = this;
+ if (!self.fire('close').isDefaultPrevented()) {
+ self.remove();
+ }
+ return self;
+ },
+ repaint: function () {
+ var self = this;
+ var style, rect;
+ style = self.getEl().style;
+ rect = self._layoutRect;
+ style.left = rect.x + 'px';
+ style.top = rect.y + 'px';
+ style.zIndex = 65535 - 1;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return panelRect;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function NotificationManagerImpl (editor) {
+ var getEditorContainer = function (editor) {
+ return editor.inline ? editor.getElement() : editor.getContentAreaContainer();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getContainerWidth = function () {
+ var container = getEditorContainer(editor);
+ return funcs.getSize(container).width;
+ };
+ var prePositionNotifications = function (notifications) {
+ $_anxm1mtajfuw8sct.each(notifications, function (notification) {
+ notification.moveTo(0, 0);
+ });
+ };
+ var positionNotifications = function (notifications) {
+ if (notifications.length > 0) {
+ var firstItem = notifications.slice(0, 1)[0];
+ var container = getEditorContainer(editor);
+ firstItem.moveRel(container, 'tc-tc');
+ $_anxm1mtajfuw8sct.each(notifications, function (notification, index) {
+ if (index > 0) {
+ notification.moveRel(notifications[index - 1].getEl(), 'bc-tc');
+ }
+ });
+ }
+ };
+ var reposition = function (notifications) {
+ prePositionNotifications(notifications);
+ positionNotifications(notifications);
+ };
+ var open = function (args, closeCallback) {
+ var extendedArgs = global$2.extend(args, { maxWidth: getContainerWidth() });
+ var notif = new Notification(extendedArgs);
+ notif.args = extendedArgs;
+ if (extendedArgs.timeout > 0) {
+ notif.timer = setTimeout(function () {
+ notif.close();
+ closeCallback();
+ }, extendedArgs.timeout);
+ }
+ notif.on('close', function () {
+ closeCallback();
+ });
+ notif.renderTo();
+ return notif;
+ };
+ var close = function (notification) {
+ notification.close();
+ };
+ var getArgs = function (notification) {
+ return notification.args;
+ };
+ return {
+ open: open,
+ close: close,
+ reposition: reposition,
+ getArgs: getArgs
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var addContextualToolbars = function (editor) {
- var scrollContainer, settings = editor.settings;
-
- var getContextToolbars = function () {
- return editor.contextToolbars || [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var windows = [];
+ var oldMetaValue = '';
+ function toggleFullScreenState(state) {
+ var noScaleMetaValue = 'width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0';
+ var viewport = global$9('meta[name=viewport]')[0], contentValue;
+ if (global$8.overrideViewPort === false) {
+ return;
+ }
+ if (!viewport) {
+ viewport = document.createElement('meta');
+ viewport.setAttribute('name', 'viewport');
+ document.getElementsByTagName('head')[0].appendChild(viewport);
+ }
+ contentValue = viewport.getAttribute('content');
+ if (contentValue && typeof oldMetaValue !== 'undefined') {
+ oldMetaValue = contentValue;
+ }
+ viewport.setAttribute('content', state ? noScaleMetaValue : oldMetaValue);
+ }
+ function toggleBodyFullScreenClasses(classPrefix, state) {
+ if (checkFullscreenWindows() && state === false) {
+ global$9([
+ document.documentElement,
+ document.body
+ ]).removeClass(classPrefix + 'fullscreen');
+ }
+ }
+ function checkFullscreenWindows() {
+ for (var i = 0; i < windows.length; i++) {
+ if (windows[i]._fullscreen) {
+ return true;
+ }
+ }
+ return false;
+ }
+ function handleWindowResize() {
+ if (!global$8.desktop) {
+ var lastSize_1 = {
+ w: window.innerWidth,
+ h: window.innerHeight
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global$7.setInterval(function () {
+ var w = window.innerWidth, h = window.innerHeight;
+ if (lastSize_1.w !== w || lastSize_1.h !== h) {
+ lastSize_1 = {
+ w: w,
+ h: h
+ };
+ global$9(window).trigger('resize');
+ }
+ }, 100);
+ }
+ function reposition() {
+ var i;
+ var rect = funcs.getWindowSize();
+ var layoutRect;
+ for (i = 0; i < windows.length; i++) {
+ layoutRect = windows[i].layoutRect();
+ windows[i].moveTo(windows[i].settings.x || Math.max(0, rect.w / 2 - layoutRect.w / 2), windows[i].settings.y || Math.max(0, rect.h / 2 - layoutRect.h / 2));
+ }
+ }
+ global$9(window).on('resize', reposition);
+ }
+ var Window = FloatPanel.extend({
+ modal: true,
+ Defaults: {
+ border: 1,
+ layout: 'flex',
+ containerCls: 'panel',
+ role: 'dialog',
+ callbacks: {
+ submit: function () {
+ this.fire('submit', { data: this.toJSON() });
+ },
+ close: function () {
+ this.close();
+ }
+ }
+ },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ if (self.isRtl()) {
+ self.classes.add('rtl');
+ }
+ self.classes.add('window');
+ self.bodyClasses.add('window-body');
+ self.state.set('fixed', true);
+ if (settings.buttons) {
+ self.statusbar = new Panel({
+ layout: 'flex',
+ border: '1 0 0 0',
+ spacing: 3,
+ padding: 10,
+ align: 'center',
+ pack: self.isRtl() ? 'start' : 'end',
+ defaults: { type: 'button' },
+ items: settings.buttons
+ });
+ self.statusbar.classes.add('foot');
+ self.statusbar.parent(self);
+ }
+ self.on('click', function (e) {
+ var closeClass = self.classPrefix + 'close';
+ if (funcs.hasClass(e.target, closeClass) || funcs.hasClass(e.target.parentNode, closeClass)) {
+ self.close();
+ }
+ });
+ self.on('cancel', function () {
+ self.close();
+ });
+ self.on('move', function (e) {
+ if (e.control === self) {
+ FloatPanel.hideAll();
+ }
+ });
+ self.aria('describedby', self.describedBy || self._id + '-none');
+ self.aria('label', settings.title);
+ self._fullscreen = false;
+ },
+ recalc: function () {
+ var self = this;
+ var statusbar = self.statusbar;
+ var layoutRect, width, x, needsRecalc;
+ if (self._fullscreen) {
+ self.layoutRect(funcs.getWindowSize());
+ self.layoutRect().contentH = self.layoutRect().innerH;
+ }
+ self._super();
+ layoutRect = self.layoutRect();
+ if (self.settings.title && !self._fullscreen) {
+ width = layoutRect.headerW;
+ if (width > layoutRect.w) {
+ x = layoutRect.x - Math.max(0, width / 2);
+ self.layoutRect({
+ w: width,
+ x: x
+ });
+ needsRecalc = true;
+ }
+ }
+ if (statusbar) {
+ statusbar.layoutRect({ w: self.layoutRect().innerW }).recalc();
+ width = statusbar.layoutRect().minW + layoutRect.deltaW;
+ if (width > layoutRect.w) {
+ x = layoutRect.x - Math.max(0, width - layoutRect.w);
+ self.layoutRect({
+ w: width,
+ x: x
+ });
+ needsRecalc = true;
+ }
+ }
+ if (needsRecalc) {
+ self.recalc();
+ }
+ },
+ initLayoutRect: function () {
+ var self = this;
+ var layoutRect = self._super();
+ var deltaH = 0, headEl;
+ if (self.settings.title && !self._fullscreen) {
+ headEl = self.getEl('head');
+ var size = funcs.getSize(headEl);
+ layoutRect.headerW = size.width;
+ layoutRect.headerH = size.height;
+ deltaH += layoutRect.headerH;
+ }
+ if (self.statusbar) {
+ deltaH += self.statusbar.layoutRect().h;
+ }
+ layoutRect.deltaH += deltaH;
+ layoutRect.minH += deltaH;
+ layoutRect.h += deltaH;
+ var rect = funcs.getWindowSize();
+ layoutRect.x = self.settings.x || Math.max(0, rect.w / 2 - layoutRect.w / 2);
+ layoutRect.y = self.settings.y || Math.max(0, rect.h / 2 - layoutRect.h / 2);
+ return layoutRect;
+ },
+ renderHtml: function () {
+ var self = this, layout = self._layout, id = self._id, prefix = self.classPrefix;
+ var settings = self.settings;
+ var headerHtml = '', footerHtml = '', html = settings.html;
+ self.preRender();
+ layout.preRender(self);
+ if (settings.title) {
+ headerHtml = '<div id="' + id + '-head" class="' + prefix + 'window-head">' + '<div id="' + id + '-title" class="' + prefix + 'title">' + self.encode(settings.title) + '</div>' + '<div id="' + id + '-dragh" class="' + prefix + 'dragh"></div>' + '<button type="button" class="' + prefix + 'close" aria-hidden="true">' + '<i class="mce-ico mce-i-remove"></i>' + '</button>' + '</div>';
+ }
+ if (settings.url) {
+ html = '<iframe src="' + settings.url + '" tabindex="-1"></iframe>';
+ }
+ if (typeof html === 'undefined') {
+ html = layout.renderHtml(self);
+ }
+ if (self.statusbar) {
+ footerHtml = self.statusbar.renderHtml();
+ }
+ return '<div id="' + id + '" class="' + self.classes + '" hidefocus="1">' + '<div class="' + self.classPrefix + 'reset" role="application">' + headerHtml + '<div id="' + id + '-body" class="' + self.bodyClasses + '">' + html + '</div>' + footerHtml + '</div>' + '</div>';
+ },
+ fullscreen: function (state) {
+ var self = this;
+ var documentElement = document.documentElement;
+ var slowRendering;
+ var prefix = self.classPrefix;
+ var layoutRect;
+ if (state !== self._fullscreen) {
+ global$9(window).on('resize', function () {
+ var time;
+ if (self._fullscreen) {
+ if (!slowRendering) {
+ time = new Date().getTime();
+ var rect = funcs.getWindowSize();
+ self.moveTo(0, 0).resizeTo(rect.w, rect.h);
+ if (new Date().getTime() - time > 50) {
+ slowRendering = true;
+ }
+ } else {
+ if (!self._timer) {
+ self._timer = global$7.setTimeout(function () {
+ var rect = funcs.getWindowSize();
+ self.moveTo(0, 0).resizeTo(rect.w, rect.h);
+ self._timer = 0;
+ }, 50);
+ }
+ }
+ }
+ });
+ layoutRect = self.layoutRect();
+ self._fullscreen = state;
+ if (!state) {
+ self.borderBox = $_xw61vtqjfuw8sep.parseBox(self.settings.border);
+ self.getEl('head').style.display = '';
+ layoutRect.deltaH += layoutRect.headerH;
+ global$9([
+ documentElement,
+ document.body
+ ]).removeClass(prefix + 'fullscreen');
+ self.classes.remove('fullscreen');
+ self.moveTo(self._initial.x, self._initial.y).resizeTo(self._initial.w, self._initial.h);
+ } else {
+ self._initial = {
+ x: layoutRect.x,
+ y: layoutRect.y,
+ w: layoutRect.w,
+ h: layoutRect.h
+ };
+ self.borderBox = $_xw61vtqjfuw8sep.parseBox('0');
+ self.getEl('head').style.display = 'none';
+ layoutRect.deltaH -= layoutRect.headerH + 2;
+ global$9([
+ documentElement,
+ document.body
+ ]).addClass(prefix + 'fullscreen');
+ self.classes.add('fullscreen');
+ var rect = funcs.getWindowSize();
+ self.moveTo(0, 0).resizeTo(rect.w, rect.h);
+ }
+ }
+ return self.reflow();
+ },
+ postRender: function () {
+ var self = this;
+ var startPos;
+ setTimeout(function () {
+ self.classes.add('in');
+ self.fire('open');
+ }, 0);
+ self._super();
+ if (self.statusbar) {
+ self.statusbar.postRender();
+ }
+ self.focus();
+ this.dragHelper = new DragHelper(self._id + '-dragh', {
+ start: function () {
+ startPos = {
+ x: self.layoutRect().x,
+ y: self.layoutRect().y
+ };
+ },
+ drag: function (e) {
+ self.moveTo(startPos.x + e.deltaX, startPos.y + e.deltaY);
+ }
+ });
+ self.on('submit', function (e) {
+ if (!e.isDefaultPrevented()) {
+ self.close();
+ }
+ });
+ windows.push(self);
+ toggleFullScreenState(true);
+ },
+ submit: function () {
+ return this.fire('submit', { data: this.toJSON() });
+ },
+ remove: function () {
+ var self = this;
+ var i;
+ self.dragHelper.destroy();
+ self._super();
+ if (self.statusbar) {
+ this.statusbar.remove();
+ }
+ toggleBodyFullScreenClasses(self.classPrefix, false);
+ i = windows.length;
+ while (i--) {
+ if (windows[i] === self) {
+ windows.splice(i, 1);
+ }
+ }
+ toggleFullScreenState(windows.length > 0);
+ },
+ getContentWindow: function () {
+ var ifr = this.getEl().getElementsByTagName('iframe')[0];
+ return ifr ? ifr.contentWindow : null;
+ }
+ });
+ handleWindowResize();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getElementRect = function (elm) {
- var pos, targetRect, root;
-
- pos = DOM.getPos(editor.getContentAreaContainer());
- targetRect = editor.dom.getRect(elm);
- root = editor.dom.getRoot();
-
- // Adjust targetPos for scrolling in the editor
- if (root.nodeName === 'BODY') {
- targetRect.x -= root.ownerDocument.documentElement.scrollLeft || root.scrollLeft;
- targetRect.y -= root.ownerDocument.documentElement.scrollTop || root.scrollTop;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var MessageBox = Window.extend({
+ init: function (settings) {
+ settings = {
+ border: 1,
+ padding: 20,
+ layout: 'flex',
+ pack: 'center',
+ align: 'center',
+ containerCls: 'panel',
+ autoScroll: true,
+ buttons: {
+ type: 'button',
+ text: 'Ok',
+ action: 'ok'
+ },
+ items: {
+ type: 'label',
+ multiline: true,
+ maxWidth: 500,
+ maxHeight: 200
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- targetRect.x += pos.x;
- targetRect.y += pos.y;
-
- return targetRect;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var reposition = function (match, shouldShow) {
- var relPos, panelRect, elementRect, contentAreaRect, panel, relRect, testPositions, smallElementWidthThreshold;
- var handler = settings.inline_toolbar_position_handler;
-
- if (editor.removed) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this._super(settings);
+ },
+ Statics: {
+ OK: 1,
+ OK_CANCEL: 2,
+ YES_NO: 3,
+ YES_NO_CANCEL: 4,
+ msgBox: function (settings) {
+ var buttons;
+ var callback = settings.callback || function () {
+ };
+ function createButton(text, status, primary) {
+ return {
+ type: 'button',
+ text: text,
+ subtype: primary ? 'primary' : '',
+ onClick: function (e) {
+ e.control.parents()[1].close();
+ callback(status);
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!match || !match.toolbar.panel) {
- hideAllFloatingPanels(editor);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch (settings.buttons) {
+ case MessageBox.OK_CANCEL:
+ buttons = [
+ createButton('Ok', true, true),
+ createButton('Cancel', false)
+ ];
+ break;
+ case MessageBox.YES_NO:
+ case MessageBox.YES_NO_CANCEL:
+ buttons = [
+ createButton('Yes', 1, true),
+ createButton('No', 0)
+ ];
+ if (settings.buttons === MessageBox.YES_NO_CANCEL) {
+ buttons.push(createButton('Cancel', -1));
+ }
+ break;
+ default:
+ buttons = [createButton('Ok', true, true)];
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return new Window({
+ padding: 20,
+ x: settings.x,
+ y: settings.y,
+ minWidth: 300,
+ minHeight: 100,
+ layout: 'flex',
+ pack: 'center',
+ align: 'center',
+ buttons: buttons,
+ title: settings.title,
+ role: 'alertdialog',
+ items: {
+ type: 'label',
+ multiline: true,
+ maxWidth: 500,
+ maxHeight: 200,
+ text: settings.text
+ },
+ onPostRender: function () {
+ this.aria('describedby', this.items()[0]._id);
+ },
+ onClose: settings.onClose,
+ onCancel: function () {
+ callback(false);
+ }
+ }).renderTo(document.body).reflow();
+ },
+ alert: function (settings, callback) {
+ if (typeof settings === 'string') {
+ settings = { text: settings };
+ }
+ settings.callback = callback;
+ return MessageBox.msgBox(settings);
+ },
+ confirm: function (settings, callback) {
+ if (typeof settings === 'string') {
+ settings = { text: settings };
+ }
+ settings.callback = callback;
+ settings.buttons = MessageBox.OK_CANCEL;
+ return MessageBox.msgBox(settings);
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- testPositions = [
- 'bc-tc', 'tc-bc',
- 'tl-bl', 'bl-tl',
- 'tr-br', 'br-tr'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function WindowManagerImpl (editor) {
+ var open = function (args, params, closeCallback) {
+ var win;
+ args.title = args.title || ' ';
+ args.url = args.url || args.file;
+ if (args.url) {
+ args.width = parseInt(args.width || 320, 10);
+ args.height = parseInt(args.height || 240, 10);
+ }
+ if (args.body) {
+ args.items = {
+ defaults: args.defaults,
+ type: args.bodyType || 'form',
+ items: args.body,
+ data: args.data,
+ callbacks: args.commands
+ };
+ }
+ if (!args.url && !args.buttons) {
+ args.buttons = [
+ {
+ text: 'Ok',
+ subtype: 'primary',
+ onclick: function () {
+ win.find('form')[0].submit();
+ }
+ },
+ {
+ text: 'Cancel',
+ onclick: function () {
+ win.close();
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> ];
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ win = new Window(args);
+ win.on('close', function () {
+ closeCallback(win);
+ });
+ if (args.data) {
+ win.on('postRender', function () {
+ this.find('*').each(function (ctrl) {
+ var name = ctrl.name();
+ if (name in args.data) {
+ ctrl.value(args.data[name]);
+ }
+ });
+ });
+ }
+ win.features = args || {};
+ win.params = params || {};
+ win = win.renderTo(document.body).reflow();
+ return win;
+ };
+ var alert = function (message, choiceCallback, closeCallback) {
+ var win;
+ win = MessageBox.alert(message, function () {
+ choiceCallback();
+ });
+ win.on('close', function () {
+ closeCallback(win);
+ });
+ return win;
+ };
+ var confirm = function (message, choiceCallback, closeCallback) {
+ var win;
+ win = MessageBox.confirm(message, function (state) {
+ choiceCallback(state);
+ });
+ win.on('close', function () {
+ closeCallback(win);
+ });
+ return win;
+ };
+ var close = function (window) {
+ window.close();
+ };
+ var getParams = function (window) {
+ return window.params;
+ };
+ var setParams = function (window, params) {
+ window.params = params;
+ };
+ return {
+ open: open,
+ alert: alert,
+ confirm: confirm,
+ close: close,
+ getParams: getParams,
+ setParams: setParams
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- panel = match.toolbar.panel;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get = function (editor) {
+ var renderUI = function (args) {
+ return $_5dgseussjfuw8sbh.renderUI(editor, this, args);
+ };
+ var resizeTo = function (w, h) {
+ return $_4yyb9xtcjfuw8scz.resizeTo(editor, w, h);
+ };
+ var resizeBy = function (dw, dh) {
+ return $_4yyb9xtcjfuw8scz.resizeBy(editor, dw, dh);
+ };
+ var getNotificationManagerImpl = function () {
+ return NotificationManagerImpl(editor);
+ };
+ var getWindowManagerImpl = function () {
+ return WindowManagerImpl(editor);
+ };
+ return {
+ renderUI: renderUI,
+ resizeTo: resizeTo,
+ resizeBy: resizeBy,
+ getNotificationManagerImpl: getNotificationManagerImpl,
+ getWindowManagerImpl: getWindowManagerImpl
+ };
+ };
+ var $_cf5qtqsrjfuw8sbf = { get: get };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Only show the panel on some events not for example nodeChange since that fires when context menu is opened
- if (shouldShow) {
- panel.show();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Layout = global$10.extend({
+ Defaults: {
+ firstControlClass: 'first',
+ lastControlClass: 'last'
+ },
+ init: function (settings) {
+ this.settings = global$2.extend({}, this.Defaults, settings);
+ },
+ preRender: function (container) {
+ container.bodyClasses.add(this.settings.containerClass);
+ },
+ applyClasses: function (items) {
+ var self = this;
+ var settings = self.settings;
+ var firstClass, lastClass, firstItem, lastItem;
+ firstClass = settings.firstControlClass;
+ lastClass = settings.lastControlClass;
+ items.each(function (item) {
+ item.classes.remove(firstClass).remove(lastClass).add(settings.controlClass);
+ if (item.visible()) {
+ if (!firstItem) {
+ firstItem = item;
+ }
+ lastItem = item;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ if (firstItem) {
+ firstItem.classes.add(firstClass);
+ }
+ if (lastItem) {
+ lastItem.classes.add(lastClass);
+ }
+ },
+ renderHtml: function (container) {
+ var self = this;
+ var html = '';
+ self.applyClasses(container.items());
+ container.items().each(function (item) {
+ html += item.renderHtml();
+ });
+ return html;
+ },
+ recalc: function () {
+ },
+ postRender: function () {
+ },
+ isNative: function () {
+ return false;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- elementRect = getElementRect(match.element);
- panelRect = DOM.getRect(panel.getEl());
- contentAreaRect = DOM.getRect(editor.getContentAreaContainer() || editor.getBody());
- smallElementWidthThreshold = 25;
-
- if (DOM.getStyle(match.element, 'display', true) !== 'inline') {
- // We need to use these instead of the rect values since the style
- // size properites might not be the same as the real size for a table
- elementRect.w = match.element.clientWidth;
- elementRect.h = match.element.clientHeight;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var AbsoluteLayout = Layout.extend({
+ Defaults: {
+ containerClass: 'abs-layout',
+ controlClass: 'abs-layout-item'
+ },
+ recalc: function (container) {
+ container.items().filter(':visible').each(function (ctrl) {
+ var settings = ctrl.settings;
+ ctrl.layoutRect({
+ x: settings.x,
+ y: settings.y,
+ w: settings.w,
+ h: settings.h
+ });
+ if (ctrl.recalc) {
+ ctrl.recalc();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ },
+ renderHtml: function (container) {
+ return '<div id="' + container._id + '-absend" class="' + container.classPrefix + 'abs-end"></div>' + this._super(container);
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (!editor.inline) {
- contentAreaRect.w = editor.getDoc().documentElement.offsetWidth;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Button = Widget.extend({
+ Defaults: {
+ classes: 'widget btn',
+ role: 'button'
+ },
+ init: function (settings) {
+ var self = this;
+ var size;
+ self._super(settings);
+ settings = self.settings;
+ size = self.settings.size;
+ self.on('click mousedown', function (e) {
+ e.preventDefault();
+ });
+ self.on('touchstart', function (e) {
+ self.fire('click', e);
+ e.preventDefault();
+ });
+ if (settings.subtype) {
+ self.classes.add(settings.subtype);
+ }
+ if (size) {
+ self.classes.add('btn-' + size);
+ }
+ if (settings.icon) {
+ self.icon(settings.icon);
+ }
+ },
+ icon: function (icon) {
+ if (!arguments.length) {
+ return this.state.get('icon');
+ }
+ this.state.set('icon', icon);
+ return this;
+ },
+ repaint: function () {
+ var btnElm = this.getEl().firstChild;
+ var btnStyle;
+ if (btnElm) {
+ btnStyle = btnElm.style;
+ btnStyle.width = btnStyle.height = '100%';
+ }
+ this._super();
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = self.classPrefix;
+ var icon = self.state.get('icon'), image;
+ var text = self.state.get('text');
+ var textHtml = '';
+ var ariaPressed;
+ var settings = self.settings;
+ image = settings.image;
+ if (image) {
+ icon = 'none';
+ if (typeof image !== 'string') {
+ image = window.getSelection ? image[0] : image[1];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ image = ' style="background-image: url(\'' + image + '\')"';
+ } else {
+ image = '';
+ }
+ if (text) {
+ self.classes.add('btn-has-text');
+ textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
+ }
+ icon = icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
+ ariaPressed = typeof settings.active === 'boolean' ? ' aria-pressed="' + settings.active + '"' : '';
+ return '<div id="' + id + '" class="' + self.classes + '" tabindex="-1"' + ariaPressed + '>' + '<button id="' + id + '-button" role="presentation" type="button" tabindex="-1">' + (icon ? '<i class="' + icon + '"' + image + '></i>' : '') + textHtml + '</button>' + '</div>';
+ },
+ bindStates: function () {
+ var self = this, $ = self.$, textCls = self.classPrefix + 'txt';
+ function setButtonText(text) {
+ var $span = $('span.' + textCls, self.getEl());
+ if (text) {
+ if (!$span[0]) {
+ $('button:first', self.getEl()).append('<span class="' + textCls + '"></span>');
+ $span = $('span.' + textCls, self.getEl());
+ }
+ $span.html(self.encode(text));
+ } else {
+ $span.remove();
+ }
+ self.classes.toggle('btn-has-text', !!text);
+ }
+ self.state.on('change:text', function (e) {
+ setButtonText(e.value);
+ });
+ self.state.on('change:icon', function (e) {
+ var icon = e.value;
+ var prefix = self.classPrefix;
+ self.settings.icon = icon;
+ icon = icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
+ var btnElm = self.getEl().firstChild;
+ var iconElm = btnElm.getElementsByTagName('i')[0];
+ if (icon) {
+ if (!iconElm || iconElm !== btnElm.firstChild) {
+ iconElm = document.createElement('i');
+ btnElm.insertBefore(iconElm, btnElm.firstChild);
+ }
+ iconElm.className = icon;
+ } else if (iconElm) {
+ btnElm.removeChild(iconElm);
+ }
+ setButtonText(self.state.get('text'));
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Inflate the elementRect so it doesn't get placed above resize handles
- if (editor.selection.controlSelection.isResizable(match.element) && elementRect.w < smallElementWidthThreshold) {
- elementRect = Rect.inflate(elementRect, 0, 8);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var BrowseButton = Button.extend({
+ init: function (settings) {
+ var self = this;
+ settings = global$2.extend({
+ text: 'Browse...',
+ multiple: false,
+ accept: null
+ }, settings);
+ self._super(settings);
+ self.classes.add('browsebutton');
+ if (settings.multiple) {
+ self.classes.add('multiple');
+ }
+ },
+ postRender: function () {
+ var self = this;
+ var input = funcs.create('input', {
+ type: 'file',
+ id: self._id + '-browse',
+ accept: self.settings.accept
+ });
+ self._super();
+ global$9(input).on('change', function (e) {
+ var files = e.target.files;
+ self.value = function () {
+ if (!files.length) {
+ return null;
+ } else if (self.settings.multiple) {
+ return files;
+ } else {
+ return files[0];
+ }
+ };
+ e.preventDefault();
+ if (files.length) {
+ self.fire('change', e);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ global$9(input).on('click', function (e) {
+ e.stopPropagation();
+ });
+ global$9(self.getEl('button')).on('click', function (e) {
+ e.stopPropagation();
+ input.click();
+ });
+ self.getEl().appendChild(input);
+ },
+ remove: function () {
+ global$9(this.getEl('button')).off();
+ global$9(this.getEl('input')).off();
+ this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- relPos = Rect.findBestRelativePosition(panelRect, elementRect, contentAreaRect, testPositions);
- elementRect = Rect.clamp(elementRect, contentAreaRect);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ButtonGroup = Container.extend({
+ Defaults: {
+ defaultType: 'button',
+ role: 'group'
+ },
+ renderHtml: function () {
+ var self = this, layout = self._layout;
+ self.classes.add('btn-group');
+ self.preRender();
+ layout.preRender(self);
+ return '<div id="' + self._id + '" class="' + self.classes + '">' + '<div id="' + self._id + '-body">' + (self.settings.html || '') + layout.renderHtml(self) + '</div>' + '</div>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (relPos) {
- relRect = Rect.relativePosition(panelRect, elementRect, relPos);
- movePanelTo(panel, userConstrain(handler, relRect.x, relRect.y, elementRect, contentAreaRect, panelRect));
- } else {
- // Allow overflow below the editor to avoid placing toolbars ontop of tables
- contentAreaRect.h += panelRect.h;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Checkbox = Widget.extend({
+ Defaults: {
+ classes: 'checkbox',
+ role: 'checkbox',
+ checked: false
+ },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.on('click mousedown', function (e) {
+ e.preventDefault();
+ });
+ self.on('click', function (e) {
+ e.preventDefault();
+ if (!self.disabled()) {
+ self.checked(!self.checked());
+ }
+ });
+ self.checked(self.settings.checked);
+ },
+ checked: function (state) {
+ if (!arguments.length) {
+ return this.state.get('checked');
+ }
+ this.state.set('checked', state);
+ return this;
+ },
+ value: function (state) {
+ if (!arguments.length) {
+ return this.checked();
+ }
+ return this.checked(state);
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = self.classPrefix;
+ return '<div id="' + id + '" class="' + self.classes + '" unselectable="on" aria-labelledby="' + id + '-al" tabindex="-1">' + '<i class="' + prefix + 'ico ' + prefix + 'i-checkbox"></i>' + '<span id="' + id + '-al" class="' + prefix + 'label">' + self.encode(self.state.get('text')) + '</span>' + '</div>';
+ },
+ bindStates: function () {
+ var self = this;
+ function checked(state) {
+ self.classes.toggle('checked', state);
+ self.aria('checked', state);
+ }
+ self.state.on('change:text', function (e) {
+ self.getEl('al').firstChild.data = self.translate(e.value);
+ });
+ self.state.on('change:checked change:value', function (e) {
+ self.fire('change');
+ checked(e.value);
+ });
+ self.state.on('change:icon', function (e) {
+ var icon = e.value;
+ var prefix = self.classPrefix;
+ if (typeof icon === 'undefined') {
+ return self.settings.icon;
+ }
+ self.settings.icon = icon;
+ icon = icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
+ var btnElm = self.getEl().firstChild;
+ var iconElm = btnElm.getElementsByTagName('i')[0];
+ if (icon) {
+ if (!iconElm || iconElm !== btnElm.firstChild) {
+ iconElm = document.createElement('i');
+ btnElm.insertBefore(iconElm, btnElm.firstChild);
+ }
+ iconElm.className = icon;
+ } else if (iconElm) {
+ btnElm.removeChild(iconElm);
+ }
+ });
+ if (self.state.get('checked')) {
+ checked(true);
+ }
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- elementRect = Rect.intersect(contentAreaRect, elementRect);
- if (elementRect) {
- relPos = Rect.findBestRelativePosition(panelRect, elementRect, contentAreaRect, [
- 'bc-tc', 'bl-tl', 'br-tr'
- ]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$13 = tinymce.util.Tools.resolve('tinymce.util.VK');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (relPos) {
- relRect = Rect.relativePosition(panelRect, elementRect, relPos);
- movePanelTo(panel, userConstrain(handler, relRect.x, relRect.y, elementRect, contentAreaRect, panelRect));
- } else {
- movePanelTo(panel, userConstrain(handler, elementRect.x, elementRect.y, elementRect, contentAreaRect, panelRect));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ComboBox = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ settings = self.settings;
+ self.classes.add('combobox');
+ self.subinput = true;
+ self.ariaTarget = 'inp';
+ settings.menu = settings.menu || settings.values;
+ if (settings.menu) {
+ settings.icon = 'caret';
+ }
+ self.on('click', function (e) {
+ var elm = e.target;
+ var root = self.getEl();
+ if (!global$9.contains(root, elm) && elm !== root) {
+ return;
+ }
+ while (elm && elm !== root) {
+ if (elm.id && elm.id.indexOf('-open') !== -1) {
+ self.fire('action');
+ if (settings.menu) {
+ self.showMenu();
+ if (e.aria) {
+ self.menu.items()[0].focus();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- panel.hide();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ elm = elm.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- togglePositionClass(panel, relPos, function (pos1, pos2) {
- return pos1 === pos2;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ self.on('keydown', function (e) {
+ var rootControl;
+ if (e.keyCode === 13 && e.target.nodeName === 'INPUT') {
+ e.preventDefault();
+ self.parents().reverse().each(function (ctrl) {
+ if (ctrl.toJSON) {
+ rootControl = ctrl;
+ return false;
+ }
+ });
+ self.fire('submit', { data: rootControl.toJSON() });
+ }
+ });
+ self.on('keyup', function (e) {
+ if (e.target.nodeName === 'INPUT') {
+ var oldValue = self.state.get('value');
+ var newValue = e.target.value;
+ if (newValue !== oldValue) {
+ self.state.set('value', newValue);
+ self.fire('autocomplete', e);
+ }
+ }
+ });
+ self.on('mouseover', function (e) {
+ var tooltip = self.tooltip().moveTo(-65535);
+ if (self.statusLevel() && e.target.className.indexOf(self.classPrefix + 'status') !== -1) {
+ var statusMessage = self.statusMessage() || 'Ok';
+ var rel = tooltip.text(statusMessage).show().testMoveRel(e.target, [
+ 'bc-tc',
+ 'bc-tl',
+ 'bc-tr'
+ ]);
+ tooltip.classes.toggle('tooltip-n', rel === 'bc-tc');
+ tooltip.classes.toggle('tooltip-nw', rel === 'bc-tl');
+ tooltip.classes.toggle('tooltip-ne', rel === 'bc-tr');
+ tooltip.moveRel(e.target, rel);
+ }
+ });
+ },
+ statusLevel: function (value) {
+ if (arguments.length > 0) {
+ this.state.set('statusLevel', value);
+ }
+ return this.state.get('statusLevel');
+ },
+ statusMessage: function (value) {
+ if (arguments.length > 0) {
+ this.state.set('statusMessage', value);
+ }
+ return this.state.get('statusMessage');
+ },
+ showMenu: function () {
+ var self = this;
+ var settings = self.settings;
+ var menu;
+ if (!self.menu) {
+ menu = settings.menu || [];
+ if (menu.length) {
+ menu = {
+ type: 'menu',
+ items: menu
+ };
+ } else {
+ menu.type = menu.type || 'menu';
+ }
+ self.menu = global$4.create(menu).parent(self).renderTo(self.getContainerElm());
+ self.fire('createmenu');
+ self.menu.reflow();
+ self.menu.on('cancel', function (e) {
+ if (e.control === self.menu) {
+ self.focus();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- //drawRect(contentAreaRect, 'blue');
- //drawRect(elementRect, 'red');
- //drawRect(panelRect, 'green');
- };
-
- var repositionHandler = function (show) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.menu.on('show hide', function (e) {
+ e.control.items().each(function (ctrl) {
+ ctrl.active(ctrl.value() === self.value());
+ });
+ }).fire('show');
+ self.menu.on('select', function (e) {
+ self.value(e.control.value());
+ });
+ self.on('focusin', function (e) {
+ if (e.target.tagName.toUpperCase() === 'INPUT') {
+ self.menu.hide();
+ }
+ });
+ self.aria('expanded', true);
+ }
+ self.menu.show();
+ self.menu.layoutRect({ w: self.layoutRect().w });
+ self.menu.moveRel(self.getEl(), self.isRtl() ? [
+ 'br-tr',
+ 'tr-br'
+ ] : [
+ 'bl-tl',
+ 'tl-bl'
+ ]);
+ },
+ focus: function () {
+ this.getEl('inp').focus();
+ },
+ repaint: function () {
+ var self = this, elm = self.getEl(), openElm = self.getEl('open'), rect = self.layoutRect();
+ var width, lineHeight, innerPadding = 0;
+ var inputElm = elm.firstChild;
+ if (self.statusLevel() && self.statusLevel() !== 'none') {
+ innerPadding = parseInt(funcs.getRuntimeStyle(inputElm, 'padding-right'), 10) - parseInt(funcs.getRuntimeStyle(inputElm, 'padding-left'), 10);
+ }
+ if (openElm) {
+ width = rect.w - funcs.getSize(openElm).width - 10;
+ } else {
+ width = rect.w - 10;
+ }
+ var doc = document;
+ if (doc.all && (!doc.documentMode || doc.documentMode <= 8)) {
+ lineHeight = self.layoutRect().h - 2 + 'px';
+ }
+ global$9(inputElm).css({
+ width: width - innerPadding,
+ lineHeight: lineHeight
+ });
+ self._super();
+ return self;
+ },
+ postRender: function () {
+ var self = this;
+ global$9(this.getEl('inp')).on('change', function (e) {
+ self.state.set('value', e.target.value);
+ self.fire('change', e);
+ });
+ return self._super();
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix;
+ var value = self.state.get('value') || '';
+ var icon, text, openBtnHtml = '', extraAttrs = '', statusHtml = '';
+ if ('spellcheck' in settings) {
+ extraAttrs += ' spellcheck="' + settings.spellcheck + '"';
+ }
+ if (settings.maxLength) {
+ extraAttrs += ' maxlength="' + settings.maxLength + '"';
+ }
+ if (settings.size) {
+ extraAttrs += ' size="' + settings.size + '"';
+ }
+ if (settings.subtype) {
+ extraAttrs += ' type="' + settings.subtype + '"';
+ }
+ statusHtml = '<i id="' + id + '-status" class="mce-status mce-ico" style="display: none"></i>';
+ if (self.disabled()) {
+ extraAttrs += ' disabled="disabled"';
+ }
+ icon = settings.icon;
+ if (icon && icon !== 'caret') {
+ icon = prefix + 'ico ' + prefix + 'i-' + settings.icon;
+ }
+ text = self.state.get('text');
+ if (icon || text) {
+ openBtnHtml = '<div id="' + id + '-open" class="' + prefix + 'btn ' + prefix + 'open" tabIndex="-1" role="button">' + '<button id="' + id + '-action" type="button" hidefocus="1" tabindex="-1">' + (icon !== 'caret' ? '<i class="' + icon + '"></i>' : '<i class="' + prefix + 'caret"></i>') + (text ? (icon ? ' ' : '') + text : '') + '</button>' + '</div>';
+ self.classes.add('has-open');
+ }
+ return '<div id="' + id + '" class="' + self.classes + '">' + '<input id="' + id + '-inp" class="' + prefix + 'textbox" value="' + self.encode(value, false) + '" hidefocus="1"' + extraAttrs + ' placeholder="' + self.encode(settings.placeholder) + '" />' + statusHtml + openBtnHtml + '</div>';
+ },
+ value: function (value) {
+ if (arguments.length) {
+ this.state.set('value', value);
+ return this;
+ }
+ if (this.state.get('rendered')) {
+ this.state.set('value', this.getEl('inp').value);
+ }
+ return this.state.get('value');
+ },
+ showAutoComplete: function (items, term) {
+ var self = this;
+ if (items.length === 0) {
+ self.hideMenu();
+ return;
+ }
+ var insert = function (value, title) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return function () {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var execute = function () {
- if (editor.selection) {
- reposition(findFrontMostMatch(editor.selection.getNode()), show);
- }
- };
-
- Delay.requestAnimationFrame(execute);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.fire('selectitem', {
+ title: title,
+ value: value
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.menu) {
+ self.menu.items().remove();
+ } else {
+ self.menu = global$4.create({
+ type: 'menu',
+ classes: 'combobox-menu',
+ layout: 'flow'
+ }).parent(self).renderTo();
+ }
+ global$2.each(items, function (item) {
+ self.menu.add({
+ text: item.title,
+ url: item.previewUrl,
+ match: term,
+ classes: 'menu-item-ellipsis',
+ onclick: insert(item.value, item.title)
+ });
+ });
+ self.menu.renderNew();
+ self.hideMenu();
+ self.menu.on('cancel', function (e) {
+ if (e.control.parent() === self.menu) {
+ e.stopPropagation();
+ self.focus();
+ self.hideMenu();
+ }
+ });
+ self.menu.on('select', function () {
+ self.focus();
+ });
+ var maxW = self.layoutRect().w;
+ self.menu.layoutRect({
+ w: maxW,
+ minW: 0,
+ maxW: maxW
+ });
+ self.menu.repaint();
+ self.menu.reflow();
+ self.menu.show();
+ self.menu.moveRel(self.getEl(), self.isRtl() ? [
+ 'br-tr',
+ 'tr-br'
+ ] : [
+ 'bl-tl',
+ 'tl-bl'
+ ]);
+ },
+ hideMenu: function () {
+ if (this.menu) {
+ this.menu.hide();
+ }
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:value', function (e) {
+ if (self.getEl('inp').value !== e.value) {
+ self.getEl('inp').value = e.value;
+ }
+ });
+ self.state.on('change:disabled', function (e) {
+ self.getEl('inp').disabled = e.value;
+ });
+ self.state.on('change:statusLevel', function (e) {
+ var statusIconElm = self.getEl('status');
+ var prefix = self.classPrefix, value = e.value;
+ funcs.css(statusIconElm, 'display', value === 'none' ? 'none' : '');
+ funcs.toggleClass(statusIconElm, prefix + 'i-checkmark', value === 'ok');
+ funcs.toggleClass(statusIconElm, prefix + 'i-warning', value === 'warn');
+ funcs.toggleClass(statusIconElm, prefix + 'i-error', value === 'error');
+ self.classes.toggle('has-status', value !== 'none');
+ self.repaint();
+ });
+ funcs.on(self.getEl('status'), 'mouseleave', function () {
+ self.tooltip().hide();
+ });
+ self.on('cancel', function (e) {
+ if (self.menu && self.menu.visible()) {
+ e.stopPropagation();
+ self.hideMenu();
+ }
+ });
+ var focusIdx = function (idx, menu) {
+ if (menu && menu.items().length > 0) {
+ menu.items().eq(idx)[0].focus();
+ }
+ };
+ self.on('keydown', function (e) {
+ var keyCode = e.keyCode;
+ if (e.target.nodeName === 'INPUT') {
+ if (keyCode === global$13.DOWN) {
+ e.preventDefault();
+ self.fire('autocomplete');
+ focusIdx(0, self.menu);
+ } else if (keyCode === global$13.UP) {
+ e.preventDefault();
+ focusIdx(-1, self.menu);
+ }
+ }
+ });
+ return self._super();
+ },
+ remove: function () {
+ global$9(this.getEl('inp')).off();
+ if (this.menu) {
+ this.menu.remove();
+ }
+ this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var bindScrollEvent = function () {
- if (!scrollContainer) {
- scrollContainer = editor.selection.getScrollContainer() || editor.getWin();
- DOM.bind(scrollContainer, 'scroll', repositionHandler(true));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ColorBox = ComboBox.extend({
+ init: function (settings) {
+ var self = this;
+ settings.spellcheck = false;
+ if (settings.onaction) {
+ settings.icon = 'none';
+ }
+ self._super(settings);
+ self.classes.add('colorbox');
+ self.on('change keyup postrender', function () {
+ self.repaintColor(self.value());
+ });
+ },
+ repaintColor: function (value) {
+ var openElm = this.getEl('open');
+ var elm = openElm ? openElm.getElementsByTagName('i')[0] : null;
+ if (elm) {
+ try {
+ elm.style.background = value;
+ } catch (ex) {
+ }
+ }
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:value', function (e) {
+ if (self.state.get('rendered')) {
+ self.repaintColor(e.value);
+ }
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('remove', function () {
- DOM.unbind(scrollContainer, 'scroll');
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var PanelButton = Button.extend({
+ showPanel: function () {
+ var self = this, settings = self.settings;
+ self.classes.add('opened');
+ if (!self.panel) {
+ var panelSettings = settings.panel;
+ if (panelSettings.type) {
+ panelSettings = {
+ layout: 'grid',
+ items: panelSettings
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ panelSettings.role = panelSettings.role || 'dialog';
+ panelSettings.popover = true;
+ panelSettings.autohide = true;
+ panelSettings.ariaRoot = true;
+ self.panel = new FloatPanel(panelSettings).on('hide', function () {
+ self.classes.remove('opened');
+ }).on('cancel', function (e) {
+ e.stopPropagation();
+ self.focus();
+ self.hidePanel();
+ }).parent(self).renderTo(self.getContainerElm());
+ self.panel.fire('show');
+ self.panel.reflow();
+ } else {
+ self.panel.show();
+ }
+ var rtlRels = [
+ 'bc-tc',
+ 'bc-tl',
+ 'bc-tr'
+ ];
+ var ltrRels = [
+ 'bc-tc',
+ 'bc-tr',
+ 'bc-tl',
+ 'tc-bc',
+ 'tc-br',
+ 'tc-bl'
+ ];
+ var rel = self.panel.testMoveRel(self.getEl(), settings.popoverAlign || (self.isRtl() ? rtlRels : ltrRels));
+ self.panel.classes.toggle('start', rel.substr(-1) === 'l');
+ self.panel.classes.toggle('end', rel.substr(-1) === 'r');
+ var isTop = rel.substr(0, 1) === 't';
+ self.panel.classes.toggle('bottom', !isTop);
+ self.panel.classes.toggle('top', isTop);
+ self.panel.moveRel(self.getEl(), rel);
+ },
+ hidePanel: function () {
+ var self = this;
+ if (self.panel) {
+ self.panel.hide();
+ }
+ },
+ postRender: function () {
+ var self = this;
+ self.aria('haspopup', true);
+ self.on('click', function (e) {
+ if (e.control === self) {
+ if (self.panel && self.panel.visible()) {
+ self.hidePanel();
+ } else {
+ self.showPanel();
+ self.panel.focus(!!e.aria);
+ }
+ }
+ });
+ return self._super();
+ },
+ remove: function () {
+ if (this.panel) {
+ this.panel.remove();
+ this.panel = null;
+ }
+ return this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var showContextToolbar = function (match) {
- var panel;
-
- if (match.toolbar.panel) {
- match.toolbar.panel.show();
- reposition(match);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$3 = global$3.DOM;
+ var ColorButton = PanelButton.extend({
+ init: function (settings) {
+ this._super(settings);
+ this.classes.add('splitbtn');
+ this.classes.add('colorbutton');
+ },
+ color: function (color) {
+ if (color) {
+ this._color = color;
+ this.getEl('preview').style.backgroundColor = color;
+ return this;
+ }
+ return this._color;
+ },
+ resetColor: function () {
+ this._color = null;
+ this.getEl('preview').style.backgroundColor = null;
+ return this;
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = self.classPrefix, text = self.state.get('text');
+ var icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
+ var image = self.settings.image ? ' style="background-image: url(\'' + self.settings.image + '\')"' : '';
+ var textHtml = '';
+ if (text) {
+ self.classes.add('btn-has-text');
+ textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
+ }
+ return '<div id="' + id + '" class="' + self.classes + '" role="button" tabindex="-1" aria-haspopup="true">' + '<button role="presentation" hidefocus="1" type="button" tabindex="-1">' + (icon ? '<i class="' + icon + '"' + image + '></i>' : '') + '<span id="' + id + '-preview" class="' + prefix + 'preview"></span>' + textHtml + '</button>' + '<button type="button" class="' + prefix + 'open" hidefocus="1" tabindex="-1">' + ' <i class="' + prefix + 'caret"></i>' + '</button>' + '</div>';
+ },
+ postRender: function () {
+ var self = this, onClickHandler = self.settings.onclick;
+ self.on('click', function (e) {
+ if (e.aria && e.aria.key === 'down') {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (e.control === self && !DOM$3.getParent(e.target, '.' + self.classPrefix + 'open')) {
+ e.stopImmediatePropagation();
+ onClickHandler.call(self, e);
+ }
+ });
+ delete self.settings.onclick;
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- bindScrollEvent();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$14 = tinymce.util.Tools.resolve('tinymce.util.Color');
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- panel = Factory.create({
- type: 'floatpanel',
- role: 'dialog',
- classes: 'tinymce tinymce-inline arrow',
- ariaLabel: 'Inline toolbar',
- layout: 'flex',
- direction: 'column',
- align: 'stretch',
- autohide: false,
- autofix: true,
- fixed: true,
- border: 1,
- items: Toolbar.createToolbar(editor, match.toolbar.items),
- oncancel: function () {
- editor.focus();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ColorPicker = Widget.extend({
+ Defaults: { classes: 'widget colorpicker' },
+ init: function (settings) {
+ this._super(settings);
+ },
+ postRender: function () {
+ var self = this;
+ var color = self.color();
+ var hsv, hueRootElm, huePointElm, svRootElm, svPointElm;
+ hueRootElm = self.getEl('h');
+ huePointElm = self.getEl('hp');
+ svRootElm = self.getEl('sv');
+ svPointElm = self.getEl('svp');
+ function getPos(elm, event) {
+ var pos = funcs.getPos(elm);
+ var x, y;
+ x = event.pageX - pos.x;
+ y = event.pageY - pos.y;
+ x = Math.max(0, Math.min(x / elm.clientWidth, 1));
+ y = Math.max(0, Math.min(y / elm.clientHeight, 1));
+ return {
+ x: x,
+ y: y
+ };
+ }
+ function updateColor(hsv, hueUpdate) {
+ var hue = (360 - hsv.h) / 360;
+ funcs.css(huePointElm, { top: hue * 100 + '%' });
+ if (!hueUpdate) {
+ funcs.css(svPointElm, {
+ left: hsv.s + '%',
+ top: 100 - hsv.v + '%'
+ });
+ }
+ svRootElm.style.background = global$14({
+ s: 100,
+ v: 100,
+ h: hsv.h
+ }).toHex();
+ self.color().parse({
+ s: hsv.s,
+ v: hsv.v,
+ h: hsv.h
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- match.toolbar.panel = panel;
- panel.renderTo(document.body).reflow();
- reposition(match);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ function updateSaturationAndValue(e) {
+ var pos;
+ pos = getPos(svRootElm, e);
+ hsv.s = pos.x * 100;
+ hsv.v = (1 - pos.y) * 100;
+ updateColor(hsv);
+ self.fire('change');
+ }
+ function updateHue(e) {
+ var pos;
+ pos = getPos(hueRootElm, e);
+ hsv = color.toHsv();
+ hsv.h = (1 - pos.y) * 360;
+ updateColor(hsv, true);
+ self.fire('change');
+ }
+ self._repaint = function () {
+ hsv = color.toHsv();
+ updateColor(hsv);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self._super();
+ self._svdraghelper = new DragHelper(self._id + '-sv', {
+ start: updateSaturationAndValue,
+ drag: updateSaturationAndValue
+ });
+ self._hdraghelper = new DragHelper(self._id + '-h', {
+ start: updateHue,
+ drag: updateHue
+ });
+ self._repaint();
+ },
+ rgb: function () {
+ return this.color().toRgb();
+ },
+ value: function (value) {
+ var self = this;
+ if (arguments.length) {
+ self.color().parse(value);
+ if (self._rendered) {
+ self._repaint();
+ }
+ } else {
+ return self.color().toHex();
+ }
+ },
+ color: function () {
+ if (!this._color) {
+ this._color = global$14();
+ }
+ return this._color;
+ },
+ renderHtml: function () {
+ var self = this;
+ var id = self._id;
+ var prefix = self.classPrefix;
+ var hueHtml;
+ var stops = '#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000';
+ function getOldIeFallbackHtml() {
+ var i, l, html = '', gradientPrefix, stopsList;
+ gradientPrefix = 'filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=';
+ stopsList = stops.split(',');
+ for (i = 0, l = stopsList.length - 1; i < l; i++) {
+ html += '<div class="' + prefix + 'colorpicker-h-chunk" style="' + 'height:' + 100 / l + '%;' + gradientPrefix + stopsList[i] + ',endColorstr=' + stopsList[i + 1] + ');' + '-ms-' + gradientPrefix + stopsList[i] + ',endColorstr=' + stopsList[i + 1] + ')' + '"></div>';
+ }
+ return html;
+ }
+ var gradientCssText = 'background: -ms-linear-gradient(top,' + stops + ');' + 'background: linear-gradient(to bottom,' + stops + ');';
+ hueHtml = '<div id="' + id + '-h" class="' + prefix + 'colorpicker-h" style="' + gradientCssText + '">' + getOldIeFallbackHtml() + '<div id="' + id + '-hp" class="' + prefix + 'colorpicker-h-marker"></div>' + '</div>';
+ return '<div id="' + id + '" class="' + self.classes + '">' + '<div id="' + id + '-sv" class="' + prefix + 'colorpicker-sv">' + '<div class="' + prefix + 'colorpicker-overlay1">' + '<div class="' + prefix + 'colorpicker-overlay2">' + '<div id="' + id + '-svp" class="' + prefix + 'colorpicker-selector1">' + '<div class="' + prefix + 'colorpicker-selector2"></div>' + '</div>' + '</div>' + '</div>' + '</div>' + hueHtml + '</div>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var hideAllContextToolbars = function () {
- Tools.each(getContextToolbars(), function (toolbar) {
- if (toolbar.panel) {
- toolbar.panel.hide();
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DropZone = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ settings = global$2.extend({
+ height: 100,
+ text: 'Drop an image here',
+ multiple: false,
+ accept: null
+ }, settings);
+ self._super(settings);
+ self.classes.add('dropzone');
+ if (settings.multiple) {
+ self.classes.add('multiple');
+ }
+ },
+ renderHtml: function () {
+ var self = this;
+ var attrs, elm;
+ var cfg = self.settings;
+ attrs = {
+ id: self._id,
+ hidefocus: '1'
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var findFrontMostMatch = function (targetElm) {
- var i, y, parentsAndSelf, toolbars = getContextToolbars();
-
- parentsAndSelf = editor.$(targetElm).parents().add(targetElm);
- for (i = parentsAndSelf.length - 1; i >= 0; i--) {
- for (y = toolbars.length - 1; y >= 0; y--) {
- if (toolbars[y].predicate(parentsAndSelf[i])) {
- return {
- toolbar: toolbars[y],
- element: parentsAndSelf[i]
- };
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ elm = funcs.create('div', attrs, '<span>' + this.translate(cfg.text) + '</span>');
+ if (cfg.height) {
+ funcs.css(elm, 'height', cfg.height + 'px');
+ }
+ if (cfg.width) {
+ funcs.css(elm, 'width', cfg.width + 'px');
+ }
+ elm.className = self.classes;
+ return elm.outerHTML;
+ },
+ postRender: function () {
+ var self = this;
+ var toggleDragClass = function (e) {
+ e.preventDefault();
+ self.classes.toggle('dragenter');
+ self.getEl().className = self.classes;
+ };
+ var filter = function (files) {
+ var accept = self.settings.accept;
+ if (typeof accept !== 'string') {
+ return files;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var re = new RegExp('(' + accept.split(/\s*,\s*/).join('|') + ')$', 'i');
+ return global$2.grep(files, function (file) {
+ return re.test(file.name);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.on('click keyup setContent ObjectResized', function (e) {
- // Only act on partial inserts
- if (e.type === 'setcontent' && !e.selection) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self._super();
+ self.$el.on('dragover', function (e) {
+ e.preventDefault();
+ });
+ self.$el.on('dragenter', toggleDragClass);
+ self.$el.on('dragleave', toggleDragClass);
+ self.$el.on('drop', function (e) {
+ e.preventDefault();
+ if (self.state.get('disabled')) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Needs to be delayed to avoid Chrome img focus out bug
- Delay.setEditorTimeout(editor, function () {
- var match;
-
- match = findFrontMostMatch(editor.selection.getNode());
- if (match) {
- hideAllContextToolbars();
- showContextToolbar(match);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var files = filter(e.dataTransfer.files);
+ self.value = function () {
+ if (!files.length) {
+ return null;
+ } else if (self.settings.multiple) {
+ return files;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- hideAllContextToolbars();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return files[0];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (files.length) {
+ self.fire('change', e);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ remove: function () {
+ this.$el.off();
+ this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('blur hide contextmenu', hideAllContextToolbars);
-
- editor.on('ObjectResizeStart', function () {
- var match = findFrontMostMatch(editor.selection.getNode());
-
- if (match && match.toolbar.panel) {
- match.toolbar.panel.hide();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Path = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ if (!settings.delimiter) {
+ settings.delimiter = '\xBB';
+ }
+ self._super(settings);
+ self.classes.add('path');
+ self.canFocus = true;
+ self.on('click', function (e) {
+ var index;
+ var target = e.target;
+ if (index = target.getAttribute('data-index')) {
+ self.fire('select', {
+ value: self.row()[index],
+ index: index
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.row(self.settings.row);
+ },
+ focus: function () {
+ var self = this;
+ self.getEl().firstChild.focus();
+ return self;
+ },
+ row: function (row) {
+ if (!arguments.length) {
+ return this.state.get('row');
+ }
+ this.state.set('row', row);
+ return this;
+ },
+ renderHtml: function () {
+ var self = this;
+ return '<div id="' + self._id + '" class="' + self.classes + '">' + self._getDataPathHtml(self.state.get('row')) + '</div>';
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:row', function (e) {
+ self.innerHtml(self._getDataPathHtml(e.value));
+ });
+ return self._super();
+ },
+ _getDataPathHtml: function (data) {
+ var self = this;
+ var parts = data || [];
+ var i, l, html = '';
+ var prefix = self.classPrefix;
+ for (i = 0, l = parts.length; i < l; i++) {
+ html += (i > 0 ? '<div class="' + prefix + 'divider" aria-hidden="true"> ' + self.settings.delimiter + ' </div>' : '') + '<div role="button" class="' + prefix + 'path-item' + (i === l - 1 ? ' ' + prefix + 'last' : '') + '" data-index="' + i + '" tabindex="-1" id="' + self._id + '-' + i + '" aria-level="' + (i + 1) + '">' + parts[i].name + '</div>';
+ }
+ if (!html) {
+ html = '<div class="' + prefix + 'path-item">\xA0</div>';
+ }
+ return html;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('ResizeEditor ResizeWindow', repositionHandler(true));
- editor.on('nodeChange', repositionHandler(false));
-
- editor.on('remove', function () {
- Tools.each(getContextToolbars(), function (toolbar) {
- if (toolbar.panel) {
- toolbar.panel.remove();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ElementPath = Path.extend({
+ postRender: function () {
+ var self = this, editor = self.settings.editor;
+ function isHidden(elm) {
+ if (elm.nodeType === 1) {
+ if (elm.nodeName === 'BR' || !!elm.getAttribute('data-mce-bogus')) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (elm.getAttribute('data-mce-type') === 'bookmark') {
+ return true;
+ }
+ }
+ return false;
+ }
+ if (editor.settings.elementpath !== false) {
+ self.on('select', function (e) {
+ editor.focus();
+ editor.selection.select(this.row()[e.index].element);
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('nodeChange', function (e) {
+ var outParents = [];
+ var parents = e.parents;
+ var i = parents.length;
+ while (i--) {
+ if (parents[i].nodeType === 1 && !isHidden(parents[i])) {
+ var args = editor.fire('ResolveName', {
+ name: parents[i].nodeName.toLowerCase(),
+ target: parents[i]
+ });
+ if (!args.isDefaultPrevented()) {
+ outParents.push({
+ name: args.name,
+ element: parents[i]
+ });
+ }
+ if (args.isPropagationStopped()) {
+ break;
+ }
+ }
+ }
+ self.row(outParents);
+ });
+ }
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.contextToolbars = {};
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var FormItem = Container.extend({
+ Defaults: {
+ layout: 'flex',
+ align: 'center',
+ defaults: { flex: 1 }
+ },
+ renderHtml: function () {
+ var self = this, layout = self._layout, prefix = self.classPrefix;
+ self.classes.add('formitem');
+ layout.preRender(self);
+ return '<div id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1">' + (self.settings.title ? '<div id="' + self._id + '-title" class="' + prefix + 'title">' + self.settings.title + '</div>' : '') + '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' + (self.settings.html || '') + layout.renderHtml(self) + '</div>' + '</div>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.shortcuts.add('ctrl+shift+e > ctrl+shift+p', '', function () {
- var match = findFrontMostMatch(editor.selection.getNode());
- if (match && match.toolbar.panel) {
- match.toolbar.panel.items()[0].focus();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Form = Container.extend({
+ Defaults: {
+ containerCls: 'form',
+ layout: 'flex',
+ direction: 'column',
+ align: 'stretch',
+ flex: 1,
+ padding: 15,
+ labelGap: 30,
+ spacing: 10,
+ callbacks: {
+ submit: function () {
+ this.submit();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ },
+ preRender: function () {
+ var self = this, items = self.items();
+ if (!self.settings.formItemDefaults) {
+ self.settings.formItemDefaults = {
+ layout: 'flex',
+ autoResize: 'overflow',
+ defaults: { flex: 1 }
+ };
+ }
+ items.each(function (ctrl) {
+ var formItem;
+ var label = ctrl.settings.label;
+ if (label) {
+ formItem = new FormItem(global$2.extend({
+ items: {
+ type: 'label',
+ id: ctrl._id + '-l',
+ text: label,
+ flex: 0,
+ forId: ctrl._id,
+ disabled: ctrl.disabled()
+ }
+ }, self.settings.formItemDefaults));
+ formItem.type = 'formitem';
+ ctrl.aria('labelledby', ctrl._id + '-l');
+ if (typeof ctrl.settings.flex === 'undefined') {
+ ctrl.settings.flex = 1;
+ }
+ self.replace(ctrl, formItem);
+ formItem.add(ctrl);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ submit: function () {
+ return this.fire('submit', { data: this.toJSON() });
+ },
+ postRender: function () {
+ var self = this;
+ self._super();
+ self.fromJSON(self.settings.data);
+ },
+ bindStates: function () {
+ var self = this;
+ self._super();
+ function recalcLabels() {
+ var maxLabelWidth = 0;
+ var labels = [];
+ var i, labelGap, items;
+ if (self.settings.labelGapCalc === false) {
+ return;
+ }
+ if (self.settings.labelGapCalc === 'children') {
+ items = self.find('formitem');
+ } else {
+ items = self.items();
+ }
+ items.filter('formitem').each(function (item) {
+ var labelCtrl = item.items()[0], labelWidth = labelCtrl.getEl().clientWidth;
+ maxLabelWidth = labelWidth > maxLabelWidth ? labelWidth : maxLabelWidth;
+ labels.push(labelCtrl);
+ });
+ labelGap = self.settings.labelGap || 0;
+ i = labels.length;
+ while (i--) {
+ labels[i].settings.minWidth = maxLabelWidth + labelGap;
+ }
+ }
+ self.on('show', recalcLabels);
+ recalcLabels();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- addContextualToolbars: addContextualToolbars
- };
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var FieldSet = Form.extend({
+ Defaults: {
+ containerCls: 'fieldset',
+ layout: 'flex',
+ direction: 'column',
+ align: 'stretch',
+ flex: 1,
+ padding: '25 15 5 15',
+ labelGap: 30,
+ spacing: 10,
+ border: 1
+ },
+ renderHtml: function () {
+ var self = this, layout = self._layout, prefix = self.classPrefix;
+ self.preRender();
+ layout.preRender(self);
+ return '<fieldset id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1">' + (self.settings.title ? '<legend id="' + self._id + '-title" class="' + prefix + 'fieldset-title">' + self.settings.title + '</legend>' : '') + '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' + (self.settings.html || '') + layout.renderHtml(self) + '</div>' + '</fieldset>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Menubar.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var unique$1 = 0;
+ var generate = function (prefix) {
+ var date = new Date();
+ var time = date.getTime();
+ var random = Math.floor(Math.random() * 1000000000);
+ unique$1++;
+ return prefix + '_' + random + unique$1 + String(time);
+ };
+ var $_8smsfouyjfuw8sjg = { generate: generate };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.modern.ui.Menubar',
- [
- 'tinymce.core.util.Tools'
- ],
- function (Tools) {
- var defaultMenus = {
- file: { title: 'File', items: 'newdocument' },
- edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall' },
- insert: { title: 'Insert', items: '|' },
- view: { title: 'View', items: 'visualaid |' },
- format: { title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat' },
- table: { title: 'Table' },
- tools: { title: 'Tools' }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fromHtml = function (html, scope) {
+ var doc = scope || document;
+ var div = doc.createElement('div');
+ div.innerHTML = html;
+ if (!div.hasChildNodes() || div.childNodes.length > 1) {
+ console.error('HTML does not have a single root node', html);
+ throw 'HTML must have a single root node';
+ }
+ return fromDom(div.childNodes[0]);
+ };
+ var fromTag = function (tag, scope) {
+ var doc = scope || document;
+ var node = doc.createElement(tag);
+ return fromDom(node);
+ };
+ var fromText = function (text, scope) {
+ var doc = scope || document;
+ var node = doc.createTextNode(text);
+ return fromDom(node);
+ };
+ var fromDom = function (node) {
+ if (node === null || node === undefined)
+ throw new Error('Node cannot be null or undefined');
+ return { dom: $_cun2p5t7jfuw8scg.constant(node) };
+ };
+ var fromPoint = function (doc, x, y) {
+ return Option.from(doc.dom().elementFromPoint(x, y)).map(fromDom);
+ };
+ var $_5ny1kxuzjfuw8sjh = {
+ fromHtml: fromHtml,
+ fromTag: fromTag,
+ fromText: fromText,
+ fromDom: fromDom,
+ fromPoint: fromPoint
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var createMenuItem = function (menuItems, name) {
- var menuItem;
-
- if (name == '|') {
- return { text: '|' };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var cached = function (f) {
+ var called = false;
+ var r;
+ return function () {
+ if (!called) {
+ called = true;
+ r = f.apply(null, arguments);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return r;
+ };
+ };
+ var $_bbc6ssv3jfuw8sjw = { cached: cached };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- menuItem = menuItems[name];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_4uam9lv5jfuw8sjy = {
+ ATTRIBUTE: 2,
+ CDATA_SECTION: 4,
+ COMMENT: 8,
+ DOCUMENT: 9,
+ DOCUMENT_TYPE: 10,
+ DOCUMENT_FRAGMENT: 11,
+ ELEMENT: 1,
+ TEXT: 3,
+ PROCESSING_INSTRUCTION: 7,
+ ENTITY_REFERENCE: 5,
+ ENTITY: 6,
+ NOTATION: 12
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return menuItem;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var name = function (element) {
+ var r = element.dom().nodeName;
+ return r.toLowerCase();
+ };
+ var type = function (element) {
+ return element.dom().nodeType;
+ };
+ var value = function (element) {
+ return element.dom().nodeValue;
+ };
+ var isType$1 = function (t) {
+ return function (element) {
+ return type(element) === t;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isComment = function (element) {
+ return type(element) === $_4uam9lv5jfuw8sjy.COMMENT || name(element) === '#comment';
+ };
+ var isElement = isType$1($_4uam9lv5jfuw8sjy.ELEMENT);
+ var isText = isType$1($_4uam9lv5jfuw8sjy.TEXT);
+ var isDocument = isType$1($_4uam9lv5jfuw8sjy.DOCUMENT);
+ var $_a011ldv4jfuw8sjx = {
+ name: name,
+ type: type,
+ value: value,
+ isElement: isElement,
+ isText: isText,
+ isDocument: isDocument,
+ isComment: isComment
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var createMenu = function (editorMenuItems, settings, context) {
- var menuButton, menu, menuItems, isUserDefined, removedMenuItems;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var inBody = function (element) {
+ var dom = $_a011ldv4jfuw8sjx.isText(element) ? element.dom().parentNode : element.dom();
+ return dom !== undefined && dom !== null && dom.ownerDocument.body.contains(dom);
+ };
+ var body = $_bbc6ssv3jfuw8sjw.cached(function () {
+ return getBody($_5ny1kxuzjfuw8sjh.fromDom(document));
+ });
+ var getBody = function (doc) {
+ var body = doc.dom().body;
+ if (body === null || body === undefined)
+ throw 'Body is not available yet';
+ return $_5ny1kxuzjfuw8sjh.fromDom(body);
+ };
+ var $_c59f72v2jfuw8sjt = {
+ body: body,
+ getBody: getBody,
+ inBody: inBody
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- removedMenuItems = Tools.makeMap((settings.removed_menuitems || '').split(/[ ,]/));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function Immutable () {
+ var fields = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ fields[_i] = arguments[_i];
+ }
+ return function () {
+ var values = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ values[_i] = arguments[_i];
+ }
+ if (fields.length !== values.length) {
+ throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments');
+ }
+ var struct = {};
+ $_anxm1mtajfuw8sct.each(fields, function (name, i) {
+ struct[name] = $_cun2p5t7jfuw8scg.constant(values[i]);
+ });
+ return struct;
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // User defined menu
- if (settings.menu) {
- menu = settings.menu[context];
- isUserDefined = true;
- } else {
- menu = defaultMenus[context];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var keys = function () {
+ var fastKeys = Object.keys;
+ var slowKeys = function (o) {
+ var r = [];
+ for (var i in o) {
+ if (o.hasOwnProperty(i)) {
+ r.push(i);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return r;
+ };
+ return fastKeys === undefined ? slowKeys : fastKeys;
+ }();
+ var each$1 = function (obj, f) {
+ var props = keys(obj);
+ for (var k = 0, len = props.length; k < len; k++) {
+ var i = props[k];
+ var x = obj[i];
+ f(x, i, obj);
+ }
+ };
+ var objectMap = function (obj, f) {
+ return tupleMap(obj, function (x, i, obj) {
+ return {
+ k: i,
+ v: f(x, i, obj)
+ };
+ });
+ };
+ var tupleMap = function (obj, f) {
+ var r = {};
+ each$1(obj, function (x, i) {
+ var tuple = f(x, i, obj);
+ r[tuple.k] = tuple.v;
+ });
+ return r;
+ };
+ var bifilter = function (obj, pred) {
+ var t = {};
+ var f = {};
+ each$1(obj, function (x, i) {
+ var branch = pred(x, i) ? t : f;
+ branch[i] = x;
+ });
+ return {
+ t: t,
+ f: f
+ };
+ };
+ var mapToArray = function (obj, f) {
+ var r = [];
+ each$1(obj, function (value, name) {
+ r.push(f(value, name));
+ });
+ return r;
+ };
+ var find$1 = function (obj, pred) {
+ var props = keys(obj);
+ for (var k = 0, len = props.length; k < len; k++) {
+ var i = props[k];
+ var x = obj[i];
+ if (pred(x, i, obj)) {
+ return Option.some(x);
+ }
+ }
+ return Option.none();
+ };
+ var values = function (obj) {
+ return mapToArray(obj, function (v) {
+ return v;
+ });
+ };
+ var size = function (obj) {
+ return values(obj).length;
+ };
+ var $_5cwil8vajfuw8skk = {
+ bifilter: bifilter,
+ each: each$1,
+ map: objectMap,
+ mapToArray: mapToArray,
+ tupleMap: tupleMap,
+ find: find$1,
+ keys: keys,
+ values: values,
+ size: size
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (menu) {
- menuButton = { text: menu.title };
- menuItems = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var sort$1 = function (arr) {
+ return arr.slice(0).sort();
+ };
+ var reqMessage = function (required, keys) {
+ throw new Error('All required keys (' + sort$1(required).join(', ') + ') were not specified. Specified keys were: ' + sort$1(keys).join(', ') + '.');
+ };
+ var unsuppMessage = function (unsupported) {
+ throw new Error('Unsupported keys for object: ' + sort$1(unsupported).join(', '));
+ };
+ var validateStrArr = function (label, array) {
+ if (!$_e8diihtbjfuw8scy.isArray(array))
+ throw new Error('The ' + label + ' fields must be an array. Was: ' + array + '.');
+ $_anxm1mtajfuw8sct.each(array, function (a) {
+ if (!$_e8diihtbjfuw8scy.isString(a))
+ throw new Error('The value ' + a + ' in the ' + label + ' fields was not a string.');
+ });
+ };
+ var invalidTypeMessage = function (incorrect, type) {
+ throw new Error('All values need to be of type: ' + type + '. Keys (' + sort$1(incorrect).join(', ') + ') were not.');
+ };
+ var checkDupes = function (everything) {
+ var sorted = sort$1(everything);
+ var dupe = $_anxm1mtajfuw8sct.find(sorted, function (s, i) {
+ return i < sorted.length - 1 && s === sorted[i + 1];
+ });
+ dupe.each(function (d) {
+ throw new Error('The field: ' + d + ' occurs more than once in the combined fields: [' + sorted.join(', ') + '].');
+ });
+ };
+ var $_2epjibvbjfuw8skm = {
+ sort: sort$1,
+ reqMessage: reqMessage,
+ unsuppMessage: unsuppMessage,
+ validateStrArr: validateStrArr,
+ invalidTypeMessage: invalidTypeMessage,
+ checkDupes: checkDupes
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Default/user defined items
- Tools.each((menu.items || '').split(/[ ,]/), function (item) {
- var menuItem = createMenuItem(editorMenuItems, item);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function MixedBag (required, optional) {
+ var everything = required.concat(optional);
+ if (everything.length === 0)
+ throw new Error('You must specify at least one required or optional field.');
+ $_2epjibvbjfuw8skm.validateStrArr('required', required);
+ $_2epjibvbjfuw8skm.validateStrArr('optional', optional);
+ $_2epjibvbjfuw8skm.checkDupes(everything);
+ return function (obj) {
+ var keys = $_5cwil8vajfuw8skk.keys(obj);
+ var allReqd = $_anxm1mtajfuw8sct.forall(required, function (req) {
+ return $_anxm1mtajfuw8sct.contains(keys, req);
+ });
+ if (!allReqd)
+ $_2epjibvbjfuw8skm.reqMessage(required, keys);
+ var unsupported = $_anxm1mtajfuw8sct.filter(keys, function (key) {
+ return !$_anxm1mtajfuw8sct.contains(everything, key);
+ });
+ if (unsupported.length > 0)
+ $_2epjibvbjfuw8skm.unsuppMessage(unsupported);
+ var r = {};
+ $_anxm1mtajfuw8sct.each(required, function (req) {
+ r[req] = $_cun2p5t7jfuw8scg.constant(obj[req]);
+ });
+ $_anxm1mtajfuw8sct.each(optional, function (opt) {
+ r[opt] = $_cun2p5t7jfuw8scg.constant(Object.prototype.hasOwnProperty.call(obj, opt) ? Option.some(obj[opt]) : Option.none());
+ });
+ return r;
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (menuItem && !removedMenuItems[item]) {
- menuItems.push(createMenuItem(editorMenuItems, item));
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_1qtvc5v7jfuw8ske = {
+ immutable: Immutable,
+ immutableBag: MixedBag
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Added though context
- if (!isUserDefined) {
- Tools.each(editorMenuItems, function (menuItem) {
- if (menuItem.context == context) {
- if (menuItem.separator == 'before') {
- menuItems.push({ text: '|' });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toArray = function (target, f) {
+ var r = [];
+ var recurse = function (e) {
+ r.push(e);
+ return f(e);
+ };
+ var cur = f(target);
+ do {
+ cur = cur.bind(recurse);
+ } while (cur.isSome());
+ return r;
+ };
+ var $_ds6cwivcjfuw8sko = { toArray: toArray };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (menuItem.prependToContext) {
- menuItems.unshift(menuItem);
- } else {
- menuItems.push(menuItem);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global$15 = typeof window !== 'undefined' ? window : Function('return this;')();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (menuItem.separator == 'after') {
- menuItems.push({ text: '|' });
- }
- }
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var path = function (parts, scope) {
+ var o = scope !== undefined && scope !== null ? scope : global$15;
+ for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
+ o = o[parts[i]];
+ return o;
+ };
+ var resolve = function (p, scope) {
+ var parts = p.split('.');
+ return path(parts, scope);
+ };
+ var step = function (o, part) {
+ if (o[part] === undefined || o[part] === null)
+ o[part] = {};
+ return o[part];
+ };
+ var forge = function (parts, target) {
+ var o = target !== undefined ? target : global$15;
+ for (var i = 0; i < parts.length; ++i)
+ o = step(o, parts[i]);
+ return o;
+ };
+ var namespace = function (name, target) {
+ var parts = name.split('.');
+ return forge(parts, target);
+ };
+ var $_3zodh3vgjfuw8slc = {
+ path: path,
+ resolve: resolve,
+ forge: forge,
+ namespace: namespace
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- for (var i = 0; i < menuItems.length; i++) {
- if (menuItems[i].text == '|') {
- if (i === 0 || i == menuItems.length - 1) {
- menuItems.splice(i, 1);
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var unsafe = function (name, scope) {
+ return $_3zodh3vgjfuw8slc.resolve(name, scope);
+ };
+ var getOrDie = function (name, scope) {
+ var actual = unsafe(name, scope);
+ if (actual === undefined || actual === null)
+ throw name + ' not available on this browser';
+ return actual;
+ };
+ var $_b2mlbvvfjfuw8sl9 = { getOrDie: getOrDie };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- menuButton.menu = menuItems;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var node = function () {
+ var f = $_b2mlbvvfjfuw8sl9.getOrDie('Node');
+ return f;
+ };
+ var compareDocumentPosition = function (a, b, match) {
+ return (a.compareDocumentPosition(b) & match) !== 0;
+ };
+ var documentPositionPreceding = function (a, b) {
+ return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);
+ };
+ var documentPositionContainedBy = function (a, b) {
+ return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);
+ };
+ var $_9ssw9yvejfuw8sl8 = {
+ documentPositionPreceding: documentPositionPreceding,
+ documentPositionContainedBy: documentPositionContainedBy
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (!menuButton.menu.length) {
- return null;
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var firstMatch = function (regexes, s) {
+ for (var i = 0; i < regexes.length; i++) {
+ var x = regexes[i];
+ if (x.test(s))
+ return x;
+ }
+ return undefined;
+ };
+ var find$2 = function (regexes, agent) {
+ var r = firstMatch(regexes, agent);
+ if (!r)
+ return {
+ major: 0,
+ minor: 0
+ };
+ var group = function (i) {
+ return Number(agent.replace(r, '$' + i));
+ };
+ return nu(group(1), group(2));
+ };
+ var detect = function (versionRegexes, agent) {
+ var cleanedAgent = String(agent).toLowerCase();
+ if (versionRegexes.length === 0)
+ return unknown();
+ return find$2(versionRegexes, cleanedAgent);
+ };
+ var unknown = function () {
+ return nu(0, 0);
+ };
+ var nu = function (major, minor) {
+ return {
+ major: major,
+ minor: minor
+ };
+ };
+ var $_cb8wvsvljfuw8slm = {
+ nu: nu,
+ detect: detect,
+ unknown: unknown
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return menuButton;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var edge = 'Edge';
+ var chrome = 'Chrome';
+ var ie = 'IE';
+ var opera = 'Opera';
+ var firefox = 'Firefox';
+ var safari = 'Safari';
+ var isBrowser = function (name, current) {
+ return function () {
+ return current === name;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var unknown$1 = function () {
+ return nu$1({
+ current: undefined,
+ version: $_cb8wvsvljfuw8slm.unknown()
+ });
+ };
+ var nu$1 = function (info) {
+ var current = info.current;
+ var version = info.version;
+ return {
+ current: current,
+ version: version,
+ isEdge: isBrowser(edge, current),
+ isChrome: isBrowser(chrome, current),
+ isIE: isBrowser(ie, current),
+ isOpera: isBrowser(opera, current),
+ isFirefox: isBrowser(firefox, current),
+ isSafari: isBrowser(safari, current)
+ };
+ };
+ var $_5l1g9dvkjfuw8slj = {
+ unknown: unknown$1,
+ nu: nu$1,
+ edge: $_cun2p5t7jfuw8scg.constant(edge),
+ chrome: $_cun2p5t7jfuw8scg.constant(chrome),
+ ie: $_cun2p5t7jfuw8scg.constant(ie),
+ opera: $_cun2p5t7jfuw8scg.constant(opera),
+ firefox: $_cun2p5t7jfuw8scg.constant(firefox),
+ safari: $_cun2p5t7jfuw8scg.constant(safari)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var createMenuButtons = function (editor) {
- var name, menuButtons = [], settings = editor.settings;
-
- var defaultMenuBar = [];
- if (settings.menu) {
- for (name in settings.menu) {
- defaultMenuBar.push(name);
- }
- } else {
- for (name in defaultMenus) {
- defaultMenuBar.push(name);
- }
- }
-
- var enabledMenuNames = typeof settings.menubar == "string" ? settings.menubar.split(/[ ,]/) : defaultMenuBar;
- for (var i = 0; i < enabledMenuNames.length; i++) {
- var menu = enabledMenuNames[i];
- menu = createMenu(editor.menuItems, editor.settings, menu);
-
- if (menu) {
- menuButtons.push(menu);
- }
- }
-
- return menuButtons;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var windows$1 = 'Windows';
+ var ios = 'iOS';
+ var android = 'Android';
+ var linux = 'Linux';
+ var osx = 'OSX';
+ var solaris = 'Solaris';
+ var freebsd = 'FreeBSD';
+ var isOS = function (name, current) {
+ return function () {
+ return current === name;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var unknown$2 = function () {
+ return nu$2({
+ current: undefined,
+ version: $_cb8wvsvljfuw8slm.unknown()
+ });
+ };
+ var nu$2 = function (info) {
+ var current = info.current;
+ var version = info.version;
+ return {
+ current: current,
+ version: version,
+ isWindows: isOS(windows$1, current),
+ isiOS: isOS(ios, current),
+ isAndroid: isOS(android, current),
+ isOSX: isOS(osx, current),
+ isLinux: isOS(linux, current),
+ isSolaris: isOS(solaris, current),
+ isFreeBSD: isOS(freebsd, current)
+ };
+ };
+ var $_ej30zjvmjfuw8sln = {
+ unknown: unknown$2,
+ nu: nu$2,
+ windows: $_cun2p5t7jfuw8scg.constant(windows$1),
+ ios: $_cun2p5t7jfuw8scg.constant(ios),
+ android: $_cun2p5t7jfuw8scg.constant(android),
+ linux: $_cun2p5t7jfuw8scg.constant(linux),
+ osx: $_cun2p5t7jfuw8scg.constant(osx),
+ solaris: $_cun2p5t7jfuw8scg.constant(solaris),
+ freebsd: $_cun2p5t7jfuw8scg.constant(freebsd)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function DeviceType (os, browser, userAgent) {
+ var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
+ var isiPhone = os.isiOS() && !isiPad;
+ var isAndroid3 = os.isAndroid() && os.version.major === 3;
+ var isAndroid4 = os.isAndroid() && os.version.major === 4;
+ var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true;
+ var isTouch = os.isiOS() || os.isAndroid();
+ var isPhone = isTouch && !isTablet;
+ var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- createMenuButtons: createMenuButtons
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ isiPad: $_cun2p5t7jfuw8scg.constant(isiPad),
+ isiPhone: $_cun2p5t7jfuw8scg.constant(isiPhone),
+ isTablet: $_cun2p5t7jfuw8scg.constant(isTablet),
+ isPhone: $_cun2p5t7jfuw8scg.constant(isPhone),
+ isTouch: $_cun2p5t7jfuw8scg.constant(isTouch),
+ isAndroid: os.isAndroid,
+ isiOS: os.isiOS,
+ isWebView: $_cun2p5t7jfuw8scg.constant(iOSwebview)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Resize.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.modern.ui.Resize',
- [
- 'tinymce.core.dom.DOMUtils'
- ],
- function (DOMUtils) {
- var DOM = DOMUtils.DOM;
- var getSize = function (elm) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var detect$1 = function (candidates, userAgent) {
+ var agent = String(userAgent).toLowerCase();
+ return $_anxm1mtajfuw8sct.find(candidates, function (candidate) {
+ return candidate.search(agent);
+ });
+ };
+ var detectBrowser = function (browsers, userAgent) {
+ return detect$1(browsers, userAgent).map(function (browser) {
+ var version = $_cb8wvsvljfuw8slm.detect(browser.versionRegexes, userAgent);
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- width: elm.clientWidth,
- height: elm.clientHeight
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ current: browser.name,
+ version: version
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var detectOs = function (oses, userAgent) {
+ return detect$1(oses, userAgent).map(function (os) {
+ var version = $_cb8wvsvljfuw8slm.detect(os.versionRegexes, userAgent);
+ return {
+ current: os.name,
+ version: version
+ };
+ });
+ };
+ var $_1rd3rvvojfuw8slu = {
+ detectBrowser: detectBrowser,
+ detectOs: detectOs
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var resizeTo = function (editor, width, height) {
- var containerElm, iframeElm, containerSize, iframeSize, settings = editor.settings;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addToStart = function (str, prefix) {
+ return prefix + str;
+ };
+ var addToEnd = function (str, suffix) {
+ return str + suffix;
+ };
+ var removeFromStart = function (str, numChars) {
+ return str.substring(numChars);
+ };
+ var removeFromEnd = function (str, numChars) {
+ return str.substring(0, str.length - numChars);
+ };
+ var $_56mt3mvrjfuw8sm6 = {
+ addToStart: addToStart,
+ addToEnd: addToEnd,
+ removeFromStart: removeFromStart,
+ removeFromEnd: removeFromEnd
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- containerElm = editor.getContainer();
- iframeElm = editor.getContentAreaContainer().firstChild;
- containerSize = getSize(containerElm);
- iframeSize = getSize(iframeElm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var first = function (str, count) {
+ return str.substr(0, count);
+ };
+ var last$1 = function (str, count) {
+ return str.substr(str.length - count, str.length);
+ };
+ var head$1 = function (str) {
+ return str === '' ? Option.none() : Option.some(str.substr(0, 1));
+ };
+ var tail = function (str) {
+ return str === '' ? Option.none() : Option.some(str.substring(1));
+ };
+ var $_7bobc1vsjfuw8sm7 = {
+ first: first,
+ last: last$1,
+ head: head$1,
+ tail: tail
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (width !== null) {
- width = Math.max(settings.min_width || 100, width);
- width = Math.min(settings.max_width || 0xFFFF, width);
-
- DOM.setStyle(containerElm, 'width', width + (containerSize.width - iframeSize.width));
- DOM.setStyle(iframeElm, 'width', width);
- }
-
- height = Math.max(settings.min_height || 100, height);
- height = Math.min(settings.max_height || 0xFFFF, height);
- DOM.setStyle(iframeElm, 'height', height);
-
- editor.fire('ResizeEditor');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var checkRange = function (str, substr, start) {
+ if (substr === '')
+ return true;
+ if (str.length < substr.length)
+ return false;
+ var x = str.substr(start, start + substr.length);
+ return x === substr;
+ };
+ var supplant = function (str, obj) {
+ var isStringOrNumber = function (a) {
+ var t = typeof a;
+ return t === 'string' || t === 'number';
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return str.replace(/\${([^{}]*)}/g, function (a, b) {
+ var value = obj[b];
+ return isStringOrNumber(value) ? value : a;
+ });
+ };
+ var removeLeading = function (str, prefix) {
+ return startsWith(str, prefix) ? $_56mt3mvrjfuw8sm6.removeFromStart(str, prefix.length) : str;
+ };
+ var removeTrailing = function (str, prefix) {
+ return endsWith(str, prefix) ? $_56mt3mvrjfuw8sm6.removeFromEnd(str, prefix.length) : str;
+ };
+ var ensureLeading = function (str, prefix) {
+ return startsWith(str, prefix) ? str : $_56mt3mvrjfuw8sm6.addToStart(str, prefix);
+ };
+ var ensureTrailing = function (str, prefix) {
+ return endsWith(str, prefix) ? str : $_56mt3mvrjfuw8sm6.addToEnd(str, prefix);
+ };
+ var contains$1 = function (str, substr) {
+ return str.indexOf(substr) !== -1;
+ };
+ var capitalize = function (str) {
+ return $_7bobc1vsjfuw8sm7.head(str).bind(function (head) {
+ return $_7bobc1vsjfuw8sm7.tail(str).map(function (tail) {
+ return head.toUpperCase() + tail;
+ });
+ }).getOr(str);
+ };
+ var startsWith = function (str, prefix) {
+ return checkRange(str, prefix, 0);
+ };
+ var endsWith = function (str, suffix) {
+ return checkRange(str, suffix, str.length - suffix.length);
+ };
+ var trim = function (str) {
+ return str.replace(/^\s+|\s+$/g, '');
+ };
+ var lTrim = function (str) {
+ return str.replace(/^\s+/g, '');
+ };
+ var rTrim = function (str) {
+ return str.replace(/\s+$/g, '');
+ };
+ var $_8evc57vqjfuw8sm4 = {
+ supplant: supplant,
+ startsWith: startsWith,
+ removeLeading: removeLeading,
+ removeTrailing: removeTrailing,
+ ensureLeading: ensureLeading,
+ ensureTrailing: ensureTrailing,
+ endsWith: endsWith,
+ contains: contains$1,
+ trim: trim,
+ lTrim: lTrim,
+ rTrim: rTrim,
+ capitalize: capitalize
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var resizeBy = function (editor, dw, dh) {
- var elm = editor.getContentAreaContainer();
- resizeTo(editor, elm.clientWidth + dw, elm.clientHeight + dh);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
+ var checkContains = function (target) {
+ return function (uastring) {
+ return $_8evc57vqjfuw8sm4.contains(uastring, target);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var browsers = [
+ {
+ name: 'Edge',
+ versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
+ search: function (uastring) {
+ var monstrosity = $_8evc57vqjfuw8sm4.contains(uastring, 'edge/') && $_8evc57vqjfuw8sm4.contains(uastring, 'chrome') && $_8evc57vqjfuw8sm4.contains(uastring, 'safari') && $_8evc57vqjfuw8sm4.contains(uastring, 'applewebkit');
+ return monstrosity;
+ }
+ },
+ {
+ name: 'Chrome',
+ versionRegexes: [
+ /.*?chrome\/([0-9]+)\.([0-9]+).*/,
+ normalVersionRegex
+ ],
+ search: function (uastring) {
+ return $_8evc57vqjfuw8sm4.contains(uastring, 'chrome') && !$_8evc57vqjfuw8sm4.contains(uastring, 'chromeframe');
+ }
+ },
+ {
+ name: 'IE',
+ versionRegexes: [
+ /.*?msie\ ?([0-9]+)\.([0-9]+).*/,
+ /.*?rv:([0-9]+)\.([0-9]+).*/
+ ],
+ search: function (uastring) {
+ return $_8evc57vqjfuw8sm4.contains(uastring, 'msie') || $_8evc57vqjfuw8sm4.contains(uastring, 'trident');
+ }
+ },
+ {
+ name: 'Opera',
+ versionRegexes: [
+ normalVersionRegex,
+ /.*?opera\/([0-9]+)\.([0-9]+).*/
+ ],
+ search: checkContains('opera')
+ },
+ {
+ name: 'Firefox',
+ versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
+ search: checkContains('firefox')
+ },
+ {
+ name: 'Safari',
+ versionRegexes: [
+ normalVersionRegex,
+ /.*?cpu os ([0-9]+)_([0-9]+).*/
+ ],
+ search: function (uastring) {
+ return ($_8evc57vqjfuw8sm4.contains(uastring, 'safari') || $_8evc57vqjfuw8sm4.contains(uastring, 'mobile/')) && $_8evc57vqjfuw8sm4.contains(uastring, 'applewebkit');
+ }
+ }
+ ];
+ var oses = [
+ {
+ name: 'Windows',
+ search: checkContains('win'),
+ versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
+ },
+ {
+ name: 'iOS',
+ search: function (uastring) {
+ return $_8evc57vqjfuw8sm4.contains(uastring, 'iphone') || $_8evc57vqjfuw8sm4.contains(uastring, 'ipad');
+ },
+ versionRegexes: [
+ /.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
+ /.*cpu os ([0-9]+)_([0-9]+).*/,
+ /.*cpu iphone os ([0-9]+)_([0-9]+).*/
+ ]
+ },
+ {
+ name: 'Android',
+ search: checkContains('android'),
+ versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
+ },
+ {
+ name: 'OSX',
+ search: checkContains('os x'),
+ versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]
+ },
+ {
+ name: 'Linux',
+ search: checkContains('linux'),
+ versionRegexes: []
+ },
+ {
+ name: 'Solaris',
+ search: checkContains('sunos'),
+ versionRegexes: []
+ },
+ {
+ name: 'FreeBSD',
+ search: checkContains('freebsd'),
+ versionRegexes: []
+ }
+ ];
+ var $_60mzbrvpjfuw8sly = {
+ browsers: $_cun2p5t7jfuw8scg.constant(browsers),
+ oses: $_cun2p5t7jfuw8scg.constant(oses)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var detect$2 = function (userAgent) {
+ var browsers = $_60mzbrvpjfuw8sly.browsers();
+ var oses = $_60mzbrvpjfuw8sly.oses();
+ var browser = $_1rd3rvvojfuw8slu.detectBrowser(browsers, userAgent).fold($_5l1g9dvkjfuw8slj.unknown, $_5l1g9dvkjfuw8slj.nu);
+ var os = $_1rd3rvvojfuw8slu.detectOs(oses, userAgent).fold($_ej30zjvmjfuw8sln.unknown, $_ej30zjvmjfuw8sln.nu);
+ var deviceType = DeviceType(os, browser, userAgent);
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- resizeTo: resizeTo,
- resizeBy: resizeBy
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ browser: browser,
+ os: os,
+ deviceType: deviceType
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_486hpkvjjfuw8slh = { detect: detect$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Sidebar.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var detect$3 = $_bbc6ssv3jfuw8sjw.cached(function () {
+ var userAgent = navigator.userAgent;
+ return $_486hpkvjjfuw8slh.detect(userAgent);
+ });
+ var $_cnts0hvijfuw8sle = { detect: detect$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.themes.modern.ui.Sidebar',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.ui.Factory',
- 'tinymce.core.Env'
- ],
- function (Tools, Factory, Env) {
- var api = function (elm) {
- return {
- element: function () {
- return elm;
- }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ELEMENT = $_4uam9lv5jfuw8sjy.ELEMENT;
+ var DOCUMENT = $_4uam9lv5jfuw8sjy.DOCUMENT;
+ var is = function (element, selector) {
+ var elem = element.dom();
+ if (elem.nodeType !== ELEMENT)
+ return false;
+ else if (elem.matches !== undefined)
+ return elem.matches(selector);
+ else if (elem.msMatchesSelector !== undefined)
+ return elem.msMatchesSelector(selector);
+ else if (elem.webkitMatchesSelector !== undefined)
+ return elem.webkitMatchesSelector(selector);
+ else if (elem.mozMatchesSelector !== undefined)
+ return elem.mozMatchesSelector(selector);
+ else
+ throw new Error('Browser lacks native selectors');
+ };
+ var bypassSelector = function (dom) {
+ return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT || dom.childElementCount === 0;
+ };
+ var all = function (selector, scope) {
+ var base = scope === undefined ? document : scope.dom();
+ return bypassSelector(base) ? [] : $_anxm1mtajfuw8sct.map(base.querySelectorAll(selector), $_5ny1kxuzjfuw8sjh.fromDom);
+ };
+ var one = function (selector, scope) {
+ var base = scope === undefined ? document : scope.dom();
+ return bypassSelector(base) ? Option.none() : Option.from(base.querySelector(selector)).map($_5ny1kxuzjfuw8sjh.fromDom);
+ };
+ var $_cy5apxvtjfuw8sm8 = {
+ all: all,
+ is: is,
+ one: one
+ };
+
+ var eq = function (e1, e2) {
+ return e1.dom() === e2.dom();
+ };
+ var isEqualNode = function (e1, e2) {
+ return e1.dom().isEqualNode(e2.dom());
+ };
+ var member = function (element, elements) {
+ return $_anxm1mtajfuw8sct.exists(elements, $_cun2p5t7jfuw8scg.curry(eq, element));
+ };
+ var regularContains = function (e1, e2) {
+ var d1 = e1.dom(), d2 = e2.dom();
+ return d1 === d2 ? false : d1.contains(d2);
+ };
+ var ieContains = function (e1, e2) {
+ return $_9ssw9yvejfuw8sl8.documentPositionContainedBy(e1.dom(), e2.dom());
+ };
+ var browser = $_cnts0hvijfuw8sle.detect().browser;
+ var contains$2 = browser.isIE() ? ieContains : regularContains;
+ var $_22fg4zvdjfuw8skq = {
+ eq: eq,
+ isEqualNode: isEqualNode,
+ member: member,
+ contains: contains$2,
+ is: $_cy5apxvtjfuw8sm8.is
+ };
+
+ var owner = function (element) {
+ return $_5ny1kxuzjfuw8sjh.fromDom(element.dom().ownerDocument);
+ };
+ var documentElement = function (element) {
+ var doc = owner(element);
+ return $_5ny1kxuzjfuw8sjh.fromDom(doc.dom().documentElement);
+ };
+ var defaultView = function (element) {
+ var el = element.dom();
+ var defaultView = el.ownerDocument.defaultView;
+ return $_5ny1kxuzjfuw8sjh.fromDom(defaultView);
+ };
+ var parent = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.parentNode).map($_5ny1kxuzjfuw8sjh.fromDom);
+ };
+ var findIndex$1 = function (element) {
+ return parent(element).bind(function (p) {
+ var kin = children(p);
+ return $_anxm1mtajfuw8sct.findIndex(kin, function (elem) {
+ return $_22fg4zvdjfuw8skq.eq(element, elem);
+ });
+ });
+ };
+ var parents = function (element, isRoot) {
+ var stop = $_e8diihtbjfuw8scy.isFunction(isRoot) ? isRoot : $_cun2p5t7jfuw8scg.constant(false);
+ var dom = element.dom();
+ var ret = [];
+ while (dom.parentNode !== null && dom.parentNode !== undefined) {
+ var rawParent = dom.parentNode;
+ var parent = $_5ny1kxuzjfuw8sjh.fromDom(rawParent);
+ ret.push(parent);
+ if (stop(parent) === true)
+ break;
+ else
+ dom = rawParent;
+ }
+ return ret;
+ };
+ var siblings = function (element) {
+ var filterSelf = function (elements) {
+ return $_anxm1mtajfuw8sct.filter(elements, function (x) {
+ return !$_22fg4zvdjfuw8skq.eq(element, x);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return parent(element).map(children).map(filterSelf).getOr([]);
+ };
+ var offsetParent = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.offsetParent).map($_5ny1kxuzjfuw8sjh.fromDom);
+ };
+ var prevSibling = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.previousSibling).map($_5ny1kxuzjfuw8sjh.fromDom);
+ };
+ var nextSibling = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.nextSibling).map($_5ny1kxuzjfuw8sjh.fromDom);
+ };
+ var prevSiblings = function (element) {
+ return $_anxm1mtajfuw8sct.reverse($_ds6cwivcjfuw8sko.toArray(element, prevSibling));
+ };
+ var nextSiblings = function (element) {
+ return $_ds6cwivcjfuw8sko.toArray(element, nextSibling);
+ };
+ var children = function (element) {
+ var dom = element.dom();
+ return $_anxm1mtajfuw8sct.map(dom.childNodes, $_5ny1kxuzjfuw8sjh.fromDom);
+ };
+ var child = function (element, index) {
+ var children = element.dom().childNodes;
+ return Option.from(children[index]).map($_5ny1kxuzjfuw8sjh.fromDom);
+ };
+ var firstChild = function (element) {
+ return child(element, 0);
+ };
+ var lastChild = function (element) {
+ return child(element, element.dom().childNodes.length - 1);
+ };
+ var childNodesCount = function (element) {
+ return element.dom().childNodes.length;
+ };
+ var hasChildNodes = function (element) {
+ return element.dom().hasChildNodes();
+ };
+ var spot = $_1qtvc5v7jfuw8ske.immutable('element', 'offset');
+ var leaf = function (element, offset) {
+ var cs = children(element);
+ return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
+ };
+ var $_3pu8ohv6jfuw8sk0 = {
+ owner: owner,
+ defaultView: defaultView,
+ documentElement: documentElement,
+ parent: parent,
+ findIndex: findIndex$1,
+ parents: parents,
+ siblings: siblings,
+ prevSibling: prevSibling,
+ offsetParent: offsetParent,
+ prevSiblings: prevSiblings,
+ nextSibling: nextSibling,
+ nextSiblings: nextSiblings,
+ children: children,
+ child: child,
+ firstChild: firstChild,
+ lastChild: lastChild,
+ childNodesCount: childNodesCount,
+ hasChildNodes: hasChildNodes,
+ leaf: leaf
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var trigger = function (sidebar, panel, callbackName) {
- var callback = sidebar.settings[callbackName];
- if (callback) {
- callback(api(panel.getEl('body')));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var all$1 = function (predicate) {
+ return descendants($_c59f72v2jfuw8sjt.body(), predicate);
+ };
+ var ancestors = function (scope, predicate, isRoot) {
+ return $_anxm1mtajfuw8sct.filter($_3pu8ohv6jfuw8sk0.parents(scope, isRoot), predicate);
+ };
+ var siblings$1 = function (scope, predicate) {
+ return $_anxm1mtajfuw8sct.filter($_3pu8ohv6jfuw8sk0.siblings(scope), predicate);
+ };
+ var children$1 = function (scope, predicate) {
+ return $_anxm1mtajfuw8sct.filter($_3pu8ohv6jfuw8sk0.children(scope), predicate);
+ };
+ var descendants = function (scope, predicate) {
+ var result = [];
+ $_anxm1mtajfuw8sct.each($_3pu8ohv6jfuw8sk0.children(scope), function (x) {
+ if (predicate(x)) {
+ result = result.concat([x]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ result = result.concat(descendants(x, predicate));
+ });
+ return result;
+ };
+ var $_32ojrxv1jfuw8sjp = {
+ all: all$1,
+ ancestors: ancestors,
+ siblings: siblings$1,
+ children: children$1,
+ descendants: descendants
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var hidePanels = function (name, container, sidebars) {
- Tools.each(sidebars, function (sidebar) {
- var panel = container.items().filter('#' + sidebar.name)[0];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var all$2 = function (selector) {
+ return $_cy5apxvtjfuw8sm8.all(selector);
+ };
+ var ancestors$1 = function (scope, selector, isRoot) {
+ return $_32ojrxv1jfuw8sjp.ancestors(scope, function (e) {
+ return $_cy5apxvtjfuw8sm8.is(e, selector);
+ }, isRoot);
+ };
+ var siblings$2 = function (scope, selector) {
+ return $_32ojrxv1jfuw8sjp.siblings(scope, function (e) {
+ return $_cy5apxvtjfuw8sm8.is(e, selector);
+ });
+ };
+ var children$2 = function (scope, selector) {
+ return $_32ojrxv1jfuw8sjp.children(scope, function (e) {
+ return $_cy5apxvtjfuw8sm8.is(e, selector);
+ });
+ };
+ var descendants$1 = function (scope, selector) {
+ return $_cy5apxvtjfuw8sm8.all(selector, scope);
+ };
+ var $_d07cf8v0jfuw8sjn = {
+ all: all$2,
+ ancestors: ancestors$1,
+ siblings: siblings$2,
+ children: children$2,
+ descendants: descendants$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (panel && panel.visible() && sidebar.name !== name) {
- trigger(sidebar, panel, 'onhide');
- panel.visible(false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var trim$1 = global$2.trim;
+ var hasContentEditableState = function (value) {
+ return function (node) {
+ if (node && node.nodeType === 1) {
+ if (node.contentEditable === value) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.getAttribute('data-mce-contenteditable') === value) {
+ return true;
+ }
+ }
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isContentEditableTrue = hasContentEditableState('true');
+ var isContentEditableFalse = hasContentEditableState('false');
+ var create = function (type, title, url, level, attach) {
+ return {
+ type: type,
+ title: title,
+ url: url,
+ level: level,
+ attach: attach
+ };
+ };
+ var isChildOfContentEditableTrue = function (node) {
+ while (node = node.parentNode) {
+ var value = node.contentEditable;
+ if (value && value !== 'inherit') {
+ return isContentEditableTrue(node);
+ }
+ }
+ return false;
+ };
+ var select = function (selector, root) {
+ return $_anxm1mtajfuw8sct.map($_d07cf8v0jfuw8sjn.descendants($_5ny1kxuzjfuw8sjh.fromDom(root), selector), function (element) {
+ return element.dom();
+ });
+ };
+ var getElementText = function (elm) {
+ return elm.innerText || elm.textContent;
+ };
+ var getOrGenerateId = function (elm) {
+ return elm.id ? elm.id : $_8smsfouyjfuw8sjg.generate('h');
+ };
+ var isAnchor = function (elm) {
+ return elm && elm.nodeName === 'A' && (elm.id || elm.name);
+ };
+ var isValidAnchor = function (elm) {
+ return isAnchor(elm) && isEditable(elm);
+ };
+ var isHeader = function (elm) {
+ return elm && /^(H[1-6])$/.test(elm.nodeName);
+ };
+ var isEditable = function (elm) {
+ return isChildOfContentEditableTrue(elm) && !isContentEditableFalse(elm);
+ };
+ var isValidHeader = function (elm) {
+ return isHeader(elm) && isEditable(elm);
+ };
+ var getLevel = function (elm) {
+ return isHeader(elm) ? parseInt(elm.nodeName.substr(1), 10) : 0;
+ };
+ var headerTarget = function (elm) {
+ var headerId = getOrGenerateId(elm);
+ var attach = function () {
+ elm.id = headerId;
+ };
+ return create('header', getElementText(elm), '#' + headerId, getLevel(elm), attach);
+ };
+ var anchorTarget = function (elm) {
+ var anchorId = elm.id || elm.name;
+ var anchorText = getElementText(elm);
+ return create('anchor', anchorText ? anchorText : '#' + anchorId, '#' + anchorId, 0, $_cun2p5t7jfuw8scg.noop);
+ };
+ var getHeaderTargets = function (elms) {
+ return $_anxm1mtajfuw8sct.map($_anxm1mtajfuw8sct.filter(elms, isValidHeader), headerTarget);
+ };
+ var getAnchorTargets = function (elms) {
+ return $_anxm1mtajfuw8sct.map($_anxm1mtajfuw8sct.filter(elms, isValidAnchor), anchorTarget);
+ };
+ var getTargetElements = function (elm) {
+ var elms = select('h1,h2,h3,h4,h5,h6,a:not([href])', elm);
+ return elms;
+ };
+ var hasTitle = function (target) {
+ return trim$1(target.title).length > 0;
+ };
+ var find$3 = function (elm) {
+ var elms = getTargetElements(elm);
+ return $_anxm1mtajfuw8sct.filter(getHeaderTargets(elms).concat(getAnchorTargets(elms)), hasTitle);
+ };
+ var $_eb3struxjfuw8sj6 = { find: find$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var deactivateButtons = function (toolbar) {
- toolbar.items().each(function (ctrl) {
- ctrl.active(false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getActiveEditor = function () {
+ return window.tinymce ? window.tinymce.activeEditor : global$1.activeEditor;
+ };
+ var history = {};
+ var HISTORY_LENGTH = 5;
+ var clearHistory = function () {
+ history = {};
+ };
+ var toMenuItem = function (target) {
+ return {
+ title: target.title,
+ value: {
+ title: { raw: target.title },
+ url: target.url,
+ attach: target.attach
+ }
+ };
+ };
+ var toMenuItems = function (targets) {
+ return global$2.map(targets, toMenuItem);
+ };
+ var staticMenuItem = function (title, url) {
+ return {
+ title: title,
+ value: {
+ title: title,
+ url: url,
+ attach: $_cun2p5t7jfuw8scg.noop
+ }
+ };
+ };
+ var isUniqueUrl = function (url, targets) {
+ var foundTarget = $_anxm1mtajfuw8sct.exists(targets, function (target) {
+ return target.url === url;
+ });
+ return !foundTarget;
+ };
+ var getSetting = function (editorSettings, name, defaultValue) {
+ var value = name in editorSettings ? editorSettings[name] : defaultValue;
+ return value === false ? null : value;
+ };
+ var createMenuItems = function (term, targets, fileType, editorSettings) {
+ var separator = { title: '-' };
+ var fromHistoryMenuItems = function (history) {
+ var historyItems = history.hasOwnProperty(fileType) ? history[fileType] : [];
+ var uniqueHistory = $_anxm1mtajfuw8sct.filter(historyItems, function (url) {
+ return isUniqueUrl(url, targets);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return global$2.map(uniqueHistory, function (url) {
+ return {
+ title: url,
+ value: {
+ title: url,
+ url: url,
+ attach: $_cun2p5t7jfuw8scg.noop
+ }
+ };
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var findSidebar = function (sidebars, name) {
- return Tools.grep(sidebars, function (sidebar) {
- return sidebar.name === name;
- })[0];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fromMenuItems = function (type) {
+ var filteredTargets = $_anxm1mtajfuw8sct.filter(targets, function (target) {
+ return target.type === type;
+ });
+ return toMenuItems(filteredTargets);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var anchorMenuItems = function () {
+ var anchorMenuItems = fromMenuItems('anchor');
+ var topAnchor = getSetting(editorSettings, 'anchor_top', '#top');
+ var bottomAchor = getSetting(editorSettings, 'anchor_bottom', '#bottom');
+ if (topAnchor !== null) {
+ anchorMenuItems.unshift(staticMenuItem('<top>', topAnchor));
+ }
+ if (bottomAchor !== null) {
+ anchorMenuItems.push(staticMenuItem('<bottom>', bottomAchor));
+ }
+ return anchorMenuItems;
+ };
+ var join = function (items) {
+ return $_anxm1mtajfuw8sct.foldl(items, function (a, b) {
+ var bothEmpty = a.length === 0 || b.length === 0;
+ return bothEmpty ? a.concat(b) : a.concat(separator, b);
+ }, []);
+ };
+ if (editorSettings.typeahead_urls === false) {
+ return [];
+ }
+ return fileType === 'file' ? join([
+ filterByQuery(term, fromHistoryMenuItems(history)),
+ filterByQuery(term, fromMenuItems('header')),
+ filterByQuery(term, anchorMenuItems())
+ ]) : filterByQuery(term, fromHistoryMenuItems(history));
+ };
+ var addToHistory = function (url, fileType) {
+ var items = history[fileType];
+ if (!/^https?/.test(url)) {
+ return;
+ }
+ if (items) {
+ if ($_anxm1mtajfuw8sct.indexOf(items, url).isNone()) {
+ history[fileType] = items.slice(0, HISTORY_LENGTH).concat(url);
+ }
+ } else {
+ history[fileType] = [url];
+ }
+ };
+ var filterByQuery = function (term, menuItems) {
+ var lowerCaseTerm = term.toLowerCase();
+ var result = global$2.grep(menuItems, function (item) {
+ return item.title.toLowerCase().indexOf(lowerCaseTerm) !== -1;
+ });
+ return result.length === 1 && result[0].title === term ? [] : result;
+ };
+ var getTitle = function (linkDetails) {
+ var title = linkDetails.title;
+ return title.raw ? title.raw : title;
+ };
+ var setupAutoCompleteHandler = function (ctrl, editorSettings, bodyElm, fileType) {
+ var autocomplete = function (term) {
+ var linkTargets = $_eb3struxjfuw8sj6.find(bodyElm);
+ var menuItems = createMenuItems(term, linkTargets, fileType, editorSettings);
+ ctrl.showAutoComplete(menuItems, term);
+ };
+ ctrl.on('autocomplete', function () {
+ autocomplete(ctrl.value());
+ });
+ ctrl.on('selectitem', function (e) {
+ var linkDetails = e.value;
+ ctrl.value(linkDetails.url);
+ var title = getTitle(linkDetails);
+ if (fileType === 'image') {
+ ctrl.fire('change', {
+ meta: {
+ alt: title,
+ attach: linkDetails.attach
+ }
+ });
+ } else {
+ ctrl.fire('change', {
+ meta: {
+ text: title,
+ attach: linkDetails.attach
+ }
+ });
+ }
+ ctrl.focus();
+ });
+ ctrl.on('click', function (e) {
+ if (ctrl.value().length === 0 && e.target.nodeName === 'INPUT') {
+ autocomplete('');
+ }
+ });
+ ctrl.on('PostRender', function () {
+ ctrl.getRoot().on('submit', function (e) {
+ if (!e.isDefaultPrevented()) {
+ addToHistory(ctrl.value(), fileType);
+ }
+ });
+ });
+ };
+ var statusToUiState = function (result) {
+ var status = result.status, message = result.message;
+ if (status === 'valid') {
+ return {
+ status: 'ok',
+ message: message
+ };
+ } else if (status === 'unknown') {
+ return {
+ status: 'warn',
+ message: message
+ };
+ } else if (status === 'invalid') {
+ return {
+ status: 'warn',
+ message: message
+ };
+ } else {
+ return {
+ status: 'none',
+ message: ''
+ };
+ }
+ };
+ var setupLinkValidatorHandler = function (ctrl, editorSettings, fileType) {
+ var validatorHandler = editorSettings.filepicker_validator_handler;
+ if (validatorHandler) {
+ var validateUrl_1 = function (url) {
+ if (url.length === 0) {
+ ctrl.statusLevel('none');
+ return;
+ }
+ validatorHandler({
+ url: url,
+ type: fileType
+ }, function (result) {
+ var uiState = statusToUiState(result);
+ ctrl.statusMessage(uiState.message);
+ ctrl.statusLevel(uiState.status);
+ });
+ };
+ ctrl.state.on('change:value', function (e) {
+ validateUrl_1(e.value);
+ });
+ }
+ };
+ var FilePicker = ComboBox.extend({
+ Statics: { clearHistory: clearHistory },
+ init: function (settings) {
+ var self = this, editor = getActiveEditor(), editorSettings = editor.settings;
+ var actionCallback, fileBrowserCallback, fileBrowserCallbackTypes;
+ var fileType = settings.filetype;
+ settings.spellcheck = false;
+ fileBrowserCallbackTypes = editorSettings.file_picker_types || editorSettings.file_browser_callback_types;
+ if (fileBrowserCallbackTypes) {
+ fileBrowserCallbackTypes = global$2.makeMap(fileBrowserCallbackTypes, /[, ]/);
+ }
+ if (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[fileType]) {
+ fileBrowserCallback = editorSettings.file_picker_callback;
+ if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[fileType])) {
+ actionCallback = function () {
+ var meta = self.fire('beforecall').meta;
+ meta = global$2.extend({ filetype: fileType }, meta);
+ fileBrowserCallback.call(editor, function (value, meta) {
+ self.value(value).fire('change', { meta: meta });
+ }, self.value(), meta);
+ };
+ } else {
+ fileBrowserCallback = editorSettings.file_browser_callback;
+ if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[fileType])) {
+ actionCallback = function () {
+ fileBrowserCallback(self.getEl('inp').id, self.value(), fileType, window);
+ };
+ }
+ }
+ }
+ if (actionCallback) {
+ settings.icon = 'browse';
+ settings.onaction = actionCallback;
+ }
+ self._super(settings);
+ self.classes.add('filepicker');
+ setupAutoCompleteHandler(self, editorSettings, editor.getBody(), fileType);
+ setupLinkValidatorHandler(self, editorSettings, fileType);
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var showPanel = function (editor, name, sidebars) {
- return function (e) {
- var btnCtrl = e.control;
- var container = btnCtrl.parents().filter('panel')[0];
- var panel = container.find('#' + name)[0];
- var sidebar = findSidebar(sidebars, name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var FitLayout = AbsoluteLayout.extend({
+ recalc: function (container) {
+ var contLayoutRect = container.layoutRect(), paddingBox = container.paddingBox;
+ container.items().filter(':visible').each(function (ctrl) {
+ ctrl.layoutRect({
+ x: paddingBox.left,
+ y: paddingBox.top,
+ w: contLayoutRect.innerW - paddingBox.right - paddingBox.left,
+ h: contLayoutRect.innerH - paddingBox.top - paddingBox.bottom
+ });
+ if (ctrl.recalc) {
+ ctrl.recalc();
+ }
+ });
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- hidePanels(name, container, sidebars);
- deactivateButtons(btnCtrl.parent());
-
- if (panel && panel.visible()) {
- trigger(sidebar, panel, 'onhide');
- panel.hide();
- btnCtrl.active(false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var FlexLayout = AbsoluteLayout.extend({
+ recalc: function (container) {
+ var i, l, items, contLayoutRect, contPaddingBox, contSettings, align, pack, spacing, totalFlex, availableSpace, direction;
+ var ctrl, ctrlLayoutRect, ctrlSettings, flex;
+ var maxSizeItems = [];
+ var size, maxSize, ratio, rect, pos, maxAlignEndPos;
+ var sizeName, minSizeName, posName, maxSizeName, beforeName, innerSizeName, deltaSizeName, contentSizeName;
+ var alignAxisName, alignInnerSizeName, alignSizeName, alignMinSizeName, alignBeforeName, alignAfterName;
+ var alignDeltaSizeName, alignContentSizeName;
+ var max = Math.max, min = Math.min;
+ items = container.items().filter(':visible');
+ contLayoutRect = container.layoutRect();
+ contPaddingBox = container.paddingBox;
+ contSettings = container.settings;
+ direction = container.isRtl() ? contSettings.direction || 'row-reversed' : contSettings.direction;
+ align = contSettings.align;
+ pack = container.isRtl() ? contSettings.pack || 'end' : contSettings.pack;
+ spacing = contSettings.spacing || 0;
+ if (direction === 'row-reversed' || direction === 'column-reverse') {
+ items = items.set(items.toArray().reverse());
+ direction = direction.split('-')[0];
+ }
+ if (direction === 'column') {
+ posName = 'y';
+ sizeName = 'h';
+ minSizeName = 'minH';
+ maxSizeName = 'maxH';
+ innerSizeName = 'innerH';
+ beforeName = 'top';
+ deltaSizeName = 'deltaH';
+ contentSizeName = 'contentH';
+ alignBeforeName = 'left';
+ alignSizeName = 'w';
+ alignAxisName = 'x';
+ alignInnerSizeName = 'innerW';
+ alignMinSizeName = 'minW';
+ alignAfterName = 'right';
+ alignDeltaSizeName = 'deltaW';
+ alignContentSizeName = 'contentW';
+ } else {
+ posName = 'x';
+ sizeName = 'w';
+ minSizeName = 'minW';
+ maxSizeName = 'maxW';
+ innerSizeName = 'innerW';
+ beforeName = 'left';
+ deltaSizeName = 'deltaW';
+ contentSizeName = 'contentW';
+ alignBeforeName = 'top';
+ alignSizeName = 'h';
+ alignAxisName = 'y';
+ alignInnerSizeName = 'innerH';
+ alignMinSizeName = 'minH';
+ alignAfterName = 'bottom';
+ alignDeltaSizeName = 'deltaH';
+ alignContentSizeName = 'contentH';
+ }
+ availableSpace = contLayoutRect[innerSizeName] - contPaddingBox[beforeName] - contPaddingBox[beforeName];
+ maxAlignEndPos = totalFlex = 0;
+ for (i = 0, l = items.length; i < l; i++) {
+ ctrl = items[i];
+ ctrlLayoutRect = ctrl.layoutRect();
+ ctrlSettings = ctrl.settings;
+ flex = ctrlSettings.flex;
+ availableSpace -= i < l - 1 ? spacing : 0;
+ if (flex > 0) {
+ totalFlex += flex;
+ if (ctrlLayoutRect[maxSizeName]) {
+ maxSizeItems.push(ctrl);
+ }
+ ctrlLayoutRect.flex = flex;
+ }
+ availableSpace -= ctrlLayoutRect[minSizeName];
+ size = contPaddingBox[alignBeforeName] + ctrlLayoutRect[alignMinSizeName] + contPaddingBox[alignAfterName];
+ if (size > maxAlignEndPos) {
+ maxAlignEndPos = size;
+ }
+ }
+ rect = {};
+ if (availableSpace < 0) {
+ rect[minSizeName] = contLayoutRect[minSizeName] - availableSpace + contLayoutRect[deltaSizeName];
+ } else {
+ rect[minSizeName] = contLayoutRect[innerSizeName] - availableSpace + contLayoutRect[deltaSizeName];
+ }
+ rect[alignMinSizeName] = maxAlignEndPos + contLayoutRect[alignDeltaSizeName];
+ rect[contentSizeName] = contLayoutRect[innerSizeName] - availableSpace;
+ rect[alignContentSizeName] = maxAlignEndPos;
+ rect.minW = min(rect.minW, contLayoutRect.maxW);
+ rect.minH = min(rect.minH, contLayoutRect.maxH);
+ rect.minW = max(rect.minW, contLayoutRect.startMinWidth);
+ rect.minH = max(rect.minH, contLayoutRect.startMinHeight);
+ if (contLayoutRect.autoResize && (rect.minW !== contLayoutRect.minW || rect.minH !== contLayoutRect.minH)) {
+ rect.w = rect.minW;
+ rect.h = rect.minH;
+ container.layoutRect(rect);
+ this.recalc(container);
+ if (container._lastRect === null) {
+ var parentCtrl = container.parent();
+ if (parentCtrl) {
+ parentCtrl._lastRect = null;
+ parentCtrl.recalc();
+ }
+ }
+ return;
+ }
+ ratio = availableSpace / totalFlex;
+ for (i = 0, l = maxSizeItems.length; i < l; i++) {
+ ctrl = maxSizeItems[i];
+ ctrlLayoutRect = ctrl.layoutRect();
+ maxSize = ctrlLayoutRect[maxSizeName];
+ size = ctrlLayoutRect[minSizeName] + ctrlLayoutRect.flex * ratio;
+ if (size > maxSize) {
+ availableSpace -= ctrlLayoutRect[maxSizeName] - ctrlLayoutRect[minSizeName];
+ totalFlex -= ctrlLayoutRect.flex;
+ ctrlLayoutRect.flex = 0;
+ ctrlLayoutRect.maxFlexSize = maxSize;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (panel) {
- panel.show();
- trigger(sidebar, panel, 'onshow');
- } else {
- panel = Factory.create({
- type: 'container',
- name: name,
- layout: 'stack',
- classes: 'sidebar-panel',
- html: ''
- });
-
- container.prepend(panel);
- trigger(sidebar, panel, 'onrender');
- trigger(sidebar, panel, 'onshow');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ctrlLayoutRect.maxFlexSize = 0;
+ }
+ }
+ ratio = availableSpace / totalFlex;
+ pos = contPaddingBox[beforeName];
+ rect = {};
+ if (totalFlex === 0) {
+ if (pack === 'end') {
+ pos = availableSpace + contPaddingBox[beforeName];
+ } else if (pack === 'center') {
+ pos = Math.round(contLayoutRect[innerSizeName] / 2 - (contLayoutRect[innerSizeName] - availableSpace) / 2) + contPaddingBox[beforeName];
+ if (pos < 0) {
+ pos = contPaddingBox[beforeName];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (pack === 'justify') {
+ pos = contPaddingBox[beforeName];
+ spacing = Math.floor(availableSpace / (items.length - 1));
+ }
+ }
+ rect[alignAxisName] = contPaddingBox[alignBeforeName];
+ for (i = 0, l = items.length; i < l; i++) {
+ ctrl = items[i];
+ ctrlLayoutRect = ctrl.layoutRect();
+ size = ctrlLayoutRect.maxFlexSize || ctrlLayoutRect[minSizeName];
+ if (align === 'center') {
+ rect[alignAxisName] = Math.round(contLayoutRect[alignInnerSizeName] / 2 - ctrlLayoutRect[alignSizeName] / 2);
+ } else if (align === 'stretch') {
+ rect[alignSizeName] = max(ctrlLayoutRect[alignMinSizeName] || 0, contLayoutRect[alignInnerSizeName] - contPaddingBox[alignBeforeName] - contPaddingBox[alignAfterName]);
+ rect[alignAxisName] = contPaddingBox[alignBeforeName];
+ } else if (align === 'end') {
+ rect[alignAxisName] = contLayoutRect[alignInnerSizeName] - ctrlLayoutRect[alignSizeName] - contPaddingBox.top;
+ }
+ if (ctrlLayoutRect.flex > 0) {
+ size += ctrlLayoutRect.flex * ratio;
+ }
+ rect[sizeName] = size;
+ rect[posName] = pos;
+ ctrl.layoutRect(rect);
+ if (ctrl.recalc) {
+ ctrl.recalc();
+ }
+ pos += size + spacing;
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- btnCtrl.active(true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var FlowLayout = Layout.extend({
+ Defaults: {
+ containerClass: 'flow-layout',
+ controlClass: 'flow-layout-item',
+ endClass: 'break'
+ },
+ recalc: function (container) {
+ container.items().filter(':visible').each(function (ctrl) {
+ if (ctrl.recalc) {
+ ctrl.recalc();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ },
+ isNative: function () {
+ return true;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.fire('ResizeEditor');
- };
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {
+ return is(scope, a) ? Option.some(scope) : $_e8diihtbjfuw8scy.isFunction(isRoot) && isRoot(scope) ? Option.none() : ancestor(scope, a, isRoot);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isModernBrowser = function () {
- return !Env.ie || Env.ie >= 11;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var first$1 = function (predicate) {
+ return descendant($_c59f72v2jfuw8sjt.body(), predicate);
+ };
+ var ancestor = function (scope, predicate, isRoot) {
+ var element = scope.dom();
+ var stop = $_e8diihtbjfuw8scy.isFunction(isRoot) ? isRoot : $_cun2p5t7jfuw8scg.constant(false);
+ while (element.parentNode) {
+ element = element.parentNode;
+ var el = $_5ny1kxuzjfuw8sjh.fromDom(element);
+ if (predicate(el))
+ return Option.some(el);
+ else if (stop(el))
+ break;
+ }
+ return Option.none();
+ };
+ var closest = function (scope, predicate, isRoot) {
+ var is = function (scope) {
+ return predicate(scope);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return ClosestOrAncestor(is, ancestor, scope, predicate, isRoot);
+ };
+ var sibling = function (scope, predicate) {
+ var element = scope.dom();
+ if (!element.parentNode)
+ return Option.none();
+ return child$1($_5ny1kxuzjfuw8sjh.fromDom(element.parentNode), function (x) {
+ return !$_22fg4zvdjfuw8skq.eq(scope, x) && predicate(x);
+ });
+ };
+ var child$1 = function (scope, predicate) {
+ var result = $_anxm1mtajfuw8sct.find(scope.dom().childNodes, $_cun2p5t7jfuw8scg.compose(predicate, $_5ny1kxuzjfuw8sjh.fromDom));
+ return result.map($_5ny1kxuzjfuw8sjh.fromDom);
+ };
+ var descendant = function (scope, predicate) {
+ var descend = function (element) {
+ for (var i = 0; i < element.childNodes.length; i++) {
+ if (predicate($_5ny1kxuzjfuw8sjh.fromDom(element.childNodes[i])))
+ return Option.some($_5ny1kxuzjfuw8sjh.fromDom(element.childNodes[i]));
+ var res = descend(element.childNodes[i]);
+ if (res.isSome())
+ return res;
+ }
+ return Option.none();
+ };
+ return descend(scope.dom());
+ };
+ var $_7wnjcvzjfuw8sn7 = {
+ first: first$1,
+ ancestor: ancestor,
+ closest: closest,
+ sibling: sibling,
+ child: child$1,
+ descendant: descendant
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var hasSidebar = function (editor) {
- return isModernBrowser() && editor.sidebars ? editor.sidebars.length > 0 : false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var first$2 = function (selector) {
+ return $_cy5apxvtjfuw8sm8.one(selector);
+ };
+ var ancestor$1 = function (scope, selector, isRoot) {
+ return $_7wnjcvzjfuw8sn7.ancestor(scope, function (e) {
+ return $_cy5apxvtjfuw8sm8.is(e, selector);
+ }, isRoot);
+ };
+ var sibling$1 = function (scope, selector) {
+ return $_7wnjcvzjfuw8sn7.sibling(scope, function (e) {
+ return $_cy5apxvtjfuw8sm8.is(e, selector);
+ });
+ };
+ var child$2 = function (scope, selector) {
+ return $_7wnjcvzjfuw8sn7.child(scope, function (e) {
+ return $_cy5apxvtjfuw8sm8.is(e, selector);
+ });
+ };
+ var descendant$1 = function (scope, selector) {
+ return $_cy5apxvtjfuw8sm8.one(selector, scope);
+ };
+ var closest$1 = function (scope, selector, isRoot) {
+ return ClosestOrAncestor($_cy5apxvtjfuw8sm8.is, ancestor$1, scope, selector, isRoot);
+ };
+ var $_279ymavyjfuw8sn6 = {
+ first: first$2,
+ ancestor: ancestor$1,
+ sibling: sibling$1,
+ child: child$2,
+ descendant: descendant$1,
+ closest: closest$1
+ };
+
+ var toggleFormat = function (editor, fmt) {
+ return function () {
+ editor.execCommand('mceToggleFormat', false, fmt);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var postRenderFormat = function (editor, name) {
+ return function () {
+ var self = this;
+ if (editor.formatter) {
+ editor.formatter.formatChanged(name, function (state) {
+ self.active(state);
+ });
+ } else {
+ editor.on('init', function () {
+ editor.formatter.formatChanged(name, function (state) {
+ self.active(state);
+ });
+ });
+ }
+ };
+ };
+ var $_e045hpw2jfuw8snu = {
+ toggleFormat: toggleFormat,
+ postRenderFormat: postRenderFormat
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var createSidebar = function (editor) {
- var buttons = Tools.map(editor.sidebars, function (sidebar) {
- var settings = sidebar.settings;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (editor) {
+ editor.addMenuItem('align', {
+ text: 'Align',
+ menu: [
+ {
+ text: 'Left',
+ icon: 'alignleft',
+ onclick: $_e045hpw2jfuw8snu.toggleFormat(editor, 'alignleft')
+ },
+ {
+ text: 'Center',
+ icon: 'aligncenter',
+ onclick: $_e045hpw2jfuw8snu.toggleFormat(editor, 'aligncenter')
+ },
+ {
+ text: 'Right',
+ icon: 'alignright',
+ onclick: $_e045hpw2jfuw8snu.toggleFormat(editor, 'alignright')
+ },
+ {
+ text: 'Justify',
+ icon: 'alignjustify',
+ onclick: $_e045hpw2jfuw8snu.toggleFormat(editor, 'alignjustify')
+ }
+ ]
+ });
+ global$2.each({
+ alignleft: [
+ 'Align left',
+ 'JustifyLeft'
+ ],
+ aligncenter: [
+ 'Align center',
+ 'JustifyCenter'
+ ],
+ alignright: [
+ 'Align right',
+ 'JustifyRight'
+ ],
+ alignjustify: [
+ 'Justify',
+ 'JustifyFull'
+ ],
+ alignnone: [
+ 'No alignment',
+ 'JustifyNone'
+ ]
+ }, function (item, name) {
+ editor.addButton(name, {
+ active: false,
+ tooltip: item[0],
+ cmd: item[1],
+ onPostRender: $_e045hpw2jfuw8snu.postRenderFormat(editor, name)
+ });
+ });
+ };
+ var $_bfu7knw1jfuw8sns = { register: register };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- type: 'button',
- icon: settings.icon,
- image: settings.image,
- tooltip: settings.tooltip,
- onclick: showPanel(editor, sidebar.name, editor.sidebars)
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getFirstFont = function (fontFamily) {
+ return fontFamily ? fontFamily.split(',')[0] : '';
+ };
+ var findMatchingValue = function (items, fontFamily) {
+ var value;
+ global$2.each(items, function (item) {
+ if (item.value.toLowerCase() === fontFamily.toLowerCase()) {
+ value = item.value;
+ }
+ });
+ global$2.each(items, function (item) {
+ if (!value && getFirstFont(item.value).toLowerCase() === getFirstFont(fontFamily).toLowerCase()) {
+ value = item.value;
+ }
+ });
+ return value;
+ };
+ var createFontNameListBoxChangeHandler = function (editor, items) {
+ return function () {
+ var self = this;
+ editor.on('init nodeChange', function (e) {
+ var fontFamily = editor.queryCommandValue('FontName');
+ var match = findMatchingValue(items, fontFamily);
+ self.value(match ? match : null);
+ if (!match && fontFamily) {
+ self.text(getFirstFont(fontFamily));
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ };
+ var createFormats = function (formats) {
+ formats = formats.replace(/;$/, '').split(';');
+ var i = formats.length;
+ while (i--) {
+ formats[i] = formats[i].split('=');
+ }
+ return formats;
+ };
+ var getFontItems = function (editor) {
+ var defaultFontsFormats = 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats';
+ var fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);
+ return global$2.map(fonts, function (font) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- type: 'panel',
- name: 'sidebar',
- layout: 'stack',
- classes: 'sidebar',
- items: [
- {
- type: 'toolbar',
- layout: 'stack',
- classes: 'sidebar-toolbar',
- items: buttons
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ text: { raw: font[0] },
+ value: font[1],
+ textStyle: font[1].indexOf('dings') === -1 ? 'font-family:' + font[1] : ''
+ };
+ });
+ };
+ var registerButtons = function (editor) {
+ editor.addButton('fontselect', function () {
+ var items = getFontItems(editor);
+ return {
+ type: 'listbox',
+ text: 'Font Family',
+ tooltip: 'Font Family',
+ values: items,
+ fixedWidth: true,
+ onPostRender: createFontNameListBoxChangeHandler(editor, items),
+ onselect: function (e) {
+ if (e.control.settings.value) {
+ editor.execCommand('FontName', false, e.control.settings.value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var register$1 = function (editor) {
+ registerButtons(editor);
+ };
+ var $_evwt60w3jfuw8snv = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- hasSidebar: hasSidebar,
- createSidebar: createSidebar
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var round = function (number, precision) {
+ var factor = Math.pow(10, precision);
+ return Math.round(number * factor) / factor;
+ };
+ var toPt = function (fontSize, precision) {
+ if (/[0-9.]+px$/.test(fontSize)) {
+ return round(parseInt(fontSize, 10) * 72 / 96, precision || 0) + 'pt';
+ }
+ return fontSize;
+ };
+ var findMatchingValue$1 = function (items, pt, px) {
+ var value;
+ global$2.each(items, function (item) {
+ if (item.value === px) {
+ value = px;
+ } else if (item.value === pt) {
+ value = pt;
+ }
+ });
+ return value;
+ };
+ var createFontSizeListBoxChangeHandler = function (editor, items) {
+ return function () {
+ var self = this;
+ editor.on('init nodeChange', function (e) {
+ var px, pt, precision, match;
+ px = editor.queryCommandValue('FontSize');
+ if (px) {
+ for (precision = 3; !match && precision >= 0; precision--) {
+ pt = toPt(px, precision);
+ match = findMatchingValue$1(items, pt, px);
+ }
+ }
+ self.value(match ? match : null);
+ if (!match) {
+ self.text(pt);
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * SkinLoaded.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.modern.ui.SkinLoaded', [
- ],
- function () {
- var fireSkinLoaded = function (editor) {
- var done = function () {
- editor._skinLoaded = true;
- editor.fire('SkinLoaded');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getFontSizeItems = function (editor) {
+ var defaultFontsizeFormats = '8pt 10pt 12pt 14pt 18pt 24pt 36pt';
+ var fontsizeFormats = editor.settings.fontsize_formats || defaultFontsizeFormats;
+ return global$2.map(fontsizeFormats.split(' '), function (item) {
+ var text = item, value = item;
+ var values = item.split('=');
+ if (values.length > 1) {
+ text = values[0];
+ value = values[1];
+ }
+ return {
+ text: text,
+ value: value
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var registerButtons$1 = function (editor) {
+ editor.addButton('fontsizeselect', function () {
+ var items = getFontSizeItems(editor);
+ return {
+ type: 'listbox',
+ text: 'Font Sizes',
+ tooltip: 'Font Sizes',
+ values: items,
+ fixedWidth: true,
+ onPostRender: createFontSizeListBoxChangeHandler(editor, items),
+ onclick: function (e) {
+ if (e.control.settings.value) {
+ editor.execCommand('FontSize', false, e.control.settings.value);
+ }
+ }
+ };
+ });
+ };
+ var register$2 = function (editor) {
+ registerButtons$1(editor);
+ };
+ var $_cv0tb2w4jfuw8sny = { register: register$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return function () {
- if (editor.initialized) {
- done();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hideMenuObjects = function (editor, menu) {
+ var count = menu.length;
+ global$2.each(menu, function (item) {
+ if (item.menu) {
+ item.hidden = hideMenuObjects(editor, item.menu) === 0;
+ }
+ var formatName = item.format;
+ if (formatName) {
+ item.hidden = !editor.formatter.canApply(formatName);
+ }
+ if (item.hidden) {
+ count--;
+ }
+ });
+ return count;
+ };
+ var hideFormatMenuItems = function (editor, menu) {
+ var count = menu.items().length;
+ menu.items().each(function (item) {
+ if (item.menu) {
+ item.visible(hideFormatMenuItems(editor, item.menu) > 0);
+ }
+ if (!item.menu && item.settings.menu) {
+ item.visible(hideMenuObjects(editor, item.settings.menu) > 0);
+ }
+ var formatName = item.settings.format;
+ if (formatName) {
+ item.visible(editor.formatter.canApply(formatName));
+ }
+ if (!item.visible()) {
+ count--;
+ }
+ });
+ return count;
+ };
+ var createFormatMenu = function (editor) {
+ var count = 0;
+ var newFormats = [];
+ var defaultStyleFormats = [
+ {
+ title: 'Headings',
+ items: [
+ {
+ title: 'Heading 1',
+ format: 'h1'
+ },
+ {
+ title: 'Heading 2',
+ format: 'h2'
+ },
+ {
+ title: 'Heading 3',
+ format: 'h3'
+ },
+ {
+ title: 'Heading 4',
+ format: 'h4'
+ },
+ {
+ title: 'Heading 5',
+ format: 'h5'
+ },
+ {
+ title: 'Heading 6',
+ format: 'h6'
+ }
+ ]
+ },
+ {
+ title: 'Inline',
+ items: [
+ {
+ title: 'Bold',
+ icon: 'bold',
+ format: 'bold'
+ },
+ {
+ title: 'Italic',
+ icon: 'italic',
+ format: 'italic'
+ },
+ {
+ title: 'Underline',
+ icon: 'underline',
+ format: 'underline'
+ },
+ {
+ title: 'Strikethrough',
+ icon: 'strikethrough',
+ format: 'strikethrough'
+ },
+ {
+ title: 'Superscript',
+ icon: 'superscript',
+ format: 'superscript'
+ },
+ {
+ title: 'Subscript',
+ icon: 'subscript',
+ format: 'subscript'
+ },
+ {
+ title: 'Code',
+ icon: 'code',
+ format: 'code'
+ }
+ ]
+ },
+ {
+ title: 'Blocks',
+ items: [
+ {
+ title: 'Paragraph',
+ format: 'p'
+ },
+ {
+ title: 'Blockquote',
+ format: 'blockquote'
+ },
+ {
+ title: 'Div',
+ format: 'div'
+ },
+ {
+ title: 'Pre',
+ format: 'pre'
+ }
+ ]
+ },
+ {
+ title: 'Alignment',
+ items: [
+ {
+ title: 'Left',
+ icon: 'alignleft',
+ format: 'alignleft'
+ },
+ {
+ title: 'Center',
+ icon: 'aligncenter',
+ format: 'aligncenter'
+ },
+ {
+ title: 'Right',
+ icon: 'alignright',
+ format: 'alignright'
+ },
+ {
+ title: 'Justify',
+ icon: 'alignjustify',
+ format: 'alignjustify'
+ }
+ ]
+ }
+ ];
+ var createMenu = function (formats) {
+ var menu = [];
+ if (!formats) {
+ return;
+ }
+ global$2.each(formats, function (format) {
+ var menuItem = {
+ text: format.title,
+ icon: format.icon
+ };
+ if (format.items) {
+ menuItem.menu = createMenu(format.items);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('init', done);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var formatName = format.format || 'custom' + count++;
+ if (!format.format) {
+ format.name = formatName;
+ newFormats.push(format);
+ }
+ menuItem.format = formatName;
+ menuItem.cmd = format.cmd;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ menu.push(menuItem);
+ });
+ return menu;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createStylesMenu = function () {
+ var menu;
+ if (editor.settings.style_formats_merge) {
+ if (editor.settings.style_formats) {
+ menu = createMenu(defaultStyleFormats.concat(editor.settings.style_formats));
+ } else {
+ menu = createMenu(defaultStyleFormats);
+ }
+ } else {
+ menu = createMenu(editor.settings.style_formats || defaultStyleFormats);
+ }
+ return menu;
+ };
+ editor.on('init', function () {
+ global$2.each(newFormats, function (format) {
+ editor.formatter.register(format.name, format);
+ });
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- fireSkinLoaded: fireSkinLoaded
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type: 'menu',
+ items: createStylesMenu(),
+ onPostRender: function (e) {
+ editor.fire('renderFormatsMenu', { control: e.control });
+ },
+ itemDefaults: {
+ preview: true,
+ textStyle: function () {
+ if (this.settings.format) {
+ return editor.formatter.getCssText(this.settings.format);
+ }
+ },
+ onPostRender: function () {
+ var self = this;
+ self.parent().on('show', function () {
+ var formatName, command;
+ formatName = self.settings.format;
+ if (formatName) {
+ self.disabled(!editor.formatter.canApply(formatName));
+ self.active(editor.formatter.match(formatName));
+ }
+ command = self.settings.cmd;
+ if (command) {
+ self.active(editor.queryCommandState(command));
+ }
+ });
+ },
+ onclick: function () {
+ if (this.settings.format) {
+ $_e045hpw2jfuw8snu.toggleFormat(editor, this.settings.format)();
+ }
+ if (this.settings.cmd) {
+ editor.execCommand(this.settings.cmd);
+ }
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var registerMenuItems = function (editor, formatMenu) {
+ editor.addMenuItem('formats', {
+ text: 'Formats',
+ menu: formatMenu
+ });
+ };
+ var registerButtons$2 = function (editor, formatMenu) {
+ editor.addButton('styleselect', {
+ type: 'menubutton',
+ text: 'Formats',
+ menu: formatMenu,
+ onShowMenu: function () {
+ if (editor.settings.style_formats_autohide) {
+ hideFormatMenuItems(editor, this.menu);
+ }
+ }
+ });
+ };
+ var register$3 = function (editor) {
+ var formatMenu = createFormatMenu(editor);
+ registerMenuItems(editor, formatMenu);
+ registerButtons$2(editor, formatMenu);
+ };
+ var $_g2376dw5jfuw8so1 = { register: register$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Iframe.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.modern.modes.Iframe',
- [
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.ui.Factory',
- 'tinymce.core.util.Tools',
- 'tinymce.themes.modern.ui.A11y',
- 'tinymce.themes.modern.ui.Branding',
- 'tinymce.themes.modern.ui.ContextToolbars',
- 'tinymce.themes.modern.ui.Menubar',
- 'tinymce.themes.modern.ui.Resize',
- 'tinymce.themes.modern.ui.Sidebar',
- 'tinymce.themes.modern.ui.SkinLoaded',
- 'tinymce.themes.modern.ui.Toolbar'
- ],
- function (DOMUtils, Factory, Tools, A11y, Branding, ContextToolbars, Menubar, Resize, Sidebar, SkinLoaded, Toolbar) {
- var DOM = DOMUtils.DOM;
-
- var switchMode = function (panel) {
- return function (e) {
- panel.find('*').disabled(e.mode === 'readonly');
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var defaultBlocks = 'Paragraph=p;' + 'Heading 1=h1;' + 'Heading 2=h2;' + 'Heading 3=h3;' + 'Heading 4=h4;' + 'Heading 5=h5;' + 'Heading 6=h6;' + 'Preformatted=pre';
+ var createFormats$1 = function (formats) {
+ formats = formats.replace(/;$/, '').split(';');
+ var i = formats.length;
+ while (i--) {
+ formats[i] = formats[i].split('=');
+ }
+ return formats;
+ };
+ var createListBoxChangeHandler = function (editor, items, formatName) {
+ return function () {
+ var self = this;
+ editor.on('nodeChange', function (e) {
+ var formatter = editor.formatter;
+ var value = null;
+ global$2.each(e.parents, function (node) {
+ global$2.each(items, function (item) {
+ if (formatName) {
+ if (formatter.matchNode(node, formatName, { value: item.value })) {
+ value = item.value;
+ }
+ } else {
+ if (formatter.matchNode(node, item.value)) {
+ value = item.value;
+ }
+ }
+ if (value) {
+ return false;
+ }
+ });
+ if (value) {
+ return false;
+ }
+ });
+ self.value(value);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var editArea = function (border) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var lazyFormatSelectBoxItems = function (editor, blocks) {
+ return function () {
+ var items = [];
+ global$2.each(blocks, function (block) {
+ items.push({
+ text: block[0],
+ value: block[1],
+ textStyle: function () {
+ return editor.formatter.getCssText(block[1]);
+ }
+ });
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- type: 'panel',
- name: 'iframe',
- layout: 'stack',
- classes: 'edit-area',
- border: border,
- html: ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type: 'listbox',
+ text: blocks[0][0],
+ values: items,
+ fixedWidth: true,
+ onselect: function (e) {
+ if (e.control) {
+ var fmt = e.control.value();
+ $_e045hpw2jfuw8snu.toggleFormat(editor, fmt)();
+ }
+ },
+ onPostRender: createListBoxChangeHandler(editor, items)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var editAreaContainer = function (editor) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var buildMenuItems = function (editor, blocks) {
+ return global$2.map(blocks, function (block) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- type: 'panel',
- layout: 'stack',
- classes: 'edit-aria-container',
- border: '1 0 0 0',
- items: [
- editArea('0'),
- Sidebar.createSidebar(editor)
- ]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ text: block[0],
+ onclick: $_e045hpw2jfuw8snu.toggleFormat(editor, block[1]),
+ textStyle: function () {
+ return editor.formatter.getCssText(block[1]);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var register$4 = function (editor) {
+ var blocks = createFormats$1(editor.settings.block_formats || defaultBlocks);
+ editor.addMenuItem('blockformats', {
+ text: 'Blocks',
+ menu: buildMenuItems(editor, blocks)
+ });
+ editor.addButton('formatselect', lazyFormatSelectBoxItems(editor, blocks));
+ };
+ var $_6ddb2xw6jfuw8so5 = { register: register$4 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var render = function (editor, theme, args) {
- var panel, resizeHandleCtrl, startSize, settings = editor.settings;
-
- if (args.skinUiCss) {
- DOM.styleSheetLoader.load(args.skinUiCss, SkinLoaded.fireSkinLoaded(editor));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createCustomMenuItems = function (editor, names) {
+ var items, nameList;
+ if (typeof names === 'string') {
+ nameList = names.split(' ');
+ } else if (global$2.isArray(names)) {
+ return $_anxm1mtajfuw8sct.flatten(global$2.map(names, function (names) {
+ return createCustomMenuItems(editor, names);
+ }));
+ }
+ items = global$2.grep(nameList, function (name) {
+ return name === '|' || name in editor.menuItems;
+ });
+ return global$2.map(items, function (name) {
+ return name === '|' ? { text: '-' } : editor.menuItems[name];
+ });
+ };
+ var isSeparator$1 = function (menuItem) {
+ return menuItem && menuItem.text === '-';
+ };
+ var trimMenuItems = function (menuItems) {
+ var menuItems2 = $_anxm1mtajfuw8sct.filter(menuItems, function (menuItem, i, menuItems) {
+ return !isSeparator$1(menuItem) || !isSeparator$1(menuItems[i - 1]);
+ });
+ return $_anxm1mtajfuw8sct.filter(menuItems2, function (menuItem, i, menuItems) {
+ return !isSeparator$1(menuItem) || i > 0 && i < menuItems.length - 1;
+ });
+ };
+ var createContextMenuItems = function (editor, context) {
+ var outputMenuItems = [{ text: '-' }];
+ var menuItems = global$2.grep(editor.menuItems, function (menuItem) {
+ return menuItem.context === context;
+ });
+ global$2.each(menuItems, function (menuItem) {
+ if (menuItem.separator === 'before') {
+ outputMenuItems.push({ text: '|' });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (menuItem.prependToContext) {
+ outputMenuItems.unshift(menuItem);
+ } else {
+ outputMenuItems.push(menuItem);
+ }
+ if (menuItem.separator === 'after') {
+ outputMenuItems.push({ text: '|' });
+ }
+ });
+ return outputMenuItems;
+ };
+ var createInsertMenu = function (editor) {
+ var insertButtonItems = editor.settings.insert_button_items;
+ if (insertButtonItems) {
+ return trimMenuItems(createCustomMenuItems(editor, insertButtonItems));
+ } else {
+ return trimMenuItems(createContextMenuItems(editor, 'insert'));
+ }
+ };
+ var registerButtons$3 = function (editor) {
+ editor.addButton('insert', {
+ type: 'menubutton',
+ icon: 'insert',
+ menu: [],
+ oncreatemenu: function () {
+ this.menu.add(createInsertMenu(editor));
+ this.menu.renderNew();
+ }
+ });
+ };
+ var register$5 = function (editor) {
+ registerButtons$3(editor);
+ };
+ var $_1dv5z9w7jfuw8so8 = { register: register$5 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- panel = theme.panel = Factory.create({
- type: 'panel',
- role: 'application',
- classes: 'tinymce',
- style: 'visibility: hidden',
- layout: 'stack',
- border: 1,
- items: [
- settings.menubar === false ? null : { type: 'menubar', border: '0 0 1 0', items: Menubar.createMenuButtons(editor) },
- Toolbar.createToolbars(editor, settings.toolbar_items_size),
- Sidebar.hasSidebar(editor) ? editAreaContainer(editor) : editArea('1 0 0 0')
- ]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var registerFormatButtons = function (editor) {
+ global$2.each({
+ bold: 'Bold',
+ italic: 'Italic',
+ underline: 'Underline',
+ strikethrough: 'Strikethrough',
+ subscript: 'Subscript',
+ superscript: 'Superscript'
+ }, function (text, name) {
+ editor.addButton(name, {
+ active: false,
+ tooltip: text,
+ onPostRender: $_e045hpw2jfuw8snu.postRenderFormat(editor, name),
+ onclick: $_e045hpw2jfuw8snu.toggleFormat(editor, name)
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var registerCommandButtons = function (editor) {
+ global$2.each({
+ outdent: [
+ 'Decrease indent',
+ 'Outdent'
+ ],
+ indent: [
+ 'Increase indent',
+ 'Indent'
+ ],
+ cut: [
+ 'Cut',
+ 'Cut'
+ ],
+ copy: [
+ 'Copy',
+ 'Copy'
+ ],
+ paste: [
+ 'Paste',
+ 'Paste'
+ ],
+ help: [
+ 'Help',
+ 'mceHelp'
+ ],
+ selectall: [
+ 'Select all',
+ 'SelectAll'
+ ],
+ visualaid: [
+ 'Visual aids',
+ 'mceToggleVisualAid'
+ ],
+ newdocument: [
+ 'New document',
+ 'mceNewDocument'
+ ],
+ removeformat: [
+ 'Clear formatting',
+ 'RemoveFormat'
+ ],
+ remove: [
+ 'Remove',
+ 'Delete'
+ ]
+ }, function (item, name) {
+ editor.addButton(name, {
+ tooltip: item[0],
+ cmd: item[1]
+ });
+ });
+ };
+ var registerCommandToggleButtons = function (editor) {
+ global$2.each({
+ blockquote: [
+ 'Blockquote',
+ 'mceBlockQuote'
+ ],
+ subscript: [
+ 'Subscript',
+ 'Subscript'
+ ],
+ superscript: [
+ 'Superscript',
+ 'Superscript'
+ ]
+ }, function (item, name) {
+ editor.addButton(name, {
+ active: false,
+ tooltip: item[0],
+ cmd: item[1],
+ onPostRender: $_e045hpw2jfuw8snu.postRenderFormat(editor, name)
+ });
+ });
+ };
+ var registerButtons$4 = function (editor) {
+ registerFormatButtons(editor);
+ registerCommandButtons(editor);
+ registerCommandToggleButtons(editor);
+ };
+ var registerMenuItems$1 = function (editor) {
+ global$2.each({
+ bold: [
+ 'Bold',
+ 'Bold',
+ 'Meta+B'
+ ],
+ italic: [
+ 'Italic',
+ 'Italic',
+ 'Meta+I'
+ ],
+ underline: [
+ 'Underline',
+ 'Underline',
+ 'Meta+U'
+ ],
+ strikethrough: [
+ 'Strikethrough',
+ 'Strikethrough'
+ ],
+ subscript: [
+ 'Subscript',
+ 'Subscript'
+ ],
+ superscript: [
+ 'Superscript',
+ 'Superscript'
+ ],
+ removeformat: [
+ 'Clear formatting',
+ 'RemoveFormat'
+ ],
+ newdocument: [
+ 'New document',
+ 'mceNewDocument'
+ ],
+ cut: [
+ 'Cut',
+ 'Cut',
+ 'Meta+X'
+ ],
+ copy: [
+ 'Copy',
+ 'Copy',
+ 'Meta+C'
+ ],
+ paste: [
+ 'Paste',
+ 'Paste',
+ 'Meta+V'
+ ],
+ selectall: [
+ 'Select all',
+ 'SelectAll',
+ 'Meta+A'
+ ]
+ }, function (item, name) {
+ editor.addMenuItem(name, {
+ text: item[0],
+ icon: name,
+ shortcut: item[2],
+ cmd: item[1]
+ });
+ });
+ editor.addMenuItem('codeformat', {
+ text: 'Code',
+ icon: 'code',
+ onclick: $_e045hpw2jfuw8snu.toggleFormat(editor, 'code')
+ });
+ };
+ var register$6 = function (editor) {
+ registerButtons$4(editor);
+ registerMenuItems$1(editor);
+ };
+ var $_fssja4w8jfuw8soc = { register: register$6 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (settings.resize !== false) {
- resizeHandleCtrl = {
- type: 'resizehandle',
- direction: settings.resize,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toggleUndoRedoState = function (editor, type) {
+ return function () {
+ var self = this;
+ var checkState = function () {
+ var typeFn = type === 'redo' ? 'hasRedo' : 'hasUndo';
+ return editor.undoManager ? editor.undoManager[typeFn]() : false;
+ };
+ self.disabled(!checkState());
+ editor.on('Undo Redo AddUndo TypingUndo ClearUndos SwitchMode', function () {
+ self.disabled(editor.readonly || !checkState());
+ });
+ };
+ };
+ var registerMenuItems$2 = function (editor) {
+ editor.addMenuItem('undo', {
+ text: 'Undo',
+ icon: 'undo',
+ shortcut: 'Meta+Z',
+ onPostRender: toggleUndoRedoState(editor, 'undo'),
+ cmd: 'undo'
+ });
+ editor.addMenuItem('redo', {
+ text: 'Redo',
+ icon: 'redo',
+ shortcut: 'Meta+Y',
+ onPostRender: toggleUndoRedoState(editor, 'redo'),
+ cmd: 'redo'
+ });
+ };
+ var registerButtons$5 = function (editor) {
+ editor.addButton('undo', {
+ tooltip: 'Undo',
+ onPostRender: toggleUndoRedoState(editor, 'undo'),
+ cmd: 'undo'
+ });
+ editor.addButton('redo', {
+ tooltip: 'Redo',
+ onPostRender: toggleUndoRedoState(editor, 'redo'),
+ cmd: 'redo'
+ });
+ };
+ var register$7 = function (editor) {
+ registerMenuItems$2(editor);
+ registerButtons$5(editor);
+ };
+ var $_fy8pn1w9jfuw8soe = { register: register$7 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- onResizeStart: function () {
- var elm = editor.getContentAreaContainer().firstChild;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toggleVisualAidState = function (editor) {
+ return function () {
+ var self = this;
+ editor.on('VisualAid', function (e) {
+ self.active(e.hasVisual);
+ });
+ self.active(editor.hasVisual);
+ };
+ };
+ var registerMenuItems$3 = function (editor) {
+ editor.addMenuItem('visualaid', {
+ text: 'Visual aids',
+ selectable: true,
+ onPostRender: toggleVisualAidState(editor),
+ cmd: 'mceToggleVisualAid'
+ });
+ };
+ var register$8 = function (editor) {
+ registerMenuItems$3(editor);
+ };
+ var $_5fcf2jwajfuw8sof = { register: register$8 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- startSize = {
- width: elm.clientWidth,
- height: elm.clientHeight
- };
- },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setupEnvironment = function () {
+ Widget.tooltips = !global$8.iOS;
+ Control$1.translate = function (text) {
+ return global$1.translate(text);
+ };
+ };
+ var setupUiContainer = function (editor) {
+ if (editor.settings.ui_container) {
+ global$8.container = $_279ymavyjfuw8sn6.descendant($_5ny1kxuzjfuw8sjh.fromDom(document.body), editor.settings.ui_container).fold($_cun2p5t7jfuw8scg.constant(null), function (elm) {
+ return elm.dom();
+ });
+ }
+ };
+ var setupRtlMode = function (editor) {
+ if (editor.rtl) {
+ Control$1.rtl = true;
+ }
+ };
+ var setupHideFloatPanels = function (editor) {
+ editor.on('mousedown', function () {
+ FloatPanel.hideAll();
+ });
+ };
+ var setup$1 = function (editor) {
+ setupRtlMode(editor);
+ setupHideFloatPanels(editor);
+ setupUiContainer(editor);
+ setupEnvironment();
+ $_6ddb2xw6jfuw8so5.register(editor);
+ $_bfu7knw1jfuw8sns.register(editor);
+ $_fssja4w8jfuw8soc.register(editor);
+ $_fy8pn1w9jfuw8soe.register(editor);
+ $_cv0tb2w4jfuw8sny.register(editor);
+ $_evwt60w3jfuw8snv.register(editor);
+ $_g2376dw5jfuw8so1.register(editor);
+ $_5fcf2jwajfuw8sof.register(editor);
+ $_1dv5z9w7jfuw8so8.register(editor);
+ };
+ var $_94fs8fvxjfuw8sn0 = { setup: setup$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- onResize: function (e) {
- if (settings.resize === 'both') {
- Resize.resizeTo(editor, startSize.width + e.deltaX, startSize.height + e.deltaY);
- } else {
- Resize.resizeTo(editor, null, startSize.height + e.deltaY);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var GridLayout = AbsoluteLayout.extend({
+ recalc: function (container) {
+ var settings, rows, cols, items, contLayoutRect, width, height, rect, ctrlLayoutRect, ctrl, x, y, posX, posY, ctrlSettings, contPaddingBox, align, spacingH, spacingV, alignH, alignV, maxX, maxY;
+ var colWidths = [];
+ var rowHeights = [];
+ var ctrlMinWidth, ctrlMinHeight, availableWidth, availableHeight, reverseRows, idx;
+ settings = container.settings;
+ items = container.items().filter(':visible');
+ contLayoutRect = container.layoutRect();
+ cols = settings.columns || Math.ceil(Math.sqrt(items.length));
+ rows = Math.ceil(items.length / cols);
+ spacingH = settings.spacingH || settings.spacing || 0;
+ spacingV = settings.spacingV || settings.spacing || 0;
+ alignH = settings.alignH || settings.align;
+ alignV = settings.alignV || settings.align;
+ contPaddingBox = container.paddingBox;
+ reverseRows = 'reverseRows' in settings ? settings.reverseRows : container.isRtl();
+ if (alignH && typeof alignH === 'string') {
+ alignH = [alignH];
+ }
+ if (alignV && typeof alignV === 'string') {
+ alignV = [alignV];
+ }
+ for (x = 0; x < cols; x++) {
+ colWidths.push(0);
+ }
+ for (y = 0; y < rows; y++) {
+ rowHeights.push(0);
+ }
+ for (y = 0; y < rows; y++) {
+ for (x = 0; x < cols; x++) {
+ ctrl = items[y * cols + x];
+ if (!ctrl) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ctrlLayoutRect = ctrl.layoutRect();
+ ctrlMinWidth = ctrlLayoutRect.minW;
+ ctrlMinHeight = ctrlLayoutRect.minH;
+ colWidths[x] = ctrlMinWidth > colWidths[x] ? ctrlMinWidth : colWidths[x];
+ rowHeights[y] = ctrlMinHeight > rowHeights[y] ? ctrlMinHeight : rowHeights[y];
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ availableWidth = contLayoutRect.innerW - contPaddingBox.left - contPaddingBox.right;
+ for (maxX = 0, x = 0; x < cols; x++) {
+ maxX += colWidths[x] + (x > 0 ? spacingH : 0);
+ availableWidth -= (x > 0 ? spacingH : 0) + colWidths[x];
+ }
+ availableHeight = contLayoutRect.innerH - contPaddingBox.top - contPaddingBox.bottom;
+ for (maxY = 0, y = 0; y < rows; y++) {
+ maxY += rowHeights[y] + (y > 0 ? spacingV : 0);
+ availableHeight -= (y > 0 ? spacingV : 0) + rowHeights[y];
+ }
+ maxX += contPaddingBox.left + contPaddingBox.right;
+ maxY += contPaddingBox.top + contPaddingBox.bottom;
+ rect = {};
+ rect.minW = maxX + (contLayoutRect.w - contLayoutRect.innerW);
+ rect.minH = maxY + (contLayoutRect.h - contLayoutRect.innerH);
+ rect.contentW = rect.minW - contLayoutRect.deltaW;
+ rect.contentH = rect.minH - contLayoutRect.deltaH;
+ rect.minW = Math.min(rect.minW, contLayoutRect.maxW);
+ rect.minH = Math.min(rect.minH, contLayoutRect.maxH);
+ rect.minW = Math.max(rect.minW, contLayoutRect.startMinWidth);
+ rect.minH = Math.max(rect.minH, contLayoutRect.startMinHeight);
+ if (contLayoutRect.autoResize && (rect.minW !== contLayoutRect.minW || rect.minH !== contLayoutRect.minH)) {
+ rect.w = rect.minW;
+ rect.h = rect.minH;
+ container.layoutRect(rect);
+ this.recalc(container);
+ if (container._lastRect === null) {
+ var parentCtrl = container.parent();
+ if (parentCtrl) {
+ parentCtrl._lastRect = null;
+ parentCtrl.recalc();
+ }
+ }
+ return;
+ }
+ if (contLayoutRect.autoResize) {
+ rect = container.layoutRect(rect);
+ rect.contentW = rect.minW - contLayoutRect.deltaW;
+ rect.contentH = rect.minH - contLayoutRect.deltaH;
+ }
+ var flexV;
+ if (settings.packV === 'start') {
+ flexV = 0;
+ } else {
+ flexV = availableHeight > 0 ? Math.floor(availableHeight / rows) : 0;
+ }
+ var totalFlex = 0;
+ var flexWidths = settings.flexWidths;
+ if (flexWidths) {
+ for (x = 0; x < flexWidths.length; x++) {
+ totalFlex += flexWidths[x];
+ }
+ } else {
+ totalFlex = cols;
+ }
+ var ratio = availableWidth / totalFlex;
+ for (x = 0; x < cols; x++) {
+ colWidths[x] += flexWidths ? flexWidths[x] * ratio : ratio;
+ }
+ posY = contPaddingBox.top;
+ for (y = 0; y < rows; y++) {
+ posX = contPaddingBox.left;
+ height = rowHeights[y] + flexV;
+ for (x = 0; x < cols; x++) {
+ if (reverseRows) {
+ idx = y * cols + cols - 1 - x;
+ } else {
+ idx = y * cols + x;
+ }
+ ctrl = items[idx];
+ if (!ctrl) {
+ break;
+ }
+ ctrlSettings = ctrl.settings;
+ ctrlLayoutRect = ctrl.layoutRect();
+ width = Math.max(colWidths[x], ctrlLayoutRect.startMinWidth);
+ ctrlLayoutRect.x = posX;
+ ctrlLayoutRect.y = posY;
+ align = ctrlSettings.alignH || (alignH ? alignH[x] || alignH[0] : null);
+ if (align === 'center') {
+ ctrlLayoutRect.x = posX + width / 2 - ctrlLayoutRect.w / 2;
+ } else if (align === 'right') {
+ ctrlLayoutRect.x = posX + width - ctrlLayoutRect.w;
+ } else if (align === 'stretch') {
+ ctrlLayoutRect.w = width;
+ }
+ align = ctrlSettings.alignV || (alignV ? alignV[x] || alignV[0] : null);
+ if (align === 'center') {
+ ctrlLayoutRect.y = posY + height / 2 - ctrlLayoutRect.h / 2;
+ } else if (align === 'bottom') {
+ ctrlLayoutRect.y = posY + height - ctrlLayoutRect.h;
+ } else if (align === 'stretch') {
+ ctrlLayoutRect.h = height;
+ }
+ ctrl.layoutRect(ctrlLayoutRect);
+ posX += width + spacingH;
+ if (ctrl.recalc) {
+ ctrl.recalc();
+ }
+ }
+ posY += height + spacingV;
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Add statusbar if needed
- if (settings.statusbar !== false) {
- panel.add({
- type: 'panel', name: 'statusbar', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', ariaRoot: true, items: [
- { type: 'elementpath', editor: editor },
- resizeHandleCtrl
- ]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Iframe$1 = Widget.extend({
+ renderHtml: function () {
+ var self = this;
+ self.classes.add('iframe');
+ self.canFocus = false;
+ return '<iframe id="' + self._id + '" class="' + self.classes + '" tabindex="-1" src="' + (self.settings.url || 'javascript:\'\'') + '" frameborder="0"></iframe>';
+ },
+ src: function (src) {
+ this.getEl().src = src;
+ },
+ html: function (html, callback) {
+ var self = this, body = this.getEl().contentWindow.document.body;
+ if (!body) {
+ global$7.setTimeout(function () {
+ self.html(html);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ body.innerHTML = html;
+ if (callback) {
+ callback();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return this;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.fire('BeforeRenderUI');
- editor.on('SwitchMode', switchMode(panel));
- panel.renderBefore(args.targetNode).reflow();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var InfoBox = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.classes.add('widget').add('infobox');
+ self.canFocus = false;
+ },
+ severity: function (level) {
+ this.classes.remove('error');
+ this.classes.remove('warning');
+ this.classes.remove('success');
+ this.classes.add(level);
+ },
+ help: function (state) {
+ this.state.set('help', state);
+ },
+ renderHtml: function () {
+ var self = this, prefix = self.classPrefix;
+ return '<div id="' + self._id + '" class="' + self.classes + '">' + '<div id="' + self._id + '-body">' + self.encode(self.state.get('text')) + '<button role="button" tabindex="-1">' + '<i class="' + prefix + 'ico ' + prefix + 'i-help"></i>' + '</button>' + '</div>' + '</div>';
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:text', function (e) {
+ self.getEl('body').firstChild.data = self.encode(e.value);
+ if (self.state.get('rendered')) {
+ self.updateLayoutRect();
+ }
+ });
+ self.state.on('change:help', function (e) {
+ self.classes.toggle('has-help', e.value);
+ if (self.state.get('rendered')) {
+ self.updateLayoutRect();
+ }
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (settings.readonly) {
- editor.setMode('readonly');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Label = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.classes.add('widget').add('label');
+ self.canFocus = false;
+ if (settings.multiline) {
+ self.classes.add('autoscroll');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (args.width) {
- DOM.setStyle(panel.getEl(), 'width', args.width);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (settings.strong) {
+ self.classes.add('strong');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ initLayoutRect: function () {
+ var self = this, layoutRect = self._super();
+ if (self.settings.multiline) {
+ var size = funcs.getSize(self.getEl());
+ if (size.width > layoutRect.maxW) {
+ layoutRect.minW = layoutRect.maxW;
+ self.classes.add('multiline');
+ }
+ self.getEl().style.width = layoutRect.minW + 'px';
+ layoutRect.startMinH = layoutRect.h = layoutRect.minH = Math.min(layoutRect.maxH, funcs.getSize(self.getEl()).height);
+ }
+ return layoutRect;
+ },
+ repaint: function () {
+ var self = this;
+ if (!self.settings.multiline) {
+ self.getEl().style.lineHeight = self.layoutRect().h + 'px';
+ }
+ return self._super();
+ },
+ severity: function (level) {
+ this.classes.remove('error');
+ this.classes.remove('warning');
+ this.classes.remove('success');
+ this.classes.add(level);
+ },
+ renderHtml: function () {
+ var self = this;
+ var targetCtrl, forName, forId = self.settings.forId;
+ var text = self.settings.html ? self.settings.html : self.encode(self.state.get('text'));
+ if (!forId && (forName = self.settings.forName)) {
+ targetCtrl = self.getRoot().find('#' + forName)[0];
+ if (targetCtrl) {
+ forId = targetCtrl._id;
+ }
+ }
+ if (forId) {
+ return '<label id="' + self._id + '" class="' + self.classes + '"' + (forId ? ' for="' + forId + '"' : '') + '>' + text + '</label>';
+ }
+ return '<span id="' + self._id + '" class="' + self.classes + '">' + text + '</span>';
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:text', function (e) {
+ self.innerHtml(self.encode(e.value));
+ if (self.state.get('rendered')) {
+ self.updateLayoutRect();
+ }
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Remove the panel when the editor is removed
- editor.on('remove', function () {
- panel.remove();
- panel = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Toolbar$1 = Container.extend({
+ Defaults: {
+ role: 'toolbar',
+ layout: 'flow'
+ },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.classes.add('toolbar');
+ },
+ postRender: function () {
+ var self = this;
+ self.items().each(function (ctrl) {
+ ctrl.classes.add('toolbar-item');
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Add accesibility shortcuts
- A11y.addKeys(editor, panel);
- ContextToolbars.addContextualToolbars(editor);
- Branding.setup(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var MenuBar = Toolbar$1.extend({
+ Defaults: {
+ role: 'menubar',
+ containerCls: 'menubar',
+ ariaRoot: true,
+ defaults: { type: 'menubutton' }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- iframeContainer: panel.find('#iframe')[0].getEl(),
- editorContainer: panel.getEl()
- };
- };
-
- return {
- render: render
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function isChildOf$1(node, parent) {
+ while (node) {
+ if (parent === node) {
+ return true;
+ }
+ node = node.parentNode;
+ }
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-
-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ui.FloatPanel',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.ui.FloatPanel');
- }
-);
-
-/**
- * Inline.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.modern.modes.Inline',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.ui.Factory',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.ui.FloatPanel',
- 'tinymce.themes.modern.ui.Toolbar',
- 'tinymce.themes.modern.ui.Menubar',
- 'tinymce.themes.modern.ui.ContextToolbars',
- 'tinymce.themes.modern.ui.A11y',
- 'tinymce.themes.modern.ui.SkinLoaded'
- ],
- function (Tools, Factory, DOMUtils, FloatPanel, Toolbar, Menubar, ContextToolbars, A11y, SkinLoaded) {
- var render = function (editor, theme, args) {
- var panel, inlineToolbarContainer, settings = editor.settings;
- var DOM = DOMUtils.DOM;
-
- if (settings.fixed_toolbar_container) {
- inlineToolbarContainer = DOM.select(settings.fixed_toolbar_container)[0];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var MenuButton = Button.extend({
+ init: function (settings) {
+ var self = this;
+ self._renderOpen = true;
+ self._super(settings);
+ settings = self.settings;
+ self.classes.add('menubtn');
+ if (settings.fixedWidth) {
+ self.classes.add('fixed-width');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var reposition = function () {
- if (panel && panel.moveRel && panel.visible() && !panel._fixed) {
- // TODO: This is kind of ugly and doesn't handle multiple scrollable elements
- var scrollContainer = editor.selection.getScrollContainer(), body = editor.getBody();
- var deltaX = 0, deltaY = 0;
-
- if (scrollContainer) {
- var bodyPos = DOM.getPos(body), scrollContainerPos = DOM.getPos(scrollContainer);
-
- deltaX = Math.max(0, scrollContainerPos.x - bodyPos.x);
- deltaY = Math.max(0, scrollContainerPos.y - bodyPos.y);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.aria('haspopup', true);
+ self.state.set('menu', settings.menu || self.render());
+ },
+ showMenu: function (toggle) {
+ var self = this;
+ var menu;
+ if (self.menu && self.menu.visible() && toggle !== false) {
+ return self.hideMenu();
+ }
+ if (!self.menu) {
+ menu = self.state.get('menu') || [];
+ self.classes.add('opened');
+ if (menu.length) {
+ menu = {
+ type: 'menu',
+ animate: true,
+ items: menu
+ };
+ } else {
+ menu.type = menu.type || 'menu';
+ menu.animate = true;
+ }
+ if (!menu.renderTo) {
+ self.menu = global$4.create(menu).parent(self).renderTo();
+ } else {
+ self.menu = menu.parent(self).show().renderTo();
+ }
+ self.fire('createmenu');
+ self.menu.reflow();
+ self.menu.on('cancel', function (e) {
+ if (e.control.parent() === self.menu) {
+ e.stopPropagation();
+ self.focus();
+ self.hideMenu();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- panel.fixed(false).moveRel(body, editor.rtl ? ['tr-br', 'br-tr'] : ['tl-bl', 'bl-tl', 'tr-br']).moveBy(deltaX, deltaY);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ self.menu.on('select', function () {
+ self.focus();
+ });
+ self.menu.on('show hide', function (e) {
+ if (e.control === self.menu) {
+ self.activeMenu(e.type === 'show');
+ self.classes.toggle('opened', e.type === 'show');
+ }
+ self.aria('expanded', e.type === 'show');
+ }).fire('show');
+ }
+ self.menu.show();
+ self.menu.layoutRect({ w: self.layoutRect().w });
+ self.menu.repaint();
+ self.menu.moveRel(self.getEl(), self.isRtl() ? [
+ 'br-tr',
+ 'tr-br'
+ ] : [
+ 'bl-tl',
+ 'tl-bl'
+ ]);
+ self.fire('showmenu');
+ },
+ hideMenu: function () {
+ var self = this;
+ if (self.menu) {
+ self.menu.items().each(function (item) {
+ if (item.hideMenu) {
+ item.hideMenu();
+ }
+ });
+ self.menu.hide();
+ }
+ },
+ activeMenu: function (state) {
+ this.classes.toggle('active', state);
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = self.classPrefix;
+ var icon = self.settings.icon, image;
+ var text = self.state.get('text');
+ var textHtml = '';
+ image = self.settings.image;
+ if (image) {
+ icon = 'none';
+ if (typeof image !== 'string') {
+ image = window.getSelection ? image[0] : image[1];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var show = function () {
- if (panel) {
- panel.show();
- reposition();
- DOM.addClass(editor.getBody(), 'mce-edit-focus');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ image = ' style="background-image: url(\'' + image + '\')"';
+ } else {
+ image = '';
+ }
+ if (text) {
+ self.classes.add('btn-has-text');
+ textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
+ }
+ icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
+ self.aria('role', self.parent() instanceof MenuBar ? 'menuitem' : 'button');
+ return '<div id="' + id + '" class="' + self.classes + '" tabindex="-1" aria-labelledby="' + id + '">' + '<button id="' + id + '-open" role="presentation" type="button" tabindex="-1">' + (icon ? '<i class="' + icon + '"' + image + '></i>' : '') + textHtml + ' <i class="' + prefix + 'caret"></i>' + '</button>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ self.on('click', function (e) {
+ if (e.control === self && isChildOf$1(e.target, self.getEl())) {
+ self.focus();
+ self.showMenu(!e.aria);
+ if (e.aria) {
+ self.menu.items().filter(':visible')[0].focus();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ self.on('mouseenter', function (e) {
+ var overCtrl = e.control;
+ var parent = self.parent();
+ var hasVisibleSiblingMenu;
+ if (overCtrl && parent && overCtrl instanceof MenuButton && overCtrl.parent() === parent) {
+ parent.items().filter('MenuButton').each(function (ctrl) {
+ if (ctrl.hideMenu && ctrl !== overCtrl) {
+ if (ctrl.menu && ctrl.menu.visible()) {
+ hasVisibleSiblingMenu = true;
+ }
+ ctrl.hideMenu();
+ }
+ });
+ if (hasVisibleSiblingMenu) {
+ overCtrl.focus();
+ overCtrl.showMenu();
+ }
+ }
+ });
+ return self._super();
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:menu', function () {
+ if (self.menu) {
+ self.menu.remove();
+ }
+ self.menu = null;
+ });
+ return self._super();
+ },
+ remove: function () {
+ this._super();
+ if (this.menu) {
+ this.menu.remove();
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var hide = function () {
- if (panel) {
- // We require two events as the inline float panel based toolbar does not have autohide=true
- panel.hide();
-
- // All other autohidden float panels will be closed below.
- FloatPanel.hideAll();
-
- DOM.removeClass(editor.getBody(), 'mce-edit-focus');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Menu = FloatPanel.extend({
+ Defaults: {
+ defaultType: 'menuitem',
+ border: 1,
+ layout: 'stack',
+ role: 'application',
+ bodyRole: 'menu',
+ ariaRoot: true
+ },
+ init: function (settings) {
+ var self = this;
+ settings.autohide = true;
+ settings.constrainToViewport = true;
+ if (typeof settings.items === 'function') {
+ settings.itemsFactory = settings.items;
+ settings.items = [];
+ }
+ if (settings.itemDefaults) {
+ var items = settings.items;
+ var i = items.length;
+ while (i--) {
+ items[i] = global$2.extend({}, settings.itemDefaults, items[i]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ self._super(settings);
+ self.classes.add('menu');
+ if (settings.animate && global$8.ie !== 11) {
+ self.classes.add('animate');
+ }
+ },
+ repaint: function () {
+ this.classes.toggle('menu-align', true);
+ this._super();
+ this.getEl().style.height = '';
+ this.getEl('body').style.height = '';
+ return this;
+ },
+ cancel: function () {
+ var self = this;
+ self.hideAll();
+ self.fire('select');
+ },
+ load: function () {
+ var self = this;
+ var time, factory;
+ function hideThrobber() {
+ if (self.throbber) {
+ self.throbber.hide();
+ self.throbber = null;
+ }
+ }
+ factory = self.settings.itemsFactory;
+ if (!factory) {
+ return;
+ }
+ if (!self.throbber) {
+ self.throbber = new Throbber(self.getEl('body'), true);
+ if (self.items().length === 0) {
+ self.throbber.show();
+ self.fire('loading');
+ } else {
+ self.throbber.show(100, function () {
+ self.items().remove();
+ self.fire('loading');
+ });
+ }
+ self.on('hide close', hideThrobber);
+ }
+ self.requestTime = time = new Date().getTime();
+ self.settings.itemsFactory(function (items) {
+ if (items.length === 0) {
+ self.hide();
+ return;
+ }
+ if (self.requestTime !== time) {
+ return;
+ }
+ self.getEl().style.width = '';
+ self.getEl('body').style.width = '';
+ hideThrobber();
+ self.items().remove();
+ self.getEl('body').innerHTML = '';
+ self.add(items);
+ self.renderNew();
+ self.fire('loaded');
+ });
+ },
+ hideAll: function () {
+ var self = this;
+ this.find('menuitem').exec('hideMenu');
+ return self._super();
+ },
+ preRender: function () {
+ var self = this;
+ self.items().each(function (ctrl) {
+ var settings = ctrl.settings;
+ if (settings.icon || settings.image || settings.selectable) {
+ self._hasIcons = true;
+ return false;
+ }
+ });
+ if (self.settings.itemsFactory) {
+ self.on('postrender', function () {
+ if (self.settings.itemsFactory) {
+ self.load();
+ }
+ });
+ }
+ self.on('show hide', function (e) {
+ if (e.control === self) {
+ if (e.type === 'show') {
+ global$7.setTimeout(function () {
+ self.classes.add('in');
+ }, 0);
+ } else {
+ self.classes.remove('in');
+ }
+ }
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var render = function () {
- if (panel) {
- if (!panel.visible()) {
- show();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ListBox = MenuButton.extend({
+ init: function (settings) {
+ var self = this;
+ var values, selected, selectedText, lastItemCtrl;
+ function setSelected(menuValues) {
+ for (var i = 0; i < menuValues.length; i++) {
+ selected = menuValues[i].selected || settings.value === menuValues[i].value;
+ if (selected) {
+ selectedText = selectedText || menuValues[i].text;
+ self.state.set('value', menuValues[i].value);
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (menuValues[i].menu) {
+ if (setSelected(menuValues[i].menu)) {
+ return true;
+ }
+ }
+ }
+ }
+ self._super(settings);
+ settings = self.settings;
+ self._values = values = settings.values;
+ if (values) {
+ if (typeof settings.value !== 'undefined') {
+ setSelected(values);
+ }
+ if (!selected && values.length > 0) {
+ selectedText = values[0].text;
+ self.state.set('value', values[0].value);
+ }
+ self.state.set('menu', values);
+ }
+ self.state.set('text', settings.text || selectedText);
+ self.classes.add('listbox');
+ self.on('select', function (e) {
+ var ctrl = e.control;
+ if (lastItemCtrl) {
+ e.lastControl = lastItemCtrl;
+ }
+ if (settings.multiple) {
+ ctrl.active(!ctrl.active());
+ } else {
+ self.value(e.control.value());
+ }
+ lastItemCtrl = ctrl;
+ });
+ },
+ value: function (value) {
+ if (arguments.length === 0) {
+ return this.state.get('value');
+ }
+ if (typeof value === 'undefined') {
+ return this;
+ }
+ if (this.settings.values) {
+ var matchingValues = global$2.grep(this.settings.values, function (a) {
+ return a.value === value;
+ });
+ if (matchingValues.length > 0) {
+ this.state.set('value', value);
+ } else if (value === null) {
+ this.state.set('value', null);
+ }
+ } else {
+ this.state.set('value', value);
+ }
+ return this;
+ },
+ bindStates: function () {
+ var self = this;
+ function activateMenuItemsByValue(menu, value) {
+ if (menu instanceof Menu) {
+ menu.items().each(function (ctrl) {
+ if (!ctrl.hasMenus()) {
+ ctrl.active(ctrl.value() === value);
+ }
+ });
+ }
+ }
+ function getSelectedItem(menuValues, value) {
+ var selectedItem;
+ if (!menuValues) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (var i = 0; i < menuValues.length; i++) {
+ if (menuValues[i].value === value) {
+ return menuValues[i];
+ }
+ if (menuValues[i].menu) {
+ selectedItem = getSelectedItem(menuValues[i].menu, value);
+ if (selectedItem) {
+ return selectedItem;
+ }
+ }
+ }
+ }
+ self.on('show', function (e) {
+ activateMenuItemsByValue(e.control, self.value());
+ });
+ self.state.on('change:value', function (e) {
+ var selectedItem = getSelectedItem(self.state.get('menu'), e.value);
+ if (selectedItem) {
+ self.text(selectedItem.text);
+ } else {
+ self.text(self.settings.text);
+ }
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Render a plain panel inside the inlineToolbarContainer if it's defined
- panel = theme.panel = Factory.create({
- type: inlineToolbarContainer ? 'panel' : 'floatpanel',
- role: 'application',
- classes: 'tinymce tinymce-inline',
- layout: 'flex',
- direction: 'column',
- align: 'stretch',
- autohide: false,
- autofix: true,
- fixed: !!inlineToolbarContainer,
- border: 1,
- items: [
- settings.menubar === false ? null : { type: 'menubar', border: '0 0 1 0', items: Menubar.createMenuButtons(editor) },
- Toolbar.createToolbars(editor, settings.toolbar_items_size)
- ]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toggleTextStyle = function (ctrl, state) {
+ var textStyle = ctrl._textStyle;
+ if (textStyle) {
+ var textElm = ctrl.getEl('text');
+ textElm.setAttribute('style', textStyle);
+ if (state) {
+ textElm.style.color = '';
+ textElm.style.backgroundColor = '';
+ }
+ }
+ };
+ var MenuItem = Widget.extend({
+ Defaults: {
+ border: 0,
+ role: 'menuitem'
+ },
+ init: function (settings) {
+ var self = this;
+ var text;
+ self._super(settings);
+ settings = self.settings;
+ self.classes.add('menu-item');
+ if (settings.menu) {
+ self.classes.add('menu-item-expand');
+ }
+ if (settings.preview) {
+ self.classes.add('menu-item-preview');
+ }
+ text = self.state.get('text');
+ if (text === '-' || text === '|') {
+ self.classes.add('menu-item-sep');
+ self.aria('role', 'separator');
+ self.state.set('text', '-');
+ }
+ if (settings.selectable) {
+ self.aria('role', 'menuitemcheckbox');
+ self.classes.add('menu-item-checkbox');
+ settings.icon = 'selected';
+ }
+ if (!settings.preview && !settings.selectable) {
+ self.classes.add('menu-item-normal');
+ }
+ self.on('mousedown', function (e) {
+ e.preventDefault();
+ });
+ if (settings.menu && !settings.ariaHideMenu) {
+ self.aria('haspopup', true);
+ }
+ },
+ hasMenus: function () {
+ return !!this.settings.menu;
+ },
+ showMenu: function () {
+ var self = this;
+ var settings = self.settings;
+ var menu;
+ var parent = self.parent();
+ parent.items().each(function (ctrl) {
+ if (ctrl !== self) {
+ ctrl.hideMenu();
+ }
+ });
+ if (settings.menu) {
+ menu = self.menu;
+ if (!menu) {
+ menu = settings.menu;
+ if (menu.length) {
+ menu = {
+ type: 'menu',
+ items: menu
+ };
+ } else {
+ menu.type = menu.type || 'menu';
+ }
+ if (parent.settings.itemDefaults) {
+ menu.itemDefaults = parent.settings.itemDefaults;
+ }
+ menu = self.menu = global$4.create(menu).parent(self).renderTo();
+ menu.reflow();
+ menu.on('cancel', function (e) {
+ e.stopPropagation();
+ self.focus();
+ menu.hide();
+ });
+ menu.on('show hide', function (e) {
+ if (e.control.items) {
+ e.control.items().each(function (ctrl) {
+ ctrl.active(ctrl.settings.selected);
+ });
+ }
+ }).fire('show');
+ menu.on('hide', function (e) {
+ if (e.control === menu) {
+ self.classes.remove('selected');
+ }
+ });
+ menu.submenu = true;
+ } else {
+ menu.show();
+ }
+ menu._parentMenu = parent;
+ menu.classes.add('menu-sub');
+ var rel = menu.testMoveRel(self.getEl(), self.isRtl() ? [
+ 'tl-tr',
+ 'bl-br',
+ 'tr-tl',
+ 'br-bl'
+ ] : [
+ 'tr-tl',
+ 'br-bl',
+ 'tl-tr',
+ 'bl-br'
+ ]);
+ menu.moveRel(self.getEl(), rel);
+ menu.rel = rel;
+ rel = 'menu-sub-' + rel;
+ menu.classes.remove(menu._lastRel).add(rel);
+ menu._lastRel = rel;
+ self.classes.add('selected');
+ self.aria('expanded', true);
+ }
+ },
+ hideMenu: function () {
+ var self = this;
+ if (self.menu) {
+ self.menu.items().each(function (item) {
+ if (item.hideMenu) {
+ item.hideMenu();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Add statusbar
- /*if (settings.statusbar !== false) {
- panel.add({type: 'panel', classes: 'statusbar', layout: 'flow', border: '1 0 0 0', items: [
- {type: 'elementpath'}
- ]});
- }*/
-
- editor.fire('BeforeRenderUI');
- panel.renderTo(inlineToolbarContainer || document.body).reflow();
-
- A11y.addKeys(editor, panel);
- show();
- ContextToolbars.addContextualToolbars(editor);
-
- editor.on('nodeChange', reposition);
- editor.on('activate', show);
- editor.on('deactivate', hide);
-
- editor.nodeChanged();
- };
-
- settings.content_editable = true;
-
- editor.on('focus', function () {
- // Render only when the CSS file has been loaded
- if (args.skinUiCss) {
- DOM.styleSheetLoader.load(args.skinUiCss, render, render);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.menu.hide();
+ self.aria('expanded', false);
+ }
+ return self;
+ },
+ renderHtml: function () {
+ var self = this;
+ var id = self._id;
+ var settings = self.settings;
+ var prefix = self.classPrefix;
+ var text = self.state.get('text');
+ var icon = self.settings.icon, image = '', shortcut = settings.shortcut;
+ var url = self.encode(settings.url), iconHtml = '';
+ function convertShortcut(shortcut) {
+ var i, value, replace = {};
+ if (global$8.mac) {
+ replace = {
+ alt: '⌥',
+ ctrl: '⌘',
+ shift: '⇧',
+ meta: '⌘'
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- render();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ replace = { meta: 'Ctrl' };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ shortcut = shortcut.split('+');
+ for (i = 0; i < shortcut.length; i++) {
+ value = replace[shortcut[i].toLowerCase()];
+ if (value) {
+ shortcut[i] = value;
+ }
+ }
+ return shortcut.join('+');
+ }
+ function escapeRegExp(str) {
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ }
+ function markMatches(text) {
+ var match = settings.match || '';
+ return match ? text.replace(new RegExp(escapeRegExp(match), 'gi'), function (match) {
+ return '!mce~match[' + match + ']mce~match!';
+ }) : text;
+ }
+ function boldMatches(text) {
+ return text.replace(new RegExp(escapeRegExp('!mce~match['), 'g'), '<b>').replace(new RegExp(escapeRegExp(']mce~match!'), 'g'), '</b>');
+ }
+ if (icon) {
+ self.parent().classes.add('menu-has-icons');
+ }
+ if (settings.image) {
+ image = ' style="background-image: url(\'' + settings.image + '\')"';
+ }
+ if (shortcut) {
+ shortcut = convertShortcut(shortcut);
+ }
+ icon = prefix + 'ico ' + prefix + 'i-' + (self.settings.icon || 'none');
+ iconHtml = text !== '-' ? '<i class="' + icon + '"' + image + '></i>\xA0' : '';
+ text = boldMatches(self.encode(markMatches(text)));
+ url = boldMatches(self.encode(markMatches(url)));
+ return '<div id="' + id + '" class="' + self.classes + '" tabindex="-1">' + iconHtml + (text !== '-' ? '<span id="' + id + '-text" class="' + prefix + 'text">' + text + '</span>' : '') + (shortcut ? '<div id="' + id + '-shortcut" class="' + prefix + 'menu-shortcut">' + shortcut + '</div>' : '') + (settings.menu ? '<div class="' + prefix + 'caret"></div>' : '') + (url ? '<div class="' + prefix + 'menu-item-link">' + url + '</div>' : '') + '</div>';
+ },
+ postRender: function () {
+ var self = this, settings = self.settings;
+ var textStyle = settings.textStyle;
+ if (typeof textStyle === 'function') {
+ textStyle = textStyle.call(this);
+ }
+ if (textStyle) {
+ var textElm = self.getEl('text');
+ if (textElm) {
+ textElm.setAttribute('style', textStyle);
+ self._textStyle = textStyle;
+ }
+ }
+ self.on('mouseenter click', function (e) {
+ if (e.control === self) {
+ if (!settings.menu && e.type === 'click') {
+ self.fire('select');
+ global$7.requestAnimationFrame(function () {
+ self.parent().hideAll();
+ });
+ } else {
+ self.showMenu();
+ if (e.aria) {
+ self.menu.focus(true);
+ }
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self._super();
+ return self;
+ },
+ hover: function () {
+ var self = this;
+ self.parent().items().each(function (ctrl) {
+ ctrl.classes.remove('selected');
+ });
+ self.classes.toggle('selected', true);
+ return self;
+ },
+ active: function (state) {
+ toggleTextStyle(this, state);
+ if (typeof state !== 'undefined') {
+ this.aria('checked', state);
+ }
+ return this._super(state);
+ },
+ remove: function () {
+ this._super();
+ if (this.menu) {
+ this.menu.remove();
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('blur hide', hide);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Radio = Checkbox.extend({
+ Defaults: {
+ classes: 'radio',
+ role: 'radio'
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Remove the panel when the editor is removed
- editor.on('remove', function () {
- if (panel) {
- panel.remove();
- panel = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ResizeHandle = Widget.extend({
+ renderHtml: function () {
+ var self = this, prefix = self.classPrefix;
+ self.classes.add('resizehandle');
+ if (self.settings.direction === 'both') {
+ self.classes.add('resizehandle-both');
+ }
+ self.canFocus = false;
+ return '<div id="' + self._id + '" class="' + self.classes + '">' + '<i class="' + prefix + 'ico ' + prefix + 'i-resize"></i>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ self._super();
+ self.resizeDragHelper = new DragHelper(this._id, {
+ start: function () {
+ self.fire('ResizeStart');
+ },
+ drag: function (e) {
+ if (self.settings.direction !== 'both') {
+ e.deltaX = 0;
+ }
+ self.fire('Resize', e);
+ },
+ stop: function () {
+ self.fire('ResizeEnd');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ remove: function () {
+ if (this.resizeDragHelper) {
+ this.resizeDragHelper.destroy();
+ }
+ return this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Preload skin css
- if (args.skinUiCss) {
- DOM.styleSheetLoader.load(args.skinUiCss, SkinLoaded.fireSkinLoaded(editor));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function createOptions(options) {
+ var strOptions = '';
+ if (options) {
+ for (var i = 0; i < options.length; i++) {
+ strOptions += '<option value="' + options[i] + '">' + options[i] + '</option>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {};
- };
-
- return {
- render: render
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return strOptions;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var SelectBox = Widget.extend({
+ Defaults: {
+ classes: 'selectbox',
+ role: 'selectbox',
+ options: []
+ },
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ if (self.settings.size) {
+ self.size = self.settings.size;
+ }
+ if (self.settings.options) {
+ self._options = self.settings.options;
+ }
+ self.on('keydown', function (e) {
+ var rootControl;
+ if (e.keyCode === 13) {
+ e.preventDefault();
+ self.parents().reverse().each(function (ctrl) {
+ if (ctrl.toJSON) {
+ rootControl = ctrl;
+ return false;
+ }
+ });
+ self.fire('submit', { data: rootControl.toJSON() });
+ }
+ });
+ },
+ options: function (state) {
+ if (!arguments.length) {
+ return this.state.get('options');
+ }
+ this.state.set('options', state);
+ return this;
+ },
+ renderHtml: function () {
+ var self = this;
+ var options, size = '';
+ options = createOptions(self._options);
+ if (self.size) {
+ size = ' size = "' + self.size + '"';
+ }
+ return '<select id="' + self._id + '" class="' + self.classes + '"' + size + '>' + options + '</select>';
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:options', function (e) {
+ self.getEl().innerHTML = createOptions(e.value);
+ });
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ResolveGlobal.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ui.Throbber',
- [
- 'global!tinymce.util.Tools.resolve'
- ],
- function (resolve) {
- return resolve('tinymce.ui.Throbber');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function constrain(value, minVal, maxVal) {
+ if (value < minVal) {
+ value = minVal;
+ }
+ if (value > maxVal) {
+ value = maxVal;
+ }
+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-
-/**
- * ProgressState.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.modern.ui.ProgressState',
- [
- 'tinymce.core.ui.Throbber'
- ],
- function (Throbber) {
- var setup = function (editor, theme) {
- var throbber;
-
- editor.on('ProgressState', function (e) {
- throbber = throbber || new Throbber(theme.panel.getEl('body'));
-
- if (e.state) {
- throbber.show(e.time);
- } else {
- throbber.hide();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function setAriaProp(el, name, value) {
+ el.setAttribute('aria-' + name, value);
+ }
+ function updateSliderHandle(ctrl, value) {
+ var maxHandlePos, shortSizeName, sizeName, stylePosName, styleValue, handleEl;
+ if (ctrl.settings.orientation === 'v') {
+ stylePosName = 'top';
+ sizeName = 'height';
+ shortSizeName = 'h';
+ } else {
+ stylePosName = 'left';
+ sizeName = 'width';
+ shortSizeName = 'w';
+ }
+ handleEl = ctrl.getEl('handle');
+ maxHandlePos = (ctrl.layoutRect()[shortSizeName] || 100) - funcs.getSize(handleEl)[sizeName];
+ styleValue = maxHandlePos * ((value - ctrl._minValue) / (ctrl._maxValue - ctrl._minValue)) + 'px';
+ handleEl.style[stylePosName] = styleValue;
+ handleEl.style.height = ctrl.layoutRect().h + 'px';
+ setAriaProp(handleEl, 'valuenow', value);
+ setAriaProp(handleEl, 'valuetext', '' + ctrl.settings.previewFilter(value));
+ setAriaProp(handleEl, 'valuemin', ctrl._minValue);
+ setAriaProp(handleEl, 'valuemax', ctrl._maxValue);
+ }
+ var Slider = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ if (!settings.previewFilter) {
+ settings.previewFilter = function (value) {
+ return Math.round(value * 100) / 100;
+ };
+ }
+ self._super(settings);
+ self.classes.add('slider');
+ if (settings.orientation === 'v') {
+ self.classes.add('vertical');
+ }
+ self._minValue = $_e8diihtbjfuw8scy.isNumber(settings.minValue) ? settings.minValue : 0;
+ self._maxValue = $_e8diihtbjfuw8scy.isNumber(settings.maxValue) ? settings.maxValue : 100;
+ self._initValue = self.state.get('value');
+ },
+ renderHtml: function () {
+ var self = this, id = self._id, prefix = self.classPrefix;
+ return '<div id="' + id + '" class="' + self.classes + '">' + '<div id="' + id + '-handle" class="' + prefix + 'slider-handle" role="slider" tabindex="-1"></div>' + '</div>';
+ },
+ reset: function () {
+ this.value(this._initValue).repaint();
+ },
+ postRender: function () {
+ var self = this;
+ var minValue, maxValue, screenCordName, stylePosName, sizeName, shortSizeName;
+ function toFraction(min, max, val) {
+ return (val + min) / (max - min);
+ }
+ function fromFraction(min, max, val) {
+ return val * (max - min) - min;
+ }
+ function handleKeyboard(minValue, maxValue) {
+ function alter(delta) {
+ var value;
+ value = self.value();
+ value = fromFraction(minValue, maxValue, toFraction(minValue, maxValue, value) + delta * 0.05);
+ value = constrain(value, minValue, maxValue);
+ self.value(value);
+ self.fire('dragstart', { value: value });
+ self.fire('drag', { value: value });
+ self.fire('dragend', { value: value });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.on('keydown', function (e) {
+ switch (e.keyCode) {
+ case 37:
+ case 38:
+ alter(-1);
+ break;
+ case 39:
+ case 40:
+ alter(1);
+ break;
+ }
+ });
+ }
+ function handleDrag(minValue, maxValue, handleEl) {
+ var startPos, startHandlePos, maxHandlePos, handlePos, value;
+ self._dragHelper = new DragHelper(self._id, {
+ handle: self._id + '-handle',
+ start: function (e) {
+ startPos = e[screenCordName];
+ startHandlePos = parseInt(self.getEl('handle').style[stylePosName], 10);
+ maxHandlePos = (self.layoutRect()[shortSizeName] || 100) - funcs.getSize(handleEl)[sizeName];
+ self.fire('dragstart', { value: value });
+ },
+ drag: function (e) {
+ var delta = e[screenCordName] - startPos;
+ handlePos = constrain(startHandlePos + delta, 0, maxHandlePos);
+ handleEl.style[stylePosName] = handlePos + 'px';
+ value = minValue + handlePos / maxHandlePos * (maxValue - minValue);
+ self.value(value);
+ self.tooltip().text('' + self.settings.previewFilter(value)).show().moveRel(handleEl, 'bc tc');
+ self.fire('drag', { value: value });
+ },
+ stop: function () {
+ self.tooltip().hide();
+ self.fire('dragend', { value: value });
+ }
+ });
+ }
+ minValue = self._minValue;
+ maxValue = self._maxValue;
+ if (self.settings.orientation === 'v') {
+ screenCordName = 'screenY';
+ stylePosName = 'top';
+ sizeName = 'height';
+ shortSizeName = 'h';
+ } else {
+ screenCordName = 'screenX';
+ stylePosName = 'left';
+ sizeName = 'width';
+ shortSizeName = 'w';
+ }
+ self._super();
+ handleKeyboard(minValue, maxValue);
+ handleDrag(minValue, maxValue, self.getEl('handle'));
+ },
+ repaint: function () {
+ this._super();
+ updateSliderHandle(this, this.value());
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:value', function (e) {
+ updateSliderHandle(self, e.value);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- setup: setup
- };
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Spacer = Widget.extend({
+ renderHtml: function () {
+ var self = this;
+ self.classes.add('spacer');
+ self.canFocus = false;
+ return '<div id="' + self._id + '" class="' + self.classes + '"></div>';
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Theme.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.themes.modern.Theme',
- [
- 'global!window',
- 'tinymce.core.AddOnManager',
- 'tinymce.core.EditorManager',
- 'tinymce.core.Env',
- 'tinymce.core.ui.Api',
- 'tinymce.themes.modern.modes.Iframe',
- 'tinymce.themes.modern.modes.Inline',
- 'tinymce.themes.modern.ui.ProgressState',
- 'tinymce.themes.modern.ui.Resize'
- ],
- function (window, AddOnManager, EditorManager, Env, Api, Iframe, Inline, ProgressState, Resize) {
- var ThemeManager = AddOnManager.ThemeManager;
-
- Api.appendTo(window.tinymce ? window.tinymce : {});
-
- var renderUI = function (editor, theme, args) {
- var settings = editor.settings;
- var skin = settings.skin !== false ? settings.skin || 'lightgray' : false;
-
- if (skin) {
- var skinUrl = settings.skin_url;
-
- if (skinUrl) {
- skinUrl = editor.documentBaseURI.toAbsolute(skinUrl);
- } else {
- skinUrl = EditorManager.baseURL + '/skins/' + skin;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var SplitButton = MenuButton.extend({
+ Defaults: {
+ classes: 'widget btn splitbtn',
+ role: 'button'
+ },
+ repaint: function () {
+ var self = this;
+ var elm = self.getEl();
+ var rect = self.layoutRect();
+ var mainButtonElm, menuButtonElm;
+ self._super();
+ mainButtonElm = elm.firstChild;
+ menuButtonElm = elm.lastChild;
+ global$9(mainButtonElm).css({
+ width: rect.w - funcs.getSize(menuButtonElm).width,
+ height: rect.h - 2
+ });
+ global$9(menuButtonElm).css({ height: rect.h - 2 });
+ return self;
+ },
+ activeMenu: function (state) {
+ var self = this;
+ global$9(self.getEl().lastChild).toggleClass(self.classPrefix + 'active', state);
+ },
+ renderHtml: function () {
+ var self = this;
+ var id = self._id;
+ var prefix = self.classPrefix;
+ var image;
+ var icon = self.state.get('icon');
+ var text = self.state.get('text');
+ var settings = self.settings;
+ var textHtml = '', ariaPressed;
+ image = settings.image;
+ if (image) {
+ icon = 'none';
+ if (typeof image !== 'string') {
+ image = window.getSelection ? image[0] : image[1];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ image = ' style="background-image: url(\'' + image + '\')"';
+ } else {
+ image = '';
+ }
+ icon = settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
+ if (text) {
+ self.classes.add('btn-has-text');
+ textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
+ }
+ ariaPressed = typeof settings.active === 'boolean' ? ' aria-pressed="' + settings.active + '"' : '';
+ return '<div id="' + id + '" class="' + self.classes + '" role="button"' + ariaPressed + ' tabindex="-1">' + '<button type="button" hidefocus="1" tabindex="-1">' + (icon ? '<i class="' + icon + '"' + image + '></i>' : '') + textHtml + '</button>' + '<button type="button" class="' + prefix + 'open" hidefocus="1" tabindex="-1">' + (self._menuBtnText ? (icon ? '\xA0' : '') + self._menuBtnText : '') + ' <i class="' + prefix + 'caret"></i>' + '</button>' + '</div>';
+ },
+ postRender: function () {
+ var self = this, onClickHandler = self.settings.onclick;
+ self.on('click', function (e) {
+ var node = e.target;
+ if (e.control === this) {
+ while (node) {
+ if (e.aria && e.aria.key !== 'down' || node.nodeName === 'BUTTON' && node.className.indexOf('open') === -1) {
+ e.stopImmediatePropagation();
+ if (onClickHandler) {
+ onClickHandler.call(this, e);
+ }
+ return;
+ }
+ node = node.parentNode;
+ }
+ }
+ });
+ delete self.settings.onclick;
+ return self._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- args.skinUiCss = skinUrl + '/skin.min.css';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var StackLayout = FlowLayout.extend({
+ Defaults: {
+ containerClass: 'stack-layout',
+ controlClass: 'stack-layout-item',
+ endClass: 'break'
+ },
+ isNative: function () {
+ return true;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Load content.min.css or content.inline.min.css
- editor.contentCSS.push(skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var TabPanel = Panel.extend({
+ Defaults: {
+ layout: 'absolute',
+ defaults: { type: 'panel' }
+ },
+ activateTab: function (idx) {
+ var activeTabElm;
+ if (this.activeTabId) {
+ activeTabElm = this.getEl(this.activeTabId);
+ global$9(activeTabElm).removeClass(this.classPrefix + 'active');
+ activeTabElm.setAttribute('aria-selected', 'false');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.activeTabId = 't' + idx;
+ activeTabElm = this.getEl('t' + idx);
+ activeTabElm.setAttribute('aria-selected', 'true');
+ global$9(activeTabElm).addClass(this.classPrefix + 'active');
+ this.items()[idx].show().fire('showtab');
+ this.reflow();
+ this.items().each(function (item, i) {
+ if (idx !== i) {
+ item.hide();
+ }
+ });
+ },
+ renderHtml: function () {
+ var self = this;
+ var layout = self._layout;
+ var tabsHtml = '';
+ var prefix = self.classPrefix;
+ self.preRender();
+ layout.preRender(self);
+ self.items().each(function (ctrl, i) {
+ var id = self._id + '-t' + i;
+ ctrl.aria('role', 'tabpanel');
+ ctrl.aria('labelledby', id);
+ tabsHtml += '<div id="' + id + '" class="' + prefix + 'tab" ' + 'unselectable="on" role="tab" aria-controls="' + ctrl._id + '" aria-selected="false" tabIndex="-1">' + self.encode(ctrl.settings.title) + '</div>';
+ });
+ return '<div id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1">' + '<div id="' + self._id + '-head" class="' + prefix + 'tabs" role="tablist">' + tabsHtml + '</div>' + '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' + layout.renderHtml(self) + '</div>' + '</div>';
+ },
+ postRender: function () {
+ var self = this;
+ self._super();
+ self.settings.activeTab = self.settings.activeTab || 0;
+ self.activateTab(self.settings.activeTab);
+ this.on('click', function (e) {
+ var targetParent = e.target.parentNode;
+ if (targetParent && targetParent.id === self._id + '-head') {
+ var i = targetParent.childNodes.length;
+ while (i--) {
+ if (targetParent.childNodes[i] === e.target) {
+ self.activateTab(i);
+ }
+ }
+ }
+ });
+ },
+ initLayoutRect: function () {
+ var self = this;
+ var rect, minW, minH;
+ minW = funcs.getSize(self.getEl('head')).width;
+ minW = minW < 0 ? 0 : minW;
+ minH = 0;
+ self.items().each(function (item) {
+ minW = Math.max(minW, item.layoutRect().minW);
+ minH = Math.max(minH, item.layoutRect().minH);
+ });
+ self.items().each(function (ctrl) {
+ ctrl.settings.x = 0;
+ ctrl.settings.y = 0;
+ ctrl.settings.w = minW;
+ ctrl.settings.h = minH;
+ ctrl.layoutRect({
+ x: 0,
+ y: 0,
+ w: minW,
+ h: minH
+ });
+ });
+ var headH = funcs.getSize(self.getEl('head')).height;
+ self.settings.minWidth = minW;
+ self.settings.minHeight = minH + headH;
+ rect = self._super();
+ rect.deltaH += headH;
+ rect.innerH = rect.h - rect.deltaH;
+ return rect;
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ProgressState.setup(editor, theme);
-
- if (settings.inline) {
- return Inline.render(editor, theme, args);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var TextBox = Widget.extend({
+ init: function (settings) {
+ var self = this;
+ self._super(settings);
+ self.classes.add('textbox');
+ if (settings.multiline) {
+ self.classes.add('multiline');
+ } else {
+ self.on('keydown', function (e) {
+ var rootControl;
+ if (e.keyCode === 13) {
+ e.preventDefault();
+ self.parents().reverse().each(function (ctrl) {
+ if (ctrl.toJSON) {
+ rootControl = ctrl;
+ return false;
+ }
+ });
+ self.fire('submit', { data: rootControl.toJSON() });
+ }
+ });
+ self.on('keyup', function (e) {
+ self.state.set('value', e.target.value);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ repaint: function () {
+ var self = this;
+ var style, rect, borderBox, borderW, borderH = 0, lastRepaintRect;
+ style = self.getEl().style;
+ rect = self._layoutRect;
+ lastRepaintRect = self._lastRepaintRect || {};
+ var doc = document;
+ if (!self.settings.multiline && doc.all && (!doc.documentMode || doc.documentMode <= 8)) {
+ style.lineHeight = rect.h - borderH + 'px';
+ }
+ borderBox = self.borderBox;
+ borderW = borderBox.left + borderBox.right + 8;
+ borderH = borderBox.top + borderBox.bottom + (self.settings.multiline ? 8 : 0);
+ if (rect.x !== lastRepaintRect.x) {
+ style.left = rect.x + 'px';
+ lastRepaintRect.x = rect.x;
+ }
+ if (rect.y !== lastRepaintRect.y) {
+ style.top = rect.y + 'px';
+ lastRepaintRect.y = rect.y;
+ }
+ if (rect.w !== lastRepaintRect.w) {
+ style.width = rect.w - borderW + 'px';
+ lastRepaintRect.w = rect.w;
+ }
+ if (rect.h !== lastRepaintRect.h) {
+ style.height = rect.h - borderH + 'px';
+ lastRepaintRect.h = rect.h;
+ }
+ self._lastRepaintRect = lastRepaintRect;
+ self.fire('repaint', {}, false);
+ return self;
+ },
+ renderHtml: function () {
+ var self = this;
+ var settings = self.settings;
+ var attrs, elm;
+ attrs = {
+ id: self._id,
+ hidefocus: '1'
+ };
+ global$2.each([
+ 'rows',
+ 'spellcheck',
+ 'maxLength',
+ 'size',
+ 'readonly',
+ 'min',
+ 'max',
+ 'step',
+ 'list',
+ 'pattern',
+ 'placeholder',
+ 'required',
+ 'multiple'
+ ], function (name) {
+ attrs[name] = settings[name];
+ });
+ if (self.disabled()) {
+ attrs.disabled = 'disabled';
+ }
+ if (settings.subtype) {
+ attrs.type = settings.subtype;
+ }
+ elm = funcs.create(settings.multiline ? 'textarea' : 'input', attrs);
+ elm.value = self.state.get('value');
+ elm.className = self.classes;
+ return elm.outerHTML;
+ },
+ value: function (value) {
+ if (arguments.length) {
+ this.state.set('value', value);
+ return this;
+ }
+ if (this.state.get('rendered')) {
+ this.state.set('value', this.getEl().value);
+ }
+ return this.state.get('value');
+ },
+ postRender: function () {
+ var self = this;
+ self.getEl().value = self.state.get('value');
+ self._super();
+ self.$el.on('change', function (e) {
+ self.state.set('value', e.target.value);
+ self.fire('change', e);
+ });
+ },
+ bindStates: function () {
+ var self = this;
+ self.state.on('change:value', function (e) {
+ if (self.getEl().value !== e.value) {
+ self.getEl().value = e.value;
+ }
+ });
+ self.state.on('change:disabled', function (e) {
+ self.getEl().disabled = e.value;
+ });
+ return self._super();
+ },
+ remove: function () {
+ this.$el.off();
+ this._super();
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Iframe.render(editor, theme, args);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getApi = function () {
+ return {
+ Selector: Selector,
+ Collection: Collection$2,
+ ReflowQueue: $_5c4g75txjfuw8sfo,
+ Control: Control$1,
+ Factory: global$4,
+ KeyboardNavigation: KeyboardNavigation,
+ Container: Container,
+ DragHelper: DragHelper,
+ Scrollable: $_8d5ltqtzjfuw8sfw,
+ Panel: Panel,
+ Movable: $_831wnjtkjfuw8sdt,
+ Resizable: $_4ucwx9u1jfuw8sg2,
+ FloatPanel: FloatPanel,
+ Window: Window,
+ MessageBox: MessageBox,
+ Tooltip: Tooltip,
+ Widget: Widget,
+ Progress: Progress,
+ Notification: Notification,
+ Layout: Layout,
+ AbsoluteLayout: AbsoluteLayout,
+ Button: Button,
+ ButtonGroup: ButtonGroup,
+ Checkbox: Checkbox,
+ ComboBox: ComboBox,
+ ColorBox: ColorBox,
+ PanelButton: PanelButton,
+ ColorButton: ColorButton,
+ ColorPicker: ColorPicker,
+ Path: Path,
+ ElementPath: ElementPath,
+ FormItem: FormItem,
+ Form: Form,
+ FieldSet: FieldSet,
+ FilePicker: FilePicker,
+ FitLayout: FitLayout,
+ FlexLayout: FlexLayout,
+ FlowLayout: FlowLayout,
+ FormatControls: $_94fs8fvxjfuw8sn0,
+ GridLayout: GridLayout,
+ Iframe: Iframe$1,
+ InfoBox: InfoBox,
+ Label: Label,
+ Toolbar: Toolbar$1,
+ MenuBar: MenuBar,
+ MenuButton: MenuButton,
+ MenuItem: MenuItem,
+ Throbber: Throbber,
+ Menu: Menu,
+ ListBox: ListBox,
+ Radio: Radio,
+ ResizeHandle: ResizeHandle,
+ SelectBox: SelectBox,
+ Slider: Slider,
+ Spacer: Spacer,
+ SplitButton: SplitButton,
+ StackLayout: StackLayout,
+ TabPanel: TabPanel,
+ TextBox: TextBox,
+ DropZone: DropZone,
+ BrowseButton: BrowseButton
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- ThemeManager.add('modern', function (editor) {
- return {
- renderUI: function (args) {
- return renderUI(editor, this, args);
- },
- resizeTo: function (w, h) {
- return Resize.resizeTo(editor, w, h);
- },
- resizeBy: function (dw, dh) {
- return Resize.resizeBy(editor, dw, dh);
- }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var appendTo = function (target) {
+ if (target.ui) {
+ global$2.each(getApi(), function (ref, key) {
+ target.ui[key] = ref;
+ });
+ } else {
+ target.ui = getApi();
+ }
+ };
+ var registerToFactory = function () {
+ global$2.each(getApi(), function (ref, key) {
+ global$4.add(key, ref);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var Api = {
+ appendTo: appendTo,
+ registerToFactory: registerToFactory
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return function () {
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Api.registerToFactory();
+ Api.appendTo(window.tinymce ? window.tinymce : {});
+ global.add('modern', function (editor) {
+ $_94fs8fvxjfuw8sn0.setup(editor);
+ return $_cf5qtqsrjfuw8sbf.get(editor);
+ });
+ function Theme () {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-dem('tinymce.themes.modern.Theme')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Theme;
+
+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcethemesmodernthememinjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/themes/modern/theme.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/themes/modern/theme.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/themes/modern/theme.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1 +1 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("1",window),h("a",tinymce.util.Tools.reso
lve),g("2",["a"],function(a){return a("tinymce.AddOnManager")}),g("3",["a"],function(a){return a("tinymce.EditorManager")}),g("4",["a"],function(a){return a("tinymce.Env")}),g("5",["a"],function(a){return a("tinymce.ui.Api")}),g("b",["a"],function(a){return a("tinymce.dom.DOMUtils")}),g("c",["a"],function(a){return a("tinymce.ui.Factory")}),g("d",["a"],function(a){return a("tinymce.util.Tools")}),g("e",[],function(){var a=function(a,b){return function(){var c=a.find(b)[0];c&&c.focus(!0)}},b=function(b,c){b.shortcuts.add("Alt+F9","",a(c,"menubar")),b.shortcuts.add("Alt+F10,F10","",a(c,"toolbar")),b.shortcuts.add("Alt+F11","",a(c,"elementpath")),c.on("cancel",fun
ction(){b.focus()})};return{addKeys:b}}),g("f",["b"],function(a){var b=a.DOM,c=function(a,c,d){return function(){var e=a.getContentAreaContainer().querySelector("iframe").offsetWidth,f=Math.max(e-a.getDoc().documentElement.offsetWidth,0);b.setStyle(c,"right",f+"px"),d?b.setStyle(c,"top","-16px"):b.setStyle(c,"bottom","1px")}},d=function(a){return function(){b.hide(a)}},e=function(a,b,d){c(a,b,d)(),a.on("NodeChange ResizeEditor",c(a,b,d))},f=function(a,b,c){c.appendChild(b),e(a,b,!0)},g=function(a,b){a.getContainer().appendChild(b),e(a,b,!1)},h=function(a){a.on("SkinLoaded",function(){var c=b.create("div",{"class":"mce-branding-powered-by"}),e=a.getContainer().querySelector(".mce-statusbar");e?f(a,c,e):g(a,c),b.bind(c,"click",d(c))})},i=function(a){a.settings.branding!==!1&&h(a)};return{setup:i}}),g("n",[&quo
t;a"],function(a){return a("tinymce.util.Delay")}),g("o",["a"],function(a){return a("tinymce.geom.Rect")}),g("k",["d","c"],function(a,b){var c="undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",d=function(c,d,e){var f,g=[];if(d)return a.each(d.split(/[ ,]/),function(a){var d,h=function(){var b=c.selection;a.settings.stateSelector&&b.selectorChanged(a.settings.stateSelector,function(b){a.active(b)},!0),a.settings.disabledStateSelector&&b.selectorChanged(a.settings.disabledStateSelector,function(b){a.disabled(b)})};"|"==a?f=null:(f||(f={type:"buttongroup",items:[]},g.push(f)),c.buttons[a]&&(d=a,a=c.buttons[d],"function"==typeof a&&(a=a()),a.type=a.type||"button",a.size=e,a=b.create(a),f.items.push(a),c.initialized?h():c.on("init",h)))}),{t
ype:"toolbar",layout:"flow",items:g}},e=function(b,e){var f=[],g=b.settings,h=function(a){if(a)return f.push(d(b,a,e)),!0};if(a.isArray(g.toolbar)){if(0===g.toolbar.length)return;a.each(g.toolbar,function(a,b){g["toolbar"+(b+1)]=a}),delete g.toolbar}for(var i=1;i<10&&h(g["toolbar"+i]);i++);if(f.length||g.toolbar===!1||h(g.toolbar||c),f.length)return{type:"panel",layout:"stack",classes:"toolbar-grp",ariaRoot:!0,ariaRemember:!0,items:f}};return{createToolbar:d,createToolbars:e}}),g("g",["b","d","n","c","o","k"],function(a,b,c,d,e,f){var g=a.DOM,h=function(a){return{left:a.x,top:a.y,width:a.w,height:a.h,right:a.x+a.w,bottom:a.y+a.h}},i=function(a){b.each(a.contextToolbars,function(a){a.panel&&a.panel.hide()})},j=function(a,b){a.moveTo(b.left,b.top)},k=function(a,c,d){c=c?c.substr(0,2):"",b.each({t:"down",b:&qu
ot;up"},function(b,e){a.classes.toggle("arrow-"+b,d(e,c.substr(0,1)))}),b.each({l:"left",r:"right"},function(b,e){a.classes.toggle("arrow-"+b,d(e,c.substr(1,1)))})},l=function(a,b,c,d,e,f){return f=h({x:b,y:c,w:f.w,h:f.h}),a&&(f=a({elementRect:h(d),contentAreaRect:h(e),panelRect:f})),f},m=function(a){var h,m=a.settings,n=function(){return a.contextToolbars||[]},o=function(b){var c,d,e;return c=g.getPos(a.getContentAreaContainer()),d=a.dom.getRect(b),e=a.dom.getRoot(),"BODY"===e.nodeName&&(d.x-=e.ownerDocument.documentElement.scrollLeft||e.scrollLeft,d.y-=e.ownerDocument.documentElement.scrollTop||e.scrollTop),d.x+=c.x,d.y+=c.y,d},p=function(b,c){var d,f,h,n,p,q,r,s,t=m.inline_toolbar_position_handler;if(!a.removed){if(!b||!b.toolbar.panel)return void i(a);r=["bc-tc","tc-bc","tl-bl","bl-tl","tr-br","br-tr"],p=b.toolbar.panel,c&&p.show(),h=o(b.elem
ent),f=g.getRect(p.getEl()),n=g.getRect(a.getContentAreaContainer()||a.getBody()),s=25,"inline"!==g.getStyle(b.element,"display",!0)&&(h.w=b.element.clientWidth,h.h=b.element.clientHeight),a.inline||(n.w=a.getDoc().documentElement.offsetWidth),a.selection.controlSelection.isResizable(b.element)&&h.w<s&&(h=e.inflate(h,0,8)),d=e.findBestRelativePosition(f,h,n,r),h=e.clamp(h,n),d?(q=e.relativePosition(f,h,d),j(p,l(t,q.x,q.y,h,n,f))):(n.h+=f.h,h=e.intersect(n,h),h?(d=e.findBestRelativePosition(f,h,n,["bc-tc","bl-tl","br-tr"]),d?(q=e.relativePosition(f,h,d),j(p,l(t,q.x,q.y,h,n,f))):j(p,l(t,h.x,h.y,h,n,f))):p.hide()),k(p,d,function(a,b){return a===b})}},q=function(b){return function(){var d=function(){a.selection&&p(u(a.selection.getNode()),b)};c.requestAnimationFrame(d)}},r=function(){h||(h=a.selection.getScrollContainer()||a.getWin(),g.bind(h,"scroll",q(!0)),a.on("remove",function(){
g.unbind(h,"scroll")}))},s=function(b){var c;return b.toolbar.panel?(b.toolbar.panel.show(),void p(b)):(r(),c=d.create({type:"floatpanel",role:"dialog",classes:"tinymce tinymce-inline arrow",ariaLabel:"Inline toolbar",layout:"flex",direction:"column",align:"stretch",autohide:!1,autofix:!0,fixed:!0,border:1,items:f.createToolbar(a,b.toolbar.items),oncancel:function(){a.focus()}}),b.toolbar.panel=c,c.renderTo(document.body).reflow(),void p(b))},t=function(){b.each(n(),function(a){a.panel&&a.panel.hide()})},u=function(b){var c,d,e,f=n();for(e=a.$(b).parents().add(b),c=e.length-1;c>=0;c--)for(d=f.length-1;d>=0;d--)if(f[d].predicate(e[c]))return{toolbar:f[d],element:e[c]};return null};a.on("click keyup setContent ObjectResized",function(b){("setcontent"!==b.type||b.selection)&&c.setEditorTimeout(a,function(){var b;b=u(a.selection.getNode()),b?(t(),s(b)):t()})}),a.on(&
quot;blur hide contextmenu",t),a.on("ObjectResizeStart",function(){var b=u(a.selection.getNode());b&&b.toolbar.panel&&b.toolbar.panel.hide()}),a.on("ResizeEditor ResizeWindow",q(!0)),a.on("nodeChange",q(!1)),a.on("remove",function(){b.each(n(),function(a){a.panel&&a.panel.remove()}),a.contextToolbars={}}),a.shortcuts.add("ctrl+shift+e > ctrl+shift+p","",function(){var b=u(a.selection.getNode());b&&b.toolbar.panel&&b.toolbar.panel.items()[0].focus()})};return{addContextualToolbars:m}}),g("h",["d"],function(a){var b={file:{title:"File",items:"newdocument"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall"},insert:{title:"Insert",items:"|"},view:{title:"View",items:"visualaid |"},format:{title:"Format",items:"bold italic underline strikethro
ugh superscript subscript | formats | removeformat"},table:{title:"Table"},tools:{title:"Tools"}},c=function(a,b){var c;return"|"==b?{text:"|"}:c=a[b]},d=function(d,e,f){var g,h,i,j,k;if(k=a.makeMap((e.removed_menuitems||"").split(/[ ,]/)),e.menu?(h=e.menu[f],j=!0):h=b[f],h){g={text:h.title},i=[],a.each((h.items||"").split(/[ ,]/),function(a){var b=c(d,a);b&&!k[a]&&i.push(c(d,a))}),j||a.each(d,function(a){a.context==f&&("before"==a.separator&&i.push({text:"|"}),a.prependToContext?i.unshift(a):i.push(a),"after"==a.separator&&i.push({text:"|"}))});for(var l=0;l<i.length;l++)"|"==i[l].text&&(0!==l&&l!=i.length-1||i.splice(l,1));if(g.menu=i,!g.menu.length)return null}return g},e=function(a){var c,e=[],f=a.settings,g=[];if(f.menu)for(c in f.menu)g.push(c);else for(c in b)g.push(c);for(var h="string"==typeof
f.menubar?f.menubar.split(/[ ,]/):g,i=0;i<h.length;i++){var j=h[i];j=d(a.menuItems,a.settings,j),j&&e.push(j)}return e};return{createMenuButtons:e}}),g("9",["b"],function(a){var b=a.DOM,c=function(a){return{width:a.clientWidth,height:a.clientHeight}},d=function(a,d,e){var f,g,h,i,j=a.settings;f=a.getContainer(),g=a.getContentAreaContainer().firstChild,h=c(f),i=c(g),null!==d&&(d=Math.max(j.min_width||100,d),d=Math.min(j.max_width||65535,d),b.setStyle(f,"width",d+(h.width-i.width)),b.setStyle(g,"width",d)),e=Math.max(j.min_height||100,e),e=Math.min(j.max_height||65535,e),b.setStyle(g,"height",e),a.fire("ResizeEditor")},e=function(a,b,c){var e=a.getContentAreaContainer();d(a,e.clientWidth+b,e.clientHeight+c)};return{resizeTo:d,resizeBy:e}}),g("i",["d","c","4"],function(a,b,c){var d=function(a){return{element:function(){return a}}},e=function(a,b,c){var e=a.settings[c]
;e&&e(d(b.getEl("body")))},f=function(b,c,d){a.each(d,function(a){var d=c.items().filter("#"+a.name)[0];d&&d.visible()&&a.name!==b&&(e(a,d,"onhide"),d.visible(!1))})},g=function(a){a.items().each(function(a){a.active(!1)})},h=function(b,c){return a.grep(b,function(a){return a.name===c})[0]},i=function(a,c,d){return function(i){var j=i.control,k=j.parents().filter("panel")[0],l=k.find("#"+c)[0],m=h(d,c);f(c,k,d),g(j.parent()),l&&l.visible()?(e(m,l,"onhide"),l.hide(),j.active(!1)):(l?(l.show(),e(m,l,"onshow")):(l=b.create({type:"container",name:c,layout:"stack",classes:"sidebar-panel",html:""}),k.prepend(l),e(m,l,"onrender"),e(m,l,"onshow")),j.active(!0)),a.fire("ResizeEditor")}},j=function(){return!c.ie||c.ie>=11},k=function(a){return!(!j()||!a.sidebars)&&a.sidebars.length>0},l=function(b){var
c=a.map(b.sidebars,function(a){var c=a.settings;return{type:"button",icon:c.icon,image:c.image,tooltip:c.tooltip,onclick:i(b,a.name,b.sidebars)}});return{type:"panel",name:"sidebar",layout:"stack",classes:"sidebar",items:[{type:"toolbar",layout:"stack",classes:"sidebar-toolbar",items:c}]}};return{hasSidebar:k,createSidebar:l}}),g("j",[],function(){var a=function(a){var b=function(){a._skinLoaded=!0,a.fire("SkinLoaded")};return function(){a.initialized?b():a.on("init",b)}};return{fireSkinLoaded:a}}),g("6",["b","c","d","e","f","g","h","9","i","j","k"],function(a,b,c,d,e,f,g,h,i,j,k){var l=a.DOM,m=function(a){return function(b){a.find("*").disabled("readonly"===b.mode)}},n=function(a){return{type:"panel",name:"iframe",l
ayout:"stack",classes:"edit-area",border:a,html:""}},o=function(a){return{type:"panel",layout:"stack",classes:"edit-aria-container",border:"1 0 0 0",items:[n("0"),i.createSidebar(a)]}},p=function(a,c,p){var q,r,s,t=a.settings;return p.skinUiCss&&l.styleSheetLoader.load(p.skinUiCss,j.fireSkinLoaded(a)),q=c.panel=b.create({type:"panel",role:"application",classes:"tinymce",style:"visibility: hidden",layout:"stack",border:1,items:[t.menubar===!1?null:{type:"menubar",border:"0 0 1 0",items:g.createMenuButtons(a)},k.createToolbars(a,t.toolbar_items_size),i.hasSidebar(a)?o(a):n("1 0 0 0")]}),t.resize!==!1&&(r={type:"resizehandle",direction:t.resize,onResizeStart:function(){var b=a.getContentAreaContainer().firstChild;s={width:b.clientWidth,height:b.clientHeight}},onResize:function(b){"both"===t.re
size?h.resizeTo(a,s.width+b.deltaX,s.height+b.deltaY):h.resizeTo(a,null,s.height+b.deltaY)}}),t.statusbar!==!1&&q.add({type:"panel",name:"statusbar",classes:"statusbar",layout:"flow",border:"1 0 0 0",ariaRoot:!0,items:[{type:"elementpath",editor:a},r]}),a.fire("BeforeRenderUI"),a.on("SwitchMode",m(q)),q.renderBefore(p.targetNode).reflow(),t.readonly&&a.setMode("readonly"),p.width&&l.setStyle(q.getEl(),"width",p.width),a.on("remove",function(){q.remove(),q=null}),d.addKeys(a,q),f.addContextualToolbars(a),e.setup(a),{iframeContainer:q.find("#iframe")[0].getEl(),editorContainer:q.getEl()}};return{render:p}}),g("l",["a"],function(a){return a("tinymce.ui.FloatPanel")}),g("7",["d","c","b","l","k","h","g","e","j"],functi
on(a,b,c,d,e,f,g,h,i){var j=function(a,j,k){var l,m,n=a.settings,o=c.DOM;n.fixed_toolbar_container&&(m=o.select(n.fixed_toolbar_container)[0]);var p=function(){if(l&&l.moveRel&&l.visible()&&!l._fixed){var b=a.selection.getScrollContainer(),c=a.getBody(),d=0,e=0;if(b){var f=o.getPos(c),g=o.getPos(b);d=Math.max(0,g.x-f.x),e=Math.max(0,g.y-f.y)}l.fixed(!1).moveRel(c,a.rtl?["tr-br","br-tr"]:["tl-bl","bl-tl","tr-br"]).moveBy(d,e)}},q=function(){l&&(l.show(),p(),o.addClass(a.getBody(),"mce-edit-focus"))},r=function(){l&&(l.hide(),d.hideAll(),o.removeClass(a.getBody(),"mce-edit-focus"))},s=function(){return l?void(l.visible()||q()):(l=j.panel=b.create({type:m?"panel":"floatpanel",role:"application",classes:"tinymce tinymce-inline",layout:"flex",direction:"column",align:"stretch",autohide:!1,autofix:!0,fix
ed:!!m,border:1,items:[n.menubar===!1?null:{type:"menubar",border:"0 0 1 0",items:f.createMenuButtons(a)},e.createToolbars(a,n.toolbar_items_size)]}),a.fire("BeforeRenderUI"),l.renderTo(m||document.body).reflow(),h.addKeys(a,l),q(),g.addContextualToolbars(a),a.on("nodeChange",p),a.on("activate",q),a.on("deactivate",r),void a.nodeChanged())};return n.content_editable=!0,a.on("focus",function(){k.skinUiCss?o.styleSheetLoader.load(k.skinUiCss,s,s):s()}),a.on("blur hide",r),a.on("remove",function(){l&&(l.remove(),l=null)}),k.skinUiCss&&o.styleSheetLoader.load(k.skinUiCss,i.fireSkinLoaded(a)),{}};return{render:j}}),g("m",["a"],function(a){return a("tinymce.ui.Throbber")}),g("8",["m"],function(a){var b=function(b,c){var d;b.on("ProgressState",function(b){d=d||new a(c.panel.getEl("body")),b.state?d.show(b.time):d.hid
e()})};return{setup:b}}),g("0",["1","2","3","4","5","6","7","8","9"],function(a,b,c,d,e,f,g,h,i){var j=b.ThemeManager;e.appendTo(a.tinymce?a.tinymce:{});var k=function(a,b,d){var e=a.settings,i=e.skin!==!1&&(e.skin||"lightgray");if(i){var j=e.skin_url;j=j?a.documentBaseURI.toAbsolute(j):c.baseURL+"/skins/"+i,d.skinUiCss=j+"/skin.min.css",a.contentCSS.push(j+"/content"+(a.inline?".inline":"")+".min.css")}return h.setup(a,b),e.inline?g.render(a,b,d):f.render(a,b,d)};return j.add("modern",function(a){return{renderUI:function(b){return k(a,this,b)},resizeTo:function(b,c){return i.resizeTo(a,b,c)},resizeBy:function(b,c){return i.resizeBy(a,b,c)}}}),function(){}}),d("0")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+!function(){"use strict";var e,t,n,i,r,o=tinymce.util.Tools.resolve("tinymce.ThemeManager"),l=tinymce.util.Tools.resolve("tinymce.EditorManager"),w=tinymce.util.Tools.resolve("tinymce.util.Tools"),d=function(e){return!1!==c(e)},c=function(e){return e.getParam("menubar")},f=function(e){return e.getParam("toolbar_items_size")},h=function(e){return e.getParam("menu")},m=function(e){return!1===e.settings.skin},g=function(e){var t=e.getParam("resize","vertical");return!1===t?"none":"both"===t?"both":"vertical"},p=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),v=tinymce.util.Tools.resolve("tinymce.ui.Factory"),b=tinymce.util.Tools.resolve("tinymce.util.I18n"),s=function(e){return e.fire("SkinLoaded")},y=function(e){return
e.fire("ResizeEditor")},x=function(e){return e.fire("BeforeRenderUI")},a=function(t,n){return function(){var e=t.find(n)[0];e&&e.focus(!0)}},_=function(e,t){e.shortcuts.add("Alt+F9","",a(t,"menubar")),e.shortcuts.add("Alt+F10,F10","",a(t,"toolbar")),e.shortcuts.add("Alt+F11","",a(t,"elementpath")),t.on("cancel",function(){e.focus()})},R=tinymce.util.Tools.resolve("tinymce.geom.Rect"),u=tinymce.util.Tools.resolve("tinymce.util.Delay"),C=function(e){return function(){return e}},k={noop:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},noarg:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n()}},compose:function(n,i){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(i.apply(null,arguments))}},constant:C,identity:function(e){return e
},tripleEquals:function(e,t){return e===t},curry:function(o){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var s=new Array(arguments.length-1),n=1;n<arguments.length;n++)s[n-1]=arguments[n];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];var r=s.concat(n);return o.apply(null,r)}},not:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,arguments)}},die:function(e){return function(){throw new Error(e)}},apply:function(e){return e()},call:function(e){e()},never:C(!1),always:C(!0)},E=k.never,H=k.always,S=function(){return M},M=(i={fold:function(e,t){return e()},is:E,isSome:E,isNone:H,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},or:n,orThunk:t,map:S,ap:S,each:function(){},bind:S,flatten:S,exis
ts:E,forall:H,filter:S,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:k.constant("none()")},Object.freeze&&Object.freeze(i),i),T=function(n){var e=function(){return n},t=function(){return r},i=function(e){return e(n)},r={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:H,isNone:E,getOr:e,getOrThunk:e,getOrDie:e,or:t,orThunk:t,map:function(e){return T(e(n))},ap:function(e){return e.fold(S,function(e){return T(e(n))})},each:function(e){e(n)},bind:i,flatten:e,exists:i,forall:i,filter:function(e){return e(n)?r:M},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(E,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return r},P={some:T,none:S,from:function(e){return null===e||e===undefined?M:T(e)}},W=function(e){return e?e.getRoot().uiContainer:null},D={getUiContainerDelta:function(e){var t=W(e);if(t&&"static&
quot;!==p.DOM.getStyle(t,"position",!0)){var n=p.DOM.getPos(t),i=t.scrollLeft-n.x,r=t.scrollTop-n.y;return P.some({x:i,y:r})}return P.none()},setUiContainer:function(e,t){var n=p.DOM.select(e.settings.ui_container)[0];t.getRoot().uiContainer=n},getUiContainer:W,inheritUiContainer:function(e,t){return t.uiContainer=W(e)}},N=function(i,e,r){var o,s=[];if(e)return w.each(e.split(/[ ,]/),function(t){var e,n=function(){var e=i.selection;t.settings.stateSelector&&e.selectorChanged(t.settings.stateSelector,function(e){t.active(e)},!0),t.settings.disabledStateSelector&&e.selectorChanged(t.settings.disabledStateSelector,function(e){t.disabled(e)})};"|"===t?o=null:(o||(o={type:"buttongroup",items:[]},s.push(o)),i.buttons[t]&&(e=t,"function"==typeof(t=i.buttons[e])&&(t=t()),t.type=t.type||"button",t.size=r,t=v.create(t),o.items.push(t),i.initialized?n():i.on("init",n)))}),{type:"toolbar",layou
t:"flow",items:s}},A=N,B=function(n,i){var e,t,r=[];if(w.each(!1===(t=(e=n).getParam("toolbar"))?[]:w.isArray(t)?w.grep(t,function(e){return 0<e.length}):function(e,t){for(var n=[],i=1;i<10;i++){var r=e["toolbar"+i];if(!r)break;n.push(r)}var o=e.toolbar?[e.toolbar]:[t];return 0<n.length?n:o}(e.settings,"undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"),function(e){var t;(t=e)&&r.push(N(n,t,i))}),r.length)return{type:"panel",layout:"stack",classes:"toolbar-grp",ariaRoot:!0,ariaRemember:!0,items:r}},O=p.DOM,z=function(e){return{left:e.x,top:e.y,width:e.w,height:e.h,right:e.x+e.w,bottom:e.y+e.h}},L=function(e,t){e.moveTo(t.left,t.top)},I=function(e,t,n,i,r,o){return o=z({x:t,y:n,w:o.w,h:o.h}),e&&(o=e({elementRect:z(i),contentAreaRect:z(r),panelRect:o})),o},F=function(x){var i,o=function(){return x.contextToolb
ars||[]},n=function(e,t){var n,i,r,o,s,a,l,u=x.getParam("inline_toolbar_position_handler");if(!x.removed){if(!e||!e.toolbar.panel)return c=x,void w.each(c.contextToolbars,function(e){e.panel&&e.panel.hide()});var c,d,f,h,m;l=["bc-tc","tc-bc","tl-bl","bl-tl","tr-br","br-tr"],s=e.toolbar.panel,t&&s.show(),d=e.element,f=O.getPos(x.getContentAreaContainer()),h=x.dom.getRect(d),"BODY"===(m=x.dom.getRoot()).nodeName&&(h.x-=m.ownerDocument.documentElement.scrollLeft||m.scrollLeft,h.y-=m.ownerDocument.documentElement.scrollTop||m.scrollTop),h.x+=f.x,h.y+=f.y,r=h,i=O.getRect(s.getEl()),o=O.getRect(x.getContentAreaContainer()||x.getBody());var g,p,v,b=D.getUiContainerDelta(s).getOr({x:0,y:0});if(r.x+=b.x,r.y+=b.y,i.x+=b.x,i.y+=b.y,o.x+=b.x,o.y+=b.y,"inline"!==O.getStyle(e.element,"display",!0)){var y=e.element.getBoundingClientRect();r.w=y.width,r.h=y.height}x.inline||(o
.w=x.getDoc().documentElement.offsetWidth),x.selection.controlSelection.isResizable(e.element)&&r.w<25&&(r=R.inflate(r,0,8)),n=R.findBestRelativePosition(i,r,o,l),r=R.clamp(r,o),n?(a=R.relativePosition(i,r,n),L(s,I(u,a.x,a.y,r,o,i))):(o.h+=i.h,(r=R.intersect(o,r))?(n=R.findBestRelativePosition(i,r,o,["bc-tc","bl-tl","br-tr"]))?(a=R.relativePosition(i,r,n),L(s,I(u,a.x,a.y,r,o,i))):L(s,I(u,r.x,r.y,r,o,i)):s.hide()),g=s,v=function(e,t){return e===t},p=(p=n)?p.substr(0,2):"",w.each({t:"down",b:"up"},function(e,t){g.classes.toggle("arrow-"+e,v(t,p.substr(0,1)))}),w.each({l:"left",r:"right"},function(e,t){g.classes.toggle("arrow-"+e,v(t,p.substr(1,1)))})}},r=function(e){return function(){u.requestAnimationFrame(function(){x.selection&&n(a(x.selection.getNode()),e)})}},t=function(e){var t;if(e.toolbar.panel)return e.toolbar.panel.show(),void n(e);t=v.create({type:&
quot;floatpanel",role:"dialog",classes:"tinymce tinymce-inline arrow",ariaLabel:"Inline toolbar",layout:"flex",direction:"column",align:"stretch",autohide:!1,autofix:!0,fixed:!0,border:1,items:A(x,e.toolbar.items),oncancel:function(){x.focus()}}),D.setUiContainer(x,t),function(e){if(!i){var t=r(!0),n=D.getUiContainer(e);i=x.selection.getScrollContainer()||x.getWin(),O.bind(i,"scroll",t),O.bind(n,"scroll",t),x.on("remove",function(){O.unbind(i,"scroll",t),O.unbind(n,"scroll",t)})}}(t),(e.toolbar.panel=t).renderTo().reflow(),n(e)},s=function(){w.each(o(),function(e){e.panel&&e.panel.hide()})},a=function(e){var t,n,i,r=o();for(t=(i=x.$(e).parents().add(e)).length-1;0<=t;t--)for(n=r.length-1;0<=n;n--)if(r[n].predicate(i[t]))return{toolbar:r[n],element:i[t]};return null};x.on("click keyup setContent ObjectResized",function(e){("setcontent"!=
=e.type||e.selection)&&u.setEditorTimeout(x,function(){var e;(e=a(x.selection.getNode()))?(s(),t(e)):s()})}),x.on("blur hide contextmenu",s),x.on("ObjectResizeStart",function(){var e=a(x.selection.getNode());e&&e.toolbar.panel&&e.toolbar.panel.hide()}),x.on("ResizeEditor ResizeWindow",r(!0)),x.on("nodeChange",r(!1)),x.on("remove",function(){w.each(o(),function(e){e.panel&&e.panel.remove()}),x.contextToolbars={}}),x.shortcuts.add("ctrl+shift+e > ctrl+shift+p","",function(){var e=a(x.selection.getNode());e&&e.toolbar.panel&&e.toolbar.panel.items()[0].focus()})},U=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(e)===t}},V={isString:U("st
ring"),isObject:U("object"),isArray:U("array"),isNull:U("null"),isBoolean:U("boolean"),isUndefined:U("undefined"),isFunction:U("function"),isNumber:U("number")},j=(r=Array.prototype.indexOf)===undefined?function(e,t){return K(e,t)}:function(e,t){return r.call(e,t)},q=function(e,t){return-1<j(e,t)},Y=function(e,t){for(var n=e.length,i=new Array(n),r=0;r<n;r++){var o=e[r];i[r]=t(o,r,e)}return i},$=function(e,t){for(var n=0,i=e.length;n<i;n++)t(e[n],n,e)},X=function(e,t){for(var n=e.length-1;0<=n;n--)t(e[n],n,e)},J=function(e,t){for(var n=[],i=0,r=e.length;i<r;i++){var o=e[i];t(o,i,e)&&n.push(o)}return n},G=function(e,t){for(var n=0,i=e.length;n<i;n++)if(t(e[n],n,e))return P.some(n);return P.none()},K=function(e,t){for(var n=0,i=e.length;n<i;++n)if(e[n]===t)return n;return-1},Z=Array.prototype.push,Q=function(e){for(var t=[],n=0,i=e.length;n<i;++n){if(!Array.prototype.isPrototypeO
f(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);Z.apply(t,e[n])}return t},ee=function(e,t){for(var n=0,i=e.length;n<i;++n)if(!0!==t(e[n],n,e))return!1;return!0},te=Array.prototype.slice,ne=V.isFunction(Array.from)?Array.from:function(e){return te.call(e)},ie={map:Y,each:$,eachr:X,partition:function(e,t){for(var n=[],i=[],r=0,o=e.length;r<o;r++){var s=e[r];(t(s,r,e)?n:i).push(s)}return{pass:n,fail:i}},filter:J,groupBy:function(e,t){if(0===e.length)return[];for(var n=t(e[0]),i=[],r=[],o=0,s=e.length;o<s;o++){var a=e[o],l=t(a);l!==n&&(i.push(r),r=[]),n=l,r.push(a)}return 0!==r.length&&i.push(r),i},indexOf:function(e,t){var n=j(e,t);return-1===n?P.none():P.some(n)},foldr:function(e,t,n){return X(e,function(e){n=t(n,e)}),n},foldl:function(e,t,n){return $(e,function(e){n=t(n,e)}),n},find:function(e,t){for(var n=0,i=e.length;n<i;n++){var r=e[n];if(t(r,n,e))return P.some(r)}return P.none()},findIndex:G,flatten:Q,b
ind:function(e,t){var n=Y(e,t);return Q(n)},forall:ee,exists:function(e,t){return G(e,t).isSome()},contains:q,equal:function(e,n){return e.length===n.length&&ee(e,function(e,t){return e===n[t]})},reverse:function(e){var t=te.call(e,0);return t.reverse(),t},chunk:function(e,t){for(var n=[],i=0;i<e.length;i+=t){var r=e.slice(i,i+t);n.push(r)}return n},difference:function(e,t){return J(e,function(e){return!q(t,e)})},mapToObject:function(e,t){for(var n={},i=0,r=e.length;i<r;i++){var o=e[i];n[String(o)]=t(o,i)}return n},pure:function(e){return[e]},sort:function(e,t){var n=te.call(e,0);return n.sort(t),n},range:function(e,t){for(var n=[],i=0;i<e;i++)n.push(t(i));return n},head:function(e){return 0===e.length?P.none():P.some(e[0])},last:function(e){return 0===e.length?P.none():P.some(e[e.length-1])},from:ne},re={file:{title:"File",items:"newdocument restoredraft | preview | print"},edit:{title:"Edit",items:"undo redo | cut copy paste past
etext | selectall"},view:{title:"View",items:"code | visualaid visualchars visualblocks | spellchecker | preview fullscreen"},insert:{title:"Insert",items:"image link media template codesample inserttable | charmap hr | pagebreak nonbreaking anchor toc | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | blockformats align | removeformat"},tools:{title:"Tools",items:"spellchecker spellcheckerlanguage | a11ycheck"},table:{title:"Table"},help:{title:"Help"}},oe=function(e,t){return"|"===e?{name:"|",item:{text:"|"}}:t?{name:e,item:t}:null},se=function(e){return e&&"|"===e.item.text},ae=function(n,e,t,r){var i,o,s,a,l,u,c,d;return e?(o=e[r],a=!0):o=re[r],o&&(i={text:o.title},s=[],w.each((o.items||"").split(/[ ,]/),function(e){var t=oe(e,n[e]);t&&
;s.push(t)}),a||w.each(n,function(e,t){var n,i;e.context!==r||(n=s,i=t,ie.findIndex(n,function(e){return e.name===i}).isSome())||("before"===e.separator&&s.push({name:"|",item:{text:"|"}}),e.prependToContext?s.unshift(oe(t,e)):s.push(oe(t,e)),"after"===e.separator&&s.push({name:"|",item:{text:"|"}}))}),i.menu=ie.map((l=s,u=t,c=ie.filter(l,function(e){return!1===u.hasOwnProperty(e.name)}),d=ie.filter(c,function(e,t,n){return!se(e)||!se(n[t-1])}),ie.filter(d,function(e,t,n){return!se(e)||0<t&&t<n.length-1})),function(e){return e.item}),!i.menu.length)?null:i},le=function(e){for(var t,n=[],i=function(e){var t,n=[],i=h(e);if(i)for(t in i)n.push(t);else for(t in re)n.push(t);return n}(e),r=w.makeMap((t=e,t.getParam("removed_menuitems","")).split(/[ ,]/)),o=c(e),s="string"==typeof o?o.split(/[ ,]/):i,a=0;a<s.length;a++){var l=s[a],u=ae(e.menuItems,h(e),r,l);u&&
;n.push(u)}return n},ue=p.DOM,ce=function(e){return{width:e.clientWidth,height:e.clientHeight}},de=function(e,t,n){var i,r,o,s;i=e.getContainer(),r=e.getContentAreaContainer().firstChild,o=ce(i),s=ce(r),null!==t&&(t=Math.max(e.getParam("min_width",100,"number"),t),t=Math.min(e.getParam("max_width",65535,"number"),t),ue.setStyle(i,"width",t+(o.width-s.width)),ue.setStyle(r,"width",t)),n=Math.max(e.getParam("min_height",100,"number"),n),n=Math.min(e.getParam("max_height",65535,"number"),n),ue.setStyle(r,"height",n),y(e)},fe=de,he=function(e,t,n){var i=e.getContentAreaContainer();de(e,i.clientWidth+t,i.clientHeight+n)},me=tinymce.util.Tools.resolve("tinymce.Env"),ge=function(e,t,n){var i,r=e.settings[n];r&&r((i=t.getEl("body"),{element:function(){return i}}))},pe=function(c,d,f){return function(e){var t,n,i,r,o,s=e.control,a=s.parents().filte
r("panel")[0],l=a.find("#"+d)[0],u=(t=f,n=d,w.grep(t,function(e){return e.name===n})[0]);i=d,r=a,o=f,w.each(o,function(e){var t=r.items().filter("#"+e.name)[0];t&&t.visible()&&e.name!==i&&(ge(e,t,"onhide"),t.visible(!1))}),s.parent().items().each(function(e){e.active(!1)}),l&&l.visible()?(ge(u,l,"onhide"),l.hide(),s.active(!1)):(l?l.show():(l=v.create({type:"container",name:d,layout:"stack",classes:"sidebar-panel",html:""}),a.prepend(l),ge(u,l,"onrender")),ge(u,l,"onshow"),s.active(!0)),y(c)}},ve=function(e){return!(me.ie&&!(11<=me.ie)||!e.sidebars)&&0<e.sidebars.length},be=function(n){return{type:"panel",name:"sidebar",layout:"stack",classes:"sidebar",items:[{type:"toolbar",layout:"stack",classes:"sidebar-toolbar",items:w.map(n.sidebars,function(e){var
t=e.settings;return{type:"button",icon:t.icon,image:t.image,tooltip:t.tooltip,onclick:pe(n,e.name,n.sidebars)}})}]}},ye=function(e){var t=function(){e._skinLoaded=!0,s(e)};return function(){e.initialized?t():e.on("init",t)}},xe=p.DOM,we=function(e){return{type:"panel",name:"iframe",layout:"stack",classes:"edit-area",border:e,html:""}},_e=function(t,e,n){var i,r,o,s,a;if(!1===m(t)&&n.skinUiCss?xe.styleSheetLoader.load(n.skinUiCss,ye(t)):ye(t)(),i=e.panel=v.create({type:"panel",role:"application",classes:"tinymce",style:"visibility: hidden",layout:"stack",border:1,items:[{type:"container",classes:"top-part",items:[!1===d(t)?null:{type:"menubar",border:"0 0 1 0",items:le(t)},B(t,f(t))]},ve(t)?(s=t,{type:"panel",layout:"stack",classes:"edit-aria-container",border:"1 0 0 0",items:[w
e("0"),be(s)]}):we("1 0 0 0")]}),D.setUiContainer(t,i),"none"!==g(t)&&(r={type:"resizehandle",direction:g(t),onResizeStart:function(){var e=t.getContentAreaContainer().firstChild;o={width:e.clientWidth,height:e.clientHeight}},onResize:function(e){"both"===g(t)?fe(t,o.width+e.deltaX,o.height+e.deltaY):fe(t,null,o.height+e.deltaY)}}),t.getParam("statusbar",!0,"boolean")){var l=b.translate(["Powered by {0}",'<a href="https://www.tinymce.com/?utm_campaign=editor_referral&utm_medium=poweredby&utm_source=tinymce" rel="noopener" target="_blank" role="presentation" tabindex="-1">tinymce</a>']),u=t.getParam("branding",!0,"boolean")?{type:"label",classes:"branding",html:" "+l}:null;i.add({type:"panel",name:"statusbar",classes:"statusbar",layout:"flow&quo
t;,border:"1 0 0 0",ariaRoot:!0,items:[{type:"elementpath",editor:t},r,u]})}return x(t),t.on("SwitchMode",(a=i,function(e){a.find("*").disabled("readonly"===e.mode)})),i.renderBefore(n.targetNode).reflow(),t.getParam("readonly",!1,"boolean")&&t.setMode("readonly"),n.width&&xe.setStyle(i.getEl(),"width",n.width),t.on("remove",function(){i.remove(),i=null}),_(t,i),F(t),{iframeContainer:i.find("#iframe")[0].getEl(),editorContainer:i.getEl()}},Re=tinymce.util.Tools.resolve("tinymce.dom.DomQuery"),Ce=0,ke={id:function(){return"mceu_"+Ce++},create:function(e,t,n){var i=document.createElement(e);return p.DOM.setAttribs(i,t),"string"==typeof n?i.innerHTML=n:w.each(n,function(e){e.nodeType&&i.appendChild(e)}),i},createFragment:function(e){return p.DOM.createFragment(e)},getWindowSize:function(){return p.DOM.getViewPort()},getSize:
function(e){var t,n;if(e.getBoundingClientRect){var i=e.getBoundingClientRect();t=Math.max(i.width||i.right-i.left,e.offsetWidth),n=Math.max(i.height||i.bottom-i.bottom,e.offsetHeight)}else t=e.offsetWidth,n=e.offsetHeight;return{width:t,height:n}},getPos:function(e,t){return p.DOM.getPos(e,t||ke.getContainer())},getContainer:function(){return me.container?me.container:document.body},getViewPort:function(e){return p.DOM.getViewPort(e)},get:function(e){return document.getElementById(e)},addClass:function(e,t){return p.DOM.addClass(e,t)},removeClass:function(e,t){return p.DOM.removeClass(e,t)},hasClass:function(e,t){return p.DOM.hasClass(e,t)},toggleClass:function(e,t,n){return p.DOM.toggleClass(e,t,n)},css:function(e,t,n){return p.DOM.setStyle(e,t,n)},getRuntimeStyle:function(e,t){return p.DOM.getStyle(e,t,!0)},on:function(e,t,n,i){return p.DOM.bind(e,t,n,i)},off:function(e,t,n){return p.DOM.unbind(e,t,n)},fire:function(e,t,n){return p.DOM.fire(e,t,n)},innerHtml:function(e,t){p.DOM.s
etHTML(e,t)}},Ee=function(e){return"static"===ke.getRuntimeStyle(e,"position")},He=function(e){return e.state.get("fixed")};function Se(e,t,n){var i,r,o,s,a,l,u,c,d,f;return d=Me(),o=(r=ke.getPos(t,D.getUiContainer(e))).x,s=r.y,He(e)&&Ee(document.body)&&(o-=d.x,s-=d.y),i=e.getEl(),a=(f=ke.getSize(i)).width,l=f.height,u=(f=ke.getSize(t)).width,c=f.height,"b"===(n=(n||"").split(""))[0]&&(s+=c),"r"===n[1]&&(o+=u),"c"===n[0]&&(s+=Math.round(c/2)),"c"===n[1]&&(o+=Math.round(u/2)),"b"===n[3]&&(s-=l),"r"===n[4]&&(o-=a),"c"===n[3]&&(s-=Math.round(l/2)),"c"===n[4]&&(o-=Math.round(a/2)),{x:o,y:s,w:a,h:l}}var Me=function(){var e=window,t=Math.max(e.pageXOffset,document.body.scrollLeft,document.documentElement.scrollLeft),n=Math.max(e.pageYOffset,document.body.scrollTop,document.documentE
lement.scrollTop);return{x:t,y:n,w:t+(e.innerWidth||document.documentElement.clientWidth),h:n+(e.innerHeight||document.documentElement.clientHeight)}},Te=function(e){var t,n=D.getUiContainer(e);return n&&!He(e)?{x:0,y:0,w:(t=n).scrollWidth-1,h:t.scrollHeight-1}:Me()},Pe={testMoveRel:function(e,t){for(var n=Te(this),i=0;i<t.length;i++){var r=Se(this,e,t[i]);if(He(this)){if(0<r.x&&r.x+r.w<n.w&&0<r.y&&r.y+r.h<n.h)return t[i]}else if(r.x>n.x&&r.x+r.w<n.w&&r.y>n.y&&r.y+r.h<n.h)return t[i]}return t[0]},moveRel:function(e,t){"string"!=typeof t&&(t=this.testMoveRel(e,t));var n=Se(this,e,t);return this.moveTo(n.x,n.y)},moveBy:function(e,t){var n=this.layoutRect();return this.moveTo(n.x+e,n.y+t),this},moveTo:function(e,t){var n=this;function i(e,t,n){return e<0?0:t<e+n&&(e=t-n)<0?0:e}if(n.settings.constrainToViewport){var r=Te(this),o=n.layoutRect();e=i(e,r.w,o.w),t=i(t,r.h,o.
h)}var s=D.getUiContainer(n);return s&&Ee(s)&&!He(n)&&(e-=s.scrollLeft,t-=s.scrollTop),s&&(e+=1,t+=1),n.state.get("rendered")?n.layoutRect({x:e,y:t}).repaint():(n.settings.x=e,n.settings.y=t),n.fire("move",{x:e,y:t}),n}},We=tinymce.util.Tools.resolve("tinymce.util.Class"),De=tinymce.util.Tools.resolve("tinymce.util.EventDispatcher"),Ne=function(e){var t;if(e)return"number"==typeof e?{top:e=e||0,left:e,bottom:e,right:e}:(1===(t=(e=e.split(" ")).length)?e[1]=e[2]=e[3]=e[0]:2===t?(e[2]=e[0],e[3]=e[1]):3===t&&(e[3]=e[1]),{top:parseInt(e[0],10)||0,right:parseInt(e[1],10)||0,bottom:parseInt(e[2],10)||0,left:parseInt(e[3],10)||0})},Ae=function(i,e){function t(e){var t=parseFloat(function(e){var t=i.ownerDocument.defaultView;if(t){var n=t.getComputedStyle(i,null);return n?(e=e.replace(/[A-Z]/g,function(e){return"-"+e}),n.getPropertyValue(e)):null}return i.currentStyle[e]}(e));return
isNaN(t)?0:t}return{top:t(e+"TopWidth"),right:t(e+"RightWidth"),bottom:t(e+"BottomWidth"),left:t(e+"LeftWidth")}};function Be(){}function Oe(e){this.cls=[],this.cls._map={},this.onchange=e||Be,this.prefix=""}w.extend(Oe.prototype,{add:function(e){return e&&!this.contains(e)&&(this.cls._map[e]=!0,this.cls.push(e),this._change()),this},remove:function(e){if(this.contains(e)){var t=void 0;for(t=0;t<this.cls.length&&this.cls[t]!==e;t++);this.cls.splice(t,1),delete this.cls._map[e],this._change()}return this},toggle:function(e,t){var n=this.contains(e);return n!==t&&(n?this.remove(e):this.add(e),this._change()),this},contains:function(e){return!!this.cls._map[e]},_change:function(){delete this.clsValue,this.onchange.call(this)}}),Oe.prototype.toString=function(){var e;if(this.clsValue)return this.clsValue;e="";for(var t=0;t<this.cls.length;t++)0<t&&(e+=" "),e+=this.pref
ix+this.cls[t];return e};var ze,Le,Ie,Fe=/^([\w\\*]+)?(?:#([\w\-\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i,Ue=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,Ve=/^\s*|\s*$/g,je=We.extend({init:function(e){var o=this.match;function s(e,t,n){var i;function r(e){e&&t.push(e)}return r(function(t){if(t)return t=t.toLowerCase(),function(e){return"*"===t||e.type===t}}((i=Fe.exec(e.replace(Ve,"")))[1])),r(function(t){if(t)return function(e){return e._name===t}}(i[2])),r(function(n){if(n)return n=n.split("."),function(e){for(var t=n.length;t--;)if(!e.classes.contains(n[t]))return!1;return!0}}(i[3])),r(function(n,i,r){if(n)return function(e){var t=e[n]?e[n]():"";return i?"="===i?t===r:"*="===i?0<=t.indexOf(r):"~="===i?0<=(" "+t+" ").indexOf(
" "+r+" "):"!="===i?t!==r:"^="===i?0===t.indexOf(r):"$="===i&&t.substr(t.length-r.length)===r:!!r}}(i[4],i[5],i[6])),r(function(i){var t;if(i)return(i=/(?:not\((.+)\))|(.+)/i.exec(i))[1]?(t=a(i[1],[]),function(e){return!o(e,t)}):(i=i[2],function(e,t,n){return"first"===i?0===t:"last"===i?t===n-1:"even"===i?t%2==0:"odd"===i?t%2==1:!!e[i]&&e[i]()})}(i[7])),t.pseudo=!!i[7],t.direct=n,t}function a(e,t){var n,i,r,o=[];do{if(Ue.exec(""),(i=Ue.exec(e))&&(e=i[3],o.push(i[1]),i[2])){n=i[3];break}}while(i);for(n&&a(n,t),e=[],r=0;r<o.length;r++)">"!==o[r]&&e.push(s(o[r],[],">"===o[r-1]));return t.push(e),t}this._selectors=a(e,[])},match:function(e,t){var n,i,r,o,s,a,l,u,c,d,f,h,m;for(n=0,i=(t=t||this._selectors).length;n<i;n++){for(m=e,h=0,r=(o=(s=t[n]).length)-1;0<=r;r--)for(u=s[r];m;){if(u.pseudo)for(c=d=(f=m.parent().it
ems()).length;c--&&f[c]!==m;);for(a=0,l=u.length;a<l;a++)if(!u[a](m,c,d)){a=l+1;break}if(a===l){h++;break}if(r===o-1)break;m=m.parent()}if(h===o)return!0}return!1},find:function(e){var t,n,u=[],i=this._selectors;function c(e,t,n){var i,r,o,s,a,l=t[n];for(i=0,r=e.length;i<r;i++){for(a=e[i],o=0,s=l.length;o<s;o++)if(!l[o](a,i,r)){o=s+1;break}if(o===s)n===t.length-1?u.push(a):a.items&&c(a.items(),t,n+1);else if(l.direct)return;a.items&&c(a.items(),t,n)}}if(e.items){for(t=0,n=i.length;t<n;t++)c(e.items(),i[t],0);1<n&&(u=function(e){for(var t,n=[],i=e.length;i--;)(t=e[i]).__checked||(n.push(t),t.__checked=1);for(i=n.length;i--;)delete n[i].__checked;return n}(u))}return ze||(ze=je.Collection),new ze(u)}}),qe=Array.prototype.push,Ye=Array.prototype.slice;Ie={length:0,init:function(e){e&&this.add(e)},add:function(e){return w.isArray(e)?qe.apply(this,e):e instanceof Le?this.add(e.toArray()):qe.call(this,e),this},set:function(e){var t,n=
this,i=n.length;for(n.length=0,n.add(e),t=n.length;t<i;t++)delete n[t];return n},filter:function(t){var e,n,i,r,o=[];for("string"==typeof t?(t=new je(t),r=function(e){return t.match(e)}):r=t,e=0,n=this.length;e<n;e++)r(i=this[e])&&o.push(i);return new Le(o)},slice:function(){return new Le(Ye.apply(this,arguments))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},each:function(e){return w.each(this,e),this},toArray:function(){return w.toArray(this)},indexOf:function(e){for(var t=this.length;t--&&this[t]!==e;);return t},reverse:function(){return new Le(w.toArray(this).reverse())},hasClass:function(e){return!!this[0]&&this[0].classes.contains(e)},prop:function(t,n){var e;return n!==undefined?(this.each(function(e){e[t]&&e[t](n)}),this):(e=this[0])&&e[t]?e[t]():void 0},exec:function(t){var n=w.toArray(arguments).slice(1);return this.each(function(e){e[t]&&e[t].apply(e,n)}),this},remove:function(){for(var e=thi
s.length;e--;)this[e].remove();return this},addClass:function(t){return this.each(function(e){e.classes.add(t)})},removeClass:function(t){return this.each(function(e){e.classes.remove(t)})}},w.each("fire on off show hide append prepend before after reflow".split(" "),function(n){Ie[n]=function(){var t=w.toArray(arguments);return this.each(function(e){n in e&&e[n].apply(e,t)}),this}}),w.each("text name disabled active selected checked visible parent value data".split(" "),function(t){Ie[t]=function(e){return this.prop(t,e)}}),Le=We.extend(Ie);var $e=je.Collection=Le,Xe=function(e){this.create=e.create};Xe.create=function(r,o){return new Xe({create:function(t,n){var i,e=function(e){t.set(n,e.value)};return t.on("change:"+n,function(e){r.set(o,e.value)}),r.on("change:"+o,e),(i=t._bindings)||(i=t._bindings=[],t.on("destroy",function(){for(var e=i.length;e--;)i[e]()})),i.push(function(){r.off("change:"
;+o,e)}),r.get(o)}})};var Je=tinymce.util.Tools.resolve("tinymce.util.Observable");function Ge(e){return 0<e.nodeType}var Ke,Ze,Qe=We.extend({Mixins:[Je],init:function(e){var t,n;for(t in e=e||{})(n=e[t])instanceof Xe&&(e[t]=n.create(this,t));this.data=e},set:function(t,n){var i,r,o=this.data[t];if(n instanceof Xe&&(n=n.create(this,t)),"object"==typeof t){for(i in t)this.set(i,t[i]);return this}return function e(t,n){var i,r;if(t===n)return!0;if(null===t||null===n)return t===n;if("object"!=typeof t||"object"!=typeof n)return t===n;if(w.isArray(n)){if(t.length!==n.length)return!1;for(i=t.length;i--;)if(!e(t[i],n[i]))return!1}if(Ge(t)||Ge(n))return t===n;for(i in r={},n){if(!e(t[i],n[i]))return!1;r[i]=!0}for(i in t)if(!r[i]&&!e(t[i],n[i]))return!1;return!0}(o,n)||(this.data[t]=n,r={target:this,name:t,value:n,oldValue:o},this.fire("change:"+t,r),this.fire("change",r)),this},get:function(e){return thi
s.data[e]},has:function(e){return e in this.data},bind:function(e){return Xe.create(this,e)},destroy:function(){this.fire("destroy")}}),et={},tt={add:function(e){var t=e.parent();if(t){if(!t._layout||t._layout.isNative())return;et[t._id]||(et[t._id]=t),Ke||(Ke=!0,u.requestAnimationFrame(function(){var e,t;for(e in Ke=!1,et)(t=et[e]).state.get("rendered")&&t.reflow();et={}},document.body))}},remove:function(e){et[e._id]&&delete et[e._id]}},nt="onmousewheel"in document,it=!1,rt=0,ot={Statics:{classPrefix:"mce-"},isRtl:function(){return Ze.rtl},classPrefix:"mce-",init:function(t){var e,n,i=this;function r(e){var t;for(e=e.split(" "),t=0;t<e.length;t++)i.classes.add(e[t])}i.settings=t=w.extend({},i.Defaults,t),i._id=t.id||"mceu_"+rt++,i._aria={role:t.role},i._elmCache={},i.$=Re,i.state=new Qe({visible:!0,active:!1,disabled:!1,value:""}),i.data=new Qe(t.data),i.classes=new Oe(function(){i.s
tate.get("rendered")&&(i.getEl().className=this.toString())}),i.classes.prefix=i.classPrefix,(e=t.classes)&&(i.Defaults&&(n=i.Defaults.classes)&&e!==n&&r(n),r(e)),w.each("title text name visible disabled active value".split(" "),function(e){e in t&&i[e](t[e])}),i.on("click",function(){if(i.disabled())return!1}),i.settings=t,i.borderBox=Ne(t.border),i.paddingBox=Ne(t.padding),i.marginBox=Ne(t.margin),t.hidden&&i.hide()},Properties:"parent,name",getContainerElm:function(){var e=D.getUiContainer(this);return e||ke.getContainer()},getParentCtrl:function(e){for(var t,n=this.getRoot().controlIdLookup;e&&n&&!(t=n[e.id]);)e=e.parentNode;return t},initLayoutRect:function(){var e,t,n,i,r,o,s,a,l,u,c=this,d=c.settings,f=c.getEl();e=c.borderBox=c.borderBox||Ae(f,"border"),c.paddingBox=c.paddingBox||Ae(f,"padding"),c.marginBox=c.marginBox||Ae(f,"margi
n"),u=ke.getSize(f),a=d.minWidth,l=d.minHeight,r=a||u.width,o=l||u.height,n=d.width,i=d.height,s=void 0!==(s=d.autoResize)?s:!n&&!i,n=n||r,i=i||o;var h=e.left+e.right,m=e.top+e.bottom,g=d.maxWidth||65535,p=d.maxHeight||65535;return c._layoutRect=t={x:d.x||0,y:d.y||0,w:n,h:i,deltaW:h,deltaH:m,contentW:n-h,contentH:i-m,innerW:n-h,innerH:i-m,startMinWidth:a||0,startMinHeight:l||0,minW:Math.min(r,g),minH:Math.min(o,p),maxW:g,maxH:p,autoResize:s,scrollW:0},c._lastLayoutRect={},t},layoutRect:function(e){var t,n,i,r,o,s=this,a=s._layoutRect;return a||(a=s.initLayoutRect()),e?(i=a.deltaW,r=a.deltaH,e.x!==undefined&&(a.x=e.x),e.y!==undefined&&(a.y=e.y),e.minW!==undefined&&(a.minW=e.minW),e.minH!==undefined&&(a.minH=e.minH),(n=e.w)!==undefined&&(n=(n=n<a.minW?a.minW:n)>a.maxW?a.maxW:n,a.w=n,a.innerW=n-i),(n=e.h)!==undefined&&(n=(n=n<a.minH?a.minH:n)>a.maxH?a.maxH:n,a.h=n,a.innerH=n-r),(n=e.innerW)!==undefined&&(n
=(n=n<a.minW-i?a.minW-i:n)>a.maxW-i?a.maxW-i:n,a.innerW=n,a.w=n+i),(n=e.innerH)!==undefined&&(n=(n=n<a.minH-r?a.minH-r:n)>a.maxH-r?a.maxH-r:n,a.innerH=n,a.h=n+r),e.contentW!==undefined&&(a.contentW=e.contentW),e.contentH!==undefined&&(a.contentH=e.contentH),(t=s._lastLayoutRect).x===a.x&&t.y===a.y&&t.w===a.w&&t.h===a.h||((o=Ze.repaintControls)&&o.map&&!o.map[s._id]&&(o.push(s),o.map[s._id]=!0),t.x=a.x,t.y=a.y,t.w=a.w,t.h=a.h),s):a},repaint:function(){var e,t,n,i,r,o,s,a,l,u,c=this;l=document.createRange?function(e){return e}:Math.round,e=c.getEl().style,i=c._layoutRect,a=c._lastRepaintRect||{},o=(r=c.borderBox).left+r.right,s=r.top+r.bottom,i.x!==a.x&&(e.left=l(i.x)+"px",a.x=i.x),i.y!==a.y&&(e.top=l(i.y)+"px",a.y=i.y),i.w!==a.w&&(u=l(i.w-o),e.width=(0<=u?u:0)+"px",a.w=i.w),i.h!==a.h&&(u=l(i.h-s),e.height=(0<=u?u:0)+"px",a.h
=i.h),c._hasBody&&i.innerW!==a.innerW&&(u=l(i.innerW),(n=c.getEl("body"))&&((t=n.style).width=(0<=u?u:0)+"px"),a.innerW=i.innerW),c._hasBody&&i.innerH!==a.innerH&&(u=l(i.innerH),(n=n||c.getEl("body"))&&((t=t||n.style).height=(0<=u?u:0)+"px"),a.innerH=i.innerH),c._lastRepaintRect=a,c.fire("repaint",{},!1)},updateLayoutRect:function(){var e=this;e.parent()._lastRect=null,ke.css(e.getEl(),{width:"",height:""}),e._layoutRect=e._lastRepaintRect=e._lastLayoutRect=null,e.initLayoutRect()},on:function(e,t){var n,i,r,o=this;return st(o).on(e,"string"!=typeof(n=t)?n:function(e){return i||o.parentsAndSelf().each(function(e){var t=e.settings.callbacks;if(t&&(i=t[n]))return r=e,!1}),i?i.call(r,e):(e.action=n,void this.fire("execute",e))}),o},off:function(e,t){return st(this).off(e,t),this},fire:function(e,t,n){if((t=t||{}).control||(t.control=thi
s),t=st(this).fire(e,t),!1!==n&&this.parent)for(var i=this.parent();i&&!t.isPropagationStopped();)i.fire(e,t,!1),i=i.parent();return t},hasEventListeners:function(e){return st(this).has(e)},parents:function(e){var t,n=new $e;for(t=this.parent();t;t=t.parent())n.add(t);return e&&(n=n.filter(e)),n},parentsAndSelf:function(e){return new $e(this).add(this.parents(e))},next:function(){var e=this.parent().items();return e[e.indexOf(this)+1]},prev:function(){var e=this.parent().items();return e[e.indexOf(this)-1]},innerHtml:function(e){return this.$el.html(e),this},getEl:function(e){var t=e?this._id+"-"+e:this._id;return this._elmCache[t]||(this._elmCache[t]=Re("#"+t)[0]),this._elmCache[t]},show:function(){return this.visible(!0)},hide:function(){return this.visible(!1)},focus:function(){try{this.getEl().focus()}catch(e){}return this},blur:function(){return this.getEl().blur(),this},aria:function(e,t){var n=this,i=n.getEl(n.ariaTarget);return voi
d 0===t?n._aria[e]:(n._aria[e]=t,n.state.get("rendered")&&i.setAttribute("role"===e?e:"aria-"+e,t),n)},encode:function(e,t){return!1!==t&&(e=this.translate(e)),(e||"").replace(/[&<>"]/g,function(e){return"&#"+e.charCodeAt(0)+";"})},translate:function(e){return Ze.translate?Ze.translate(e):e},before:function(e){var t=this.parent();return t&&t.insert(e,t.items().indexOf(this),!0),this},after:function(e){var t=this.parent();return t&&t.insert(e,t.items().indexOf(this)),this},remove:function(){var t,e,n=this,i=n.getEl(),r=n.parent();if(n.items){var o=n.items().toArray();for(e=o.length;e--;)o[e].remove()}r&&r.items&&(t=[],r.items().each(function(e){e!==n&&t.push(e)}),r.items().set(t),r._lastRect=null),n._eventsRoot&&n._eventsRoot===n&&Re(i).off();var s=n.getRoot().controlIdLookup;return s&&delete s[n._id],i&&i.parentNode&am
p;&i.parentNode.removeChild(i),n.state.set("rendered",!1),n.state.destroy(),n.fire("remove"),n},renderBefore:function(e){return Re(e).before(this.renderHtml()),this.postRender(),this},renderTo:function(e){return Re(e||this.getContainerElm()).append(this.renderHtml()),this.postRender(),this},preRender:function(){},render:function(){},renderHtml:function(){return'<div id="'+this._id+'" class="'+this.classes+'"></div>'},postRender:function(){var e,t,n,i,r,o=this,s=o.settings;for(i in o.$el=Re(o.getEl()),o.state.set("rendered",!0),s)0===i.indexOf("on")&&o.on(i.substr(2),s[i]);if(o._eventsRoot){for(n=o.parent();!r&&n;n=n.parent())r=n._eventsRoot;if(r)for(i in r._nativeEvents)o._nativeEvents[i]=!0}at(o),s.style&&(e=o.getEl())&&(e.setAttribute("style",s.style),e.style.cssText=s.style),o.settings.border&&(t=o.borderBox,o.$el.css({"border-top-width":t.top,&q
uot;border-right-width":t.right,"border-bottom-width":t.bottom,"border-left-width":t.left}));var a=o.getRoot();for(var l in a.controlIdLookup||(a.controlIdLookup={}),(a.controlIdLookup[o._id]=o)._aria)o.aria(l,o._aria[l]);!1===o.state.get("visible")&&(o.getEl().style.display="none"),o.bindStates(),o.state.on("change:visible",function(e){var t,n=e.value;o.state.get("rendered")&&(o.getEl().style.display=!1===n?"none":"",o.getEl().getBoundingClientRect()),(t=o.parent())&&(t._lastRect=null),o.fire(n?"show":"hide"),tt.add(o)}),o.fire("postrender",{},!1)},bindStates:function(){},scrollIntoView:function(e){var t,n,i,r,o,s,a=this.getEl(),l=a.parentNode,u=function(e,t){var n,i,r=e;for(n=i=0;r&&r!==t&&r.nodeType;)n+=r.offsetLeft||0,i+=r.offsetTop||0,r=r.offsetParent;return{x:n,y:i}}(a,l);return t=u.x,n=u.y,i=a.offsetWidth,r=a.offsetHeight,o
=l.clientWidth,s=l.clientHeight,"end"===e?(t-=o-i,n-=s-r):"center"===e&&(t-=o/2-i/2,n-=s/2-r/2),l.scrollLeft=t,l.scrollTop=n,this},getRoot:function(){for(var e,t=this,n=[];t;){if(t.rootControl){e=t.rootControl;break}n.push(t),t=(e=t).parent()}e||(e=this);for(var i=n.length;i--;)n[i].rootControl=e;return e},reflow:function(){tt.remove(this);var e=this.parent();return e&&e._layout&&!e._layout.isNative()&&e.reflow(),this}};function st(n){return n._eventDispatcher||(n._eventDispatcher=new De({scope:n,toggleEvent:function(e,t){t&&De.isNative(e)&&(n._nativeEvents||(n._nativeEvents={}),n._nativeEvents[e]=!0,n.state.get("rendered")&&at(n))}})),n._eventDispatcher}function at(a){var e,t,n,l,i,r;function o(e){var t=a.getParentCtrl(e.target);t&&t.fire(e.type,e)}function s(){var e=l._lastHoverCtrl;e&&(e.fire("mouseleave",{target:e.getEl()}),e.parents().each(function(e){e.fire("mou
seleave",{target:e.getEl()})}),l._lastHoverCtrl=null)}function u(e){var t,n,i,r=a.getParentCtrl(e.target),o=l._lastHoverCtrl,s=0;if(r!==o){if((n=(l._lastHoverCtrl=r).parents().toArray().reverse()).push(r),o){for((i=o.parents().toArray().reverse()).push(o),s=0;s<i.length&&n[s]===i[s];s++);for(t=i.length-1;s<=t;t--)(o=i[t]).fire("mouseleave",{target:o.getEl()})}for(t=s;t<n.length;t++)(r=n[t]).fire("mouseenter",{target:r.getEl()})}}function c(e){e.preventDefault(),"mousewheel"===e.type?(e.deltaY=-.025*e.wheelDelta,e.wheelDeltaX&&(e.deltaX=-.025*e.wheelDeltaX)):(e.deltaX=0,e.deltaY=e.detail),e=a.fire("wheel",e)}if(i=a._nativeEvents){for((n=a.parents().toArray()).unshift(a),e=0,t=n.length;!l&&e<t;e++)l=n[e]._eventsRoot;for(l||(l=n[n.length-1]||a),a._eventsRoot=l,t=e,e=0;e<t;e++)n[e]._eventsRoot=l;var d=l._delegates;for(r in d||(d=l._delegates={}),i){if(!i)return!1;"wheel"!==r||it?("mouseent
er"===r||"mouseleave"===r?l._hasMouseEnter||(Re(l.getEl()).on("mouseleave",s).on("mouseover",u),l._hasMouseEnter=1):d[r]||(Re(l.getEl()).on(r,o),d[r]=!0),i[r]=!1):nt?Re(a.getEl()).on("mousewheel",c):Re(a.getEl()).on("DOMMouseScroll",c)}}}w.each("text title visible disabled active value".split(" "),function(t){ot[t]=function(e){return 0===arguments.length?this.state.get(t):(void 0!==e&&this.state.set(t,e),this)}});var lt=Ze=We.extend(ot),ut=function(e){return!!e.getAttribute("data-mce-tabstop")};function ct(e){var o,r,n=e.root;function i(e){return e&&1===e.nodeType}try{o=document.activeElement}catch(t){o=document.body}function s(e){return i(e=e||o)?e.getAttribute("role"):null}function a(e){for(var t,n=e||o;n=n.parentNode;)if(t=s(n))return t}function l(e){var t=o;if(i(t))return t.getAttribute("aria-"+e)}function u(e){var t=e.tagName.toUpperCase();return"INPUT&q
uot;===t||"TEXTAREA"===t||"SELECT"===t}function c(t){var r=[];return function e(t){if(1===t.nodeType&&"none"!==t.style.display&&!t.disabled){var n;(u(n=t)&&!n.hidden||ut(n)||/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell|slider)$/.test(s(n)))&&r.push(t);for(var i=0;i<t.childNodes.length;i++)e(t.childNodes[i])}}(t||n.getEl()),r}function d(e){var t,n;(n=(e=e||r).parents().toArray()).unshift(e);for(var i=0;i<n.length&&!(t=n[i]).settings.ariaRoot;i++);return t}function f(e,t){return e<0?e=t.length-1:e>=t.length&&(e=0),t[e]&&t[e].focus(),e}function h(e,t){var n=-1,i=d();t=t||c(i.getEl());for(var r=0;r<t.length;r++)t[r]===o&&(n=r);n+=e,i.lastAriaIndex=f(n,t)}function m(){"tablist"===a()?h(-1,c(o.parentNode)):r.parent().submenu?b():h(-1)}function g(){var e=s(),t=a();"tablist"===t?h(1,c(o.parentNode)):"menuitem"===e&&"menu&
quot;===t&&l("haspopup")?y():h(1)}function p(){h(-1)}function v(){var e=s(),t=a();"menuitem"===e&&"menubar"===t?y():"button"===e&&l("haspopup")?y({key:"down"}):h(1)}function b(){r.fire("cancel")}function y(e){e=e||{},r.fire("click",{target:o,aria:e})}return r=n.getParentCtrl(o),n.on("keydown",function(e){function t(e,t){u(o)||ut(o)||"slider"!==s(o)&&!1!==t(e)&&e.preventDefault()}if(!e.isDefaultPrevented())switch(e.keyCode){case 37:t(e,m);break;case 39:t(e,g);break;case 38:t(e,p);break;case 40:t(e,v);break;case 27:b();break;case 14:case 13:case 32:t(e,y);break;case 9:!function(e){if("tablist"===a()){var t=c(r.getEl("body"))[0];t&&t.focus()}else h(e.shiftKey?-1:1)}(e),e.preventDefault()}}),n.on("focusin",function(e){o=e.target,r=e.control}),{focusFirst:function(e){var t=d(e),n=c(t.getEl());t.settings.ariaRemem
ber&&"lastAriaIndex"in t?f(t.lastAriaIndex,n):f(0,n)}}}var dt={},ft=lt.extend({init:function(e){var t=this;t._super(e),(e=t.settings).fixed&&t.state.set("fixed",!0),t._items=new $e,t.isRtl()&&t.classes.add("rtl"),t.bodyClasses=new Oe(function(){t.state.get("rendered")&&(t.getEl("body").className=this.toString())}),t.bodyClasses.prefix=t.classPrefix,t.classes.add("container"),t.bodyClasses.add("container-body"),e.containerCls&&t.classes.add(e.containerCls),t._layout=v.create((e.layout||"")+"layout"),t.settings.items?t.add(t.settings.items):t.add(t.render()),t._hasBody=!0},items:function(){return this._items},find:function(e){return(e=dt[e]=dt[e]||new je(e)).find(this)},add:function(e){return this.items().add(this.create(e)).parent(this),this},focus:function(e){var t,n,i,r=this;if(!e||!(n=r.keyboardNav||r.parents().eq(-1)[0].keyboardNav))return i=r.find(&qu
ot;*"),r.statusbar&&i.add(r.statusbar.items()),i.each(function(e){if(e.settings.autofocus)return t=null,!1;e.canFocus&&(t=t||e)}),t&&t.focus(),r;n.focusFirst(r)},replace:function(e,t){for(var n,i=this.items(),r=i.length;r--;)if(i[r]===e){i[r]=t;break}0<=r&&((n=t.getEl())&&n.parentNode.removeChild(n),(n=e.getEl())&&n.parentNode.removeChild(n)),t.parent(this)},create:function(e){var t,n=this,i=[];return w.isArray(e)||(e=[e]),w.each(e,function(e){e&&(e instanceof lt||("string"==typeof e&&(e={type:e}),t=w.extend({},n.settings.defaults,e),e.type=t.type=t.type||e.type||n.settings.defaultType||(t.defaults?t.defaults.type:null),e=v.create(t)),i.push(e))}),i},renderNew:function(){var i=this;return i.items().each(function(e,t){var n;e.parent(i),e.state.get("rendered")||((n=i.getEl("body")).hasChildNodes()&&t<=n.childNodes.length-1?Re(n.childNodes[t]).before(e.renderHtml()):Re(n).ap
pend(e.renderHtml()),e.postRender(),tt.add(e))}),i._layout.applyClasses(i.items().filter(":visible")),i._lastRect=null,i},append:function(e){return this.add(e).renderNew()},prepend:function(e){return this.items().set(this.create(e).concat(this.items().toArray())),this.renderNew()},insert:function(e,t,n){var i,r,o;return e=this.create(e),i=this.items(),!n&&t<i.length-1&&(t+=1),0<=t&&t<i.length&&(r=i.slice(0,t).toArray(),o=i.slice(t).toArray(),i.set(r.concat(e,o))),this.renderNew()},fromJSON:function(e){for(var t in e)this.find("#"+t).value(e[t]);return this},toJSON:function(){var i={};return this.find("*").each(function(e){var t=e.name(),n=e.value();t&&void 0!==n&&(i[t]=n)}),i},renderHtml:function(){var e=this,t=e._layout,n=this.settings.role;return e.preRender(),t.preRender(e),'<div id="'+e._id+'" class="'+e.classes+'"'+(n?' role="'+this.settings.role+'"':"&qu
ot;)+'><div id="'+e._id+'-body" class="'+e.bodyClasses+'">'+(e.settings.html||"")+t.renderHtml(e)+"</div></div>"},postRender:function(){var e,t=this;return t.items().exec("postRender"),t._super(),t._layout.postRender(t),t.state.set("rendered",!0),t.settings.style&&t.$el.css(t.settings.style),t.settings.border&&(e=t.borderBox,t.$el.css({"border-top-width":e.top,"border-right-width":e.right,"border-bottom-width":e.bottom,"border-left-width":e.left})),t.parent()||(t.keyboardNav=ct({root:t})),t},initLayoutRect:function(){var e=this._super();return this._layout.recalc(this),e},recalc:function(){var e=this,t=e._layoutRect,n=e._lastRect;if(!n||n.w!==t.w||n.h!==t.h)return e._layout.recalc(e),t=e.layoutRect(),e._lastRect={x:t.x,y:t.y,w:t.w,h:t.h},!0},reflow:function(){var e;if(tt.remove(this),this.visible()){for(lt.repaintControls=[],lt.repaintControls.map=
{},this.recalc(),e=lt.repaintControls.length;e--;)lt.repaintControls[e].repaint();"flow"!==this.settings.layout&&"stack"!==this.settings.layout&&this.repaint(),lt.repaintControls=[]}return this}});function ht(e){var t,n;if(e.changedTouches)for(t="screenX screenY pageX pageY clientX clientY".split(" "),n=0;n<t.length;n++)e[t[n]]=e.changedTouches[0][t[n]]}function mt(e,h){var m,g,t,p,v,b,y,x=h.document||document;h=h||{};var w=x.getElementById(h.handle||e);t=function(e){var t,n,i,r,o,s,a,l,u,c,d,f=(t=x,u=Math.max,n=t.documentElement,i=t.body,r=u(n.scrollWidth,i.scrollWidth),o=u(n.clientWidth,i.clientWidth),s=u(n.offsetWidth,i.offsetWidth),a=u(n.scrollHeight,i.scrollHeight),l=u(n.clientHeight,i.clientHeight),{width:r<s?o:r,height:a<u(n.offsetHeight,i.offsetHeight)?l:a});ht(e),e.preventDefault(),g=e.button,c=w,b=e.screenX,y=e.screenY,d=window.getComputedStyle?window.getComputedStyle(c,null).getPropertyValue("cursor&quo
t;):c.runtimeStyle.cursor,m=Re("<div></div>").css({position:"absolute",top:0,left:0,width:f.width,height:f.height,zIndex:2147483647,opacity:1e-4,cursor:d}).appendTo(x.body),Re(x).on("mousemove touchmove",v).on("mouseup touchend",p),h.start(e)},v=function(e){if(ht(e),e.button!==g)return p(e);e.deltaX=e.screenX-b,e.deltaY=e.screenY-y,e.preventDefault(),h.drag(e)},p=function(e){ht(e),Re(x).off("mousemove touchmove",v).off("mouseup touchend",p),m.remove(),h.stop&&h.stop(e)},this.destroy=function(){Re(w).off()},Re(w).on("mousedown touchstart",t)}var gt,pt,vt,bt,yt={init:function(){this.on("repaint",this.renderScroll)},renderScroll:function(){var p=this,v=2;function n(){var m,g,e;function t(e,t,n,i,r,o){var s,a,l,u,c,d,f,h;if(a=p.getEl("scroll"+e)){if(f=t.toLowerCase(),h=n.toLowerCase(),Re(p.getEl("absend")).css(f,p.layoutRect()[i]-1),!r)return void Re(a).css("displ
ay","none");Re(a).css("display","block"),s=p.getEl("body"),l=p.getEl("scroll"+e+"t"),u=s["client"+n]-2*v,c=(u-=m&&g?a["client"+o]:0)/s["scroll"+n],(d={})[f]=s["offset"+t]+v,d[h]=u,Re(a).css(d),(d={})[f]=s["scroll"+t]*c,d[h]=u*c,Re(l).css(d)}}e=p.getEl("body"),m=e.scrollWidth>e.clientWidth,g=e.scrollHeight>e.clientHeight,t("h","Left","Width","contentW",m,"Height"),t("v","Top","Height","contentH",g,"Width")}p.settings.autoScroll&&(p._hasScroll||(p._hasScroll=!0,function(){function e(s,a,l,u,c){var d,e=p._id+"-scroll"+s,t=p.classPrefix;Re(p.getEl()).append('<div id="'+e+'" class="'+t+"scrollbar "+t+"scrollbar-"+s+'"><div id="'+e+'t" class="'+t+'scrollbar-thumb">&
lt;/div></div>'),p.draghelper=new mt(e+"t",{start:function(){d=p.getEl("body")["scroll"+a],Re("#"+e).addClass(t+"active")},drag:function(e){var t,n,i,r,o=p.layoutRect();n=o.contentW>o.innerW,i=o.contentH>o.innerH,r=p.getEl("body")["client"+l]-2*v,t=(r-=n&&i?p.getEl("scroll"+s)["client"+c]:0)/p.getEl("body")["scroll"+l],p.getEl("body")["scroll"+a]=d+e["delta"+u]/t},stop:function(){Re("#"+e).removeClass(t+"active")}})}p.classes.add("scroll"),e("v","Top","Height","Y","Width"),e("h","Left","Width","X","Height")}(),p.on("wheel",function(e){var t=p.getEl("body");t.scrollLeft+=10*(e.deltaX||0),t.scrollTop+=10*e.deltaY,n()}),Re(p.getEl("body")).on("scroll",n)),n()
)}},xt=ft.extend({Defaults:{layout:"fit",containerCls:"panel"},Mixins:[yt],renderHtml:function(){var e=this,t=e._layout,n=e.settings.html;return e.preRender(),t.preRender(e),void 0===n?n='<div id="'+e._id+'-body" class="'+e.bodyClasses+'">'+t.renderHtml(e)+"</div>":("function"==typeof n&&(n=n.call(e)),e._hasBody=!1),'<div id="'+e._id+'" class="'+e.classes+'" hidefocus="1" tabindex="-1" role="group">'+(e._preBodyHtml||"")+n+"</div>"}}),wt={resizeToContent:function(){this._layoutRect.autoResize=!0,this._lastRect=null,this.reflow()},resizeTo:function(e,t){if(e<=1||t<=1){var n=ke.getWindowSize();e=e<=1?e*n.w:e,t=t<=1?t*n.h:t}return this._layoutRect.autoResize=!1,this.layoutRect({minW:e,minH:t,w:e,h:t}).reflow()},resizeBy:function(e,t){var n=this.layoutRect();return this.resizeTo(n.w+e,n.h+t)}},_t=[],Rt=[];function C
t(e,t){for(;e;){if(e===t)return!0;e=e.parent()}}function kt(){gt||(gt=function(e){2!==e.button&&function(e){for(var t=_t.length;t--;){var n=_t[t],i=n.getParentCtrl(e.target);if(n.settings.autohide){if(i&&(Ct(i,n)||n.parent()===i))continue;(e=n.fire("autohide",{target:e.target})).isDefaultPrevented()||n.hide()}}}(e)},Re(document).on("click touchstart",gt))}function Et(r){var e=ke.getViewPort().y;function t(e,t){for(var n,i=0;i<_t.length;i++)if(_t[i]!==r)for(n=_t[i].parent();n&&(n=n.parent());)n===r&&_t[i].fixed(e).moveBy(0,t).repaint()}r.settings.autofix&&(r.state.get("fixed")?r._autoFixY>e&&(r.fixed(!1).layoutRect({y:r._autoFixY}).repaint(),t(!1,r._autoFixY-e)):(r._autoFixY=r.layoutRect().y,r._autoFixY<e&&(r.fixed(!0).layoutRect({y:0}).repaint(),t(!0,e-r._autoFixY))))}function Ht(e,t){var n,i,r=St.zIndex||65535;if(e)Rt.push(t);else for(n=Rt.length;n--;)Rt[n]===t&&Rt.splice(n,1);if(
Rt.length)for(n=0;n<Rt.length;n++)Rt[n].modal&&(r++,i=Rt[n]),Rt[n].getEl().style.zIndex=r,Rt[n].zIndex=r,r++;var o=Re("#"+t.classPrefix+"modal-block",t.getContainerElm())[0];i?Re(o).css("z-index",i.zIndex-1):o&&(o.parentNode.removeChild(o),bt=!1),St.currentZIndex=r}var St=xt.extend({Mixins:[Pe,wt],init:function(e){var i=this;i._super(e),(i._eventsRoot=i).classes.add("floatpanel"),e.autohide&&(kt(),function(){if(!vt){var e=document.documentElement,t=e.clientWidth,n=e.clientHeight;vt=function(){document.all&&t===e.clientWidth&&n===e.clientHeight||(t=e.clientWidth,n=e.clientHeight,St.hideAll())},Re(window).on("resize",vt)}}(),_t.push(i)),e.autofix&&(pt||(pt=function(){var e;for(e=_t.length;e--;)Et(_t[e])},Re(window).on("scroll",pt)),i.on("move",function(){Et(this)})),i.on("postrender show",function(e){if(e.control===i){var t,n=i.classPrefix;i.modal&&
;!bt&&((t=Re("#"+n+"modal-block",i.getContainerElm()))[0]||(t=Re('<div id="'+n+'modal-block" class="'+n+"reset "+n+'fade"></div>').appendTo(i.getContainerElm())),u.setTimeout(function(){t.addClass(n+"in"),Re(i.getEl()).addClass(n+"in")}),bt=!0),Ht(!0,i)}}),i.on("show",function(){i.parents().each(function(e){if(e.state.get("fixed"))return i.fixed(!0),!1})}),e.popover&&(i._preBodyHtml='<div class="'+i.classPrefix+'arrow"></div>',i.classes.add("popover").add("bottom").add(i.isRtl()?"end":"start")),i.aria("label",e.ariaLabel),i.aria("labelledby",i._id),i.aria("describedby",i.describedBy||i._id+"-none")},fixed:function(e){var t=this;if(t.state.get("fixed")!==e){if(t.state.get("rendered")){var n=ke.getViewPort();e?t.layoutRect().y-=n.y:t.layoutRect().y+
=n.y}t.classes.toggle("fixed",e),t.state.set("fixed",e)}return t},show:function(){var e,t=this._super();for(e=_t.length;e--&&_t[e]!==this;);return-1===e&&_t.push(this),t},hide:function(){return Mt(this),Ht(!1,this),this._super()},hideAll:function(){St.hideAll()},close:function(){return this.fire("close").isDefaultPrevented()||(this.remove(),Ht(!1,this)),this},remove:function(){Mt(this),this._super()},postRender:function(){return this.settings.bodyRole&&this.getEl("body").setAttribute("role",this.settings.bodyRole),this._super()}});function Mt(e){var t;for(t=_t.length;t--;)_t[t]===e&&_t.splice(t,1);for(t=Rt.length;t--;)Rt[t]===e&&Rt.splice(t,1)}St.hideAll=function(){for(var e=_t.length;e--;){var t=_t[e];t&&t.settings.autohide&&(t.hide(),_t.splice(e,1))}};var Tt=function(e,t){return!(!e||t.settings.ui_container)},Pt=function(s,e,t){var a,n,l=p.DOM,i=s.getParam("fixed_toolbar_
container");i&&(n=l.select(i)[0]);var r=function(){if(a&&a.moveRel&&a.visible()&&!a._fixed){var e=s.selection.getScrollContainer(),t=s.getBody(),n=0,i=0;if(e){var r=l.getPos(t),o=l.getPos(e);n=Math.max(0,o.x-r.x),i=Math.max(0,o.y-r.y)}a.fixed(!1).moveRel(t,s.rtl?["tr-br","br-tr"]:["tl-bl","bl-tl","tr-br"]).moveBy(n,i)}},o=function(){a&&(a.show(),r(),l.addClass(s.getBody(),"mce-edit-focus"))},u=function(){a&&(a.hide(),St.hideAll(),l.removeClass(s.getBody(),"mce-edit-focus"))},c=function(){a?a.visible()||o():(a=e.panel=v.create({type:n?"panel":"floatpanel",role:"application",classes:"tinymce tinymce-inline",layout:"flex",direction:"column",align:"stretch",autohide:!1,autofix:Tt(n,s),fixed:Tt(n,s),border:1,items:[!1===d(s)?null:{type:"menubar",border:"0 0 1 0",items:le(s)},B(s
,f(s))]}),D.setUiContainer(s,a),x(s),n?a.renderTo(n).reflow():a.renderTo().reflow(),_(s,a),o(),F(s),s.on("nodeChange",r),s.on("ResizeWindow",r),s.on("activate",o),s.on("deactivate",u),s.nodeChanged())};return s.settings.content_editable=!0,s.on("focus",function(){!1===m(s)&&t.skinUiCss?l.styleSheetLoader.load(t.skinUiCss,c,c):c()}),s.on("blur hide",u),s.on("remove",function(){a&&(a.remove(),a=null)}),!1===m(s)&&t.skinUiCss?l.styleSheetLoader.load(t.skinUiCss,ye(s)):ye(s)(),{}};function Wt(i,r){var o,s,a=this,l=lt.classPrefix;a.show=function(e,t){function n(){o&&(Re(i).append('<div class="'+l+"throbber"+(r?" "+l+"throbber-inline":"")+'"></div>'),t&&t())}return a.hide(),o=!0,e?s=u.setTimeout(n,e):n(),a},a.hide=function(){var e=i.lastChild;return u.clearTimeout(s),e&&-1!==e.className.indexOf("throbber&qu
ot;)&&e.parentNode.removeChild(e),o=!1,a}}var Dt=function(e,t){var n;e.on("ProgressState",function(e){n=n||new Wt(t.panel.getEl("body")),e.state?n.show(e.time):n.hide()})},Nt=function(e,t,n){var i=function(e){var t=e.settings,n=t.skin,i=t.skin_url;if(!1!==n){var r=n||"lightgray";i=i?e.documentBaseURI.toAbsolute(i):l.baseURL+"/skins/"+r}return i}(e);return i&&(n.skinUiCss=i+"/skin.min.css",e.contentCSS.push(i+"/content"+(e.inline?".inline":"")+".min.css")),Dt(e,t),e.getParam("inline",!1,"boolean")?Pt(e,t,n):_e(e,t,n)},At=lt.extend({Mixins:[Pe],Defaults:{classes:"widget tooltip tooltip-n"},renderHtml:function(){var e=this,t=e.classPrefix;return'<div id="'+e._id+'" class="'+e.classes+'" role="presentation"><div class="'+t+'tooltip-arrow"></div><div class="'+t+'tooltip-inner">'+e.
encode(e.state.get("text"))+"</div></div>"},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.getEl().lastChild.innerHTML=t.encode(e.value)}),t._super()},repaint:function(){var e,t;e=this.getEl().style,t=this._layoutRect,e.left=t.x+"px",e.top=t.y+"px",e.zIndex=131070}}),Bt=lt.extend({init:function(i){var r=this;r._super(i),i=r.settings,r.canFocus=!0,i.tooltip&&!1!==Bt.tooltips&&(r.on("mouseenter",function(e){var t=r.tooltip().moveTo(-65535);if(e.control===r){var n=t.text(i.tooltip).show().testMoveRel(r.getEl(),["bc-tc","bc-tl","bc-tr"]);t.classes.toggle("tooltip-n","bc-tc"===n),t.classes.toggle("tooltip-nw","bc-tl"===n),t.classes.toggle("tooltip-ne","bc-tr"===n),t.moveRel(r.getEl(),n)}else t.hide()}),r.on("mouseleave mousedown click",function(){r.tooltip().remove(),r._t
ooltip=null})),r.aria("label",i.ariaLabel||i.tooltip)},tooltip:function(){return this._tooltip||(this._tooltip=new At({type:"tooltip"}),D.inheritUiContainer(this,this._tooltip),this._tooltip.renderTo()),this._tooltip},postRender:function(){var e=this,t=e.settings;e._super(),e.parent()||!t.width&&!t.height||(e.initLayoutRect(),e.repaint()),t.autofocus&&e.focus()},bindStates:function(){var t=this;function n(e){t.aria("disabled",e),t.classes.toggle("disabled",e)}function i(e){t.aria("pressed",e),t.classes.toggle("active",e)}return t.state.on("change:disabled",function(e){n(e.value)}),t.state.on("change:active",function(e){i(e.value)}),t.state.get("disabled")&&n(!0),t.state.get("active")&&i(!0),t._super()},remove:function(){this._super(),this._tooltip&&(this._tooltip.remove(),this._tooltip=null)}}),Ot=Bt.extend({Defaults:{value:0},init:function(e){t
his._super(e),this.classes.add("progress"),this.settings.filter||(this.settings.filter=function(e){return Math.round(e)})},renderHtml:function(){var e=this._id,t=this.classPrefix;return'<div id="'+e+'" class="'+this.classes+'"><div class="'+t+'bar-container"><div class="'+t+'bar"></div></div><div class="'+t+'text">0%</div></div>'},postRender:function(){return this._super(),this.value(this.settings.value),this},bindStates:function(){var t=this;function n(e){e=t.settings.filter(e),t.getEl().lastChild.innerHTML=e+"%",t.getEl().firstChild.firstChild.style.width=e+"%"}return t.state.on("change:value",function(e){n(e.value)}),n(t.state.get("value")),t._super()}}),zt=function(e,t){e.getEl().lastChild.textContent=t+(e.progressBar?" "+e.progressBar.value()+"%":"")},Lt=lt.extend({Mixins:[Pe],Defaults:{classes:"wi
dget notification"},init:function(e){var t=this;t._super(e),t.maxWidth=e.maxWidth,e.text&&t.text(e.text),e.icon&&(t.icon=e.icon),e.color&&(t.color=e.color),e.type&&t.classes.add("notification-"+e.type),e.timeout&&(e.timeout<0||0<e.timeout)&&!e.closeButton?t.closeButton=!1:(t.classes.add("has-close"),t.closeButton=!0),e.progressBar&&(t.progressBar=new Ot),t.on("click",function(e){-1!==e.target.className.indexOf(t.classPrefix+"close")&&t.close()})},renderHtml:function(){var e,t=this,n=t.classPrefix,i="",r="",o="";return t.icon&&(i='<i class="'+n+"ico "+n+"i-"+t.icon+'"></i>'),e=' style="max-width: '+t.maxWidth+"px;"+(t.color?"background-color: "+t.color+';"':'"'),t.closeButton&&(r='<button type="button" class="'+n+'close" aria-h
idden="true">\xd7</button>'),t.progressBar&&(o=t.progressBar.renderHtml()),'<div id="'+t._id+'" class="'+t.classes+'"'+e+' role="presentation">'+i+'<div class="'+n+'notification-inner">'+t.state.get("text")+"</div>"+o+r+'<div style="clip: rect(1px, 1px, 1px, 1px);height: 1px;overflow: hidden;position: absolute;width: 1px;" aria-live="assertive" aria-relevant="additions" aria-atomic="true"></div></div>'},postRender:function(){var e=this;return u.setTimeout(function(){e.$el.addClass(e.classPrefix+"in"),zt(e,e.state.get("text"))},100),e._super()},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.getEl().firstChild.innerHTML=e.value,zt(t,e.value)}),t.progressBar&&(t.progressBar.bindStates(),t.progressBar.state.on("change:value",function(e){zt(t,t.stat
e.get("text"))})),t._super()},close:function(){return this.fire("close").isDefaultPrevented()||this.remove(),this},repaint:function(){var e,t;e=this.getEl().style,t=this._layoutRect,e.left=t.x+"px",e.top=t.y+"px",e.zIndex=65534}});function It(o){var s=function(e){return e.inline?e.getElement():e.getContentAreaContainer()};return{open:function(e,t){var n,i=w.extend(e,{maxWidth:(n=s(o),ke.getSize(n).width)}),r=new Lt(i);return 0<(r.args=i).timeout&&(r.timer=setTimeout(function(){r.close(),t()},i.timeout)),r.on("close",function(){t()}),r.renderTo(),r},close:function(e){e.close()},reposition:function(e){var t;t=e,ie.each(t,function(e){e.moveTo(0,0)}),function(n){if(0<n.length){var e=n.slice(0,1)[0],t=s(o);e.moveRel(t,"tc-tc"),ie.each(n,function(e,t){0<t&&e.moveRel(n[t-1].getEl(),"bc-tc")})}}(e)},getArgs:function(e){return e.args}}}var Ft=[],Ut="";function Vt(e){var t,n=Re("meta[
name=viewport]")[0];!1!==me.overrideViewPort&&(n||((n=document.createElement("meta")).setAttribute("name","viewport"),document.getElementsByTagName("head")[0].appendChild(n)),(t=n.getAttribute("content"))&&void 0!==Ut&&(Ut=t),n.setAttribute("content",e?"width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0":Ut))}function jt(e,t){(function(){for(var e=0;e<Ft.length;e++)if(Ft[e]._fullscreen)return!0;return!1})()&&!1===t&&Re([document.documentElement,document.body]).removeClass(e+"fullscreen")}var qt=St.extend({modal:!0,Defaults:{border:1,layout:"flex",containerCls:"panel",role:"dialog",callbacks:{submit:function(){this.fire("submit",{data:this.toJSON()})},close:function(){this.close()}}},init:function(e){var n=this;n._super(e),n.isRtl()&&n.classes.add("rtl"),n.classes
.add("window"),n.bodyClasses.add("window-body"),n.state.set("fixed",!0),e.buttons&&(n.statusbar=new xt({layout:"flex",border:"1 0 0 0",spacing:3,padding:10,align:"center",pack:n.isRtl()?"start":"end",defaults:{type:"button"},items:e.buttons}),n.statusbar.classes.add("foot"),n.statusbar.parent(n)),n.on("click",function(e){var t=n.classPrefix+"close";(ke.hasClass(e.target,t)||ke.hasClass(e.target.parentNode,t))&&n.close()}),n.on("cancel",function(){n.close()}),n.on("move",function(e){e.control===n&&St.hideAll()}),n.aria("describedby",n.describedBy||n._id+"-none"),n.aria("label",e.title),n._fullscreen=!1},recalc:function(){var e,t,n,i,r=this,o=r.statusbar;r._fullscreen&&(r.layoutRect(ke.getWindowSize()),r.layoutRect().contentH=r.layoutRect().innerH),r._super(),e=r.layoutRect(),r.settings
.title&&!r._fullscreen&&(t=e.headerW)>e.w&&(n=e.x-Math.max(0,t/2),r.layoutRect({w:t,x:n}),i=!0),o&&(o.layoutRect({w:r.layoutRect().innerW}).recalc(),(t=o.layoutRect().minW+e.deltaW)>e.w&&(n=e.x-Math.max(0,t-e.w),r.layoutRect({w:t,x:n}),i=!0)),i&&r.recalc()},initLayoutRect:function(){var e,t=this,n=t._super(),i=0;if(t.settings.title&&!t._fullscreen){e=t.getEl("head");var r=ke.getSize(e);n.headerW=r.width,n.headerH=r.height,i+=n.headerH}t.statusbar&&(i+=t.statusbar.layoutRect().h),n.deltaH+=i,n.minH+=i,n.h+=i;var o=ke.getWindowSize();return n.x=t.settings.x||Math.max(0,o.w/2-n.w/2),n.y=t.settings.y||Math.max(0,o.h/2-n.h/2),n},renderHtml:function(){var e=this,t=e._layout,n=e._id,i=e.classPrefix,r=e.settings,o="",s="",a=r.html;return e.preRender(),t.preRender(e),r.title&&(o='<div id="'+n+'-head" class="'+i+'window-head"><div id="'+n+'-title"
class="'+i+'title">'+e.encode(r.title)+'</div><div id="'+n+'-dragh" class="'+i+'dragh"></div><button type="button" class="'+i+'close" aria-hidden="true"><i class="mce-ico mce-i-remove"></i></button></div>'),r.url&&(a='<iframe src="'+r.url+'" tabindex="-1"></iframe>'),void 0===a&&(a=t.renderHtml(e)),e.statusbar&&(s=e.statusbar.renderHtml()),'<div id="'+n+'" class="'+e.classes+'" hidefocus="1"><div class="'+e.classPrefix+'reset" role="application">'+o+'<div id="'+n+'-body" class="'+e.bodyClasses+'">'+a+"</div>"+s+"</div></div>"},fullscreen:function(e){var n,t,i=this,r=document.documentElement,o=i.classPrefix;if(e!==i._fullscreen)if(Re(window).on("resize",function(){var e;if(i._
fullscreen)if(n)i._timer||(i._timer=u.setTimeout(function(){var e=ke.getWindowSize();i.moveTo(0,0).resizeTo(e.w,e.h),i._timer=0},50));else{e=(new Date).getTime();var t=ke.getWindowSize();i.moveTo(0,0).resizeTo(t.w,t.h),50<(new Date).getTime()-e&&(n=!0)}}),t=i.layoutRect(),i._fullscreen=e){i._initial={x:t.x,y:t.y,w:t.w,h:t.h},i.borderBox=Ne("0"),i.getEl("head").style.display="none",t.deltaH-=t.headerH+2,Re([r,document.body]).addClass(o+"fullscreen"),i.classes.add("fullscreen");var s=ke.getWindowSize();i.moveTo(0,0).resizeTo(s.w,s.h)}else i.borderBox=Ne(i.settings.border),i.getEl("head").style.display="",t.deltaH+=t.headerH,Re([r,document.body]).removeClass(o+"fullscreen"),i.classes.remove("fullscreen"),i.moveTo(i._initial.x,i._initial.y).resizeTo(i._initial.w,i._initial.h);return i.reflow()},postRender:function(){var t,n=this;setTimeout(function(){n.classes.add("in"),n.fire(
"open")},0),n._super(),n.statusbar&&n.statusbar.postRender(),n.focus(),this.dragHelper=new mt(n._id+"-dragh",{start:function(){t={x:n.layoutRect().x,y:n.layoutRect().y}},drag:function(e){n.moveTo(t.x+e.deltaX,t.y+e.deltaY)}}),n.on("submit",function(e){e.isDefaultPrevented()||n.close()}),Ft.push(n),Vt(!0)},submit:function(){return this.fire("submit",{data:this.toJSON()})},remove:function(){var e,t=this;for(t.dragHelper.destroy(),t._super(),t.statusbar&&this.statusbar.remove(),jt(t.classPrefix,!1),e=Ft.length;e--;)Ft[e]===t&&Ft.splice(e,1);Vt(0<Ft.length)},getContentWindow:function(){var e=this.getEl().getElementsByTagName("iframe")[0];return e?e.contentWindow:null}});!function(){if(!me.desktop){var n={w:window.innerWidth,h:window.innerHeight};u.setInterval(function(){var e=window.innerWidth,t=window.innerHeight;n.w===e&&n.h===t||(n={w:e,h:t},Re(window).trigger("resize"))},100)}Re(window).on
("resize",function(){var e,t,n=ke.getWindowSize();for(e=0;e<Ft.length;e++)t=Ft[e].layoutRect(),Ft[e].moveTo(Ft[e].settings.x||Math.max(0,n.w/2-t.w/2),Ft[e].settings.y||Math.max(0,n.h/2-t.h/2))})}();var Yt,$t=qt.extend({init:function(e){e={border:1,padding:20,layout:"flex",pack:"center",align:"center",containerCls:"panel",autoScroll:!0,buttons:{type:"button",text:"Ok",action:"ok"},items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200}},this._super(e)},Statics:{OK:1,OK_CANCEL:2,YES_NO:3,YES_NO_CANCEL:4,msgBox:function(e){var t,i=e.callback||function(){};function n(e,t,n){return{type:"button",text:e,subtype:n?"primary":"",onClick:function(e){e.control.parents()[1].close(),i(t)}}}switch(e.buttons){case $t.OK_CANCEL:t=[n("Ok",!0,!0),n("Cancel",!1)];break;case $t.YES_NO:case $t.YES_NO_CANCEL:t=[n("Yes",1,!0),n("No",0)],e.b
uttons===$t.YES_NO_CANCEL&&t.push(n("Cancel",-1));break;default:t=[n("Ok",!0,!0)]}return new qt({padding:20,x:e.x,y:e.y,minWidth:300,minHeight:100,layout:"flex",pack:"center",align:"center",buttons:t,title:e.title,role:"alertdialog",items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200,text:e.text},onPostRender:function(){this.aria("describedby",this.items()[0]._id)},onClose:e.onClose,onCancel:function(){i(!1)}}).renderTo(document.body).reflow()},alert:function(e,t){return"string"==typeof e&&(e={text:e}),e.callback=t,$t.msgBox(e)},confirm:function(e,t){return"string"==typeof e&&(e={text:e}),e.callback=t,e.buttons=$t.OK_CANCEL,$t.msgBox(e)}}}),Xt=function(n){return{renderUI:function(e){return Nt(n,this,e)},resizeTo:function(e,t){return fe(n,e,t)},resizeBy:function(e,t){return he(n,e,t)},getNotificationManagerImpl:function(){return It(n)},getWindowManagerIm
pl:function(){return{open:function(n,e,t){var i;return n.title=n.title||" ",n.url=n.url||n.file,n.url&&(n.width=parseInt(n.width||320,10),n.height=parseInt(n.height||240,10)),n.body&&(n.items={defaults:n.defaults,type:n.bodyType||"form",items:n.body,data:n.data,callbacks:n.commands}),n.url||n.buttons||(n.buttons=[{text:"Ok",subtype:"primary",onclick:function(){i.find("form")[0].submit()}},{text:"Cancel",onclick:function(){i.close()}}]),(i=new qt(n)).on("close",function(){t(i)}),n.data&&i.on("postRender",function(){this.find("*").each(function(e){var t=e.name();t in n.data&&e.value(n.data[t])})}),i.features=n||{},i.params=e||{},i=i.renderTo(document.body).reflow()},alert:function(e,t,n){var i;return(i=$t.alert(e,function(){t()})).on("close",function(){n(i)}),i},confirm:function(e,t,n){var i;return(i=$t.confirm(e,function(e){t(e)})).on("close",f
unction(){n(i)}),i},close:function(e){e.close()},getParams:function(e){return e.params},setParams:function(e,t){e.params=t}}}}},Jt=We.extend({Defaults:{firstControlClass:"first",lastControlClass:"last"},init:function(e){this.settings=w.extend({},this.Defaults,e)},preRender:function(e){e.bodyClasses.add(this.settings.containerClass)},applyClasses:function(e){var t,n,i,r,o=this.settings;t=o.firstControlClass,n=o.lastControlClass,e.each(function(e){e.classes.remove(t).remove(n).add(o.controlClass),e.visible()&&(i||(i=e),r=e)}),i&&i.classes.add(t),r&&r.classes.add(n)},renderHtml:function(e){var t="";return this.applyClasses(e.items()),e.items().each(function(e){t+=e.renderHtml()}),t},recalc:function(){},postRender:function(){},isNative:function(){return!1}}),Gt=Jt.extend({Defaults:{containerClass:"abs-layout",controlClass:"abs-layout-item"},recalc:function(e){e.items().filter(":visible").each(function(e)
{var t=e.settings;e.layoutRect({x:t.x,y:t.y,w:t.w,h:t.h}),e.recalc&&e.recalc()})},renderHtml:function(e){return'<div id="'+e._id+'-absend" class="'+e.classPrefix+'abs-end"></div>'+this._super(e)}}),Kt=Bt.extend({Defaults:{classes:"widget btn",role:"button"},init:function(e){var t,n=this;n._super(e),e=n.settings,t=n.settings.size,n.on("click mousedown",function(e){e.preventDefault()}),n.on("touchstart",function(e){n.fire("click",e),e.preventDefault()}),e.subtype&&n.classes.add(e.subtype),t&&n.classes.add("btn-"+t),e.icon&&n.icon(e.icon)},icon:function(e){return arguments.length?(this.state.set("icon",e),this):this.state.get("icon")},repaint:function(){var e,t=this.getEl().firstChild;t&&((e=t.style).width=e.height="100%"),this._super()},renderHtml:function(){var e,t,n=this,i=n._id,r=n.classPrefix,o=n.state.get("icon"
;),s=n.state.get("text"),a="",l=n.settings;return(e=l.image)?(o="none","string"!=typeof e&&(e=window.getSelection?e[0]:e[1]),e=" style=\"background-image: url('"+e+"')\""):e="",s&&(n.classes.add("btn-has-text"),a='<span class="'+r+'txt">'+n.encode(s)+"</span>"),o=o?r+"ico "+r+"i-"+o:"",t="boolean"==typeof l.active?' aria-pressed="'+l.active+'"':"",'<div id="'+i+'" class="'+n.classes+'" tabindex="-1"'+t+'><button id="'+i+'-button" role="presentation" type="button" tabindex="-1">'+(o?'<i class="'+o+'"'+e+"></i>":"")+a+"</button></div>"},bindStates:function(){var o=this,n=o.$,i=o.classPrefix+"txt";function s(e){var t=n("span."+i
,o.getEl());e?(t[0]||(n("button:first",o.getEl()).append('<span class="'+i+'"></span>'),t=n("span."+i,o.getEl())),t.html(o.encode(e))):t.remove(),o.classes.toggle("btn-has-text",!!e)}return o.state.on("change:text",function(e){s(e.value)}),o.state.on("change:icon",function(e){var t=e.value,n=o.classPrefix;t=(o.settings.icon=t)?n+"ico "+n+"i-"+o.settings.icon:"";var i=o.getEl().firstChild,r=i.getElementsByTagName("i")[0];t?(r&&r===i.firstChild||(r=document.createElement("i"),i.insertBefore(r,i.firstChild)),r.className=t):r&&i.removeChild(r),s(o.state.get("text"))}),o._super()}}),Zt=Kt.extend({init:function(e){e=w.extend({text:"Browse...",multiple:!1,accept:null},e),this._super(e),this.classes.add("browsebutton"),e.multiple&&this.classes.add("multiple")},postRender:function(){var n=this,t=ke.create(&qu
ot;input",{type:"file",id:n._id+"-browse",accept:n.settings.accept});n._super(),Re(t).on("change",function(e){var t=e.target.files;n.value=function(){return t.length?n.settings.multiple?t:t[0]:null},e.preventDefault(),t.length&&n.fire("change",e)}),Re(t).on("click",function(e){e.stopPropagation()}),Re(n.getEl("button")).on("click",function(e){e.stopPropagation(),t.click()}),n.getEl().appendChild(t)},remove:function(){Re(this.getEl("button")).off(),Re(this.getEl("input")).off(),this._super()}}),Qt=ft.extend({Defaults:{defaultType:"button",role:"group"},renderHtml:function(){var e=this,t=e._layout;return e.classes.add("btn-group"),e.preRender(),t.preRender(e),'<div id="'+e._id+'" class="'+e.classes+'"><div id="'+e._id+'-body">'+(e.settings.html||"")+t.renderHtml(e)+"</div></div>"}}
),en=Bt.extend({Defaults:{classes:"checkbox",role:"checkbox",checked:!1},init:function(e){var t=this;t._super(e),t.on("click mousedown",function(e){e.preventDefault()}),t.on("click",function(e){e.preventDefault(),t.disabled()||t.checked(!t.checked())}),t.checked(t.settings.checked)},checked:function(e){return arguments.length?(this.state.set("checked",e),this):this.state.get("checked")},value:function(e){return arguments.length?this.checked(e):this.checked()},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix;return'<div id="'+t+'" class="'+e.classes+'" unselectable="on" aria-labelledby="'+t+'-al" tabindex="-1"><i class="'+n+"ico "+n+'i-checkbox"></i><span id="'+t+'-al" class="'+n+'label">'+e.encode(e.state.get("text"))+"</span></div>"},bindStates:function(){var o=this;funct
ion t(e){o.classes.toggle("checked",e),o.aria("checked",e)}return o.state.on("change:text",function(e){o.getEl("al").firstChild.data=o.translate(e.value)}),o.state.on("change:checked change:value",function(e){o.fire("change"),t(e.value)}),o.state.on("change:icon",function(e){var t=e.value,n=o.classPrefix;if(void 0===t)return o.settings.icon;t=(o.settings.icon=t)?n+"ico "+n+"i-"+o.settings.icon:"";var i=o.getEl().firstChild,r=i.getElementsByTagName("i")[0];t?(r&&r===i.firstChild||(r=document.createElement("i"),i.insertBefore(r,i.firstChild)),r.className=t):r&&i.removeChild(r)}),o.state.get("checked")&&t(!0),o._super()}}),tn=tinymce.util.Tools.resolve("tinymce.util.VK"),nn=Bt.extend({init:function(i){var r=this;r._super(i),i=r.settings,r.classes.add("combobox"),r.subinput=!0,r.ariaTarget="inp",i.menu=i.m
enu||i.values,i.menu&&(i.icon="caret"),r.on("click",function(e){var t=e.target,n=r.getEl();if(Re.contains(n,t)||t===n)for(;t&&t!==n;)t.id&&-1!==t.id.indexOf("-open")&&(r.fire("action"),i.menu&&(r.showMenu(),e.aria&&r.menu.items()[0].focus())),t=t.parentNode}),r.on("keydown",function(e){var t;13===e.keyCode&&"INPUT"===e.target.nodeName&&(e.preventDefault(),r.parents().reverse().each(function(e){if(e.toJSON)return t=e,!1}),r.fire("submit",{data:t.toJSON()}))}),r.on("keyup",function(e){if("INPUT"===e.target.nodeName){var t=r.state.get("value"),n=e.target.value;n!==t&&(r.state.set("value",n),r.fire("autocomplete",e))}}),r.on("mouseover",function(e){var t=r.tooltip().moveTo(-65535);if(r.statusLevel()&&-1!==e.target.className.indexOf(r.classPrefix+"status")){var n=r.status
Message()||"Ok",i=t.text(n).show().testMoveRel(e.target,["bc-tc","bc-tl","bc-tr"]);t.classes.toggle("tooltip-n","bc-tc"===i),t.classes.toggle("tooltip-nw","bc-tl"===i),t.classes.toggle("tooltip-ne","bc-tr"===i),t.moveRel(e.target,i)}})},statusLevel:function(e){return 0<arguments.length&&this.state.set("statusLevel",e),this.state.get("statusLevel")},statusMessage:function(e){return 0<arguments.length&&this.state.set("statusMessage",e),this.state.get("statusMessage")},showMenu:function(){var e,t=this,n=t.settings;t.menu||((e=n.menu||[]).length?e={type:"menu",items:e}:e.type=e.type||"menu",t.menu=v.create(e).parent(t).renderTo(t.getContainerElm()),t.fire("createmenu"),t.menu.reflow(),t.menu.on("cancel",function(e){e.control===t.menu&&t.focus()}),t.menu.on("show hide",fu
nction(e){e.control.items().each(function(e){e.active(e.value()===t.value())})}).fire("show"),t.menu.on("select",function(e){t.value(e.control.value())}),t.on("focusin",function(e){"INPUT"===e.target.tagName.toUpperCase()&&t.menu.hide()}),t.aria("expanded",!0)),t.menu.show(),t.menu.layoutRect({w:t.layoutRect().w}),t.menu.moveRel(t.getEl(),t.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},focus:function(){this.getEl("inp").focus()},repaint:function(){var e,t,n=this,i=n.getEl(),r=n.getEl("open"),o=n.layoutRect(),s=0,a=i.firstChild;n.statusLevel()&&"none"!==n.statusLevel()&&(s=parseInt(ke.getRuntimeStyle(a,"padding-right"),10)-parseInt(ke.getRuntimeStyle(a,"padding-left"),10)),e=r?o.w-ke.getSize(r).width-10:o.w-10;var l=document;return l.all&&(!l.documentMode||l.documentMode<=8)&&(t=n.layoutRect().h-2+"
px"),Re(a).css({width:e-s,lineHeight:t}),n._super(),n},postRender:function(){var t=this;return Re(this.getEl("inp")).on("change",function(e){t.state.set("value",e.target.value),t.fire("change",e)}),t._super()},renderHtml:function(){var e,t,n,i=this,r=i._id,o=i.settings,s=i.classPrefix,a=i.state.get("value")||"",l="",u="";return"spellcheck"in o&&(u+=' spellcheck="'+o.spellcheck+'"'),o.maxLength&&(u+=' maxlength="'+o.maxLength+'"'),o.size&&(u+=' size="'+o.size+'"'),o.subtype&&(u+=' type="'+o.subtype+'"'),n='<i id="'+r+'-status" class="mce-status mce-ico" style="display: none"></i>',i.disabled()&&(u+=' disabled="disabled"'),(e=o.icon)&&"caret"!==e&&(e=s+"ico "+s+"i-"+o.icon),t=i.state.get("text"),(e||t)&
&(l='<div id="'+r+'-open" class="'+s+"btn "+s+'open" tabIndex="-1" role="button"><button id="'+r+'-action" type="button" hidefocus="1" tabindex="-1">'+("caret"!==e?'<i class="'+e+'"></i>':'<i class="'+s+'caret"></i>')+(t?(e?" ":"")+t:"")+"</button></div>",i.classes.add("has-open")),'<div id="'+r+'" class="'+i.classes+'"><input id="'+r+'-inp" class="'+s+'textbox" value="'+i.encode(a,!1)+'" hidefocus="1"'+u+' placeholder="'+i.encode(o.placeholder)+'" />'+n+l+"</div>"},value:function(e){return arguments.length?(this.state.set("value",e),this):(this.state.get("rendered")&&this.state.set("value",this.getEl("inp").value),this.s
tate.get("value"))},showAutoComplete:function(e,i){var r=this;if(0!==e.length){r.menu?r.menu.items().remove():r.menu=v.create({type:"menu",classes:"combobox-menu",layout:"flow"}).parent(r).renderTo(),w.each(e,function(e){var t,n;r.menu.add({text:e.title,url:e.previewUrl,match:i,classes:"menu-item-ellipsis",onclick:(t=e.value,n=e.title,function(){r.fire("selectitem",{title:n,value:t})})})}),r.menu.renderNew(),r.hideMenu(),r.menu.on("cancel",function(e){e.control.parent()===r.menu&&(e.stopPropagation(),r.focus(),r.hideMenu())}),r.menu.on("select",function(){r.focus()});var t=r.layoutRect().w;r.menu.layoutRect({w:t,minW:0,maxW:t}),r.menu.repaint(),r.menu.reflow(),r.menu.show(),r.menu.moveRel(r.getEl(),r.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])}else r.hideMenu()},hideMenu:function(){this.menu&&this.menu.hide()},bindStates:function(){var r=this;r.sta
te.on("change:value",function(e){r.getEl("inp").value!==e.value&&(r.getEl("inp").value=e.value)}),r.state.on("change:disabled",function(e){r.getEl("inp").disabled=e.value}),r.state.on("change:statusLevel",function(e){var t=r.getEl("status"),n=r.classPrefix,i=e.value;ke.css(t,"display","none"===i?"none":""),ke.toggleClass(t,n+"i-checkmark","ok"===i),ke.toggleClass(t,n+"i-warning","warn"===i),ke.toggleClass(t,n+"i-error","error"===i),r.classes.toggle("has-status","none"!==i),r.repaint()}),ke.on(r.getEl("status"),"mouseleave",function(){r.tooltip().hide()}),r.on("cancel",function(e){r.menu&&r.menu.visible()&&(e.stopPropagation(),r.hideMenu())});var n=function(e,t){t&&0<t.items().length&&t.items().eq(e)[0].focus()};return r.on(&
quot;keydown",function(e){var t=e.keyCode;"INPUT"===e.target.nodeName&&(t===tn.DOWN?(e.preventDefault(),r.fire("autocomplete"),n(0,r.menu)):t===tn.UP&&(e.preventDefault(),n(-1,r.menu)))}),r._super()},remove:function(){Re(this.getEl("inp")).off(),this.menu&&this.menu.remove(),this._super()}}),rn=nn.extend({init:function(e){var t=this;e.spellcheck=!1,e.onaction&&(e.icon="none"),t._super(e),t.classes.add("colorbox"),t.on("change keyup postrender",function(){t.repaintColor(t.value())})},repaintColor:function(e){var t=this.getEl("open"),n=t?t.getElementsByTagName("i")[0]:null;if(n)try{n.style.background=e}catch(i){}},bindStates:function(){var t=this;return t.state.on("change:value",function(e){t.state.get("rendered")&&t.repaintColor(e.value)}),t._super()}}),on=Kt.extend({showPanel:function(){var t=this,e=t.settings;if(t.classes.add("opened&
quot;),t.panel)t.panel.show();else{var n=e.panel;n.type&&(n={layout:"grid",items:n}),n.role=n.role||"dialog",n.popover=!0,n.autohide=!0,n.ariaRoot=!0,t.panel=new St(n).on("hide",function(){t.classes.remove("opened")}).on("cancel",function(e){e.stopPropagation(),t.focus(),t.hidePanel()}).parent(t).renderTo(t.getContainerElm()),t.panel.fire("show"),t.panel.reflow()}var i=t.panel.testMoveRel(t.getEl(),e.popoverAlign||(t.isRtl()?["bc-tc","bc-tl","bc-tr"]:["bc-tc","bc-tr","bc-tl","tc-bc","tc-br","tc-bl"]));t.panel.classes.toggle("start","l"===i.substr(-1)),t.panel.classes.toggle("end","r"===i.substr(-1));var r="t"===i.substr(0,1);t.panel.classes.toggle("bottom",!r),t.panel.classes.toggle("top",r),t.panel.moveRel(t.getEl(),i)},hidePanel:function(){this.panel&&a
mp;this.panel.hide()},postRender:function(){var t=this;return t.aria("haspopup",!0),t.on("click",function(e){e.control===t&&(t.panel&&t.panel.visible()?t.hidePanel():(t.showPanel(),t.panel.focus(!!e.aria)))}),t._super()},remove:function(){return this.panel&&(this.panel.remove(),this.panel=null),this._super()}}),sn=p.DOM,an=on.extend({init:function(e){this._super(e),this.classes.add("splitbtn"),this.classes.add("colorbutton")},color:function(e){return e?(this._color=e,this.getEl("preview").style.backgroundColor=e,this):this._color},resetColor:function(){return this._color=null,this.getEl("preview").style.backgroundColor=null,this},renderHtml:function(){var e=this,t=e._id,n=e.classPrefix,i=e.state.get("text"),r=e.settings.icon?n+"ico "+n+"i-"+e.settings.icon:"",o=e.settings.image?" style=\"background-image: url('"+e.settings.image+"')\"&q
uot;:"",s="";return i&&(e.classes.add("btn-has-text"),s='<span class="'+n+'txt">'+e.encode(i)+"</span>"),'<div id="'+t+'" class="'+e.classes+'" role="button" tabindex="-1" aria-haspopup="true"><button role="presentation" hidefocus="1" type="button" tabindex="-1">'+(r?'<i class="'+r+'"'+o+"></i>":"")+'<span id="'+t+'-preview" class="'+n+'preview"></span>'+s+'</button><button type="button" class="'+n+'open" hidefocus="1" tabindex="-1"> <i class="'+n+'caret"></i></button></div>'},postRender:function(){var t=this,n=t.settings.onclick;return t.on("click",function(e){e.aria&&"down"===e.aria.key||e.control!==t||sn.getParent(e.target,&qu
ot;."+t.classPrefix+"open")||(e.stopImmediatePropagation(),n.call(t,e))}),delete t.settings.onclick,t._super()}}),ln=tinymce.util.Tools.resolve("tinymce.util.Color"),un=Bt.extend({Defaults:{classes:"widget colorpicker"},init:function(e){this._super(e)},postRender:function(){var n,i,r,o,s,a=this,l=a.color();function u(e,t){var n,i,r=ke.getPos(e);return n=t.pageX-r.x,i=t.pageY-r.y,{x:n=Math.max(0,Math.min(n/e.clientWidth,1)),y:i=Math.max(0,Math.min(i/e.clientHeight,1))}}function c(e,t){var n=(360-e.h)/360;ke.css(r,{top:100*n+"%"}),t||ke.css(s,{left:e.s+"%",top:100-e.v+"%"}),o.style.background=ln({s:100,v:100,h:e.h}).toHex(),a.color().parse({s:e.s,v:e.v,h:e.h})}function e(e){var t;t=u(o,e),n.s=100*t.x,n.v=100*(1-t.y),c(n),a.fire("change")}function t(e){var t;t=u(i,e),(n=l.toHsv()).h=360*(1-t.y),c(n,!0),a.fire("change")}i=a.getEl("h"),r=a.getEl("hp"),o=a.getEl("sv"),s=a.get
El("svp"),a._repaint=function(){c(n=l.toHsv())},a._super(),a._svdraghelper=new mt(a._id+"-sv",{start:e,drag:e}),a._hdraghelper=new mt(a._id+"-h",{start:t,drag:t}),a._repaint()},rgb:function(){return this.color().toRgb()},value:function(e){if(!arguments.length)return this.color().toHex();this.color().parse(e),this._rendered&&this._repaint()},color:function(){return this._color||(this._color=ln()),this._color},renderHtml:function(){var e,t=this._id,o=this.classPrefix,s="#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000";return e='<div id="'+t+'-h" class="'+o+'colorpicker-h" style="background: -ms-linear-gradient(top,'+s+");background: linear-gradient(to bottom,"+s+');">'+function(){var e,t,n,i,r="";for(n="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=",e=0,t=(i=s.split(",")).le
ngth-1;e<t;e++)r+='<div class="'+o+'colorpicker-h-chunk" style="height:'+100/t+"%;"+n+i[e]+",endColorstr="+i[e+1]+");-ms-"+n+i[e]+",endColorstr="+i[e+1]+')"></div>';return r}()+'<div id="'+t+'-hp" class="'+o+'colorpicker-h-marker"></div></div>','<div id="'+t+'" class="'+this.classes+'"><div id="'+t+'-sv" class="'+o+'colorpicker-sv"><div class="'+o+'colorpicker-overlay1"><div class="'+o+'colorpicker-overlay2"><div id="'+t+'-svp" class="'+o+'colorpicker-selector1"><div class="'+o+'colorpicker-selector2"></div></div></div></div></div>'+e+"</div>"}}),cn=Bt.extend({init:function(e){e=w.extend({height:100,text:"Drop an image here",multiple:!1,accept:null},e),this._super(e),this.classes.add("dro
pzone"),e.multiple&&this.classes.add("multiple")},renderHtml:function(){var e,t,n=this.settings;return e={id:this._id,hidefocus:"1"},t=ke.create("div",e,"<span>"+this.translate(n.text)+"</span>"),n.height&&ke.css(t,"height",n.height+"px"),n.width&&ke.css(t,"width",n.width+"px"),t.className=this.classes,t.outerHTML},postRender:function(){var i=this,e=function(e){e.preventDefault(),i.classes.toggle("dragenter"),i.getEl().className=i.classes};i._super(),i.$el.on("dragover",function(e){e.preventDefault()}),i.$el.on("dragenter",e),i.$el.on("dragleave",e),i.$el.on("drop",function(e){if(e.preventDefault(),!i.state.get("disabled")){var t=function(e){var t=i.settings.accept;if("string"!=typeof t)return e;var n=new RegExp("("+t.split(/\s*,\s*/).join("|")+")$","
i");return w.grep(e,function(e){return n.test(e.name)})}(e.dataTransfer.files);i.value=function(){return t.length?i.settings.multiple?t:t[0]:null},t.length&&i.fire("change",e)}})},remove:function(){this.$el.off(),this._super()}}),dn=Bt.extend({init:function(e){var n=this;e.delimiter||(e.delimiter="\xbb"),n._super(e),n.classes.add("path"),n.canFocus=!0,n.on("click",function(e){var t;(t=e.target.getAttribute("data-index"))&&n.fire("select",{value:n.row()[t],index:t})}),n.row(n.settings.row)},focus:function(){return this.getEl().firstChild.focus(),this},row:function(e){return arguments.length?(this.state.set("row",e),this):this.state.get("row")},renderHtml:function(){return'<div id="'+this._id+'" class="'+this.classes+'">'+this._getDataPathHtml(this.state.get("row"))+"</div>"},bindStates:function(){var t=this;return t.state.on("ch
ange:row",function(e){t.innerHtml(t._getDataPathHtml(e.value))}),t._super()},_getDataPathHtml:function(e){var t,n,i=e||[],r="",o=this.classPrefix;for(t=0,n=i.length;t<n;t++)r+=(0<t?'<div class="'+o+'divider" aria-hidden="true"> '+this.settings.delimiter+" </div>":"")+'<div role="button" class="'+o+"path-item"+(t===n-1?" "+o+"last":"")+'" data-index="'+t+'" tabindex="-1" id="'+this._id+"-"+t+'" aria-level="'+(t+1)+'">'+i[t].name+"</div>";return r||(r='<div class="'+o+'path-item">\xa0</div>'),r}}),fn=dn.extend({postRender:function(){var o=this,s=o.settings.editor;function a(e){if(1===e.nodeType){if("BR"===e.nodeName||e.getAttribute("data-mce-bogus"))return!0;if("bookmark"===e.getAttribute("data-mce-type"))return!0}return!1
}return!1!==s.settings.elementpath&&(o.on("select",function(e){s.focus(),s.selection.select(this.row()[e.index].element),s.nodeChanged()}),s.on("nodeChange",function(e){for(var t=[],n=e.parents,i=n.length;i--;)if(1===n[i].nodeType&&!a(n[i])){var r=s.fire("ResolveName",{name:n[i].nodeName.toLowerCase(),target:n[i]});if(r.isDefaultPrevented()||t.push({name:r.name,element:n[i]}),r.isPropagationStopped())break}o.row(t)})),o._super()}}),hn=ft.extend({Defaults:{layout:"flex",align:"center",defaults:{flex:1}},renderHtml:function(){var e=this,t=e._layout,n=e.classPrefix;return e.classes.add("formitem"),t.preRender(e),'<div id="'+e._id+'" class="'+e.classes+'" hidefocus="1" tabindex="-1">'+(e.settings.title?'<div id="'+e._id+'-title" class="'+n+'title">'+e.settings.title+"</div>":"")+'<div id="'+e._id+'-body"
; class="'+e.bodyClasses+'">'+(e.settings.html||"")+t.renderHtml(e)+"</div></div>"}}),mn=ft.extend({Defaults:{containerCls:"form",layout:"flex",direction:"column",align:"stretch",flex:1,padding:15,labelGap:30,spacing:10,callbacks:{submit:function(){this.submit()}}},preRender:function(){var i=this,e=i.items();i.settings.formItemDefaults||(i.settings.formItemDefaults={layout:"flex",autoResize:"overflow",defaults:{flex:1}}),e.each(function(e){var t,n=e.settings.label;n&&((t=new hn(w.extend({items:{type:"label",id:e._id+"-l",text:n,flex:0,forId:e._id,disabled:e.disabled()}},i.settings.formItemDefaults))).type="formitem",e.aria("labelledby",e._id+"-l"),"undefined"==typeof e.settings.flex&&(e.settings.flex=1),i.replace(e,t),t.add(e))})},submit:function(){return this.fire("submit",{data:this.toJSON()})
},postRender:function(){this._super(),this.fromJSON(this.settings.data)},bindStates:function(){var n=this;function e(){var e,t,i=0,r=[];if(!1!==n.settings.labelGapCalc)for(("children"===n.settings.labelGapCalc?n.find("formitem"):n.items()).filter("formitem").each(function(e){var t=e.items()[0],n=t.getEl().clientWidth;i=i<n?n:i,r.push(t)}),t=n.settings.labelGap||0,e=r.length;e--;)r[e].settings.minWidth=i+t}n._super(),n.on("show",e),e()}}),gn=mn.extend({Defaults:{containerCls:"fieldset",layout:"flex",direction:"column",align:"stretch",flex:1,padding:"25 15 5 15",labelGap:30,spacing:10,border:1},renderHtml:function(){var e=this,t=e._layout,n=e.classPrefix;return e.preRender(),t.preRender(e),'<fieldset id="'+e._id+'" class="'+e.classes+'" hidefocus="1" tabindex="-1">'+(e.settings.title?'<legend id="'+e._id+'-title" class="'+n+'field
set-title">'+e.settings.title+"</legend>":"")+'<div id="'+e._id+'-body" class="'+e.bodyClasses+'">'+(e.settings.html||"")+t.renderHtml(e)+"</div></fieldset>"}}),pn=0,vn=function(e){var t=(new Date).getTime();return e+"_"+Math.floor(1e9*Math.random())+ ++pn+String(t)},bn=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:k.constant(e)}},yn={fromHtml:function(e,t){var n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||1<n.childNodes.length)throw console.error("HTML does not have a single root node",e),"HTML must have a single root node";return bn(n.childNodes[0])},fromTag:function(e,t){var n=(t||document).createElement(e);return bn(n)},fromText:function(e,t){var n=(t||document).createTextNode(e);return bn(n)},fromDom:bn,fromPoint:function(e,t,n){return P.from(e.dom().el
ementFromPoint(t,n)).map(bn)}},xn=function(e){var t,n=!1;return function(){return n||(n=!0,t=e.apply(null,arguments)),t}},wn=9,_n=1,Rn=3,Cn=function(e){return e.dom().nodeType},kn=function(t){return function(e){return Cn(e)===t}},En=(kn(_n),kn(Rn),kn(wn),xn(function(){return En(yn.fromDom(document))}),function(e){var t=e.dom().body;if(null===t||t===undefined)throw"Body is not available yet";return yn.fromDom(t)}),Hn=(Yt=Object.keys)===undefined?function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}:Yt,Sn=function(e,t){for(var n=Hn(e),i=0,r=n.length;i<r;i++){var o=n[i];t(e[o],o,e)}},Mn=function(i,r){var o={};return Sn(i,function(e,t){var n=r(e,t,i);o[n.k]=n.v}),o},Tn=function(e,n){var i=[];return Sn(e,function(e,t){i.push(n(e,t))}),i},Pn=function(e){return Tn(e,function(e){return e})},Wn={bifilter:function(e,n){var i={},r={};return Sn(e,function(e,t){(n(e,t)?i:r)[t]=e}),{t:i,f:r}},each:Sn,map:function(e,i){return Mn(e,function(e,t,n){return{
k:t,v:i(e,t,n)}})},mapToArray:Tn,tupleMap:Mn,find:function(e,t){for(var n=Hn(e),i=0,r=n.length;i<r;i++){var o=n[i],s=e[o];if(t(s,o,e))return P.some(s)}return P.none()},keys:Hn,values:Pn,size:function(e){return Pn(e).length}},Dn=function(e){return e.slice(0).sort()},Nn={sort:Dn,reqMessage:function(e,t){throw new Error("All required keys ("+Dn(e).join(", ")+") were not specified. Specified keys were: "+Dn(t).join(", ")+".")},unsuppMessage:function(e){throw new Error("Unsupported keys for object: "+Dn(e).join(", "))},validateStrArr:function(t,e){if(!V.isArray(e))throw new Error("The "+t+" fields must be an array. Was: "+e+".");ie.each(e,function(e){if(!V.isString(e))throw new Error("The value "+e+" in the "+t+" fields was not a string.")})},invalidTypeMessage:function(e,t){throw new Error("All values need to be of type: "+t+". Keys ("+
Dn(e).join(", ")+") were not.")},checkDupes:function(e){var n=Dn(e);ie.find(n,function(e,t){return t<n.length-1&&e===n[t+1]}).each(function(e){throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+n.join(", ")+"].")})}},An={immutable:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(t.length!==n.length)throw new Error('Wrong number of arguments to struct. Expected "['+t.length+']", got '+n.length+" arguments");var i={};return ie.each(t,function(e,t){i[e]=k.constant(n[t])}),i}},immutableBag:function(r,o){var s=r.concat(o);if(0===s.length)throw new Error("You must specify at least one required or optional field.");return Nn.validateStrArr("required",r),Nn.validateStrArr("optional",o),Nn.checkDupes(s),function(t){var n=Wn.keys(t);ie.for
all(r,function(e){return ie.contains(n,e)})||Nn.reqMessage(r,n);var e=ie.filter(n,function(e){return!ie.contains(s,e)});0<e.length&&Nn.unsuppMessage(e);var i={};return ie.each(r,function(e){i[e]=k.constant(t[e])}),ie.each(o,function(e){i[e]=k.constant(Object.prototype.hasOwnProperty.call(t,e)?P.some(t[e]):P.none())}),i}}},Bn=("undefined"!=typeof window?window:Function("return this;")(),function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){var i=e[n];if(i.test(t))return i}return undefined}(e,t);if(!n)return{major:0,minor:0};var i=function(e){return Number(t.replace(n,"$"+e))};return zn(i(1),i(2))}),On=function(){return zn(0,0)},zn=function(e,t){return{major:e,minor:t}},Ln={nu:zn,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?On():Bn(e,n)},unknown:On},In="Firefox",Fn=function(e,t){return function(){return t===e}},Un=function(e){var t=e.current;return{current:t,version:e.version,isEdge:Fn("Edge&q
uot;,t),isChrome:Fn("Chrome",t),isIE:Fn("IE",t),isOpera:Fn("Opera",t),isFirefox:Fn(In,t),isSafari:Fn("Safari",t)}},Vn={unknown:function(){return Un({current:undefined,version:Ln.unknown()})},nu:Un,edge:k.constant("Edge"),chrome:k.constant("Chrome"),ie:k.constant("IE"),opera:k.constant("Opera"),firefox:k.constant(In),safari:k.constant("Safari")},jn="Windows",qn="Android",Yn="Solaris",$n="FreeBSD",Xn=function(e,t){return function(){return t===e}},Jn=function(e){var t=e.current;return{current:t,version:e.version,isWindows:Xn(jn,t),isiOS:Xn("iOS",t),isAndroid:Xn(qn,t),isOSX:Xn("OSX",t),isLinux:Xn("Linux",t),isSolaris:Xn(Yn,t),isFreeBSD:Xn($n,t)}},Gn={unknown:function(){return Jn({current:undefined,version:Ln.unknown()})},nu:Jn,windows:k.constant(jn),ios:k.constant("iOS"),android:k.constant(qn),linux:k.constant("Lin
ux"),osx:k.constant("OSX"),solaris:k.constant(Yn),freebsd:k.constant($n)},Kn=function(e,t){var n=String(t).toLowerCase();return ie.find(e,function(e){return e.search(n)})},Zn=function(e,n){return Kn(e,n).map(function(e){var t=Ln.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Qn=function(e,n){return Kn(e,n).map(function(e){var t=Ln.detect(e.versionRegexes,n);return{current:e.name,version:t}})},ei=function(e,t){return-1!==e.indexOf(t)},ti=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ni=function(t){return function(e){return ei(e,t)}},ii=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return ei(e,"edge/")&&ei(e,"chrome")&&ei(e,"safari")&&ei(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,ti],search:function(e){return ei(e,"chrome")&&!ei(e,"chromeframe")}},{name:"IE",version
Regexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return ei(e,"msie")||ei(e,"trident")}},{name:"Opera",versionRegexes:[ti,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ni("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ni("firefox")},{name:"Safari",versionRegexes:[ti,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(ei(e,"safari")||ei(e,"mobile/"))&&ei(e,"applewebkit")}}],ri=[{name:"Windows",search:ni("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return ei(e,"iphone")||ei(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ni("android"),versionRegexes:[/.*?android\ ?([0-
9]+)\.([0-9]+).*/]},{name:"OSX",search:ni("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ni("linux"),versionRegexes:[]},{name:"Solaris",search:ni("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ni("freebsd"),versionRegexes:[]}],oi={browsers:k.constant(ii),oses:k.constant(ri)},si=function(e){var t,n,i,r,o,s,a,l,u,c,d,f=oi.browsers(),h=oi.oses(),m=Zn(f,e).fold(Vn.unknown,Vn.nu),g=Qn(h,e).fold(Gn.unknown,Gn.nu);return{browser:m,os:g,deviceType:(n=m,i=e,r=(t=g).isiOS()&&!0===/ipad/i.test(i),o=t.isiOS()&&!r,s=t.isAndroid()&&3===t.version.major,a=t.isAndroid()&&4===t.version.major,l=r||s||a&&!0===/mobile/i.test(i),u=t.isiOS()||t.isAndroid(),c=u&&!l,d=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(i),{isiPad:k.constant(r),isiPhone:k.constant(o),isTablet:k.constant(l),isPhone:k.constant(c),isTouch:k.constant(u),isAn
droid:t.isAndroid,isiOS:t.isiOS,isWebView:k.constant(d)})}},ai=xn(function(){var e=navigator.userAgent;return si(e)}),li=_n,ui=wn,ci=function(e){return e.nodeType!==li&&e.nodeType!==ui||0===e.childElementCount},di={all:function(e,t){var n=t===undefined?document:t.dom();return ci(n)?[]:ie.map(n.querySelectorAll(e),yn.fromDom)},is:function(e,t){var n=e.dom();if(n.nodeType!==li)return!1;if(n.matches!==undefined)return n.matches(t);if(n.msMatchesSelector!==undefined)return n.msMatchesSelector(t);if(n.webkitMatchesSelector!==undefined)return n.webkitMatchesSelector(t);if(n.mozMatchesSelector!==undefined)return n.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},one:function(e,t){var n=t===undefined?document:t.dom();return ci(n)?P.none():P.from(n.querySelector(e)).map(yn.fromDom)}},fi=(ai().browser.isIE(),An.immutable("element","offset"),function(e,t){return di.all(t,e)}),hi=w.trim,mi=function(t){return function(e){if(e&&
;1===e.nodeType){if(e.contentEditable===t)return!0;if(e.getAttribute("data-mce-contenteditable")===t)return!0}return!1}},gi=mi("true"),pi=mi("false"),vi=function(e,t,n,i,r){return{type:e,title:t,url:n,level:i,attach:r}},bi=function(e){return e.innerText||e.textContent},yi=function(e){return(t=e)&&"A"===t.nodeName&&(t.id||t.name)&&wi(e);var t},xi=function(e){return e&&/^(H[1-6])$/.test(e.nodeName)},wi=function(e){return function(e){for(;e=e.parentNode;){var t=e.contentEditable;if(t&&"inherit"!==t)return gi(e)}return!1}(e)&&!pi(e)},_i=function(e){return xi(e)&&wi(e)},Ri=function(e){var t,n,i=(t=e).id?t.id:vn("h");return vi("header",bi(e),"#"+i,xi(n=e)?parseInt(n.nodeName.substr(1),10):0,function(){e.id=i})},Ci=function(e){var t=e.id||e.name,n=bi(e);return vi("anchor",n||"#"+t,"#"+t,0,k.noop)},ki=function(e){var t,n;return
t="h1,h2,h3,h4,h5,h6,a:not([href])",n=e,ie.map(fi(yn.fromDom(n),t),function(e){return e.dom()})},Ei=function(e){return 0<hi(e.title).length},Hi=function(e){var t,n,i=ki(e);return ie.filter((n=i,ie.map(ie.filter(n,_i),Ri)).concat((t=i,ie.map(ie.filter(t,yi),Ci))),Ei)},Si={},Mi=function(e){return{title:e.title,value:{title:{raw:e.title},url:e.url,attach:e.attach}}},Ti=function(e,t){return{title:e,value:{title:e,url:t,attach:k.noop}}},Pi=function(e,t,n){var i=t in e?e[t]:n;return!1===i?null:i},Wi=function(e,i,r,t){var n,o,s,a,l={title:"-"},u=function(e){var t=e.hasOwnProperty(r)?e[r]:[],n=ie.filter(t,function(e){return t=e,n=i,!ie.exists(n,function(e){return e.url===t});var t,n});return w.map(n,function(e){return{title:e,value:{title:e,url:e,attach:k.noop}}})},c=function(t){var e,n=ie.filter(i,function(e){return e.type===t});return e=n,w.map(e,Mi)};return!1===t.typeahead_urls?[]:"file"===r?(n=[Di(e,u(Si)),Di(e,c("header")),Di(e,(o=c("anc
hor"),s=Pi(t,"anchor_top","#top"),a=Pi(t,"anchor_bottom","#bottom"),null!==s&&o.unshift(Ti("<top>",s)),null!==a&&o.push(Ti("<bottom>",a)),o))],ie.foldl(n,function(e,t){return 0===e.length||0===t.length?e.concat(t):e.concat(l,t)},[])):Di(e,u(Si))},Di=function(e,t){var n=e.toLowerCase(),i=w.grep(t,function(e){return-1!==e.title.toLowerCase().indexOf(n)});return 1===i.length&&i[0].title===e?[]:i},Ni=function(r,i,o,s){var t=function(e){var t=Hi(o),n=Wi(e,t,s,i);r.showAutoComplete(n,e)};r.on("autocomplete",function(){t(r.value())}),r.on("selectitem",function(e){var t=e.value;r.value(t.url);var n,i=(n=t.title).raw?n.raw:n;"image"===s?r.fire("change",{meta:{alt:i,attach:t.attach}}):r.fire("change",{meta:{text:i,attach:t.attach}}),r.focus()}),r.on("click",function(e){0===r.value().length&&"INPUT"===e.target.nodeNam
e&&t("")}),r.on("PostRender",function(){r.getRoot().on("submit",function(e){var t,n,i;e.isDefaultPrevented()||(t=r.value(),i=Si[n=s],/^https?/.test(t)&&(i?ie.indexOf(i,t).isNone()&&(Si[n]=i.slice(0,5).concat(t)):Si[n]=[t]))})})},Ai=function(o,e,n){var i=e.filepicker_validator_handler;i&&o.state.on("change:value",function(e){var t;0!==(t=e.value).length?i({url:t,type:n},function(e){var t,n,i,r=(n=(t=e).status,i=t.message,"valid"===n?{status:"ok",message:i}:"unknown"===n?{status:"warn",message:i}:"invalid"===n?{status:"warn",message:i}:{status:"none",message:""});o.statusMessage(r.message),o.statusLevel(r.status)}):o.statusLevel("none")})},Bi=nn.extend({Statics:{clearHistory:function(){Si={}}},init:function(e){var t,n,i,r=this,o=window.tinymce?window.tinymce.activeEditor:l.activeEditor,s=o.settings,a=e.filetype;e.spellcheck=!
1,(i=s.file_picker_types||s.file_browser_callback_types)&&(i=w.makeMap(i,/[, ]/)),i&&!i[a]||(!(n=s.file_picker_callback)||i&&!i[a]?!(n=s.file_browser_callback)||i&&!i[a]||(t=function(){n(r.getEl("inp").id,r.value(),a,window)}):t=function(){var e=r.fire("beforecall").meta;e=w.extend({filetype:a},e),n.call(o,function(e,t){r.value(e).fire("change",{meta:t})},r.value(),e)}),t&&(e.icon="browse",e.onaction=t),r._super(e),r.classes.add("filepicker"),Ni(r,s,o.getBody(),a),Ai(r,s,a)}}),Oi=Gt.extend({recalc:function(e){var t=e.layoutRect(),n=e.paddingBox;e.items().filter(":visible").each(function(e){e.layoutRect({x:n.left,y:n.top,w:t.innerW-n.right-n.left,h:t.innerH-n.top-n.bottom}),e.recalc&&e.recalc()})}}),zi=Gt.extend({recalc:function(e){var t,n,i,r,o,s,a,l,u,c,d,f,h,m,g,p,v,b,y,x,w,_,R,C,k,E,H,S,M,T,P,W,D,N,A,B,O,z=[],L=Math.max,I=Math.min;for(i=e.items().filter(":visible"
),r=e.layoutRect(),o=e.paddingBox,s=e.settings,f=e.isRtl()?s.direction||"row-reversed":s.direction,a=s.align,l=e.isRtl()?s.pack||"end":s.pack,u=s.spacing||0,"row-reversed"!==f&&"column-reverse"!==f||(i=i.set(i.toArray().reverse()),f=f.split("-")[0]),"column"===f?(C="y",_="h",R="minH",k="maxH",H="innerH",E="top",S="deltaH",M="contentH",N="left",W="w",T="x",P="innerW",D="minW",A="right",B="deltaW",O="contentW"):(C="x",_="w",R="minW",k="maxW",H="innerW",E="left",S="deltaW",M="contentW",N="top",W="h",T="y",P="innerH",D="minH",A="bottom",B="deltaH",O="contentH"),d=r[H]-o[E]-o[E],w=c=0,t=0,n=i.length;t<n;
t++)m=(h=i[t]).layoutRect(),d-=t<n-1?u:0,0<(g=h.settings.flex)&&(c+=g,m[k]&&z.push(h),m.flex=g),d-=m[R],w<(p=o[N]+m[D]+o[A])&&(w=p);if((y={})[R]=d<0?r[R]-d+r[S]:r[H]-d+r[S],y[D]=w+r[B],y[M]=r[H]-d,y[O]=w,y.minW=I(y.minW,r.maxW),y.minH=I(y.minH,r.maxH),y.minW=L(y.minW,r.startMinWidth),y.minH=L(y.minH,r.startMinHeight),!r.autoResize||y.minW===r.minW&&y.minH===r.minH){for(b=d/c,t=0,n=z.length;t<n;t++)(v=(m=(h=z[t]).layoutRect())[k])<(p=m[R]+m.flex*b)?(d-=m[k]-m[R],c-=m.flex,m.flex=0,m.maxFlexSize=v):m.maxFlexSize=0;for(b=d/c,x=o[E],y={},0===c&&("end"===l?x=d+o[E]:"center"===l?(x=Math.round(r[H]/2-(r[H]-d)/2)+o[E])<0&&(x=o[E]):"justify"===l&&(x=o[E],u=Math.floor(d/(i.length-1)))),y[T]=o[N],t=0,n=i.length;t<n;t++)p=(m=(h=i[t]).layoutRect()).maxFlexSize||m[R],"center"===a?y[T]=Math.round(r[P]/2-m[W]/2):"stretch"===a?(y[W]=L(m[D]||0,r[P]-o[N]-o[A]),y[T]=o[N]):&q
uot;end"===a&&(y[T]=r[P]-m[W]-o.top),0<m.flex&&(p+=m.flex*b),y[_]=p,y[C]=x,h.layoutRect(y),h.recalc&&h.recalc(),x+=p+u}else if(y.w=y.minW,y.h=y.minH,e.layoutRect(y),this.recalc(e),null===e._lastRect){var F=e.parent();F&&(F._lastRect=null,F.recalc())}}}),Li=Jt.extend({Defaults:{containerClass:"flow-layout",controlClass:"flow-layout-item",endClass:"break"},recalc:function(e){e.items().filter(":visible").each(function(e){e.recalc&&e.recalc()})},isNative:function(){return!0}}),Ii=function(e,t){return di.one(t,e)},Fi=function(e,t){return function(){e.execCommand("mceToggleFormat",!1,t)}},Ui=function(e,n){return function(){var t=this;e.formatter?e.formatter.formatChanged(n,function(e){t.active(e)}):e.on("init",function(){e.formatter.formatChanged(n,function(e){t.active(e)})})}},Vi=function(n){n.addMenuItem("align",{text:"Align",menu:[{text:"Left",icon:&
quot;alignleft",onclick:Fi(n,"alignleft")},{text:"Center",icon:"aligncenter",onclick:Fi(n,"aligncenter")},{text:"Right",icon:"alignright",onclick:Fi(n,"alignright")},{text:"Justify",icon:"alignjustify",onclick:Fi(n,"alignjustify")}]}),w.each({alignleft:["Align left","JustifyLeft"],aligncenter:["Align center","JustifyCenter"],alignright:["Align right","JustifyRight"],alignjustify:["Justify","JustifyFull"],alignnone:["No alignment","JustifyNone"]},function(e,t){n.addButton(t,{active:!1,tooltip:e[0],cmd:e[1],onPostRender:Ui(n,t)})})},ji=function(e){return e?e.split(",")[0]:""},qi=function(a,l){return function(){var s=this;a.on("init nodeChange",function(e){var t,n,i,r=a.queryCommandValue("FontName"),o=(t=l,n=r,w.each(t,function(e){e.value.toLowe
rCase()===n.toLowerCase()&&(i=e.value)}),w.each(t,function(e){i||ji(e.value).toLowerCase()!==ji(n).toLowerCase()||(i=e.value)}),i);s.value(o||null),!o&&r&&s.text(ji(r))})}},Yi=function(n){n.addButton("fontselect",function(){var e,t=(e=function(e){for(var t=(e=e.replace(/;$/,"").split(";")).length;t--;)e[t]=e[t].split("=");return e}(n.settings.font_formats||"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,z
apf dingbats"),w.map(e,function(e){return{text:{raw:e[0]},value:e[1],textStyle:-1===e[1].indexOf("dings")?"font-family:"+e[1]:""}}));return{type:"listbox",text:"Font Family",tooltip:"Font Family",values:t,fixedWidth:!0,onPostRender:qi(n,t),onselect:function(e){e.control.settings.value&&n.execCommand("FontName",!1,e.control.settings.value)}}})},$i=function(e){Yi(e)},Xi=function(e,t){return/[0-9.]+px$/.test(e)?(n=72*parseInt(e,10)/96,i=t||0,r=Math.pow(10,i),Math.round(n*r)/r+"pt"):e;var n,i,r},Ji=function(e,t,n){var i;return w.each(e,function(e){e.value===n?i=n:e.value===t&&(i=t)}),i},Gi=function(n){n.addButton("fontsizeselect",function(){var e,s,a,t=(e=n.settings.fontsize_formats||"8pt 10pt 12pt 14pt 18pt 24pt 36pt",w.map(e.split(" "),function(e){var t=e,n=e,i=e.split("=");return 1<i.length&&(t=i[0],n=i[1]),{text:t,value:n}}));return{
type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:t,fixedWidth:!0,onPostRender:(s=n,a=t,function(){var o=this;s.on("init nodeChange",function(e){var t,n,i,r;if(t=s.queryCommandValue("FontSize"))for(i=3;!r&&0<=i;i--)n=Xi(t,i),r=Ji(a,n,t);o.value(r||null),r||o.text(n)})}),onclick:function(e){e.control.settings.value&&n.execCommand("FontSize",!1,e.control.settings.value)}}})},Ki=function(e){Gi(e)},Zi=function(n,e){var i=e.length;return w.each(e,function(e){e.menu&&(e.hidden=0===Zi(n,e.menu));var t=e.format;t&&(e.hidden=!n.formatter.canApply(t)),e.hidden&&i--}),i},Qi=function(n,e){var i=e.items().length;return e.items().each(function(e){e.menu&&e.visible(0<Qi(n,e.menu)),!e.menu&&e.settings.menu&&e.visible(0<Zi(n,e.settings.menu));var t=e.settings.format;t&&e.visible(n.formatter.canApply(t)),e.visible()||i--}),i},er=function(e){var i,r,o,
t,s,n,a,l,u=(r=0,o=[],t=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:
"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"Justify",icon:"alignjustify",format:"alignjustify"}]}],s=function(e){var i=[];if(e)return w.each(e,function(e){var t={text:e.title,icon:e.icon};if(e.items)t.menu=s(e.items);else{var n=e.format||"custom"+r++;e.format||(e.name=n,o.push(e)),t.format=n,t.cmd=e.cmd}i.push(t)}),i},(i=e).on("init",function(){w.each(o,function(e){i.formatter.register(e.name,e)})}),{type:"menu",items:i.settings.style_formats_merg
e?i.settings.style_formats?s(t.concat(i.settings.style_formats)):s(t):s(i.settings.style_formats||t),onPostRender:function(e){i.fire("renderFormatsMenu",{control:e.control})},itemDefaults:{preview:!0,textStyle:function(){if(this.settings.format)return i.formatter.getCssText(this.settings.format)},onPostRender:function(){var n=this;n.parent().on("show",function(){var e,t;(e=n.settings.format)&&(n.disabled(!i.formatter.canApply(e)),n.active(i.formatter.match(e))),(t=n.settings.cmd)&&n.active(i.queryCommandState(t))})},onclick:function(){this.settings.format&&Fi(i,this.settings.format)(),this.settings.cmd&&i.execCommand(this.settings.cmd)}}});n=u,e.addMenuItem("formats",{text:"Formats",menu:n}),l=u,(a=e).addButton("styleselect",{type:"menubutton",text:"Formats",menu:l,onShowMenu:function(){a.settings.style_formats_autohide&&Qi(a,this.menu)}})},tr=function(n,e){return function()
{var r,o,s,t=[];return w.each(e,function(e){t.push({text:e[0],value:e[1],textStyle:function(){return n.formatter.getCssText(e[1])}})}),{type:"listbox",text:e[0][0],values:t,fixedWidth:!0,onselect:function(e){if(e.control){var t=e.control.value();Fi(n,t)()}},onPostRender:(r=n,o=t,function(){var t=this;r.on("nodeChange",function(e){var n=r.formatter,i=null;w.each(e.parents,function(t){if(w.each(o,function(e){if(s?n.matchNode(t,s,{value:e.value})&&(i=e.value):n.matchNode(t,e.value)&&(i=e.value),i)return!1}),i)return!1}),t.value(i)})})}}},nr=function(e){var t,n,i=function(e){for(var t=(e=e.replace(/;$/,"").split(";")).length;t--;)e[t]=e[t].split("=");return e}(e.settings.block_formats||"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre");e.addMenuItem("blockformats",{text:"Blocks",menu:(t=e,n=i,w.map(n,function(e){return{text:e[0],oncli
ck:Fi(t,e[1]),textStyle:function(){return t.formatter.getCssText(e[1])}}}))}),e.addButton("formatselect",tr(e,i))},ir=function(t,e){var n,i;if("string"==typeof e)i=e.split(" ");else if(w.isArray(e))return ie.flatten(w.map(e,function(e){return ir(t,e)}));return n=w.grep(i,function(e){return"|"===e||e in t.menuItems}),w.map(n,function(e){return"|"===e?{text:"-"}:t.menuItems[e]})},rr=function(e){return e&&"-"===e.text},or=function(e){var t=ie.filter(e,function(e,t,n){return!rr(e)||!rr(n[t-1])});return ie.filter(t,function(e,t,n){return!rr(e)||0<t&&t<n.length-1})},sr=function(e){var t,n,i,r,o=e.settings.insert_button_items;return or(o?ir(e,o):(t=e,n="insert",i=[{text:"-"}],r=w.grep(t.menuItems,function(e){return e.context===n}),w.each(r,function(e){"before"===e.separator&&i.push({text:"|"}),e.prependToContext?i.unshift(e):i.push(e),"after"
===e.separator&&i.push({text:"|"})}),i))},ar=function(e){var t;(t=e).addButton("insert",{type:"menubutton",icon:"insert",menu:[],oncreatemenu:function(){this.menu.add(sr(t)),this.menu.renderNew()}})},lr=function(e){var n,i,r;n=e,w.each({bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript"},function(e,t){n.addButton(t,{active:!1,tooltip:e,onPostRender:Ui(n,t),onclick:Fi(n,t)})}),i=e,w.each({outdent:["Decrease indent","Outdent"],indent:["Increase indent","Indent"],cut:["Cut","Cut"],copy:["Copy","Copy"],paste:["Paste","Paste"],help:["Help","mceHelp"],selectall:["Select all","SelectAll"],visualaid:["Visual aids","mceToggleVisualAid"],newdocument:[&qu
ot;New document","mceNewDocument"],removeformat:["Clear formatting","RemoveFormat"],remove:["Remove","Delete"]},function(e,t){i.addButton(t,{tooltip:e[0],cmd:e[1]})}),r=e,w.each({blockquote:["Blockquote","mceBlockQuote"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"]},function(e,t){r.addButton(t,{active:!1,tooltip:e[0],cmd:e[1],onPostRender:Ui(r,t)})})},ur=function(e){var n;lr(e),n=e,w.each({bold:["Bold","Bold","Meta+B"],italic:["Italic","Italic","Meta+I"],underline:["Underline","Underline","Meta+U"],strikethrough:["Strikethrough","Strikethrough"],subscript:["Subscript","Subscript"],superscript:["Superscript","Superscript"],removeformat:["Clear formatting","RemoveFormat"],
newdocument:["New document","mceNewDocument"],cut:["Cut","Cut","Meta+X"],copy:["Copy","Copy","Meta+C"],paste:["Paste","Paste","Meta+V"],selectall:["Select all","SelectAll","Meta+A"]},function(e,t){n.addMenuItem(t,{text:e[0],icon:t,shortcut:e[2],cmd:e[1]})}),n.addMenuItem("codeformat",{text:"Code",icon:"code",onclick:Fi(n,"code")})},cr=function(n,i){return function(){var e=this,t=function(){var e="redo"===i?"hasRedo":"hasUndo";return!!n.undoManager&&n.undoManager[e]()};e.disabled(!t()),n.on("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",function(){e.disabled(n.readonly||!t())})}},dr=function(e){var t,n;(t=e).addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onPostRender:cr(t,"undo"),cmd:"
undo"}),t.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onPostRender:cr(t,"redo"),cmd:"redo"}),(n=e).addButton("undo",{tooltip:"Undo",onPostRender:cr(n,"undo"),cmd:"undo"}),n.addButton("redo",{tooltip:"Redo",onPostRender:cr(n,"redo"),cmd:"redo"})},fr=function(e){var t,n;(t=e).addMenuItem("visualaid",{text:"Visual aids",selectable:!0,onPostRender:(n=t,function(){var t=this;n.on("VisualAid",function(e){t.active(e.hasVisual)}),t.active(n.hasVisual)}),cmd:"mceToggleVisualAid"})},hr={setup:function(e){var t;e.rtl&&(lt.rtl=!0),e.on("mousedown",function(){St.hideAll()}),(t=e).settings.ui_container&&(me.container=Ii(yn.fromDom(document.body),t.settings.ui_container).fold(k.constant(null),function(e){return e.dom()})),Bt.tooltips=!me.iOS,lt.translate=function(e){return
l.translate(e)},nr(e),Vi(e),ur(e),dr(e),Ki(e),$i(e),er(e),fr(e),ar(e)}},mr=Gt.extend({recalc:function(e){var t,n,i,r,o,s,a,l,u,c,d,f,h,m,g,p,v,b,y,x,w,_,R,C,k,E,H,S,M=[],T=[];t=e.settings,r=e.items().filter(":visible"),o=e.layoutRect(),i=t.columns||Math.ceil(Math.sqrt(r.length)),n=Math.ceil(r.length/i),b=t.spacingH||t.spacing||0,y=t.spacingV||t.spacing||0,x=t.alignH||t.align,w=t.alignV||t.align,p=e.paddingBox,S="reverseRows"in t?t.reverseRows:e.isRtl(),x&&"string"==typeof x&&(x=[x]),w&&"string"==typeof w&&(w=[w]);for(d=0;d<i;d++)M.push(0);for(f=0;f<n;f++)T.push(0);for(f=0;f<n;f++)for(d=0;d<i&&(c=r[f*i+d]);d++)C=(u=c.layoutRect()).minW,k=u.minH,M[d]=C>M[d]?C:M[d],T[f]=k>T[f]?k:T[f];for(E=o.innerW-p.left-p.right,d=_=0;d<i;d++)_+=M[d]+(0<d?b:0),E-=(0<d?b:0)+M[d];for(H=o.innerH-p.top-p.bottom,f=R=0;f<n;f++)R+=T[f]+(0<f?y:0),H-=(0<f?y:0)+T[f];if(_+=p.left+p.right,R+=p.top+
p.bottom,(l={}).minW=_+(o.w-o.innerW),l.minH=R+(o.h-o.innerH),l.contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH,l.minW=Math.min(l.minW,o.maxW),l.minH=Math.min(l.minH,o.maxH),l.minW=Math.max(l.minW,o.startMinWidth),l.minH=Math.max(l.minH,o.startMinHeight),!o.autoResize||l.minW===o.minW&&l.minH===o.minH){var P;o.autoResize&&((l=e.layoutRect(l)).contentW=l.minW-o.deltaW,l.contentH=l.minH-o.deltaH),P="start"===t.packV?0:0<H?Math.floor(H/n):0;var W=0,D=t.flexWidths;if(D)for(d=0;d<D.length;d++)W+=D[d];else W=i;var N=E/W;for(d=0;d<i;d++)M[d]+=D?D[d]*N:N;for(m=p.top,f=0;f<n;f++){for(h=p.left,a=T[f]+P,d=0;d<i&&(c=r[S?f*i+i-1-d:f*i+d]);d++)g=c.settings,u=c.layoutRect(),s=Math.max(M[d],u.startMinWidth),u.x=h,u.y=m,"center"===(v=g.alignH||(x?x[d]||x[0]:null))?u.x=h+s/2-u.w/2:"right"===v?u.x=h+s-u.w:"stretch"===v&&(u.w=s),"center"===(v=g.alignV||(w?w[d]||w[0]:null))?u.y=m+a/2-u.h/2:"bottom&q
uot;===v?u.y=m+a-u.h:"stretch"===v&&(u.h=a),c.layoutRect(u),h+=s+b,c.recalc&&c.recalc();m+=a+y}}else if(l.w=l.minW,l.h=l.minH,e.layoutRect(l),this.recalc(e),null===e._lastRect){var A=e.parent();A&&(A._lastRect=null,A.recalc())}}}),gr=Bt.extend({renderHtml:function(){var e=this;return e.classes.add("iframe"),e.canFocus=!1,'<iframe id="'+e._id+'" class="'+e.classes+'" tabindex="-1" src="'+(e.settings.url||"javascript:''")+'" frameborder="0"></iframe>'},src:function(e){this.getEl().src=e},html:function(e,t){var n=this,i=this.getEl().contentWindow.document.body;return i?(i.innerHTML=e,t&&t()):u.setTimeout(function(){n.html(e)}),this}}),pr=Bt.extend({init:function(e){this._super(e),this.classes.add("widget").add("infobox"),this.canFocus=!1},severity:function(e){this.classes.remove("error"),this.classes.remove("warning"),this.c
lasses.remove("success"),this.classes.add(e)},help:function(e){this.state.set("help",e)},renderHtml:function(){var e=this,t=e.classPrefix;return'<div id="'+e._id+'" class="'+e.classes+'"><div id="'+e._id+'-body">'+e.encode(e.state.get("text"))+'<button role="button" tabindex="-1"><i class="'+t+"ico "+t+'i-help"></i></button></div></div>'},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.getEl("body").firstChild.data=t.encode(e.value),t.state.get("rendered")&&t.updateLayoutRect()}),t.state.on("change:help",function(e){t.classes.toggle("has-help",e.value),t.state.get("rendered")&&t.updateLayoutRect()}),t._super()}}),vr=Bt.extend({init:function(e){var t=this;t._super(e),t.classes.add("widget").add("label"),t.canFocus
=!1,e.multiline&&t.classes.add("autoscroll"),e.strong&&t.classes.add("strong")},initLayoutRect:function(){var e=this,t=e._super();return e.settings.multiline&&(ke.getSize(e.getEl()).width>t.maxW&&(t.minW=t.maxW,e.classes.add("multiline")),e.getEl().style.width=t.minW+"px",t.startMinH=t.h=t.minH=Math.min(t.maxH,ke.getSize(e.getEl()).height)),t},repaint:function(){return this.settings.multiline||(this.getEl().style.lineHeight=this.layoutRect().h+"px"),this._super()},severity:function(e){this.classes.remove("error"),this.classes.remove("warning"),this.classes.remove("success"),this.classes.add(e)},renderHtml:function(){var e,t,n=this,i=n.settings.forId,r=n.settings.html?n.settings.html:n.encode(n.state.get("text"));return!i&&(t=n.settings.forName)&&(e=n.getRoot().find("#"+t)[0])&&(i=e._id),i?'<label id="'+n._id+'" cl
ass="'+n.classes+'"'+(i?' for="'+i+'"':"")+">"+r+"</label>":'<span id="'+n._id+'" class="'+n.classes+'">'+r+"</span>"},bindStates:function(){var t=this;return t.state.on("change:text",function(e){t.innerHtml(t.encode(e.value)),t.state.get("rendered")&&t.updateLayoutRect()}),t._super()}}),br=ft.extend({Defaults:{role:"toolbar",layout:"flow"},init:function(e){this._super(e),this.classes.add("toolbar")},postRender:function(){return this.items().each(function(e){e.classes.add("toolbar-item")}),this._super()}}),yr=br.extend({Defaults:{role:"menubar",containerCls:"menubar",ariaRoot:!0,defaults:{type:"menubutton"}}}),xr=Kt.extend({init:function(e){var t=this;t._renderOpen=!0,t._super(e),e=t.settings,t.classes.add("menubtn"),e.fixedWidth&&t.classes.add("fixed-width"),
t.aria("haspopup",!0),t.state.set("menu",e.menu||t.render())},showMenu:function(e){var t,n=this;if(n.menu&&n.menu.visible()&&!1!==e)return n.hideMenu();n.menu||(t=n.state.get("menu")||[],n.classes.add("opened"),t.length?t={type:"menu",animate:!0,items:t}:(t.type=t.type||"menu",t.animate=!0),t.renderTo?n.menu=t.parent(n).show().renderTo():n.menu=v.create(t).parent(n).renderTo(),n.fire("createmenu"),n.menu.reflow(),n.menu.on("cancel",function(e){e.control.parent()===n.menu&&(e.stopPropagation(),n.focus(),n.hideMenu())}),n.menu.on("select",function(){n.focus()}),n.menu.on("show hide",function(e){e.control===n.menu&&(n.activeMenu("show"===e.type),n.classes.toggle("opened","show"===e.type)),n.aria("expanded","show"===e.type)}).fire("show")),n.menu.show(),n.menu.layoutRect({w:n.layoutRect().w}),n.men
u.repaint(),n.menu.moveRel(n.getEl(),n.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"]),n.fire("showmenu")},hideMenu:function(){this.menu&&(this.menu.items().each(function(e){e.hideMenu&&e.hideMenu()}),this.menu.hide())},activeMenu:function(e){this.classes.toggle("active",e)},renderHtml:function(){var e,t=this,n=t._id,i=t.classPrefix,r=t.settings.icon,o=t.state.get("text"),s="";return(e=t.settings.image)?(r="none","string"!=typeof e&&(e=window.getSelection?e[0]:e[1]),e=" style=\"background-image: url('"+e+"')\""):e="",o&&(t.classes.add("btn-has-text"),s='<span class="'+i+'txt">'+t.encode(o)+"</span>"),r=t.settings.icon?i+"ico "+i+"i-"+r:"",t.aria("role",t.parent()instanceof yr?"menuitem":"button"),'<div id="'+
n+'" class="'+t.classes+'" tabindex="-1" aria-labelledby="'+n+'"><button id="'+n+'-open" role="presentation" type="button" tabindex="-1">'+(r?'<i class="'+r+'"'+e+"></i>":"")+s+' <i class="'+i+'caret"></i></button></div>'},postRender:function(){var r=this;return r.on("click",function(e){e.control===r&&function(e,t){for(;e;){if(t===e)return!0;e=e.parentNode}return!1}(e.target,r.getEl())&&(r.focus(),r.showMenu(!e.aria),e.aria&&r.menu.items().filter(":visible")[0].focus())}),r.on("mouseenter",function(e){var t,n=e.control,i=r.parent();n&&i&&n instanceof xr&&n.parent()===i&&(i.items().filter("MenuButton").each(function(e){e.hideMenu&&e!==n&&(e.menu&&e.menu.visible()&&(t=!0),e.hideMenu())}),t&&(n.
focus(),n.showMenu()))}),r._super()},bindStates:function(){var e=this;return e.state.on("change:menu",function(){e.menu&&e.menu.remove(),e.menu=null}),e._super()},remove:function(){this._super(),this.menu&&this.menu.remove()}}),wr=St.extend({Defaults:{defaultType:"menuitem",border:1,layout:"stack",role:"application",bodyRole:"menu",ariaRoot:!0},init:function(e){if(e.autohide=!0,e.constrainToViewport=!0,"function"==typeof e.items&&(e.itemsFactory=e.items,e.items=[]),e.itemDefaults)for(var t=e.items,n=t.length;n--;)t[n]=w.extend({},e.itemDefaults,t[n]);this._super(e),this.classes.add("menu"),e.animate&&11!==me.ie&&this.classes.add("animate")},repaint:function(){return this.classes.toggle("menu-align",!0),this._super(),this.getEl().style.height="",this.getEl("body").style.height="",this},cancel:function(){this.hideAll(),this.fir
e("select")},load:function(){var t,n=this;function i(){n.throbber&&(n.throbber.hide(),n.throbber=null)}n.settings.itemsFactory&&(n.throbber||(n.throbber=new Wt(n.getEl("body"),!0),0===n.items().length?(n.throbber.show(),n.fire("loading")):n.throbber.show(100,function(){n.items().remove(),n.fire("loading")}),n.on("hide close",i)),n.requestTime=t=(new Date).getTime(),n.settings.itemsFactory(function(e){0!==e.length?n.requestTime===t&&(n.getEl().style.width="",n.getEl("body").style.width="",i(),n.items().remove(),n.getEl("body").innerHTML="",n.add(e),n.renderNew(),n.fire("loaded")):n.hide()}))},hideAll:function(){return this.find("menuitem").exec("hideMenu"),this._super()},preRender:function(){var n=this;return n.items().each(function(e){var t=e.settings;if(t.icon||t.image||t.selectable)return!(n._hasIcons=!0)}),n.settings.itemsFactor
y&&n.on("postrender",function(){n.settings.itemsFactory&&n.load()}),n.on("show hide",function(e){e.control===n&&("show"===e.type?u.setTimeout(function(){n.classes.add("in")},0):n.classes.remove("in"))}),n._super()}}),_r=xr.extend({init:function(i){var t,r,o,n,s=this;s._super(i),i=s.settings,s._values=t=i.values,t&&("undefined"!=typeof i.value&&function e(t){for(var n=0;n<t.length;n++){if(r=t[n].selected||i.value===t[n].value)return o=o||t[n].text,s.state.set("value",t[n].value),!0;if(t[n].menu&&e(t[n].menu))return!0}}(t),!r&&0<t.length&&(o=t[0].text,s.state.set("value",t[0].value)),s.state.set("menu",t)),s.state.set("text",i.text||o),s.classes.add("listbox"),s.on("select",function(e){var t=e.control;n&&(e.lastControl=n),i.multiple?t.active(!t.active()):s.value(e.control.value()),n=t})},va
lue:function(t){return 0===arguments.length?this.state.get("value"):(void 0===t||(this.settings.values?0<w.grep(this.settings.values,function(e){return e.value===t}).length?this.state.set("value",t):null===t&&this.state.set("value",null):this.state.set("value",t)),this)},bindStates:function(){var i=this;return i.on("show",function(e){var t,n;t=e.control,n=i.value(),t instanceof wr&&t.items().each(function(e){e.hasMenus()||e.active(e.value()===n)})}),i.state.on("change:value",function(t){var n=function e(t,n){var i;if(t)for(var r=0;r<t.length;r++){if(t[r].value===n)return t[r];if(t[r].menu&&(i=e(t[r].menu,n)))return i}}(i.state.get("menu"),t.value);n?i.text(n.text):i.text(i.settings.text)}),i._super()}}),Rr=Bt.extend({Defaults:{border:0,role:"menuitem"},init:function(e){var t,n=this;n._super(e),e=n.settings,n.classes.add("menu-item"),e.menu&&n.classes.add(&q
uot;menu-item-expand"),e.preview&&n.classes.add("menu-item-preview"),"-"!==(t=n.state.get("text"))&&"|"!==t||(n.classes.add("menu-item-sep"),n.aria("role","separator"),n.state.set("text","-")),e.selectable&&(n.aria("role","menuitemcheckbox"),n.classes.add("menu-item-checkbox"),e.icon="selected"),e.preview||e.selectable||n.classes.add("menu-item-normal"),n.on("mousedown",function(e){e.preventDefault()}),e.menu&&!e.ariaHideMenu&&n.aria("haspopup",!0)},hasMenus:function(){return!!this.settings.menu},showMenu:function(){var t,n=this,e=n.settings,i=n.parent();if(i.items().each(function(e){e!==n&&e.hideMenu()}),e.menu){(t=n.menu)?t.show():((t=e.menu).length?t={type:"menu",items:t}:t.type=t.type||"menu",i.settings.itemDefaults&&(t.itemDefaults=i.setting
s.itemDefaults),(t=n.menu=v.create(t).parent(n).renderTo()).reflow(),t.on("cancel",function(e){e.stopPropagation(),n.focus(),t.hide()}),t.on("show hide",function(e){e.control.items&&e.control.items().each(function(e){e.active(e.settings.selected)})}).fire("show"),t.on("hide",function(e){e.control===t&&n.classes.remove("selected")}),t.submenu=!0),t._parentMenu=i,t.classes.add("menu-sub");var r=t.testMoveRel(n.getEl(),n.isRtl()?["tl-tr","bl-br","tr-tl","br-bl"]:["tr-tl","br-bl","tl-tr","bl-br"]);t.moveRel(n.getEl(),r),r="menu-sub-"+(t.rel=r),t.classes.remove(t._lastRel).add(r),t._lastRel=r,n.classes.add("selected"),n.aria("expanded",!0)}},hideMenu:function(){var e=this;return e.menu&&(e.menu.items().each(function(e){e.hideMenu&&e.hideMenu()}),e.menu.hide(),e.aria("expanded",!1
)),e},renderHtml:function(){var e,t=this,n=t._id,i=t.settings,r=t.classPrefix,o=t.state.get("text"),s=t.settings.icon,a="",l=i.shortcut,u=t.encode(i.url);function c(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function d(e){var t=i.match||"";return t?e.replace(new RegExp(c(t),"gi"),function(e){return"!mce~match["+e+"]mce~match!"}):e}function f(e){return e.replace(new RegExp(c("!mce~match["),"g"),"<b>").replace(new RegExp(c("]mce~match!"),"g"),"</b>")}return s&&t.parent().classes.add("menu-has-icons"),i.image&&(a=" style=\"background-image: url('"+i.image+"')\""),l&&(l=function(e){var t,n,i={};for(i=me.mac?{alt:"⌥",ctrl:"⌘",shift:"⇧",meta:"⌘"}:{meta:"Ctrl"},e=e.split("+"
),t=0;t<e.length;t++)(n=i[e[t].toLowerCase()])&&(e[t]=n);return e.join("+")}(l)),s=r+"ico "+r+"i-"+(t.settings.icon||"none"),e="-"!==o?'<i class="'+s+'"'+a+"></i>\xa0":"",o=f(t.encode(d(o))),u=f(t.encode(d(u))),'<div id="'+n+'" class="'+t.classes+'" tabindex="-1">'+e+("-"!==o?'<span id="'+n+'-text" class="'+r+'text">'+o+"</span>":"")+(l?'<div id="'+n+'-shortcut" class="'+r+'menu-shortcut">'+l+"</div>":"")+(i.menu?'<div class="'+r+'caret"></div>':"")+(u?'<div class="'+r+'menu-item-link">'+u+"</div>":"")+"</div>"},postRender:function(){var t=this,n=t.settings,e=n.textStyle;if("function"==typeof e&&(e=e.call(this)),e){var i=t.getEl
("text");i&&(i.setAttribute("style",e),t._textStyle=e)}return t.on("mouseenter click",function(e){e.control===t&&(n.menu||"click"!==e.type?(t.showMenu(),e.aria&&t.menu.focus(!0)):(t.fire("select"),u.requestAnimationFrame(function(){t.parent().hideAll()})))}),t._super(),t},hover:function(){return this.parent().items().each(function(e){e.classes.remove("selected")}),this.classes.toggle("selected",!0),this},active:function(e){return function(e,t){var n=e._textStyle;if(n){var i=e.getEl("text");i.setAttribute("style",n),t&&(i.style.color="",i.style.backgroundColor="")}}(this,e),void 0!==e&&this.aria("checked",e),this._super(e)},remove:function(){this._super(),this.menu&&this.menu.remove()}}),Cr=en.extend({Defaults:{classes:"radio",role:"radio"}}),kr=Bt.extend({renderHtml:function(){var e=this,t=e.classP
refix;return e.classes.add("resizehandle"),"both"===e.settings.direction&&e.classes.add("resizehandle-both"),e.canFocus=!1,'<div id="'+e._id+'" class="'+e.classes+'"><i class="'+t+"ico "+t+'i-resize"></i></div>'},postRender:function(){var t=this;t._super(),t.resizeDragHelper=new mt(this._id,{start:function(){t.fire("ResizeStart")},drag:function(e){"both"!==t.settings.direction&&(e.deltaX=0),t.fire("Resize",e)},stop:function(){t.fire("ResizeEnd")}})},remove:function(){return this.resizeDragHelper&&this.resizeDragHelper.destroy(),this._super()}});function Er(e){var t="";if(e)for(var n=0;n<e.length;n++)t+='<option value="'+e[n]+'">'+e[n]+"</option>";return t}var Hr=Bt.extend({Defaults:{classes:"selectbox",role:"selectbox",options:[]},init:function(e){var n=this;n._su
per(e),n.settings.size&&(n.size=n.settings.size),n.settings.options&&(n._options=n.settings.options),n.on("keydown",function(e){var t;13===e.keyCode&&(e.preventDefault(),n.parents().reverse().each(function(e){if(e.toJSON)return t=e,!1}),n.fire("submit",{data:t.toJSON()}))})},options:function(e){return arguments.length?(this.state.set("options",e),this):this.state.get("options")},renderHtml:function(){var e,t=this,n="";return e=Er(t._options),t.size&&(n=' size = "'+t.size+'"'),'<select id="'+t._id+'" class="'+t.classes+'"'+n+">"+e+"</select>"},bindStates:function(){var t=this;return t.state.on("change:options",function(e){t.getEl().innerHTML=Er(e.value)}),t._super()}});function Sr(e,t,n){return e<t&&(e=t),n<e&&(e=n),e}function Mr(e,t,n){e.setAttribute("aria-"+t,n)}function Tr(e,t){var n,i,r,o,s;"
v"===e.settings.orientation?(r="top",i="height",n="h"):(r="left",i="width",n="w"),s=e.getEl("handle"),o=((e.layoutRect()[n]||100)-ke.getSize(s)[i])*((t-e._minValue)/(e._maxValue-e._minValue))+"px",s.style[r]=o,s.style.height=e.layoutRect().h+"px",Mr(s,"valuenow",t),Mr(s,"valuetext",""+e.settings.previewFilter(t)),Mr(s,"valuemin",e._minValue),Mr(s,"valuemax",e._maxValue)}var Pr=Bt.extend({init:function(e){var t=this;e.previewFilter||(e.previewFilter=function(e){return Math.round(100*e)/100}),t._super(e),t.classes.add("slider"),"v"===e.orientation&&t.classes.add("vertical"),t._minValue=V.isNumber(e.minValue)?e.minValue:0,t._maxValue=V.isNumber(e.maxValue)?e.maxValue:100,t._initValue=t.state.get("value")},renderHtml:function(){var e=this._id,t=this.classPrefix;return'<div id="'+e+'"
class="'+this.classes+'"><div id="'+e+'-handle" class="'+t+'slider-handle" role="slider" tabindex="-1"></div></div>'},reset:function(){this.value(this._initValue).repaint()},postRender:function(){var e,t,n,i,r,o,s,a,l,u,c,d,f,h,m=this;e=m._minValue,t=m._maxValue,"v"===m.settings.orientation?(n="screenY",i="top",r="height",o="h"):(n="screenX",i="left",r="width",o="w"),m._super(),function(o,s){function t(e){var t,n,i,r;t=Sr(t=(((t=m.value())+(r=n=o))/((i=s)-r)+.05*e)*(i-n)-n,o,s),m.value(t),m.fire("dragstart",{value:t}),m.fire("drag",{value:t}),m.fire("dragend",{value:t})}m.on("keydown",function(e){switch(e.keyCode){case 37:case 38:t(-1);break;case 39:case 40:t(1)}})}(e,t),s=e,a=t,l=m.getEl("handle"),m._dragHelper=new mt(m._id,{handle:m._id+"-handle",start:function(e)
{u=e[n],c=parseInt(m.getEl("handle").style[i],10),d=(m.layoutRect()[o]||100)-ke.getSize(l)[r],m.fire("dragstart",{value:h})},drag:function(e){var t=e[n]-u;f=Sr(c+t,0,d),l.style[i]=f+"px",h=s+f/d*(a-s),m.value(h),m.tooltip().text(""+m.settings.previewFilter(h)).show().moveRel(l,"bc tc"),m.fire("drag",{value:h})},stop:function(){m.tooltip().hide(),m.fire("dragend",{value:h})}})},repaint:function(){this._super(),Tr(this,this.value())},bindStates:function(){var t=this;return t.state.on("change:value",function(e){Tr(t,e.value)}),t._super()}}),Wr=Bt.extend({renderHtml:function(){return this.classes.add("spacer"),this.canFocus=!1,'<div id="'+this._id+'" class="'+this.classes+'"></div>'}}),Dr=xr.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var e,t,n=this.getEl(),i=this.layoutRect();return this._super(),e=n.firstChi
ld,t=n.lastChild,Re(e).css({width:i.w-ke.getSize(t).width,height:i.h-2}),Re(t).css({height:i.h-2}),this},activeMenu:function(e){Re(this.getEl().lastChild).toggleClass(this.classPrefix+"active",e)},renderHtml:function(){var e,t,n=this,i=n._id,r=n.classPrefix,o=n.state.get("icon"),s=n.state.get("text"),a=n.settings,l="";return(e=a.image)?(o="none","string"!=typeof e&&(e=window.getSelection?e[0]:e[1]),e=" style=\"background-image: url('"+e+"')\""):e="",o=a.icon?r+"ico "+r+"i-"+o:"",s&&(n.classes.add("btn-has-text"),l='<span class="'+r+'txt">'+n.encode(s)+"</span>"),t="boolean"==typeof a.active?' aria-pressed="'+a.active+'"':"",'<div id="'+i+'" class="'+n.classes+'" role="button"'+t+' tabindex="-1"><button type="button&
quot; hidefocus="1" tabindex="-1">'+(o?'<i class="'+o+'"'+e+"></i>":"")+l+'</button><button type="button" class="'+r+'open" hidefocus="1" tabindex="-1">'+(n._menuBtnText?(o?"\xa0":"")+n._menuBtnText:"")+' <i class="'+r+'caret"></i></button></div>'},postRender:function(){var n=this.settings.onclick;return this.on("click",function(e){var t=e.target;if(e.control===this)for(;t;){if(e.aria&&"down"!==e.aria.key||"BUTTON"===t.nodeName&&-1===t.className.indexOf("open"))return e.stopImmediatePropagation(),void(n&&n.call(this,e));t=t.parentNode}}),delete this.settings.onclick,this._super()}}),Nr=Li.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"},isNative:function(){return!
0}}),Ar=xt.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(n){var e;this.activeTabId&&(e=this.getEl(this.activeTabId),Re(e).removeClass(this.classPrefix+"active"),e.setAttribute("aria-selected","false")),this.activeTabId="t"+n,(e=this.getEl("t"+n)).setAttribute("aria-selected","true"),Re(e).addClass(this.classPrefix+"active"),this.items()[n].show().fire("showtab"),this.reflow(),this.items().each(function(e,t){n!==t&&e.hide()})},renderHtml:function(){var i=this,e=i._layout,r="",o=i.classPrefix;return i.preRender(),e.preRender(i),i.items().each(function(e,t){var n=i._id+"-t"+t;e.aria("role","tabpanel"),e.aria("labelledby",n),r+='<div id="'+n+'" class="'+o+'tab" unselectable="on" role="tab" aria-controls="'+e._id+'" aria-select
ed="false" tabIndex="-1">'+i.encode(e.settings.title)+"</div>"}),'<div id="'+i._id+'" class="'+i.classes+'" hidefocus="1" tabindex="-1"><div id="'+i._id+'-head" class="'+o+'tabs" role="tablist">'+r+'</div><div id="'+i._id+'-body" class="'+i.bodyClasses+'">'+e.renderHtml(i)+"</div></div>"},postRender:function(){var i=this;i._super(),i.settings.activeTab=i.settings.activeTab||0,i.activateTab(i.settings.activeTab),this.on("click",function(e){var t=e.target.parentNode;if(t&&t.id===i._id+"-head")for(var n=t.childNodes.length;n--;)t.childNodes[n]===e.target&&i.activateTab(n)})},initLayoutRect:function(){var e,t,n,i=this;t=(t=ke.getSize(i.getEl("head")).width)<0?0:t,n=0,i.items().each(function(e){t=Math.max(t,e.layoutRect().minW),n=Math.max(n,e.layoutRect().minH)}),i.it
ems().each(function(e){e.settings.x=0,e.settings.y=0,e.settings.w=t,e.settings.h=n,e.layoutRect({x:0,y:0,w:t,h:n})});var r=ke.getSize(i.getEl("head")).height;return i.settings.minWidth=t,i.settings.minHeight=n+r,(e=i._super()).deltaH+=r,e.innerH=e.h-e.deltaH,e}}),Br=Bt.extend({init:function(e){var n=this;n._super(e),n.classes.add("textbox"),e.multiline?n.classes.add("multiline"):(n.on("keydown",function(e){var t;13===e.keyCode&&(e.preventDefault(),n.parents().reverse().each(function(e){if(e.toJSON)return t=e,!1}),n.fire("submit",{data:t.toJSON()}))}),n.on("keyup",function(e){n.state.set("value",e.target.value)}))},repaint:function(){var e,t,n,i,r,o=this,s=0;e=o.getEl().style,t=o._layoutRect,r=o._lastRepaintRect||{};var a=document;return!o.settings.multiline&&a.all&&(!a.documentMode||a.documentMode<=8)&&(e.lineHeight=t.h-s+"px"),i=(n=o.borderBox).left+n.right+8,s=n.top+n
.bottom+(o.settings.multiline?8:0),t.x!==r.x&&(e.left=t.x+"px",r.x=t.x),t.y!==r.y&&(e.top=t.y+"px",r.y=t.y),t.w!==r.w&&(e.width=t.w-i+"px",r.w=t.w),t.h!==r.h&&(e.height=t.h-s+"px",r.h=t.h),o._lastRepaintRect=r,o.fire("repaint",{},!1),o},renderHtml:function(){var t,e,n=this,i=n.settings;return t={id:n._id,hidefocus:"1"},w.each(["rows","spellcheck","maxLength","size","readonly","min","max","step","list","pattern","placeholder","required","multiple"],function(e){t[e]=i[e]}),n.disabled()&&(t.disabled="disabled"),i.subtype&&(t.type=i.subtype),(e=ke.create(i.multiline?"textarea":"input",t)).value=n.state.get("value"),e.className=n.classes,e.outerHTML},value:function(e){return arguments.length?(this.state.set("v
alue",e),this):(this.state.get("rendered")&&this.state.set("value",this.getEl().value),this.state.get("value"))},postRender:function(){var t=this;t.getEl().value=t.state.get("value"),t._super(),t.$el.on("change",function(e){t.state.set("value",e.target.value),t.fire("change",e)})},bindStates:function(){var t=this;return t.state.on("change:value",function(e){t.getEl().value!==e.value&&(t.getEl().value=e.value)}),t.state.on("change:disabled",function(e){t.getEl().disabled=e.value}),t._super()},remove:function(){this.$el.off(),this._super()}}),Or=function(){return{Selector:je,Collection:$e,ReflowQueue:tt,Control:lt,Factory:v,KeyboardNavigation:ct,Container:ft,DragHelper:mt,Scrollable:yt,Panel:xt,Movable:Pe,Resizable:wt,FloatPanel:St,Window:qt,MessageBox:$t,Tooltip:At,Widget:Bt,Progress:Ot,Notification:Lt,Layout:Jt,AbsoluteLayout:Gt,Button:Kt,ButtonGroup:Qt,Checkbox:en,ComboBox
:nn,ColorBox:rn,PanelButton:on,ColorButton:an,ColorPicker:un,Path:dn,ElementPath:fn,FormItem:hn,Form:mn,FieldSet:gn,FilePicker:Bi,FitLayout:Oi,FlexLayout:zi,FlowLayout:Li,FormatControls:hr,GridLayout:mr,Iframe:gr,InfoBox:pr,Label:vr,Toolbar:br,MenuBar:yr,MenuButton:xr,MenuItem:Rr,Throbber:Wt,Menu:wr,ListBox:_r,Radio:Cr,ResizeHandle:kr,SelectBox:Hr,Slider:Pr,Spacer:Wr,SplitButton:Dr,StackLayout:Nr,TabPanel:Ar,TextBox:Br,DropZone:cn,BrowseButton:Zt}},zr=function(n){n.ui?w.each(Or(),function(e,t){n.ui[t]=e}):n.ui=Or()};w.each(Or(),function(e,t){v.add(t,e)}),zr(window.tinymce?window.tinymce:{}),o.add("modern",function(e){return hr.setup(e),Xt(e)})}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcetinymcejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/tinymce.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/tinymce.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/tinymce.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,231 +1,624 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-// 4.6.7 (2017-09-18)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+// 4.7.11 (2018-04-11)
</ins><span class="cx" style="display: block; padding: 0 10px"> (function () {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+(function () {
+ 'use strict';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
-
-// Used when there is no 'main' module.
-// The name is probably (hopefully) unique so minification removes for releases.
-var register_3795 = function (id) {
- var module = dem(id);
- var fragments = id.split('.');
- var target = Function('return this;')();
- for (var i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined)
- target[fragments[i]] = {};
- target = target[fragments[i]];
- }
- target[fragments[fragments.length - 1]] = module;
-};
-
-var instantiate = function (id) {
- var actual = defs[id];
- var dependencies = actual.deps;
- var definition = actual.defn;
- var len = dependencies.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances[i] = dem(dependencies[i]);
- var defResult = definition.apply(null, instances);
- if (defResult === undefined)
- throw 'module [' + id + '] returned undefined';
- actual.instance = defResult;
-};
-
-var def = function (id, dependencies, definition) {
- if (typeof id !== 'string')
- throw 'module id must be a string';
- else if (dependencies === undefined)
- throw 'no dependencies for ' + id;
- else if (definition === undefined)
- throw 'no definition function for ' + id;
- defs[id] = {
- deps: dependencies,
- defn: definition,
- instance: undefined
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var noop = function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-};
-
-var dem = function (id) {
- var actual = defs[id];
- if (actual === undefined)
- throw 'module [' + id + '] was undefined';
- else if (actual.instance === undefined)
- instantiate(id);
- return actual.instance;
-};
-
-var req = function (ids, callback) {
- var len = ids.length;
- var instances = new Array(len);
- for (var i = 0; i < len; ++i)
- instances.push(dem(ids[i]));
- callback.apply(null, callback);
-};
-
-var ephox = {};
-
-ephox.bolt = {
- module: {
- api: {
- define: def,
- require: req,
- demand: dem
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var noarg = function (f) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return f();
+ };
+ };
+ var compose = function (fa, fb) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return fa(fb.apply(null, arguments));
+ };
+ };
+ var constant = function (value) {
+ return function () {
+ return value;
+ };
+ };
+ var identity = function (x) {
+ return x;
+ };
+ var tripleEquals = function (a, b) {
+ return a === b;
+ };
+ var curry = function (f) {
+ var x = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ x[_i - 1] = arguments[_i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-};
-
-var define = def;
-var require = req;
-var demand = dem;
-// this helps with minificiation when using a lot of global references
-var defineGlobal = function (id, ref) {
- define(id, [], function () { return ref; });
-};
-/*jsc
-["tinymce.core.api.Main","ephox.katamari.api.Fun","tinymce.core.api.Tinymce","global!Array","global!Error","tinymce.core.AddOnManager","tinymce.core.api.Formatter","tinymce.core.api.NotificationManager","tinymce.core.api.WindowManager","tinymce.core.dom.BookmarkManager","tinymce.core.dom.ControlSelection","tinymce.core.dom.DomQuery","tinymce.core.dom.DOMUtils","tinymce.core.dom.EventUtils","tinymce.core.dom.RangeUtils","tinymce.core.dom.ScriptLoader","tinymce.core.dom.Selection","tinymce.core.dom.Serializer","tinymce.core.dom.Sizzle","tinymce.core.dom.TreeWalker","tinymce.core.Editor","tinymce.core.EditorCommands","tinymce.core.EditorManager","tinymce.core.EditorObservable","tinymce.core.Env","tinymce.core.FocusManager","t
inymce.core.geom.Rect","tinymce.core.html.DomParser","tinymce.core.html.Entities","tinymce.core.html.Node","tinymce.core.html.SaxParser","tinymce.core.html.Schema","tinymce.core.html.Serializer","tinymce.core.html.Styles","tinymce.core.html.Writer","tinymce.core.Shortcuts","tinymce.core.ui.Api","tinymce.core.UndoManager","tinymce.core.util.Class","tinymce.core.util.Color","tinymce.core.util.Delay","tinymce.core.util.EventDispatcher","tinymce.core.util.I18n","tinymce.core.util.JSON","tinymce.core.util.JSONP","tinymce.core.util.JSONRequest","tinymce.core.util.LocalStorage","tinymce.core.util.Observable","tinymce.core.util.Promise","tinymce.core.util.Tools","tinymce.core.util.URI","tinymce.core.util.VK","tinymce.core.util.XHR"
;,"tinymce.core.util.Arr","tinymce.core.dom.Range","tinymce.core.dom.StyleSheetLoader","ephox.katamari.api.Cell","tinymce.core.fmt.ApplyFormat","tinymce.core.fmt.FormatChanged","tinymce.core.fmt.FormatRegistry","tinymce.core.fmt.MatchFormat","tinymce.core.fmt.Preview","tinymce.core.fmt.RemoveFormat","tinymce.core.fmt.ToggleFormat","tinymce.core.keyboard.FormatShortcuts","ephox.katamari.api.Arr","ephox.katamari.api.Option","tinymce.core.EditorView","tinymce.core.ui.NotificationManagerImpl","tinymce.core.ui.WindowManagerImpl","tinymce.core.caret.CaretBookmark","tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretPosition","tinymce.core.dom.NodeType","tinymce.core.text.Zwsp","ephox.sugar.api.node.Element","ephox.sugar.api.search.Selectors",&q
uot;tinymce.core.dom.RangePoint","ephox.sugar.api.dom.Compare","tinymce.core.dom.ScrollIntoView","tinymce.core.dom.TridentSelection","tinymce.core.selection.FragmentReader","tinymce.core.selection.MultiRange","tinymce.core.delete.DeleteCommands","tinymce.core.InsertContent","tinymce.core.EditorFocus","tinymce.core.EditorSettings","tinymce.core.init.Render","tinymce.core.Mode","tinymce.core.ui.Sidebar","global!document","tinymce.core.util.Uuid","ephox.katamari.api.Type","tinymce.core.ErrorReporter","tinymce.core.LegacyInput","tinymce.core.ui.Selector","tinymce.core.ui.Collection","tinymce.core.ui.ReflowQueue","tinymce.core.ui.Control","tinymce.core.ui.Factory","tinymce.core.ui.KeyboardNavigation","tinymce.core.ui.Container","tinymce.core.
ui.DragHelper","tinymce.core.ui.Scrollable","tinymce.core.ui.Panel","tinymce.core.ui.Movable","tinymce.core.ui.Resizable","tinymce.core.ui.FloatPanel","tinymce.core.ui.Window","tinymce.core.ui.MessageBox","tinymce.core.ui.Tooltip","tinymce.core.ui.Widget","tinymce.core.ui.Progress","tinymce.core.ui.Notification","tinymce.core.ui.Layout","tinymce.core.ui.AbsoluteLayout","tinymce.core.ui.Button","tinymce.core.ui.ButtonGroup","tinymce.core.ui.Checkbox","tinymce.core.ui.ComboBox","tinymce.core.ui.ColorBox","tinymce.core.ui.PanelButton","tinymce.core.ui.ColorButton","tinymce.core.ui.ColorPicker","tinymce.core.ui.Path","tinymce.core.ui.ElementPath","tinymce.core.ui.FormItem","tinymce.core.ui.Form","tinymce.core.ui.FieldSet",&quo
t;tinymce.core.ui.FilePicker","tinymce.core.ui.FitLayout","tinymce.core.ui.FlexLayout","tinymce.core.ui.FlowLayout","tinymce.core.ui.FormatControls","tinymce.core.ui.GridLayout","tinymce.core.ui.Iframe","tinymce.core.ui.InfoBox","tinymce.core.ui.Label","tinymce.core.ui.Toolbar","tinymce.core.ui.MenuBar","tinymce.core.ui.MenuButton","tinymce.core.ui.MenuItem","tinymce.core.ui.Throbber","tinymce.core.ui.Menu","tinymce.core.ui.ListBox","tinymce.core.ui.Radio","tinymce.core.ui.ResizeHandle","tinymce.core.ui.SelectBox","tinymce.core.ui.Slider","tinymce.core.ui.Spacer","tinymce.core.ui.SplitButton","tinymce.core.ui.StackLayout","tinymce.core.ui.TabPanel","tinymce.core.ui.TextBox","tinymce.core.ui.DropZone","tinymce.core.ui.BrowseButt
on","tinymce.core.undo.Levels","global!Object","global!String","ephox.katamari.api.Future","ephox.katamari.api.Futures","ephox.katamari.api.Result","tinymce.core.util.Fun","tinymce.core.caret.CaretCandidate","tinymce.core.geom.ClientRect","tinymce.core.text.ExtendingChar","tinymce.core.dom.RangeNormalizer","tinymce.core.fmt.CaretFormat","tinymce.core.fmt.ExpandRange","tinymce.core.fmt.FormatUtils","tinymce.core.fmt.Hooks","tinymce.core.fmt.MergeFormats","tinymce.core.fmt.DefaultFormats","ephox.sand.api.Node","ephox.sand.api.PlatformDetection","global!console","ephox.sugar.api.node.NodeTypes","ephox.sugar.api.properties.Css","ephox.sugar.api.search.Traverse","tinymce.core.ui.DomUtils","tinymce.core.data.ObservableObject","tinymc
e.core.ui.BoxUtils","tinymce.core.ui.ClassList","ephox.sugar.api.dom.Insert","ephox.sugar.api.dom.Replication","ephox.sugar.api.node.Fragment","ephox.sugar.api.node.Node","ephox.sugar.api.search.SelectorFind","tinymce.core.dom.ElementType","tinymce.core.dom.Parents","tinymce.core.selection.SelectionUtils","tinymce.core.selection.SimpleTableModel","tinymce.core.selection.TableCellSelection","tinymce.core.delete.BlockBoundaryDelete","tinymce.core.delete.BlockRangeDelete","tinymce.core.delete.CefDelete","tinymce.core.delete.DeleteUtils","tinymce.core.delete.InlineBoundaryDelete","tinymce.core.delete.TableDelete","tinymce.core.caret.CaretWalker","tinymce.core.dom.ElementUtils","tinymce.core.dom.PaddingBr","tinymce.core.InsertList","tinymce.core.caret.CaretFinder",&q
uot;ephox.katamari.api.Obj","ephox.katamari.api.Strings","ephox.katamari.api.Struct","global!window","tinymce.core.init.Init","tinymce.core.PluginManager","tinymce.core.ThemeManager","tinymce.core.content.LinkTargets","tinymce.core.fmt.FontInfo","global!RegExp","tinymce.core.undo.Fragments","ephox.katamari.api.LazyValue","ephox.katamari.async.Bounce","ephox.katamari.async.AsyncValues","tinymce.core.caret.CaretUtils","ephox.katamari.data.Immutable","ephox.katamari.data.MixedBag","ephox.sugar.alien.Recurse","ephox.sand.util.Global","ephox.katamari.api.Thunk","ephox.sand.core.PlatformDetection","global!navigator","ephox.sugar.api.dom.Remove","ephox.sugar.api.node.Text","ephox.sugar.api.search.SelectorFilter","ephox.sugar.api.properties.Attr
","ephox.sugar.api.node.Body","ephox.sugar.impl.Style","ephox.katamari.str.StrAppend","ephox.katamari.str.StringParts","tinymce.core.data.Binding","ephox.sugar.api.dom.InsertAll","ephox.sugar.api.search.PredicateFind","ephox.sugar.impl.ClosestOrAncestor","ephox.katamari.api.Options","tinymce.core.delete.BlockBoundary","tinymce.core.delete.MergeBlocks","tinymce.core.delete.CefDeleteAction","tinymce.core.delete.DeleteElement","tinymce.core.keyboard.BoundaryCaret","tinymce.core.keyboard.BoundaryLocation","tinymce.core.keyboard.BoundarySelection","tinymce.core.keyboard.InlineUtils","tinymce.core.delete.TableDeleteAction","tinymce.core.init.InitContentBody","tinymce.core.undo.Diff","global!setTimeout","ephox.katamari.util.BagUtils","ephox.katamari.api.Resolve&qu
ot;,"ephox.sand.core.Browser","ephox.sand.core.OperatingSystem","ephox.sand.detect.DeviceType","ephox.sand.detect.UaString","ephox.sand.info.PlatformInfo","ephox.sugar.impl.NodeValue","ephox.sugar.api.search.PredicateFilter","tinymce.core.dom.Empty","ephox.katamari.api.Adt","tinymce.core.caret.CaretContainerInline","tinymce.core.caret.CaretContainerRemove","tinymce.core.text.Bidi","tinymce.core.util.LazyEvaluator","tinymce.core.caret.CaretContainerInput","tinymce.core.EditorUpload","tinymce.core.ForceBlocks","tinymce.core.keyboard.KeyboardOverrides","tinymce.core.NodeChange","tinymce.core.SelectionOverrides","tinymce.core.util.Quirks","ephox.katamari.api.Global","ephox.sand.detect.Version","ephox.sugar.api.search.SelectorExists","tinymce.core.file.Uplo
ader","tinymce.core.file.ImageScanner","tinymce.core.file.BlobCache","tinymce.core.file.UploadStatus","tinymce.core.keyboard.ArrowKeys","tinymce.core.keyboard.DeleteBackspaceKeys","tinymce.core.keyboard.EnterKey","tinymce.core.keyboard.SpaceKey","tinymce.core.DragDropOverrides","tinymce.core.caret.FakeCaret","tinymce.core.caret.LineUtils","tinymce.core.keyboard.CefUtils","tinymce.core.dom.NodePath","global!Number","tinymce.core.file.Conversions","ephox.sand.api.URL","tinymce.core.keyboard.CefNavigation","tinymce.core.keyboard.MatchKeys","tinymce.core.keyboard.InsertNewLine","tinymce.core.keyboard.InsertSpace","tinymce.core.dom.MousePosition","tinymce.core.dom.Dimensions","ephox.sand.api.Window","tinymce.core.caret.LineWalker","ephox.katamari.api.M
erger"]
-jsc*/
-defineGlobal("global!Array", Array);
-defineGlobal("global!Error", Error);
-define(
- 'ephox.katamari.api.Fun',
-
- [
- 'global!Array',
- 'global!Error'
- ],
-
- function (Array, Error) {
-
- var noop = function () { };
-
- var compose = function (fa, fb) {
- return function () {
- return fa(fb.apply(null, arguments));
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var args = new Array(arguments.length - 1);
+ for (var i = 1; i < arguments.length; i++)
+ args[i - 1] = arguments[i];
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ var newArgs = new Array(arguments.length);
+ for (var j = 0; j < newArgs.length; j++)
+ newArgs[j] = arguments[j];
+ var all = args.concat(newArgs);
+ return f.apply(null, all);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var constant = function (value) {
- return function () {
- return value;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var not = function (f) {
+ return function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ return !f.apply(null, arguments);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var identity = function (x) {
- return x;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var die = function (msg) {
+ return function () {
+ throw new Error(msg);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var apply = function (f) {
+ return f();
+ };
+ var call = function (f) {
+ f();
+ };
+ var never = constant(false);
+ var always = constant(true);
+ var $_68e81l6jfuw8kyc = {
+ noop: noop,
+ noarg: noarg,
+ compose: compose,
+ constant: constant,
+ identity: identity,
+ tripleEquals: tripleEquals,
+ curry: curry,
+ not: not,
+ die: die,
+ apply: apply,
+ call: call,
+ never: never,
+ always: always
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var tripleEquals = function(a, b) {
- return a === b;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var never$1 = $_68e81l6jfuw8kyc.never;
+ var always$1 = $_68e81l6jfuw8kyc.always;
+ var none = function () {
+ return NONE;
+ };
+ var NONE = function () {
+ var eq = function (o) {
+ return o.isNone();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Don't use array slice(arguments), makes the whole function unoptimisable on Chrome
- var curry = function (f) {
- // equivalent to arguments.slice(1)
- // starting at 1 because 0 is the f, makes things tricky.
- // Pay attention to what variable is where, and the -1 magic.
- // thankfully, we have tests for this.
- var args = new Array(arguments.length - 1);
- for (var i = 1; i < arguments.length; i++) args[i-1] = arguments[i];
-
- return function () {
- var newArgs = new Array(arguments.length);
- for (var j = 0; j < newArgs.length; j++) newArgs[j] = arguments[j];
-
- var all = args.concat(newArgs);
- return f.apply(null, all);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var call = function (thunk) {
+ return thunk();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var not = function (f) {
- return function () {
- return !f.apply(null, arguments);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var id = function (n) {
+ return n;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var die = function (msg) {
- return function () {
- throw new Error(msg);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var noop = function () {
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var me = {
+ fold: function (n, s) {
+ return n();
+ },
+ is: never$1,
+ isSome: never$1,
+ isNone: always$1,
+ getOr: id,
+ getOrThunk: call,
+ getOrDie: function (msg) {
+ throw new Error(msg || 'error: getOrDie called on none.');
+ },
+ or: id,
+ orThunk: call,
+ map: none,
+ ap: none,
+ each: noop,
+ bind: none,
+ flatten: none,
+ exists: never$1,
+ forall: always$1,
+ filter: none,
+ equals: eq,
+ equals_: eq,
+ toArray: function () {
+ return [];
+ },
+ toString: $_68e81l6jfuw8kyc.constant('none()')
+ };
+ if (Object.freeze)
+ Object.freeze(me);
+ return me;
+ }();
+ var some = function (a) {
+ var constant_a = function () {
+ return a;
+ };
+ var self = function () {
+ return me;
+ };
+ var map = function (f) {
+ return some(f(a));
+ };
+ var bind = function (f) {
+ return f(a);
+ };
+ var me = {
+ fold: function (n, s) {
+ return s(a);
+ },
+ is: function (v) {
+ return a === v;
+ },
+ isSome: always$1,
+ isNone: never$1,
+ getOr: constant_a,
+ getOrThunk: constant_a,
+ getOrDie: constant_a,
+ or: self,
+ orThunk: self,
+ map: map,
+ ap: function (optfab) {
+ return optfab.fold(none, function (fab) {
+ return some(fab(a));
+ });
+ },
+ each: function (f) {
+ f(a);
+ },
+ bind: bind,
+ flatten: constant_a,
+ exists: bind,
+ forall: bind,
+ filter: function (f) {
+ return f(a) ? me : NONE;
+ },
+ equals: function (o) {
+ return o.is(a);
+ },
+ equals_: function (o, elementEq) {
+ return o.fold(never$1, function (b) {
+ return elementEq(a, b);
+ });
+ },
+ toArray: function () {
+ return [a];
+ },
+ toString: function () {
+ return 'some(' + a + ')';
+ }
+ };
+ return me;
+ };
+ var from = function (value) {
+ return value === null || value === undefined ? NONE : some(value);
+ };
+ var Option = {
+ some: some,
+ none: none,
+ from: from
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var apply = function (f) {
- return f();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var typeOf = function (x) {
+ if (x === null)
+ return 'null';
+ var t = typeof x;
+ if (t === 'object' && Array.prototype.isPrototypeOf(x))
+ return 'array';
+ if (t === 'object' && String.prototype.isPrototypeOf(x))
+ return 'string';
+ return t;
+ };
+ var isType = function (type) {
+ return function (value) {
+ return typeOf(value) === type;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_16i8k47jfuw8kyi = {
+ isString: isType('string'),
+ isObject: isType('object'),
+ isArray: isType('array'),
+ isNull: isType('null'),
+ isBoolean: isType('boolean'),
+ isUndefined: isType('undefined'),
+ isFunction: isType('function'),
+ isNumber: isType('number')
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var call = function(f) {
- f();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var rawIndexOf = function () {
+ var pIndexOf = Array.prototype.indexOf;
+ var fastIndex = function (xs, x) {
+ return pIndexOf.call(xs, x);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var never = constant(false);
- var always = constant(true);
-
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var slowIndex = function (xs, x) {
+ return slowIndexOf(xs, x);
+ };
+ return pIndexOf === undefined ? slowIndex : fastIndex;
+ }();
+ var indexOf = function (xs, x) {
+ var r = rawIndexOf(xs, x);
+ return r === -1 ? Option.none() : Option.some(r);
+ };
+ var contains = function (xs, x) {
+ return rawIndexOf(xs, x) > -1;
+ };
+ var exists = function (xs, pred) {
+ return findIndex(xs, pred).isSome();
+ };
+ var range = function (num, f) {
+ var r = [];
+ for (var i = 0; i < num; i++) {
+ r.push(f(i));
+ }
+ return r;
+ };
+ var chunk = function (array, size) {
+ var r = [];
+ for (var i = 0; i < array.length; i += size) {
+ var s = array.slice(i, i + size);
+ r.push(s);
+ }
+ return r;
+ };
+ var map = function (xs, f) {
+ var len = xs.length;
+ var r = new Array(len);
+ for (var i = 0; i < len; i++) {
+ var x = xs[i];
+ r[i] = f(x, i, xs);
+ }
+ return r;
+ };
+ var each = function (xs, f) {
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ f(x, i, xs);
+ }
+ };
+ var eachr = function (xs, f) {
+ for (var i = xs.length - 1; i >= 0; i--) {
+ var x = xs[i];
+ f(x, i, xs);
+ }
+ };
+ var partition = function (xs, pred) {
+ var pass = [];
+ var fail = [];
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ var arr = pred(x, i, xs) ? pass : fail;
+ arr.push(x);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- noop: noop,
- compose: compose,
- constant: constant,
- identity: identity,
- tripleEquals: tripleEquals,
- curry: curry,
- not: not,
- die: die,
- apply: apply,
- call: call,
- never: never,
- always: always
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ pass: pass,
+ fail: fail
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var filter = function (xs, pred) {
+ var r = [];
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ if (pred(x, i, xs)) {
+ r.push(x);
+ }
+ }
+ return r;
+ };
+ var groupBy = function (xs, f) {
+ if (xs.length === 0) {
+ return [];
+ } else {
+ var wasType = f(xs[0]);
+ var r = [];
+ var group = [];
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ var type = f(x);
+ if (type !== wasType) {
+ r.push(group);
+ group = [];
+ }
+ wasType = type;
+ group.push(x);
+ }
+ if (group.length !== 0) {
+ r.push(group);
+ }
+ return r;
+ }
+ };
+ var foldr = function (xs, f, acc) {
+ eachr(xs, function (x) {
+ acc = f(acc, x);
+ });
+ return acc;
+ };
+ var foldl = function (xs, f, acc) {
+ each(xs, function (x) {
+ acc = f(acc, x);
+ });
+ return acc;
+ };
+ var find = function (xs, pred) {
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ if (pred(x, i, xs)) {
+ return Option.some(x);
+ }
+ }
+ return Option.none();
+ };
+ var findIndex = function (xs, pred) {
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ if (pred(x, i, xs)) {
+ return Option.some(i);
+ }
+ }
+ return Option.none();
+ };
+ var slowIndexOf = function (xs, x) {
+ for (var i = 0, len = xs.length; i < len; ++i) {
+ if (xs[i] === x) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ var push = Array.prototype.push;
+ var flatten = function (xs) {
+ var r = [];
+ for (var i = 0, len = xs.length; i < len; ++i) {
+ if (!Array.prototype.isPrototypeOf(xs[i]))
+ throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
+ push.apply(r, xs[i]);
+ }
+ return r;
+ };
+ var bind = function (xs, f) {
+ var output = map(xs, f);
+ return flatten(output);
+ };
+ var forall = function (xs, pred) {
+ for (var i = 0, len = xs.length; i < len; ++i) {
+ var x = xs[i];
+ if (pred(x, i, xs) !== true) {
+ return false;
+ }
+ }
+ return true;
+ };
+ var equal = function (a1, a2) {
+ return a1.length === a2.length && forall(a1, function (x, i) {
+ return x === a2[i];
+ });
+ };
+ var slice = Array.prototype.slice;
+ var reverse = function (xs) {
+ var r = slice.call(xs, 0);
+ r.reverse();
+ return r;
+ };
+ var difference = function (a1, a2) {
+ return filter(a1, function (x) {
+ return !contains(a2, x);
+ });
+ };
+ var mapToObject = function (xs, f) {
+ var r = {};
+ for (var i = 0, len = xs.length; i < len; i++) {
+ var x = xs[i];
+ r[String(x)] = f(x, i);
+ }
+ return r;
+ };
+ var pure = function (x) {
+ return [x];
+ };
+ var sort = function (xs, comparator) {
+ var copy = slice.call(xs, 0);
+ copy.sort(comparator);
+ return copy;
+ };
+ var head = function (xs) {
+ return xs.length === 0 ? Option.none() : Option.some(xs[0]);
+ };
+ var last = function (xs) {
+ return xs.length === 0 ? Option.none() : Option.some(xs[xs.length - 1]);
+ };
+ var from$1 = $_16i8k47jfuw8kyi.isFunction(Array.from) ? Array.from : function (x) {
+ return slice.call(x);
+ };
+ var $_9ek1bp4jfuw8kxg = {
+ map: map,
+ each: each,
+ eachr: eachr,
+ partition: partition,
+ filter: filter,
+ groupBy: groupBy,
+ indexOf: indexOf,
+ foldr: foldr,
+ foldl: foldl,
+ find: find,
+ findIndex: findIndex,
+ flatten: flatten,
+ bind: bind,
+ forall: forall,
+ exists: exists,
+ contains: contains,
+ equal: equal,
+ reverse: reverse,
+ chunk: chunk,
+ difference: difference,
+ mapToObject: mapToObject,
+ pure: pure,
+ sort: sort,
+ range: range,
+ head: head,
+ last: last,
+ from: from$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Promise.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * Promise polyfill under MIT license: https://github.com/taylorhakes/promise-polyfill
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var global = typeof window !== 'undefined' ? window : Function('return this;')();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* eslint-disable */
-/* jshint ignore:start */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var path = function (parts, scope) {
+ var o = scope !== undefined && scope !== null ? scope : global;
+ for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
+ o = o[parts[i]];
+ return o;
+ };
+ var resolve = function (p, scope) {
+ var parts = p.split('.');
+ return path(parts, scope);
+ };
+ var step = function (o, part) {
+ if (o[part] === undefined || o[part] === null)
+ o[part] = {};
+ return o[part];
+ };
+ var forge = function (parts, target) {
+ var o = target !== undefined ? target : global;
+ for (var i = 0; i < parts.length; ++i)
+ o = step(o, parts[i]);
+ return o;
+ };
+ var namespace = function (name, target) {
+ var parts = name.split('.');
+ return forge(parts, target);
+ };
+ var $_44d31jdjfuw8l1u = {
+ path: path,
+ resolve: resolve,
+ forge: forge,
+ namespace: namespace
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Modifed to be a feature fill and wrapped as tinymce module.
- */
-define(
- 'tinymce.core.util.Promise',
- [],
- function () {
- if (window.Promise) {
- return window.Promise;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var unsafe = function (name, scope) {
+ return $_44d31jdjfuw8l1u.resolve(name, scope);
+ };
+ var getOrDie = function (name, scope) {
+ var actual = unsafe(name, scope);
+ if (actual === undefined || actual === null)
+ throw name + ' not available on this browser';
+ return actual;
+ };
+ var $_3hdbe8cjfuw8l1e = { getOrDie: getOrDie };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Use polyfill for setImmediate for performance gains
- var asap = Promise.immediateFn || (typeof setImmediate === 'function' && setImmediate) ||
- function (fn) { setTimeout(fn, 1); };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var url = function () {
+ return $_3hdbe8cjfuw8l1e.getOrDie('URL');
+ };
+ var createObjectURL = function (blob) {
+ return url().createObjectURL(blob);
+ };
+ var revokeObjectURL = function (u) {
+ url().revokeObjectURL(u);
+ };
+ var $_b6ehwsbjfuw8l1c = {
+ createObjectURL: createObjectURL,
+ revokeObjectURL: revokeObjectURL
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Polyfill for Function.prototype.bind
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var nav = navigator;
+ var userAgent = nav.userAgent;
+ var opera;
+ var webkit;
+ var ie;
+ var ie11;
+ var ie12;
+ var gecko;
+ var mac;
+ var iDevice;
+ var android;
+ var fileApi;
+ var phone;
+ var tablet;
+ var windowsPhone;
+ var matchMediaQuery = function (query) {
+ return 'matchMedia' in window ? matchMedia(query).matches : false;
+ };
+ opera = false;
+ android = /Android/.test(userAgent);
+ webkit = /WebKit/.test(userAgent);
+ ie = !webkit && !opera && /MSIE/gi.test(userAgent) && /Explorer/gi.test(nav.appName);
+ ie = ie && /MSIE (\w+)\./.exec(userAgent)[1];
+ ie11 = userAgent.indexOf('Trident/') !== -1 && (userAgent.indexOf('rv:') !== -1 || nav.appName.indexOf('Netscape') !== -1) ? 11 : false;
+ ie12 = userAgent.indexOf('Edge/') !== -1 && !ie && !ie11 ? 12 : false;
+ ie = ie || ie11 || ie12;
+ gecko = !webkit && !ie11 && /Gecko/.test(userAgent);
+ mac = userAgent.indexOf('Mac') !== -1;
+ iDevice = /(iPad|iPhone)/.test(userAgent);
+ fileApi = 'FormData' in window && 'FileReader' in window && 'URL' in window && !!$_b6ehwsbjfuw8l1c.createObjectURL;
+ phone = matchMediaQuery('only screen and (max-device-width: 480px)') && (android || iDevice);
+ tablet = matchMediaQuery('only screen and (min-width: 800px)') && (android || iDevice);
+ windowsPhone = userAgent.indexOf('Windows Phone') !== -1;
+ if (ie12) {
+ webkit = false;
+ }
+ var contentEditable = !iDevice || fileApi || parseInt(userAgent.match(/AppleWebKit\/(\d*)/)[1], 10) >= 534;
+ var $_9fhi43ajfuw8l13 = {
+ opera: opera,
+ webkit: webkit,
+ ie: ie,
+ gecko: gecko,
+ mac: mac,
+ iOS: iDevice,
+ android: android,
+ contentEditable: contentEditable,
+ transparentSrc: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
+ caretAfter: ie !== 8,
+ range: window.getSelection && 'Range' in window,
+ documentMode: ie && !ie12 ? document.documentMode || 7 : 10,
+ fileApi: fileApi,
+ ceFalse: ie === false || ie > 8,
+ cacheSuffix: null,
+ container: null,
+ overrideViewPort: null,
+ experimentalShadowDom: false,
+ canHaveCSP: ie === false || ie > 11,
+ desktop: !phone && !tablet,
+ windowsPhone: windowsPhone
+ };
+
+ var promise = function () {
</ins><span class="cx" style="display: block; padding: 0 10px"> function bind(fn, thisArg) {
</span><span class="cx" style="display: block; padding: 0 10px"> return function () {
</span><span class="cx" style="display: block; padding: 0 10px"> fn.apply(thisArg, arguments);
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isArray = Array.isArray || function (value) { return Object.prototype.toString.call(value) === "[object Array]"; };
-
- function Promise(fn) {
- if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new');
- if (typeof fn !== 'function') throw new TypeError('not a function');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isArray = Array.isArray || function (value) {
+ return Object.prototype.toString.call(value) === '[object Array]';
+ };
+ var Promise = function (fn) {
+ if (typeof this !== 'object') {
+ throw new TypeError('Promises must be constructed via new');
+ }
+ if (typeof fn !== 'function') {
+ throw new TypeError('not a function');
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> this._state = null;
</span><span class="cx" style="display: block; padding: 0 10px"> this._value = null;
</span><span class="cx" style="display: block; padding: 0 10px"> this._deferreds = [];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> doResolve(fn, bind(resolve, this), bind(reject, this));
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var asap = Promise.immediateFn || typeof setImmediate === 'function' && setImmediate || function (fn) {
+ setTimeout(fn, 1);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> function handle(deferred) {
</span><span class="cx" style="display: block; padding: 0 10px"> var me = this;
</span><span class="cx" style="display: block; padding: 0 10px"> if (this._state === null) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -241,8 +634,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> var ret;
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="cx" style="display: block; padding: 0 10px"> ret = cb(me._value);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- catch (e) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (e) {
</ins><span class="cx" style="display: block; padding: 0 10px"> deferred.reject(e);
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -249,10 +641,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> deferred.resolve(ret);
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> function resolve(newValue) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- try { //Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
- if (newValue === this) throw new TypeError('A promise cannot be resolved with itself.');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ try {
+ if (newValue === this) {
+ throw new TypeError('A promise cannot be resolved with itself.');
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
</span><span class="cx" style="display: block; padding: 0 10px"> var then = newValue.then;
</span><span class="cx" style="display: block; padding: 0 10px"> if (typeof then === 'function') {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -263,15 +656,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this._state = true;
</span><span class="cx" style="display: block; padding: 0 10px"> this._value = newValue;
</span><span class="cx" style="display: block; padding: 0 10px"> finale.call(this);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } catch (e) { reject.call(this, e); }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (e) {
+ reject.call(this, e);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> function reject(newValue) {
</span><span class="cx" style="display: block; padding: 0 10px"> this._state = false;
</span><span class="cx" style="display: block; padding: 0 10px"> this._value = newValue;
</span><span class="cx" style="display: block; padding: 0 10px"> finale.call(this);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> function finale() {
</span><span class="cx" style="display: block; padding: 0 10px"> for (var i = 0, len = this._deferreds.length; i < len; i++) {
</span><span class="cx" style="display: block; padding: 0 10px"> handle.call(this, this._deferreds[i]);
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -278,7 +671,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> this._deferreds = null;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> function Handler(onFulfilled, onRejected, resolve, reject) {
</span><span class="cx" style="display: block; padding: 0 10px"> this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
</span><span class="cx" style="display: block; padding: 0 10px"> this.onRejected = typeof onRejected === 'function' ? onRejected : null;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -285,36 +677,33 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.resolve = resolve;
</span><span class="cx" style="display: block; padding: 0 10px"> this.reject = reject;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Take a potentially misbehaving resolver function and make sure
- * onFulfilled and onRejected are only called once.
- *
- * Makes no guarantees about asynchrony.
- */
</del><span class="cx" style="display: block; padding: 0 10px"> function doResolve(fn, onFulfilled, onRejected) {
</span><span class="cx" style="display: block; padding: 0 10px"> var done = false;
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="cx" style="display: block; padding: 0 10px"> fn(function (value) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (done) return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (done) {
+ return;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> done = true;
</span><span class="cx" style="display: block; padding: 0 10px"> onFulfilled(value);
</span><span class="cx" style="display: block; padding: 0 10px"> }, function (reason) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (done) return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (done) {
+ return;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> done = true;
</span><span class="cx" style="display: block; padding: 0 10px"> onRejected(reason);
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> } catch (ex) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (done) return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (done) {
+ return;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> done = true;
</span><span class="cx" style="display: block; padding: 0 10px"> onRejected(ex);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- Promise.prototype['catch'] = function (onRejected) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Promise.prototype.catch = function (onRejected) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return this.then(null, onRejected);
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> Promise.prototype.then = function (onFulfilled, onRejected) {
</span><span class="cx" style="display: block; padding: 0 10px"> var me = this;
</span><span class="cx" style="display: block; padding: 0 10px"> return new Promise(function (resolve, reject) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -321,12 +710,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> handle.call(me, new Handler(onFulfilled, onRejected, resolve, reject));
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> Promise.all = function () {
</span><span class="cx" style="display: block; padding: 0 10px"> var args = Array.prototype.slice.call(arguments.length === 1 && isArray(arguments[0]) ? arguments[0] : arguments);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return new Promise(function (resolve, reject) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (args.length === 0) return resolve([]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (args.length === 0) {
+ return resolve([]);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> var remaining = args.length;
</span><span class="cx" style="display: block; padding: 0 10px"> function res(i, val) {
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -333,7 +722,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if (val && (typeof val === 'object' || typeof val === 'function')) {
</span><span class="cx" style="display: block; padding: 0 10px"> var then = val.then;
</span><span class="cx" style="display: block; padding: 0 10px"> if (typeof then === 'function') {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- then.call(val, function (val) { res(i, val); }, reject);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ then.call(val, function (val) {
+ res(i, val);
+ }, reject);
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -350,23 +741,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> Promise.resolve = function (value) {
</span><span class="cx" style="display: block; padding: 0 10px"> if (value && typeof value === 'object' && value.constructor === Promise) {
</span><span class="cx" style="display: block; padding: 0 10px"> return value;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return new Promise(function (resolve) {
</span><span class="cx" style="display: block; padding: 0 10px"> resolve(value);
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> Promise.reject = function (value) {
</span><span class="cx" style="display: block; padding: 0 10px"> return new Promise(function (resolve, reject) {
</span><span class="cx" style="display: block; padding: 0 10px"> reject(value);
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> Promise.race = function (values) {
</span><span class="cx" style="display: block; padding: 0 10px"> return new Promise(function (resolve, reject) {
</span><span class="cx" style="display: block; padding: 0 10px"> for (var i = 0, len = values.length; i < len; i++) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -374,57204 +761,25809 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return Promise;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var promiseObj = window.Promise ? window.Promise : promise();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* jshint ignore:end */
-/* eslint-enable */
-/**
- * Delay.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Utility class for working with delayed actions like setTimeout.
- *
- * @class tinymce.util.Delay
- */
-define(
- 'tinymce.core.util.Delay',
- [
- "tinymce.core.util.Promise"
- ],
- function (Promise) {
- var requestAnimationFramePromise;
-
- function requestAnimationFrame(callback, element) {
- var i, requestAnimationFrameFunc = window.requestAnimationFrame, vendors = ['ms', 'moz', 'webkit'];
-
- function featurefill(callback) {
- window.setTimeout(callback, 0);
- }
-
- for (i = 0; i < vendors.length && !requestAnimationFrameFunc; i++) {
- requestAnimationFrameFunc = window[vendors[i] + 'RequestAnimationFrame'];
- }
-
- if (!requestAnimationFrameFunc) {
- requestAnimationFrameFunc = featurefill;
- }
-
- requestAnimationFrameFunc(callback, element);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var requestAnimationFramePromise;
+ var requestAnimationFrame = function (callback, element) {
+ var i, requestAnimationFrameFunc = window.requestAnimationFrame;
+ var vendors = [
+ 'ms',
+ 'moz',
+ 'webkit'
+ ];
+ var featurefill = function (callback) {
+ window.setTimeout(callback, 0);
+ };
+ for (i = 0; i < vendors.length && !requestAnimationFrameFunc; i++) {
+ requestAnimationFrameFunc = window[vendors[i] + 'RequestAnimationFrame'];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function wrappedSetTimeout(callback, time) {
- if (typeof time != 'number') {
- time = 0;
- }
-
- return setTimeout(callback, time);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!requestAnimationFrameFunc) {
+ requestAnimationFrameFunc = featurefill;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function wrappedSetInterval(callback, time) {
- if (typeof time != 'number') {
- time = 1; // IE 8 needs it to be > 0
- }
-
- return setInterval(callback, time);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ requestAnimationFrameFunc(callback, element);
+ };
+ var wrappedSetTimeout = function (callback, time) {
+ if (typeof time !== 'number') {
+ time = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function wrappedClearTimeout(id) {
- return clearTimeout(id);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return setTimeout(callback, time);
+ };
+ var wrappedSetInterval = function (callback, time) {
+ if (typeof time !== 'number') {
+ time = 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function wrappedClearInterval(id) {
- return clearInterval(id);
- }
-
- function debounce(callback, time) {
- var timer, func;
-
- func = function () {
- var args = arguments;
-
- clearTimeout(timer);
-
- timer = wrappedSetTimeout(function () {
- callback.apply(this, args);
- }, time);
- };
-
- func.stop = function () {
- clearTimeout(timer);
- };
-
- return func;
- }
-
- return {
- /**
- * Requests an animation frame and fallbacks to a timeout on older browsers.
- *
- * @method requestAnimationFrame
- * @param {function} callback Callback to execute when a new frame is available.
- * @param {DOMElement} element Optional element to scope it to.
- */
- requestAnimationFrame: function (callback, element) {
- if (requestAnimationFramePromise) {
- requestAnimationFramePromise.then(callback);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return setInterval(callback, time);
+ };
+ var wrappedClearTimeout = function (id) {
+ return clearTimeout(id);
+ };
+ var wrappedClearInterval = function (id) {
+ return clearInterval(id);
+ };
+ var debounce = function (callback, time) {
+ var timer, func;
+ func = function () {
+ var args = arguments;
+ clearTimeout(timer);
+ timer = wrappedSetTimeout(function () {
+ callback.apply(this, args);
+ }, time);
+ };
+ func.stop = function () {
+ clearTimeout(timer);
+ };
+ return func;
+ };
+ var $_2m8wq9hjfuw8l41 = {
+ requestAnimationFrame: function (callback, element) {
+ if (requestAnimationFramePromise) {
+ requestAnimationFramePromise.then(callback);
+ return;
+ }
+ requestAnimationFramePromise = new promiseObj(function (resolve) {
+ if (!element) {
+ element = document.body;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ requestAnimationFrame(resolve, element);
+ }).then(callback);
+ },
+ setTimeout: wrappedSetTimeout,
+ setInterval: wrappedSetInterval,
+ setEditorTimeout: function (editor, callback, time) {
+ return wrappedSetTimeout(function () {
+ if (!editor.removed) {
+ callback();
+ }
+ }, time);
+ },
+ setEditorInterval: function (editor, callback, time) {
+ var timer;
+ timer = wrappedSetInterval(function () {
+ if (!editor.removed) {
+ callback();
+ } else {
+ clearInterval(timer);
+ }
+ }, time);
+ return timer;
+ },
+ debounce: debounce,
+ throttle: debounce,
+ clearInterval: wrappedClearInterval,
+ clearTimeout: wrappedClearTimeout
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- requestAnimationFramePromise = new Promise(function (resolve) {
- if (!element) {
- element = document.body;
- }
-
- requestAnimationFrame(resolve, element);
- }).then(callback);
- },
-
- /**
- * Sets a timer in ms and executes the specified callback when the timer runs out.
- *
- * @method setTimeout
- * @param {function} callback Callback to execute when timer runs out.
- * @param {Number} time Optional time to wait before the callback is executed, defaults to 0.
- * @return {Number} Timeout id number.
- */
- setTimeout: wrappedSetTimeout,
-
- /**
- * Sets an interval timer in ms and executes the specified callback at every interval of that time.
- *
- * @method setInterval
- * @param {function} callback Callback to execute when interval time runs out.
- * @param {Number} time Optional time to wait before the callback is executed, defaults to 0.
- * @return {Number} Timeout id number.
- */
- setInterval: wrappedSetInterval,
-
- /**
- * Sets an editor timeout it's similar to setTimeout except that it checks if the editor instance is
- * still alive when the callback gets executed.
- *
- * @method setEditorTimeout
- * @param {tinymce.Editor} editor Editor instance to check the removed state on.
- * @param {function} callback Callback to execute when timer runs out.
- * @param {Number} time Optional time to wait before the callback is executed, defaults to 0.
- * @return {Number} Timeout id number.
- */
- setEditorTimeout: function (editor, callback, time) {
- return wrappedSetTimeout(function () {
- if (!editor.removed) {
- callback();
- }
- }, time);
- },
-
- /**
- * Sets an interval timer it's similar to setInterval except that it checks if the editor instance is
- * still alive when the callback gets executed.
- *
- * @method setEditorInterval
- * @param {function} callback Callback to execute when interval time runs out.
- * @param {Number} time Optional time to wait before the callback is executed, defaults to 0.
- * @return {Number} Timeout id number.
- */
- setEditorInterval: function (editor, callback, time) {
- var timer;
-
- timer = wrappedSetInterval(function () {
- if (!editor.removed) {
- callback();
- } else {
- clearInterval(timer);
- }
- }, time);
-
- return timer;
- },
-
- /**
- * Creates debounced callback function that only gets executed once within the specified time.
- *
- * @method debounce
- * @param {function} callback Callback to execute when timer finishes.
- * @param {Number} time Optional time to wait before the callback is executed, defaults to 0.
- * @return {Function} debounced function callback.
- */
- debounce: debounce,
-
- // Throttle needs to be debounce due to backwards compatibility.
- throttle: debounce,
-
- /**
- * Clears an interval timer so it won't execute.
- *
- * @method clearInterval
- * @param {Number} Interval timer id number.
- */
- clearInterval: wrappedClearInterval,
-
- /**
- * Clears an timeout timer so it won't execute.
- *
- * @method clearTimeout
- * @param {Number} Timeout timer id number.
- */
- clearTimeout: wrappedClearTimeout
- };
- }
-);
-
-/**
- * Env.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains various environment constants like browser versions etc.
- * Normally you don't want to sniff specific browser versions but sometimes you have
- * to when it's impossible to feature detect. So use this with care.
- *
- * @class tinymce.Env
- * @static
- */
-define(
- 'tinymce.core.Env',
- [
- ],
- function () {
- var nav = navigator, userAgent = nav.userAgent;
- var opera, webkit, ie, ie11, ie12, gecko, mac, iDevice, android, fileApi, phone, tablet, windowsPhone;
-
- function matchMediaQuery(query) {
- return "matchMedia" in window ? matchMedia(query).matches : false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var eventExpandoPrefix = 'mce-data-';
+ var mouseEventRe = /^(?:mouse|contextmenu)|click/;
+ var deprecated = {
+ keyLocation: 1,
+ layerX: 1,
+ layerY: 1,
+ returnValue: 1,
+ webkitMovementX: 1,
+ webkitMovementY: 1,
+ keyIdentifier: 1
+ };
+ var hasIsDefaultPrevented = function (event) {
+ return event.isDefaultPrevented === returnTrue || event.isDefaultPrevented === returnFalse;
+ };
+ var returnFalse = function () {
+ return false;
+ };
+ var returnTrue = function () {
+ return true;
+ };
+ var addEvent = function (target, name, callback, capture) {
+ if (target.addEventListener) {
+ target.addEventListener(name, callback, capture || false);
+ } else if (target.attachEvent) {
+ target.attachEvent('on' + name, callback);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- opera = window.opera && window.opera.buildNumber;
- android = /Android/.test(userAgent);
- webkit = /WebKit/.test(userAgent);
- ie = !webkit && !opera && (/MSIE/gi).test(userAgent) && (/Explorer/gi).test(nav.appName);
- ie = ie && /MSIE (\w+)\./.exec(userAgent)[1];
- ie11 = userAgent.indexOf('Trident/') != -1 && (userAgent.indexOf('rv:') != -1 || nav.appName.indexOf('Netscape') != -1) ? 11 : false;
- ie12 = (userAgent.indexOf('Edge/') != -1 && !ie && !ie11) ? 12 : false;
- ie = ie || ie11 || ie12;
- gecko = !webkit && !ie11 && /Gecko/.test(userAgent);
- mac = userAgent.indexOf('Mac') != -1;
- iDevice = /(iPad|iPhone)/.test(userAgent);
- fileApi = "FormData" in window && "FileReader" in window && "URL" in window && !!URL.createObjectURL;
- phone = matchMediaQuery("only screen and (max-device-width: 480px)") && (android || iDevice);
- tablet = matchMediaQuery("only screen and (min-width: 800px)") && (android || iDevice);
- windowsPhone = userAgent.indexOf('Windows Phone') != -1;
-
- if (ie12) {
- webkit = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var removeEvent = function (target, name, callback, capture) {
+ if (target.removeEventListener) {
+ target.removeEventListener(name, callback, capture || false);
+ } else if (target.detachEvent) {
+ target.detachEvent('on' + name, callback);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Is a iPad/iPhone and not on iOS5 sniff the WebKit version since older iOS WebKit versions
- // says it has contentEditable support but there is no visible caret.
- var contentEditable = !iDevice || fileApi || userAgent.match(/AppleWebKit\/(\d*)/)[1] >= 534;
-
- return {
- /**
- * Constant that is true if the browser is Opera.
- *
- * @property opera
- * @type Boolean
- * @final
- */
- opera: opera,
-
- /**
- * Constant that is true if the browser is WebKit (Safari/Chrome).
- *
- * @property webKit
- * @type Boolean
- * @final
- */
- webkit: webkit,
-
- /**
- * Constant that is more than zero if the browser is IE.
- *
- * @property ie
- * @type Boolean
- * @final
- */
- ie: ie,
-
- /**
- * Constant that is true if the browser is Gecko.
- *
- * @property gecko
- * @type Boolean
- * @final
- */
- gecko: gecko,
-
- /**
- * Constant that is true if the os is Mac OS.
- *
- * @property mac
- * @type Boolean
- * @final
- */
- mac: mac,
-
- /**
- * Constant that is true if the os is iOS.
- *
- * @property iOS
- * @type Boolean
- * @final
- */
- iOS: iDevice,
-
- /**
- * Constant that is true if the os is android.
- *
- * @property android
- * @type Boolean
- * @final
- */
- android: android,
-
- /**
- * Constant that is true if the browser supports editing.
- *
- * @property contentEditable
- * @type Boolean
- * @final
- */
- contentEditable: contentEditable,
-
- /**
- * Transparent image data url.
- *
- * @property transparentSrc
- * @type Boolean
- * @final
- */
- transparentSrc: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
-
- /**
- * Returns true/false if the browser can or can't place the caret after a inline block like an image.
- *
- * @property noCaretAfter
- * @type Boolean
- * @final
- */
- caretAfter: ie != 8,
-
- /**
- * Constant that is true if the browser supports native DOM Ranges. IE 9+.
- *
- * @property range
- * @type Boolean
- */
- range: window.getSelection && "Range" in window,
-
- /**
- * Returns the IE document mode for non IE browsers this will fake IE 10.
- *
- * @property documentMode
- * @type Number
- */
- documentMode: ie && !ie12 ? (document.documentMode || 7) : 10,
-
- /**
- * Constant that is true if the browser has a modern file api.
- *
- * @property fileApi
- * @type Boolean
- */
- fileApi: fileApi,
-
- /**
- * Constant that is true if the browser supports contentEditable=false regions.
- *
- * @property ceFalse
- * @type Boolean
- */
- ceFalse: (ie === false || ie > 8),
-
- /**
- * Constant if CSP mode is possible or not. Meaning we can't use script urls for the iframe.
- */
- canHaveCSP: (ie === false || ie > 11),
-
- desktop: !phone && !tablet,
- windowsPhone: windowsPhone
- };
- }
-);
-
-/**
- * EventUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/*jshint loopfunc:true*/
-/*eslint no-loop-func:0 */
-
-/**
- * This class wraps the browsers native event logic with more convenient methods.
- *
- * @class tinymce.dom.EventUtils
- */
-define(
- 'tinymce.core.dom.EventUtils',
- [
- "tinymce.core.util.Delay",
- "tinymce.core.Env"
- ],
- function (Delay, Env) {
- "use strict";
-
- var eventExpandoPrefix = "mce-data-";
- var mouseEventRe = /^(?:mouse|contextmenu)|click/;
- var deprecated = {
- keyLocation: 1, layerX: 1, layerY: 1, returnValue: 1,
- webkitMovementX: 1, webkitMovementY: 1, keyIdentifier: 1
- };
-
- // Checks if it is our own isDefaultPrevented function
- var hasIsDefaultPrevented = function (event) {
- return event.isDefaultPrevented === returnTrue || event.isDefaultPrevented === returnFalse;
- };
-
- // Dummy function that gets replaced on the delegation state functions
- var returnFalse = function () {
- return false;
- };
-
- // Dummy function that gets replaced on the delegation state functions
- var returnTrue = function () {
- return true;
- };
-
- /**
- * Binds a native event to a callback on the speified target.
- */
- function addEvent(target, name, callback, capture) {
- if (target.addEventListener) {
- target.addEventListener(name, callback, capture || false);
- } else if (target.attachEvent) {
- target.attachEvent('on' + name, callback);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getTargetFromShadowDom = function (event, defaultTarget) {
+ var path, target = defaultTarget;
+ path = event.path;
+ if (path && path.length > 0) {
+ target = path[0];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Unbinds a native event callback on the specified target.
- */
- function removeEvent(target, name, callback, capture) {
- if (target.removeEventListener) {
- target.removeEventListener(name, callback, capture || false);
- } else if (target.detachEvent) {
- target.detachEvent('on' + name, callback);
- }
- }
-
- /**
- * Gets the event target based on shadow dom properties like path and deepPath.
- */
- function getTargetFromShadowDom(event, defaultTarget) {
- var path, target = defaultTarget;
-
- // When target element is inside Shadow DOM we need to take first element from path
- // otherwise we'll get Shadow Root parent, not actual target element
-
- // Normalize target for WebComponents v0 implementation (in Chrome)
- path = event.path;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (event.composedPath) {
+ path = event.composedPath();
</ins><span class="cx" style="display: block; padding: 0 10px"> if (path && path.length > 0) {
</span><span class="cx" style="display: block; padding: 0 10px"> target = path[0];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Normalize target for WebComponents v1 implementation (standard)
- if (event.deepPath) {
- path = event.deepPath();
- if (path && path.length > 0) {
- target = path[0];
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return target;
+ };
+ var fix = function (originalEvent, data) {
+ var name;
+ var event = data || {};
+ for (name in originalEvent) {
+ if (!deprecated[name]) {
+ event[name] = originalEvent[name];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return target;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Normalizes a native event object or just adds the event specific methods on a custom event.
- */
- function fix(originalEvent, data) {
- var name, event = data || {}, undef;
-
- // Copy all properties from the original event
- for (name in originalEvent) {
- // layerX/layerY is deprecated in Chrome and produces a warning
- if (!deprecated[name]) {
- event[name] = originalEvent[name];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!event.target) {
+ event.target = event.srcElement || document;
+ }
+ if ($_9fhi43ajfuw8l13.experimentalShadowDom) {
+ event.target = getTargetFromShadowDom(originalEvent, event.target);
+ }
+ if (originalEvent && mouseEventRe.test(originalEvent.type) && originalEvent.pageX === undefined && originalEvent.clientX !== undefined) {
+ var eventDoc = event.target.ownerDocument || document;
+ var doc = eventDoc.documentElement;
+ var body = eventDoc.body;
+ event.pageX = originalEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
+ event.pageY = originalEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
+ }
+ event.preventDefault = function () {
+ event.isDefaultPrevented = returnTrue;
+ if (originalEvent) {
+ if (originalEvent.preventDefault) {
+ originalEvent.preventDefault();
+ } else {
+ originalEvent.returnValue = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Normalize target IE uses srcElement
- if (!event.target) {
- event.target = event.srcElement || document;
- }
-
- // Experimental shadow dom support
- if (Env.experimentalShadowDom) {
- event.target = getTargetFromShadowDom(originalEvent, event.target);
- }
-
- // Calculate pageX/Y if missing and clientX/Y available
- if (originalEvent && mouseEventRe.test(originalEvent.type) && originalEvent.pageX === undef && originalEvent.clientX !== undef) {
- var eventDoc = event.target.ownerDocument || document;
- var doc = eventDoc.documentElement;
- var body = eventDoc.body;
-
- event.pageX = originalEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) -
- (doc && doc.clientLeft || body && body.clientLeft || 0);
-
- event.pageY = originalEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) -
- (doc && doc.clientTop || body && body.clientTop || 0);
- }
-
- // Add preventDefault method
- event.preventDefault = function () {
- event.isDefaultPrevented = returnTrue;
-
- // Execute preventDefault on the original event object
- if (originalEvent) {
- if (originalEvent.preventDefault) {
- originalEvent.preventDefault();
- } else {
- originalEvent.returnValue = false; // IE
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ event.stopPropagation = function () {
+ event.isPropagationStopped = returnTrue;
+ if (originalEvent) {
+ if (originalEvent.stopPropagation) {
+ originalEvent.stopPropagation();
+ } else {
+ originalEvent.cancelBubble = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- // Add stopPropagation
- event.stopPropagation = function () {
- event.isPropagationStopped = returnTrue;
-
- // Execute stopPropagation on the original event object
- if (originalEvent) {
- if (originalEvent.stopPropagation) {
- originalEvent.stopPropagation();
- } else {
- originalEvent.cancelBubble = true; // IE
- }
- }
- };
-
- // Add stopImmediatePropagation
- event.stopImmediatePropagation = function () {
- event.isImmediatePropagationStopped = returnTrue;
- event.stopPropagation();
- };
-
- // Add event delegation states
- if (hasIsDefaultPrevented(event) === false) {
- event.isDefaultPrevented = returnFalse;
- event.isPropagationStopped = returnFalse;
- event.isImmediatePropagationStopped = returnFalse;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Add missing metaKey for IE 8
- if (typeof event.metaKey == 'undefined') {
- event.metaKey = false;
- }
-
- return event;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ event.stopImmediatePropagation = function () {
+ event.isImmediatePropagationStopped = returnTrue;
+ event.stopPropagation();
+ };
+ if (hasIsDefaultPrevented(event) === false) {
+ event.isDefaultPrevented = returnFalse;
+ event.isPropagationStopped = returnFalse;
+ event.isImmediatePropagationStopped = returnFalse;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Bind a DOMContentLoaded event across browsers and executes the callback once the page DOM is initialized.
- * It will also set/check the domLoaded state of the event_utils instance so ready isn't called multiple times.
- */
- function bindOnReady(win, callback, eventUtils) {
- var doc = win.document, event = { type: 'ready' };
-
- if (eventUtils.domLoaded) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (typeof event.metaKey === 'undefined') {
+ event.metaKey = false;
+ }
+ return event;
+ };
+ var bindOnReady = function (win, callback, eventUtils) {
+ var doc = win.document, event = { type: 'ready' };
+ if (eventUtils.domLoaded) {
+ callback(event);
+ return;
+ }
+ var isDocReady = function () {
+ return doc.readyState === 'complete' || doc.readyState === 'interactive' && doc.body;
+ };
+ var readyHandler = function () {
+ if (!eventUtils.domLoaded) {
+ eventUtils.domLoaded = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> callback(event);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isDocReady() {
- // Check complete or interactive state if there is a body
- // element on some iframes IE 8 will produce a null body
- return doc.readyState === "complete" || (doc.readyState === "interactive" && doc.body);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var waitForDomLoaded = function () {
+ if (isDocReady()) {
+ removeEvent(doc, 'readystatechange', waitForDomLoaded);
+ readyHandler();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Gets called when the DOM is ready
- function readyHandler() {
- if (!eventUtils.domLoaded) {
- eventUtils.domLoaded = true;
- callback(event);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var tryScroll = function () {
+ try {
+ doc.documentElement.doScroll('left');
+ } catch (ex) {
+ $_2m8wq9hjfuw8l41.setTimeout(tryScroll);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function waitForDomLoaded() {
- if (isDocReady()) {
- removeEvent(doc, "readystatechange", waitForDomLoaded);
- readyHandler();
- }
- }
-
- function tryScroll() {
- try {
- // If IE is used, use the trick by Diego Perini licensed under MIT by request to the author.
- // http://javascript.nwbox.com/IEContentLoaded/
- doc.documentElement.doScroll("left");
- } catch (ex) {
- Delay.setTimeout(tryScroll);
- return;
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ readyHandler();
+ };
+ if (doc.addEventListener && !($_9fhi43ajfuw8l13.ie && $_9fhi43ajfuw8l13.ie < 11)) {
+ if (isDocReady()) {
</ins><span class="cx" style="display: block; padding: 0 10px"> readyHandler();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Use W3C method (exclude IE 9,10 - readyState "interactive" became valid only in IE 11)
- if (doc.addEventListener && !(Env.ie && Env.ie < 11)) {
- if (isDocReady()) {
- readyHandler();
- } else {
- addEvent(win, 'DOMContentLoaded', readyHandler);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Use IE method
- addEvent(doc, "readystatechange", waitForDomLoaded);
-
- // Wait until we can scroll, when we can the DOM is initialized
- if (doc.documentElement.doScroll && win.self === win.top) {
- tryScroll();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ addEvent(win, 'DOMContentLoaded', readyHandler);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Fallback if any of the above methods should fail for some odd reason
- addEvent(win, 'load', readyHandler);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ addEvent(doc, 'readystatechange', waitForDomLoaded);
+ if (doc.documentElement.doScroll && win.self === win.top) {
+ tryScroll();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * This class enables you to bind/unbind native events to elements and normalize it's behavior across browsers.
- */
- function EventUtils() {
- var self = this, events = {}, count, expando, hasFocusIn, hasMouseEnterLeave, mouseEnterLeave;
-
- expando = eventExpandoPrefix + (+new Date()).toString(32);
- hasMouseEnterLeave = "onmouseenter" in document.documentElement;
- hasFocusIn = "onfocusin" in document.documentElement;
- mouseEnterLeave = { mouseenter: 'mouseover', mouseleave: 'mouseout' };
- count = 1;
-
- // State if the DOMContentLoaded was executed or not
- self.domLoaded = false;
- self.events = events;
-
- /**
- * Executes all event handler callbacks for a specific event.
- *
- * @private
- * @param {Event} evt Event object.
- * @param {String} id Expando id value to look for.
- */
- function executeHandlers(evt, id) {
- var callbackList, i, l, callback, container = events[id];
-
- callbackList = container && container[evt.type];
- if (callbackList) {
- for (i = 0, l = callbackList.length; i < l; i++) {
- callback = callbackList[i];
-
- // Check if callback exists might be removed if a unbind is called inside the callback
- if (callback && callback.func.call(callback.scope, evt) === false) {
- evt.preventDefault();
- }
-
- // Should we stop propagation to immediate listeners
- if (evt.isImmediatePropagationStopped()) {
- return;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ addEvent(win, 'load', readyHandler);
+ };
+ var EventUtils = function () {
+ var self = this;
+ var events = {}, count, expando, hasFocusIn, hasMouseEnterLeave, mouseEnterLeave;
+ expando = eventExpandoPrefix + (+new Date()).toString(32);
+ hasMouseEnterLeave = 'onmouseenter' in document.documentElement;
+ hasFocusIn = 'onfocusin' in document.documentElement;
+ mouseEnterLeave = {
+ mouseenter: 'mouseover',
+ mouseleave: 'mouseout'
+ };
+ count = 1;
+ self.domLoaded = false;
+ self.events = events;
+ var executeHandlers = function (evt, id) {
+ var callbackList, i, l, callback;
+ var container = events[id];
+ callbackList = container && container[evt.type];
+ if (callbackList) {
+ for (i = 0, l = callbackList.length; i < l; i++) {
+ callback = callbackList[i];
+ if (callback && callback.func.call(callback.scope, evt) === false) {
+ evt.preventDefault();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (evt.isImmediatePropagationStopped()) {
+ return;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Binds a callback to an event on the specified target.
- *
- * @method bind
- * @param {Object} target Target node/window or custom object.
- * @param {String} names Name of the event to bind.
- * @param {function} callback Callback function to execute when the event occurs.
- * @param {Object} scope Scope to call the callback function on, defaults to target.
- * @return {function} Callback function that got bound.
- */
- self.bind = function (target, names, callback, scope) {
- var id, callbackList, i, name, fakeName, nativeHandler, capture, win = window;
-
- // Native event handler function patches the event and executes the callbacks for the expando
- function defaultNativeHandler(evt) {
- executeHandlers(fix(evt || win.event), id);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ self.bind = function (target, names, callback, scope) {
+ var id, callbackList, i, name, fakeName, nativeHandler, capture;
+ var win = window;
+ var defaultNativeHandler = function (evt) {
+ executeHandlers(fix(evt || win.event), id);
+ };
+ if (!target || target.nodeType === 3 || target.nodeType === 8) {
+ return;
+ }
+ if (!target[expando]) {
+ id = count++;
+ target[expando] = id;
+ events[id] = {};
+ } else {
+ id = target[expando];
+ }
+ scope = scope || target;
+ names = names.split(' ');
+ i = names.length;
+ while (i--) {
+ name = names[i];
+ nativeHandler = defaultNativeHandler;
+ fakeName = capture = false;
+ if (name === 'DOMContentLoaded') {
+ name = 'ready';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Don't bind to text nodes or comments
- if (!target || target.nodeType === 3 || target.nodeType === 8) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.domLoaded && name === 'ready' && target.readyState === 'complete') {
+ callback.call(scope, fix({ type: name }));
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Create or get events id for the target
- if (!target[expando]) {
- id = count++;
- target[expando] = id;
- events[id] = {};
- } else {
- id = target[expando];
- }
-
- // Setup the specified scope or use the target as a default
- scope = scope || target;
-
- // Split names and bind each event, enables you to bind multiple events with one call
- names = names.split(' ');
- i = names.length;
- while (i--) {
- name = names[i];
- nativeHandler = defaultNativeHandler;
- fakeName = capture = false;
-
- // Use ready instead of DOMContentLoaded
- if (name === "DOMContentLoaded") {
- name = "ready";
- }
-
- // DOM is already ready
- if (self.domLoaded && name === "ready" && target.readyState == 'complete') {
- callback.call(scope, fix({ type: name }));
- continue;
- }
-
- // Handle mouseenter/mouseleaver
- if (!hasMouseEnterLeave) {
- fakeName = mouseEnterLeave[name];
-
- if (fakeName) {
- nativeHandler = function (evt) {
- var current, related;
-
- current = evt.currentTarget;
- related = evt.relatedTarget;
-
- // Check if related is inside the current target if it's not then the event should
- // be ignored since it's a mouseover/mouseout inside the element
- if (related && current.contains) {
- // Use contains for performance
- related = current.contains(related);
- } else {
- while (related && related !== current) {
- related = related.parentNode;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!hasMouseEnterLeave) {
+ fakeName = mouseEnterLeave[name];
+ if (fakeName) {
+ nativeHandler = function (evt) {
+ var current, related;
+ current = evt.currentTarget;
+ related = evt.relatedTarget;
+ if (related && current.contains) {
+ related = current.contains(related);
+ } else {
+ while (related && related !== current) {
+ related = related.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Fire fake event
- if (!related) {
- evt = fix(evt || win.event);
- evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter';
- evt.target = current;
- executeHandlers(evt, id);
- }
- };
- }
- }
-
- // Fake bubbling of focusin/focusout
- if (!hasFocusIn && (name === "focusin" || name === "focusout")) {
- capture = true;
- fakeName = name === "focusin" ? "focus" : "blur";
- nativeHandler = function (evt) {
- evt = fix(evt || win.event);
- evt.type = evt.type === 'focus' ? 'focusin' : 'focusout';
- executeHandlers(evt, id);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (!related) {
+ evt = fix(evt || win.event);
+ evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter';
+ evt.target = current;
+ executeHandlers(evt, id);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Setup callback list and bind native event
- callbackList = events[id][name];
- if (!callbackList) {
- events[id][name] = callbackList = [{ func: callback, scope: scope }];
- callbackList.fakeName = fakeName;
- callbackList.capture = capture;
- //callbackList.callback = callback;
-
- // Add the nativeHandler to the callback list so that we can later unbind it
- callbackList.nativeHandler = nativeHandler;
-
- // Check if the target has native events support
-
- if (name === "ready") {
- bindOnReady(target, nativeHandler, self);
- } else {
- addEvent(target, fakeName || name, nativeHandler, capture);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (!hasFocusIn && (name === 'focusin' || name === 'focusout')) {
+ capture = true;
+ fakeName = name === 'focusin' ? 'focus' : 'blur';
+ nativeHandler = function (evt) {
+ evt = fix(evt || win.event);
+ evt.type = evt.type === 'focus' ? 'focusin' : 'focusout';
+ executeHandlers(evt, id);
+ };
+ }
+ callbackList = events[id][name];
+ if (!callbackList) {
+ events[id][name] = callbackList = [{
+ func: callback,
+ scope: scope
+ }];
+ callbackList.fakeName = fakeName;
+ callbackList.capture = capture;
+ callbackList.nativeHandler = nativeHandler;
+ if (name === 'ready') {
+ bindOnReady(target, nativeHandler, self);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (name === "ready" && self.domLoaded) {
- callback({ type: name });
- } else {
- // If it already has an native handler then just push the callback
- callbackList.push({ func: callback, scope: scope });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ addEvent(target, fakeName || name, nativeHandler, capture);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if (name === 'ready' && self.domLoaded) {
+ callback({ type: name });
+ } else {
+ callbackList.push({
+ func: callback,
+ scope: scope
+ });
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- target = callbackList = 0; // Clean memory for IE
-
- return callback;
- };
-
- /**
- * Unbinds the specified event by name, name and callback or all events on the target.
- *
- * @method unbind
- * @param {Object} target Target node/window or custom object.
- * @param {String} names Optional event name to unbind.
- * @param {function} callback Optional callback function to unbind.
- * @return {EventUtils} Event utils instance.
- */
- self.unbind = function (target, names, callback) {
- var id, callbackList, i, ci, name, eventMap;
-
- // Don't bind to text nodes or comments
- if (!target || target.nodeType === 3 || target.nodeType === 8) {
- return self;
- }
-
- // Unbind event or events if the target has the expando
- id = target[expando];
- if (id) {
- eventMap = events[id];
-
- // Specific callback
- if (names) {
- names = names.split(' ');
- i = names.length;
- while (i--) {
- name = names[i];
- callbackList = eventMap[name];
-
- // Unbind the event if it exists in the map
- if (callbackList) {
- // Remove specified callback
- if (callback) {
- ci = callbackList.length;
- while (ci--) {
- if (callbackList[ci].func === callback) {
- var nativeHandler = callbackList.nativeHandler;
- var fakeName = callbackList.fakeName, capture = callbackList.capture;
-
- // Clone callbackList since unbind inside a callback would otherwise break the handlers loop
- callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1));
- callbackList.nativeHandler = nativeHandler;
- callbackList.fakeName = fakeName;
- callbackList.capture = capture;
-
- eventMap[name] = callbackList;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ target = callbackList = 0;
+ return callback;
+ };
+ self.unbind = function (target, names, callback) {
+ var id, callbackList, i, ci, name, eventMap;
+ if (!target || target.nodeType === 3 || target.nodeType === 8) {
+ return self;
+ }
+ id = target[expando];
+ if (id) {
+ eventMap = events[id];
+ if (names) {
+ names = names.split(' ');
+ i = names.length;
+ while (i--) {
+ name = names[i];
+ callbackList = eventMap[name];
+ if (callbackList) {
+ if (callback) {
+ ci = callbackList.length;
+ while (ci--) {
+ if (callbackList[ci].func === callback) {
+ var nativeHandler = callbackList.nativeHandler;
+ var fakeName = callbackList.fakeName, capture = callbackList.capture;
+ callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1));
+ callbackList.nativeHandler = nativeHandler;
+ callbackList.fakeName = fakeName;
+ callbackList.capture = capture;
+ eventMap[name] = callbackList;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove all callbacks if there isn't a specified callback or there is no callbacks left
- if (!callback || callbackList.length === 0) {
- delete eventMap[name];
- removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!callback || callbackList.length === 0) {
+ delete eventMap[name];
+ removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- // All events for a specific element
- for (name in eventMap) {
- callbackList = eventMap[name];
- removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture);
- }
-
- eventMap = {};
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Check if object is empty, if it isn't then we won't remove the expando map
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
</ins><span class="cx" style="display: block; padding: 0 10px"> for (name in eventMap) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ callbackList = eventMap[name];
+ removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Delete event object
- delete events[id];
-
- // Remove expando from target
- try {
- // IE will fail here since it can't delete properties from window
- delete target[expando];
- } catch (ex) {
- // IE will set it to null
- target[expando] = null;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ eventMap = {};
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return self;
- };
-
- /**
- * Fires the specified event on the specified target.
- *
- * @method fire
- * @param {Object} target Target node/window or custom object.
- * @param {String} name Event name to fire.
- * @param {Object} args Optional arguments to send to the observers.
- * @return {EventUtils} Event utils instance.
- */
- self.fire = function (target, name, args) {
- var id;
-
- // Don't bind to text nodes or comments
- if (!target || target.nodeType === 3 || target.nodeType === 8) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (name in eventMap) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return self;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Build event object by patching the args
- args = fix(null, args);
- args.type = name;
- args.target = target;
-
- do {
- // Found an expando that means there is listeners to execute
- id = target[expando];
- if (id) {
- executeHandlers(args, id);
- }
-
- // Walk up the DOM
- target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow;
- } while (target && !args.isPropagationStopped());
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ delete events[id];
+ try {
+ delete target[expando];
+ } catch (ex) {
+ target[expando] = null;
+ }
+ }
+ return self;
+ };
+ self.fire = function (target, name, args) {
+ var id;
+ if (!target || target.nodeType === 3 || target.nodeType === 8) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return self;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- /**
- * Removes all bound event listeners for the specified target. This will also remove any bound
- * listeners to child nodes within that target.
- *
- * @method clean
- * @param {Object} target Target node/window object.
- * @return {EventUtils} Event utils instance.
- */
- self.clean = function (target) {
- var i, children, unbind = self.unbind;
-
- // Don't bind to text nodes or comments
- if (!target || target.nodeType === 3 || target.nodeType === 8) {
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ args = fix(null, args);
+ args.type = name;
+ args.target = target;
+ do {
+ id = target[expando];
+ if (id) {
+ executeHandlers(args, id);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Unbind any element on the specified target
- if (target[expando]) {
- unbind(target);
- }
-
- // Target doesn't have getElementsByTagName it's probably a window object then use it's document to find the children
- if (!target.getElementsByTagName) {
- target = target.document;
- }
-
- // Remove events from each child element
- if (target && target.getElementsByTagName) {
- unbind(target);
-
- children = target.getElementsByTagName('*');
- i = children.length;
- while (i--) {
- target = children[i];
-
- if (target[expando]) {
- unbind(target);
- }
- }
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow;
+ } while (target && !args.isPropagationStopped());
+ return self;
+ };
+ self.clean = function (target) {
+ var i, children;
+ var unbind = self.unbind;
+ if (!target || target.nodeType === 3 || target.nodeType === 8) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return self;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- /**
- * Destroys the event object. Call this on IE to remove memory leaks.
- */
- self.destroy = function () {
- events = {};
- };
-
- // Legacy function for canceling events
- self.cancel = function (e) {
- if (e) {
- e.preventDefault();
- e.stopImmediatePropagation();
- }
-
- return false;
- };
- }
-
- EventUtils.Event = new EventUtils();
- EventUtils.Event.bind(window, 'ready', function () { });
-
- return EventUtils;
- }
-);
-
-/**
- * Sizzle.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- *
- * @ignore-file
- *
- * Forked changes:
- * - Disabled all assertions since they are only used for non supported browsers and cause dom repaints see #TINY-1141
- */
-
-/*jshint bitwise:false, expr:true, noempty:false, sub:true, eqnull:true, latedef:false, maxlen:255 */
-/*eslint-disable */
-
-/**
- * Sizzle CSS Selector Engine v@VERSION
- * http://sizzlejs.com/
- *
- * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
- * Released under the MIT license
- * http://jquery.org/license
- *
- * Date: @DATE
- */
-define(
- 'tinymce.core.dom.Sizzle',
- [],
- function () {
- var i,
- support,
- Expr,
- getText,
- isXML,
- tokenize,
- compile,
- select,
- outermostContext,
- sortInput,
- hasDuplicate,
-
- // Local document vars
- setDocument,
- document,
- docElem,
- documentIsHTML,
- rbuggyQSA,
- rbuggyMatches,
- matches,
- contains,
-
- // Instance-specific data
- expando = "sizzle" + -(new Date()),
- preferredDoc = window.document,
- dirruns = 0,
- done = 0,
- classCache = createCache(),
- tokenCache = createCache(),
- compilerCache = createCache(),
- sortOrder = function (a, b) {
- if (a === b) {
- hasDuplicate = true;
- }
- return 0;
- },
-
- // General-purpose constants
- strundefined = typeof undefined,
- MAX_NEGATIVE = 1 << 31,
-
- // Instance methods
- hasOwn = ({}).hasOwnProperty,
- arr = [],
- pop = arr.pop,
- push_native = arr.push,
- push = arr.push,
- slice = arr.slice,
- // Use a stripped-down indexOf if we can't use a native one
- indexOf = arr.indexOf || function (elem) {
- var i = 0,
- len = this.length;
- for (; i < len; i++) {
- if (this[i] === elem) {
- return i;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (target[expando]) {
+ unbind(target);
+ }
+ if (!target.getElementsByTagName) {
+ target = target.document;
+ }
+ if (target && target.getElementsByTagName) {
+ unbind(target);
+ children = target.getElementsByTagName('*');
+ i = children.length;
+ while (i--) {
+ target = children[i];
+ if (target[expando]) {
+ unbind(target);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return -1;
- },
-
- booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
-
- // Regular expressions
-
- // http://www.w3.org/TR/css3-selectors/#whitespace
- whitespace = "[\\x20\\t\\r\\n\\f]",
-
- // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
- identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
-
- // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
- attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
- // Operator (capture 2)
- "*([*^$|!~]?=)" + whitespace +
- // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
- "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
- "*\\]",
-
- pseudos = ":(" + identifier + ")(?:\\((" +
- // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
- // 1. quoted (capture 3; capture 4 or capture 5)
- "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
- // 2. simple (capture 6)
- "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
- // 3. anything else (capture 2)
- ".*" +
- ")\\)|)",
-
- // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
- rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
-
- rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
- rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
-
- rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
-
- rpseudo = new RegExp(pseudos),
- ridentifier = new RegExp("^" + identifier + "$"),
-
- matchExpr = {
- "ID": new RegExp("^#(" + identifier + ")"),
- "CLASS": new RegExp("^\\.(" + identifier + ")"),
- "TAG": new RegExp("^(" + identifier + "|[*])"),
- "ATTR": new RegExp("^" + attributes),
- "PSEUDO": new RegExp("^" + pseudos),
- "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
- "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
- "bool": new RegExp("^(?:" + booleans + ")$", "i"),
- // For use in libraries implementing .is()
- // We use this for POS matching in `select`
- "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
- whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
- },
-
- rinputs = /^(?:input|select|textarea|button)$/i,
- rheader = /^h\d$/i,
-
- rnative = /^[^{]+\{\s*\[native \w/,
-
- // Easily-parseable/retrievable ID or TAG or CLASS selectors
- rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
-
- rsibling = /[+~]/,
- rescape = /'|\\/g,
-
- // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
- runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
- funescape = function (_, escaped, escapedWhitespace) {
- var high = "0x" + escaped - 0x10000;
- // NaN means non-codepoint
- // Support: Firefox<24
- // Workaround erroneous numeric interpretation of +"0x"
- return high !== high || escapedWhitespace ?
- escaped :
- high < 0 ?
- // BMP codepoint
- String.fromCharCode(high + 0x10000) :
- // Supplemental Plane codepoint (surrogate pair)
- String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
- };
-
- // Optimize for push.apply( _, NodeList )
- try {
- push.apply(
- (arr = slice.call(preferredDoc.childNodes)),
- preferredDoc.childNodes
- );
- // Support: Android<4.0
- // Detect silently failing push.apply
- arr[preferredDoc.childNodes.length].nodeType;
- } catch (e) {
- push = {
- apply: arr.length ?
-
- // Leverage slice if possible
- function (target, els) {
- push_native.apply(target, slice.call(els));
- } :
-
- // Support: IE<9
- // Otherwise append directly
- function (target, els) {
- var j = target.length,
- i = 0;
- // Can't trust NodeList.length
- while ((target[j++] = els[i++])) { }
- target.length = j - 1;
- }
- };
- }
-
- function Sizzle(selector, context, results, seed) {
- var match, elem, m, nodeType,
- // QSA vars
- i, groups, old, nid, newContext, newSelector;
-
- if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
- setDocument(context);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- context = context || document;
- results = results || [];
-
- if (!selector || typeof selector !== "string") {
- return results;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
+ };
+ self.destroy = function () {
+ events = {};
+ };
+ self.cancel = function (e) {
+ if (e) {
+ e.preventDefault();
+ e.stopImmediatePropagation();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
+ };
+ };
+ EventUtils.Event = new EventUtils();
+ EventUtils.Event.bind(window, 'ready', function () {
+ });
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) {
- return [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var i;
+ var support;
+ var Expr;
+ var getText;
+ var isXML;
+ var tokenize;
+ var compile;
+ var select;
+ var outermostContext;
+ var sortInput;
+ var hasDuplicate;
+ var setDocument;
+ var document$1;
+ var docElem;
+ var documentIsHTML;
+ var rbuggyQSA;
+ var rbuggyMatches;
+ var matches;
+ var contains$1;
+ var expando = 'sizzle' + -new Date();
+ var preferredDoc = window.document;
+ var dirruns = 0;
+ var done = 0;
+ var classCache = createCache();
+ var tokenCache = createCache();
+ var compilerCache = createCache();
+ var sortOrder = function (a, b) {
+ if (a === b) {
+ hasDuplicate = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (documentIsHTML && !seed) {
-
- // Shortcuts
- if ((match = rquickExpr.exec(selector))) {
- // Speed-up: Sizzle("#ID")
- if ((m = match[1])) {
- if (nodeType === 9) {
- elem = context.getElementById(m);
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document (jQuery #6963)
- if (elem && elem.parentNode) {
- // Handle the case where IE, Opera, and Webkit return items
- // by name instead of ID
- if (elem.id === m) {
- results.push(elem);
- return results;
- }
- } else {
- return results;
- }
- } else {
- // Context is not a document
- if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) &&
- contains(context, elem) && elem.id === m) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return 0;
+ };
+ var strundefined = typeof undefined;
+ var MAX_NEGATIVE = 1 << 31;
+ var hasOwn = {}.hasOwnProperty;
+ var arr = [];
+ var pop = arr.pop;
+ var push_native = arr.push;
+ var push$1 = arr.push;
+ var slice$1 = arr.slice;
+ var indexOf$1 = arr.indexOf || function (elem) {
+ var i = 0, len = this.length;
+ for (; i < len; i++) {
+ if (this[i] === elem) {
+ return i;
+ }
+ }
+ return -1;
+ };
+ var booleans = 'checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped';
+ var whitespace = '[\\x20\\t\\r\\n\\f]';
+ var identifier = '(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+';
+ var attributes = '\\[' + whitespace + '*(' + identifier + ')(?:' + whitespace + '*([*^$|!~]?=)' + whitespace + '*(?:\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)"|(' + identifier + '))|)' + whitespace + '*\\]';
+ var pseudos = ':(' + identifier + ')(?:\\((' + '(\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)")|' + '((?:\\\\.|[^\\\\()[\\]]|' + attributes + ')*)|' + '.*' + ')\\)|)';
+ var rtrim = new RegExp('^' + whitespace + '+|((?:^|[^\\\\])(?:\\\\.)*)' + whitespace + '+$', 'g');
+ var rcomma = new RegExp('^' + whitespace + '*,' + whitespace + '*');
+ var rcombinators = new RegExp('^' + whitespace + '*([>+~]|' + whitespace + ')' + whitespace + '*');
+ var rattributeQuotes = new RegExp('=' + whitespace + '*([^\\]\'"]*?)' + whitespace + '*\\]', 'g');
+ var rpseudo = new RegExp(pseudos);
+ var ridentifier = new RegExp('^' + identifier + '$');
+ var matchExpr = {
+ ID: new RegExp('^#(' + identifier + ')'),
+ CLASS: new RegExp('^\\.(' + identifier + ')'),
+ TAG: new RegExp('^(' + identifier + '|[*])'),
+ ATTR: new RegExp('^' + attributes),
+ PSEUDO: new RegExp('^' + pseudos),
+ CHILD: new RegExp('^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(' + whitespace + '*(even|odd|(([+-]|)(\\d*)n|)' + whitespace + '*(?:([+-]|)' + whitespace + '*(\\d+)|))' + whitespace + '*\\)|)', 'i'),
+ bool: new RegExp('^(?:' + booleans + ')$', 'i'),
+ needsContext: new RegExp('^' + whitespace + '*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(' + whitespace + '*((?:-\\d)?\\d*)' + whitespace + '*\\)|)(?=[^-]|$)', 'i')
+ };
+ var rinputs = /^(?:input|select|textarea|button)$/i;
+ var rheader = /^h\d$/i;
+ var rnative = /^[^{]+\{\s*\[native \w/;
+ var rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/;
+ var rsibling = /[+~]/;
+ var rescape = /'|\\/g;
+ var runescape = new RegExp('\\\\([\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig');
+ var funescape = function (_, escaped, escapedWhitespace) {
+ var high = '0x' + escaped - 65536;
+ return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
+ };
+ try {
+ push$1.apply(arr = slice$1.call(preferredDoc.childNodes), preferredDoc.childNodes);
+ arr[preferredDoc.childNodes.length].nodeType;
+ } catch (e) {
+ push$1 = {
+ apply: arr.length ? function (target, els) {
+ push_native.apply(target, slice$1.call(els));
+ } : function (target, els) {
+ var j = target.length, i = 0;
+ while (target[j++] = els[i++]) {
+ }
+ target.length = j - 1;
+ }
+ };
+ }
+ var Sizzle = function (selector, context, results, seed) {
+ var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector;
+ if ((context ? context.ownerDocument || context : preferredDoc) !== document$1) {
+ setDocument(context);
+ }
+ context = context || document$1;
+ results = results || [];
+ if (!selector || typeof selector !== 'string') {
+ return results;
+ }
+ if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) {
+ return [];
+ }
+ if (documentIsHTML && !seed) {
+ if (match = rquickExpr.exec(selector)) {
+ if (m = match[1]) {
+ if (nodeType === 9) {
+ elem = context.getElementById(m);
+ if (elem && elem.parentNode) {
+ if (elem.id === m) {
</ins><span class="cx" style="display: block; padding: 0 10px"> results.push(elem);
</span><span class="cx" style="display: block; padding: 0 10px"> return results;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Speed-up: Sizzle("TAG")
- } else if (match[2]) {
- push.apply(results, context.getElementsByTagName(selector));
- return results;
-
- // Speed-up: Sizzle(".CLASS")
- } else if ((m = match[3]) && support.getElementsByClassName) {
- push.apply(results, context.getElementsByClassName(m));
- return results;
- }
- }
-
- // QSA path
- if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
- nid = old = expando;
- newContext = context;
- newSelector = nodeType === 9 && selector;
-
- // qSA works strangely on Element-rooted queries
- // We can work around this by specifying an extra ID on the root
- // and working up from there (Thanks to Andrew Dupont for the technique)
- // IE 8 doesn't work on object elements
- if (nodeType === 1 && context.nodeName.toLowerCase() !== "object") {
- groups = tokenize(selector);
-
- if ((old = context.getAttribute("id"))) {
- nid = old.replace(rescape, "\\$&");
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- context.setAttribute("id", nid);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return results;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- nid = "[id='" + nid + "'] ";
-
- i = groups.length;
- while (i--) {
- groups[i] = nid + toSelector(groups[i]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains$1(context, elem) && elem.id === m) {
+ results.push(elem);
+ return results;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
- newSelector = groups.join(",");
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (newSelector) {
- try {
- push.apply(results,
- newContext.querySelectorAll(newSelector)
- );
- return results;
- } catch (qsaError) {
- } finally {
- if (!old) {
- context.removeAttribute("id");
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (match[2]) {
+ push$1.apply(results, context.getElementsByTagName(selector));
+ return results;
+ } else if ((m = match[3]) && support.getElementsByClassName) {
+ push$1.apply(results, context.getElementsByClassName(m));
+ return results;
+ }
+ }
+ if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
+ nid = old = expando;
+ newContext = context;
+ newSelector = nodeType === 9 && selector;
+ if (nodeType === 1 && context.nodeName.toLowerCase() !== 'object') {
+ groups = tokenize(selector);
+ if (old = context.getAttribute('id')) {
+ nid = old.replace(rescape, '\\$&');
+ } else {
+ context.setAttribute('id', nid);
+ }
+ nid = '[id=\'' + nid + '\'] ';
+ i = groups.length;
+ while (i--) {
+ groups[i] = nid + toSelector(groups[i]);
+ }
+ newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
+ newSelector = groups.join(',');
+ }
+ if (newSelector) {
+ try {
+ push$1.apply(results, newContext.querySelectorAll(newSelector));
+ return results;
+ } catch (qsaError) {
+ } finally {
+ if (!old) {
+ context.removeAttribute('id');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // All others
- return select(selector.replace(rtrim, "$1"), context, results, seed);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Create key-value caches of limited size
- * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
- * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
- * deleting the oldest entry
- */
- function createCache() {
- var keys = [];
-
- function cache(key, value) {
- // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
- if (keys.push(key + " ") > Expr.cacheLength) {
- // Only keep the most recent entries
- delete cache[keys.shift()];
- }
- return (cache[key + " "] = value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return select(selector.replace(rtrim, '$1'), context, results, seed);
+ };
+ function createCache() {
+ var keys = [];
+ function cache(key, value) {
+ if (keys.push(key + ' ') > Expr.cacheLength) {
+ delete cache[keys.shift()];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return cache;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return cache[key + ' '] = value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Mark a function for special use by Sizzle
- * @param {Function} fn The function to mark
- */
- function markFunction(fn) {
- fn[expando] = true;
- return fn;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return cache;
+ }
+ function markFunction(fn) {
+ fn[expando] = true;
+ return fn;
+ }
+ function siblingCheck(a, b) {
+ var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE);
+ if (diff) {
+ return diff;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Support testing using an element
- * @param {Function} fn Passed the created div and expects a boolean result
- */
- /*function assert(fn) {
- var div = document.createElement("div");
-
- try {
- return !!fn(div);
- } catch (e) {
- return false;
- } finally {
- // Remove from its parent by default
- if (div.parentNode) {
- div.parentNode.removeChild(div);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (cur) {
+ while (cur = cur.nextSibling) {
+ if (cur === b) {
+ return -1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // release memory in IE
- div = null;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }*/
-
- /**
- * Adds the same handler for all of the specified attrs
- * @param {String} attrs Pipe-separated list of attributes
- * @param {Function} handler The method that will be applied
- */
- function addHandle(attrs, handler) {
- var arr = attrs.split("|"),
- i = attrs.length;
-
- while (i--) {
- Expr.attrHandle[arr[i]] = handler;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Checks document order of two siblings
- * @param {Element} a
- * @param {Element} b
- * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
- */
- function siblingCheck(a, b) {
- var cur = b && a,
- diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
- (~b.sourceIndex || MAX_NEGATIVE) -
- (~a.sourceIndex || MAX_NEGATIVE);
-
- // Use IE sourceIndex if available on both nodes
- if (diff) {
- return diff;
- }
-
- // Check if b follows a
- if (cur) {
- while ((cur = cur.nextSibling)) {
- if (cur === b) {
- return -1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return a ? 1 : -1;
+ }
+ function createInputPseudo(type) {
+ return function (elem) {
+ var name = elem.nodeName.toLowerCase();
+ return name === 'input' && elem.type === type;
+ };
+ }
+ function createButtonPseudo(type) {
+ return function (elem) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === 'input' || name === 'button') && elem.type === type;
+ };
+ }
+ function createPositionalPseudo(fn) {
+ return markFunction(function (argument) {
+ argument = +argument;
+ return markFunction(function (seed, matches) {
+ var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length;
+ while (i--) {
+ if (seed[j = matchIndexes[i]]) {
+ seed[j] = !(matches[j] = seed[j]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ });
+ }
+ function testContext(context) {
+ return context && typeof context.getElementsByTagName !== strundefined && context;
+ }
+ support = Sizzle.support = {};
+ isXML = Sizzle.isXML = function (elem) {
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+ return documentElement ? documentElement.nodeName !== 'HTML' : false;
+ };
+ setDocument = Sizzle.setDocument = function (node) {
+ var hasCompare, doc = node ? node.ownerDocument || node : preferredDoc, parent = doc.defaultView;
+ function getTop(win) {
+ try {
+ return win.top;
+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return a ? 1 : -1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns a function to use in pseudos for input types
- * @param {String} type
- */
- function createInputPseudo(type) {
- return function (elem) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && elem.type === type;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (doc === document$1 || doc.nodeType !== 9 || !doc.documentElement) {
+ return document$1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns a function to use in pseudos for buttons
- * @param {String} type
- */
- function createButtonPseudo(type) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ document$1 = doc;
+ docElem = doc.documentElement;
+ documentIsHTML = !isXML(doc);
+ if (parent && parent !== getTop(parent)) {
+ if (parent.addEventListener) {
+ parent.addEventListener('unload', function () {
+ setDocument();
+ }, false);
+ } else if (parent.attachEvent) {
+ parent.attachEvent('onunload', function () {
+ setDocument();
+ });
+ }
+ }
+ support.attributes = true;
+ support.getElementsByTagName = true;
+ support.getElementsByClassName = rnative.test(doc.getElementsByClassName);
+ support.getById = true;
+ Expr.find.ID = function (id, context) {
+ if (typeof context.getElementById !== strundefined && documentIsHTML) {
+ var m = context.getElementById(id);
+ return m && m.parentNode ? [m] : [];
+ }
+ };
+ Expr.filter.ID = function (id) {
+ var attrId = id.replace(runescape, funescape);
</ins><span class="cx" style="display: block; padding: 0 10px"> return function (elem) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && elem.type === type;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return elem.getAttribute('id') === attrId;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- /**
- * Returns a function to use in pseudos for positionals
- * @param {Function} fn
- */
- function createPositionalPseudo(fn) {
- return markFunction(function (argument) {
- argument = +argument;
- return markFunction(function (seed, matches) {
- var j,
- matchIndexes = fn([], seed.length, argument),
- i = matchIndexes.length;
-
- // Match elements found at the specified indexes
- while (i--) {
- if (seed[(j = matchIndexes[i])]) {
- seed[j] = !(matches[j] = seed[j]);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ Expr.find.TAG = support.getElementsByTagName ? function (tag, context) {
+ if (typeof context.getElementsByTagName !== strundefined) {
+ return context.getElementsByTagName(tag);
+ }
+ } : function (tag, context) {
+ var elem, tmp = [], i = 0, results = context.getElementsByTagName(tag);
+ if (tag === '*') {
+ while (elem = results[i++]) {
+ if (elem.nodeType === 1) {
+ tmp.push(elem);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- });
- }
-
- /**
- * Checks a node for validity as a Sizzle context
- * @param {Element|Object=} context
- * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
- */
- function testContext(context) {
- return context && typeof context.getElementsByTagName !== strundefined && context;
- }
-
- // Expose support vars for convenience
- support = Sizzle.support = {};
-
- /**
- * Detects XML nodes
- * @param {Element|Object} elem An element or a document
- * @returns {Boolean} True iff elem is a non-HTML XML node
- */
- isXML = Sizzle.isXML = function (elem) {
- // documentElement is verified for cases where it doesn't yet exist
- // (such as loading iframes in IE - #4833)
- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
- return documentElement ? documentElement.nodeName !== "HTML" : false;
- };
-
- /**
- * Sets document-related variables once based on the current document
- * @param {Element|Object} [doc] An element or document object to use to set the document
- * @returns {Object} Returns the current document
- */
- setDocument = Sizzle.setDocument = function (node) {
- var hasCompare,
- doc = node ? node.ownerDocument || node : preferredDoc,
- parent = doc.defaultView;
-
- function getTop(win) {
- // Edge throws a lovely Object expected if you try to get top on a detached reference see #2642
- try {
- return win.top;
- } catch (ex) {
- // Ignore
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return tmp;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // If no document and documentElement is available, return
- if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
- return document;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return results;
+ };
+ Expr.find.CLASS = support.getElementsByClassName && function (className, context) {
+ if (documentIsHTML) {
+ return context.getElementsByClassName(className);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Set our document
- document = doc;
- docElem = doc.documentElement;
-
- // Support tests
- documentIsHTML = !isXML(doc);
-
- // Support: IE>8
- // If iframe document is assigned to "document" variable and if iframe has been reloaded,
- // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
- // IE6-8 do not support the defaultView property so parent will be undefined
- if (parent && parent !== getTop(parent)) {
- // IE11 does not have attachEvent, so all must suffer
- if (parent.addEventListener) {
- parent.addEventListener("unload", function () {
- setDocument();
- }, false);
- } else if (parent.attachEvent) {
- parent.attachEvent("onunload", function () {
- setDocument();
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ rbuggyMatches = [];
+ rbuggyQSA = [];
+ support.disconnectedMatch = true;
+ rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join('|'));
+ rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join('|'));
+ hasCompare = rnative.test(docElem.compareDocumentPosition);
+ contains$1 = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
+ var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode;
+ return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
+ } : function (a, b) {
+ if (b) {
+ while (b = b.parentNode) {
+ if (b === a) {
+ return true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /* Attributes
- ---------------------------------------------------------------------- */
-
- // Support: IE<8
- // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
- support.attributes = true;
-
- /* getElement(s)By*
- ---------------------------------------------------------------------- */
-
- // Check if getElementsByTagName("*") returns only elements
- support.getElementsByTagName = true;
-
- // Support: IE<9
- support.getElementsByClassName = rnative.test(doc.getElementsByClassName);
-
- // Support: IE<10
- // Check if getElementById returns elements by name
- // The broken getElementById methods don't pick up programatically-set names,
- // so use a roundabout getElementsByName test
- support.getById = true;
-
- // ID find and filter
- /*if (support.getById) {*/
- Expr.find["ID"] = function (id, context) {
- if (typeof context.getElementById !== strundefined && documentIsHTML) {
- var m = context.getElementById(id);
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- return m && m.parentNode ? [m] : [];
- }
- };
- Expr.filter["ID"] = function (id) {
- var attrId = id.replace(runescape, funescape);
- return function (elem) {
- return elem.getAttribute("id") === attrId;
- };
- };
- /*} else {
- // Support: IE6/7
- // getElementById is not reliable as a find shortcut
- delete Expr.find["ID"];
-
- Expr.filter["ID"] = function (id) {
- var attrId = id.replace(runescape, funescape);
- return function (elem) {
- var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
- return node && node.value === attrId;
- };
- };
- }*/
-
- // Tag
- Expr.find["TAG"] = support.getElementsByTagName ?
- function (tag, context) {
- if (typeof context.getElementsByTagName !== strundefined) {
- return context.getElementsByTagName(tag);
- }
- } :
- function (tag, context) {
- var elem,
- tmp = [],
- i = 0,
- results = context.getElementsByTagName(tag);
-
- // Filter out possible comments
- if (tag === "*") {
- while ((elem = results[i++])) {
- if (elem.nodeType === 1) {
- tmp.push(elem);
- }
- }
-
- return tmp;
- }
- return results;
- };
-
- // Class
- Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
- if (documentIsHTML) {
- return context.getElementsByClassName(className);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
+ };
+ sortOrder = hasCompare ? function (a, b) {
+ if (a === b) {
+ hasDuplicate = true;
+ return 0;
+ }
+ var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
+ if (compare) {
+ return compare;
+ }
+ compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
+ if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
+ if (a === doc || a.ownerDocument === preferredDoc && contains$1(preferredDoc, a)) {
+ return -1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- /* QSA/matchesSelector
- ---------------------------------------------------------------------- */
-
- // QSA and matchesSelector support
-
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
- rbuggyMatches = [];
-
- // qSa(:focus) reports false when true (Chrome 21)
- // We allow this because of a bug in IE8/9 that throws an error
- // whenever `document.activeElement` is accessed on an iframe
- // So, we allow :focus to pass through QSA all the time to avoid the IE error
- // See http://bugs.jquery.com/ticket/13378
- rbuggyQSA = [];
-
- /*
- if ((support.qsa = rnative.test(doc.querySelectorAll))) {
- // Build QSA regex
- // Regex strategy adopted from Diego Perini
- assert(function (div) {
- // Select is set to empty string on purpose
- // This is to test IE's treatment of not explicitly
- // setting a boolean content attribute,
- // since its presence should be enough
- // http://bugs.jquery.com/ticket/12359
- div.innerHTML = "<select msallowcapture=''><option selected=''></option></select>";
-
- // Support: IE8, Opera 11-12.16
- // Nothing should be selected when empty strings follow ^= or $= or *=
- // The test attribute must be unknown in Opera but "safe" for WinRT
- // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
- if (div.querySelectorAll("[msallowcapture^='']").length) {
- rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
- }
-
- // Support: IE8
- // Boolean attributes and "value" are not treated correctly
- if (!div.querySelectorAll("[selected]").length) {
- rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
- }
-
- // Webkit/Opera - :checked should return selected option elements
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
- // IE8 throws error here and will not see later tests
- if (!div.querySelectorAll(":checked").length) {
- rbuggyQSA.push(":checked");
- }
- });
-
- assert(function (div) {
- // Support: Windows 8 Native Apps
- // The type and name attributes are restricted during .innerHTML assignment
- var input = doc.createElement("input");
- input.setAttribute("type", "hidden");
- div.appendChild(input).setAttribute("name", "D");
-
- // Support: IE8
- // Enforce case-sensitivity of name attribute
- if (div.querySelectorAll("[name=d]").length) {
- rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
- }
-
- // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
- // IE8 throws error here and will not see later tests
- if (!div.querySelectorAll(":enabled").length) {
- rbuggyQSA.push(":enabled", ":disabled");
- }
-
- // Opera 10-11 does not throw on post-comma invalid pseudos
- div.querySelectorAll("*,:x");
- rbuggyQSA.push(",.*:");
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (b === doc || b.ownerDocument === preferredDoc && contains$1(preferredDoc, b)) {
+ return 1;
+ }
+ return sortInput ? indexOf$1.call(sortInput, a) - indexOf$1.call(sortInput, b) : 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- */
-
- support.disconnectedMatch = true;
-
- /*
- if ((support.matchesSelector = rnative.test((matches = docElem.matches ||
- docElem.webkitMatchesSelector ||
- docElem.mozMatchesSelector ||
- docElem.oMatchesSelector ||
- docElem.msMatchesSelector)))) {
-
- assert(function (div) {
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9)
- support.disconnectedMatch = matches.call(div, "div");
-
- // This should fail with an exception
- // Gecko does not error, returns false instead
- matches.call(div, "[s!='']:x");
- rbuggyMatches.push("!=", pseudos);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return compare & 4 ? -1 : 1;
+ } : function (a, b) {
+ if (a === b) {
+ hasDuplicate = true;
+ return 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- */
-
- rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
- rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
-
- /* Contains
- ---------------------------------------------------------------------- */
- hasCompare = rnative.test(docElem.compareDocumentPosition);
-
- // Element contains another
- // Purposefully does not implement inclusive descendent
- // As in, an element does not contain itself
- contains = hasCompare || rnative.test(docElem.contains) ?
- function (a, b) {
- var adown = a.nodeType === 9 ? a.documentElement : a,
- bup = b && b.parentNode;
- return a === bup || !!(bup && bup.nodeType === 1 && (
- adown.contains ?
- adown.contains(bup) :
- a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16
- ));
- } :
- function (a, b) {
- if (b) {
- while ((b = b.parentNode)) {
- if (b === a) {
- return true;
- }
- }
- }
- return false;
- };
-
- /* Sorting
- ---------------------------------------------------------------------- */
-
- // Document order sorting
- sortOrder = hasCompare ?
- function (a, b) {
-
- // Flag for duplicate removal
- if (a === b) {
- hasDuplicate = true;
- return 0;
- }
-
- // Sort on method existence if only one input has compareDocumentPosition
- var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
- if (compare) {
- return compare;
- }
-
- // Calculate position if both inputs belong to the same document
- compare = (a.ownerDocument || a) === (b.ownerDocument || b) ?
- a.compareDocumentPosition(b) :
-
- // Otherwise we know they are disconnected
- 1;
-
- // Disconnected nodes
- if (compare & 1 ||
- (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
-
- // Choose the first element that is related to our preferred document
- if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
- return -1;
- }
- if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
- return 1;
- }
-
- // Maintain original order
- return sortInput ?
- (indexOf.call(sortInput, a) - indexOf.call(sortInput, b)) :
- 0;
- }
-
- return compare & 4 ? -1 : 1;
- } :
- function (a, b) {
- // Exit early if the nodes are identical
- if (a === b) {
- hasDuplicate = true;
- return 0;
- }
-
- var cur,
- i = 0,
- aup = a.parentNode,
- bup = b.parentNode,
- ap = [a],
- bp = [b];
-
- // Parentless nodes are either documents or disconnected
- if (!aup || !bup) {
- return a === doc ? -1 :
- b === doc ? 1 :
- aup ? -1 :
- bup ? 1 :
- sortInput ?
- (indexOf.call(sortInput, a) - indexOf.call(sortInput, b)) :
- 0;
-
- // If the nodes are siblings, we can do a quick check
- } else if (aup === bup) {
- return siblingCheck(a, b);
- }
-
- // Otherwise we need full lists of their ancestors for comparison
- cur = a;
- while ((cur = cur.parentNode)) {
- ap.unshift(cur);
- }
- cur = b;
- while ((cur = cur.parentNode)) {
- bp.unshift(cur);
- }
-
- // Walk down the tree looking for a discrepancy
- while (ap[i] === bp[i]) {
- i++;
- }
-
- return i ?
- // Do a sibling check if the nodes have a common ancestor
- siblingCheck(ap[i], bp[i]) :
-
- // Otherwise nodes in our document sort first
- ap[i] === preferredDoc ? -1 :
- bp[i] === preferredDoc ? 1 :
- 0;
- };
-
- return doc;
- };
-
- Sizzle.matches = function (expr, elements) {
- return Sizzle(expr, null, null, elements);
- };
-
- Sizzle.matchesSelector = function (elem, expr) {
- // Set document vars if needed
- if ((elem.ownerDocument || elem) !== document) {
- setDocument(elem);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b];
+ if (!aup || !bup) {
+ return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf$1.call(sortInput, a) - indexOf$1.call(sortInput, b) : 0;
+ } else if (aup === bup) {
+ return siblingCheck(a, b);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Make sure that attribute selectors are quoted
- expr = expr.replace(rattributeQuotes, "='$1']");
-
- if (support.matchesSelector && documentIsHTML &&
- (!rbuggyMatches || !rbuggyMatches.test(expr)) &&
- (!rbuggyQSA || !rbuggyQSA.test(expr))) {
-
- try {
- var ret = matches.call(elem, expr);
-
- // IE 9's matchesSelector returns false on disconnected nodes
- if (ret || support.disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9
- elem.document && elem.document.nodeType !== 11) {
- return ret;
- }
- } catch (e) { }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ cur = a;
+ while (cur = cur.parentNode) {
+ ap.unshift(cur);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Sizzle(expr, document, null, [elem]).length > 0;
- };
-
- Sizzle.contains = function (context, elem) {
- // Set document vars if needed
- if ((context.ownerDocument || context) !== document) {
- setDocument(context);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ cur = b;
+ while (cur = cur.parentNode) {
+ bp.unshift(cur);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return contains(context, elem);
- };
-
- Sizzle.attr = function (elem, name) {
- // Set document vars if needed
- if ((elem.ownerDocument || elem) !== document) {
- setDocument(elem);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (ap[i] === bp[i]) {
+ i++;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var fn = Expr.attrHandle[name.toLowerCase()],
- // Don't get fooled by Object.prototype properties (jQuery #13807)
- val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ?
- fn(elem, name, !documentIsHTML) :
- undefined;
-
- return val !== undefined ?
- val :
- support.attributes || !documentIsHTML ?
- elem.getAttribute(name) :
- (val = elem.getAttributeNode(name)) && val.specified ?
- val.value :
- null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- Sizzle.error = function (msg) {
- throw new Error("Syntax error, unrecognized expression: " + msg);
- };
-
- /**
- * Document sorting and removing duplicates
- * @param {ArrayLike} results
- */
- Sizzle.uniqueSort = function (results) {
- var elem,
- duplicates = [],
- j = 0,
- i = 0;
-
- // Unless we *know* we can detect duplicates, assume their presence
- hasDuplicate = !support.detectDuplicates;
- sortInput = !support.sortStable && results.slice(0);
- results.sort(sortOrder);
-
- if (hasDuplicate) {
- while ((elem = results[i++])) {
- if (elem === results[i]) {
- j = duplicates.push(i);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return doc;
+ };
+ Sizzle.matches = function (expr, elements) {
+ return Sizzle(expr, null, null, elements);
+ };
+ Sizzle.matchesSelector = function (elem, expr) {
+ if ((elem.ownerDocument || elem) !== document$1) {
+ setDocument(elem);
+ }
+ expr = expr.replace(rattributeQuotes, '=\'$1\']');
+ if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
+ try {
+ var ret = matches.call(elem, expr);
+ if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
+ return ret;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- while (j--) {
- results.splice(duplicates[j], 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (e) {
+ }
+ }
+ return Sizzle(expr, document$1, null, [elem]).length > 0;
+ };
+ Sizzle.contains = function (context, elem) {
+ if ((context.ownerDocument || context) !== document$1) {
+ setDocument(context);
+ }
+ return contains$1(context, elem);
+ };
+ Sizzle.attr = function (elem, name) {
+ if ((elem.ownerDocument || elem) !== document$1) {
+ setDocument(elem);
+ }
+ var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
+ return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
+ };
+ Sizzle.error = function (msg) {
+ throw new Error('Syntax error, unrecognized expression: ' + msg);
+ };
+ Sizzle.uniqueSort = function (results) {
+ var elem, duplicates = [], j = 0, i = 0;
+ hasDuplicate = !support.detectDuplicates;
+ sortInput = !support.sortStable && results.slice(0);
+ results.sort(sortOrder);
+ if (hasDuplicate) {
+ while (elem = results[i++]) {
+ if (elem === results[i]) {
+ j = duplicates.push(i);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Clear input after sorting to release objects
- // See https://github.com/jquery/sizzle/pull/225
- sortInput = null;
-
- return results;
- };
-
- /**
- * Utility function for retrieving the text value of an array of DOM nodes
- * @param {Array|Element} elem
- */
- getText = Sizzle.getText = function (elem) {
- var node,
- ret = "",
- i = 0,
- nodeType = elem.nodeType;
-
- if (!nodeType) {
- // If no nodeType, this is expected to be an array
- while ((node = elem[i++])) {
- // Do not traverse comment nodes
- ret += getText(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (j--) {
+ results.splice(duplicates[j], 1);
+ }
+ }
+ sortInput = null;
+ return results;
+ };
+ getText = Sizzle.getText = function (elem) {
+ var node, ret = '', i = 0, nodeType = elem.nodeType;
+ if (!nodeType) {
+ while (node = elem[i++]) {
+ ret += getText(node);
+ }
+ } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
+ if (typeof elem.textContent === 'string') {
+ return elem.textContent;
+ } else {
+ for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
+ ret += getText(elem);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
- // Use textContent for elements
- // innerText usage removed for consistency of new lines (jQuery #11153)
- if (typeof elem.textContent === "string") {
- return elem.textContent;
- } else {
- // Traverse its children
- for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
- ret += getText(elem);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ } else if (nodeType === 3 || nodeType === 4) {
+ return elem.nodeValue;
+ }
+ return ret;
+ };
+ Expr = Sizzle.selectors = {
+ cacheLength: 50,
+ createPseudo: markFunction,
+ match: matchExpr,
+ attrHandle: {},
+ find: {},
+ relative: {
+ '>': {
+ dir: 'parentNode',
+ first: true
+ },
+ ' ': { dir: 'parentNode' },
+ '+': {
+ dir: 'previousSibling',
+ first: true
+ },
+ '~': { dir: 'previousSibling' }
+ },
+ preFilter: {
+ ATTR: function (match) {
+ match[1] = match[1].replace(runescape, funescape);
+ match[3] = (match[3] || match[4] || match[5] || '').replace(runescape, funescape);
+ if (match[2] === '~=') {
+ match[3] = ' ' + match[3] + ' ';
+ }
+ return match.slice(0, 4);
+ },
+ CHILD: function (match) {
+ match[1] = match[1].toLowerCase();
+ if (match[1].slice(0, 3) === 'nth') {
+ if (!match[3]) {
+ Sizzle.error(match[0]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === 'even' || match[3] === 'odd'));
+ match[5] = +(match[7] + match[8] || match[3] === 'odd');
+ } else if (match[3]) {
+ Sizzle.error(match[0]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if (nodeType === 3 || nodeType === 4) {
- return elem.nodeValue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return match;
+ },
+ PSEUDO: function (match) {
+ var excess, unquoted = !match[6] && match[2];
+ if (matchExpr.CHILD.test(match[0])) {
+ return null;
+ }
+ if (match[3]) {
+ match[2] = match[4] || match[5] || '';
+ } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(')', unquoted.length - excess) - unquoted.length)) {
+ match[0] = match[0].slice(0, excess);
+ match[2] = unquoted.slice(0, excess);
+ }
+ return match.slice(0, 3);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Do not include comment or processing instruction nodes
-
- return ret;
- };
-
- Expr = Sizzle.selectors = {
-
- // Can be adjusted by the user
- cacheLength: 50,
-
- createPseudo: markFunction,
-
- match: matchExpr,
-
- attrHandle: {},
-
- find: {},
-
- relative: {
- ">": { dir: "parentNode", first: true },
- " ": { dir: "parentNode" },
- "+": { dir: "previousSibling", first: true },
- "~": { dir: "previousSibling" }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ filter: {
+ TAG: function (nodeNameSelector) {
+ var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
+ return nodeNameSelector === '*' ? function () {
+ return true;
+ } : function (elem) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- preFilter: {
- "ATTR": function (match) {
- match[1] = match[1].replace(runescape, funescape);
-
- // Move the given value to match[3] whether quoted or unquoted
- match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
-
- if (match[2] === "~=") {
- match[3] = " " + match[3] + " ";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CLASS: function (className) {
+ var pattern = classCache[className + ' '];
+ return pattern || (pattern = new RegExp('(^|' + whitespace + ')' + className + '(' + whitespace + '|$)')) && classCache(className, function (elem) {
+ return pattern.test(typeof elem.className === 'string' && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute('class') || '');
+ });
+ },
+ ATTR: function (name, operator, check) {
+ return function (elem) {
+ var result = Sizzle.attr(elem, name);
+ if (result == null) {
+ return operator === '!=';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return match.slice(0, 4);
- },
-
- "CHILD": function (match) {
- /* matches from matchExpr["CHILD"]
- 1 type (only|nth|...)
- 2 what (child|of-type)
- 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
- 4 xn-component of xn+y argument ([+-]?\d*n|)
- 5 sign of xn-component
- 6 x of xn-component
- 7 sign of y-component
- 8 y of y-component
- */
- match[1] = match[1].toLowerCase();
-
- if (match[1].slice(0, 3) === "nth") {
- // nth-* requires argument
- if (!match[3]) {
- Sizzle.error(match[0]);
- }
-
- // numeric x and y parameters for Expr.filter.CHILD
- // remember that false/true cast respectively to 0/1
- match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
- match[5] = +((match[7] + match[8]) || match[3] === "odd");
-
- // other types prohibit arguments
- } else if (match[3]) {
- Sizzle.error(match[0]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!operator) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return match;
- },
-
- "PSEUDO": function (match) {
- var excess,
- unquoted = !match[6] && match[2];
-
- if (matchExpr["CHILD"].test(match[0])) {
- return null;
- }
-
- // Accept quoted arguments as-is
- if (match[3]) {
- match[2] = match[4] || match[5] || "";
-
- // Strip excess characters from unquoted arguments
- } else if (unquoted && rpseudo.test(unquoted) &&
- // Get excess from tokenize (recursively)
- (excess = tokenize(unquoted, true)) &&
- // advance to the next closing parenthesis
- (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
-
- // excess is a negative index
- match[0] = match[0].slice(0, excess);
- match[2] = unquoted.slice(0, excess);
- }
-
- // Return only captures needed by the pseudo filter method (type and argument)
- return match.slice(0, 3);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ result += '';
+ return operator === '=' ? result === check : operator === '!=' ? result !== check : operator === '^=' ? check && result.indexOf(check) === 0 : operator === '*=' ? check && result.indexOf(check) > -1 : operator === '$=' ? check && result.slice(-check.length) === check : operator === '~=' ? (' ' + result + ' ').indexOf(check) > -1 : operator === '|=' ? result === check || result.slice(0, check.length + 1) === check + '-' : false;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- filter: {
-
- "TAG": function (nodeNameSelector) {
- var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
- return nodeNameSelector === "*" ?
- function () { return true; } :
- function (elem) {
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
- };
- },
-
- "CLASS": function (className) {
- var pattern = classCache[className + " "];
-
- return pattern ||
- (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) &&
- classCache(className, function (elem) {
- return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "");
- });
- },
-
- "ATTR": function (name, operator, check) {
- return function (elem) {
- var result = Sizzle.attr(elem, name);
-
- if (result == null) {
- return operator === "!=";
- }
- if (!operator) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CHILD: function (type, what, argument, first, last) {
+ var simple = type.slice(0, 3) !== 'nth', forward = type.slice(-4) !== 'last', ofType = what === 'of-type';
+ return first === 1 && last === 0 ? function (elem) {
+ return !!elem.parentNode;
+ } : function (elem, context, xml) {
+ var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? 'nextSibling' : 'previousSibling', parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType;
+ if (parent) {
+ if (simple) {
+ while (dir) {
+ node = elem;
+ while (node = node[dir]) {
+ if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
+ return false;
+ }
+ }
+ start = dir = type === 'only' && !start && 'nextSibling';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- result += "";
-
- return operator === "=" ? result === check :
- operator === "!=" ? result !== check :
- operator === "^=" ? check && result.indexOf(check) === 0 :
- operator === "*=" ? check && result.indexOf(check) > -1 :
- operator === "$=" ? check && result.slice(-check.length) === check :
- operator === "~=" ? (" " + result + " ").indexOf(check) > -1 :
- operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" :
- false;
- };
- },
-
- "CHILD": function (type, what, argument, first, last) {
- var simple = type.slice(0, 3) !== "nth",
- forward = type.slice(-4) !== "last",
- ofType = what === "of-type";
-
- return first === 1 && last === 0 ?
-
- // Shortcut for :nth-*(n)
- function (elem) {
- return !!elem.parentNode;
- } :
-
- function (elem, context, xml) {
- var cache, outerCache, node, diff, nodeIndex, start,
- dir = simple !== forward ? "nextSibling" : "previousSibling",
- parent = elem.parentNode,
- name = ofType && elem.nodeName.toLowerCase(),
- useCache = !xml && !ofType;
-
- if (parent) {
-
- // :(first|last|only)-(child|of-type)
- if (simple) {
- while (dir) {
- node = elem;
- while ((node = node[dir])) {
- if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
- return false;
- }
- }
- // Reverse direction for :only-* (if we haven't yet done so)
- start = dir = type === "only" && !start && "nextSibling";
- }
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ start = [forward ? parent.firstChild : parent.lastChild];
+ if (forward && useCache) {
+ outerCache = parent[expando] || (parent[expando] = {});
+ cache = outerCache[type] || [];
+ nodeIndex = cache[0] === dirruns && cache[1];
+ diff = cache[0] === dirruns && cache[2];
+ node = nodeIndex && parent.childNodes[nodeIndex];
+ while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
+ if (node.nodeType === 1 && ++diff && node === elem) {
+ outerCache[type] = [
+ dirruns,
+ nodeIndex,
+ diff
+ ];
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- start = [forward ? parent.firstChild : parent.lastChild];
-
- // non-xml :nth-child(...) stores cache data on `parent`
- if (forward && useCache) {
- // Seek `elem` from a previously-cached index
- outerCache = parent[expando] || (parent[expando] = {});
- cache = outerCache[type] || [];
- nodeIndex = cache[0] === dirruns && cache[1];
- diff = cache[0] === dirruns && cache[2];
- node = nodeIndex && parent.childNodes[nodeIndex];
-
- while ((node = ++nodeIndex && node && node[dir] ||
-
- // Fallback to seeking `elem` from the start
- (diff = nodeIndex = 0) || start.pop())) {
-
- // When found, cache indexes on `parent` and break
- if (node.nodeType === 1 && ++diff && node === elem) {
- outerCache[type] = [dirruns, nodeIndex, diff];
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {
+ diff = cache[1];
+ } else {
+ while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
+ if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
+ if (useCache) {
+ (node[expando] || (node[expando] = {}))[type] = [
+ dirruns,
+ diff
+ ];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Use previously-cached element index if available
- } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {
- diff = cache[1];
-
- // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
- } else {
- // Use the same loop as above to seek `elem` from the start
- while ((node = ++nodeIndex && node && node[dir] ||
- (diff = nodeIndex = 0) || start.pop())) {
-
- if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
- // Cache the index of each encountered element
- if (useCache) {
- (node[expando] || (node[expando] = {}))[type] = [dirruns, diff];
- }
-
- if (node === elem) {
- break;
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node === elem) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Incorporate the offset, then check against cycle size
- diff -= last;
- return diff === first || (diff % first === 0 && diff / first >= 0);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- },
-
- "PSEUDO": function (pseudo, argument) {
- // pseudo-class names are case-insensitive
- // http://www.w3.org/TR/selectors/#pseudo-classes
- // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
- // Remember that setFilters inherits from pseudos
- var args,
- fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] ||
- Sizzle.error("unsupported pseudo: " + pseudo);
-
- // The user may use createPseudo to indicate that
- // arguments are needed to create the filter function
- // just as Sizzle does
- if (fn[expando]) {
- return fn(argument);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ diff -= last;
+ return diff === first || diff % first === 0 && diff / first >= 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // But maintain support for old signatures
- if (fn.length > 1) {
- args = [pseudo, pseudo, "", argument];
- return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ?
- markFunction(function (seed, matches) {
- var idx,
- matched = fn(seed, argument),
- i = matched.length;
- while (i--) {
- idx = indexOf.call(seed, matched[i]);
- seed[idx] = !(matches[idx] = matched[i]);
- }
- }) :
- function (elem) {
- return fn(elem, 0, args);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ },
+ PSEUDO: function (pseudo, argument) {
+ var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error('unsupported pseudo: ' + pseudo);
+ if (fn[expando]) {
+ return fn(argument);
+ }
+ if (fn.length > 1) {
+ args = [
+ pseudo,
+ pseudo,
+ '',
+ argument
+ ];
+ return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
+ var idx, matched = fn(seed, argument), i = matched.length;
+ while (i--) {
+ idx = indexOf$1.call(seed, matched[i]);
+ seed[idx] = !(matches[idx] = matched[i]);
+ }
+ }) : function (elem) {
+ return fn(elem, 0, args);
+ };
+ }
+ return fn;
+ }
+ },
+ pseudos: {
+ not: markFunction(function (selector) {
+ var input = [], results = [], matcher = compile(selector.replace(rtrim, '$1'));
+ return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
+ var elem, unmatched = matcher(seed, null, xml, []), i = seed.length;
+ while (i--) {
+ if (elem = unmatched[i]) {
+ seed[i] = !(matches[i] = elem);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return fn;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }) : function (elem, context, xml) {
+ input[0] = elem;
+ matcher(input, null, xml, results);
+ return !results.pop();
+ };
+ }),
+ has: markFunction(function (selector) {
+ return function (elem) {
+ return Sizzle(selector, elem).length > 0;
+ };
+ }),
+ contains: markFunction(function (text) {
+ text = text.replace(runescape, funescape);
+ return function (elem) {
+ return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
+ };
+ }),
+ lang: markFunction(function (lang) {
+ if (!ridentifier.test(lang || '')) {
+ Sizzle.error('unsupported lang: ' + lang);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ lang = lang.replace(runescape, funescape).toLowerCase();
+ return function (elem) {
+ var elemLang;
+ do {
+ if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute('xml:lang') || elem.getAttribute('lang')) {
+ elemLang = elemLang.toLowerCase();
+ return elemLang === lang || elemLang.indexOf(lang + '-') === 0;
+ }
+ } while ((elem = elem.parentNode) && elem.nodeType === 1);
+ return false;
+ };
+ }),
+ target: function (elem) {
+ var hash = window.location && window.location.hash;
+ return hash && hash.slice(1) === elem.id;
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- pseudos: {
- // Potentially complex pseudos
- "not": markFunction(function (selector) {
- // Trim the selector passed to compile
- // to avoid treating leading and trailing
- // spaces as combinators
- var input = [],
- results = [],
- matcher = compile(selector.replace(rtrim, "$1"));
-
- return matcher[expando] ?
- markFunction(function (seed, matches, context, xml) {
- var elem,
- unmatched = matcher(seed, null, xml, []),
- i = seed.length;
-
- // Match elements unmatched by `matcher`
- while (i--) {
- if ((elem = unmatched[i])) {
- seed[i] = !(matches[i] = elem);
- }
- }
- }) :
- function (elem, context, xml) {
- input[0] = elem;
- matcher(input, null, xml, results);
- return !results.pop();
- };
- }),
-
- "has": markFunction(function (selector) {
- return function (elem) {
- return Sizzle(selector, elem).length > 0;
- };
- }),
-
- "contains": markFunction(function (text) {
- text = text.replace(runescape, funescape);
- return function (elem) {
- return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
- };
- }),
-
- // "Whether an element is represented by a :lang() selector
- // is based solely on the element's language value
- // being equal to the identifier C,
- // or beginning with the identifier C immediately followed by "-".
- // The matching of C against the element's language value is performed case-insensitively.
- // The identifier C does not have to be a valid language name."
- // http://www.w3.org/TR/selectors/#lang-pseudo
- "lang": markFunction(function (lang) {
- // lang value must be a valid identifier
- if (!ridentifier.test(lang || "")) {
- Sizzle.error("unsupported lang: " + lang);
- }
- lang = lang.replace(runescape, funescape).toLowerCase();
- return function (elem) {
- var elemLang;
- do {
- if ((elemLang = documentIsHTML ?
- elem.lang :
- elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
-
- elemLang = elemLang.toLowerCase();
- return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
- }
- } while ((elem = elem.parentNode) && elem.nodeType === 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ root: function (elem) {
+ return elem === docElem;
+ },
+ focus: function (elem) {
+ return elem === document$1.activeElement && (!document$1.hasFocus || document$1.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+ },
+ enabled: function (elem) {
+ return elem.disabled === false;
+ },
+ disabled: function (elem) {
+ return elem.disabled === true;
+ },
+ checked: function (elem) {
+ var nodeName = elem.nodeName.toLowerCase();
+ return nodeName === 'input' && !!elem.checked || nodeName === 'option' && !!elem.selected;
+ },
+ selected: function (elem) {
+ if (elem.parentNode) {
+ elem.parentNode.selectedIndex;
+ }
+ return elem.selected === true;
+ },
+ empty: function (elem) {
+ for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
+ if (elem.nodeType < 6) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- }),
-
- // Miscellaneous
- "target": function (elem) {
- var hash = window.location && window.location.hash;
- return hash && hash.slice(1) === elem.id;
- },
-
- "root": function (elem) {
- return elem === docElem;
- },
-
- "focus": function (elem) {
- return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
- },
-
- // Boolean properties
- "enabled": function (elem) {
- return elem.disabled === false;
- },
-
- "disabled": function (elem) {
- return elem.disabled === true;
- },
-
- "checked": function (elem) {
- // In CSS3, :checked should return both checked and selected elements
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
- var nodeName = elem.nodeName.toLowerCase();
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
- },
-
- "selected": function (elem) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
- if (elem.parentNode) {
- elem.parentNode.selectedIndex;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return elem.selected === true;
- },
-
- // Contents
- "empty": function (elem) {
- // http://www.w3.org/TR/selectors/#empty-pseudo
- // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
- // but not by others (comment: 8; processing instruction: 7; etc.)
- // nodeType < 6 works because attributes (2) do not appear as children
- for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
- if (elem.nodeType < 6) {
- return false;
- }
- }
- return true;
- },
-
- "parent": function (elem) {
- return !Expr.pseudos["empty"](elem);
- },
-
- // Element/input types
- "header": function (elem) {
- return rheader.test(elem.nodeName);
- },
-
- "input": function (elem) {
- return rinputs.test(elem.nodeName);
- },
-
- "button": function (elem) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && elem.type === "button" || name === "button";
- },
-
- "text": function (elem) {
- var attr;
- return elem.nodeName.toLowerCase() === "input" &&
- elem.type === "text" &&
-
- // Support: IE<8
- // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
- ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
- },
-
- // Position-in-collection
- "first": createPositionalPseudo(function () {
- return [0];
- }),
-
- "last": createPositionalPseudo(function (matchIndexes, length) {
- return [length - 1];
- }),
-
- "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
- return [argument < 0 ? argument + length : argument];
- }),
-
- "even": createPositionalPseudo(function (matchIndexes, length) {
- var i = 0;
- for (; i < length; i += 2) {
- matchIndexes.push(i);
- }
- return matchIndexes;
- }),
-
- "odd": createPositionalPseudo(function (matchIndexes, length) {
- var i = 1;
- for (; i < length; i += 2) {
- matchIndexes.push(i);
- }
- return matchIndexes;
- }),
-
- "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
- var i = argument < 0 ? argument + length : argument;
- for (; --i >= 0;) {
- matchIndexes.push(i);
- }
- return matchIndexes;
- }),
-
- "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
- var i = argument < 0 ? argument + length : argument;
- for (; ++i < length;) {
- matchIndexes.push(i);
- }
- return matchIndexes;
- })
- }
- };
-
- Expr.pseudos["nth"] = Expr.pseudos["eq"];
-
- // Add button/input type pseudos
- for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
- Expr.pseudos[i] = createInputPseudo(i);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return true;
+ },
+ parent: function (elem) {
+ return !Expr.pseudos.empty(elem);
+ },
+ header: function (elem) {
+ return rheader.test(elem.nodeName);
+ },
+ input: function (elem) {
+ return rinputs.test(elem.nodeName);
+ },
+ button: function (elem) {
+ var name = elem.nodeName.toLowerCase();
+ return name === 'input' && elem.type === 'button' || name === 'button';
+ },
+ text: function (elem) {
+ var attr;
+ return elem.nodeName.toLowerCase() === 'input' && elem.type === 'text' && ((attr = elem.getAttribute('type')) == null || attr.toLowerCase() === 'text');
+ },
+ first: createPositionalPseudo(function () {
+ return [0];
+ }),
+ last: createPositionalPseudo(function (matchIndexes, length) {
+ return [length - 1];
+ }),
+ eq: createPositionalPseudo(function (matchIndexes, length, argument) {
+ return [argument < 0 ? argument + length : argument];
+ }),
+ even: createPositionalPseudo(function (matchIndexes, length) {
+ var i = 0;
+ for (; i < length; i += 2) {
+ matchIndexes.push(i);
+ }
+ return matchIndexes;
+ }),
+ odd: createPositionalPseudo(function (matchIndexes, length) {
+ var i = 1;
+ for (; i < length; i += 2) {
+ matchIndexes.push(i);
+ }
+ return matchIndexes;
+ }),
+ lt: createPositionalPseudo(function (matchIndexes, length, argument) {
+ var i = argument < 0 ? argument + length : argument;
+ for (; --i >= 0;) {
+ matchIndexes.push(i);
+ }
+ return matchIndexes;
+ }),
+ gt: createPositionalPseudo(function (matchIndexes, length, argument) {
+ var i = argument < 0 ? argument + length : argument;
+ for (; ++i < length;) {
+ matchIndexes.push(i);
+ }
+ return matchIndexes;
+ })
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- for (i in { submit: true, reset: true }) {
- Expr.pseudos[i] = createButtonPseudo(i);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ Expr.pseudos.nth = Expr.pseudos.eq;
+ for (i in {
+ radio: true,
+ checkbox: true,
+ file: true,
+ password: true,
+ image: true
+ }) {
+ Expr.pseudos[i] = createInputPseudo(i);
+ }
+ for (i in {
+ submit: true,
+ reset: true
+ }) {
+ Expr.pseudos[i] = createButtonPseudo(i);
+ }
+ function setFilters() {
+ }
+ setFilters.prototype = Expr.filters = Expr.pseudos;
+ Expr.setFilters = new setFilters();
+ tokenize = Sizzle.tokenize = function (selector, parseOnly) {
+ var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + ' '];
+ if (cached) {
+ return parseOnly ? 0 : cached.slice(0);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Easy API for creating new setFilters
- function setFilters() { }
- setFilters.prototype = Expr.filters = Expr.pseudos;
- Expr.setFilters = new setFilters();
-
- tokenize = Sizzle.tokenize = function (selector, parseOnly) {
- var matched, match, tokens, type,
- soFar, groups, preFilters,
- cached = tokenCache[selector + " "];
-
- if (cached) {
- return parseOnly ? 0 : cached.slice(0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ soFar = selector;
+ groups = [];
+ preFilters = Expr.preFilter;
+ while (soFar) {
+ if (!matched || (match = rcomma.exec(soFar))) {
+ if (match) {
+ soFar = soFar.slice(match[0].length) || soFar;
+ }
+ groups.push(tokens = []);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- soFar = selector;
- groups = [];
- preFilters = Expr.preFilter;
-
- while (soFar) {
-
- // Comma and first run
- if (!matched || (match = rcomma.exec(soFar))) {
- if (match) {
- // Don't consume trailing commas as valid
- soFar = soFar.slice(match[0].length) || soFar;
- }
- groups.push((tokens = []));
- }
-
- matched = false;
-
- // Combinators
- if ((match = rcombinators.exec(soFar))) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ matched = false;
+ if (match = rcombinators.exec(soFar)) {
+ matched = match.shift();
+ tokens.push({
+ value: matched,
+ type: match[0].replace(rtrim, ' ')
+ });
+ soFar = soFar.slice(matched.length);
+ }
+ for (type in Expr.filter) {
+ if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
</ins><span class="cx" style="display: block; padding: 0 10px"> matched = match.shift();
</span><span class="cx" style="display: block; padding: 0 10px"> tokens.push({
</span><span class="cx" style="display: block; padding: 0 10px"> value: matched,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Cast descendant combinators to space
- type: match[0].replace(rtrim, " ")
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ type: type,
+ matches: match
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> soFar = soFar.slice(matched.length);
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Filters
- for (type in Expr.filter) {
- if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] ||
- (match = preFilters[type](match)))) {
- matched = match.shift();
- tokens.push({
- value: matched,
- type: type,
- matches: match
- });
- soFar = soFar.slice(matched.length);
- }
- }
-
- if (!matched) {
- break;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Return the length of the invalid excess
- // if we're just parsing
- // Otherwise, throw an error or return tokens
- return parseOnly ?
- soFar.length :
- soFar ?
- Sizzle.error(selector) :
- // Cache the tokens
- tokenCache(selector, groups).slice(0);
- };
-
- function toSelector(tokens) {
- var i = 0,
- len = tokens.length,
- selector = "";
- for (; i < len; i++) {
- selector += tokens[i].value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!matched) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return selector;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function addCombinator(matcher, combinator, base) {
- var dir = combinator.dir,
- checkNonElements = base && dir === "parentNode",
- doneName = done++;
-
- return combinator.first ?
- // Check against closest ancestor/preceding element
- function (elem, context, xml) {
- while ((elem = elem[dir])) {
- if (elem.nodeType === 1 || checkNonElements) {
- return matcher(elem, context, xml);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0);
+ };
+ function toSelector(tokens) {
+ var i = 0, len = tokens.length, selector = '';
+ for (; i < len; i++) {
+ selector += tokens[i].value;
+ }
+ return selector;
+ }
+ function addCombinator(matcher, combinator, base) {
+ var dir = combinator.dir, checkNonElements = base && dir === 'parentNode', doneName = done++;
+ return combinator.first ? function (elem, context, xml) {
+ while (elem = elem[dir]) {
+ if (elem.nodeType === 1 || checkNonElements) {
+ return matcher(elem, context, xml);
+ }
+ }
+ } : function (elem, context, xml) {
+ var oldCache, outerCache, newCache = [
+ dirruns,
+ doneName
+ ];
+ if (xml) {
+ while (elem = elem[dir]) {
+ if (elem.nodeType === 1 || checkNonElements) {
+ if (matcher(elem, context, xml)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } :
-
- // Check against all ancestor/preceding elements
- function (elem, context, xml) {
- var oldCache, outerCache,
- newCache = [dirruns, doneName];
-
- // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
- if (xml) {
- while ((elem = elem[dir])) {
- if (elem.nodeType === 1 || checkNonElements) {
- if (matcher(elem, context, xml)) {
- return true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ } else {
+ while (elem = elem[dir]) {
+ if (elem.nodeType === 1 || checkNonElements) {
+ outerCache = elem[expando] || (elem[expando] = {});
+ if ((oldCache = outerCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
+ return newCache[2] = oldCache[2];
+ } else {
+ outerCache[dir] = newCache;
+ if (newCache[2] = matcher(elem, context, xml)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- while ((elem = elem[dir])) {
- if (elem.nodeType === 1 || checkNonElements) {
- outerCache = elem[expando] || (elem[expando] = {});
- if ((oldCache = outerCache[dir]) &&
- oldCache[0] === dirruns && oldCache[1] === doneName) {
-
- // Assign to newCache so results back-propagate to previous elements
- return (newCache[2] = oldCache[2]);
- } else {
- // Reuse newcache so results back-propagate to previous elements
- outerCache[dir] = newCache;
-
- // A match means we're done; a fail means we have to keep checking
- if ((newCache[2] = matcher(elem, context, xml))) {
- return true;
- }
- }
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- }
-
- function elementMatcher(matchers) {
- return matchers.length > 1 ?
- function (elem, context, xml) {
- var i = matchers.length;
- while (i--) {
- if (!matchers[i](elem, context, xml)) {
- return false;
- }
- }
- return true;
- } :
- matchers[0];
- }
-
- function multipleContexts(selector, contexts, results) {
- var i = 0,
- len = contexts.length;
- for (; i < len; i++) {
- Sizzle(selector, contexts[i], results);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return results;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ }
+ function elementMatcher(matchers) {
+ return matchers.length > 1 ? function (elem, context, xml) {
+ var i = matchers.length;
+ while (i--) {
+ if (!matchers[i](elem, context, xml)) {
+ return false;
+ }
+ }
+ return true;
+ } : matchers[0];
+ }
+ function multipleContexts(selector, contexts, results) {
+ var i = 0, len = contexts.length;
+ for (; i < len; i++) {
+ Sizzle(selector, contexts[i], results);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function condense(unmatched, map, filter, context, xml) {
- var elem,
- newUnmatched = [],
- i = 0,
- len = unmatched.length,
- mapped = map != null;
-
- for (; i < len; i++) {
- if ((elem = unmatched[i])) {
- if (!filter || filter(elem, context, xml)) {
- newUnmatched.push(elem);
- if (mapped) {
- map.push(i);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return results;
+ }
+ function condense(unmatched, map, filter, context, xml) {
+ var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null;
+ for (; i < len; i++) {
+ if (elem = unmatched[i]) {
+ if (!filter || filter(elem, context, xml)) {
+ newUnmatched.push(elem);
+ if (mapped) {
+ map.push(i);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return newUnmatched;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
- if (postFilter && !postFilter[expando]) {
- postFilter = setMatcher(postFilter);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return newUnmatched;
+ }
+ function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
+ if (postFilter && !postFilter[expando]) {
+ postFilter = setMatcher(postFilter);
+ }
+ if (postFinder && !postFinder[expando]) {
+ postFinder = setMatcher(postFinder, postSelector);
+ }
+ return markFunction(function (seed, results, context, xml) {
+ var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(selector || '*', context.nodeType ? [context] : context, []), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;
+ if (matcher) {
+ matcher(matcherIn, matcherOut, context, xml);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (postFinder && !postFinder[expando]) {
- postFinder = setMatcher(postFinder, postSelector);
- }
- return markFunction(function (seed, results, context, xml) {
- var temp, i, elem,
- preMap = [],
- postMap = [],
- preexisting = results.length,
-
- // Get initial elements from seed or context
- elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
-
- // Prefilter to get matcher input, preserving a map for seed-results synchronization
- matcherIn = preFilter && (seed || !selector) ?
- condense(elems, preMap, preFilter, context, xml) :
- elems,
-
- matcherOut = matcher ?
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
- postFinder || (seed ? preFilter : preexisting || postFilter) ?
-
- // ...intermediate processing is necessary
- [] :
-
- // ...otherwise use results directly
- results :
- matcherIn;
-
- // Find primary matches
- if (matcher) {
- matcher(matcherIn, matcherOut, context, xml);
- }
-
- // Apply postFilter
- if (postFilter) {
- temp = condense(matcherOut, postMap);
- postFilter(temp, [], context, xml);
-
- // Un-match failing elements by moving them back to matcherIn
- i = temp.length;
- while (i--) {
- if ((elem = temp[i])) {
- matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (postFilter) {
+ temp = condense(matcherOut, postMap);
+ postFilter(temp, [], context, xml);
+ i = temp.length;
+ while (i--) {
+ if (elem = temp[i]) {
+ matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (seed) {
- if (postFinder || preFilter) {
- if (postFinder) {
- // Get the final matcherOut by condensing this intermediate into postFinder contexts
- temp = [];
- i = matcherOut.length;
- while (i--) {
- if ((elem = matcherOut[i])) {
- // Restore matcherIn since elem is not yet a final match
- temp.push((matcherIn[i] = elem));
- }
- }
- postFinder(null, (matcherOut = []), temp, xml);
- }
-
- // Move matched elements from seed to results to keep them synchronized
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (seed) {
+ if (postFinder || preFilter) {
+ if (postFinder) {
+ temp = [];
</ins><span class="cx" style="display: block; padding: 0 10px"> i = matcherOut.length;
</span><span class="cx" style="display: block; padding: 0 10px"> while (i--) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ((elem = matcherOut[i]) &&
- (temp = postFinder ? indexOf.call(seed, elem) : preMap[i]) > -1) {
-
- seed[temp] = !(results[temp] = elem);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (elem = matcherOut[i]) {
+ temp.push(matcherIn[i] = elem);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ postFinder(null, matcherOut = [], temp, xml);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Add elements to results, through postFinder if defined
- } else {
- matcherOut = condense(
- matcherOut === results ?
- matcherOut.splice(preexisting, matcherOut.length) :
- matcherOut
- );
- if (postFinder) {
- postFinder(null, results, matcherOut, xml);
- } else {
- push.apply(results, matcherOut);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ i = matcherOut.length;
+ while (i--) {
+ if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf$1.call(seed, elem) : preMap[i]) > -1) {
+ seed[temp] = !(results[temp] = elem);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-
- function matcherFromTokens(tokens) {
- var checkContext, matcher, j,
- len = tokens.length,
- leadingRelative = Expr.relative[tokens[0].type],
- implicitRelative = leadingRelative || Expr.relative[" "],
- i = leadingRelative ? 1 : 0,
-
- // The foundational matcher ensures that elements are reachable from top-level context(s)
- matchContext = addCombinator(function (elem) {
- return elem === checkContext;
- }, implicitRelative, true),
- matchAnyContext = addCombinator(function (elem) {
- return indexOf.call(checkContext, elem) > -1;
- }, implicitRelative, true),
- matchers = [function (elem, context, xml) {
- return (!leadingRelative && (xml || context !== outermostContext)) || (
- (checkContext = context).nodeType ?
- matchContext(elem, context, xml) :
- matchAnyContext(elem, context, xml));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
+ if (postFinder) {
+ postFinder(null, results, matcherOut, xml);
+ } else {
+ push$1.apply(results, matcherOut);
+ }
+ }
+ });
+ }
+ function matcherFromTokens(tokens) {
+ var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[' '], i = leadingRelative ? 1 : 0, matchContext = addCombinator(function (elem) {
+ return elem === checkContext;
+ }, implicitRelative, true), matchAnyContext = addCombinator(function (elem) {
+ return indexOf$1.call(checkContext, elem) > -1;
+ }, implicitRelative, true), matchers = [function (elem, context, xml) {
+ return !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
</ins><span class="cx" style="display: block; padding: 0 10px"> }];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (; i < len; i++) {
- if ((matcher = Expr.relative[tokens[i].type])) {
- matchers = [addCombinator(elementMatcher(matchers), matcher)];
- } else {
- matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
-
- // Return special upon seeing a positional matcher
- if (matcher[expando]) {
- // Find the next relative operator (if any) for proper handling
- j = ++i;
- for (; j < len; j++) {
- if (Expr.relative[tokens[j].type]) {
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (; i < len; i++) {
+ if (matcher = Expr.relative[tokens[i].type]) {
+ matchers = [addCombinator(elementMatcher(matchers), matcher)];
+ } else {
+ matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
+ if (matcher[expando]) {
+ j = ++i;
+ for (; j < len; j++) {
+ if (Expr.relative[tokens[j].type]) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return setMatcher(
- i > 1 && elementMatcher(matchers),
- i > 1 && toSelector(
- // If the preceding token was a descendant combinator, insert an implicit any-element `*`
- tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })
- ).replace(rtrim, "$1"),
- matcher,
- i < j && matcherFromTokens(tokens.slice(i, j)),
- j < len && matcherFromTokens((tokens = tokens.slice(j))),
- j < len && toSelector(tokens)
- );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- matchers.push(matcher);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === ' ' ? '*' : '' })).replace(rtrim, '$1'), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ matchers.push(matcher);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return elementMatcher(matchers);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function matcherFromGroupMatchers(elementMatchers, setMatchers) {
- var bySet = setMatchers.length > 0,
- byElement = elementMatchers.length > 0,
- superMatcher = function (seed, context, xml, results, outermost) {
- var elem, j, matcher,
- matchedCount = 0,
- i = "0",
- unmatched = seed && [],
- setMatched = [],
- contextBackup = outermostContext,
- // We must always have either seed elements or outermost context
- elems = seed || byElement && Expr.find["TAG"]("*", outermost),
- // Use integer dirruns iff this is the outermost matcher
- dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
- len = elems.length;
-
- if (outermost) {
- outermostContext = context !== document && context;
- }
-
- // Add elements passing elementMatchers directly to results
- // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
- // Support: IE<9, Safari
- // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
- for (; i !== len && (elem = elems[i]) != null; i++) {
- if (byElement && elem) {
- j = 0;
- while ((matcher = elementMatchers[j++])) {
- if (matcher(elem, context, xml)) {
- results.push(elem);
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return elementMatcher(matchers);
+ }
+ function matcherFromGroupMatchers(elementMatchers, setMatchers) {
+ var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function (seed, context, xml, results, outermost) {
+ var elem, j, matcher, matchedCount = 0, i = '0', unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG('*', outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length;
+ if (outermost) {
+ outermostContext = context !== document$1 && context;
+ }
+ for (; i !== len && (elem = elems[i]) != null; i++) {
+ if (byElement && elem) {
+ j = 0;
+ while (matcher = elementMatchers[j++]) {
+ if (matcher(elem, context, xml)) {
+ results.push(elem);
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (outermost) {
- dirruns = dirrunsUnique;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Track unmatched elements for set filters
- if (bySet) {
- // They will have gone through all possible matchers
- if ((elem = !matcher && elem)) {
- matchedCount--;
- }
-
- // Lengthen the array for every element, matched or not
- if (seed) {
- unmatched.push(elem);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (outermost) {
+ dirruns = dirrunsUnique;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Apply set filters to unmatched elements
- matchedCount += i;
- if (bySet && i !== matchedCount) {
- j = 0;
- while ((matcher = setMatchers[j++])) {
- matcher(unmatched, setMatched, context, xml);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (bySet) {
+ if (elem = !matcher && elem) {
+ matchedCount--;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> if (seed) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Reintegrate element matches to eliminate the need for sorting
- if (matchedCount > 0) {
- while (i--) {
- if (!(unmatched[i] || setMatched[i])) {
- setMatched[i] = pop.call(results);
- }
- }
- }
-
- // Discard index placeholder values to get only actual matches
- setMatched = condense(setMatched);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unmatched.push(elem);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Add matches to results
- push.apply(results, setMatched);
-
- // Seedless set matches succeeding multiple successful matchers stipulate sorting
- if (outermost && !seed && setMatched.length > 0 &&
- (matchedCount + setMatchers.length) > 1) {
-
- Sizzle.uniqueSort(results);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Override manipulation of globals by nested matchers
- if (outermost) {
- dirruns = dirrunsUnique;
- outermostContext = contextBackup;
- }
-
- return unmatched;
- };
-
- return bySet ?
- markFunction(superMatcher) :
- superMatcher;
- }
-
- compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
- var i,
- setMatchers = [],
- elementMatchers = [],
- cached = compilerCache[selector + " "];
-
- if (!cached) {
- // Generate a function of recursive functions that can be used to check each element
- if (!match) {
- match = tokenize(selector);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- i = match.length;
- while (i--) {
- cached = matcherFromTokens(match[i]);
- if (cached[expando]) {
- setMatchers.push(cached);
- } else {
- elementMatchers.push(cached);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ matchedCount += i;
+ if (bySet && i !== matchedCount) {
+ j = 0;
+ while (matcher = setMatchers[j++]) {
+ matcher(unmatched, setMatched, context, xml);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Cache the compiled function
- cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
-
- // Save selector and tokenization
- cached.selector = selector;
- }
- return cached;
- };
-
- /**
- * A low-level selection function that works with Sizzle's compiled
- * selector functions
- * @param {String|Function} selector A selector or a pre-compiled
- * selector function built with Sizzle.compile
- * @param {Element} context
- * @param {Array} [results]
- * @param {Array} [seed] A set of elements to match against
- */
- select = Sizzle.select = function (selector, context, results, seed) {
- var i, tokens, token, type, find,
- compiled = typeof selector === "function" && selector,
- match = !seed && tokenize((selector = compiled.selector || selector));
-
- results = results || [];
-
- // Try to minimize operations if there is no seed and only one group
- if (match.length === 1) {
-
- // Take a shortcut and set the context if the root selector is an ID
- tokens = match[0] = match[0].slice(0);
- if (tokens.length > 2 && (token = tokens[0]).type === "ID" &&
- support.getById && context.nodeType === 9 && documentIsHTML &&
- Expr.relative[tokens[1].type]) {
-
- context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
- if (!context) {
- return results;
-
- // Precompiled matchers will still verify ancestry, so step up a level
- } else if (compiled) {
- context = context.parentNode;
- }
-
- selector = selector.slice(tokens.shift().value.length);
- }
-
- // Fetch a seed set for right-to-left matching
- i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
- while (i--) {
- token = tokens[i];
-
- // Abort if we hit a combinator
- if (Expr.relative[(type = token.type)]) {
- break;
- }
- if ((find = Expr.find[type])) {
- // Search, expanding context for leading sibling combinators
- if ((seed = find(
- token.matches[0].replace(runescape, funescape),
- rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
- ))) {
-
- // If seed is empty or no tokens remain, we can return early
- tokens.splice(i, 1);
- selector = seed.length && toSelector(tokens);
- if (!selector) {
- push.apply(results, seed);
- return results;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (seed) {
+ if (matchedCount > 0) {
+ while (i--) {
+ if (!(unmatched[i] || setMatched[i])) {
+ setMatched[i] = pop.call(results);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- break;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ setMatched = condense(setMatched);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ push$1.apply(results, setMatched);
+ if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
+ Sizzle.uniqueSort(results);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Compile and execute a filtering function if one is not provided
- // Provide `match` to avoid retokenization if we modified the selector above
- (compiled || compile(selector, match))(
- seed,
- context,
- !documentIsHTML,
- results,
- rsibling.test(selector) && testContext(context.parentNode) || context
- );
- return results;
- };
-
- // One-time assignments
-
- // Sort stability
- support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
-
- // Support: Chrome 14-35+
- // Always assume duplicates if they aren't passed to the comparison function
- support.detectDuplicates = !!hasDuplicate;
-
- // Initialize against the default document
- setDocument();
-
- // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
- // Detached nodes confoundingly follow *each other*
- support.sortDetached = true;
-
- // Support: IE<8
- // Prevent attribute/property "interpolation"
- // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
- /*if (!assert(function (div) {
- div.innerHTML = "<a href='#'></a>";
- return div.firstChild.getAttribute("href") === "#";
- })) {
- addHandle("type|href|height|width", function (elem, name, isXML) {
- if (!isXML) {
- return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (outermost) {
+ dirruns = dirrunsUnique;
+ outermostContext = contextBackup;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }*/
-
- // Support: IE<9
- // Use defaultValue in place of getAttribute("value")
- /*if (!support.attributes || !assert(function (div) {
- div.innerHTML = "<input/>";
- div.firstChild.setAttribute("value", "");
- return div.firstChild.getAttribute("value") === "";
- })) {
- addHandle("value", function (elem, name, isXML) {
- if (!isXML && elem.nodeName.toLowerCase() === "input") {
- return elem.defaultValue;
- }
- });
- }*/
-
- // Support: IE<9
- // Use getAttributeNode to fetch booleans when getAttribute lies
- /*if (!assert(function (div) {
- return div.getAttribute("disabled") == null;
- })) {
- addHandle(booleans, function (elem, name, isXML) {
- var val;
- if (!isXML) {
- return elem[name] === true ? name.toLowerCase() :
- (val = elem.getAttributeNode(name)) && val.specified ?
- val.value :
- null;
- }
- });
- }*/
-
- // EXPOSE
- return Sizzle;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return unmatched;
+ };
+ return bySet ? markFunction(superMatcher) : superMatcher;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-
-/*eslint-enable */
-
-/**
- * Arr.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Array utility class.
- *
- * @private
- * @class tinymce.util.Arr
- */
-define(
- 'tinymce.core.util.Arr',
- [
- ],
- function () {
- var isArray = Array.isArray || function (obj) {
- return Object.prototype.toString.call(obj) === "[object Array]";
- };
-
- function toArray(obj) {
- var array = obj, i, l;
-
- if (!isArray(obj)) {
- array = [];
- for (i = 0, l = obj.length; i < l; i++) {
- array[i] = obj[i];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ compile = Sizzle.compile = function (selector, match) {
+ var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + ' '];
+ if (!cached) {
+ if (!match) {
+ match = tokenize(selector);
+ }
+ i = match.length;
+ while (i--) {
+ cached = matcherFromTokens(match[i]);
+ if (cached[expando]) {
+ setMatchers.push(cached);
+ } else {
+ elementMatchers.push(cached);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return array;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
+ cached.selector = selector;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function each(o, cb, s) {
- var n, l;
-
- if (!o) {
- return 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return cached;
+ };
+ select = Sizzle.select = function (selector, context, results, seed) {
+ var i, tokens, token, type, find, compiled = typeof selector === 'function' && selector, match = !seed && tokenize(selector = compiled.selector || selector);
+ results = results || [];
+ if (match.length === 1) {
+ tokens = match[0] = match[0].slice(0);
+ if (tokens.length > 2 && (token = tokens[0]).type === 'ID' && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
+ context = (Expr.find.ID(token.matches[0].replace(runescape, funescape), context) || [])[0];
+ if (!context) {
+ return results;
+ } else if (compiled) {
+ context = context.parentNode;
+ }
+ selector = selector.slice(tokens.shift().value.length);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- s = s || o;
-
- if (o.length !== undefined) {
- // Indexed arrays, needed for Safari
- for (n = 0, l = o.length; n < l; n++) {
- if (cb.call(s, o[n], n, o) === false) {
- return 0;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ i = matchExpr.needsContext.test(selector) ? 0 : tokens.length;
+ while (i--) {
+ token = tokens[i];
+ if (Expr.relative[type = token.type]) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- // Hashtables
- for (n in o) {
- if (o.hasOwnProperty(n)) {
- if (cb.call(s, o[n], n, o) === false) {
- return 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (find = Expr.find[type]) {
+ if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
+ tokens.splice(i, 1);
+ selector = seed.length && toSelector(tokens);
+ if (!selector) {
+ push$1.apply(results, seed);
+ return results;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return 1;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, rsibling.test(selector) && testContext(context.parentNode) || context);
+ return results;
+ };
+ support.sortStable = expando.split('').sort(sortOrder).join('') === expando;
+ support.detectDuplicates = !!hasDuplicate;
+ setDocument();
+ support.sortDetached = true;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function map(array, callback) {
- var out = [];
-
- each(array, function (item, index) {
- out.push(callback(item, index, array));
- });
-
- return out;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isArray = Array.isArray;
+ var toArray = function (obj) {
+ var array = obj, i, l;
+ if (!isArray(obj)) {
+ array = [];
+ for (i = 0, l = obj.length; i < l; i++) {
+ array[i] = obj[i];
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function filter(a, f) {
- var o = [];
-
- each(a, function (v, index) {
- if (!f || f(v, index, a)) {
- o.push(v);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return array;
+ };
+ var each$1 = function (o, cb, s) {
+ var n, l;
+ if (!o) {
+ return 0;
+ }
+ s = s || o;
+ if (o.length !== undefined) {
+ for (n = 0, l = o.length; n < l; n++) {
+ if (cb.call(s, o[n], n, o) === false) {
+ return 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- return o;
- }
-
- function indexOf(a, v) {
- var i, l;
-
- if (a) {
- for (i = 0, l = a.length; i < l; i++) {
- if (a[i] === v) {
- return i;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ } else {
+ for (n in o) {
+ if (o.hasOwnProperty(n)) {
+ if (cb.call(s, o[n], n, o) === false) {
+ return 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return -1;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function reduce(collection, iteratee, accumulator, thisArg) {
- var i = 0;
-
- if (arguments.length < 3) {
- accumulator = collection[0];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return 1;
+ };
+ var map$1 = function (array, callback) {
+ var out = [];
+ each$1(array, function (item, index) {
+ out.push(callback(item, index, array));
+ });
+ return out;
+ };
+ var filter$1 = function (a, f) {
+ var o = [];
+ each$1(a, function (v, index) {
+ if (!f || f(v, index, a)) {
+ o.push(v);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (; i < collection.length; i++) {
- accumulator = iteratee.call(thisArg, accumulator, collection[i], i);
- }
-
- return accumulator;
- }
-
- function findIndex(array, predicate, thisArg) {
- var i, l;
-
- for (i = 0, l = array.length; i < l; i++) {
- if (predicate.call(thisArg, array[i], i, array)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ return o;
+ };
+ var indexOf$2 = function (a, v) {
+ var i, l;
+ if (a) {
+ for (i = 0, l = a.length; i < l; i++) {
+ if (a[i] === v) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return i;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return -1;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function find(array, predicate, thisArg) {
- var idx = findIndex(array, predicate, thisArg);
-
- if (idx !== -1) {
- return array[idx];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return -1;
+ };
+ var reduce = function (collection, iteratee, accumulator, thisArg) {
+ var i = 0;
+ if (arguments.length < 3) {
+ accumulator = collection[0];
+ }
+ for (; i < collection.length; i++) {
+ accumulator = iteratee.call(thisArg, accumulator, collection[i], i);
+ }
+ return accumulator;
+ };
+ var findIndex$1 = function (array, predicate, thisArg) {
+ var i, l;
+ for (i = 0, l = array.length; i < l; i++) {
+ if (predicate.call(thisArg, array[i], i, array)) {
+ return i;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return undefined;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function last(collection) {
- return collection[collection.length - 1];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return -1;
+ };
+ var find$1 = function (array, predicate, thisArg) {
+ var idx = findIndex$1(array, predicate, thisArg);
+ if (idx !== -1) {
+ return array[idx];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return undefined;
+ };
+ var last$1 = function (collection) {
+ return collection[collection.length - 1];
+ };
+ var $_djuh8tljfuw8l74 = {
+ isArray: isArray,
+ toArray: toArray,
+ each: each$1,
+ map: map$1,
+ filter: filter$1,
+ indexOf: indexOf$2,
+ reduce: reduce,
+ findIndex: findIndex$1,
+ find: find$1,
+ last: last$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- isArray: isArray,
- toArray: toArray,
- each: each,
- map: map,
- filter: filter,
- indexOf: indexOf,
- reduce: reduce,
- findIndex: findIndex,
- find: find,
- last: last
- };
- }
-);
-/**
- * Tools.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains various utlity functions. These are also exposed
- * directly on the tinymce namespace.
- *
- * @class tinymce.util.Tools
- */
-define(
- 'tinymce.core.util.Tools',
- [
- "tinymce.core.Env",
- "tinymce.core.util.Arr"
- ],
- function (Env, Arr) {
- /**
- * Removes whitespace from the beginning and end of a string.
- *
- * @method trim
- * @param {String} s String to remove whitespace from.
- * @return {String} New string with removed whitespace.
- */
- var whiteSpaceRegExp = /^\s*|\s*$/g;
-
- function trim(str) {
- return (str === null || str === undefined) ? '' : ("" + str).replace(whiteSpaceRegExp, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var whiteSpaceRegExp = /^\s*|\s*$/g;
+ var trim = function (str) {
+ return str === null || str === undefined ? '' : ('' + str).replace(whiteSpaceRegExp, '');
+ };
+ var is = function (obj, type) {
+ if (!type) {
+ return obj !== undefined;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Checks if a object is of a specific type for example an array.
- *
- * @method is
- * @param {Object} obj Object to check type of.
- * @param {string} type Optional type to check for.
- * @return {Boolean} true/false if the object is of the specified type.
- */
- function is(obj, type) {
- if (!type) {
- return obj !== undefined;
- }
-
- if (type == 'array' && Arr.isArray(obj)) {
- return true;
- }
-
- return typeof obj == type;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (type === 'array' && $_djuh8tljfuw8l74.isArray(obj)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Makes a name/object map out of an array with names.
- *
- * @method makeMap
- * @param {Array/String} items Items to make map out of.
- * @param {String} delim Optional delimiter to split string by.
- * @param {Object} map Optional map to add items to.
- * @return {Object} Name/value map of items.
- */
- function makeMap(items, delim, map) {
- var i;
-
- items = items || [];
- delim = delim || ',';
-
- if (typeof items == "string") {
- items = items.split(delim);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return typeof obj === type;
+ };
+ var makeMap = function (items, delim, map) {
+ var i;
+ items = items || [];
+ delim = delim || ',';
+ if (typeof items === 'string') {
+ items = items.split(delim);
+ }
+ map = map || {};
+ i = items.length;
+ while (i--) {
+ map[items[i]] = {};
+ }
+ return map;
+ };
+ var hasOwnProperty = function (obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+ };
+ var create = function (s, p, root) {
+ var self = this;
+ var sp, ns, cn, scn, c, de = 0;
+ s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);
+ cn = s[3].match(/(^|\.)(\w+)$/i)[2];
+ ns = self.createNS(s[3].replace(/\.\w+$/, ''), root);
+ if (ns[cn]) {
+ return;
+ }
+ if (s[2] === 'static') {
+ ns[cn] = p;
+ if (this.onCreate) {
+ this.onCreate(s[2], s[3], ns[cn]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- map = map || {};
-
- i = items.length;
- while (i--) {
- map[items[i]] = {};
- }
-
- return map;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * JavaScript does not protect hasOwnProperty method, so it is possible to overwrite it. This is
- * object independent version.
- *
- * @param {Object} obj
- * @param {String} prop
- * @returns {Boolean}
- */
- function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!p[cn]) {
+ p[cn] = function () {
+ };
+ de = 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Creates a class, subclass or static singleton.
- * More details on this method can be found in the Wiki.
- *
- * @method create
- * @param {String} s Class name, inheritance and prefix.
- * @param {Object} p Collection of methods to add to the class.
- * @param {Object} root Optional root object defaults to the global window object.
- * @example
- * // Creates a basic class
- * tinymce.create('tinymce.somepackage.SomeClass', {
- * SomeClass: function() {
- * // Class constructor
- * },
- *
- * method: function() {
- * // Some method
- * }
- * });
- *
- * // Creates a basic subclass class
- * tinymce.create('tinymce.somepackage.SomeSubClass:tinymce.somepackage.SomeClass', {
- * SomeSubClass: function() {
- * // Class constructor
- * this.parent(); // Call parent constructor
- * },
- *
- * method: function() {
- * // Some method
- * this.parent(); // Call parent method
- * },
- *
- * 'static': {
- * staticMethod: function() {
- * // Static method
- * }
- * }
- * });
- *
- * // Creates a singleton/static class
- * tinymce.create('static tinymce.somepackage.SomeSingletonClass', {
- * method: function() {
- * // Some method
- * }
- * });
- */
- function create(s, p, root) {
- var self = this, sp, ns, cn, scn, c, de = 0;
-
- // Parse : <prefix> <class>:<super class>
- s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);
- cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name
-
- // Create namespace for new class
- ns = self.createNS(s[3].replace(/\.\w+$/, ''), root);
-
- // Class already exists
- if (ns[cn]) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ns[cn] = p[cn];
+ self.extend(ns[cn].prototype, p);
+ if (s[5]) {
+ sp = self.resolve(s[5]).prototype;
+ scn = s[5].match(/\.(\w+)$/i)[1];
+ c = ns[cn];
+ if (de) {
+ ns[cn] = function () {
+ return sp[scn].apply(this, arguments);
+ };
+ } else {
+ ns[cn] = function () {
+ this.parent = sp[scn];
+ return c.apply(this, arguments);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Make pure static class
- if (s[2] == 'static') {
- ns[cn] = p;
-
- if (this.onCreate) {
- this.onCreate(s[2], s[3], ns[cn]);
- }
-
- return;
- }
-
- // Create default constructor
- if (!p[cn]) {
- p[cn] = function () { };
- de = 1;
- }
-
- // Add constructor and methods
- ns[cn] = p[cn];
- self.extend(ns[cn].prototype, p);
-
- // Extend
- if (s[5]) {
- sp = self.resolve(s[5]).prototype;
- scn = s[5].match(/\.(\w+)$/i)[1]; // Class name
-
- // Extend constructor
- c = ns[cn];
- if (de) {
- // Add passthrough constructor
- ns[cn] = function () {
- return sp[scn].apply(this, arguments);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ns[cn].prototype[cn] = ns[cn];
+ self.each(sp, function (f, n) {
+ ns[cn].prototype[n] = sp[n];
+ });
+ self.each(p, function (f, n) {
+ if (sp[n]) {
+ ns[cn].prototype[n] = function () {
+ this.parent = sp[n];
+ return f.apply(this, arguments);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Add inherit constructor
- ns[cn] = function () {
- this.parent = sp[scn];
- return c.apply(this, arguments);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (n !== cn) {
+ ns[cn].prototype[n] = f;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ns[cn].prototype[cn] = ns[cn];
-
- // Add super methods
- self.each(sp, function (f, n) {
- ns[cn].prototype[n] = sp[n];
- });
-
- // Add overridden methods
- self.each(p, function (f, n) {
- // Extend methods if needed
- if (sp[n]) {
- ns[cn].prototype[n] = function () {
- this.parent = sp[n];
- return f.apply(this, arguments);
- };
- } else {
- if (n != cn) {
- ns[cn].prototype[n] = f;
- }
- }
- });
- }
-
- // Add static methods
- /*jshint sub:true*/
- /*eslint dot-notation:0*/
- self.each(p['static'], function (f, n) {
- ns[cn][n] = f;
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function extend(obj, ext) {
- var i, l, name, args = arguments, value;
-
- for (i = 1, l = args.length; i < l; i++) {
- ext = args[i];
- for (name in ext) {
- if (ext.hasOwnProperty(name)) {
- value = ext[name];
-
- if (value !== undefined) {
- obj[name] = value;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.each(p.static, function (f, n) {
+ ns[cn][n] = f;
+ });
+ };
+ var extend = function (obj, ext) {
+ var x = [];
+ for (var _i = 2; _i < arguments.length; _i++) {
+ x[_i - 2] = arguments[_i];
+ }
+ var i, l, name;
+ var args = arguments;
+ var value;
+ for (i = 1, l = args.length; i < l; i++) {
+ ext = args[i];
+ for (name in ext) {
+ if (ext.hasOwnProperty(name)) {
+ value = ext[name];
+ if (value !== undefined) {
+ obj[name] = value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return obj;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Executed the specified function for each item in a object tree.
- *
- * @method walk
- * @param {Object} o Object tree to walk though.
- * @param {function} f Function to call for each item.
- * @param {String} n Optional name of collection inside the objects to walk for example childNodes.
- * @param {String} s Optional scope to execute the function in.
- */
- function walk(o, f, n, s) {
- s = s || this;
-
- if (o) {
- if (n) {
- o = o[n];
- }
-
- Arr.each(o, function (o, i) {
- if (f.call(s, o, i, n) === false) {
- return false;
- }
-
- walk(o, f, n, s);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return obj;
+ };
+ var walk = function (o, f, n, s) {
+ s = s || this;
+ if (o) {
+ if (n) {
+ o = o[n];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- /**
- * Creates a namespace on a specific object.
- *
- * @method createNS
- * @param {String} n Namespace to create for example a.b.c.d.
- * @param {Object} o Optional object to add namespace to, defaults to window.
- * @return {Object} New namespace object the last item in path.
- * @example
- * // Create some namespace
- * tinymce.createNS('tinymce.somepackage.subpackage');
- *
- * // Add a singleton
- * var tinymce.somepackage.subpackage.SomeSingleton = {
- * method: function() {
- * // Some method
- * }
- * };
- */
- function createNS(n, o) {
- var i, v;
-
- o = o || window;
-
- n = n.split('.');
- for (i = 0; i < n.length; i++) {
- v = n[i];
-
- if (!o[v]) {
- o[v] = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_djuh8tljfuw8l74.each(o, function (o, i) {
+ if (f.call(s, o, i, n) === false) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- o = o[v];
- }
-
- return o;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ walk(o, f, n, s);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Resolves a string and returns the object from a specific structure.
- *
- * @method resolve
- * @param {String} n Path to resolve for example a.b.c.d.
- * @param {Object} o Optional object to search though, defaults to window.
- * @return {Object} Last object in path or null if it couldn't be resolved.
- * @example
- * // Resolve a path into an object reference
- * var obj = tinymce.resolve('a.b.c.d');
- */
- function resolve(n, o) {
- var i, l;
-
- o = o || window;
-
- n = n.split('.');
- for (i = 0, l = n.length; i < l; i++) {
- o = o[n[i]];
-
- if (!o) {
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var createNS = function (n, o) {
+ var i, v;
+ o = o || window;
+ n = n.split('.');
+ for (i = 0; i < n.length; i++) {
+ v = n[i];
+ if (!o[v]) {
+ o[v] = {};
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return o;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ o = o[v];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Splits a string but removes the whitespace before and after each value.
- *
- * @method explode
- * @param {string} s String to split.
- * @param {string} d Delimiter to split by.
- * @example
- * // Split a string into an array with a,b,c
- * var arr = tinymce.explode('a, b, c');
- */
- function explode(s, d) {
- if (!s || is(s, 'array')) {
- return s;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return o;
+ };
+ var resolve$1 = function (n, o) {
+ var i, l;
+ o = o || window;
+ n = n.split('.');
+ for (i = 0, l = n.length; i < l; i++) {
+ o = o[n[i]];
+ if (!o) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Arr.map(s.split(d || ','), trim);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _addCacheSuffix(url) {
- var cacheSuffix = Env.cacheSuffix;
-
- if (cacheSuffix) {
- url += (url.indexOf('?') === -1 ? '?' : '&') + cacheSuffix;
- }
-
- return url;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return o;
+ };
+ var explode = function (s, d) {
+ if (!s || is(s, 'array')) {
+ return s;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- trim: trim,
-
- /**
- * Returns true/false if the object is an array or not.
- *
- * @method isArray
- * @param {Object} obj Object to check.
- * @return {boolean} true/false state if the object is an array or not.
- */
- isArray: Arr.isArray,
-
- is: is,
-
- /**
- * Converts the specified object into a real JavaScript array.
- *
- * @method toArray
- * @param {Object} obj Object to convert into array.
- * @return {Array} Array object based in input.
- */
- toArray: Arr.toArray,
- makeMap: makeMap,
-
- /**
- * Performs an iteration of all items in a collection such as an object or array. This method will execure the
- * callback function for each item in the collection, if the callback returns false the iteration will terminate.
- * The callback has the following format: cb(value, key_or_index).
- *
- * @method each
- * @param {Object} o Collection to iterate.
- * @param {function} cb Callback function to execute for each item.
- * @param {Object} s Optional scope to execute the callback in.
- * @example
- * // Iterate an array
- * tinymce.each([1,2,3], function(v, i) {
- * console.debug("Value: " + v + ", Index: " + i);
- * });
- *
- * // Iterate an object
- * tinymce.each({a: 1, b: 2, c: 3], function(v, k) {
- * console.debug("Value: " + v + ", Key: " + k);
- * });
- */
- each: Arr.each,
-
- /**
- * Creates a new array by the return value of each iteration function call. This enables you to convert
- * one array list into another.
- *
- * @method map
- * @param {Array} array Array of items to iterate.
- * @param {function} callback Function to call for each item. It's return value will be the new value.
- * @return {Array} Array with new values based on function return values.
- */
- map: Arr.map,
-
- /**
- * Filters out items from the input array by calling the specified function for each item.
- * If the function returns false the item will be excluded if it returns true it will be included.
- *
- * @method grep
- * @param {Array} a Array of items to loop though.
- * @param {function} f Function to call for each item. Include/exclude depends on it's return value.
- * @return {Array} New array with values imported and filtered based in input.
- * @example
- * // Filter out some items, this will return an array with 4 and 5
- * var items = tinymce.grep([1,2,3,4,5], function(v) {return v > 3;});
- */
- grep: Arr.filter,
-
- /**
- * Returns an index of the item or -1 if item is not present in the array.
- *
- * @method inArray
- * @param {any} item Item to search for.
- * @param {Array} arr Array to search in.
- * @return {Number} index of the item or -1 if item was not found.
- */
- inArray: Arr.indexOf,
-
- hasOwn: hasOwnProperty,
-
- extend: extend,
- create: create,
- walk: walk,
- createNS: createNS,
- resolve: resolve,
- explode: explode,
- _addCacheSuffix: _addCacheSuffix
- };
- }
-);
-/**
- * DomQuery.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class mimics most of the jQuery API:
- *
- * This is whats currently implemented:
- * - Utility functions
- * - DOM traversial
- * - DOM manipulation
- * - Event binding
- *
- * This is not currently implemented:
- * - Dimension
- * - Ajax
- * - Animation
- * - Advanced chaining
- *
- * @example
- * var $ = tinymce.dom.DomQuery;
- * $('p').attr('attr', 'value').addClass('class');
- *
- * @class tinymce.dom.DomQuery
- */
-define(
- 'tinymce.core.dom.DomQuery',
- [
- "tinymce.core.dom.EventUtils",
- "tinymce.core.dom.Sizzle",
- "tinymce.core.util.Tools",
- "tinymce.core.Env"
- ],
- function (EventUtils, Sizzle, Tools, Env) {
- var doc = document, push = Array.prototype.push, slice = Array.prototype.slice;
- var rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/;
- var Event = EventUtils.Event, undef;
- var skipUniques = Tools.makeMap('children,contents,next,prev');
-
- function isDefined(obj) {
- return typeof obj !== 'undefined';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $_djuh8tljfuw8l74.map(s.split(d || ','), trim);
+ };
+ var _addCacheSuffix = function (url) {
+ var cacheSuffix = $_9fhi43ajfuw8l13.cacheSuffix;
+ if (cacheSuffix) {
+ url += (url.indexOf('?') === -1 ? '?' : '&') + cacheSuffix;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return url;
+ };
+ var $_52qop8kjfuw8l6v = {
+ trim: trim,
+ isArray: $_djuh8tljfuw8l74.isArray,
+ is: is,
+ toArray: $_djuh8tljfuw8l74.toArray,
+ makeMap: makeMap,
+ each: $_djuh8tljfuw8l74.each,
+ map: $_djuh8tljfuw8l74.map,
+ grep: $_djuh8tljfuw8l74.filter,
+ inArray: $_djuh8tljfuw8l74.indexOf,
+ hasOwn: hasOwnProperty,
+ extend: extend,
+ create: create,
+ walk: walk,
+ createNS: createNS,
+ resolve: resolve$1,
+ explode: explode,
+ _addCacheSuffix: _addCacheSuffix
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function isString(obj) {
- return typeof obj === 'string';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var doc = document;
+ var push$2 = Array.prototype.push;
+ var slice$2 = Array.prototype.slice;
+ var rquickExpr$1 = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/;
+ var Event = EventUtils.Event;
+ var skipUniques = $_52qop8kjfuw8l6v.makeMap('children,contents,next,prev');
+ var isDefined = function (obj) {
+ return typeof obj !== 'undefined';
+ };
+ var isString = function (obj) {
+ return typeof obj === 'string';
+ };
+ var isWindow = function (obj) {
+ return obj && obj === obj.window;
+ };
+ var createFragment = function (html, fragDoc) {
+ var frag, node, container;
+ fragDoc = fragDoc || doc;
+ container = fragDoc.createElement('div');
+ frag = fragDoc.createDocumentFragment();
+ container.innerHTML = html;
+ while (node = container.firstChild) {
+ frag.appendChild(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isWindow(obj) {
- return obj && obj == obj.window;
- }
-
- function createFragment(html, fragDoc) {
- var frag, node, container;
-
- fragDoc = fragDoc || doc;
- container = fragDoc.createElement('div');
- frag = fragDoc.createDocumentFragment();
- container.innerHTML = html;
-
- while ((node = container.firstChild)) {
- frag.appendChild(node);
- }
-
- return frag;
- }
-
- function domManipulate(targetNodes, sourceItem, callback, reverse) {
- var i;
-
- if (isString(sourceItem)) {
- sourceItem = createFragment(sourceItem, getElementDocument(targetNodes[0]));
- } else if (sourceItem.length && !sourceItem.nodeType) {
- sourceItem = DomQuery.makeArray(sourceItem);
-
- if (reverse) {
- for (i = sourceItem.length - 1; i >= 0; i--) {
- domManipulate(targetNodes, sourceItem[i], callback, reverse);
- }
- } else {
- for (i = 0; i < sourceItem.length; i++) {
- domManipulate(targetNodes, sourceItem[i], callback, reverse);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return frag;
+ };
+ var domManipulate = function (targetNodes, sourceItem, callback, reverse) {
+ var i;
+ if (isString(sourceItem)) {
+ sourceItem = createFragment(sourceItem, getElementDocument(targetNodes[0]));
+ } else if (sourceItem.length && !sourceItem.nodeType) {
+ sourceItem = DomQuery.makeArray(sourceItem);
+ if (reverse) {
+ for (i = sourceItem.length - 1; i >= 0; i--) {
+ domManipulate(targetNodes, sourceItem[i], callback, reverse);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return targetNodes;
- }
-
- if (sourceItem.nodeType) {
- i = targetNodes.length;
- while (i--) {
- callback.call(targetNodes[i], sourceItem);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ for (i = 0; i < sourceItem.length; i++) {
+ domManipulate(targetNodes, sourceItem[i], callback, reverse);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return targetNodes;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hasClass(node, className) {
- return node && className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (sourceItem.nodeType) {
+ i = targetNodes.length;
+ while (i--) {
+ callback.call(targetNodes[i], sourceItem);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function wrap(elements, wrapper, all) {
- var lastParent, newWrapper;
-
- wrapper = DomQuery(wrapper)[0];
-
- elements.each(function () {
- var self = this;
-
- if (!all || lastParent != self.parentNode) {
- lastParent = self.parentNode;
- newWrapper = wrapper.cloneNode(false);
- self.parentNode.insertBefore(newWrapper, self);
- newWrapper.appendChild(self);
- } else {
- newWrapper.appendChild(self);
- }
- });
-
- return elements;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return targetNodes;
+ };
+ var hasClass = function (node, className) {
+ return node && className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1;
+ };
+ var wrap = function (elements, wrapper, all) {
+ var lastParent, newWrapper;
+ wrapper = DomQuery(wrapper)[0];
+ elements.each(function () {
+ var self = this;
+ if (!all || lastParent !== self.parentNode) {
+ lastParent = self.parentNode;
+ newWrapper = wrapper.cloneNode(false);
+ self.parentNode.insertBefore(newWrapper, self);
+ newWrapper.appendChild(self);
+ } else {
+ newWrapper.appendChild(self);
+ }
+ });
+ return elements;
+ };
+ var numericCssMap = $_52qop8kjfuw8l6v.makeMap('fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom', ' ');
+ var booleanMap = $_52qop8kjfuw8l6v.makeMap('checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected', ' ');
+ var propFix = {
+ for: 'htmlFor',
+ class: 'className',
+ readonly: 'readOnly'
+ };
+ var cssFix = { float: 'cssFloat' };
+ var attrHooks = {};
+ var cssHooks = {};
+ var DomQuery = function (selector, context) {
+ return new DomQuery.fn.init(selector, context);
+ };
+ var inArray = function (item, array) {
+ var i;
+ if (array.indexOf) {
+ return array.indexOf(item);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var numericCssMap = Tools.makeMap('fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom', ' ');
- var booleanMap = Tools.makeMap('checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected', ' ');
- var propFix = {
- 'for': 'htmlFor',
- 'class': 'className',
- 'readonly': 'readOnly'
- };
- var cssFix = {
- 'float': 'cssFloat'
- };
-
- var attrHooks = {}, cssHooks = {};
-
- function DomQuery(selector, context) {
- /*eslint new-cap:0 */
- return new DomQuery.fn.init(selector, context);
- }
-
- function inArray(item, array) {
- var i;
-
- if (array.indexOf) {
- return array.indexOf(item);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ i = array.length;
+ while (i--) {
+ if (array[i] === item) {
+ return i;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- i = array.length;
- while (i--) {
- if (array[i] === item) {
- return i;
- }
- }
-
- return -1;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var whiteSpaceRegExp = /^\s*|\s*$/g;
-
- function trim(str) {
- return (str === null || str === undef) ? '' : ("" + str).replace(whiteSpaceRegExp, '');
- }
-
- function each(obj, callback) {
- var length, key, i, undef, value;
-
- if (obj) {
- length = obj.length;
-
- if (length === undef) {
- // Loop object items
- for (key in obj) {
- if (obj.hasOwnProperty(key)) {
- value = obj[key];
- if (callback.call(value, key, value) === false) {
- break;
- }
- }
- }
- } else {
- // Loop array items
- for (i = 0; i < length; i++) {
- value = obj[i];
- if (callback.call(value, i, value) === false) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return -1;
+ };
+ var whiteSpaceRegExp$1 = /^\s*|\s*$/g;
+ var trim$1 = function (str) {
+ return str === null || str === undefined ? '' : ('' + str).replace(whiteSpaceRegExp$1, '');
+ };
+ var each$2 = function (obj, callback) {
+ var length, key, i, value;
+ if (obj) {
+ length = obj.length;
+ if (length === undefined) {
+ for (key in obj) {
+ if (obj.hasOwnProperty(key)) {
+ value = obj[key];
+ if (callback.call(value, key, value) === false) {
</ins><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ for (i = 0; i < length; i++) {
+ value = obj[i];
+ if (callback.call(value, i, value) === false) {
+ break;
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return obj;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function grep(array, callback) {
- var out = [];
-
- each(array, function (i, item) {
- if (callback(item, i)) {
- out.push(item);
- }
- });
-
- return out;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return obj;
+ };
+ var grep = function (array, callback) {
+ var out = [];
+ each$2(array, function (i, item) {
+ if (callback(item, i)) {
+ out.push(item);
+ }
+ });
+ return out;
+ };
+ var getElementDocument = function (element) {
+ if (!element) {
+ return doc;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getElementDocument(element) {
- if (!element) {
- return doc;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (element.nodeType === 9) {
+ return element;
+ }
+ return element.ownerDocument;
+ };
+ DomQuery.fn = DomQuery.prototype = {
+ constructor: DomQuery,
+ selector: '',
+ context: null,
+ length: 0,
+ init: function (selector, context) {
+ var self = this;
+ var match, node;
+ if (!selector) {
+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (element.nodeType == 9) {
- return element;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (selector.nodeType) {
+ self.context = self[0] = selector;
+ self.length = 1;
+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return element.ownerDocument;
- }
-
- DomQuery.fn = DomQuery.prototype = {
- constructor: DomQuery,
-
- /**
- * Selector for the current set.
- *
- * @property selector
- * @type String
- */
- selector: "",
-
- /**
- * Context used to create the set.
- *
- * @property context
- * @type Element
- */
- context: null,
-
- /**
- * Number of items in the current set.
- *
- * @property length
- * @type Number
- */
- length: 0,
-
- /**
- * Constructs a new DomQuery instance with the specified selector or context.
- *
- * @constructor
- * @method init
- * @param {String/Array/DomQuery} selector Optional CSS selector/Array or array like object or HTML string.
- * @param {Document/Element} context Optional context to search in.
- */
- init: function (selector, context) {
- var self = this, match, node;
-
- if (!selector) {
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (context && context.nodeType) {
+ self.context = context;
+ } else {
+ if (context) {
+ return DomQuery(selector).attr(context);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (selector.nodeType) {
- self.context = self[0] = selector;
- self.length = 1;
-
- return self;
- }
-
- if (context && context.nodeType) {
- self.context = context;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.context = context = document;
+ }
+ if (isString(selector)) {
+ self.selector = selector;
+ if (selector.charAt(0) === '<' && selector.charAt(selector.length - 1) === '>' && selector.length >= 3) {
+ match = [
+ null,
+ selector,
+ null
+ ];
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (context) {
- return DomQuery(selector).attr(context);
- }
-
- self.context = context = document;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ match = rquickExpr$1.exec(selector);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isString(selector)) {
- self.selector = selector;
-
- if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) {
- match = [null, selector, null];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (match) {
+ if (match[1]) {
+ node = createFragment(selector, getElementDocument(context)).firstChild;
+ while (node) {
+ push$2.call(self, node);
+ node = node.nextSibling;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- match = rquickExpr.exec(selector);
- }
-
- if (match) {
- if (match[1]) {
- node = createFragment(selector, getElementDocument(context)).firstChild;
-
- while (node) {
- push.call(self, node);
- node = node.nextSibling;
- }
- } else {
- node = getElementDocument(context).getElementById(match[2]);
-
- if (!node) {
- return self;
- }
-
- if (node.id !== match[2]) {
- return self.find(selector);
- }
-
- self.length = 1;
- self[0] = node;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = getElementDocument(context).getElementById(match[2]);
+ if (!node) {
+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- return DomQuery(context).find(selector);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.id !== match[2]) {
+ return self.find(selector);
+ }
+ self.length = 1;
+ self[0] = node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- this.add(selector, false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return DomQuery(context).find(selector);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return self;
- },
-
- /**
- * Converts the current set to an array.
- *
- * @method toArray
- * @return {Array} Array of all nodes in set.
- */
- toArray: function () {
- return Tools.toArray(this);
- },
-
- /**
- * Adds new nodes to the set.
- *
- * @method add
- * @param {Array/tinymce.core.dom.DomQuery} items Array of all nodes to add to set.
- * @param {Boolean} sort Optional sort flag that enables sorting of elements.
- * @return {tinymce.dom.DomQuery} New instance with nodes added.
- */
- add: function (items, sort) {
- var self = this, nodes, i;
-
- if (isString(items)) {
- return self.add(DomQuery(items));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ this.add(selector, false);
+ }
+ return self;
+ },
+ toArray: function () {
+ return $_52qop8kjfuw8l6v.toArray(this);
+ },
+ add: function (items, sort) {
+ var self = this;
+ var nodes, i;
+ if (isString(items)) {
+ return self.add(DomQuery(items));
+ }
+ if (sort !== false) {
+ nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items)));
+ self.length = nodes.length;
+ for (i = 0; i < nodes.length; i++) {
+ self[i] = nodes[i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (sort !== false) {
- nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items)));
- self.length = nodes.length;
- for (i = 0; i < nodes.length; i++) {
- self[i] = nodes[i];
- }
- } else {
- push.apply(self, DomQuery.makeArray(items));
- }
-
- return self;
- },
-
- /**
- * Sets/gets attributes on the elements in the current set.
- *
- * @method attr
- * @param {String/Object} name Name of attribute to get or an object with attributes to set.
- * @param {String} value Optional value to set.
- * @return {tinymce.dom.DomQuery/String} Current set or the specified attribute when only the name is specified.
- */
- attr: function (name, value) {
- var self = this, hook;
-
- if (typeof name === "object") {
- each(name, function (name, value) {
- self.attr(name, value);
- });
- } else if (isDefined(value)) {
- this.each(function () {
- var hook;
-
- if (this.nodeType === 1) {
- hook = attrHooks[name];
- if (hook && hook.set) {
- hook.set(this, value);
- return;
- }
-
- if (value === null) {
- this.removeAttribute(name, 2);
- } else {
- this.setAttribute(name, value, 2);
- }
- }
- });
- } else {
- if (self[0] && self[0].nodeType === 1) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ push$2.apply(self, DomQuery.makeArray(items));
+ }
+ return self;
+ },
+ attr: function (name, value) {
+ var self = this;
+ var hook;
+ if (typeof name === 'object') {
+ each$2(name, function (name, value) {
+ self.attr(name, value);
+ });
+ } else if (isDefined(value)) {
+ this.each(function () {
+ var hook;
+ if (this.nodeType === 1) {
</ins><span class="cx" style="display: block; padding: 0 10px"> hook = attrHooks[name];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (hook && hook.get) {
- return hook.get(self[0], name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (hook && hook.set) {
+ hook.set(this, value);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (booleanMap[name]) {
- return self.prop(name) ? name : undef;
- }
-
- value = self[0].getAttribute(name, 2);
-
</del><span class="cx" style="display: block; padding: 0 10px"> if (value === null) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- value = undef;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.removeAttribute(name, 2);
+ } else {
+ this.setAttribute(name, value, 2);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return value;
- }
-
- return self;
- },
-
- /**
- * Removes attributse on the elements in the current set.
- *
- * @method removeAttr
- * @param {String/Object} name Name of attribute to remove.
- * @return {tinymce.dom.DomQuery/String} Current set.
- */
- removeAttr: function (name) {
- return this.attr(name, null);
- },
-
- /**
- * Sets/gets properties on the elements in the current set.
- *
- * @method attr
- * @param {String/Object} name Name of property to get or an object with properties to set.
- * @param {String} value Optional value to set.
- * @return {tinymce.dom.DomQuery/String} Current set or the specified property when only the name is specified.
- */
- prop: function (name, value) {
- var self = this;
-
- name = propFix[name] || name;
-
- if (typeof name === "object") {
- each(name, function (name, value) {
- self.prop(name, value);
- });
- } else if (isDefined(value)) {
- this.each(function () {
- if (this.nodeType == 1) {
- this[name] = value;
- }
- });
- } else {
- if (self[0] && self[0].nodeType && name in self[0]) {
- return self[0][name];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ } else {
+ if (self[0] && self[0].nodeType === 1) {
+ hook = attrHooks[name];
+ if (hook && hook.get) {
+ return hook.get(self[0], name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return value;
- }
-
- return self;
- },
-
- /**
- * Sets/gets styles on the elements in the current set.
- *
- * @method css
- * @param {String/Object} name Name of style to get or an object with styles to set.
- * @param {String} value Optional value to set.
- * @return {tinymce.dom.DomQuery/String} Current set or the specified style when only the name is specified.
- */
- css: function (name, value) {
- var self = this, elm, hook;
-
- function camel(name) {
- return name.replace(/-(\D)/g, function (a, b) {
- return b.toUpperCase();
- });
- }
-
- function dashed(name) {
- return name.replace(/[A-Z]/g, function (a) {
- return '-' + a;
- });
- }
-
- if (typeof name === "object") {
- each(name, function (name, value) {
- self.css(name, value);
- });
- } else {
- if (isDefined(value)) {
- name = camel(name);
-
- // Default px suffix on these
- if (typeof value === 'number' && !numericCssMap[name]) {
- value += 'px';
- }
-
- self.each(function () {
- var style = this.style;
-
- hook = cssHooks[name];
- if (hook && hook.set) {
- hook.set(this, value);
- return;
- }
-
- try {
- this.style[cssFix[name] || name] = value;
- } catch (ex) {
- // Ignore
- }
-
- if (value === null || value === '') {
- if (style.removeProperty) {
- style.removeProperty(dashed(name));
- } else {
- style.removeAttribute(name);
- }
- }
- });
- } else {
- elm = self[0];
-
- hook = cssHooks[name];
- if (hook && hook.get) {
- return hook.get(elm);
- }
-
- if (elm.ownerDocument.defaultView) {
- try {
- return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name));
- } catch (ex) {
- return undef;
- }
- } else if (elm.currentStyle) {
- return elm.currentStyle[camel(name)];
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (booleanMap[name]) {
+ return self.prop(name) ? name : undefined;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return self;
- },
-
- /**
- * Removes all nodes in set from the document.
- *
- * @method remove
- * @return {tinymce.dom.DomQuery} Current set with the removed nodes.
- */
- remove: function () {
- var self = this, node, i = this.length;
-
- while (i--) {
- node = self[i];
- Event.clean(node);
-
- if (node.parentNode) {
- node.parentNode.removeChild(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ value = self[0].getAttribute(name, 2);
+ if (value === null) {
+ value = undefined;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return this;
- },
-
- /**
- * Empties all elements in set.
- *
- * @method empty
- * @return {tinymce.dom.DomQuery} Current set with the empty nodes.
- */
- empty: function () {
- var self = this, node, i = this.length;
-
- while (i--) {
- node = self[i];
- while (node.firstChild) {
- node.removeChild(node.firstChild);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return value;
+ }
+ return self;
+ },
+ removeAttr: function (name) {
+ return this.attr(name, null);
+ },
+ prop: function (name, value) {
+ var self = this;
+ name = propFix[name] || name;
+ if (typeof name === 'object') {
+ each$2(name, function (name, value) {
+ self.prop(name, value);
+ });
+ } else if (isDefined(value)) {
+ this.each(function () {
+ if (this.nodeType === 1) {
+ this[name] = value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return this;
- },
-
- /**
- * Sets or gets the HTML of the current set or first set node.
- *
- * @method html
- * @param {String} value Optional innerHTML value to set on each element.
- * @return {tinymce.dom.DomQuery/String} Current set or the innerHTML of the first element.
- */
- html: function (value) {
- var self = this, i;
-
- if (isDefined(value)) {
- i = self.length;
-
- try {
- while (i--) {
- self[i].innerHTML = value;
- }
- } catch (ex) {
- // Workaround for "Unknown runtime error" when DIV is added to P on IE
- DomQuery(self[i]).empty().append(value);
- }
-
- return self;
- }
-
- return self[0] ? self[0].innerHTML : '';
- },
-
- /**
- * Sets or gets the text of the current set or first set node.
- *
- * @method text
- * @param {String} value Optional innerText value to set on each element.
- * @return {tinymce.dom.DomQuery/String} Current set or the innerText of the first element.
- */
- text: function (value) {
- var self = this, i;
-
- if (isDefined(value)) {
- i = self.length;
- while (i--) {
- if ("innerText" in self[i]) {
- self[i].innerText = value;
- } else {
- self[0].textContent = value;
- }
- }
-
- return self;
- }
-
- return self[0] ? (self[0].innerText || self[0].textContent) : '';
- },
-
- /**
- * Appends the specified node/html or node set to the current set nodes.
- *
- * @method append
- * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to append to each element in set.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- append: function () {
- return domManipulate(this, arguments, function (node) {
- // Either element or Shadow Root
- if (this.nodeType === 1 || (this.host && this.host.nodeType === 1)) {
- this.appendChild(node);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Prepends the specified node/html or node set to the current set nodes.
- *
- * @method prepend
- * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to prepend to each element in set.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- prepend: function () {
- return domManipulate(this, arguments, function (node) {
- // Either element or Shadow Root
- if (this.nodeType === 1 || (this.host && this.host.nodeType === 1)) {
- this.insertBefore(node, this.firstChild);
- }
- }, true);
- },
-
- /**
- * Adds the specified elements before current set nodes.
- *
- * @method before
- * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add before to each element in set.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- before: function () {
- var self = this;
-
- if (self[0] && self[0].parentNode) {
- return domManipulate(self, arguments, function (node) {
- this.parentNode.insertBefore(node, this);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if (self[0] && self[0].nodeType && name in self[0]) {
+ return self[0][name];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return self;
- },
-
- /**
- * Adds the specified elements after current set nodes.
- *
- * @method after
- * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to add after to each element in set.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- after: function () {
- var self = this;
-
- if (self[0] && self[0].parentNode) {
- return domManipulate(self, arguments, function (node) {
- this.parentNode.insertBefore(node, this.nextSibling);
- }, true);
- }
-
- return self;
- },
-
- /**
- * Appends the specified set nodes to the specified selector/instance.
- *
- * @method appendTo
- * @param {String/Element/Array/tinymce.dom.DomQuery} val Item to append the current set to.
- * @return {tinymce.dom.DomQuery} Current set with the appended nodes.
- */
- appendTo: function (val) {
- DomQuery(val).append(this);
-
- return this;
- },
-
- /**
- * Prepends the specified set nodes to the specified selector/instance.
- *
- * @method prependTo
- * @param {String/Element/Array/tinymce.dom.DomQuery} val Item to prepend the current set to.
- * @return {tinymce.dom.DomQuery} Current set with the prepended nodes.
- */
- prependTo: function (val) {
- DomQuery(val).prepend(this);
-
- return this;
- },
-
- /**
- * Replaces the nodes in set with the specified content.
- *
- * @method replaceWith
- * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to replace nodes with.
- * @return {tinymce.dom.DomQuery} Set with replaced nodes.
- */
- replaceWith: function (content) {
- return this.before(content).remove();
- },
-
- /**
- * Wraps all elements in set with the specified wrapper.
- *
- * @method wrap
- * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with.
- * @return {tinymce.dom.DomQuery} Set with wrapped nodes.
- */
- wrap: function (content) {
- return wrap(this, content);
- },
-
- /**
- * Wraps all nodes in set with the specified wrapper. If the nodes are siblings all of them
- * will be wrapped in the same wrapper.
- *
- * @method wrapAll
- * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with.
- * @return {tinymce.dom.DomQuery} Set with wrapped nodes.
- */
- wrapAll: function (content) {
- return wrap(this, content, true);
- },
-
- /**
- * Wraps all elements inner contents in set with the specified wrapper.
- *
- * @method wrapInner
- * @param {String/Element/Array/tinymce.dom.DomQuery} content Content to wrap nodes with.
- * @return {tinymce.dom.DomQuery} Set with wrapped nodes.
- */
- wrapInner: function (content) {
- this.each(function () {
- DomQuery(this).contents().wrapAll(content);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return value;
+ }
+ return self;
+ },
+ css: function (name, value) {
+ var self = this;
+ var elm, hook;
+ var camel = function (name) {
+ return name.replace(/-(\D)/g, function (a, b) {
+ return b.toUpperCase();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return this;
- },
-
- /**
- * Unwraps all elements by removing the parent element of each item in set.
- *
- * @method unwrap
- * @return {tinymce.dom.DomQuery} Set with unwrapped nodes.
- */
- unwrap: function () {
- return this.parent().each(function () {
- DomQuery(this).replaceWith(this.childNodes);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var dashed = function (name) {
+ return name.replace(/[A-Z]/g, function (a) {
+ return '-' + a;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Clones all nodes in set.
- *
- * @method clone
- * @return {tinymce.dom.DomQuery} Set with cloned nodes.
- */
- clone: function () {
- var result = [];
-
- this.each(function () {
- result.push(this.cloneNode(true));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (typeof name === 'object') {
+ each$2(name, function (name, value) {
+ self.css(name, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return DomQuery(result);
- },
-
- /**
- * Adds the specified class name to the current set elements.
- *
- * @method addClass
- * @param {String} className Class name to add.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- addClass: function (className) {
- return this.toggleClass(className, true);
- },
-
- /**
- * Removes the specified class name to the current set elements.
- *
- * @method removeClass
- * @param {String} className Class name to remove.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- removeClass: function (className) {
- return this.toggleClass(className, false);
- },
-
- /**
- * Toggles the specified class name on the current set elements.
- *
- * @method toggleClass
- * @param {String} className Class name to add/remove.
- * @param {Boolean} state Optional state to toggle on/off.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- toggleClass: function (className, state) {
- var self = this;
-
- // Functions are not supported
- if (typeof className != 'string') {
- return self;
- }
-
- if (className.indexOf(' ') !== -1) {
- each(className.split(' '), function () {
- self.toggleClass(this, state);
- });
- } else {
- self.each(function (index, node) {
- var existingClassName, classState;
-
- classState = hasClass(node, className);
- if (classState !== state) {
- existingClassName = node.className;
-
- if (classState) {
- node.className = trim((" " + existingClassName + " ").replace(' ' + className + ' ', ' '));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if (isDefined(value)) {
+ name = camel(name);
+ if (typeof value === 'number' && !numericCssMap[name]) {
+ value = value.toString() + 'px';
+ }
+ self.each(function () {
+ var style = this.style;
+ hook = cssHooks[name];
+ if (hook && hook.set) {
+ hook.set(this, value);
+ return;
+ }
+ try {
+ this.style[cssFix[name] || name] = value;
+ } catch (ex) {
+ }
+ if (value === null || value === '') {
+ if (style.removeProperty) {
+ style.removeProperty(dashed(name));
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- node.className += existingClassName ? ' ' + className : className;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ style.removeAttribute(name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return self;
- },
-
- /**
- * Returns true/false if the first item in set has the specified class.
- *
- * @method hasClass
- * @param {String} className Class name to check for.
- * @return {Boolean} True/false if the set has the specified class.
- */
- hasClass: function (className) {
- return hasClass(this[0], className);
- },
-
- /**
- * Executes the callback function for each item DomQuery collection. If you return false in the
- * callback it will break the loop.
- *
- * @method each
- * @param {function} callback Callback function to execute for each item.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- each: function (callback) {
- return each(this, callback);
- },
-
- /**
- * Binds an event with callback function to the elements in set.
- *
- * @method on
- * @param {String} name Name of the event to bind.
- * @param {function} callback Callback function to execute when the event occurs.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- on: function (name, callback) {
- return this.each(function () {
- Event.bind(this, name, callback);
- });
- },
-
- /**
- * Unbinds an event with callback function to the elements in set.
- *
- * @method off
- * @param {String} name Optional name of the event to bind.
- * @param {function} callback Optional callback function to execute when the event occurs.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- off: function (name, callback) {
- return this.each(function () {
- Event.unbind(this, name, callback);
- });
- },
-
- /**
- * Triggers the specified event by name or event object.
- *
- * @method trigger
- * @param {String/Object} name Name of the event to trigger or event object.
- * @return {tinymce.dom.DomQuery} Current set.
- */
- trigger: function (name) {
- return this.each(function () {
- if (typeof name == 'object') {
- Event.fire(this, name.type, name);
- } else {
- Event.fire(this, name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ elm = self[0];
+ hook = cssHooks[name];
+ if (hook && hook.get) {
+ return hook.get(elm);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- },
-
- /**
- * Shows all elements in set.
- *
- * @method show
- * @return {tinymce.dom.DomQuery} Current set.
- */
- show: function () {
- return this.css('display', '');
- },
-
- /**
- * Hides all elements in set.
- *
- * @method hide
- * @return {tinymce.dom.DomQuery} Current set.
- */
- hide: function () {
- return this.css('display', 'none');
- },
-
- /**
- * Slices the current set.
- *
- * @method slice
- * @param {Number} start Start index to slice at.
- * @param {Number} end Optional end index to end slice at.
- * @return {tinymce.dom.DomQuery} Sliced set.
- */
- slice: function () {
- return new DomQuery(slice.apply(this, arguments));
- },
-
- /**
- * Makes the set equal to the specified index.
- *
- * @method eq
- * @param {Number} index Index to set it equal to.
- * @return {tinymce.dom.DomQuery} Single item set.
- */
- eq: function (index) {
- return index === -1 ? this.slice(index) : this.slice(index, +index + 1);
- },
-
- /**
- * Makes the set equal to first element in set.
- *
- * @method first
- * @return {tinymce.dom.DomQuery} Single item set.
- */
- first: function () {
- return this.eq(0);
- },
-
- /**
- * Makes the set equal to last element in set.
- *
- * @method last
- * @return {tinymce.dom.DomQuery} Single item set.
- */
- last: function () {
- return this.eq(-1);
- },
-
- /**
- * Finds elements by the specified selector for each element in set.
- *
- * @method find
- * @param {String} selector Selector to find elements by.
- * @return {tinymce.dom.DomQuery} Set with matches elements.
- */
- find: function (selector) {
- var i, l, ret = [];
-
- for (i = 0, l = this.length; i < l; i++) {
- DomQuery.find(selector, this[i], ret);
- }
-
- return DomQuery(ret);
- },
-
- /**
- * Filters the current set with the specified selector.
- *
- * @method filter
- * @param {String/function} selector Selector to filter elements by.
- * @return {tinymce.dom.DomQuery} Set with filtered elements.
- */
- filter: function (selector) {
- if (typeof selector == 'function') {
- return DomQuery(grep(this.toArray(), function (item, i) {
- return selector(i, item);
- }));
- }
-
- return DomQuery(DomQuery.filter(selector, this.toArray()));
- },
-
- /**
- * Gets the current node or any parent matching the specified selector.
- *
- * @method closest
- * @param {String/Element/tinymce.dom.DomQuery} selector Selector or element to find.
- * @return {tinymce.dom.DomQuery} Set with closest elements.
- */
- closest: function (selector) {
- var result = [];
-
- if (selector instanceof DomQuery) {
- selector = selector[0];
- }
-
- this.each(function (i, node) {
- while (node) {
- if (typeof selector == 'string' && DomQuery(node).is(selector)) {
- result.push(node);
- break;
- } else if (node == selector) {
- result.push(node);
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (elm.ownerDocument.defaultView) {
+ try {
+ return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name));
+ } catch (ex) {
+ return undefined;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node = node.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (elm.currentStyle) {
+ return elm.currentStyle[camel(name)];
+ } else {
+ return '';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- return DomQuery(result);
- },
-
- /**
- * Returns the offset of the first element in set or sets the top/left css properties of all elements in set.
- *
- * @method offset
- * @param {Object} offset Optional offset object to set on each item.
- * @return {Object/tinymce.dom.DomQuery} Returns the first element offset or the current set if you specified an offset.
- */
- offset: function (offset) {
- var elm, doc, docElm;
- var x = 0, y = 0, pos;
-
- if (!offset) {
- elm = this[0];
-
- if (elm) {
- doc = elm.ownerDocument;
- docElm = doc.documentElement;
-
- if (elm.getBoundingClientRect) {
- pos = elm.getBoundingClientRect();
- x = pos.left + (docElm.scrollLeft || doc.body.scrollLeft) - docElm.clientLeft;
- y = pos.top + (docElm.scrollTop || doc.body.scrollTop) - docElm.clientTop;
- }
- }
-
- return {
- left: x,
- top: y
- };
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return this.css(offset);
- },
-
- push: push,
- sort: [].sort,
- splice: [].splice
- };
-
- // Static members
- Tools.extend(DomQuery, {
- /**
- * Extends the specified object with one or more objects.
- *
- * @static
- * @method extend
- * @param {Object} target Target object to extend with new items.
- * @param {Object..} object Object to extend the target with.
- * @return {Object} Extended input object.
- */
- extend: Tools.extend,
-
- /**
- * Creates an array out of an array like object.
- *
- * @static
- * @method makeArray
- * @param {Object} object Object to convert to array.
- * @return {Array} Array produced from object.
- */
- makeArray: function (object) {
- if (isWindow(object) || object.nodeType) {
- return [object];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return self;
+ },
+ remove: function () {
+ var self = this;
+ var node, i = this.length;
+ while (i--) {
+ node = self[i];
+ Event.clean(node);
+ if (node.parentNode) {
+ node.parentNode.removeChild(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Tools.toArray(object);
- },
-
- /**
- * Returns the index of the specified item inside the array.
- *
- * @static
- * @method inArray
- * @param {Object} item Item to look for.
- * @param {Array} array Array to look for item in.
- * @return {Number} Index of the item or -1.
- */
- inArray: inArray,
-
- /**
- * Returns true/false if the specified object is an array or not.
- *
- * @static
- * @method isArray
- * @param {Object} array Object to check if it's an array or not.
- * @return {Boolean} True/false if the object is an array.
- */
- isArray: Tools.isArray,
-
- /**
- * Executes the callback function for each item in array/object. If you return false in the
- * callback it will break the loop.
- *
- * @static
- * @method each
- * @param {Object} obj Object to iterate.
- * @param {function} callback Callback function to execute for each item.
- */
- each: each,
-
- /**
- * Removes whitespace from the beginning and end of a string.
- *
- * @static
- * @method trim
- * @param {String} str String to remove whitespace from.
- * @return {String} New string with removed whitespace.
- */
- trim: trim,
-
- /**
- * Filters out items from the input array by calling the specified function for each item.
- * If the function returns false the item will be excluded if it returns true it will be included.
- *
- * @static
- * @method grep
- * @param {Array} array Array of items to loop though.
- * @param {function} callback Function to call for each item. Include/exclude depends on it's return value.
- * @return {Array} New array with values imported and filtered based in input.
- * @example
- * // Filter out some items, this will return an array with 4 and 5
- * var items = DomQuery.grep([1, 2, 3, 4, 5], function(v) {return v > 3;});
- */
- grep: grep,
-
- // Sizzle
- find: Sizzle,
- expr: Sizzle.selectors,
- unique: Sizzle.uniqueSort,
- text: Sizzle.getText,
- contains: Sizzle.contains,
- filter: function (expr, elems, not) {
- var i = elems.length;
-
- if (not) {
- expr = ":not(" + expr + ")";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return this;
+ },
+ empty: function () {
+ var self = this;
+ var node, i = this.length;
+ while (i--) {
+ node = self[i];
+ while (node.firstChild) {
+ node.removeChild(node.firstChild);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- while (i--) {
- if (elems[i].nodeType != 1) {
- elems.splice(i, 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return this;
+ },
+ html: function (value) {
+ var self = this;
+ var i;
+ if (isDefined(value)) {
+ i = self.length;
+ try {
+ while (i--) {
+ self[i].innerHTML = value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (ex) {
+ DomQuery(self[i]).empty().append(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (elems.length === 1) {
- elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : [];
- } else {
- elems = DomQuery.find.matches(expr, elems);
- }
-
- return elems;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- function dir(el, prop, until) {
- var matched = [], cur = el[prop];
-
- if (typeof until != 'string' && until instanceof DomQuery) {
- until = until[0];
- }
-
- while (cur && cur.nodeType !== 9) {
- if (until !== undefined) {
- if (cur === until) {
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self[0] ? self[0].innerHTML : '';
+ },
+ text: function (value) {
+ var self = this;
+ var i;
+ if (isDefined(value)) {
+ i = self.length;
+ while (i--) {
+ if ('innerText' in self[i]) {
+ self[i].innerText = value;
+ } else {
+ self[0].textContent = value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (typeof until == 'string' && DomQuery(cur).is(until)) {
- break;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (cur.nodeType === 1) {
- matched.push(cur);
- }
-
- cur = cur[prop];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return matched;
- }
-
- function sibling(node, siblingName, nodeType, until) {
- var result = [];
-
- if (until instanceof DomQuery) {
- until = until[0];
- }
-
- for (; node; node = node[siblingName]) {
- if (nodeType && node.nodeType !== nodeType) {
- continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self[0] ? self[0].innerText || self[0].textContent : '';
+ },
+ append: function () {
+ return domManipulate(this, arguments, function (node) {
+ if (this.nodeType === 1 || this.host && this.host.nodeType === 1) {
+ this.appendChild(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (until !== undefined) {
- if (node === until) {
- break;
- }
-
- if (typeof until == 'string' && DomQuery(node).is(until)) {
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ },
+ prepend: function () {
+ return domManipulate(this, arguments, function (node) {
+ if (this.nodeType === 1 || this.host && this.host.nodeType === 1) {
+ this.insertBefore(node, this.firstChild);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- result.push(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, true);
+ },
+ before: function () {
+ var self = this;
+ if (self[0] && self[0].parentNode) {
+ return domManipulate(self, arguments, function (node) {
+ this.parentNode.insertBefore(node, this);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return result;
- }
-
- function firstSibling(node, siblingName, nodeType) {
- for (node = node[siblingName]; node; node = node[siblingName]) {
- if (node.nodeType == nodeType) {
- return node;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
+ },
+ after: function () {
+ var self = this;
+ if (self[0] && self[0].parentNode) {
+ return domManipulate(self, arguments, function (node) {
+ this.parentNode.insertBefore(node, this.nextSibling);
+ }, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
- }
-
- each({
- /**
- * Returns a new collection with the parent of each item in current collection matching the optional selector.
- *
- * @method parent
- * @param {Element/tinymce.dom.DomQuery} node Node to match parents against.
- * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents.
- */
- parent: function (node) {
- var parent = node.parentNode;
-
- return parent && parent.nodeType !== 11 ? parent : null;
- },
-
- /**
- * Returns a new collection with the all the parents of each item in current collection matching the optional selector.
- *
- * @method parents
- * @param {Element/tinymce.dom.DomQuery} node Node to match parents against.
- * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents.
- */
- parents: function (node) {
- return dir(node, "parentNode");
- },
-
- /**
- * Returns a new collection with next sibling of each item in current collection matching the optional selector.
- *
- * @method next
- * @param {Element/tinymce.dom.DomQuery} node Node to match the next element against.
- * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
- */
- next: function (node) {
- return firstSibling(node, 'nextSibling', 1);
- },
-
- /**
- * Returns a new collection with previous sibling of each item in current collection matching the optional selector.
- *
- * @method prev
- * @param {Element/tinymce.dom.DomQuery} node Node to match the previous element against.
- * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
- */
- prev: function (node) {
- return firstSibling(node, 'previousSibling', 1);
- },
-
- /**
- * Returns all child elements matching the optional selector.
- *
- * @method children
- * @param {Element/tinymce.dom.DomQuery} node Node to match the elements against.
- * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
- */
- children: function (node) {
- return sibling(node.firstChild, 'nextSibling', 1);
- },
-
- /**
- * Returns all child nodes matching the optional selector.
- *
- * @method contents
- * @param {Element/tinymce.dom.DomQuery} node Node to get the contents of.
- * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
- */
- contents: function (node) {
- return Tools.toArray((node.nodeName === "iframe" ? node.contentDocument || node.contentWindow.document : node).childNodes);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
+ },
+ appendTo: function (val) {
+ DomQuery(val).append(this);
+ return this;
+ },
+ prependTo: function (val) {
+ DomQuery(val).prepend(this);
+ return this;
+ },
+ replaceWith: function (content) {
+ return this.before(content).remove();
+ },
+ wrap: function (content) {
+ return wrap(this, content);
+ },
+ wrapAll: function (content) {
+ return wrap(this, content, true);
+ },
+ wrapInner: function (content) {
+ this.each(function () {
+ DomQuery(this).contents().wrapAll(content);
+ });
+ return this;
+ },
+ unwrap: function () {
+ return this.parent().each(function () {
+ DomQuery(this).replaceWith(this.childNodes);
+ });
+ },
+ clone: function () {
+ var result = [];
+ this.each(function () {
+ result.push(this.cloneNode(true));
+ });
+ return DomQuery(result);
+ },
+ addClass: function (className) {
+ return this.toggleClass(className, true);
+ },
+ removeClass: function (className) {
+ return this.toggleClass(className, false);
+ },
+ toggleClass: function (className, state) {
+ var self = this;
+ if (typeof className !== 'string') {
+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }, function (name, fn) {
- DomQuery.fn[name] = function (selector) {
- var self = this, result = [];
-
- self.each(function () {
- var nodes = fn.call(result, this, selector, result);
-
- if (nodes) {
- if (DomQuery.isArray(nodes)) {
- result.push.apply(result, nodes);
- } else {
- result.push(nodes);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (className.indexOf(' ') !== -1) {
+ each$2(className.split(' '), function () {
+ self.toggleClass(this, state);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // If traversing on multiple elements we might get the same elements twice
- if (this.length > 1) {
- if (!skipUniques[name]) {
- result = DomQuery.unique(result);
- }
-
- if (name.indexOf('parents') === 0) {
- result = result.reverse();
- }
- }
-
- result = DomQuery(result);
-
- if (selector) {
- return result.filter(selector);
- }
-
- return result;
- };
- });
-
- each({
- /**
- * Returns a new collection with the all the parents until the matching selector/element
- * of each item in current collection matching the optional selector.
- *
- * @method parentsUntil
- * @param {Element/tinymce.dom.DomQuery} node Node to find parent of.
- * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element.
- * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching parents.
- */
- parentsUntil: function (node, until) {
- return dir(node, "parentNode", until);
- },
-
- /**
- * Returns a new collection with all next siblings of each item in current collection matching the optional selector.
- *
- * @method nextUntil
- * @param {Element/tinymce.dom.DomQuery} node Node to find next siblings on.
- * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element.
- * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
- */
- nextUntil: function (node, until) {
- return sibling(node, 'nextSibling', 1, until).slice(1);
- },
-
- /**
- * Returns a new collection with all previous siblings of each item in current collection matching the optional selector.
- *
- * @method prevUntil
- * @param {Element/tinymce.dom.DomQuery} node Node to find previous siblings on.
- * @param {String/Element/tinymce.dom.DomQuery} until Until the matching selector or element.
- * @return {tinymce.dom.DomQuery} New DomQuery instance with all matching elements.
- */
- prevUntil: function (node, until) {
- return sibling(node, 'previousSibling', 1, until).slice(1);
- }
- }, function (name, fn) {
- DomQuery.fn[name] = function (selector, filter) {
- var self = this, result = [];
-
- self.each(function () {
- var nodes = fn.call(result, this, selector, result);
-
- if (nodes) {
- if (DomQuery.isArray(nodes)) {
- result.push.apply(result, nodes);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ self.each(function (index, node) {
+ var existingClassName, classState;
+ classState = hasClass(node, className);
+ if (classState !== state) {
+ existingClassName = node.className;
+ if (classState) {
+ node.className = trim$1((' ' + existingClassName + ' ').replace(' ' + className + ' ', ' '));
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- result.push(nodes);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.className += existingClassName ? ' ' + className : className;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // If traversing on multiple elements we might get the same elements twice
- if (this.length > 1) {
- result = DomQuery.unique(result);
-
- if (name.indexOf('parents') === 0 || name === 'prevUntil') {
- result = result.reverse();
- }
- }
-
- result = DomQuery(result);
-
- if (filter) {
- return result.filter(filter);
- }
-
- return result;
- };
- });
-
- /**
- * Returns true/false if the current set items matches the selector.
- *
- * @method is
- * @param {String} selector Selector to match the elements against.
- * @return {Boolean} True/false if the current set matches the selector.
- */
- DomQuery.fn.is = function (selector) {
- return !!selector && this.filter(selector).length > 0;
- };
-
- DomQuery.fn.init.prototype = DomQuery.fn;
-
- DomQuery.overrideDefaults = function (callback) {
- var defaults;
-
- function sub(selector, context) {
- defaults = defaults || callback();
-
- if (arguments.length === 0) {
- selector = defaults.element;
- }
-
- if (!context) {
- context = defaults.context;
- }
-
- return new sub.fn.init(selector, context);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- DomQuery.extend(sub, this);
-
- return sub;
- };
-
- function appendHooks(targetHooks, prop, hooks) {
- each(hooks, function (name, func) {
- targetHooks[name] = targetHooks[name] || {};
- targetHooks[name][prop] = func;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
+ },
+ hasClass: function (className) {
+ return hasClass(this[0], className);
+ },
+ each: function (callback) {
+ return each$2(this, callback);
+ },
+ on: function (name, callback) {
+ return this.each(function () {
+ Event.bind(this, name, callback);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- if (Env.ie && Env.ie < 8) {
- appendHooks(attrHooks, 'get', {
- maxlength: function (elm) {
- var value = elm.maxLength;
-
- if (value === 0x7fffffff) {
- return undef;
- }
-
- return value;
- },
-
- size: function (elm) {
- var value = elm.size;
-
- if (value === 20) {
- return undef;
- }
-
- return value;
- },
-
- 'class': function (elm) {
- return elm.className;
- },
-
- style: function (elm) {
- var value = elm.style.cssText;
-
- if (value.length === 0) {
- return undef;
- }
-
- return value;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ off: function (name, callback) {
+ return this.each(function () {
+ Event.unbind(this, name, callback);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- appendHooks(attrHooks, 'set', {
- 'class': function (elm, value) {
- elm.className = value;
- },
-
- style: function (elm, value) {
- elm.style.cssText = value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ trigger: function (name) {
+ return this.each(function () {
+ if (typeof name === 'object') {
+ Event.fire(this, name.type, name);
+ } else {
+ Event.fire(this, name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- if (Env.ie && Env.ie < 9) {
- /*jshint sub:true */
- /*eslint dot-notation: 0*/
- cssFix['float'] = 'styleFloat';
-
- appendHooks(cssHooks, 'set', {
- opacity: function (elm, value) {
- var style = elm.style;
-
- if (value === null || value === '') {
- style.removeAttribute('filter');
- } else {
- style.zoom = 1;
- style.filter = 'alpha(opacity=' + (value * 100) + ')';
- }
- }
- });
- }
-
- DomQuery.attrHooks = attrHooks;
- DomQuery.cssHooks = cssHooks;
-
- return DomQuery;
- }
-);
-
-/**
- * Range.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Old IE Range.
- *
- * @private
- * @class tinymce.dom.Range
- */
-define(
- 'tinymce.core.dom.Range',
- [
- "tinymce.core.util.Tools"
- ],
- function (Tools) {
- // Range constructor
- function Range(dom) {
- var self = this,
- doc = dom.doc,
- EXTRACT = 0,
- CLONE = 1,
- DELETE = 2,
- TRUE = true,
- FALSE = false,
- START_OFFSET = 'startOffset',
- START_CONTAINER = 'startContainer',
- END_CONTAINER = 'endContainer',
- END_OFFSET = 'endOffset',
- extend = Tools.extend,
- nodeIndex = dom.nodeIndex;
-
- function createDocumentFragment() {
- return doc.createDocumentFragment();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ show: function () {
+ return this.css('display', '');
+ },
+ hide: function () {
+ return this.css('display', 'none');
+ },
+ slice: function () {
+ return new DomQuery(slice$2.apply(this, arguments));
+ },
+ eq: function (index) {
+ return index === -1 ? this.slice(index) : this.slice(index, +index + 1);
+ },
+ first: function () {
+ return this.eq(0);
+ },
+ last: function () {
+ return this.eq(-1);
+ },
+ find: function (selector) {
+ var i, l;
+ var ret = [];
+ for (i = 0, l = this.length; i < l; i++) {
+ DomQuery.find(selector, this[i], ret);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function setStart(n, o) {
- _setEndPoint(TRUE, n, o);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return DomQuery(ret);
+ },
+ filter: function (selector) {
+ if (typeof selector === 'function') {
+ return DomQuery(grep(this.toArray(), function (item, i) {
+ return selector(i, item);
+ }));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function setEnd(n, o) {
- _setEndPoint(FALSE, n, o);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return DomQuery(DomQuery.filter(selector, this.toArray()));
+ },
+ closest: function (selector) {
+ var result = [];
+ if (selector instanceof DomQuery) {
+ selector = selector[0];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function setStartBefore(n) {
- setStart(n.parentNode, nodeIndex(n));
- }
-
- function setStartAfter(n) {
- setStart(n.parentNode, nodeIndex(n) + 1);
- }
-
- function setEndBefore(n) {
- setEnd(n.parentNode, nodeIndex(n));
- }
-
- function setEndAfter(n) {
- setEnd(n.parentNode, nodeIndex(n) + 1);
- }
-
- function collapse(ts) {
- if (ts) {
- self[END_CONTAINER] = self[START_CONTAINER];
- self[END_OFFSET] = self[START_OFFSET];
- } else {
- self[START_CONTAINER] = self[END_CONTAINER];
- self[START_OFFSET] = self[END_OFFSET];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.each(function (i, node) {
+ while (node) {
+ if (typeof selector === 'string' && DomQuery(node).is(selector)) {
+ result.push(node);
+ break;
+ } else if (node === selector) {
+ result.push(node);
+ break;
+ }
+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.collapsed = TRUE;
- }
-
- function selectNode(n) {
- setStartBefore(n);
- setEndAfter(n);
- }
-
- function selectNodeContents(n) {
- setStart(n, 0);
- setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length);
- }
-
- function compareBoundaryPoints(h, r) {
- var sc = self[START_CONTAINER], so = self[START_OFFSET], ec = self[END_CONTAINER], eo = self[END_OFFSET],
- rsc = r.startContainer, rso = r.startOffset, rec = r.endContainer, reo = r.endOffset;
-
- // Check START_TO_START
- if (h === 0) {
- return _compareBoundaryPoints(sc, so, rsc, rso);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ return DomQuery(result);
+ },
+ offset: function (offset) {
+ var elm, doc, docElm;
+ var x = 0, y = 0, pos;
+ if (!offset) {
+ elm = this[0];
+ if (elm) {
+ doc = elm.ownerDocument;
+ docElm = doc.documentElement;
+ if (elm.getBoundingClientRect) {
+ pos = elm.getBoundingClientRect();
+ x = pos.left + (docElm.scrollLeft || doc.body.scrollLeft) - docElm.clientLeft;
+ y = pos.top + (docElm.scrollTop || doc.body.scrollTop) - docElm.clientTop;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Check START_TO_END
- if (h === 1) {
- return _compareBoundaryPoints(ec, eo, rsc, rso);
- }
-
- // Check END_TO_END
- if (h === 2) {
- return _compareBoundaryPoints(ec, eo, rec, reo);
- }
-
- // Check END_TO_START
- if (h === 3) {
- return _compareBoundaryPoints(sc, so, rec, reo);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return {
+ left: x,
+ top: y
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function deleteContents() {
- _traverse(DELETE);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return this.css(offset);
+ },
+ push: push$2,
+ sort: [].sort,
+ splice: [].splice
+ };
+ $_52qop8kjfuw8l6v.extend(DomQuery, {
+ extend: $_52qop8kjfuw8l6v.extend,
+ makeArray: function (object) {
+ if (isWindow(object) || object.nodeType) {
+ return [object];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function extractContents() {
- return _traverse(EXTRACT);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $_52qop8kjfuw8l6v.toArray(object);
+ },
+ inArray: inArray,
+ isArray: $_52qop8kjfuw8l6v.isArray,
+ each: each$2,
+ trim: trim$1,
+ grep: grep,
+ find: Sizzle,
+ expr: Sizzle.selectors,
+ unique: Sizzle.uniqueSort,
+ text: Sizzle.getText,
+ contains: Sizzle.contains,
+ filter: function (expr, elems, not) {
+ var i = elems.length;
+ if (not) {
+ expr = ':not(' + expr + ')';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function cloneContents() {
- return _traverse(CLONE);
- }
-
- function insertNode(n) {
- var startContainer = this[START_CONTAINER],
- startOffset = this[START_OFFSET], nn, o;
-
- // Node is TEXT_NODE or CDATA
- if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) {
- if (!startOffset) {
- // At the start of text
- startContainer.parentNode.insertBefore(n, startContainer);
- } else if (startOffset >= startContainer.nodeValue.length) {
- // At the end of text
- dom.insertAfter(n, startContainer);
- } else {
- // Middle, need to split
- nn = startContainer.splitText(startOffset);
- startContainer.parentNode.insertBefore(n, nn);
- }
- } else {
- // Insert element node
- if (startContainer.childNodes.length > 0) {
- o = startContainer.childNodes[startOffset];
- }
-
- if (o) {
- startContainer.insertBefore(n, o);
- } else {
- if (startContainer.nodeType == 3) {
- dom.insertAfter(n, startContainer);
- } else {
- startContainer.appendChild(n);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (i--) {
+ if (elems[i].nodeType !== 1) {
+ elems.splice(i, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function surroundContents(n) {
- var f = self.extractContents();
-
- self.insertNode(n);
- n.appendChild(f);
- self.selectNode(n);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (elems.length === 1) {
+ elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : [];
+ } else {
+ elems = DomQuery.find.matches(expr, elems);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function cloneRange() {
- return extend(new Range(dom), {
- startContainer: self[START_CONTAINER],
- startOffset: self[START_OFFSET],
- endContainer: self[END_CONTAINER],
- endOffset: self[END_OFFSET],
- collapsed: self.collapsed,
- commonAncestorContainer: self.commonAncestorContainer
- });
- }
-
- // Private methods
-
- function _getSelectedNode(container, offset) {
- var child;
-
- // TEXT_NODE
- if (container.nodeType == 3) {
- return container;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return elems;
+ }
+ });
+ var dir = function (el, prop, until) {
+ var matched = [];
+ var cur = el[prop];
+ if (typeof until !== 'string' && until instanceof DomQuery) {
+ until = until[0];
+ }
+ while (cur && cur.nodeType !== 9) {
+ if (until !== undefined) {
+ if (cur === until) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (offset < 0) {
- return container;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (typeof until === 'string' && DomQuery(cur).is(until)) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- child = container.firstChild;
- while (child && offset > 0) {
- --offset;
- child = child.nextSibling;
- }
-
- if (child) {
- return child;
- }
-
- return container;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _isCollapsed() {
- return (self[START_CONTAINER] == self[END_CONTAINER] && self[START_OFFSET] == self[END_OFFSET]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (cur.nodeType === 1) {
+ matched.push(cur);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) {
- var c, offsetC, n, cmnRoot, childA, childB;
-
- // In the first case the boundary-points have the same container. A is before B
- // if its offset is less than the offset of B, A is equal to B if its offset is
- // equal to the offset of B, and A is after B if its offset is greater than the
- // offset of B.
- if (containerA == containerB) {
- if (offsetA == offsetB) {
- return 0; // equal
- }
-
- if (offsetA < offsetB) {
- return -1; // before
- }
-
- return 1; // after
- }
-
- // In the second case a child node C of the container of A is an ancestor
- // container of B. In this case, A is before B if the offset of A is less than or
- // equal to the index of the child node C and A is after B otherwise.
- c = containerB;
- while (c && c.parentNode != containerA) {
- c = c.parentNode;
- }
-
- if (c) {
- offsetC = 0;
- n = containerA.firstChild;
-
- while (n != c && offsetC < offsetA) {
- offsetC++;
- n = n.nextSibling;
- }
-
- if (offsetA <= offsetC) {
- return -1; // before
- }
-
- return 1; // after
- }
-
- // In the third case a child node C of the container of B is an ancestor container
- // of A. In this case, A is before B if the index of the child node C is less than
- // the offset of B and A is after B otherwise.
- c = containerA;
- while (c && c.parentNode != containerB) {
- c = c.parentNode;
- }
-
- if (c) {
- offsetC = 0;
- n = containerB.firstChild;
-
- while (n != c && offsetC < offsetB) {
- offsetC++;
- n = n.nextSibling;
- }
-
- if (offsetC < offsetB) {
- return -1; // before
- }
-
- return 1; // after
- }
-
- // In the fourth case, none of three other cases hold: the containers of A and B
- // are siblings or descendants of sibling nodes. In this case, A is before B if
- // the container of A is before the container of B in a pre-order traversal of the
- // Ranges' context tree and A is after B otherwise.
- cmnRoot = dom.findCommonAncestor(containerA, containerB);
- childA = containerA;
-
- while (childA && childA.parentNode != cmnRoot) {
- childA = childA.parentNode;
- }
-
- if (!childA) {
- childA = cmnRoot;
- }
-
- childB = containerB;
- while (childB && childB.parentNode != cmnRoot) {
- childB = childB.parentNode;
- }
-
- if (!childB) {
- childB = cmnRoot;
- }
-
- if (childA == childB) {
- return 0; // equal
- }
-
- n = cmnRoot.firstChild;
- while (n) {
- if (n == childA) {
- return -1; // before
- }
-
- if (n == childB) {
- return 1; // after
- }
-
- n = n.nextSibling;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ cur = cur[prop];
+ }
+ return matched;
+ };
+ var sibling = function (node, siblingName, nodeType, until) {
+ var result = [];
+ if (until instanceof DomQuery) {
+ until = until[0];
+ }
+ for (; node; node = node[siblingName]) {
+ if (nodeType && node.nodeType !== nodeType) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _setEndPoint(st, n, o) {
- var ec, sc;
-
- if (st) {
- self[START_CONTAINER] = n;
- self[START_OFFSET] = o;
- } else {
- self[END_CONTAINER] = n;
- self[END_OFFSET] = o;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (until !== undefined) {
+ if (node === until) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // If one boundary-point of a Range is set to have a root container
- // other than the current one for the Range, the Range is collapsed to
- // the new position. This enforces the restriction that both boundary-
- // points of a Range must have the same root container.
- ec = self[END_CONTAINER];
- while (ec.parentNode) {
- ec = ec.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (typeof until === 'string' && DomQuery(node).is(until)) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- sc = self[START_CONTAINER];
- while (sc.parentNode) {
- sc = sc.parentNode;
- }
-
- if (sc == ec) {
- // The start position of a Range is guaranteed to never be after the
- // end position. To enforce this restriction, if the start is set to
- // be at a position after the end, the Range is collapsed to that
- // position.
- if (_compareBoundaryPoints(self[START_CONTAINER], self[START_OFFSET], self[END_CONTAINER], self[END_OFFSET]) > 0) {
- self.collapse(st);
- }
- } else {
- self.collapse(st);
- }
-
- self.collapsed = _isCollapsed();
- self.commonAncestorContainer = dom.findCommonAncestor(self[START_CONTAINER], self[END_CONTAINER]);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _traverse(how) {
- var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;
-
- if (self[START_CONTAINER] == self[END_CONTAINER]) {
- return _traverseSameContainer(how);
- }
-
- for (c = self[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {
- if (p == self[START_CONTAINER]) {
- return _traverseCommonStartContainer(c, how);
- }
-
- ++endContainerDepth;
- }
-
- for (c = self[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {
- if (p == self[END_CONTAINER]) {
- return _traverseCommonEndContainer(c, how);
- }
-
- ++startContainerDepth;
- }
-
- depthDiff = startContainerDepth - endContainerDepth;
-
- startNode = self[START_CONTAINER];
- while (depthDiff > 0) {
- startNode = startNode.parentNode;
- depthDiff--;
- }
-
- endNode = self[END_CONTAINER];
- while (depthDiff < 0) {
- endNode = endNode.parentNode;
- depthDiff++;
- }
-
- // ascend the ancestor hierarchy until we have a common parent.
- for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) {
- startNode = sp;
- endNode = ep;
- }
-
- return _traverseCommonAncestors(startNode, endNode, how);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ result.push(node);
+ }
+ return result;
+ };
+ var firstSibling = function (node, siblingName, nodeType) {
+ for (node = node[siblingName]; node; node = node[siblingName]) {
+ if (node.nodeType === nodeType) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _traverseSameContainer(how) {
- var frag, s, sub, n, cnt, sibling, xferNode, start, len;
-
- if (how != DELETE) {
- frag = createDocumentFragment();
- }
-
- // If selection is empty, just return the fragment
- if (self[START_OFFSET] == self[END_OFFSET]) {
- return frag;
- }
-
- // Text node needs special case handling
- if (self[START_CONTAINER].nodeType == 3) { // TEXT_NODE
- // get the substring
- s = self[START_CONTAINER].nodeValue;
- sub = s.substring(self[START_OFFSET], self[END_OFFSET]);
-
- // set the original text node to its new value
- if (how != CLONE) {
- n = self[START_CONTAINER];
- start = self[START_OFFSET];
- len = self[END_OFFSET] - self[START_OFFSET];
-
- if (start === 0 && len >= n.nodeValue.length - 1) {
- n.parentNode.removeChild(n);
- } else {
- n.deleteData(start, len);
- }
-
- // Nothing is partially selected, so collapse to start point
- self.collapse(TRUE);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return null;
+ };
+ each$2({
+ parent: function (node) {
+ var parent = node.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function (node) {
+ return dir(node, 'parentNode');
+ },
+ next: function (node) {
+ return firstSibling(node, 'nextSibling', 1);
+ },
+ prev: function (node) {
+ return firstSibling(node, 'previousSibling', 1);
+ },
+ children: function (node) {
+ return sibling(node.firstChild, 'nextSibling', 1);
+ },
+ contents: function (node) {
+ return $_52qop8kjfuw8l6v.toArray((node.nodeName === 'iframe' ? node.contentDocument || node.contentWindow.document : node).childNodes);
+ }
+ }, function (name, fn) {
+ DomQuery.fn[name] = function (selector) {
+ var self = this;
+ var result = [];
+ self.each(function () {
+ var nodes = fn.call(result, this, selector, result);
+ if (nodes) {
+ if (DomQuery.isArray(nodes)) {
+ result.push.apply(result, nodes);
+ } else {
+ result.push(nodes);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (how == DELETE) {
- return;
- }
-
- if (sub.length > 0) {
- frag.appendChild(doc.createTextNode(sub));
- }
-
- return frag;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Copy nodes between the start/end offsets.
- n = _getSelectedNode(self[START_CONTAINER], self[START_OFFSET]);
- cnt = self[END_OFFSET] - self[START_OFFSET];
-
- while (n && cnt > 0) {
- sibling = n.nextSibling;
- xferNode = _traverseFullySelected(n, how);
-
- if (frag) {
- frag.appendChild(xferNode);
- }
-
- --cnt;
- n = sibling;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ if (this.length > 1) {
+ if (!skipUniques[name]) {
+ result = DomQuery.unique(result);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Nothing is partially selected, so collapse to start point
- if (how != CLONE) {
- self.collapse(TRUE);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (name.indexOf('parents') === 0) {
+ result = result.reverse();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return frag;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _traverseCommonStartContainer(endAncestor, how) {
- var frag, n, endIdx, cnt, sibling, xferNode;
-
- if (how != DELETE) {
- frag = createDocumentFragment();
- }
-
- n = _traverseRightBoundary(endAncestor, how);
-
- if (frag) {
- frag.appendChild(n);
- }
-
- endIdx = nodeIndex(endAncestor);
- cnt = endIdx - self[START_OFFSET];
-
- if (cnt <= 0) {
- // Collapse to just before the endAncestor, which
- // is partially selected.
- if (how != CLONE) {
- self.setEndBefore(endAncestor);
- self.collapse(FALSE);
- }
-
- return frag;
- }
-
- n = endAncestor.previousSibling;
- while (cnt > 0) {
- sibling = n.previousSibling;
- xferNode = _traverseFullySelected(n, how);
-
- if (frag) {
- frag.insertBefore(xferNode, frag.firstChild);
- }
-
- --cnt;
- n = sibling;
- }
-
- // Collapse to just before the endAncestor, which
- // is partially selected.
- if (how != CLONE) {
- self.setEndBefore(endAncestor);
- self.collapse(FALSE);
- }
-
- return frag;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ result = DomQuery(result);
+ if (selector) {
+ return result.filter(selector);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _traverseCommonEndContainer(startAncestor, how) {
- var frag, startIdx, n, cnt, sibling, xferNode;
-
- if (how != DELETE) {
- frag = createDocumentFragment();
- }
-
- n = _traverseLeftBoundary(startAncestor, how);
- if (frag) {
- frag.appendChild(n);
- }
-
- startIdx = nodeIndex(startAncestor);
- ++startIdx; // Because we already traversed it
-
- cnt = self[END_OFFSET] - startIdx;
- n = startAncestor.nextSibling;
- while (n && cnt > 0) {
- sibling = n.nextSibling;
- xferNode = _traverseFullySelected(n, how);
-
- if (frag) {
- frag.appendChild(xferNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return result;
+ };
+ });
+ each$2({
+ parentsUntil: function (node, until) {
+ return dir(node, 'parentNode', until);
+ },
+ nextUntil: function (node, until) {
+ return sibling(node, 'nextSibling', 1, until).slice(1);
+ },
+ prevUntil: function (node, until) {
+ return sibling(node, 'previousSibling', 1, until).slice(1);
+ }
+ }, function (name, fn) {
+ DomQuery.fn[name] = function (selector, filter) {
+ var self = this;
+ var result = [];
+ self.each(function () {
+ var nodes = fn.call(result, this, selector, result);
+ if (nodes) {
+ if (DomQuery.isArray(nodes)) {
+ result.push.apply(result, nodes);
+ } else {
+ result.push(nodes);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- --cnt;
- n = sibling;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (how != CLONE) {
- self.setStartAfter(startAncestor);
- self.collapse(TRUE);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ if (this.length > 1) {
+ result = DomQuery.unique(result);
+ if (name.indexOf('parents') === 0 || name === 'prevUntil') {
+ result = result.reverse();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return frag;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _traverseCommonAncestors(startAncestor, endAncestor, how) {
- var n, frag, startOffset, endOffset, cnt, sibling, nextSibling;
-
- if (how != DELETE) {
- frag = createDocumentFragment();
- }
-
- n = _traverseLeftBoundary(startAncestor, how);
- if (frag) {
- frag.appendChild(n);
- }
-
- startOffset = nodeIndex(startAncestor);
- endOffset = nodeIndex(endAncestor);
- ++startOffset;
-
- cnt = endOffset - startOffset;
- sibling = startAncestor.nextSibling;
-
- while (cnt > 0) {
- nextSibling = sibling.nextSibling;
- n = _traverseFullySelected(sibling, how);
-
- if (frag) {
- frag.appendChild(n);
- }
-
- sibling = nextSibling;
- --cnt;
- }
-
- n = _traverseRightBoundary(endAncestor, how);
-
- if (frag) {
- frag.appendChild(n);
- }
-
- if (how != CLONE) {
- self.setStartAfter(startAncestor);
- self.collapse(TRUE);
- }
-
- return frag;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ result = DomQuery(result);
+ if (filter) {
+ return result.filter(filter);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _traverseRightBoundary(root, how) {
- var next = _getSelectedNode(self[END_CONTAINER], self[END_OFFSET] - 1), parent, clonedParent;
- var prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != self[END_CONTAINER];
-
- if (next == root) {
- return _traverseNode(next, isFullySelected, FALSE, how);
- }
-
- parent = next.parentNode;
- clonedParent = _traverseNode(parent, FALSE, FALSE, how);
-
- while (parent) {
- while (next) {
- prevSibling = next.previousSibling;
- clonedChild = _traverseNode(next, isFullySelected, FALSE, how);
-
- if (how != DELETE) {
- clonedParent.insertBefore(clonedChild, clonedParent.firstChild);
- }
-
- isFullySelected = TRUE;
- next = prevSibling;
- }
-
- if (parent == root) {
- return clonedParent;
- }
-
- next = parent.previousSibling;
- parent = parent.parentNode;
-
- clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how);
-
- if (how != DELETE) {
- clonedGrandParent.appendChild(clonedParent);
- }
-
- clonedParent = clonedGrandParent;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return result;
+ };
+ });
+ DomQuery.fn.is = function (selector) {
+ return !!selector && this.filter(selector).length > 0;
+ };
+ DomQuery.fn.init.prototype = DomQuery.fn;
+ DomQuery.overrideDefaults = function (callback) {
+ var defaults;
+ var sub = function (selector, context) {
+ defaults = defaults || callback();
+ if (arguments.length === 0) {
+ selector = defaults.element;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _traverseLeftBoundary(root, how) {
- var next = _getSelectedNode(self[START_CONTAINER], self[START_OFFSET]), isFullySelected = next != self[START_CONTAINER];
- var parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;
-
- if (next == root) {
- return _traverseNode(next, isFullySelected, TRUE, how);
- }
-
- parent = next.parentNode;
- clonedParent = _traverseNode(parent, FALSE, TRUE, how);
-
- while (parent) {
- while (next) {
- nextSibling = next.nextSibling;
- clonedChild = _traverseNode(next, isFullySelected, TRUE, how);
-
- if (how != DELETE) {
- clonedParent.appendChild(clonedChild);
- }
-
- isFullySelected = TRUE;
- next = nextSibling;
- }
-
- if (parent == root) {
- return clonedParent;
- }
-
- next = parent.nextSibling;
- parent = parent.parentNode;
-
- clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how);
-
- if (how != DELETE) {
- clonedGrandParent.appendChild(clonedParent);
- }
-
- clonedParent = clonedGrandParent;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!context) {
+ context = defaults.context;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _traverseNode(n, isFullySelected, isLeft, how) {
- var txtValue, newNodeValue, oldNodeValue, offset, newNode;
-
- if (isFullySelected) {
- return _traverseFullySelected(n, how);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return new sub.fn.init(selector, context);
+ };
+ DomQuery.extend(sub, this);
+ return sub;
+ };
+ var appendHooks = function (targetHooks, prop, hooks) {
+ each$2(hooks, function (name, func) {
+ targetHooks[name] = targetHooks[name] || {};
+ targetHooks[name][prop] = func;
+ });
+ };
+ if ($_9fhi43ajfuw8l13.ie && $_9fhi43ajfuw8l13.ie < 8) {
+ appendHooks(attrHooks, 'get', {
+ maxlength: function (elm) {
+ var value = elm.maxLength;
+ if (value === 2147483647) {
+ return undefined;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // TEXT_NODE
- if (n.nodeType == 3) {
- txtValue = n.nodeValue;
-
- if (isLeft) {
- offset = self[START_OFFSET];
- newNodeValue = txtValue.substring(offset);
- oldNodeValue = txtValue.substring(0, offset);
- } else {
- offset = self[END_OFFSET];
- newNodeValue = txtValue.substring(0, offset);
- oldNodeValue = txtValue.substring(offset);
- }
-
- if (how != CLONE) {
- n.nodeValue = oldNodeValue;
- }
-
- if (how == DELETE) {
- return;
- }
-
- newNode = dom.clone(n, FALSE);
- newNode.nodeValue = newNodeValue;
-
- return newNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return value;
+ },
+ size: function (elm) {
+ var value = elm.size;
+ if (value === 20) {
+ return undefined;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (how == DELETE) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return value;
+ },
+ class: function (elm) {
+ return elm.className;
+ },
+ style: function (elm) {
+ var value = elm.style.cssText;
+ if (value.length === 0) {
+ return undefined;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return dom.clone(n, FALSE);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function _traverseFullySelected(n, how) {
- if (how != DELETE) {
- return how == CLONE ? dom.clone(n, TRUE) : n;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ appendHooks(attrHooks, 'set', {
+ class: function (elm, value) {
+ elm.className = value;
+ },
+ style: function (elm, value) {
+ elm.style.cssText = value;
+ }
+ });
+ }
+ if ($_9fhi43ajfuw8l13.ie && $_9fhi43ajfuw8l13.ie < 9) {
+ cssFix.float = 'styleFloat';
+ appendHooks(cssHooks, 'set', {
+ opacity: function (elm, value) {
+ var style = elm.style;
+ if (value === null || value === '') {
+ style.removeAttribute('filter');
+ } else {
+ style.zoom = 1;
+ style.filter = 'alpha(opacity=' + value * 100 + ')';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- n.parentNode.removeChild(n);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ DomQuery.attrHooks = attrHooks;
+ DomQuery.cssHooks = cssHooks;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function toStringIE() {
- return dom.create('body', null, cloneContents()).outerText;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var cached = function (f) {
+ var called = false;
+ var r;
+ return function () {
+ if (!called) {
+ called = true;
+ r = f.apply(null, arguments);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return r;
+ };
+ };
+ var $_fsjpd3ojfuw8l7r = { cached: cached };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- extend(self, {
- // Initial states
- startContainer: doc,
- startOffset: 0,
- endContainer: doc,
- endOffset: 0,
- collapsed: TRUE,
- commonAncestorContainer: doc,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var firstMatch = function (regexes, s) {
+ for (var i = 0; i < regexes.length; i++) {
+ var x = regexes[i];
+ if (x.test(s))
+ return x;
+ }
+ return undefined;
+ };
+ var find$2 = function (regexes, agent) {
+ var r = firstMatch(regexes, agent);
+ if (!r)
+ return {
+ major: 0,
+ minor: 0
+ };
+ var group = function (i) {
+ return Number(agent.replace(r, '$' + i));
+ };
+ return nu(group(1), group(2));
+ };
+ var detect = function (versionRegexes, agent) {
+ var cleanedAgent = String(agent).toLowerCase();
+ if (versionRegexes.length === 0)
+ return unknown();
+ return find$2(versionRegexes, cleanedAgent);
+ };
+ var unknown = function () {
+ return nu(0, 0);
+ };
+ var nu = function (major, minor) {
+ return {
+ major: major,
+ minor: minor
+ };
+ };
+ var $_anp2zprjfuw8l8b = {
+ nu: nu,
+ detect: detect,
+ unknown: unknown
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Range constants
- START_TO_START: 0,
- START_TO_END: 1,
- END_TO_END: 2,
- END_TO_START: 3,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var edge = 'Edge';
+ var chrome = 'Chrome';
+ var ie$1 = 'IE';
+ var opera$1 = 'Opera';
+ var firefox = 'Firefox';
+ var safari = 'Safari';
+ var isBrowser = function (name, current) {
+ return function () {
+ return current === name;
+ };
+ };
+ var unknown$1 = function () {
+ return nu$1({
+ current: undefined,
+ version: $_anp2zprjfuw8l8b.unknown()
+ });
+ };
+ var nu$1 = function (info) {
+ var current = info.current;
+ var version = info.version;
+ return {
+ current: current,
+ version: version,
+ isEdge: isBrowser(edge, current),
+ isChrome: isBrowser(chrome, current),
+ isIE: isBrowser(ie$1, current),
+ isOpera: isBrowser(opera$1, current),
+ isFirefox: isBrowser(firefox, current),
+ isSafari: isBrowser(safari, current)
+ };
+ };
+ var $_93hntrqjfuw8l87 = {
+ unknown: unknown$1,
+ nu: nu$1,
+ edge: $_68e81l6jfuw8kyc.constant(edge),
+ chrome: $_68e81l6jfuw8kyc.constant(chrome),
+ ie: $_68e81l6jfuw8kyc.constant(ie$1),
+ opera: $_68e81l6jfuw8kyc.constant(opera$1),
+ firefox: $_68e81l6jfuw8kyc.constant(firefox),
+ safari: $_68e81l6jfuw8kyc.constant(safari)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Public methods
- setStart: setStart,
- setEnd: setEnd,
- setStartBefore: setStartBefore,
- setStartAfter: setStartAfter,
- setEndBefore: setEndBefore,
- setEndAfter: setEndAfter,
- collapse: collapse,
- selectNode: selectNode,
- selectNodeContents: selectNodeContents,
- compareBoundaryPoints: compareBoundaryPoints,
- deleteContents: deleteContents,
- extractContents: extractContents,
- cloneContents: cloneContents,
- insertNode: insertNode,
- surroundContents: surroundContents,
- cloneRange: cloneRange,
- toStringIE: toStringIE
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var windows = 'Windows';
+ var ios = 'iOS';
+ var android$1 = 'Android';
+ var linux = 'Linux';
+ var osx = 'OSX';
+ var solaris = 'Solaris';
+ var freebsd = 'FreeBSD';
+ var isOS = function (name, current) {
+ return function () {
+ return current === name;
+ };
+ };
+ var unknown$2 = function () {
+ return nu$2({
+ current: undefined,
+ version: $_anp2zprjfuw8l8b.unknown()
+ });
+ };
+ var nu$2 = function (info) {
+ var current = info.current;
+ var version = info.version;
+ return {
+ current: current,
+ version: version,
+ isWindows: isOS(windows, current),
+ isiOS: isOS(ios, current),
+ isAndroid: isOS(android$1, current),
+ isOSX: isOS(osx, current),
+ isLinux: isOS(linux, current),
+ isSolaris: isOS(solaris, current),
+ isFreeBSD: isOS(freebsd, current)
+ };
+ };
+ var $_7sklw6sjfuw8l8e = {
+ unknown: unknown$2,
+ nu: nu$2,
+ windows: $_68e81l6jfuw8kyc.constant(windows),
+ ios: $_68e81l6jfuw8kyc.constant(ios),
+ android: $_68e81l6jfuw8kyc.constant(android$1),
+ linux: $_68e81l6jfuw8kyc.constant(linux),
+ osx: $_68e81l6jfuw8kyc.constant(osx),
+ solaris: $_68e81l6jfuw8kyc.constant(solaris),
+ freebsd: $_68e81l6jfuw8kyc.constant(freebsd)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return self;
- }
-
- // Older IE versions doesn't let you override toString by it's constructor so we have to stick it in the prototype
- Range.prototype.toString = function () {
- return this.toStringIE();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function DeviceType (os, browser, userAgent) {
+ var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
+ var isiPhone = os.isiOS() && !isiPad;
+ var isAndroid3 = os.isAndroid() && os.version.major === 3;
+ var isAndroid4 = os.isAndroid() && os.version.major === 4;
+ var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true;
+ var isTouch = os.isiOS() || os.isAndroid();
+ var isPhone = isTouch && !isTablet;
+ var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
+ return {
+ isiPad: $_68e81l6jfuw8kyc.constant(isiPad),
+ isiPhone: $_68e81l6jfuw8kyc.constant(isiPhone),
+ isTablet: $_68e81l6jfuw8kyc.constant(isTablet),
+ isPhone: $_68e81l6jfuw8kyc.constant(isPhone),
+ isTouch: $_68e81l6jfuw8kyc.constant(isTouch),
+ isAndroid: os.isAndroid,
+ isiOS: os.isiOS,
+ isWebView: $_68e81l6jfuw8kyc.constant(iOSwebview)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Range;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-defineGlobal("global!Object", Object);
-define(
- 'ephox.katamari.api.Option',
-
- [
- 'ephox.katamari.api.Fun',
- 'global!Object'
- ],
-
- function (Fun, Object) {
-
- var never = Fun.never;
- var always = Fun.always;
-
- /**
- Option objects support the following methods:
-
- fold :: this Option a -> ((() -> b, a -> b)) -> Option b
-
- is :: this Option a -> a -> Boolean
-
- isSome :: this Option a -> () -> Boolean
-
- isNone :: this Option a -> () -> Boolean
-
- getOr :: this Option a -> a -> a
-
- getOrThunk :: this Option a -> (() -> a) -> a
-
- getOrDie :: this Option a -> String -> a
-
- or :: this Option a -> Option a -> Option a
- - if some: return self
- - if none: return opt
-
- orThunk :: this Option a -> (() -> Option a) -> Option a
- - Same as "or", but uses a thunk instead of a value
-
- map :: this Option a -> (a -> b) -> Option b
- - "fmap" operation on the Option Functor.
- - same as 'each'
-
- ap :: this Option a -> Option (a -> b) -> Option b
- - "apply" operation on the Option Apply/Applicative.
- - Equivalent to <*> in Haskell/PureScript.
-
- each :: this Option a -> (a -> b) -> Option b
- - same as 'map'
-
- bind :: this Option a -> (a -> Option b) -> Option b
- - "bind"/"flatMap" operation on the Option Bind/Monad.
- - Equivalent to >>= in Haskell/PureScript; flatMap in Scala.
-
- flatten :: {this Option (Option a))} -> () -> Option a
- - "flatten"/"join" operation on the Option Monad.
-
- exists :: this Option a -> (a -> Boolean) -> Boolean
-
- forall :: this Option a -> (a -> Boolean) -> Boolean
-
- filter :: this Option a -> (a -> Boolean) -> Option a
-
- equals :: this Option a -> Option a -> Boolean
-
- equals_ :: this Option a -> (Option a, a -> Boolean) -> Boolean
-
- toArray :: this Option a -> () -> [a]
-
- */
-
- var none = function () { return NONE; };
-
- var NONE = (function () {
- var eq = function (o) {
- return o.isNone();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var detect$1 = function (candidates, userAgent) {
+ var agent = String(userAgent).toLowerCase();
+ return $_9ek1bp4jfuw8kxg.find(candidates, function (candidate) {
+ return candidate.search(agent);
+ });
+ };
+ var detectBrowser = function (browsers, userAgent) {
+ return detect$1(browsers, userAgent).map(function (browser) {
+ var version = $_anp2zprjfuw8l8b.detect(browser.versionRegexes, userAgent);
+ return {
+ current: browser.name,
+ version: version
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // inlined from peanut, maybe a micro-optimisation?
- var call = function (thunk) { return thunk(); };
- var id = function (n) { return n; };
- var noop = function () { };
-
- var me = {
- fold: function (n, s) { return n(); },
- is: never,
- isSome: never,
- isNone: always,
- getOr: id,
- getOrThunk: call,
- getOrDie: function (msg) {
- throw new Error(msg || 'error: getOrDie called on none.');
- },
- or: id,
- orThunk: call,
- map: none,
- ap: none,
- each: noop,
- bind: none,
- flatten: none,
- exists: never,
- forall: always,
- filter: none,
- equals: eq,
- equals_: eq,
- toArray: function () { return []; },
- toString: Fun.constant("none()")
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var detectOs = function (oses, userAgent) {
+ return detect$1(oses, userAgent).map(function (os) {
+ var version = $_anp2zprjfuw8l8b.detect(os.versionRegexes, userAgent);
+ return {
+ current: os.name,
+ version: version
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (Object.freeze) Object.freeze(me);
- return me;
- })();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var $_btz1g4ujfuw8l8n = {
+ detectBrowser: detectBrowser,
+ detectOs: detectOs
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addToStart = function (str, prefix) {
+ return prefix + str;
+ };
+ var addToEnd = function (str, suffix) {
+ return str + suffix;
+ };
+ var removeFromStart = function (str, numChars) {
+ return str.substring(numChars);
+ };
+ var removeFromEnd = function (str, numChars) {
+ return str.substring(0, str.length - numChars);
+ };
+ var $_dsovrexjfuw8l95 = {
+ addToStart: addToStart,
+ addToEnd: addToEnd,
+ removeFromStart: removeFromStart,
+ removeFromEnd: removeFromEnd
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** some :: a -> Option a */
- var some = function (a) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var first = function (str, count) {
+ return str.substr(0, count);
+ };
+ var last$2 = function (str, count) {
+ return str.substr(str.length - count, str.length);
+ };
+ var head$1 = function (str) {
+ return str === '' ? Option.none() : Option.some(str.substr(0, 1));
+ };
+ var tail = function (str) {
+ return str === '' ? Option.none() : Option.some(str.substring(1));
+ };
+ var $_179cg9yjfuw8l96 = {
+ first: first,
+ last: last$2,
+ head: head$1,
+ tail: tail
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // inlined from peanut, maybe a micro-optimisation?
- var constant_a = function () { return a; };
-
- var self = function () {
- // can't Fun.constant this one
- return me;
- };
-
- var map = function (f) {
- return some(f(a));
- };
-
- var bind = function (f) {
- return f(a);
- };
-
- var me = {
- fold: function (n, s) { return s(a); },
- is: function (v) { return a === v; },
- isSome: always,
- isNone: never,
- getOr: constant_a,
- getOrThunk: constant_a,
- getOrDie: constant_a,
- or: self,
- orThunk: self,
- map: map,
- ap: function (optfab) {
- return optfab.fold(none, function(fab) {
- return some(fab(a));
- });
- },
- each: function (f) {
- f(a);
- },
- bind: bind,
- flatten: constant_a,
- exists: bind,
- forall: bind,
- filter: function (f) {
- return f(a) ? me : NONE;
- },
- equals: function (o) {
- return o.is(a);
- },
- equals_: function (o, elementEq) {
- return o.fold(
- never,
- function (b) { return elementEq(a, b); }
- );
- },
- toArray: function () {
- return [a];
- },
- toString: function () {
- return 'some(' + a + ')';
- }
- };
- return me;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var checkRange = function (str, substr, start) {
+ if (substr === '')
+ return true;
+ if (str.length < substr.length)
+ return false;
+ var x = str.substr(start, start + substr.length);
+ return x === substr;
+ };
+ var supplant = function (str, obj) {
+ var isStringOrNumber = function (a) {
+ var t = typeof a;
+ return t === 'string' || t === 'number';
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return str.replace(/\${([^{}]*)}/g, function (a, b) {
+ var value = obj[b];
+ return isStringOrNumber(value) ? value : a;
+ });
+ };
+ var removeLeading = function (str, prefix) {
+ return startsWith(str, prefix) ? $_dsovrexjfuw8l95.removeFromStart(str, prefix.length) : str;
+ };
+ var removeTrailing = function (str, prefix) {
+ return endsWith(str, prefix) ? $_dsovrexjfuw8l95.removeFromEnd(str, prefix.length) : str;
+ };
+ var ensureLeading = function (str, prefix) {
+ return startsWith(str, prefix) ? str : $_dsovrexjfuw8l95.addToStart(str, prefix);
+ };
+ var ensureTrailing = function (str, prefix) {
+ return endsWith(str, prefix) ? str : $_dsovrexjfuw8l95.addToEnd(str, prefix);
+ };
+ var contains$2 = function (str, substr) {
+ return str.indexOf(substr) !== -1;
+ };
+ var capitalize = function (str) {
+ return $_179cg9yjfuw8l96.head(str).bind(function (head) {
+ return $_179cg9yjfuw8l96.tail(str).map(function (tail) {
+ return head.toUpperCase() + tail;
+ });
+ }).getOr(str);
+ };
+ var startsWith = function (str, prefix) {
+ return checkRange(str, prefix, 0);
+ };
+ var endsWith = function (str, suffix) {
+ return checkRange(str, suffix, str.length - suffix.length);
+ };
+ var trim$2 = function (str) {
+ return str.replace(/^\s+|\s+$/g, '');
+ };
+ var lTrim = function (str) {
+ return str.replace(/^\s+/g, '');
+ };
+ var rTrim = function (str) {
+ return str.replace(/\s+$/g, '');
+ };
+ var $_e6kxndwjfuw8l91 = {
+ supplant: supplant,
+ startsWith: startsWith,
+ removeLeading: removeLeading,
+ removeTrailing: removeTrailing,
+ ensureLeading: ensureLeading,
+ ensureTrailing: ensureTrailing,
+ endsWith: endsWith,
+ contains: contains$2,
+ trim: trim$2,
+ lTrim: lTrim,
+ rTrim: rTrim,
+ capitalize: capitalize
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /** from :: undefined|null|a -> Option a */
- var from = function (value) {
- return value === null || value === undefined ? NONE : some(value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
+ var checkContains = function (target) {
+ return function (uastring) {
+ return $_e6kxndwjfuw8l91.contains(uastring, target);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var browsers = [
+ {
+ name: 'Edge',
+ versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
+ search: function (uastring) {
+ var monstrosity = $_e6kxndwjfuw8l91.contains(uastring, 'edge/') && $_e6kxndwjfuw8l91.contains(uastring, 'chrome') && $_e6kxndwjfuw8l91.contains(uastring, 'safari') && $_e6kxndwjfuw8l91.contains(uastring, 'applewebkit');
+ return monstrosity;
+ }
+ },
+ {
+ name: 'Chrome',
+ versionRegexes: [
+ /.*?chrome\/([0-9]+)\.([0-9]+).*/,
+ normalVersionRegex
+ ],
+ search: function (uastring) {
+ return $_e6kxndwjfuw8l91.contains(uastring, 'chrome') && !$_e6kxndwjfuw8l91.contains(uastring, 'chromeframe');
+ }
+ },
+ {
+ name: 'IE',
+ versionRegexes: [
+ /.*?msie\ ?([0-9]+)\.([0-9]+).*/,
+ /.*?rv:([0-9]+)\.([0-9]+).*/
+ ],
+ search: function (uastring) {
+ return $_e6kxndwjfuw8l91.contains(uastring, 'msie') || $_e6kxndwjfuw8l91.contains(uastring, 'trident');
+ }
+ },
+ {
+ name: 'Opera',
+ versionRegexes: [
+ normalVersionRegex,
+ /.*?opera\/([0-9]+)\.([0-9]+).*/
+ ],
+ search: checkContains('opera')
+ },
+ {
+ name: 'Firefox',
+ versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
+ search: checkContains('firefox')
+ },
+ {
+ name: 'Safari',
+ versionRegexes: [
+ normalVersionRegex,
+ /.*?cpu os ([0-9]+)_([0-9]+).*/
+ ],
+ search: function (uastring) {
+ return ($_e6kxndwjfuw8l91.contains(uastring, 'safari') || $_e6kxndwjfuw8l91.contains(uastring, 'mobile/')) && $_e6kxndwjfuw8l91.contains(uastring, 'applewebkit');
+ }
+ }
+ ];
+ var oses = [
+ {
+ name: 'Windows',
+ search: checkContains('win'),
+ versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
+ },
+ {
+ name: 'iOS',
+ search: function (uastring) {
+ return $_e6kxndwjfuw8l91.contains(uastring, 'iphone') || $_e6kxndwjfuw8l91.contains(uastring, 'ipad');
+ },
+ versionRegexes: [
+ /.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
+ /.*cpu os ([0-9]+)_([0-9]+).*/,
+ /.*cpu iphone os ([0-9]+)_([0-9]+).*/
+ ]
+ },
+ {
+ name: 'Android',
+ search: checkContains('android'),
+ versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
+ },
+ {
+ name: 'OSX',
+ search: checkContains('os x'),
+ versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]
+ },
+ {
+ name: 'Linux',
+ search: checkContains('linux'),
+ versionRegexes: []
+ },
+ {
+ name: 'Solaris',
+ search: checkContains('sunos'),
+ versionRegexes: []
+ },
+ {
+ name: 'FreeBSD',
+ search: checkContains('freebsd'),
+ versionRegexes: []
+ }
+ ];
+ var $_6ctm98vjfuw8l8t = {
+ browsers: $_68e81l6jfuw8kyc.constant(browsers),
+ oses: $_68e81l6jfuw8kyc.constant(oses)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var detect$2 = function (userAgent) {
+ var browsers = $_6ctm98vjfuw8l8t.browsers();
+ var oses = $_6ctm98vjfuw8l8t.oses();
+ var browser = $_btz1g4ujfuw8l8n.detectBrowser(browsers, userAgent).fold($_93hntrqjfuw8l87.unknown, $_93hntrqjfuw8l87.nu);
+ var os = $_btz1g4ujfuw8l8n.detectOs(oses, userAgent).fold($_7sklw6sjfuw8l8e.unknown, $_7sklw6sjfuw8l8e.nu);
+ var deviceType = DeviceType(os, browser, userAgent);
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- some: some,
- none: none,
- from: from
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ browser: browser,
+ os: os,
+ deviceType: deviceType
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_181zxbpjfuw8l86 = { detect: detect$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-defineGlobal("global!String", String);
-define(
- 'ephox.katamari.api.Arr',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var detect$3 = $_fsjpd3ojfuw8l7r.cached(function () {
+ var userAgent = navigator.userAgent;
+ return $_181zxbpjfuw8l86.detect(userAgent);
+ });
+ var $_f1lbzgnjfuw8l7o = { detect: detect$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'ephox.katamari.api.Option',
- 'global!Array',
- 'global!Error',
- 'global!String'
- ],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fromHtml = function (html, scope) {
+ var doc = scope || document;
+ var div = doc.createElement('div');
+ div.innerHTML = html;
+ if (!div.hasChildNodes() || div.childNodes.length > 1) {
+ console.error('HTML does not have a single root node', html);
+ throw 'HTML must have a single root node';
+ }
+ return fromDom(div.childNodes[0]);
+ };
+ var fromTag = function (tag, scope) {
+ var doc = scope || document;
+ var node = doc.createElement(tag);
+ return fromDom(node);
+ };
+ var fromText = function (text, scope) {
+ var doc = scope || document;
+ var node = doc.createTextNode(text);
+ return fromDom(node);
+ };
+ var fromDom = function (node) {
+ if (node === null || node === undefined)
+ throw new Error('Node cannot be null or undefined');
+ return { dom: $_68e81l6jfuw8kyc.constant(node) };
+ };
+ var fromPoint = function (doc, x, y) {
+ return Option.from(doc.dom().elementFromPoint(x, y)).map(fromDom);
+ };
+ var $_c9h6qlzjfuw8l98 = {
+ fromHtml: fromHtml,
+ fromTag: fromTag,
+ fromText: fromText,
+ fromDom: fromDom,
+ fromPoint: fromPoint
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function (Option, Array, Error, String) {
- // Use the native Array.indexOf if it is available (IE9+) otherwise fall back to manual iteration
- // https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
- var rawIndexOf = (function () {
- var pIndexOf = Array.prototype.indexOf;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_adtawu11jfuw8l9g = {
+ ATTRIBUTE: 2,
+ CDATA_SECTION: 4,
+ COMMENT: 8,
+ DOCUMENT: 9,
+ DOCUMENT_TYPE: 10,
+ DOCUMENT_FRAGMENT: 11,
+ ELEMENT: 1,
+ TEXT: 3,
+ PROCESSING_INSTRUCTION: 7,
+ ENTITY_REFERENCE: 5,
+ ENTITY: 6,
+ NOTATION: 12
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var fastIndex = function (xs, x) { return pIndexOf.call(xs, x); };
-
- var slowIndex = function(xs, x) { return slowIndexOf(xs, x); };
-
- return pIndexOf === undefined ? slowIndex : fastIndex;
- })();
-
- var indexOf = function (xs, x) {
- // The rawIndexOf method does not wrap up in an option. This is for performance reasons.
- var r = rawIndexOf(xs, x);
- return r === -1 ? Option.none() : Option.some(r);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var name$1 = function (element) {
+ var r = element.dom().nodeName;
+ return r.toLowerCase();
+ };
+ var type = function (element) {
+ return element.dom().nodeType;
+ };
+ var value = function (element) {
+ return element.dom().nodeValue;
+ };
+ var isType$1 = function (t) {
+ return function (element) {
+ return type(element) === t;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isComment = function (element) {
+ return type(element) === $_adtawu11jfuw8l9g.COMMENT || name$1(element) === '#comment';
+ };
+ var isElement = isType$1($_adtawu11jfuw8l9g.ELEMENT);
+ var isText = isType$1($_adtawu11jfuw8l9g.TEXT);
+ var isDocument = isType$1($_adtawu11jfuw8l9g.DOCUMENT);
+ var $_eaw33d10jfuw8l9f = {
+ name: name$1,
+ type: type,
+ value: value,
+ isElement: isElement,
+ isText: isText,
+ isDocument: isDocument,
+ isComment: isComment
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var contains = function (xs, x) {
- return rawIndexOf(xs, x) > -1;
- };
-
- // Using findIndex is likely less optimal in Chrome (dynamic return type instead of bool)
- // but if we need that micro-optimisation we can inline it later.
- var exists = function (xs, pred) {
- return findIndex(xs, pred).isSome();
- };
-
- var range = function (num, f) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var keys = function () {
+ var fastKeys = Object.keys;
+ var slowKeys = function (o) {
</ins><span class="cx" style="display: block; padding: 0 10px"> var r = [];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- for (var i = 0; i < num; i++) {
- r.push(f(i));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (var i in o) {
+ if (o.hasOwnProperty(i)) {
+ r.push(i);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> return r;
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return fastKeys === undefined ? slowKeys : fastKeys;
+ }();
+ var each$3 = function (obj, f) {
+ var props = keys(obj);
+ for (var k = 0, len = props.length; k < len; k++) {
+ var i = props[k];
+ var x = obj[i];
+ f(x, i, obj);
+ }
+ };
+ var objectMap = function (obj, f) {
+ return tupleMap(obj, function (x, i, obj) {
+ return {
+ k: i,
+ v: f(x, i, obj)
+ };
+ });
+ };
+ var tupleMap = function (obj, f) {
+ var r = {};
+ each$3(obj, function (x, i) {
+ var tuple = f(x, i, obj);
+ r[tuple.k] = tuple.v;
+ });
+ return r;
+ };
+ var bifilter = function (obj, pred) {
+ var t = {};
+ var f = {};
+ each$3(obj, function (x, i) {
+ var branch = pred(x, i) ? t : f;
+ branch[i] = x;
+ });
+ return {
+ t: t,
+ f: f
+ };
+ };
+ var mapToArray = function (obj, f) {
+ var r = [];
+ each$3(obj, function (value, name) {
+ r.push(f(value, name));
+ });
+ return r;
+ };
+ var find$3 = function (obj, pred) {
+ var props = keys(obj);
+ for (var k = 0, len = props.length; k < len; k++) {
+ var i = props[k];
+ var x = obj[i];
+ if (pred(x, i, obj)) {
+ return Option.some(x);
+ }
+ }
+ return Option.none();
+ };
+ var values = function (obj) {
+ return mapToArray(obj, function (v) {
+ return v;
+ });
+ };
+ var size = function (obj) {
+ return values(obj).length;
+ };
+ var $_8c8uhu13jfuw8la0 = {
+ bifilter: bifilter,
+ each: each$3,
+ map: objectMap,
+ mapToArray: mapToArray,
+ tupleMap: tupleMap,
+ find: find$3,
+ keys: keys,
+ values: values,
+ size: size
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // It's a total micro optimisation, but these do make some difference.
- // Particularly for browsers other than Chrome.
- // - length caching
- // http://jsperf.com/browser-diet-jquery-each-vs-for-loop/69
- // - not using push
- // http://jsperf.com/array-direct-assignment-vs-push/2
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var rawSet = function (dom, key, value) {
+ if ($_16i8k47jfuw8kyi.isString(value) || $_16i8k47jfuw8kyi.isBoolean(value) || $_16i8k47jfuw8kyi.isNumber(value)) {
+ dom.setAttribute(key, value + '');
+ } else {
+ console.error('Invalid call to Attr.set. Key ', key, ':: Value ', value, ':: Element ', dom);
+ throw new Error('Attribute value was not simple');
+ }
+ };
+ var set = function (element, key, value) {
+ rawSet(element.dom(), key, value);
+ };
+ var setAll = function (element, attrs) {
+ var dom = element.dom();
+ $_8c8uhu13jfuw8la0.each(attrs, function (v, k) {
+ rawSet(dom, k, v);
+ });
+ };
+ var get = function (element, key) {
+ var v = element.dom().getAttribute(key);
+ return v === null ? undefined : v;
+ };
+ var has = function (element, key) {
+ var dom = element.dom();
+ return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
+ };
+ var remove = function (element, key) {
+ element.dom().removeAttribute(key);
+ };
+ var hasNone = function (element) {
+ var attrs = element.dom().attributes;
+ return attrs === undefined || attrs === null || attrs.length === 0;
+ };
+ var clone = function (element) {
+ return $_9ek1bp4jfuw8kxg.foldl(element.dom().attributes, function (acc, attr) {
+ acc[attr.name] = attr.value;
+ return acc;
+ }, {});
+ };
+ var transferOne = function (source, destination, attr) {
+ if (has(source, attr) && !has(destination, attr))
+ set(destination, attr, get(source, attr));
+ };
+ var transfer = function (source, destination, attrs) {
+ if (!$_eaw33d10jfuw8l9f.isElement(source) || !$_eaw33d10jfuw8l9f.isElement(destination))
+ return;
+ $_9ek1bp4jfuw8kxg.each(attrs, function (attr) {
+ transferOne(source, destination, attr);
+ });
+ };
+ var $_8g002u14jfuw8la5 = {
+ clone: clone,
+ set: set,
+ setAll: setAll,
+ get: get,
+ has: has,
+ remove: remove,
+ hasNone: hasNone,
+ transfer: transfer
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var chunk = function (array, size) {
- var r = [];
- for (var i = 0; i < array.length; i += size) {
- var s = array.slice(i, i + size);
- r.push(s);
- }
- return r;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var inBody = function (element) {
+ var dom = $_eaw33d10jfuw8l9f.isText(element) ? element.dom().parentNode : element.dom();
+ return dom !== undefined && dom !== null && dom.ownerDocument.body.contains(dom);
+ };
+ var body = $_fsjpd3ojfuw8l7r.cached(function () {
+ return getBody($_c9h6qlzjfuw8l98.fromDom(document));
+ });
+ var getBody = function (doc) {
+ var body = doc.dom().body;
+ if (body === null || body === undefined)
+ throw 'Body is not available yet';
+ return $_c9h6qlzjfuw8l98.fromDom(body);
+ };
+ var $_5nbzws15jfuw8lap = {
+ body: body,
+ getBody: getBody,
+ inBody: inBody
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var map = function(xs, f) {
- // pre-allocating array size when it's guaranteed to be known
- // http://jsperf.com/push-allocated-vs-dynamic/22
- var len = xs.length;
- var r = new Array(len);
- for (var i = 0; i < len; i++) {
- var x = xs[i];
- r[i] = f(x, i, xs);
- }
- return r;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isSupported = function (dom) {
+ return dom.style !== undefined;
+ };
+ var $_3xxgy116jfuw8las = { isSupported: isSupported };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Unwound implementing other functions in terms of each.
- // The code size is roughly the same, and it should allow for better optimisation.
- var each = function(xs, f) {
- for (var i = 0, len = xs.length; i < len; i++) {
- var x = xs[i];
- f(x, i, xs);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var internalSet = function (dom, property, value) {
+ if (!$_16i8k47jfuw8kyi.isString(value)) {
+ console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
+ throw new Error('CSS value must be a string: ' + value);
+ }
+ if ($_3xxgy116jfuw8las.isSupported(dom))
+ dom.style.setProperty(property, value);
+ };
+ var internalRemove = function (dom, property) {
+ if ($_3xxgy116jfuw8las.isSupported(dom))
+ dom.style.removeProperty(property);
+ };
+ var set$1 = function (element, property, value) {
+ var dom = element.dom();
+ internalSet(dom, property, value);
+ };
+ var setAll$1 = function (element, css) {
+ var dom = element.dom();
+ $_8c8uhu13jfuw8la0.each(css, function (v, k) {
+ internalSet(dom, k, v);
+ });
+ };
+ var setOptions = function (element, css) {
+ var dom = element.dom();
+ $_8c8uhu13jfuw8la0.each(css, function (v, k) {
+ v.fold(function () {
+ internalRemove(dom, k);
+ }, function (value) {
+ internalSet(dom, k, value);
+ });
+ });
+ };
+ var get$1 = function (element, property) {
+ var dom = element.dom();
+ var styles = window.getComputedStyle(dom);
+ var r = styles.getPropertyValue(property);
+ var v = r === '' && !$_5nbzws15jfuw8lap.inBody(element) ? getUnsafeProperty(dom, property) : r;
+ return v === null ? undefined : v;
+ };
+ var getUnsafeProperty = function (dom, property) {
+ return $_3xxgy116jfuw8las.isSupported(dom) ? dom.style.getPropertyValue(property) : '';
+ };
+ var getRaw = function (element, property) {
+ var dom = element.dom();
+ var raw = getUnsafeProperty(dom, property);
+ return Option.from(raw).filter(function (r) {
+ return r.length > 0;
+ });
+ };
+ var getAllRaw = function (element) {
+ var css = {};
+ var dom = element.dom();
+ if ($_3xxgy116jfuw8las.isSupported(dom)) {
+ for (var i = 0; i < dom.style.length; i++) {
+ var ruleName = dom.style.item(i);
+ css[ruleName] = dom.style[ruleName];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return css;
+ };
+ var isValidValue = function (tag, property, value) {
+ var element = $_c9h6qlzjfuw8l98.fromTag(tag);
+ set$1(element, property, value);
+ var style = getRaw(element, property);
+ return style.isSome();
+ };
+ var remove$1 = function (element, property) {
+ var dom = element.dom();
+ internalRemove(dom, property);
+ if ($_8g002u14jfuw8la5.has(element, 'style') && $_e6kxndwjfuw8l91.trim($_8g002u14jfuw8la5.get(element, 'style')) === '') {
+ $_8g002u14jfuw8la5.remove(element, 'style');
+ }
+ };
+ var preserve = function (element, f) {
+ var oldStyles = $_8g002u14jfuw8la5.get(element, 'style');
+ var result = f(element);
+ var restore = oldStyles === undefined ? $_8g002u14jfuw8la5.remove : $_8g002u14jfuw8la5.set;
+ restore(element, 'style', oldStyles);
+ return result;
+ };
+ var copy = function (source, target) {
+ var sourceDom = source.dom();
+ var targetDom = target.dom();
+ if ($_3xxgy116jfuw8las.isSupported(sourceDom) && $_3xxgy116jfuw8las.isSupported(targetDom)) {
+ targetDom.style.cssText = sourceDom.style.cssText;
+ }
+ };
+ var reflow = function (e) {
+ return e.dom().offsetWidth;
+ };
+ var transferOne$1 = function (source, destination, style) {
+ getRaw(source, style).each(function (value) {
+ if (getRaw(destination, style).isNone())
+ set$1(destination, style, value);
+ });
+ };
+ var transfer$1 = function (source, destination, styles) {
+ if (!$_eaw33d10jfuw8l9f.isElement(source) || !$_eaw33d10jfuw8l9f.isElement(destination))
+ return;
+ $_9ek1bp4jfuw8kxg.each(styles, function (style) {
+ transferOne$1(source, destination, style);
+ });
+ };
+ var $_cworr512jfuw8l9j = {
+ copy: copy,
+ set: set$1,
+ preserve: preserve,
+ setAll: setAll$1,
+ setOptions: setOptions,
+ remove: remove$1,
+ get: get$1,
+ getRaw: getRaw,
+ getAllRaw: getAllRaw,
+ isValidValue: isValidValue,
+ reflow: reflow,
+ transfer: transfer$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var eachr = function (xs, f) {
- for (var i = xs.length - 1; i >= 0; i--) {
- var x = xs[i];
- f(x, i, xs);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function Immutable () {
+ var fields = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ fields[_i] = arguments[_i];
+ }
+ return function () {
+ var values = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ values[_i] = arguments[_i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var partition = function(xs, pred) {
- var pass = [];
- var fail = [];
- for (var i = 0, len = xs.length; i < len; i++) {
- var x = xs[i];
- var arr = pred(x, i, xs) ? pass : fail;
- arr.push(x);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (fields.length !== values.length) {
+ throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return { pass: pass, fail: fail };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var struct = {};
+ $_9ek1bp4jfuw8kxg.each(fields, function (name, i) {
+ struct[name] = $_68e81l6jfuw8kyc.constant(values[i]);
+ });
+ return struct;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var filter = function(xs, pred) {
- var r = [];
- for (var i = 0, len = xs.length; i < len; i++) {
- var x = xs[i];
- if (pred(x, i, xs)) {
- r.push(x);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var sort$1 = function (arr) {
+ return arr.slice(0).sort();
+ };
+ var reqMessage = function (required, keys) {
+ throw new Error('All required keys (' + sort$1(required).join(', ') + ') were not specified. Specified keys were: ' + sort$1(keys).join(', ') + '.');
+ };
+ var unsuppMessage = function (unsupported) {
+ throw new Error('Unsupported keys for object: ' + sort$1(unsupported).join(', '));
+ };
+ var validateStrArr = function (label, array) {
+ if (!$_16i8k47jfuw8kyi.isArray(array))
+ throw new Error('The ' + label + ' fields must be an array. Was: ' + array + '.');
+ $_9ek1bp4jfuw8kxg.each(array, function (a) {
+ if (!$_16i8k47jfuw8kyi.isString(a))
+ throw new Error('The value ' + a + ' in the ' + label + ' fields was not a string.');
+ });
+ };
+ var invalidTypeMessage = function (incorrect, type) {
+ throw new Error('All values need to be of type: ' + type + '. Keys (' + sort$1(incorrect).join(', ') + ') were not.');
+ };
+ var checkDupes = function (everything) {
+ var sorted = sort$1(everything);
+ var dupe = $_9ek1bp4jfuw8kxg.find(sorted, function (s, i) {
+ return i < sorted.length - 1 && s === sorted[i + 1];
+ });
+ dupe.each(function (d) {
+ throw new Error('The field: ' + d + ' occurs more than once in the combined fields: [' + sorted.join(', ') + '].');
+ });
+ };
+ var $_3gh3fe1bjfuw8lbh = {
+ sort: sort$1,
+ reqMessage: reqMessage,
+ unsuppMessage: unsuppMessage,
+ validateStrArr: validateStrArr,
+ invalidTypeMessage: invalidTypeMessage,
+ checkDupes: checkDupes
+ };
+
+ function MixedBag (required, optional) {
+ var everything = required.concat(optional);
+ if (everything.length === 0)
+ throw new Error('You must specify at least one required or optional field.');
+ $_3gh3fe1bjfuw8lbh.validateStrArr('required', required);
+ $_3gh3fe1bjfuw8lbh.validateStrArr('optional', optional);
+ $_3gh3fe1bjfuw8lbh.checkDupes(everything);
+ return function (obj) {
+ var keys = $_8c8uhu13jfuw8la0.keys(obj);
+ var allReqd = $_9ek1bp4jfuw8kxg.forall(required, function (req) {
+ return $_9ek1bp4jfuw8kxg.contains(keys, req);
+ });
+ if (!allReqd)
+ $_3gh3fe1bjfuw8lbh.reqMessage(required, keys);
+ var unsupported = $_9ek1bp4jfuw8kxg.filter(keys, function (key) {
+ return !$_9ek1bp4jfuw8kxg.contains(everything, key);
+ });
+ if (unsupported.length > 0)
+ $_3gh3fe1bjfuw8lbh.unsuppMessage(unsupported);
+ var r = {};
+ $_9ek1bp4jfuw8kxg.each(required, function (req) {
+ r[req] = $_68e81l6jfuw8kyc.constant(obj[req]);
+ });
+ $_9ek1bp4jfuw8kxg.each(optional, function (opt) {
+ r[opt] = $_68e81l6jfuw8kyc.constant(Object.prototype.hasOwnProperty.call(obj, opt) ? Option.some(obj[opt]) : Option.none());
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> return r;
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /*
- * Groups an array into contiguous arrays of like elements. Whether an element is like or not depends on f.
- *
- * f is a function that derives a value from an element - e.g. true or false, or a string.
- * Elements are like if this function generates the same value for them (according to ===).
- *
- *
- * Order of the elements is preserved. Arr.flatten() on the result will return the original list, as with Haskell groupBy function.
- * For a good explanation, see the group function (which is a special case of groupBy)
- * http://hackage.haskell.org/package/base-4.7.0.0/docs/Data-List.html#v:group
- */
- var groupBy = function (xs, f) {
- if (xs.length === 0) {
- return [];
- } else {
- var wasType = f(xs[0]); // initial case for matching
- var r = [];
- var group = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_1a7eqh18jfuw8lb9 = {
+ immutable: Immutable,
+ immutableBag: MixedBag
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- for (var i = 0, len = xs.length; i < len; i++) {
- var x = xs[i];
- var type = f(x);
- if (type !== wasType) {
- r.push(group);
- group = [];
- }
- wasType = type;
- group.push(x);
- }
- if (group.length !== 0) {
- r.push(group);
- }
- return r;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toArray$1 = function (target, f) {
+ var r = [];
+ var recurse = function (e) {
+ r.push(e);
+ return f(e);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var cur = f(target);
+ do {
+ cur = cur.bind(recurse);
+ } while (cur.isSome());
+ return r;
+ };
+ var $_3lbkh61cjfuw8lbj = { toArray: toArray$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var foldr = function (xs, f, acc) {
- eachr(xs, function (x) {
- acc = f(acc, x);
- });
- return acc;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var node = function () {
+ var f = $_3hdbe8cjfuw8l1e.getOrDie('Node');
+ return f;
+ };
+ var compareDocumentPosition = function (a, b, match) {
+ return (a.compareDocumentPosition(b) & match) !== 0;
+ };
+ var documentPositionPreceding = function (a, b) {
+ return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);
+ };
+ var documentPositionContainedBy = function (a, b) {
+ return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);
+ };
+ var $_1i92tr1ejfuw8lbv = {
+ documentPositionPreceding: documentPositionPreceding,
+ documentPositionContainedBy: documentPositionContainedBy
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var foldl = function (xs, f, acc) {
- each(xs, function (x) {
- acc = f(acc, x);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ELEMENT = $_adtawu11jfuw8l9g.ELEMENT;
+ var DOCUMENT = $_adtawu11jfuw8l9g.DOCUMENT;
+ var is$1 = function (element, selector) {
+ var elem = element.dom();
+ if (elem.nodeType !== ELEMENT)
+ return false;
+ else if (elem.matches !== undefined)
+ return elem.matches(selector);
+ else if (elem.msMatchesSelector !== undefined)
+ return elem.msMatchesSelector(selector);
+ else if (elem.webkitMatchesSelector !== undefined)
+ return elem.webkitMatchesSelector(selector);
+ else if (elem.mozMatchesSelector !== undefined)
+ return elem.mozMatchesSelector(selector);
+ else
+ throw new Error('Browser lacks native selectors');
+ };
+ var bypassSelector = function (dom) {
+ return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT || dom.childElementCount === 0;
+ };
+ var all = function (selector, scope) {
+ var base = scope === undefined ? document : scope.dom();
+ return bypassSelector(base) ? [] : $_9ek1bp4jfuw8kxg.map(base.querySelectorAll(selector), $_c9h6qlzjfuw8l98.fromDom);
+ };
+ var one = function (selector, scope) {
+ var base = scope === undefined ? document : scope.dom();
+ return bypassSelector(base) ? Option.none() : Option.from(base.querySelector(selector)).map($_c9h6qlzjfuw8l98.fromDom);
+ };
+ var $_fbwcti1fjfuw8lbx = {
+ all: all,
+ is: is$1,
+ one: one
+ };
+
+ var eq = function (e1, e2) {
+ return e1.dom() === e2.dom();
+ };
+ var isEqualNode = function (e1, e2) {
+ return e1.dom().isEqualNode(e2.dom());
+ };
+ var member = function (element, elements) {
+ return $_9ek1bp4jfuw8kxg.exists(elements, $_68e81l6jfuw8kyc.curry(eq, element));
+ };
+ var regularContains = function (e1, e2) {
+ var d1 = e1.dom(), d2 = e2.dom();
+ return d1 === d2 ? false : d1.contains(d2);
+ };
+ var ieContains = function (e1, e2) {
+ return $_1i92tr1ejfuw8lbv.documentPositionContainedBy(e1.dom(), e2.dom());
+ };
+ var browser = $_f1lbzgnjfuw8l7o.detect().browser;
+ var contains$3 = browser.isIE() ? ieContains : regularContains;
+ var $_4fb96d1djfuw8lbl = {
+ eq: eq,
+ isEqualNode: isEqualNode,
+ member: member,
+ contains: contains$3,
+ is: $_fbwcti1fjfuw8lbx.is
+ };
+
+ var owner = function (element) {
+ return $_c9h6qlzjfuw8l98.fromDom(element.dom().ownerDocument);
+ };
+ var documentElement = function (element) {
+ var doc = owner(element);
+ return $_c9h6qlzjfuw8l98.fromDom(doc.dom().documentElement);
+ };
+ var defaultView = function (element) {
+ var el = element.dom();
+ var defaultView = el.ownerDocument.defaultView;
+ return $_c9h6qlzjfuw8l98.fromDom(defaultView);
+ };
+ var parent = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.parentNode).map($_c9h6qlzjfuw8l98.fromDom);
+ };
+ var findIndex$2 = function (element) {
+ return parent(element).bind(function (p) {
+ var kin = children(p);
+ return $_9ek1bp4jfuw8kxg.findIndex(kin, function (elem) {
+ return $_4fb96d1djfuw8lbl.eq(element, elem);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return acc;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var parents = function (element, isRoot) {
+ var stop = $_16i8k47jfuw8kyi.isFunction(isRoot) ? isRoot : $_68e81l6jfuw8kyc.constant(false);
+ var dom = element.dom();
+ var ret = [];
+ while (dom.parentNode !== null && dom.parentNode !== undefined) {
+ var rawParent = dom.parentNode;
+ var parent = $_c9h6qlzjfuw8l98.fromDom(rawParent);
+ ret.push(parent);
+ if (stop(parent) === true)
+ break;
+ else
+ dom = rawParent;
+ }
+ return ret;
+ };
+ var siblings = function (element) {
+ var filterSelf = function (elements) {
+ return $_9ek1bp4jfuw8kxg.filter(elements, function (x) {
+ return !$_4fb96d1djfuw8lbl.eq(element, x);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return parent(element).map(children).map(filterSelf).getOr([]);
+ };
+ var offsetParent = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.offsetParent).map($_c9h6qlzjfuw8l98.fromDom);
+ };
+ var prevSibling = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.previousSibling).map($_c9h6qlzjfuw8l98.fromDom);
+ };
+ var nextSibling = function (element) {
+ var dom = element.dom();
+ return Option.from(dom.nextSibling).map($_c9h6qlzjfuw8l98.fromDom);
+ };
+ var prevSiblings = function (element) {
+ return $_9ek1bp4jfuw8kxg.reverse($_3lbkh61cjfuw8lbj.toArray(element, prevSibling));
+ };
+ var nextSiblings = function (element) {
+ return $_3lbkh61cjfuw8lbj.toArray(element, nextSibling);
+ };
+ var children = function (element) {
+ var dom = element.dom();
+ return $_9ek1bp4jfuw8kxg.map(dom.childNodes, $_c9h6qlzjfuw8l98.fromDom);
+ };
+ var child = function (element, index) {
+ var children = element.dom().childNodes;
+ return Option.from(children[index]).map($_c9h6qlzjfuw8l98.fromDom);
+ };
+ var firstChild = function (element) {
+ return child(element, 0);
+ };
+ var lastChild = function (element) {
+ return child(element, element.dom().childNodes.length - 1);
+ };
+ var childNodesCount = function (element) {
+ return element.dom().childNodes.length;
+ };
+ var hasChildNodes = function (element) {
+ return element.dom().hasChildNodes();
+ };
+ var spot = $_1a7eqh18jfuw8lb9.immutable('element', 'offset');
+ var leaf = function (element, offset) {
+ var cs = children(element);
+ return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
+ };
+ var $_2j4g5u17jfuw8lav = {
+ owner: owner,
+ defaultView: defaultView,
+ documentElement: documentElement,
+ parent: parent,
+ findIndex: findIndex$2,
+ parents: parents,
+ siblings: siblings,
+ prevSibling: prevSibling,
+ offsetParent: offsetParent,
+ prevSiblings: prevSiblings,
+ nextSibling: nextSibling,
+ nextSiblings: nextSiblings,
+ children: children,
+ child: child,
+ firstChild: firstChild,
+ lastChild: lastChild,
+ childNodesCount: childNodesCount,
+ hasChildNodes: hasChildNodes,
+ leaf: leaf
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var find = function (xs, pred) {
- for (var i = 0, len = xs.length; i < len; i++) {
- var x = xs[i];
- if (pred(x, i, xs)) {
- return Option.some(x);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var browser$1 = $_f1lbzgnjfuw8l7o.detect().browser;
+ var firstElement = function (nodes) {
+ return $_9ek1bp4jfuw8kxg.find(nodes, $_eaw33d10jfuw8l9f.isElement);
+ };
+ var getTableCaptionDeltaY = function (elm) {
+ if (browser$1.isFirefox() && $_eaw33d10jfuw8l9f.name(elm) === 'table') {
+ return firstElement($_2j4g5u17jfuw8lav.children(elm)).filter(function (elm) {
+ return $_eaw33d10jfuw8l9f.name(elm) === 'caption';
+ }).bind(function (caption) {
+ return firstElement($_2j4g5u17jfuw8lav.nextSiblings(caption)).map(function (body) {
+ var bodyTop = body.dom().offsetTop;
+ var captionTop = caption.dom().offsetTop;
+ var captionHeight = caption.dom().offsetHeight;
+ return bodyTop <= captionTop ? -captionHeight : 0;
+ });
+ }).getOr(0);
+ } else {
+ return 0;
+ }
+ };
+ var getPos = function (body, elm, rootElm) {
+ var x = 0, y = 0, offsetParent;
+ var doc = body.ownerDocument;
+ var pos;
+ rootElm = rootElm ? rootElm : body;
+ if (elm) {
+ if (rootElm === body && elm.getBoundingClientRect && $_cworr512jfuw8l9j.get($_c9h6qlzjfuw8l98.fromDom(body), 'position') === 'static') {
+ pos = elm.getBoundingClientRect();
+ x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - doc.documentElement.clientLeft;
+ y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - doc.documentElement.clientTop;
+ return {
+ x: x,
+ y: y
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Option.none();
- };
-
- var findIndex = function (xs, pred) {
- for (var i = 0, len = xs.length; i < len; i++) {
- var x = xs[i];
- if (pred(x, i, xs)) {
- return Option.some(i);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ offsetParent = elm;
+ while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType) {
+ x += offsetParent.offsetLeft || 0;
+ y += offsetParent.offsetTop || 0;
+ offsetParent = offsetParent.offsetParent;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Option.none();
- };
-
- var slowIndexOf = function (xs, x) {
- for (var i = 0, len = xs.length; i < len; ++i) {
- if (xs[i] === x) {
- return i;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ offsetParent = elm.parentNode;
+ while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType) {
+ x -= offsetParent.scrollLeft || 0;
+ y -= offsetParent.scrollTop || 0;
+ offsetParent = offsetParent.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return -1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ y += getTableCaptionDeltaY($_c9h6qlzjfuw8l98.fromDom(elm));
+ }
+ return {
+ x: x,
+ y: y
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_4nsusvmjfuw8l7a = { getPos: getPos };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var push = Array.prototype.push;
- var flatten = function (xs) {
- // Note, this is possible because push supports multiple arguments:
- // http://jsperf.com/concat-push/6
- // Note that in the past, concat() would silently work (very slowly) for array-like objects.
- // With this change it will throw an error.
- var r = [];
- for (var i = 0, len = xs.length; i < len; ++i) {
- // Ensure that each value is an array itself
- if (! Array.prototype.isPrototypeOf(xs[i])) throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
- push.apply(r, xs[i]);
- }
- return r;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var nu$3 = function (baseFn) {
+ var data = Option.none();
+ var callbacks = [];
+ var map = function (f) {
+ return nu$3(function (nCallback) {
+ get(function (data) {
+ nCallback(f(data));
+ });
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var bind = function (xs, f) {
- var output = map(xs, f);
- return flatten(output);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get = function (nCallback) {
+ if (isReady())
+ call(nCallback);
+ else
+ callbacks.push(nCallback);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var forall = function (xs, pred) {
- for (var i = 0, len = xs.length; i < len; ++i) {
- var x = xs[i];
- if (pred(x, i, xs) !== true) {
- return false;
- }
- }
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var set = function (x) {
+ data = Option.some(x);
+ run(callbacks);
+ callbacks = [];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var equal = function (a1, a2) {
- return a1.length === a2.length && forall(a1, function (x, i) {
- return x === a2[i];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isReady = function () {
+ return data.isSome();
+ };
+ var run = function (cbs) {
+ $_9ek1bp4jfuw8kxg.each(cbs, call);
+ };
+ var call = function (cb) {
+ data.each(function (x) {
+ setTimeout(function () {
+ cb(x);
+ }, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ baseFn(set);
+ return {
+ get: get,
+ map: map,
+ isReady: isReady
+ };
+ };
+ var pure$1 = function (a) {
+ return nu$3(function (callback) {
+ callback(a);
+ });
+ };
+ var LazyValue = {
+ nu: nu$3,
+ pure: pure$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var slice = Array.prototype.slice;
- var reverse = function (xs) {
- var r = slice.call(xs, 0);
- r.reverse();
- return r;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var bounce = function (f) {
+ return function () {
+ var args = Array.prototype.slice.call(arguments);
+ var me = this;
+ setTimeout(function () {
+ f.apply(me, args);
+ }, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_erz7cb1jjfuw8lcl = { bounce: bounce };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var difference = function (a1, a2) {
- return filter(a1, function (x) {
- return !contains(a2, x);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var nu$4 = function (baseFn) {
+ var get = function (callback) {
+ baseFn($_erz7cb1jjfuw8lcl.bounce(callback));
+ };
+ var map = function (fab) {
+ return nu$4(function (callback) {
+ get(function (a) {
+ var value = fab(a);
+ callback(value);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var mapToObject = function(xs, f) {
- var r = {};
- for (var i = 0, len = xs.length; i < len; i++) {
- var x = xs[i];
- r[String(x)] = f(x, i);
- }
- return r;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var bind = function (aFutureB) {
+ return nu$4(function (callback) {
+ get(function (a) {
+ aFutureB(a).get(callback);
+ });
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var pure = function(x) {
- return [x];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var anonBind = function (futureB) {
+ return nu$4(function (callback) {
+ get(function (a) {
+ futureB.get(callback);
+ });
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var sort = function (xs, comparator) {
- var copy = slice.call(xs, 0);
- copy.sort(comparator);
- return copy;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toLazy = function () {
+ return LazyValue.nu(get);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><span class="cx" style="display: block; padding: 0 10px"> map: map,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- each: each,
- eachr: eachr,
- partition: partition,
- filter: filter,
- groupBy: groupBy,
- indexOf: indexOf,
- foldr: foldr,
- foldl: foldl,
- find: find,
- findIndex: findIndex,
- flatten: flatten,
</del><span class="cx" style="display: block; padding: 0 10px"> bind: bind,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- forall: forall,
- exists: exists,
- contains: contains,
- equal: equal,
- reverse: reverse,
- chunk: chunk,
- difference: difference,
- mapToObject: mapToObject,
- pure: pure,
- sort: sort,
- range: range
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ anonBind: anonBind,
+ toLazy: toLazy,
+ get: get
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-defineGlobal("global!setTimeout", setTimeout);
-define(
- 'ephox.katamari.api.LazyValue',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var pure$2 = function (a) {
+ return nu$4(function (callback) {
+ callback(a);
+ });
+ };
+ var Future = {
+ nu: nu$4,
+ pure: pure$2
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Option',
- 'global!setTimeout'
- ],
-
- function (Arr, Option, setTimeout) {
- var nu = function (baseFn) {
- var data = Option.none();
- var callbacks = [];
-
- /** map :: this LazyValue a -> (a -> b) -> LazyValue b */
- var map = function (f) {
- return nu(function (nCallback) {
- get(function (data) {
- nCallback(f(data));
- });
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var par = function (asyncValues, nu) {
+ return nu(function (callback) {
+ var r = [];
+ var count = 0;
+ var cb = function (i) {
+ return function (value) {
+ r[i] = value;
+ count++;
+ if (count >= asyncValues.length) {
+ callback(r);
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var get = function (nCallback) {
- if (isReady()) call(nCallback);
- else callbacks.push(nCallback);
- };
-
- var set = function (x) {
- data = Option.some(x);
- run(callbacks);
- callbacks = [];
- };
-
- var isReady = function () {
- return data.isSome();
- };
-
- var run = function (cbs) {
- Arr.each(cbs, call);
- };
-
- var call = function(cb) {
- data.each(function(x) {
- setTimeout(function() {
- cb(x);
- }, 0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (asyncValues.length === 0) {
+ callback([]);
+ } else {
+ $_9ek1bp4jfuw8kxg.each(asyncValues, function (asyncValue, i) {
+ asyncValue.get(cb(i));
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ };
+ var $_863o6m1ljfuw8lcu = { par: par };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Lazy values cache the value and kick off immediately
- baseFn(set);
-
- return {
- get: get,
- map: map,
- isReady: isReady
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var par$1 = function (futures) {
+ return $_863o6m1ljfuw8lcu.par(futures, Future.nu);
+ };
+ var mapM = function (array, fn) {
+ var futures = $_9ek1bp4jfuw8kxg.map(array, fn);
+ return par$1(futures);
+ };
+ var compose$1 = function (f, g) {
+ return function (a) {
+ return g(a).bind(f);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_9tz6fr1kjfuw8lcn = {
+ par: par$1,
+ mapM: mapM,
+ compose: compose$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var pure = function (a) {
- return nu(function (callback) {
- callback(a);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var value$1 = function (o) {
+ var is = function (v) {
+ return o === v;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- nu: nu,
- pure: pure
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var or = function (opt) {
+ return value$1(o);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-define(
- 'ephox.katamari.async.Bounce',
-
- [
- 'global!Array',
- 'global!setTimeout'
- ],
-
- function (Array, setTimeout) {
-
- var bounce = function(f) {
- return function() {
- var args = Array.prototype.slice.call(arguments);
- var me = this;
- setTimeout(function() {
- f.apply(me, args);
- }, 0);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var orThunk = function (f) {
+ return value$1(o);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- bounce: bounce
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var map = function (f) {
+ return value$1(f(o));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-define(
- 'ephox.katamari.api.Future',
-
- [
- 'ephox.katamari.api.LazyValue',
- 'ephox.katamari.async.Bounce'
- ],
-
- /** A future value that is evaluated on demand. The base function is re-evaluated each time 'get' is called. */
- function (LazyValue, Bounce) {
- var nu = function (baseFn) {
- var get = function(callback) {
- baseFn(Bounce.bounce(callback));
- };
-
- /** map :: this Future a -> (a -> b) -> Future b */
- var map = function (fab) {
- return nu(function (callback) {
- get(function (a) {
- var value = fab(a);
- callback(value);
- });
- });
- };
-
- /** bind :: this Future a -> (a -> Future b) -> Future b */
- var bind = function (aFutureB) {
- return nu(function (callback) {
- get(function (a) {
- aFutureB(a).get(callback);
- });
- });
- };
-
- /** anonBind :: this Future a -> Future b -> Future b
- * Returns a future, which evaluates the first future, ignores the result, then evaluates the second.
- */
- var anonBind = function (futureB) {
- return nu(function (callback) {
- get(function (a) {
- futureB.get(callback);
- });
- });
- };
-
- var toLazy = function () {
- return LazyValue.nu(get);
- };
-
- return {
- map: map,
- bind: bind,
- anonBind: anonBind,
- toLazy: toLazy,
- get: get
- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each = function (f) {
+ f(o);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** a -> Future a */
- var pure = function (a) {
- return nu(function (callback) {
- callback(a);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var bind = function (f) {
+ return f(o);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- nu: nu,
- pure: pure
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fold = function (_, onValue) {
+ return onValue(o);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-define(
- 'ephox.katamari.async.AsyncValues',
-
- [
- 'ephox.katamari.api.Arr'
- ],
-
- function (Arr) {
- /*
- * NOTE: an `asyncValue` must have a `get` function which gets given a callback and calls
- * that callback with a value once it is ready
- *
- * e.g
- * {
- * get: function (callback) { callback(10); }
- * }
- */
- var par = function (asyncValues, nu) {
- return nu(function(callback) {
- var r = [];
- var count = 0;
-
- var cb = function(i) {
- return function(value) {
- r[i] = value;
- count++;
- if (count >= asyncValues.length) {
- callback(r);
- }
- };
- };
-
- if (asyncValues.length === 0) {
- callback([]);
- } else {
- Arr.each(asyncValues, function(asyncValue, i) {
- asyncValue.get(cb(i));
- });
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var exists = function (f) {
+ return f(o);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var forall = function (f) {
+ return f(o);
+ };
+ var toOption = function () {
+ return Option.some(o);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- par: par
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ is: is,
+ isValue: $_68e81l6jfuw8kyc.always,
+ isError: $_68e81l6jfuw8kyc.never,
+ getOr: $_68e81l6jfuw8kyc.constant(o),
+ getOrThunk: $_68e81l6jfuw8kyc.constant(o),
+ getOrDie: $_68e81l6jfuw8kyc.constant(o),
+ or: or,
+ orThunk: orThunk,
+ fold: fold,
+ map: map,
+ each: each,
+ bind: bind,
+ exists: exists,
+ forall: forall,
+ toOption: toOption
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-define(
- 'ephox.katamari.api.Futures',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Future',
- 'ephox.katamari.async.AsyncValues'
- ],
-
- function (Arr, Future, AsyncValues) {
- /** par :: [Future a] -> Future [a] */
- var par = function(futures) {
- return AsyncValues.par(futures, Future.nu);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var error = function (message) {
+ var getOrThunk = function (f) {
+ return f();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** mapM :: [a] -> (a -> Future b) -> Future [b] */
- var mapM = function(array, fn) {
- var futures = Arr.map(array, fn);
- return par(futures);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getOrDie = function () {
+ return $_68e81l6jfuw8kyc.die(String(message))();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** Kleisli composition of two functions: a -> Future b.
- * Note the order of arguments: g is invoked first, then the result passed to f.
- * This is in line with f . g = \x -> f (g a)
- *
- * compose :: ((b -> Future c), (a -> Future b)) -> a -> Future c
- */
- var compose = function (f, g) {
- return function (a) {
- return g(a).bind(f);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var or = function (opt) {
+ return opt;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var orThunk = function (f) {
+ return f();
+ };
+ var map = function (f) {
+ return error(message);
+ };
+ var bind = function (f) {
+ return error(message);
+ };
+ var fold = function (onError, _) {
+ return onError(message);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- par: par,
- mapM: mapM,
- compose: compose
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ is: $_68e81l6jfuw8kyc.never,
+ isValue: $_68e81l6jfuw8kyc.never,
+ isError: $_68e81l6jfuw8kyc.always,
+ getOr: $_68e81l6jfuw8kyc.identity,
+ getOrThunk: getOrThunk,
+ getOrDie: getOrDie,
+ or: or,
+ orThunk: orThunk,
+ fold: fold,
+ map: map,
+ each: $_68e81l6jfuw8kyc.noop,
+ bind: bind,
+ exists: $_68e81l6jfuw8kyc.never,
+ forall: $_68e81l6jfuw8kyc.always,
+ toOption: Option.none
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-define(
- 'ephox.katamari.api.Result',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var Result = {
+ value: value$1,
+ error: error
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option'
- ],
-
- function (Fun, Option) {
- /* The type signatures for Result
- * is :: this Result a -> a -> Bool
- * or :: this Result a -> Result a -> Result a
- * orThunk :: this Result a -> (_ -> Result a) -> Result a
- * map :: this Result a -> (a -> b) -> Result b
- * each :: this Result a -> (a -> _) -> _
- * bind :: this Result a -> (a -> Result b) -> Result b
- * fold :: this Result a -> (_ -> b, a -> b) -> b
- * exists :: this Result a -> (a -> Bool) -> Bool
- * forall :: this Result a -> (a -> Bool) -> Bool
- * toOption :: this Result a -> Option a
- * isValue :: this Result a -> Bool
- * isError :: this Result a -> Bool
- * getOr :: this Result a -> a -> a
- * getOrThunk :: this Result a -> (_ -> a) -> a
- * getOrDie :: this Result a -> a (or throws error)
- */
-
- var value = function (o) {
- var is = function (v) {
- return o === v;
- };
-
- var or = function (opt) {
- return value(o);
- };
-
- var orThunk = function (f) {
- return value(o);
- };
-
- var map = function (f) {
- return value(f(o));
- };
-
- var each = function (f) {
- f(o);
- };
-
- var bind = function (f) {
- return f(o);
- };
-
- var fold = function (_, onValue) {
- return onValue(o);
- };
-
- var exists = function (f) {
- return f(o);
- };
-
- var forall = function (f) {
- return f(o);
- };
-
- var toOption = function () {
- return Option.some(o);
- };
-
- return {
- is: is,
- isValue: Fun.constant(true),
- isError: Fun.constant(false),
- getOr: Fun.constant(o),
- getOrThunk: Fun.constant(o),
- getOrDie: Fun.constant(o),
- or: or,
- orThunk: orThunk,
- fold: fold,
- map: map,
- each: each,
- bind: bind,
- exists: exists,
- forall: forall,
- toOption: toOption
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function StyleSheetLoader(document, settings) {
+ var idCount = 0;
+ var loadedStates = {};
+ var maxLoadTime;
+ settings = settings || {};
+ maxLoadTime = settings.maxLoadTime || 5000;
+ var appendToHead = function (node) {
+ document.getElementsByTagName('head')[0].appendChild(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var error = function (message) {
- var getOrThunk = function (f) {
- return f();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var load = function (url, loadedCallback, errorCallback) {
+ var link, style, startTime, state;
+ var passed = function () {
+ var callbacks = state.passed;
+ var i = callbacks.length;
+ while (i--) {
+ callbacks[i]();
+ }
+ state.status = 2;
+ state.passed = [];
+ state.failed = [];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getOrDie = function () {
- return Fun.die(message)();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var failed = function () {
+ var callbacks = state.failed;
+ var i = callbacks.length;
+ while (i--) {
+ callbacks[i]();
+ }
+ state.status = 3;
+ state.passed = [];
+ state.failed = [];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var or = function (opt) {
- return opt;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isOldWebKit = function () {
+ var webKitChunks = navigator.userAgent.match(/WebKit\/(\d*)/);
+ return !!(webKitChunks && parseInt(webKitChunks[1], 10) < 536);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var orThunk = function (f) {
- return f();
- };
-
- var map = function (f) {
- return error(message);
- };
-
- var bind = function (f) {
- return error(message);
- };
-
- var fold = function (onError, _) {
- return onError(message);
- };
-
- return {
- is: Fun.constant(false),
- isValue: Fun.constant(false),
- isError: Fun.constant(true),
- getOr: Fun.identity,
- getOrThunk: getOrThunk,
- getOrDie: getOrDie,
- or: or,
- orThunk: orThunk,
- fold: fold,
- map: map,
- each: Fun.noop,
- bind: bind,
- exists: Fun.constant(false),
- forall: Fun.constant(true),
- toOption: Option.none
- };
- };
-
- return {
- value: value,
- error: error
- };
- }
-);
-
-/**
- * StyleSheetLoader.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class handles loading of external stylesheets and fires events when these are loaded.
- *
- * @class tinymce.dom.StyleSheetLoader
- * @private
- */
-define(
- 'tinymce.core.dom.StyleSheetLoader',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Future',
- 'ephox.katamari.api.Futures',
- 'ephox.katamari.api.Result',
- 'tinymce.core.util.Delay',
- 'tinymce.core.util.Tools'
- ],
- function (Arr, Fun, Future, Futures, Result, Delay, Tools) {
- "use strict";
-
- return function (document, settings) {
- var idCount = 0, loadedStates = {}, maxLoadTime;
-
- settings = settings || {};
- maxLoadTime = settings.maxLoadTime || 5000;
-
- function appendToHead(node) {
- document.getElementsByTagName('head')[0].appendChild(node);
- }
-
- /**
- * Loads the specified css style sheet file and call the loadedCallback once it's finished loading.
- *
- * @method load
- * @param {String} url Url to be loaded.
- * @param {Function} loadedCallback Callback to be executed when loaded.
- * @param {Function} errorCallback Callback to be executed when failed loading.
- */
- function load(url, loadedCallback, errorCallback) {
- var link, style, startTime, state;
-
- function passed() {
- var callbacks = state.passed, i = callbacks.length;
-
- while (i--) {
- callbacks[i]();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var wait = function (testCallback, waitCallback) {
+ if (!testCallback()) {
+ if (new Date().getTime() - startTime < maxLoadTime) {
+ $_2m8wq9hjfuw8l41.setTimeout(waitCallback);
+ } else {
+ failed();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- state.status = 2;
- state.passed = [];
- state.failed = [];
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function failed() {
- var callbacks = state.failed, i = callbacks.length;
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var waitForWebKitLinkLoaded = function () {
+ wait(function () {
+ var styleSheets = document.styleSheets;
+ var styleSheet, i = styleSheets.length, owner;
</ins><span class="cx" style="display: block; padding: 0 10px"> while (i--) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- callbacks[i]();
- }
-
- state.status = 3;
- state.passed = [];
- state.failed = [];
- }
-
- // Sniffs for older WebKit versions that have the link.onload but a broken one
- function isOldWebKit() {
- var webKitChunks = navigator.userAgent.match(/WebKit\/(\d*)/);
- return !!(webKitChunks && webKitChunks[1] < 536);
- }
-
- // Calls the waitCallback until the test returns true or the timeout occurs
- function wait(testCallback, waitCallback) {
- if (!testCallback()) {
- // Wait for timeout
- if ((new Date().getTime()) - startTime < maxLoadTime) {
- Delay.setTimeout(waitCallback);
- } else {
- failed();
- }
- }
- }
-
- // Workaround for WebKit that doesn't properly support the onload event for link elements
- // Or WebKit that fires the onload event before the StyleSheet is added to the document
- function waitForWebKitLinkLoaded() {
- wait(function () {
- var styleSheets = document.styleSheets, styleSheet, i = styleSheets.length, owner;
-
- while (i--) {
- styleSheet = styleSheets[i];
- owner = styleSheet.ownerNode ? styleSheet.ownerNode : styleSheet.owningElement;
- if (owner && owner.id === link.id) {
- passed();
- return true;
- }
- }
- }, waitForWebKitLinkLoaded);
- }
-
- // Workaround for older Geckos that doesn't have any onload event for StyleSheets
- function waitForGeckoLinkLoaded() {
- wait(function () {
- try {
- // Accessing the cssRules will throw an exception until the CSS file is loaded
- var cssRules = style.sheet.cssRules;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ styleSheet = styleSheets[i];
+ owner = styleSheet.ownerNode ? styleSheet.ownerNode : styleSheet.owningElement;
+ if (owner && owner.id === link.id) {
</ins><span class="cx" style="display: block; padding: 0 10px"> passed();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return !!cssRules;
- } catch (ex) {
- // Ignore
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }, waitForGeckoLinkLoaded);
- }
-
- url = Tools._addCacheSuffix(url);
-
- if (!loadedStates[url]) {
- state = {
- passed: [],
- failed: []
- };
-
- loadedStates[url] = state;
- } else {
- state = loadedStates[url];
- }
-
- if (loadedCallback) {
- state.passed.push(loadedCallback);
- }
-
- if (errorCallback) {
- state.failed.push(errorCallback);
- }
-
- // Is loading wait for it to pass
- if (state.status == 1) {
- return;
- }
-
- // Has finished loading and was success
- if (state.status == 2) {
- passed();
- return;
- }
-
- // Has finished loading and was a failure
- if (state.status == 3) {
- failed();
- return;
- }
-
- // Start loading
- state.status = 1;
- link = document.createElement('link');
- link.rel = 'stylesheet';
- link.type = 'text/css';
- link.id = 'u' + (idCount++);
- link.async = false;
- link.defer = false;
- startTime = new Date().getTime();
-
- // Feature detect onload on link element and sniff older webkits since it has an broken onload event
- if ("onload" in link && !isOldWebKit()) {
- link.onload = waitForWebKitLinkLoaded;
- link.onerror = failed;
- } else {
- // Sniff for old Firefox that doesn't support the onload event on link elements
- // TODO: Remove this in the future when everyone uses modern browsers
- if (navigator.userAgent.indexOf("Firefox") > 0) {
- style = document.createElement('style');
- style.textContent = '@import "' + url + '"';
- waitForGeckoLinkLoaded();
- appendToHead(style);
- return;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Use the id owner on older webkits
- waitForWebKitLinkLoaded();
- }
-
- appendToHead(link);
- link.href = url;
- }
-
- var loadF = function (url) {
- return Future.nu(function (resolve) {
- load(
- url,
- Fun.compose(resolve, Fun.constant(Result.value(url))),
- Fun.compose(resolve, Fun.constant(Result.error(url)))
- );
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, waitForWebKitLinkLoaded);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var unbox = function (result) {
- return result.fold(Fun.identity, Fun.identity);
- };
-
- var loadAll = function (urls, success, failure) {
- Futures.par(Arr.map(urls, loadF)).get(function (result) {
- var parts = Arr.partition(result, function (r) {
- return r.isValue();
- });
-
- if (parts.fail.length > 0) {
- failure(parts.fail.map(unbox));
- } else {
- success(parts.pass.map(unbox));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var waitForGeckoLinkLoaded = function () {
+ wait(function () {
+ try {
+ var cssRules = style.sheet.cssRules;
+ passed();
+ return !!cssRules;
+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, waitForGeckoLinkLoaded);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- load: load,
- loadAll: loadAll
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ url = $_52qop8kjfuw8l6v._addCacheSuffix(url);
+ if (!loadedStates[url]) {
+ state = {
+ passed: [],
+ failed: []
+ };
+ loadedStates[url] = state;
+ } else {
+ state = loadedStates[url];
+ }
+ if (loadedCallback) {
+ state.passed.push(loadedCallback);
+ }
+ if (errorCallback) {
+ state.failed.push(errorCallback);
+ }
+ if (state.status === 1) {
+ return;
+ }
+ if (state.status === 2) {
+ passed();
+ return;
+ }
+ if (state.status === 3) {
+ failed();
+ return;
+ }
+ state.status = 1;
+ link = document.createElement('link');
+ link.rel = 'stylesheet';
+ link.type = 'text/css';
+ link.id = 'u' + idCount++;
+ link.async = false;
+ link.defer = false;
+ startTime = new Date().getTime();
+ if ('onload' in link && !isOldWebKit()) {
+ link.onload = waitForWebKitLinkLoaded;
+ link.onerror = failed;
+ } else {
+ if (navigator.userAgent.indexOf('Firefox') > 0) {
+ style = document.createElement('style');
+ style.textContent = '@import "' + url + '"';
+ waitForGeckoLinkLoaded();
+ appendToHead(style);
+ return;
+ }
+ waitForWebKitLinkLoaded();
+ }
+ appendToHead(link);
+ link.href = url;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var loadF = function (url) {
+ return Future.nu(function (resolve) {
+ load(url, $_68e81l6jfuw8kyc.compose(resolve, $_68e81l6jfuw8kyc.constant(Result.value(url))), $_68e81l6jfuw8kyc.compose(resolve, $_68e81l6jfuw8kyc.constant(Result.error(url))));
+ });
+ };
+ var unbox = function (result) {
+ return result.fold($_68e81l6jfuw8kyc.identity, $_68e81l6jfuw8kyc.identity);
+ };
+ var loadAll = function (urls, success, failure) {
+ $_9tz6fr1kjfuw8lcn.par($_9ek1bp4jfuw8kxg.map(urls, loadF)).get(function (result) {
+ var parts = $_9ek1bp4jfuw8kxg.partition(result, function (r) {
+ return r.isValue();
+ });
+ if (parts.fail.length > 0) {
+ failure(parts.fail.map(unbox));
+ } else {
+ success(parts.pass.map(unbox));
+ }
+ });
+ };
+ return {
+ load: load,
+ loadAll: loadAll
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * TreeWalker.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * TreeWalker class enables you to walk the DOM in a linear manner.
- *
- * @class tinymce.dom.TreeWalker
- * @example
- * var walker = new tinymce.dom.TreeWalker(startNode);
- *
- * do {
- * console.log(walker.current());
- * } while (walker.next());
- */
-define(
- 'tinymce.core.dom.TreeWalker',
- [
- ],
- function () {
- /**
- * Constructs a new TreeWalker instance.
- *
- * @constructor
- * @method TreeWalker
- * @param {Node} startNode Node to start walking from.
- * @param {node} rootNode Optional root node to never walk out of.
- */
- return function (startNode, rootNode) {
- var node = startNode;
-
- function findSibling(node, startName, siblingName, shallow) {
- var sibling, parent;
-
- if (node) {
- // Walk into nodes if it has a start
- if (!shallow && node[startName]) {
- return node[startName];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function TreeWalker (startNode, rootNode) {
+ var node = startNode;
+ var findSibling = function (node, startName, siblingName, shallow) {
+ var sibling, parent;
+ if (node) {
+ if (!shallow && node[startName]) {
+ return node[startName];
+ }
+ if (node !== rootNode) {
+ sibling = node[siblingName];
+ if (sibling) {
+ return sibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Return the sibling if it has one
- if (node != rootNode) {
- sibling = node[siblingName];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (parent = node.parentNode; parent && parent !== rootNode; parent = parent.parentNode) {
+ sibling = parent[siblingName];
</ins><span class="cx" style="display: block; padding: 0 10px"> if (sibling) {
</span><span class="cx" style="display: block; padding: 0 10px"> return sibling;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Walk up the parents to look for siblings
- for (parent = node.parentNode; parent && parent != rootNode; parent = parent.parentNode) {
- sibling = parent[siblingName];
- if (sibling) {
- return sibling;
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function findPreviousNode(node, startName, siblingName, shallow) {
- var sibling, parent, child;
-
- if (node) {
- sibling = node[siblingName];
- if (rootNode && sibling === rootNode) {
- return;
- }
-
- if (sibling) {
- if (!shallow) {
- // Walk up the parents to look for siblings
- for (child = sibling[startName]; child; child = child[startName]) {
- if (!child[startName]) {
- return child;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var findPreviousNode = function (node, startName, siblingName, shallow) {
+ var sibling, parent, child;
+ if (node) {
+ sibling = node[siblingName];
+ if (rootNode && sibling === rootNode) {
+ return;
+ }
+ if (sibling) {
+ if (!shallow) {
+ for (child = sibling[startName]; child; child = child[startName]) {
+ if (!child[startName]) {
+ return child;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return sibling;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- parent = node.parentNode;
- if (parent && parent !== rootNode) {
- return parent;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return sibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent = node.parentNode;
+ if (parent && parent !== rootNode) {
+ return parent;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the current node.
- *
- * @method current
- * @return {Node} Current node where the walker is.
- */
- this.current = function () {
- return node;
- };
-
- /**
- * Walks to the next node in tree.
- *
- * @method next
- * @return {Node} Current node where the walker is after moving to the next node.
- */
- this.next = function (shallow) {
- node = findSibling(node, 'firstChild', 'nextSibling', shallow);
- return node;
- };
-
- /**
- * Walks to the previous node in tree.
- *
- * @method prev
- * @return {Node} Current node where the walker is after moving to the previous node.
- */
- this.prev = function (shallow) {
- node = findSibling(node, 'lastChild', 'previousSibling', shallow);
- return node;
- };
-
- this.prev2 = function (shallow) {
- node = findPreviousNode(node, 'lastChild', 'previousSibling', shallow);
- return node;
- };
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.current = function () {
+ return node;
+ };
+ this.next = function (shallow) {
+ node = findSibling(node, 'firstChild', 'nextSibling', shallow);
+ return node;
+ };
+ this.prev = function (shallow) {
+ node = findSibling(node, 'lastChild', 'previousSibling', shallow);
+ return node;
+ };
+ this.prev2 = function (shallow) {
+ node = findPreviousNode(node, 'lastChild', 'previousSibling', shallow);
+ return node;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Entities.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/*jshint bitwise:false */
-/*eslint no-bitwise:0 */
-
-/**
- * Entity encoder class.
- *
- * @class tinymce.html.Entities
- * @static
- * @version 3.4
- */
-define(
- 'tinymce.core.html.Entities',
- [
- "tinymce.core.util.Tools"
- ],
- function (Tools) {
- var makeMap = Tools.makeMap;
-
- var namedEntities, baseEntities, reverseEntities,
- attrsCharsRegExp = /[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
- textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
- rawCharsRegExp = /[<>&\"\']/g,
- entityRegExp = /&#([a-z0-9]+);?|&([a-z0-9]+);/gi,
- asciiMap = {
- 128: "\u20AC", 130: "\u201A", 131: "\u0192", 132: "\u201E", 133: "\u2026", 134: "\u2020",
- 135: "\u2021", 136: "\u02C6", 137: "\u2030", 138: "\u0160", 139: "\u2039", 140: "\u0152",
- 142: "\u017D", 145: "\u2018", 146: "\u2019", 147: "\u201C", 148: "\u201D", 149: "\u2022",
- 150: "\u2013", 151: "\u2014", 152: "\u02DC", 153: "\u2122", 154: "\u0161", 155: "\u203A",
- 156: "\u0153", 158: "\u017E", 159: "\u0178"
- };
-
- // Raw entities
- baseEntities = {
- '\"': '"', // Needs to be escaped since the YUI compressor would otherwise break the code
- "'": ''',
- '<': '<',
- '>': '>',
- '&': '&',
- '\u0060': '`'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var blocks = [
+ 'article',
+ 'aside',
+ 'details',
+ 'div',
+ 'dt',
+ 'figcaption',
+ 'footer',
+ 'form',
+ 'fieldset',
+ 'header',
+ 'hgroup',
+ 'html',
+ 'main',
+ 'nav',
+ 'section',
+ 'summary',
+ 'body',
+ 'p',
+ 'dl',
+ 'multicol',
+ 'dd',
+ 'figure',
+ 'address',
+ 'center',
+ 'blockquote',
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6',
+ 'listing',
+ 'xmp',
+ 'pre',
+ 'plaintext',
+ 'menu',
+ 'dir',
+ 'ul',
+ 'ol',
+ 'li',
+ 'hr',
+ 'table',
+ 'tbody',
+ 'thead',
+ 'tfoot',
+ 'th',
+ 'tr',
+ 'td',
+ 'caption'
+ ];
+ var voids = [
+ 'area',
+ 'base',
+ 'basefont',
+ 'br',
+ 'col',
+ 'frame',
+ 'hr',
+ 'img',
+ 'input',
+ 'isindex',
+ 'link',
+ 'meta',
+ 'param',
+ 'embed',
+ 'source',
+ 'wbr',
+ 'track'
+ ];
+ var tableCells = [
+ 'td',
+ 'th'
+ ];
+ var tableSections = [
+ 'thead',
+ 'tbody',
+ 'tfoot'
+ ];
+ var textBlocks = [
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6',
+ 'p',
+ 'div',
+ 'address',
+ 'pre',
+ 'form',
+ 'blockquote',
+ 'center',
+ 'dir',
+ 'fieldset',
+ 'header',
+ 'footer',
+ 'article',
+ 'section',
+ 'hgroup',
+ 'aside',
+ 'nav',
+ 'figure'
+ ];
+ var headings = [
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6'
+ ];
+ var listItems = [
+ 'li',
+ 'dd',
+ 'dt'
+ ];
+ var lists = [
+ 'ul',
+ 'ol',
+ 'dl'
+ ];
+ var lazyLookup = function (items) {
+ var lookup;
+ return function (node) {
+ lookup = lookup ? lookup : $_9ek1bp4jfuw8kxg.mapToObject(items, $_68e81l6jfuw8kyc.constant(true));
+ return lookup.hasOwnProperty($_eaw33d10jfuw8l9f.name(node));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isHeading = lazyLookup(headings);
+ var isBlock = lazyLookup(blocks);
+ var isInline = function (node) {
+ return $_eaw33d10jfuw8l9f.isElement(node) && !isBlock(node);
+ };
+ var isBr = function (node) {
+ return $_eaw33d10jfuw8l9f.isElement(node) && $_eaw33d10jfuw8l9f.name(node) === 'br';
+ };
+ var isTextBlock = lazyLookup(textBlocks);
+ var isList = lazyLookup(lists);
+ var isListItem = lazyLookup(listItems);
+ var isVoid = lazyLookup(voids);
+ var isTableSection = lazyLookup(tableSections);
+ var isTableCell = lazyLookup(tableCells);
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Reverse lookup table for raw entities
- reverseEntities = {
- '<': '<',
- '>': '>',
- '&': '&',
- '"': '"',
- ''': "'"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isNodeType = function (type) {
+ return function (node) {
+ return !!node && node.nodeType === type;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Decodes text by using the browser
- function nativeDecode(text) {
- var elm;
-
- elm = document.createElement("div");
- elm.innerHTML = text;
-
- return elm.textContent || elm.innerText || text;
- }
-
- // Build a two way lookup table for the entities
- function buildEntitiesLookup(items, radix) {
- var i, chr, entity, lookup = {};
-
- if (items) {
- items = items.split(',');
- radix = radix || 10;
-
- // Build entities lookup table
- for (i = 0; i < items.length; i += 2) {
- chr = String.fromCharCode(parseInt(items[i], radix));
-
- // Only add non base entities
- if (!baseEntities[chr]) {
- entity = '&' + items[i + 1] + ';';
- lookup[chr] = entity;
- lookup[entity] = chr;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isElement$1 = isNodeType(1);
+ var matchNodeNames = function (names) {
+ var items = names.toLowerCase().split(' ');
+ return function (node) {
+ var i, name;
+ if (node && node.nodeType) {
+ name = node.nodeName.toLowerCase();
+ for (i = 0; i < items.length; i++) {
+ if (name === items[i]) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return lookup;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Unpack entities lookup where the numbers are in radix 32 to reduce the size
- namedEntities = buildEntitiesLookup(
- '50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' +
- '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' +
- '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' +
- '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' +
- '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' +
- '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' +
- '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' +
- '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' +
- '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' +
- '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' +
- 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' +
- 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' +
- 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' +
- 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' +
- 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' +
- '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' +
- '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' +
- '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' +
- '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' +
- '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' +
- 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' +
- 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' +
- 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' +
- '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' +
- '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32);
-
- var Entities = {
- /**
- * Encodes the specified string using raw entities. This means only the required XML base entities will be encoded.
- *
- * @method encodeRaw
- * @param {String} text Text to encode.
- * @param {Boolean} attr Optional flag to specify if the text is attribute contents.
- * @return {String} Entity encoded text.
- */
- encodeRaw: function (text, attr) {
- return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
- return baseEntities[chr] || chr;
- });
- },
-
- /**
- * Encoded the specified text with both the attributes and text entities. This function will produce larger text contents
- * since it doesn't know if the context is within a attribute or text node. This was added for compatibility
- * and is exposed as the DOMUtils.encode function.
- *
- * @method encodeAllRaw
- * @param {String} text Text to encode.
- * @return {String} Entity encoded text.
- */
- encodeAllRaw: function (text) {
- return ('' + text).replace(rawCharsRegExp, function (chr) {
- return baseEntities[chr] || chr;
- });
- },
-
- /**
- * Encodes the specified string using numeric entities. The core entities will be
- * encoded as named ones but all non lower ascii characters will be encoded into numeric entities.
- *
- * @method encodeNumeric
- * @param {String} text Text to encode.
- * @param {Boolean} attr Optional flag to specify if the text is attribute contents.
- * @return {String} Entity encoded text.
- */
- encodeNumeric: function (text, attr) {
- return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
- // Multi byte sequence convert it to a single entity
- if (chr.length > 1) {
- return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
+ };
+ };
+ var matchStyleValues = function (name, values) {
+ var items = values.toLowerCase().split(' ');
+ return function (node) {
+ var i, cssValue;
+ if (isElement$1(node)) {
+ for (i = 0; i < items.length; i++) {
+ var computed = node.ownerDocument.defaultView.getComputedStyle(node, null);
+ cssValue = computed ? computed.getPropertyValue(name) : null;
+ if (cssValue === items[i]) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';
- });
- },
-
- /**
- * Encodes the specified string using named entities. The core entities will be encoded
- * as named ones but all non lower ascii characters will be encoded into named entities.
- *
- * @method encodeNamed
- * @param {String} text Text to encode.
- * @param {Boolean} attr Optional flag to specify if the text is attribute contents.
- * @param {Object} entities Optional parameter with entities to use.
- * @return {String} Entity encoded text.
- */
- encodeNamed: function (text, attr, entities) {
- entities = entities || namedEntities;
-
- return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
- return baseEntities[chr] || entities[chr] || chr;
- });
- },
-
- /**
- * Returns an encode function based on the name(s) and it's optional entities.
- *
- * @method getEncodeFunc
- * @param {String} name Comma separated list of encoders for example named,numeric.
- * @param {String} entities Optional parameter with entities to use instead of the built in set.
- * @return {function} Encode function to be used.
- */
- getEncodeFunc: function (name, entities) {
- entities = buildEntitiesLookup(entities) || namedEntities;
-
- function encodeNamedAndNumeric(text, attr) {
- return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
- if (baseEntities[chr] !== undefined) {
- return baseEntities[chr];
- }
-
- if (entities[chr] !== undefined) {
- return entities[chr];
- }
-
- // Convert multi-byte sequences to a single entity.
- if (chr.length > 1) {
- return '&#' + (((chr.charCodeAt(0) - 0xD800) * 0x400) + (chr.charCodeAt(1) - 0xDC00) + 0x10000) + ';';
- }
-
- return '&#' + chr.charCodeAt(0) + ';';
- });
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function encodeCustomNamed(text, attr) {
- return Entities.encodeNamed(text, attr, entities);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return false;
+ };
+ };
+ var hasPropValue = function (propName, propValue) {
+ return function (node) {
+ return isElement$1(node) && node[propName] === propValue;
+ };
+ };
+ var hasAttribute = function (attrName, attrValue) {
+ return function (node) {
+ return isElement$1(node) && node.hasAttribute(attrName);
+ };
+ };
+ var hasAttributeValue = function (attrName, attrValue) {
+ return function (node) {
+ return isElement$1(node) && node.getAttribute(attrName) === attrValue;
+ };
+ };
+ var isBogus = function (node) {
+ return isElement$1(node) && node.hasAttribute('data-mce-bogus');
+ };
+ var isBogusAll = function (node) {
+ return isElement$1(node) && node.getAttribute('data-mce-bogus') === 'all';
+ };
+ var isTable = function (node) {
+ return isElement$1(node) && node.tagName === 'TABLE';
+ };
+ var hasContentEditableState = function (value) {
+ return function (node) {
+ if (isElement$1(node)) {
+ if (node.contentEditable === value) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Replace + with , to be compatible with previous TinyMCE versions
- name = makeMap(name.replace(/\+/g, ','));
-
- // Named and numeric encoder
- if (name.named && name.numeric) {
- return encodeNamedAndNumeric;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.getAttribute('data-mce-contenteditable') === value) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Named encoder
- if (name.named) {
- // Custom names
- if (entities) {
- return encodeCustomNamed;
- }
-
- return Entities.encodeNamed;
- }
-
- // Numeric
- if (name.numeric) {
- return Entities.encodeNumeric;
- }
-
- // Raw encoder
- return Entities.encodeRaw;
- },
-
- /**
- * Decodes the specified string, this will replace entities with raw UTF characters.
- *
- * @method decode
- * @param {String} text Text to entity decode.
- * @return {String} Entity decoded string.
- */
- decode: function (text) {
- return text.replace(entityRegExp, function (all, numeric) {
- if (numeric) {
- if (numeric.charAt(0).toLowerCase() === 'x') {
- numeric = parseInt(numeric.substr(1), 16);
- } else {
- numeric = parseInt(numeric, 10);
- }
-
- // Support upper UTF
- if (numeric > 0xFFFF) {
- numeric -= 0x10000;
-
- return String.fromCharCode(0xD800 + (numeric >> 10), 0xDC00 + (numeric & 0x3FF));
- }
-
- return asciiMap[numeric] || String.fromCharCode(numeric);
- }
-
- return reverseEntities[all] || namedEntities[all] || nativeDecode(all);
- });
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isText$1 = isNodeType(3);
+ var isComment$1 = isNodeType(8);
+ var isDocument$1 = isNodeType(9);
+ var isBr$1 = matchNodeNames('br');
+ var isContentEditableTrue = hasContentEditableState('true');
+ var isContentEditableFalse = hasContentEditableState('false');
+ var $_ey7ka11qjfuw8ldg = {
+ isText: isText$1,
+ isElement: isElement$1,
+ isComment: isComment$1,
+ isDocument: isDocument$1,
+ isBr: isBr$1,
+ isContentEditableTrue: isContentEditableTrue,
+ isContentEditableFalse: isContentEditableFalse,
+ matchNodeNames: matchNodeNames,
+ hasPropValue: hasPropValue,
+ hasAttribute: hasAttribute,
+ hasAttributeValue: hasAttributeValue,
+ matchStyleValues: matchStyleValues,
+ isBogus: isBogus,
+ isBogusAll: isBogusAll,
+ isTable: isTable
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Entities;
- }
-);
-
-/**
- * Schema.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Schema validator class.
- *
- * @class tinymce.html.Schema
- * @example
- * if (tinymce.activeEditor.schema.isValidChild('p', 'span'))
- * alert('span is valid child of p.');
- *
- * if (tinymce.activeEditor.schema.getElementRule('p'))
- * alert('P is a valid element.');
- *
- * @class tinymce.html.Schema
- * @version 3.4
- */
-define(
- 'tinymce.core.html.Schema',
- [
- "tinymce.core.util.Tools"
- ],
- function (Tools) {
- var mapCache = {}, dummyObj = {};
- var makeMap = Tools.makeMap, each = Tools.each, extend = Tools.extend, explode = Tools.explode, inArray = Tools.inArray;
-
- function split(items, delim) {
- items = Tools.trim(items);
- return items ? items.split(delim || ' ') : [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var surroundedBySpans = function (node) {
+ var previousIsSpan = node.previousSibling && node.previousSibling.nodeName === 'SPAN';
+ var nextIsSpan = node.nextSibling && node.nextSibling.nodeName === 'SPAN';
+ return previousIsSpan && nextIsSpan;
+ };
+ var isBookmarkNode = function (node) {
+ return node && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark';
+ };
+ var trimNode = function (dom, node) {
+ var i, children = node.childNodes;
+ if ($_ey7ka11qjfuw8ldg.isElement(node) && isBookmarkNode(node)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Builds a schema lookup table
- *
- * @private
- * @param {String} type html4, html5 or html5-strict schema type.
- * @return {Object} Schema lookup table.
- */
- function compileSchema(type) {
- var schema = {}, globalAttributes, blockContent;
- var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent;
-
- function add(name, attributes, children) {
- var ni, attributesOrder, element;
-
- function arrayToMap(array, obj) {
- var map = {}, i, l;
-
- for (i = 0, l = array.length; i < l; i++) {
- map[array[i]] = obj || {};
- }
-
- return map;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (i = children.length - 1; i >= 0; i--) {
+ trimNode(dom, children[i]);
+ }
+ if ($_ey7ka11qjfuw8ldg.isDocument(node) === false) {
+ if ($_ey7ka11qjfuw8ldg.isText(node) && node.nodeValue.length > 0) {
+ var trimmedLength = $_52qop8kjfuw8l6v.trim(node.nodeValue).length;
+ if (dom.isBlock(node.parentNode) || trimmedLength > 0) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- children = children || [];
- attributes = attributes || "";
-
- if (typeof children === "string") {
- children = split(children);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (trimmedLength === 0 && surroundedBySpans(node)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- name = split(name);
- ni = name.length;
- while (ni--) {
- attributesOrder = split([globalAttributes, attributes].join(' '));
-
- element = {
- attributes: arrayToMap(attributesOrder),
- attributesOrder: attributesOrder,
- children: arrayToMap(children, dummyObj)
- };
-
- schema[name[ni]] = element;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if ($_ey7ka11qjfuw8ldg.isElement(node)) {
+ children = node.childNodes;
+ if (children.length === 1 && isBookmarkNode(children[0])) {
+ node.parentNode.insertBefore(children[0], node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (children.length || isVoid($_c9h6qlzjfuw8l98.fromDom(node))) {
+ return;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.remove(node);
+ }
+ return node;
+ };
+ var $_a6mrv1ojfuw8ld2 = { trimNode: trimNode };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function addAttrs(name, attributes) {
- var ni, schemaItem, i, l;
-
- name = split(name);
- ni = name.length;
- attributes = split(attributes);
- while (ni--) {
- schemaItem = schema[name[ni]];
- for (i = 0, l = attributes.length; i < l; i++) {
- schemaItem.attributes[attributes[i]] = {};
- schemaItem.attributesOrder.push(attributes[i]);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var makeMap$1 = $_52qop8kjfuw8l6v.makeMap;
+ var namedEntities;
+ var baseEntities;
+ var reverseEntities;
+ var attrsCharsRegExp = /[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
+ var textCharsRegExp = /[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
+ var rawCharsRegExp = /[<>&\"\']/g;
+ var entityRegExp = /&#([a-z0-9]+);?|&([a-z0-9]+);/gi;
+ var asciiMap = {
+ 128: '\u20AC',
+ 130: '\u201A',
+ 131: '\u0192',
+ 132: '\u201E',
+ 133: '\u2026',
+ 134: '\u2020',
+ 135: '\u2021',
+ 136: '\u02c6',
+ 137: '\u2030',
+ 138: '\u0160',
+ 139: '\u2039',
+ 140: '\u0152',
+ 142: '\u017d',
+ 145: '\u2018',
+ 146: '\u2019',
+ 147: '\u201C',
+ 148: '\u201D',
+ 149: '\u2022',
+ 150: '\u2013',
+ 151: '\u2014',
+ 152: '\u02DC',
+ 153: '\u2122',
+ 154: '\u0161',
+ 155: '\u203A',
+ 156: '\u0153',
+ 158: '\u017e',
+ 159: '\u0178'
+ };
+ baseEntities = {
+ '"': '"',
+ '\'': ''',
+ '<': '<',
+ '>': '>',
+ '&': '&',
+ '`': '`'
+ };
+ reverseEntities = {
+ '<': '<',
+ '>': '>',
+ '&': '&',
+ '"': '"',
+ ''': '\''
+ };
+ var nativeDecode = function (text) {
+ var elm;
+ elm = $_c9h6qlzjfuw8l98.fromTag('div').dom();
+ elm.innerHTML = text;
+ return elm.textContent || elm.innerText || text;
+ };
+ var buildEntitiesLookup = function (items, radix) {
+ var i, chr, entity;
+ var lookup = {};
+ if (items) {
+ items = items.split(',');
+ radix = radix || 10;
+ for (i = 0; i < items.length; i += 2) {
+ chr = String.fromCharCode(parseInt(items[i], radix));
+ if (!baseEntities[chr]) {
+ entity = '&' + items[i + 1] + ';';
+ lookup[chr] = entity;
+ lookup[entity] = chr;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Use cached schema
- if (mapCache[type]) {
- return mapCache[type];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return lookup;
+ }
+ };
+ namedEntities = buildEntitiesLookup('50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' + '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' + '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' + '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' + '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' + '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' + '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' + '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' + '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' + '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' + 'sj,Gamma,sk,Delt
a,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' + 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' + 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' + 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' + 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' + '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' + '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' + '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' + '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' + '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' + 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sd
ot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' + 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' + 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' + '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' + '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32);
+ var encodeRaw = function (text, attr) {
+ return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
+ return baseEntities[chr] || chr;
+ });
+ };
+ var encodeAllRaw = function (text) {
+ return ('' + text).replace(rawCharsRegExp, function (chr) {
+ return baseEntities[chr] || chr;
+ });
+ };
+ var encodeNumeric = function (text, attr) {
+ return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
+ if (chr.length > 1) {
+ return '&#' + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ';';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Attributes present on all elements
- globalAttributes = "id accesskey class dir lang style tabindex title role";
-
- // Event attributes can be opt-in/opt-out
- /*eventAttributes = split("onabort onblur oncancel oncanplay oncanplaythrough onchange onclick onclose oncontextmenu oncuechange " +
- "ondblclick ondrag ondragend ondragenter ondragleave ondragover ondragstart ondrop ondurationchange onemptied onended " +
- "onerror onfocus oninput oninvalid onkeydown onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart " +
- "onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onpause onplay onplaying onprogress onratechange " +
- "onreset onscroll onseeked onseeking onseeking onselect onshow onstalled onsubmit onsuspend ontimeupdate onvolumechange " +
- "onwaiting"
- );*/
-
- // Block content elements
- blockContent =
- "address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul";
-
- // Phrasing content elements from the HTML5 spec (inline)
- phrasingContent =
- "a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd " +
- "label map noscript object q s samp script select small span strong sub sup " +
- "textarea u var #text #comment"
- ;
-
- // Add HTML5 items to globalAttributes, blockContent, phrasingContent
- if (type != "html4") {
- globalAttributes += " contenteditable contextmenu draggable dropzone " +
- "hidden spellcheck translate";
- blockContent += " article aside details dialog figure header footer hgroup section nav";
- phrasingContent += " audio canvas command datalist mark meter output picture " +
- "progress time wbr video ruby bdi keygen";
- }
-
- // Add HTML4 elements unless it's html5-strict
- if (type != "html5-strict") {
- globalAttributes += " xml:lang";
-
- html4PhrasingContent = "acronym applet basefont big font strike tt";
- phrasingContent = [phrasingContent, html4PhrasingContent].join(' ');
-
- each(split(html4PhrasingContent), function (name) {
- add(name, "", phrasingContent);
- });
-
- html4BlockContent = "center dir isindex noframes";
- blockContent = [blockContent, html4BlockContent].join(' ');
-
- // Flow content elements from the HTML5 spec (block+inline)
- flowContent = [blockContent, phrasingContent].join(' ');
-
- each(split(html4BlockContent), function (name) {
- add(name, "", flowContent);
- });
- }
-
- // Flow content elements from the HTML5 spec (block+inline)
- flowContent = flowContent || [blockContent, phrasingContent].join(" ");
-
- // HTML4 base schema TODO: Move HTML5 specific attributes to HTML5 specific if statement
- // Schema items <element name>, <specific attributes>, <children ..>
- add("html", "manifest", "head body");
- add("head", "", "base command link meta noscript script style title");
- add("title hr noscript br");
- add("base", "href target");
- add("link", "href rel media hreflang type sizes hreflang");
- add("meta", "name http-equiv content charset");
- add("style", "media type scoped");
- add("script", "src async defer type charset");
- add("body", "onafterprint onbeforeprint onbeforeunload onblur onerror onfocus " +
- "onhashchange onload onmessage onoffline ononline onpagehide onpageshow " +
- "onpopstate onresize onscroll onstorage onunload", flowContent);
- add("address dt dd div caption", "", flowContent);
- add("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn", "", phrasingContent);
- add("blockquote", "cite", flowContent);
- add("ol", "reversed start type", "li");
- add("ul", "", "li");
- add("li", "value", flowContent);
- add("dl", "", "dt dd");
- add("a", "href target rel media hreflang type", phrasingContent);
- add("q", "cite", phrasingContent);
- add("ins del", "cite datetime", flowContent);
- add("img", "src sizes srcset alt usemap ismap width height");
- add("iframe", "src name width height", flowContent);
- add("embed", "src type width height");
- add("object", "data type typemustmatch name usemap form width height", [flowContent, "param"].join(' '));
- add("param", "name value");
- add("map", "name", [flowContent, "area"].join(' '));
- add("area", "alt coords shape href target rel media hreflang type");
- add("table", "border", "caption colgroup thead tfoot tbody tr" + (type == "html4" ? " col" : ""));
- add("colgroup", "span", "col");
- add("col", "span");
- add("tbody thead tfoot", "", "tr");
- add("tr", "", "td th");
- add("td", "colspan rowspan headers", flowContent);
- add("th", "colspan rowspan headers scope abbr", flowContent);
- add("form", "accept-charset action autocomplete enctype method name novalidate target", flowContent);
- add("fieldset", "disabled form name", [flowContent, "legend"].join(' '));
- add("label", "form for", phrasingContent);
- add("input", "accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate " +
- "formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"
- );
- add("button", "disabled form formaction formenctype formmethod formnovalidate formtarget name type value",
- type == "html4" ? flowContent : phrasingContent);
- add("select", "disabled form multiple name required size", "option optgroup");
- add("optgroup", "disabled label", "option");
- add("option", "disabled label selected value");
- add("textarea", "cols dirname disabled form maxlength name readonly required rows wrap");
- add("menu", "type label", [flowContent, "li"].join(' '));
- add("noscript", "", flowContent);
-
- // Extend with HTML5 elements
- if (type != "html4") {
- add("wbr");
- add("ruby", "", [phrasingContent, "rt rp"].join(' '));
- add("figcaption", "", flowContent);
- add("mark rt rp summary bdi", "", phrasingContent);
- add("canvas", "width height", flowContent);
- add("video", "src crossorigin poster preload autoplay mediagroup loop " +
- "muted controls width height buffered", [flowContent, "track source"].join(' '));
- add("audio", "src crossorigin preload autoplay mediagroup loop muted controls " +
- "buffered volume", [flowContent, "track source"].join(' '));
- add("picture", "", "img source");
- add("source", "src srcset type media sizes");
- add("track", "kind src srclang label default");
- add("datalist", "", [phrasingContent, "option"].join(' '));
- add("article section nav aside header footer", "", flowContent);
- add("hgroup", "", "h1 h2 h3 h4 h5 h6");
- add("figure", "", [flowContent, "figcaption"].join(' '));
- add("time", "datetime", phrasingContent);
- add("dialog", "open", flowContent);
- add("command", "type label icon disabled checked radiogroup command");
- add("output", "for form name", phrasingContent);
- add("progress", "value max", phrasingContent);
- add("meter", "value min max low high optimum", phrasingContent);
- add("details", "open", [flowContent, "summary"].join(' '));
- add("keygen", "autofocus challenge disabled form keytype name");
- }
-
- // Extend with HTML4 attributes unless it's html5-strict
- if (type != "html5-strict") {
- addAttrs("script", "language xml:space");
- addAttrs("style", "xml:space");
- addAttrs("object", "declare classid code codebase codetype archive standby align border hspace vspace");
- addAttrs("embed", "align name hspace vspace");
- addAttrs("param", "valuetype type");
- addAttrs("a", "charset name rev shape coords");
- addAttrs("br", "clear");
- addAttrs("applet", "codebase archive code object alt name width height align hspace vspace");
- addAttrs("img", "name longdesc align border hspace vspace");
- addAttrs("iframe", "longdesc frameborder marginwidth marginheight scrolling align");
- addAttrs("font basefont", "size color face");
- addAttrs("input", "usemap align");
- addAttrs("select", "onchange");
- addAttrs("textarea");
- addAttrs("h1 h2 h3 h4 h5 h6 div p legend caption", "align");
- addAttrs("ul", "type compact");
- addAttrs("li", "type");
- addAttrs("ol dl menu dir", "compact");
- addAttrs("pre", "width xml:space");
- addAttrs("hr", "align noshade size width");
- addAttrs("isindex", "prompt");
- addAttrs("table", "summary width frame rules cellspacing cellpadding align bgcolor");
- addAttrs("col", "width align char charoff valign");
- addAttrs("colgroup", "width align char charoff valign");
- addAttrs("thead", "align char charoff valign");
- addAttrs("tr", "align char charoff valign bgcolor");
- addAttrs("th", "axis align char charoff valign nowrap bgcolor width height");
- addAttrs("form", "accept");
- addAttrs("td", "abbr axis scope align char charoff valign nowrap bgcolor width height");
- addAttrs("tfoot", "align char charoff valign");
- addAttrs("tbody", "align char charoff valign");
- addAttrs("area", "nohref");
- addAttrs("body", "background bgcolor text link vlink alink");
- }
-
- // Extend with HTML5 attributes unless it's html4
- if (type != "html4") {
- addAttrs("input button select textarea", "autofocus");
- addAttrs("input textarea", "placeholder");
- addAttrs("a", "download");
- addAttrs("link script img", "crossorigin");
- addAttrs("iframe", "sandbox seamless allowfullscreen"); // Excluded: srcdoc
- }
-
- // Special: iframe, ruby, video, audio, label
-
- // Delete children of the same name from it's parent
- // For example: form can't have a child of the name form
- each(split('a form meter progress dfn'), function (name) {
- if (schema[name]) {
- delete schema[name].children[name];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';
+ });
+ };
+ var encodeNamed = function (text, attr, entities) {
+ entities = entities || namedEntities;
+ return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
+ return baseEntities[chr] || entities[chr] || chr;
+ });
+ };
+ var getEncodeFunc = function (name, entities) {
+ var entitiesMap = buildEntitiesLookup(entities) || namedEntities;
+ var encodeNamedAndNumeric = function (text, attr) {
+ return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {
+ if (baseEntities[chr] !== undefined) {
+ return baseEntities[chr];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (entitiesMap[chr] !== undefined) {
+ return entitiesMap[chr];
+ }
+ if (chr.length > 1) {
+ return '&#' + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ';';
+ }
+ return '&#' + chr.charCodeAt(0) + ';';
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Delete header, footer, sectioning and heading content descendants
- /*each('dt th address', function(name) {
- delete schema[name].children[name];
- });*/
-
- // Caption can't have tables
- delete schema.caption.children.table;
-
- // Delete scripts by default due to possible XSS
- delete schema.script;
-
- // TODO: LI:s can only have value if parent is OL
-
- // TODO: Handle transparent elements
- // a ins del canvas map
-
- mapCache[type] = schema;
-
- return schema;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var encodeCustomNamed = function (text, attr) {
+ return encodeNamed(text, attr, entitiesMap);
+ };
+ var nameMap = makeMap$1(name.replace(/\+/g, ','));
+ if (nameMap.named && nameMap.numeric) {
+ return encodeNamedAndNumeric;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function compileElementMap(value, mode) {
- var styles;
-
- if (value) {
- styles = {};
-
- if (typeof value == 'string') {
- value = {
- '*': value
- };
- }
-
- // Convert styles into a rule list
- each(value, function (value, key) {
- styles[key] = styles[key.toUpperCase()] = mode == 'map' ? makeMap(value, /[, ]/) : explode(value, /[, ]/);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (nameMap.named) {
+ if (entities) {
+ return encodeCustomNamed;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return styles;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return encodeNamed;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Constructs a new Schema instance.
- *
- * @constructor
- * @method Schema
- * @param {Object} settings Name/value settings object.
- */
- return function (settings) {
- var self = this, elements = {}, children = {}, patternElements = [], validStyles, invalidStyles, schemaItems;
- var whiteSpaceElementsMap, selfClosingElementsMap, shortEndedElementsMap, boolAttrMap, validClasses;
- var blockElementsMap, nonEmptyElementsMap, moveCaretBeforeOnEnterElementsMap, textBlockElementsMap, textInlineElementsMap;
- var customElementsMap = {}, specialElements = {};
-
- // Creates an lookup table map object for the specified option or the default value
- function createLookupTable(option, defaultValue, extendWith) {
- var value = settings[option];
-
- if (!value) {
- // Get cached default map or make it if needed
- value = mapCache[option];
-
- if (!value) {
- value = makeMap(defaultValue, ' ', makeMap(defaultValue.toUpperCase(), ' '));
- value = extend(value, extendWith);
-
- mapCache[option] = value;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (nameMap.numeric) {
+ return encodeNumeric;
+ }
+ return encodeRaw;
+ };
+ var decode = function (text) {
+ return text.replace(entityRegExp, function (all, numeric) {
+ if (numeric) {
+ if (numeric.charAt(0).toLowerCase() === 'x') {
+ numeric = parseInt(numeric.substr(1), 16);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Create custom map
- value = makeMap(value, /[, ]/, makeMap(value.toUpperCase(), /[, ]/));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ numeric = parseInt(numeric, 10);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (numeric > 65535) {
+ numeric -= 65536;
+ return String.fromCharCode(55296 + (numeric >> 10), 56320 + (numeric & 1023));
+ }
+ return asciiMap[numeric] || String.fromCharCode(numeric);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return reverseEntities[all] || namedEntities[all] || nativeDecode(all);
+ });
+ };
+ var $_8uzsfe1rjfuw8ldm = {
+ encodeRaw: encodeRaw,
+ encodeAllRaw: encodeAllRaw,
+ encodeNumeric: encodeNumeric,
+ encodeNamed: encodeNamed,
+ getEncodeFunc: getEncodeFunc,
+ decode: decode
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- settings = settings || {};
- schemaItems = compileSchema(settings.schema);
-
- // Allow all elements and attributes if verify_html is set to false
- if (settings.verify_html === false) {
- settings.valid_elements = '*[*]';
- }
-
- validStyles = compileElementMap(settings.valid_styles);
- invalidStyles = compileElementMap(settings.invalid_styles, 'map');
- validClasses = compileElementMap(settings.valid_classes, 'map');
-
- // Setup map objects
- whiteSpaceElementsMap = createLookupTable(
- 'whitespace_elements',
- 'pre script noscript style textarea video audio iframe object code'
- );
- selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr');
- shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link ' +
- 'meta param embed source wbr track');
- boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize ' +
- 'noshade nowrap readonly selected autoplay loop controls');
- nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object ' +
- 'script pre code', shortEndedElementsMap);
- moveCaretBeforeOnEnterElementsMap = createLookupTable('move_caret_before_on_enter_elements', 'table', nonEmptyElementsMap);
- textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' +
- 'blockquote center dir fieldset header footer article section hgroup aside nav figure');
- blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' +
- 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' +
- 'datalist select optgroup figcaption', textBlockElementsMap);
- textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' +
- 'dfn code mark q sup sub samp');
-
- each((settings.special || 'script noscript noframes noembed title style textarea xmp').split(' '), function (name) {
- specialElements[name] = new RegExp('<\/' + name + '[^>]*>', 'gi');
- });
-
- // Converts a wildcard expression string to a regexp for example *a will become /.*a/.
- function patternToRegExp(str) {
- return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');
- }
-
- // Parses the specified valid_elements string and adds to the current rules
- // This function is a bit hard to read since it's heavily optimized for speed
- function addValidElements(validElements) {
- var ei, el, ai, al, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder,
- prefix, outputName, globalAttributes, globalAttributesOrder, key, value,
- elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/,
- attrRuleRegExp = /^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,
- hasPatternsRegExp = /[*?+]/;
-
- if (validElements) {
- // Split valid elements into an array with rules
- validElements = split(validElements, ',');
-
- if (elements['@']) {
- globalAttributes = elements['@'].attributes;
- globalAttributesOrder = elements['@'].attributesOrder;
- }
-
- // Loop all rules
- for (ei = 0, el = validElements.length; ei < el; ei++) {
- // Parse element rule
- matches = elementRuleRegExp.exec(validElements[ei]);
- if (matches) {
- // Setup local names for matches
- prefix = matches[1];
- elementName = matches[2];
- outputName = matches[3];
- attrData = matches[5];
-
- // Create new attributes and attributesOrder
- attributes = {};
- attributesOrder = [];
-
- // Create the new element
- element = {
- attributes: attributes,
- attributesOrder: attributesOrder
- };
-
- // Padd empty elements prefix
- if (prefix === '#') {
- element.paddEmpty = true;
- }
-
- // Remove empty elements prefix
- if (prefix === '-') {
- element.removeEmpty = true;
- }
-
- if (matches[4] === '!') {
- element.removeEmptyAttrs = true;
- }
-
- // Copy attributes from global rule into current rule
- if (globalAttributes) {
- for (key in globalAttributes) {
- attributes[key] = globalAttributes[key];
- }
-
- attributesOrder.push.apply(attributesOrder, globalAttributesOrder);
- }
-
- // Attributes defined
- if (attrData) {
- attrData = split(attrData, '|');
- for (ai = 0, al = attrData.length; ai < al; ai++) {
- matches = attrRuleRegExp.exec(attrData[ai]);
- if (matches) {
- attr = {};
- attrType = matches[1];
- attrName = matches[2].replace(/::/g, ':');
- prefix = matches[3];
- value = matches[4];
-
- // Required
- if (attrType === '!') {
- element.attributesRequired = element.attributesRequired || [];
- element.attributesRequired.push(attrName);
- attr.required = true;
- }
-
- // Denied from global
- if (attrType === '-') {
- delete attributes[attrName];
- attributesOrder.splice(inArray(attributesOrder, attrName), 1);
- continue;
- }
-
- // Default value
- if (prefix) {
- // Default value
- if (prefix === '=') {
- element.attributesDefault = element.attributesDefault || [];
- element.attributesDefault.push({ name: attrName, value: value });
- attr.defaultValue = value;
- }
-
- // Forced value
- if (prefix === ':') {
- element.attributesForced = element.attributesForced || [];
- element.attributesForced.push({ name: attrName, value: value });
- attr.forcedValue = value;
- }
-
- // Required values
- if (prefix === '<') {
- attr.validValues = makeMap(value, '?');
- }
- }
-
- // Check for attribute patterns
- if (hasPatternsRegExp.test(attrName)) {
- element.attributePatterns = element.attributePatterns || [];
- attr.pattern = patternToRegExp(attrName);
- element.attributePatterns.push(attr);
- } else {
- // Add attribute to order list if it doesn't already exist
- if (!attributes[attrName]) {
- attributesOrder.push(attrName);
- }
-
- attributes[attrName] = attr;
- }
- }
- }
- }
-
- // Global rule, store away these for later usage
- if (!globalAttributes && elementName == '@') {
- globalAttributes = attributes;
- globalAttributesOrder = attributesOrder;
- }
-
- // Handle substitute elements such as b/strong
- if (outputName) {
- element.outputName = elementName;
- elements[outputName] = element;
- }
-
- // Add pattern or exact element
- if (hasPatternsRegExp.test(elementName)) {
- element.pattern = patternToRegExp(elementName);
- patternElements.push(element);
- } else {
- elements[elementName] = element;
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var mapCache = {};
+ var dummyObj = {};
+ var makeMap$2 = $_52qop8kjfuw8l6v.makeMap;
+ var each$4 = $_52qop8kjfuw8l6v.each;
+ var extend$1 = $_52qop8kjfuw8l6v.extend;
+ var explode$1 = $_52qop8kjfuw8l6v.explode;
+ var inArray$1 = $_52qop8kjfuw8l6v.inArray;
+ var split = function (items, delim) {
+ items = $_52qop8kjfuw8l6v.trim(items);
+ return items ? items.split(delim || ' ') : [];
+ };
+ var compileSchema = function (type) {
+ var schema = {};
+ var globalAttributes, blockContent;
+ var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent;
+ var add = function (name, attributes, children) {
+ var ni, attributesOrder, element;
+ var arrayToMap = function (array, obj) {
+ var map = {};
+ var i, l;
+ for (i = 0, l = array.length; i < l; i++) {
+ map[array[i]] = obj || {};
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return map;
+ };
+ children = children || [];
+ attributes = attributes || '';
+ if (typeof children === 'string') {
+ children = split(children);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function setValidElements(validElements) {
- elements = {};
- patternElements = [];
-
- addValidElements(validElements);
-
- each(schemaItems, function (element, name) {
- children[name] = element.children;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ name = split(name);
+ ni = name.length;
+ while (ni--) {
+ attributesOrder = split([
+ globalAttributes,
+ attributes
+ ].join(' '));
+ element = {
+ attributes: arrayToMap(attributesOrder),
+ attributesOrder: attributesOrder,
+ children: arrayToMap(children, dummyObj)
+ };
+ schema[name[ni]] = element;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Adds custom non HTML elements to the schema
- function addCustomElements(customElements) {
- var customElementRegExp = /^(~)?(.+)$/;
-
- if (customElements) {
- // Flush cached items since we are altering the default maps
- mapCache.text_block_elements = mapCache.block_elements = null;
-
- each(split(customElements, ','), function (rule) {
- var matches = customElementRegExp.exec(rule),
- inline = matches[1] === '~',
- cloneName = inline ? 'span' : 'div',
- name = matches[2];
-
- children[name] = children[cloneName];
- customElementsMap[name] = cloneName;
-
- // If it's not marked as inline then add it to valid block elements
- if (!inline) {
- blockElementsMap[name.toUpperCase()] = {};
- blockElementsMap[name] = {};
- }
-
- // Add elements clone if needed
- if (!elements[name]) {
- var customRule = elements[cloneName];
-
- customRule = extend({}, customRule);
- delete customRule.removeEmptyAttrs;
- delete customRule.removeEmpty;
-
- elements[name] = customRule;
- }
-
- // Add custom elements at span/div positions
- each(children, function (element, elmName) {
- if (element[cloneName]) {
- children[elmName] = element = extend({}, children[elmName]);
- element[name] = element[cloneName];
- }
- });
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var addAttrs = function (name, attributes) {
+ var ni, schemaItem, i, l;
+ name = split(name);
+ ni = name.length;
+ attributes = split(attributes);
+ while (ni--) {
+ schemaItem = schema[name[ni]];
+ for (i = 0, l = attributes.length; i < l; i++) {
+ schemaItem.attributes[attributes[i]] = {};
+ schemaItem.attributesOrder.push(attributes[i]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Adds valid children to the schema object
- function addValidChildren(validChildren) {
- var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/;
-
- // Invalidate the schema cache if the schema is mutated
- mapCache[settings.schema] = null;
-
- if (validChildren) {
- each(split(validChildren, ','), function (rule) {
- var matches = childRuleRegExp.exec(rule), parent, prefix;
-
- if (matches) {
- prefix = matches[1];
-
- // Add/remove items from default
- if (prefix) {
- parent = children[matches[2]];
- } else {
- parent = children[matches[2]] = { '#comment': {} };
- }
-
- parent = children[matches[2]];
-
- each(split(matches[3], '|'), function (child) {
- if (prefix === '-') {
- delete parent[child];
- } else {
- parent[child] = {};
- }
- });
- }
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (mapCache[type]) {
+ return mapCache[type];
+ }
+ globalAttributes = 'id accesskey class dir lang style tabindex title role';
+ blockContent = 'address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul';
+ phrasingContent = 'a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd ' + 'label map noscript object q s samp script select small span strong sub sup ' + 'textarea u var #text #comment';
+ if (type !== 'html4') {
+ globalAttributes += ' contenteditable contextmenu draggable dropzone ' + 'hidden spellcheck translate';
+ blockContent += ' article aside details dialog figure header footer hgroup section nav';
+ phrasingContent += ' audio canvas command datalist mark meter output picture ' + 'progress time wbr video ruby bdi keygen';
+ }
+ if (type !== 'html5-strict') {
+ globalAttributes += ' xml:lang';
+ html4PhrasingContent = 'acronym applet basefont big font strike tt';
+ phrasingContent = [
+ phrasingContent,
+ html4PhrasingContent
+ ].join(' ');
+ each$4(split(html4PhrasingContent), function (name) {
+ add(name, '', phrasingContent);
+ });
+ html4BlockContent = 'center dir isindex noframes';
+ blockContent = [
+ blockContent,
+ html4BlockContent
+ ].join(' ');
+ flowContent = [
+ blockContent,
+ phrasingContent
+ ].join(' ');
+ each$4(split(html4BlockContent), function (name) {
+ add(name, '', flowContent);
+ });
+ }
+ flowContent = flowContent || [
+ blockContent,
+ phrasingContent
+ ].join(' ');
+ add('html', 'manifest', 'head body');
+ add('head', '', 'base command link meta noscript script style title');
+ add('title hr noscript br');
+ add('base', 'href target');
+ add('link', 'href rel media hreflang type sizes hreflang');
+ add('meta', 'name http-equiv content charset');
+ add('style', 'media type scoped');
+ add('script', 'src async defer type charset');
+ add('body', 'onafterprint onbeforeprint onbeforeunload onblur onerror onfocus ' + 'onhashchange onload onmessage onoffline ononline onpagehide onpageshow ' + 'onpopstate onresize onscroll onstorage onunload', flowContent);
+ add('address dt dd div caption', '', flowContent);
+ add('h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn', '', phrasingContent);
+ add('blockquote', 'cite', flowContent);
+ add('ol', 'reversed start type', 'li');
+ add('ul', '', 'li');
+ add('li', 'value', flowContent);
+ add('dl', '', 'dt dd');
+ add('a', 'href target rel media hreflang type', phrasingContent);
+ add('q', 'cite', phrasingContent);
+ add('ins del', 'cite datetime', flowContent);
+ add('img', 'src sizes srcset alt usemap ismap width height');
+ add('iframe', 'src name width height', flowContent);
+ add('embed', 'src type width height');
+ add('object', 'data type typemustmatch name usemap form width height', [
+ flowContent,
+ 'param'
+ ].join(' '));
+ add('param', 'name value');
+ add('map', 'name', [
+ flowContent,
+ 'area'
+ ].join(' '));
+ add('area', 'alt coords shape href target rel media hreflang type');
+ add('table', 'border', 'caption colgroup thead tfoot tbody tr' + (type === 'html4' ? ' col' : ''));
+ add('colgroup', 'span', 'col');
+ add('col', 'span');
+ add('tbody thead tfoot', '', 'tr');
+ add('tr', '', 'td th');
+ add('td', 'colspan rowspan headers', flowContent);
+ add('th', 'colspan rowspan headers scope abbr', flowContent);
+ add('form', 'accept-charset action autocomplete enctype method name novalidate target', flowContent);
+ add('fieldset', 'disabled form name', [
+ flowContent,
+ 'legend'
+ ].join(' '));
+ add('label', 'form for', phrasingContent);
+ add('input', 'accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate ' + 'formtarget height list max maxlength min multiple name pattern readonly required size src step type value width');
+ add('button', 'disabled form formaction formenctype formmethod formnovalidate formtarget name type value', type === 'html4' ? flowContent : phrasingContent);
+ add('select', 'disabled form multiple name required size', 'option optgroup');
+ add('optgroup', 'disabled label', 'option');
+ add('option', 'disabled label selected value');
+ add('textarea', 'cols dirname disabled form maxlength name readonly required rows wrap');
+ add('menu', 'type label', [
+ flowContent,
+ 'li'
+ ].join(' '));
+ add('noscript', '', flowContent);
+ if (type !== 'html4') {
+ add('wbr');
+ add('ruby', '', [
+ phrasingContent,
+ 'rt rp'
+ ].join(' '));
+ add('figcaption', '', flowContent);
+ add('mark rt rp summary bdi', '', phrasingContent);
+ add('canvas', 'width height', flowContent);
+ add('video', 'src crossorigin poster preload autoplay mediagroup loop ' + 'muted controls width height buffered', [
+ flowContent,
+ 'track source'
+ ].join(' '));
+ add('audio', 'src crossorigin preload autoplay mediagroup loop muted controls ' + 'buffered volume', [
+ flowContent,
+ 'track source'
+ ].join(' '));
+ add('picture', '', 'img source');
+ add('source', 'src srcset type media sizes');
+ add('track', 'kind src srclang label default');
+ add('datalist', '', [
+ phrasingContent,
+ 'option'
+ ].join(' '));
+ add('article section nav aside header footer', '', flowContent);
+ add('hgroup', '', 'h1 h2 h3 h4 h5 h6');
+ add('figure', '', [
+ flowContent,
+ 'figcaption'
+ ].join(' '));
+ add('time', 'datetime', phrasingContent);
+ add('dialog', 'open', flowContent);
+ add('command', 'type label icon disabled checked radiogroup command');
+ add('output', 'for form name', phrasingContent);
+ add('progress', 'value max', phrasingContent);
+ add('meter', 'value min max low high optimum', phrasingContent);
+ add('details', 'open', [
+ flowContent,
+ 'summary'
+ ].join(' '));
+ add('keygen', 'autofocus challenge disabled form keytype name');
+ }
+ if (type !== 'html5-strict') {
+ addAttrs('script', 'language xml:space');
+ addAttrs('style', 'xml:space');
+ addAttrs('object', 'declare classid code codebase codetype archive standby align border hspace vspace');
+ addAttrs('embed', 'align name hspace vspace');
+ addAttrs('param', 'valuetype type');
+ addAttrs('a', 'charset name rev shape coords');
+ addAttrs('br', 'clear');
+ addAttrs('applet', 'codebase archive code object alt name width height align hspace vspace');
+ addAttrs('img', 'name longdesc align border hspace vspace');
+ addAttrs('iframe', 'longdesc frameborder marginwidth marginheight scrolling align');
+ addAttrs('font basefont', 'size color face');
+ addAttrs('input', 'usemap align');
+ addAttrs('select', 'onchange');
+ addAttrs('textarea');
+ addAttrs('h1 h2 h3 h4 h5 h6 div p legend caption', 'align');
+ addAttrs('ul', 'type compact');
+ addAttrs('li', 'type');
+ addAttrs('ol dl menu dir', 'compact');
+ addAttrs('pre', 'width xml:space');
+ addAttrs('hr', 'align noshade size width');
+ addAttrs('isindex', 'prompt');
+ addAttrs('table', 'summary width frame rules cellspacing cellpadding align bgcolor');
+ addAttrs('col', 'width align char charoff valign');
+ addAttrs('colgroup', 'width align char charoff valign');
+ addAttrs('thead', 'align char charoff valign');
+ addAttrs('tr', 'align char charoff valign bgcolor');
+ addAttrs('th', 'axis align char charoff valign nowrap bgcolor width height');
+ addAttrs('form', 'accept');
+ addAttrs('td', 'abbr axis scope align char charoff valign nowrap bgcolor width height');
+ addAttrs('tfoot', 'align char charoff valign');
+ addAttrs('tbody', 'align char charoff valign');
+ addAttrs('area', 'nohref');
+ addAttrs('body', 'background bgcolor text link vlink alink');
+ }
+ if (type !== 'html4') {
+ addAttrs('input button select textarea', 'autofocus');
+ addAttrs('input textarea', 'placeholder');
+ addAttrs('a', 'download');
+ addAttrs('link script img', 'crossorigin');
+ addAttrs('iframe', 'sandbox seamless allowfullscreen');
+ }
+ each$4(split('a form meter progress dfn'), function (name) {
+ if (schema[name]) {
+ delete schema[name].children[name];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getElementRule(name) {
- var element = elements[name], i;
-
- // Exact match found
- if (element) {
- return element;
- }
-
- // No exact match then try the patterns
- i = patternElements.length;
- while (i--) {
- element = patternElements[i];
-
- if (element.pattern.test(name)) {
- return element;
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ delete schema.caption.children.table;
+ delete schema.script;
+ mapCache[type] = schema;
+ return schema;
+ };
+ var compileElementMap = function (value, mode) {
+ var styles;
+ if (value) {
+ styles = {};
+ if (typeof value === 'string') {
+ value = { '*': value };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!settings.valid_elements) {
- // No valid elements defined then clone the elements from the schema spec
- each(schemaItems, function (element, name) {
- elements[name] = {
- attributes: element.attributes,
- attributesOrder: element.attributesOrder
- };
-
- children[name] = element.children;
- });
-
- // Switch these on HTML4
- if (settings.schema != "html5") {
- each(split('strong/b em/i'), function (item) {
- item = split(item, '/');
- elements[item[1]].outputName = item[0];
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ each$4(value, function (value, key) {
+ styles[key] = styles[key.toUpperCase()] = mode === 'map' ? makeMap$2(value, /[, ]/) : explode$1(value, /[, ]/);
+ });
+ }
+ return styles;
+ };
+ function Schema(settings) {
+ var elements = {};
+ var children = {};
+ var patternElements = [];
+ var validStyles;
+ var invalidStyles;
+ var schemaItems;
+ var whiteSpaceElementsMap, selfClosingElementsMap, shortEndedElementsMap, boolAttrMap, validClasses;
+ var blockElementsMap, nonEmptyElementsMap, moveCaretBeforeOnEnterElementsMap, textBlockElementsMap, textInlineElementsMap;
+ var customElementsMap = {}, specialElements = {};
+ var createLookupTable = function (option, defaultValue, extendWith) {
+ var value = settings[option];
+ if (!value) {
+ value = mapCache[option];
+ if (!value) {
+ value = makeMap$2(defaultValue, ' ', makeMap$2(defaultValue.toUpperCase(), ' '));
+ value = extend$1(value, extendWith);
+ mapCache[option] = value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Add default alt attribute for images, removed since alt="" is treated as presentational.
- // elements.img.attributesDefault = [{name: 'alt', value: ''}];
-
- // Remove these if they are empty by default
- each(split('ol ul sub sup blockquote span font a table tbody tr strong em b i'), function (name) {
- if (elements[name]) {
- elements[name].removeEmpty = true;
- }
- });
-
- // Padd these by default
- each(split('p h1 h2 h3 h4 h5 h6 th td pre div address caption'), function (name) {
- elements[name].paddEmpty = true;
- });
-
- // Remove these if they have no attributes
- each(split('span'), function (name) {
- elements[name].removeEmptyAttrs = true;
- });
-
- // Remove these by default
- // TODO: Reenable in 4.1
- /*each(split('script style'), function(name) {
- delete elements[name];
- });*/
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- setValidElements(settings.valid_elements);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ value = makeMap$2(value, /[, ]/, makeMap$2(value.toUpperCase(), /[, ]/));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- addCustomElements(settings.custom_elements);
- addValidChildren(settings.valid_children);
- addValidElements(settings.extended_valid_elements);
-
- // Todo: Remove this when we fix list handling to be valid
- addValidChildren('+ol[ul|ol],+ul[ul|ol]');
-
-
- // Some elements are not valid by themselves - require parents
- each({
- dd: 'dl',
- dt: 'dl',
- li: 'ul ol',
- td: 'tr',
- th: 'tr',
- tr: 'tbody thead tfoot',
- tbody: 'table',
- thead: 'table',
- tfoot: 'table',
- legend: 'fieldset',
- area: 'map',
- param: 'video audio object'
- }, function (parents, item) {
- if (elements[item]) {
- elements[item].parentsRequired = split(parents);
- }
- });
-
-
- // Delete invalid elements
- if (settings.invalid_elements) {
- each(explode(settings.invalid_elements), function (item) {
- if (elements[item]) {
- delete elements[item];
- }
- });
- }
-
- // If the user didn't allow span only allow internal spans
- if (!getElementRule('span')) {
- addValidElements('span[!data-mce-type|*]');
- }
-
- /**
- * Name/value map object with valid parents and children to those parents.
- *
- * @example
- * children = {
- * div:{p:{}, h1:{}}
- * };
- * @field children
- * @type Object
- */
- self.children = children;
-
- /**
- * Name/value map object with valid styles for each element.
- *
- * @method getValidStyles
- * @type Object
- */
- self.getValidStyles = function () {
- return validStyles;
- };
-
- /**
- * Name/value map object with valid styles for each element.
- *
- * @method getInvalidStyles
- * @type Object
- */
- self.getInvalidStyles = function () {
- return invalidStyles;
- };
-
- /**
- * Name/value map object with valid classes for each element.
- *
- * @method getValidClasses
- * @type Object
- */
- self.getValidClasses = function () {
- return validClasses;
- };
-
- /**
- * Returns a map with boolean attributes.
- *
- * @method getBoolAttrs
- * @return {Object} Name/value lookup map for boolean attributes.
- */
- self.getBoolAttrs = function () {
- return boolAttrMap;
- };
-
- /**
- * Returns a map with block elements.
- *
- * @method getBlockElements
- * @return {Object} Name/value lookup map for block elements.
- */
- self.getBlockElements = function () {
- return blockElementsMap;
- };
-
- /**
- * Returns a map with text block elements. Such as: p,h1-h6,div,address
- *
- * @method getTextBlockElements
- * @return {Object} Name/value lookup map for block elements.
- */
- self.getTextBlockElements = function () {
- return textBlockElementsMap;
- };
-
- /**
- * Returns a map of inline text format nodes for example strong/span or ins.
- *
- * @method getTextInlineElements
- * @return {Object} Name/value lookup map for text format elements.
- */
- self.getTextInlineElements = function () {
- return textInlineElementsMap;
- };
-
- /**
- * Returns a map with short ended elements such as BR or IMG.
- *
- * @method getShortEndedElements
- * @return {Object} Name/value lookup map for short ended elements.
- */
- self.getShortEndedElements = function () {
- return shortEndedElementsMap;
- };
-
- /**
- * Returns a map with self closing tags such as <li>.
- *
- * @method getSelfClosingElements
- * @return {Object} Name/value lookup map for self closing tags elements.
- */
- self.getSelfClosingElements = function () {
- return selfClosingElementsMap;
- };
-
- /**
- * Returns a map with elements that should be treated as contents regardless if it has text
- * content in them or not such as TD, VIDEO or IMG.
- *
- * @method getNonEmptyElements
- * @return {Object} Name/value lookup map for non empty elements.
- */
- self.getNonEmptyElements = function () {
- return nonEmptyElementsMap;
- };
-
- /**
- * Returns a map with elements that the caret should be moved in front of after enter is
- * pressed
- *
- * @method getMoveCaretBeforeOnEnterElements
- * @return {Object} Name/value lookup map for elements to place the caret in front of.
- */
- self.getMoveCaretBeforeOnEnterElements = function () {
- return moveCaretBeforeOnEnterElementsMap;
- };
-
- /**
- * Returns a map with elements where white space is to be preserved like PRE or SCRIPT.
- *
- * @method getWhiteSpaceElements
- * @return {Object} Name/value lookup map for white space elements.
- */
- self.getWhiteSpaceElements = function () {
- return whiteSpaceElementsMap;
- };
-
- /**
- * Returns a map with special elements. These are elements that needs to be parsed
- * in a special way such as script, style, textarea etc. The map object values
- * are regexps used to find the end of the element.
- *
- * @method getSpecialElements
- * @return {Object} Name/value lookup map for special elements.
- */
- self.getSpecialElements = function () {
- return specialElements;
- };
-
- /**
- * Returns true/false if the specified element and it's child is valid or not
- * according to the schema.
- *
- * @method isValidChild
- * @param {String} name Element name to check for.
- * @param {String} child Element child to verify.
- * @return {Boolean} True/false if the element is a valid child of the specified parent.
- */
- self.isValidChild = function (name, child) {
- var parent = children[name.toLowerCase()];
-
- return !!(parent && parent[child.toLowerCase()]);
- };
-
- /**
- * Returns true/false if the specified element name and optional attribute is
- * valid according to the schema.
- *
- * @method isValid
- * @param {String} name Name of element to check.
- * @param {String} attr Optional attribute name to check for.
- * @return {Boolean} True/false if the element and attribute is valid.
- */
- self.isValid = function (name, attr) {
- var attrPatterns, i, rule = getElementRule(name);
-
- // Check if it's a valid element
- if (rule) {
- if (attr) {
- // Check if attribute name exists
- if (rule.attributes[attr]) {
- return true;
- }
-
- // Check if attribute matches a regexp pattern
- attrPatterns = rule.attributePatterns;
- if (attrPatterns) {
- i = attrPatterns.length;
- while (i--) {
- if (attrPatterns[i].pattern.test(name)) {
- return true;
- }
- }
- }
- } else {
- return true;
- }
- }
-
- // No match
- return false;
- };
-
- /**
- * Returns true/false if the specified element is valid or not
- * according to the schema.
- *
- * @method getElementRule
- * @param {String} name Element name to check for.
- * @return {Object} Element object or undefined if the element isn't valid.
- */
- self.getElementRule = getElementRule;
-
- /**
- * Returns an map object of all custom elements.
- *
- * @method getCustomElements
- * @return {Object} Name/value map object of all custom elements.
- */
- self.getCustomElements = function () {
- return customElementsMap;
- };
-
- /**
- * Parses a valid elements string and adds it to the schema. The valid elements
- * format is for example "element[attr=default|otherattr]".
- * Existing rules will be replaced with the ones specified, so this extends the schema.
- *
- * @method addValidElements
- * @param {String} valid_elements String in the valid elements format to be parsed.
- */
- self.addValidElements = addValidElements;
-
- /**
- * Parses a valid elements string and sets it to the schema. The valid elements
- * format is for example "element[attr=default|otherattr]".
- * Existing rules will be replaced with the ones specified, so this extends the schema.
- *
- * @method setValidElements
- * @param {String} valid_elements String in the valid elements format to be parsed.
- */
- self.setValidElements = setValidElements;
-
- /**
- * Adds custom non HTML elements to the schema.
- *
- * @method addCustomElements
- * @param {String} custom_elements Comma separated list of custom elements to add.
- */
- self.addCustomElements = addCustomElements;
-
- /**
- * Parses a valid children string and adds them to the schema structure. The valid children
- * format is for example: "element[child1|child2]".
- *
- * @method addValidChildren
- * @param {String} valid_children Valid children elements string to parse
- */
- self.addValidChildren = addValidChildren;
-
- self.elements = elements;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Styles.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class is used to parse CSS styles it also compresses styles to reduce the output size.
- *
- * @example
- * var Styles = new tinymce.html.Styles({
- * url_converter: function(url) {
- * return url;
- * }
- * });
- *
- * styles = Styles.parse('border: 1px solid red');
- * styles.color = 'red';
- *
- * console.log(new tinymce.html.StyleSerializer().serialize(styles));
- *
- * @class tinymce.html.Styles
- * @version 3.4
- */
-define(
- 'tinymce.core.html.Styles',
- [
- ],
- function () {
- return function (settings, schema) {
- /*jshint maxlen:255 */
- /*eslint max-len:0 */
- var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,
- urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,
- styleRegExp = /\s*([^:]+):\s*([^;]+);?/g,
- trimRightRegExp = /\s+$/,
- i, encodingLookup = {}, encodingItems, validStyles, invalidStyles, invisibleChar = '\uFEFF';
-
- settings = settings || {};
-
- if (schema) {
- validStyles = schema.getValidStyles();
- invalidStyles = schema.getInvalidStyles();
- }
-
- encodingItems = ('\\" \\\' \\; \\: ; : ' + invisibleChar).split(' ');
- for (i = 0; i < encodingItems.length; i++) {
- encodingLookup[encodingItems[i]] = invisibleChar + i;
- encodingLookup[invisibleChar + i] = encodingItems[i];
- }
-
- function toHex(match, r, g, b) {
- function hex(val) {
- val = parseInt(val, 10).toString(16);
-
- return val.length > 1 ? val : '0' + val; // 0 -> 00
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ settings = settings || {};
+ schemaItems = compileSchema(settings.schema);
+ if (settings.verify_html === false) {
+ settings.valid_elements = '*[*]';
+ }
+ validStyles = compileElementMap(settings.valid_styles);
+ invalidStyles = compileElementMap(settings.invalid_styles, 'map');
+ validClasses = compileElementMap(settings.valid_classes, 'map');
+ whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea video audio iframe object code');
+ selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr');
+ shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link ' + 'meta param embed source wbr track');
+ boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize ' + 'noshade nowrap readonly selected autoplay loop controls');
+ nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object ' + 'script pre code', shortEndedElementsMap);
+ moveCaretBeforeOnEnterElementsMap = createLookupTable('move_caret_before_on_enter_elements', 'table', nonEmptyElementsMap);
+ textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + 'blockquote center dir fieldset header footer article section hgroup aside nav figure');
+ blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' + 'datalist select optgroup figcaption', textBlockElementsMap);
+ textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font strike u var cite ' + 'dfn code mark q sup sub samp');
+ each$4((settings.special || 'script noscript noframes noembed title style textarea xmp').split(' '), function (name) {
+ specialElements[name] = new RegExp('</' + name + '[^>]*>', 'gi');
+ });
+ var patternToRegExp = function (str) {
+ return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');
+ };
+ var addValidElements = function (validElements) {
+ var ei, el, ai, al, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder, prefix, outputName, globalAttributes, globalAttributesOrder, key, value;
+ var elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/, attrRuleRegExp = /^([!\-])?(\w+[\\:]:\w+|[^=:<]+)?(?:([=:<])(.*))?$/, hasPatternsRegExp = /[*?+]/;
+ if (validElements) {
+ validElements = split(validElements, ',');
+ if (elements['@']) {
+ globalAttributes = elements['@'].attributes;
+ globalAttributesOrder = elements['@'].attributesOrder;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return '#' + hex(r) + hex(g) + hex(b);
- }
-
- return {
- /**
- * Parses the specified RGB color value and returns a hex version of that color.
- *
- * @method toHex
- * @param {String} color RGB string value like rgb(1,2,3)
- * @return {String} Hex version of that RGB value like #FF00FF.
- */
- toHex: function (color) {
- return color.replace(rgbRegExp, toHex);
- },
-
- /**
- * Parses the specified style value into an object collection. This parser will also
- * merge and remove any redundant items that browsers might have added. It will also convert non hex
- * colors to hex values. Urls inside the styles will also be converted to absolute/relative based on settings.
- *
- * @method parse
- * @param {String} css Style value to parse for example: border:1px solid red;.
- * @return {Object} Object representation of that style like {border: '1px solid red'}
- */
- parse: function (css) {
- var styles = {}, matches, name, value, isEncoded, urlConverter = settings.url_converter;
- var urlConverterScope = settings.url_converter_scope || this;
-
- function compress(prefix, suffix, noJoin) {
- var top, right, bottom, left;
-
- top = styles[prefix + '-top' + suffix];
- if (!top) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (ei = 0, el = validElements.length; ei < el; ei++) {
+ matches = elementRuleRegExp.exec(validElements[ei]);
+ if (matches) {
+ prefix = matches[1];
+ elementName = matches[2];
+ outputName = matches[3];
+ attrData = matches[5];
+ attributes = {};
+ attributesOrder = [];
+ element = {
+ attributes: attributes,
+ attributesOrder: attributesOrder
+ };
+ if (prefix === '#') {
+ element.paddEmpty = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- right = styles[prefix + '-right' + suffix];
- if (!right) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (prefix === '-') {
+ element.removeEmpty = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- bottom = styles[prefix + '-bottom' + suffix];
- if (!bottom) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (matches[4] === '!') {
+ element.removeEmptyAttrs = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- left = styles[prefix + '-left' + suffix];
- if (!left) {
- return;
- }
-
- var box = [top, right, bottom, left];
- i = box.length - 1;
- while (i--) {
- if (box[i] !== box[i + 1]) {
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (globalAttributes) {
+ for (key in globalAttributes) {
+ attributes[key] = globalAttributes[key];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ attributesOrder.push.apply(attributesOrder, globalAttributesOrder);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (i > -1 && noJoin) {
- return;
- }
-
- styles[prefix + suffix] = i == -1 ? box[0] : box.join(' ');
- delete styles[prefix + '-top' + suffix];
- delete styles[prefix + '-right' + suffix];
- delete styles[prefix + '-bottom' + suffix];
- delete styles[prefix + '-left' + suffix];
- }
-
- /**
- * Checks if the specific style can be compressed in other words if all border-width are equal.
- */
- function canCompress(key) {
- var value = styles[key], i;
-
- if (!value) {
- return;
- }
-
- value = value.split(' ');
- i = value.length;
- while (i--) {
- if (value[i] !== value[0]) {
- return false;
- }
- }
-
- styles[key] = value[0];
-
- return true;
- }
-
- /**
- * Compresses multiple styles into one style.
- */
- function compress2(target, a, b, c) {
- if (!canCompress(a)) {
- return;
- }
-
- if (!canCompress(b)) {
- return;
- }
-
- if (!canCompress(c)) {
- return;
- }
-
- // Compress
- styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c];
- delete styles[a];
- delete styles[b];
- delete styles[c];
- }
-
- // Encodes the specified string by replacing all \" \' ; : with _<num>
- function encode(str) {
- isEncoded = true;
-
- return encodingLookup[str];
- }
-
- // Decodes the specified string by replacing all _<num> with it's original value \" \' etc
- // It will also decode the \" \' if keepSlashes is set to fale or omitted
- function decode(str, keepSlashes) {
- if (isEncoded) {
- str = str.replace(/\uFEFF[0-9]/g, function (str) {
- return encodingLookup[str];
- });
- }
-
- if (!keepSlashes) {
- str = str.replace(/\\([\'\";:])/g, "$1");
- }
-
- return str;
- }
-
- function decodeSingleHexSequence(escSeq) {
- return String.fromCharCode(parseInt(escSeq.slice(1), 16));
- }
-
- function decodeHexSequences(value) {
- return value.replace(/\\[0-9a-f]+/gi, decodeSingleHexSequence);
- }
-
- function processUrl(match, url, url2, url3, str, str2) {
- str = str || str2;
-
- if (str) {
- str = decode(str);
-
- // Force strings into single quote format
- return "'" + str.replace(/\'/g, "\\'") + "'";
- }
-
- url = decode(url || url2 || url3);
-
- if (!settings.allow_script_urls) {
- var scriptUrl = url.replace(/[\s\r\n]+/g, '');
-
- if (/(java|vb)script:/i.test(scriptUrl)) {
- return "";
- }
-
- if (!settings.allow_svg_data_urls && /^data:image\/svg/i.test(scriptUrl)) {
- return "";
- }
- }
-
- // Convert the URL to relative/absolute depending on config
- if (urlConverter) {
- url = urlConverter.call(urlConverterScope, url, 'style');
- }
-
- // Output new URL format
- return "url('" + url.replace(/\'/g, "\\'") + "')";
- }
-
- if (css) {
- css = css.replace(/[\u0000-\u001F]/g, '');
-
- // Encode \" \' % and ; and : inside strings so they don't interfere with the style parsing
- css = css.replace(/\\[\"\';:\uFEFF]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function (str) {
- return str.replace(/[;:]/g, encode);
- });
-
- // Parse styles
- while ((matches = styleRegExp.exec(css))) {
- styleRegExp.lastIndex = matches.index + matches[0].length;
- name = matches[1].replace(trimRightRegExp, '').toLowerCase();
- value = matches[2].replace(trimRightRegExp, '');
-
- if (name && value) {
- // Decode escaped sequences like \65 -> e
- name = decodeHexSequences(name);
- value = decodeHexSequences(value);
-
- // Skip properties with double quotes and sequences like \" \' in their names
- // See 'mXSS Attacks: Attacking well-secured Web-Applications by using innerHTML Mutations'
- // https://cure53.de/fp170.pdf
- if (name.indexOf(invisibleChar) !== -1 || name.indexOf('"') !== -1) {
- continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (attrData) {
+ attrData = split(attrData, '|');
+ for (ai = 0, al = attrData.length; ai < al; ai++) {
+ matches = attrRuleRegExp.exec(attrData[ai]);
+ if (matches) {
+ attr = {};
+ attrType = matches[1];
+ attrName = matches[2].replace(/[\\:]:/g, ':');
+ prefix = matches[3];
+ value = matches[4];
+ if (attrType === '!') {
+ element.attributesRequired = element.attributesRequired || [];
+ element.attributesRequired.push(attrName);
+ attr.required = true;
+ }
+ if (attrType === '-') {
+ delete attributes[attrName];
+ attributesOrder.splice(inArray$1(attributesOrder, attrName), 1);
+ continue;
+ }
+ if (prefix) {
+ if (prefix === '=') {
+ element.attributesDefault = element.attributesDefault || [];
+ element.attributesDefault.push({
+ name: attrName,
+ value: value
+ });
+ attr.defaultValue = value;
+ }
+ if (prefix === ':') {
+ element.attributesForced = element.attributesForced || [];
+ element.attributesForced.push({
+ name: attrName,
+ value: value
+ });
+ attr.forcedValue = value;
+ }
+ if (prefix === '<') {
+ attr.validValues = makeMap$2(value, '?');
+ }
+ }
+ if (hasPatternsRegExp.test(attrName)) {
+ element.attributePatterns = element.attributePatterns || [];
+ attr.pattern = patternToRegExp(attrName);
+ element.attributePatterns.push(attr);
+ } else {
+ if (!attributes[attrName]) {
+ attributesOrder.push(attrName);
+ }
+ attributes[attrName] = attr;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Don't allow behavior name or expression/comments within the values
- if (!settings.allow_script_urls && (name == "behavior" || /expression\s*\(|\/\*|\*\//.test(value))) {
- continue;
- }
-
- // Opera will produce 700 instead of bold in their style values
- if (name === 'font-weight' && value === '700') {
- value = 'bold';
- } else if (name === 'color' || name === 'background-color') { // Lowercase colors like RED
- value = value.toLowerCase();
- }
-
- // Convert RGB colors to HEX
- value = value.replace(rgbRegExp, toHex);
-
- // Convert URLs and force them into url('value') format
- value = value.replace(urlOrStrRegExp, processUrl);
- styles[name] = isEncoded ? decode(value, true) : value;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Compress the styles to reduce it's size for example IE will expand styles
- compress("border", "", true);
- compress("border", "-width");
- compress("border", "-color");
- compress("border", "-style");
- compress("padding", "");
- compress("margin", "");
- compress2('border', 'border-width', 'border-style', 'border-color');
-
- // Remove pointless border, IE produces these
- if (styles.border === 'medium none') {
- delete styles.border;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!globalAttributes && elementName === '@') {
+ globalAttributes = attributes;
+ globalAttributesOrder = attributesOrder;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // IE 11 will produce a border-image: none when getting the style attribute from <p style="border: 1px solid red"></p>
- // So let us assume it shouldn't be there
- if (styles['border-image'] === 'none') {
- delete styles['border-image'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (outputName) {
+ element.outputName = elementName;
+ elements[outputName] = element;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return styles;
- },
-
- /**
- * Serializes the specified style object into a string.
- *
- * @method serialize
- * @param {Object} styles Object to serialize as string for example: {border: '1px solid red'}
- * @param {String} elementName Optional element name, if specified only the styles that matches the schema will be serialized.
- * @return {String} String representation of the style object for example: border: 1px solid red.
- */
- serialize: function (styles, elementName) {
- var css = '', name, value;
-
- function serializeStyles(name) {
- var styleList, i, l, value;
-
- styleList = validStyles[name];
- if (styleList) {
- for (i = 0, l = styleList.length; i < l; i++) {
- name = styleList[i];
- value = styles[name];
-
- if (value) {
- css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (hasPatternsRegExp.test(elementName)) {
+ element.pattern = patternToRegExp(elementName);
+ patternElements.push(element);
+ } else {
+ elements[elementName] = element;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isValid(name, elementName) {
- var styleMap;
-
- styleMap = invalidStyles['*'];
- if (styleMap && styleMap[name]) {
- return false;
- }
-
- styleMap = invalidStyles[elementName];
- if (styleMap && styleMap[name]) {
- return false;
- }
-
- return true;
- }
-
- // Serialize styles according to schema
- if (elementName && validStyles) {
- // Serialize global styles and element specific styles
- serializeStyles('*');
- serializeStyles(elementName);
- } else {
- // Output the styles in the order they are inside the object
- for (name in styles) {
- value = styles[name];
-
- if (value && (!invalidStyles || isValid(name, elementName))) {
- css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';
- }
- }
- }
-
- return css;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * DOMUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Utility class for various DOM manipulation and retrieval functions.
- *
- * @class tinymce.dom.DOMUtils
- * @example
- * // Add a class to an element by id in the page
- * tinymce.DOM.addClass('someid', 'someclass');
- *
- * // Add a class to an element by id inside the editor
- * tinymce.activeEditor.dom.addClass('someid', 'someclass');
- */
-define(
- 'tinymce.core.dom.DOMUtils',
- [
- 'tinymce.core.dom.DomQuery',
- 'tinymce.core.dom.EventUtils',
- 'tinymce.core.dom.Range',
- 'tinymce.core.dom.Sizzle',
- 'tinymce.core.dom.StyleSheetLoader',
- 'tinymce.core.dom.TreeWalker',
- 'tinymce.core.Env',
- 'tinymce.core.html.Entities',
- 'tinymce.core.html.Schema',
- 'tinymce.core.html.Styles',
- 'tinymce.core.util.Tools'
- ],
- function (DomQuery, EventUtils, Range, Sizzle, StyleSheetLoader, TreeWalker, Env, Entities, Schema, Styles, Tools) {
- // Shorten names
- var each = Tools.each, is = Tools.is, grep = Tools.grep, trim = Tools.trim;
- var isIE = Env.ie;
- var simpleSelectorRe = /^([a-z0-9],?)+$/i;
- var whiteSpaceRegExp = /^[ \t\r\n]*$/;
-
- function setupAttrHooks(domUtils, settings) {
- var attrHooks = {}, keepValues = settings.keep_values, keepUrlHook;
-
- keepUrlHook = {
- set: function ($elm, value, name) {
- if (settings.url_converter) {
- value = settings.url_converter.call(settings.url_converter_scope || domUtils, value, name, $elm[0]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setValidElements = function (validElements) {
+ elements = {};
+ patternElements = [];
+ addValidElements(validElements);
+ each$4(schemaItems, function (element, name) {
+ children[name] = element.children;
+ });
+ };
+ var addCustomElements = function (customElements) {
+ var customElementRegExp = /^(~)?(.+)$/;
+ if (customElements) {
+ mapCache.text_block_elements = mapCache.block_elements = null;
+ each$4(split(customElements, ','), function (rule) {
+ var matches = customElementRegExp.exec(rule), inline = matches[1] === '~', cloneName = inline ? 'span' : 'div', name = matches[2];
+ children[name] = children[cloneName];
+ customElementsMap[name] = cloneName;
+ if (!inline) {
+ blockElementsMap[name.toUpperCase()] = {};
+ blockElementsMap[name] = {};
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $elm.attr('data-mce-' + name, value).attr(name, value);
- },
-
- get: function ($elm, name) {
- return $elm.attr('data-mce-' + name) || $elm.attr(name);
- }
- };
-
- attrHooks = {
- style: {
- set: function ($elm, value) {
- if (value !== null && typeof value === 'object') {
- $elm.css(value);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!elements[name]) {
+ var customRule = elements[cloneName];
+ customRule = extend$1({}, customRule);
+ delete customRule.removeEmptyAttrs;
+ delete customRule.removeEmpty;
+ elements[name] = customRule;
+ }
+ each$4(children, function (element, elmName) {
+ if (element[cloneName]) {
+ children[elmName] = element = extend$1({}, children[elmName]);
+ element[name] = element[cloneName];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (keepValues) {
- $elm.attr('data-mce-style', value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ });
+ }
+ };
+ var addValidChildren = function (validChildren) {
+ var childRuleRegExp = /^([+\-]?)(\w+)\[([^\]]+)\]$/;
+ mapCache[settings.schema] = null;
+ if (validChildren) {
+ each$4(split(validChildren, ','), function (rule) {
+ var matches = childRuleRegExp.exec(rule);
+ var parent, prefix;
+ if (matches) {
+ prefix = matches[1];
+ if (prefix) {
+ parent = children[matches[2]];
+ } else {
+ parent = children[matches[2]] = { '#comment': {} };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $elm.attr('style', value);
- },
-
- get: function ($elm) {
- var value = $elm.attr('data-mce-style') || $elm.attr('style');
-
- value = domUtils.serializeStyle(domUtils.parseStyle(value), $elm[0].nodeName);
-
- return value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent = children[matches[2]];
+ each$4(split(matches[3], '|'), function (child) {
+ if (prefix === '-') {
+ delete parent[child];
+ } else {
+ parent[child] = {};
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- };
-
- if (keepValues) {
- attrHooks.href = attrHooks.src = keepUrlHook;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return attrHooks;
- }
-
- function updateInternalStyleAttr(domUtils, $elm) {
- var value = $elm.attr('style');
-
- value = domUtils.serializeStyle(domUtils.parseStyle(value), $elm[0].nodeName);
-
- if (!value) {
- value = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getElementRule = function (name) {
+ var element = elements[name], i;
+ if (element) {
+ return element;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $elm.attr('data-mce-style', value);
- }
-
- function nodeIndex(node, normalized) {
- var idx = 0, lastNodeType, nodeType;
-
- if (node) {
- for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) {
- nodeType = node.nodeType;
-
- // Normalize text nodes
- if (normalized && nodeType == 3) {
- if (nodeType == lastNodeType || !node.nodeValue.length) {
- continue;
- }
- }
- idx++;
- lastNodeType = nodeType;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ i = patternElements.length;
+ while (i--) {
+ element = patternElements[i];
+ if (element.pattern.test(name)) {
+ return element;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return idx;
- }
-
- /**
- * Constructs a new DOMUtils instance. Consult the Wiki for more details on settings etc for this class.
- *
- * @constructor
- * @method DOMUtils
- * @param {Document} doc Document reference to bind the utility class to.
- * @param {settings} settings Optional settings collection.
- */
- function DOMUtils(doc, settings) {
- var self = this, blockElementsMap;
-
- self.doc = doc;
- self.win = window;
- self.files = {};
- self.counter = 0;
- self.stdMode = !isIE || doc.documentMode >= 8;
- self.boxModel = !isIE || doc.compatMode == "CSS1Compat" || self.stdMode;
- self.styleSheetLoader = new StyleSheetLoader(doc);
- self.boundEvents = [];
- self.settings = settings = settings || {};
- self.schema = settings.schema ? settings.schema : new Schema({});
- self.styles = new Styles({
- url_converter: settings.url_converter,
- url_converter_scope: settings.url_converter_scope
- }, settings.schema);
-
- self.fixDoc(doc);
- self.events = settings.ownEvents ? new EventUtils(settings.proxy) : EventUtils.Event;
- self.attrHooks = setupAttrHooks(self, settings);
- blockElementsMap = settings.schema ? settings.schema.getBlockElements() : {};
- self.$ = DomQuery.overrideDefaults(function () {
- return {
- context: doc,
- element: self.getRoot()
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (!settings.valid_elements) {
+ each$4(schemaItems, function (element, name) {
+ elements[name] = {
+ attributes: element.attributes,
+ attributesOrder: element.attributesOrder
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ children[name] = element.children;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns true/false if the specified element is a block element or not.
- *
- * @method isBlock
- * @param {Node/String} node Element/Node to check.
- * @return {Boolean} True/False state if the node is a block element or not.
- */
- self.isBlock = function (node) {
- // Fix for #5446
- if (!node) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (settings.schema !== 'html5') {
+ each$4(split('strong/b em/i'), function (item) {
+ item = split(item, '/');
+ elements[item[1]].outputName = item[0];
+ });
+ }
+ each$4(split('ol ul sub sup blockquote span font a table tbody tr strong em b i'), function (name) {
+ if (elements[name]) {
+ elements[name].removeEmpty = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // This function is called in module pattern style since it might be executed with the wrong this scope
- var type = node.nodeType;
-
- // If it's a node then check the type and use the nodeName
- if (type) {
- return !!(type === 1 && blockElementsMap[node.nodeName]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ each$4(split('p h1 h2 h3 h4 h5 h6 th td pre div address caption li'), function (name) {
+ elements[name].paddEmpty = true;
+ });
+ each$4(split('span'), function (name) {
+ elements[name].removeEmptyAttrs = true;
+ });
+ } else {
+ setValidElements(settings.valid_elements);
+ }
+ addCustomElements(settings.custom_elements);
+ addValidChildren(settings.valid_children);
+ addValidElements(settings.extended_valid_elements);
+ addValidChildren('+ol[ul|ol],+ul[ul|ol]');
+ each$4({
+ dd: 'dl',
+ dt: 'dl',
+ li: 'ul ol',
+ td: 'tr',
+ th: 'tr',
+ tr: 'tbody thead tfoot',
+ tbody: 'table',
+ thead: 'table',
+ tfoot: 'table',
+ legend: 'fieldset',
+ area: 'map',
+ param: 'video audio object'
+ }, function (parents, item) {
+ if (elements[item]) {
+ elements[item].parentsRequired = split(parents);
+ }
+ });
+ if (settings.invalid_elements) {
+ each$4(explode$1(settings.invalid_elements), function (item) {
+ if (elements[item]) {
+ delete elements[item];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return !!blockElementsMap[node];
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- DOMUtils.prototype = {
- $$: function (elm) {
- if (typeof elm == 'string') {
- elm = this.get(elm);
- }
-
- return this.$(elm);
- },
-
- root: null,
-
- fixDoc: function (doc) {
- var settings = this.settings, name;
-
- if (isIE && settings.schema) {
- // Add missing HTML 4/5 elements to IE
- ('abbr article aside audio canvas ' +
- 'details figcaption figure footer ' +
- 'header hgroup mark menu meter nav ' +
- 'output progress section summary ' +
- 'time video').replace(/\w+/g, function (name) {
- doc.createElement(name);
- });
-
- // Create all custom elements
- for (name in settings.schema.getCustomElements()) {
- doc.createElement(name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!getElementRule('span')) {
+ addValidElements('span[!data-mce-type|*]');
+ }
+ var getValidStyles = function () {
+ return validStyles;
+ };
+ var getInvalidStyles = function () {
+ return invalidStyles;
+ };
+ var getValidClasses = function () {
+ return validClasses;
+ };
+ var getBoolAttrs = function () {
+ return boolAttrMap;
+ };
+ var getBlockElements = function () {
+ return blockElementsMap;
+ };
+ var getTextBlockElements = function () {
+ return textBlockElementsMap;
+ };
+ var getTextInlineElements = function () {
+ return textInlineElementsMap;
+ };
+ var getShortEndedElements = function () {
+ return shortEndedElementsMap;
+ };
+ var getSelfClosingElements = function () {
+ return selfClosingElementsMap;
+ };
+ var getNonEmptyElements = function () {
+ return nonEmptyElementsMap;
+ };
+ var getMoveCaretBeforeOnEnterElements = function () {
+ return moveCaretBeforeOnEnterElementsMap;
+ };
+ var getWhiteSpaceElements = function () {
+ return whiteSpaceElementsMap;
+ };
+ var getSpecialElements = function () {
+ return specialElements;
+ };
+ var isValidChild = function (name, child) {
+ var parent = children[name.toLowerCase()];
+ return !!(parent && parent[child.toLowerCase()]);
+ };
+ var isValid = function (name, attr) {
+ var attrPatterns, i;
+ var rule = getElementRule(name);
+ if (rule) {
+ if (attr) {
+ if (rule.attributes[attr]) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- },
-
- clone: function (node, deep) {
- var self = this, clone, doc;
-
- // TODO: Add feature detection here in the future
- if (!isIE || node.nodeType !== 1 || deep) {
- return node.cloneNode(deep);
- }
-
- doc = self.doc;
-
- // Make a HTML5 safe shallow copy
- if (!deep) {
- clone = doc.createElement(node.nodeName);
-
- // Copy attribs
- each(self.getAttribs(node), function (attr) {
- self.setAttrib(clone, attr.nodeName, self.getAttrib(node, attr.nodeName));
- });
-
- return clone;
- }
-
- return clone.firstChild;
- },
-
- /**
- * Returns the root node of the document. This is normally the body but might be a DIV. Parents like getParent will not
- * go above the point of this root node.
- *
- * @method getRoot
- * @return {Element} Root element for the utility class.
- */
- getRoot: function () {
- var self = this;
-
- return self.settings.root_element || self.doc.body;
- },
-
- /**
- * Returns the viewport of the window.
- *
- * @method getViewPort
- * @param {Window} win Optional window to get viewport of.
- * @return {Object} Viewport object with fields x, y, w and h.
- */
- getViewPort: function (win) {
- var doc, rootElm;
-
- win = !win ? this.win : win;
- doc = win.document;
- rootElm = this.boxModel ? doc.documentElement : doc.body;
-
- // Returns viewport size excluding scrollbars
- return {
- x: win.pageXOffset || rootElm.scrollLeft,
- y: win.pageYOffset || rootElm.scrollTop,
- w: win.innerWidth || rootElm.clientWidth,
- h: win.innerHeight || rootElm.clientHeight
- };
- },
-
- /**
- * Returns the rectangle for a specific element.
- *
- * @method getRect
- * @param {Element/String} elm Element object or element ID to get rectangle from.
- * @return {object} Rectangle for specified element object with x, y, w, h fields.
- */
- getRect: function (elm) {
- var self = this, pos, size;
-
- elm = self.get(elm);
- pos = self.getPos(elm);
- size = self.getSize(elm);
-
- return {
- x: pos.x, y: pos.y,
- w: size.w, h: size.h
- };
- },
-
- /**
- * Returns the size dimensions of the specified element.
- *
- * @method getSize
- * @param {Element/String} elm Element object or element ID to get rectangle from.
- * @return {object} Rectangle for specified element object with w, h fields.
- */
- getSize: function (elm) {
- var self = this, w, h;
-
- elm = self.get(elm);
- w = self.getStyle(elm, 'width');
- h = self.getStyle(elm, 'height');
-
- // Non pixel value, then force offset/clientWidth
- if (w.indexOf('px') === -1) {
- w = 0;
- }
-
- // Non pixel value, then force offset/clientWidth
- if (h.indexOf('px') === -1) {
- h = 0;
- }
-
- return {
- w: parseInt(w, 10) || elm.offsetWidth || elm.clientWidth,
- h: parseInt(h, 10) || elm.offsetHeight || elm.clientHeight
- };
- },
-
- /**
- * Returns a node by the specified selector function. This function will
- * loop through all parent nodes and call the specified function for each node.
- * If the function then returns true indicating that it has found what it was looking for, the loop execution will then end
- * and the node it found will be returned.
- *
- * @method getParent
- * @param {Node/String} node DOM node to search parents on or ID string.
- * @param {function} selector Selection function or CSS selector to execute on each node.
- * @param {Node} root Optional root element, never go beyond this point.
- * @return {Node} DOM Node or null if it wasn't found.
- */
- getParent: function (node, selector, root) {
- return this.getParents(node, selector, root, false);
- },
-
- /**
- * Returns a node list of all parents matching the specified selector function or pattern.
- * If the function then returns true indicating that it has found what it was looking for and that node will be collected.
- *
- * @method getParents
- * @param {Node/String} node DOM node to search parents on or ID string.
- * @param {function} selector Selection function to execute on each node or CSS pattern.
- * @param {Node} root Optional root element, never go beyond this point.
- * @return {Array} Array of nodes or null if it wasn't found.
- */
- getParents: function (node, selector, root, collect) {
- var self = this, selectorVal, result = [];
-
- node = self.get(node);
- collect = collect === undefined;
-
- // Default root on inline mode
- root = root || (self.getRoot().nodeName != 'BODY' ? self.getRoot().parentNode : null);
-
- // Wrap node name as func
- if (is(selector, 'string')) {
- selectorVal = selector;
-
- if (selector === '*') {
- selector = function (node) {
- return node.nodeType == 1;
- };
- } else {
- selector = function (node) {
- return self.is(node, selectorVal);
- };
- }
- }
-
- while (node) {
- if (node == root || !node.nodeType || node.nodeType === 9) {
- break;
- }
-
- if (!selector || selector(node)) {
- if (collect) {
- result.push(node);
- } else {
- return node;
- }
- }
-
- node = node.parentNode;
- }
-
- return collect ? result : null;
- },
-
- /**
- * Returns the specified element by ID or the input element if it isn't a string.
- *
- * @method get
- * @param {String/Element} n Element id to look for or element to just pass though.
- * @return {Element} Element matching the specified id or null if it wasn't found.
- */
- get: function (elm) {
- var name;
-
- if (elm && this.doc && typeof elm == 'string') {
- name = elm;
- elm = this.doc.getElementById(elm);
-
- // IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick
- if (elm && elm.id !== name) {
- return this.doc.getElementsByName(name)[1];
- }
- }
-
- return elm;
- },
-
- /**
- * Returns the next node that matches selector or function
- *
- * @method getNext
- * @param {Node} node Node to find siblings from.
- * @param {String/function} selector Selector CSS expression or function.
- * @return {Node} Next node item matching the selector or null if it wasn't found.
- */
- getNext: function (node, selector) {
- return this._findSib(node, selector, 'nextSibling');
- },
-
- /**
- * Returns the previous node that matches selector or function
- *
- * @method getPrev
- * @param {Node} node Node to find siblings from.
- * @param {String/function} selector Selector CSS expression or function.
- * @return {Node} Previous node item matching the selector or null if it wasn't found.
- */
- getPrev: function (node, selector) {
- return this._findSib(node, selector, 'previousSibling');
- },
-
- // #ifndef jquery
-
- /**
- * Selects specific elements by a CSS level 3 pattern. For example "div#a1 p.test".
- * This function is optimized for the most common patterns needed in TinyMCE but it also performs well enough
- * on more complex patterns.
- *
- * @method select
- * @param {String} selector CSS level 3 pattern to select/find elements by.
- * @param {Object} scope Optional root element/scope element to search in.
- * @return {Array} Array with all matched elements.
- * @example
- * // Adds a class to all paragraphs in the currently active editor
- * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass');
- *
- * // Adds a class to all spans that have the test class in the currently active editor
- * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('span.test'), 'someclass')
- */
- select: function (selector, scope) {
- var self = this;
-
- /*eslint new-cap:0 */
- return Sizzle(selector, self.get(scope) || self.settings.root_element || self.doc, []);
- },
-
- /**
- * Returns true/false if the specified element matches the specified css pattern.
- *
- * @method is
- * @param {Node/NodeList} elm DOM node to match or an array of nodes to match.
- * @param {String} selector CSS pattern to match the element against.
- */
- is: function (elm, selector) {
- var i;
-
- if (!elm) {
- return false;
- }
-
- // If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance
- if (elm.length === undefined) {
- // Simple all selector
- if (selector === '*') {
- return elm.nodeType == 1;
- }
-
- // Simple selector just elements
- if (simpleSelectorRe.test(selector)) {
- selector = selector.toLowerCase().split(/,/);
- elm = elm.nodeName.toLowerCase();
-
- for (i = selector.length - 1; i >= 0; i--) {
- if (selector[i] == elm) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ attrPatterns = rule.attributePatterns;
+ if (attrPatterns) {
+ i = attrPatterns.length;
+ while (i--) {
+ if (attrPatterns[i].pattern.test(name)) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Is non element
- if (elm.nodeType && elm.nodeType != 1) {
- return false;
- }
-
- var elms = elm.nodeType ? [elm] : elm;
-
- /*eslint new-cap:0 */
- return Sizzle(selector, elms[0].ownerDocument || elms[0], null, elms).length > 0;
- },
-
- // #endif
-
- /**
- * Adds the specified element to another element or elements.
- *
- * @method add
- * @param {String/Element/Array} parentElm Element id string, DOM node element or array of ids or elements to add to.
- * @param {String/Element} name Name of new element to add or existing element to add.
- * @param {Object} attrs Optional object collection with arguments to add to the new element(s).
- * @param {String} html Optional inner HTML contents to add for each element.
- * @param {Boolean} create Optional flag if the element should be created or added.
- * @return {Element/Array} Element that got created, or an array of created elements if multiple input elements
- * were passed in.
- * @example
- * // Adds a new paragraph to the end of the active editor
- * tinymce.activeEditor.dom.add(tinymce.activeEditor.getBody(), 'p', {title: 'my title'}, 'Some content');
- */
- add: function (parentElm, name, attrs, html, create) {
- var self = this;
-
- return this.run(parentElm, function (parentElm) {
- var newElm;
-
- newElm = is(name, 'string') ? self.doc.createElement(name) : name;
- self.setAttribs(newElm, attrs);
-
- if (html) {
- if (html.nodeType) {
- newElm.appendChild(html);
- } else {
- self.setHTML(newElm, html);
- }
- }
-
- return !create ? parentElm.appendChild(newElm) : newElm;
- });
- },
-
- /**
- * Creates a new element.
- *
- * @method create
- * @param {String} name Name of new element.
- * @param {Object} attrs Optional object name/value collection with element attributes.
- * @param {String} html Optional HTML string to set as inner HTML of the element.
- * @return {Element} HTML DOM node element that got created.
- * @example
- * // Adds an element where the caret/selection is in the active editor
- * var el = tinymce.activeEditor.dom.create('div', {id: 'test', 'class': 'myclass'}, 'some content');
- * tinymce.activeEditor.selection.setNode(el);
- */
- create: function (name, attrs, html) {
- return this.add(this.doc.createElement(name), name, attrs, html, 1);
- },
-
- /**
- * Creates HTML string for element. The element will be closed unless an empty inner HTML string is passed in.
- *
- * @method createHTML
- * @param {String} name Name of new element.
- * @param {Object} attrs Optional object name/value collection with element attributes.
- * @param {String} html Optional HTML string to set as inner HTML of the element.
- * @return {String} String with new HTML element, for example: <a href="#">test</a>.
- * @example
- * // Creates a html chunk and inserts it at the current selection/caret location
- * tinymce.activeEditor.selection.setContent(tinymce.activeEditor.dom.createHTML('a', {href: 'test.html'}, 'some line'));
- */
- createHTML: function (name, attrs, html) {
- var outHtml = '', key;
-
- outHtml += '<' + name;
-
- for (key in attrs) {
- if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] != 'undefined') {
- outHtml += ' ' + key + '="' + this.encode(attrs[key]) + '"';
- }
- }
-
- // A call to tinymce.is doesn't work for some odd reason on IE9 possible bug inside their JS runtime
- if (typeof html != "undefined") {
- return outHtml + '>' + html + '</' + name + '>';
- }
-
- return outHtml + ' />';
- },
-
- /**
- * Creates a document fragment out of the specified HTML string.
- *
- * @method createFragment
- * @param {String} html Html string to create fragment from.
- * @return {DocumentFragment} Document fragment node.
- */
- createFragment: function (html) {
- var frag, node, doc = this.doc, container;
-
- container = doc.createElement("div");
- frag = doc.createDocumentFragment();
-
- if (html) {
- container.innerHTML = html;
- }
-
- while ((node = container.firstChild)) {
- frag.appendChild(node);
- }
-
- return frag;
- },
-
- /**
- * Removes/deletes the specified element(s) from the DOM.
- *
- * @method remove
- * @param {String/Element/Array} node ID of element or DOM element object or array containing multiple elements/ids.
- * @param {Boolean} keepChildren Optional state to keep children or not. If set to true all children will be
- * placed at the location of the removed element.
- * @return {Element/Array} HTML DOM element that got removed, or an array of removed elements if multiple input elements
- * were passed in.
- * @example
- * // Removes all paragraphs in the active editor
- * tinymce.activeEditor.dom.remove(tinymce.activeEditor.dom.select('p'));
- *
- * // Removes an element by id in the document
- * tinymce.DOM.remove('mydiv');
- */
- remove: function (node, keepChildren) {
- node = this.$$(node);
-
- if (keepChildren) {
- node.each(function () {
- var child;
-
- while ((child = this.firstChild)) {
- if (child.nodeType == 3 && child.data.length === 0) {
- this.removeChild(child);
- } else {
- this.parentNode.insertBefore(child, this);
- }
- }
- }).remove();
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- node.remove();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return false;
+ };
+ var getCustomElements = function () {
+ return customElementsMap;
+ };
+ return {
+ children: children,
+ elements: elements,
+ getValidStyles: getValidStyles,
+ getValidClasses: getValidClasses,
+ getBlockElements: getBlockElements,
+ getInvalidStyles: getInvalidStyles,
+ getShortEndedElements: getShortEndedElements,
+ getTextBlockElements: getTextBlockElements,
+ getTextInlineElements: getTextInlineElements,
+ getBoolAttrs: getBoolAttrs,
+ getElementRule: getElementRule,
+ getSelfClosingElements: getSelfClosingElements,
+ getNonEmptyElements: getNonEmptyElements,
+ getMoveCaretBeforeOnEnterElements: getMoveCaretBeforeOnEnterElements,
+ getWhiteSpaceElements: getWhiteSpaceElements,
+ getSpecialElements: getSpecialElements,
+ isValidChild: isValidChild,
+ isValid: isValid,
+ getCustomElements: getCustomElements,
+ addValidElements: addValidElements,
+ setValidElements: setValidElements,
+ addCustomElements: addCustomElements,
+ addValidChildren: addValidChildren
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return node.length > 1 ? node.toArray() : node[0];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toHex = function (match, r, g, b) {
+ var hex = function (val) {
+ val = parseInt(val, 10).toString(16);
+ return val.length > 1 ? val : '0' + val;
+ };
+ return '#' + hex(r) + hex(g) + hex(b);
+ };
+ function Styles(settings, schema) {
+ var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi;
+ var urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi;
+ var styleRegExp = /\s*([^:]+):\s*([^;]+);?/g;
+ var trimRightRegExp = /\s+$/;
+ var i;
+ var encodingLookup = {};
+ var encodingItems;
+ var validStyles;
+ var invalidStyles;
+ var invisibleChar = '\uFEFF';
+ settings = settings || {};
+ if (schema) {
+ validStyles = schema.getValidStyles();
+ invalidStyles = schema.getInvalidStyles();
+ }
+ encodingItems = ('\\" \\\' \\; \\: ; : ' + invisibleChar).split(' ');
+ for (i = 0; i < encodingItems.length; i++) {
+ encodingLookup[encodingItems[i]] = invisibleChar + i;
+ encodingLookup[invisibleChar + i] = encodingItems[i];
+ }
+ return {
+ toHex: function (color) {
+ return color.replace(rgbRegExp, toHex);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Sets the CSS style value on a HTML element. The name can be a camelcase string
- * or the CSS style name like background-color.
- *
- * @method setStyle
- * @param {String/Element/Array} elm HTML element/Array of elements to set CSS style value on.
- * @param {String} name Name of the style value to set.
- * @param {String} value Value to set on the style.
- * @example
- * // Sets a style value on all paragraphs in the currently active editor
- * tinymce.activeEditor.dom.setStyle(tinymce.activeEditor.dom.select('p'), 'background-color', 'red');
- *
- * // Sets a style value to an element by id in the current document
- * tinymce.DOM.setStyle('mydiv', 'background-color', 'red');
- */
- setStyle: function (elm, name, value) {
- elm = this.$$(elm).css(name, value);
-
- if (this.settings.update_styles) {
- updateInternalStyleAttr(this, elm);
- }
- },
-
- /**
- * Returns the current style or runtime/computed value of an element.
- *
- * @method getStyle
- * @param {String/Element} elm HTML element or element id string to get style from.
- * @param {String} name Style name to return.
- * @param {Boolean} computed Computed style.
- * @return {String} Current style or computed style value of an element.
- */
- getStyle: function (elm, name, computed) {
- elm = this.$$(elm);
-
- if (computed) {
- return elm.css(name);
- }
-
- // Camelcase it, if needed
- name = name.replace(/-(\D)/g, function (a, b) {
- return b.toUpperCase();
- });
-
- if (name == 'float') {
- name = Env.ie && Env.ie < 12 ? 'styleFloat' : 'cssFloat';
- }
-
- return elm[0] && elm[0].style ? elm[0].style[name] : undefined;
- },
-
- /**
- * Sets multiple styles on the specified element(s).
- *
- * @method setStyles
- * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set styles on.
- * @param {Object} styles Name/Value collection of style items to add to the element(s).
- * @example
- * // Sets styles on all paragraphs in the currently active editor
- * tinymce.activeEditor.dom.setStyles(tinymce.activeEditor.dom.select('p'), {'background-color': 'red', 'color': 'green'});
- *
- * // Sets styles to an element by id in the current document
- * tinymce.DOM.setStyles('mydiv', {'background-color': 'red', 'color': 'green'});
- */
- setStyles: function (elm, styles) {
- elm = this.$$(elm).css(styles);
-
- if (this.settings.update_styles) {
- updateInternalStyleAttr(this, elm);
- }
- },
-
- /**
- * Removes all attributes from an element or elements.
- *
- * @method removeAllAttribs
- * @param {Element/String/Array} e DOM element, element id string or array of elements/ids to remove attributes from.
- */
- removeAllAttribs: function (e) {
- return this.run(e, function (e) {
- var i, attrs = e.attributes;
- for (i = attrs.length - 1; i >= 0; i--) {
- e.removeAttributeNode(attrs.item(i));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parse: function (css) {
+ var styles = {};
+ var matches, name, value, isEncoded;
+ var urlConverter = settings.url_converter;
+ var urlConverterScope = settings.url_converter_scope || this;
+ var compress = function (prefix, suffix, noJoin) {
+ var top, right, bottom, left;
+ top = styles[prefix + '-top' + suffix];
+ if (!top) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- },
-
- /**
- * Sets the specified attribute of an element or elements.
- *
- * @method setAttrib
- * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set attribute on.
- * @param {String} name Name of attribute to set.
- * @param {String} value Value to set on the attribute - if this value is falsy like null, 0 or '' it will remove
- * the attribute instead.
- * @example
- * // Sets class attribute on all paragraphs in the active editor
- * tinymce.activeEditor.dom.setAttrib(tinymce.activeEditor.dom.select('p'), 'class', 'myclass');
- *
- * // Sets class attribute on a specific element in the current page
- * tinymce.dom.setAttrib('mydiv', 'class', 'myclass');
- */
- setAttrib: function (elm, name, value) {
- var self = this, originalValue, hook, settings = self.settings;
-
- if (value === '') {
- value = null;
- }
-
- elm = self.$$(elm);
- originalValue = elm.attr(name);
-
- if (!elm.length) {
- return;
- }
-
- hook = self.attrHooks[name];
- if (hook && hook.set) {
- hook.set(elm, value, name);
- } else {
- elm.attr(name, value);
- }
-
- if (originalValue != value && settings.onSetAttrib) {
- settings.onSetAttrib({
- attrElm: elm,
- attrName: name,
- attrValue: value
- });
- }
- },
-
- /**
- * Sets two or more specified attributes of an element or elements.
- *
- * @method setAttribs
- * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set attributes on.
- * @param {Object} attrs Name/Value collection of attribute items to add to the element(s).
- * @example
- * // Sets class and title attributes on all paragraphs in the active editor
- * tinymce.activeEditor.dom.setAttribs(tinymce.activeEditor.dom.select('p'), {'class': 'myclass', title: 'some title'});
- *
- * // Sets class and title attributes on a specific element in the current page
- * tinymce.DOM.setAttribs('mydiv', {'class': 'myclass', title: 'some title'});
- */
- setAttribs: function (elm, attrs) {
- var self = this;
-
- self.$$(elm).each(function (i, node) {
- each(attrs, function (value, name) {
- self.setAttrib(node, name, value);
- });
- });
- },
-
- /**
- * Returns the specified attribute by name.
- *
- * @method getAttrib
- * @param {String/Element} elm Element string id or DOM element to get attribute from.
- * @param {String} name Name of attribute to get.
- * @param {String} defaultVal Optional default value to return if the attribute didn't exist.
- * @return {String} Attribute value string, default value or null if the attribute wasn't found.
- */
- getAttrib: function (elm, name, defaultVal) {
- var self = this, hook, value;
-
- elm = self.$$(elm);
-
- if (elm.length) {
- hook = self.attrHooks[name];
-
- if (hook && hook.get) {
- value = hook.get(elm, name);
- } else {
- value = elm.attr(name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ right = styles[prefix + '-right' + suffix];
+ if (!right) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- if (typeof value == 'undefined') {
- value = defaultVal || '';
- }
-
- return value;
- },
-
- /**
- * Returns the absolute x, y position of a node. The position will be returned in an object with x, y fields.
- *
- * @method getPos
- * @param {Element/String} elm HTML element or element id to get x, y position from.
- * @param {Element} rootElm Optional root element to stop calculations at.
- * @return {object} Absolute position of the specified element object with x, y fields.
- */
- getPos: function (elm, rootElm) {
- var self = this, x = 0, y = 0, offsetParent, doc = self.doc, body = doc.body, pos;
-
- elm = self.get(elm);
- rootElm = rootElm || body;
-
- if (elm) {
- // Use getBoundingClientRect if it exists since it's faster than looping offset nodes
- // Fallback to offsetParent calculations if the body isn't static better since it stops at the body root
- if (rootElm === body && elm.getBoundingClientRect && DomQuery(body).css('position') === 'static') {
- pos = elm.getBoundingClientRect();
- rootElm = self.boxModel ? doc.documentElement : body;
-
- // Add scroll offsets from documentElement or body since IE with the wrong box model will use d.body and so do WebKit
- // Also remove the body/documentelement clientTop/clientLeft on IE 6, 7 since they offset the position
- x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - rootElm.clientLeft;
- y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - rootElm.clientTop;
-
- return { x: x, y: y };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ bottom = styles[prefix + '-bottom' + suffix];
+ if (!bottom) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- offsetParent = elm;
- while (offsetParent && offsetParent != rootElm && offsetParent.nodeType) {
- x += offsetParent.offsetLeft || 0;
- y += offsetParent.offsetTop || 0;
- offsetParent = offsetParent.offsetParent;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ left = styles[prefix + '-left' + suffix];
+ if (!left) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- offsetParent = elm.parentNode;
- while (offsetParent && offsetParent != rootElm && offsetParent.nodeType) {
- x -= offsetParent.scrollLeft || 0;
- y -= offsetParent.scrollTop || 0;
- offsetParent = offsetParent.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var box = [
+ top,
+ right,
+ bottom,
+ left
+ ];
+ i = box.length - 1;
+ while (i--) {
+ if (box[i] !== box[i + 1]) {
+ break;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return { x: x, y: y };
- },
-
- /**
- * Parses the specified style value into an object collection. This parser will also
- * merge and remove any redundant items that browsers might have added. It will also convert non-hex
- * colors to hex values. Urls inside the styles will also be converted to absolute/relative based on settings.
- *
- * @method parseStyle
- * @param {String} cssText Style value to parse, for example: border:1px solid red;.
- * @return {Object} Object representation of that style, for example: {border: '1px solid red'}
- */
- parseStyle: function (cssText) {
- return this.styles.parse(cssText);
- },
-
- /**
- * Serializes the specified style object into a string.
- *
- * @method serializeStyle
- * @param {Object} styles Object to serialize as string, for example: {border: '1px solid red'}
- * @param {String} name Optional element name.
- * @return {String} String representation of the style object, for example: border: 1px solid red.
- */
- serializeStyle: function (styles, name) {
- return this.styles.serialize(styles, name);
- },
-
- /**
- * Adds a style element at the top of the document with the specified cssText content.
- *
- * @method addStyle
- * @param {String} cssText CSS Text style to add to top of head of document.
- */
- addStyle: function (cssText) {
- var self = this, doc = self.doc, head, styleElm;
-
- // Prevent inline from loading the same styles twice
- if (self !== DOMUtils.DOM && doc === document) {
- var addedStyles = DOMUtils.DOM.addedStyles;
-
- addedStyles = addedStyles || [];
- if (addedStyles[cssText]) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (i > -1 && noJoin) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- addedStyles[cssText] = true;
- DOMUtils.DOM.addedStyles = addedStyles;
- }
-
- // Create style element if needed
- styleElm = doc.getElementById('mceDefaultStyles');
- if (!styleElm) {
- styleElm = doc.createElement('style');
- styleElm.id = 'mceDefaultStyles';
- styleElm.type = 'text/css';
-
- head = doc.getElementsByTagName('head')[0];
- if (head.firstChild) {
- head.insertBefore(styleElm, head.firstChild);
- } else {
- head.appendChild(styleElm);
- }
- }
-
- // Append style data to old or new style element
- if (styleElm.styleSheet) {
- styleElm.styleSheet.cssText += cssText;
- } else {
- styleElm.appendChild(doc.createTextNode(cssText));
- }
- },
-
- /**
- * Imports/loads the specified CSS file into the document bound to the class.
- *
- * @method loadCSS
- * @param {String} url URL to CSS file to load.
- * @example
- * // Loads a CSS file dynamically into the current document
- * tinymce.DOM.loadCSS('somepath/some.css');
- *
- * // Loads a CSS file into the currently active editor instance
- * tinymce.activeEditor.dom.loadCSS('somepath/some.css');
- *
- * // Loads a CSS file into an editor instance by id
- * tinymce.get('someid').dom.loadCSS('somepath/some.css');
- *
- * // Loads multiple CSS files into the current document
- * tinymce.DOM.loadCSS('somepath/some.css,somepath/someother.css');
- */
- loadCSS: function (url) {
- var self = this, doc = self.doc, head;
-
- // Prevent inline from loading the same CSS file twice
- if (self !== DOMUtils.DOM && doc === document) {
- DOMUtils.DOM.loadCSS(url);
- return;
- }
-
- if (!url) {
- url = '';
- }
-
- head = doc.getElementsByTagName('head')[0];
-
- each(url.split(','), function (url) {
- var link;
-
- url = Tools._addCacheSuffix(url);
-
- if (self.files[url]) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ styles[prefix + suffix] = i === -1 ? box[0] : box.join(' ');
+ delete styles[prefix + '-top' + suffix];
+ delete styles[prefix + '-right' + suffix];
+ delete styles[prefix + '-bottom' + suffix];
+ delete styles[prefix + '-left' + suffix];
+ };
+ var canCompress = function (key) {
+ var value = styles[key], i;
+ if (!value) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.files[url] = true;
- link = self.create('link', { rel: 'stylesheet', href: url });
-
- // IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug
- // This fix seems to resolve that issue by recalcing the document once a stylesheet finishes loading
- // It's ugly but it seems to work fine.
- if (isIE && doc.documentMode && doc.recalc) {
- link.onload = function () {
- if (doc.recalc) {
- doc.recalc();
- }
-
- link.onload = null;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ value = value.split(' ');
+ i = value.length;
+ while (i--) {
+ if (value[i] !== value[0]) {
+ return false;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- head.appendChild(link);
- });
- },
-
- /**
- * Adds a class to the specified element or elements.
- *
- * @method addClass
- * @param {String/Element/Array} elm Element ID string or DOM element or array with elements or IDs.
- * @param {String} cls Class name to add to each element.
- * @return {String/Array} String with new class value or array with new class values for all elements.
- * @example
- * // Adds a class to all paragraphs in the active editor
- * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'myclass');
- *
- * // Adds a class to a specific element in the current page
- * tinymce.DOM.addClass('mydiv', 'myclass');
- */
- addClass: function (elm, cls) {
- this.$$(elm).addClass(cls);
- },
-
- /**
- * Removes a class from the specified element or elements.
- *
- * @method removeClass
- * @param {String/Element/Array} elm Element ID string or DOM element or array with elements or IDs.
- * @param {String} cls Class name to remove from each element.
- * @return {String/Array} String of remaining class name(s), or an array of strings if multiple input elements
- * were passed in.
- * @example
- * // Removes a class from all paragraphs in the active editor
- * tinymce.activeEditor.dom.removeClass(tinymce.activeEditor.dom.select('p'), 'myclass');
- *
- * // Removes a class from a specific element in the current page
- * tinymce.DOM.removeClass('mydiv', 'myclass');
- */
- removeClass: function (elm, cls) {
- this.toggleClass(elm, cls, false);
- },
-
- /**
- * Returns true if the specified element has the specified class.
- *
- * @method hasClass
- * @param {String/Element} elm HTML element or element id string to check CSS class on.
- * @param {String} cls CSS class to check for.
- * @return {Boolean} true/false if the specified element has the specified class.
- */
- hasClass: function (elm, cls) {
- return this.$$(elm).hasClass(cls);
- },
-
- /**
- * Toggles the specified class on/off.
- *
- * @method toggleClass
- * @param {Element} elm Element to toggle class on.
- * @param {[type]} cls Class to toggle on/off.
- * @param {[type]} state Optional state to set.
- */
- toggleClass: function (elm, cls, state) {
- this.$$(elm).toggleClass(cls, state).each(function () {
- if (this.className === '') {
- DomQuery(this).attr('class', null);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ styles[key] = value[0];
+ return true;
+ };
+ var compress2 = function (target, a, b, c) {
+ if (!canCompress(a)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- },
-
- /**
- * Shows the specified element(s) by ID by setting the "display" style.
- *
- * @method show
- * @param {String/Element/Array} elm ID of DOM element or DOM element or array with elements or IDs to show.
- */
- show: function (elm) {
- this.$$(elm).show();
- },
-
- /**
- * Hides the specified element(s) by ID by setting the "display" style.
- *
- * @method hide
- * @param {String/Element/Array} elm ID of DOM element or DOM element or array with elements or IDs to hide.
- * @example
- * // Hides an element by id in the document
- * tinymce.DOM.hide('myid');
- */
- hide: function (elm) {
- this.$$(elm).hide();
- },
-
- /**
- * Returns true/false if the element is hidden or not by checking the "display" style.
- *
- * @method isHidden
- * @param {String/Element} elm Id or element to check display state on.
- * @return {Boolean} true/false if the element is hidden or not.
- */
- isHidden: function (elm) {
- return this.$$(elm).css('display') == 'none';
- },
-
- /**
- * Returns a unique id. This can be useful when generating elements on the fly.
- * This method will not check if the element already exists.
- *
- * @method uniqueId
- * @param {String} prefix Optional prefix to add in front of all ids - defaults to "mce_".
- * @return {String} Unique id.
- */
- uniqueId: function (prefix) {
- return (!prefix ? 'mce_' : prefix) + (this.counter++);
- },
-
- /**
- * Sets the specified HTML content inside the element or elements. The HTML will first be processed. This means
- * URLs will get converted, hex color values fixed etc. Check processHTML for details.
- *
- * @method setHTML
- * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set HTML inside of.
- * @param {String} html HTML content to set as inner HTML of the element.
- * @example
- * // Sets the inner HTML of all paragraphs in the active editor
- * tinymce.activeEditor.dom.setHTML(tinymce.activeEditor.dom.select('p'), 'some inner html');
- *
- * // Sets the inner HTML of an element by id in the document
- * tinymce.DOM.setHTML('mydiv', 'some inner html');
- */
- setHTML: function (elm, html) {
- elm = this.$$(elm);
-
- if (isIE) {
- elm.each(function (i, target) {
- if (target.canHaveHTML === false) {
- return;
- }
-
- // Remove all child nodes, IE keeps empty text nodes in DOM
- while (target.firstChild) {
- target.removeChild(target.firstChild);
- }
-
- try {
- // IE will remove comments from the beginning
- // unless you padd the contents with something
- target.innerHTML = '<br>' + html;
- target.removeChild(target.firstChild);
- } catch (ex) {
- // IE sometimes produces an unknown runtime error on innerHTML if it's a div inside a p
- DomQuery('<div></div>').html('<br>' + html).contents().slice(1).appendTo(target);
- }
-
- return html;
- });
- } else {
- elm.html(html);
- }
- },
-
- /**
- * Returns the outer HTML of an element.
- *
- * @method getOuterHTML
- * @param {String/Element} elm Element ID or element object to get outer HTML from.
- * @return {String} Outer HTML string.
- * @example
- * tinymce.DOM.getOuterHTML(editorElement);
- * tinymce.activeEditor.getOuterHTML(tinymce.activeEditor.getBody());
- */
- getOuterHTML: function (elm) {
- elm = this.get(elm);
-
- // Older FF doesn't have outerHTML 3.6 is still used by some orgaizations
- return elm.nodeType == 1 && "outerHTML" in elm ? elm.outerHTML : DomQuery('<div></div>').append(DomQuery(elm).clone()).html();
- },
-
- /**
- * Sets the specified outer HTML on an element or elements.
- *
- * @method setOuterHTML
- * @param {Element/String/Array} elm DOM element, element id string or array of elements/ids to set outer HTML on.
- * @param {Object} html HTML code to set as outer value for the element.
- * @example
- * // Sets the outer HTML of all paragraphs in the active editor
- * tinymce.activeEditor.dom.setOuterHTML(tinymce.activeEditor.dom.select('p'), '<div>some html</div>');
- *
- * // Sets the outer HTML of an element by id in the document
- * tinymce.DOM.setOuterHTML('mydiv', '<div>some html</div>');
- */
- setOuterHTML: function (elm, html) {
- var self = this;
-
- self.$$(elm).each(function () {
- try {
- // Older FF doesn't have outerHTML 3.6 is still used by some organizations
- if ("outerHTML" in this) {
- this.outerHTML = html;
- return;
- }
- } catch (ex) {
- // Ignore
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!canCompress(b)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // OuterHTML for IE it sometimes produces an "unknown runtime error"
- self.remove(DomQuery(this).html(html), true);
- });
- },
-
- /**
- * Entity decodes a string. This method decodes any HTML entities, such as å.
- *
- * @method decode
- * @param {String} s String to decode entities on.
- * @return {String} Entity decoded string.
- */
- decode: Entities.decode,
-
- /**
- * Entity encodes a string. This method encodes the most common entities, such as <>"&.
- *
- * @method encode
- * @param {String} text String to encode with entities.
- * @return {String} Entity encoded string.
- */
- encode: Entities.encodeAllRaw,
-
- /**
- * Inserts an element after the reference element.
- *
- * @method insertAfter
- * @param {Element} node Element to insert after the reference.
- * @param {Element/String/Array} referenceNode Reference element, element id or array of elements to insert after.
- * @return {Element/Array} Element that got added or an array with elements.
- */
- insertAfter: function (node, referenceNode) {
- referenceNode = this.get(referenceNode);
-
- return this.run(node, function (node) {
- var parent, nextSibling;
-
- parent = referenceNode.parentNode;
- nextSibling = referenceNode.nextSibling;
-
- if (nextSibling) {
- parent.insertBefore(node, nextSibling);
- } else {
- parent.appendChild(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!canCompress(c)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return node;
- });
- },
-
- /**
- * Replaces the specified element or elements with the new element specified. The new element will
- * be cloned if multiple input elements are passed in.
- *
- * @method replace
- * @param {Element} newElm New element to replace old ones with.
- * @param {Element/String/Array} oldElm Element DOM node, element id or array of elements or ids to replace.
- * @param {Boolean} keepChildren Optional keep children state, if set to true child nodes from the old object will be added
- * to new ones.
- */
- replace: function (newElm, oldElm, keepChildren) {
- var self = this;
-
- return self.run(oldElm, function (oldElm) {
- if (is(oldElm, 'array')) {
- newElm = newElm.cloneNode(true);
- }
-
- if (keepChildren) {
- each(grep(oldElm.childNodes), function (node) {
- newElm.appendChild(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c];
+ delete styles[a];
+ delete styles[b];
+ delete styles[c];
+ };
+ var encode = function (str) {
+ isEncoded = true;
+ return encodingLookup[str];
+ };
+ var decode = function (str, keepSlashes) {
+ if (isEncoded) {
+ str = str.replace(/\uFEFF[0-9]/g, function (str) {
+ return encodingLookup[str];
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return oldElm.parentNode.replaceChild(newElm, oldElm);
- });
- },
-
- /**
- * Renames the specified element and keeps its attributes and children.
- *
- * @method rename
- * @param {Element} elm Element to rename.
- * @param {String} name Name of the new element.
- * @return {Element} New element or the old element if it needed renaming.
- */
- rename: function (elm, name) {
- var self = this, newElm;
-
- if (elm.nodeName != name.toUpperCase()) {
- // Rename block element
- newElm = self.create(name);
-
- // Copy attribs to new block
- each(self.getAttribs(elm), function (attrNode) {
- self.setAttrib(newElm, attrNode.nodeName, self.getAttrib(elm, attrNode.nodeName));
- });
-
- // Replace block
- self.replace(newElm, elm, 1);
- }
-
- return newElm || elm;
- },
-
- /**
- * Find the common ancestor of two elements. This is a shorter method than using the DOM Range logic.
- *
- * @method findCommonAncestor
- * @param {Element} a Element to find common ancestor of.
- * @param {Element} b Element to find common ancestor of.
- * @return {Element} Common ancestor element of the two input elements.
- */
- findCommonAncestor: function (a, b) {
- var ps = a, pe;
-
- while (ps) {
- pe = b;
-
- while (pe && ps != pe) {
- pe = pe.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!keepSlashes) {
+ str = str.replace(/\\([\'\";:])/g, '$1');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (ps == pe) {
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return str;
+ };
+ var decodeSingleHexSequence = function (escSeq) {
+ return String.fromCharCode(parseInt(escSeq.slice(1), 16));
+ };
+ var decodeHexSequences = function (value) {
+ return value.replace(/\\[0-9a-f]+/gi, decodeSingleHexSequence);
+ };
+ var processUrl = function (match, url, url2, url3, str, str2) {
+ str = str || str2;
+ if (str) {
+ str = decode(str);
+ return '\'' + str.replace(/\'/g, '\\\'') + '\'';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- ps = ps.parentNode;
- }
-
- if (!ps && a.ownerDocument) {
- return a.ownerDocument.documentElement;
- }
-
- return ps;
- },
-
- /**
- * Parses the specified RGB color value and returns a hex version of that color.
- *
- * @method toHex
- * @param {String} rgbVal RGB string value like rgb(1,2,3)
- * @return {String} Hex version of that RGB value like #FF00FF.
- */
- toHex: function (rgbVal) {
- return this.styles.toHex(Tools.trim(rgbVal));
- },
-
- /**
- * Executes the specified function on the element by id or dom element node or array of elements/id.
- *
- * @method run
- * @param {String/Element/Array} elm ID or DOM element object or array with ids or elements.
- * @param {function} func Function to execute for each item.
- * @param {Object} scope Optional scope to execute the function in.
- * @return {Object/Array} Single object, or an array of objects if multiple input elements were passed in.
- */
- run: function (elm, func, scope) {
- var self = this, result;
-
- if (typeof elm === 'string') {
- elm = self.get(elm);
- }
-
- if (!elm) {
- return false;
- }
-
- scope = scope || this;
- if (!elm.nodeType && (elm.length || elm.length === 0)) {
- result = [];
-
- each(elm, function (elm, i) {
- if (elm) {
- if (typeof elm == 'string') {
- elm = self.get(elm);
- }
-
- result.push(func.call(scope, elm, i));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ url = decode(url || url2 || url3);
+ if (!settings.allow_script_urls) {
+ var scriptUrl = url.replace(/[\s\r\n]+/g, '');
+ if (/(java|vb)script:/i.test(scriptUrl)) {
+ return '';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- return result;
- }
-
- return func.call(scope, elm);
- },
-
- /**
- * Returns a NodeList with attributes for the element.
- *
- * @method getAttribs
- * @param {HTMLElement/string} elm Element node or string id to get attributes from.
- * @return {NodeList} NodeList with attributes.
- */
- getAttribs: function (elm) {
- var attrs;
-
- elm = this.get(elm);
-
- if (!elm) {
- return [];
- }
-
- if (isIE) {
- attrs = [];
-
- // Object will throw exception in IE
- if (elm.nodeName == 'OBJECT') {
- return elm.attributes;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!settings.allow_svg_data_urls && /^data:image\/svg/i.test(scriptUrl)) {
+ return '';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // IE doesn't keep the selected attribute if you clone option elements
- if (elm.nodeName === 'OPTION' && this.getAttrib(elm, 'selected')) {
- attrs.push({ specified: 1, nodeName: 'selected' });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (urlConverter) {
+ url = urlConverter.call(urlConverterScope, url, 'style');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // It's crazy that this is faster in IE but it's because it returns all attributes all the time
- var attrRegExp = /<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi;
- elm.cloneNode(false).outerHTML.replace(attrRegExp, '').replace(/[\w:\-]+/gi, function (a) {
- attrs.push({ specified: 1, nodeName: a });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return 'url(\'' + url.replace(/\'/g, '\\\'') + '\')';
+ };
+ if (css) {
+ css = css.replace(/[\u0000-\u001F]/g, '');
+ css = css.replace(/\\[\"\';:\uFEFF]/g, encode).replace(/\"[^\"]+\"|\'[^\']+\'/g, function (str) {
+ return str.replace(/[;:]/g, encode);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return attrs;
- }
-
- return elm.attributes;
- },
-
- /**
- * Returns true/false if the specified node is to be considered empty or not.
- *
- * @example
- * tinymce.DOM.isEmpty(node, {img: true});
- * @method isEmpty
- * @param {Object} elements Optional name/value object with elements that are automatically treated as non-empty elements.
- * @return {Boolean} true/false if the node is empty or not.
- */
- isEmpty: function (node, elements) {
- var self = this, i, attributes, type, whitespace, walker, name, brCount = 0;
-
- node = node.firstChild;
- if (node) {
- walker = new TreeWalker(node, node.parentNode);
- elements = elements || (self.schema ? self.schema.getNonEmptyElements() : null);
- whitespace = self.schema ? self.schema.getWhiteSpaceElements() : {};
-
- do {
- type = node.nodeType;
-
- if (type === 1) {
- // Ignore bogus elements
- var bogusVal = node.getAttribute('data-mce-bogus');
- if (bogusVal) {
- node = walker.next(bogusVal === 'all');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (matches = styleRegExp.exec(css)) {
+ styleRegExp.lastIndex = matches.index + matches[0].length;
+ name = matches[1].replace(trimRightRegExp, '').toLowerCase();
+ value = matches[2].replace(trimRightRegExp, '');
+ if (name && value) {
+ name = decodeHexSequences(name);
+ value = decodeHexSequences(value);
+ if (name.indexOf(invisibleChar) !== -1 || name.indexOf('"') !== -1) {
</ins><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Keep empty elements like <img />
- name = node.nodeName.toLowerCase();
- if (elements && elements[name]) {
- // Ignore single BR elements in blocks like <p><br /></p> or <p><span><br /></span></p>
- if (name === 'br') {
- brCount++;
- node = walker.next();
- continue;
- }
-
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!settings.allow_script_urls && (name === 'behavior' || /expression\s*\(|\/\*|\*\//.test(value))) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Keep elements with data-bookmark attributes or name attribute like <a name="1"></a>
- attributes = self.getAttribs(node);
- i = attributes.length;
- while (i--) {
- name = attributes[i].nodeName;
- if (name === "name" || name === 'data-mce-bookmark') {
- return false;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (name === 'font-weight' && value === '700') {
+ value = 'bold';
+ } else if (name === 'color' || name === 'background-color') {
+ value = value.toLowerCase();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ value = value.replace(rgbRegExp, toHex);
+ value = value.replace(urlOrStrRegExp, processUrl);
+ styles[name] = isEncoded ? decode(value, true) : value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Keep comment nodes
- if (type == 8) {
- return false;
- }
-
- // Keep non whitespace text nodes
- if (type === 3 && !whiteSpaceRegExp.test(node.nodeValue)) {
- return false;
- }
-
- // Keep whitespace preserve elements
- if (type === 3 && node.parentNode && whitespace[node.parentNode.nodeName] && whiteSpaceRegExp.test(node.nodeValue)) {
- return false;
- }
-
- node = walker.next();
- } while (node);
- }
-
- return brCount <= 1;
- },
-
- /**
- * Creates a new DOM Range object. This will use the native DOM Range API if it's
- * available. If it's not, it will fall back to the custom TinyMCE implementation.
- *
- * @method createRng
- * @return {DOMRange} DOM Range object.
- * @example
- * var rng = tinymce.DOM.createRng();
- * alert(rng.startContainer + "," + rng.startOffset);
- */
- createRng: function () {
- var doc = this.doc;
-
- return doc.createRange ? doc.createRange() : new Range(this);
- },
-
- /**
- * Returns the index of the specified node within its parent.
- *
- * @method nodeIndex
- * @param {Node} node Node to look for.
- * @param {boolean} normalized Optional true/false state if the index is what it would be after a normalization.
- * @return {Number} Index of the specified node.
- */
- nodeIndex: nodeIndex,
-
- /**
- * Splits an element into two new elements and places the specified split
- * element or elements between the new ones. For example splitting the paragraph at the bold element in
- * this example <p>abc<b>abc</b>123</p> would produce <p>abc</p><b>abc</b><p>123</p>.
- *
- * @method split
- * @param {Element} parentElm Parent element to split.
- * @param {Element} splitElm Element to split at.
- * @param {Element} replacementElm Optional replacement element to replace the split element with.
- * @return {Element} Returns the split element or the replacement element if that is specified.
- */
- split: function (parentElm, splitElm, replacementElm) {
- var self = this, r = self.createRng(), bef, aft, pa;
-
- // W3C valid browsers tend to leave empty nodes to the left/right side of the contents - this makes sense
- // but we don't want that in our code since it serves no purpose for the end user
- // For example splitting this html at the bold element:
- // <p>text 1<span><b>CHOP</b></span>text 2</p>
- // would produce:
- // <p>text 1<span></span></p><b>CHOP</b><p><span></span>text 2</p>
- // this function will then trim off empty edges and produce:
- // <p>text 1</p><b>CHOP</b><p>text 2</p>
- function trimNode(node) {
- var i, children = node.childNodes, type = node.nodeType;
-
- function surroundedBySpans(node) {
- var previousIsSpan = node.previousSibling && node.previousSibling.nodeName == 'SPAN';
- var nextIsSpan = node.nextSibling && node.nextSibling.nodeName == 'SPAN';
- return previousIsSpan && nextIsSpan;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (type == 1 && node.getAttribute('data-mce-type') == 'bookmark') {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ compress('border', '', true);
+ compress('border', '-width');
+ compress('border', '-color');
+ compress('border', '-style');
+ compress('padding', '');
+ compress('margin', '');
+ compress2('border', 'border-width', 'border-style', 'border-color');
+ if (styles.border === 'medium none') {
+ delete styles.border;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (i = children.length - 1; i >= 0; i--) {
- trimNode(children[i]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (styles['border-image'] === 'none') {
+ delete styles['border-image'];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (type != 9) {
- // Keep non whitespace text nodes
- if (type == 3 && node.nodeValue.length > 0) {
- // If parent element isn't a block or there isn't any useful contents for example "<p> </p>"
- // Also keep text nodes with only spaces if surrounded by spans.
- // eg. "<p><span>a</span> <span>b</span></p>" should keep space between a and b
- var trimmedLength = trim(node.nodeValue).length;
- if (!self.isBlock(node.parentNode) || trimmedLength > 0 || trimmedLength === 0 && surroundedBySpans(node)) {
- return;
- }
- } else if (type == 1) {
- // If the only child is a bookmark then move it up
- children = node.childNodes;
-
- // TODO fix this complex if
- if (children.length == 1 && children[0] && children[0].nodeType == 1 &&
- children[0].getAttribute('data-mce-type') == 'bookmark') {
- node.parentNode.insertBefore(children[0], node);
- }
-
- // Keep non empty elements or img, hr etc
- if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName)) {
- return;
- }
- }
-
- self.remove(node);
- }
-
- return node;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (parentElm && splitElm) {
- // Get before chunk
- r.setStart(parentElm.parentNode, self.nodeIndex(parentElm));
- r.setEnd(splitElm.parentNode, self.nodeIndex(splitElm));
- bef = r.extractContents();
-
- // Get after chunk
- r = self.createRng();
- r.setStart(splitElm.parentNode, self.nodeIndex(splitElm) + 1);
- r.setEnd(parentElm.parentNode, self.nodeIndex(parentElm) + 1);
- aft = r.extractContents();
-
- // Insert before chunk
- pa = parentElm.parentNode;
- pa.insertBefore(trimNode(bef), parentElm);
-
- // Insert middle chunk
- if (replacementElm) {
- pa.insertBefore(replacementElm, parentElm);
- //pa.replaceChild(replacementElm, splitElm);
- } else {
- pa.insertBefore(splitElm, parentElm);
- }
-
- // Insert after chunk
- pa.insertBefore(trimNode(aft), parentElm);
- self.remove(parentElm);
-
- return replacementElm || splitElm;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return styles;
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Adds an event handler to the specified object.
- *
- * @method bind
- * @param {Element/Document/Window/Array} target Target element to bind events to.
- * handler to or an array of elements/ids/documents.
- * @param {String} name Name of event handler to add, for example: click.
- * @param {function} func Function to execute when the event occurs.
- * @param {Object} scope Optional scope to execute the function in.
- * @return {function} Function callback handler the same as the one passed in.
- */
- bind: function (target, name, func, scope) {
- var self = this;
-
- if (Tools.isArray(target)) {
- var i = target.length;
-
- while (i--) {
- target[i] = self.bind(target[i], name, func, scope);
- }
-
- return target;
- }
-
- // Collect all window/document events bound by editor instance
- if (self.settings.collect && (target === self.doc || target === self.win)) {
- self.boundEvents.push([target, name, func, scope]);
- }
-
- return self.events.bind(target, name, func, scope || self);
- },
-
- /**
- * Removes the specified event handler by name and function from an element or collection of elements.
- *
- * @method unbind
- * @param {Element/Document/Window/Array} target Target element to unbind events on.
- * @param {String} name Event handler name, for example: "click"
- * @param {function} func Function to remove.
- * @return {bool/Array} Bool state of true if the handler was removed, or an array of states if multiple input elements
- * were passed in.
- */
- unbind: function (target, name, func) {
- var self = this, i;
-
- if (Tools.isArray(target)) {
- i = target.length;
-
- while (i--) {
- target[i] = self.unbind(target[i], name, func);
- }
-
- return target;
- }
-
- // Remove any bound events matching the input
- if (self.boundEvents && (target === self.doc || target === self.win)) {
- i = self.boundEvents.length;
-
- while (i--) {
- var item = self.boundEvents[i];
-
- if (target == item[0] && (!name || name == item[1]) && (!func || func == item[2])) {
- this.events.unbind(item[0], item[1], item[2]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ serialize: function (styles, elementName) {
+ var css = '', name, value;
+ var serializeStyles = function (name) {
+ var styleList, i, l, value;
+ styleList = validStyles[name];
+ if (styleList) {
+ for (i = 0, l = styleList.length; i < l; i++) {
+ name = styleList[i];
+ value = styles[name];
+ if (value) {
+ css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return this.events.unbind(target, name, func);
- },
-
- /**
- * Fires the specified event name with object on target.
- *
- * @method fire
- * @param {Node/Document/Window} target Target element or object to fire event on.
- * @param {String} name Name of the event to fire.
- * @param {Object} evt Event object to send.
- * @return {Event} Event object.
- */
- fire: function (target, name, evt) {
- return this.events.fire(target, name, evt);
- },
-
- // Returns the content editable state of a node
- getContentEditable: function (node) {
- var contentEditable;
-
- // Check type
- if (!node || node.nodeType != 1) {
- return null;
- }
-
- // Check for fake content editable
- contentEditable = node.getAttribute("data-mce-contenteditable");
- if (contentEditable && contentEditable !== "inherit") {
- return contentEditable;
- }
-
- // Check for real content editable
- return node.contentEditable !== "inherit" ? node.contentEditable : null;
- },
-
- getContentEditableParent: function (node) {
- var root = this.getRoot(), state = null;
-
- for (; node && node !== root; node = node.parentNode) {
- state = this.getContentEditable(node);
-
- if (state !== null) {
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isValid = function (name, elementName) {
+ var styleMap;
+ styleMap = invalidStyles['*'];
+ if (styleMap && styleMap[name]) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return state;
- },
-
- /**
- * Destroys all internal references to the DOM to solve IE leak issues.
- *
- * @method destroy
- */
- destroy: function () {
- var self = this;
-
- // Unbind all events bound to window/document by editor instance
- if (self.boundEvents) {
- var i = self.boundEvents.length;
-
- while (i--) {
- var item = self.boundEvents[i];
- this.events.unbind(item[0], item[1], item[2]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ styleMap = invalidStyles[elementName];
+ if (styleMap && styleMap[name]) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.boundEvents = null;
- }
-
- // Restore sizzle document to window.document
- // Since the current document might be removed producing "Permission denied" on IE see #6325
- if (Sizzle.setDocument) {
- Sizzle.setDocument();
- }
-
- self.win = self.doc = self.root = self.events = self.frag = null;
- },
-
- isChildOf: function (node, parent) {
- while (node) {
- if (parent === node) {
- return true;
- }
-
- node = node.parentNode;
- }
-
- return false;
- },
-
- // #ifdef debug
-
- dumpRng: function (r) {
- return (
- 'startContainer: ' + r.startContainer.nodeName +
- ', startOffset: ' + r.startOffset +
- ', endContainer: ' + r.endContainer.nodeName +
- ', endOffset: ' + r.endOffset
- );
- },
-
- // #endif
-
- _findSib: function (node, selector, name) {
- var self = this, func = selector;
-
- if (node) {
- // If expression make a function of it using is
- if (typeof func == 'string') {
- func = function (node) {
- return self.is(node, selector);
- };
- }
-
- // Loop all siblings
- for (node = node[name]; node; node = node[name]) {
- if (func(node)) {
- return node;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ };
+ if (elementName && validStyles) {
+ serializeStyles('*');
+ serializeStyles(elementName);
+ } else {
+ for (name in styles) {
+ value = styles[name];
+ if (value && (!invalidStyles || isValid(name, elementName))) {
+ css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return css;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Instance of DOMUtils for the current document.
- *
- * @static
- * @property DOM
- * @type tinymce.dom.DOMUtils
- * @example
- * // Example of how to add a class to some element by id
- * tinymce.DOM.addClass('someid', 'someclass');
- */
- DOMUtils.DOM = new DOMUtils(document);
- DOMUtils.nodeIndex = nodeIndex;
-
- return DOMUtils;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ScriptLoader.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/*globals console*/
-
-/**
- * This class handles asynchronous/synchronous loading of JavaScript files it will execute callbacks
- * when various items gets loaded. This class is useful to load external JavaScript files.
- *
- * @class tinymce.dom.ScriptLoader
- * @example
- * // Load a script from a specific URL using the global script loader
- * tinymce.ScriptLoader.load('somescript.js');
- *
- * // Load a script using a unique instance of the script loader
- * var scriptLoader = new tinymce.dom.ScriptLoader();
- *
- * scriptLoader.load('somescript.js');
- *
- * // Load multiple scripts
- * var scriptLoader = new tinymce.dom.ScriptLoader();
- *
- * scriptLoader.add('somescript1.js');
- * scriptLoader.add('somescript2.js');
- * scriptLoader.add('somescript3.js');
- *
- * scriptLoader.loadQueue(function() {
- * alert('All scripts are now loaded.');
- * });
- */
-define(
- 'tinymce.core.dom.ScriptLoader',
- [
- "tinymce.core.dom.DOMUtils",
- "tinymce.core.util.Tools"
- ],
- function (DOMUtils, Tools) {
- var DOM = DOMUtils.DOM;
- var each = Tools.each, grep = Tools.grep;
-
- var isFunction = function (f) {
- return typeof f === 'function';
- };
-
- function ScriptLoader() {
- var QUEUED = 0,
- LOADING = 1,
- LOADED = 2,
- FAILED = 3,
- states = {},
- queue = [],
- scriptLoadedCallbacks = {},
- queueLoadedCallbacks = [],
- loading = 0,
- undef;
-
- /**
- * Loads a specific script directly without adding it to the load queue.
- *
- * @method load
- * @param {String} url Absolute URL to script to add.
- * @param {function} callback Optional success callback function when the script loaded successfully.
- * @param {function} callback Optional failure callback function when the script failed to load.
- */
- function loadScript(url, success, failure) {
- var dom = DOM, elm, id;
-
- // Execute callback when script is loaded
- function done() {
- dom.remove(id);
-
- if (elm) {
- elm.onreadystatechange = elm.onload = elm = null;
- }
-
- success();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$5 = $_52qop8kjfuw8l6v.each;
+ var grep$1 = $_52qop8kjfuw8l6v.grep;
+ var isIE = $_9fhi43ajfuw8l13.ie;
+ var simpleSelectorRe = /^([a-z0-9],?)+$/i;
+ var whiteSpaceRegExp$2 = /^[ \t\r\n]*$/;
+ var setupAttrHooks = function (styles, settings, getContext) {
+ var attrHooks = {};
+ var keepValues = settings.keep_values;
+ var keepUrlHook = {
+ set: function ($elm, value, name) {
+ if (settings.url_converter) {
+ value = settings.url_converter.call(settings.url_converter_scope || getContext(), value, name, $elm[0]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function error() {
- /*eslint no-console:0 */
-
- // We can't mark it as done if there is a load error since
- // A) We don't want to produce 404 errors on the server and
- // B) the onerror event won't fire on all browsers.
- // done();
-
- if (isFunction(failure)) {
- failure();
- } else {
- // Report the error so it's easier for people to spot loading errors
- if (typeof console !== "undefined" && console.log) {
- console.log("Failed to load script: " + url);
- }
- }
- }
-
- id = dom.uniqueId();
-
- // Create new script element
- elm = document.createElement('script');
- elm.id = id;
- elm.type = 'text/javascript';
- elm.src = Tools._addCacheSuffix(url);
-
- // Seems that onreadystatechange works better on IE 10 onload seems to fire incorrectly
- if ("onreadystatechange" in elm) {
- elm.onreadystatechange = function () {
- if (/loaded|complete/.test(elm.readyState)) {
- done();
- }
- };
- } else {
- elm.onload = done;
- }
-
- // Add onerror event will get fired on some browsers but not all of them
- elm.onerror = error;
-
- // Add script to document
- (document.getElementsByTagName('head')[0] || document.body).appendChild(elm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $elm.attr('data-mce-' + name, value).attr(name, value);
+ },
+ get: function ($elm, name) {
+ return $elm.attr('data-mce-' + name) || $elm.attr(name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns true/false if a script has been loaded or not.
- *
- * @method isDone
- * @param {String} url URL to check for.
- * @return {Boolean} true/false if the URL is loaded.
- */
- this.isDone = function (url) {
- return states[url] == LOADED;
- };
-
- /**
- * Marks a specific script to be loaded. This can be useful if a script got loaded outside
- * the script loader or to skip it from loading some script.
- *
- * @method markDone
- * @param {string} url Absolute URL to the script to mark as loaded.
- */
- this.markDone = function (url) {
- states[url] = LOADED;
- };
-
- /**
- * Adds a specific script to the load queue of the script loader.
- *
- * @method add
- * @param {String} url Absolute URL to script to add.
- * @param {function} success Optional success callback function to execute when the script loades successfully.
- * @param {Object} scope Optional scope to execute callback in.
- * @param {function} failure Optional failure callback function to execute when the script failed to load.
- */
- this.add = this.load = function (url, success, scope, failure) {
- var state = states[url];
-
- // Add url to load queue
- if (state == undef) {
- queue.push(url);
- states[url] = QUEUED;
- }
-
- if (success) {
- // Store away callback for later execution
- if (!scriptLoadedCallbacks[url]) {
- scriptLoadedCallbacks[url] = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ attrHooks = {
+ style: {
+ set: function ($elm, value) {
+ if (value !== null && typeof value === 'object') {
+ $elm.css(value);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- scriptLoadedCallbacks[url].push({
- success: success,
- failure: failure,
- scope: scope || this
- });
- }
- };
-
- this.remove = function (url) {
- delete states[url];
- delete scriptLoadedCallbacks[url];
- };
-
- /**
- * Starts the loading of the queue.
- *
- * @method loadQueue
- * @param {function} success Optional callback to execute when all queued items are loaded.
- * @param {function} failure Optional callback to execute when queued items failed to load.
- * @param {Object} scope Optional scope to execute the callback in.
- */
- this.loadQueue = function (success, scope, failure) {
- this.loadScripts(queue, success, scope, failure);
- };
-
- /**
- * Loads the specified queue of files and executes the callback ones they are loaded.
- * This method is generally not used outside this class but it might be useful in some scenarios.
- *
- * @method loadScripts
- * @param {Array} scripts Array of queue items to load.
- * @param {function} callback Optional callback to execute when scripts is loaded successfully.
- * @param {Object} scope Optional scope to execute callback in.
- * @param {function} callback Optional callback to execute if scripts failed to load.
- */
- this.loadScripts = function (scripts, success, scope, failure) {
- var loadScripts, failures = [];
-
- function execCallbacks(name, url) {
- // Execute URL callback functions
- each(scriptLoadedCallbacks[url], function (callback) {
- if (isFunction(callback[name])) {
- callback[name].call(callback.scope);
- }
- });
-
- scriptLoadedCallbacks[url] = undef;
- }
-
- queueLoadedCallbacks.push({
- success: success,
- failure: failure,
- scope: scope || this
- });
-
- loadScripts = function () {
- var loadingScripts = grep(scripts);
-
- // Current scripts has been handled
- scripts.length = 0;
-
- // Load scripts that needs to be loaded
- each(loadingScripts, function (url) {
- // Script is already loaded then execute script callbacks directly
- if (states[url] === LOADED) {
- execCallbacks('success', url);
- return;
- }
-
- if (states[url] === FAILED) {
- execCallbacks('failure', url);
- return;
- }
-
- // Is script not loading then start loading it
- if (states[url] !== LOADING) {
- states[url] = LOADING;
- loading++;
-
- loadScript(url, function () {
- states[url] = LOADED;
- loading--;
-
- execCallbacks('success', url);
-
- // Load more scripts if they where added by the recently loaded script
- loadScripts();
- }, function () {
- states[url] = FAILED;
- loading--;
-
- failures.push(url);
- execCallbacks('failure', url);
-
- // Load more scripts if they where added by the recently loaded script
- loadScripts();
- });
- }
- });
-
- // No scripts are currently loading then execute all pending queue loaded callbacks
- if (!loading) {
- each(queueLoadedCallbacks, function (callback) {
- if (failures.length === 0) {
- if (isFunction(callback.success)) {
- callback.success.call(callback.scope);
- }
- } else {
- if (isFunction(callback.failure)) {
- callback.failure.call(callback.scope, failures);
- }
- }
- });
-
- queueLoadedCallbacks.length = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (keepValues) {
+ $elm.attr('data-mce-style', value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- loadScripts();
- };
- }
-
- ScriptLoader.ScriptLoader = new ScriptLoader();
-
- return ScriptLoader;
- }
-);
-
-/**
- * AddOnManager.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class handles the loading of themes/plugins or other add-ons and their language packs.
- *
- * @class tinymce.AddOnManager
- */
-define(
- 'tinymce.core.AddOnManager',
- [
- "tinymce.core.dom.ScriptLoader",
- "tinymce.core.util.Tools"
- ],
- function (ScriptLoader, Tools) {
- var each = Tools.each;
-
- function AddOnManager() {
- var self = this;
-
- self.items = [];
- self.urls = {};
- self.lookup = {};
- }
-
- AddOnManager.prototype = {
- /**
- * Returns the specified add on by the short name.
- *
- * @method get
- * @param {String} name Add-on to look for.
- * @return {tinymce.Theme/tinymce.Plugin} Theme or plugin add-on instance or undefined.
- */
- get: function (name) {
- if (this.lookup[name]) {
- return this.lookup[name].instance;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $elm.attr('style', value);
+ },
+ get: function ($elm) {
+ var value = $elm.attr('data-mce-style') || $elm.attr('style');
+ value = styles.serialize(styles.parse(value), $elm[0].nodeName);
+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return undefined;
- },
-
- dependencies: function (name) {
- var result;
-
- if (this.lookup[name]) {
- result = this.lookup[name].dependencies;
- }
-
- return result || [];
- },
-
- /**
- * Loads a language pack for the specified add-on.
- *
- * @method requireLangPack
- * @param {String} name Short name of the add-on.
- * @param {String} languages Optional comma or space separated list of languages to check if it matches the name.
- */
- requireLangPack: function (name, languages) {
- var language = AddOnManager.language;
-
- if (language && AddOnManager.languageLoad !== false) {
- if (languages) {
- languages = ',' + languages + ',';
-
- // Load short form sv.js or long form sv_SE.js
- if (languages.indexOf(',' + language.substr(0, 2) + ',') != -1) {
- language = language.substr(0, 2);
- } else if (languages.indexOf(',' + language + ',') == -1) {
- return;
- }
- }
-
- ScriptLoader.ScriptLoader.add(this.urls[name] + '/langs/' + language + '.js');
- }
- },
-
- /**
- * Adds a instance of the add-on by it's short name.
- *
- * @method add
- * @param {String} id Short name/id for the add-on.
- * @param {tinymce.Theme/tinymce.Plugin} addOn Theme or plugin to add.
- * @return {tinymce.Theme/tinymce.Plugin} The same theme or plugin instance that got passed in.
- * @example
- * // Create a simple plugin
- * tinymce.create('tinymce.plugins.TestPlugin', {
- * TestPlugin: function(ed, url) {
- * ed.on('click', function(e) {
- * ed.windowManager.alert('Hello World!');
- * });
- * }
- * });
- *
- * // Register plugin using the add method
- * tinymce.PluginManager.add('test', tinymce.plugins.TestPlugin);
- *
- * // Initialize TinyMCE
- * tinymce.init({
- * ...
- * plugins: '-test' // Init the plugin but don't try to load it
- * });
- */
- add: function (id, addOn, dependencies) {
- this.items.push(addOn);
- this.lookup[id] = { instance: addOn, dependencies: dependencies };
-
- return addOn;
- },
-
- remove: function (name) {
- delete this.urls[name];
- delete this.lookup[name];
- },
-
- createUrl: function (baseUrl, dep) {
- if (typeof dep === "object") {
- return dep;
- }
-
- return { prefix: baseUrl.prefix, resource: dep, suffix: baseUrl.suffix };
- },
-
- /**
- * Add a set of components that will make up the add-on. Using the url of the add-on name as the base url.
- * This should be used in development mode. A new compressor/javascript munger process will ensure that the
- * components are put together into the plugin.js file and compressed correctly.
- *
- * @method addComponents
- * @param {String} pluginName name of the plugin to load scripts from (will be used to get the base url for the plugins).
- * @param {Array} scripts Array containing the names of the scripts to load.
- */
- addComponents: function (pluginName, scripts) {
- var pluginUrl = this.urls[pluginName];
-
- each(scripts, function (script) {
- ScriptLoader.ScriptLoader.add(pluginUrl + "/" + script);
- });
- },
-
- /**
- * Loads an add-on from a specific url.
- *
- * @method load
- * @param {String} name Short name of the add-on that gets loaded.
- * @param {String} addOnUrl URL to the add-on that will get loaded.
- * @param {function} success Optional success callback to execute when an add-on is loaded.
- * @param {Object} scope Optional scope to execute the callback in.
- * @param {function} failure Optional failure callback to execute when an add-on failed to load.
- * @example
- * // Loads a plugin from an external URL
- * tinymce.PluginManager.load('myplugin', '/some/dir/someplugin/plugin.js');
- *
- * // Initialize TinyMCE
- * tinymce.init({
- * ...
- * plugins: '-myplugin' // Don't try to load it again
- * });
- */
- load: function (name, addOnUrl, success, scope, failure) {
- var self = this, url = addOnUrl;
-
- function loadDependencies() {
- var dependencies = self.dependencies(name);
-
- each(dependencies, function (dep) {
- var newUrl = self.createUrl(addOnUrl, dep);
-
- self.load(newUrl.resource, newUrl, undefined, undefined);
- });
-
- if (success) {
- if (scope) {
- success.call(scope);
- } else {
- success.call(ScriptLoader);
- }
- }
- }
-
- if (self.urls[name]) {
- return;
- }
-
- if (typeof addOnUrl === "object") {
- url = addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix;
- }
-
- if (url.indexOf('/') !== 0 && url.indexOf('://') == -1) {
- url = AddOnManager.baseURL + '/' + url;
- }
-
- self.urls[name] = url.substring(0, url.lastIndexOf('/'));
-
- if (self.lookup[name]) {
- loadDependencies();
- } else {
- ScriptLoader.ScriptLoader.add(url, loadDependencies, scope, failure);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- AddOnManager.PluginManager = new AddOnManager();
- AddOnManager.ThemeManager = new AddOnManager();
-
- return AddOnManager;
- }
-);
-
-/**
- * TinyMCE theme class.
- *
- * @class tinymce.Theme
- */
-
-/**
- * This method is responsible for rendering/generating the overall user interface with toolbars, buttons, iframe containers etc.
- *
- * @method renderUI
- * @param {Object} obj Object parameter containing the targetNode DOM node that will be replaced visually with an editor instance.
- * @return {Object} an object with items like iframeContainer, editorContainer, sizeContainer, deltaWidth, deltaHeight.
- */
-
-/**
- * Plugin base class, this is a pseudo class that describes how a plugin is to be created for TinyMCE. The methods below are all optional.
- *
- * @class tinymce.Plugin
- * @example
- * tinymce.PluginManager.add('example', function(editor, url) {
- * // Add a button that opens a window
- * editor.addButton('example', {
- * text: 'My button',
- * icon: false,
- * onclick: function() {
- * // Open window
- * editor.windowManager.open({
- * title: 'Example plugin',
- * body: [
- * {type: 'textbox', name: 'title', label: 'Title'}
- * ],
- * onsubmit: function(e) {
- * // Insert content when the window form is submitted
- * editor.insertContent('Title: ' + e.data.title);
- * }
- * });
- * }
- * });
- *
- * // Adds a menu item to the tools menu
- * editor.addMenuItem('example', {
- * text: 'Example plugin',
- * context: 'tools',
- * onclick: function() {
- * // Open window with a specific url
- * editor.windowManager.open({
- * title: 'TinyMCE site',
- * url: 'http://www.tinymce.com',
- * width: 800,
- * height: 600,
- * buttons: [{
- * text: 'Close',
- * onclick: 'close'
- * }]
- * });
- * }
- * });
- * });
- */
-
-define(
- 'ephox.katamari.api.Cell',
-
- [
- ],
-
- function () {
- var Cell = function (initial) {
- var value = initial;
-
- var get = function () {
- return value;
- };
-
- var set = function (v) {
- value = v;
- };
-
- var clone = function () {
- return Cell(get());
- };
-
- return {
- get: get,
- set: set,
- clone: clone
- };
- };
-
- return Cell;
- }
-);
-
-/**
- * NodeType.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Contains various node validation functions.
- *
- * @private
- * @class tinymce.dom.NodeType
- */
-define(
- 'tinymce.core.dom.NodeType',
- [
- ],
- function () {
- function isNodeType(type) {
- return function (node) {
- return !!node && node.nodeType == type;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (keepValues) {
+ attrHooks.href = attrHooks.src = keepUrlHook;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isElement = isNodeType(1);
-
- function matchNodeNames(names) {
- names = names.toLowerCase().split(' ');
-
- return function (node) {
- var i, name;
-
- if (node && node.nodeType) {
- name = node.nodeName.toLowerCase();
-
- for (i = 0; i < names.length; i++) {
- if (name === names[i]) {
- return true;
- }
- }
- }
-
- return false;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return attrHooks;
+ };
+ var updateInternalStyleAttr = function (styles, $elm) {
+ var rawValue = $elm.attr('style');
+ var value = styles.serialize(styles.parse(rawValue), $elm[0].nodeName);
+ if (!value) {
+ value = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function matchStyleValues(name, values) {
- values = values.toLowerCase().split(' ');
-
- return function (node) {
- var i, cssValue;
-
- if (isElement(node)) {
- for (i = 0; i < values.length; i++) {
- cssValue = node.ownerDocument.defaultView.getComputedStyle(node, null).getPropertyValue(name);
- if (cssValue === values[i]) {
- return true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $elm.attr('data-mce-style', value);
+ };
+ var findNodeIndex = function (node, normalized) {
+ var idx = 0, lastNodeType, nodeType;
+ if (node) {
+ for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) {
+ nodeType = node.nodeType;
+ if (normalized && nodeType === 3) {
+ if (nodeType === lastNodeType || !node.nodeValue.length) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ idx++;
+ lastNodeType = nodeType;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hasPropValue(propName, propValue) {
- return function (node) {
- return isElement(node) && node[propName] === propValue;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return idx;
+ };
+ function DOMUtils(doc, settings) {
+ var _this = this;
+ if (settings === void 0) {
+ settings = {};
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hasAttribute(attrName, attrValue) {
- return function (node) {
- return isElement(node) && node.hasAttribute(attrName);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var attrHooks;
+ var addedStyles = {};
+ var win = window;
+ var files = {};
+ var counter = 0;
+ var stdMode = true;
+ var boxModel = true;
+ var styleSheetLoader = StyleSheetLoader(doc);
+ var boundEvents = [];
+ var schema = settings.schema ? settings.schema : Schema({});
+ var styles = Styles({
+ url_converter: settings.url_converter,
+ url_converter_scope: settings.url_converter_scope
+ }, settings.schema);
+ var events = settings.ownEvents ? new EventUtils(settings.proxy) : EventUtils.Event;
+ var blockElementsMap = schema.getBlockElements();
+ var $ = DomQuery.overrideDefaults(function () {
+ return {
+ context: doc,
+ element: self.getRoot()
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function hasAttributeValue(attrName, attrValue) {
- return function (node) {
- return isElement(node) && node.getAttribute(attrName) === attrValue;
- };
- }
-
- function isBogus(node) {
- return isElement(node) && node.hasAttribute('data-mce-bogus');
- }
-
- function hasContentEditableState(value) {
- return function (node) {
- if (isElement(node)) {
- if (node.contentEditable === value) {
- return true;
- }
-
- if (node.getAttribute('data-mce-contenteditable') === value) {
- return true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ var isBlock = function (node) {
+ if (typeof node === 'string') {
+ return !!blockElementsMap[node];
+ } else if (node) {
+ var type = node.nodeType;
+ if (type) {
+ return !!(type === 1 && blockElementsMap[node.nodeName]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
- };
- }
-
- return {
- isText: isNodeType(3),
- isElement: isElement,
- isComment: isNodeType(8),
- isBr: matchNodeNames('br'),
- isContentEditableTrue: hasContentEditableState('true'),
- isContentEditableFalse: hasContentEditableState('false'),
- matchNodeNames: matchNodeNames,
- hasPropValue: hasPropValue,
- hasAttribute: hasAttribute,
- hasAttributeValue: hasAttributeValue,
- matchStyleValues: matchStyleValues,
- isBogus: isBogus
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Fun.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Functional utility class.
- *
- * @private
- * @class tinymce.util.Fun
- */
-define(
- 'tinymce.core.util.Fun',
- [
- ],
- function () {
- var slice = [].slice;
-
- function constant(value) {
- return function () {
- return value;
- };
- }
-
- function negate(predicate) {
- return function (x) {
- return !predicate(x);
- };
- }
-
- function compose(f, g) {
- return function (x) {
- return f(g(x));
- };
- }
-
- function or() {
- var args = slice.call(arguments);
-
- return function (x) {
- for (var i = 0; i < args.length; i++) {
- if (args[i](x)) {
- return true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get = function (elm) {
+ if (elm && doc && typeof elm === 'string') {
+ var node = doc.getElementById(elm);
+ if (node && node.id !== elm) {
+ return doc.getElementsByName(elm)[1];
+ } else {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
- };
- }
-
- function and() {
- var args = slice.call(arguments);
-
- return function (x) {
- for (var i = 0; i < args.length; i++) {
- if (!args[i](x)) {
- return false;
- }
- }
-
- return true;
- };
- }
-
- function curry(fn) {
- var args = slice.call(arguments);
-
- if (args.length - 1 >= fn.length) {
- return fn.apply(this, args.slice(1));
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return function () {
- var tempArgs = args.concat([].slice.call(arguments));
- return curry.apply(this, tempArgs);
- };
- }
-
- function noop() {
- }
-
- return {
- constant: constant,
- negate: negate,
- and: and,
- or: or,
- curry: curry,
- compose: compose,
- noop: noop
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return elm;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Zwsp.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Utility functions for working with zero width space
- * characters used as character containers etc.
- *
- * @private
- * @class tinymce.text.Zwsp
- * @example
- * var isZwsp = Zwsp.isZwsp('\uFEFF');
- * var abc = Zwsp.trim('a\uFEFFc');
- */
-define(
- 'tinymce.core.text.Zwsp',
- [
- ],
- function () {
- // This is technically not a ZWSP but a ZWNBSP or a BYTE ORDER MARK it used to be a ZWSP
- var ZWSP = '\uFEFF';
-
- var isZwsp = function (chr) {
- return chr === ZWSP;
- };
-
- var trim = function (text) {
- return text.replace(new RegExp(ZWSP, 'g'), '');
- };
-
- return {
- isZwsp: isZwsp,
- ZWSP: ZWSP,
- trim: trim
- };
- }
-);
-/**
- * CaretContainer.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module handles caret containers. A caret container is a node that
- * holds the caret for positional purposes.
- *
- * @private
- * @class tinymce.caret.CaretContainer
- */
-define(
- 'tinymce.core.caret.CaretContainer',
- [
- "tinymce.core.dom.NodeType",
- "tinymce.core.text.Zwsp"
- ],
- function (NodeType, Zwsp) {
- var isElement = NodeType.isElement,
- isText = NodeType.isText;
-
- function isCaretContainerBlock(node) {
- if (isText(node)) {
- node = node.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $$ = function (elm) {
+ if (typeof elm === 'string') {
+ elm = get(elm);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return isElement(node) && node.hasAttribute('data-mce-caret');
- }
-
- function isCaretContainerInline(node) {
- return isText(node) && Zwsp.isZwsp(node.data);
- }
-
- function isCaretContainer(node) {
- return isCaretContainerBlock(node) || isCaretContainerInline(node);
- }
-
- var hasContent = function (node) {
- return node.firstChild !== node.lastChild || !NodeType.isBr(node.firstChild);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $(elm);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function insertInline(node, before) {
- var doc, sibling, textNode, parentNode;
-
- doc = node.ownerDocument;
- textNode = doc.createTextNode(Zwsp.ZWSP);
- parentNode = node.parentNode;
-
- if (!before) {
- sibling = node.nextSibling;
- if (isText(sibling)) {
- if (isCaretContainer(sibling)) {
- return sibling;
- }
-
- if (startsWithCaretContainer(sibling)) {
- sibling.splitText(1);
- return sibling;
- }
- }
-
- if (node.nextSibling) {
- parentNode.insertBefore(textNode, node.nextSibling);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getAttrib = function (elm, name, defaultVal) {
+ var hook, value;
+ var $elm = $$(elm);
+ if ($elm.length) {
+ hook = attrHooks[name];
+ if (hook && hook.get) {
+ value = hook.get($elm, name);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- parentNode.appendChild(textNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ value = $elm.attr(name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- sibling = node.previousSibling;
- if (isText(sibling)) {
- if (isCaretContainer(sibling)) {
- return sibling;
- }
-
- if (endsWithCaretContainer(sibling)) {
- return sibling.splitText(sibling.data.length - 1);
- }
- }
-
- parentNode.insertBefore(textNode, node);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return textNode;
- }
-
- var prependInline = function (node) {
- if (NodeType.isText(node)) {
- var data = node.data;
- if (data.length > 0 && data.charAt(0) !== Zwsp.ZWSP) {
- node.insertData(0, Zwsp.ZWSP);
- }
- return node;
- } else {
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (typeof value === 'undefined') {
+ value = defaultVal || '';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var appendInline = function (node) {
- if (NodeType.isText(node)) {
- var data = node.data;
- if (data.length > 0 && data.charAt(data.length - 1) !== Zwsp.ZWSP) {
- node.insertData(data.length, Zwsp.ZWSP);
- }
- return node;
- } else {
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getAttribs = function (elm) {
+ var node = get(elm);
+ if (!node) {
+ return [];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return node.attributes;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isBeforeInline = function (pos) {
- return pos && NodeType.isText(pos.container()) && pos.container().data.charAt(pos.offset()) === Zwsp.ZWSP;
- };
-
- var isAfterInline = function (pos) {
- return pos && NodeType.isText(pos.container()) && pos.container().data.charAt(pos.offset() - 1) === Zwsp.ZWSP;
- };
-
- function createBogusBr() {
- var br = document.createElement('br');
- br.setAttribute('data-mce-bogus', '1');
- return br;
- }
-
- function insertBlock(blockName, node, before) {
- var doc, blockNode, parentNode;
-
- doc = node.ownerDocument;
- blockNode = doc.createElement(blockName);
- blockNode.setAttribute('data-mce-caret', before ? 'before' : 'after');
- blockNode.setAttribute('data-mce-bogus', 'all');
- blockNode.appendChild(createBogusBr());
- parentNode = node.parentNode;
-
- if (!before) {
- if (node.nextSibling) {
- parentNode.insertBefore(blockNode, node.nextSibling);
- } else {
- parentNode.appendChild(blockNode);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setAttrib = function (elm, name, value) {
+ var originalValue, hook;
+ if (value === '') {
+ value = null;
+ }
+ var $elm = $$(elm);
+ originalValue = $elm.attr(name);
+ if (!$elm.length) {
+ return;
+ }
+ hook = attrHooks[name];
+ if (hook && hook.set) {
+ hook.set($elm, value, name);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- parentNode.insertBefore(blockNode, node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $elm.attr(name, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return blockNode;
- }
-
- function startsWithCaretContainer(node) {
- return isText(node) && node.data[0] == Zwsp.ZWSP;
- }
-
- function endsWithCaretContainer(node) {
- return isText(node) && node.data[node.data.length - 1] == Zwsp.ZWSP;
- }
-
- function trimBogusBr(elm) {
- var brs = elm.getElementsByTagName('br');
- var lastBr = brs[brs.length - 1];
- if (NodeType.isBogus(lastBr)) {
- lastBr.parentNode.removeChild(lastBr);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (originalValue !== value && settings.onSetAttrib) {
+ settings.onSetAttrib({
+ attrElm: $elm,
+ attrName: name,
+ attrValue: value
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function showCaretContainerBlock(caretContainer) {
- if (caretContainer && caretContainer.hasAttribute('data-mce-caret')) {
- trimBogusBr(caretContainer);
- caretContainer.removeAttribute('data-mce-caret');
- caretContainer.removeAttribute('data-mce-bogus');
- caretContainer.removeAttribute('style');
- caretContainer.removeAttribute('_moz_abspos');
- return caretContainer;
- }
-
- return null;
- }
-
- return {
- isCaretContainer: isCaretContainer,
- isCaretContainerBlock: isCaretContainerBlock,
- isCaretContainerInline: isCaretContainerInline,
- showCaretContainerBlock: showCaretContainerBlock,
- insertInline: insertInline,
- prependInline: prependInline,
- appendInline: appendInline,
- isBeforeInline: isBeforeInline,
- isAfterInline: isAfterInline,
- insertBlock: insertBlock,
- hasContent: hasContent,
- startsWithCaretContainer: startsWithCaretContainer,
- endsWithCaretContainer: endsWithCaretContainer
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * RangeUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains a few utility methods for ranges.
- *
- * @class tinymce.dom.RangeUtils
- */
-define(
- 'tinymce.core.dom.RangeUtils',
- [
- "tinymce.core.util.Tools",
- "tinymce.core.dom.TreeWalker",
- "tinymce.core.dom.NodeType",
- "tinymce.core.dom.Range",
- "tinymce.core.caret.CaretContainer"
- ],
- function (Tools, TreeWalker, NodeType, Range, CaretContainer) {
- var each = Tools.each,
- isContentEditableTrue = NodeType.isContentEditableTrue,
- isContentEditableFalse = NodeType.isContentEditableFalse,
- isCaretContainer = CaretContainer.isCaretContainer;
-
- function hasCeProperty(node) {
- return isContentEditableTrue(node) || isContentEditableFalse(node);
- }
-
- function getEndChild(container, index) {
- var childNodes = container.childNodes;
-
- index--;
-
- if (index > childNodes.length - 1) {
- index = childNodes.length - 1;
- } else if (index < 0) {
- index = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var clone = function (node, deep) {
+ if (!isIE || node.nodeType !== 1 || deep) {
+ return node.cloneNode(deep);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return childNodes[index] || container;
- }
-
- function findParent(node, rootNode, predicate) {
- while (node && node !== rootNode) {
- if (predicate(node)) {
- return node;
- }
-
- node = node.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!deep) {
+ var clone_1 = doc.createElement(node.nodeName);
+ each$5(getAttribs(node), function (attr) {
+ setAttrib(clone_1, attr.nodeName, getAttrib(node, attr.nodeName));
+ });
+ return clone_1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return null;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function hasParent(node, rootNode, predicate) {
- return findParent(node, rootNode, predicate) !== null;
- }
-
- function hasParentWithName(node, rootNode, name) {
- return hasParent(node, rootNode, function (node) {
- return node.nodeName === name;
- });
- }
-
- function isFormatterCaret(node) {
- return node.id === '_mce_caret';
- }
-
- function isCeFalseCaretContainer(node, rootNode) {
- return isCaretContainer(node) && hasParent(node, rootNode, isFormatterCaret) === false;
- }
-
- function RangeUtils(dom) {
- /**
- * Walks the specified range like object and executes the callback for each sibling collection it finds.
- *
- * @private
- * @method walk
- * @param {Object} rng Range like object.
- * @param {function} callback Callback function to execute for each sibling collection.
- */
- this.walk = function (rng, callback) {
- var startContainer = rng.startContainer,
- startOffset = rng.startOffset,
- endContainer = rng.endContainer,
- endOffset = rng.endOffset,
- ancestor, startPoint,
- endPoint, node, parent, siblings, nodes;
-
- // Handle table cell selection the table plugin enables
- // you to fake select table cells and perform formatting actions on them
- nodes = dom.select('td[data-mce-selected],th[data-mce-selected]');
- if (nodes.length > 0) {
- each(nodes, function (node) {
- callback([node]);
- });
-
- return;
- }
-
- /**
- * Excludes start/end text node if they are out side the range
- *
- * @private
- * @param {Array} nodes Nodes to exclude items from.
- * @return {Array} Array with nodes excluding the start/end container if needed.
- */
- function exclude(nodes) {
- var node;
-
- // First node is excluded
- node = nodes[0];
- if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) {
- nodes.splice(0, 1);
- }
-
- // Last node is excluded
- node = nodes[nodes.length - 1];
- if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) {
- nodes.splice(nodes.length - 1, 1);
- }
-
- return nodes;
- }
-
- /**
- * Collects siblings
- *
- * @private
- * @param {Node} node Node to collect siblings from.
- * @param {String} name Name of the sibling to check for.
- * @param {Node} endNode
- * @return {Array} Array of collected siblings.
- */
- function collectSiblings(node, name, endNode) {
- var siblings = [];
-
- for (; node && node != endNode; node = node[name]) {
- siblings.push(node);
- }
-
- return siblings;
- }
-
- /**
- * Find an end point this is the node just before the common ancestor root.
- *
- * @private
- * @param {Node} node Node to start at.
- * @param {Node} root Root/ancestor element to stop just before.
- * @return {Node} Node just before the root element.
- */
- function findEndPoint(node, root) {
- do {
- if (node.parentNode == root) {
- return node;
- }
-
- node = node.parentNode;
- } while (node);
- }
-
- function walkBoundary(startNode, endNode, next) {
- var siblingName = next ? 'nextSibling' : 'previousSibling';
-
- for (node = startNode, parent = node.parentNode; node && node != endNode; node = parent) {
- parent = node.parentNode;
- siblings = collectSiblings(node == startNode ? node : node[siblingName], siblingName);
-
- if (siblings.length) {
- if (!next) {
- siblings.reverse();
- }
-
- callback(exclude(siblings));
- }
- }
- }
-
- // If index based start position then resolve it
- if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) {
- startContainer = startContainer.childNodes[startOffset];
- }
-
- // If index based end position then resolve it
- if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) {
- endContainer = getEndChild(endContainer, endOffset);
- }
-
- // Same container
- if (startContainer == endContainer) {
- return callback(exclude([startContainer]));
- }
-
- // Find common ancestor and end points
- ancestor = dom.findCommonAncestor(startContainer, endContainer);
-
- // Process left side
- for (node = startContainer; node; node = node.parentNode) {
- if (node === endContainer) {
- return walkBoundary(startContainer, ancestor, true);
- }
-
- if (node === ancestor) {
- break;
- }
- }
-
- // Process right side
- for (node = endContainer; node; node = node.parentNode) {
- if (node === startContainer) {
- return walkBoundary(endContainer, ancestor);
- }
-
- if (node === ancestor) {
- break;
- }
- }
-
- // Find start/end point
- startPoint = findEndPoint(startContainer, ancestor) || startContainer;
- endPoint = findEndPoint(endContainer, ancestor) || endContainer;
-
- // Walk left leaf
- walkBoundary(startContainer, startPoint, true);
-
- // Walk the middle from start to end point
- siblings = collectSiblings(
- startPoint == startContainer ? startPoint : startPoint.nextSibling,
- 'nextSibling',
- endPoint == endContainer ? endPoint.nextSibling : endPoint
- );
-
- if (siblings.length) {
- callback(exclude(siblings));
- }
-
- // Walk right leaf
- walkBoundary(endContainer, endPoint);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getRoot = function () {
+ return settings.root_element || doc.body;
+ };
+ var getViewPort = function (argWin) {
+ var actWin = !argWin ? win : argWin;
+ var doc = actWin.document;
+ var rootElm = boxModel ? doc.documentElement : doc.body;
+ return {
+ x: actWin.pageXOffset || rootElm.scrollLeft,
+ y: actWin.pageYOffset || rootElm.scrollTop,
+ w: actWin.innerWidth || rootElm.clientWidth,
+ h: actWin.innerHeight || rootElm.clientHeight
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Splits the specified range at it's start/end points.
- *
- * @private
- * @param {Range/RangeObject} rng Range to split.
- * @return {Object} Range position object.
- */
- this.split = function (rng) {
- var startContainer = rng.startContainer,
- startOffset = rng.startOffset,
- endContainer = rng.endContainer,
- endOffset = rng.endOffset;
-
- function splitText(node, offset) {
- return node.splitText(offset);
- }
-
- // Handle single text node
- if (startContainer == endContainer && startContainer.nodeType == 3) {
- if (startOffset > 0 && startOffset < startContainer.nodeValue.length) {
- endContainer = splitText(startContainer, startOffset);
- startContainer = endContainer.previousSibling;
-
- if (endOffset > startOffset) {
- endOffset = endOffset - startOffset;
- startContainer = endContainer = splitText(endContainer, endOffset).previousSibling;
- endOffset = endContainer.nodeValue.length;
- startOffset = 0;
- } else {
- endOffset = 0;
- }
- }
- } else {
- // Split startContainer text node if needed
- if (startContainer.nodeType == 3 && startOffset > 0 && startOffset < startContainer.nodeValue.length) {
- startContainer = splitText(startContainer, startOffset);
- startOffset = 0;
- }
-
- // Split endContainer text node if needed
- if (endContainer.nodeType == 3 && endOffset > 0 && endOffset < endContainer.nodeValue.length) {
- endContainer = splitText(endContainer, endOffset).previousSibling;
- endOffset = endContainer.nodeValue.length;
- }
- }
-
- return {
- startContainer: startContainer,
- startOffset: startOffset,
- endContainer: endContainer,
- endOffset: endOffset
- };
- };
-
- /**
- * Normalizes the specified range by finding the closest best suitable caret location.
- *
- * @private
- * @param {Range} rng Range to normalize.
- * @return {Boolean} True/false if the specified range was normalized or not.
- */
- this.normalize = function (rng) {
- var normalized = false, collapsed;
-
- function normalizeEndPoint(start) {
- var container, offset, walker, body = dom.getRoot(), node, nonEmptyElementsMap;
- var directionLeft, isAfterNode;
-
- function isTableCell(node) {
- return node && /^(TD|TH|CAPTION)$/.test(node.nodeName);
- }
-
- function hasBrBeforeAfter(node, left) {
- var walker = new TreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || body);
-
- while ((node = walker[left ? 'prev' : 'next']())) {
- if (node.nodeName === "BR") {
- return true;
- }
- }
- }
-
- function hasContentEditableFalseParent(node) {
- while (node && node != body) {
- if (isContentEditableFalse(node)) {
- return true;
- }
-
- node = node.parentNode;
- }
-
- return false;
- }
-
- function isPrevNode(node, name) {
- return node.previousSibling && node.previousSibling.nodeName == name;
- }
-
- // Walks the dom left/right to find a suitable text node to move the endpoint into
- // It will only walk within the current parent block or body and will stop if it hits a block or a BR/IMG
- function findTextNodeRelative(left, startNode) {
- var walker, lastInlineElement, parentBlockContainer;
-
- startNode = startNode || container;
- parentBlockContainer = dom.getParent(startNode.parentNode, dom.isBlock) || body;
-
- // Lean left before the BR element if it's the only BR within a block element. Gecko bug: #6680
- // This: <p><br>|</p> becomes <p>|<br></p>
- if (left && startNode.nodeName == 'BR' && isAfterNode && dom.isEmpty(parentBlockContainer)) {
- container = startNode.parentNode;
- offset = dom.nodeIndex(startNode);
- normalized = true;
- return;
- }
-
- // Walk left until we hit a text node we can move to or a block/br/img
- walker = new TreeWalker(startNode, parentBlockContainer);
- while ((node = walker[left ? 'prev' : 'next']())) {
- // Break if we hit a non content editable node
- if (dom.getContentEditableParent(node) === "false" || isCeFalseCaretContainer(node, dom.getRoot())) {
- return;
- }
-
- // Found text node that has a length
- if (node.nodeType === 3 && node.nodeValue.length > 0) {
- if (hasParentWithName(node, body, 'A') === false) {
- container = node;
- offset = left ? node.nodeValue.length : 0;
- normalized = true;
- }
-
- return;
- }
-
- // Break if we find a block or a BR/IMG/INPUT etc
- if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) {
- return;
- }
-
- lastInlineElement = node;
- }
-
- // Only fetch the last inline element when in caret mode for now
- if (collapsed && lastInlineElement) {
- container = lastInlineElement;
- normalized = true;
- offset = 0;
- }
- }
-
- container = rng[(start ? 'start' : 'end') + 'Container'];
- offset = rng[(start ? 'start' : 'end') + 'Offset'];
- isAfterNode = container.nodeType == 1 && offset === container.childNodes.length;
- nonEmptyElementsMap = dom.schema.getNonEmptyElements();
- directionLeft = start;
-
- if (isCaretContainer(container)) {
- return;
- }
-
- if (container.nodeType == 1 && offset > container.childNodes.length - 1) {
- directionLeft = false;
- }
-
- // If the container is a document move it to the body element
- if (container.nodeType === 9) {
- container = dom.getRoot();
- offset = 0;
- }
-
- // If the container is body try move it into the closest text node or position
- if (container === body) {
- // If start is before/after a image, table etc
- if (directionLeft) {
- node = container.childNodes[offset > 0 ? offset - 1 : 0];
- if (node) {
- if (isCaretContainer(node)) {
- return;
- }
-
- if (nonEmptyElementsMap[node.nodeName] || node.nodeName == "TABLE") {
- return;
- }
- }
- }
-
- // Resolve the index
- if (container.hasChildNodes()) {
- offset = Math.min(!directionLeft && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1);
- container = container.childNodes[offset];
- offset = 0;
-
- // Don't normalize non collapsed selections like <p>[a</p><table></table>]
- if (!collapsed && container === body.lastChild && container.nodeName === 'TABLE') {
- return;
- }
-
- if (hasContentEditableFalseParent(container) || isCaretContainer(container)) {
- return;
- }
-
- // Don't walk into elements that doesn't have any child nodes like a IMG
- if (container.hasChildNodes() && !/TABLE/.test(container.nodeName)) {
- // Walk the DOM to find a text node to place the caret at or a BR
- node = container;
- walker = new TreeWalker(container, body);
-
- do {
- if (isContentEditableFalse(node) || isCaretContainer(node)) {
- normalized = false;
- break;
- }
-
- // Found a text node use that position
- if (node.nodeType === 3 && node.nodeValue.length > 0) {
- offset = directionLeft ? 0 : node.nodeValue.length;
- container = node;
- normalized = true;
- break;
- }
-
- // Found a BR/IMG/PRE element that we can place the caret before
- if (nonEmptyElementsMap[node.nodeName.toLowerCase()] && !isTableCell(node)) {
- offset = dom.nodeIndex(node);
- container = node.parentNode;
-
- // Put caret after image and pre tag when moving the end point
- if ((node.nodeName === "IMG" || node.nodeName === "PRE") && !directionLeft) {
- offset++;
- }
-
- normalized = true;
- break;
- }
- } while ((node = (directionLeft ? walker.next() : walker.prev())));
- }
- }
- }
-
- // Lean the caret to the left if possible
- if (collapsed) {
- // So this: <b>x</b><i>|x</i>
- // Becomes: <b>x|</b><i>x</i>
- // Seems that only gecko has issues with this
- if (container.nodeType === 3 && offset === 0) {
- findTextNodeRelative(true);
- }
-
- // Lean left into empty inline elements when the caret is before a BR
- // So this: <i><b></b><i>|<br></i>
- // Becomes: <i><b>|</b><i><br></i>
- // Seems that only gecko has issues with this.
- // Special edge case for <p><a>x</a>|<br></p> since we don't want <p><a>x|</a><br></p>
- if (container.nodeType === 1) {
- node = container.childNodes[offset];
-
- // Offset is after the containers last child
- // then use the previous child for normalization
- if (!node) {
- node = container.childNodes[offset - 1];
- }
-
- if (node && node.nodeName === 'BR' && !isPrevNode(node, 'A') &&
- !hasBrBeforeAfter(node) && !hasBrBeforeAfter(node, true)) {
- findTextNodeRelative(true, node);
- }
- }
- }
-
- // Lean the start of the selection right if possible
- // So this: x[<b>x]</b>
- // Becomes: x<b>[x]</b>
- if (directionLeft && !collapsed && container.nodeType === 3 && offset === container.nodeValue.length) {
- findTextNodeRelative(false);
- }
-
- // Set endpoint if it was normalized
- if (normalized) {
- rng['set' + (start ? 'Start' : 'End')](container, offset);
- }
- }
-
- collapsed = rng.collapsed;
-
- normalizeEndPoint(true);
-
- if (!collapsed) {
- normalizeEndPoint();
- }
-
- // If it was collapsed then make sure it still is
- if (normalized && collapsed) {
- rng.collapse(true);
- }
-
- return normalized;
- };
- }
-
- /**
- * Compares two ranges and checks if they are equal.
- *
- * @static
- * @method compareRanges
- * @param {DOMRange} rng1 First range to compare.
- * @param {DOMRange} rng2 First range to compare.
- * @return {Boolean} true/false if the ranges are equal.
- */
- RangeUtils.compareRanges = function (rng1, rng2) {
- if (rng1 && rng2) {
- // Compare native IE ranges
- if (rng1.item || rng1.duplicate) {
- // Both are control ranges and the selected element matches
- if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0)) {
- return true;
- }
-
- // Both are text ranges and the range matches
- if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1)) {
- return true;
- }
- } else {
- // Compare w3c ranges
- return rng1.startContainer == rng2.startContainer && rng1.startOffset == rng2.startOffset;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getPos = function (elm, rootElm) {
+ return $_4nsusvmjfuw8l7a.getPos(doc.body, get(elm), rootElm);
+ };
+ var setStyle = function (elm, name, value) {
+ var $elm = $$(elm).css(name, value);
+ if (settings.update_styles) {
+ updateInternalStyleAttr(styles, $elm);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Finds the closest selection rect tries to get the range from that.
- */
- function findClosestIeRange(clientX, clientY, doc) {
- var element, rng, rects;
-
- element = doc.elementFromPoint(clientX, clientY);
- rng = doc.body.createTextRange();
-
- if (!element || element.tagName == 'HTML') {
- element = doc.body;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setStyles = function (elm, stylesArg) {
+ var $elm = $$(elm).css(stylesArg);
+ if (settings.update_styles) {
+ updateInternalStyleAttr(styles, $elm);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- rng.moveToElementText(element);
- rects = Tools.toArray(rng.getClientRects());
-
- rects = rects.sort(function (a, b) {
- a = Math.abs(Math.max(a.top - clientY, a.bottom - clientY));
- b = Math.abs(Math.max(b.top - clientY, b.bottom - clientY));
-
- return a - b;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getStyle = function (elm, name, computed) {
+ var $elm = $$(elm);
+ if (computed) {
+ return $elm.css(name);
+ }
+ name = name.replace(/-(\D)/g, function (a, b) {
+ return b.toUpperCase();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rects.length > 0) {
- clientY = (rects[0].bottom + rects[0].top) / 2;
-
- try {
- rng.moveToPoint(clientX, clientY);
- rng.collapse(true);
-
- return rng;
- } catch (ex) {
- // At least we tried
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (name === 'float') {
+ name = $_9fhi43ajfuw8l13.ie && $_9fhi43ajfuw8l13.ie < 12 ? 'styleFloat' : 'cssFloat';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
- }
-
- function moveOutOfContentEditableFalse(rng, rootNode) {
- var parentElement = rng && rng.parentElement ? rng.parentElement() : null;
- return isContentEditableFalse(findParent(parentElement, rootNode, hasCeProperty)) ? null : rng;
- }
-
- /**
- * Gets the caret range for the given x/y location.
- *
- * @static
- * @method getCaretRangeFromPoint
- * @param {Number} clientX X coordinate for range
- * @param {Number} clientY Y coordinate for range
- * @param {Document} doc Document that x/y are relative to
- * @returns {Range} caret range
- */
- RangeUtils.getCaretRangeFromPoint = function (clientX, clientY, doc) {
- var rng, point;
-
- if (doc.caretPositionFromPoint) {
- point = doc.caretPositionFromPoint(clientX, clientY);
- rng = doc.createRange();
- rng.setStart(point.offsetNode, point.offset);
- rng.collapse(true);
- } else if (doc.caretRangeFromPoint) {
- rng = doc.caretRangeFromPoint(clientX, clientY);
- } else if (doc.body.createTextRange) {
- rng = doc.body.createTextRange();
-
- try {
- rng.moveToPoint(clientX, clientY);
- rng.collapse(true);
- } catch (ex) {
- rng = findClosestIeRange(clientX, clientY, doc);
- }
-
- return moveOutOfContentEditableFalse(rng, doc.body);
- }
-
- return rng;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $elm[0] && $elm[0].style ? $elm[0].style[name] : undefined;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- RangeUtils.getSelectedNode = function (range) {
- var startContainer = range.startContainer,
- startOffset = range.startOffset;
-
- if (startContainer.hasChildNodes() && range.endOffset == startOffset + 1) {
- return startContainer.childNodes[startOffset];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getSize = function (elm) {
+ var w, h;
+ elm = get(elm);
+ w = getStyle(elm, 'width');
+ h = getStyle(elm, 'height');
+ if (w.indexOf('px') === -1) {
+ w = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
- };
-
- RangeUtils.getNode = function (container, offset) {
- if (container.nodeType === 1 && container.hasChildNodes()) {
- if (offset >= container.childNodes.length) {
- offset = container.childNodes.length - 1;
- }
-
- container = container.childNodes[offset];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (h.indexOf('px') === -1) {
+ h = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return container;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return {
+ w: parseInt(w, 10) || elm.offsetWidth || elm.clientWidth,
+ h: parseInt(h, 10) || elm.offsetHeight || elm.clientHeight
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return RangeUtils;
- }
-);
-
-/**
- * CaretCandidate.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module contains logic for handling caret candidates. A caret candidate is
- * for example text nodes, images, input elements, cE=false elements etc.
- *
- * @private
- * @class tinymce.caret.CaretCandidate
- */
-define(
- 'tinymce.core.caret.CaretCandidate',
- [
- "tinymce.core.dom.NodeType",
- "tinymce.core.util.Arr",
- "tinymce.core.caret.CaretContainer"
- ],
- function (NodeType, Arr, CaretContainer) {
- var isContentEditableTrue = NodeType.isContentEditableTrue,
- isContentEditableFalse = NodeType.isContentEditableFalse,
- isBr = NodeType.isBr,
- isText = NodeType.isText,
- isInvalidTextElement = NodeType.matchNodeNames('script style textarea'),
- isAtomicInline = NodeType.matchNodeNames('img input textarea hr iframe video audio object'),
- isTable = NodeType.matchNodeNames('table'),
- isCaretContainer = CaretContainer.isCaretContainer;
-
- function isCaretCandidate(node) {
- if (isCaretContainer(node)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getRect = function (elm) {
+ var pos, size;
+ elm = get(elm);
+ pos = getPos(elm);
+ size = getSize(elm);
+ return {
+ x: pos.x,
+ y: pos.y,
+ w: size.w,
+ h: size.h
+ };
+ };
+ var is = function (elm, selector) {
+ var i;
+ if (!elm) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isText(node)) {
- if (isInvalidTextElement(node.parentNode)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!Array.isArray(elm)) {
+ if (selector === '*') {
+ return elm.nodeType === 1;
+ }
+ if (simpleSelectorRe.test(selector)) {
+ var selectors = selector.toLowerCase().split(/,/);
+ var elmName = elm.nodeName.toLowerCase();
+ for (i = selectors.length - 1; i >= 0; i--) {
+ if (selectors[i] === elmName) {
+ return true;
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return true;
- }
-
- return isAtomicInline(node) || isBr(node) || isTable(node) || isContentEditableFalse(node);
- }
-
- function isInEditable(node, rootNode) {
- for (node = node.parentNode; node && node != rootNode; node = node.parentNode) {
- if (isContentEditableFalse(node)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (elm.nodeType && elm.nodeType !== 1) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isContentEditableTrue(node)) {
- return true;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return true;
- }
-
- function isAtomicContentEditableFalse(node) {
- if (!isContentEditableFalse(node)) {
- return false;
- }
-
- return Arr.reduce(node.getElementsByTagName('*'), function (result, elm) {
- return result || isContentEditableTrue(elm);
- }, false) !== true;
- }
-
- function isAtomic(node) {
- return isAtomicInline(node) || isAtomicContentEditableFalse(node);
- }
-
- function isEditableCaretCandidate(node, rootNode) {
- return isCaretCandidate(node) && isInEditable(node, rootNode);
- }
-
- return {
- isCaretCandidate: isCaretCandidate,
- isInEditable: isInEditable,
- isAtomic: isAtomic,
- isEditableCaretCandidate: isEditableCaretCandidate
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var elms = !Array.isArray(elm) ? [elm] : elm;
+ return Sizzle(selector, elms[0].ownerDocument || elms[0], null, elms).length > 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * ClientRect.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Utility functions for working with client rects.
- *
- * @private
- * @class tinymce.geom.ClientRect
- */
-define(
- 'tinymce.core.geom.ClientRect',
- [
- ],
- function () {
- var round = Math.round;
-
- function clone(rect) {
- if (!rect) {
- return { left: 0, top: 0, bottom: 0, right: 0, width: 0, height: 0 };
- }
-
- return {
- left: round(rect.left),
- top: round(rect.top),
- bottom: round(rect.bottom),
- right: round(rect.right),
- width: round(rect.width),
- height: round(rect.height)
- };
- }
-
- function collapse(clientRect, toStart) {
- clientRect = clone(clientRect);
-
- if (toStart) {
- clientRect.right = clientRect.left;
- } else {
- clientRect.left = clientRect.left + clientRect.width;
- clientRect.right = clientRect.left;
- }
-
- clientRect.width = 0;
-
- return clientRect;
- }
-
- function isEqual(rect1, rect2) {
- return (
- rect1.left === rect2.left &&
- rect1.top === rect2.top &&
- rect1.bottom === rect2.bottom &&
- rect1.right === rect2.right
- );
- }
-
- function isValidOverflow(overflowY, clientRect1, clientRect2) {
- return overflowY >= 0 && overflowY <= Math.min(clientRect1.height, clientRect2.height) / 2;
-
- }
-
- function isAbove(clientRect1, clientRect2) {
- if ((clientRect1.bottom - clientRect1.height / 2) < clientRect2.top) {
- return true;
- }
-
- if (clientRect1.top > clientRect2.bottom) {
- return false;
- }
-
- return isValidOverflow(clientRect2.top - clientRect1.bottom, clientRect1, clientRect2);
- }
-
- function isBelow(clientRect1, clientRect2) {
- if (clientRect1.top > clientRect2.bottom) {
- return true;
- }
-
- if (clientRect1.bottom < clientRect2.top) {
- return false;
- }
-
- return isValidOverflow(clientRect2.bottom - clientRect1.top, clientRect1, clientRect2);
- }
-
- function isLeft(clientRect1, clientRect2) {
- return clientRect1.left < clientRect2.left;
- }
-
- function isRight(clientRect1, clientRect2) {
- return clientRect1.right > clientRect2.right;
- }
-
- function compare(clientRect1, clientRect2) {
- if (isAbove(clientRect1, clientRect2)) {
- return -1;
- }
-
- if (isBelow(clientRect1, clientRect2)) {
- return 1;
- }
-
- if (isLeft(clientRect1, clientRect2)) {
- return -1;
- }
-
- if (isRight(clientRect1, clientRect2)) {
- return 1;
- }
-
- return 0;
- }
-
- function containsXY(clientRect, clientX, clientY) {
- return (
- clientX >= clientRect.left &&
- clientX <= clientRect.right &&
- clientY >= clientRect.top &&
- clientY <= clientRect.bottom
- );
- }
-
- return {
- clone: clone,
- collapse: collapse,
- isEqual: isEqual,
- isAbove: isAbove,
- isBelow: isBelow,
- isLeft: isLeft,
- isRight: isRight,
- compare: compare,
- containsXY: containsXY
- };
- }
-);
-
-/**
- * ExtendingChar.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class contains logic for detecting extending characters.
- *
- * @private
- * @class tinymce.text.ExtendingChar
- * @example
- * var isExtending = ExtendingChar.isExtendingChar('a');
- */
-define(
- 'tinymce.core.text.ExtendingChar',
- [
- ],
- function () {
- // Generated from: http://www.unicode.org/Public/UNIDATA/DerivedCoreProperties.txt
- // Only includes the characters in that fit into UCS-2 16 bit
- var extendingChars = new RegExp(
- "[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A" +
- "\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0" +
- "\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E3-\u0902\u093A\u093C" +
- "\u0941-\u0948\u094D\u0951-\u0957\u0962-\u0963\u0981\u09BC\u09BE\u09C1-\u09C4\u09CD\u09D7\u09E2-\u09E3" +
- "\u0A01-\u0A02\u0A3C\u0A41-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A51\u0A70-\u0A71\u0A75\u0A81-\u0A82\u0ABC" +
- "\u0AC1-\u0AC5\u0AC7-\u0AC8\u0ACD\u0AE2-\u0AE3\u0B01\u0B3C\u0B3E\u0B3F\u0B41-\u0B44\u0B4D\u0B56\u0B57" +
- "\u0B62-\u0B63\u0B82\u0BBE\u0BC0\u0BCD\u0BD7\u0C00\u0C3E-\u0C40\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56" +
- "\u0C62-\u0C63\u0C81\u0CBC\u0CBF\u0CC2\u0CC6\u0CCC-\u0CCD\u0CD5-\u0CD6\u0CE2-\u0CE3\u0D01\u0D3E\u0D41-\u0D44" +
- "\u0D4D\u0D57\u0D62-\u0D63\u0DCA\u0DCF\u0DD2-\u0DD4\u0DD6\u0DDF\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9" +
- "\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F71-\u0F7E\u0F80-\u0F84\u0F86-\u0F87\u0F8D-\u0F97" +
- "\u0F99-\u0FBC\u0FC6\u102D-\u1030\u1032-\u1037\u1039-\u103A\u103D-\u103E\u1058-\u1059\u105E-\u1060\u1071-\u1074" +
- "\u1082\u1085-\u1086\u108D\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17B4-\u17B5" +
- "\u17B7-\u17BD\u17C6\u17C9-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193B\u1A17-\u1A18" +
- "\u1A1B\u1A56\u1A58-\u1A5E\u1A60\u1A62\u1A65-\u1A6C\u1A73-\u1A7C\u1A7F\u1AB0-\u1ABD\u1ABE\u1B00-\u1B03\u1B34" +
- "\u1B36-\u1B3A\u1B3C\u1B42\u1B6B-\u1B73\u1B80-\u1B81\u1BA2-\u1BA5\u1BA8-\u1BA9\u1BAB-\u1BAD\u1BE6\u1BE8-\u1BE9" +
- "\u1BED\u1BEF-\u1BF1\u1C2C-\u1C33\u1C36-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE0\u1CE2-\u1CE8\u1CED\u1CF4\u1CF8-\u1CF9" +
- "\u1DC0-\u1DF5\u1DFC-\u1DFF\u200C-\u200D\u20D0-\u20DC\u20DD-\u20E0\u20E1\u20E2-\u20E4\u20E5-\u20F0\u2CEF-\u2CF1" +
- "\u2D7F\u2DE0-\u2DFF\u302A-\u302D\u302E-\u302F\u3099-\u309A\uA66F\uA670-\uA672\uA674-\uA67D\uA69E-\uA69F\uA6F0-\uA6F1" +
- "\uA802\uA806\uA80B\uA825-\uA826\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA951\uA980-\uA982\uA9B3\uA9B6-\uA9B9\uA9BC" +
- "\uA9E5\uAA29-\uAA2E\uAA31-\uAA32\uAA35-\uAA36\uAA43\uAA4C\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7-\uAAB8\uAABE-\uAABF\uAAC1" +
- "\uAAEC-\uAAED\uAAF6\uABE5\uABE8\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E-\uFF9F]"
- );
-
- function isExtendingChar(ch) {
- return typeof ch == "string" && ch.charCodeAt(0) >= 768 && extendingChars.test(ch);
- }
-
- return {
- isExtendingChar: isExtendingChar
- };
- }
-);
-/**
- * CaretPosition.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module contains logic for creating caret positions within a document a caretposition
- * is similar to a DOMRange object but it doesn't have two endpoints and is also more lightweight
- * since it's now updated live when the DOM changes.
- *
- * @private
- * @class tinymce.caret.CaretPosition
- * @example
- * var caretPos1 = new CaretPosition(container, offset);
- * var caretPos2 = CaretPosition.fromRangeStart(someRange);
- */
-define(
- 'tinymce.core.caret.CaretPosition',
- [
- "tinymce.core.util.Fun",
- "tinymce.core.dom.NodeType",
- "tinymce.core.dom.DOMUtils",
- "tinymce.core.dom.RangeUtils",
- "tinymce.core.caret.CaretCandidate",
- "tinymce.core.geom.ClientRect",
- "tinymce.core.text.ExtendingChar"
- ],
- function (Fun, NodeType, DOMUtils, RangeUtils, CaretCandidate, ClientRect, ExtendingChar) {
- var isElement = NodeType.isElement,
- isCaretCandidate = CaretCandidate.isCaretCandidate,
- isBlock = NodeType.matchStyleValues('display', 'block table'),
- isFloated = NodeType.matchStyleValues('float', 'left right'),
- isValidElementCaretCandidate = Fun.and(isElement, isCaretCandidate, Fun.negate(isFloated)),
- isNotPre = Fun.negate(NodeType.matchStyleValues('white-space', 'pre pre-line pre-wrap')),
- isText = NodeType.isText,
- isBr = NodeType.isBr,
- nodeIndex = DOMUtils.nodeIndex,
- resolveIndex = RangeUtils.getNode;
-
- function createRange(doc) {
- return "createRange" in doc ? doc.createRange() : DOMUtils.DOM.createRng();
- }
-
- function isWhiteSpace(chr) {
- return chr && /[\r\n\t ]/.test(chr);
- }
-
- function isHiddenWhiteSpaceRange(range) {
- var container = range.startContainer,
- offset = range.startOffset,
- text;
-
- if (isWhiteSpace(range.toString()) && isNotPre(container.parentNode)) {
- text = container.data;
-
- if (isWhiteSpace(text[offset - 1]) || isWhiteSpace(text[offset + 1])) {
- return true;
- }
- }
-
- return false;
- }
-
- function getCaretPositionClientRects(caretPosition) {
- var clientRects = [], beforeNode, node;
-
- // Hack for older WebKit versions that doesn't
- // support getBoundingClientRect on BR elements
- function getBrClientRect(brNode) {
- var doc = brNode.ownerDocument,
- rng = createRange(doc),
- nbsp = doc.createTextNode('\u00a0'),
- parentNode = brNode.parentNode,
- clientRect;
-
- parentNode.insertBefore(nbsp, brNode);
- rng.setStart(nbsp, 0);
- rng.setEnd(nbsp, 1);
- clientRect = ClientRect.clone(rng.getBoundingClientRect());
- parentNode.removeChild(nbsp);
-
- return clientRect;
- }
-
- function getBoundingClientRect(item) {
- var clientRect, clientRects;
-
- clientRects = item.getClientRects();
- if (clientRects.length > 0) {
- clientRect = ClientRect.clone(clientRects[0]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getParents = function (elm, selector, root, collect) {
+ var result = [];
+ var selectorVal;
+ var node = get(elm);
+ collect = collect === undefined;
+ root = root || (getRoot().nodeName !== 'BODY' ? getRoot().parentNode : null);
+ if ($_52qop8kjfuw8l6v.is(selector, 'string')) {
+ selectorVal = selector;
+ if (selector === '*') {
+ selector = function (node) {
+ return node.nodeType === 1;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- clientRect = ClientRect.clone(item.getBoundingClientRect());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ selector = function (node) {
+ return is(node, selectorVal);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isBr(item) && clientRect.left === 0) {
- return getBrClientRect(item);
- }
-
- return clientRect;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function collapseAndInflateWidth(clientRect, toStart) {
- clientRect = ClientRect.collapse(clientRect, toStart);
- clientRect.width = 1;
- clientRect.right = clientRect.left + 1;
-
- return clientRect;
- }
-
- function addUniqueAndValidRect(clientRect) {
- if (clientRect.height === 0) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (node) {
+ if (node === root || !node.nodeType || node.nodeType === 9) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (clientRects.length > 0) {
- if (ClientRect.isEqual(clientRect, clientRects[clientRects.length - 1])) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!selector || typeof selector === 'function' && selector(node)) {
+ if (collect) {
+ result.push(node);
+ } else {
+ return [node];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- clientRects.push(clientRect);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function addCharacterOffset(container, offset) {
- var range = createRange(container.ownerDocument);
-
- if (offset < container.data.length) {
- if (ExtendingChar.isExtendingChar(container.data[offset])) {
- return clientRects;
- }
-
- // WebKit returns two client rects for a position after an extending
- // character a\uxxx|b so expand on "b" and collapse to start of "b" box
- if (ExtendingChar.isExtendingChar(container.data[offset - 1])) {
- range.setStart(container, offset);
- range.setEnd(container, offset + 1);
-
- if (!isHiddenWhiteSpaceRange(range)) {
- addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false));
- return clientRects;
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return collect ? result : null;
+ };
+ var getParent = function (node, selector, root) {
+ var parents = getParents(node, selector, root, false);
+ return parents && parents.length > 0 ? parents[0] : null;
+ };
+ var _findSib = function (node, selector, name) {
+ var func = selector;
+ if (node) {
+ if (typeof selector === 'string') {
+ func = function (node) {
+ return is(node, selector);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (offset > 0) {
- range.setStart(container, offset - 1);
- range.setEnd(container, offset);
-
- if (!isHiddenWhiteSpaceRange(range)) {
- addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (node = node[name]; node; node = node[name]) {
+ if (typeof func === 'function' && func(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (offset < container.data.length) {
- range.setStart(container, offset);
- range.setEnd(container, offset + 1);
-
- if (!isHiddenWhiteSpaceRange(range)) {
- addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), true));
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isText(caretPosition.container())) {
- addCharacterOffset(caretPosition.container(), caretPosition.offset());
- return clientRects;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
+ };
+ var getNext = function (node, selector) {
+ return _findSib(node, selector, 'nextSibling');
+ };
+ var getPrev = function (node, selector) {
+ return _findSib(node, selector, 'previousSibling');
+ };
+ var select = function (selector, scope) {
+ return Sizzle(selector, get(scope) || settings.root_element || doc, []);
+ };
+ var run = function (elm, func, scope) {
+ var result;
+ var node = typeof elm === 'string' ? get(elm) : elm;
+ if (!node) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isElement(caretPosition.container())) {
- if (caretPosition.isAtEnd()) {
- node = resolveIndex(caretPosition.container(), caretPosition.offset());
- if (isText(node)) {
- addCharacterOffset(node, node.data.length);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_52qop8kjfuw8l6v.isArray(node) && (node.length || node.length === 0)) {
+ result = [];
+ each$5(node, function (elm, i) {
+ if (elm) {
+ if (typeof elm === 'string') {
+ elm = get(elm);
+ }
+ result.push(func.call(scope, elm, i));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isValidElementCaretCandidate(node) && !isBr(node)) {
- addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), false));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ return result;
+ }
+ var context = scope ? scope : _this;
+ return func.call(context, node);
+ };
+ var setAttribs = function (elm, attrs) {
+ $$(elm).each(function (i, node) {
+ each$5(attrs, function (value, name) {
+ setAttrib(node, name, value);
+ });
+ });
+ };
+ var setHTML = function (elm, html) {
+ var $elm = $$(elm);
+ if (isIE) {
+ $elm.each(function (i, target) {
+ if (target.canHaveHTML === false) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- node = resolveIndex(caretPosition.container(), caretPosition.offset());
- if (isText(node)) {
- addCharacterOffset(node, 0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (target.firstChild) {
+ target.removeChild(target.firstChild);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isValidElementCaretCandidate(node) && caretPosition.isAtEnd()) {
- addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), false));
- return clientRects;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ try {
+ target.innerHTML = '<br>' + html;
+ target.removeChild(target.firstChild);
+ } catch (ex) {
+ DomQuery('<div></div>').html('<br>' + html).contents().slice(1).appendTo(target);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- beforeNode = resolveIndex(caretPosition.container(), caretPosition.offset() - 1);
- if (isValidElementCaretCandidate(beforeNode) && !isBr(beforeNode)) {
- if (isBlock(beforeNode) || isBlock(node) || !isValidElementCaretCandidate(node)) {
- addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(beforeNode), false));
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return html;
+ });
+ } else {
+ $elm.html(html);
+ }
+ };
+ var add = function (parentElm, name, attrs, html, create) {
+ return run(parentElm, function (parentElm) {
+ var newElm = typeof name === 'string' ? doc.createElement(name) : name;
+ setAttribs(newElm, attrs);
+ if (html) {
+ if (typeof html !== 'string' && html.nodeType) {
+ newElm.appendChild(html);
+ } else if (typeof html === 'string') {
+ setHTML(newElm, html);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isValidElementCaretCandidate(node)) {
- addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), true));
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return clientRects;
- }
-
- /**
- * Represents a location within the document by a container and an offset.
- *
- * @constructor
- * @param {Node} container Container node.
- * @param {Number} offset Offset within that container node.
- * @param {Array} clientRects Optional client rects array for the position.
- */
- function CaretPosition(container, offset, clientRects) {
- function isAtStart() {
- if (isText(container)) {
- return offset === 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return !create ? parentElm.appendChild(newElm) : newElm;
+ });
+ };
+ var create = function (name, attrs, html) {
+ return add(doc.createElement(name), name, attrs, html, true);
+ };
+ var decode = $_8uzsfe1rjfuw8ldm.decode;
+ var encode = $_8uzsfe1rjfuw8ldm.encodeAllRaw;
+ var createHTML = function (name, attrs, html) {
+ var outHtml = '', key;
+ outHtml += '<' + name;
+ for (key in attrs) {
+ if (attrs.hasOwnProperty(key) && attrs[key] !== null && typeof attrs[key] !== 'undefined') {
+ outHtml += ' ' + key + '="' + encode(attrs[key]) + '"';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return offset === 0;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isAtEnd() {
- if (isText(container)) {
- return offset >= container.data.length;
- }
-
- return offset >= container.childNodes.length;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (typeof html !== 'undefined') {
+ return outHtml + '>' + html + '</' + name + '>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function toRange() {
- var range;
-
- range = createRange(container.ownerDocument);
- range.setStart(container, offset);
- range.setEnd(container, offset);
-
- return range;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return outHtml + ' />';
+ };
+ var createFragment = function (html) {
+ var node;
+ var container = doc.createElement('div');
+ var frag = doc.createDocumentFragment();
+ if (html) {
+ container.innerHTML = html;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getClientRects() {
- if (!clientRects) {
- clientRects = getCaretPositionClientRects(new CaretPosition(container, offset));
- }
-
- return clientRects;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (node = container.firstChild) {
+ frag.appendChild(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isVisible() {
- return getClientRects().length > 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return frag;
+ };
+ var remove = function (node, keepChildren) {
+ var $node = $$(node);
+ if (keepChildren) {
+ $node.each(function () {
+ var child;
+ while (child = this.firstChild) {
+ if (child.nodeType === 3 && child.data.length === 0) {
+ this.removeChild(child);
+ } else {
+ this.parentNode.insertBefore(child, this);
+ }
+ }
+ }).remove();
+ } else {
+ $node.remove();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isEqual(caretPosition) {
- return caretPosition && container === caretPosition.container() && offset === caretPosition.offset();
- }
-
- function getNode(before) {
- return resolveIndex(container, before ? offset - 1 : offset);
- }
-
- return {
- /**
- * Returns the container node.
- *
- * @method container
- * @return {Node} Container node.
- */
- container: Fun.constant(container),
-
- /**
- * Returns the offset within the container node.
- *
- * @method offset
- * @return {Number} Offset within the container node.
- */
- offset: Fun.constant(offset),
-
- /**
- * Returns a range out of a the caret position.
- *
- * @method toRange
- * @return {DOMRange} range for the caret position.
- */
- toRange: toRange,
-
- /**
- * Returns the client rects for the caret position. Might be multiple rects between
- * block elements.
- *
- * @method getClientRects
- * @return {Array} Array of client rects.
- */
- getClientRects: getClientRects,
-
- /**
- * Returns true if the caret location is visible/displayed on screen.
- *
- * @method isVisible
- * @return {Boolean} true/false if the position is visible or not.
- */
- isVisible: isVisible,
-
- /**
- * Returns true if the caret location is at the beginning of text node or container.
- *
- * @method isVisible
- * @return {Boolean} true/false if the position is at the beginning.
- */
- isAtStart: isAtStart,
-
- /**
- * Returns true if the caret location is at the end of text node or container.
- *
- * @method isVisible
- * @return {Boolean} true/false if the position is at the end.
- */
- isAtEnd: isAtEnd,
-
- /**
- * Compares the caret position to another caret position. This will only compare the
- * container and offset not it's visual position.
- *
- * @method isEqual
- * @param {tinymce.caret.CaretPosition} caretPosition Caret position to compare with.
- * @return {Boolean} true if the caret positions are equal.
- */
- isEqual: isEqual,
-
- /**
- * Returns the closest resolved node from a node index. That means if you have an offset after the
- * last node in a container it will return that last node.
- *
- * @method getNode
- * @return {Node} Node that is closest to the index.
- */
- getNode: getNode
- };
- }
-
- /**
- * Creates a caret position from the start of a range.
- *
- * @method fromRangeStart
- * @param {DOMRange} range DOM Range to create caret position from.
- * @return {tinymce.caret.CaretPosition} Caret position from the start of DOM range.
- */
- CaretPosition.fromRangeStart = function (range) {
- return new CaretPosition(range.startContainer, range.startOffset);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $node.length > 1 ? $node.toArray() : $node[0];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Creates a caret position from the end of a range.
- *
- * @method fromRangeEnd
- * @param {DOMRange} range DOM Range to create caret position from.
- * @return {tinymce.caret.CaretPosition} Caret position from the end of DOM range.
- */
- CaretPosition.fromRangeEnd = function (range) {
- return new CaretPosition(range.endContainer, range.endOffset);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var removeAllAttribs = function (e) {
+ return run(e, function (e) {
+ var i;
+ var attrs = e.attributes;
+ for (i = attrs.length - 1; i >= 0; i--) {
+ e.removeAttributeNode(attrs.item(i));
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Creates a caret position from a node and places the offset after it.
- *
- * @method after
- * @param {Node} node Node to get caret position from.
- * @return {tinymce.caret.CaretPosition} Caret position from the node.
- */
- CaretPosition.after = function (node) {
- return new CaretPosition(node.parentNode, nodeIndex(node) + 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var parseStyle = function (cssText) {
+ return styles.parse(cssText);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Creates a caret position from a node and places the offset before it.
- *
- * @method before
- * @param {Node} node Node to get caret position from.
- * @return {tinymce.caret.CaretPosition} Caret position from the node.
- */
- CaretPosition.before = function (node) {
- return new CaretPosition(node.parentNode, nodeIndex(node));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var serializeStyle = function (stylesArg, name) {
+ return styles.serialize(stylesArg, name);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- CaretPosition.isAtStart = function (pos) {
- return pos ? pos.isAtStart() : false;
- };
-
- CaretPosition.isAtEnd = function (pos) {
- return pos ? pos.isAtEnd() : false;
- };
-
- CaretPosition.isTextPosition = function (pos) {
- return pos ? NodeType.isText(pos.container()) : false;
- };
-
- return CaretPosition;
- }
-);
-/**
- * CaretBookmark.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module creates or resolves xpath like string representation of a CaretPositions.
- *
- * The format is a / separated list of chunks with:
- * <element|text()>[index|after|before]
- *
- * For example:
- * p[0]/b[0]/text()[0],1 = <p><b>a|c</b></p>
- * p[0]/img[0],before = <p>|<img></p>
- * p[0]/img[0],after = <p><img>|</p>
- *
- * @private
- * @static
- * @class tinymce.caret.CaretBookmark
- * @example
- * var bookmark = CaretBookmark.create(rootElm, CaretPosition.before(rootElm.firstChild));
- * var caretPosition = CaretBookmark.resolve(bookmark);
- */
-define(
- 'tinymce.core.caret.CaretBookmark',
- [
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.util.Fun',
- 'tinymce.core.util.Arr',
- 'tinymce.core.caret.CaretPosition'
- ],
- function (NodeType, DomUtils, Fun, Arr, CaretPosition) {
- var isText = NodeType.isText,
- isBogus = NodeType.isBogus,
- nodeIndex = DomUtils.nodeIndex;
-
- function normalizedParent(node) {
- var parentNode = node.parentNode;
-
- if (isBogus(parentNode)) {
- return normalizedParent(parentNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addStyle = function (cssText) {
+ var head, styleElm;
+ if (self !== DOMUtils.DOM && doc === document) {
+ if (addedStyles[cssText]) {
+ return;
+ }
+ addedStyles[cssText] = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return parentNode;
- }
-
- function getChildNodes(node) {
- if (!node) {
- return [];
- }
-
- return Arr.reduce(node.childNodes, function (result, node) {
- if (isBogus(node) && node.nodeName != 'BR') {
- result = result.concat(getChildNodes(node));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ styleElm = doc.getElementById('mceDefaultStyles');
+ if (!styleElm) {
+ styleElm = doc.createElement('style');
+ styleElm.id = 'mceDefaultStyles';
+ styleElm.type = 'text/css';
+ head = doc.getElementsByTagName('head')[0];
+ if (head.firstChild) {
+ head.insertBefore(styleElm, head.firstChild);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- result.push(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ head.appendChild(styleElm);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return result;
- }, []);
- }
-
- function normalizedTextOffset(textNode, offset) {
- while ((textNode = textNode.previousSibling)) {
- if (!isText(textNode)) {
- break;
- }
-
- offset += textNode.data.length;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return offset;
- }
-
- function equal(targetValue) {
- return function (value) {
- return targetValue === value;
- };
- }
-
- function normalizedNodeIndex(node) {
- var nodes, index, numTextFragments;
-
- nodes = getChildNodes(normalizedParent(node));
- index = Arr.findIndex(nodes, equal(node), node);
- nodes = nodes.slice(0, index + 1);
- numTextFragments = Arr.reduce(nodes, function (result, node, i) {
- if (isText(node) && isText(nodes[i - 1])) {
- result++;
- }
-
- return result;
- }, 0);
-
- nodes = Arr.filter(nodes, NodeType.matchNodeNames(node.nodeName));
- index = Arr.findIndex(nodes, equal(node), node);
-
- return index - numTextFragments;
- }
-
- function createPathItem(node) {
- var name;
-
- if (isText(node)) {
- name = 'text()';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (styleElm.styleSheet) {
+ styleElm.styleSheet.cssText += cssText;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- name = node.nodeName.toLowerCase();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ styleElm.appendChild(doc.createTextNode(cssText));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return name + '[' + normalizedNodeIndex(node) + ']';
- }
-
- function parentsUntil(rootNode, node, predicate) {
- var parents = [];
-
- for (node = node.parentNode; node != rootNode; node = node.parentNode) {
- if (predicate && predicate(node)) {
- break;
- }
-
- parents.push(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var loadCSS = function (url) {
+ var head;
+ if (self !== DOMUtils.DOM && doc === document) {
+ DOMUtils.DOM.loadCSS(url);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return parents;
- }
-
- function create(rootNode, caretPosition) {
- var container, offset, path = [],
- outputOffset, childNodes, parents;
-
- container = caretPosition.container();
- offset = caretPosition.offset();
-
- if (isText(container)) {
- outputOffset = normalizedTextOffset(container, offset);
- } else {
- childNodes = container.childNodes;
- if (offset >= childNodes.length) {
- outputOffset = 'after';
- offset = childNodes.length - 1;
- } else {
- outputOffset = 'before';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!url) {
+ url = '';
+ }
+ head = doc.getElementsByTagName('head')[0];
+ each$5(url.split(','), function (url) {
+ var link;
+ url = $_52qop8kjfuw8l6v._addCacheSuffix(url);
+ if (files[url]) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- container = childNodes[offset];
- }
-
- path.push(createPathItem(container));
- parents = parentsUntil(rootNode, container);
- parents = Arr.filter(parents, Fun.negate(NodeType.isBogus));
- path = path.concat(Arr.map(parents, function (node) {
- return createPathItem(node);
- }));
-
- return path.reverse().join('/') + ',' + outputOffset;
- }
-
- function resolvePathItem(node, name, index) {
- var nodes = getChildNodes(node);
-
- nodes = Arr.filter(nodes, function (node, index) {
- return !isText(node) || !isText(nodes[index - 1]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ files[url] = true;
+ link = create('link', {
+ rel: 'stylesheet',
+ href: url
+ });
+ head.appendChild(link);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- nodes = Arr.filter(nodes, NodeType.matchNodeNames(name));
- return nodes[index];
- }
-
- function findTextPosition(container, offset) {
- var node = container, targetOffset = 0, dataLen;
-
- while (isText(node)) {
- dataLen = node.data.length;
-
- if (offset >= targetOffset && offset <= targetOffset + dataLen) {
- container = node;
- offset = offset - targetOffset;
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var toggleClass = function (elm, cls, state) {
+ $$(elm).toggleClass(cls, state).each(function () {
+ if (this.className === '') {
+ DomQuery(this).attr('class', null);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!isText(node.nextSibling)) {
- container = node;
- offset = dataLen;
- break;
- }
-
- targetOffset += dataLen;
- node = node.nextSibling;
- }
-
- if (offset > container.data.length) {
- offset = container.data.length;
- }
-
- return new CaretPosition(container, offset);
- }
-
- function resolve(rootNode, path) {
- var parts, container, offset;
-
- if (!path) {
- return null;
- }
-
- parts = path.split(',');
- path = parts[0].split('/');
- offset = parts.length > 1 ? parts[1] : 'before';
-
- container = Arr.reduce(path, function (result, value) {
- value = /([\w\-\(\)]+)\[([0-9]+)\]/.exec(value);
- if (!value) {
- return null;
- }
-
- if (value[1] === 'text()') {
- value[1] = '#text';
- }
-
- return resolvePathItem(result, value[1], parseInt(value[2], 10));
- }, rootNode);
-
- if (!container) {
- return null;
- }
-
- if (!isText(container)) {
- if (offset === 'after') {
- offset = nodeIndex(container) + 1;
- } else {
- offset = nodeIndex(container);
- }
-
- return new CaretPosition(container.parentNode, offset);
- }
-
- return findTextPosition(container, parseInt(offset, 10));
- }
-
- return {
- /**
- * Create a xpath bookmark location for the specified caret position.
- *
- * @method create
- * @param {Node} rootNode Root node to create bookmark within.
- * @param {tinymce.caret.CaretPosition} caretPosition Caret position within the root node.
- * @return {String} String xpath like location of caret position.
- */
- create: create,
-
- /**
- * Resolves a xpath like bookmark location to the a caret position.
- *
- * @method resolve
- * @param {Node} rootNode Root node to resolve xpath bookmark within.
- * @param {String} bookmark Bookmark string to resolve.
- * @return {tinymce.caret.CaretPosition} Caret position resolved from xpath like bookmark.
- */
- resolve: resolve
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * BookmarkManager.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class handles selection bookmarks.
- *
- * @class tinymce.dom.BookmarkManager
- */
-define(
- 'tinymce.core.dom.BookmarkManager',
- [
- 'tinymce.core.caret.CaretBookmark',
- 'tinymce.core.caret.CaretContainer',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.Env',
- 'tinymce.core.text.Zwsp',
- 'tinymce.core.util.Tools'
- ],
- function (CaretBookmark, CaretContainer, CaretPosition, NodeType, RangeUtils, Env, Zwsp, Tools) {
- var isContentEditableFalse = NodeType.isContentEditableFalse;
-
- var getNormalizedTextOffset = function (container, offset) {
- var node, trimmedOffset;
-
- trimmedOffset = Zwsp.trim(container.data.slice(0, offset)).length;
- for (node = container.previousSibling; node && node.nodeType === 3; node = node.previousSibling) {
- trimmedOffset += Zwsp.trim(node.data).length;
- }
-
- return trimmedOffset;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addClass = function (elm, cls) {
+ $$(elm).addClass(cls);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var trimEmptyTextNode = function (node) {
- if (NodeType.isText(node) && node.data.length === 0) {
- node.parentNode.removeChild(node);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var removeClass = function (elm, cls) {
+ toggleClass(elm, cls, false);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Constructs a new BookmarkManager instance for a specific selection instance.
- *
- * @constructor
- * @method BookmarkManager
- * @param {tinymce.dom.Selection} selection Selection instance to handle bookmarks for.
- */
- function BookmarkManager(selection) {
- var dom = selection.dom;
-
- /**
- * Returns a bookmark location for the current selection. This bookmark object
- * can then be used to restore the selection after some content modification to the document.
- *
- * @method getBookmark
- * @param {Number} type Optional state if the bookmark should be simple or not. Default is complex.
- * @param {Boolean} normalized Optional state that enables you to get a position that it would be after normalization.
- * @return {Object} Bookmark object, use moveToBookmark with this object to restore the selection.
- * @example
- * // Stores a bookmark of the current selection
- * var bm = tinymce.activeEditor.selection.getBookmark();
- *
- * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');
- *
- * // Restore the selection bookmark
- * tinymce.activeEditor.selection.moveToBookmark(bm);
- */
- this.getBookmark = function (type, normalized) {
- var rng, rng2, id, collapsed, name, element, chr = '', styles;
-
- function findIndex(name, element) {
- var count = 0;
-
- Tools.each(dom.select(name), function (node) {
- if (node.getAttribute('data-mce-bogus') === 'all') {
- return;
- }
-
- if (node == element) {
- return false;
- }
-
- count++;
- });
-
- return count;
- }
-
- function normalizeTableCellSelection(rng) {
- function moveEndPoint(start) {
- var container, offset, childNodes, prefix = start ? 'start' : 'end';
-
- container = rng[prefix + 'Container'];
- offset = rng[prefix + 'Offset'];
-
- if (container.nodeType == 1 && container.nodeName == "TR") {
- childNodes = container.childNodes;
- container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)];
- if (container) {
- offset = start ? 0 : container.childNodes.length;
- rng['set' + (start ? 'Start' : 'End')](container, offset);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasClass = function (elm, cls) {
+ return $$(elm).hasClass(cls);
+ };
+ var show = function (elm) {
+ $$(elm).show();
+ };
+ var hide = function (elm) {
+ $$(elm).hide();
+ };
+ var isHidden = function (elm) {
+ return $$(elm).css('display') === 'none';
+ };
+ var uniqueId = function (prefix) {
+ return (!prefix ? 'mce_' : prefix) + counter++;
+ };
+ var getOuterHTML = function (elm) {
+ var node = typeof elm === 'string' ? get(elm) : elm;
+ return $_ey7ka11qjfuw8ldg.isElement(node) ? node.outerHTML : DomQuery('<div></div>').append(DomQuery(node).clone()).html();
+ };
+ var setOuterHTML = function (elm, html) {
+ $$(elm).each(function () {
+ try {
+ if ('outerHTML' in this) {
+ this.outerHTML = html;
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- moveEndPoint(true);
- moveEndPoint();
-
- return rng;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getLocation(rng) {
- var root = dom.getRoot(), bookmark = {};
-
- function getPoint(rng, start) {
- var container = rng[start ? 'startContainer' : 'endContainer'],
- offset = rng[start ? 'startOffset' : 'endOffset'], point = [], childNodes, after = 0;
-
- if (container.nodeType === 3) {
- point.push(normalized ? getNormalizedTextOffset(container, offset) : offset);
- } else {
- childNodes = container.childNodes;
-
- if (offset >= childNodes.length && childNodes.length) {
- after = 1;
- offset = Math.max(0, childNodes.length - 1);
- }
-
- point.push(dom.nodeIndex(childNodes[offset], normalized) + after);
- }
-
- for (; container && container != root; container = container.parentNode) {
- point.push(dom.nodeIndex(container, normalized));
- }
-
- return point;
- }
-
- bookmark.start = getPoint(rng, true);
-
- if (!selection.isCollapsed()) {
- bookmark.end = getPoint(rng);
- }
-
- return bookmark;
- }
-
- function findAdjacentContentEditableFalseElm(rng) {
- function findSibling(node, offset) {
- var sibling;
-
- if (NodeType.isElement(node)) {
- node = RangeUtils.getNode(node, offset);
- if (isContentEditableFalse(node)) {
- return node;
- }
- }
-
- if (CaretContainer.isCaretContainer(node)) {
- if (NodeType.isText(node) && CaretContainer.isCaretContainerBlock(node)) {
- node = node.parentNode;
- }
-
- sibling = node.previousSibling;
- if (isContentEditableFalse(sibling)) {
- return sibling;
- }
-
- sibling = node.nextSibling;
- if (isContentEditableFalse(sibling)) {
- return sibling;
- }
- }
- }
-
- return findSibling(rng.startContainer, rng.startOffset) || findSibling(rng.endContainer, rng.endOffset);
- }
-
- if (type == 2) {
- element = selection.getNode();
- name = element ? element.nodeName : null;
- rng = selection.getRng();
-
- if (isContentEditableFalse(element) || name == 'IMG') {
- return { name: name, index: findIndex(name, element) };
- }
-
- if (selection.tridentSel) {
- return selection.tridentSel.getBookmark(type);
- }
-
- element = findAdjacentContentEditableFalseElm(rng);
- if (element) {
- name = element.tagName;
- return { name: name, index: findIndex(name, element) };
- }
-
- return getLocation(rng);
- }
-
- if (type == 3) {
- rng = selection.getRng();
-
- return {
- start: CaretBookmark.create(dom.getRoot(), CaretPosition.fromRangeStart(rng)),
- end: CaretBookmark.create(dom.getRoot(), CaretPosition.fromRangeEnd(rng))
- };
- }
-
- // Handle simple range
- if (type) {
- return { rng: selection.getRng() };
- }
-
- rng = selection.getRng();
- id = dom.uniqueId();
- collapsed = selection.isCollapsed();
- styles = 'overflow:hidden;line-height:0px';
-
- // Explorer method
- if (rng.duplicate || rng.item) {
- // Text selection
- if (!rng.item) {
- rng2 = rng.duplicate();
-
- try {
- // Insert start marker
- rng.collapse();
- rng.pasteHTML('<span data-mce-type="bookmark" id="' + id + '_start" style="' + styles + '">' + chr + '</span>');
-
- // Insert end marker
- if (!collapsed) {
- rng2.collapse(false);
-
- // Detect the empty space after block elements in IE and move the
- // end back one character <p></p>] becomes <p>]</p>
- rng.moveToElementText(rng2.parentElement());
- if (rng.compareEndPoints('StartToEnd', rng2) === 0) {
- rng2.move('character', -1);
- }
-
- rng2.pasteHTML('<span data-mce-type="bookmark" id="' + id + '_end" style="' + styles + '">' + chr + '</span>');
- }
- } catch (ex) {
- // IE might throw unspecified error so lets ignore it
- return null;
- }
- } else {
- // Control selection
- element = rng.item(0);
- name = element.nodeName;
-
- return { name: name, index: findIndex(name, element) };
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ remove(DomQuery(this).html(html), true);
+ });
+ };
+ var insertAfter = function (node, reference) {
+ var referenceNode = get(reference);
+ return run(node, function (node) {
+ var parent, nextSibling;
+ parent = referenceNode.parentNode;
+ nextSibling = referenceNode.nextSibling;
+ if (nextSibling) {
+ parent.insertBefore(node, nextSibling);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- element = selection.getNode();
- name = element.nodeName;
- if (name == 'IMG') {
- return { name: name, index: findIndex(name, element) };
- }
-
- // W3C method
- rng2 = normalizeTableCellSelection(rng.cloneRange());
-
- // Insert end marker
- if (!collapsed) {
- rng2.collapse(false);
- var endBookmarkNode = dom.create('span', { 'data-mce-type': "bookmark", id: id + '_end', style: styles }, chr);
- rng2.insertNode(endBookmarkNode);
- trimEmptyTextNode(endBookmarkNode.nextSibling);
- }
-
- rng = normalizeTableCellSelection(rng);
- rng.collapse(true);
- var startBookmarkNode = dom.create('span', { 'data-mce-type': "bookmark", id: id + '_start', style: styles }, chr);
- rng.insertNode(startBookmarkNode);
- trimEmptyTextNode(startBookmarkNode.previousSibling);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent.appendChild(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- selection.moveToBookmark({ id: id, keep: 1 });
-
- return { id: id };
- };
-
- /**
- * Restores the selection to the specified bookmark.
- *
- * @method moveToBookmark
- * @param {Object} bookmark Bookmark to restore selection from.
- * @return {Boolean} true/false if it was successful or not.
- * @example
- * // Stores a bookmark of the current selection
- * var bm = tinymce.activeEditor.selection.getBookmark();
- *
- * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');
- *
- * // Restore the selection bookmark
- * tinymce.activeEditor.selection.moveToBookmark(bm);
- */
- this.moveToBookmark = function (bookmark) {
- var rng, root, startContainer, endContainer, startOffset, endOffset;
-
- function setEndPoint(start) {
- var point = bookmark[start ? 'start' : 'end'], i, node, offset, children;
-
- if (point) {
- offset = point[0];
-
- // Find container node
- for (node = root, i = point.length - 1; i >= 1; i--) {
- children = node.childNodes;
-
- if (point[i] > children.length - 1) {
- return;
- }
-
- node = children[point[i]];
- }
-
- // Move text offset to best suitable location
- if (node.nodeType === 3) {
- offset = Math.min(point[0], node.nodeValue.length);
- }
-
- // Move element offset to best suitable location
- if (node.nodeType === 1) {
- offset = Math.min(point[0], node.childNodes.length);
- }
-
- // Set offset within container node
- if (start) {
- rng.setStart(node, offset);
- } else {
- rng.setEnd(node, offset);
- }
- }
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return node;
+ });
+ };
+ var replace = function (newElm, oldElm, keepChildren) {
+ return run(oldElm, function (oldElm) {
+ if ($_52qop8kjfuw8l6v.is(oldElm, 'array')) {
+ newElm = newElm.cloneNode(true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function restoreEndPoint(suffix) {
- var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep;
-
- if (marker) {
- node = marker.parentNode;
-
- if (suffix == 'start') {
- if (!keep) {
- idx = dom.nodeIndex(marker);
- } else {
- node = marker.firstChild;
- idx = 1;
- }
-
- startContainer = endContainer = node;
- startOffset = endOffset = idx;
- } else {
- if (!keep) {
- idx = dom.nodeIndex(marker);
- } else {
- node = marker.firstChild;
- idx = 1;
- }
-
- endContainer = node;
- endOffset = idx;
- }
-
- if (!keep) {
- prev = marker.previousSibling;
- next = marker.nextSibling;
-
- // Remove all marker text nodes
- Tools.each(Tools.grep(marker.childNodes), function (node) {
- if (node.nodeType == 3) {
- node.nodeValue = node.nodeValue.replace(/\uFEFF/g, '');
- }
- });
-
- // Remove marker but keep children if for example contents where inserted into the marker
- // Also remove duplicated instances of the marker for example by a
- // split operation or by WebKit auto split on paste feature
- while ((marker = dom.get(bookmark.id + '_' + suffix))) {
- dom.remove(marker, 1);
- }
-
- // If siblings are text nodes then merge them unless it's Opera since it some how removes the node
- // and we are sniffing since adding a lot of detection code for a browser with 3% of the market
- // isn't worth the effort. Sorry, Opera but it's just a fact
- if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3 && !Env.opera) {
- idx = prev.nodeValue.length;
- prev.appendData(next.nodeValue);
- dom.remove(next);
-
- if (suffix == 'start') {
- startContainer = endContainer = prev;
- startOffset = endOffset = idx;
- } else {
- endContainer = prev;
- endOffset = idx;
- }
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (keepChildren) {
+ each$5(grep$1(oldElm.childNodes), function (node) {
+ newElm.appendChild(node);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function addBogus(node) {
- // Adds a bogus BR element for empty block elements
- if (dom.isBlock(node) && !node.innerHTML && !Env.ie) {
- node.innerHTML = '<br data-mce-bogus="1" />';
- }
-
- return node;
- }
-
- function resolveCaretPositionBookmark() {
- var rng, pos;
-
- rng = dom.createRng();
- pos = CaretBookmark.resolve(dom.getRoot(), bookmark.start);
- rng.setStart(pos.container(), pos.offset());
-
- pos = CaretBookmark.resolve(dom.getRoot(), bookmark.end);
- rng.setEnd(pos.container(), pos.offset());
-
- return rng;
- }
-
- if (bookmark) {
- if (Tools.isArray(bookmark.start)) {
- rng = dom.createRng();
- root = dom.getRoot();
-
- if (selection.tridentSel) {
- return selection.tridentSel.moveToBookmark(bookmark);
- }
-
- if (setEndPoint(true) && setEndPoint()) {
- selection.setRng(rng);
- }
- } else if (typeof bookmark.start == 'string') {
- selection.setRng(resolveCaretPositionBookmark(bookmark));
- } else if (bookmark.id) {
- // Restore start/end points
- restoreEndPoint('start');
- restoreEndPoint('end');
-
- if (startContainer) {
- rng = dom.createRng();
- rng.setStart(addBogus(startContainer), startOffset);
- rng.setEnd(addBogus(endContainer), endOffset);
- selection.setRng(rng);
- }
- } else if (bookmark.name) {
- selection.select(dom.select(bookmark.name)[bookmark.index]);
- } else if (bookmark.rng) {
- selection.setRng(bookmark.rng);
- }
- }
- };
- }
-
- /**
- * Returns true/false if the specified node is a bookmark node or not.
- *
- * @static
- * @method isBookmarkNode
- * @param {DOMNode} node DOM Node to check if it's a bookmark node or not.
- * @return {Boolean} true/false if the node is a bookmark node or not.
- */
- BookmarkManager.isBookmarkNode = function (node) {
- return node && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return oldElm.parentNode.replaceChild(newElm, oldElm);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return BookmarkManager;
- }
-);
-/**
- * CaretUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Utility functions shared by the caret logic.
- *
- * @private
- * @class tinymce.caret.CaretUtils
- */
-define(
- 'tinymce.core.caret.CaretUtils',
- [
- "tinymce.core.util.Fun",
- "tinymce.core.dom.TreeWalker",
- "tinymce.core.dom.NodeType",
- "tinymce.core.caret.CaretPosition",
- "tinymce.core.caret.CaretContainer",
- "tinymce.core.caret.CaretCandidate"
- ],
- function (Fun, TreeWalker, NodeType, CaretPosition, CaretContainer, CaretCandidate) {
- var isContentEditableTrue = NodeType.isContentEditableTrue,
- isContentEditableFalse = NodeType.isContentEditableFalse,
- isBlockLike = NodeType.matchStyleValues('display', 'block table table-cell table-caption list-item'),
- isCaretContainer = CaretContainer.isCaretContainer,
- isCaretContainerBlock = CaretContainer.isCaretContainerBlock,
- curry = Fun.curry,
- isElement = NodeType.isElement,
- isCaretCandidate = CaretCandidate.isCaretCandidate;
-
- function isForwards(direction) {
- return direction > 0;
- }
-
- function isBackwards(direction) {
- return direction < 0;
- }
-
- function skipCaretContainers(walk, shallow) {
- var node;
-
- while ((node = walk(shallow))) {
- if (!isCaretContainerBlock(node)) {
- return node;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var rename = function (elm, name) {
+ var newElm;
+ if (elm.nodeName !== name.toUpperCase()) {
+ newElm = create(name);
+ each$5(getAttribs(elm), function (attrNode) {
+ setAttrib(newElm, attrNode.nodeName, getAttrib(elm, attrNode.nodeName));
+ });
+ replace(newElm, elm, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
- }
-
- function findNode(node, direction, predicateFn, rootNode, shallow) {
- var walker = new TreeWalker(node, rootNode);
-
- if (isBackwards(direction)) {
- if (isContentEditableFalse(node) || isCaretContainerBlock(node)) {
- node = skipCaretContainers(walker.prev, true);
- if (predicateFn(node)) {
- return node;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return newElm || elm;
+ };
+ var findCommonAncestor = function (a, b) {
+ var ps = a, pe;
+ while (ps) {
+ pe = b;
+ while (pe && ps !== pe) {
+ pe = pe.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- while ((node = skipCaretContainers(walker.prev, shallow))) {
- if (predicateFn(node)) {
- return node;
- }
- }
- }
-
- if (isForwards(direction)) {
- if (isContentEditableFalse(node) || isCaretContainerBlock(node)) {
- node = skipCaretContainers(walker.next, true);
- if (predicateFn(node)) {
- return node;
- }
- }
-
- while ((node = skipCaretContainers(walker.next, shallow))) {
- if (predicateFn(node)) {
- return node;
- }
- }
- }
-
- return null;
- }
-
- function getEditingHost(node, rootNode) {
- for (node = node.parentNode; node && node != rootNode; node = node.parentNode) {
- if (isContentEditableTrue(node)) {
- return node;
- }
- }
-
- return rootNode;
- }
-
- function getParentBlock(node, rootNode) {
- while (node && node != rootNode) {
- if (isBlockLike(node)) {
- return node;
- }
-
- node = node.parentNode;
- }
-
- return null;
- }
-
- function isInSameBlock(caretPosition1, caretPosition2, rootNode) {
- return getParentBlock(caretPosition1.container(), rootNode) == getParentBlock(caretPosition2.container(), rootNode);
- }
-
- function isInSameEditingHost(caretPosition1, caretPosition2, rootNode) {
- return getEditingHost(caretPosition1.container(), rootNode) == getEditingHost(caretPosition2.container(), rootNode);
- }
-
- function getChildNodeAtRelativeOffset(relativeOffset, caretPosition) {
- var container, offset;
-
- if (!caretPosition) {
- return null;
- }
-
- container = caretPosition.container();
- offset = caretPosition.offset();
-
- if (!isElement(container)) {
- return null;
- }
-
- return container.childNodes[offset + relativeOffset];
- }
-
- function beforeAfter(before, node) {
- var range = node.ownerDocument.createRange();
-
- if (before) {
- range.setStartBefore(node);
- range.setEndBefore(node);
- } else {
- range.setStartAfter(node);
- range.setEndAfter(node);
- }
-
- return range;
- }
-
- function isNodesInSameBlock(rootNode, node1, node2) {
- return getParentBlock(node1, rootNode) == getParentBlock(node2, rootNode);
- }
-
- function lean(left, rootNode, node) {
- var sibling, siblingName;
-
- if (left) {
- siblingName = 'previousSibling';
- } else {
- siblingName = 'nextSibling';
- }
-
- while (node && node != rootNode) {
- sibling = node[siblingName];
-
- if (isCaretContainer(sibling)) {
- sibling = sibling[siblingName];
- }
-
- if (isContentEditableFalse(sibling)) {
- if (isNodesInSameBlock(rootNode, sibling, node)) {
- return sibling;
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (ps === pe) {
</ins><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isCaretCandidate(sibling)) {
- break;
- }
-
- node = node.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ps = ps.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
- }
-
- var before = curry(beforeAfter, true);
- var after = curry(beforeAfter, false);
-
- function normalizeRange(direction, rootNode, range) {
- var node, container, offset, location;
- var leanLeft = curry(lean, true, rootNode);
- var leanRight = curry(lean, false, rootNode);
-
- container = range.startContainer;
- offset = range.startOffset;
-
- if (CaretContainer.isCaretContainerBlock(container)) {
- if (!isElement(container)) {
- container = container.parentNode;
- }
-
- location = container.getAttribute('data-mce-caret');
-
- if (location == 'before') {
- node = container.nextSibling;
- if (isContentEditableFalse(node)) {
- return before(node);
- }
- }
-
- if (location == 'after') {
- node = container.previousSibling;
- if (isContentEditableFalse(node)) {
- return after(node);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!ps && a.ownerDocument) {
+ return a.ownerDocument.documentElement;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!range.collapsed) {
- return range;
- }
-
- if (NodeType.isText(container)) {
- if (isCaretContainer(container)) {
- if (direction === 1) {
- node = leanRight(container);
- if (node) {
- return before(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return ps;
+ };
+ var toHex = function (rgbVal) {
+ return styles.toHex($_52qop8kjfuw8l6v.trim(rgbVal));
+ };
+ var isEmpty = function (node, elements) {
+ var i, attributes, type, whitespace, walker, name, brCount = 0;
+ node = node.firstChild;
+ if (node) {
+ walker = new TreeWalker(node, node.parentNode);
+ elements = elements || (schema ? schema.getNonEmptyElements() : null);
+ whitespace = schema ? schema.getWhiteSpaceElements() : {};
+ do {
+ type = node.nodeType;
+ if ($_ey7ka11qjfuw8ldg.isElement(node)) {
+ var bogusVal = node.getAttribute('data-mce-bogus');
+ if (bogusVal) {
+ node = walker.next(bogusVal === 'all');
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node = leanLeft(container);
- if (node) {
- return after(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ name = node.nodeName.toLowerCase();
+ if (elements && elements[name]) {
+ if (name === 'br') {
+ brCount++;
+ node = walker.next();
+ continue;
+ }
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- if (direction === -1) {
- node = leanLeft(container);
- if (node) {
- return after(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ attributes = getAttribs(node);
+ i = attributes.length;
+ while (i--) {
+ name = attributes[i].nodeName;
+ if (name === 'name' || name === 'data-mce-bookmark') {
+ return false;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node = leanRight(container);
- if (node) {
- return before(node);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return range;
- }
-
- if (CaretContainer.endsWithCaretContainer(container) && offset >= container.data.length - 1) {
- if (direction === 1) {
- node = leanRight(container);
- if (node) {
- return before(node);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (type === 8) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return range;
- }
-
- if (CaretContainer.startsWithCaretContainer(container) && offset <= 1) {
- if (direction === -1) {
- node = leanLeft(container);
- if (node) {
- return after(node);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (type === 3 && !whiteSpaceRegExp$2.test(node.nodeValue)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return range;
- }
-
- if (offset === container.data.length) {
- node = leanRight(container);
- if (node) {
- return before(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (type === 3 && node.parentNode && whitespace[node.parentNode.nodeName] && whiteSpaceRegExp$2.test(node.nodeValue)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return range;
- }
-
- if (offset === 0) {
- node = leanLeft(container);
- if (node) {
- return after(node);
- }
-
- return range;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = walker.next();
+ } while (node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return range;
- }
-
- function isNextToContentEditableFalse(relativeOffset, caretPosition) {
- return isContentEditableFalse(getChildNodeAtRelativeOffset(relativeOffset, caretPosition));
- }
-
- return {
- isForwards: isForwards,
- isBackwards: isBackwards,
- findNode: findNode,
- getEditingHost: getEditingHost,
- getParentBlock: getParentBlock,
- isInSameBlock: isInSameBlock,
- isInSameEditingHost: isInSameEditingHost,
- isBeforeContentEditableFalse: curry(isNextToContentEditableFalse, 0),
- isAfterContentEditableFalse: curry(isNextToContentEditableFalse, -1),
- normalizeRange: normalizeRange
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return brCount <= 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * CaretWalker.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module contains logic for moving around a virtual caret in logical order within a DOM element.
- *
- * It ignores the most obvious invalid caret locations such as within a script element or within a
- * contentEditable=false element but it will return locations that isn't possible to render visually.
- *
- * @private
- * @class tinymce.caret.CaretWalker
- * @example
- * var caretWalker = new CaretWalker(rootElm);
- *
- * var prevLogicalCaretPosition = caretWalker.prev(CaretPosition.fromRangeStart(range));
- * var nextLogicalCaretPosition = caretWalker.next(CaretPosition.fromRangeEnd(range));
- */
-define(
- 'tinymce.core.caret.CaretWalker',
- [
- "tinymce.core.dom.NodeType",
- "tinymce.core.caret.CaretCandidate",
- "tinymce.core.caret.CaretPosition",
- "tinymce.core.caret.CaretUtils",
- "tinymce.core.util.Arr",
- "tinymce.core.util.Fun"
- ],
- function (NodeType, CaretCandidate, CaretPosition, CaretUtils, Arr, Fun) {
- var isContentEditableFalse = NodeType.isContentEditableFalse,
- isText = NodeType.isText,
- isElement = NodeType.isElement,
- isBr = NodeType.isBr,
- isForwards = CaretUtils.isForwards,
- isBackwards = CaretUtils.isBackwards,
- isCaretCandidate = CaretCandidate.isCaretCandidate,
- isAtomic = CaretCandidate.isAtomic,
- isEditableCaretCandidate = CaretCandidate.isEditableCaretCandidate;
-
- function getParents(node, rootNode) {
- var parents = [];
-
- while (node && node != rootNode) {
- parents.push(node);
- node = node.parentNode;
- }
-
- return parents;
- }
-
- function nodeAtIndex(container, offset) {
- if (container.hasChildNodes() && offset < container.childNodes.length) {
- return container.childNodes[offset];
- }
-
- return null;
- }
-
- function getCaretCandidatePosition(direction, node) {
- if (isForwards(direction)) {
- if (isCaretCandidate(node.previousSibling) && !isText(node.previousSibling)) {
- return CaretPosition.before(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createRng = function () {
+ return doc.createRange();
+ };
+ var split = function (parentElm, splitElm, replacementElm) {
+ var r = createRng(), bef, aft, pa;
+ if (parentElm && splitElm) {
+ r.setStart(parentElm.parentNode, findNodeIndex(parentElm));
+ r.setEnd(splitElm.parentNode, findNodeIndex(splitElm));
+ bef = r.extractContents();
+ r = createRng();
+ r.setStart(splitElm.parentNode, findNodeIndex(splitElm) + 1);
+ r.setEnd(parentElm.parentNode, findNodeIndex(parentElm) + 1);
+ aft = r.extractContents();
+ pa = parentElm.parentNode;
+ pa.insertBefore($_a6mrv1ojfuw8ld2.trimNode(self, bef), parentElm);
+ if (replacementElm) {
+ pa.insertBefore(replacementElm, parentElm);
+ } else {
+ pa.insertBefore(splitElm, parentElm);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isText(node)) {
- return CaretPosition(node, 0);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ pa.insertBefore($_a6mrv1ojfuw8ld2.trimNode(self, aft), parentElm);
+ remove(parentElm);
+ return replacementElm || splitElm;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isBackwards(direction)) {
- if (isCaretCandidate(node.nextSibling) && !isText(node.nextSibling)) {
- return CaretPosition.after(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var bind = function (target, name, func, scope) {
+ if ($_52qop8kjfuw8l6v.isArray(target)) {
+ var i = target.length;
+ while (i--) {
+ target[i] = bind(target[i], name, func, scope);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isText(node)) {
- return CaretPosition(node, node.data.length);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return target;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isBackwards(direction)) {
- if (isBr(node)) {
- return CaretPosition.before(node);
- }
-
- return CaretPosition.after(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (settings.collect && (target === doc || target === win)) {
+ boundEvents.push([
+ target,
+ name,
+ func,
+ scope
+ ]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return CaretPosition.before(node);
- }
-
- // Jumps over BR elements <p>|<br></p><p>a</p> -> <p><br></p><p>|a</p>
- function isBrBeforeBlock(node, rootNode) {
- var next;
-
- if (!NodeType.isBr(node)) {
- return false;
- }
-
- next = findCaretPosition(1, CaretPosition.after(node), rootNode);
- if (!next) {
- return false;
- }
-
- return !CaretUtils.isInSameBlock(CaretPosition.before(node), CaretPosition.before(next), rootNode);
- }
-
- function findCaretPosition(direction, startCaretPosition, rootNode) {
- var container, offset, node, nextNode, innerNode,
- rootContentEditableFalseElm, caretPosition;
-
- if (!isElement(rootNode) || !startCaretPosition) {
- return null;
- }
-
- if (startCaretPosition.isEqual(CaretPosition.after(rootNode)) && rootNode.lastChild) {
- caretPosition = CaretPosition.after(rootNode.lastChild);
- if (isBackwards(direction) && isCaretCandidate(rootNode.lastChild) && isElement(rootNode.lastChild)) {
- return isBr(rootNode.lastChild) ? CaretPosition.before(rootNode.lastChild) : caretPosition;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return events.bind(target, name, func, scope || self);
+ };
+ var unbind = function (target, name, func) {
+ var i;
+ if ($_52qop8kjfuw8l6v.isArray(target)) {
+ i = target.length;
+ while (i--) {
+ target[i] = unbind(target[i], name, func);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- caretPosition = startCaretPosition;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return target;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- container = caretPosition.container();
- offset = caretPosition.offset();
-
- if (isText(container)) {
- if (isBackwards(direction) && offset > 0) {
- return CaretPosition(container, --offset);
- }
-
- if (isForwards(direction) && offset < container.length) {
- return CaretPosition(container, ++offset);
- }
-
- node = container;
- } else {
- if (isBackwards(direction) && offset > 0) {
- nextNode = nodeAtIndex(container, offset - 1);
- if (isCaretCandidate(nextNode)) {
- if (!isAtomic(nextNode)) {
- innerNode = CaretUtils.findNode(nextNode, direction, isEditableCaretCandidate, nextNode);
- if (innerNode) {
- if (isText(innerNode)) {
- return CaretPosition(innerNode, innerNode.data.length);
- }
-
- return CaretPosition.after(innerNode);
- }
- }
-
- if (isText(nextNode)) {
- return CaretPosition(nextNode, nextNode.data.length);
- }
-
- return CaretPosition.before(nextNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (boundEvents && (target === doc || target === win)) {
+ i = boundEvents.length;
+ while (i--) {
+ var item = boundEvents[i];
+ if (target === item[0] && (!name || name === item[1]) && (!func || func === item[2])) {
+ events.unbind(item[0], item[1], item[2]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isForwards(direction) && offset < container.childNodes.length) {
- nextNode = nodeAtIndex(container, offset);
- if (isCaretCandidate(nextNode)) {
- if (isBrBeforeBlock(nextNode, rootNode)) {
- return findCaretPosition(direction, CaretPosition.after(nextNode), rootNode);
- }
-
- if (!isAtomic(nextNode)) {
- innerNode = CaretUtils.findNode(nextNode, direction, isEditableCaretCandidate, nextNode);
- if (innerNode) {
- if (isText(innerNode)) {
- return CaretPosition(innerNode, 0);
- }
-
- return CaretPosition.before(innerNode);
- }
- }
-
- if (isText(nextNode)) {
- return CaretPosition(nextNode, 0);
- }
-
- return CaretPosition.after(nextNode);
- }
- }
-
- node = caretPosition.getNode();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if ((isForwards(direction) && caretPosition.isAtEnd()) || (isBackwards(direction) && caretPosition.isAtStart())) {
- node = CaretUtils.findNode(node, direction, Fun.constant(true), rootNode, true);
- if (isEditableCaretCandidate(node)) {
- return getCaretCandidatePosition(direction, node);
- }
- }
-
- nextNode = CaretUtils.findNode(node, direction, isEditableCaretCandidate, rootNode);
-
- rootContentEditableFalseElm = Arr.last(Arr.filter(getParents(container, rootNode), isContentEditableFalse));
- if (rootContentEditableFalseElm && (!nextNode || !rootContentEditableFalseElm.contains(nextNode))) {
- if (isForwards(direction)) {
- caretPosition = CaretPosition.after(rootContentEditableFalseElm);
- } else {
- caretPosition = CaretPosition.before(rootContentEditableFalseElm);
- }
-
- return caretPosition;
- }
-
- if (nextNode) {
- return getCaretCandidatePosition(direction, nextNode);
- }
-
- return null;
- }
-
- return function (rootNode) {
- return {
- /**
- * Returns the next logical caret position from the specificed input
- * caretPoisiton or null if there isn't any more positions left for example
- * at the end specified root element.
- *
- * @method next
- * @param {tinymce.caret.CaretPosition} caretPosition Caret position to start from.
- * @return {tinymce.caret.CaretPosition} CaretPosition or null if no position was found.
- */
- next: function (caretPosition) {
- return findCaretPosition(1, caretPosition, rootNode);
- },
-
- /**
- * Returns the previous logical caret position from the specificed input
- * caretPoisiton or null if there isn't any more positions left for example
- * at the end specified root element.
- *
- * @method prev
- * @param {tinymce.caret.CaretPosition} caretPosition Caret position to start from.
- * @return {tinymce.caret.CaretPosition} CaretPosition or null if no position was found.
- */
- prev: function (caretPosition) {
- return findCaretPosition(-1, caretPosition, rootNode);
- }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return events.unbind(target, name, func);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * CaretFinder.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.caret.CaretFinder',
- [
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'tinymce.core.caret.CaretCandidate',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.caret.CaretUtils',
- 'tinymce.core.caret.CaretWalker',
- 'tinymce.core.dom.NodeType'
- ],
- function (Fun, Option, CaretCandidate, CaretPosition, CaretUtils, CaretWalker, NodeType) {
- var walkToPositionIn = function (forward, rootNode, startNode) {
- var position = forward ? CaretPosition.before(startNode) : CaretPosition.after(startNode);
- return fromPosition(forward, rootNode, position);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fire = function (target, name, evt) {
+ return events.fire(target, name, evt);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var afterElement = function (node) {
- return NodeType.isBr(node) ? CaretPosition.before(node) : CaretPosition.after(node);
- };
-
- var isBeforeOrStart = function (position) {
- if (CaretPosition.isTextPosition(position)) {
- return position.offset() === 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getContentEditable = function (node) {
+ if (node && $_ey7ka11qjfuw8ldg.isElement(node)) {
+ var contentEditable = node.getAttribute('data-mce-contenteditable');
+ if (contentEditable && contentEditable !== 'inherit') {
+ return contentEditable;
+ }
+ return node.contentEditable !== 'inherit' ? node.contentEditable : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return CaretCandidate.isCaretCandidate(position.getNode());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isAfterOrEnd = function (position) {
- if (CaretPosition.isTextPosition(position)) {
- return position.offset() === position.container().data.length;
- } else {
- return CaretCandidate.isCaretCandidate(position.getNode(true));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getContentEditableParent = function (node) {
+ var root = getRoot();
+ var state = null;
+ for (; node && node !== root; node = node.parentNode) {
+ state = getContentEditable(node);
+ if (state !== null) {
+ break;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return state;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isBeforeAfterSameElement = function (from, to) {
- return !CaretPosition.isTextPosition(from) && !CaretPosition.isTextPosition(to) && from.getNode() === to.getNode(true);
- };
-
- var isAtBr = function (position) {
- return !CaretPosition.isTextPosition(position) && NodeType.isBr(position.getNode());
- };
-
- var shouldSkipPosition = function (forward, from, to) {
- if (forward) {
- return !isBeforeAfterSameElement(from, to) && !isAtBr(from) && isAfterOrEnd(from) && isBeforeOrStart(to);
- } else {
- return !isBeforeAfterSameElement(to, from) && isBeforeOrStart(from) && isAfterOrEnd(to);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var destroy = function () {
+ if (boundEvents) {
+ var i = boundEvents.length;
+ while (i--) {
+ var item = boundEvents[i];
+ events.unbind(item[0], item[1], item[2]);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (Sizzle.setDocument) {
+ Sizzle.setDocument();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Finds: <p>a|<b>b</b></p> -> <p>a<b>|b</b></p>
- var fromPosition = function (forward, rootNode, position) {
- var walker = new CaretWalker(rootNode);
- return Option.from(forward ? walker.next(position) : walker.prev(position));
- };
-
- // Finds: <p>a|<b>b</b></p> -> <p>a<b>b|</b></p>
- var navigate = function (forward, rootNode, from) {
- return fromPosition(forward, rootNode, from).bind(function (to) {
- if (CaretUtils.isInSameBlock(from, to, rootNode) && shouldSkipPosition(forward, from, to)) {
- return fromPosition(forward, rootNode, to);
- } else {
- return Option.some(to);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isChildOf = function (node, parent) {
+ while (node) {
+ if (parent === node) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- };
-
- var positionIn = function (forward, element) {
- var startNode = forward ? element.firstChild : element.lastChild;
- if (NodeType.isText(startNode)) {
- return Option.some(new CaretPosition(startNode, forward ? 0 : startNode.data.length));
- } else if (startNode) {
- if (CaretCandidate.isCaretCandidate(startNode)) {
- return Option.some(forward ? CaretPosition.before(startNode) : afterElement(startNode));
- } else {
- return walkToPositionIn(forward, element, startNode);
- }
- } else {
- return Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- fromPosition: fromPosition,
- nextPosition: Fun.curry(fromPosition, true),
- prevPosition: Fun.curry(fromPosition, false),
- navigate: navigate,
- positionIn: positionIn,
- firstPositionIn: Fun.curry(positionIn, true),
- lastPositionIn: Fun.curry(positionIn, false)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var dumpRng = function (r) {
+ return 'startContainer: ' + r.startContainer.nodeName + ', startOffset: ' + r.startOffset + ', endContainer: ' + r.endContainer.nodeName + ', endOffset: ' + r.endOffset;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * RangeNormalizer.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.RangeNormalizer',
- [
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.caret.CaretUtils'
- ],
- function (CaretFinder, CaretPosition, CaretUtils) {
- var createRange = function (sc, so, ec, eo) {
- var rng = document.createRange();
- rng.setStart(sc, so);
- rng.setEnd(ec, eo);
- return rng;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var self = {
+ doc: doc,
+ settings: settings,
+ win: win,
+ files: files,
+ stdMode: stdMode,
+ boxModel: boxModel,
+ styleSheetLoader: styleSheetLoader,
+ boundEvents: boundEvents,
+ styles: styles,
+ schema: schema,
+ events: events,
+ isBlock: isBlock,
+ $: $,
+ $$: $$,
+ root: null,
+ clone: clone,
+ getRoot: getRoot,
+ getViewPort: getViewPort,
+ getRect: getRect,
+ getSize: getSize,
+ getParent: getParent,
+ getParents: getParents,
+ get: get,
+ getNext: getNext,
+ getPrev: getPrev,
+ select: select,
+ is: is,
+ add: add,
+ create: create,
+ createHTML: createHTML,
+ createFragment: createFragment,
+ remove: remove,
+ setStyle: setStyle,
+ getStyle: getStyle,
+ setStyles: setStyles,
+ removeAllAttribs: removeAllAttribs,
+ setAttrib: setAttrib,
+ setAttribs: setAttribs,
+ getAttrib: getAttrib,
+ getPos: getPos,
+ parseStyle: parseStyle,
+ serializeStyle: serializeStyle,
+ addStyle: addStyle,
+ loadCSS: loadCSS,
+ addClass: addClass,
+ removeClass: removeClass,
+ hasClass: hasClass,
+ toggleClass: toggleClass,
+ show: show,
+ hide: hide,
+ isHidden: isHidden,
+ uniqueId: uniqueId,
+ setHTML: setHTML,
+ getOuterHTML: getOuterHTML,
+ setOuterHTML: setOuterHTML,
+ decode: decode,
+ encode: encode,
+ insertAfter: insertAfter,
+ replace: replace,
+ rename: rename,
+ findCommonAncestor: findCommonAncestor,
+ toHex: toHex,
+ run: run,
+ getAttribs: getAttribs,
+ isEmpty: isEmpty,
+ createRng: createRng,
+ nodeIndex: findNodeIndex,
+ split: split,
+ bind: bind,
+ unbind: unbind,
+ fire: fire,
+ getContentEditable: getContentEditable,
+ getContentEditableParent: getContentEditableParent,
+ destroy: destroy,
+ isChildOf: isChildOf,
+ dumpRng: dumpRng
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // If you triple click a paragraph in this case:
- // <blockquote><p>a</p></blockquote><p>b</p>
- // It would become this range in webkit:
- // <blockquote><p>[a</p></blockquote><p>]b</p>
- // We would want it to be:
- // <blockquote><p>[a]</p></blockquote><p>b</p>
- // Since it would otherwise produces spans out of thin air on insertContent for example.
- var normalizeBlockSelectionRange = function (rng) {
- var startPos = CaretPosition.fromRangeStart(rng);
- var endPos = CaretPosition.fromRangeEnd(rng);
- var rootNode = rng.commonAncestorContainer;
-
- return CaretFinder.fromPosition(false, rootNode, endPos)
- .map(function (newEndPos) {
- if (!CaretUtils.isInSameBlock(startPos, endPos, rootNode) && CaretUtils.isInSameBlock(startPos, newEndPos, rootNode)) {
- return createRange(startPos.container(), startPos.offset(), newEndPos.container(), newEndPos.offset());
- } else {
- return rng;
- }
- }).getOr(rng);
- };
-
- var normalizeBlockSelection = function (rng) {
- return rng.collapsed ? rng : normalizeBlockSelectionRange(rng);
- };
-
- var normalize = function (rng) {
- return normalizeBlockSelection(rng);
- };
-
- return {
- normalize: normalize
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ attrHooks = setupAttrHooks(styles, settings, function () {
+ return self;
+ });
+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-define("global!console", [], function () { if (typeof console === "undefined") console = { log: function () {} }; return console; });
-defineGlobal("global!document", document);
-define(
- 'ephox.sugar.api.node.Element',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ (function (DOMUtils) {
+ DOMUtils.DOM = DOMUtils(document);
+ DOMUtils.nodeIndex = findNodeIndex;
+ }(DOMUtils || (DOMUtils = {})));
+ var DOMUtils$1 = DOMUtils;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'ephox.katamari.api.Fun',
- 'global!Error',
- 'global!console',
- 'global!document'
- ],
-
- function (Fun, Error, console, document) {
- var fromHtml = function (html, scope) {
- var doc = scope || document;
- var div = doc.createElement('div');
- div.innerHTML = html;
- if (!div.hasChildNodes() || div.childNodes.length > 1) {
- console.error('HTML does not have a single root node', html);
- throw 'HTML must have a single root node';
- }
- return fromDom(div.childNodes[0]);
- };
-
- var fromTag = function (tag, scope) {
- var doc = scope || document;
- var node = doc.createElement(tag);
- return fromDom(node);
- };
-
- var fromText = function (text, scope) {
- var doc = scope || document;
- var node = doc.createTextNode(text);
- return fromDom(node);
- };
-
- var fromDom = function (node) {
- if (node === null || node === undefined) throw new Error('Node cannot be null or undefined');
- return {
- dom: Fun.constant(node)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM = DOMUtils$1.DOM;
+ var each$6 = $_52qop8kjfuw8l6v.each;
+ var grep$2 = $_52qop8kjfuw8l6v.grep;
+ var isFunction = function (f) {
+ return typeof f === 'function';
+ };
+ var ScriptLoader = function () {
+ var QUEUED = 0;
+ var LOADING = 1;
+ var LOADED = 2;
+ var FAILED = 3;
+ var states = {};
+ var queue = [];
+ var scriptLoadedCallbacks = {};
+ var queueLoadedCallbacks = [];
+ var loading = 0;
+ var loadScript = function (url, success, failure) {
+ var dom = DOM;
+ var elm, id;
+ var done = function () {
+ dom.remove(id);
+ if (elm) {
+ elm.onreadystatechange = elm.onload = elm = null;
+ }
+ success();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- return {
- fromHtml: fromHtml,
- fromTag: fromTag,
- fromText: fromText,
- fromDom: fromDom
- };
- }
-);
-
-define(
- 'ephox.katamari.api.Type',
-
- [
- 'global!Array',
- 'global!String'
- ],
-
- function (Array, String) {
- var typeOf = function(x) {
- if (x === null) return 'null';
- var t = typeof x;
- if (t === 'object' && Array.prototype.isPrototypeOf(x)) return 'array';
- if (t === 'object' && String.prototype.isPrototypeOf(x)) return 'string';
- return t;
- };
-
- var isType = function (type) {
- return function (value) {
- return typeOf(value) === type;
- };
- };
-
- return {
- isString: isType('string'),
- isObject: isType('object'),
- isArray: isType('array'),
- isNull: isType('null'),
- isBoolean: isType('boolean'),
- isUndefined: isType('undefined'),
- isFunction: isType('function'),
- isNumber: isType('number')
- };
- }
-);
-
-
-define(
- 'ephox.katamari.data.Immutable',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'global!Array',
- 'global!Error'
- ],
-
- function (Arr, Fun, Array, Error) {
- return function () {
- var fields = arguments;
- return function(/* values */) {
- // Don't use array slice(arguments), makes the whole function unoptimisable on Chrome
- var values = new Array(arguments.length);
- for (var i = 0; i < values.length; i++) values[i] = arguments[i];
-
- if (fields.length !== values.length)
- throw new Error('Wrong number of arguments to struct. Expected "[' + fields.length + ']", got ' + values.length + ' arguments');
-
- var struct = {};
- Arr.each(fields, function (name, i) {
- struct[name] = Fun.constant(values[i]);
- });
- return struct;
- };
- };
- }
-);
-
-define(
- 'ephox.katamari.api.Obj',
-
- [
- 'ephox.katamari.api.Option',
- 'global!Object'
- ],
-
- function (Option, Object) {
- // There are many variations of Object iteration that are faster than the 'for-in' style:
- // http://jsperf.com/object-keys-iteration/107
- //
- // Use the native keys if it is available (IE9+), otherwise fall back to manually filtering
- var keys = (function () {
- var fastKeys = Object.keys;
-
- // This technically means that 'each' and 'find' on IE8 iterate through the object twice.
- // This code doesn't run on IE8 much, so it's an acceptable tradeoff.
- // If it becomes a problem we can always duplicate the feature detection inside each and find as well.
- var slowKeys = function (o) {
- var r = [];
- for (var i in o) {
- if (o.hasOwnProperty(i)) {
- r.push(i);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var error = function () {
+ if (isFunction(failure)) {
+ failure();
+ } else {
+ if (typeof console !== 'undefined' && console.log) {
+ console.log('Failed to load script: ' + url);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return r;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return fastKeys === undefined ? slowKeys : fastKeys;
- })();
-
-
- var each = function (obj, f) {
- var props = keys(obj);
- for (var k = 0, len = props.length; k < len; k++) {
- var i = props[k];
- var x = obj[i];
- f(x, i, obj);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ id = dom.uniqueId();
+ elm = document.createElement('script');
+ elm.id = id;
+ elm.type = 'text/javascript';
+ elm.src = $_52qop8kjfuw8l6v._addCacheSuffix(url);
+ if ('onreadystatechange' in elm) {
+ elm.onreadystatechange = function () {
+ if (/loaded|complete/.test(elm.readyState)) {
+ done();
+ }
+ };
+ } else {
+ elm.onload = done;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ elm.onerror = error;
+ (document.getElementsByTagName('head')[0] || document.body).appendChild(elm);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** objectMap :: (JsObj(k, v), (v, k, JsObj(k, v) -> x)) -> JsObj(k, x) */
- var objectMap = function (obj, f) {
- return tupleMap(obj, function (x, i, obj) {
- return {
- k: i,
- v: f(x, i, obj)
- };
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.isDone = function (url) {
+ return states[url] === LOADED;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** tupleMap :: (JsObj(k, v), (v, k, JsObj(k, v) -> { k: x, v: y })) -> JsObj(x, y) */
- var tupleMap = function (obj, f) {
- var r = {};
- each(obj, function (x, i) {
- var tuple = f(x, i, obj);
- r[tuple.k] = tuple.v;
- });
- return r;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.markDone = function (url) {
+ states[url] = LOADED;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** bifilter :: (JsObj(k, v), (v, k -> Bool)) -> { t: JsObj(k, v), f: JsObj(k, v) } */
- var bifilter = function (obj, pred) {
- var t = {};
- var f = {};
- each(obj, function(x, i) {
- var branch = pred(x, i) ? t : f;
- branch[i] = x;
- });
- return {
- t: t,
- f: f
- };
- };
-
- /** mapToArray :: (JsObj(k, v), (v, k -> a)) -> [a] */
- var mapToArray = function (obj, f) {
- var r = [];
- each(obj, function(value, name) {
- r.push(f(value, name));
- });
- return r;
- };
-
- /** find :: (JsObj(k, v), (v, k, JsObj(k, v) -> Bool)) -> Option v */
- var find = function (obj, pred) {
- var props = keys(obj);
- for (var k = 0, len = props.length; k < len; k++) {
- var i = props[k];
- var x = obj[i];
- if (pred(x, i, obj)) {
- return Option.some(x);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.add = this.load = function (url, success, scope, failure) {
+ var state = states[url];
+ if (state === undefined) {
+ queue.push(url);
+ states[url] = QUEUED;
+ }
+ if (success) {
+ if (!scriptLoadedCallbacks[url]) {
+ scriptLoadedCallbacks[url] = [];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ scriptLoadedCallbacks[url].push({
+ success: success,
+ failure: failure,
+ scope: scope || this
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Option.none();
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** values :: JsObj(k, v) -> [v] */
- var values = function (obj) {
- return mapToArray(obj, function (v) {
- return v;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.remove = function (url) {
+ delete states[url];
+ delete scriptLoadedCallbacks[url];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var size = function (obj) {
- return values(obj).length;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.loadQueue = function (success, scope, failure) {
+ this.loadScripts(queue, success, scope, failure);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- bifilter: bifilter,
- each: each,
- map: objectMap,
- mapToArray: mapToArray,
- tupleMap: tupleMap,
- find: find,
- keys: keys,
- values: values,
- size: size
- };
- }
-);
-define(
- 'ephox.katamari.util.BagUtils',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Type',
- 'global!Error'
- ],
-
- function (Arr, Type, Error) {
- var sort = function (arr) {
- return arr.slice(0).sort();
- };
-
- var reqMessage = function (required, keys) {
- throw new Error('All required keys (' + sort(required).join(', ') + ') were not specified. Specified keys were: ' + sort(keys).join(', ') + '.');
- };
-
- var unsuppMessage = function (unsupported) {
- throw new Error('Unsupported keys for object: ' + sort(unsupported).join(', '));
- };
-
- var validateStrArr = function (label, array) {
- if (!Type.isArray(array)) throw new Error('The ' + label + ' fields must be an array. Was: ' + array + '.');
- Arr.each(array, function (a) {
- if (!Type.isString(a)) throw new Error('The value ' + a + ' in the ' + label + ' fields was not a string.');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.loadScripts = function (scripts, success, scope, failure) {
+ var loadScripts;
+ var failures = [];
+ var execCallbacks = function (name, url) {
+ each$6(scriptLoadedCallbacks[url], function (callback) {
+ if (isFunction(callback[name])) {
+ callback[name].call(callback.scope);
+ }
+ });
+ scriptLoadedCallbacks[url] = undefined;
+ };
+ queueLoadedCallbacks.push({
+ success: success,
+ failure: failure,
+ scope: scope || this
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var invalidTypeMessage = function (incorrect, type) {
- throw new Error('All values need to be of type: ' + type + '. Keys (' + sort(incorrect).join(', ') + ') were not.');
- };
-
- var checkDupes = function (everything) {
- var sorted = sort(everything);
- var dupe = Arr.find(sorted, function (s, i) {
- return i < sorted.length -1 && s === sorted[i + 1];
- });
-
- dupe.each(function (d) {
- throw new Error('The field: ' + d + ' occurs more than once in the combined fields: [' + sorted.join(', ') + '].');
- });
- };
-
- return {
- sort: sort,
- reqMessage: reqMessage,
- unsuppMessage: unsuppMessage,
- validateStrArr: validateStrArr,
- invalidTypeMessage: invalidTypeMessage,
- checkDupes: checkDupes
- };
- }
-);
-define(
- 'ephox.katamari.data.MixedBag',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Obj',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.util.BagUtils',
- 'global!Error',
- 'global!Object'
- ],
-
- function (Arr, Fun, Obj, Option, BagUtils, Error, Object) {
-
- return function (required, optional) {
- var everything = required.concat(optional);
- if (everything.length === 0) throw new Error('You must specify at least one required or optional field.');
-
- BagUtils.validateStrArr('required', required);
- BagUtils.validateStrArr('optional', optional);
-
- BagUtils.checkDupes(everything);
-
- return function (obj) {
- var keys = Obj.keys(obj);
-
- // Ensure all required keys are present.
- var allReqd = Arr.forall(required, function (req) {
- return Arr.contains(keys, req);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ loadScripts = function () {
+ var loadingScripts = grep$2(scripts);
+ scripts.length = 0;
+ each$6(loadingScripts, function (url) {
+ if (states[url] === LOADED) {
+ execCallbacks('success', url);
+ return;
+ }
+ if (states[url] === FAILED) {
+ execCallbacks('failure', url);
+ return;
+ }
+ if (states[url] !== LOADING) {
+ states[url] = LOADING;
+ loading++;
+ loadScript(url, function () {
+ states[url] = LOADED;
+ loading--;
+ execCallbacks('success', url);
+ loadScripts();
+ }, function () {
+ states[url] = FAILED;
+ loading--;
+ failures.push(url);
+ execCallbacks('failure', url);
+ loadScripts();
+ });
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (! allReqd) BagUtils.reqMessage(required, keys);
-
- var unsupported = Arr.filter(keys, function (key) {
- return !Arr.contains(everything, key);
- });
-
- if (unsupported.length > 0) BagUtils.unsuppMessage(unsupported);
-
- var r = {};
- Arr.each(required, function (req) {
- r[req] = Fun.constant(obj[req]);
- });
-
- Arr.each(optional, function (opt) {
- r[opt] = Fun.constant(Object.prototype.hasOwnProperty.call(obj, opt) ? Option.some(obj[opt]): Option.none());
- });
-
- return r;
- };
- };
- }
-);
-define(
- 'ephox.katamari.api.Struct',
-
- [
- 'ephox.katamari.data.Immutable',
- 'ephox.katamari.data.MixedBag'
- ],
-
- function (Immutable, MixedBag) {
- return {
- immutable: Immutable,
- immutableBag: MixedBag
- };
- }
-);
-
-define(
- 'ephox.sugar.alien.Recurse',
-
- [
-
- ],
-
- function () {
- /**
- * Applies f repeatedly until it completes (by returning Option.none()).
- *
- * Normally would just use recursion, but JavaScript lacks tail call optimisation.
- *
- * This is what recursion looks like when manually unravelled :)
- */
- var toArray = function (target, f) {
- var r = [];
-
- var recurse = function (e) {
- r.push(e);
- return f(e);
- };
-
- var cur = f(target);
- do {
- cur = cur.bind(recurse);
- } while (cur.isSome());
-
- return r;
- };
-
- return {
- toArray: toArray
- };
- }
-);
-define(
- 'ephox.katamari.api.Global',
-
- [
- ],
-
- function () {
- // Use window object as the global if it's available since CSP will block script evals
- if (typeof window !== 'undefined') {
- return window;
- } else {
- return Function('return this;')();
- }
- }
-);
-
-
-define(
- 'ephox.katamari.api.Resolve',
-
- [
- 'ephox.katamari.api.Global'
- ],
-
- function (Global) {
- /** path :: ([String], JsObj?) -> JsObj */
- var path = function (parts, scope) {
- var o = scope !== undefined ? scope : Global;
- for (var i = 0; i < parts.length && o !== undefined && o !== null; ++i)
- o = o[parts[i]];
- return o;
- };
-
- /** resolve :: (String, JsObj?) -> JsObj */
- var resolve = function (p, scope) {
- var parts = p.split('.');
- return path(parts, scope);
- };
-
- /** step :: (JsObj, String) -> JsObj */
- var step = function (o, part) {
- if (o[part] === undefined || o[part] === null)
- o[part] = {};
- return o[part];
- };
-
- /** forge :: ([String], JsObj?) -> JsObj */
- var forge = function (parts, target) {
- var o = target !== undefined ? target : Global;
- for (var i = 0; i < parts.length; ++i)
- o = step(o, parts[i]);
- return o;
- };
-
- /** namespace :: (String, JsObj?) -> JsObj */
- var namespace = function (name, target) {
- var parts = name.split('.');
- return forge(parts, target);
- };
-
- return {
- path: path,
- resolve: resolve,
- forge: forge,
- namespace: namespace
- };
- }
-);
-
-
-define(
- 'ephox.sand.util.Global',
-
- [
- 'ephox.katamari.api.Resolve'
- ],
-
- function (Resolve) {
- var unsafe = function (name, scope) {
- return Resolve.resolve(name, scope);
- };
-
- var getOrDie = function (name, scope) {
- var actual = unsafe(name, scope);
-
- if (actual === undefined) throw name + ' not available on this browser';
- return actual;
- };
-
- return {
- getOrDie: getOrDie
- };
- }
-);
-define(
- 'ephox.sand.api.Node',
-
- [
- 'ephox.sand.util.Global'
- ],
-
- function (Global) {
- /*
- * MDN says (yes) for IE, but it's undefined on IE8
- */
- var node = function () {
- var f = Global.getOrDie('Node');
- return f;
- };
-
- /*
- * Most of numerosity doesn't alter the methods on the object.
- * We're making an exception for Node, because bitwise and is so easy to get wrong.
- *
- * Might be nice to ADT this at some point instead of having individual methods.
- */
-
- var compareDocumentPosition = function (a, b, match) {
- // Returns: 0 if e1 and e2 are the same node, or a bitmask comparing the positions
- // of nodes e1 and e2 in their documents. See the URL below for bitmask interpretation
- // https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
- return (a.compareDocumentPosition(b) & match) !== 0;
- };
-
- var documentPositionPreceding = function (a, b) {
- return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_PRECEDING);
- };
-
- var documentPositionContainedBy = function (a, b) {
- return compareDocumentPosition(a, b, node().DOCUMENT_POSITION_CONTAINED_BY);
- };
-
- return {
- documentPositionPreceding: documentPositionPreceding,
- documentPositionContainedBy: documentPositionContainedBy
- };
- }
-);
-define(
- 'ephox.katamari.api.Thunk',
-
- [
- ],
-
- function () {
-
- var cached = function (f) {
- var called = false;
- var r;
- return function() {
- if (!called) {
- called = true;
- r = f.apply(null, arguments);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!loading) {
+ var notifyCallbacks = queueLoadedCallbacks.slice(0);
+ queueLoadedCallbacks.length = 0;
+ each$6(notifyCallbacks, function (callback) {
+ if (failures.length === 0) {
+ if (isFunction(callback.success)) {
+ callback.success.call(callback.scope);
+ }
+ } else {
+ if (isFunction(callback.failure)) {
+ callback.failure.call(callback.scope, failures);
+ }
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return r;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ loadScripts();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ ScriptLoader.ScriptLoader = new ScriptLoader();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- cached: cached
- };
- }
-);
-
-defineGlobal("global!Number", Number);
-define(
- 'ephox.sand.detect.Version',
-
- [
- 'ephox.katamari.api.Arr',
- 'global!Number',
- 'global!String'
- ],
-
- function (Arr, Number, String) {
- var firstMatch = function (regexes, s) {
- for (var i = 0; i < regexes.length; i++) {
- var x = regexes[i];
- if (x.test(s)) return x;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$7 = $_52qop8kjfuw8l6v.each;
+ function AddOnManager() {
+ var _this = this;
+ var items = [];
+ var urls = {};
+ var lookup = {};
+ var _listeners = [];
+ var get = function (name) {
+ if (lookup[name]) {
+ return lookup[name].instance;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> return undefined;
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var find = function (regexes, agent) {
- var r = firstMatch(regexes, agent);
- if (!r) return { major : 0, minor : 0 };
- var group = function(i) {
- return Number(agent.replace(r, '$' + i));
- };
- return nu(group(1), group(2));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var dependencies = function (name) {
+ var result;
+ if (lookup[name]) {
+ result = lookup[name].dependencies;
+ }
+ return result || [];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var detect = function (versionRegexes, agent) {
- var cleanedAgent = String(agent).toLowerCase();
-
- if (versionRegexes.length === 0) return unknown();
- return find(versionRegexes, cleanedAgent);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var requireLangPack = function (name, languages) {
+ var language = AddOnManager.language;
+ if (language && AddOnManager.languageLoad !== false) {
+ if (languages) {
+ languages = ',' + languages + ',';
+ if (languages.indexOf(',' + language.substr(0, 2) + ',') !== -1) {
+ language = language.substr(0, 2);
+ } else if (languages.indexOf(',' + language + ',') === -1) {
+ return;
+ }
+ }
+ ScriptLoader.ScriptLoader.add(urls[name] + '/langs/' + language + '.js');
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var unknown = function () {
- return nu(0, 0);
- };
-
- var nu = function (major, minor) {
- return { major: major, minor: minor };
- };
-
- return {
- nu: nu,
- detect: detect,
- unknown: unknown
- };
- }
-);
-define(
- 'ephox.sand.core.Browser',
-
- [
- 'ephox.katamari.api.Fun',
- 'ephox.sand.detect.Version'
- ],
-
- function (Fun, Version) {
- var edge = 'Edge';
- var chrome = 'Chrome';
- var ie = 'IE';
- var opera = 'Opera';
- var firefox = 'Firefox';
- var safari = 'Safari';
-
- var isBrowser = function (name, current) {
- return function () {
- return current === name;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var add = function (id, addOn, dependencies) {
+ items.push(addOn);
+ lookup[id] = {
+ instance: addOn,
+ dependencies: dependencies
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var unknown = function () {
- return nu({
- current: undefined,
- version: Version.unknown()
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var result = $_9ek1bp4jfuw8kxg.partition(_listeners, function (listener) {
+ return listener.name === id;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var nu = function (info) {
- var current = info.current;
- var version = info.version;
-
- return {
- current: current,
- version: version,
-
- // INVESTIGATE: Rename to Edge ?
- isEdge: isBrowser(edge, current),
- isChrome: isBrowser(chrome, current),
- // NOTE: isIe just looks too weird
- isIE: isBrowser(ie, current),
- isOpera: isBrowser(opera, current),
- isFirefox: isBrowser(firefox, current),
- isSafari: isBrowser(safari, current)
- };
- };
-
- return {
- unknown: unknown,
- nu: nu,
- edge: Fun.constant(edge),
- chrome: Fun.constant(chrome),
- ie: Fun.constant(ie),
- opera: Fun.constant(opera),
- firefox: Fun.constant(firefox),
- safari: Fun.constant(safari)
- };
- }
-);
-define(
- 'ephox.sand.core.OperatingSystem',
-
- [
- 'ephox.katamari.api.Fun',
- 'ephox.sand.detect.Version'
- ],
-
- function (Fun, Version) {
- var windows = 'Windows';
- var ios = 'iOS';
- var android = 'Android';
- var linux = 'Linux';
- var osx = 'OSX';
- var solaris = 'Solaris';
- var freebsd = 'FreeBSD';
-
- // Though there is a bit of dupe with this and Browser, trying to
- // reuse code makes it much harder to follow and change.
- var isOS = function (name, current) {
- return function () {
- return current === name;
- };
- };
-
- var unknown = function () {
- return nu({
- current: undefined,
- version: Version.unknown()
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _listeners = result.fail;
+ each$7(result.pass, function (listener) {
+ listener.callback();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return addOn;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var nu = function (info) {
- var current = info.current;
- var version = info.version;
-
- return {
- current: current,
- version: version,
-
- isWindows: isOS(windows, current),
- // TODO: Fix capitalisation
- isiOS: isOS(ios, current),
- isAndroid: isOS(android, current),
- isOSX: isOS(osx, current),
- isLinux: isOS(linux, current),
- isSolaris: isOS(solaris, current),
- isFreeBSD: isOS(freebsd, current)
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var remove = function (name) {
+ delete urls[name];
+ delete lookup[name];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- unknown: unknown,
- nu: nu,
-
- windows: Fun.constant(windows),
- ios: Fun.constant(ios),
- android: Fun.constant(android),
- linux: Fun.constant(linux),
- osx: Fun.constant(osx),
- solaris: Fun.constant(solaris),
- freebsd: Fun.constant(freebsd)
- };
- }
-);
-define(
- 'ephox.sand.detect.DeviceType',
-
- [
- 'ephox.katamari.api.Fun'
- ],
-
- function (Fun) {
- return function (os, browser, userAgent) {
- var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
- var isiPhone = os.isiOS() && !isiPad;
- var isAndroid3 = os.isAndroid() && os.version.major === 3;
- var isAndroid4 = os.isAndroid() && os.version.major === 4;
- var isTablet = isiPad || isAndroid3 || ( isAndroid4 && /mobile/i.test(userAgent) === true );
- var isTouch = os.isiOS() || os.isAndroid();
- var isPhone = isTouch && !isTablet;
-
- var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
-
- return {
- isiPad : Fun.constant(isiPad),
- isiPhone: Fun.constant(isiPhone),
- isTablet: Fun.constant(isTablet),
- isPhone: Fun.constant(isPhone),
- isTouch: Fun.constant(isTouch),
- isAndroid: os.isAndroid,
- isiOS: os.isiOS,
- isWebView: Fun.constant(iOSwebview)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createUrl = function (baseUrl, dep) {
+ if (typeof dep === 'object') {
+ return dep;
+ }
+ return typeof baseUrl === 'string' ? {
+ prefix: '',
+ resource: dep,
+ suffix: ''
+ } : {
+ prefix: baseUrl.prefix,
+ resource: dep,
+ suffix: baseUrl.suffix
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-define(
- 'ephox.sand.detect.UaString',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sand.detect.Version',
- 'global!String'
- ],
-
- function (Arr, Version, String) {
- var detect = function (candidates, userAgent) {
- var agent = String(userAgent).toLowerCase();
- return Arr.find(candidates, function (candidate) {
- return candidate.search(agent);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addComponents = function (pluginName, scripts) {
+ var pluginUrl = _this.urls[pluginName];
+ each$7(scripts, function (script) {
+ ScriptLoader.ScriptLoader.add(pluginUrl + '/' + script);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // They (browser and os) are the same at the moment, but they might
- // not stay that way.
- var detectBrowser = function (browsers, userAgent) {
- return detect(browsers, userAgent).map(function (browser) {
- var version = Version.detect(browser.versionRegexes, userAgent);
- return {
- current: browser.name,
- version: version
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var loadDependencies = function (addOnUrl, success, scope) {
+ var deps = dependencies(name);
+ each$7(deps, function (dep) {
+ var newUrl = createUrl(addOnUrl, dep);
+ load(newUrl.resource, newUrl, undefined, undefined);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var detectOs = function (oses, userAgent) {
- return detect(oses, userAgent).map(function (os) {
- var version = Version.detect(os.versionRegexes, userAgent);
- return {
- current: os.name,
- version: version
- };
- });
- };
-
- return {
- detectBrowser: detectBrowser,
- detectOs: detectOs
- };
- }
-);
-define(
- 'ephox.katamari.str.StrAppend',
-
- [
-
- ],
-
- function () {
- var addToStart = function (str, prefix) {
- return prefix + str;
- };
-
- var addToEnd = function (str, suffix) {
- return str + suffix;
- };
-
- var removeFromStart = function (str, numChars) {
- return str.substring(numChars);
- };
-
- var removeFromEnd = function (str, numChars) {
- return str.substring(0, str.length - numChars);
- };
-
- return {
- addToStart: addToStart,
- addToEnd: addToEnd,
- removeFromStart: removeFromStart,
- removeFromEnd: removeFromEnd
- };
- }
-);
-define(
- 'ephox.katamari.str.StringParts',
-
- [
- 'ephox.katamari.api.Option',
- 'global!Error'
- ],
-
- function (Option, Error) {
- /** Return the first 'count' letters from 'str'.
-- * e.g. first("abcde", 2) === "ab"
-- */
- var first = function(str, count) {
- return str.substr(0, count);
- };
-
- /** Return the last 'count' letters from 'str'.
- * e.g. last("abcde", 2) === "de"
- */
- var last = function(str, count) {
- return str.substr(str.length - count, str.length);
- };
-
- var head = function(str) {
- return str === '' ? Option.none() : Option.some(str.substr(0, 1));
- };
-
- var tail = function(str) {
- return str === '' ? Option.none() : Option.some(str.substring(1));
- };
-
- return {
- first: first,
- last: last,
- head: head,
- tail: tail
- };
- }
-);
-define(
- 'ephox.katamari.api.Strings',
-
- [
- 'ephox.katamari.str.StrAppend',
- 'ephox.katamari.str.StringParts',
- 'global!Error'
- ],
-
- function (StrAppend, StringParts, Error) {
- var checkRange = function(str, substr, start) {
- if (substr === '') return true;
- if (str.length < substr.length) return false;
- var x = str.substr(start, start + substr.length);
- return x === substr;
- };
-
- /** Given a string and object, perform template-replacements on the string, as specified by the object.
- * Any template fields of the form ${name} are replaced by the string or number specified as obj["name"]
- * Based on Douglas Crockford's 'supplant' method for template-replace of strings. Uses different template format.
- */
- var supplant = function(str, obj) {
- var isStringOrNumber = function(a) {
- var t = typeof a;
- return t === 'string' || t === 'number';
- };
-
- return str.replace(/\${([^{}]*)}/g,
- function (a, b) {
- var value = obj[b];
- return isStringOrNumber(value) ? value : a;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (success) {
+ if (scope) {
+ success.call(scope);
+ } else {
+ success.call(ScriptLoader);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var removeLeading = function (str, prefix) {
- return startsWith(str, prefix) ? StrAppend.removeFromStart(str, prefix.length) : str;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var load = function (name, addOnUrl, success, scope, failure) {
+ if (urls[name]) {
+ return;
+ }
+ var urlString = typeof addOnUrl === 'string' ? addOnUrl : addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix;
+ if (urlString.indexOf('/') !== 0 && urlString.indexOf('://') === -1) {
+ urlString = AddOnManager.baseURL + '/' + urlString;
+ }
+ urls[name] = urlString.substring(0, urlString.lastIndexOf('/'));
+ if (lookup[name]) {
+ loadDependencies(addOnUrl, success, scope);
+ } else {
+ ScriptLoader.ScriptLoader.add(urlString, function () {
+ return loadDependencies(addOnUrl, success, scope);
+ }, scope, failure);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var removeTrailing = function (str, prefix) {
- return endsWith(str, prefix) ? StrAppend.removeFromEnd(str, prefix.length) : str;
- };
-
- var ensureLeading = function (str, prefix) {
- return startsWith(str, prefix) ? str : StrAppend.addToStart(str, prefix);
- };
-
- var ensureTrailing = function (str, prefix) {
- return endsWith(str, prefix) ? str : StrAppend.addToEnd(str, prefix);
- };
-
- var contains = function(str, substr) {
- return str.indexOf(substr) !== -1;
- };
-
- var capitalize = function(str) {
- return StringParts.head(str).bind(function (head) {
- return StringParts.tail(str).map(function (tail) {
- return head.toUpperCase() + tail;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var waitFor = function (name, callback) {
+ if (lookup.hasOwnProperty(name)) {
+ callback();
+ } else {
+ _listeners.push({
+ name: name,
+ callback: callback
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }).getOr(str);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /** Does 'str' start with 'prefix'?
- * Note: all strings start with the empty string.
- * More formally, for all strings x, startsWith(x, "").
- * This is so that for all strings x and y, startsWith(y + x, y)
- */
- var startsWith = function(str, prefix) {
- return checkRange(str, prefix, 0);
- };
-
- /** Does 'str' end with 'suffix'?
- * Note: all strings end with the empty string.
- * More formally, for all strings x, endsWith(x, "").
- * This is so that for all strings x and y, endsWith(x + y, y)
- */
- var endsWith = function(str, suffix) {
- return checkRange(str, suffix, str.length - suffix.length);
- };
-
-
- /** removes all leading and trailing spaces */
- var trim = function(str) {
- return str.replace(/^\s+|\s+$/g, '');
- };
-
- var lTrim = function(str) {
- return str.replace(/^\s+/g, '');
- };
-
- var rTrim = function(str) {
- return str.replace(/\s+$/g, '');
- };
-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- supplant: supplant,
- startsWith: startsWith,
- removeLeading: removeLeading,
- removeTrailing: removeTrailing,
- ensureLeading: ensureLeading,
- ensureTrailing: ensureTrailing,
- endsWith: endsWith,
- contains: contains,
- trim: trim,
- lTrim: lTrim,
- rTrim: rTrim,
- capitalize: capitalize
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ items: items,
+ urls: urls,
+ lookup: lookup,
+ _listeners: _listeners,
+ get: get,
+ dependencies: dependencies,
+ requireLangPack: requireLangPack,
+ add: add,
+ remove: remove,
+ createUrl: createUrl,
+ addComponents: addComponents,
+ load: load,
+ waitFor: waitFor
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ (function (AddOnManager) {
+ AddOnManager.PluginManager = AddOnManager();
+ AddOnManager.ThemeManager = AddOnManager();
+ }(AddOnManager || (AddOnManager = {})));
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'ephox.sand.info.PlatformInfo',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ZWSP = '\uFEFF';
+ var isZwsp = function (chr) {
+ return chr === ZWSP;
+ };
+ var trim$3 = function (text) {
+ return text.replace(new RegExp(ZWSP, 'g'), '');
+ };
+ var $_dpfg1321jfuw8lhn = {
+ isZwsp: isZwsp,
+ ZWSP: ZWSP,
+ trim: trim$3
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Strings'
- ],
-
- function (Fun, Strings) {
- var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
-
- var checkContains = function (target) {
- return function (uastring) {
- return Strings.contains(uastring, target);
- };
- };
-
- var browsers = [
- {
- name : 'Edge',
- versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
- search: function (uastring) {
- var monstrosity = Strings.contains(uastring, 'edge/') && Strings.contains(uastring, 'chrome') && Strings.contains(uastring, 'safari') && Strings.contains(uastring, 'applewebkit');
- return monstrosity;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isElement$2 = $_ey7ka11qjfuw8ldg.isElement;
+ var isText$2 = $_ey7ka11qjfuw8ldg.isText;
+ var isCaretContainerBlock = function (node) {
+ if (isText$2(node)) {
+ node = node.parentNode;
+ }
+ return isElement$2(node) && node.hasAttribute('data-mce-caret');
+ };
+ var isCaretContainerInline = function (node) {
+ return isText$2(node) && $_dpfg1321jfuw8lhn.isZwsp(node.data);
+ };
+ var isCaretContainer = function (node) {
+ return isCaretContainerBlock(node) || isCaretContainerInline(node);
+ };
+ var hasContent = function (node) {
+ return node.firstChild !== node.lastChild || !$_ey7ka11qjfuw8ldg.isBr(node.firstChild);
+ };
+ var insertInline = function (node, before) {
+ var doc, sibling, textNode, parentNode;
+ doc = node.ownerDocument;
+ textNode = doc.createTextNode($_dpfg1321jfuw8lhn.ZWSP);
+ parentNode = node.parentNode;
+ if (!before) {
+ sibling = node.nextSibling;
+ if (isText$2(sibling)) {
+ if (isCaretContainer(sibling)) {
+ return sibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
- {
- name : 'Chrome',
- versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/, normalVersionRegex],
- search : function (uastring) {
- return Strings.contains(uastring, 'chrome') && !Strings.contains(uastring, 'chromeframe');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (startsWithCaretContainer(sibling)) {
+ sibling.splitText(1);
+ return sibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
- {
- name : 'IE',
- versionRegexes: [/.*?msie\ ?([0-9]+)\.([0-9]+).*/, /.*?rv:([0-9]+)\.([0-9]+).*/],
- search: function (uastring) {
- return Strings.contains(uastring, 'msie') || Strings.contains(uastring, 'trident');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (node.nextSibling) {
+ parentNode.insertBefore(textNode, node.nextSibling);
+ } else {
+ parentNode.appendChild(textNode);
+ }
+ } else {
+ sibling = node.previousSibling;
+ if (isText$2(sibling)) {
+ if (isCaretContainer(sibling)) {
+ return sibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
- // INVESTIGATE: Is this still the Opera user agent?
- {
- name : 'Opera',
- versionRegexes: [normalVersionRegex, /.*?opera\/([0-9]+)\.([0-9]+).*/],
- search : checkContains('opera')
- },
- {
- name : 'Firefox',
- versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
- search : checkContains('firefox')
- },
- {
- name : 'Safari',
- versionRegexes: [normalVersionRegex, /.*?cpu os ([0-9]+)_([0-9]+).*/],
- search : function (uastring) {
- return (Strings.contains(uastring, 'safari') || Strings.contains(uastring, 'mobile/')) && Strings.contains(uastring, 'applewebkit');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (endsWithCaretContainer(sibling)) {
+ return sibling.splitText(sibling.data.length - 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
-
- var oses = [
- {
- name : 'Windows',
- search : checkContains('win'),
- versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
- },
- {
- name : 'iOS',
- search : function (uastring) {
- return Strings.contains(uastring, 'iphone') || Strings.contains(uastring, 'ipad');
- },
- versionRegexes: [/.*?version\/\ ?([0-9]+)\.([0-9]+).*/, /.*cpu os ([0-9]+)_([0-9]+).*/, /.*cpu iphone os ([0-9]+)_([0-9]+).*/]
- },
- {
- name : 'Android',
- search : checkContains('android'),
- versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
- },
- {
- name : 'OSX',
- search : checkContains('os x'),
- versionRegexes: [/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]
- },
- {
- name : 'Linux',
- search : checkContains('linux'),
- versionRegexes: [ ]
- },
- { name : 'Solaris',
- search : checkContains('sunos'),
- versionRegexes: [ ]
- },
- {
- name : 'FreeBSD',
- search : checkContains('freebsd'),
- versionRegexes: [ ]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parentNode.insertBefore(textNode, node);
+ }
+ return textNode;
+ };
+ var isBeforeInline = function (pos) {
+ var container = pos.container();
+ return pos && $_ey7ka11qjfuw8ldg.isText(container) && container.data.charAt(pos.offset()) === $_dpfg1321jfuw8lhn.ZWSP;
+ };
+ var isAfterInline = function (pos) {
+ var container = pos.container();
+ return pos && $_ey7ka11qjfuw8ldg.isText(container) && container.data.charAt(pos.offset() - 1) === $_dpfg1321jfuw8lhn.ZWSP;
+ };
+ var createBogusBr = function () {
+ var br = document.createElement('br');
+ br.setAttribute('data-mce-bogus', '1');
+ return br;
+ };
+ var insertBlock = function (blockName, node, before) {
+ var doc, blockNode, parentNode;
+ doc = node.ownerDocument;
+ blockNode = doc.createElement(blockName);
+ blockNode.setAttribute('data-mce-caret', before ? 'before' : 'after');
+ blockNode.setAttribute('data-mce-bogus', 'all');
+ blockNode.appendChild(createBogusBr());
+ parentNode = node.parentNode;
+ if (!before) {
+ if (node.nextSibling) {
+ parentNode.insertBefore(blockNode, node.nextSibling);
+ } else {
+ parentNode.appendChild(blockNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ parentNode.insertBefore(blockNode, node);
+ }
+ return blockNode;
+ };
+ var startsWithCaretContainer = function (node) {
+ return isText$2(node) && node.data[0] === $_dpfg1321jfuw8lhn.ZWSP;
+ };
+ var endsWithCaretContainer = function (node) {
+ return isText$2(node) && node.data[node.data.length - 1] === $_dpfg1321jfuw8lhn.ZWSP;
+ };
+ var trimBogusBr = function (elm) {
+ var brs = elm.getElementsByTagName('br');
+ var lastBr = brs[brs.length - 1];
+ if ($_ey7ka11qjfuw8ldg.isBogus(lastBr)) {
+ lastBr.parentNode.removeChild(lastBr);
+ }
+ };
+ var showCaretContainerBlock = function (caretContainer) {
+ if (caretContainer && caretContainer.hasAttribute('data-mce-caret')) {
+ trimBogusBr(caretContainer);
+ caretContainer.removeAttribute('data-mce-caret');
+ caretContainer.removeAttribute('data-mce-bogus');
+ caretContainer.removeAttribute('style');
+ caretContainer.removeAttribute('_moz_abspos');
+ return caretContainer;
+ }
+ return null;
+ };
+ var isRangeInCaretContainerBlock = function (range) {
+ return isCaretContainerBlock(range.startContainer);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- browsers: Fun.constant(browsers),
- oses: Fun.constant(oses)
- };
- }
-);
-define(
- 'ephox.sand.core.PlatformDetection',
-
- [
- 'ephox.sand.core.Browser',
- 'ephox.sand.core.OperatingSystem',
- 'ephox.sand.detect.DeviceType',
- 'ephox.sand.detect.UaString',
- 'ephox.sand.info.PlatformInfo'
- ],
-
- function (Browser, OperatingSystem, DeviceType, UaString, PlatformInfo) {
- var detect = function (userAgent) {
- var browsers = PlatformInfo.browsers();
- var oses = PlatformInfo.oses();
-
- var browser = UaString.detectBrowser(browsers, userAgent).fold(
- Browser.unknown,
- Browser.nu
- );
- var os = UaString.detectOs(oses, userAgent).fold(
- OperatingSystem.unknown,
- OperatingSystem.nu
- );
- var deviceType = DeviceType(os, browser, userAgent);
-
- return {
- browser: browser,
- os: os,
- deviceType: deviceType
- };
- };
-
- return {
- detect: detect
- };
- }
-);
-defineGlobal("global!navigator", navigator);
-define(
- 'ephox.sand.api.PlatformDetection',
-
- [
- 'ephox.katamari.api.Thunk',
- 'ephox.sand.core.PlatformDetection',
- 'global!navigator'
- ],
-
- function (Thunk, PlatformDetection, navigator) {
- var detect = Thunk.cached(function () {
- var userAgent = navigator.userAgent;
- return PlatformDetection.detect(userAgent);
- });
-
- return {
- detect: detect
- };
- }
-);
-define(
- 'ephox.sugar.api.node.NodeTypes',
-
- [
-
- ],
-
- function () {
- return {
- ATTRIBUTE: 2,
- CDATA_SECTION: 4,
- COMMENT: 8,
- DOCUMENT: 9,
- DOCUMENT_TYPE: 10,
- DOCUMENT_FRAGMENT: 11,
- ELEMENT: 1,
- TEXT: 3,
- PROCESSING_INSTRUCTION: 7,
- ENTITY_REFERENCE: 5,
- ENTITY: 6,
- NOTATION: 12
- };
- }
-);
-define(
- 'ephox.sugar.api.search.Selectors',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Option',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.node.NodeTypes',
- 'global!Error',
- 'global!document'
- ],
-
- function (Arr, Option, Element, NodeTypes, Error, document) {
- var ELEMENT = NodeTypes.ELEMENT;
- var DOCUMENT = NodeTypes.DOCUMENT;
-
- var is = function (element, selector) {
- var elem = element.dom();
- if (elem.nodeType !== ELEMENT) return false; // documents have querySelector but not matches
-
- // As of Chrome 34 / Safari 7.1 / FireFox 34, everyone except IE has the unprefixed function.
- // Still check for the others, but do it last.
- else if (elem.matches !== undefined) return elem.matches(selector);
- else if (elem.msMatchesSelector !== undefined) return elem.msMatchesSelector(selector);
- else if (elem.webkitMatchesSelector !== undefined) return elem.webkitMatchesSelector(selector);
- else if (elem.mozMatchesSelector !== undefined) return elem.mozMatchesSelector(selector);
- else throw new Error('Browser lacks native selectors'); // unfortunately we can't throw this on startup :(
- };
-
- var bypassSelector = function (dom) {
- // Only elements and documents support querySelector
- return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT ||
- // IE fix for complex queries on empty nodes: http://jsfiddle.net/spyder/fv9ptr5L/
- dom.childElementCount === 0;
- };
-
- var all = function (selector, scope) {
- var base = scope === undefined ? document : scope.dom();
- return bypassSelector(base) ? [] : Arr.map(base.querySelectorAll(selector), Element.fromDom);
- };
-
- var one = function (selector, scope) {
- var base = scope === undefined ? document : scope.dom();
- return bypassSelector(base) ? Option.none() : Option.from(base.querySelector(selector)).map(Element.fromDom);
- };
-
- return {
- all: all,
- is: is,
- one: one
- };
- }
-);
-
-define(
- 'ephox.sugar.api.dom.Compare',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.sand.api.Node',
- 'ephox.sand.api.PlatformDetection',
- 'ephox.sugar.api.search.Selectors'
- ],
-
- function (Arr, Fun, Node, PlatformDetection, Selectors) {
-
- var eq = function (e1, e2) {
- return e1.dom() === e2.dom();
- };
-
- var isEqualNode = function (e1, e2) {
- return e1.dom().isEqualNode(e2.dom());
- };
-
- var member = function (element, elements) {
- return Arr.exists(elements, Fun.curry(eq, element));
- };
-
- // DOM contains() method returns true if e1===e2, we define our contains() to return false (a node does not contain itself).
- var regularContains = function (e1, e2) {
- var d1 = e1.dom(), d2 = e2.dom();
- return d1 === d2 ? false : d1.contains(d2);
- };
-
- var ieContains = function (e1, e2) {
- // IE only implements the contains() method for Element nodes.
- // It fails for Text nodes, so implement it using compareDocumentPosition()
- // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect
- // Note that compareDocumentPosition returns CONTAINED_BY if 'e2 *is_contained_by* e1':
- // Also, compareDocumentPosition defines a node containing itself as false.
- return Node.documentPositionContainedBy(e1.dom(), e2.dom());
- };
-
- var browser = PlatformDetection.detect().browser;
-
- // Returns: true if node e1 contains e2, otherwise false.
- // (returns false if e1===e2: A node does not contain itself).
- var contains = browser.isIE() ? ieContains : regularContains;
-
- return {
- eq: eq,
- isEqualNode: isEqualNode,
- member: member,
- contains: contains,
-
- // Only used by DomUniverse. Remove (or should Selectors.is move here?)
- is: Selectors.is
- };
- }
-);
-
-define(
- 'ephox.sugar.api.search.Traverse',
-
- [
- 'ephox.katamari.api.Type',
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.api.Struct',
- 'ephox.sugar.alien.Recurse',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element'
- ],
-
- function (Type, Arr, Fun, Option, Struct, Recurse, Compare, Element) {
- // The document associated with the current element
- var owner = function (element) {
- return Element.fromDom(element.dom().ownerDocument);
- };
-
- var documentElement = function (element) {
- // TODO: Avoid unnecessary wrap/unwrap here
- var doc = owner(element);
- return Element.fromDom(doc.dom().documentElement);
- };
-
- // The window element associated with the element
- var defaultView = function (element) {
- var el = element.dom();
- var defaultView = el.ownerDocument.defaultView;
- return Element.fromDom(defaultView);
- };
-
- var parent = function (element) {
- var dom = element.dom();
- return Option.from(dom.parentNode).map(Element.fromDom);
- };
-
- var findIndex = function (element) {
- return parent(element).bind(function (p) {
- // TODO: Refactor out children so we can avoid the constant unwrapping
- var kin = children(p);
- return Arr.findIndex(kin, function (elem) {
- return Compare.eq(element, elem);
- });
- });
- };
-
- var parents = function (element, isRoot) {
- var stop = Type.isFunction(isRoot) ? isRoot : Fun.constant(false);
-
- // This is used a *lot* so it needs to be performant, not recursive
- var dom = element.dom();
- var ret = [];
-
- while (dom.parentNode !== null && dom.parentNode !== undefined) {
- var rawParent = dom.parentNode;
- var parent = Element.fromDom(rawParent);
- ret.push(parent);
-
- if (stop(parent) === true) break;
- else dom = rawParent;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isContentEditableTrue$1 = $_ey7ka11qjfuw8ldg.isContentEditableTrue;
+ var isContentEditableFalse$1 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var isBr$2 = $_ey7ka11qjfuw8ldg.isBr;
+ var isText$3 = $_ey7ka11qjfuw8ldg.isText;
+ var isInvalidTextElement = $_ey7ka11qjfuw8ldg.matchNodeNames('script style textarea');
+ var isAtomicInline = $_ey7ka11qjfuw8ldg.matchNodeNames('img input textarea hr iframe video audio object');
+ var isTable$1 = $_ey7ka11qjfuw8ldg.matchNodeNames('table');
+ var isCaretContainer$1 = isCaretContainer;
+ var isCaretCandidate = function (node) {
+ if (isCaretContainer$1(node)) {
+ return false;
+ }
+ if (isText$3(node)) {
+ if (isInvalidTextElement(node.parentNode)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return ret;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ }
+ return isAtomicInline(node) || isBr$2(node) || isTable$1(node) || isNonUiContentEditableFalse(node);
+ };
+ var isUnselectable = function (node) {
+ return $_ey7ka11qjfuw8ldg.isElement(node) && node.getAttribute('unselectable') === 'true';
+ };
+ var isNonUiContentEditableFalse = function (node) {
+ return isUnselectable(node) === false && isContentEditableFalse$1(node);
+ };
+ var isInEditable = function (node, root) {
+ for (node = node.parentNode; node && node !== root; node = node.parentNode) {
+ if (isNonUiContentEditableFalse(node)) {
+ return false;
+ }
+ if (isContentEditableTrue$1(node)) {
+ return true;
+ }
+ }
+ return true;
+ };
+ var isAtomicContentEditableFalse = function (node) {
+ if (!isNonUiContentEditableFalse(node)) {
+ return false;
+ }
+ return $_djuh8tljfuw8l74.reduce(node.getElementsByTagName('*'), function (result, elm) {
+ return result || isContentEditableTrue$1(elm);
+ }, false) !== true;
+ };
+ var isAtomic = function (node) {
+ return isAtomicInline(node) || isAtomicContentEditableFalse(node);
+ };
+ var isEditableCaretCandidate = function (node, root) {
+ return isCaretCandidate(node) && isInEditable(node, root);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var siblings = function (element) {
- // TODO: Refactor out children so we can just not add self instead of filtering afterwards
- var filterSelf = function (elements) {
- return Arr.filter(elements, function (x) {
- return !Compare.eq(element, x);
- });
- };
-
- return parent(element).map(children).map(filterSelf).getOr([]);
- };
-
- var offsetParent = function (element) {
- var dom = element.dom();
- return Option.from(dom.offsetParent).map(Element.fromDom);
- };
-
- var prevSibling = function (element) {
- var dom = element.dom();
- return Option.from(dom.previousSibling).map(Element.fromDom);
- };
-
- var nextSibling = function (element) {
- var dom = element.dom();
- return Option.from(dom.nextSibling).map(Element.fromDom);
- };
-
- var prevSiblings = function (element) {
- // This one needs to be reversed, so they're still in DOM order
- return Arr.reverse(Recurse.toArray(element, prevSibling));
- };
-
- var nextSiblings = function (element) {
- return Recurse.toArray(element, nextSibling);
- };
-
- var children = function (element) {
- var dom = element.dom();
- return Arr.map(dom.childNodes, Element.fromDom);
- };
-
- var child = function (element, index) {
- var children = element.dom().childNodes;
- return Option.from(children[index]).map(Element.fromDom);
- };
-
- var firstChild = function (element) {
- return child(element, 0);
- };
-
- var lastChild = function (element) {
- return child(element, element.dom().childNodes.length - 1);
- };
-
- var spot = Struct.immutable('element', 'offset');
- var leaf = function (element, offset) {
- var cs = children(element);
- return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);
- };
-
- return {
- owner: owner,
- defaultView: defaultView,
- documentElement: documentElement,
- parent: parent,
- findIndex: findIndex,
- parents: parents,
- siblings: siblings,
- prevSibling: prevSibling,
- offsetParent: offsetParent,
- prevSiblings: prevSiblings,
- nextSibling: nextSibling,
- nextSiblings: nextSiblings,
- children: children,
- child: child,
- firstChild: firstChild,
- lastChild: lastChild,
- leaf: leaf
- };
- }
-);
-
-define(
- 'ephox.sugar.api.dom.Insert',
-
- [
- 'ephox.sugar.api.search.Traverse'
- ],
-
- function (Traverse) {
- var before = function (marker, element) {
- var parent = Traverse.parent(marker);
- parent.each(function (v) {
- v.dom().insertBefore(element.dom(), marker.dom());
- });
- };
-
- var after = function (marker, element) {
- var sibling = Traverse.nextSibling(marker);
- sibling.fold(function () {
- var parent = Traverse.parent(marker);
- parent.each(function (v) {
- append(v, element);
- });
- }, function (v) {
- before(v, element);
- });
- };
-
- var prepend = function (parent, element) {
- var firstChild = Traverse.firstChild(parent);
- firstChild.fold(function () {
- append(parent, element);
- }, function (v) {
- parent.dom().insertBefore(element.dom(), v.dom());
- });
- };
-
- var append = function (parent, element) {
- parent.dom().appendChild(element.dom());
- };
-
- var appendAt = function (parent, element, index) {
- Traverse.child(parent, index).fold(function () {
- append(parent, element);
- }, function (v) {
- before(v, element);
- });
- };
-
- var wrap = function (element, wrapper) {
- before(element, wrapper);
- append(wrapper, element);
- };
-
- return {
- before: before,
- after: after,
- prepend: prepend,
- append: append,
- appendAt: appendAt,
- wrap: wrap
- };
- }
-);
-
-define(
- 'ephox.sugar.api.dom.InsertAll',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.dom.Insert'
- ],
-
- function (Arr, Insert) {
- var before = function (marker, elements) {
- Arr.each(elements, function (x) {
- Insert.before(marker, x);
- });
- };
-
- var after = function (marker, elements) {
- Arr.each(elements, function (x, i) {
- var e = i === 0 ? marker : elements[i - 1];
- Insert.after(e, x);
- });
- };
-
- var prepend = function (parent, elements) {
- Arr.each(elements.slice().reverse(), function (x) {
- Insert.prepend(parent, x);
- });
- };
-
- var append = function (parent, elements) {
- Arr.each(elements, function (x) {
- Insert.append(parent, x);
- });
- };
-
- return {
- before: before,
- after: after,
- prepend: prepend,
- append: append
- };
- }
-);
-
-define(
- 'ephox.sugar.api.dom.Remove',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.dom.InsertAll',
- 'ephox.sugar.api.search.Traverse'
- ],
-
- function (Arr, InsertAll, Traverse) {
- var empty = function (element) {
- // shortcut "empty node" trick. Requires IE 9.
- element.dom().textContent = '';
-
- // If the contents was a single empty text node, the above doesn't remove it. But, it's still faster in general
- // than removing every child node manually.
- // The following is (probably) safe for performance as 99.9% of the time the trick works and
- // Traverse.children will return an empty array.
- Arr.each(Traverse.children(element), function (rogue) {
- remove(rogue);
- });
- };
-
- var remove = function (element) {
- var dom = element.dom();
- if (dom.parentNode !== null)
- dom.parentNode.removeChild(dom);
- };
-
- var unwrap = function (wrapper) {
- var children = Traverse.children(wrapper);
- if (children.length > 0)
- InsertAll.before(wrapper, children);
- remove(wrapper);
- };
-
- return {
- empty: empty,
- remove: remove,
- unwrap: unwrap
- };
- }
-);
-
-define(
- 'ephox.sugar.api.node.Node',
-
- [
- 'ephox.sugar.api.node.NodeTypes'
- ],
-
- function (NodeTypes) {
- var name = function (element) {
- var r = element.dom().nodeName;
- return r.toLowerCase();
- };
-
- var type = function (element) {
- return element.dom().nodeType;
- };
-
- var value = function (element) {
- return element.dom().nodeValue;
- };
-
- var isType = function (t) {
- return function (element) {
- return type(element) === t;
- };
- };
-
- var isComment = function (element) {
- return type(element) === NodeTypes.COMMENT || name(element) === '#comment';
- };
-
- var isElement = isType(NodeTypes.ELEMENT);
- var isText = isType(NodeTypes.TEXT);
- var isDocument = isType(NodeTypes.DOCUMENT);
-
- return {
- name: name,
- type: type,
- value: value,
- isElement: isElement,
- isText: isText,
- isDocument: isDocument,
- isComment: isComment
- };
- }
-);
-
-define(
- 'ephox.sugar.impl.NodeValue',
-
- [
- 'ephox.sand.api.PlatformDetection',
- 'ephox.katamari.api.Option',
- 'global!Error'
- ],
-
- function (PlatformDetection, Option, Error) {
- return function (is, name) {
- var get = function (element) {
- if (!is(element)) throw new Error('Can only get ' + name + ' value of a ' + name + ' node');
- return getOption(element).getOr('');
- };
-
- var getOptionIE10 = function (element) {
- // Prevent IE10 from throwing exception when setting parent innerHTML clobbers (TBIO-451).
- try {
- return getOptionSafe(element);
- } catch (e) {
- return Option.none();
- }
- };
-
- var getOptionSafe = function (element) {
- return is(element) ? Option.from(element.dom().nodeValue) : Option.none();
- };
-
- var browser = PlatformDetection.detect().browser;
- var getOption = browser.isIE() && browser.version.major === 10 ? getOptionIE10 : getOptionSafe;
-
- var set = function (element, value) {
- if (!is(element)) throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');
- element.dom().nodeValue = value;
- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var round = Math.round;
+ var clone$1 = function (rect) {
+ if (!rect) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- get: get,
- getOption: getOption,
- set: set
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ left: 0,
+ top: 0,
+ bottom: 0,
+ right: 0,
+ width: 0,
+ height: 0
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- }
-);
-define(
- 'ephox.sugar.api.node.Text',
-
- [
- 'ephox.sugar.api.node.Node',
- 'ephox.sugar.impl.NodeValue'
- ],
-
- function (Node, NodeValue) {
- var api = NodeValue(Node.isText, 'text');
-
- var get = function (element) {
- return api.get(element);
- };
-
- var getOption = function (element) {
- return api.getOption(element);
- };
-
- var set = function (element, value) {
- api.set(element, value);
- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- get: get,
- getOption: getOption,
- set: set
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ left: round(rect.left),
+ top: round(rect.top),
+ bottom: round(rect.bottom),
+ right: round(rect.right),
+ width: round(rect.width),
+ height: round(rect.height)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-define(
- 'ephox.sugar.api.node.Body',
-
- [
- 'ephox.katamari.api.Thunk',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.node.Node',
- 'global!document'
- ],
-
- function (Thunk, Element, Node, document) {
-
- // Node.contains() is very, very, very good performance
- // http://jsperf.com/closest-vs-contains/5
- var inBody = function (element) {
- // Technically this is only required on IE, where contains() returns false for text nodes.
- // But it's cheap enough to run everywhere and Sugar doesn't have platform detection (yet).
- var dom = Node.isText(element) ? element.dom().parentNode : element.dom();
-
- // use ownerDocument.body to ensure this works inside iframes.
- // Normally contains is bad because an element "contains" itself, but here we want that.
- return dom !== undefined && dom !== null && dom.ownerDocument.body.contains(dom);
- };
-
- var body = Thunk.cached(function() {
- return getBody(Element.fromDom(document));
- });
-
- var getBody = function (doc) {
- var body = doc.dom().body;
- if (body === null || body === undefined) throw 'Body is not available yet';
- return Element.fromDom(body);
- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var collapse = function (rect, toStart) {
+ rect = clone$1(rect);
+ if (toStart) {
+ rect.right = rect.left;
+ } else {
+ rect.left = rect.left + rect.width;
+ rect.right = rect.left;
+ }
+ rect.width = 0;
+ return rect;
+ };
+ var isEqual = function (rect1, rect2) {
+ return rect1.left === rect2.left && rect1.top === rect2.top && rect1.bottom === rect2.bottom && rect1.right === rect2.right;
+ };
+ var isValidOverflow = function (overflowY, rect1, rect2) {
+ return overflowY >= 0 && overflowY <= Math.min(rect1.height, rect2.height) / 2;
+ };
+ var isAbove = function (rect1, rect2) {
+ if (rect1.bottom - rect1.height / 2 < rect2.top) {
+ return true;
+ }
+ if (rect1.top > rect2.bottom) {
+ return false;
+ }
+ return isValidOverflow(rect2.top - rect1.bottom, rect1, rect2);
+ };
+ var isBelow = function (rect1, rect2) {
+ if (rect1.top > rect2.bottom) {
+ return true;
+ }
+ if (rect1.bottom < rect2.top) {
+ return false;
+ }
+ return isValidOverflow(rect2.bottom - rect1.top, rect1, rect2);
+ };
+ var containsXY = function (rect, clientX, clientY) {
+ return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;
+ };
+ var overflowX = function (outer, inner) {
+ if (inner.left > outer.left && inner.right < outer.right) {
+ return 0;
+ } else {
+ return inner.left < outer.left ? inner.left - outer.left : inner.right - outer.right;
+ }
+ };
+ var overflowY = function (outer, inner) {
+ if (inner.top > outer.top && inner.bottom < outer.bottom) {
+ return 0;
+ } else {
+ return inner.top < outer.top ? inner.top - outer.top : inner.bottom - outer.bottom;
+ }
+ };
+ var getOverflow = function (outer, inner) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- body: body,
- getBody: getBody,
- inBody: inBody
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ x: overflowX(outer, inner),
+ y: overflowY(outer, inner)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'ephox.sugar.api.search.PredicateFilter',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.node.Body',
- 'ephox.sugar.api.search.Traverse'
- ],
-
- function (Arr, Body, Traverse) {
- // maybe TraverseWith, similar to traverse but with a predicate?
-
- var all = function (predicate) {
- return descendants(Body.body(), predicate);
- };
-
- var ancestors = function (scope, predicate, isRoot) {
- return Arr.filter(Traverse.parents(scope, isRoot), predicate);
- };
-
- var siblings = function (scope, predicate) {
- return Arr.filter(Traverse.siblings(scope), predicate);
- };
-
- var children = function (scope, predicate) {
- return Arr.filter(Traverse.children(scope), predicate);
- };
-
- var descendants = function (scope, predicate) {
- var result = [];
-
- // Recurse.toArray() might help here
- Arr.each(Traverse.children(scope), function (x) {
- if (predicate(x)) {
- result = result.concat([ x ]);
- }
- result = result.concat(descendants(x, predicate));
- });
- return result;
- };
-
- return {
- all: all,
- ancestors: ancestors,
- siblings: siblings,
- children: children,
- descendants: descendants
- };
- }
-);
-
-define(
- 'ephox.sugar.api.search.SelectorFilter',
-
- [
- 'ephox.sugar.api.search.PredicateFilter',
- 'ephox.sugar.api.search.Selectors'
- ],
-
- function (PredicateFilter, Selectors) {
- var all = function (selector) {
- return Selectors.all(selector);
- };
-
- // For all of the following:
- //
- // jQuery does siblings of firstChild. IE9+ supports scope.dom().children (similar to Traverse.children but elements only).
- // Traverse should also do this (but probably not by default).
- //
-
- var ancestors = function (scope, selector, isRoot) {
- // It may surprise you to learn this is exactly what JQuery does
- // TODO: Avoid all this wrapping and unwrapping
- return PredicateFilter.ancestors(scope, function (e) {
- return Selectors.is(e, selector);
- }, isRoot);
- };
-
- var siblings = function (scope, selector) {
- // It may surprise you to learn this is exactly what JQuery does
- // TODO: Avoid all the wrapping and unwrapping
- return PredicateFilter.siblings(scope, function (e) {
- return Selectors.is(e, selector);
- });
- };
-
- var children = function (scope, selector) {
- // It may surprise you to learn this is exactly what JQuery does
- // TODO: Avoid all the wrapping and unwrapping
- return PredicateFilter.children(scope, function (e) {
- return Selectors.is(e, selector);
- });
- };
-
- var descendants = function (scope, selector) {
- return Selectors.all(selector, scope);
- };
-
- return {
- all: all,
- ancestors: ancestors,
- siblings: siblings,
- children: children,
- descendants: descendants
- };
- }
-);
-
-/**
- * ElementType.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.ElementType',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.sugar.api.node.Node'
- ],
- function (Arr, Fun, Node) {
- var blocks = [
- 'article', 'aside', 'details', 'div', 'dt', 'figcaption', 'footer',
- 'form', 'fieldset', 'header', 'hgroup', 'html', 'main', 'nav',
- 'section', 'summary', 'body', 'p', 'dl', 'multicol', 'dd', 'figure',
- 'address', 'center', 'blockquote', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
- 'listing', 'xmp', 'pre', 'plaintext', 'menu', 'dir', 'ul', 'ol', 'li', 'hr',
- 'table', 'tbody', 'thead', 'tfoot', 'th', 'tr', 'td', 'caption'
- ];
-
- var voids = [
- 'area', 'base', 'basefont', 'br', 'col', 'frame', 'hr', 'img', 'input',
- 'isindex', 'link', 'meta', 'param', 'embed', 'source', 'wbr', 'track'
- ];
-
- var tableCells = ['td', 'th'];
- var tableSections = ['thead', 'tbody', 'tfoot'];
-
- var textBlocks = [
- 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'div', 'address', 'pre', 'form',
- 'blockquote', 'center', 'dir', 'fieldset', 'header', 'footer', 'article',
- 'section', 'hgroup', 'aside', 'nav', 'figure'
- ];
-
- var headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
- var listItems = ['li', 'dd', 'dt'];
- var lists = ['ul', 'ol', 'dl'];
-
- var lazyLookup = function (items) {
- var lookup;
- return function (node) {
- lookup = lookup ? lookup : Arr.mapToObject(items, Fun.constant(true));
- return lookup.hasOwnProperty(Node.name(node));
- };
- };
-
- var isHeading = lazyLookup(headings);
-
- var isBlock = lazyLookup(blocks);
-
- var isInline = function (node) {
- return Node.isElement(node) && !isBlock(node);
- };
-
- var isBr = function (node) {
- return Node.isElement(node) && Node.name(node) === 'br';
- };
-
- return {
- isBlock: isBlock,
- isInline: isInline,
- isHeading: isHeading,
- isTextBlock: lazyLookup(textBlocks),
- isList: lazyLookup(lists),
- isListItem: lazyLookup(listItems),
- isVoid: lazyLookup(voids),
- isTableSection: lazyLookup(tableSections),
- isTableCell: lazyLookup(tableCells),
- isBr: isBr
- };
- }
-);
-
-/**
- * PaddingBr.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.PaddingBr',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.dom.Insert',
- 'ephox.sugar.api.dom.Remove',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.node.Node',
- 'ephox.sugar.api.node.Text',
- 'ephox.sugar.api.search.SelectorFilter',
- 'ephox.sugar.api.search.Traverse',
- 'tinymce.core.dom.ElementType'
- ],
- function (Arr, Insert, Remove, Element, Node, Text, SelectorFilter, Traverse, ElementType) {
- var getLastChildren = function (elm) {
- var children = [], rawNode = elm.dom();
-
- while (rawNode) {
- children.push(Element.fromDom(rawNode));
- rawNode = rawNode.lastChild;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getSelectedNode = function (range) {
+ var startContainer = range.startContainer, startOffset = range.startOffset;
+ if (startContainer.hasChildNodes() && range.endOffset === startOffset + 1) {
+ return startContainer.childNodes[startOffset];
+ }
+ return null;
+ };
+ var getNode = function (container, offset) {
+ if (container.nodeType === 1 && container.hasChildNodes()) {
+ if (offset >= container.childNodes.length) {
+ offset = container.childNodes.length - 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = container.childNodes[offset];
+ }
+ return container;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return children;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var extendingChars = new RegExp('[\u0300-\u036f\u0483-\u0487\u0488-\u0489\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a' + '\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0' + '\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08E3-\u0902\u093a\u093c' + '\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2-\u09e3' + '\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc' + '\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57' + '\u0b62-\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c00\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56' + '\u0c62-\u0c63\u0c81\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc-\u0ccd\u0cd5-\u0cd6\u0ce2-\u0ce3\u0d01\u0d3e\u0d41-\u0d44' + '\u0d4
d\u0d57\u0d62-\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9' + '\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97' + '\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074' + '\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5' + '\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18' + '\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1ab0-\u1abd\u1ABE\u1b00-\u1b03\u1b34' + '\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab-\u1bad\u1be6\u1be8-\u1be9' + '\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1cf8-\u1cf9' + '\u1dc0-\u1df5\u1dfc-\u1dff\u200c-\u200d\u20d0-\u20dc\u20DD-\u20E0\u20e1\u20E2-\u2
0E4\u20e5-\u20f0\u2cef-\u2cf1' + '\u2d7f\u2de0-\u2dff\u302a-\u302d\u302e-\u302f\u3099-\u309a\ua66f\uA670-\uA672\ua674-\ua67d\uA69E-\ua69f\ua6f0-\ua6f1' + '\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc' + '\ua9e5\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaa7c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1' + '\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\uFE2F\uff9e-\uff9f]');
+ var isExtendingChar = function (ch) {
+ return typeof ch === 'string' && ch.charCodeAt(0) >= 768 && extendingChars.test(ch);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var removeTrailingBr = function (elm) {
- var allBrs = SelectorFilter.descendants(elm, 'br');
- var brs = Arr.filter(getLastChildren(elm).slice(-1), ElementType.isBr);
- if (allBrs.length === brs.length) {
- Arr.each(brs, Remove.remove);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var slice$3 = [].slice;
+ var constant$1 = function (value) {
+ return function () {
+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var fillWithPaddingBr = function (elm) {
- Remove.empty(elm);
- Insert.append(elm, Element.fromHtml('<br data-mce-bogus="1">'));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var negate = function (predicate) {
+ return function (x) {
+ return !predicate(x);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isPaddingContents = function (elm) {
- return Node.isText(elm) ? Text.get(elm) === '\u00a0' : ElementType.isBr(elm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var compose$2 = function (f, g) {
+ return function (x) {
+ return f(g(x));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isPaddedElement = function (elm) {
- return Arr.filter(Traverse.children(elm), isPaddingContents).length === 1;
- };
-
- var trimBlockTrailingBr = function (elm) {
- Traverse.lastChild(elm).each(function (lastChild) {
- Traverse.prevSibling(lastChild).each(function (lastChildPrevSibling) {
- if (ElementType.isBlock(elm) && ElementType.isBr(lastChild) && ElementType.isBlock(lastChildPrevSibling)) {
- Remove.remove(lastChild);
- }
- });
- });
- };
-
- return {
- removeTrailingBr: removeTrailingBr,
- fillWithPaddingBr: fillWithPaddingBr,
- isPaddedElement: isPaddedElement,
- trimBlockTrailingBr: trimBlockTrailingBr
- };
- }
-);
-/**
- * FormatUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.fmt.FormatUtils',
- [
- 'tinymce.core.dom.TreeWalker'
- ],
- function (TreeWalker) {
- var isInlineBlock = function (node) {
- return node && /^(IMG)$/.test(node.nodeName);
- };
-
- var moveStart = function (dom, selection, rng) {
- var container = rng.startContainer,
- offset = rng.startOffset,
- walker, node, nodes;
-
- if (rng.startContainer === rng.endContainer) {
- if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var or = function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ var args = slice$3.call(arguments);
+ return function (x) {
+ for (var i = 0; i < args.length; i++) {
+ if (args[i](x)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Convert text node into index if possible
- if (container.nodeType === 3 && offset >= container.nodeValue.length) {
- // Get the parent container location and walk from there
- offset = dom.nodeIndex(container);
- container = container.parentNode;
- }
-
- // Move startContainer/startOffset in to a suitable node
- if (container.nodeType === 1) {
- nodes = container.childNodes;
- if (offset < nodes.length) {
- container = nodes[offset];
- walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));
- } else {
- container = nodes[nodes.length - 1];
- walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));
- walker.next(true);
- }
-
- for (node = walker.current(); node; node = walker.next()) {
- if (node.nodeType === 3 && !isWhiteSpaceNode(node)) {
- rng.setStart(node, 0);
- selection.setRng(rng);
-
- return;
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the next/previous non whitespace node.
- *
- * @private
- * @param {Node} node Node to start at.
- * @param {boolean} next (Optional) Include next or previous node defaults to previous.
- * @param {boolean} inc (Optional) Include the current node in checking. Defaults to false.
- * @return {Node} Next or previous node or undefined if it wasn't found.
- */
- var getNonWhiteSpaceSibling = function (node, next, inc) {
- if (node) {
- next = next ? 'nextSibling' : 'previousSibling';
-
- for (node = inc ? node : node[next]; node; node = node[next]) {
- if (node.nodeType === 1 || !isWhiteSpaceNode(node)) {
- return node;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var and = function () {
+ var x = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ x[_i] = arguments[_i];
+ }
+ var args = slice$3.call(arguments);
+ return function (x) {
+ for (var i = 0; i < args.length; i++) {
+ if (!args[i](x)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isTextBlock = function (editor, name) {
- if (name.nodeType) {
- name = name.nodeName;
- }
-
- return !!editor.schema.getTextBlockElements()[name.toLowerCase()];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var curry$1 = function (fn) {
+ var x = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ x[_i - 1] = arguments[_i];
+ }
+ var args = slice$3.call(arguments);
+ if (args.length - 1 >= fn.length) {
+ return fn.apply(this, args.slice(1));
+ }
+ return function () {
+ var tempArgs = args.concat([].slice.call(arguments));
+ return curry$1.apply(this, tempArgs);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var noop$1 = function () {
+ };
+ var $_ebfy8j25jfuw8li1 = {
+ constant: constant$1,
+ negate: negate,
+ and: and,
+ or: or,
+ curry: curry$1,
+ compose: compose$2,
+ noop: noop$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isValid = function (ed, parent, child) {
- return ed.schema.isValidChild(parent, child);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var cat = function (arr) {
+ var r = [];
+ var push = function (x) {
+ r.push(x);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isWhiteSpaceNode = function (node) {
- return node && node.nodeType === 3 && /^([\t \r\n]+|)$/.test(node.nodeValue);
- };
-
- /**
- * Replaces variables in the value. The variable format is %var.
- *
- * @private
- * @param {String} value Value to replace variables in.
- * @param {Object} vars Name/value array with variables to replace.
- * @return {String} New value with replaced variables.
- */
- var replaceVars = function (value, vars) {
- if (typeof value !== "string") {
- value = value(vars);
- } else if (vars) {
- value = value.replace(/%(\w+)/g, function (str, name) {
- return vars[name] || str;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (var i = 0; i < arr.length; i++) {
+ arr[i].each(push);
+ }
+ return r;
+ };
+ var findMap = function (arr, f) {
+ for (var i = 0; i < arr.length; i++) {
+ var r = f(arr[i], i);
+ if (r.isSome()) {
+ return r;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return value;
- };
-
- /**
- * Compares two string/nodes regardless of their case.
- *
- * @private
- * @param {String/Node} str1 Node or string to compare.
- * @param {String/Node} str2 Node or string to compare.
- * @return {boolean} True/false if they match.
- */
- var isEq = function (str1, str2) {
- str1 = str1 || '';
- str2 = str2 || '';
-
- str1 = '' + (str1.nodeName || str1);
- str2 = '' + (str2.nodeName || str2);
-
- return str1.toLowerCase() === str2.toLowerCase();
- };
-
- var normalizeStyleValue = function (dom, value, name) {
- // Force the format to hex
- if (name === 'color' || name === 'backgroundColor') {
- value = dom.toHex(value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return Option.none();
+ };
+ var liftN = function (arr, f) {
+ var r = [];
+ for (var i = 0; i < arr.length; i++) {
+ var x = arr[i];
+ if (x.isSome()) {
+ r.push(x.getOrDie());
+ } else {
+ return Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return Option.some(f.apply(null, r));
+ };
+ var $_5gv5dd26jfuw8li3 = {
+ cat: cat,
+ findMap: findMap,
+ liftN: liftN
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Opera will return bold as 700
- if (name === 'fontWeight' && value === 700) {
- value = 'bold';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isElement$3 = $_ey7ka11qjfuw8ldg.isElement;
+ var isCaretCandidate$1 = isCaretCandidate;
+ var isBlock$1 = $_ey7ka11qjfuw8ldg.matchStyleValues('display', 'block table');
+ var isFloated = $_ey7ka11qjfuw8ldg.matchStyleValues('float', 'left right');
+ var isValidElementCaretCandidate = $_ebfy8j25jfuw8li1.and(isElement$3, isCaretCandidate$1, $_ebfy8j25jfuw8li1.negate(isFloated));
+ var isNotPre = $_ebfy8j25jfuw8li1.negate($_ey7ka11qjfuw8ldg.matchStyleValues('white-space', 'pre pre-line pre-wrap'));
+ var isText$4 = $_ey7ka11qjfuw8ldg.isText;
+ var isBr$3 = $_ey7ka11qjfuw8ldg.isBr;
+ var nodeIndex = DOMUtils$1.nodeIndex;
+ var resolveIndex = getNode;
+ var createRange = function (doc) {
+ return 'createRange' in doc ? doc.createRange() : DOMUtils$1.DOM.createRng();
+ };
+ var isWhiteSpace = function (chr) {
+ return chr && /[\r\n\t ]/.test(chr);
+ };
+ var isRange = function (rng) {
+ return !!rng.setStart && !!rng.setEnd;
+ };
+ var isHiddenWhiteSpaceRange = function (range) {
+ var container = range.startContainer;
+ var offset = range.startOffset;
+ var text;
+ if (isWhiteSpace(range.toString()) && isNotPre(container.parentNode) && $_ey7ka11qjfuw8ldg.isText(container)) {
+ text = container.data;
+ if (isWhiteSpace(text[offset - 1]) || isWhiteSpace(text[offset + 1])) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Normalize fontFamily so "'Font name', Font" becomes: "Font name,Font"
- if (name === 'fontFamily') {
- value = value.replace(/[\'\"]/g, '').replace(/,\s+/g, ',');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return false;
+ };
+ var getBrClientRect = function (brNode) {
+ var doc = brNode.ownerDocument;
+ var rng = createRange(doc);
+ var nbsp = doc.createTextNode('\xA0');
+ var parentNode = brNode.parentNode;
+ var clientRect;
+ parentNode.insertBefore(nbsp, brNode);
+ rng.setStart(nbsp, 0);
+ rng.setEnd(nbsp, 1);
+ clientRect = clone$1(rng.getBoundingClientRect());
+ parentNode.removeChild(nbsp);
+ return clientRect;
+ };
+ var getBoundingClientRectWebKitText = function (rng) {
+ var sc = rng.startContainer;
+ var ec = rng.endContainer;
+ var so = rng.startOffset;
+ var eo = rng.endOffset;
+ if (sc === ec && $_ey7ka11qjfuw8ldg.isText(ec) && so === 0 && eo === 1) {
+ var newRng = rng.cloneRange();
+ newRng.setEndAfter(ec);
+ return getBoundingClientRect(newRng);
+ } else {
+ return null;
+ }
+ };
+ var isZeroRect = function (r) {
+ return r.left === 0 && r.right === 0 && r.top === 0 && r.bottom === 0;
+ };
+ var getBoundingClientRect = function (item) {
+ var clientRect, clientRects;
+ clientRects = item.getClientRects();
+ if (clientRects.length > 0) {
+ clientRect = clone$1(clientRects[0]);
+ } else {
+ clientRect = clone$1(item.getBoundingClientRect());
+ }
+ if (!isRange(item) && isBr$3(item) && isZeroRect(clientRect)) {
+ return getBrClientRect(item);
+ }
+ if (isZeroRect(clientRect) && isRange(item)) {
+ return getBoundingClientRectWebKitText(item);
+ }
+ return clientRect;
+ };
+ var collapseAndInflateWidth = function (clientRect, toStart) {
+ var newClientRect = collapse(clientRect, toStart);
+ newClientRect.width = 1;
+ newClientRect.right = newClientRect.left + 1;
+ return newClientRect;
+ };
+ var getCaretPositionClientRects = function (caretPosition) {
+ var clientRects = [];
+ var beforeNode, node;
+ var addUniqueAndValidRect = function (clientRect) {
+ if (clientRect.height === 0) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return '' + value;
- };
-
- var getStyle = function (dom, node, name) {
- return normalizeStyleValue(dom, dom.getStyle(node, name), name);
- };
-
- var getTextDecoration = function (dom, node) {
- var decoration;
-
- dom.getParent(node, function (n) {
- decoration = dom.getStyle(n, 'text-decoration');
- return decoration && decoration !== 'none';
- });
-
- return decoration;
- };
-
- var getParents = function (dom, node, selector) {
- return dom.getParents(node, selector, dom.getRoot());
- };
-
- return {
- isInlineBlock: isInlineBlock,
- moveStart: moveStart,
- getNonWhiteSpaceSibling: getNonWhiteSpaceSibling,
- isTextBlock: isTextBlock,
- isValid: isValid,
- isWhiteSpaceNode: isWhiteSpaceNode,
- replaceVars: replaceVars,
- isEq: isEq,
- normalizeStyleValue: normalizeStyleValue,
- getStyle: getStyle,
- getTextDecoration: getTextDecoration,
- getParents: getParents
- };
- }
-);
-/**
- * ExpandRange.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.fmt.ExpandRange',
- [
- 'tinymce.core.dom.BookmarkManager',
- 'tinymce.core.dom.TreeWalker',
- 'tinymce.core.fmt.FormatUtils'
- ],
- function (BookmarkManager, TreeWalker, FormatUtils) {
- var isBookmarkNode = BookmarkManager.isBookmarkNode;
- var getParents = FormatUtils.getParents, isWhiteSpaceNode = FormatUtils.isWhiteSpaceNode, isTextBlock = FormatUtils.isTextBlock;
-
- // This function walks down the tree to find the leaf at the selection.
- // The offset is also returned as if node initially a leaf, the offset may be in the middle of the text node.
- var findLeaf = function (node, offset) {
- if (typeof offset === 'undefined') {
- offset = node.nodeType === 3 ? node.length : node.childNodes.length;
- }
-
- while (node && node.hasChildNodes()) {
- node = node.childNodes[offset];
- if (node) {
- offset = node.nodeType === 3 ? node.length : node.childNodes.length;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (clientRects.length > 0) {
+ if (isEqual(clientRect, clientRects[clientRects.length - 1])) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return { node: node, offset: offset };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ clientRects.push(clientRect);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var excludeTrailingWhitespace = function (endContainer, endOffset) {
- // Avoid applying formatting to a trailing space,
- // but remove formatting from trailing space
- var leaf = findLeaf(endContainer, endOffset);
- if (leaf.node) {
- while (leaf.node && leaf.offset === 0 && leaf.node.previousSibling) {
- leaf = findLeaf(leaf.node.previousSibling);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addCharacterOffset = function (container, offset) {
+ var range = createRange(container.ownerDocument);
+ if (offset < container.data.length) {
+ if (isExtendingChar(container.data[offset])) {
+ return clientRects;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (leaf.node && leaf.offset > 0 && leaf.node.nodeType === 3 &&
- leaf.node.nodeValue.charAt(leaf.offset - 1) === ' ') {
-
- if (leaf.offset > 1) {
- endContainer = leaf.node;
- endContainer.splitText(leaf.offset - 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isExtendingChar(container.data[offset - 1])) {
+ range.setStart(container, offset);
+ range.setEnd(container, offset + 1);
+ if (!isHiddenWhiteSpaceRange(range)) {
+ addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false));
+ return clientRects;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return endContainer;
- };
-
- var isBogusBr = function (node) {
- return node.nodeName === "BR" && node.getAttribute('data-mce-bogus') && !node.nextSibling;
- };
-
- var expandRng = function (editor, rng, format, remove) {
- var lastIdx, endPoint,
- startContainer = rng.startContainer,
- startOffset = rng.startOffset,
- endContainer = rng.endContainer,
- endOffset = rng.endOffset,
- dom = editor.dom;
-
- // This function walks up the tree if there is no siblings before/after the node
- var findParentContainer = function (start) {
- var container, parent, sibling, siblingName, root;
-
- container = parent = start ? startContainer : endContainer;
- siblingName = start ? 'previousSibling' : 'nextSibling';
- root = dom.getRoot();
-
- // If it's a text node and the offset is inside the text
- if (container.nodeType === 3 && !isWhiteSpaceNode(container)) {
- if (start ? startOffset > 0 : endOffset < container.nodeValue.length) {
- return container;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (offset > 0) {
+ range.setStart(container, offset - 1);
+ range.setEnd(container, offset);
+ if (!isHiddenWhiteSpaceRange(range)) {
+ addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), false));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /*eslint no-constant-condition:0 */
- while (true) {
- // Stop expanding on block elements
- if (!format[0].block_expand && dom.isBlock(parent)) {
- return parent;
- }
-
- // Walk left/right
- for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {
- if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling) && !isBogusBr(sibling)) {
- return parent;
- }
- }
-
- // Check if we can move up are we at root level or body level
- if (parent === root || parent.parentNode === root) {
- container = parent;
- break;
- }
-
- parent = parent.parentNode;
- }
-
- return container;
- };
-
- // If index based start position then resolve it
- if (startContainer.nodeType === 1 && startContainer.hasChildNodes()) {
- lastIdx = startContainer.childNodes.length - 1;
- startContainer = startContainer.childNodes[startOffset > lastIdx ? lastIdx : startOffset];
-
- if (startContainer.nodeType === 3) {
- startOffset = 0;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // If index based end position then resolve it
- if (endContainer.nodeType === 1 && endContainer.hasChildNodes()) {
- lastIdx = endContainer.childNodes.length - 1;
- endContainer = endContainer.childNodes[endOffset > lastIdx ? lastIdx : endOffset - 1];
-
- if (endContainer.nodeType === 3) {
- endOffset = endContainer.nodeValue.length;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (offset < container.data.length) {
+ range.setStart(container, offset);
+ range.setEnd(container, offset + 1);
+ if (!isHiddenWhiteSpaceRange(range)) {
+ addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(range), true));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Expands the node to the closes contentEditable false element if it exists
- var findParentContentEditable = function (node) {
- var parent = node;
-
- while (parent) {
- if (parent.nodeType === 1 && dom.getContentEditable(parent)) {
- return dom.getContentEditable(parent) === "false" ? parent : node;
- }
-
- parent = parent.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (isText$4(caretPosition.container())) {
+ addCharacterOffset(caretPosition.container(), caretPosition.offset());
+ return clientRects;
+ }
+ if (isElement$3(caretPosition.container())) {
+ if (caretPosition.isAtEnd()) {
+ node = resolveIndex(caretPosition.container(), caretPosition.offset());
+ if (isText$4(node)) {
+ addCharacterOffset(node, node.data.length);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return node;
- };
-
- var findWordEndPoint = function (container, offset, start) {
- var walker, node, pos, lastTextNode;
-
- var findSpace = function (node, offset) {
- var pos, pos2, str = node.nodeValue;
-
- if (typeof offset === "undefined") {
- offset = start ? str.length : 0;
- }
-
- if (start) {
- pos = str.lastIndexOf(' ', offset);
- pos2 = str.lastIndexOf('\u00a0', offset);
- pos = pos > pos2 ? pos : pos2;
-
- // Include the space on remove to avoid tag soup
- if (pos !== -1 && !remove) {
- pos++;
- }
- } else {
- pos = str.indexOf(' ', offset);
- pos2 = str.indexOf('\u00a0', offset);
- pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2;
- }
-
- return pos;
- };
-
- if (container.nodeType === 3) {
- pos = findSpace(container, offset);
-
- if (pos !== -1) {
- return { container: container, offset: pos };
- }
-
- lastTextNode = container;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isValidElementCaretCandidate(node) && !isBr$3(node)) {
+ addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), false));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Walk the nodes inside the block
- walker = new TreeWalker(container, dom.getParent(container, dom.isBlock) || editor.getBody());
- while ((node = walker[start ? 'prev' : 'next']())) {
- if (node.nodeType === 3) {
- lastTextNode = node;
- pos = findSpace(node);
-
- if (pos !== -1) {
- return { container: node, offset: pos };
- }
- } else if (dom.isBlock(node)) {
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ node = resolveIndex(caretPosition.container(), caretPosition.offset());
+ if (isText$4(node)) {
+ addCharacterOffset(node, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (lastTextNode) {
- if (start) {
- offset = 0;
- } else {
- offset = lastTextNode.length;
- }
-
- return { container: lastTextNode, offset: offset };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isValidElementCaretCandidate(node) && caretPosition.isAtEnd()) {
+ addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), false));
+ return clientRects;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var findSelectorEndPoint = function (container, siblingName) {
- var parents, i, y, curFormat;
-
- if (container.nodeType === 3 && container.nodeValue.length === 0 && container[siblingName]) {
- container = container[siblingName];
- }
-
- parents = getParents(dom, container);
- for (i = 0; i < parents.length; i++) {
- for (y = 0; y < format.length; y++) {
- curFormat = format[y];
-
- // If collapsed state is set then skip formats that doesn't match that
- if ("collapsed" in curFormat && curFormat.collapsed !== rng.collapsed) {
- continue;
- }
-
- if (dom.is(parents[i], curFormat.selector)) {
- return parents[i];
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ beforeNode = resolveIndex(caretPosition.container(), caretPosition.offset() - 1);
+ if (isValidElementCaretCandidate(beforeNode) && !isBr$3(beforeNode)) {
+ if (isBlock$1(beforeNode) || isBlock$1(node) || !isValidElementCaretCandidate(node)) {
+ addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(beforeNode), false));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return container;
- };
-
- var findBlockEndPoint = function (container, siblingName) {
- var node, root = dom.getRoot();
-
- // Expand to block of similar type
- if (!format[0].wrapper) {
- node = dom.getParent(container, format[0].block, root);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isValidElementCaretCandidate(node)) {
+ addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect(node), true));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Expand to first wrappable block element or any block element
- if (!node) {
- var scopeRoot = dom.getParent(container, 'LI,TD,TH');
- node = dom.getParent(container.nodeType === 3 ? container.parentNode : container, function (node) {
- // Fixes #6183 where it would expand to editable parent element in inline mode
- return node !== root && isTextBlock(editor, node);
- }, scopeRoot);
- }
-
- // Exclude inner lists from wrapping
- if (node && format[0].wrapper) {
- node = getParents(dom, node, 'ul,ol').reverse()[0] || node;
- }
-
- // Didn't find a block element look for first/last wrappable element
- if (!node) {
- node = container;
-
- while (node[siblingName] && !dom.isBlock(node[siblingName])) {
- node = node[siblingName];
-
- // Break on BR but include it will be removed later on
- // we can't remove it now since we need to check if it can be wrapped
- if (FormatUtils.isEq(node, 'br')) {
- break;
- }
- }
- }
-
- return node || container;
- };
-
- // Expand to closest contentEditable element
- startContainer = findParentContentEditable(startContainer);
- endContainer = findParentContentEditable(endContainer);
-
- // Exclude bookmark nodes if possible
- if (isBookmarkNode(startContainer.parentNode) || isBookmarkNode(startContainer)) {
- startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode;
- startContainer = startContainer.nextSibling || startContainer;
-
- if (startContainer.nodeType === 3) {
- startOffset = 0;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isBookmarkNode(endContainer.parentNode) || isBookmarkNode(endContainer)) {
- endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode;
- endContainer = endContainer.previousSibling || endContainer;
-
- if (endContainer.nodeType === 3) {
- endOffset = endContainer.length;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return clientRects;
+ };
+ function CaretPosition(container, offset, clientRects) {
+ var isAtStart = function () {
+ if (isText$4(container)) {
+ return offset === 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (format[0].inline) {
- if (rng.collapsed) {
- // Expand left to closest word boundary
- endPoint = findWordEndPoint(startContainer, startOffset, true);
- if (endPoint) {
- startContainer = endPoint.container;
- startOffset = endPoint.offset;
- }
-
- // Expand right to closest word boundary
- endPoint = findWordEndPoint(endContainer, endOffset);
- if (endPoint) {
- endContainer = endPoint.container;
- endOffset = endPoint.offset;
- }
- }
-
- endContainer = remove ? endContainer : excludeTrailingWhitespace(endContainer, endOffset);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return offset === 0;
+ };
+ var isAtEnd = function () {
+ if (isText$4(container)) {
+ return offset >= container.data.length;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Move start/end point up the tree if the leaves are sharp and if we are in different containers
- // Example * becomes !: !<p><b><i>*text</i><i>text*</i></b></p>!
- // This will reduce the number of wrapper elements that needs to be created
- // Move start point up the tree
- if (format[0].inline || format[0].block_expand) {
- if (!format[0].inline || (startContainer.nodeType !== 3 || startOffset === 0)) {
- startContainer = findParentContainer(true);
- }
-
- if (!format[0].inline || (endContainer.nodeType !== 3 || endOffset === endContainer.nodeValue.length)) {
- endContainer = findParentContainer();
- }
- }
-
- // Expand start/end container to matching selector
- if (format[0].selector && format[0].expand !== false && !format[0].inline) {
- // Find new startContainer/endContainer if there is better one
- startContainer = findSelectorEndPoint(startContainer, 'previousSibling');
- endContainer = findSelectorEndPoint(endContainer, 'nextSibling');
- }
-
- // Expand start/end container to matching block element or text node
- if (format[0].block || format[0].selector) {
- // Find new startContainer/endContainer if there is better one
- startContainer = findBlockEndPoint(startContainer, 'previousSibling');
- endContainer = findBlockEndPoint(endContainer, 'nextSibling');
-
- // Non block element then try to expand up the leaf
- if (format[0].block) {
- if (!dom.isBlock(startContainer)) {
- startContainer = findParentContainer(true);
- }
-
- if (!dom.isBlock(endContainer)) {
- endContainer = findParentContainer();
- }
- }
- }
-
- // Setup index for startContainer
- if (startContainer.nodeType === 1) {
- startOffset = dom.nodeIndex(startContainer);
- startContainer = startContainer.parentNode;
- }
-
- // Setup index for endContainer
- if (endContainer.nodeType === 1) {
- endOffset = dom.nodeIndex(endContainer) + 1;
- endContainer = endContainer.parentNode;
- }
-
- // Return new range like object
- return {
- startContainer: startContainer,
- startOffset: startOffset,
- endContainer: endContainer,
- endOffset: endOffset
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return offset >= container.childNodes.length;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- expandRng: expandRng
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toRange = function () {
+ var range;
+ range = createRange(container.ownerDocument);
+ range.setStart(container, offset);
+ range.setEnd(container, offset);
+ return range;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * MatchFormat.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.fmt.MatchFormat',
- [
- 'tinymce.core.fmt.FormatUtils'
- ],
- function (FormatUtils) {
- var isEq = FormatUtils.isEq;
-
- var matchesUnInheritedFormatSelector = function (ed, node, name) {
- var formatList = ed.formatter.get(name);
-
- if (formatList) {
- for (var i = 0; i < formatList.length; i++) {
- if (formatList[i].inherit === false && ed.dom.is(node, formatList[i].selector)) {
- return true;
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getClientRects = function () {
+ if (!clientRects) {
+ clientRects = getCaretPositionClientRects(CaretPosition(container, offset));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return clientRects;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var matchParents = function (editor, node, name, vars) {
- var root = editor.dom.getRoot();
-
- if (node === root) {
- return false;
- }
-
- // Find first node with similar format settings
- node = editor.dom.getParent(node, function (node) {
- if (matchesUnInheritedFormatSelector(editor, node, name)) {
- return true;
- }
-
- return node.parentNode === root || !!matchNode(editor, node, name, vars, true);
- });
-
- // Do an exact check on the similar format element
- return matchNode(editor, node, name, vars);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isVisible = function () {
+ return getClientRects().length > 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var matchName = function (dom, node, format) {
- // Check for inline match
- if (isEq(node, format.inline)) {
- return true;
- }
-
- // Check for block match
- if (isEq(node, format.block)) {
- return true;
- }
-
- // Check for selector match
- if (format.selector) {
- return node.nodeType === 1 && dom.is(node, format.selector);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isEqual$$1 = function (caretPosition) {
+ return caretPosition && container === caretPosition.container() && offset === caretPosition.offset();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var matchItems = function (dom, node, format, itemName, similar, vars) {
- var key, value, items = format[itemName], i;
-
- // Custom match
- if (format.onmatch) {
- return format.onmatch(node, format, itemName);
- }
-
- // Check all items
- if (items) {
- // Non indexed object
- if (typeof items.length === 'undefined') {
- for (key in items) {
- if (items.hasOwnProperty(key)) {
- if (itemName === 'attributes') {
- value = dom.getAttrib(node, key);
- } else {
- value = FormatUtils.getStyle(dom, node, key);
- }
-
- if (similar && !value && !format.exact) {
- return;
- }
-
- if ((!similar || format.exact) && !isEq(value, FormatUtils.normalizeStyleValue(dom, FormatUtils.replaceVars(items[key], vars), key))) {
- return;
- }
- }
- }
- } else {
- // Only one match needed for indexed arrays
- for (i = 0; i < items.length; i++) {
- if (itemName === 'attributes' ? dom.getAttrib(node, items[i]) : FormatUtils.getStyle(dom, node, items[i])) {
- return format;
- }
- }
- }
- }
-
- return format;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getNode$$1 = function (before) {
+ return resolveIndex(container, before ? offset - 1 : offset);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var matchNode = function (ed, node, name, vars, similar) {
- var formatList = ed.formatter.get(name), format, i, x, classes, dom = ed.dom;
-
- if (formatList && node) {
- // Check each format in list
- for (i = 0; i < formatList.length; i++) {
- format = formatList[i];
-
- // Name name, attributes, styles and classes
- if (matchName(ed.dom, node, format) && matchItems(dom, node, format, 'attributes', similar, vars) && matchItems(dom, node, format, 'styles', similar, vars)) {
- // Match classes
- if ((classes = format.classes)) {
- for (x = 0; x < classes.length; x++) {
- if (!ed.dom.hasClass(node, classes[x])) {
- return;
- }
- }
- }
-
- return format;
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return {
+ container: $_ebfy8j25jfuw8li1.constant(container),
+ offset: $_ebfy8j25jfuw8li1.constant(offset),
+ toRange: toRange,
+ getClientRects: getClientRects,
+ isVisible: isVisible,
+ isAtStart: isAtStart,
+ isAtEnd: isAtEnd,
+ isEqual: isEqual$$1,
+ getNode: getNode$$1
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var match = function (editor, name, vars, node) {
- var startNode;
-
- // Check specified node
- if (node) {
- return matchParents(editor, node, name, vars);
- }
-
- // Check selected node
- node = editor.selection.getNode();
- if (matchParents(editor, node, name, vars)) {
- return true;
- }
-
- // Check start node if it's different
- startNode = editor.selection.getStart();
- if (startNode !== node) {
- if (matchParents(editor, startNode, name, vars)) {
- return true;
- }
- }
-
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ (function (CaretPosition) {
+ CaretPosition.fromRangeStart = function (range) {
+ return CaretPosition(range.startContainer, range.startOffset);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var matchAll = function (editor, names, vars) {
- var startElement, matchedFormatNames = [], checkedMap = {};
-
- // Check start of selection for formats
- startElement = editor.selection.getStart();
- editor.dom.getParent(startElement, function (node) {
- var i, name;
-
- for (i = 0; i < names.length; i++) {
- name = names[i];
-
- if (!checkedMap[name] && matchNode(editor, node, name, vars)) {
- checkedMap[name] = true;
- matchedFormatNames.push(name);
- }
- }
- }, editor.dom.getRoot());
-
- return matchedFormatNames;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CaretPosition.fromRangeEnd = function (range) {
+ return CaretPosition(range.endContainer, range.endOffset);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var canApply = function (editor, name) {
- var formatList = editor.formatter.get(name), startNode, parents, i, x, selector, dom = editor.dom;
-
- if (formatList) {
- startNode = editor.selection.getStart();
- parents = FormatUtils.getParents(dom, startNode);
-
- for (x = formatList.length - 1; x >= 0; x--) {
- selector = formatList[x].selector;
-
- // Format is not selector based then always return TRUE
- // Is it has a defaultBlock then it's likely it can be applied for example align on a non block element line
- if (!selector || formatList[x].defaultBlock) {
- return true;
- }
-
- for (i = parents.length - 1; i >= 0; i--) {
- if (dom.is(parents[i], selector)) {
- return true;
- }
- }
- }
- }
-
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CaretPosition.after = function (node) {
+ return CaretPosition(node.parentNode, nodeIndex(node) + 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- matchNode: matchNode,
- matchName: matchName,
- match: match,
- matchAll: matchAll,
- canApply: canApply,
- matchesUnInheritedFormatSelector: matchesUnInheritedFormatSelector
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CaretPosition.before = function (node) {
+ return CaretPosition(node.parentNode, nodeIndex(node));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * CaretFormat.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.fmt.CaretFormat',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.node.Element',
- 'tinymce.core.dom.PaddingBr',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.dom.TreeWalker',
- 'tinymce.core.fmt.ExpandRange',
- 'tinymce.core.fmt.FormatUtils',
- 'tinymce.core.fmt.MatchFormat',
- 'tinymce.core.text.Zwsp',
- 'tinymce.core.util.Fun',
- 'tinymce.core.util.Tools'
- ],
- function (Arr, Element, PaddingBr, RangeUtils, TreeWalker, ExpandRange, FormatUtils, MatchFormat, Zwsp, Fun, Tools) {
- var ZWSP = Zwsp.ZWSP, CARET_ID = '_mce_caret', DEBUG = false;
-
- var isCaretNode = function (node) {
- return node.nodeType === 1 && node.id === CARET_ID;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CaretPosition.isAbove = function (pos1, pos2) {
+ return $_5gv5dd26jfuw8li3.liftN([
+ $_9ek1bp4jfuw8kxg.head(pos2.getClientRects()),
+ $_9ek1bp4jfuw8kxg.last(pos1.getClientRects())
+ ], isAbove).getOr(false);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isCaretContainerEmpty = function (node, nodes) {
- while (node) {
- if ((node.nodeType === 3 && node.nodeValue !== ZWSP) || node.childNodes.length > 1) {
- return false;
- }
-
- // Collect nodes
- if (nodes && node.nodeType === 1) {
- nodes.push(node);
- }
-
- node = node.firstChild;
- }
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CaretPosition.isBelow = function (pos1, pos2) {
+ return $_5gv5dd26jfuw8li3.liftN([
+ $_9ek1bp4jfuw8kxg.last(pos2.getClientRects()),
+ $_9ek1bp4jfuw8kxg.head(pos1.getClientRects())
+ ], isBelow).getOr(false);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var findFirstTextNode = function (node) {
- var walker;
-
- if (node) {
- walker = new TreeWalker(node, node);
-
- for (node = walker.current(); node; node = walker.next()) {
- if (node.nodeType === 3) {
- return node;
- }
- }
- }
-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CaretPosition.isAtStart = function (pos) {
+ return pos ? pos.isAtStart() : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var createCaretContainer = function (dom, fill) {
- var caretContainer = dom.create('span', { id: CARET_ID, 'data-mce-bogus': '1', style: DEBUG ? 'color:red' : '' });
-
- if (fill) {
- caretContainer.appendChild(dom.doc.createTextNode(ZWSP));
- }
-
- return caretContainer;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CaretPosition.isAtEnd = function (pos) {
+ return pos ? pos.isAtEnd() : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getParentCaretContainer = function (node) {
- while (node) {
- if (node.id === CARET_ID) {
- return node;
- }
-
- node = node.parentNode;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CaretPosition.isTextPosition = function (pos) {
+ return pos ? $_ey7ka11qjfuw8ldg.isText(pos.container()) : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Checks if the parent caret container node isn't empty if that is the case it
- // will remove the bogus state on all children that isn't empty
- var unmarkBogusCaretParents = function (dom, selection) {
- var caretContainer;
-
- caretContainer = getParentCaretContainer(selection.getStart());
- if (caretContainer && !dom.isEmpty(caretContainer)) {
- Tools.walk(caretContainer, function (node) {
- if (node.nodeType === 1 && node.id !== CARET_ID && !dom.isEmpty(node)) {
- dom.setAttrib(node, 'data-mce-bogus', null);
- }
- }, 'childNodes');
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ CaretPosition.isElementPosition = function (pos) {
+ return CaretPosition.isTextPosition(pos) === false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }(CaretPosition || (CaretPosition = {})));
+ var CaretPosition$1 = CaretPosition;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var trimZwspFromCaretContainer = function (caretContainerNode) {
- var textNode = findFirstTextNode(caretContainerNode);
- if (textNode && textNode.nodeValue.charAt(0) === ZWSP) {
- textNode.deleteData(0, 1);
- }
-
- return textNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isElement$4 = $_ey7ka11qjfuw8ldg.isElement;
+ var isText$5 = $_ey7ka11qjfuw8ldg.isText;
+ var removeNode = function (node) {
+ var parentNode = node.parentNode;
+ if (parentNode) {
+ parentNode.removeChild(node);
+ }
+ };
+ var getNodeValue = function (node) {
+ try {
+ return node.nodeValue;
+ } catch (ex) {
+ return '';
+ }
+ };
+ var setNodeValue = function (node, text) {
+ if (text.length === 0) {
+ removeNode(node);
+ } else {
+ node.nodeValue = text;
+ }
+ };
+ var trimCount = function (text) {
+ var trimmedText = $_dpfg1321jfuw8lhn.trim(text);
+ return {
+ count: text.length - trimmedText.length,
+ text: trimmedText
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var removeCaretContainerNode = function (dom, selection, node, moveCaret) {
- var rng, block, textNode;
-
- rng = selection.getRng(true);
- block = dom.getParent(node, dom.isBlock);
-
- if (isCaretContainerEmpty(node)) {
- if (moveCaret !== false) {
- rng.setStartBefore(node);
- rng.setEndBefore(node);
- }
-
- dom.remove(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var removeUnchanged = function (caretContainer, pos) {
+ remove$2(caretContainer);
+ return pos;
+ };
+ var removeTextAndReposition = function (caretContainer, pos) {
+ var before = trimCount(caretContainer.data.substr(0, pos.offset()));
+ var after = trimCount(caretContainer.data.substr(pos.offset()));
+ var text = before.text + after.text;
+ if (text.length > 0) {
+ setNodeValue(caretContainer, text);
+ return CaretPosition$1(caretContainer, pos.offset() - before.count);
+ } else {
+ return pos;
+ }
+ };
+ var removeElementAndReposition = function (caretContainer, pos) {
+ var parentNode = pos.container();
+ var newPosition = $_9ek1bp4jfuw8kxg.indexOf($_9ek1bp4jfuw8kxg.from(parentNode.childNodes), caretContainer).map(function (index) {
+ return index < pos.offset() ? CaretPosition$1(parentNode, pos.offset() - 1) : pos;
+ }).getOr(pos);
+ remove$2(caretContainer);
+ return newPosition;
+ };
+ var removeTextCaretContainer = function (caretContainer, pos) {
+ return isText$5(caretContainer) && pos.container() === caretContainer ? removeTextAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);
+ };
+ var removeElementCaretContainer = function (caretContainer, pos) {
+ return pos.container() === caretContainer.parentNode ? removeElementAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);
+ };
+ var removeAndReposition = function (container, pos) {
+ return CaretPosition$1.isTextPosition(pos) ? removeTextCaretContainer(container, pos) : removeElementCaretContainer(container, pos);
+ };
+ var remove$2 = function (caretContainerNode) {
+ if (isElement$4(caretContainerNode) && isCaretContainer(caretContainerNode)) {
+ if (hasContent(caretContainerNode)) {
+ caretContainerNode.removeAttribute('data-mce-caret');
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- textNode = trimZwspFromCaretContainer(node);
- if (rng.startContainer === textNode && rng.startOffset > 0) {
- rng.setStart(textNode, rng.startOffset - 1);
- }
-
- if (rng.endContainer === textNode && rng.endOffset > 0) {
- rng.setEnd(textNode, rng.endOffset - 1);
- }
-
- dom.remove(node, true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ removeNode(caretContainerNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (isText$5(caretContainerNode)) {
+ var text = $_dpfg1321jfuw8lhn.trim(getNodeValue(caretContainerNode));
+ setNodeValue(caretContainerNode, text);
+ }
+ };
+ var $_dpm5zo2ajfuw8liw = {
+ removeAndReposition: removeAndReposition,
+ remove: remove$2
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (block && dom.isEmpty(block)) {
- PaddingBr.fillWithPaddingBr(Element.fromDom(block));
- }
-
- selection.setRng(rng);
- };
-
- // Removes the caret container for the specified node or all on the current document
- var removeCaretContainer = function (dom, selection, node, moveCaret) {
- if (!node) {
- node = getParentCaretContainer(selection.getStart());
-
- if (!node) {
- while ((node = dom.get(CARET_ID))) {
- removeCaretContainerNode(dom, selection, node, false);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var walkToPositionIn = function (forward, root, start) {
+ var position = forward ? CaretPosition$1.before(start) : CaretPosition$1.after(start);
+ return fromPosition(forward, root, position);
+ };
+ var afterElement = function (node) {
+ return $_ey7ka11qjfuw8ldg.isBr(node) ? CaretPosition$1.before(node) : CaretPosition$1.after(node);
+ };
+ var isBeforeOrStart = function (position) {
+ if (CaretPosition$1.isTextPosition(position)) {
+ return position.offset() === 0;
+ } else {
+ return isCaretCandidate(position.getNode());
+ }
+ };
+ var isAfterOrEnd = function (position) {
+ if (CaretPosition$1.isTextPosition(position)) {
+ var container = position.container();
+ return position.offset() === container.data.length;
+ } else {
+ return isCaretCandidate(position.getNode(true));
+ }
+ };
+ var isBeforeAfterSameElement = function (from, to) {
+ return !CaretPosition$1.isTextPosition(from) && !CaretPosition$1.isTextPosition(to) && from.getNode() === to.getNode(true);
+ };
+ var isAtBr = function (position) {
+ return !CaretPosition$1.isTextPosition(position) && $_ey7ka11qjfuw8ldg.isBr(position.getNode());
+ };
+ var shouldSkipPosition = function (forward, from, to) {
+ if (forward) {
+ return !isBeforeAfterSameElement(from, to) && !isAtBr(from) && isAfterOrEnd(from) && isBeforeOrStart(to);
+ } else {
+ return !isBeforeAfterSameElement(to, from) && isBeforeOrStart(from) && isAfterOrEnd(to);
+ }
+ };
+ var fromPosition = function (forward, root, pos) {
+ var walker = CaretWalker(root);
+ return Option.from(forward ? walker.next(pos) : walker.prev(pos));
+ };
+ var navigate = function (forward, root, from) {
+ return fromPosition(forward, root, from).bind(function (to) {
+ if (isInSameBlock(from, to, root) && shouldSkipPosition(forward, from, to)) {
+ return fromPosition(forward, root, to);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- removeCaretContainerNode(dom, selection, node, moveCaret);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Option.some(to);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var insertCaretContainerNode = function (editor, caretContainer, formatNode) {
- var dom = editor.dom, block = dom.getParent(formatNode, Fun.curry(FormatUtils.isTextBlock, editor));
-
- if (block && dom.isEmpty(block)) {
- // Replace formatNode with caretContainer when removing format from empty block like <p><b>|</b></p>
- formatNode.parentNode.replaceChild(caretContainer, formatNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var positionIn = function (forward, element) {
+ var startNode = forward ? element.firstChild : element.lastChild;
+ if ($_ey7ka11qjfuw8ldg.isText(startNode)) {
+ return Option.some(CaretPosition$1(startNode, forward ? 0 : startNode.data.length));
+ } else if (startNode) {
+ if (isCaretCandidate(startNode)) {
+ return Option.some(forward ? CaretPosition$1.before(startNode) : afterElement(startNode));
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- PaddingBr.removeTrailingBr(Element.fromDom(formatNode));
- if (dom.isEmpty(formatNode)) {
- formatNode.parentNode.replaceChild(caretContainer, formatNode);
- } else {
- dom.insertAfter(caretContainer, formatNode);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return walkToPositionIn(forward, element, startNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ return Option.none();
+ }
+ };
+ var $_25kl2c2cjfuw8ljh = {
+ fromPosition: fromPosition,
+ nextPosition: $_68e81l6jfuw8kyc.curry(fromPosition, true),
+ prevPosition: $_68e81l6jfuw8kyc.curry(fromPosition, false),
+ navigate: navigate,
+ positionIn: positionIn,
+ firstPositionIn: $_68e81l6jfuw8kyc.curry(positionIn, true),
+ lastPositionIn: $_68e81l6jfuw8kyc.curry(positionIn, false)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var appendNode = function (parentNode, node) {
- parentNode.appendChild(node);
- return node;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isContentEditableTrue$2 = $_ey7ka11qjfuw8ldg.isContentEditableTrue;
+ var isContentEditableFalse$2 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var showCaret = function (direction, editor, node, before, scrollIntoView) {
+ return editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView);
+ };
+ var getNodeRange = function (node) {
+ var rng = node.ownerDocument.createRange();
+ rng.selectNode(node);
+ return rng;
+ };
+ var selectNode = function (editor, node) {
+ var e = editor.fire('BeforeObjectSelected', { target: node });
+ if (e.isDefaultPrevented()) {
+ return null;
+ }
+ return getNodeRange(node);
+ };
+ var renderCaretAtRange = function (editor, range, scrollIntoView) {
+ var normalizedRange = normalizeRange(1, editor.getBody(), range);
+ var caretPosition = CaretPosition$1.fromRangeStart(normalizedRange);
+ var caretPositionNode = caretPosition.getNode();
+ if (isContentEditableFalse$2(caretPositionNode)) {
+ return showCaret(1, editor, caretPositionNode, !caretPosition.isAtEnd(), false);
+ }
+ var caretPositionBeforeNode = caretPosition.getNode(true);
+ if (isContentEditableFalse$2(caretPositionBeforeNode)) {
+ return showCaret(1, editor, caretPositionBeforeNode, false, false);
+ }
+ var ceRoot = editor.dom.getParent(caretPosition.getNode(), function (node) {
+ return isContentEditableFalse$2(node) || isContentEditableTrue$2(node);
+ });
+ if (isContentEditableFalse$2(ceRoot)) {
+ return showCaret(1, editor, ceRoot, false, scrollIntoView);
+ }
+ return null;
+ };
+ var renderRangeCaret = function (editor, range, scrollIntoView) {
+ if (!range || !range.collapsed) {
+ return range;
+ }
+ var caretRange = renderCaretAtRange(editor, range, scrollIntoView);
+ if (caretRange) {
+ return caretRange;
+ }
+ return range;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var insertFormatNodesIntoCaretContainer = function (formatNodes, caretContainer) {
- var innerMostFormatNode = Arr.foldr(formatNodes, function (parentNode, formatNode) {
- return appendNode(parentNode, formatNode.cloneNode(false));
- }, caretContainer);
-
- return appendNode(innerMostFormatNode, innerMostFormatNode.ownerDocument.createTextNode(ZWSP));
- };
-
- var setupCaretEvents = function (editor) {
- if (!editor._hasCaretEvents) {
- bindEvents(editor);
- editor._hasCaretEvents = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var BreakType;
+ (function (BreakType) {
+ BreakType[BreakType['Br'] = 0] = 'Br';
+ BreakType[BreakType['Block'] = 1] = 'Block';
+ BreakType[BreakType['Wrap'] = 2] = 'Wrap';
+ BreakType[BreakType['Eol'] = 3] = 'Eol';
+ }(BreakType || (BreakType = {})));
+ var flip = function (direction, positions) {
+ return direction === HDirection.Backwards ? positions.reverse() : positions;
+ };
+ var walk$1 = function (direction, caretWalker, pos) {
+ return direction === HDirection.Forwards ? caretWalker.next(pos) : caretWalker.prev(pos);
+ };
+ var getBreakType = function (scope, direction, currentPos, nextPos) {
+ if ($_ey7ka11qjfuw8ldg.isBr(nextPos.getNode(direction === HDirection.Forwards))) {
+ return BreakType.Br;
+ } else if (isInSameBlock(currentPos, nextPos) === false) {
+ return BreakType.Block;
+ } else {
+ return BreakType.Wrap;
+ }
+ };
+ var getPositionsUntil = function (predicate, direction, scope, start) {
+ var caretWalker = CaretWalker(scope);
+ var currentPos = start, nextPos;
+ var positions = [];
+ while (currentPos) {
+ nextPos = walk$1(direction, caretWalker, currentPos);
+ if (!nextPos) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var applyCaretFormat = function (editor, name, vars) {
- var rng, caretContainer, textNode, offset, bookmark, container, text;
- var dom = editor.dom, selection = editor.selection;
-
- setupCaretEvents(editor);
-
- rng = selection.getRng(true);
- offset = rng.startOffset;
- container = rng.startContainer;
- text = container.nodeValue;
-
- caretContainer = getParentCaretContainer(selection.getStart());
- if (caretContainer) {
- textNode = findFirstTextNode(caretContainer);
- }
-
- // Expand to word if caret is in the middle of a text node and the char before/after is a alpha numeric character
- var wordcharRegex = /[^\s\u00a0\u00ad\u200b\ufeff]/;
- if (text && offset > 0 && offset < text.length &&
- wordcharRegex.test(text.charAt(offset)) && wordcharRegex.test(text.charAt(offset - 1))) {
- // Get bookmark of caret position
- bookmark = selection.getBookmark();
-
- // Collapse bookmark range (WebKit)
- rng.collapse(true);
-
- // Expand the range to the closest word and split it at those points
- rng = ExpandRange.expandRng(editor, rng, editor.formatter.get(name));
- rng = new RangeUtils(dom).split(rng);
-
- // Apply the format to the range
- editor.formatter.apply(name, vars, rng);
-
- // Move selection back to caret position
- selection.moveToBookmark(bookmark);
- } else {
- if (!caretContainer || textNode.nodeValue !== ZWSP) {
- caretContainer = createCaretContainer(dom, true);
- textNode = caretContainer.firstChild;
-
- rng.insertNode(caretContainer);
- offset = 1;
-
- editor.formatter.apply(name, vars, caretContainer);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_ey7ka11qjfuw8ldg.isBr(nextPos.getNode(false))) {
+ if (direction === HDirection.Forwards) {
+ return {
+ positions: flip(direction, positions).concat([nextPos]),
+ breakType: BreakType.Br,
+ breakAt: Option.some(nextPos)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.formatter.apply(name, vars, caretContainer);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return {
+ positions: flip(direction, positions),
+ breakType: BreakType.Br,
+ breakAt: Option.some(nextPos)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Move selection to text node
- selection.setCursorLocation(textNode, offset);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var removeCaretFormat = function (editor, name, vars, similar) {
- var dom = editor.dom, selection = editor.selection;
- var rng = selection.getRng(true), container, offset, bookmark;
- var hasContentAfter, node, formatNode, parents = [], caretContainer;
-
- setupCaretEvents(editor);
-
- container = rng.startContainer;
- offset = rng.startOffset;
- node = container;
-
- if (container.nodeType === 3) {
- if (offset !== container.nodeValue.length) {
- hasContentAfter = true;
- }
-
- node = node.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!nextPos.isVisible()) {
+ currentPos = nextPos;
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- while (node) {
- if (MatchFormat.matchNode(editor, node, name, vars, similar)) {
- formatNode = node;
- break;
- }
-
- if (node.nextSibling) {
- hasContentAfter = true;
- }
-
- parents.push(node);
- node = node.parentNode;
- }
-
- // Node doesn't have the specified format
- if (!formatNode) {
- return;
- }
-
- // Is there contents after the caret then remove the format on the element
- if (hasContentAfter) {
- bookmark = selection.getBookmark();
-
- // Collapse bookmark range (WebKit)
- rng.collapse(true);
-
- // Expand the range to the closest word and split it at those points
- rng = ExpandRange.expandRng(editor, rng, editor.formatter.get(name), true);
- rng = new RangeUtils(dom).split(rng);
-
- editor.formatter.remove(name, vars, rng);
- selection.moveToBookmark(bookmark);
- } else {
- caretContainer = getParentCaretContainer(formatNode);
- var newCaretContainer = createCaretContainer(dom, false);
- var caretNode = insertFormatNodesIntoCaretContainer(parents, newCaretContainer);
-
- if (caretContainer) {
- insertCaretContainerNode(editor, newCaretContainer, caretContainer);
- } else {
- insertCaretContainerNode(editor, newCaretContainer, formatNode);
- }
-
- removeCaretContainerNode(dom, selection, caretContainer, false);
- selection.setCursorLocation(caretNode, 1);
-
- if (dom.isEmpty(formatNode)) {
- dom.remove(formatNode);
- }
- }
- };
-
- var bindEvents = function (editor) {
- var dom = editor.dom, selection = editor.selection;
-
- if (!editor._hasCaretEvents) {
- var markCaretContainersBogus, disableCaretContainer;
-
- editor.on('BeforeGetContent', function (e) {
- if (markCaretContainersBogus && e.format !== 'raw') {
- markCaretContainersBogus();
- }
- });
-
- editor.on('mouseup keydown', function (e) {
- if (disableCaretContainer) {
- disableCaretContainer(e);
- }
- });
-
- // Mark current caret container elements as bogus when getting the contents so we don't end up with empty elements
- markCaretContainersBogus = function () {
- var nodes = [], i;
-
- if (isCaretContainerEmpty(getParentCaretContainer(selection.getStart()), nodes)) {
- // Mark children
- i = nodes.length;
- while (i--) {
- dom.setAttrib(nodes[i], 'data-mce-bogus', '1');
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (predicate(currentPos, nextPos)) {
+ var breakType = getBreakType(scope, direction, currentPos, nextPos);
+ return {
+ positions: flip(direction, positions),
+ breakType: breakType,
+ breakAt: Option.some(nextPos)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- disableCaretContainer = function (e) {
- var keyCode = e.keyCode;
-
- removeCaretContainer(dom, selection, null, false);
-
- // Remove caret container if it's empty
- if (keyCode === 8 && selection.isCollapsed() && selection.getStart().innerHTML === ZWSP) {
- removeCaretContainer(dom, selection, getParentCaretContainer(selection.getStart()));
- }
-
- // Remove caret container on keydown and it's left/right arrow keys
- if (keyCode === 37 || keyCode === 39) {
- removeCaretContainer(dom, selection, getParentCaretContainer(selection.getStart()));
- }
-
- unmarkBogusCaretParents(dom, selection);
- };
-
- // Remove bogus state if they got filled by contents using editor.selection.setContent
- editor.on('SetContent', function (e) {
- if (e.selection) {
- unmarkBogusCaretParents(dom, selection);
- }
- });
- editor._hasCaretEvents = true;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ positions.push(nextPos);
+ currentPos = nextPos;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- applyCaretFormat: applyCaretFormat,
- removeCaretFormat: removeCaretFormat,
- isCaretNode: isCaretNode
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ positions: flip(direction, positions),
+ breakType: BreakType.Eol,
+ breakAt: Option.none()
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Hooks.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Internal class for overriding formatting.
- *
- * @private
- * @class tinymce.fmt.Hooks
- */
-define(
- 'tinymce.core.fmt.Hooks',
- [
- "tinymce.core.util.Arr",
- "tinymce.core.dom.NodeType",
- "tinymce.core.dom.DomQuery"
- ],
- function (Arr, NodeType, $) {
- var postProcessHooks = {}, filter = Arr.filter, each = Arr.each;
-
- function addPostProcessHook(name, hook) {
- var hooks = postProcessHooks[name];
-
- if (!hooks) {
- postProcessHooks[name] = hooks = [];
- }
-
- postProcessHooks[name].push(hook);
- }
-
- function postProcess(name, editor) {
- each(postProcessHooks[name], function (hook) {
- hook(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getAdjacentLinePositions = function (direction, getPositionsUntilBreak, scope, start) {
+ return getPositionsUntilBreak(scope, start).breakAt.map(function (pos) {
+ var positions = getPositionsUntilBreak(scope, pos).positions;
+ return direction === HDirection.Backwards ? positions.concat(pos) : [pos].concat(positions);
+ }).getOr([]);
+ };
+ var findClosestHorizontalPositionFromPoint = function (positions, x) {
+ return $_9ek1bp4jfuw8kxg.foldl(positions, function (acc, newPos) {
+ return acc.fold(function () {
+ return Option.some(newPos);
+ }, function (lastPos) {
+ return $_5gv5dd26jfuw8li3.liftN([
+ $_9ek1bp4jfuw8kxg.head(lastPos.getClientRects()),
+ $_9ek1bp4jfuw8kxg.head(newPos.getClientRects())
+ ], function (lastRect, newRect) {
+ var lastDist = Math.abs(x - lastRect.left);
+ var newDist = Math.abs(x - newRect.left);
+ return newDist <= lastDist ? newPos : lastPos;
+ }).or(acc);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, Option.none());
+ };
+ var findClosestHorizontalPosition = function (positions, pos) {
+ return $_9ek1bp4jfuw8kxg.head(pos.getClientRects()).bind(function (targetRect) {
+ return findClosestHorizontalPositionFromPoint(positions, targetRect.left);
+ });
+ };
+ var getPositionsUntilPreviousLine = $_68e81l6jfuw8kyc.curry(getPositionsUntil, CaretPosition.isAbove, -1);
+ var getPositionsUntilNextLine = $_68e81l6jfuw8kyc.curry(getPositionsUntil, CaretPosition.isBelow, 1);
+ var getPositionsAbove = $_68e81l6jfuw8kyc.curry(getAdjacentLinePositions, -1, getPositionsUntilPreviousLine);
+ var getPositionsBelow = $_68e81l6jfuw8kyc.curry(getAdjacentLinePositions, 1, getPositionsUntilNextLine);
+ var getFirstLinePositions = function (scope) {
+ return $_25kl2c2cjfuw8ljh.firstPositionIn(scope).map(function (pos) {
+ return [pos].concat(getPositionsUntilNextLine(scope, pos).positions);
+ }).getOr([]);
+ };
+ var getLastLinePositions = function (scope) {
+ return $_25kl2c2cjfuw8ljh.lastPositionIn(scope).map(function (pos) {
+ return getPositionsUntilPreviousLine(scope, pos).positions.concat(pos);
+ }).getOr([]);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- addPostProcessHook("pre", function (editor) {
- var rng = editor.selection.getRng(), isPre, blocks;
-
- function hasPreSibling(pre) {
- return isPre(pre.previousSibling) && Arr.indexOf(blocks, pre.previousSibling) !== -1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var all$1 = function (predicate) {
+ return descendants($_5nbzws15jfuw8lap.body(), predicate);
+ };
+ var ancestors = function (scope, predicate, isRoot) {
+ return $_9ek1bp4jfuw8kxg.filter($_2j4g5u17jfuw8lav.parents(scope, isRoot), predicate);
+ };
+ var siblings$1 = function (scope, predicate) {
+ return $_9ek1bp4jfuw8kxg.filter($_2j4g5u17jfuw8lav.siblings(scope), predicate);
+ };
+ var children$1 = function (scope, predicate) {
+ return $_9ek1bp4jfuw8kxg.filter($_2j4g5u17jfuw8lav.children(scope), predicate);
+ };
+ var descendants = function (scope, predicate) {
+ var result = [];
+ $_9ek1bp4jfuw8kxg.each($_2j4g5u17jfuw8lav.children(scope), function (x) {
+ if (predicate(x)) {
+ result = result.concat([x]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ result = result.concat(descendants(x, predicate));
+ });
+ return result;
+ };
+ var $_1ufmrf2hjfuw8lkm = {
+ all: all$1,
+ ancestors: ancestors,
+ siblings: siblings$1,
+ children: children$1,
+ descendants: descendants
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function joinPre(pre1, pre2) {
- $(pre2).remove();
- $(pre1).append('<br><br>').append(pre2.childNodes);
- }
-
- isPre = NodeType.matchNodeNames('pre');
-
- if (!rng.collapsed) {
- blocks = editor.selection.getSelectedBlocks();
-
- each(filter(filter(blocks, isPre), hasPreSibling), function (pre) {
- joinPre(pre.previousSibling, pre);
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var all$2 = function (selector) {
+ return $_fbwcti1fjfuw8lbx.all(selector);
+ };
+ var ancestors$1 = function (scope, selector, isRoot) {
+ return $_1ufmrf2hjfuw8lkm.ancestors(scope, function (e) {
+ return $_fbwcti1fjfuw8lbx.is(e, selector);
+ }, isRoot);
+ };
+ var siblings$2 = function (scope, selector) {
+ return $_1ufmrf2hjfuw8lkm.siblings(scope, function (e) {
+ return $_fbwcti1fjfuw8lbx.is(e, selector);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var children$2 = function (scope, selector) {
+ return $_1ufmrf2hjfuw8lkm.children(scope, function (e) {
+ return $_fbwcti1fjfuw8lbx.is(e, selector);
+ });
+ };
+ var descendants$1 = function (scope, selector) {
+ return $_fbwcti1fjfuw8lbx.all(selector, scope);
+ };
+ var $_ryxde2gjfuw8lkk = {
+ all: all$2,
+ ancestors: ancestors$1,
+ siblings: siblings$2,
+ children: children$2,
+ descendants: descendants$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var deflate = function (rect, delta) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- postProcess: postProcess
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ left: rect.left - delta,
+ top: rect.top - delta,
+ right: rect.right + delta * 2,
+ bottom: rect.bottom + delta * 2,
+ width: rect.width + delta,
+ height: rect.height + delta
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * ElementUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Utility class for various element specific functions.
- *
- * @private
- * @class tinymce.dom.ElementUtils
- */
-define(
- 'tinymce.core.dom.ElementUtils',
- [
- "tinymce.core.dom.BookmarkManager",
- "tinymce.core.util.Tools"
- ],
- function (BookmarkManager, Tools) {
- var each = Tools.each;
-
- function ElementUtils(dom) {
- /**
- * Compares two nodes and checks if it's attributes and styles matches.
- * This doesn't compare classes as items since their order is significant.
- *
- * @method compare
- * @param {Node} node1 First node to compare with.
- * @param {Node} node2 Second node to compare with.
- * @return {boolean} True/false if the nodes are the same or not.
- */
- this.compare = function (node1, node2) {
- // Not the same name
- if (node1.nodeName != node2.nodeName) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getCorners = function (getYAxisValue, tds) {
+ return $_9ek1bp4jfuw8kxg.bind(tds, function (td) {
+ var rect = deflate(td.getBoundingClientRect(), -1);
+ return [
+ {
+ x: rect.left,
+ y: getYAxisValue(rect),
+ cell: td
+ },
+ {
+ x: rect.right,
+ y: getYAxisValue(rect),
+ cell: td
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ];
+ });
+ };
+ var findClosestCorner = function (corners, x, y) {
+ return $_9ek1bp4jfuw8kxg.foldl(corners, function (acc, newCorner) {
+ return acc.fold(function () {
+ return Option.some(newCorner);
+ }, function (oldCorner) {
+ var oldDist = Math.sqrt(Math.abs(oldCorner.x - x) + Math.abs(oldCorner.y - y));
+ var newDist = Math.sqrt(Math.abs(newCorner.x - x) + Math.abs(newCorner.y - y));
+ return Option.some(newDist < oldDist ? newCorner : oldCorner);
+ });
+ }, Option.none());
+ };
+ var getClosestCell = function (getYAxisValue, isTargetCorner, table, x, y) {
+ var cells = $_ryxde2gjfuw8lkk.descendants($_c9h6qlzjfuw8l98.fromDom(table), 'td,th').map(function (e) {
+ return e.dom();
+ });
+ var corners = $_9ek1bp4jfuw8kxg.filter(getCorners(getYAxisValue, cells), function (corner) {
+ return isTargetCorner(corner, y);
+ });
+ return findClosestCorner(corners, x, y).map(function (corner) {
+ return corner.cell;
+ });
+ };
+ var getBottomValue = function (rect) {
+ return rect.bottom;
+ };
+ var getTopValue = function (rect) {
+ return rect.top;
+ };
+ var isAbove$1 = function (corner, y) {
+ return corner.y < y;
+ };
+ var isBelow$1 = function (corner, y) {
+ return corner.y > y;
+ };
+ var getClosestCellAbove = $_68e81l6jfuw8kyc.curry(getClosestCell, getBottomValue, isAbove$1);
+ var getClosestCellBelow = $_68e81l6jfuw8kyc.curry(getClosestCell, getTopValue, isBelow$1);
+ var findClosestPositionInAboveCell = function (table, pos) {
+ return $_9ek1bp4jfuw8kxg.head(pos.getClientRects()).bind(function (rect) {
+ return getClosestCellAbove(table, rect.left, rect.top);
+ }).bind(function (cell) {
+ return findClosestHorizontalPosition(getLastLinePositions(cell), pos);
+ });
+ };
+ var findClosestPositionInBelowCell = function (table, pos) {
+ return $_9ek1bp4jfuw8kxg.last(pos.getClientRects()).bind(function (rect) {
+ return getClosestCellBelow(table, rect.left, rect.top);
+ }).bind(function (cell) {
+ return findClosestHorizontalPosition(getFirstLinePositions(cell), pos);
+ });
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Returns all the nodes attributes excluding internal ones, styles and classes.
- *
- * @private
- * @param {Node} node Node to get attributes from.
- * @return {Object} Name/value object with attributes and attribute values.
- */
- function getAttribs(node) {
- var attribs = {};
-
- each(dom.getAttribs(node), function (attr) {
- var name = attr.nodeName.toLowerCase();
-
- // Don't compare internal attributes or style
- if (name.indexOf('_') !== 0 && name !== 'style' && name.indexOf('data-') !== 0) {
- attribs[name] = dom.getAttrib(node, name);
- }
- });
-
- return attribs;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getPos$1 = function (elm) {
+ var x = 0, y = 0;
+ var offsetParent = elm;
+ while (offsetParent && offsetParent.nodeType) {
+ x += offsetParent.offsetLeft || 0;
+ y += offsetParent.offsetTop || 0;
+ offsetParent = offsetParent.offsetParent;
+ }
+ return {
+ x: x,
+ y: y
+ };
+ };
+ var fireScrollIntoViewEvent = function (editor, elm, alignToTop) {
+ var scrollEvent = {
+ elm: elm,
+ alignToTop: alignToTop
+ };
+ editor.fire('scrollIntoView', scrollEvent);
+ return scrollEvent.isDefaultPrevented();
+ };
+ var scrollElementIntoView = function (editor, elm, alignToTop) {
+ var y, viewPort;
+ var dom = editor.dom;
+ var root = dom.getRoot();
+ var viewPortY, viewPortH, offsetY = 0;
+ if (fireScrollIntoViewEvent(editor, elm, alignToTop)) {
+ return;
+ }
+ if (!$_ey7ka11qjfuw8ldg.isElement(elm)) {
+ return;
+ }
+ if (alignToTop === false) {
+ offsetY = elm.offsetHeight;
+ }
+ if (root.nodeName !== 'BODY') {
+ var scrollContainer = editor.selection.getScrollContainer();
+ if (scrollContainer) {
+ y = getPos$1(elm).y - getPos$1(scrollContainer).y + offsetY;
+ viewPortH = scrollContainer.clientHeight;
+ viewPortY = scrollContainer.scrollTop;
+ if (y < viewPortY || y + 25 > viewPortY + viewPortH) {
+ scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Compares two objects checks if it's key + value exists in the other one.
- *
- * @private
- * @param {Object} obj1 First object to compare.
- * @param {Object} obj2 Second object to compare.
- * @return {boolean} True/false if the objects matches or not.
- */
- function compareObjects(obj1, obj2) {
- var value, name;
-
- for (name in obj1) {
- // Obj1 has item obj2 doesn't have
- if (obj1.hasOwnProperty(name)) {
- value = obj2[name];
-
- // Obj2 doesn't have obj1 item
- if (typeof value == "undefined") {
- return false;
- }
-
- // Obj2 item has a different value
- if (obj1[name] != value) {
- return false;
- }
-
- // Delete similar value
- delete obj2[name];
- }
- }
-
- // Check if obj 2 has something obj 1 doesn't have
- for (name in obj2) {
- // Obj2 has item obj1 doesn't have
- if (obj2.hasOwnProperty(name)) {
- return false;
- }
- }
-
- return true;
- }
-
- // Attribs are not the same
- if (!compareObjects(getAttribs(node1), getAttribs(node2))) {
- return false;
- }
-
- // Styles are not the same
- if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) {
- return false;
- }
-
- return !BookmarkManager.isBookmarkNode(node1) && !BookmarkManager.isBookmarkNode(node2);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
+ }
+ }
+ viewPort = dom.getViewPort(editor.getWin());
+ y = dom.getPos(elm).y + offsetY;
+ viewPortY = viewPort.y;
+ viewPortH = viewPort.h;
+ if (y < viewPort.y || y + 25 > viewPortY + viewPortH) {
+ editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25);
+ }
+ };
+ var getViewPortRect = function (editor) {
+ if (editor.inline) {
+ return editor.getBody().getBoundingClientRect();
+ } else {
+ var win = editor.getWin();
+ return {
+ left: 0,
+ right: win.innerWidth,
+ top: 0,
+ bottom: win.innerHeight,
+ width: win.innerWidth,
+ height: win.innerHeight
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var scrollBy = function (editor, dx, dy) {
+ if (editor.inline) {
+ editor.getBody().scrollLeft += dx;
+ editor.getBody().scrollTop += dy;
+ } else {
+ editor.getWin().scrollBy(dx, dy);
+ }
+ };
+ var scrollRangeIntoView = function (editor, rng) {
+ $_9ek1bp4jfuw8kxg.head(CaretPosition.fromRangeStart(rng).getClientRects()).each(function (rngRect) {
+ var bodyRect = getViewPortRect(editor);
+ var overflow = getOverflow(bodyRect, rngRect);
+ var margin = 4;
+ var dx = overflow.x > 0 ? overflow.x + margin : overflow.x - margin;
+ var dy = overflow.y > 0 ? overflow.y + margin : overflow.y - margin;
+ scrollBy(editor, overflow.x !== 0 ? dx : 0, overflow.y !== 0 ? dy : 0);
+ });
+ };
+ var $_254q5e2ijfuw8lkq = {
+ scrollElementIntoView: scrollElementIntoView,
+ scrollRangeIntoView: scrollRangeIntoView
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return ElementUtils;
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getBodySetting = function (editor, name, defaultValue) {
+ var value = editor.getParam(name, defaultValue);
+ if (value.indexOf('=') !== -1) {
+ var bodyObj = editor.getParam(name, '', 'hash');
+ return bodyObj.hasOwnProperty(editor.id) ? bodyObj[editor.id] : defaultValue;
+ } else {
+ return value;
+ }
+ };
+ var getIframeAttrs = function (editor) {
+ return editor.getParam('iframe_attrs', {});
+ };
+ var getDocType = function (editor) {
+ return editor.getParam('doctype', '<!DOCTYPE html>');
+ };
+ var getDocumentBaseUrl = function (editor) {
+ return editor.getParam('document_base_url', '');
+ };
+ var getBodyId = function (editor) {
+ return getBodySetting(editor, 'body_id', 'tinymce');
+ };
+ var getBodyClass = function (editor) {
+ return getBodySetting(editor, 'body_class', '');
+ };
+ var getContentSecurityPolicy = function (editor) {
+ return editor.getParam('content_security_policy', '');
+ };
+ var shouldPutBrInPre = function (editor) {
+ return editor.getParam('br_in_pre', true);
+ };
+ var getForcedRootBlock = function (editor) {
+ if (editor.getParam('force_p_newlines', false)) {
+ return 'p';
+ }
+ var block = editor.getParam('forced_root_block', 'p');
+ return block === false ? '' : block;
+ };
+ var getForcedRootBlockAttrs = function (editor) {
+ return editor.getParam('forced_root_block_attrs', {});
+ };
+ var getBrNewLineSelector = function (editor) {
+ return editor.getParam('br_newline_selector', '.mce-toc h2,figcaption,caption');
+ };
+ var getNoNewLineSelector = function (editor) {
+ return editor.getParam('no_newline_selector', '');
+ };
+ var shouldKeepStyles = function (editor) {
+ return editor.getParam('keep_styles', true);
+ };
+ var shouldEndContainerOnEmptyBlock = function (editor) {
+ return editor.getParam('end_container_on_empty_block', false);
+ };
+ var getFontStyleValues = function (editor) {
+ return $_52qop8kjfuw8l6v.explode(editor.getParam('font_size_style_values', ''));
+ };
+ var getFontSizeClasses = function (editor) {
+ return $_52qop8kjfuw8l6v.explode(editor.getParam('font_size_classes', ''));
+ };
+ var $_6msxiw2jjfuw8lkv = {
+ getIframeAttrs: getIframeAttrs,
+ getDocType: getDocType,
+ getDocumentBaseUrl: getDocumentBaseUrl,
+ getBodyId: getBodyId,
+ getBodyClass: getBodyClass,
+ getContentSecurityPolicy: getContentSecurityPolicy,
+ shouldPutBrInPre: shouldPutBrInPre,
+ getForcedRootBlock: getForcedRootBlock,
+ getForcedRootBlockAttrs: getForcedRootBlockAttrs,
+ getBrNewLineSelector: getBrNewLineSelector,
+ getNoNewLineSelector: getNoNewLineSelector,
+ shouldKeepStyles: shouldKeepStyles,
+ shouldEndContainerOnEmptyBlock: shouldEndContainerOnEmptyBlock,
+ getFontStyleValues: getFontStyleValues,
+ getFontSizeClasses: getFontSizeClasses
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * RemoveFormat.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var before = function (marker, element) {
+ var parent = $_2j4g5u17jfuw8lav.parent(marker);
+ parent.each(function (v) {
+ v.dom().insertBefore(element.dom(), marker.dom());
+ });
+ };
+ var after = function (marker, element) {
+ var sibling = $_2j4g5u17jfuw8lav.nextSibling(marker);
+ sibling.fold(function () {
+ var parent = $_2j4g5u17jfuw8lav.parent(marker);
+ parent.each(function (v) {
+ append(v, element);
+ });
+ }, function (v) {
+ before(v, element);
+ });
+ };
+ var prepend = function (parent, element) {
+ var firstChild = $_2j4g5u17jfuw8lav.firstChild(parent);
+ firstChild.fold(function () {
+ append(parent, element);
+ }, function (v) {
+ parent.dom().insertBefore(element.dom(), v.dom());
+ });
+ };
+ var append = function (parent, element) {
+ parent.dom().appendChild(element.dom());
+ };
+ var appendAt = function (parent, element, index) {
+ $_2j4g5u17jfuw8lav.child(parent, index).fold(function () {
+ append(parent, element);
+ }, function (v) {
+ before(v, element);
+ });
+ };
+ var wrap$1 = function (element, wrapper) {
+ before(element, wrapper);
+ append(wrapper, element);
+ };
+ var $_doli6x2kjfuw8lky = {
+ before: before,
+ after: after,
+ prepend: prepend,
+ append: append,
+ appendAt: appendAt,
+ wrap: wrap$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.fmt.RemoveFormat',
- [
- 'ephox.katamari.api.Fun',
- 'tinymce.core.dom.BookmarkManager',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.dom.TreeWalker',
- 'tinymce.core.fmt.CaretFormat',
- 'tinymce.core.fmt.ExpandRange',
- 'tinymce.core.fmt.FormatUtils',
- 'tinymce.core.fmt.MatchFormat',
- 'tinymce.core.util.Tools'
- ],
- function (Fun, BookmarkManager, RangeUtils, TreeWalker, CaretFormat, ExpandRange, FormatUtils, MatchFormat, Tools) {
- var MCE_ATTR_RE = /^(src|href|style)$/;
- var each = Tools.each;
- var isEq = FormatUtils.isEq;
-
- var isTableCell = function (node) {
- return /^(TH|TD)$/.test(node.nodeName);
- };
-
- var getContainer = function (ed, rng, start) {
- var container, offset, lastIdx;
-
- container = rng[start ? 'startContainer' : 'endContainer'];
- offset = rng[start ? 'startOffset' : 'endOffset'];
-
- if (container.nodeType === 1) {
- lastIdx = container.childNodes.length - 1;
-
- if (!start && offset) {
- offset--;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var browser$2 = $_f1lbzgnjfuw8l7o.detect().browser;
+ var isFakeCaretTableBrowser = function () {
+ return browser$2.isIE() || browser$2.isEdge() || browser$2.isFirefox();
+ };
+ var moveToRange = function (editor, rng) {
+ editor.selection.setRng(rng);
+ $_254q5e2ijfuw8lkq.scrollRangeIntoView(editor, rng);
+ };
+ var isAtTableCellLine = function (getPositionsUntil, scope, pos) {
+ var lineInfo = getPositionsUntil(scope, pos);
+ if (lineInfo.breakType === BreakType.Wrap && lineInfo.positions.length === 0) {
+ return lineInfo.breakAt.map(function (breakPos) {
+ return getPositionsUntil(scope, breakPos).breakAt.isNone();
+ }).getOr(true);
+ } else {
+ return lineInfo.breakAt.isNone();
+ }
+ };
+ var isAtFirstTableCellLine = $_ebfy8j25jfuw8li1.curry(isAtTableCellLine, getPositionsUntilPreviousLine);
+ var isAtLastTableCellLine = $_ebfy8j25jfuw8li1.curry(isAtTableCellLine, getPositionsUntilNextLine);
+ var isCaretAtStartOrEndOfTable = function (forward, rng, table) {
+ var caretPos = CaretPosition$1.fromRangeStart(rng);
+ return $_25kl2c2cjfuw8ljh.positionIn(!forward, table).map(function (pos) {
+ return pos.isEqual(caretPos);
+ }).getOr(false);
+ };
+ var navigateHorizontally = function (editor, forward, table, td) {
+ var rng = editor.selection.getRng();
+ var direction = forward ? 1 : -1;
+ if (isFakeCaretTableBrowser() && isCaretAtStartOrEndOfTable(forward, rng, table)) {
+ var newRng = showCaret(direction, editor, table, !forward, true);
+ moveToRange(editor, newRng);
+ return true;
+ }
+ return false;
+ };
+ var getClosestAbovePosition = function (root, table, start) {
+ return findClosestPositionInAboveCell(table, start).orThunk(function () {
+ return $_9ek1bp4jfuw8kxg.head(start.getClientRects()).bind(function (rect) {
+ return findClosestHorizontalPositionFromPoint(getPositionsAbove(root, CaretPosition$1.before(table)), rect.left);
+ });
+ }).getOr(CaretPosition$1.before(table));
+ };
+ var getClosestBelowPosition = function (root, table, start) {
+ return findClosestPositionInBelowCell(table, start).orThunk(function () {
+ return $_9ek1bp4jfuw8kxg.head(start.getClientRects()).bind(function (rect) {
+ return findClosestHorizontalPositionFromPoint(getPositionsBelow(root, CaretPosition$1.after(table)), rect.left);
+ });
+ }).getOr(CaretPosition$1.after(table));
+ };
+ var getTable = function (previous, pos) {
+ var node = pos.getNode(previous);
+ return $_ey7ka11qjfuw8ldg.isElement(node) && node.nodeName === 'TABLE' ? Option.some(node) : Option.none();
+ };
+ var renderBlock = function (down, editor, table, pos) {
+ var forcedRootBlock = $_6msxiw2jjfuw8lkv.getForcedRootBlock(editor);
+ if (forcedRootBlock) {
+ editor.undoManager.transact(function () {
+ var element = $_c9h6qlzjfuw8l98.fromTag(forcedRootBlock);
+ $_8g002u14jfuw8la5.setAll(element, $_6msxiw2jjfuw8lkv.getForcedRootBlockAttrs(editor));
+ $_doli6x2kjfuw8lky.append(element, $_c9h6qlzjfuw8l98.fromTag('br'));
+ if (down) {
+ $_doli6x2kjfuw8lky.after($_c9h6qlzjfuw8l98.fromDom(table), element);
+ } else {
+ $_doli6x2kjfuw8lky.before($_c9h6qlzjfuw8l98.fromDom(table), element);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- container = container.childNodes[offset > lastIdx ? lastIdx : offset];
- }
-
- // If start text node is excluded then walk to the next node
- if (container.nodeType === 3 && start && offset >= container.nodeValue.length) {
- container = new TreeWalker(container, ed.getBody()).next() || container;
- }
-
- // If end text node is excluded then walk to the previous node
- if (container.nodeType === 3 && !start && offset === 0) {
- container = new TreeWalker(container, ed.getBody()).prev() || container;
- }
-
- return container;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var rng = editor.dom.createRng();
+ rng.setStart(element.dom(), 0);
+ rng.setEnd(element.dom(), 0);
+ moveToRange(editor, rng);
+ });
+ } else {
+ moveToRange(editor, pos.toRange());
+ }
+ };
+ var moveCaret = function (editor, down, pos) {
+ var table = down ? getTable(true, pos) : getTable(false, pos);
+ var last = down === false;
+ table.fold(function () {
+ return moveToRange(editor, pos.toRange());
+ }, function (table) {
+ return $_25kl2c2cjfuw8ljh.positionIn(last, editor.getBody()).filter(function (lastPos) {
+ return lastPos.isEqual(pos);
+ }).fold(function () {
+ return moveToRange(editor, pos.toRange());
+ }, function (_) {
+ return renderBlock(down, editor, table, pos);
+ });
+ });
+ };
+ var navigateVertically = function (editor, down, table, td) {
+ var rng = editor.selection.getRng();
+ var pos = CaretPosition$1.fromRangeStart(rng);
+ var root = editor.getBody();
+ if (!down && isAtFirstTableCellLine(td, pos)) {
+ var newPos = getClosestAbovePosition(root, table, pos);
+ moveCaret(editor, down, newPos);
+ return true;
+ } else if (down && isAtLastTableCellLine(td, pos)) {
+ var newPos = getClosestBelowPosition(root, table, pos);
+ moveCaret(editor, down, newPos);
+ return true;
+ } else {
+ return false;
+ }
+ };
+ var moveH = function (editor, forward) {
+ return function () {
+ return Option.from(editor.dom.getParent(editor.selection.getNode(), 'td,th')).bind(function (td) {
+ return Option.from(editor.dom.getParent(td, 'table')).map(function (table) {
+ return navigateHorizontally(editor, forward, table, td);
+ });
+ }).getOr(false);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var wrap = function (dom, node, name, attrs) {
- var wrapper = dom.create(name, attrs);
-
- node.parentNode.insertBefore(wrapper, node);
- wrapper.appendChild(node);
-
- return wrapper;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var moveV = function (editor, forward) {
+ return function () {
+ return Option.from(editor.dom.getParent(editor.selection.getNode(), 'td,th')).bind(function (td) {
+ return Option.from(editor.dom.getParent(td, 'table')).map(function (table) {
+ return navigateVertically(editor, forward, table, td);
+ });
+ }).getOr(false);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Checks if the specified nodes name matches the format inline/block or selector.
- *
- * @private
- * @param {Node} node Node to match against the specified format.
- * @param {Object} format Format object o match with.
- * @return {boolean} true/false if the format matches.
- */
- var matchName = function (dom, node, format) {
- // Check for inline match
- if (isEq(node, format.inline)) {
- return true;
- }
-
- // Check for block match
- if (isEq(node, format.block)) {
- return true;
- }
-
- // Check for selector match
- if (format.selector) {
- return node.nodeType === 1 && dom.is(node, format.selector);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Cell = function (initial) {
+ var value = initial;
+ var get = function () {
+ return value;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isColorFormatAndAnchor = function (node, format) {
- return format.links && node.tagName === 'A';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var set = function (v) {
+ value = v;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var find = function (dom, node, next, inc) {
- node = FormatUtils.getNonWhiteSpaceSibling(node, next, inc);
- return !node || (node.nodeName === 'BR' || dom.isBlock(node));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var clone = function () {
+ return Cell(get());
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return {
+ get: get,
+ set: set,
+ clone: clone
+ };
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Removes the node and wrap it's children in paragraphs before doing so or
- * appends BR elements to the beginning/end of the block element if forcedRootBlocks is disabled.
- *
- * If the div in the node below gets removed:
- * text<div>text</div>text
- *
- * Output becomes:
- * text<div><br />text<br /></div>text
- *
- * So when the div is removed the result is:
- * text<br />text<br />text
- *
- * @private
- * @param {Node} node Node to remove + apply BR/P elements to.
- * @param {Object} format Format rule.
- * @return {Node} Input node.
- */
- var removeNode = function (ed, node, format) {
- var parentNode = node.parentNode, rootBlockElm;
- var dom = ed.dom, forcedRootBlock = ed.settings.forced_root_block;
-
- if (format.block) {
- if (!forcedRootBlock) {
- // Append BR elements if needed before we remove the block
- if (dom.isBlock(node) && !dom.isBlock(parentNode)) {
- if (!find(dom, node, false) && !find(dom, node.firstChild, true, 1)) {
- node.insertBefore(dom.create('br'), node.firstChild);
- }
-
- if (!find(dom, node, true) && !find(dom, node.lastChild, false, 1)) {
- node.appendChild(dom.create('br'));
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isContentEditableFalse$3 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var isTableCell$1 = function (node) {
+ return $_ey7ka11qjfuw8ldg.isElement(node) && /^(TD|TH)$/i.test(node.tagName);
+ };
+ var getAbsoluteClientRect = function (root, element, before) {
+ var clientRect = collapse(element.getBoundingClientRect(), before);
+ var docElm, scrollX, scrollY, margin, rootRect;
+ if (root.tagName === 'BODY') {
+ docElm = root.ownerDocument.documentElement;
+ scrollX = root.scrollLeft || docElm.scrollLeft;
+ scrollY = root.scrollTop || docElm.scrollTop;
+ } else {
+ rootRect = root.getBoundingClientRect();
+ scrollX = root.scrollLeft - rootRect.left;
+ scrollY = root.scrollTop - rootRect.top;
+ }
+ clientRect.left += scrollX;
+ clientRect.right += scrollX;
+ clientRect.top += scrollY;
+ clientRect.bottom += scrollY;
+ clientRect.width = 1;
+ margin = element.offsetWidth - element.clientWidth;
+ if (margin > 0) {
+ if (before) {
+ margin *= -1;
+ }
+ clientRect.left += margin;
+ clientRect.right += margin;
+ }
+ return clientRect;
+ };
+ var trimInlineCaretContainers = function (root) {
+ var contentEditableFalseNodes, node, sibling, i, data;
+ contentEditableFalseNodes = DomQuery('*[contentEditable=false]', root);
+ for (i = 0; i < contentEditableFalseNodes.length; i++) {
+ node = contentEditableFalseNodes[i];
+ sibling = node.previousSibling;
+ if (endsWithCaretContainer(sibling)) {
+ data = sibling.data;
+ if (data.length === 1) {
+ sibling.parentNode.removeChild(sibling);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Wrap the block in a forcedRootBlock if we are at the root of document
- if (parentNode === dom.getRoot()) {
- if (!format.list_block || !isEq(node, format.list_block)) {
- each(Tools.grep(node.childNodes), function (node) {
- if (FormatUtils.isValid(ed, forcedRootBlock, node.nodeName.toLowerCase())) {
- if (!rootBlockElm) {
- rootBlockElm = wrap(dom, node, forcedRootBlock);
- dom.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs);
- } else {
- rootBlockElm.appendChild(node);
- }
- } else {
- rootBlockElm = 0;
- }
- });
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sibling.deleteData(data.length - 1, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Never remove nodes that isn't the specified inline element if a selector is specified too
- if (format.selector && format.inline && !isEq(format.inline, node)) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sibling = node.nextSibling;
+ if (startsWithCaretContainer(sibling)) {
+ data = sibling.data;
+ if (data.length === 1) {
+ sibling.parentNode.removeChild(sibling);
+ } else {
+ sibling.deleteData(0, 1);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- dom.remove(node, 1);
- };
-
- /**
- * Removes the specified format for the specified node. It will also remove the node if it doesn't have
- * any attributes if the format specifies it to do so.
- *
- * @private
- * @param {Object} format Format object with items to remove from node.
- * @param {Object} vars Name/value object with variables to apply to format.
- * @param {Node} node Node to remove the format styles on.
- * @param {Node} compareNode Optional compare node, if specified the styles will be compared to that node.
- * @return {Boolean} True/false if the node was removed or not.
- */
- var removeFormat = function (ed, format, vars, node, compareNode) {
- var i, attrs, stylesModified, dom = ed.dom;
-
- // Check if node matches format
- if (!matchName(dom, node, format) && !isColorFormatAndAnchor(node, format)) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var FakeCaret = function (root, isBlock, hasFocus) {
+ var lastVisualCaret = Cell(Option.none());
+ var cursorInterval, caretContainerNode;
+ var show = function (before, element) {
+ var clientRect, rng;
+ hide();
+ if (isTableCell$1(element)) {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Should we compare with format attribs and styles
- if (format.remove !== 'all') {
- // Remove styles
- each(format.styles, function (value, name) {
- value = FormatUtils.normalizeStyleValue(dom, FormatUtils.replaceVars(value, vars), name);
-
- // Indexed array
- if (typeof name === 'number') {
- name = value;
- compareNode = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isBlock(element)) {
+ caretContainerNode = insertBlock('p', element, before);
+ clientRect = getAbsoluteClientRect(root, element, before);
+ DomQuery(caretContainerNode).css('top', clientRect.top);
+ var caret = DomQuery('<div class="mce-visual-caret" data-mce-bogus="all"></div>').css(clientRect).appendTo(root)[0];
+ lastVisualCaret.set(Option.some({
+ caret: caret,
+ element: element,
+ before: before
+ }));
+ lastVisualCaret.get().each(function (caretState) {
+ if (before) {
+ DomQuery(caretState.caret).addClass('mce-visual-caret-before');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (format.remove_similar || (!compareNode || isEq(FormatUtils.getStyle(dom, compareNode, name), value))) {
- dom.setStyle(node, name, '');
- }
-
- stylesModified = 1;
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove style attribute if it's empty
- if (stylesModified && dom.getAttrib(node, 'style') === '') {
- node.removeAttribute('style');
- node.removeAttribute('data-mce-style');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ startBlink();
+ rng = element.ownerDocument.createRange();
+ rng.setStart(caretContainerNode, 0);
+ rng.setEnd(caretContainerNode, 0);
+ } else {
+ caretContainerNode = insertInline(element, before);
+ rng = element.ownerDocument.createRange();
+ if (isContentEditableFalse$3(caretContainerNode.nextSibling)) {
+ rng.setStart(caretContainerNode, 0);
+ rng.setEnd(caretContainerNode, 0);
+ } else {
+ rng.setStart(caretContainerNode, 1);
+ rng.setEnd(caretContainerNode, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove attributes
- each(format.attributes, function (value, name) {
- var valueOut;
-
- value = FormatUtils.replaceVars(value, vars);
-
- // Indexed array
- if (typeof name === 'number') {
- name = value;
- compareNode = 0;
- }
-
- if (!compareNode || isEq(dom.getAttrib(compareNode, name), value)) {
- // Keep internal classes
- if (name === 'class') {
- value = dom.getAttrib(node, name);
- if (value) {
- // Build new class value where everything is removed except the internal prefixed classes
- valueOut = '';
- each(value.split(/\s+/), function (cls) {
- if (/mce\-\w+/.test(cls)) {
- valueOut += (valueOut ? ' ' : '') + cls;
- }
- });
-
- // We got some internal classes left
- if (valueOut) {
- dom.setAttrib(node, name, valueOut);
- return;
- }
- }
- }
-
- // IE6 has a bug where the attribute doesn't get removed correctly
- if (name === "class") {
- node.removeAttribute('className');
- }
-
- // Remove mce prefixed attributes
- if (MCE_ATTR_RE.test(name)) {
- node.removeAttribute('data-mce-' + name);
- }
-
- node.removeAttribute(name);
- }
- });
-
- // Remove classes
- each(format.classes, function (value) {
- value = FormatUtils.replaceVars(value, vars);
-
- if (!compareNode || dom.hasClass(compareNode, value)) {
- dom.removeClass(node, value);
- }
- });
-
- // Check for non internal attributes
- attrs = dom.getAttribs(node);
- for (i = 0; i < attrs.length; i++) {
- var attrName = attrs[i].nodeName;
- if (attrName.indexOf('_') !== 0 && attrName.indexOf('data-') !== 0) {
- return false;
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return rng;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove the inline child if it's empty for example <b> or <span>
- if (format.remove !== 'none') {
- removeNode(ed, node, format);
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return rng;
+ };
+ var hide = function () {
+ trimInlineCaretContainers(root);
+ if (caretContainerNode) {
+ $_dpm5zo2ajfuw8liw.remove(caretContainerNode);
+ caretContainerNode = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ lastVisualCaret.get().each(function (caretState) {
+ DomQuery(caretState.caret).remove();
+ lastVisualCaret.set(Option.none());
+ });
+ clearInterval(cursorInterval);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var findFormatRoot = function (editor, container, name, vars, similar) {
- var formatRoot;
-
- // Find format root
- each(FormatUtils.getParents(editor.dom, container.parentNode).reverse(), function (parent) {
- var format;
-
- // Find format root element
- if (!formatRoot && parent.id !== '_start' && parent.id !== '_end') {
- // Is the node matching the format we are looking for
- format = MatchFormat.matchNode(editor, parent, name, vars, similar);
- if (format && format.split !== false) {
- formatRoot = parent;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var startBlink = function () {
+ cursorInterval = $_2m8wq9hjfuw8l41.setInterval(function () {
+ if (hasFocus()) {
+ DomQuery('div.mce-visual-caret', root).toggleClass('mce-visual-caret-hidden');
+ } else {
+ DomQuery('div.mce-visual-caret', root).addClass('mce-visual-caret-hidden');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, 500);
+ };
+ var reposition = function () {
+ lastVisualCaret.get().each(function (caretState) {
+ var clientRect = getAbsoluteClientRect(root, caretState.element, caretState.before);
+ DomQuery(caretState.caret).css(clientRect);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return formatRoot;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var wrapAndSplit = function (editor, formatList, formatRoot, container, target, split, format, vars) {
- var parent, clone, lastClone, firstClone, i, formatRootParent, dom = editor.dom;
-
- // Format root found then clone formats and split it
- if (formatRoot) {
- formatRootParent = formatRoot.parentNode;
-
- for (parent = container.parentNode; parent && parent !== formatRootParent; parent = parent.parentNode) {
- clone = dom.clone(parent, false);
-
- for (i = 0; i < formatList.length; i++) {
- if (removeFormat(editor, formatList[i], vars, clone, clone)) {
- clone = 0;
- break;
- }
- }
-
- // Build wrapper node
- if (clone) {
- if (lastClone) {
- clone.appendChild(lastClone);
- }
-
- if (!firstClone) {
- firstClone = clone;
- }
-
- lastClone = clone;
- }
- }
-
- // Never split block elements if the format is mixed
- if (split && (!format.mixed || !dom.isBlock(formatRoot))) {
- container = dom.split(formatRoot, container);
- }
-
- // Wrap container in cloned formats
- if (lastClone) {
- target.parentNode.insertBefore(lastClone, target);
- firstClone.appendChild(target);
- }
- }
-
- return container;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var destroy = function () {
+ return $_2m8wq9hjfuw8l41.clearInterval(cursorInterval);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var remove = function (ed, name, vars, node, similar) {
- var formatList = ed.formatter.get(name), format = formatList[0];
- var bookmark, rng, contentEditable = true, dom = ed.dom, selection = ed.selection;
-
- var splitToFormatRoot = function (container) {
- var formatRoot = findFormatRoot(ed, container, name, vars, similar);
- return wrapAndSplit(ed, formatList, formatRoot, container, container, true, format, vars);
- };
-
- // Merges the styles for each node
- var process = function (node) {
- var children, i, l, lastContentEditable, hasContentEditableState;
-
- // Node has a contentEditable value
- if (node.nodeType === 1 && dom.getContentEditable(node)) {
- lastContentEditable = contentEditable;
- contentEditable = dom.getContentEditable(node) === "true";
- hasContentEditableState = true; // We don't want to wrap the container only it's children
- }
-
- // Grab the children first since the nodelist might be changed
- children = Tools.grep(node.childNodes);
-
- // Process current node
- if (contentEditable && !hasContentEditableState) {
- for (i = 0, l = formatList.length; i < l; i++) {
- if (removeFormat(ed, formatList[i], vars, node, node)) {
- break;
- }
- }
- }
-
- // Process the children
- if (format.deep) {
- if (children.length) {
- for (i = 0, l = children.length; i < l; i++) {
- process(children[i]);
- }
-
- if (hasContentEditableState) {
- contentEditable = lastContentEditable; // Restore last contentEditable state from stack
- }
- }
- }
- };
-
- var unwrap = function (start) {
- var node = dom.get(start ? '_start' : '_end'),
- out = node[start ? 'firstChild' : 'lastChild'];
-
- // If the end is placed within the start the result will be removed
- // So this checks if the out node is a bookmark node if it is it
- // checks for another more suitable node
- if (BookmarkManager.isBookmarkNode(out)) {
- out = out[start ? 'firstChild' : 'lastChild'];
- }
-
- // Since dom.remove removes empty text nodes then we need to try to find a better node
- if (out.nodeType === 3 && out.data.length === 0) {
- out = start ? node.previousSibling || node.nextSibling : node.nextSibling || node.previousSibling;
- }
-
- dom.remove(node, true);
-
- return out;
- };
-
- var removeRngStyle = function (rng) {
- var startContainer, endContainer;
- var commonAncestorContainer = rng.commonAncestorContainer;
-
- rng = ExpandRange.expandRng(ed, rng, formatList, true);
-
- if (format.split) {
- startContainer = getContainer(ed, rng, true);
- endContainer = getContainer(ed, rng);
-
- if (startContainer !== endContainer) {
- // WebKit will render the table incorrectly if we wrap a TH or TD in a SPAN
- // so let's see if we can use the first child instead
- // This will happen if you triple click a table cell and use remove formatting
- if (/^(TR|TH|TD)$/.test(startContainer.nodeName) && startContainer.firstChild) {
- if (startContainer.nodeName === "TR") {
- startContainer = startContainer.firstChild.firstChild || startContainer;
- } else {
- startContainer = startContainer.firstChild || startContainer;
- }
- }
-
- // Try to adjust endContainer as well if cells on the same row were selected - bug #6410
- if (commonAncestorContainer &&
- /^T(HEAD|BODY|FOOT|R)$/.test(commonAncestorContainer.nodeName) &&
- isTableCell(endContainer) && endContainer.firstChild) {
- endContainer = endContainer.firstChild || endContainer;
- }
-
- if (dom.isChildOf(startContainer, endContainer) && !dom.isBlock(endContainer) &&
- !isTableCell(startContainer) && !isTableCell(endContainer)) {
- startContainer = wrap(dom, startContainer, 'span', { id: '_start', 'data-mce-type': 'bookmark' });
- splitToFormatRoot(startContainer);
- startContainer = unwrap(true);
- return;
- }
-
- // Wrap start/end nodes in span element since these might be cloned/moved
- startContainer = wrap(dom, startContainer, 'span', { id: '_start', 'data-mce-type': 'bookmark' });
- endContainer = wrap(dom, endContainer, 'span', { id: '_end', 'data-mce-type': 'bookmark' });
-
- // Split start/end
- splitToFormatRoot(startContainer);
- splitToFormatRoot(endContainer);
-
- // Unwrap start/end to get real elements again
- startContainer = unwrap(true);
- endContainer = unwrap();
- } else {
- startContainer = endContainer = splitToFormatRoot(startContainer);
- }
-
- // Update range positions since they might have changed after the split operations
- rng.startContainer = startContainer.parentNode ? startContainer.parentNode : startContainer;
- rng.startOffset = dom.nodeIndex(startContainer);
- rng.endContainer = endContainer.parentNode ? endContainer.parentNode : endContainer;
- rng.endOffset = dom.nodeIndex(endContainer) + 1;
- }
-
- // Remove items between start/end
- new RangeUtils(dom).walk(rng, function (nodes) {
- each(nodes, function (node) {
- process(node);
-
- // Remove parent span if it only contains text-decoration: underline, yet a parent node is also underlined.
- if (node.nodeType === 1 && ed.dom.getStyle(node, 'text-decoration') === 'underline' &&
- node.parentNode && FormatUtils.getTextDecoration(dom, node.parentNode) === 'underline') {
- removeFormat(ed, {
- 'deep': false,
- 'exact': true,
- 'inline': 'span',
- 'styles': {
- 'textDecoration': 'underline'
- }
- }, null, node);
- }
- });
- });
- };
-
- // Handle node
- if (node) {
- if (node.nodeType) {
- rng = dom.createRng();
- rng.setStartBefore(node);
- rng.setEndAfter(node);
- removeRngStyle(rng);
- } else {
- removeRngStyle(node);
- }
-
- return;
- }
-
- if (dom.getContentEditable(selection.getNode()) === "false") {
- node = selection.getNode();
- for (var i = 0, l = formatList.length; i < l; i++) {
- if (formatList[i].ceFalseOverride) {
- if (removeFormat(ed, formatList[i], vars, node, node)) {
- break;
- }
- }
- }
-
- return;
- }
-
- if (!selection.isCollapsed() || !format.inline || dom.select('td[data-mce-selected],th[data-mce-selected]').length) {
- bookmark = selection.getBookmark();
- removeRngStyle(selection.getRng(true));
- selection.moveToBookmark(bookmark);
-
- // Check if start element still has formatting then we are at: "<b>text|</b>text"
- // and need to move the start into the next text node
- if (format.inline && MatchFormat.match(ed, name, vars, selection.getStart())) {
- FormatUtils.moveStart(dom, selection, selection.getRng(true));
- }
-
- ed.nodeChanged();
- } else {
- CaretFormat.removeCaretFormat(ed, name, vars, similar);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getCss = function () {
+ return '.mce-visual-caret {' + 'position: absolute;' + 'background-color: black;' + 'background-color: currentcolor;' + '}' + '.mce-visual-caret-hidden {' + 'display: none;' + '}' + '*[data-mce-caret] {' + 'position: absolute;' + 'left: -1000px;' + 'right: auto;' + 'top: 0;' + 'margin: 0;' + 'padding: 0;' + '}';
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- removeFormat: removeFormat,
- remove: remove
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ show: show,
+ hide: hide,
+ getCss: getCss,
+ reposition: reposition,
+ destroy: destroy
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * MergeFormats.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isFakeCaretTarget = function (node) {
+ return isContentEditableFalse$3(node) || $_ey7ka11qjfuw8ldg.isTable(node) && isFakeCaretTableBrowser();
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.fmt.MergeFormats',
- [
- 'ephox.katamari.api.Fun',
- 'tinymce.core.dom.BookmarkManager',
- 'tinymce.core.dom.ElementUtils',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.fmt.CaretFormat',
- 'tinymce.core.fmt.FormatUtils',
- 'tinymce.core.fmt.MatchFormat',
- 'tinymce.core.fmt.RemoveFormat',
- 'tinymce.core.util.Tools'
- ],
- function (Fun, BookmarkManager, ElementUtils, NodeType, CaretFormat, FormatUtils, MatchFormat, RemoveFormat, Tools) {
- var each = Tools.each;
-
- var isElementNode = function (node) {
- return node && node.nodeType === 1 && !BookmarkManager.isBookmarkNode(node) && !CaretFormat.isCaretNode(node) && !NodeType.isBogus(node);
- };
-
- var findElementSibling = function (node, siblingName) {
- var sibling;
-
- for (sibling = node; sibling; sibling = sibling[siblingName]) {
- if (sibling.nodeType === 3 && sibling.nodeValue.length !== 0) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isContentEditableFalse$4 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var isBlockLike = $_ey7ka11qjfuw8ldg.matchStyleValues('display', 'block table table-cell table-caption list-item');
+ var isCaretContainer$2 = isCaretContainer;
+ var isCaretContainerBlock$1 = isCaretContainerBlock;
+ var curry$2 = $_ebfy8j25jfuw8li1.curry;
+ var isElement$5 = $_ey7ka11qjfuw8ldg.isElement;
+ var isCaretCandidate$2 = isCaretCandidate;
+ var isForwards = function (direction) {
+ return direction > 0;
+ };
+ var isBackwards = function (direction) {
+ return direction < 0;
+ };
+ var skipCaretContainers = function (walk, shallow) {
+ var node;
+ while (node = walk(shallow)) {
+ if (!isCaretContainerBlock$1(node)) {
+ return node;
+ }
+ }
+ return null;
+ };
+ var findNode = function (node, direction, predicateFn, rootNode, shallow) {
+ var walker = new TreeWalker(node, rootNode);
+ if (isBackwards(direction)) {
+ if (isContentEditableFalse$4(node) || isCaretContainerBlock$1(node)) {
+ node = skipCaretContainers(walker.prev, true);
+ if (predicateFn(node)) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return node;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (sibling.nodeType === 1 && !BookmarkManager.isBookmarkNode(sibling)) {
- return sibling;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return node;
- };
-
- var mergeSiblingsNodes = function (dom, prev, next) {
- var sibling, tmpSibling, elementUtils = new ElementUtils(dom);
-
- // Check if next/prev exists and that they are elements
- if (prev && next) {
- // If previous sibling is empty then jump over it
- prev = findElementSibling(prev, 'previousSibling');
- next = findElementSibling(next, 'nextSibling');
-
- // Compare next and previous nodes
- if (elementUtils.compare(prev, next)) {
- // Append nodes between
- for (sibling = prev.nextSibling; sibling && sibling !== next;) {
- tmpSibling = sibling;
- sibling = sibling.nextSibling;
- prev.appendChild(tmpSibling);
- }
-
- dom.remove(next);
-
- Tools.each(Tools.grep(next.childNodes), function (node) {
- prev.appendChild(node);
- });
-
- return prev;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (node = skipCaretContainers(walker.prev, shallow)) {
+ if (predicateFn(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return next;
- };
-
- var processChildElements = function (node, filter, process) {
- each(node.childNodes, function (node) {
- if (isElementNode(node)) {
- if (filter(node)) {
- process(node);
- }
- if (node.hasChildNodes()) {
- processChildElements(node, filter, process);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (isForwards(direction)) {
+ if (isContentEditableFalse$4(node) || isCaretContainerBlock$1(node)) {
+ node = skipCaretContainers(walker.next, true);
+ if (predicateFn(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- };
-
- var hasStyle = function (dom, name) {
- return Fun.curry(function (name, node) {
- return !!(node && FormatUtils.getStyle(dom, node, name));
- }, name);
- };
-
- var applyStyle = function (dom, name, value) {
- return Fun.curry(function (name, value, node) {
- dom.setStyle(node, name, value);
-
- if (node.getAttribute('style') === '') {
- node.removeAttribute('style');
- }
-
- unwrapEmptySpan(dom, node);
- }, name, value);
- };
-
- var unwrapEmptySpan = function (dom, node) {
- if (node.nodeName === 'SPAN' && dom.getAttribs(node).length === 0) {
- dom.remove(node, true);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var processUnderlineAndColor = function (dom, node) {
- var textDecoration;
- if (node.nodeType === 1 && node.parentNode && node.parentNode.nodeType === 1) {
- textDecoration = FormatUtils.getTextDecoration(dom, node.parentNode);
- if (dom.getStyle(node, 'color') && textDecoration) {
- dom.setStyle(node, 'text-decoration', textDecoration);
- } else if (dom.getStyle(node, 'text-decoration') === textDecoration) {
- dom.setStyle(node, 'text-decoration', null);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (node = skipCaretContainers(walker.next, shallow)) {
+ if (predicateFn(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var mergeUnderlineAndColor = function (dom, format, vars, node) {
- // Colored nodes should be underlined so that the color of the underline matches the text color.
- if (format.styles.color || format.styles.textDecoration) {
- Tools.walk(node, Fun.curry(processUnderlineAndColor, dom), 'childNodes');
- processUnderlineAndColor(dom, node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return null;
+ };
+ var getParentBlock = function (node, rootNode) {
+ while (node && node !== rootNode) {
+ if (isBlockLike(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var mergeBackgroundColorAndFontSize = function (dom, format, vars, node) {
- // nodes with font-size should have their own background color as well to fit the line-height (see TINY-882)
- if (format.styles && format.styles.backgroundColor) {
- processChildElements(node,
- hasStyle(dom, 'fontSize'),
- applyStyle(dom, 'backgroundColor', FormatUtils.replaceVars(format.styles.backgroundColor, vars))
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
+ }
+ return null;
+ };
+ var isInSameBlock = function (caretPosition1, caretPosition2, rootNode) {
+ return getParentBlock(caretPosition1.container(), rootNode) === getParentBlock(caretPosition2.container(), rootNode);
+ };
+ var getChildNodeAtRelativeOffset = function (relativeOffset, caretPosition) {
+ var container, offset;
+ if (!caretPosition) {
+ return null;
+ }
+ container = caretPosition.container();
+ offset = caretPosition.offset();
+ if (!isElement$5(container)) {
+ return null;
+ }
+ return container.childNodes[offset + relativeOffset];
+ };
+ var beforeAfter = function (before, node) {
+ var range = node.ownerDocument.createRange();
+ if (before) {
+ range.setStartBefore(node);
+ range.setEndBefore(node);
+ } else {
+ range.setStartAfter(node);
+ range.setEndAfter(node);
+ }
+ return range;
+ };
+ var isNodesInSameBlock = function (root, node1, node2) {
+ return getParentBlock(node1, root) === getParentBlock(node2, root);
+ };
+ var lean = function (left, root, node) {
+ var sibling, siblingName;
+ if (left) {
+ siblingName = 'previousSibling';
+ } else {
+ siblingName = 'nextSibling';
+ }
+ while (node && node !== root) {
+ sibling = node[siblingName];
+ if (isCaretContainer$2(sibling)) {
+ sibling = sibling[siblingName];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var mergeSubSup = function (dom, format, vars, node) {
- // Remove font size on all chilren of a sub/sup and remove the inverse element
- if (format.inline === 'sub' || format.inline === 'sup') {
- processChildElements(node,
- hasStyle(dom, 'fontSize'),
- applyStyle(dom, 'fontSize', '')
- );
-
- dom.remove(dom.select(format.inline === 'sup' ? 'sub' : 'sup', node), true);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isContentEditableFalse$4(sibling)) {
+ if (isNodesInSameBlock(root, sibling, node)) {
+ return sibling;
+ }
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var mergeSiblings = function (dom, format, vars, node) {
- // Merge next and previous siblings if they are similar <b>text</b><b>text</b> becomes <b>texttext</b>
- if (node && format.merge_siblings !== false) {
- node = mergeSiblingsNodes(dom, FormatUtils.getNonWhiteSpaceSibling(node), node);
- node = mergeSiblingsNodes(dom, node, FormatUtils.getNonWhiteSpaceSibling(node, true));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isCaretCandidate$2(sibling)) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var clearChildStyles = function (dom, format, node) {
- if (format.clear_child_styles) {
- var selector = format.links ? '*:not(a)' : '*';
- each(dom.select(selector, node), function (node) {
- if (isElementNode(node)) {
- each(format.styles, function (value, name) {
- dom.setStyle(node, name, '');
- });
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
+ }
+ return null;
+ };
+ var before$1 = curry$2(beforeAfter, true);
+ var after$1 = curry$2(beforeAfter, false);
+ var normalizeRange = function (direction, root, range) {
+ var node, container, offset, location;
+ var leanLeft = curry$2(lean, true, root);
+ var leanRight = curry$2(lean, false, root);
+ container = range.startContainer;
+ offset = range.startOffset;
+ if (isCaretContainerBlock(container)) {
+ if (!isElement$5(container)) {
+ container = container.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var mergeWithChildren = function (editor, formatList, vars, node) {
- // Remove/merge children
- each(formatList, function (format) {
- // Merge all children of similar type will move styles from child to parent
- // this: <span style="color:red"><b><span style="color:red; font-size:10px">text</span></b></span>
- // will become: <span style="color:red"><b><span style="font-size:10px">text</span></b></span>
- each(editor.dom.select(format.inline, node), function (child) {
- if (!isElementNode(child)) {
- return;
- }
-
- RemoveFormat.removeFormat(editor, format, vars, child, format.exact ? child : null);
- });
-
- clearChildStyles(editor.dom, format, node);
- });
- };
-
- var mergeWithParents = function (editor, format, name, vars, node) {
- // Remove format if direct parent already has the same format
- if (MatchFormat.matchNode(editor, node.parentNode, name, vars)) {
- if (RemoveFormat.removeFormat(editor, format, vars, node)) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ location = container.getAttribute('data-mce-caret');
+ if (location === 'before') {
+ node = container.nextSibling;
+ if (isFakeCaretTarget(node)) {
+ return before$1(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove format if any ancestor already has the same format
- if (format.merge_with_parents) {
- editor.dom.getParent(node.parentNode, function (parent) {
- if (MatchFormat.matchNode(editor, parent, name, vars)) {
- RemoveFormat.removeFormat(editor, format, vars, node);
- return true;
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (location === 'after') {
+ node = container.previousSibling;
+ if (isFakeCaretTarget(node)) {
+ return after$1(node);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- return {
- mergeWithChildren: mergeWithChildren,
- mergeUnderlineAndColor: mergeUnderlineAndColor,
- mergeBackgroundColorAndFontSize: mergeBackgroundColorAndFontSize,
- mergeSubSup: mergeSubSup,
- mergeSiblings: mergeSiblings,
- mergeWithParents: mergeWithParents
- };
- }
-);
-/**
- * ApplyFormat.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.fmt.ApplyFormat',
- [
- 'tinymce.core.dom.BookmarkManager',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.RangeNormalizer',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.fmt.CaretFormat',
- 'tinymce.core.fmt.ExpandRange',
- 'tinymce.core.fmt.FormatUtils',
- 'tinymce.core.fmt.Hooks',
- 'tinymce.core.fmt.MatchFormat',
- 'tinymce.core.fmt.MergeFormats',
- 'tinymce.core.util.Tools'
- ],
- function (BookmarkManager, NodeType, RangeNormalizer, RangeUtils, CaretFormat, ExpandRange, FormatUtils, Hooks, MatchFormat, MergeFormats, Tools) {
- var each = Tools.each;
-
- var isElementNode = function (node) {
- return node && node.nodeType === 1 && !BookmarkManager.isBookmarkNode(node) && !CaretFormat.isCaretNode(node) && !NodeType.isBogus(node);
- };
-
- var processChildElements = function (node, filter, process) {
- each(node.childNodes, function (node) {
- if (isElementNode(node)) {
- if (filter(node)) {
- process(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (!range.collapsed) {
+ return range;
+ }
+ if ($_ey7ka11qjfuw8ldg.isText(container)) {
+ if (isCaretContainer$2(container)) {
+ if (direction === 1) {
+ node = leanRight(container);
+ if (node) {
+ return before$1(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (node.hasChildNodes()) {
- processChildElements(node, filter, process);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = leanLeft(container);
+ if (node) {
+ return after$1(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- };
-
- var applyFormat = function (ed, name, vars, node) {
- var formatList = ed.formatter.get(name), format = formatList[0], bookmark, rng, isCollapsed = !node && ed.selection.isCollapsed();
- var dom = ed.dom, selection = ed.selection;
-
- var setElementFormat = function (elm, fmt) {
- fmt = fmt || format;
-
- if (elm) {
- if (fmt.onformat) {
- fmt.onformat(elm, fmt, vars, node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (direction === -1) {
+ node = leanLeft(container);
+ if (node) {
+ return after$1(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- each(fmt.styles, function (value, name) {
- dom.setStyle(elm, name, FormatUtils.replaceVars(value, vars));
- });
-
- // Needed for the WebKit span spam bug
- // TODO: Remove this once WebKit/Blink fixes this
- if (fmt.styles) {
- var styleVal = dom.getAttrib(elm, 'style');
-
- if (styleVal) {
- elm.setAttribute('data-mce-style', styleVal);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = leanRight(container);
+ if (node) {
+ return before$1(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- each(fmt.attributes, function (value, name) {
- dom.setAttrib(elm, name, FormatUtils.replaceVars(value, vars));
- });
-
- each(fmt.classes, function (value) {
- value = FormatUtils.replaceVars(value, vars);
-
- if (!dom.hasClass(elm, value)) {
- dom.addClass(elm, value);
- }
- });
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var applyNodeStyle = function (formatList, node) {
- var found = false;
-
- if (!format.selector) {
- return false;
- }
-
- // Look for matching formats
- each(formatList, function (format) {
- // Check collapsed state if it exists
- if ('collapsed' in format && format.collapsed !== isCollapsed) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return range;
+ }
+ if (endsWithCaretContainer(container) && offset >= container.data.length - 1) {
+ if (direction === 1) {
+ node = leanRight(container);
+ if (node) {
+ return before$1(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (dom.is(node, format.selector) && !CaretFormat.isCaretNode(node)) {
- setElementFormat(node, format);
- found = true;
- return false;
- }
- });
-
- return found;
- };
-
- var applyRngStyle = function (dom, rng, bookmark, nodeSpecific) {
- var newWrappers = [], wrapName, wrapElm, contentEditable = true;
-
- // Setup wrapper element
- wrapName = format.inline || format.block;
- wrapElm = dom.create(wrapName);
- setElementFormat(wrapElm);
-
- new RangeUtils(dom).walk(rng, function (nodes) {
- var currentWrapElm;
-
- /**
- * Process a list of nodes wrap them.
- */
- var process = function (node) {
- var nodeName, parentName, hasContentEditableState, lastContentEditable;
-
- lastContentEditable = contentEditable;
- nodeName = node.nodeName.toLowerCase();
- parentName = node.parentNode.nodeName.toLowerCase();
-
- // Node has a contentEditable value
- if (node.nodeType === 1 && dom.getContentEditable(node)) {
- lastContentEditable = contentEditable;
- contentEditable = dom.getContentEditable(node) === "true";
- hasContentEditableState = true; // We don't want to wrap the container only it's children
- }
-
- // Stop wrapping on br elements
- if (FormatUtils.isEq(nodeName, 'br')) {
- currentWrapElm = 0;
-
- // Remove any br elements when we wrap things
- if (format.block) {
- dom.remove(node);
- }
-
- return;
- }
-
- // If node is wrapper type
- if (format.wrapper && MatchFormat.matchNode(ed, node, name, vars)) {
- currentWrapElm = 0;
- return;
- }
-
- // Can we rename the block
- // TODO: Break this if up, too complex
- if (contentEditable && !hasContentEditableState && format.block &&
- !format.wrapper && FormatUtils.isTextBlock(ed, nodeName) && FormatUtils.isValid(ed, parentName, wrapName)) {
- node = dom.rename(node, wrapName);
- setElementFormat(node);
- newWrappers.push(node);
- currentWrapElm = 0;
- return;
- }
-
- // Handle selector patterns
- if (format.selector) {
- var found = applyNodeStyle(formatList, node);
-
- // Continue processing if a selector match wasn't found and a inline element is defined
- if (!format.inline || found) {
- currentWrapElm = 0;
- return;
- }
- }
-
- // Is it valid to wrap this item
- // TODO: Break this if up, too complex
- if (contentEditable && !hasContentEditableState && FormatUtils.isValid(ed, wrapName, nodeName) && FormatUtils.isValid(ed, parentName, wrapName) &&
- !(!nodeSpecific && node.nodeType === 3 &&
- node.nodeValue.length === 1 &&
- node.nodeValue.charCodeAt(0) === 65279) &&
- !CaretFormat.isCaretNode(node) &&
- (!format.inline || !dom.isBlock(node))) {
- // Start wrapping
- if (!currentWrapElm) {
- // Wrap the node
- currentWrapElm = dom.clone(wrapElm, false);
- node.parentNode.insertBefore(currentWrapElm, node);
- newWrappers.push(currentWrapElm);
- }
-
- currentWrapElm.appendChild(node);
- } else {
- // Start a new wrapper for possible children
- currentWrapElm = 0;
-
- each(Tools.grep(node.childNodes), process);
-
- if (hasContentEditableState) {
- contentEditable = lastContentEditable; // Restore last contentEditable state from stack
- }
-
- // End the last wrapper
- currentWrapElm = 0;
- }
- };
-
- // Process siblings from range
- each(nodes, process);
- });
-
- // Apply formats to links as well to get the color of the underline to change as well
- if (format.links === true) {
- each(newWrappers, function (node) {
- var process = function (node) {
- if (node.nodeName === 'A') {
- setElementFormat(node, format);
- }
-
- each(Tools.grep(node.childNodes), process);
- };
-
- process(node);
- });
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Cleanup
- each(newWrappers, function (node) {
- var childCount;
-
- var getChildCount = function (node) {
- var count = 0;
-
- each(node.childNodes, function (node) {
- if (!FormatUtils.isWhiteSpaceNode(node) && !BookmarkManager.isBookmarkNode(node)) {
- count++;
- }
- });
-
- return count;
- };
-
- var getChildElementNode = function (root) {
- var child = false;
- each(root.childNodes, function (node) {
- if (isElementNode(node)) {
- child = node;
- return false; // break loop
- }
- });
- return child;
- };
-
- var mergeStyles = function (node) {
- var child, clone;
-
- child = getChildElementNode(node);
-
- // If child was found and of the same type as the current node
- if (child && !BookmarkManager.isBookmarkNode(child) && MatchFormat.matchName(dom, child, format)) {
- clone = dom.clone(child, false);
- setElementFormat(clone);
-
- dom.replace(clone, node, true);
- dom.remove(child, 1);
- }
-
- return clone || node;
- };
-
- childCount = getChildCount(node);
-
- // Remove empty nodes but only if there is multiple wrappers and they are not block
- // elements so never remove single <h1></h1> since that would remove the
- // current empty block element where the caret is at
- if ((newWrappers.length > 1 || !dom.isBlock(node)) && childCount === 0) {
- dom.remove(node, 1);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return range;
+ }
+ if (startsWithCaretContainer(container) && offset <= 1) {
+ if (direction === -1) {
+ node = leanLeft(container);
+ if (node) {
+ return after$1(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (format.inline || format.wrapper) {
- // Merges the current node with it's children of similar type to reduce the number of elements
- if (!format.exact && childCount === 1) {
- node = mergeStyles(node);
- }
-
- MergeFormats.mergeWithChildren(ed, formatList, vars, node);
- MergeFormats.mergeWithParents(ed, format, name, vars, node);
- MergeFormats.mergeBackgroundColorAndFontSize(dom, format, vars, node);
- MergeFormats.mergeSubSup(dom, format, vars, node);
- MergeFormats.mergeSiblings(dom, format, vars, node);
- }
- });
- };
-
- if (dom.getContentEditable(selection.getNode()) === "false") {
- node = selection.getNode();
- for (var i = 0, l = formatList.length; i < l; i++) {
- if (formatList[i].ceFalseOverride && dom.is(node, formatList[i].selector)) {
- setElementFormat(node, formatList[i]);
- return;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return range;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (format) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (offset === container.data.length) {
+ node = leanRight(container);
</ins><span class="cx" style="display: block; padding: 0 10px"> if (node) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (node.nodeType) {
- if (!applyNodeStyle(formatList, node)) {
- rng = dom.createRng();
- rng.setStartBefore(node);
- rng.setEndAfter(node);
- applyRngStyle(dom, ExpandRange.expandRng(ed, rng, formatList), null, true);
- }
- } else {
- applyRngStyle(dom, node, null, true);
- }
- } else {
- if (!isCollapsed || !format.inline || dom.select('td[data-mce-selected],th[data-mce-selected]').length) {
- // Obtain selection node before selection is unselected by applyRngStyle
- var curSelNode = ed.selection.getNode();
-
- // If the formats have a default block and we can't find a parent block then
- // start wrapping it with a DIV this is for forced_root_blocks: false
- // It's kind of a hack but people should be using the default block type P since all desktop editors work that way
- if (!ed.settings.forced_root_block && formatList[0].defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) {
- applyFormat(ed, formatList[0].defaultBlock);
- }
-
- // Apply formatting to selection
- ed.selection.setRng(RangeNormalizer.normalize(ed.selection.getRng()));
- bookmark = selection.getBookmark();
- applyRngStyle(dom, ExpandRange.expandRng(ed, selection.getRng(true), formatList), bookmark);
-
- if (format.styles) {
- MergeFormats.mergeUnderlineAndColor(dom, format, vars, curSelNode);
- }
-
- selection.moveToBookmark(bookmark);
- FormatUtils.moveStart(dom, selection, selection.getRng(true));
- ed.nodeChanged();
- } else {
- CaretFormat.applyCaretFormat(ed, name, vars);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return before$1(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- Hooks.postProcess(name, ed);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return range;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- return {
- applyFormat: applyFormat
- };
- }
-);
-/**
- * FormatChanged.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.fmt.FormatChanged',
- [
- 'ephox.katamari.api.Cell',
- 'tinymce.core.fmt.FormatUtils',
- 'tinymce.core.fmt.MatchFormat',
- 'tinymce.core.util.Tools'
- ],
- function (Cell, FormatUtils, MatchFormat, Tools) {
- var each = Tools.each;
-
- var setup = function (formatChangeData, editor) {
- var currentFormats = {};
-
- formatChangeData.set({});
-
- editor.on('NodeChange', function (e) {
- var parents = FormatUtils.getParents(editor.dom, e.element), matchedFormats = {};
-
- // Ignore bogus nodes like the <a> tag created by moveStart()
- parents = Tools.grep(parents, function (node) {
- return node.nodeType === 1 && !node.getAttribute('data-mce-bogus');
- });
-
- // Check for new formats
- each(formatChangeData.get(), function (callbacks, format) {
- each(parents, function (node) {
- if (editor.formatter.matchNode(node, format, {}, callbacks.similar)) {
- if (!currentFormats[format]) {
- // Execute callbacks
- each(callbacks, function (callback) {
- callback(true, { node: node, format: format, parents: parents });
- });
-
- currentFormats[format] = callbacks;
- }
-
- matchedFormats[format] = callbacks;
- return false;
- }
-
- if (MatchFormat.matchesUnInheritedFormatSelector(editor, node, format)) {
- return false;
- }
- });
- });
-
- // Check if current formats still match
- each(currentFormats, function (callbacks, format) {
- if (!matchedFormats[format]) {
- delete currentFormats[format];
-
- each(callbacks, function (callback) {
- callback(false, { node: e.element, format: format, parents: parents });
- });
- }
- });
- });
- };
-
- var addListeners = function (formatChangeData, formats, callback, similar) {
- var formatChangeItems = formatChangeData.get();
-
- each(formats.split(','), function (format) {
- if (!formatChangeItems[format]) {
- formatChangeItems[format] = [];
- formatChangeItems[format].similar = similar;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (offset === 0) {
+ node = leanLeft(container);
+ if (node) {
+ return after$1(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- formatChangeItems[format].push(callback);
- });
-
- formatChangeData.set(formatChangeItems);
- };
-
- var formatChanged = function (editor, formatChangeState, formats, callback, similar) {
- if (formatChangeState.get() === null) {
- setup(formatChangeState, editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return range;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return range;
+ };
+ var isNextToContentEditableFalse = function (relativeOffset, caretPosition) {
+ var node = getChildNodeAtRelativeOffset(relativeOffset, caretPosition);
+ return isContentEditableFalse$4(node) && !$_ey7ka11qjfuw8ldg.isBogusAll(node);
+ };
+ var isNextToTable = function (relativeOffset, caretPosition) {
+ return $_ey7ka11qjfuw8ldg.isTable(getChildNodeAtRelativeOffset(relativeOffset, caretPosition));
+ };
+ var getRelativeCefElm = function (forward, caretPosition) {
+ return Option.from(getChildNodeAtRelativeOffset(forward ? 0 : -1, caretPosition)).filter(isContentEditableFalse$4);
+ };
+ var getNormalizedRangeEndPoint = function (direction, root, range) {
+ var normalizedRange = normalizeRange(direction, root, range);
+ if (direction === -1) {
+ return CaretPosition.fromRangeStart(normalizedRange);
+ }
+ return CaretPosition.fromRangeEnd(normalizedRange);
+ };
+ var isBeforeContentEditableFalse = curry$2(isNextToContentEditableFalse, 0);
+ var isAfterContentEditableFalse = curry$2(isNextToContentEditableFalse, -1);
+ var isBeforeTable = curry$2(isNextToTable, 0);
+ var isAfterTable = curry$2(isNextToTable, -1);
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- addListeners(formatChangeState, formats, callback, similar);
- };
-
- return {
- formatChanged: formatChanged
- };
- }
-);
-/**
- * DefaultFormats.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.fmt.DefaultFormats',
- [
- 'tinymce.core.util.Tools'
- ],
- function (Tools) {
- var get = function (dom) {
- var formats = {
- valigntop: [
- { selector: 'td,th', styles: { 'verticalAlign': 'top' } }
- ],
-
- valignmiddle: [
- { selector: 'td,th', styles: { 'verticalAlign': 'middle' } }
- ],
-
- valignbottom: [
- { selector: 'td,th', styles: { 'verticalAlign': 'bottom' } }
- ],
-
- alignleft: [
- {
- selector: 'figure.image',
- collapsed: false,
- classes: 'align-left',
- ceFalseOverride: true,
- preview: 'font-family font-size'
- },
- {
- selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',
- styles: {
- textAlign: 'left'
- },
- inherit: false,
- preview: false,
- defaultBlock: 'div'
- },
- {
- selector: 'img,table',
- collapsed: false,
- styles: {
- 'float': 'left'
- },
- preview: 'font-family font-size'
- }
- ],
-
- aligncenter: [
- {
- selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',
- styles: {
- textAlign: 'center'
- },
- inherit: false,
- preview: 'font-family font-size',
- defaultBlock: 'div'
- },
- {
- selector: 'figure.image',
- collapsed: false,
- classes: 'align-center',
- ceFalseOverride: true,
- preview: 'font-family font-size'
- },
- {
- selector: 'img',
- collapsed: false,
- styles: {
- display: 'block',
- marginLeft: 'auto',
- marginRight: 'auto'
- },
- preview: false
- },
- {
- selector: 'table',
- collapsed: false,
- styles: {
- marginLeft: 'auto',
- marginRight: 'auto'
- },
- preview: 'font-family font-size'
- }
- ],
-
- alignright: [
- {
- selector: 'figure.image',
- collapsed: false,
- classes: 'align-right',
- ceFalseOverride: true,
- preview: 'font-family font-size'
- },
- {
- selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',
- styles: {
- textAlign: 'right'
- },
- inherit: false,
- preview: 'font-family font-size',
- defaultBlock: 'div'
- },
- {
- selector: 'img,table',
- collapsed: false,
- styles: {
- 'float': 'right'
- },
- preview: 'font-family font-size'
- }
- ],
-
- alignjustify: [
- {
- selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',
- styles: {
- textAlign: 'justify'
- },
- inherit: false,
- defaultBlock: 'div',
- preview: 'font-family font-size'
- }
- ],
-
- bold: [
- { inline: 'strong', remove: 'all' },
- { inline: 'span', styles: { fontWeight: 'bold' } },
- { inline: 'b', remove: 'all' }
- ],
-
- italic: [
- { inline: 'em', remove: 'all' },
- { inline: 'span', styles: { fontStyle: 'italic' } },
- { inline: 'i', remove: 'all' }
- ],
-
- underline: [
- { inline: 'span', styles: { textDecoration: 'underline' }, exact: true },
- { inline: 'u', remove: 'all' }
- ],
-
- strikethrough: [
- { inline: 'span', styles: { textDecoration: 'line-through' }, exact: true },
- { inline: 'strike', remove: 'all' }
- ],
-
- forecolor: { inline: 'span', styles: { color: '%value' }, links: true, remove_similar: true, clear_child_styles: true },
- hilitecolor: { inline: 'span', styles: { backgroundColor: '%value' }, links: true, remove_similar: true, clear_child_styles: true },
- fontname: { inline: 'span', styles: { fontFamily: '%value' }, clear_child_styles: true },
- fontsize: { inline: 'span', styles: { fontSize: '%value' }, clear_child_styles: true },
- fontsize_class: { inline: 'span', attributes: { 'class': '%value' } },
- blockquote: { block: 'blockquote', wrapper: 1, remove: 'all' },
- subscript: { inline: 'sub' },
- superscript: { inline: 'sup' },
- code: { inline: 'code' },
-
- link: {
- inline: 'a', selector: 'a', remove: 'all', split: true, deep: true,
- onmatch: function () {
- return true;
- },
-
- onformat: function (elm, fmt, vars) {
- Tools.each(vars, function (value, key) {
- dom.setAttrib(elm, key, value);
- });
- }
- },
-
- removeformat: [
- {
- selector: 'b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins',
- remove: 'all',
- split: true,
- expand: false,
- block_expand: true,
- deep: true
- },
- { selector: 'span', attributes: ['style', 'class'], remove: 'empty', split: true, expand: false, deep: true },
- { selector: '*', attributes: ['style', 'class'], split: false, expand: false, deep: true }
- ]
- };
-
- Tools.each('p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp'.split(/\s/), function (name) {
- formats[name] = { block: name, remove: 'all' };
- });
-
- return formats;
- };
-
- return {
- get: get
- };
- }
-);
-/**
- * FormatRegistry.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.fmt.FormatRegistry',
- [
- 'tinymce.core.fmt.DefaultFormats',
- 'tinymce.core.util.Tools'
- ],
- function (DefaultFormats, Tools) {
- return function (editor) {
- var formats = {};
-
- var get = function (name) {
- return name ? formats[name] : formats;
- };
-
- var register = function (name, format) {
- if (name) {
- if (typeof name !== 'string') {
- Tools.each(name, function (format, name) {
- register(name, format);
- });
- } else {
- // Force format into array and add it to internal collection
- format = format.length ? format : [format];
-
- Tools.each(format, function (format) {
- // Set deep to false by default on selector formats this to avoid removing
- // alignment on images inside paragraphs when alignment is changed on paragraphs
- if (typeof format.deep === 'undefined') {
- format.deep = !format.selector;
- }
-
- // Default to true
- if (typeof format.split === 'undefined') {
- format.split = !format.selector || format.inline;
- }
-
- // Default to true
- if (typeof format.remove === 'undefined' && format.selector && !format.inline) {
- format.remove = 'none';
- }
-
- // Mark format as a mixed format inline + block level
- if (format.selector && format.inline) {
- format.mixed = true;
- format.block_expand = true;
- }
-
- // Split classes if needed
- if (typeof format.classes === 'string') {
- format.classes = format.classes.split(/\s+/);
- }
- });
-
- formats[name] = format;
- }
- }
- };
-
- var unregister = function (name) {
- if (name && formats[name]) {
- delete formats[name];
- }
-
- return formats;
- };
-
- register(DefaultFormats.get(editor.dom));
- register(editor.settings.formats);
-
- return {
- get: get,
- register: register,
- unregister: unregister
- };
- };
- }
-);
-
-/**
- * Preview.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Internal class for generating previews styles for formats.
- *
- * Example:
- * Preview.getCssText(editor, 'bold');
- *
- * @private
- * @class tinymce.fmt.Preview
- */
-define(
- 'tinymce.core.fmt.Preview',
- [
- "tinymce.core.dom.DOMUtils",
- "tinymce.core.util.Tools",
- "tinymce.core.html.Schema"
- ],
- function (DOMUtils, Tools, Schema) {
- var each = Tools.each;
- var dom = DOMUtils.DOM;
-
- function parsedSelectorToHtml(ancestry, editor) {
- var elm, item, fragment;
- var schema = editor && editor.schema || new Schema({});
-
- function decorate(elm, item) {
- if (item.classes.length) {
- dom.addClass(elm, item.classes.join(' '));
- }
- dom.setAttribs(elm, item.attrs);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var HDirection;
+ (function (HDirection) {
+ HDirection[HDirection['Backwards'] = -1] = 'Backwards';
+ HDirection[HDirection['Forwards'] = 1] = 'Forwards';
+ }(HDirection || (HDirection = {})));
+ var isContentEditableFalse$5 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var isText$6 = $_ey7ka11qjfuw8ldg.isText;
+ var isElement$6 = $_ey7ka11qjfuw8ldg.isElement;
+ var isBr$4 = $_ey7ka11qjfuw8ldg.isBr;
+ var isCaretCandidate$3 = isCaretCandidate;
+ var isAtomic$1 = isAtomic;
+ var isEditableCaretCandidate$1 = isEditableCaretCandidate;
+ var getParents = function (node, root) {
+ var parents = [];
+ while (node && node !== root) {
+ parents.push(node);
+ node = node.parentNode;
+ }
+ return parents;
+ };
+ var nodeAtIndex = function (container, offset) {
+ if (container.hasChildNodes() && offset < container.childNodes.length) {
+ return container.childNodes[offset];
+ }
+ return null;
+ };
+ var getCaretCandidatePosition = function (direction, node) {
+ if (isForwards(direction)) {
+ if (isCaretCandidate$3(node.previousSibling) && !isText$6(node.previousSibling)) {
+ return CaretPosition$1.before(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function createElement(sItem) {
- var elm;
-
- item = typeof sItem === 'string' ? {
- name: sItem,
- classes: [],
- attrs: {}
- } : sItem;
-
- elm = dom.create(item.name);
- decorate(elm, item);
- return elm;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isText$6(node)) {
+ return CaretPosition$1(node, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getRequiredParent(elm, candidate) {
- var name = typeof elm !== 'string' ? elm.nodeName.toLowerCase() : elm;
- var elmRule = schema.getElementRule(name);
- var parentsRequired = elmRule && elmRule.parentsRequired;
-
- if (parentsRequired && parentsRequired.length) {
- return candidate && Tools.inArray(parentsRequired, candidate) !== -1 ? candidate : parentsRequired[0];
- } else {
- return false;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (isBackwards(direction)) {
+ if (isCaretCandidate$3(node.nextSibling) && !isText$6(node.nextSibling)) {
+ return CaretPosition$1.after(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function wrapInHtml(elm, ancestry, siblings) {
- var parent, parentCandidate, parentRequired;
- var ancestor = ancestry.length > 0 && ancestry[0];
- var ancestorName = ancestor && ancestor.name;
-
- parentRequired = getRequiredParent(elm, ancestorName);
-
- if (parentRequired) {
- if (ancestorName === parentRequired) {
- parentCandidate = ancestry[0];
- ancestry = ancestry.slice(1);
- } else {
- parentCandidate = parentRequired;
- }
- } else if (ancestor) {
- parentCandidate = ancestry[0];
- ancestry = ancestry.slice(1);
- } else if (!siblings) {
- return elm;
- }
-
- if (parentCandidate) {
- parent = createElement(parentCandidate);
- parent.appendChild(elm);
- }
-
- if (siblings) {
- if (!parent) {
- // if no more ancestry, wrap in generic div
- parent = dom.create('div');
- parent.appendChild(elm);
- }
-
- Tools.each(siblings, function (sibling) {
- var siblingElm = createElement(sibling);
- parent.insertBefore(siblingElm, elm);
- });
- }
-
- return wrapInHtml(parent, ancestry, parentCandidate && parentCandidate.siblings);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isText$6(node)) {
+ return CaretPosition$1(node, node.data.length);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (ancestry && ancestry.length) {
- item = ancestry[0];
- elm = createElement(item);
- fragment = dom.create('div');
- fragment.appendChild(wrapInHtml(elm, ancestry.slice(1), item.siblings));
- return fragment;
- } else {
- return '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (isBackwards(direction)) {
+ if (isBr$4(node)) {
+ return CaretPosition$1.before(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return CaretPosition$1.after(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
- function selectorToHtml(selector, editor) {
- return parsedSelectorToHtml(parseSelector(selector), editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return CaretPosition$1.before(node);
+ };
+ var isBrBeforeBlock = function (node, root) {
+ var next;
+ if (!$_ey7ka11qjfuw8ldg.isBr(node)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
- function parseSelectorItem(item) {
- var tagName;
- var obj = {
- classes: [],
- attrs: {}
- };
-
- item = obj.selector = Tools.trim(item);
-
- if (item !== '*') {
- // matching IDs, CLASSes, ATTRIBUTES and PSEUDOs
- tagName = item.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g, function ($0, $1, $2, $3, $4) {
- switch ($1) {
- case '#':
- obj.attrs.id = $2;
- break;
-
- case '.':
- obj.classes.push($2);
- break;
-
- case ':':
- if (Tools.inArray('checked disabled enabled read-only required'.split(' '), $2) !== -1) {
- obj.attrs[$2] = $2;
- }
- break;
- }
-
- // atribute matched
- if ($3 === '[') {
- var m = $4.match(/([\w\-]+)(?:\=\"([^\"]+))?/);
- if (m) {
- obj.attrs[m[1]] = m[2];
- }
- }
-
- return '';
- });
- }
-
- obj.name = tagName || 'div';
- return obj;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ next = findCaretPosition(1, CaretPosition$1.after(node), root);
+ if (!next) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
- function parseSelector(selector) {
- if (!selector || typeof selector !== 'string') {
- return [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return !isInSameBlock(CaretPosition$1.before(node), CaretPosition$1.before(next), root);
+ };
+ var findCaretPosition = function (direction, startPos, root) {
+ var node, nextNode, innerNode;
+ var rootContentEditableFalseElm, caretPosition;
+ if (!isElement$6(root) || !startPos) {
+ return null;
+ }
+ if (startPos.isEqual(CaretPosition$1.after(root)) && root.lastChild) {
+ caretPosition = CaretPosition$1.after(root.lastChild);
+ if (isBackwards(direction) && isCaretCandidate$3(root.lastChild) && isElement$6(root.lastChild)) {
+ return isBr$4(root.lastChild) ? CaretPosition$1.before(root.lastChild) : caretPosition;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // take into account only first one
- selector = selector.split(/\s*,\s*/)[0];
-
- // tighten
- selector = selector.replace(/\s*(~\+|~|\+|>)\s*/g, '$1');
-
- // split either on > or on space, but not the one inside brackets
- return Tools.map(selector.split(/(?:>|\s+(?![^\[\]]+\]))/), function (item) {
- // process each sibling selector separately
- var siblings = Tools.map(item.split(/(?:~\+|~|\+)/), parseSelectorItem);
- var obj = siblings.pop(); // the last one is our real target
-
- if (siblings.length) {
- obj.siblings = siblings;
- }
- return obj;
- }).reverse();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ caretPosition = startPos;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-
- function getCssText(editor, format) {
- var name, previewFrag, previewElm, items;
- var previewCss = '', parentFontSize, previewStyles;
-
- previewStyles = editor.settings.preview_styles;
-
- // No preview forced
- if (previewStyles === false) {
- return '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var container = caretPosition.container();
+ var offset = caretPosition.offset();
+ if (isText$6(container)) {
+ if (isBackwards(direction) && offset > 0) {
+ return CaretPosition$1(container, --offset);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Default preview
- if (typeof previewStyles !== 'string') {
- previewStyles = 'font-family font-size font-weight font-style text-decoration ' +
- 'text-transform color background-color border border-radius outline text-shadow';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isForwards(direction) && offset < container.length) {
+ return CaretPosition$1(container, ++offset);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Removes any variables since these can't be previewed
- function removeVars(val) {
- return val.replace(/%(\w+)/g, '');
- }
-
- // Create block/inline element to use for preview
- if (typeof format === "string") {
- format = editor.formatter.get(format);
- if (!format) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = container;
+ } else {
+ if (isBackwards(direction) && offset > 0) {
+ nextNode = nodeAtIndex(container, offset - 1);
+ if (isCaretCandidate$3(nextNode)) {
+ if (!isAtomic$1(nextNode)) {
+ innerNode = findNode(nextNode, direction, isEditableCaretCandidate$1, nextNode);
+ if (innerNode) {
+ if (isText$6(innerNode)) {
+ return CaretPosition$1(innerNode, innerNode.data.length);
+ }
+ return CaretPosition$1.after(innerNode);
+ }
+ }
+ if (isText$6(nextNode)) {
+ return CaretPosition$1(nextNode, nextNode.data.length);
+ }
+ return CaretPosition$1.before(nextNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- format = format[0];
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Format specific preview override
- // TODO: This should probably be further reduced by the previewStyles option
- if ('preview' in format) {
- previewStyles = format.preview;
- if (previewStyles === false) {
- return '';
- }
- }
-
- name = format.block || format.inline || 'span';
-
- items = parseSelector(format.selector);
- if (items.length) {
- if (!items[0].name) { // e.g. something like ul > .someClass was provided
- items[0].name = name;
- }
- name = format.selector;
- previewFrag = parsedSelectorToHtml(items, editor);
- } else {
- previewFrag = parsedSelectorToHtml([name], editor);
- }
-
- previewElm = dom.select(name, previewFrag)[0] || previewFrag.firstChild;
-
- // Add format styles to preview element
- each(format.styles, function (value, name) {
- value = removeVars(value);
-
- if (value) {
- dom.setStyle(previewElm, name, value);
- }
- });
-
- // Add attributes to preview element
- each(format.attributes, function (value, name) {
- value = removeVars(value);
-
- if (value) {
- dom.setAttrib(previewElm, name, value);
- }
- });
-
- // Add classes to preview element
- each(format.classes, function (value) {
- value = removeVars(value);
-
- if (!dom.hasClass(previewElm, value)) {
- dom.addClass(previewElm, value);
- }
- });
-
- editor.fire('PreviewFormats');
-
- // Add the previewElm outside the visual area
- dom.setStyles(previewFrag, { position: 'absolute', left: -0xFFFF });
- editor.getBody().appendChild(previewFrag);
-
- // Get parent container font size so we can compute px values out of em/% for older IE:s
- parentFontSize = dom.getStyle(editor.getBody(), 'fontSize', true);
- parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0;
-
- each(previewStyles.split(' '), function (name) {
- var value = dom.getStyle(previewElm, name, true);
-
- // If background is transparent then check if the body has a background color we can use
- if (name === 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) {
- value = dom.getStyle(editor.getBody(), name, true);
-
- // Ignore white since it's the default color, not the nicest fix
- // TODO: Fix this by detecting runtime style
- if (dom.toHex(value).toLowerCase() === '#ffffff') {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isForwards(direction) && offset < container.childNodes.length) {
+ nextNode = nodeAtIndex(container, offset);
+ if (isCaretCandidate$3(nextNode)) {
+ if (isBr$4(nextNode) && root.lastChild === nextNode) {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- if (name === 'color') {
- // Ignore black since it's the default color, not the nicest fix
- // TODO: Fix this by detecting runtime style
- if (dom.toHex(value).toLowerCase() === '#000000') {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isBrBeforeBlock(nextNode, root)) {
+ return findCaretPosition(direction, CaretPosition$1.after(nextNode), root);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Old IE won't calculate the font size so we need to do that manually
- if (name === 'font-size') {
- if (/em|%$/.test(value)) {
- if (parentFontSize === 0) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!isAtomic$1(nextNode)) {
+ innerNode = findNode(nextNode, direction, isEditableCaretCandidate$1, nextNode);
+ if (innerNode) {
+ if (isText$6(innerNode)) {
+ return CaretPosition$1(innerNode, 0);
+ }
+ return CaretPosition$1.before(innerNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Convert font size from em/% to px
- value = parseFloat(value, 10) / (/%$/.test(value) ? 100 : 1);
- value = (value * parentFontSize) + 'px';
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isText$6(nextNode)) {
+ return CaretPosition$1(nextNode, 0);
+ }
+ return CaretPosition$1.after(nextNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (name === "border" && value) {
- previewCss += 'padding:0 2px;';
- }
-
- previewCss += name + ':' + value + ';';
- });
-
- editor.fire('AfterPreviewFormats');
-
- //previewCss += 'line-height:normal';
-
- dom.remove(previewFrag);
-
- return previewCss;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ node = nextNode ? nextNode : caretPosition.getNode();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- getCssText: getCssText,
- parseSelector: parseSelector,
- selectorToHtml: selectorToHtml
- };
- }
-);
-
-/**
- * ToggleFormat.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.fmt.ToggleFormat',
- [
- 'tinymce.core.fmt.ApplyFormat',
- 'tinymce.core.fmt.MatchFormat',
- 'tinymce.core.fmt.RemoveFormat'
- ],
- function (ApplyFormat, MatchFormat, RemoveFormat) {
- var toggle = function (editor, formats, name, vars, node) {
- var fmt = formats.get(name);
-
- if (MatchFormat.match(editor, name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) {
- RemoveFormat.remove(editor, name, vars, node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isForwards(direction) && caretPosition.isAtEnd() || isBackwards(direction) && caretPosition.isAtStart()) {
+ node = findNode(node, direction, $_ebfy8j25jfuw8li1.constant(true), root, true);
+ if (isEditableCaretCandidate$1(node, root)) {
+ return getCaretCandidatePosition(direction, node);
+ }
+ }
+ nextNode = findNode(node, direction, isEditableCaretCandidate$1, root);
+ rootContentEditableFalseElm = $_djuh8tljfuw8l74.last($_djuh8tljfuw8l74.filter(getParents(container, root), isContentEditableFalse$5));
+ if (rootContentEditableFalseElm && (!nextNode || !rootContentEditableFalseElm.contains(nextNode))) {
+ if (isForwards(direction)) {
+ caretPosition = CaretPosition$1.after(rootContentEditableFalseElm);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ApplyFormat.applyFormat(editor, name, vars, node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ caretPosition = CaretPosition$1.before(rootContentEditableFalseElm);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return caretPosition;
+ }
+ if (nextNode) {
+ return getCaretCandidatePosition(direction, nextNode);
+ }
+ return null;
+ };
+ var CaretWalker = function (root) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- toggle: toggle
- };
- }
-);
-
-/**
- * FormatShortcuts.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.FormatShortcuts',
- [
- ],
- function () {
- var setup = function (editor) {
- // Add some inline shortcuts
- editor.addShortcut('meta+b', '', 'Bold');
- editor.addShortcut('meta+i', '', 'Italic');
- editor.addShortcut('meta+u', '', 'Underline');
-
- // BlockFormat shortcuts keys
- for (var i = 1; i <= 6; i++) {
- editor.addShortcut('access+' + i, '', ['FormatBlock', false, 'h' + i]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ next: function (caretPosition) {
+ return findCaretPosition(HDirection.Forwards, caretPosition, root);
+ },
+ prev: function (caretPosition) {
+ return findCaretPosition(HDirection.Backwards, caretPosition, root);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.addShortcut('access+7', '', ['FormatBlock', false, 'p']);
- editor.addShortcut('access+8', '', ['FormatBlock', false, 'div']);
- editor.addShortcut('access+9', '', ['FormatBlock', false, 'address']);
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- setup: setup
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasOnlyOneChild = function (node) {
+ return node.firstChild && node.firstChild === node.lastChild;
+ };
+ var isPaddingNode = function (node) {
+ return node.name === 'br' || node.value === '\xA0';
+ };
+ var isPaddedEmptyBlock = function (schema, node) {
+ var blockElements = schema.getBlockElements();
+ return blockElements[node.name] && hasOnlyOneChild(node) && isPaddingNode(node.firstChild);
+ };
+ var isEmptyFragmentElement = function (schema, node) {
+ var nonEmptyElements = schema.getNonEmptyElements();
+ return node && (node.isEmpty(nonEmptyElements) || isPaddedEmptyBlock(schema, node));
+ };
+ var isListFragment = function (schema, fragment) {
+ var firstChild = fragment.firstChild;
+ var lastChild = fragment.lastChild;
+ if (firstChild && firstChild.name === 'meta') {
+ firstChild = firstChild.next;
+ }
+ if (lastChild && lastChild.attr('id') === 'mce_marker') {
+ lastChild = lastChild.prev;
+ }
+ if (isEmptyFragmentElement(schema, lastChild)) {
+ lastChild = lastChild.prev;
+ }
+ if (!firstChild || firstChild !== lastChild) {
+ return false;
+ }
+ return firstChild.name === 'ul' || firstChild.name === 'ol';
+ };
+ var cleanupDomFragment = function (domFragment) {
+ var firstChild = domFragment.firstChild;
+ var lastChild = domFragment.lastChild;
+ if (firstChild && firstChild.nodeName === 'META') {
+ firstChild.parentNode.removeChild(firstChild);
+ }
+ if (lastChild && lastChild.id === 'mce_marker') {
+ lastChild.parentNode.removeChild(lastChild);
+ }
+ return domFragment;
+ };
+ var toDomFragment = function (dom, serializer, fragment) {
+ var html = serializer.serialize(fragment);
+ var domFragment = dom.createFragment(html);
+ return cleanupDomFragment(domFragment);
+ };
+ var listItems$1 = function (elm) {
+ return $_52qop8kjfuw8l6v.grep(elm.childNodes, function (child) {
+ return child.nodeName === 'LI';
+ });
+ };
+ var isPadding = function (node) {
+ return node.data === '\xA0' || $_ey7ka11qjfuw8ldg.isBr(node);
+ };
+ var isListItemPadded = function (node) {
+ return node && node.firstChild && node.firstChild === node.lastChild && isPadding(node.firstChild);
+ };
+ var isEmptyOrPadded = function (elm) {
+ return !elm.firstChild || isListItemPadded(elm);
+ };
+ var trimListItems = function (elms) {
+ return elms.length > 0 && isEmptyOrPadded(elms[elms.length - 1]) ? elms.slice(0, -1) : elms;
+ };
+ var getParentLi = function (dom, node) {
+ var parentBlock = dom.getParent(node, dom.isBlock);
+ return parentBlock && parentBlock.nodeName === 'LI' ? parentBlock : null;
+ };
+ var isParentBlockLi = function (dom, node) {
+ return !!getParentLi(dom, node);
+ };
+ var getSplit = function (parentNode, rng) {
+ var beforeRng = rng.cloneRange();
+ var afterRng = rng.cloneRange();
+ beforeRng.setStartBefore(parentNode);
+ afterRng.setEndAfter(parentNode);
+ return [
+ beforeRng.cloneContents(),
+ afterRng.cloneContents()
+ ];
+ };
+ var findFirstIn = function (node, rootNode) {
+ var caretPos = CaretPosition$1.before(node);
+ var caretWalker = CaretWalker(rootNode);
+ var newCaretPos = caretWalker.next(caretPos);
+ return newCaretPos ? newCaretPos.toRange() : null;
+ };
+ var findLastOf = function (node, rootNode) {
+ var caretPos = CaretPosition$1.after(node);
+ var caretWalker = CaretWalker(rootNode);
+ var newCaretPos = caretWalker.prev(caretPos);
+ return newCaretPos ? newCaretPos.toRange() : null;
+ };
+ var insertMiddle = function (target, elms, rootNode, rng) {
+ var parts = getSplit(target, rng);
+ var parentElm = target.parentNode;
+ parentElm.insertBefore(parts[0], target);
+ $_52qop8kjfuw8l6v.each(elms, function (li) {
+ parentElm.insertBefore(li, target);
+ });
+ parentElm.insertBefore(parts[1], target);
+ parentElm.removeChild(target);
+ return findLastOf(elms[elms.length - 1], rootNode);
+ };
+ var insertBefore = function (target, elms, rootNode) {
+ var parentElm = target.parentNode;
+ $_52qop8kjfuw8l6v.each(elms, function (elm) {
+ parentElm.insertBefore(elm, target);
+ });
+ return findFirstIn(target, rootNode);
+ };
+ var insertAfter = function (target, elms, rootNode, dom) {
+ dom.insertAfter(elms.reverse(), target);
+ return findLastOf(elms[0], rootNode);
+ };
+ var insertAtCaret = function (serializer, dom, rng, fragment) {
+ var domFragment = toDomFragment(dom, serializer, fragment);
+ var liTarget = getParentLi(dom, rng.startContainer);
+ var liElms = trimListItems(listItems$1(domFragment.firstChild));
+ var BEGINNING = 1, END = 2;
+ var rootNode = dom.getRoot();
+ var isAt = function (location) {
+ var caretPos = CaretPosition$1.fromRangeStart(rng);
+ var caretWalker = CaretWalker(dom.getRoot());
+ var newPos = location === BEGINNING ? caretWalker.prev(caretPos) : caretWalker.next(caretPos);
+ return newPos ? getParentLi(dom, newPos.getNode()) !== liTarget : true;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isAt(BEGINNING)) {
+ return insertBefore(liTarget, liElms, rootNode);
+ } else if (isAt(END)) {
+ return insertAfter(liTarget, liElms, rootNode, dom);
+ }
+ return insertMiddle(liTarget, liElms, rootNode, rng);
+ };
+ var $_5shtl51xjfuw8lgk = {
+ isListFragment: isListFragment,
+ insertAtCaret: insertAtCaret,
+ isParentBlockLi: isParentBlockLi,
+ trimListItems: trimListItems,
+ listItems: listItems$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Formatter.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Text formatter engine class. This class is used to apply formats like bold, italic, font size
- * etc to the current selection or specific nodes. This engine was built to replace the browser's
- * default formatting logic for execCommand due to its inconsistent and buggy behavior.
- *
- * @class tinymce.Formatter
- * @example
- * tinymce.activeEditor.formatter.register('mycustomformat', {
- * inline: 'span',
- * styles: {color: '#ff0000'}
- * });
- *
- * tinymce.activeEditor.formatter.apply('mycustomformat');
- */
-define(
- 'tinymce.core.api.Formatter',
- [
- 'ephox.katamari.api.Cell',
- 'ephox.katamari.api.Fun',
- 'tinymce.core.fmt.ApplyFormat',
- 'tinymce.core.fmt.FormatChanged',
- 'tinymce.core.fmt.FormatRegistry',
- 'tinymce.core.fmt.MatchFormat',
- 'tinymce.core.fmt.Preview',
- 'tinymce.core.fmt.RemoveFormat',
- 'tinymce.core.fmt.ToggleFormat',
- 'tinymce.core.keyboard.FormatShortcuts'
- ],
- function (Cell, Fun, ApplyFormat, FormatChanged, FormatRegistry, MatchFormat, Preview, RemoveFormat, ToggleFormat, FormatShortcuts) {
- /**
- * Constructs a new formatter instance.
- *
- * @constructor Formatter
- * @param {tinymce.Editor} ed Editor instance to construct the formatter engine to.
- */
- return function (editor) {
- var formats = FormatRegistry(editor);
- var formatChangeState = Cell(null);
-
- FormatShortcuts.setup(editor);
-
- return {
- /**
- * Returns the format by name or all formats if no name is specified.
- *
- * @method get
- * @param {String} name Optional name to retrieve by.
- * @return {Array/Object} Array/Object with all registered formats or a specific format.
- */
- get: formats.get,
-
- /**
- * Registers a specific format by name.
- *
- * @method register
- * @param {Object/String} name Name of the format for example "bold".
- * @param {Object/Array} format Optional format object or array of format variants
- * can only be omitted if the first arg is an object.
- */
- register: formats.register,
-
- /**
- * Unregister a specific format by name.
- *
- * @method unregister
- * @param {String} name Name of the format for example "bold".
- */
- unregister: formats.unregister,
-
- /**
- * Applies the specified format to the current selection or specified node.
- *
- * @method apply
- * @param {String} name Name of format to apply.
- * @param {Object} vars Optional list of variables to replace within format before applying it.
- * @param {Node} node Optional node to apply the format to defaults to current selection.
- */
- apply: Fun.curry(ApplyFormat.applyFormat, editor),
-
- /**
- * Removes the specified format from the current selection or specified node.
- *
- * @method remove
- * @param {String} name Name of format to remove.
- * @param {Object} vars Optional list of variables to replace within format before removing it.
- * @param {Node/Range} node Optional node or DOM range to remove the format from defaults to current selection.
- */
- remove: Fun.curry(RemoveFormat.remove, editor),
-
- /**
- * Toggles the specified format on/off.
- *
- * @method toggle
- * @param {String} name Name of format to apply/remove.
- * @param {Object} vars Optional list of variables to replace within format before applying/removing it.
- * @param {Node} node Optional node to apply the format to or remove from. Defaults to current selection.
- */
- toggle: Fun.curry(ToggleFormat.toggle, editor, formats),
-
- /**
- * Matches the current selection or specified node against the specified format name.
- *
- * @method match
- * @param {String} name Name of format to match.
- * @param {Object} vars Optional list of variables to replace before checking it.
- * @param {Node} node Optional node to check.
- * @return {boolean} true/false if the specified selection/node matches the format.
- */
- match: Fun.curry(MatchFormat.match, editor),
-
- /**
- * Matches the current selection against the array of formats and returns a new array with matching formats.
- *
- * @method matchAll
- * @param {Array} names Name of format to match.
- * @param {Object} vars Optional list of variables to replace before checking it.
- * @return {Array} Array with matched formats.
- */
- matchAll: Fun.curry(MatchFormat.matchAll, editor),
-
- /**
- * Return true/false if the specified node has the specified format.
- *
- * @method matchNode
- * @param {Node} node Node to check the format on.
- * @param {String} name Format name to check.
- * @param {Object} vars Optional list of variables to replace before checking it.
- * @param {Boolean} similar Match format that has similar properties.
- * @return {Object} Returns the format object it matches or undefined if it doesn't match.
- */
- matchNode: Fun.curry(MatchFormat.matchNode, editor),
-
- /**
- * Returns true/false if the specified format can be applied to the current selection or not. It
- * will currently only check the state for selector formats, it returns true on all other format types.
- *
- * @method canApply
- * @param {String} name Name of format to check.
- * @return {boolean} true/false if the specified format can be applied to the current selection/node.
- */
- canApply: Fun.curry(MatchFormat.canApply, editor),
-
- /**
- * Executes the specified callback when the current selection matches the formats or not.
- *
- * @method formatChanged
- * @param {String} formats Comma separated list of formats to check for.
- * @param {function} callback Callback with state and args when the format is changed/toggled on/off.
- * @param {Boolean} similar True/false state if the match should handle similar or exact formats.
- */
- formatChanged: Fun.curry(FormatChanged.formatChanged, editor, formatChangeState),
-
- /**
- * Returns a preview css text for the specified format.
- *
- * @method getCssText
- * @param {String/Object} format Format to generate preview css text for.
- * @return {String} Css text for the specified format.
- * @example
- * var cssText1 = editor.formatter.getCssText('bold');
- * var cssText2 = editor.formatter.getCssText({inline: 'b'});
- */
- getCssText: Fun.curry(Preview.getCssText, editor)
- };
- };
- }
-);
-
-define(
- 'ephox.sugar.api.properties.Attr',
-
- [
- 'ephox.katamari.api.Type',
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Obj',
- 'ephox.sugar.api.node.Node',
- 'global!Error',
- 'global!console'
- ],
-
- /*
- * Direct attribute manipulation has been around since IE8, but
- * was apparently unstable until IE10.
- */
- function (Type, Arr, Obj, Node, Error, console) {
- var rawSet = function (dom, key, value) {
- /*
- * JQuery coerced everything to a string, and silently did nothing on text node/null/undefined.
- *
- * We fail on those invalid cases, only allowing numbers and booleans.
- */
- if (Type.isString(value) || Type.isBoolean(value) || Type.isNumber(value)) {
- dom.setAttribute(key, value + '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isText$7 = $_ey7ka11qjfuw8ldg.isText;
+ var isBogus$1 = $_ey7ka11qjfuw8ldg.isBogus;
+ var nodeIndex$1 = DOMUtils$1.nodeIndex;
+ var normalizedParent = function (node) {
+ var parentNode = node.parentNode;
+ if (isBogus$1(parentNode)) {
+ return normalizedParent(parentNode);
+ }
+ return parentNode;
+ };
+ var getChildNodes = function (node) {
+ if (!node) {
+ return [];
+ }
+ return $_djuh8tljfuw8l74.reduce(node.childNodes, function (result, node) {
+ if (isBogus$1(node) && node.nodeName !== 'BR') {
+ result = result.concat(getChildNodes(node));
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- console.error('Invalid call to Attr.set. Key ', key, ':: Value ', value, ':: Element ', dom);
- throw new Error('Attribute value was not simple');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ result.push(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var set = function (element, key, value) {
- rawSet(element.dom(), key, value);
- };
-
- var setAll = function (element, attrs) {
- var dom = element.dom();
- Obj.each(attrs, function (v, k) {
- rawSet(dom, k, v);
- });
- };
-
- var get = function (element, key) {
- var v = element.dom().getAttribute(key);
-
- // undefined is the more appropriate value for JS, and this matches JQuery
- return v === null ? undefined : v;
- };
-
- var has = function (element, key) {
- var dom = element.dom();
-
- // return false for non-element nodes, no point in throwing an error
- return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
- };
-
- var remove = function (element, key) {
- element.dom().removeAttribute(key);
- };
-
- var hasNone = function (element) {
- var attrs = element.dom().attributes;
- return attrs === undefined || attrs === null || attrs.length === 0;
- };
-
- var clone = function (element) {
- return Arr.foldl(element.dom().attributes, function (acc, attr) {
- acc[attr.name] = attr.value;
- return acc;
- }, {});
- };
-
- var transferOne = function (source, destination, attr) {
- // NOTE: We don't want to clobber any existing attributes
- if (has(source, attr) && !has(destination, attr)) set(destination, attr, get(source, attr));
- };
-
- // Transfer attributes(attrs) from source to destination, unless they are already present
- var transfer = function (source, destination, attrs) {
- if (!Node.isElement(source) || !Node.isElement(destination)) return;
- Arr.each(attrs, function (attr) {
- transferOne(source, destination, attr);
- });
- };
-
- return {
- clone: clone,
- set: set,
- setAll: setAll,
- get: get,
- has: has,
- remove: remove,
- hasNone: hasNone,
- transfer: transfer
- };
- }
-);
-
-define(
- 'ephox.sugar.impl.Style',
-
- [
-
- ],
-
- function () {
- // some elements, such as mathml, don't have style attributes
- var isSupported = function (dom) {
- return dom.style !== undefined;
- };
-
- return {
- isSupported: isSupported
- };
- }
-);
-defineGlobal("global!window", window);
-define(
- 'ephox.sugar.api.properties.Css',
-
- [
- 'ephox.katamari.api.Type',
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Obj',
- 'ephox.katamari.api.Option',
- 'ephox.sugar.api.properties.Attr',
- 'ephox.sugar.api.node.Body',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.node.Node',
- 'ephox.sugar.impl.Style',
- 'ephox.katamari.api.Strings',
- 'global!Error',
- 'global!console',
- 'global!window'
- ],
-
- function (Type, Arr, Obj, Option, Attr, Body, Element, Node, Style, Strings, Error, console, window) {
- var internalSet = function (dom, property, value) {
- // This is going to hurt. Apologies.
- // JQuery coerces numbers to pixels for certain property names, and other times lets numbers through.
- // we're going to be explicit; strings only.
- if (!Type.isString(value)) {
- console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
- throw new Error('CSS value must be a string: ' + value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return result;
+ }, []);
+ };
+ var normalizedTextOffset = function (node, offset) {
+ while (node = node.previousSibling) {
+ if (!isText$7(node)) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // removed: support for dom().style[property] where prop is camel case instead of normal property name
- if (Style.isSupported(dom)) dom.style.setProperty(property, value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ offset += node.data.length;
+ }
+ return offset;
+ };
+ var equal$1 = function (a) {
+ return function (b) {
+ return a === b;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var internalRemove = function (dom, property) {
- /*
- * IE9 and above - MDN doesn't have details, but here's a couple of random internet claims
- *
- * http://help.dottoro.com/ljopsjck.php
- * http://stackoverflow.com/a/7901886/7546
- */
- if (Style.isSupported(dom)) dom.style.removeProperty(property);
- };
-
- var set = function (element, property, value) {
- var dom = element.dom();
- internalSet(dom, property, value);
- };
-
- var setAll = function (element, css) {
- var dom = element.dom();
-
- Obj.each(css, function (v, k) {
- internalSet(dom, k, v);
- });
- };
-
- var setOptions = function(element, css) {
- var dom = element.dom();
-
- Obj.each(css, function (v, k) {
- v.fold(function () {
- internalRemove(dom, k);
- }, function (value) {
- internalSet(dom, k, value);
- });
- });
- };
-
- /*
- * NOTE: For certain properties, this returns the "used value" which is subtly different to the "computed value" (despite calling getComputedStyle).
- * Blame CSS 2.0.
- *
- * https://developer.mozilla.org/en-US/docs/Web/CSS/used_value
- */
- var get = function (element, property) {
- var dom = element.dom();
- /*
- * IE9 and above per
- * https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle
- *
- * Not in numerosity, because it doesn't memoize and looking this up dynamically in performance critical code would be horrendous.
- *
- * JQuery has some magic here for IE popups, but we don't really need that.
- * It also uses element.ownerDocument.defaultView to handle iframes but that hasn't been required since FF 3.6.
- */
- var styles = window.getComputedStyle(dom);
- var r = styles.getPropertyValue(property);
-
- // jquery-ism: If r is an empty string, check that the element is not in a document. If it isn't, return the raw value.
- // Turns out we do this a lot.
- var v = (r === '' && !Body.inBody(element)) ? getUnsafeProperty(dom, property) : r;
-
- // undefined is the more appropriate value for JS. JQuery coerces to an empty string, but screw that!
- return v === null ? undefined : v;
- };
-
- var getUnsafeProperty = function (dom, property) {
- // removed: support for dom().style[property] where prop is camel case instead of normal property name
- // empty string is what the browsers (IE11 and Chrome) return when the propertyValue doesn't exists.
- return Style.isSupported(dom) ? dom.style.getPropertyValue(property) : '';
- };
-
- /*
- * Gets the raw value from the style attribute. Useful for retrieving "used values" from the DOM:
- * https://developer.mozilla.org/en-US/docs/Web/CSS/used_value
- *
- * Returns NONE if the property isn't set, or the value is an empty string.
- */
- var getRaw = function (element, property) {
- var dom = element.dom();
- var raw = getUnsafeProperty(dom, property);
-
- return Option.from(raw).filter(function (r) { return r.length > 0; });
- };
-
- var isValidValue = function (tag, property, value) {
- var element = Element.fromTag(tag);
- set(element, property, value);
- var style = getRaw(element, property);
- return style.isSome();
- };
-
- var remove = function (element, property) {
- var dom = element.dom();
-
- internalRemove(dom, property);
-
- if (Attr.has(element, 'style') && Strings.trim(Attr.get(element, 'style')) === '') {
- // No more styles left, remove the style attribute as well
- Attr.remove(element, 'style');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var normalizedNodeIndex = function (node) {
+ var nodes, index, numTextFragments;
+ nodes = getChildNodes(normalizedParent(node));
+ index = $_djuh8tljfuw8l74.findIndex(nodes, equal$1(node), node);
+ nodes = nodes.slice(0, index + 1);
+ numTextFragments = $_djuh8tljfuw8l74.reduce(nodes, function (result, node, i) {
+ if (isText$7(node) && isText$7(nodes[i - 1])) {
+ result++;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var preserve = function (element, f) {
- var oldStyles = Attr.get(element, 'style');
- var result = f(element);
- var restore = oldStyles === undefined ? Attr.remove : Attr.set;
- restore(element, 'style', oldStyles);
</del><span class="cx" style="display: block; padding: 0 10px"> return result;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var copy = function (source, target) {
- var sourceDom = source.dom();
- var targetDom = target.dom();
- if (Style.isSupported(sourceDom) && Style.isSupported(targetDom)) {
- targetDom.style.cssText = sourceDom.style.cssText;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, 0);
+ nodes = $_djuh8tljfuw8l74.filter(nodes, $_ey7ka11qjfuw8ldg.matchNodeNames(node.nodeName));
+ index = $_djuh8tljfuw8l74.findIndex(nodes, equal$1(node), node);
+ return index - numTextFragments;
+ };
+ var createPathItem = function (node) {
+ var name;
+ if (isText$7(node)) {
+ name = 'text()';
+ } else {
+ name = node.nodeName.toLowerCase();
+ }
+ return name + '[' + normalizedNodeIndex(node) + ']';
+ };
+ var parentsUntil = function (root, node, predicate) {
+ var parents = [];
+ for (node = node.parentNode; node !== root; node = node.parentNode) {
+ if (predicate && predicate(node)) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var reflow = function (e) {
- /* NOTE:
- * do not rely on this return value.
- * It's here so the closure compiler doesn't optimise the property access away.
- */
- return e.dom().offsetWidth;
- };
-
- var transferOne = function (source, destination, style) {
- getRaw(source, style).each(function (value) {
- // NOTE: We don't want to clobber any existing inline styles.
- if (getRaw(destination, style).isNone()) set(destination, style, value);
- });
- };
-
- var transfer = function (source, destination, styles) {
- if (!Node.isElement(source) || !Node.isElement(destination)) return;
- Arr.each(styles, function (style) {
- transferOne(source, destination, style);
- });
- };
-
- return {
- copy: copy,
- set: set,
- preserve: preserve,
- setAll: setAll,
- setOptions: setOptions,
- remove: remove,
- get: get,
- getRaw: getRaw,
- isValidValue: isValidValue,
- reflow: reflow,
- transfer: transfer
- };
- }
-);
-
-/**
- * EditorView.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2016 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.EditorView',
- [
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.properties.Css',
- 'ephox.sugar.api.search.Traverse'
- ],
- function (Fun, Option, Compare, Element, Css, Traverse) {
- var getProp = function (propName, elm) {
- var rawElm = elm.dom();
- return rawElm[propName];
- };
-
- var getComputedSizeProp = function (propName, elm) {
- return parseInt(Css.get(elm, propName), 10);
- };
-
- var getClientWidth = Fun.curry(getProp, 'clientWidth');
- var getClientHeight = Fun.curry(getProp, 'clientHeight');
- var getMarginTop = Fun.curry(getComputedSizeProp, 'margin-top');
- var getMarginLeft = Fun.curry(getComputedSizeProp, 'margin-left');
-
- var getBoundingClientRect = function (elm) {
- return elm.dom().getBoundingClientRect();
- };
-
- var isInsideElementContentArea = function (bodyElm, clientX, clientY) {
- var clientWidth = getClientWidth(bodyElm);
- var clientHeight = getClientHeight(bodyElm);
-
- return clientX >= 0 && clientY >= 0 && clientX <= clientWidth && clientY <= clientHeight;
- };
-
- var transpose = function (inline, elm, clientX, clientY) {
- var clientRect = getBoundingClientRect(elm);
- var deltaX = inline ? clientRect.left + elm.dom().clientLeft + getMarginLeft(elm) : 0;
- var deltaY = inline ? clientRect.top + elm.dom().clientTop + getMarginTop(elm) : 0;
- var x = clientX - deltaX;
- var y = clientY - deltaY;
-
- return { x: x, y: y };
- };
-
- // Checks if the specified coordinate is within the visual content area excluding the scrollbars
- var isXYInContentArea = function (editor, clientX, clientY) {
- var bodyElm = Element.fromDom(editor.getBody());
- var targetElm = editor.inline ? bodyElm : Traverse.documentElement(bodyElm);
- var transposedPoint = transpose(editor.inline, targetElm, clientX, clientY);
-
- return isInsideElementContentArea(targetElm, transposedPoint.x, transposedPoint.y);
- };
-
- var fromDomSafe = function (node) {
- return Option.from(node).map(Element.fromDom);
- };
-
- var isEditorAttachedToDom = function (editor) {
- var rawContainer = editor.inline ? editor.getBody() : editor.getContentAreaContainer();
-
- return fromDomSafe(rawContainer).map(function (container) {
- return Compare.contains(Traverse.owner(container), container);
- }).getOr(false);
- };
-
- return {
- isXYInContentArea: isXYInContentArea,
- isEditorAttachedToDom: isEditorAttachedToDom
- };
- }
-);
-
-/**
- * DomUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Private UI DomUtils proxy.
- *
- * @private
- * @class tinymce.ui.DomUtils
- */
-define(
- 'tinymce.core.ui.DomUtils',
- [
- "tinymce.core.Env",
- "tinymce.core.util.Tools",
- "tinymce.core.dom.DOMUtils"
- ],
- function (Env, Tools, DOMUtils) {
- "use strict";
-
- var count = 0;
-
- var funcs = {
- id: function () {
- return 'mceu_' + (count++);
- },
-
- create: function (name, attrs, children) {
- var elm = document.createElement(name);
-
- DOMUtils.DOM.setAttribs(elm, attrs);
-
- if (typeof children === 'string') {
- elm.innerHTML = children;
- } else {
- Tools.each(children, function (child) {
- if (child.nodeType) {
- elm.appendChild(child);
- }
- });
- }
-
- return elm;
- },
-
- createFragment: function (html) {
- return DOMUtils.DOM.createFragment(html);
- },
-
- getWindowSize: function () {
- return DOMUtils.DOM.getViewPort();
- },
-
- getSize: function (elm) {
- var width, height;
-
- if (elm.getBoundingClientRect) {
- var rect = elm.getBoundingClientRect();
-
- width = Math.max(rect.width || (rect.right - rect.left), elm.offsetWidth);
- height = Math.max(rect.height || (rect.bottom - rect.bottom), elm.offsetHeight);
- } else {
- width = elm.offsetWidth;
- height = elm.offsetHeight;
- }
-
- return { width: width, height: height };
- },
-
- getPos: function (elm, root) {
- return DOMUtils.DOM.getPos(elm, root || funcs.getContainer());
- },
-
- getContainer: function () {
- return Env.container ? Env.container : document.body;
- },
-
- getViewPort: function (win) {
- return DOMUtils.DOM.getViewPort(win);
- },
-
- get: function (id) {
- return document.getElementById(id);
- },
-
- addClass: function (elm, cls) {
- return DOMUtils.DOM.addClass(elm, cls);
- },
-
- removeClass: function (elm, cls) {
- return DOMUtils.DOM.removeClass(elm, cls);
- },
-
- hasClass: function (elm, cls) {
- return DOMUtils.DOM.hasClass(elm, cls);
- },
-
- toggleClass: function (elm, cls, state) {
- return DOMUtils.DOM.toggleClass(elm, cls, state);
- },
-
- css: function (elm, name, value) {
- return DOMUtils.DOM.setStyle(elm, name, value);
- },
-
- getRuntimeStyle: function (elm, name) {
- return DOMUtils.DOM.getStyle(elm, name, true);
- },
-
- on: function (target, name, callback, scope) {
- return DOMUtils.DOM.bind(target, name, callback, scope);
- },
-
- off: function (target, name, callback) {
- return DOMUtils.DOM.unbind(target, name, callback);
- },
-
- fire: function (target, name, args) {
- return DOMUtils.DOM.fire(target, name, args);
- },
-
- innerHtml: function (elm, html) {
- // Workaround for <div> in <p> bug on IE 8 #6178
- DOMUtils.DOM.setHTML(elm, html);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parents.push(node);
+ }
+ return parents;
+ };
+ var create$1 = function (root, caretPosition) {
+ var container, offset, path = [], outputOffset, childNodes, parents;
+ container = caretPosition.container();
+ offset = caretPosition.offset();
+ if (isText$7(container)) {
+ outputOffset = normalizedTextOffset(container, offset);
+ } else {
+ childNodes = container.childNodes;
+ if (offset >= childNodes.length) {
+ outputOffset = 'after';
+ offset = childNodes.length - 1;
+ } else {
+ outputOffset = 'before';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- return funcs;
- }
-);
-/**
- * Class.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This utilitiy class is used for easier inheritance.
- *
- * Features:
- * * Exposed super functions: this._super();
- * * Mixins
- * * Dummy functions
- * * Property functions: var value = object.value(); and object.value(newValue);
- * * Static functions
- * * Defaults settings
- */
-define(
- 'tinymce.core.util.Class',
- [
- "tinymce.core.util.Tools"
- ],
- function (Tools) {
- var each = Tools.each, extend = Tools.extend;
-
- var extendClass, initializing;
-
- function Class() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = childNodes[offset];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Provides classical inheritance, based on code made by John Resig
- Class.extend = extendClass = function (prop) {
- var self = this, _super = self.prototype, prototype, name, member;
-
- // The dummy class constructor
- function Class() {
- var i, mixins, mixin, self = this;
-
- // All construction is actually done in the init method
- if (!initializing) {
- // Run class constuctor
- if (self.init) {
- self.init.apply(self, arguments);
- }
-
- // Run mixin constructors
- mixins = self.Mixins;
- if (mixins) {
- i = mixins.length;
- while (i--) {
- mixin = mixins[i];
- if (mixin.init) {
- mixin.init.apply(self, arguments);
- }
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ path.push(createPathItem(container));
+ parents = parentsUntil(root, container);
+ parents = $_djuh8tljfuw8l74.filter(parents, $_ebfy8j25jfuw8li1.negate($_ey7ka11qjfuw8ldg.isBogus));
+ path = path.concat($_djuh8tljfuw8l74.map(parents, function (node) {
+ return createPathItem(node);
+ }));
+ return path.reverse().join('/') + ',' + outputOffset;
+ };
+ var resolvePathItem = function (node, name, index) {
+ var nodes = getChildNodes(node);
+ nodes = $_djuh8tljfuw8l74.filter(nodes, function (node, index) {
+ return !isText$7(node) || !isText$7(nodes[index - 1]);
+ });
+ nodes = $_djuh8tljfuw8l74.filter(nodes, $_ey7ka11qjfuw8ldg.matchNodeNames(name));
+ return nodes[index];
+ };
+ var findTextPosition = function (container, offset) {
+ var node = container, targetOffset = 0, dataLen;
+ while (isText$7(node)) {
+ dataLen = node.data.length;
+ if (offset >= targetOffset && offset <= targetOffset + dataLen) {
+ container = node;
+ offset = offset - targetOffset;
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Dummy function, needs to be extended in order to provide functionality
- function dummy() {
- return this;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!isText$7(node.nextSibling)) {
+ container = node;
+ offset = dataLen;
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Creates a overloaded method for the class
- // this enables you to use this._super(); to call the super function
- function createMethod(name, fn) {
- return function () {
- var self = this, tmp = self._super, ret;
-
- self._super = _super[name];
- ret = fn.apply(self, arguments);
- self._super = tmp;
-
- return ret;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ targetOffset += dataLen;
+ node = node.nextSibling;
+ }
+ if (isText$7(container) && offset > container.data.length) {
+ offset = container.data.length;
+ }
+ return CaretPosition$1(container, offset);
+ };
+ var resolve$2 = function (root, path) {
+ var parts, container, offset;
+ if (!path) {
+ return null;
+ }
+ parts = path.split(',');
+ path = parts[0].split('/');
+ offset = parts.length > 1 ? parts[1] : 'before';
+ container = $_djuh8tljfuw8l74.reduce(path, function (result, value) {
+ value = /([\w\-\(\)]+)\[([0-9]+)\]/.exec(value);
+ if (!value) {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Instantiate a base class (but only create the instance,
- // don't run the init constructor)
- initializing = true;
-
- /*eslint new-cap:0 */
- prototype = new self();
- initializing = false;
-
- // Add mixins
- if (prop.Mixins) {
- each(prop.Mixins, function (mixin) {
- for (var name in mixin) {
- if (name !== "init") {
- prop[name] = mixin[name];
- }
- }
- });
-
- if (_super.Mixins) {
- prop.Mixins = _super.Mixins.concat(prop.Mixins);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (value[1] === 'text()') {
+ value[1] = '#text';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Generate dummy methods
- if (prop.Methods) {
- each(prop.Methods.split(','), function (name) {
- prop[name] = dummy;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return resolvePathItem(result, value[1], parseInt(value[2], 10));
+ }, root);
+ if (!container) {
+ return null;
+ }
+ if (!isText$7(container)) {
+ if (offset === 'after') {
+ offset = nodeIndex$1(container) + 1;
+ } else {
+ offset = nodeIndex$1(container);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return CaretPosition$1(container.parentNode, offset);
+ }
+ return findTextPosition(container, parseInt(offset, 10));
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Generate property methods
- if (prop.Properties) {
- each(prop.Properties.split(','), function (name) {
- var fieldName = '_' + name;
-
- prop[name] = function (value) {
- var self = this, undef;
-
- // Set value
- if (value !== undef) {
- self[fieldName] = value;
-
- return self;
- }
-
- // Get value
- return self[fieldName];
- };
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isContentEditableFalse$6 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var getNormalizedTextOffset = function (trim, container, offset) {
+ var node, trimmedOffset;
+ trimmedOffset = trim(container.data.slice(0, offset)).length;
+ for (node = container.previousSibling; node && $_ey7ka11qjfuw8ldg.isText(node); node = node.previousSibling) {
+ trimmedOffset += trim(node.data).length;
+ }
+ return trimmedOffset;
+ };
+ var getPoint = function (dom, trim, normalized, rng, start) {
+ var container = rng[start ? 'startContainer' : 'endContainer'];
+ var offset = rng[start ? 'startOffset' : 'endOffset'];
+ var point = [];
+ var childNodes, after = 0;
+ var root = dom.getRoot();
+ if ($_ey7ka11qjfuw8ldg.isText(container)) {
+ point.push(normalized ? getNormalizedTextOffset(trim, container, offset) : offset);
+ } else {
+ childNodes = container.childNodes;
+ if (offset >= childNodes.length && childNodes.length) {
+ after = 1;
+ offset = Math.max(0, childNodes.length - 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Static functions
- if (prop.Statics) {
- each(prop.Statics, function (func, name) {
- Class[name] = func;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ point.push(dom.nodeIndex(childNodes[offset], normalized) + after);
+ }
+ for (; container && container !== root; container = container.parentNode) {
+ point.push(dom.nodeIndex(container, normalized));
+ }
+ return point;
+ };
+ var getLocation = function (trim, selection, normalized, rng) {
+ var dom = selection.dom, bookmark = {};
+ bookmark.start = getPoint(dom, trim, normalized, rng, true);
+ if (!selection.isCollapsed()) {
+ bookmark.end = getPoint(dom, trim, normalized, rng, false);
+ }
+ return bookmark;
+ };
+ var trimEmptyTextNode = function (node) {
+ if ($_ey7ka11qjfuw8ldg.isText(node) && node.data.length === 0) {
+ node.parentNode.removeChild(node);
+ }
+ };
+ var findIndex$3 = function (dom, name, element) {
+ var count = 0;
+ $_52qop8kjfuw8l6v.each(dom.select(name), function (node) {
+ if (node.getAttribute('data-mce-bogus') === 'all') {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Default settings
- if (prop.Defaults && _super.Defaults) {
- prop.Defaults = extend({}, _super.Defaults, prop.Defaults);
- }
-
- // Copy the properties over onto the new prototype
- for (name in prop) {
- member = prop[name];
-
- if (typeof member == "function" && _super[name]) {
- prototype[name] = createMethod(name, member);
- } else {
- prototype[name] = member;
- }
- }
-
- // Populate our constructed prototype object
- Class.prototype = prototype;
-
- // Enforce the constructor to be what we expect
- Class.constructor = Class;
-
- // And make this class extendible
- Class.extend = extendClass;
-
- return Class;
- };
-
- return Class;
- }
-);
-/**
- * EventDispatcher.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class lets you add/remove and fire events by name on the specified scope. This makes
- * it easy to add event listener logic to any class.
- *
- * @class tinymce.util.EventDispatcher
- * @example
- * var eventDispatcher = new EventDispatcher();
- *
- * eventDispatcher.on('click', function() {console.log('data');});
- * eventDispatcher.fire('click', {data: 123});
- */
-define(
- 'tinymce.core.util.EventDispatcher',
- [
- "tinymce.core.util.Tools"
- ],
- function (Tools) {
- var nativeEvents = Tools.makeMap(
- "focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange " +
- "mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover " +
- "draggesture dragdrop drop drag submit " +
- "compositionstart compositionend compositionupdate touchstart touchmove touchend",
- ' '
- );
-
- function Dispatcher(settings) {
- var self = this, scope, bindings = {}, toggleEvent;
-
- function returnFalse() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node === element) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function returnTrue() {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ count++;
+ });
+ return count;
+ };
+ var moveEndPoint = function (rng, start) {
+ var container, offset, childNodes;
+ var prefix = start ? 'start' : 'end';
+ container = rng[prefix + 'Container'];
+ offset = rng[prefix + 'Offset'];
+ if ($_ey7ka11qjfuw8ldg.isElement(container) && container.nodeName === 'TR') {
+ childNodes = container.childNodes;
+ container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)];
+ if (container) {
+ offset = start ? 0 : container.childNodes.length;
+ rng['set' + (start ? 'Start' : 'End')](container, offset);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- settings = settings || {};
- scope = settings.scope || self;
- toggleEvent = settings.toggleEvent || returnFalse;
-
- /**
- * Fires the specified event by name.
- *
- * @method fire
- * @param {String} name Name of the event to fire.
- * @param {Object?} args Event arguments.
- * @return {Object} Event args instance passed in.
- * @example
- * instance.fire('event', {...});
- */
- function fire(name, args) {
- var handlers, i, l, callback;
-
- name = name.toLowerCase();
- args = args || {};
- args.type = name;
-
- // Setup target is there isn't one
- if (!args.target) {
- args.target = scope;
- }
-
- // Add event delegation methods if they are missing
- if (!args.preventDefault) {
- // Add preventDefault method
- args.preventDefault = function () {
- args.isDefaultPrevented = returnTrue;
- };
-
- // Add stopPropagation
- args.stopPropagation = function () {
- args.isPropagationStopped = returnTrue;
- };
-
- // Add stopImmediatePropagation
- args.stopImmediatePropagation = function () {
- args.isImmediatePropagationStopped = returnTrue;
- };
-
- // Add event delegation states
- args.isDefaultPrevented = returnFalse;
- args.isPropagationStopped = returnFalse;
- args.isImmediatePropagationStopped = returnFalse;
- }
-
- if (settings.beforeFire) {
- settings.beforeFire(args);
- }
-
- handlers = bindings[name];
- if (handlers) {
- for (i = 0, l = handlers.length; i < l; i++) {
- callback = handlers[i];
-
- // Unbind handlers marked with "once"
- if (callback.once) {
- off(name, callback.func);
- }
-
- // Stop immediate propagation if needed
- if (args.isImmediatePropagationStopped()) {
- args.stopPropagation();
- return args;
- }
-
- // If callback returns false then prevent default and stop all propagation
- if (callback.func.call(scope, args) === false) {
- args.preventDefault();
- return args;
- }
- }
- }
-
- return args;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var normalizeTableCellSelection = function (rng) {
+ moveEndPoint(rng, true);
+ moveEndPoint(rng, false);
+ return rng;
+ };
+ var findSibling = function (node, offset) {
+ var sibling;
+ if ($_ey7ka11qjfuw8ldg.isElement(node)) {
+ node = getNode(node, offset);
+ if (isContentEditableFalse$6(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Binds an event listener to a specific event by name.
- *
- * @method on
- * @param {String} name Event name or space separated list of events to bind.
- * @param {callback} callback Callback to be executed when the event occurs.
- * @param {Boolean} first Optional flag if the event should be prepended. Use this with care.
- * @return {Object} Current class instance.
- * @example
- * instance.on('event', function(e) {
- * // Callback logic
- * });
- */
- function on(name, callback, prepend, extra) {
- var handlers, names, i;
-
- if (callback === false) {
- callback = returnFalse;
- }
-
- if (callback) {
- callback = {
- func: callback
- };
-
- if (extra) {
- Tools.extend(callback, extra);
- }
-
- names = name.toLowerCase().split(' ');
- i = names.length;
- while (i--) {
- name = names[i];
- handlers = bindings[name];
- if (!handlers) {
- handlers = bindings[name] = [];
- toggleEvent(name, true);
- }
-
- if (prepend) {
- handlers.unshift(callback);
- } else {
- handlers.push(callback);
- }
- }
- }
-
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (isCaretContainer(node)) {
+ if ($_ey7ka11qjfuw8ldg.isText(node) && isCaretContainerBlock(node)) {
+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Unbinds an event listener to a specific event by name.
- *
- * @method off
- * @param {String?} name Name of the event to unbind.
- * @param {callback?} callback Callback to unbind.
- * @return {Object} Current class instance.
- * @example
- * // Unbind specific callback
- * instance.off('event', handler);
- *
- * // Unbind all listeners by name
- * instance.off('event');
- *
- * // Unbind all events
- * instance.off();
- */
- function off(name, callback) {
- var i, handlers, bindingName, names, hi;
-
- if (name) {
- names = name.toLowerCase().split(' ');
- i = names.length;
- while (i--) {
- name = names[i];
- handlers = bindings[name];
-
- // Unbind all handlers
- if (!name) {
- for (bindingName in bindings) {
- toggleEvent(bindingName, false);
- delete bindings[bindingName];
- }
-
- return self;
- }
-
- if (handlers) {
- // Unbind all by name
- if (!callback) {
- handlers.length = 0;
- } else {
- // Unbind specific ones
- hi = handlers.length;
- while (hi--) {
- if (handlers[hi].func === callback) {
- handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1));
- bindings[name] = handlers;
- }
- }
- }
-
- if (!handlers.length) {
- toggleEvent(name, false);
- delete bindings[name];
- }
- }
- }
- } else {
- for (name in bindings) {
- toggleEvent(name, false);
- }
-
- bindings = {};
- }
-
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sibling = node.previousSibling;
+ if (isContentEditableFalse$6(sibling)) {
+ return sibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Binds an event listener to a specific event by name
- * and automatically unbind the event once the callback fires.
- *
- * @method once
- * @param {String} name Event name or space separated list of events to bind.
- * @param {callback} callback Callback to be executed when the event occurs.
- * @param {Boolean} first Optional flag if the event should be prepended. Use this with care.
- * @return {Object} Current class instance.
- * @example
- * instance.once('event', function(e) {
- * // Callback logic
- * });
- */
- function once(name, callback, prepend) {
- return on(name, callback, prepend, { once: true });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sibling = node.nextSibling;
+ if (isContentEditableFalse$6(sibling)) {
+ return sibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns true/false if the dispatcher has a event of the specified name.
- *
- * @method has
- * @param {String} name Name of the event to check for.
- * @return {Boolean} true/false if the event exists or not.
- */
- function has(name) {
- name = name.toLowerCase();
- return !(!bindings[name] || bindings[name].length === 0);
- }
-
- // Expose
- self.fire = fire;
- self.on = on;
- self.off = off;
- self.once = once;
- self.has = has;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns true/false if the specified event name is a native browser event or not.
- *
- * @method isNative
- * @param {String} name Name to check if it's native.
- * @return {Boolean} true/false if the event is native or not.
- * @static
- */
- Dispatcher.isNative = function (name) {
- return !!nativeEvents[name.toLowerCase()];
- };
-
- return Dispatcher;
- }
-);
-
-/**
- * Binding.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class gets dynamically extended to provide a binding between two models. This makes it possible to
- * sync the state of two properties in two models by a layer of abstraction.
- *
- * @private
- * @class tinymce.data.Binding
- */
-define(
- 'tinymce.core.data.Binding',
- [
- ],
- function () {
- /**
- * Constructs a new bidning.
- *
- * @constructor
- * @method Binding
- * @param {Object} settings Settings to the binding.
- */
- function Binding(settings) {
- this.create = settings.create;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var findAdjacentContentEditableFalseElm = function (rng) {
+ return findSibling(rng.startContainer, rng.startOffset) || findSibling(rng.endContainer, rng.endOffset);
+ };
+ var getOffsetBookmark = function (trim, normalized, selection) {
+ var element = selection.getNode();
+ var name = element ? element.nodeName : null;
+ var rng = selection.getRng();
+ if (isContentEditableFalse$6(element) || name === 'IMG') {
+ return {
+ name: name,
+ index: findIndex$3(selection.dom, name, element)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Creates a binding for a property on a model.
- *
- * @method create
- * @param {tinymce.data.ObservableObject} model Model to create binding to.
- * @param {String} name Name of property to bind.
- * @return {tinymce.data.Binding} Binding instance.
- */
- Binding.create = function (model, name) {
- return new Binding({
- create: function (otherModel, otherName) {
- var bindings;
-
- function fromSelfToOther(e) {
- otherModel.set(otherName, e.value);
- }
-
- function fromOtherToSelf(e) {
- model.set(name, e.value);
- }
-
- otherModel.on('change:' + otherName, fromOtherToSelf);
- model.on('change:' + name, fromSelfToOther);
-
- // Keep track of the bindings
- bindings = otherModel._bindings;
-
- if (!bindings) {
- bindings = otherModel._bindings = [];
-
- otherModel.on('destroy', function () {
- var i = bindings.length;
-
- while (i--) {
- bindings[i]();
- }
- });
- }
-
- bindings.push(function () {
- model.off('change:' + name, fromSelfToOther);
- });
-
- return model.get(name);
- }
- });
- };
-
- return Binding;
- }
-);
-/**
- * Observable.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This mixin will add event binding logic to classes.
- *
- * @mixin tinymce.util.Observable
- */
-define(
- 'tinymce.core.util.Observable',
- [
- "tinymce.core.util.EventDispatcher"
- ],
- function (EventDispatcher) {
- function getEventDispatcher(obj) {
- if (!obj._eventDispatcher) {
- obj._eventDispatcher = new EventDispatcher({
- scope: obj,
- toggleEvent: function (name, state) {
- if (EventDispatcher.isNative(name) && obj.toggleNativeEvent) {
- obj.toggleNativeEvent(name, state);
- }
- }
- });
- }
-
- return obj._eventDispatcher;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var sibling = findAdjacentContentEditableFalseElm(rng);
+ if (sibling) {
+ name = sibling.tagName;
+ return {
+ name: name,
+ index: findIndex$3(selection.dom, name, sibling)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return getLocation(trim, selection, normalized, rng);
+ };
+ var getCaretBookmark = function (selection) {
+ var rng = selection.getRng();
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Fires the specified event by name. Consult the
- * <a href="/docs/advanced/events">event reference</a> for more details on each event.
- *
- * @method fire
- * @param {String} name Name of the event to fire.
- * @param {Object?} args Event arguments.
- * @param {Boolean?} bubble True/false if the event is to be bubbled.
- * @return {Object} Event args instance passed in.
- * @example
- * instance.fire('event', {...});
- */
- fire: function (name, args, bubble) {
- var self = this;
-
- // Prevent all events except the remove event after the instance has been removed
- if (self.removed && name !== "remove") {
- return args;
- }
-
- args = getEventDispatcher(self).fire(name, args, bubble);
-
- // Bubble event up to parents
- if (bubble !== false && self.parent) {
- var parent = self.parent();
- while (parent && !args.isPropagationStopped()) {
- parent.fire(name, args, false);
- parent = parent.parent();
- }
- }
-
- return args;
- },
-
- /**
- * Binds an event listener to a specific event by name. Consult the
- * <a href="/docs/advanced/events">event reference</a> for more details on each event.
- *
- * @method on
- * @param {String} name Event name or space separated list of events to bind.
- * @param {callback} callback Callback to be executed when the event occurs.
- * @param {Boolean} first Optional flag if the event should be prepended. Use this with care.
- * @return {Object} Current class instance.
- * @example
- * instance.on('event', function(e) {
- * // Callback logic
- * });
- */
- on: function (name, callback, prepend) {
- return getEventDispatcher(this).on(name, callback, prepend);
- },
-
- /**
- * Unbinds an event listener to a specific event by name. Consult the
- * <a href="/docs/advanced/events">event reference</a> for more details on each event.
- *
- * @method off
- * @param {String?} name Name of the event to unbind.
- * @param {callback?} callback Callback to unbind.
- * @return {Object} Current class instance.
- * @example
- * // Unbind specific callback
- * instance.off('event', handler);
- *
- * // Unbind all listeners by name
- * instance.off('event');
- *
- * // Unbind all events
- * instance.off();
- */
- off: function (name, callback) {
- return getEventDispatcher(this).off(name, callback);
- },
-
- /**
- * Bind the event callback and once it fires the callback is removed. Consult the
- * <a href="/docs/advanced/events">event reference</a> for more details on each event.
- *
- * @method once
- * @param {String} name Name of the event to bind.
- * @param {callback} callback Callback to bind only once.
- * @return {Object} Current class instance.
- */
- once: function (name, callback) {
- return getEventDispatcher(this).once(name, callback);
- },
-
- /**
- * Returns true/false if the object has a event of the specified name.
- *
- * @method hasEventListeners
- * @param {String} name Name of the event to check for.
- * @return {Boolean} true/false if the event exists or not.
- */
- hasEventListeners: function (name) {
- return getEventDispatcher(this).has(name);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ start: create$1(selection.dom.getRoot(), CaretPosition$1.fromRangeStart(rng)),
+ end: create$1(selection.dom.getRoot(), CaretPosition$1.fromRangeEnd(rng))
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * ObservableObject.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class is a object that is observable when properties changes a change event gets emitted.
- *
- * @private
- * @class tinymce.data.ObservableObject
- */
-define(
- 'tinymce.core.data.ObservableObject',
- [
- 'tinymce.core.data.Binding',
- 'tinymce.core.util.Class',
- 'tinymce.core.util.Observable',
- 'tinymce.core.util.Tools'
- ], function (Binding, Class, Observable, Tools) {
- function isNode(node) {
- return node.nodeType > 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getRangeBookmark = function (selection) {
+ return { rng: selection.getRng() };
+ };
+ var createBookmarkSpan = function (dom, id, filled) {
+ var args = {
+ 'data-mce-type': 'bookmark',
+ 'id': id,
+ 'style': 'overflow:hidden;line-height:0px'
+ };
+ return filled ? dom.create('span', args, '') : dom.create('span', args);
+ };
+ var getPersistentBookmark = function (selection, filled) {
+ var dom = selection.dom;
+ var rng = selection.getRng();
+ var id = dom.uniqueId();
+ var collapsed = selection.isCollapsed();
+ var element = selection.getNode();
+ var name = element.nodeName;
+ if (name === 'IMG') {
+ return {
+ name: name,
+ index: findIndex$3(dom, name, element)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var rng2 = normalizeTableCellSelection(rng.cloneRange());
+ if (!collapsed) {
+ rng2.collapse(false);
+ var endBookmarkNode = createBookmarkSpan(dom, id + '_end', filled);
+ rng2.insertNode(endBookmarkNode);
+ trimEmptyTextNode(endBookmarkNode.nextSibling);
+ }
+ rng = normalizeTableCellSelection(rng);
+ rng.collapse(true);
+ var startBookmarkNode = createBookmarkSpan(dom, id + '_start', filled);
+ rng.insertNode(startBookmarkNode);
+ trimEmptyTextNode(startBookmarkNode.previousSibling);
+ selection.moveToBookmark({
+ id: id,
+ keep: 1
+ });
+ return { id: id };
+ };
+ var getBookmark = function (selection, type, normalized) {
+ if (type === 2) {
+ return getOffsetBookmark($_dpfg1321jfuw8lhn.trim, normalized, selection);
+ } else if (type === 3) {
+ return getCaretBookmark(selection);
+ } else if (type) {
+ return getRangeBookmark(selection);
+ } else {
+ return getPersistentBookmark(selection, false);
+ }
+ };
+ var $_cpdbfi2ojfuw8ll6 = {
+ getBookmark: getBookmark,
+ getUndoBookmark: $_68e81l6jfuw8kyc.curry(getOffsetBookmark, $_68e81l6jfuw8kyc.identity, true),
+ getPersistentBookmark: getPersistentBookmark
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Todo: Maybe this should be shallow compare since it might be huge object references
- function isEqual(a, b) {
- var k, checked;
-
- // Strict equals
- if (a === b) {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var CARET_ID = '_mce_caret';
+ var isCaretNode = function (node) {
+ return $_ey7ka11qjfuw8ldg.isElement(node) && node.id === CARET_ID;
+ };
+ var getParentCaretContainer = function (body, node) {
+ while (node && node !== body) {
+ if (node.id === CARET_ID) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
+ }
+ return null;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Compare null
- if (a === null || b === null) {
- return a === b;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isStringPathBookmark = function (bookmark) {
+ return typeof bookmark.start === 'string';
+ };
+ var isRangeBookmark = function (bookmark) {
+ return bookmark.hasOwnProperty('rng');
+ };
+ var isIdBookmark = function (bookmark) {
+ return bookmark.hasOwnProperty('id');
+ };
+ var isIndexBookmark = function (bookmark) {
+ return bookmark.hasOwnProperty('name');
+ };
+ var isPathBookmark = function (bookmark) {
+ return $_52qop8kjfuw8l6v.isArray(bookmark.start);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Compare number, boolean, string, undefined
- if (typeof a !== "object" || typeof b !== "object") {
- return a === b;
- }
-
- // Compare arrays
- if (Tools.isArray(b)) {
- if (a.length !== b.length) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addBogus = function (dom, node) {
+ if (dom.isBlock(node) && !node.innerHTML && !$_9fhi43ajfuw8l13.ie) {
+ node.innerHTML = '<br data-mce-bogus="1" />';
+ }
+ return node;
+ };
+ var resolveCaretPositionBookmark = function (dom, bookmark) {
+ var rng, pos;
+ rng = dom.createRng();
+ pos = resolve$2(dom.getRoot(), bookmark.start);
+ rng.setStart(pos.container(), pos.offset());
+ pos = resolve$2(dom.getRoot(), bookmark.end);
+ rng.setEnd(pos.container(), pos.offset());
+ return rng;
+ };
+ var insertZwsp = function (node, rng) {
+ var textNode = node.ownerDocument.createTextNode($_dpfg1321jfuw8lhn.ZWSP);
+ node.appendChild(textNode);
+ rng.setStart(textNode, 0);
+ rng.setEnd(textNode, 0);
+ };
+ var isEmpty = function (node) {
+ return node.hasChildNodes() === false;
+ };
+ var tryFindRangePosition = function (node, rng) {
+ return $_25kl2c2cjfuw8ljh.lastPositionIn(node).fold(function () {
+ return false;
+ }, function (pos) {
+ rng.setStart(pos.container(), pos.offset());
+ rng.setEnd(pos.container(), pos.offset());
+ return true;
+ });
+ };
+ var padEmptyCaretContainer = function (root, node, rng) {
+ if (isEmpty(node) && getParentCaretContainer(root, node)) {
+ insertZwsp(node, rng);
+ return true;
+ } else {
+ return false;
+ }
+ };
+ var setEndPoint = function (dom, start, bookmark, rng) {
+ var point = bookmark[start ? 'start' : 'end'];
+ var i, node, offset, children;
+ var root = dom.getRoot();
+ if (point) {
+ offset = point[0];
+ for (node = root, i = point.length - 1; i >= 1; i--) {
+ children = node.childNodes;
+ if (padEmptyCaretContainer(root, node, rng)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- k = a.length;
- while (k--) {
- if (!isEqual(a[k], b[k])) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (point[i] > children.length - 1) {
+ if (padEmptyCaretContainer(root, node, rng)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return tryFindRangePosition(node, rng);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = children[point[i]];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Shallow compare nodes
- if (isNode(a) || isNode(b)) {
- return a === b;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.nodeType === 3) {
+ offset = Math.min(point[0], node.nodeValue.length);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Compare objects
- checked = {};
- for (k in b) {
- if (!isEqual(a[k], b[k])) {
- return false;
- }
-
- checked[k] = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.nodeType === 1) {
+ offset = Math.min(point[0], node.childNodes.length);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (k in a) {
- if (!checked[k] && !isEqual(a[k], b[k])) {
- return false;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (start) {
+ rng.setStart(node, offset);
+ } else {
+ rng.setEnd(node, offset);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return true;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Class.extend({
- Mixins: [Observable],
-
- /**
- * Constructs a new observable object instance.
- *
- * @constructor
- * @param {Object} data Initial data for the object.
- */
- init: function (data) {
- var name, value;
-
- data = data || {};
-
- for (name in data) {
- value = data[name];
-
- if (value instanceof Binding) {
- data[name] = value.create(this, name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ };
+ var isValidTextNode = function (node) {
+ return $_ey7ka11qjfuw8ldg.isText(node) && node.data.length > 0;
+ };
+ var restoreEndPoint = function (dom, suffix, bookmark) {
+ var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev;
+ var keep = bookmark.keep;
+ var container, offset;
+ if (marker) {
+ node = marker.parentNode;
+ if (suffix === 'start') {
+ if (!keep) {
+ idx = dom.nodeIndex(marker);
+ } else {
+ if (marker.hasChildNodes()) {
+ node = marker.firstChild;
+ idx = 1;
+ } else if (isValidTextNode(marker.nextSibling)) {
+ node = marker.nextSibling;
+ idx = 0;
+ } else if (isValidTextNode(marker.previousSibling)) {
+ node = marker.previousSibling;
+ idx = marker.previousSibling.data.length;
+ } else {
+ node = marker.parentNode;
+ idx = dom.nodeIndex(marker) + 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- this.data = data;
- },
-
- /**
- * Sets a property on the value this will call
- * observers if the value is a change from the current value.
- *
- * @method set
- * @param {String/object} name Name of the property to set or a object of items to set.
- * @param {Object} value Value to set for the property.
- * @return {tinymce.data.ObservableObject} Observable object instance.
- */
- set: function (name, value) {
- var key, args, oldValue = this.data[name];
-
- if (value instanceof Binding) {
- value = value.create(this, name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = node;
+ offset = idx;
+ } else {
+ if (!keep) {
+ idx = dom.nodeIndex(marker);
+ } else {
+ if (marker.hasChildNodes()) {
+ node = marker.firstChild;
+ idx = 1;
+ } else if (isValidTextNode(marker.previousSibling)) {
+ node = marker.previousSibling;
+ idx = marker.previousSibling.data.length;
+ } else {
+ node = marker.parentNode;
+ idx = dom.nodeIndex(marker);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (typeof name === "object") {
- for (key in name) {
- this.set(key, name[key]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = node;
+ offset = idx;
+ }
+ if (!keep) {
+ prev = marker.previousSibling;
+ next = marker.nextSibling;
+ $_52qop8kjfuw8l6v.each($_52qop8kjfuw8l6v.grep(marker.childNodes), function (node) {
+ if ($_ey7ka11qjfuw8ldg.isText(node)) {
+ node.nodeValue = node.nodeValue.replace(/\uFEFF/g, '');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return this;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ while (marker = dom.get(bookmark.id + '_' + suffix)) {
+ dom.remove(marker, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!isEqual(oldValue, value)) {
- this.data[name] = value;
-
- args = {
- target: this,
- name: name,
- value: value,
- oldValue: oldValue
- };
-
- this.fire('change:' + name, args);
- this.fire('change', args);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (prev && next && prev.nodeType === next.nodeType && $_ey7ka11qjfuw8ldg.isText(prev) && !$_9fhi43ajfuw8l13.opera) {
+ idx = prev.nodeValue.length;
+ prev.appendData(next.nodeValue);
+ dom.remove(next);
+ if (suffix === 'start') {
+ container = prev;
+ offset = idx;
+ } else {
+ container = prev;
+ offset = idx;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return this;
- },
-
- /**
- * Gets a property by name.
- *
- * @method get
- * @param {String} name Name of the property to get.
- * @return {Object} Object value of propery.
- */
- get: function (name) {
- return this.data[name];
- },
-
- /**
- * Returns true/false if the specified property exists.
- *
- * @method has
- * @param {String} name Name of the property to check for.
- * @return {Boolean} true/false if the item exists.
- */
- has: function (name) {
- return name in this.data;
- },
-
- /**
- * Returns a dynamic property binding for the specified property name. This makes
- * it possible to sync the state of two properties in two ObservableObject instances.
- *
- * @method bind
- * @param {String} name Name of the property to sync with the property it's inserted to.
- * @return {tinymce.data.Binding} Data binding instance.
- */
- bind: function (name) {
- return Binding.create(this, name);
- },
-
- /**
- * Destroys the observable object and fires the "destroy"
- * event and clean up any internal resources.
- *
- * @method destroy
- */
- destroy: function () {
- this.fire('destroy');
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Option.some(CaretPosition$1(container, offset));
+ } else {
+ return Option.none();
+ }
+ };
+ var alt = function (o1, o2) {
+ return o1.isSome() ? o1 : o2;
+ };
+ var resolvePaths = function (dom, bookmark) {
+ var rng = dom.createRng();
+ if (setEndPoint(dom, true, bookmark, rng) && setEndPoint(dom, false, bookmark, rng)) {
+ return Option.some(rng);
+ } else {
+ return Option.none();
+ }
+ };
+ var resolveId = function (dom, bookmark) {
+ var startPos = restoreEndPoint(dom, 'start', bookmark);
+ var endPos = restoreEndPoint(dom, 'end', bookmark);
+ return $_5gv5dd26jfuw8li3.liftN([
+ startPos,
+ alt(endPos, startPos)
+ ], function (spos, epos) {
+ var rng = dom.createRng();
+ rng.setStart(addBogus(dom, spos.container()), spos.offset());
+ rng.setEnd(addBogus(dom, epos.container()), epos.offset());
+ return rng;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Selector.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/*eslint no-nested-ternary:0 */
-
-/**
- * Selector engine, enables you to select controls by using CSS like expressions.
- * We currently only support basic CSS expressions to reduce the size of the core
- * and the ones we support should be enough for most cases.
- *
- * @example
- * Supported expressions:
- * element
- * element#name
- * element.class
- * element[attr]
- * element[attr*=value]
- * element[attr~=value]
- * element[attr!=value]
- * element[attr^=value]
- * element[attr$=value]
- * element:<state>
- * element:not(<expression>)
- * element:first
- * element:last
- * element:odd
- * element:even
- * element element
- * element > element
- *
- * @class tinymce.ui.Selector
- */
-define(
- 'tinymce.core.ui.Selector',
- [
- "tinymce.core.util.Class"
- ],
- function (Class) {
- "use strict";
-
- /**
- * Produces an array with a unique set of objects. It will not compare the values
- * but the references of the objects.
- *
- * @private
- * @method unqiue
- * @param {Array} array Array to make into an array with unique items.
- * @return {Array} Array with unique items.
- */
- function unique(array) {
- var uniqueItems = [], i = array.length, item;
-
- while (i--) {
- item = array[i];
-
- if (!item.__checked) {
- uniqueItems.push(item);
- item.__checked = 1;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var resolveIndex$1 = function (dom, bookmark) {
+ return Option.from(dom.select(bookmark.name)[bookmark.index]).map(function (elm) {
+ var rng = dom.createRng();
+ rng.selectNode(elm);
+ return rng;
+ });
+ };
+ var resolve$3 = function (selection, bookmark) {
+ var dom = selection.dom;
+ if (bookmark) {
+ if (isPathBookmark(bookmark)) {
+ return resolvePaths(dom, bookmark);
+ } else if (isStringPathBookmark(bookmark)) {
+ return Option.some(resolveCaretPositionBookmark(dom, bookmark));
+ } else if (isIdBookmark(bookmark)) {
+ return resolveId(dom, bookmark);
+ } else if (isIndexBookmark(bookmark)) {
+ return resolveIndex$1(dom, bookmark);
+ } else if (isRangeBookmark(bookmark)) {
+ return Option.some(bookmark.rng);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- i = uniqueItems.length;
- while (i--) {
- delete uniqueItems[i].__checked;
- }
-
- return uniqueItems;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Option.none();
+ };
+ var $_dczulw2qjfuw8llk = { resolve: resolve$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var expression = /^([\w\\*]+)?(?:#([\w\-\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getBookmark$1 = function (selection, type, normalized) {
+ return $_cpdbfi2ojfuw8ll6.getBookmark(selection, type, normalized);
+ };
+ var moveToBookmark = function (selection, bookmark) {
+ $_dczulw2qjfuw8llk.resolve(selection, bookmark).each(function (rng) {
+ selection.setRng(rng);
+ });
+ };
+ var isBookmarkNode$1 = function (node) {
+ return $_ey7ka11qjfuw8ldg.isElement(node) && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark';
+ };
+ var $_disscn2njfuw8ll3 = {
+ getBookmark: getBookmark$1,
+ moveToBookmark: moveToBookmark,
+ isBookmarkNode: isBookmarkNode$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /*jshint maxlen:255 */
- /*eslint max-len:0 */
- var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
- whiteSpace = /^\s*|\s*$/g,
- Collection;
-
- var Selector = Class.extend({
- /**
- * Constructs a new Selector instance.
- *
- * @constructor
- * @method init
- * @param {String} selector CSS like selector expression.
- */
- init: function (selector) {
- var match = this.match;
-
- function compileNameFilter(name) {
- if (name) {
- name = name.toLowerCase();
-
- return function (item) {
- return name === '*' || item.type === name;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$8 = $_52qop8kjfuw8l6v.each;
+ var ElementUtils = function (dom) {
+ this.compare = function (node1, node2) {
+ if (node1.nodeName !== node2.nodeName) {
+ return false;
+ }
+ var getAttribs = function (node) {
+ var attribs = {};
+ each$8(dom.getAttribs(node), function (attr) {
+ var name = attr.nodeName.toLowerCase();
+ if (name.indexOf('_') !== 0 && name !== 'style' && name.indexOf('data-') !== 0) {
+ attribs[name] = dom.getAttrib(node, name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function compileIdFilter(id) {
- if (id) {
- return function (item) {
- return item._name === id;
- };
- }
- }
-
- function compileClassesFilter(classes) {
- if (classes) {
- classes = classes.split('.');
-
- return function (item) {
- var i = classes.length;
-
- while (i--) {
- if (!item.classes.contains(classes[i])) {
- return false;
- }
- }
-
- return true;
- };
- }
- }
-
- function compileAttrFilter(name, cmp, check) {
- if (name) {
- return function (item) {
- var value = item[name] ? item[name]() : '';
-
- return !cmp ? !!check :
- cmp === "=" ? value === check :
- cmp === "*=" ? value.indexOf(check) >= 0 :
- cmp === "~=" ? (" " + value + " ").indexOf(" " + check + " ") >= 0 :
- cmp === "!=" ? value != check :
- cmp === "^=" ? value.indexOf(check) === 0 :
- cmp === "$=" ? value.substr(value.length - check.length) === check :
- false;
- };
- }
- }
-
- function compilePsuedoFilter(name) {
- var notSelectors;
-
- if (name) {
- name = /(?:not\((.+)\))|(.+)/i.exec(name);
-
- if (!name[1]) {
- name = name[2];
-
- return function (item, index, length) {
- return name === 'first' ? index === 0 :
- name === 'last' ? index === length - 1 :
- name === 'even' ? index % 2 === 0 :
- name === 'odd' ? index % 2 === 1 :
- item[name] ? item[name]() :
- false;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ return attribs;
+ };
+ var compareObjects = function (obj1, obj2) {
+ var value, name;
+ for (name in obj1) {
+ if (obj1.hasOwnProperty(name)) {
+ value = obj2[name];
+ if (typeof value === 'undefined') {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Compile not expression
- notSelectors = parseChunks(name[1], []);
-
- return function (item) {
- return !match(item, notSelectors);
- };
- }
- }
-
- function compile(selector, filters, direct) {
- var parts;
-
- function add(filter) {
- if (filter) {
- filters.push(filter);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (obj1[name] !== value) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ delete obj2[name];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Parse expression into parts
- parts = expression.exec(selector.replace(whiteSpace, ''));
-
- add(compileNameFilter(parts[1]));
- add(compileIdFilter(parts[2]));
- add(compileClassesFilter(parts[3]));
- add(compileAttrFilter(parts[4], parts[5], parts[6]));
- add(compilePsuedoFilter(parts[7]));
-
- // Mark the filter with pseudo for performance
- filters.pseudo = !!parts[7];
- filters.direct = direct;
-
- return filters;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Parser logic based on Sizzle by John Resig
- function parseChunks(selector, selectors) {
- var parts = [], extra, matches, i;
-
- do {
- chunker.exec("");
- matches = chunker.exec(selector);
-
- if (matches) {
- selector = matches[3];
- parts.push(matches[1]);
-
- if (matches[2]) {
- extra = matches[3];
- break;
- }
- }
- } while (matches);
-
- if (extra) {
- parseChunks(extra, selectors);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (name in obj2) {
+ if (obj2.hasOwnProperty(name)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- selector = [];
- for (i = 0; i < parts.length; i++) {
- if (parts[i] != '>') {
- selector.push(compile(parts[i], [], parts[i - 1] === '>'));
- }
- }
-
- selectors.push(selector);
-
- return selectors;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- this._selectors = parseChunks(selector, []);
- },
-
- /**
- * Returns true/false if the selector matches the specified control.
- *
- * @method match
- * @param {tinymce.ui.Control} control Control to match against the selector.
- * @param {Array} selectors Optional array of selectors, mostly used internally.
- * @return {Boolean} true/false state if the control matches or not.
- */
- match: function (control, selectors) {
- var i, l, si, sl, selector, fi, fl, filters, index, length, siblings, count, item;
-
- selectors = selectors || this._selectors;
- for (i = 0, l = selectors.length; i < l; i++) {
- selector = selectors[i];
- sl = selector.length;
- item = control;
- count = 0;
-
- for (si = sl - 1; si >= 0; si--) {
- filters = selector[si];
-
- while (item) {
- // Find the index and length since a pseudo filter like :first needs it
- if (filters.pseudo) {
- siblings = item.parent().items();
- index = length = siblings.length;
- while (index--) {
- if (siblings[index] === item) {
- break;
- }
- }
- }
-
- for (fi = 0, fl = filters.length; fi < fl; fi++) {
- if (!filters[fi](item, index, length)) {
- fi = fl + 1;
- break;
- }
- }
-
- if (fi === fl) {
- count++;
- break;
- } else {
- // If it didn't match the right most expression then
- // break since it's no point looking at the parents
- if (si === sl - 1) {
- break;
- }
- }
-
- item = item.parent();
- }
- }
-
- // If we found all selectors then return true otherwise continue looking
- if (count === sl) {
- return true;
- }
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ };
+ if (!compareObjects(getAttribs(node1), getAttribs(node2))) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Returns a tinymce.ui.Collection with matches of the specified selector inside the specified container.
- *
- * @method find
- * @param {tinymce.ui.Control} container Container to look for items in.
- * @return {tinymce.ui.Collection} Collection with matched elements.
- */
- find: function (container) {
- var matches = [], i, l, selectors = this._selectors;
-
- function collect(items, selector, index) {
- var i, l, fi, fl, item, filters = selector[index];
-
- for (i = 0, l = items.length; i < l; i++) {
- item = items[i];
-
- // Run each filter against the item
- for (fi = 0, fl = filters.length; fi < fl; fi++) {
- if (!filters[fi](item, i, l)) {
- fi = fl + 1;
- break;
- }
- }
-
- // All filters matched the item
- if (fi === fl) {
- // Matched item is on the last expression like: panel toolbar [button]
- if (index == selector.length - 1) {
- matches.push(item);
- } else {
- // Collect next expression type
- if (item.items) {
- collect(item.items(), selector, index + 1);
- }
- }
- } else if (filters.direct) {
- return;
- }
-
- // Collect child items
- if (item.items) {
- collect(item.items(), selector, index);
- }
- }
- }
-
- if (container.items) {
- for (i = 0, l = selectors.length; i < l; i++) {
- collect(container.items(), selectors[i], 0);
- }
-
- // Unique the matches if needed
- if (l > 1) {
- matches = unique(matches);
- }
- }
-
- // Fix for circular reference
- if (!Collection) {
- // TODO: Fix me!
- Collection = Selector.Collection;
- }
-
- return new Collection(matches);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- return Selector;
- }
-);
-
-/**
- * Collection.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Control collection, this class contains control instances and it enables you to
- * perform actions on all the contained items. This is very similar to how jQuery works.
- *
- * @example
- * someCollection.show().disabled(true);
- *
- * @class tinymce.ui.Collection
- */
-define(
- 'tinymce.core.ui.Collection',
- [
- "tinymce.core.util.Tools",
- "tinymce.core.ui.Selector",
- "tinymce.core.util.Class"
- ],
- function (Tools, Selector, Class) {
- "use strict";
-
- var Collection, proto, push = Array.prototype.push, slice = Array.prototype.slice;
-
- proto = {
- /**
- * Current number of contained control instances.
- *
- * @field length
- * @type Number
- */
- length: 0,
-
- /**
- * Constructor for the collection.
- *
- * @constructor
- * @method init
- * @param {Array} items Optional array with items to add.
- */
- init: function (items) {
- if (items) {
- this.add(items);
- }
- },
-
- /**
- * Adds new items to the control collection.
- *
- * @method add
- * @param {Array} items Array if items to add to collection.
- * @return {tinymce.ui.Collection} Current collection instance.
- */
- add: function (items) {
- var self = this;
-
- // Force single item into array
- if (!Tools.isArray(items)) {
- if (items instanceof Collection) {
- self.add(items.toArray());
- } else {
- push.call(self, items);
- }
- } else {
- push.apply(self, items);
- }
-
- return self;
- },
-
- /**
- * Sets the contents of the collection. This will remove any existing items
- * and replace them with the ones specified in the input array.
- *
- * @method set
- * @param {Array} items Array with items to set into the Collection.
- * @return {tinymce.ui.Collection} Collection instance.
- */
- set: function (items) {
- var self = this, len = self.length, i;
-
- self.length = 0;
- self.add(items);
-
- // Remove old entries
- for (i = self.length; i < len; i++) {
- delete self[i];
- }
-
- return self;
- },
-
- /**
- * Filters the collection item based on the specified selector expression or selector function.
- *
- * @method filter
- * @param {String} selector Selector expression to filter items by.
- * @return {tinymce.ui.Collection} Collection containing the filtered items.
- */
- filter: function (selector) {
- var self = this, i, l, matches = [], item, match;
-
- // Compile string into selector expression
- if (typeof selector === "string") {
- selector = new Selector(selector);
-
- match = function (item) {
- return selector.match(item);
- };
- } else {
- // Use selector as matching function
- match = selector;
- }
-
- for (i = 0, l = self.length; i < l; i++) {
- item = self[i];
-
- if (match(item)) {
- matches.push(item);
- }
- }
-
- return new Collection(matches);
- },
-
- /**
- * Slices the items within the collection.
- *
- * @method slice
- * @param {Number} index Index to slice at.
- * @param {Number} len Optional length to slice.
- * @return {tinymce.ui.Collection} Current collection.
- */
- slice: function () {
- return new Collection(slice.apply(this, arguments));
- },
-
- /**
- * Makes the current collection equal to the specified index.
- *
- * @method eq
- * @param {Number} index Index of the item to set the collection to.
- * @return {tinymce.ui.Collection} Current collection.
- */
- eq: function (index) {
- return index === -1 ? this.slice(index) : this.slice(index, +index + 1);
- },
-
- /**
- * Executes the specified callback on each item in collection.
- *
- * @method each
- * @param {function} callback Callback to execute for each item in collection.
- * @return {tinymce.ui.Collection} Current collection instance.
- */
- each: function (callback) {
- Tools.each(this, callback);
-
- return this;
- },
-
- /**
- * Returns an JavaScript array object of the contents inside the collection.
- *
- * @method toArray
- * @return {Array} Array with all items from collection.
- */
- toArray: function () {
- return Tools.toArray(this);
- },
-
- /**
- * Finds the index of the specified control or return -1 if it isn't in the collection.
- *
- * @method indexOf
- * @param {Control} ctrl Control instance to look for.
- * @return {Number} Index of the specified control or -1.
- */
- indexOf: function (ctrl) {
- var self = this, i = self.length;
-
- while (i--) {
- if (self[i] === ctrl) {
- break;
- }
- }
-
- return i;
- },
-
- /**
- * Returns a new collection of the contents in reverse order.
- *
- * @method reverse
- * @return {tinymce.ui.Collection} Collection instance with reversed items.
- */
- reverse: function () {
- return new Collection(Tools.toArray(this).reverse());
- },
-
- /**
- * Returns true/false if the class exists or not.
- *
- * @method hasClass
- * @param {String} cls Class to check for.
- * @return {Boolean} true/false state if the class exists or not.
- */
- hasClass: function (cls) {
- return this[0] ? this[0].classes.contains(cls) : false;
- },
-
- /**
- * Sets/gets the specific property on the items in the collection. The same as executing control.<property>(<value>);
- *
- * @method prop
- * @param {String} name Property name to get/set.
- * @param {Object} value Optional object value to set.
- * @return {tinymce.ui.Collection} Current collection instance or value of the first item on a get operation.
- */
- prop: function (name, value) {
- var self = this, undef, item;
-
- if (value !== undef) {
- self.each(function (item) {
- if (item[name]) {
- item[name](value);
- }
- });
-
- return self;
- }
-
- item = self[0];
-
- if (item && item[name]) {
- return item[name]();
- }
- },
-
- /**
- * Executes the specific function name with optional arguments an all items in collection if it exists.
- *
- * @example collection.exec("myMethod", arg1, arg2, arg3);
- * @method exec
- * @param {String} name Name of the function to execute.
- * @param {Object} ... Multiple arguments to pass to each function.
- * @return {tinymce.ui.Collection} Current collection.
- */
- exec: function (name) {
- var self = this, args = Tools.toArray(arguments).slice(1);
-
- self.each(function (item) {
- if (item[name]) {
- item[name].apply(item, args);
- }
- });
-
- return self;
- },
-
- /**
- * Remove all items from collection and DOM.
- *
- * @method remove
- * @return {tinymce.ui.Collection} Current collection.
- */
- remove: function () {
- var i = this.length;
-
- while (i--) {
- this[i].remove();
- }
-
- return this;
- },
-
- /**
- * Adds a class to all items in the collection.
- *
- * @method addClass
- * @param {String} cls Class to add to each item.
- * @return {tinymce.ui.Collection} Current collection instance.
- */
- addClass: function (cls) {
- return this.each(function (item) {
- item.classes.add(cls);
- });
- },
-
- /**
- * Removes the specified class from all items in collection.
- *
- * @method removeClass
- * @param {String} cls Class to remove from each item.
- * @return {tinymce.ui.Collection} Current collection instance.
- */
- removeClass: function (cls) {
- return this.each(function (item) {
- item.classes.remove(cls);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Fires the specified event by name and arguments on the control. This will execute all
- * bound event handlers.
- *
- * @method fire
- * @param {String} name Name of the event to fire.
- * @param {Object} args Optional arguments to pass to the event.
- * @return {tinymce.ui.Collection} Current collection instance.
- */
- // fire: function(event, args) {}, -- Generated by code below
-
- /**
- * Binds a callback to the specified event. This event can both be
- * native browser events like "click" or custom ones like PostRender.
- *
- * The callback function will have two parameters the first one being the control that received the event
- * the second one will be the event object either the browsers native event object or a custom JS object.
- *
- * @method on
- * @param {String} name Name of the event to bind. For example "click".
- * @param {String/function} callback Callback function to execute ones the event occurs.
- * @return {tinymce.ui.Collection} Current collection instance.
- */
- // on: function(name, callback) {}, -- Generated by code below
-
- /**
- * Unbinds the specified event and optionally a specific callback. If you omit the name
- * parameter all event handlers will be removed. If you omit the callback all event handles
- * by the specified name will be removed.
- *
- * @method off
- * @param {String} name Optional name for the event to unbind.
- * @param {function} callback Optional callback function to unbind.
- * @return {tinymce.ui.Collection} Current collection instance.
- */
- // off: function(name, callback) {}, -- Generated by code below
-
- /**
- * Shows the items in the current collection.
- *
- * @method show
- * @return {tinymce.ui.Collection} Current collection instance.
- */
- // show: function() {}, -- Generated by code below
-
- /**
- * Hides the items in the current collection.
- *
- * @method hide
- * @return {tinymce.ui.Collection} Current collection instance.
- */
- // hide: function() {}, -- Generated by code below
-
- /**
- * Sets/gets the text contents of the items in the current collection.
- *
- * @method text
- * @return {tinymce.ui.Collection} Current collection instance or text value of the first item on a get operation.
- */
- // text: function(value) {}, -- Generated by code below
-
- /**
- * Sets/gets the name contents of the items in the current collection.
- *
- * @method name
- * @return {tinymce.ui.Collection} Current collection instance or name value of the first item on a get operation.
- */
- // name: function(value) {}, -- Generated by code below
-
- /**
- * Sets/gets the disabled state on the items in the current collection.
- *
- * @method disabled
- * @return {tinymce.ui.Collection} Current collection instance or disabled state of the first item on a get operation.
- */
- // disabled: function(state) {}, -- Generated by code below
-
- /**
- * Sets/gets the active state on the items in the current collection.
- *
- * @method active
- * @return {tinymce.ui.Collection} Current collection instance or active state of the first item on a get operation.
- */
- // active: function(state) {}, -- Generated by code below
-
- /**
- * Sets/gets the selected state on the items in the current collection.
- *
- * @method selected
- * @return {tinymce.ui.Collection} Current collection instance or selected state of the first item on a get operation.
- */
- // selected: function(state) {}, -- Generated by code below
-
- /**
- * Sets/gets the selected state on the items in the current collection.
- *
- * @method visible
- * @return {tinymce.ui.Collection} Current collection instance or visible state of the first item on a get operation.
- */
- // visible: function(state) {}, -- Generated by code below
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return !$_disscn2njfuw8ll3.isBookmarkNode(node1) && !$_disscn2njfuw8ll3.isBookmarkNode(node2);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Extend tinymce.ui.Collection prototype with some generated control specific methods
- Tools.each('fire on off show hide append prepend before after reflow'.split(' '), function (name) {
- proto[name] = function () {
- var args = Tools.toArray(arguments);
-
- this.each(function (ctrl) {
- if (name in ctrl) {
- ctrl[name].apply(ctrl, args);
- }
- });
-
- return this;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var before$2 = function (marker, elements) {
+ $_9ek1bp4jfuw8kxg.each(elements, function (x) {
+ $_doli6x2kjfuw8lky.before(marker, x);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var after$2 = function (marker, elements) {
+ $_9ek1bp4jfuw8kxg.each(elements, function (x, i) {
+ var e = i === 0 ? marker : elements[i - 1];
+ $_doli6x2kjfuw8lky.after(e, x);
+ });
+ };
+ var prepend$1 = function (parent, elements) {
+ $_9ek1bp4jfuw8kxg.each(elements.slice().reverse(), function (x) {
+ $_doli6x2kjfuw8lky.prepend(parent, x);
+ });
+ };
+ var append$1 = function (parent, elements) {
+ $_9ek1bp4jfuw8kxg.each(elements, function (x) {
+ $_doli6x2kjfuw8lky.append(parent, x);
+ });
+ };
+ var $_84jjow2vjfuw8lml = {
+ before: before$2,
+ after: after$2,
+ prepend: prepend$1,
+ append: append$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Extend tinymce.ui.Collection prototype with some property methods
- Tools.each('text name disabled active selected checked visible parent value data'.split(' '), function (name) {
- proto[name] = function (value) {
- return this.prop(name, value);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var empty = function (element) {
+ element.dom().textContent = '';
+ $_9ek1bp4jfuw8kxg.each($_2j4g5u17jfuw8lav.children(element), function (rogue) {
+ remove$3(rogue);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var remove$3 = function (element) {
+ var dom = element.dom();
+ if (dom.parentNode !== null)
+ dom.parentNode.removeChild(dom);
+ };
+ var unwrap = function (wrapper) {
+ var children = $_2j4g5u17jfuw8lav.children(wrapper);
+ if (children.length > 0)
+ $_84jjow2vjfuw8lml.before(wrapper, children);
+ remove$3(wrapper);
+ };
+ var $_byg6a92ujfuw8lmi = {
+ empty: empty,
+ remove: remove$3,
+ unwrap: unwrap
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Create class based on the new prototype
- Collection = Class.extend(proto);
-
- // Stick Collection into Selector to prevent circual references
- Selector.Collection = Collection;
-
- return Collection;
- }
-);
-/**
- * BoxUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Utility class for box parsing and measuring.
- *
- * @private
- * @class tinymce.ui.BoxUtils
- */
-define(
- 'tinymce.core.ui.BoxUtils',
- [
- ],
- function () {
- "use strict";
-
- return {
- /**
- * Parses the specified box value. A box value contains 1-4 properties in clockwise order.
- *
- * @method parseBox
- * @param {String/Number} value Box value "0 1 2 3" or "0" etc.
- * @return {Object} Object with top/right/bottom/left properties.
- * @private
- */
- parseBox: function (value) {
- var len, radix = 10;
-
- if (!value) {
- return;
- }
-
- if (typeof value === "number") {
- value = value || 0;
-
- return {
- top: value,
- left: value,
- bottom: value,
- right: value
- };
- }
-
- value = value.split(' ');
- len = value.length;
-
- if (len === 1) {
- value[1] = value[2] = value[3] = value[0];
- } else if (len === 2) {
- value[2] = value[0];
- value[3] = value[1];
- } else if (len === 3) {
- value[3] = value[1];
- }
-
- return {
- top: parseInt(value[0], radix) || 0,
- right: parseInt(value[1], radix) || 0,
- bottom: parseInt(value[2], radix) || 0,
- left: parseInt(value[3], radix) || 0
- };
- },
-
- measureBox: function (elm, prefix) {
- function getStyle(name) {
- var defaultView = document.defaultView;
-
- if (defaultView) {
- // Remove camelcase
- name = name.replace(/[A-Z]/g, function (a) {
- return '-' + a;
- });
-
- return defaultView.getComputedStyle(elm, null).getPropertyValue(name);
- }
-
- return elm.currentStyle[name];
- }
-
- function getSide(name) {
- var val = parseFloat(getStyle(name), 10);
-
- return isNaN(val) ? 0 : val;
- }
-
- return {
- top: getSide(prefix + "TopWidth"),
- right: getSide(prefix + "RightWidth"),
- bottom: getSide(prefix + "BottomWidth"),
- left: getSide(prefix + "LeftWidth")
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function NodeValue (is, name) {
+ var get = function (element) {
+ if (!is(element))
+ throw new Error('Can only get ' + name + ' value of a ' + name + ' node');
+ return getOption(element).getOr('');
+ };
+ var getOptionIE10 = function (element) {
+ try {
+ return getOptionSafe(element);
+ } catch (e) {
+ return Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getOptionSafe = function (element) {
+ return is(element) ? Option.from(element.dom().nodeValue) : Option.none();
+ };
+ var browser = $_f1lbzgnjfuw8l7o.detect().browser;
+ var getOption = browser.isIE() && browser.version.major === 10 ? getOptionIE10 : getOptionSafe;
+ var set = function (element, value) {
+ if (!is(element))
+ throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');
+ element.dom().nodeValue = value;
+ };
+ return {
+ get: get,
+ getOption: getOption,
+ set: set
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ClassList.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var api = NodeValue($_eaw33d10jfuw8l9f.isText, 'text');
+ var get$2 = function (element) {
+ return api.get(element);
+ };
+ var getOption = function (element) {
+ return api.getOption(element);
+ };
+ var set$2 = function (element, value) {
+ api.set(element, value);
+ };
+ var $_buobzn2wjfuw8lmp = {
+ get: get$2,
+ getOption: getOption,
+ set: set$2
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Handles adding and removal of classes.
- *
- * @private
- * @class tinymce.ui.ClassList
- */
-define(
- 'tinymce.core.ui.ClassList',
- [
- "tinymce.core.util.Tools"
- ],
- function (Tools) {
- "use strict";
-
- function noop() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getLastChildren = function (elm) {
+ var children = [];
+ var rawNode = elm.dom();
+ while (rawNode) {
+ children.push($_c9h6qlzjfuw8l98.fromDom(rawNode));
+ rawNode = rawNode.lastChild;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Constructs a new class list the specified onchange
- * callback will be executed when the class list gets modifed.
- *
- * @constructor ClassList
- * @param {function} onchange Onchange callback to be executed.
- */
- function ClassList(onchange) {
- this.cls = [];
- this.cls._map = {};
- this.onchange = onchange || noop;
- this.prefix = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return children;
+ };
+ var removeTrailingBr = function (elm) {
+ var allBrs = $_ryxde2gjfuw8lkk.descendants(elm, 'br');
+ var brs = $_9ek1bp4jfuw8kxg.filter(getLastChildren(elm).slice(-1), isBr);
+ if (allBrs.length === brs.length) {
+ $_9ek1bp4jfuw8kxg.each(brs, $_byg6a92ujfuw8lmi.remove);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- Tools.extend(ClassList.prototype, {
- /**
- * Adds a new class to the class list.
- *
- * @method add
- * @param {String} cls Class to be added.
- * @return {tinymce.ui.ClassList} Current class list instance.
- */
- add: function (cls) {
- if (cls && !this.contains(cls)) {
- this.cls._map[cls] = true;
- this.cls.push(cls);
- this._change();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var fillWithPaddingBr = function (elm) {
+ $_byg6a92ujfuw8lmi.empty(elm);
+ $_doli6x2kjfuw8lky.append(elm, $_c9h6qlzjfuw8l98.fromHtml('<br data-mce-bogus="1">'));
+ };
+ var isPaddingContents = function (elm) {
+ return $_eaw33d10jfuw8l9f.isText(elm) ? $_buobzn2wjfuw8lmp.get(elm) === '\xA0' : isBr(elm);
+ };
+ var isPaddedElement = function (elm) {
+ return $_9ek1bp4jfuw8kxg.filter($_2j4g5u17jfuw8lav.children(elm), isPaddingContents).length === 1;
+ };
+ var trimBlockTrailingBr = function (elm) {
+ $_2j4g5u17jfuw8lav.lastChild(elm).each(function (lastChild) {
+ $_2j4g5u17jfuw8lav.prevSibling(lastChild).each(function (lastChildPrevSibling) {
+ if (isBlock(elm) && isBr(lastChild) && isBlock(lastChildPrevSibling)) {
+ $_byg6a92ujfuw8lmi.remove(lastChild);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return this;
- },
-
- /**
- * Removes the specified class from the class list.
- *
- * @method remove
- * @param {String} cls Class to be removed.
- * @return {tinymce.ui.ClassList} Current class list instance.
- */
- remove: function (cls) {
- if (this.contains(cls)) {
- for (var i = 0; i < this.cls.length; i++) {
- if (this.cls[i] === cls) {
- break;
- }
- }
-
- this.cls.splice(i, 1);
- delete this.cls._map[cls];
- this._change();
- }
-
- return this;
- },
-
- /**
- * Toggles a class in the class list.
- *
- * @method toggle
- * @param {String} cls Class to be added/removed.
- * @param {Boolean} state Optional state if it should be added/removed.
- * @return {tinymce.ui.ClassList} Current class list instance.
- */
- toggle: function (cls, state) {
- var curState = this.contains(cls);
-
- if (curState !== state) {
- if (curState) {
- this.remove(cls);
- } else {
- this.add(cls);
- }
-
- this._change();
- }
-
- return this;
- },
-
- /**
- * Returns true if the class list has the specified class.
- *
- * @method contains
- * @param {String} cls Class to look for.
- * @return {Boolean} true/false if the class exists or not.
- */
- contains: function (cls) {
- return !!this.cls._map[cls];
- },
-
- /**
- * Returns a space separated list of classes.
- *
- * @method toString
- * @return {String} Space separated list of classes.
- */
-
- _change: function () {
- delete this.clsValue;
- this.onchange.call(this);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_5udnjn2tjfuw8lm4 = {
+ removeTrailingBr: removeTrailingBr,
+ fillWithPaddingBr: fillWithPaddingBr,
+ isPaddedElement: isPaddedElement,
+ trimBlockTrailingBr: trimBlockTrailingBr
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // IE 8 compatibility
- ClassList.prototype.toString = function () {
- var value;
-
- if (this.clsValue) {
- return this.clsValue;
- }
-
- value = '';
- for (var i = 0; i < this.cls.length; i++) {
- if (i > 0) {
- value += ' ';
- }
-
- value += this.prefix + this.cls[i];
- }
-
- return value;
- };
-
- return ClassList;
- }
-);
-/**
- * ReflowQueue.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class will automatically reflow controls on the next animation frame within a few milliseconds on older browsers.
- * If the user manually reflows then the automatic reflow will be cancelled. This class is used internally when various control states
- * changes that triggers a reflow.
- *
- * @class tinymce.ui.ReflowQueue
- * @static
- */
-define(
- 'tinymce.core.ui.ReflowQueue',
- [
- "tinymce.core.util.Delay"
- ],
- function (Delay) {
- var dirtyCtrls = {}, animationFrameRequested;
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var makeMap$3 = $_52qop8kjfuw8l6v.makeMap;
+ function Writer (settings) {
+ var html = [];
+ var indent, indentBefore, indentAfter, encode, htmlOutput;
+ settings = settings || {};
+ indent = settings.indent;
+ indentBefore = makeMap$3(settings.indent_before || '');
+ indentAfter = makeMap$3(settings.indent_after || '');
+ encode = $_8uzsfe1rjfuw8ldm.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities);
+ htmlOutput = settings.element_format === 'html';
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Adds a control to the next automatic reflow call. This is the control that had a state
- * change for example if the control was hidden/shown.
- *
- * @method add
- * @param {tinymce.ui.Control} ctrl Control to add to queue.
- */
- add: function (ctrl) {
- var parent = ctrl.parent();
-
- if (parent) {
- if (!parent._layout || parent._layout.isNative()) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ start: function (name, attrs, empty) {
+ var i, l, attr, value;
+ if (indent && indentBefore[name] && html.length > 0) {
+ value = html[html.length - 1];
+ if (value.length > 0 && value !== '\n') {
+ html.push('\n');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!dirtyCtrls[parent._id]) {
- dirtyCtrls[parent._id] = parent;
- }
-
- if (!animationFrameRequested) {
- animationFrameRequested = true;
-
- Delay.requestAnimationFrame(function () {
- var id, ctrl;
-
- animationFrameRequested = false;
-
- for (id in dirtyCtrls) {
- ctrl = dirtyCtrls[id];
-
- if (ctrl.state.get('rendered')) {
- ctrl.reflow();
- }
- }
-
- dirtyCtrls = {};
- }, document.body);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Removes the specified control from the automatic reflow. This will happen when for example the user
- * manually triggers a reflow.
- *
- * @method remove
- * @param {tinymce.ui.Control} ctrl Control to remove from queue.
- */
- remove: function (ctrl) {
- if (dirtyCtrls[ctrl._id]) {
- delete dirtyCtrls[ctrl._id];
- }
- }
- };
- }
-);
-
-/**
- * Control.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/*eslint consistent-this:0 */
-
-/**
- * This is the base class for all controls and containers. All UI control instances inherit
- * from this one as it has the base logic needed by all of them.
- *
- * @class tinymce.ui.Control
- */
-define(
- 'tinymce.core.ui.Control',
- [
- "tinymce.core.util.Class",
- "tinymce.core.util.Tools",
- "tinymce.core.util.EventDispatcher",
- "tinymce.core.data.ObservableObject",
- "tinymce.core.ui.Collection",
- "tinymce.core.ui.DomUtils",
- "tinymce.core.dom.DomQuery",
- "tinymce.core.ui.BoxUtils",
- "tinymce.core.ui.ClassList",
- "tinymce.core.ui.ReflowQueue"
- ],
- function (Class, Tools, EventDispatcher, ObservableObject, Collection, DomUtils, $, BoxUtils, ClassList, ReflowQueue) {
- "use strict";
-
- var hasMouseWheelEventSupport = "onmousewheel" in document;
- var hasWheelEventSupport = false;
- var classPrefix = "mce-";
- var Control, idCounter = 0;
-
- var proto = {
- Statics: {
- classPrefix: classPrefix
- },
-
- isRtl: function () {
- return Control.rtl;
- },
-
- /**
- * Class/id prefix to use for all controls.
- *
- * @final
- * @field {String} classPrefix
- */
- classPrefix: classPrefix,
-
- /**
- * Constructs a new control instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {String} style Style CSS properties to add.
- * @setting {String} border Border box values example: 1 1 1 1
- * @setting {String} padding Padding box values example: 1 1 1 1
- * @setting {String} margin Margin box values example: 1 1 1 1
- * @setting {Number} minWidth Minimal width for the control.
- * @setting {Number} minHeight Minimal height for the control.
- * @setting {String} classes Space separated list of classes to add.
- * @setting {String} role WAI-ARIA role to use for control.
- * @setting {Boolean} hidden Is the control hidden by default.
- * @setting {Boolean} disabled Is the control disabled by default.
- * @setting {String} name Name of the control instance.
- */
- init: function (settings) {
- var self = this, classes, defaultClasses;
-
- function applyClasses(classes) {
- var i;
-
- classes = classes.split(' ');
- for (i = 0; i < classes.length; i++) {
- self.classes.add(classes[i]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ html.push('<', name);
+ if (attrs) {
+ for (i = 0, l = attrs.length; i < l; i++) {
+ attr = attrs[i];
+ html.push(' ', attr.name, '="', encode(attr.value, true), '"');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.settings = settings = Tools.extend({}, self.Defaults, settings);
-
- // Initial states
- self._id = settings.id || ('mceu_' + (idCounter++));
- self._aria = { role: settings.role };
- self._elmCache = {};
- self.$ = $;
-
- self.state = new ObservableObject({
- visible: true,
- active: false,
- disabled: false,
- value: ''
- });
-
- self.data = new ObservableObject(settings.data);
-
- self.classes = new ClassList(function () {
- if (self.state.get('rendered')) {
- self.getEl().className = this.toString();
- }
- });
- self.classes.prefix = self.classPrefix;
-
- // Setup classes
- classes = settings.classes;
- if (classes) {
- if (self.Defaults) {
- defaultClasses = self.Defaults.classes;
-
- if (defaultClasses && classes != defaultClasses) {
- applyClasses(defaultClasses);
- }
- }
-
- applyClasses(classes);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!empty || htmlOutput) {
+ html[html.length] = '>';
+ } else {
+ html[html.length] = ' />';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- Tools.each('title text name visible disabled active value'.split(' '), function (name) {
- if (name in settings) {
- self[name](settings[name]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (empty && indent && indentAfter[name] && html.length > 0) {
+ value = html[html.length - 1];
+ if (value.length > 0 && value !== '\n') {
+ html.push('\n');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- self.on('click', function () {
- if (self.disabled()) {
- return false;
- }
- });
-
- /**
- * Name/value object with settings for the current control.
- *
- * @field {Object} settings
- */
- self.settings = settings;
-
- self.borderBox = BoxUtils.parseBox(settings.border);
- self.paddingBox = BoxUtils.parseBox(settings.padding);
- self.marginBox = BoxUtils.parseBox(settings.margin);
-
- if (settings.hidden) {
- self.hide();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Will generate getter/setter methods for these properties
- Properties: 'parent,name',
-
- /**
- * Returns the root element to render controls into.
- *
- * @method getContainerElm
- * @return {Element} HTML DOM element to render into.
- */
- getContainerElm: function () {
- return DomUtils.getContainer();
- },
-
- /**
- * Returns a control instance for the current DOM element.
- *
- * @method getParentCtrl
- * @param {Element} elm HTML dom element to get parent control from.
- * @return {tinymce.ui.Control} Control instance or undefined.
- */
- getParentCtrl: function (elm) {
- var ctrl, lookup = this.getRoot().controlIdLookup;
-
- while (elm && lookup) {
- ctrl = lookup[elm.id];
- if (ctrl) {
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ end: function (name) {
+ var value;
+ html.push('</', name, '>');
+ if (indent && indentAfter[name] && html.length > 0) {
+ value = html[html.length - 1];
+ if (value.length > 0 && value !== '\n') {
+ html.push('\n');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- elm = elm.parentNode;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return ctrl;
</del><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Initializes the current controls layout rect.
- * This will be executed by the layout managers to determine the
- * default minWidth/minHeight etc.
- *
- * @method initLayoutRect
- * @return {Object} Layout rect instance.
- */
- initLayoutRect: function () {
- var self = this, settings = self.settings, borderBox, layoutRect;
- var elm = self.getEl(), width, height, minWidth, minHeight, autoResize;
- var startMinWidth, startMinHeight, initialSize;
-
- // Measure the current element
- borderBox = self.borderBox = self.borderBox || BoxUtils.measureBox(elm, 'border');
- self.paddingBox = self.paddingBox || BoxUtils.measureBox(elm, 'padding');
- self.marginBox = self.marginBox || BoxUtils.measureBox(elm, 'margin');
- initialSize = DomUtils.getSize(elm);
-
- // Setup minWidth/minHeight and width/height
- startMinWidth = settings.minWidth;
- startMinHeight = settings.minHeight;
- minWidth = startMinWidth || initialSize.width;
- minHeight = startMinHeight || initialSize.height;
- width = settings.width;
- height = settings.height;
- autoResize = settings.autoResize;
- autoResize = typeof autoResize != "undefined" ? autoResize : !width && !height;
-
- width = width || minWidth;
- height = height || minHeight;
-
- var deltaW = borderBox.left + borderBox.right;
- var deltaH = borderBox.top + borderBox.bottom;
-
- var maxW = settings.maxWidth || 0xFFFF;
- var maxH = settings.maxHeight || 0xFFFF;
-
- // Setup initial layout rect
- self._layoutRect = layoutRect = {
- x: settings.x || 0,
- y: settings.y || 0,
- w: width,
- h: height,
- deltaW: deltaW,
- deltaH: deltaH,
- contentW: width - deltaW,
- contentH: height - deltaH,
- innerW: width - deltaW,
- innerH: height - deltaH,
- startMinWidth: startMinWidth || 0,
- startMinHeight: startMinHeight || 0,
- minW: Math.min(minWidth, maxW),
- minH: Math.min(minHeight, maxH),
- maxW: maxW,
- maxH: maxH,
- autoResize: autoResize,
- scrollW: 0
- };
-
- self._lastLayoutRect = {};
-
- return layoutRect;
- },
-
- /**
- * Getter/setter for the current layout rect.
- *
- * @method layoutRect
- * @param {Object} [newRect] Optional new layout rect.
- * @return {tinymce.ui.Control/Object} Current control or rect object.
- */
- layoutRect: function (newRect) {
- var self = this, curRect = self._layoutRect, lastLayoutRect, size, deltaWidth, deltaHeight, undef, repaintControls;
-
- // Initialize default layout rect
- if (!curRect) {
- curRect = self.initLayoutRect();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ text: function (text, raw) {
+ if (text.length > 0) {
+ html[html.length] = raw ? text : encode(text);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Set new rect values
- if (newRect) {
- // Calc deltas between inner and outer sizes
- deltaWidth = curRect.deltaW;
- deltaHeight = curRect.deltaH;
-
- // Set x position
- if (newRect.x !== undef) {
- curRect.x = newRect.x;
- }
-
- // Set y position
- if (newRect.y !== undef) {
- curRect.y = newRect.y;
- }
-
- // Set minW
- if (newRect.minW !== undef) {
- curRect.minW = newRect.minW;
- }
-
- // Set minH
- if (newRect.minH !== undef) {
- curRect.minH = newRect.minH;
- }
-
- // Set new width and calculate inner width
- size = newRect.w;
- if (size !== undef) {
- size = size < curRect.minW ? curRect.minW : size;
- size = size > curRect.maxW ? curRect.maxW : size;
- curRect.w = size;
- curRect.innerW = size - deltaWidth;
- }
-
- // Set new height and calculate inner height
- size = newRect.h;
- if (size !== undef) {
- size = size < curRect.minH ? curRect.minH : size;
- size = size > curRect.maxH ? curRect.maxH : size;
- curRect.h = size;
- curRect.innerH = size - deltaHeight;
- }
-
- // Set new inner width and calculate width
- size = newRect.innerW;
- if (size !== undef) {
- size = size < curRect.minW - deltaWidth ? curRect.minW - deltaWidth : size;
- size = size > curRect.maxW - deltaWidth ? curRect.maxW - deltaWidth : size;
- curRect.innerW = size;
- curRect.w = size + deltaWidth;
- }
-
- // Set new height and calculate inner height
- size = newRect.innerH;
- if (size !== undef) {
- size = size < curRect.minH - deltaHeight ? curRect.minH - deltaHeight : size;
- size = size > curRect.maxH - deltaHeight ? curRect.maxH - deltaHeight : size;
- curRect.innerH = size;
- curRect.h = size + deltaHeight;
- }
-
- // Set new contentW
- if (newRect.contentW !== undef) {
- curRect.contentW = newRect.contentW;
- }
-
- // Set new contentH
- if (newRect.contentH !== undef) {
- curRect.contentH = newRect.contentH;
- }
-
- // Compare last layout rect with the current one to see if we need to repaint or not
- lastLayoutRect = self._lastLayoutRect;
- if (lastLayoutRect.x !== curRect.x || lastLayoutRect.y !== curRect.y ||
- lastLayoutRect.w !== curRect.w || lastLayoutRect.h !== curRect.h) {
- repaintControls = Control.repaintControls;
-
- if (repaintControls) {
- if (repaintControls.map && !repaintControls.map[self._id]) {
- repaintControls.push(self);
- repaintControls.map[self._id] = true;
- }
- }
-
- lastLayoutRect.x = curRect.x;
- lastLayoutRect.y = curRect.y;
- lastLayoutRect.w = curRect.w;
- lastLayoutRect.h = curRect.h;
- }
-
- return self;
- }
-
- return curRect;
</del><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Repaints the control after a layout operation.
- *
- * @method repaint
- */
- repaint: function () {
- var self = this, style, bodyStyle, bodyElm, rect, borderBox;
- var borderW, borderH, lastRepaintRect, round, value;
-
- // Use Math.round on all values on IE < 9
- round = !document.createRange ? Math.round : function (value) {
- return value;
- };
-
- style = self.getEl().style;
- rect = self._layoutRect;
- lastRepaintRect = self._lastRepaintRect || {};
-
- borderBox = self.borderBox;
- borderW = borderBox.left + borderBox.right;
- borderH = borderBox.top + borderBox.bottom;
-
- if (rect.x !== lastRepaintRect.x) {
- style.left = round(rect.x) + 'px';
- lastRepaintRect.x = rect.x;
- }
-
- if (rect.y !== lastRepaintRect.y) {
- style.top = round(rect.y) + 'px';
- lastRepaintRect.y = rect.y;
- }
-
- if (rect.w !== lastRepaintRect.w) {
- value = round(rect.w - borderW);
- style.width = (value >= 0 ? value : 0) + 'px';
- lastRepaintRect.w = rect.w;
- }
-
- if (rect.h !== lastRepaintRect.h) {
- value = round(rect.h - borderH);
- style.height = (value >= 0 ? value : 0) + 'px';
- lastRepaintRect.h = rect.h;
- }
-
- // Update body if needed
- if (self._hasBody && rect.innerW !== lastRepaintRect.innerW) {
- value = round(rect.innerW);
-
- bodyElm = self.getEl('body');
- if (bodyElm) {
- bodyStyle = bodyElm.style;
- bodyStyle.width = (value >= 0 ? value : 0) + 'px';
- }
-
- lastRepaintRect.innerW = rect.innerW;
- }
-
- if (self._hasBody && rect.innerH !== lastRepaintRect.innerH) {
- value = round(rect.innerH);
-
- bodyElm = bodyElm || self.getEl('body');
- if (bodyElm) {
- bodyStyle = bodyStyle || bodyElm.style;
- bodyStyle.height = (value >= 0 ? value : 0) + 'px';
- }
-
- lastRepaintRect.innerH = rect.innerH;
- }
-
- self._lastRepaintRect = lastRepaintRect;
- self.fire('repaint', {}, false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ cdata: function (text) {
+ html.push('<![CDATA[', text, ']]>');
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Updates the controls layout rect by re-measuing it.
- */
- updateLayoutRect: function () {
- var self = this;
-
- self.parent()._lastRect = null;
-
- DomUtils.css(self.getEl(), { width: '', height: '' });
-
- self._layoutRect = self._lastRepaintRect = self._lastLayoutRect = null;
- self.initLayoutRect();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ comment: function (text) {
+ html.push('<!--', text, '-->');
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Binds a callback to the specified event. This event can both be
- * native browser events like "click" or custom ones like PostRender.
- *
- * The callback function will be passed a DOM event like object that enables yout do stop propagation.
- *
- * @method on
- * @param {String} name Name of the event to bind. For example "click".
- * @param {String/function} callback Callback function to execute ones the event occurs.
- * @return {tinymce.ui.Control} Current control object.
- */
- on: function (name, callback) {
- var self = this;
-
- function resolveCallbackName(name) {
- var callback, scope;
-
- if (typeof name != 'string') {
- return name;
- }
-
- return function (e) {
- if (!callback) {
- self.parentsAndSelf().each(function (ctrl) {
- var callbacks = ctrl.settings.callbacks;
-
- if (callbacks && (callback = callbacks[name])) {
- scope = ctrl;
- return false;
- }
- });
- }
-
- if (!callback) {
- e.action = name;
- this.fire('execute', e);
- return;
- }
-
- return callback.call(scope, e);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ pi: function (name, text) {
+ if (text) {
+ html.push('<?', name, ' ', encode(text), '?>');
+ } else {
+ html.push('<?', name, '?>');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- getEventDispatcher(self).on(name, resolveCallbackName(callback));
-
- return self;
- },
-
- /**
- * Unbinds the specified event and optionally a specific callback. If you omit the name
- * parameter all event handlers will be removed. If you omit the callback all event handles
- * by the specified name will be removed.
- *
- * @method off
- * @param {String} [name] Name for the event to unbind.
- * @param {function} [callback] Callback function to unbind.
- * @return {tinymce.ui.Control} Current control object.
- */
- off: function (name, callback) {
- getEventDispatcher(this).off(name, callback);
- return this;
- },
-
- /**
- * Fires the specified event by name and arguments on the control. This will execute all
- * bound event handlers.
- *
- * @method fire
- * @param {String} name Name of the event to fire.
- * @param {Object} [args] Arguments to pass to the event.
- * @param {Boolean} [bubble] Value to control bubbling. Defaults to true.
- * @return {Object} Current arguments object.
- */
- fire: function (name, args, bubble) {
- var self = this;
-
- args = args || {};
-
- if (!args.control) {
- args.control = self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (indent) {
+ html.push('\n');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- args = getEventDispatcher(self).fire(name, args);
-
- // Bubble event up to parents
- if (bubble !== false && self.parent) {
- var parent = self.parent();
- while (parent && !args.isPropagationStopped()) {
- parent.fire(name, args, false);
- parent = parent.parent();
- }
- }
-
- return args;
</del><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns true/false if the specified event has any listeners.
- *
- * @method hasEventListeners
- * @param {String} name Name of the event to check for.
- * @return {Boolean} True/false state if the event has listeners.
- */
- hasEventListeners: function (name) {
- return getEventDispatcher(this).has(name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ doctype: function (text) {
+ html.push('<!DOCTYPE', text, '>', indent ? '\n' : '');
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns a control collection with all parent controls.
- *
- * @method parents
- * @param {String} selector Optional selector expression to find parents.
- * @return {tinymce.ui.Collection} Collection with all parent controls.
- */
- parents: function (selector) {
- var self = this, ctrl, parents = new Collection();
-
- // Add each parent to collection
- for (ctrl = self.parent(); ctrl; ctrl = ctrl.parent()) {
- parents.add(ctrl);
- }
-
- // Filter away everything that doesn't match the selector
- if (selector) {
- parents = parents.filter(selector);
- }
-
- return parents;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ reset: function () {
+ html.length = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the current control and it's parents.
- *
- * @method parentsAndSelf
- * @param {String} selector Optional selector expression to find parents.
- * @return {tinymce.ui.Collection} Collection with all parent controls.
- */
- parentsAndSelf: function (selector) {
- return new Collection(this).add(this.parents(selector));
- },
-
- /**
- * Returns the control next to the current control.
- *
- * @method next
- * @return {tinymce.ui.Control} Next control instance.
- */
- next: function () {
- var parentControls = this.parent().items();
-
- return parentControls[parentControls.indexOf(this) + 1];
- },
-
- /**
- * Returns the control previous to the current control.
- *
- * @method prev
- * @return {tinymce.ui.Control} Previous control instance.
- */
- prev: function () {
- var parentControls = this.parent().items();
-
- return parentControls[parentControls.indexOf(this) - 1];
- },
-
- /**
- * Sets the inner HTML of the control element.
- *
- * @method innerHtml
- * @param {String} html Html string to set as inner html.
- * @return {tinymce.ui.Control} Current control object.
- */
- innerHtml: function (html) {
- this.$el.html(html);
- return this;
- },
-
- /**
- * Returns the control DOM element or sub element.
- *
- * @method getEl
- * @param {String} [suffix] Suffix to get element by.
- * @return {Element} HTML DOM element for the current control or it's children.
- */
- getEl: function (suffix) {
- var id = suffix ? this._id + '-' + suffix : this._id;
-
- if (!this._elmCache[id]) {
- this._elmCache[id] = $('#' + id)[0];
- }
-
- return this._elmCache[id];
- },
-
- /**
- * Sets the visible state to true.
- *
- * @method show
- * @return {tinymce.ui.Control} Current control instance.
- */
- show: function () {
- return this.visible(true);
- },
-
- /**
- * Sets the visible state to false.
- *
- * @method hide
- * @return {tinymce.ui.Control} Current control instance.
- */
- hide: function () {
- return this.visible(false);
- },
-
- /**
- * Focuses the current control.
- *
- * @method focus
- * @return {tinymce.ui.Control} Current control instance.
- */
- focus: function () {
- try {
- this.getEl().focus();
- } catch (ex) {
- // Ignore IE error
- }
-
- return this;
- },
-
- /**
- * Blurs the current control.
- *
- * @method blur
- * @return {tinymce.ui.Control} Current control instance.
- */
- blur: function () {
- this.getEl().blur();
-
- return this;
- },
-
- /**
- * Sets the specified aria property.
- *
- * @method aria
- * @param {String} name Name of the aria property to set.
- * @param {String} value Value of the aria property.
- * @return {tinymce.ui.Control} Current control instance.
- */
- aria: function (name, value) {
- var self = this, elm = self.getEl(self.ariaTarget);
-
- if (typeof value === "undefined") {
- return self._aria[name];
- }
-
- self._aria[name] = value;
-
- if (self.state.get('rendered')) {
- elm.setAttribute(name == 'role' ? name : 'aria-' + name, value);
- }
-
- return self;
- },
-
- /**
- * Encodes the specified string with HTML entities. It will also
- * translate the string to different languages.
- *
- * @method encode
- * @param {String/Object/Array} text Text to entity encode.
- * @param {Boolean} [translate=true] False if the contents shouldn't be translated.
- * @return {String} Encoded and possible traslated string.
- */
- encode: function (text, translate) {
- if (translate !== false) {
- text = this.translate(text);
- }
-
- return (text || '').replace(/[&<>"]/g, function (match) {
- return '&#' + match.charCodeAt(0) + ';';
- });
- },
-
- /**
- * Returns the translated string.
- *
- * @method translate
- * @param {String} text Text to translate.
- * @return {String} Translated string or the same as the input.
- */
- translate: function (text) {
- return Control.translate ? Control.translate(text) : text;
- },
-
- /**
- * Adds items before the current control.
- *
- * @method before
- * @param {Array/tinymce.ui.Collection} items Array of items to prepend before this control.
- * @return {tinymce.ui.Control} Current control instance.
- */
- before: function (items) {
- var self = this, parent = self.parent();
-
- if (parent) {
- parent.insert(items, parent.items().indexOf(self), true);
- }
-
- return self;
- },
-
- /**
- * Adds items after the current control.
- *
- * @method after
- * @param {Array/tinymce.ui.Collection} items Array of items to append after this control.
- * @return {tinymce.ui.Control} Current control instance.
- */
- after: function (items) {
- var self = this, parent = self.parent();
-
- if (parent) {
- parent.insert(items, parent.items().indexOf(self));
- }
-
- return self;
- },
-
- /**
- * Removes the current control from DOM and from UI collections.
- *
- * @method remove
- * @return {tinymce.ui.Control} Current control instance.
- */
- remove: function () {
- var self = this, elm = self.getEl(), parent = self.parent(), newItems, i;
-
- if (self.items) {
- var controls = self.items().toArray();
- i = controls.length;
- while (i--) {
- controls[i].remove();
- }
- }
-
- if (parent && parent.items) {
- newItems = [];
-
- parent.items().each(function (item) {
- if (item !== self) {
- newItems.push(item);
- }
- });
-
- parent.items().set(newItems);
- parent._lastRect = null;
- }
-
- if (self._eventsRoot && self._eventsRoot == self) {
- $(elm).off();
- }
-
- var lookup = self.getRoot().controlIdLookup;
- if (lookup) {
- delete lookup[self._id];
- }
-
- if (elm && elm.parentNode) {
- elm.parentNode.removeChild(elm);
- }
-
- self.state.set('rendered', false);
- self.state.destroy();
-
- self.fire('remove');
-
- return self;
- },
-
- /**
- * Renders the control before the specified element.
- *
- * @method renderBefore
- * @param {Element} elm Element to render before.
- * @return {tinymce.ui.Control} Current control instance.
- */
- renderBefore: function (elm) {
- $(elm).before(this.renderHtml());
- this.postRender();
- return this;
- },
-
- /**
- * Renders the control to the specified element.
- *
- * @method renderBefore
- * @param {Element} elm Element to render to.
- * @return {tinymce.ui.Control} Current control instance.
- */
- renderTo: function (elm) {
- $(elm || this.getContainerElm()).append(this.renderHtml());
- this.postRender();
- return this;
- },
-
- preRender: function () {
- },
-
- render: function () {
- },
-
- renderHtml: function () {
- return '<div id="' + this._id + '" class="' + this.classes + '"></div>';
- },
-
- /**
- * Post render method. Called after the control has been rendered to the target.
- *
- * @method postRender
- * @return {tinymce.ui.Control} Current control instance.
- */
- postRender: function () {
- var self = this, settings = self.settings, elm, box, parent, name, parentEventsRoot;
-
- self.$el = $(self.getEl());
- self.state.set('rendered', true);
-
- // Bind on<event> settings
- for (name in settings) {
- if (name.indexOf("on") === 0) {
- self.on(name.substr(2), settings[name]);
- }
- }
-
- if (self._eventsRoot) {
- for (parent = self.parent(); !parentEventsRoot && parent; parent = parent.parent()) {
- parentEventsRoot = parent._eventsRoot;
- }
-
- if (parentEventsRoot) {
- for (name in parentEventsRoot._nativeEvents) {
- self._nativeEvents[name] = true;
- }
- }
- }
-
- bindPendingEvents(self);
-
- if (settings.style) {
- elm = self.getEl();
- if (elm) {
- elm.setAttribute('style', settings.style);
- elm.style.cssText = settings.style;
- }
- }
-
- if (self.settings.border) {
- box = self.borderBox;
- self.$el.css({
- 'border-top-width': box.top,
- 'border-right-width': box.right,
- 'border-bottom-width': box.bottom,
- 'border-left-width': box.left
- });
- }
-
- // Add instance to lookup
- var root = self.getRoot();
- if (!root.controlIdLookup) {
- root.controlIdLookup = {};
- }
-
- root.controlIdLookup[self._id] = self;
-
- for (var key in self._aria) {
- self.aria(key, self._aria[key]);
- }
-
- if (self.state.get('visible') === false) {
- self.getEl().style.display = 'none';
- }
-
- self.bindStates();
-
- self.state.on('change:visible', function (e) {
- var state = e.value, parentCtrl;
-
- if (self.state.get('rendered')) {
- self.getEl().style.display = state === false ? 'none' : '';
-
- // Need to force a reflow here on IE 8
- self.getEl().getBoundingClientRect();
- }
-
- // Parent container needs to reflow
- parentCtrl = self.parent();
- if (parentCtrl) {
- parentCtrl._lastRect = null;
- }
-
- self.fire(state ? 'show' : 'hide');
-
- ReflowQueue.add(self);
- });
-
- self.fire('postrender', {}, false);
- },
-
- bindStates: function () {
- },
-
- /**
- * Scrolls the current control into view.
- *
- * @method scrollIntoView
- * @param {String} align Alignment in view top|center|bottom.
- * @return {tinymce.ui.Control} Current control instance.
- */
- scrollIntoView: function (align) {
- function getOffset(elm, rootElm) {
- var x, y, parent = elm;
-
- x = y = 0;
- while (parent && parent != rootElm && parent.nodeType) {
- x += parent.offsetLeft || 0;
- y += parent.offsetTop || 0;
- parent = parent.offsetParent;
- }
-
- return { x: x, y: y };
- }
-
- var elm = this.getEl(), parentElm = elm.parentNode;
- var x, y, width, height, parentWidth, parentHeight;
- var pos = getOffset(elm, parentElm);
-
- x = pos.x;
- y = pos.y;
- width = elm.offsetWidth;
- height = elm.offsetHeight;
- parentWidth = parentElm.clientWidth;
- parentHeight = parentElm.clientHeight;
-
- if (align == "end") {
- x -= parentWidth - width;
- y -= parentHeight - height;
- } else if (align == "center") {
- x -= (parentWidth / 2) - (width / 2);
- y -= (parentHeight / 2) - (height / 2);
- }
-
- parentElm.scrollLeft = x;
- parentElm.scrollTop = y;
-
- return this;
- },
-
- getRoot: function () {
- var ctrl = this, rootControl, parents = [];
-
- while (ctrl) {
- if (ctrl.rootControl) {
- rootControl = ctrl.rootControl;
- break;
- }
-
- parents.push(ctrl);
- rootControl = ctrl;
- ctrl = ctrl.parent();
- }
-
- if (!rootControl) {
- rootControl = this;
- }
-
- var i = parents.length;
- while (i--) {
- parents[i].rootControl = rootControl;
- }
-
- return rootControl;
- },
-
- /**
- * Reflows the current control and it's parents.
- * This should be used after you for example append children to the current control so
- * that the layout managers know that they need to reposition everything.
- *
- * @example
- * container.append({type: 'button', text: 'My button'}).reflow();
- *
- * @method reflow
- * @return {tinymce.ui.Control} Current control instance.
- */
- reflow: function () {
- ReflowQueue.remove(this);
-
- var parent = this.parent();
- if (parent && parent._layout && !parent._layout.isNative()) {
- parent.reflow();
- }
-
- return this;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ getContent: function () {
+ return html.join('').replace(/\n$/, '');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Sets/gets the parent container for the control.
- *
- * @method parent
- * @param {tinymce.ui.Container} parent Optional parent to set.
- * @return {tinymce.ui.Control} Parent control or the current control on a set action.
- */
- // parent: function(parent) {} -- Generated
-
- /**
- * Sets/gets the text for the control.
- *
- * @method text
- * @param {String} value Value to set to control.
- * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get.
- */
- // text: function(value) {} -- Generated
-
- /**
- * Sets/gets the disabled state on the control.
- *
- * @method disabled
- * @param {Boolean} state Value to set to control.
- * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get.
- */
- // disabled: function(state) {} -- Generated
-
- /**
- * Sets/gets the active for the control.
- *
- * @method active
- * @param {Boolean} state Value to set to control.
- * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get.
- */
- // active: function(state) {} -- Generated
-
- /**
- * Sets/gets the name for the control.
- *
- * @method name
- * @param {String} value Value to set to control.
- * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get.
- */
- // name: function(value) {} -- Generated
-
- /**
- * Sets/gets the title for the control.
- *
- * @method title
- * @param {String} value Value to set to control.
- * @return {String/tinymce.ui.Control} Current control on a set operation or current value on a get.
- */
- // title: function(value) {} -- Generated
-
- /**
- * Sets/gets the visible for the control.
- *
- * @method visible
- * @param {Boolean} state Value to set to control.
- * @return {Boolean/tinymce.ui.Control} Current control on a set operation or current state on a get.
- */
- // visible: function(value) {} -- Generated
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Setup state properties.
- */
- Tools.each('text title visible disabled active value'.split(' '), function (name) {
- proto[name] = function (value) {
- if (arguments.length === 0) {
- return this.state.get(name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function HtmlSerializer (settings, schema) {
+ if (schema === void 0) {
+ schema = Schema();
+ }
+ var writer = Writer(settings);
+ settings = settings || {};
+ settings.validate = 'validate' in settings ? settings.validate : true;
+ var serialize = function (node) {
+ var handlers, validate;
+ validate = settings.validate;
+ handlers = {
+ 3: function (node) {
+ writer.text(node.value, node.raw);
+ },
+ 8: function (node) {
+ writer.comment(node.value);
+ },
+ 7: function (node) {
+ writer.pi(node.name, node.value);
+ },
+ 10: function (node) {
+ writer.doctype(node.value);
+ },
+ 4: function (node) {
+ writer.cdata(node.value);
+ },
+ 11: function (node) {
+ if (node = node.firstChild) {
+ do {
+ walk(node);
+ } while (node = node.next);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (typeof value != "undefined") {
- this.state.set(name, value);
- }
-
- return this;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- Control = Class.extend(proto);
-
- function getEventDispatcher(obj) {
- if (!obj._eventDispatcher) {
- obj._eventDispatcher = new EventDispatcher({
- scope: obj,
- toggleEvent: function (name, state) {
- if (state && EventDispatcher.isNative(name)) {
- if (!obj._nativeEvents) {
- obj._nativeEvents = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ writer.reset();
+ var walk = function (node) {
+ var handler = handlers[node.type];
+ var name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule;
+ if (!handler) {
+ name = node.name;
+ isEmpty = node.shortEnded;
+ attrs = node.attributes;
+ if (validate && attrs && attrs.length > 1) {
+ sortedAttrs = [];
+ sortedAttrs.map = {};
+ elementRule = schema.getElementRule(node.name);
+ if (elementRule) {
+ for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {
+ attrName = elementRule.attributesOrder[i];
+ if (attrName in attrs.map) {
+ attrValue = attrs.map[attrName];
+ sortedAttrs.map[attrName] = attrValue;
+ sortedAttrs.push({
+ name: attrName,
+ value: attrValue
+ });
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- obj._nativeEvents[name] = true;
-
- if (obj.state.get('rendered')) {
- bindPendingEvents(obj);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (i = 0, l = attrs.length; i < l; i++) {
+ attrName = attrs[i].name;
+ if (!(attrName in sortedAttrs.map)) {
+ attrValue = attrs.map[attrName];
+ sortedAttrs.map[attrName] = attrValue;
+ sortedAttrs.push({
+ name: attrName,
+ value: attrValue
+ });
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ attrs = sortedAttrs;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-
- return obj._eventDispatcher;
- }
-
- function bindPendingEvents(eventCtrl) {
- var i, l, parents, eventRootCtrl, nativeEvents, name;
-
- function delegate(e) {
- var control = eventCtrl.getParentCtrl(e.target);
-
- if (control) {
- control.fire(e.type, e);
- }
- }
-
- function mouseLeaveHandler() {
- var ctrl = eventRootCtrl._lastHoverCtrl;
-
- if (ctrl) {
- ctrl.fire("mouseleave", { target: ctrl.getEl() });
-
- ctrl.parents().each(function (ctrl) {
- ctrl.fire("mouseleave", { target: ctrl.getEl() });
- });
-
- eventRootCtrl._lastHoverCtrl = null;
- }
- }
-
- function mouseEnterHandler(e) {
- var ctrl = eventCtrl.getParentCtrl(e.target), lastCtrl = eventRootCtrl._lastHoverCtrl, idx = 0, i, parents, lastParents;
-
- // Over on a new control
- if (ctrl !== lastCtrl) {
- eventRootCtrl._lastHoverCtrl = ctrl;
-
- parents = ctrl.parents().toArray().reverse();
- parents.push(ctrl);
-
- if (lastCtrl) {
- lastParents = lastCtrl.parents().toArray().reverse();
- lastParents.push(lastCtrl);
-
- for (idx = 0; idx < lastParents.length; idx++) {
- if (parents[idx] !== lastParents[idx]) {
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ writer.start(node.name, attrs, isEmpty);
+ if (!isEmpty) {
+ if (node = node.firstChild) {
+ do {
+ walk(node);
+ } while (node = node.next);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (i = lastParents.length - 1; i >= idx; i--) {
- lastCtrl = lastParents[i];
- lastCtrl.fire("mouseleave", {
- target: lastCtrl.getEl()
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ writer.end(name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (i = idx; i < parents.length; i++) {
- ctrl = parents[i];
- ctrl.fire("mouseenter", {
- target: ctrl.getEl()
- });
- }
- }
- }
-
- function fixWheelEvent(e) {
- e.preventDefault();
-
- if (e.type == "mousewheel") {
- e.deltaY = -1 / 40 * e.wheelDelta;
-
- if (e.wheelDeltaX) {
- e.deltaX = -1 / 40 * e.wheelDeltaX;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- e.deltaX = 0;
- e.deltaY = e.detail;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ handler(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- e = eventCtrl.fire("wheel", e);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (node.type === 1 && !settings.inner) {
+ walk(node);
+ } else {
+ handlers[11](node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- nativeEvents = eventCtrl._nativeEvents;
- if (nativeEvents) {
- // Find event root element if it exists
- parents = eventCtrl.parents().toArray();
- parents.unshift(eventCtrl);
- for (i = 0, l = parents.length; !eventRootCtrl && i < l; i++) {
- eventRootCtrl = parents[i]._eventsRoot;
- }
-
- // Event root wasn't found the use the root control
- if (!eventRootCtrl) {
- eventRootCtrl = parents[parents.length - 1] || eventCtrl;
- }
-
- // Set the eventsRoot property on children that didn't have it
- eventCtrl._eventsRoot = eventRootCtrl;
- for (l = i, i = 0; i < l; i++) {
- parents[i]._eventsRoot = eventRootCtrl;
- }
-
- var eventRootDelegates = eventRootCtrl._delegates;
- if (!eventRootDelegates) {
- eventRootDelegates = eventRootCtrl._delegates = {};
- }
-
- // Bind native event delegates
- for (name in nativeEvents) {
- if (!nativeEvents) {
- return false;
- }
-
- if (name === "wheel" && !hasWheelEventSupport) {
- if (hasMouseWheelEventSupport) {
- $(eventCtrl.getEl()).on("mousewheel", fixWheelEvent);
- } else {
- $(eventCtrl.getEl()).on("DOMMouseScroll", fixWheelEvent);
- }
-
- continue;
- }
-
- // Special treatment for mousenter/mouseleave since these doesn't bubble
- if (name === "mouseenter" || name === "mouseleave") {
- // Fake mousenter/mouseleave
- if (!eventRootCtrl._hasMouseEnter) {
- $(eventRootCtrl.getEl()).on("mouseleave", mouseLeaveHandler).on("mouseover", mouseEnterHandler);
- eventRootCtrl._hasMouseEnter = 1;
- }
- } else if (!eventRootDelegates[name]) {
- $(eventRootCtrl.getEl()).on(name, delegate);
- eventRootDelegates[name] = true;
- }
-
- // Remove the event once it's bound
- nativeEvents[name] = false;
- }
- }
- }
-
- return Control;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return writer.getContent();
+ };
+ return { serialize: serialize };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Movable.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Movable mixin. Makes controls movable absolute and relative to other elements.
- *
- * @mixin tinymce.ui.Movable
- */
-define(
- 'tinymce.core.ui.Movable',
- [
- "tinymce.core.ui.DomUtils"
- ],
- function (DomUtils) {
- "use strict";
-
- function calculateRelativePosition(ctrl, targetElm, rel) {
- var ctrlElm, pos, x, y, selfW, selfH, targetW, targetH, viewport, size;
-
- viewport = DomUtils.getViewPort();
-
- // Get pos of target
- pos = DomUtils.getPos(targetElm);
- x = pos.x;
- y = pos.y;
-
- if (ctrl.state.get('fixed') && DomUtils.getRuntimeStyle(document.body, 'position') == 'static') {
- x -= viewport.x;
- y -= viewport.y;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createRange$1 = function (sc, so, ec, eo) {
+ var rng = document.createRange();
+ rng.setStart(sc, so);
+ rng.setEnd(ec, eo);
+ return rng;
+ };
+ var normalizeBlockSelectionRange = function (rng) {
+ var startPos = CaretPosition$1.fromRangeStart(rng);
+ var endPos = CaretPosition$1.fromRangeEnd(rng);
+ var rootNode = rng.commonAncestorContainer;
+ return $_25kl2c2cjfuw8ljh.fromPosition(false, rootNode, endPos).map(function (newEndPos) {
+ if (!isInSameBlock(startPos, endPos, rootNode) && isInSameBlock(startPos, newEndPos, rootNode)) {
+ return createRange$1(startPos.container(), startPos.offset(), newEndPos.container(), newEndPos.offset());
+ } else {
+ return rng;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).getOr(rng);
+ };
+ var normalize = function (rng) {
+ return rng.collapsed ? rng : normalizeBlockSelectionRange(rng);
+ };
+ var $_538lml30jfuw8ln4 = { normalize: normalize };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Get size of self
- ctrlElm = ctrl.getEl();
- size = DomUtils.getSize(ctrlElm);
- selfW = size.width;
- selfH = size.height;
-
- // Get size of target
- size = DomUtils.getSize(targetElm);
- targetW = size.width;
- targetH = size.height;
-
- // Parse align string
- rel = (rel || '').split('');
-
- // Target corners
- if (rel[0] === 'b') {
- y += targetH;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isTableCell$2 = $_ey7ka11qjfuw8ldg.matchNodeNames('td th');
+ var validInsertion = function (editor, value, parentNode) {
+ if (parentNode.getAttribute('data-mce-bogus') === 'all') {
+ parentNode.parentNode.insertBefore(editor.dom.createFragment(value), parentNode);
+ } else {
+ var node = parentNode.firstChild;
+ var node2 = parentNode.lastChild;
+ if (!node || node === node2 && node.nodeName === 'BR') {
+ editor.dom.setHTML(parentNode, value);
+ } else {
+ editor.selection.setContent(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rel[1] === 'r') {
- x += targetW;
- }
-
- if (rel[0] === 'c') {
- y += Math.round(targetH / 2);
- }
-
- if (rel[1] === 'c') {
- x += Math.round(targetW / 2);
- }
-
- // Self corners
- if (rel[3] === 'b') {
- y -= selfH;
- }
-
- if (rel[4] === 'r') {
- x -= selfW;
- }
-
- if (rel[3] === 'c') {
- y -= Math.round(selfH / 2);
- }
-
- if (rel[4] === 'c') {
- x -= Math.round(selfW / 2);
- }
-
- return {
- x: x,
- y: y,
- w: selfW,
- h: selfH
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var trimBrsFromTableCell = function (dom, elm) {
+ Option.from(dom.getParent(elm, 'td,th')).map($_c9h6qlzjfuw8l98.fromDom).each($_5udnjn2tjfuw8lm4.trimBlockTrailingBr);
+ };
+ var insertHtmlAtCaret = function (editor, value, details) {
+ var parser, serializer, parentNode, rootNode, fragment, args;
+ var marker, rng, node, node2, bookmarkHtml, merge;
+ var textInlineElements = editor.schema.getTextInlineElements();
+ var selection = editor.selection, dom = editor.dom;
+ var trimOrPaddLeftRight = function (html) {
+ var rng, container, offset;
+ rng = selection.getRng();
+ container = rng.startContainer;
+ offset = rng.startOffset;
+ var hasSiblingText = function (siblingName) {
+ return container[siblingName] && container[siblingName].nodeType === 3;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return {
- /**
- * Tests various positions to get the most suitable one.
- *
- * @method testMoveRel
- * @param {DOMElement} elm Element to position against.
- * @param {Array} rels Array with relative positions.
- * @return {String} Best suitable relative position.
- */
- testMoveRel: function (elm, rels) {
- var viewPortRect = DomUtils.getViewPort();
-
- for (var i = 0; i < rels.length; i++) {
- var pos = calculateRelativePosition(this, elm, rels[i]);
-
- if (this.state.get('fixed')) {
- if (pos.x > 0 && pos.x + pos.w < viewPortRect.w && pos.y > 0 && pos.y + pos.h < viewPortRect.h) {
- return rels[i];
- }
- } else {
- if (pos.x > viewPortRect.x && pos.x + pos.w < viewPortRect.w + viewPortRect.x &&
- pos.y > viewPortRect.y && pos.y + pos.h < viewPortRect.h + viewPortRect.y) {
- return rels[i];
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (container.nodeType === 3) {
+ if (offset > 0) {
+ html = html.replace(/^ /, ' ');
+ } else if (!hasSiblingText('previousSibling')) {
+ html = html.replace(/^ /, ' ');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return rels[0];
- },
-
- /**
- * Move relative to the specified element.
- *
- * @method moveRel
- * @param {Element} elm Element to move relative to.
- * @param {String} rel Relative mode. For example: br-tl.
- * @return {tinymce.ui.Control} Current control instance.
- */
- moveRel: function (elm, rel) {
- if (typeof rel != 'string') {
- rel = this.testMoveRel(elm, rel);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (offset < container.length) {
+ html = html.replace(/ (<br>|)$/, ' ');
+ } else if (!hasSiblingText('nextSibling')) {
+ html = html.replace(/( | )(<br>|)$/, ' ');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var pos = calculateRelativePosition(this, elm, rel);
- return this.moveTo(pos.x, pos.y);
- },
-
- /**
- * Move by a relative x, y values.
- *
- * @method moveBy
- * @param {Number} dx Relative x position.
- * @param {Number} dy Relative y position.
- * @return {tinymce.ui.Control} Current control instance.
- */
- moveBy: function (dx, dy) {
- var self = this, rect = self.layoutRect();
-
- self.moveTo(rect.x + dx, rect.y + dy);
-
- return self;
- },
-
- /**
- * Move to absolute position.
- *
- * @method moveTo
- * @param {Number} x Absolute x position.
- * @param {Number} y Absolute y position.
- * @return {tinymce.ui.Control} Current control instance.
- */
- moveTo: function (x, y) {
- var self = this;
-
- // TODO: Move this to some global class
- function constrain(value, max, size) {
- if (value < 0) {
- return 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return html;
+ };
+ var trimNbspAfterDeleteAndPaddValue = function () {
+ var rng, container, offset;
+ rng = selection.getRng();
+ container = rng.startContainer;
+ offset = rng.startOffset;
+ if (container.nodeType === 3 && rng.collapsed) {
+ if (container.data[offset] === '\xA0') {
+ container.deleteData(offset, 1);
+ if (!/[\u00a0| ]$/.test(value)) {
+ value += ' ';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (value + size > max) {
- value = max - size;
- return value < 0 ? 0 : value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (container.data[offset - 1] === '\xA0') {
+ container.deleteData(offset - 1, 1);
+ if (!/[\u00a0| ]$/.test(value)) {
+ value = ' ' + value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return value;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (self.settings.constrainToViewport) {
- var viewPortRect = DomUtils.getViewPort(window);
- var layoutRect = self.layoutRect();
-
- x = constrain(x, viewPortRect.w + viewPortRect.x, layoutRect.w);
- y = constrain(y, viewPortRect.h + viewPortRect.y, layoutRect.h);
- }
-
- if (self.state.get('rendered')) {
- self.layoutRect({ x: x, y: y }).repaint();
- } else {
- self.settings.x = x;
- self.settings.y = y;
- }
-
- self.fire('move', { x: x, y: y });
-
- return self;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Tooltip.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a tooltip instance.
- *
- * @-x-less ToolTip.less
- * @class tinymce.ui.ToolTip
- * @extends tinymce.ui.Control
- * @mixes tinymce.ui.Movable
- */
-define(
- 'tinymce.core.ui.Tooltip',
- [
- "tinymce.core.ui.Control",
- "tinymce.core.ui.Movable"
- ],
- function (Control, Movable) {
- return Control.extend({
- Mixins: [Movable],
-
- Defaults: {
- classes: 'widget tooltip tooltip-n'
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, prefix = self.classPrefix;
-
- return (
- '<div id="' + self._id + '" class="' + self.classes + '" role="presentation">' +
- '<div class="' + prefix + 'tooltip-arrow"></div>' +
- '<div class="' + prefix + 'tooltip-inner">' + self.encode(self.state.get('text')) + '</div>' +
- '</div>'
- );
- },
-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:text', function (e) {
- self.getEl().lastChild.innerHTML = self.encode(e.value);
- });
-
- return self._super();
- },
-
- /**
- * Repaints the control after a layout operation.
- *
- * @method repaint
- */
- repaint: function () {
- var self = this, style, rect;
-
- style = self.getEl().style;
- rect = self._layoutRect;
-
- style.left = rect.x + 'px';
- style.top = rect.y + 'px';
- style.zIndex = 0xFFFF + 0xFFFF;
- }
- });
- }
-);
-/**
- * Widget.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Widget base class a widget is a control that has a tooltip and some basic states.
- *
- * @class tinymce.ui.Widget
- * @extends tinymce.ui.Control
- */
-define(
- 'tinymce.core.ui.Widget',
- [
- "tinymce.core.ui.Control",
- "tinymce.core.ui.Tooltip"
- ],
- function (Control, Tooltip) {
- "use strict";
-
- var tooltip;
-
- var Widget = Control.extend({
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {String} tooltip Tooltip text to display when hovering.
- * @setting {Boolean} autofocus True if the control should be focused when rendered.
- * @setting {String} text Text to display inside widget.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
- settings = self.settings;
- self.canFocus = true;
-
- if (settings.tooltip && Widget.tooltips !== false) {
- self.on('mouseenter', function (e) {
- var tooltip = self.tooltip().moveTo(-0xFFFF);
-
- if (e.control == self) {
- var rel = tooltip.text(settings.tooltip).show().testMoveRel(self.getEl(), ['bc-tc', 'bc-tl', 'bc-tr']);
-
- tooltip.classes.toggle('tooltip-n', rel == 'bc-tc');
- tooltip.classes.toggle('tooltip-nw', rel == 'bc-tl');
- tooltip.classes.toggle('tooltip-ne', rel == 'bc-tr');
-
- tooltip.moveRel(self.getEl(), rel);
- } else {
- tooltip.hide();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var reduceInlineTextElements = function () {
+ if (merge) {
+ var root_1 = editor.getBody(), elementUtils_1 = new ElementUtils(dom);
+ $_52qop8kjfuw8l6v.each(dom.select('*[data-mce-fragment]'), function (node) {
+ for (var testNode = node.parentNode; testNode && testNode !== root_1; testNode = testNode.parentNode) {
+ if (textInlineElements[node.nodeName.toLowerCase()] && elementUtils_1.compare(testNode, node)) {
+ dom.remove(node, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- self.on('mouseleave mousedown click', function () {
- self.tooltip().hide();
- });
- }
-
- self.aria('label', settings.ariaLabel || settings.tooltip);
- },
-
- /**
- * Returns the current tooltip instance.
- *
- * @method tooltip
- * @return {tinymce.ui.Tooltip} Tooltip instance.
- */
- tooltip: function () {
- if (!tooltip) {
- tooltip = new Tooltip({ type: 'tooltip' });
- tooltip.renderTo();
- }
-
- return tooltip;
- },
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this, settings = self.settings;
-
- self._super();
-
- if (!self.parent() && (settings.width || settings.height)) {
- self.initLayoutRect();
- self.repaint();
- }
-
- if (settings.autofocus) {
- self.focus();
- }
- },
-
- bindStates: function () {
- var self = this;
-
- function disable(state) {
- self.aria('disabled', state);
- self.classes.toggle('disabled', state);
- }
-
- function active(state) {
- self.aria('pressed', state);
- self.classes.toggle('active', state);
- }
-
- self.state.on('change:disabled', function (e) {
- disable(e.value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.state.on('change:active', function (e) {
- active(e.value);
- });
-
- if (self.state.get('disabled')) {
- disable(true);
- }
-
- if (self.state.get('active')) {
- active(true);
- }
-
- return self._super();
- },
-
- /**
- * Removes the current control from DOM and from UI collections.
- *
- * @method remove
- * @return {tinymce.ui.Control} Current control instance.
- */
- remove: function () {
- this._super();
-
- if (tooltip) {
- tooltip.remove();
- tooltip = null;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- return Widget;
- }
-);
-
-/**
- * Progress.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Progress control.
- *
- * @-x-less Progress.less
- * @class tinymce.ui.Progress
- * @extends tinymce.ui.Control
- */
-define(
- 'tinymce.core.ui.Progress',
- [
- "tinymce.core.ui.Widget"
- ],
- function (Widget) {
- "use strict";
-
- return Widget.extend({
- Defaults: {
- value: 0
- },
-
- init: function (settings) {
- var self = this;
-
- self._super(settings);
- self.classes.add('progress');
-
- if (!self.settings.filter) {
- self.settings.filter = function (value) {
- return Math.round(value);
- };
- }
- },
-
- renderHtml: function () {
- var self = this, id = self._id, prefix = this.classPrefix;
-
- return (
- '<div id="' + id + '" class="' + self.classes + '">' +
- '<div class="' + prefix + 'bar-container">' +
- '<div class="' + prefix + 'bar"></div>' +
- '</div>' +
- '<div class="' + prefix + 'text">0%</div>' +
- '</div>'
- );
- },
-
- postRender: function () {
- var self = this;
-
- self._super();
- self.value(self.settings.value);
-
- return self;
- },
-
- bindStates: function () {
- var self = this;
-
- function setValue(value) {
- value = self.settings.filter(value);
- self.getEl().lastChild.innerHTML = value + '%';
- self.getEl().firstChild.firstChild.style.width = value + '%';
- }
-
- self.state.on('change:value', function (e) {
- setValue(e.value);
- });
-
- setValue(self.state.get('value'));
-
- return self._super();
- }
- });
- }
-);
-/**
- * Notification.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a notification instance.
- *
- * @-x-less Notification.less
- * @class tinymce.ui.Notification
- * @extends tinymce.ui.Container
- * @mixes tinymce.ui.Movable
- */
-define(
- 'tinymce.core.ui.Notification',
- [
- "tinymce.core.ui.Control",
- "tinymce.core.ui.Movable",
- "tinymce.core.ui.Progress",
- "tinymce.core.util.Delay"
- ],
- function (Control, Movable, Progress, Delay) {
- var updateLiveRegion = function (ctx, text) {
- ctx.getEl().lastChild.textContent = text + (ctx.progressBar ? ' ' + ctx.progressBar.value() + '%' : '');
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Control.extend({
- Mixins: [Movable],
-
- Defaults: {
- classes: 'widget notification'
- },
-
- init: function (settings) {
- var self = this;
-
- self._super(settings);
-
- self.maxWidth = settings.maxWidth;
-
- if (settings.text) {
- self.text(settings.text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var markFragmentElements = function (fragment) {
+ var node = fragment;
+ while (node = node.walk()) {
+ if (node.type === 1) {
+ node.attr('data-mce-fragment', '1');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.icon) {
- self.icon = settings.icon;
- }
-
- if (settings.color) {
- self.color = settings.color;
- }
-
- if (settings.type) {
- self.classes.add('notification-' + settings.type);
- }
-
- if (settings.timeout && (settings.timeout < 0 || settings.timeout > 0) && !settings.closeButton) {
- self.closeButton = false;
- } else {
- self.classes.add('has-close');
- self.closeButton = true;
- }
-
- if (settings.progressBar) {
- self.progressBar = new Progress();
- }
-
- self.on('click', function (e) {
- if (e.target.className.indexOf(self.classPrefix + 'close') != -1) {
- self.close();
- }
- });
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, prefix = self.classPrefix, icon = '', closeButton = '', progressBar = '', notificationStyle = '';
-
- if (self.icon) {
- icon = '<i class="' + prefix + 'ico' + ' ' + prefix + 'i-' + self.icon + '"></i>';
- }
-
- notificationStyle = ' style="max-width: ' + self.maxWidth + 'px;' + (self.color ? 'background-color: ' + self.color + ';"' : '"');
-
- if (self.closeButton) {
- closeButton = '<button type="button" class="' + prefix + 'close" aria-hidden="true">\u00d7</button>';
- }
-
- if (self.progressBar) {
- progressBar = self.progressBar.renderHtml();
- }
-
- return (
- '<div id="' + self._id + '" class="' + self.classes + '"' + notificationStyle + ' role="presentation">' +
- icon +
- '<div class="' + prefix + 'notification-inner">' + self.state.get('text') + '</div>' +
- progressBar +
- closeButton +
- '<div style="clip: rect(1px, 1px, 1px, 1px);height: 1px;overflow: hidden;position: absolute;width: 1px;"' +
- ' aria-live="assertive" aria-relevant="additions" aria-atomic="true"></div>' +
- '</div>'
- );
- },
-
- postRender: function () {
- var self = this;
-
- Delay.setTimeout(function () {
- self.$el.addClass(self.classPrefix + 'in');
- updateLiveRegion(self, self.state.get('text'));
- }, 100);
-
- return self._super();
- },
-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:text', function (e) {
- self.getEl().firstChild.innerHTML = e.value;
- updateLiveRegion(self, e.value);
- });
- if (self.progressBar) {
- self.progressBar.bindStates();
- self.progressBar.state.on('change:value', function (e) {
- updateLiveRegion(self, self.state.get('text'));
- });
- }
- return self._super();
- },
-
- close: function () {
- var self = this;
-
- if (!self.fire('close').isDefaultPrevented()) {
- self.remove();
- }
-
- return self;
- },
-
- /**
- * Repaints the control after a layout operation.
- *
- * @method repaint
- */
- repaint: function () {
- var self = this, style, rect;
-
- style = self.getEl().style;
- rect = self._layoutRect;
-
- style.left = rect.x + 'px';
- style.top = rect.y + 'px';
-
- // Hardcoded arbitrary z-value because we want the
- // notifications under the other windows
- style.zIndex = 0xFFFF - 1;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * NotificationManagerImpl.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ui.NotificationManagerImpl',
- [
- 'ephox.katamari.api.Arr',
- 'tinymce.core.ui.DomUtils',
- 'tinymce.core.ui.Notification',
- 'tinymce.core.util.Tools'
- ],
- function (Arr, DomUtils, Notification, Tools) {
- return function (editor) {
- var getEditorContainer = function (editor) {
- return editor.inline ? editor.getElement() : editor.getContentAreaContainer();
- };
-
- var getContainerWidth = function () {
- var container = getEditorContainer(editor);
- return DomUtils.getSize(container).width;
- };
-
- // Since the viewport will change based on the present notifications, we need to move them all to the
- // top left of the viewport to give an accurate size measurement so we can position them later.
- var prePositionNotifications = function (notifications) {
- Arr.each(notifications, function (notification) {
- notification.moveTo(0, 0);
- });
- };
-
- var positionNotifications = function (notifications) {
- if (notifications.length > 0) {
- var firstItem = notifications.slice(0, 1)[0];
- var container = getEditorContainer(editor);
- firstItem.moveRel(container, 'tc-tc');
- Arr.each(notifications, function (notification, index) {
- if (index > 0) {
- notification.moveRel(notifications[index - 1].getEl(), 'bc-tc');
- }
- });
- }
- };
-
- var reposition = function (notifications) {
- prePositionNotifications(notifications);
- positionNotifications(notifications);
- };
-
- var open = function (args, closeCallback) {
- var extendedArgs = Tools.extend(args, { maxWidth: getContainerWidth() });
- var notif = new Notification(extendedArgs);
- notif.args = extendedArgs;
-
- //If we have a timeout value
- if (extendedArgs.timeout > 0) {
- notif.timer = setTimeout(function () {
- notif.close();
- closeCallback();
- }, extendedArgs.timeout);
- }
-
- notif.on('close', function () {
- closeCallback();
- });
-
- notif.renderTo();
-
- return notif;
- };
-
- var close = function (notification) {
- notification.close();
- };
-
- var getArgs = function (notification) {
- return notification.args;
- };
-
- return {
- open: open,
- close: close,
- reposition: reposition,
- getArgs: getArgs
- };
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * NotificationManager.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class handles the creation of TinyMCE's notifications.
- *
- * @class tinymce.NotificationManager
- * @example
- * // Opens a new notification of type "error" with text "An error occurred."
- * tinymce.activeEditor.notificationManager.open({
- * text: 'An error occurred.',
- * type: 'error'
- * });
- */
-define(
- 'tinymce.core.api.NotificationManager',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Option',
- 'tinymce.core.EditorView',
- 'tinymce.core.ui.NotificationManagerImpl',
- 'tinymce.core.util.Delay'
- ],
- function (Arr, Option, EditorView, NotificationManagerImpl, Delay) {
- return function (editor) {
- var notifications = [];
-
- var getImplementation = function () {
- var theme = editor.theme;
- return theme && theme.getNotificationManagerImpl ? theme.getNotificationManagerImpl() : NotificationManagerImpl(editor);
- };
-
- var getTopNotification = function () {
- return Option.from(notifications[0]);
- };
-
- var isEqual = function (a, b) {
- return a.type === b.type && a.text === b.text && !a.progressBar && !a.timeout && !b.progressBar && !b.timeout;
- };
-
- var reposition = function () {
- if (notifications.length > 0) {
- getImplementation().reposition(notifications);
- }
- };
-
- var addNotification = function (notification) {
- notifications.push(notification);
- };
-
- var closeNotification = function (notification) {
- Arr.findIndex(notifications, function (otherNotification) {
- return otherNotification === notification;
- }).each(function (index) {
- // Mutate here since third party might have stored away the window array
- // TODO: Consider breaking this api
- notifications.splice(index, 1);
- });
- };
-
- var open = function (args) {
- // Never open notification if editor has been removed.
- if (editor.removed || !EditorView.isEditorAttachedToDom(editor)) {
- return;
- }
-
- return Arr.find(notifications, function (notification) {
- return isEqual(getImplementation().getArgs(notification), args);
- }).getOrThunk(function () {
- editor.editorManager.setActive(editor);
-
- var notification = getImplementation().open(args, function () {
- closeNotification(notification);
- reposition();
- });
-
- addNotification(notification);
- reposition();
- return notification;
- });
- };
-
- var close = function () {
- getTopNotification().each(function (notification) {
- getImplementation().close(notification);
- closeNotification(notification);
- reposition();
- });
- };
-
- var getNotifications = function () {
- return notifications;
- };
-
- var registerEvents = function (editor) {
- editor.on('SkinLoaded', function () {
- var serviceMessage = editor.settings.service_message;
-
- if (serviceMessage) {
- open({
- text: serviceMessage,
- type: 'warning',
- timeout: 0,
- icon: ''
- });
- }
- });
-
- editor.on('ResizeEditor ResizeWindow', function () {
- Delay.requestAnimationFrame(reposition);
- });
-
- editor.on('remove', function () {
- Arr.each(notifications, function (notification) {
- getImplementation().close(notification);
- });
- });
- };
-
- registerEvents(editor);
-
- return {
- /**
- * Opens a new notification.
- *
- * @method open
- * @param {Object} args Optional name/value settings collection contains things like timeout/color/message etc.
- */
- open: open,
-
- /**
- * Closes the top most notification.
- *
- * @method close
- */
- close: close,
-
- /**
- * Returns the currently opened notification objects.
- *
- * @method getNotifications
- * @return {Array} Array of the currently opened notifications.
- */
- getNotifications: getNotifications
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var umarkFragmentElements = function (elm) {
+ $_52qop8kjfuw8l6v.each(elm.getElementsByTagName('*'), function (elm) {
+ elm.removeAttribute('data-mce-fragment');
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Factory.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class is a factory for control instances. This enables you
- * to create instances of controls without having to require the UI controls directly.
- *
- * It also allow you to override or add new control types.
- *
- * @class tinymce.ui.Factory
- */
-define(
- 'tinymce.core.ui.Factory',
- [
- ],
- function () {
- "use strict";
-
- var types = {};
-
- return {
- /**
- * Adds a new control instance type to the factory.
- *
- * @method add
- * @param {String} type Type name for example "button".
- * @param {function} typeClass Class type function.
- */
- add: function (type, typeClass) {
- types[type.toLowerCase()] = typeClass;
- },
-
- /**
- * Returns true/false if the specified type exists or not.
- *
- * @method has
- * @param {String} type Type to look for.
- * @return {Boolean} true/false if the control by name exists.
- */
- has: function (type) {
- return !!types[type.toLowerCase()];
- },
-
- /**
- * Returns ui control module by name.
- *
- * @method get
- * @param {String} type Type get.
- * @return {Object} Module or undefined.
- */
- get: function (type) {
- var lctype = type.toLowerCase();
- var controlType = types.hasOwnProperty(lctype) ? types[lctype] : null;
- if (controlType === null) {
- throw new Error("Could not find module for type: " + type);
- }
-
- return controlType;
- },
-
- /**
- * Creates a new control instance based on the settings provided. The instance created will be
- * based on the specified type property it can also create whole structures of components out of
- * the specified JSON object.
- *
- * @example
- * tinymce.ui.Factory.create({
- * type: 'button',
- * text: 'Hello world!'
- * });
- *
- * @method create
- * @param {Object/String} settings Name/Value object with items used to create the type.
- * @return {tinymce.ui.Control} Control instance based on the specified type.
- */
- create: function (type, settings) {
- var ControlType;
-
- // If string is specified then use it as the type
- if (typeof type == 'string') {
- settings = settings || {};
- settings.type = type;
- } else {
- settings = type;
- type = settings.type;
- }
-
- // Find control type
- type = type.toLowerCase();
- ControlType = types[type];
-
- // #if debug
-
- if (!ControlType) {
- throw new Error("Could not find control by type: " + type);
- }
-
- // #endif
-
- ControlType = new ControlType(settings);
- ControlType.type = type; // Set the type on the instance, this will be used by the Selector engine
-
- return ControlType;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isPartOfFragment = function (node) {
+ return !!node.getAttribute('data-mce-fragment');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * KeyboardNavigation.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class handles keyboard navigation of controls and elements.
- *
- * @class tinymce.ui.KeyboardNavigation
- */
-define(
- 'tinymce.core.ui.KeyboardNavigation',
- [
- ],
- function () {
- "use strict";
-
- var hasTabstopData = function (elm) {
- return elm.getAttribute('data-mce-tabstop') ? true : false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var canHaveChildren = function (node) {
+ return node && !editor.schema.getShortEndedElements()[node.nodeName];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * This class handles all keyboard navigation for WAI-ARIA support. Each root container
- * gets an instance of this class.
- *
- * @constructor
- */
- return function (settings) {
- var root = settings.root, focusedElement, focusedControl;
-
- function isElement(node) {
- return node && node.nodeType === 1;
- }
-
- try {
- focusedElement = document.activeElement;
- } catch (ex) {
- // IE sometimes fails to return a proper element
- focusedElement = document.body;
- }
-
- focusedControl = root.getParentCtrl(focusedElement);
-
- /**
- * Returns the currently focused elements wai aria role of the currently
- * focused element or specified element.
- *
- * @private
- * @param {Element} elm Optional element to get role from.
- * @return {String} Role of specified element.
- */
- function getRole(elm) {
- elm = elm || focusedElement;
-
- if (isElement(elm)) {
- return elm.getAttribute('role');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var moveSelectionToMarker = function (marker) {
+ var parentEditableFalseElm, parentBlock, nextRng;
+ var getContentEditableFalseParent = function (node) {
+ var root = editor.getBody();
+ for (; node && node !== root; node = node.parentNode) {
+ if (editor.dom.getContentEditable(node) === 'false') {
+ return node;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return null;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (!marker) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the wai role of the parent element of the currently
- * focused element or specified element.
- *
- * @private
- * @param {Element} elm Optional element to get parent role from.
- * @return {String} Role of the first parent that has a role.
- */
- function getParentRole(elm) {
- var role, parent = elm || focusedElement;
-
- while ((parent = parent.parentNode)) {
- if ((role = getRole(parent))) {
- return role;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ selection.scrollIntoView(marker);
+ parentEditableFalseElm = getContentEditableFalseParent(marker);
+ if (parentEditableFalseElm) {
+ dom.remove(marker);
+ selection.select(parentEditableFalseElm);
+ return;
+ }
+ rng = dom.createRng();
+ node = marker.previousSibling;
+ if (node && node.nodeType === 3) {
+ rng.setStart(node, node.nodeValue.length);
+ if (!$_9fhi43ajfuw8l13.ie) {
+ node2 = marker.nextSibling;
+ if (node2 && node2.nodeType === 3) {
+ node.appendData(node2.data);
+ node2.parentNode.removeChild(node2);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ rng.setStartBefore(marker);
+ rng.setEndBefore(marker);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns a wai aria property by name for example aria-selected.
- *
- * @private
- * @param {String} name Name of the aria property to get for example "disabled".
- * @return {String} Aria property value.
- */
- function getAriaProp(name) {
- var elm = focusedElement;
-
- if (isElement(elm)) {
- return elm.getAttribute('aria-' + name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var findNextCaretRng = function (rng) {
+ var caretPos = CaretPosition$1.fromRangeStart(rng);
+ var caretWalker = CaretWalker(editor.getBody());
+ caretPos = caretWalker.next(caretPos);
+ if (caretPos) {
+ return caretPos.toRange();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- /**
- * Is the element a text input element or not.
- *
- * @private
- * @param {Element} elm Element to check if it's an text input element or not.
- * @return {Boolean} True/false if the element is a text element or not.
- */
- function isTextInputElement(elm) {
- var tagName = elm.tagName.toUpperCase();
-
- // Notice: since type can be "email" etc we don't check the type
- // So all input elements gets treated as text input elements
- return tagName == "INPUT" || tagName == "TEXTAREA" || tagName == "SELECT";
- }
-
- /**
- * Returns true/false if the specified element can be focused or not.
- *
- * @private
- * @param {Element} elm DOM element to check if it can be focused or not.
- * @return {Boolean} True/false if the element can have focus.
- */
- function canFocus(elm) {
- if (isTextInputElement(elm) && !elm.hidden) {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ parentBlock = dom.getParent(marker, dom.isBlock);
+ dom.remove(marker);
+ if (parentBlock && dom.isEmpty(parentBlock)) {
+ editor.$(parentBlock).empty();
+ rng.setStart(parentBlock, 0);
+ rng.setEnd(parentBlock, 0);
+ if (!isTableCell$2(parentBlock) && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) {
+ rng = nextRng;
+ dom.remove(parentBlock);
+ } else {
+ dom.add(parentBlock, dom.create('br', { 'data-mce-bogus': '1' }));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (hasTabstopData(elm)) {
- return true;
- }
-
- if (/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell|slider)$/.test(getRole(elm))) {
- return true;
- }
-
- return false;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns an array of focusable visible elements within the specified container element.
- *
- * @private
- * @param {Element} elm DOM element to find focusable elements within.
- * @return {Array} Array of focusable elements.
- */
- function getFocusElements(elm) {
- var elements = [];
-
- function collect(elm) {
- if (elm.nodeType != 1 || elm.style.display == 'none' || elm.disabled) {
- return;
- }
-
- if (canFocus(elm)) {
- elements.push(elm);
- }
-
- for (var i = 0; i < elm.childNodes.length; i++) {
- collect(elm.childNodes[i]);
- }
- }
-
- collect(elm || root.getEl());
-
- return elements;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ selection.setRng(rng);
+ };
+ if (/^ | $/.test(value)) {
+ value = trimOrPaddLeftRight(value);
+ }
+ parser = editor.parser;
+ merge = details.merge;
+ serializer = HtmlSerializer({ validate: editor.settings.validate }, editor.schema);
+ bookmarkHtml = '<span id="mce_marker" data-mce-type="bookmark">​</span>';
+ args = {
+ content: value,
+ format: 'html',
+ selection: true,
+ paste: details.paste
+ };
+ args = editor.fire('BeforeSetContent', args);
+ if (args.isDefaultPrevented()) {
+ editor.fire('SetContent', {
+ content: args.content,
+ format: 'html',
+ selection: true,
+ paste: details.paste
+ });
+ return;
+ }
+ value = args.content;
+ if (value.indexOf('{$caret}') === -1) {
+ value += '{$caret}';
+ }
+ value = value.replace(/\{\$caret\}/, bookmarkHtml);
+ rng = selection.getRng();
+ var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null);
+ var body = editor.getBody();
+ if (caretElement === body && selection.isCollapsed()) {
+ if (dom.isBlock(body.firstChild) && canHaveChildren(body.firstChild) && dom.isEmpty(body.firstChild)) {
+ rng = dom.createRng();
+ rng.setStart(body.firstChild, 0);
+ rng.setEnd(body.firstChild, 0);
+ selection.setRng(rng);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the navigation root control for the specified control. The navigation root
- * is the control that the keyboard navigation gets scoped to for example a menubar or toolbar group.
- * It will look for parents of the specified target control or the currently focused control if this option is omitted.
- *
- * @private
- * @param {tinymce.ui.Control} targetControl Optional target control to find root of.
- * @return {tinymce.ui.Control} Navigation root control.
- */
- function getNavigationRoot(targetControl) {
- var navigationRoot, controls;
-
- targetControl = targetControl || focusedControl;
- controls = targetControl.parents().toArray();
- controls.unshift(targetControl);
-
- for (var i = 0; i < controls.length; i++) {
- navigationRoot = controls[i];
-
- if (navigationRoot.settings.ariaRoot) {
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (!selection.isCollapsed()) {
+ editor.selection.setRng($_538lml30jfuw8ln4.normalize(editor.selection.getRng()));
+ editor.getDoc().execCommand('Delete', false, null);
+ trimNbspAfterDeleteAndPaddValue();
+ }
+ parentNode = selection.getNode();
+ var parserArgs = {
+ context: parentNode.nodeName.toLowerCase(),
+ data: details.data,
+ insert: true
+ };
+ fragment = parser.parse(value, parserArgs);
+ if (details.paste === true && $_5shtl51xjfuw8lgk.isListFragment(editor.schema, fragment) && $_5shtl51xjfuw8lgk.isParentBlockLi(dom, parentNode)) {
+ rng = $_5shtl51xjfuw8lgk.insertAtCaret(serializer, dom, editor.selection.getRng(), fragment);
+ editor.selection.setRng(rng);
+ editor.fire('SetContent', args);
+ return;
+ }
+ markFragmentElements(fragment);
+ node = fragment.lastChild;
+ if (node.attr('id') === 'mce_marker') {
+ marker = node;
+ for (node = node.prev; node; node = node.walk(true)) {
+ if (node.type === 3 || !dom.isBlock(node.name)) {
+ if (editor.schema.isValidChild(node.parent.name, 'span')) {
+ node.parent.insert(marker, node, node.name === 'br');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return navigationRoot;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Focuses the first item in the specified targetControl element or the last aria index if the
- * navigation root has the ariaRemember option enabled.
- *
- * @private
- * @param {tinymce.ui.Control} targetControl Target control to focus the first item in.
- */
- function focusFirst(targetControl) {
- var navigationRoot = getNavigationRoot(targetControl);
- var focusElements = getFocusElements(navigationRoot.getEl());
-
- if (navigationRoot.settings.ariaRemember && "lastAriaIndex" in navigationRoot) {
- moveFocusToIndex(navigationRoot.lastAriaIndex, focusElements);
- } else {
- moveFocusToIndex(0, focusElements);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ editor._selectionOverrides.showBlockCaretContainer(parentNode);
+ if (!parserArgs.invalid) {
+ value = serializer.serialize(fragment);
+ validInsertion(editor, value, parentNode);
+ } else {
+ selection.setContent(bookmarkHtml);
+ parentNode = selection.getNode();
+ rootNode = editor.getBody();
+ if (parentNode.nodeType === 9) {
+ parentNode = node = rootNode;
+ } else {
+ node = parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Moves the focus to the specified index within the elements list.
- * This will scope the index to the size of the element list if it changed.
- *
- * @private
- * @param {Number} idx Specified index to move to.
- * @param {Array} elements Array with dom elements to move focus within.
- * @return {Number} Input index or a changed index if it was out of range.
- */
- function moveFocusToIndex(idx, elements) {
- if (idx < 0) {
- idx = elements.length - 1;
- } else if (idx >= elements.length) {
- idx = 0;
- }
-
- if (elements[idx]) {
- elements[idx].focus();
- }
-
- return idx;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (node !== rootNode) {
+ parentNode = node;
+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Moves the focus forwards or backwards.
- *
- * @private
- * @param {Number} dir Direction to move in positive means forward, negative means backwards.
- * @param {Array} elements Optional array of elements to move within defaults to the current navigation roots elements.
- */
- function moveFocus(dir, elements) {
- var idx = -1, navigationRoot = getNavigationRoot();
-
- elements = elements || getFocusElements(navigationRoot.getEl());
-
- for (var i = 0; i < elements.length; i++) {
- if (elements[i] === focusedElement) {
- idx = i;
- }
- }
-
- idx += dir;
- navigationRoot.lastAriaIndex = moveFocusToIndex(idx, elements);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ value = parentNode === rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode);
+ value = serializer.serialize(parser.parse(value.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i, function () {
+ return serializer.serialize(fragment);
+ })));
+ if (parentNode === rootNode) {
+ dom.setHTML(rootNode, value);
+ } else {
+ dom.setOuterHTML(parentNode, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ reduceInlineTextElements();
+ moveSelectionToMarker(dom.get('mce_marker'));
+ umarkFragmentElements(editor.getBody());
+ trimBrsFromTableCell(editor.dom, editor.selection.getStart());
+ editor.fire('SetContent', args);
+ editor.addVisual();
+ };
+ var processValue = function (value) {
+ var details;
+ if (typeof value !== 'string') {
+ details = $_52qop8kjfuw8l6v.extend({
+ paste: value.paste,
+ data: { paste: value.paste }
+ }, value);
+ return {
+ content: value.content,
+ details: details
+ };
+ }
+ return {
+ content: value,
+ details: {}
+ };
+ };
+ var insertAtCaret$1 = function (editor, value) {
+ var result = processValue(value);
+ insertHtmlAtCaret(editor, result.content, result.details);
+ };
+ var $_c8z6p81wjfuw8lg5 = { insertAtCaret: insertAtCaret$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Moves the focus to the left this is called by the left key.
- *
- * @private
- */
- function left() {
- var parentRole = getParentRole();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {
+ return is(scope, a) ? Option.some(scope) : $_16i8k47jfuw8kyi.isFunction(isRoot) && isRoot(scope) ? Option.none() : ancestor(scope, a, isRoot);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (parentRole == "tablist") {
- moveFocus(-1, getFocusElements(focusedElement.parentNode));
- } else if (focusedControl.parent().submenu) {
- cancel();
- } else {
- moveFocus(-1);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var first$1 = function (predicate) {
+ return descendant($_5nbzws15jfuw8lap.body(), predicate);
+ };
+ var ancestor = function (scope, predicate, isRoot) {
+ var element = scope.dom();
+ var stop = $_16i8k47jfuw8kyi.isFunction(isRoot) ? isRoot : $_68e81l6jfuw8kyc.constant(false);
+ while (element.parentNode) {
+ element = element.parentNode;
+ var el = $_c9h6qlzjfuw8l98.fromDom(element);
+ if (predicate(el))
+ return Option.some(el);
+ else if (stop(el))
+ break;
+ }
+ return Option.none();
+ };
+ var closest = function (scope, predicate, isRoot) {
+ var is = function (scope) {
+ return predicate(scope);
+ };
+ return ClosestOrAncestor(is, ancestor, scope, predicate, isRoot);
+ };
+ var sibling$1 = function (scope, predicate) {
+ var element = scope.dom();
+ if (!element.parentNode)
+ return Option.none();
+ return child$1($_c9h6qlzjfuw8l98.fromDom(element.parentNode), function (x) {
+ return !$_4fb96d1djfuw8lbl.eq(scope, x) && predicate(x);
+ });
+ };
+ var child$1 = function (scope, predicate) {
+ var result = $_9ek1bp4jfuw8kxg.find(scope.dom().childNodes, $_68e81l6jfuw8kyc.compose(predicate, $_c9h6qlzjfuw8l98.fromDom));
+ return result.map($_c9h6qlzjfuw8l98.fromDom);
+ };
+ var descendant = function (scope, predicate) {
+ var descend = function (element) {
+ for (var i = 0; i < element.childNodes.length; i++) {
+ if (predicate($_c9h6qlzjfuw8l98.fromDom(element.childNodes[i])))
+ return Option.some($_c9h6qlzjfuw8l98.fromDom(element.childNodes[i]));
+ var res = descend(element.childNodes[i]);
+ if (res.isSome())
+ return res;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Option.none();
+ };
+ return descend(scope.dom());
+ };
+ var $_chabeg35jfuw8lo3 = {
+ first: first$1,
+ ancestor: ancestor,
+ closest: closest,
+ sibling: sibling$1,
+ child: child$1,
+ descendant: descendant
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Moves the focus to the right this is called by the right key.
- *
- * @private
- */
- function right() {
- var role = getRole(), parentRole = getParentRole();
-
- if (parentRole == "tablist") {
- moveFocus(1, getFocusElements(focusedElement.parentNode));
- } else if (role == "menuitem" && parentRole == "menu" && getAriaProp('haspopup')) {
- enter();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var sectionResult = $_1a7eqh18jfuw8lb9.immutable('sections', 'settings');
+ var detection = $_f1lbzgnjfuw8l7o.detect();
+ var isTouch = detection.deviceType.isTouch();
+ var mobilePlugins = [
+ 'lists',
+ 'autolink',
+ 'autosave'
+ ];
+ var defaultMobileSettings = { theme: 'mobile' };
+ var normalizePlugins = function (plugins) {
+ var pluginNames = $_16i8k47jfuw8kyi.isArray(plugins) ? plugins.join(' ') : plugins;
+ var trimmedPlugins = $_9ek1bp4jfuw8kxg.map($_16i8k47jfuw8kyi.isString(pluginNames) ? pluginNames.split(' ') : [], $_e6kxndwjfuw8l91.trim);
+ return $_9ek1bp4jfuw8kxg.filter(trimmedPlugins, function (item) {
+ return item.length > 0;
+ });
+ };
+ var filterMobilePlugins = function (plugins) {
+ return $_9ek1bp4jfuw8kxg.filter(plugins, $_68e81l6jfuw8kyc.curry($_9ek1bp4jfuw8kxg.contains, mobilePlugins));
+ };
+ var extractSections = function (keys, settings) {
+ var result = $_8c8uhu13jfuw8la0.bifilter(settings, function (value, key) {
+ return $_9ek1bp4jfuw8kxg.contains(keys, key);
+ });
+ return sectionResult(result.t, result.f);
+ };
+ var getSection = function (sectionResult, name, defaults) {
+ var sections = sectionResult.sections();
+ var sectionSettings = sections.hasOwnProperty(name) ? sections[name] : {};
+ return $_52qop8kjfuw8l6v.extend({}, defaults, sectionSettings);
+ };
+ var hasSection = function (sectionResult, name) {
+ return sectionResult.sections().hasOwnProperty(name);
+ };
+ var getDefaultSettings = function (id, documentBaseUrl, editor) {
+ return {
+ id: id,
+ theme: 'modern',
+ delta_width: 0,
+ delta_height: 0,
+ popup_css: '',
+ plugins: '',
+ document_base_url: documentBaseUrl,
+ add_form_submit_trigger: true,
+ submit_patch: true,
+ add_unload_trigger: true,
+ convert_urls: true,
+ relative_urls: true,
+ remove_script_host: true,
+ object_resizing: true,
+ doctype: '<!DOCTYPE html>',
+ visual: true,
+ font_size_style_values: 'xx-small,x-small,small,medium,large,x-large,xx-large',
+ font_size_legacy_values: 'xx-small,small,medium,large,x-large,xx-large,300%',
+ forced_root_block: 'p',
+ hidden_input: true,
+ render_ui: true,
+ indentation: '30px',
+ inline_styles: true,
+ convert_fonts_to_spans: true,
+ indent: 'simple',
+ indent_before: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist',
+ indent_after: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist',
+ entity_encoding: 'named',
+ url_converter: editor.convertURL,
+ url_converter_scope: editor,
+ ie7_compat: true
+ };
+ };
+ var getExternalPlugins = function (overrideSettings, settings) {
+ var userDefinedExternalPlugins = settings.external_plugins ? settings.external_plugins : {};
+ if (overrideSettings && overrideSettings.external_plugins) {
+ return $_52qop8kjfuw8l6v.extend({}, overrideSettings.external_plugins, userDefinedExternalPlugins);
+ } else {
+ return userDefinedExternalPlugins;
+ }
+ };
+ var combinePlugins = function (forcedPlugins, plugins) {
+ return [].concat(normalizePlugins(forcedPlugins)).concat(normalizePlugins(plugins));
+ };
+ var processPlugins = function (isTouchDevice, sectionResult, defaultOverrideSettings, settings) {
+ var forcedPlugins = normalizePlugins(defaultOverrideSettings.forced_plugins);
+ var plugins = normalizePlugins(settings.plugins);
+ var platformPlugins = isTouchDevice && hasSection(sectionResult, 'mobile') ? filterMobilePlugins(plugins) : plugins;
+ var combinedPlugins = combinePlugins(forcedPlugins, platformPlugins);
+ return $_52qop8kjfuw8l6v.extend(settings, { plugins: combinedPlugins.join(' ') });
+ };
+ var isOnMobile = function (isTouchDevice, sectionResult) {
+ var isInline = sectionResult.settings().inline;
+ return isTouchDevice && hasSection(sectionResult, 'mobile') && !isInline;
+ };
+ var combineSettings = function (isTouchDevice, defaultSettings, defaultOverrideSettings, settings) {
+ var sectionResult = extractSections(['mobile'], settings);
+ var extendedSettings = $_52qop8kjfuw8l6v.extend(defaultSettings, defaultOverrideSettings, sectionResult.settings(), isOnMobile(isTouchDevice, sectionResult) ? getSection(sectionResult, 'mobile', defaultMobileSettings) : {}, {
+ validate: true,
+ content_editable: sectionResult.settings().inline,
+ external_plugins: getExternalPlugins(defaultOverrideSettings, sectionResult.settings())
+ });
+ return processPlugins(isTouchDevice, sectionResult, defaultOverrideSettings, extendedSettings);
+ };
+ var getEditorSettings = function (editor, id, documentBaseUrl, defaultOverrideSettings, settings) {
+ var defaultSettings = getDefaultSettings(id, documentBaseUrl, editor);
+ return combineSettings(isTouch, defaultSettings, defaultOverrideSettings, settings);
+ };
+ var getFiltered = function (predicate, editor, name) {
+ return Option.from(editor.settings[name]).filter(predicate);
+ };
+ var getString = $_68e81l6jfuw8kyc.curry(getFiltered, $_16i8k47jfuw8kyi.isString);
+ var getParamObject = function (value) {
+ var output = {};
+ if (typeof value === 'string') {
+ $_9ek1bp4jfuw8kxg.each(value.indexOf('=') > 0 ? value.split(/[;,](?![^=;,]*(?:[;,]|$))/) : value.split(','), function (val) {
+ var arr = val.split('=');
+ if (arr.length > 1) {
+ output[$_52qop8kjfuw8l6v.trim(arr[0])] = $_52qop8kjfuw8l6v.trim(arr[1]);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- moveFocus(1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ output[$_52qop8kjfuw8l6v.trim(arr[0])] = $_52qop8kjfuw8l6v.trim(arr);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ } else {
+ output = value;
+ }
+ return output;
+ };
+ var isArrayOf = function (p) {
+ return function (a) {
+ return $_16i8k47jfuw8kyi.isArray(a) && $_9ek1bp4jfuw8kxg.forall(a, p);
+ };
+ };
+ var getParam = function (editor, name, defaultVal, type) {
+ var value = name in editor.settings ? editor.settings[name] : defaultVal;
+ if (type === 'hash') {
+ return getParamObject(value);
+ } else if (type === 'string') {
+ return getFiltered($_16i8k47jfuw8kyi.isString, editor, name).getOr(defaultVal);
+ } else if (type === 'number') {
+ return getFiltered($_16i8k47jfuw8kyi.isNumber, editor, name).getOr(defaultVal);
+ } else if (type === 'boolean') {
+ return getFiltered($_16i8k47jfuw8kyi.isBoolean, editor, name).getOr(defaultVal);
+ } else if (type === 'object') {
+ return getFiltered($_16i8k47jfuw8kyi.isObject, editor, name).getOr(defaultVal);
+ } else if (type === 'array') {
+ return getFiltered($_16i8k47jfuw8kyi.isArray, editor, name).getOr(defaultVal);
+ } else if (type === 'string[]') {
+ return getFiltered(isArrayOf($_16i8k47jfuw8kyi.isString), editor, name).getOr(defaultVal);
+ } else if (type === 'function') {
+ return getFiltered($_16i8k47jfuw8kyi.isFunction, editor, name).getOr(defaultVal);
+ } else {
+ return value;
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Moves the focus to the up this is called by the up key.
- *
- * @private
- */
- function up() {
- moveFocus(-1);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var strongRtl = /[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/;
+ var hasStrongRtl = function (text) {
+ return strongRtl.test(text);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Moves the focus to the up this is called by the down key.
- *
- * @private
- */
- function down() {
- var role = getRole(), parentRole = getParentRole();
-
- if (role == "menuitem" && parentRole == "menubar") {
- enter();
- } else if (role == "button" && getAriaProp('haspopup')) {
- enter({ key: 'down' });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isInlineTarget = function (editor, elm) {
+ var selector = getString(editor, 'inline_boundaries_selector').getOr('a[href],code');
+ return $_fbwcti1fjfuw8lbx.is($_c9h6qlzjfuw8l98.fromDom(elm), selector);
+ };
+ var isRtl = function (element) {
+ return DOMUtils$1.DOM.getStyle(element, 'direction', true) === 'rtl' || hasStrongRtl(element.textContent);
+ };
+ var findInlineParents = function (isInlineTarget, rootNode, pos) {
+ return $_9ek1bp4jfuw8kxg.filter(DOMUtils$1.DOM.getParents(pos.container(), '*', rootNode), isInlineTarget);
+ };
+ var findRootInline = function (isInlineTarget, rootNode, pos) {
+ var parents = findInlineParents(isInlineTarget, rootNode, pos);
+ return Option.from(parents[parents.length - 1]);
+ };
+ var hasSameParentBlock = function (rootNode, node1, node2) {
+ var block1 = getParentBlock(node1, rootNode);
+ var block2 = getParentBlock(node2, rootNode);
+ return block1 && block1 === block2;
+ };
+ var isAtZwsp = function (pos) {
+ return isBeforeInline(pos) || isAfterInline(pos);
+ };
+ var normalizePosition = function (forward, pos) {
+ var container = pos.container(), offset = pos.offset();
+ if (forward) {
+ if (isCaretContainerInline(container)) {
+ if ($_ey7ka11qjfuw8ldg.isText(container.nextSibling)) {
+ return CaretPosition$1(container.nextSibling, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- moveFocus(1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return CaretPosition$1.after(container);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ return isBeforeInline(pos) ? CaretPosition$1(container, offset + 1) : pos;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Moves the focus to the next item or previous item depending on shift key.
- *
- * @private
- * @param {DOMEvent} e DOM event object.
- */
- function tab(e) {
- var parentRole = getParentRole();
-
- if (parentRole == "tablist") {
- var elm = getFocusElements(focusedControl.getEl('body'))[0];
-
- if (elm) {
- elm.focus();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if (isCaretContainerInline(container)) {
+ if ($_ey7ka11qjfuw8ldg.isText(container.previousSibling)) {
+ return CaretPosition$1(container.previousSibling, container.previousSibling.data.length);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- moveFocus(e.shiftKey ? -1 : 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return CaretPosition$1.before(container);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ return isAfterInline(pos) ? CaretPosition$1(container, offset - 1) : pos;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var normalizeForwards = $_68e81l6jfuw8kyc.curry(normalizePosition, true);
+ var normalizeBackwards = $_68e81l6jfuw8kyc.curry(normalizePosition, false);
+ var $_exgtt937jfuw8loj = {
+ isInlineTarget: isInlineTarget,
+ findRootInline: findRootInline,
+ isRtl: isRtl,
+ isAtZwsp: isAtZwsp,
+ normalizePosition: normalizePosition,
+ normalizeForwards: normalizeForwards,
+ normalizeBackwards: normalizeBackwards,
+ hasSameParentBlock: hasSameParentBlock
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Calls the cancel event on the currently focused control. This is normally done using the Esc key.
- *
- * @private
- */
- function cancel() {
- focusedControl.fire('cancel');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isBeforeRoot = function (rootNode) {
+ return function (elm) {
+ return $_4fb96d1djfuw8lbl.eq(rootNode, $_c9h6qlzjfuw8l98.fromDom(elm.dom().parentNode));
+ };
+ };
+ var getParentBlock$1 = function (rootNode, elm) {
+ return $_4fb96d1djfuw8lbl.contains(rootNode, elm) ? $_chabeg35jfuw8lo3.closest(elm, function (element) {
+ return isTextBlock(element) || isListItem(element);
+ }, isBeforeRoot(rootNode)) : Option.none();
+ };
+ var placeCaretInEmptyBody = function (editor) {
+ var body = editor.getBody();
+ var node = body.firstChild && editor.dom.isBlock(body.firstChild) ? body.firstChild : body;
+ editor.selection.setCursorLocation(node, 0);
+ };
+ var paddEmptyBody = function (editor) {
+ if (editor.dom.isEmpty(editor.getBody())) {
+ editor.setContent('');
+ placeCaretInEmptyBody(editor);
+ }
+ };
+ var willDeleteLastPositionInElement = function (forward, fromPos, elm) {
+ return $_5gv5dd26jfuw8li3.liftN([
+ $_25kl2c2cjfuw8ljh.firstPositionIn(elm),
+ $_25kl2c2cjfuw8ljh.lastPositionIn(elm)
+ ], function (firstPos, lastPos) {
+ var normalizedFirstPos = $_exgtt937jfuw8loj.normalizePosition(true, firstPos);
+ var normalizedLastPos = $_exgtt937jfuw8loj.normalizePosition(false, lastPos);
+ var normalizedFromPos = $_exgtt937jfuw8loj.normalizePosition(false, fromPos);
+ if (forward) {
+ return $_25kl2c2cjfuw8ljh.nextPosition(elm, normalizedFromPos).map(function (nextPos) {
+ return nextPos.isEqual(normalizedLastPos) && fromPos.isEqual(normalizedFirstPos);
+ }).getOr(false);
+ } else {
+ return $_25kl2c2cjfuw8ljh.prevPosition(elm, normalizedFromPos).map(function (prevPos) {
+ return prevPos.isEqual(normalizedFirstPos) && fromPos.isEqual(normalizedLastPos);
+ }).getOr(false);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).getOr(true);
+ };
+ var $_43wr4w34jfuw8lnu = {
+ getParentBlock: getParentBlock$1,
+ paddEmptyBody: paddEmptyBody,
+ willDeleteLastPositionInElement: willDeleteLastPositionInElement
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Calls the click event on the currently focused control. This is normally done using the Enter/Space keys.
- *
- * @private
- * @param {Object} aria Optional aria data to pass along with the enter event.
- */
- function enter(aria) {
- aria = aria || {};
- focusedControl.fire('click', { target: focusedElement, aria: aria });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var first$2 = function (selector) {
+ return $_fbwcti1fjfuw8lbx.one(selector);
+ };
+ var ancestor$1 = function (scope, selector, isRoot) {
+ return $_chabeg35jfuw8lo3.ancestor(scope, function (e) {
+ return $_fbwcti1fjfuw8lbx.is(e, selector);
+ }, isRoot);
+ };
+ var sibling$2 = function (scope, selector) {
+ return $_chabeg35jfuw8lo3.sibling(scope, function (e) {
+ return $_fbwcti1fjfuw8lbx.is(e, selector);
+ });
+ };
+ var child$2 = function (scope, selector) {
+ return $_chabeg35jfuw8lo3.child(scope, function (e) {
+ return $_fbwcti1fjfuw8lbx.is(e, selector);
+ });
+ };
+ var descendant$1 = function (scope, selector) {
+ return $_fbwcti1fjfuw8lbx.one(selector, scope);
+ };
+ var closest$1 = function (scope, selector, isRoot) {
+ return ClosestOrAncestor($_fbwcti1fjfuw8lbx.is, ancestor$1, scope, selector, isRoot);
+ };
+ var $_94zo1v3cjfuw8lpg = {
+ first: first$2,
+ ancestor: ancestor$1,
+ sibling: sibling$2,
+ child: child$2,
+ descendant: descendant$1,
+ closest: closest$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- root.on('keydown', function (e) {
- function handleNonTabOrEscEvent(e, handler) {
- // Ignore non tab keys for text elements
- if (isTextInputElement(focusedElement) || hasTabstopData(focusedElement)) {
- return;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var any = function (selector) {
+ return $_94zo1v3cjfuw8lpg.first(selector).isSome();
+ };
+ var ancestor$2 = function (scope, selector, isRoot) {
+ return $_94zo1v3cjfuw8lpg.ancestor(scope, selector, isRoot).isSome();
+ };
+ var sibling$3 = function (scope, selector) {
+ return $_94zo1v3cjfuw8lpg.sibling(scope, selector).isSome();
+ };
+ var child$3 = function (scope, selector) {
+ return $_94zo1v3cjfuw8lpg.child(scope, selector).isSome();
+ };
+ var descendant$2 = function (scope, selector) {
+ return $_94zo1v3cjfuw8lpg.descendant(scope, selector).isSome();
+ };
+ var closest$2 = function (scope, selector, isRoot) {
+ return $_94zo1v3cjfuw8lpg.closest(scope, selector, isRoot).isSome();
+ };
+ var $_8wfxe73bjfuw8lpe = {
+ any: any,
+ ancestor: ancestor$2,
+ sibling: sibling$3,
+ child: child$3,
+ descendant: descendant$2,
+ closest: closest$2
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (getRole(focusedElement) === 'slider') {
- return;
- }
-
- if (handler(e) !== false) {
- e.preventDefault();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasWhitespacePreserveParent = function (rootNode, node) {
+ var rootElement = $_c9h6qlzjfuw8l98.fromDom(rootNode);
+ var startNode = $_c9h6qlzjfuw8l98.fromDom(node);
+ return $_8wfxe73bjfuw8lpe.ancestor(startNode, 'pre,code', $_68e81l6jfuw8kyc.curry($_4fb96d1djfuw8lbl.eq, rootElement));
+ };
+ var isWhitespace = function (rootNode, node) {
+ return $_ey7ka11qjfuw8ldg.isText(node) && /^[ \t\r\n]*$/.test(node.data) && hasWhitespacePreserveParent(rootNode, node) === false;
+ };
+ var isNamedAnchor = function (node) {
+ return $_ey7ka11qjfuw8ldg.isElement(node) && node.nodeName === 'A' && node.hasAttribute('name');
+ };
+ var isContent = function (rootNode, node) {
+ return isCaretCandidate(node) && isWhitespace(rootNode, node) === false || isNamedAnchor(node) || isBookmark(node);
+ };
+ var isBookmark = $_ey7ka11qjfuw8ldg.hasAttribute('data-mce-bookmark');
+ var isBogus$2 = $_ey7ka11qjfuw8ldg.hasAttribute('data-mce-bogus');
+ var isBogusAll$1 = $_ey7ka11qjfuw8ldg.hasAttributeValue('data-mce-bogus', 'all');
+ var isEmptyNode = function (targetNode) {
+ var walker, node, brCount = 0;
+ if (isContent(targetNode, targetNode)) {
+ return false;
+ } else {
+ node = targetNode.firstChild;
+ if (!node) {
+ return true;
+ }
+ walker = new TreeWalker(node, targetNode);
+ do {
+ if (isBogusAll$1(node)) {
+ node = walker.next(true);
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (e.isDefaultPrevented()) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isBogus$2(node)) {
+ node = walker.next();
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- switch (e.keyCode) {
- case 37: // DOM_VK_LEFT
- handleNonTabOrEscEvent(e, left);
- break;
-
- case 39: // DOM_VK_RIGHT
- handleNonTabOrEscEvent(e, right);
- break;
-
- case 38: // DOM_VK_UP
- handleNonTabOrEscEvent(e, up);
- break;
-
- case 40: // DOM_VK_DOWN
- handleNonTabOrEscEvent(e, down);
- break;
-
- case 27: // DOM_VK_ESCAPE
- cancel();
- break;
-
- case 14: // DOM_VK_ENTER
- case 13: // DOM_VK_RETURN
- case 32: // DOM_VK_SPACE
- handleNonTabOrEscEvent(e, enter);
- break;
-
- case 9: // DOM_VK_TAB
- if (tab(e) !== false) {
- e.preventDefault();
- }
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_ey7ka11qjfuw8ldg.isBr(node)) {
+ brCount++;
+ node = walker.next();
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isContent(targetNode, node)) {
+ return false;
+ }
+ node = walker.next();
+ } while (node);
+ return brCount <= 1;
+ }
+ };
+ var isEmpty$1 = function (elm) {
+ return isEmptyNode(elm.dom());
+ };
+ var $_9f7o8q3ajfuw8lp7 = { isEmpty: isEmpty$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- root.on('focusin', function (e) {
- focusedElement = e.target;
- focusedControl = e.control;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var BlockPosition = $_1a7eqh18jfuw8lb9.immutable('block', 'position');
+ var BlockBoundary = $_1a7eqh18jfuw8lb9.immutable('from', 'to');
+ var getBlockPosition = function (rootNode, pos) {
+ var rootElm = $_c9h6qlzjfuw8l98.fromDom(rootNode);
+ var containerElm = $_c9h6qlzjfuw8l98.fromDom(pos.container());
+ return $_43wr4w34jfuw8lnu.getParentBlock(rootElm, containerElm).map(function (block) {
+ return BlockPosition(block, pos);
+ });
+ };
+ var isDifferentBlocks = function (blockBoundary) {
+ return $_4fb96d1djfuw8lbl.eq(blockBoundary.from().block(), blockBoundary.to().block()) === false;
+ };
+ var hasSameParent = function (blockBoundary) {
+ return $_2j4g5u17jfuw8lav.parent(blockBoundary.from().block()).bind(function (parent1) {
+ return $_2j4g5u17jfuw8lav.parent(blockBoundary.to().block()).filter(function (parent2) {
+ return $_4fb96d1djfuw8lbl.eq(parent1, parent2);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- focusFirst: focusFirst
- };
- };
- }
-);
-/**
- * Container.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Container control. This is extended by all controls that can have
- * children such as panels etc. You can also use this class directly as an
- * generic container instance. The container doesn't have any specific role or style.
- *
- * @-x-less Container.less
- * @class tinymce.ui.Container
- * @extends tinymce.ui.Control
- */
-define(
- 'tinymce.core.ui.Container',
- [
- "tinymce.core.ui.Control",
- "tinymce.core.ui.Collection",
- "tinymce.core.ui.Selector",
- "tinymce.core.ui.Factory",
- "tinymce.core.ui.KeyboardNavigation",
- "tinymce.core.util.Tools",
- "tinymce.core.dom.DomQuery",
- "tinymce.core.ui.ClassList",
- "tinymce.core.ui.ReflowQueue"
- ],
- function (Control, Collection, Selector, Factory, KeyboardNavigation, Tools, $, ClassList, ReflowQueue) {
- "use strict";
-
- var selectorCache = {};
-
- return Control.extend({
- /**
- * Constructs a new control instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Array} items Items to add to container in JSON format or control instances.
- * @setting {String} layout Layout manager by name to use.
- * @setting {Object} defaults Default settings to apply to all items.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
- settings = self.settings;
-
- if (settings.fixed) {
- self.state.set('fixed', true);
- }
-
- self._items = new Collection();
-
- if (self.isRtl()) {
- self.classes.add('rtl');
- }
-
- self.bodyClasses = new ClassList(function () {
- if (self.state.get('rendered')) {
- self.getEl('body').className = this.toString();
- }
- });
- self.bodyClasses.prefix = self.classPrefix;
-
- self.classes.add('container');
- self.bodyClasses.add('container-body');
-
- if (settings.containerCls) {
- self.classes.add(settings.containerCls);
- }
-
- self._layout = Factory.create((settings.layout || '') + 'layout');
-
- if (self.settings.items) {
- self.add(self.settings.items);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).isSome();
+ };
+ var isEditable = function (blockBoundary) {
+ return $_ey7ka11qjfuw8ldg.isContentEditableFalse(blockBoundary.from().block()) === false && $_ey7ka11qjfuw8ldg.isContentEditableFalse(blockBoundary.to().block()) === false;
+ };
+ var skipLastBr = function (rootNode, forward, blockPosition) {
+ if ($_ey7ka11qjfuw8ldg.isBr(blockPosition.position().getNode()) && $_9f7o8q3ajfuw8lp7.isEmpty(blockPosition.block()) === false) {
+ return $_25kl2c2cjfuw8ljh.positionIn(false, blockPosition.block().dom()).bind(function (lastPositionInBlock) {
+ if (lastPositionInBlock.isEqual(blockPosition.position())) {
+ return $_25kl2c2cjfuw8ljh.fromPosition(forward, rootNode, lastPositionInBlock).bind(function (to) {
+ return getBlockPosition(rootNode, to);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.add(self.render());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Option.some(blockPosition);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // TODO: Fix this!
- self._hasBody = true;
- },
-
- /**
- * Returns a collection of child items that the container currently have.
- *
- * @method items
- * @return {tinymce.ui.Collection} Control collection direct child controls.
- */
- items: function () {
- return this._items;
- },
-
- /**
- * Find child controls by selector.
- *
- * @method find
- * @param {String} selector Selector CSS pattern to find children by.
- * @return {tinymce.ui.Collection} Control collection with child controls.
- */
- find: function (selector) {
- selector = selectorCache[selector] = selectorCache[selector] || new Selector(selector);
-
- return selector.find(this);
- },
-
- /**
- * Adds one or many items to the current container. This will create instances of
- * the object representations if needed.
- *
- * @method add
- * @param {Array/Object/tinymce.ui.Control} items Array or item that will be added to the container.
- * @return {tinymce.ui.Collection} Current collection control.
- */
- add: function (items) {
- var self = this;
-
- self.items().add(self.create(items)).parent(self);
-
- return self;
- },
-
- /**
- * Focuses the current container instance. This will look
- * for the first control in the container and focus that.
- *
- * @method focus
- * @param {Boolean} keyboard Optional true/false if the focus was a keyboard focus or not.
- * @return {tinymce.ui.Collection} Current instance.
- */
- focus: function (keyboard) {
- var self = this, focusCtrl, keyboardNav, items;
-
- if (keyboard) {
- keyboardNav = self.keyboardNav || self.parents().eq(-1)[0].keyboardNav;
-
- if (keyboardNav) {
- keyboardNav.focusFirst(self);
- return;
- }
- }
-
- items = self.find('*');
-
- // TODO: Figure out a better way to auto focus alert dialog buttons
- if (self.statusbar) {
- items.add(self.statusbar.items());
- }
-
- items.each(function (ctrl) {
- if (ctrl.settings.autofocus) {
- focusCtrl = null;
- return false;
- }
-
- if (ctrl.canFocus) {
- focusCtrl = focusCtrl || ctrl;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).getOr(blockPosition);
+ } else {
+ return blockPosition;
+ }
+ };
+ var readFromRange = function (rootNode, forward, rng) {
+ var fromBlockPos = getBlockPosition(rootNode, CaretPosition$1.fromRangeStart(rng));
+ var toBlockPos = fromBlockPos.bind(function (blockPos) {
+ return $_25kl2c2cjfuw8ljh.fromPosition(forward, rootNode, blockPos.position()).bind(function (to) {
+ return getBlockPosition(rootNode, to).map(function (blockPos) {
+ return skipLastBr(rootNode, forward, blockPos);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ });
+ return $_5gv5dd26jfuw8li3.liftN([
+ fromBlockPos,
+ toBlockPos
+ ], BlockBoundary).filter(function (blockBoundary) {
+ return isDifferentBlocks(blockBoundary) && hasSameParent(blockBoundary) && isEditable(blockBoundary);
+ });
+ };
+ var read = function (rootNode, forward, rng) {
+ return rng.collapsed ? readFromRange(rootNode, forward, rng) : Option.none();
+ };
+ var $_dp1erv33jfuw8lna = { read: read };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (focusCtrl) {
- focusCtrl.focus();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var dropLast = function (xs) {
+ return xs.slice(0, -1);
+ };
+ var parentsUntil$1 = function (startNode, rootElm, predicate) {
+ if ($_4fb96d1djfuw8lbl.contains(rootElm, startNode)) {
+ return dropLast($_2j4g5u17jfuw8lav.parents(startNode, function (elm) {
+ return predicate(elm) || $_4fb96d1djfuw8lbl.eq(elm, rootElm);
+ }));
+ } else {
+ return [];
+ }
+ };
+ var parents$1 = function (startNode, rootElm) {
+ return parentsUntil$1(startNode, rootElm, $_68e81l6jfuw8kyc.constant(false));
+ };
+ var parentsAndSelf = function (startNode, rootElm) {
+ return [startNode].concat(parents$1(startNode, rootElm));
+ };
+ var $_3t5pi43ejfuw8lq0 = {
+ parentsUntil: parentsUntil$1,
+ parents: parents$1,
+ parentsAndSelf: parentsAndSelf
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return self;
- },
-
- /**
- * Replaces the specified child control with a new control.
- *
- * @method replace
- * @param {tinymce.ui.Control} oldItem Old item to be replaced.
- * @param {tinymce.ui.Control} newItem New item to be inserted.
- */
- replace: function (oldItem, newItem) {
- var ctrlElm, items = this.items(), i = items.length;
-
- // Replace the item in collection
- while (i--) {
- if (items[i] === oldItem) {
- items[i] = newItem;
- break;
- }
- }
-
- if (i >= 0) {
- // Remove new item from DOM
- ctrlElm = newItem.getEl();
- if (ctrlElm) {
- ctrlElm.parentNode.removeChild(ctrlElm);
- }
-
- // Remove old item from DOM
- ctrlElm = oldItem.getEl();
- if (ctrlElm) {
- ctrlElm.parentNode.removeChild(ctrlElm);
- }
- }
-
- // Adopt the item
- newItem.parent(this);
- },
-
- /**
- * Creates the specified items. If any of the items is plain JSON style objects
- * it will convert these into real tinymce.ui.Control instances.
- *
- * @method create
- * @param {Array} items Array of items to convert into control instances.
- * @return {Array} Array with control instances.
- */
- create: function (items) {
- var self = this, settings, ctrlItems = [];
-
- // Non array structure, then force it into an array
- if (!Tools.isArray(items)) {
- items = [items];
- }
-
- // Add default type to each child control
- Tools.each(items, function (item) {
- if (item) {
- // Construct item if needed
- if (!(item instanceof Control)) {
- // Name only then convert it to an object
- if (typeof item == "string") {
- item = { type: item };
- }
-
- // Create control instance based on input settings and default settings
- settings = Tools.extend({}, self.settings.defaults, item);
- item.type = settings.type = settings.type || item.type || self.settings.defaultType ||
- (settings.defaults ? settings.defaults.type : null);
- item = Factory.create(settings);
- }
-
- ctrlItems.push(item);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getChildrenUntilBlockBoundary = function (block) {
+ var children = $_2j4g5u17jfuw8lav.children(block);
+ return $_9ek1bp4jfuw8kxg.findIndex(children, isBlock).fold(function () {
+ return children;
+ }, function (index) {
+ return children.slice(0, index);
+ });
+ };
+ var extractChildren = function (block) {
+ var children = getChildrenUntilBlockBoundary(block);
+ $_9ek1bp4jfuw8kxg.each(children, function (node) {
+ $_byg6a92ujfuw8lmi.remove(node);
+ });
+ return children;
+ };
+ var trimBr = function (first, block) {
+ $_25kl2c2cjfuw8ljh.positionIn(first, block.dom()).each(function (position) {
+ var node = position.getNode();
+ if ($_ey7ka11qjfuw8ldg.isBr(node)) {
+ $_byg6a92ujfuw8lmi.remove($_c9h6qlzjfuw8l98.fromDom(node));
+ }
+ });
+ };
+ var removeEmptyRoot = function (rootNode, block) {
+ var parents = $_3t5pi43ejfuw8lq0.parentsAndSelf(block, rootNode);
+ return $_9ek1bp4jfuw8kxg.find(parents.reverse(), $_9f7o8q3ajfuw8lp7.isEmpty).each($_byg6a92ujfuw8lmi.remove);
+ };
+ var findParentInsertPoint = function (toBlock, block) {
+ var parents = $_2j4g5u17jfuw8lav.parents(block, function (elm) {
+ return $_4fb96d1djfuw8lbl.eq(elm, toBlock);
+ });
+ return Option.from(parents[parents.length - 2]);
+ };
+ var getInsertionPoint = function (fromBlock, toBlock) {
+ if ($_4fb96d1djfuw8lbl.contains(toBlock, fromBlock)) {
+ return $_2j4g5u17jfuw8lav.parent(fromBlock).bind(function (parent) {
+ return $_4fb96d1djfuw8lbl.eq(parent, toBlock) ? Option.some(fromBlock) : findParentInsertPoint(toBlock, fromBlock);
+ });
+ } else {
+ return Option.none();
+ }
+ };
+ var mergeBlockInto = function (rootNode, fromBlock, toBlock) {
+ if ($_9f7o8q3ajfuw8lp7.isEmpty(toBlock)) {
+ $_byg6a92ujfuw8lmi.remove(toBlock);
+ if ($_9f7o8q3ajfuw8lp7.isEmpty(fromBlock)) {
+ $_5udnjn2tjfuw8lm4.fillWithPaddingBr(fromBlock);
+ }
+ return $_25kl2c2cjfuw8ljh.firstPositionIn(fromBlock.dom());
+ } else {
+ trimBr(true, fromBlock);
+ trimBr(false, toBlock);
+ var children_1 = extractChildren(fromBlock);
+ return getInsertionPoint(fromBlock, toBlock).fold(function () {
+ removeEmptyRoot(rootNode, fromBlock);
+ var position = $_25kl2c2cjfuw8ljh.lastPositionIn(toBlock.dom());
+ $_9ek1bp4jfuw8kxg.each(children_1, function (node) {
+ $_doli6x2kjfuw8lky.append(toBlock, node);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return ctrlItems;
- },
-
- /**
- * Renders new control instances.
- *
- * @private
- */
- renderNew: function () {
- var self = this;
-
- // Render any new items
- self.items().each(function (ctrl, index) {
- var containerElm;
-
- ctrl.parent(self);
-
- if (!ctrl.state.get('rendered')) {
- containerElm = self.getEl('body');
-
- // Insert or append the item
- if (containerElm.hasChildNodes() && index <= containerElm.childNodes.length - 1) {
- $(containerElm.childNodes[index]).before(ctrl.renderHtml());
- } else {
- $(containerElm).append(ctrl.renderHtml());
- }
-
- ctrl.postRender();
- ReflowQueue.add(ctrl);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return position;
+ }, function (target) {
+ var position = $_25kl2c2cjfuw8ljh.prevPosition(toBlock.dom(), CaretPosition$1.before(target.dom()));
+ $_9ek1bp4jfuw8kxg.each(children_1, function (node) {
+ $_doli6x2kjfuw8lky.before(target, node);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ removeEmptyRoot(rootNode, fromBlock);
+ return position;
+ });
+ }
+ };
+ var mergeBlocks = function (rootNode, forward, block1, block2) {
+ return forward ? mergeBlockInto(rootNode, block2, block1) : mergeBlockInto(rootNode, block1, block2);
+ };
+ var $_fm1lyo3djfuw8lpi = { mergeBlocks: mergeBlocks };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self._layout.applyClasses(self.items().filter(':visible'));
- self._lastRect = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var backspaceDelete = function (editor, forward) {
+ var position;
+ var rootNode = $_c9h6qlzjfuw8l98.fromDom(editor.getBody());
+ position = $_dp1erv33jfuw8lna.read(rootNode.dom(), forward, editor.selection.getRng()).bind(function (blockBoundary) {
+ return $_fm1lyo3djfuw8lpi.mergeBlocks(rootNode, forward, blockBoundary.from().block(), blockBoundary.to().block());
+ });
+ position.each(function (pos) {
+ editor.selection.setRng(pos.toRange());
+ });
+ return position.isSome();
+ };
+ var $_cwwff132jfuw8ln7 = { backspaceDelete: backspaceDelete };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return self;
- },
-
- /**
- * Appends new instances to the current container.
- *
- * @method append
- * @param {Array/tinymce.ui.Collection} items Array if controls to append.
- * @return {tinymce.ui.Container} Current container instance.
- */
- append: function (items) {
- return this.add(items).renderNew();
- },
-
- /**
- * Prepends new instances to the current container.
- *
- * @method prepend
- * @param {Array/tinymce.ui.Collection} items Array if controls to prepend.
- * @return {tinymce.ui.Container} Current container instance.
- */
- prepend: function (items) {
- var self = this;
-
- self.items().set(self.create(items).concat(self.items().toArray()));
-
- return self.renderNew();
- },
-
- /**
- * Inserts an control at a specific index.
- *
- * @method insert
- * @param {Array/tinymce.ui.Collection} items Array if controls to insert.
- * @param {Number} index Index to insert controls at.
- * @param {Boolean} [before=false] Inserts controls before the index.
- */
- insert: function (items, index, before) {
- var self = this, curItems, beforeItems, afterItems;
-
- items = self.create(items);
- curItems = self.items();
-
- if (!before && index < curItems.length - 1) {
- index += 1;
- }
-
- if (index >= 0 && index < curItems.length) {
- beforeItems = curItems.slice(0, index).toArray();
- afterItems = curItems.slice(index).toArray();
- curItems.set(beforeItems.concat(items, afterItems));
- }
-
- return self.renderNew();
- },
-
- /**
- * Populates the form fields from the specified JSON data object.
- *
- * Control items in the form that matches the data will have it's value set.
- *
- * @method fromJSON
- * @param {Object} data JSON data object to set control values by.
- * @return {tinymce.ui.Container} Current form instance.
- */
- fromJSON: function (data) {
- var self = this;
-
- for (var name in data) {
- self.find('#' + name).value(data[name]);
- }
-
- return self;
- },
-
- /**
- * Serializes the form into a JSON object by getting all items
- * that has a name and a value.
- *
- * @method toJSON
- * @return {Object} JSON object with form data.
- */
- toJSON: function () {
- var self = this, data = {};
-
- self.find('*').each(function (ctrl) {
- var name = ctrl.name(), value = ctrl.value();
-
- if (name && typeof value != "undefined") {
- data[name] = value;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var deleteRangeMergeBlocks = function (rootNode, selection) {
+ var rng = selection.getRng();
+ return $_5gv5dd26jfuw8li3.liftN([
+ $_43wr4w34jfuw8lnu.getParentBlock(rootNode, $_c9h6qlzjfuw8l98.fromDom(rng.startContainer)),
+ $_43wr4w34jfuw8lnu.getParentBlock(rootNode, $_c9h6qlzjfuw8l98.fromDom(rng.endContainer))
+ ], function (block1, block2) {
+ if ($_4fb96d1djfuw8lbl.eq(block1, block2) === false) {
+ rng.deleteContents();
+ $_fm1lyo3djfuw8lpi.mergeBlocks(rootNode, true, block1, block2).each(function (pos) {
+ selection.setRng(pos.toRange());
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return data;
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, layout = self._layout, role = this.settings.role;
-
- self.preRender();
- layout.preRender(self);
-
- return (
- '<div id="' + self._id + '" class="' + self.classes + '"' + (role ? ' role="' + this.settings.role + '"' : '') + '>' +
- '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' +
- (self.settings.html || '') + layout.renderHtml(self) +
- '</div>' +
- '</div>'
- );
- },
-
- /**
- * Post render method. Called after the control has been rendered to the target.
- *
- * @method postRender
- * @return {tinymce.ui.Container} Current combobox instance.
- */
- postRender: function () {
- var self = this, box;
-
- self.items().exec('postRender');
- self._super();
-
- self._layout.postRender(self);
- self.state.set('rendered', true);
-
- if (self.settings.style) {
- self.$el.css(self.settings.style);
- }
-
- if (self.settings.border) {
- box = self.borderBox;
- self.$el.css({
- 'border-top-width': box.top,
- 'border-right-width': box.right,
- 'border-bottom-width': box.bottom,
- 'border-left-width': box.left
- });
- }
-
- if (!self.parent()) {
- self.keyboardNav = new KeyboardNavigation({
- root: self
- });
- }
-
- return self;
- },
-
- /**
- * Initializes the current controls layout rect.
- * This will be executed by the layout managers to determine the
- * default minWidth/minHeight etc.
- *
- * @method initLayoutRect
- * @return {Object} Layout rect instance.
- */
- initLayoutRect: function () {
- var self = this, layoutRect = self._super();
-
- // Recalc container size by asking layout manager
- self._layout.recalc(self);
-
- return layoutRect;
- },
-
- /**
- * Recalculates the positions of the controls in the current container.
- * This is invoked by the reflow method and shouldn't be called directly.
- *
- * @method recalc
- */
- recalc: function () {
- var self = this, rect = self._layoutRect, lastRect = self._lastRect;
-
- if (!lastRect || lastRect.w != rect.w || lastRect.h != rect.h) {
- self._layout.recalc(self);
- rect = self.layoutRect();
- self._lastRect = { x: rect.x, y: rect.y, w: rect.w, h: rect.h };
- return true;
- }
- },
-
- /**
- * Reflows the current container and it's children and possible parents.
- * This should be used after you for example append children to the current control so
- * that the layout managers know that they need to reposition everything.
- *
- * @example
- * container.append({type: 'button', text: 'My button'}).reflow();
- *
- * @method reflow
- * @return {tinymce.ui.Container} Current container instance.
- */
- reflow: function () {
- var i;
-
- ReflowQueue.remove(this);
-
- if (this.visible()) {
- Control.repaintControls = [];
- Control.repaintControls.map = {};
-
- this.recalc();
- i = Control.repaintControls.length;
-
- while (i--) {
- Control.repaintControls[i].repaint();
- }
-
- // TODO: Fix me!
- if (this.settings.layout !== "flow" && this.settings.layout !== "stack") {
- this.repaint();
- }
-
- Control.repaintControls = [];
- }
-
- return this;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ } else {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * DragHelper.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).getOr(false);
+ };
+ var isRawNodeInTable = function (root, rawNode) {
+ var node = $_c9h6qlzjfuw8l98.fromDom(rawNode);
+ var isRoot = $_68e81l6jfuw8kyc.curry($_4fb96d1djfuw8lbl.eq, root);
+ return $_chabeg35jfuw8lo3.ancestor(node, isTableCell, isRoot).isSome();
+ };
+ var isSelectionInTable = function (root, rng) {
+ return isRawNodeInTable(root, rng.startContainer) || isRawNodeInTable(root, rng.endContainer);
+ };
+ var isEverythingSelected = function (root, rng) {
+ var noPrevious = $_25kl2c2cjfuw8ljh.prevPosition(root.dom(), CaretPosition$1.fromRangeStart(rng)).isNone();
+ var noNext = $_25kl2c2cjfuw8ljh.nextPosition(root.dom(), CaretPosition$1.fromRangeEnd(rng)).isNone();
+ return !isSelectionInTable(root, rng) && noPrevious && noNext;
+ };
+ var emptyEditor = function (editor) {
+ editor.setContent('');
+ editor.selection.setCursorLocation();
+ return true;
+ };
+ var deleteRange = function (editor) {
+ var rootNode = $_c9h6qlzjfuw8l98.fromDom(editor.getBody());
+ var rng = editor.selection.getRng();
+ return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection);
+ };
+ var backspaceDelete$1 = function (editor, forward) {
+ return editor.selection.isCollapsed() ? false : deleteRange(editor);
+ };
+ var $_f34seo3fjfuw8lq6 = { backspaceDelete: backspaceDelete$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Drag/drop helper class.
- *
- * @example
- * var dragHelper = new tinymce.ui.DragHelper('mydiv', {
- * start: function(evt) {
- * },
- *
- * drag: function(evt) {
- * },
- *
- * end: function(evt) {
- * }
- * });
- *
- * @class tinymce.ui.DragHelper
- */
-define(
- 'tinymce.core.ui.DragHelper',
- [
- "tinymce.core.dom.DomQuery"
- ],
- function ($) {
- "use strict";
-
- function getDocumentSize(doc) {
- var documentElement, body, scrollWidth, clientWidth;
- var offsetWidth, scrollHeight, clientHeight, offsetHeight, max = Math.max;
-
- documentElement = doc.documentElement;
- body = doc.body;
-
- scrollWidth = max(documentElement.scrollWidth, body.scrollWidth);
- clientWidth = max(documentElement.clientWidth, body.clientWidth);
- offsetWidth = max(documentElement.offsetWidth, body.offsetWidth);
-
- scrollHeight = max(documentElement.scrollHeight, body.scrollHeight);
- clientHeight = max(documentElement.clientHeight, body.clientHeight);
- offsetHeight = max(documentElement.offsetHeight, body.offsetHeight);
-
- return {
- width: scrollWidth < offsetWidth ? clientWidth : scrollWidth,
- height: scrollHeight < offsetHeight ? clientHeight : scrollHeight
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var generate = function (cases) {
+ if (!$_16i8k47jfuw8kyi.isArray(cases)) {
+ throw new Error('cases must be an array');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function updateWithTouchData(e) {
- var keys, i;
-
- if (e.changedTouches) {
- keys = "screenX screenY pageX pageY clientX clientY".split(' ');
- for (i = 0; i < keys.length; i++) {
- e[keys[i]] = e.changedTouches[0][keys[i]];
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (cases.length === 0) {
+ throw new Error('there must be at least one case');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return function (id, settings) {
- var $eventOverlay, doc = settings.document || document, downButton, start, stop, drag, startX, startY;
-
- settings = settings || {};
-
- function getHandleElm() {
- return doc.getElementById(settings.handle || id);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var constructors = [];
+ var adt = {};
+ $_9ek1bp4jfuw8kxg.each(cases, function (acase, count) {
+ var keys = $_8c8uhu13jfuw8la0.keys(acase);
+ if (keys.length !== 1) {
+ throw new Error('one and only one name per case');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- start = function (e) {
- var docSize = getDocumentSize(doc), handleElm, cursor;
-
- updateWithTouchData(e);
-
- e.preventDefault();
- downButton = e.button;
- handleElm = getHandleElm();
- startX = e.screenX;
- startY = e.screenY;
-
- // Grab cursor from handle so we can place it on overlay
- if (window.getComputedStyle) {
- cursor = window.getComputedStyle(handleElm, null).getPropertyValue("cursor");
- } else {
- cursor = handleElm.runtimeStyle.cursor;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var key = keys[0];
+ var value = acase[key];
+ if (adt[key] !== undefined) {
+ throw new Error('duplicate key detected:' + key);
+ } else if (key === 'cata') {
+ throw new Error('cannot have a case named cata (sorry)');
+ } else if (!$_16i8k47jfuw8kyi.isArray(value)) {
+ throw new Error('case arguments must be an array');
+ }
+ constructors.push(key);
+ adt[key] = function () {
+ var argLength = arguments.length;
+ if (argLength !== value.length) {
+ throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $eventOverlay = $('<div></div>').css({
- position: "absolute",
- top: 0, left: 0,
- width: docSize.width,
- height: docSize.height,
- zIndex: 0x7FFFFFFF,
- opacity: 0.0001,
- cursor: cursor
- }).appendTo(doc.body);
-
- $(doc).on('mousemove touchmove', drag).on('mouseup touchend', stop);
-
- settings.start(e);
- };
-
- drag = function (e) {
- updateWithTouchData(e);
-
- if (e.button !== downButton) {
- return stop(e);
- }
-
- e.deltaX = e.screenX - startX;
- e.deltaY = e.screenY - startY;
-
- e.preventDefault();
- settings.drag(e);
- };
-
- stop = function (e) {
- updateWithTouchData(e);
-
- $(doc).off('mousemove touchmove', drag).off('mouseup touchend', stop);
-
- $eventOverlay.remove();
-
- if (settings.stop) {
- settings.stop(e);
- }
- };
-
- /**
- * Destroys the drag/drop helper instance.
- *
- * @method destroy
- */
- this.destroy = function () {
- $(getHandleElm()).off();
- };
-
- $(getHandleElm()).on('mousedown touchstart', start);
- };
- }
-);
-/**
- * Scrollable.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This mixin makes controls scrollable using custom scrollbars.
- *
- * @-x-less Scrollable.less
- * @mixin tinymce.ui.Scrollable
- */
-define(
- 'tinymce.core.ui.Scrollable',
- [
- "tinymce.core.dom.DomQuery",
- "tinymce.core.ui.DragHelper"
- ],
- function ($, DragHelper) {
- "use strict";
-
- return {
- init: function () {
- var self = this;
- self.on('repaint', self.renderScroll);
- },
-
- renderScroll: function () {
- var self = this, margin = 2;
-
- function repaintScroll() {
- var hasScrollH, hasScrollV, bodyElm;
-
- function repaintAxis(axisName, posName, sizeName, contentSizeName, hasScroll, ax) {
- var containerElm, scrollBarElm, scrollThumbElm;
- var containerSize, scrollSize, ratio, rect;
- var posNameLower, sizeNameLower;
-
- scrollBarElm = self.getEl('scroll' + axisName);
- if (scrollBarElm) {
- posNameLower = posName.toLowerCase();
- sizeNameLower = sizeName.toLowerCase();
-
- $(self.getEl('absend')).css(posNameLower, self.layoutRect()[contentSizeName] - 1);
-
- if (!hasScroll) {
- $(scrollBarElm).css('display', 'none');
- return;
- }
-
- $(scrollBarElm).css('display', 'block');
- containerElm = self.getEl('body');
- scrollThumbElm = self.getEl('scroll' + axisName + "t");
- containerSize = containerElm["client" + sizeName] - (margin * 2);
- containerSize -= hasScrollH && hasScrollV ? scrollBarElm["client" + ax] : 0;
- scrollSize = containerElm["scroll" + sizeName];
- ratio = containerSize / scrollSize;
-
- rect = {};
- rect[posNameLower] = containerElm["offset" + posName] + margin;
- rect[sizeNameLower] = containerSize;
- $(scrollBarElm).css(rect);
-
- rect = {};
- rect[posNameLower] = containerElm["scroll" + posName] * ratio;
- rect[sizeNameLower] = containerSize * ratio;
- $(scrollThumbElm).css(rect);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var args = new Array(argLength);
+ for (var i = 0; i < args.length; i++)
+ args[i] = arguments[i];
+ var match = function (branches) {
+ var branchKeys = $_8c8uhu13jfuw8la0.keys(branches);
+ if (constructors.length !== branchKeys.length) {
+ throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\nActual: ' + branchKeys.join(','));
+ }
+ var allReqd = $_9ek1bp4jfuw8kxg.forall(constructors, function (reqKey) {
+ return $_9ek1bp4jfuw8kxg.contains(branchKeys, reqKey);
+ });
+ if (!allReqd)
+ throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\nRequired: ' + constructors.join(', '));
+ return branches[key].apply(null, args);
+ };
+ return {
+ fold: function () {
+ if (arguments.length !== cases.length) {
+ throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + arguments.length);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- bodyElm = self.getEl('body');
- hasScrollH = bodyElm.scrollWidth > bodyElm.clientWidth;
- hasScrollV = bodyElm.scrollHeight > bodyElm.clientHeight;
-
- repaintAxis("h", "Left", "Width", "contentW", hasScrollH, "Height");
- repaintAxis("v", "Top", "Height", "contentH", hasScrollV, "Width");
- }
-
- function addScroll() {
- function addScrollAxis(axisName, posName, sizeName, deltaPosName, ax) {
- var scrollStart, axisId = self._id + '-scroll' + axisName, prefix = self.classPrefix;
-
- $(self.getEl()).append(
- '<div id="' + axisId + '" class="' + prefix + 'scrollbar ' + prefix + 'scrollbar-' + axisName + '">' +
- '<div id="' + axisId + 't" class="' + prefix + 'scrollbar-thumb"></div>' +
- '</div>'
- );
-
- self.draghelper = new DragHelper(axisId + 't', {
- start: function () {
- scrollStart = self.getEl('body')["scroll" + posName];
- $('#' + axisId).addClass(prefix + 'active');
- },
-
- drag: function (e) {
- var ratio, hasScrollH, hasScrollV, containerSize, layoutRect = self.layoutRect();
-
- hasScrollH = layoutRect.contentW > layoutRect.innerW;
- hasScrollV = layoutRect.contentH > layoutRect.innerH;
- containerSize = self.getEl('body')["client" + sizeName] - (margin * 2);
- containerSize -= hasScrollH && hasScrollV ? self.getEl('scroll' + axisName)["client" + ax] : 0;
-
- ratio = containerSize / self.getEl('body')["scroll" + sizeName];
- self.getEl('body')["scroll" + posName] = scrollStart + (e["delta" + deltaPosName] / ratio);
- },
-
- stop: function () {
- $('#' + axisId).removeClass(prefix + 'active');
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var target = arguments[count];
+ return target.apply(null, args);
+ },
+ match: match,
+ log: function (label) {
+ console.log(label, {
+ constructors: constructors,
+ constructor: key,
+ params: args
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ };
+ });
+ return adt;
+ };
+ var $_5ac1li3ijfuw8lqv = { generate: generate };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.classes.add('scroll');
-
- addScrollAxis("v", "Top", "Height", "Y", "Width");
- addScrollAxis("h", "Left", "Width", "X", "Height");
- }
-
- if (self.settings.autoScroll) {
- if (!self._hasScroll) {
- self._hasScroll = true;
- addScroll();
-
- self.on('wheel', function (e) {
- var bodyEl = self.getEl('body');
-
- bodyEl.scrollLeft += (e.deltaX || 0) * 10;
- bodyEl.scrollTop += e.deltaY * 10;
-
- repaintScroll();
- });
-
- $(self.getEl('body')).on("scroll", repaintScroll);
- }
-
- repaintScroll();
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isCompoundElement = function (node) {
+ return isTableCell($_c9h6qlzjfuw8l98.fromDom(node)) || isListItem($_c9h6qlzjfuw8l98.fromDom(node));
+ };
+ var DeleteAction = $_5ac1li3ijfuw8lqv.generate([
+ { remove: ['element'] },
+ { moveToElement: ['element'] },
+ { moveToPosition: ['position'] }
+ ]);
+ var isAtContentEditableBlockCaret = function (forward, from) {
+ var elm = from.getNode(forward === false);
+ var caretLocation = forward ? 'after' : 'before';
+ return $_ey7ka11qjfuw8ldg.isElement(elm) && elm.getAttribute('data-mce-caret') === caretLocation;
+ };
+ var isDeleteFromCefDifferentBlocks = function (root, forward, from, to) {
+ var inSameBlock = function (elm) {
+ return isInline($_c9h6qlzjfuw8l98.fromDom(elm)) && !isInSameBlock(from, to, root);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Panel.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new panel.
- *
- * @-x-less Panel.less
- * @class tinymce.ui.Panel
- * @extends tinymce.ui.Container
- * @mixes tinymce.ui.Scrollable
- */
-define(
- 'tinymce.core.ui.Panel',
- [
- "tinymce.core.ui.Container",
- "tinymce.core.ui.Scrollable"
- ],
- function (Container, Scrollable) {
- "use strict";
-
- return Container.extend({
- Defaults: {
- layout: 'fit',
- containerCls: 'panel'
- },
-
- Mixins: [Scrollable],
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, layout = self._layout, innerHtml = self.settings.html;
-
- self.preRender();
- layout.preRender(self);
-
- if (typeof innerHtml == "undefined") {
- innerHtml = (
- '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' +
- layout.renderHtml(self) +
- '</div>'
- );
- } else {
- if (typeof innerHtml == 'function') {
- innerHtml = innerHtml.call(self);
- }
-
- self._hasBody = false;
- }
-
- return (
- '<div id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1" role="group">' +
- (self._preBodyHtml || '') +
- innerHtml +
- '</div>'
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return getRelativeCefElm(!forward, from).fold(function () {
+ return getRelativeCefElm(forward, to).fold($_68e81l6jfuw8kyc.constant(false), inSameBlock);
+ }, inSameBlock);
+ };
+ var deleteEmptyBlockOrMoveToCef = function (root, forward, from, to) {
+ var toCefElm = to.getNode(forward === false);
+ return $_43wr4w34jfuw8lnu.getParentBlock($_c9h6qlzjfuw8l98.fromDom(root), $_c9h6qlzjfuw8l98.fromDom(from.getNode())).map(function (blockElm) {
+ return $_9f7o8q3ajfuw8lp7.isEmpty(blockElm) ? DeleteAction.remove(blockElm.dom()) : DeleteAction.moveToElement(toCefElm);
+ }).orThunk(function () {
+ return Option.some(DeleteAction.moveToElement(toCefElm));
+ });
+ };
+ var findCefPosition = function (root, forward, from) {
+ return $_25kl2c2cjfuw8ljh.fromPosition(forward, root, from).bind(function (to) {
+ if (isCompoundElement(to.getNode())) {
+ return Option.none();
+ } else if (isDeleteFromCefDifferentBlocks(root, forward, from, to)) {
+ return Option.none();
+ } else if (forward && $_ey7ka11qjfuw8ldg.isContentEditableFalse(to.getNode())) {
+ return deleteEmptyBlockOrMoveToCef(root, forward, from, to);
+ } else if (forward === false && $_ey7ka11qjfuw8ldg.isContentEditableFalse(to.getNode(true))) {
+ return deleteEmptyBlockOrMoveToCef(root, forward, from, to);
+ } else if (forward && isAfterContentEditableFalse(from)) {
+ return Option.some(DeleteAction.moveToPosition(to));
+ } else if (forward === false && isBeforeContentEditableFalse(from)) {
+ return Option.some(DeleteAction.moveToPosition(to));
+ } else {
+ return Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Resizable.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Resizable mixin. Enables controls to be resized.
- *
- * @mixin tinymce.ui.Resizable
- */
-define(
- 'tinymce.core.ui.Resizable',
- [
- "tinymce.core.ui.DomUtils"
- ],
- function (DomUtils) {
- "use strict";
-
- return {
- /**
- * Resizes the control to contents.
- *
- * @method resizeToContent
- */
- resizeToContent: function () {
- this._layoutRect.autoResize = true;
- this._lastRect = null;
- this.reflow();
- },
-
- /**
- * Resizes the control to a specific width/height.
- *
- * @method resizeTo
- * @param {Number} w Control width.
- * @param {Number} h Control height.
- * @return {tinymce.ui.Control} Current control instance.
- */
- resizeTo: function (w, h) {
- // TODO: Fix hack
- if (w <= 1 || h <= 1) {
- var rect = DomUtils.getWindowSize();
-
- w = w <= 1 ? w * rect.w : w;
- h = h <= 1 ? h * rect.h : h;
- }
-
- this._layoutRect.autoResize = false;
- return this.layoutRect({ minW: w, minH: h, w: w, h: h }).reflow();
- },
-
- /**
- * Resizes the control to a specific relative width/height.
- *
- * @method resizeBy
- * @param {Number} dw Relative control width.
- * @param {Number} dh Relative control height.
- * @return {tinymce.ui.Control} Current control instance.
- */
- resizeBy: function (dw, dh) {
- var self = this, rect = self.layoutRect();
-
- return self.resizeTo(rect.w + dw, rect.h + dh);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getContentEditableBlockAction = function (forward, elm) {
+ if (forward && $_ey7ka11qjfuw8ldg.isContentEditableFalse(elm.nextSibling)) {
+ return Option.some(DeleteAction.moveToElement(elm.nextSibling));
+ } else if (forward === false && $_ey7ka11qjfuw8ldg.isContentEditableFalse(elm.previousSibling)) {
+ return Option.some(DeleteAction.moveToElement(elm.previousSibling));
+ } else {
+ return Option.none();
+ }
+ };
+ var skipMoveToActionFromInlineCefToContent = function (root, from, deleteAction) {
+ return deleteAction.fold(function (elm) {
+ return Option.some(DeleteAction.remove(elm));
+ }, function (elm) {
+ return Option.some(DeleteAction.moveToElement(elm));
+ }, function (to) {
+ if (isInSameBlock(from, to, root)) {
+ return Option.none();
+ } else {
+ return Option.some(DeleteAction.moveToPosition(to));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- }
-);
-/**
- * FloatPanel.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var getContentEditableAction = function (root, forward, from) {
+ if (isAtContentEditableBlockCaret(forward, from)) {
+ return getContentEditableBlockAction(forward, from.getNode(forward === false)).fold(function () {
+ return findCefPosition(root, forward, from);
+ }, Option.some);
+ } else {
+ return findCefPosition(root, forward, from).bind(function (deleteAction) {
+ return skipMoveToActionFromInlineCefToContent(root, from, deleteAction);
+ });
+ }
+ };
+ var read$1 = function (root, forward, rng) {
+ var normalizedRange = normalizeRange(forward ? 1 : -1, root, rng);
+ var from = CaretPosition$1.fromRangeStart(normalizedRange);
+ if (forward === false && isAfterContentEditableFalse(from)) {
+ return Option.some(DeleteAction.remove(from.getNode(true)));
+ } else if (forward && isBeforeContentEditableFalse(from)) {
+ return Option.some(DeleteAction.remove(from.getNode()));
+ } else {
+ return getContentEditableAction(root, forward, from);
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * This class creates a floating panel.
- *
- * @-x-less FloatPanel.less
- * @class tinymce.ui.FloatPanel
- * @extends tinymce.ui.Panel
- * @mixes tinymce.ui.Movable
- * @mixes tinymce.ui.Resizable
- */
-define(
- 'tinymce.core.ui.FloatPanel',
- [
- "tinymce.core.ui.Panel",
- "tinymce.core.ui.Movable",
- "tinymce.core.ui.Resizable",
- "tinymce.core.ui.DomUtils",
- "tinymce.core.dom.DomQuery",
- "tinymce.core.util.Delay"
- ],
- function (Panel, Movable, Resizable, DomUtils, $, Delay) {
- "use strict";
-
- var documentClickHandler, documentScrollHandler, windowResizeHandler, visiblePanels = [];
- var zOrder = [], hasModal;
-
- function isChildOf(ctrl, parent) {
- while (ctrl) {
- if (ctrl == parent) {
- return true;
- }
-
- ctrl = ctrl.parent();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var needsReposition = function (pos, elm) {
+ var container = pos.container();
+ var offset = pos.offset();
+ return CaretPosition$1.isTextPosition(pos) === false && container === elm.parentNode && offset > CaretPosition$1.before(elm).offset();
+ };
+ var reposition = function (elm, pos) {
+ return needsReposition(pos, elm) ? CaretPosition$1(pos.container(), pos.offset() - 1) : pos;
+ };
+ var beforeOrStartOf = function (node) {
+ return $_ey7ka11qjfuw8ldg.isText(node) ? CaretPosition$1(node, 0) : CaretPosition$1.before(node);
+ };
+ var afterOrEndOf = function (node) {
+ return $_ey7ka11qjfuw8ldg.isText(node) ? CaretPosition$1(node, node.data.length) : CaretPosition$1.after(node);
+ };
+ var getPreviousSiblingCaretPosition = function (elm) {
+ if (isCaretCandidate(elm.previousSibling)) {
+ return Option.some(afterOrEndOf(elm.previousSibling));
+ } else {
+ return elm.previousSibling ? $_25kl2c2cjfuw8ljh.lastPositionIn(elm.previousSibling) : Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function skipOrHidePanels(e) {
- // Hide any float panel when a click/focus out is out side that float panel and the
- // float panels direct parent for example a click on a menu button
- var i = visiblePanels.length;
-
- while (i--) {
- var panel = visiblePanels[i], clickCtrl = panel.getParentCtrl(e.target);
-
- if (panel.settings.autohide) {
- if (clickCtrl) {
- if (isChildOf(clickCtrl, panel) || panel.parent() === clickCtrl) {
- continue;
- }
- }
-
- e = panel.fire('autohide', { target: e.target });
- if (!e.isDefaultPrevented()) {
- panel.hide();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getNextSiblingCaretPosition = function (elm) {
+ if (isCaretCandidate(elm.nextSibling)) {
+ return Option.some(beforeOrStartOf(elm.nextSibling));
+ } else {
+ return elm.nextSibling ? $_25kl2c2cjfuw8ljh.firstPositionIn(elm.nextSibling) : Option.none();
+ }
+ };
+ var findCaretPositionBackwardsFromElm = function (rootElement, elm) {
+ var startPosition = CaretPosition$1.before(elm.previousSibling ? elm.previousSibling : elm.parentNode);
+ return $_25kl2c2cjfuw8ljh.prevPosition(rootElement, startPosition).fold(function () {
+ return $_25kl2c2cjfuw8ljh.nextPosition(rootElement, CaretPosition$1.after(elm));
+ }, Option.some);
+ };
+ var findCaretPositionForwardsFromElm = function (rootElement, elm) {
+ return $_25kl2c2cjfuw8ljh.nextPosition(rootElement, CaretPosition$1.after(elm)).fold(function () {
+ return $_25kl2c2cjfuw8ljh.prevPosition(rootElement, CaretPosition$1.before(elm));
+ }, Option.some);
+ };
+ var findCaretPositionBackwards = function (rootElement, elm) {
+ return getPreviousSiblingCaretPosition(elm).orThunk(function () {
+ return getNextSiblingCaretPosition(elm);
+ }).orThunk(function () {
+ return findCaretPositionBackwardsFromElm(rootElement, elm);
+ });
+ };
+ var findCaretPositionForward = function (rootElement, elm) {
+ return getNextSiblingCaretPosition(elm).orThunk(function () {
+ return getPreviousSiblingCaretPosition(elm);
+ }).orThunk(function () {
+ return findCaretPositionForwardsFromElm(rootElement, elm);
+ });
+ };
+ var findCaretPosition$1 = function (forward, rootElement, elm) {
+ return forward ? findCaretPositionForward(rootElement, elm) : findCaretPositionBackwards(rootElement, elm);
+ };
+ var findCaretPosOutsideElmAfterDelete = function (forward, rootElement, elm) {
+ return findCaretPosition$1(forward, rootElement, elm).map($_68e81l6jfuw8kyc.curry(reposition, elm));
+ };
+ var setSelection = function (editor, forward, pos) {
+ pos.fold(function () {
+ editor.focus();
+ }, function (pos) {
+ editor.selection.setRng(pos.toRange(), forward);
+ });
+ };
+ var eqRawNode = function (rawNode) {
+ return function (elm) {
+ return elm.dom() === rawNode;
+ };
+ };
+ var isBlock$2 = function (editor, elm) {
+ return elm && editor.schema.getBlockElements().hasOwnProperty($_eaw33d10jfuw8l9f.name(elm));
+ };
+ var paddEmptyBlock = function (elm) {
+ if ($_9f7o8q3ajfuw8lp7.isEmpty(elm)) {
+ var br = $_c9h6qlzjfuw8l98.fromHtml('<br data-mce-bogus="1">');
+ $_byg6a92ujfuw8lmi.empty(elm);
+ $_doli6x2kjfuw8lky.append(elm, br);
+ return Option.some(CaretPosition$1.before(br.dom()));
+ } else {
+ return Option.none();
+ }
+ };
+ var deleteNormalized = function (elm, afterDeletePosOpt) {
+ return $_5gv5dd26jfuw8li3.liftN([
+ $_2j4g5u17jfuw8lav.prevSibling(elm),
+ $_2j4g5u17jfuw8lav.nextSibling(elm),
+ afterDeletePosOpt
+ ], function (prev, next, afterDeletePos) {
+ var offset;
+ var prevNode = prev.dom();
+ var nextNode = next.dom();
+ if ($_ey7ka11qjfuw8ldg.isText(prevNode) && $_ey7ka11qjfuw8ldg.isText(nextNode)) {
+ offset = prevNode.data.length;
+ prevNode.appendData(nextNode.data);
+ $_byg6a92ujfuw8lmi.remove(next);
+ $_byg6a92ujfuw8lmi.remove(elm);
+ if (afterDeletePos.container() === nextNode) {
+ return CaretPosition$1(prevNode, offset);
+ } else {
+ return afterDeletePos;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ $_byg6a92ujfuw8lmi.remove(elm);
+ return afterDeletePos;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).orThunk(function () {
+ $_byg6a92ujfuw8lmi.remove(elm);
+ return afterDeletePosOpt;
+ });
+ };
+ var deleteElement = function (editor, forward, elm) {
+ var afterDeletePos = findCaretPosOutsideElmAfterDelete(forward, editor.getBody(), elm.dom());
+ var parentBlock = $_chabeg35jfuw8lo3.ancestor(elm, $_68e81l6jfuw8kyc.curry(isBlock$2, editor), eqRawNode(editor.getBody()));
+ var normalizedAfterDeletePos = deleteNormalized(elm, afterDeletePos);
+ if (editor.dom.isEmpty(editor.getBody())) {
+ editor.setContent('');
+ editor.selection.setCursorLocation();
+ } else {
+ parentBlock.bind(paddEmptyBlock).fold(function () {
+ setSelection(editor, forward, normalizedAfterDeletePos);
+ }, function (paddPos) {
+ setSelection(editor, forward, Option.some(paddPos));
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_ge41qn3jjfuw8lr1 = { deleteElement: deleteElement };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function bindDocumentClickHandler() {
-
- if (!documentClickHandler) {
- documentClickHandler = function (e) {
- // Gecko fires click event and in the wrong order on Mac so lets normalize
- if (e.button == 2) {
- return;
- }
-
- skipOrHidePanels(e);
- };
-
- $(document).on('click touchstart', documentClickHandler);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var deleteElement$1 = function (editor, forward) {
+ return function (element) {
+ editor._selectionOverrides.hideFakeCaret();
+ $_ge41qn3jjfuw8lr1.deleteElement(editor, forward, $_c9h6qlzjfuw8l98.fromDom(element));
+ return true;
+ };
+ };
+ var moveToElement = function (editor, forward) {
+ return function (element) {
+ var pos = forward ? CaretPosition$1.before(element) : CaretPosition$1.after(element);
+ editor.selection.setRng(pos.toRange());
+ return true;
+ };
+ };
+ var moveToPosition = function (editor) {
+ return function (pos) {
+ editor.selection.setRng(pos.toRange());
+ return true;
+ };
+ };
+ var backspaceDeleteCaret = function (editor, forward) {
+ var result = read$1(editor.getBody(), forward, editor.selection.getRng()).map(function (deleteAction) {
+ return deleteAction.fold(deleteElement$1(editor, forward), moveToElement(editor, forward), moveToPosition(editor));
+ });
+ return result.getOr(false);
+ };
+ var deleteOffscreenSelection = function (rootElement) {
+ $_9ek1bp4jfuw8kxg.each($_ryxde2gjfuw8lkk.descendants(rootElement, '.mce-offscreen-selection'), $_byg6a92ujfuw8lmi.remove);
+ };
+ var backspaceDeleteRange = function (editor, forward) {
+ var selectedElement = editor.selection.getNode();
+ if ($_ey7ka11qjfuw8ldg.isContentEditableFalse(selectedElement)) {
+ deleteOffscreenSelection($_c9h6qlzjfuw8l98.fromDom(editor.getBody()));
+ $_ge41qn3jjfuw8lr1.deleteElement(editor, forward, $_c9h6qlzjfuw8l98.fromDom(editor.selection.getNode()));
+ $_43wr4w34jfuw8lnu.paddEmptyBody(editor);
+ return true;
+ } else {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function bindDocumentScrollHandler() {
- if (!documentScrollHandler) {
- documentScrollHandler = function () {
- var i;
-
- i = visiblePanels.length;
- while (i--) {
- repositionPanel(visiblePanels[i]);
- }
- };
-
- $(window).on('scroll', documentScrollHandler);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getContentEditableRoot = function (root, node) {
+ while (node && node !== root) {
+ if ($_ey7ka11qjfuw8ldg.isContentEditableTrue(node) || $_ey7ka11qjfuw8ldg.isContentEditableFalse(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function bindWindowResizeHandler() {
- if (!windowResizeHandler) {
- var docElm = document.documentElement, clientWidth = docElm.clientWidth, clientHeight = docElm.clientHeight;
-
- windowResizeHandler = function () {
- // Workaround for #7065 IE 7 fires resize events event though the window wasn't resized
- if (!document.all || clientWidth != docElm.clientWidth || clientHeight != docElm.clientHeight) {
- clientWidth = docElm.clientWidth;
- clientHeight = docElm.clientHeight;
- FloatPanel.hideAll();
- }
- };
-
- $(window).on('resize', windowResizeHandler);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
+ };
+ var paddEmptyElement = function (editor) {
+ var br;
+ var ceRoot = getContentEditableRoot(editor.getBody(), editor.selection.getNode());
+ if ($_ey7ka11qjfuw8ldg.isContentEditableTrue(ceRoot) && editor.dom.isBlock(ceRoot) && editor.dom.isEmpty(ceRoot)) {
+ br = editor.dom.create('br', { 'data-mce-bogus': '1' });
+ editor.dom.setHTML(ceRoot, '');
+ ceRoot.appendChild(br);
+ editor.selection.setRng(CaretPosition$1.before(br).toRange());
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ };
+ var backspaceDelete$2 = function (editor, forward) {
+ if (editor.selection.isCollapsed()) {
+ return backspaceDeleteCaret(editor, forward);
+ } else {
+ return backspaceDeleteRange(editor, forward);
+ }
+ };
+ var $_a7skkj3gjfuw8lqf = {
+ backspaceDelete: backspaceDelete$2,
+ paddEmptyElement: paddEmptyElement
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Repositions the panel to the top of page if the panel is outside of the visual viewport. It will
- * also reposition all child panels of the current panel.
- */
- function repositionPanel(panel) {
- var scrollY = DomUtils.getViewPort().y;
-
- function toggleFixedChildPanels(fixed, deltaY) {
- var parent;
-
- for (var i = 0; i < visiblePanels.length; i++) {
- if (visiblePanels[i] != panel) {
- parent = visiblePanels[i].parent();
-
- while (parent && (parent = parent.parent())) {
- if (parent == panel) {
- visiblePanels[i].fixed(fixed).moveBy(0, deltaY).repaint();
- }
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isText$8 = $_ey7ka11qjfuw8ldg.isText;
+ var startsWithCaretContainer$1 = function (node) {
+ return isText$8(node) && node.data[0] === $_dpfg1321jfuw8lhn.ZWSP;
+ };
+ var endsWithCaretContainer$1 = function (node) {
+ return isText$8(node) && node.data[node.data.length - 1] === $_dpfg1321jfuw8lhn.ZWSP;
+ };
+ var createZwsp = function (node) {
+ return node.ownerDocument.createTextNode($_dpfg1321jfuw8lhn.ZWSP);
+ };
+ var insertBefore$1 = function (node) {
+ if (isText$8(node.previousSibling)) {
+ if (endsWithCaretContainer$1(node.previousSibling)) {
+ return node.previousSibling;
+ } else {
+ node.previousSibling.appendData($_dpfg1321jfuw8lhn.ZWSP);
+ return node.previousSibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (panel.settings.autofix) {
- if (!panel.state.get('fixed')) {
- panel._autoFixY = panel.layoutRect().y;
-
- if (panel._autoFixY < scrollY) {
- panel.fixed(true).layoutRect({ y: 0 }).repaint();
- toggleFixedChildPanels(true, scrollY - panel._autoFixY);
- }
- } else {
- if (panel._autoFixY > scrollY) {
- panel.fixed(false).layoutRect({ y: panel._autoFixY }).repaint();
- toggleFixedChildPanels(false, panel._autoFixY - scrollY);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (isText$8(node)) {
+ if (startsWithCaretContainer$1(node)) {
+ return node;
+ } else {
+ node.insertData(0, $_dpfg1321jfuw8lhn.ZWSP);
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ var newNode = createZwsp(node);
+ node.parentNode.insertBefore(newNode, node);
+ return newNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function addRemove(add, ctrl) {
- var i, zIndex = FloatPanel.zIndex || 0xFFFF, topModal;
-
- if (add) {
- zOrder.push(ctrl);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var insertAfter$1 = function (node) {
+ if (isText$8(node.nextSibling)) {
+ if (startsWithCaretContainer$1(node.nextSibling)) {
+ return node.nextSibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- i = zOrder.length;
-
- while (i--) {
- if (zOrder[i] === ctrl) {
- zOrder.splice(i, 1);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.nextSibling.insertData(0, $_dpfg1321jfuw8lhn.ZWSP);
+ return node.nextSibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (zOrder.length) {
- for (i = 0; i < zOrder.length; i++) {
- if (zOrder[i].modal) {
- zIndex++;
- topModal = zOrder[i];
- }
-
- zOrder[i].getEl().style.zIndex = zIndex;
- zOrder[i].zIndex = zIndex;
- zIndex++;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (isText$8(node)) {
+ if (endsWithCaretContainer$1(node)) {
+ return node;
+ } else {
+ node.appendData($_dpfg1321jfuw8lhn.ZWSP);
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var modalBlockEl = $('#' + ctrl.classPrefix + 'modal-block', ctrl.getContainerElm())[0];
-
- if (topModal) {
- $(modalBlockEl).css('z-index', topModal.zIndex - 1);
- } else if (modalBlockEl) {
- modalBlockEl.parentNode.removeChild(modalBlockEl);
- hasModal = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ var newNode = createZwsp(node);
+ if (node.nextSibling) {
+ node.parentNode.insertBefore(newNode, node.nextSibling);
+ } else {
+ node.parentNode.appendChild(newNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return newNode;
+ }
+ };
+ var insertInline$1 = function (before, node) {
+ return before ? insertBefore$1(node) : insertAfter$1(node);
+ };
+ var insertInlineBefore = $_68e81l6jfuw8kyc.curry(insertInline$1, true);
+ var insertInlineAfter = $_68e81l6jfuw8kyc.curry(insertInline$1, false);
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- FloatPanel.currentZIndex = zIndex;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var insertInlinePos = function (pos, before) {
+ if ($_ey7ka11qjfuw8ldg.isText(pos.container())) {
+ return insertInline$1(before, pos.container());
+ } else {
+ return insertInline$1(before, pos.getNode());
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var FloatPanel = Panel.extend({
- Mixins: [Movable, Resizable],
-
- /**
- * Constructs a new control instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Boolean} autohide Automatically hide the panel.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
- self._eventsRoot = self;
-
- self.classes.add('floatpanel');
-
- // Hide floatpanes on click out side the root button
- if (settings.autohide) {
- bindDocumentClickHandler();
- bindWindowResizeHandler();
- visiblePanels.push(self);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isPosCaretContainer = function (pos, caret) {
+ var caretNode = caret.get();
+ return caretNode && pos.container() === caretNode && isCaretContainerInline(caretNode);
+ };
+ var renderCaret = function (caret, location) {
+ return location.fold(function (element) {
+ $_dpm5zo2ajfuw8liw.remove(caret.get());
+ var text = insertInlineBefore(element);
+ caret.set(text);
+ return Option.some(CaretPosition$1(text, text.length - 1));
+ }, function (element) {
+ return $_25kl2c2cjfuw8ljh.firstPositionIn(element).map(function (pos) {
+ if (!isPosCaretContainer(pos, caret)) {
+ $_dpm5zo2ajfuw8liw.remove(caret.get());
+ var text = insertInlinePos(pos, true);
+ caret.set(text);
+ return CaretPosition$1(text, 1);
+ } else {
+ return CaretPosition$1(caret.get(), 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.autofix) {
- bindDocumentScrollHandler();
-
- self.on('move', function () {
- repositionPanel(this);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }, function (element) {
+ return $_25kl2c2cjfuw8ljh.lastPositionIn(element).map(function (pos) {
+ if (!isPosCaretContainer(pos, caret)) {
+ $_dpm5zo2ajfuw8liw.remove(caret.get());
+ var text = insertInlinePos(pos, false);
+ caret.set(text);
+ return CaretPosition$1(text, text.length - 1);
+ } else {
+ return CaretPosition$1(caret.get(), caret.get().length - 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.on('postrender show', function (e) {
- if (e.control == self) {
- var $modalBlockEl, prefix = self.classPrefix;
-
- if (self.modal && !hasModal) {
- $modalBlockEl = $('#' + prefix + 'modal-block', self.getContainerElm());
- if (!$modalBlockEl[0]) {
- $modalBlockEl = $(
- '<div id="' + prefix + 'modal-block" class="' + prefix + 'reset ' + prefix + 'fade"></div>'
- ).appendTo(self.getContainerElm());
- }
-
- Delay.setTimeout(function () {
- $modalBlockEl.addClass(prefix + 'in');
- $(self.getEl()).addClass(prefix + 'in');
- });
-
- hasModal = true;
- }
-
- addRemove(true, self);
- }
- });
-
- self.on('show', function () {
- self.parents().each(function (ctrl) {
- if (ctrl.state.get('fixed')) {
- self.fixed(true);
- return false;
- }
- });
- });
-
- if (settings.popover) {
- self._preBodyHtml = '<div class="' + self.classPrefix + 'arrow"></div>';
- self.classes.add('popover').add('bottom').add(self.isRtl() ? 'end' : 'start');
- }
-
- self.aria('label', settings.ariaLabel);
- self.aria('labelledby', self._id);
- self.aria('describedby', self.describedBy || self._id + '-none');
- },
-
- fixed: function (state) {
- var self = this;
-
- if (self.state.get('fixed') != state) {
- if (self.state.get('rendered')) {
- var viewport = DomUtils.getViewPort();
-
- if (state) {
- self.layoutRect().y -= viewport.y;
- } else {
- self.layoutRect().y += viewport.y;
- }
- }
-
- self.classes.toggle('fixed', state);
- self.state.set('fixed', state);
- }
-
- return self;
- },
-
- /**
- * Shows the current float panel.
- *
- * @method show
- * @return {tinymce.ui.FloatPanel} Current floatpanel instance.
- */
- show: function () {
- var self = this, i, state = self._super();
-
- i = visiblePanels.length;
- while (i--) {
- if (visiblePanels[i] === self) {
- break;
- }
- }
-
- if (i === -1) {
- visiblePanels.push(self);
- }
-
- return state;
- },
-
- /**
- * Hides the current float panel.
- *
- * @method hide
- * @return {tinymce.ui.FloatPanel} Current floatpanel instance.
- */
- hide: function () {
- removeVisiblePanel(this);
- addRemove(false, this);
-
- return this._super();
- },
-
- /**
- * Hide all visible float panels with he autohide setting enabled. This is for
- * manually hiding floating menus or panels.
- *
- * @method hideAll
- */
- hideAll: function () {
- FloatPanel.hideAll();
- },
-
- /**
- * Closes the float panel. This will remove the float panel from page and fire the close event.
- *
- * @method close
- */
- close: function () {
- var self = this;
-
- if (!self.fire('close').isDefaultPrevented()) {
- self.remove();
- addRemove(false, self);
- }
-
- return self;
- },
-
- /**
- * Removes the float panel from page.
- *
- * @method remove
- */
- remove: function () {
- removeVisiblePanel(this);
- this._super();
- },
-
- postRender: function () {
- var self = this;
-
- if (self.settings.bodyRole) {
- this.getEl('body').setAttribute('role', self.settings.bodyRole);
- }
-
- return self._super();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }, function (element) {
+ $_dpm5zo2ajfuw8liw.remove(caret.get());
+ var text = insertInlineAfter(element);
+ caret.set(text);
+ return Option.some(CaretPosition$1(text, 1));
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_40d5vv3ljfuw8lv1 = { renderCaret: renderCaret };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Hide all visible float panels with he autohide setting enabled. This is for
- * manually hiding floating menus or panels.
- *
- * @static
- * @method hideAll
- */
- FloatPanel.hideAll = function () {
- var i = visiblePanels.length;
-
- while (i--) {
- var panel = visiblePanels[i];
-
- if (panel && panel.settings.autohide) {
- panel.hide();
- visiblePanels.splice(i, 1);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var evaluateUntil = function (fns, args) {
+ for (var i = 0; i < fns.length; i++) {
+ var result = fns[i].apply(null, args);
+ if (result.isSome()) {
+ return result;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return Option.none();
+ };
+ var $_d9qu763ojfuw8lvl = { evaluateUntil: evaluateUntil };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function removeVisiblePanel(panel) {
- var i;
-
- i = visiblePanels.length;
- while (i--) {
- if (visiblePanels[i] === panel) {
- visiblePanels.splice(i, 1);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var Location = $_5ac1li3ijfuw8lqv.generate([
+ { before: ['element'] },
+ { start: ['element'] },
+ { end: ['element'] },
+ { after: ['element'] }
+ ]);
+ var rescope = function (rootNode, node) {
+ var parentBlock = getParentBlock(node, rootNode);
+ return parentBlock ? parentBlock : rootNode;
+ };
+ var before$3 = function (isInlineTarget, rootNode, pos) {
+ var nPos = $_exgtt937jfuw8loj.normalizeForwards(pos);
+ var scope = rescope(rootNode, nPos.container());
+ return $_exgtt937jfuw8loj.findRootInline(isInlineTarget, scope, nPos).fold(function () {
+ return $_25kl2c2cjfuw8ljh.nextPosition(scope, nPos).bind($_68e81l6jfuw8kyc.curry($_exgtt937jfuw8loj.findRootInline, isInlineTarget, scope)).map(function (inline) {
+ return Location.before(inline);
+ });
+ }, Option.none);
+ };
+ var isNotInsideFormatCaretContainer = function (rootNode, elm) {
+ return getParentCaretContainer(rootNode, elm) === null;
+ };
+ var findInsideRootInline = function (isInlineTarget, rootNode, pos) {
+ return $_exgtt937jfuw8loj.findRootInline(isInlineTarget, rootNode, pos).filter($_68e81l6jfuw8kyc.curry(isNotInsideFormatCaretContainer, rootNode));
+ };
+ var start = function (isInlineTarget, rootNode, pos) {
+ var nPos = $_exgtt937jfuw8loj.normalizeBackwards(pos);
+ return findInsideRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) {
+ var prevPos = $_25kl2c2cjfuw8ljh.prevPosition(inline, nPos);
+ return prevPos.isNone() ? Option.some(Location.start(inline)) : Option.none();
+ });
+ };
+ var end = function (isInlineTarget, rootNode, pos) {
+ var nPos = $_exgtt937jfuw8loj.normalizeForwards(pos);
+ return findInsideRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) {
+ var nextPos = $_25kl2c2cjfuw8ljh.nextPosition(inline, nPos);
+ return nextPos.isNone() ? Option.some(Location.end(inline)) : Option.none();
+ });
+ };
+ var after$3 = function (isInlineTarget, rootNode, pos) {
+ var nPos = $_exgtt937jfuw8loj.normalizeBackwards(pos);
+ var scope = rescope(rootNode, nPos.container());
+ return $_exgtt937jfuw8loj.findRootInline(isInlineTarget, scope, nPos).fold(function () {
+ return $_25kl2c2cjfuw8ljh.prevPosition(scope, nPos).bind($_68e81l6jfuw8kyc.curry($_exgtt937jfuw8loj.findRootInline, isInlineTarget, scope)).map(function (inline) {
+ return Location.after(inline);
+ });
+ }, Option.none);
+ };
+ var isValidLocation = function (location) {
+ return $_exgtt937jfuw8loj.isRtl(getElement(location)) === false;
+ };
+ var readLocation = function (isInlineTarget, rootNode, pos) {
+ var location = $_d9qu763ojfuw8lvl.evaluateUntil([
+ before$3,
+ start,
+ end,
+ after$3
+ ], [
+ isInlineTarget,
+ rootNode,
+ pos
+ ]);
+ return location.filter(isValidLocation);
+ };
+ var getElement = function (location) {
+ return location.fold($_68e81l6jfuw8kyc.identity, $_68e81l6jfuw8kyc.identity, $_68e81l6jfuw8kyc.identity, $_68e81l6jfuw8kyc.identity);
+ };
+ var getName = function (location) {
+ return location.fold($_68e81l6jfuw8kyc.constant('before'), $_68e81l6jfuw8kyc.constant('start'), $_68e81l6jfuw8kyc.constant('end'), $_68e81l6jfuw8kyc.constant('after'));
+ };
+ var outside = function (location) {
+ return location.fold(Location.before, Location.before, Location.after, Location.after);
+ };
+ var inside = function (location) {
+ return location.fold(Location.start, Location.start, Location.end, Location.end);
+ };
+ var isEq = function (location1, location2) {
+ return getName(location1) === getName(location2) && getElement(location1) === getElement(location2);
+ };
+ var betweenInlines = function (forward, isInlineTarget, rootNode, from, to, location) {
+ return $_5gv5dd26jfuw8li3.liftN([
+ $_exgtt937jfuw8loj.findRootInline(isInlineTarget, rootNode, from),
+ $_exgtt937jfuw8loj.findRootInline(isInlineTarget, rootNode, to)
+ ], function (fromInline, toInline) {
+ if (fromInline !== toInline && $_exgtt937jfuw8loj.hasSameParentBlock(rootNode, fromInline, toInline)) {
+ return Location.after(forward ? fromInline : toInline);
+ } else {
+ return location;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- i = zOrder.length;
- while (i--) {
- if (zOrder[i] === panel) {
- zOrder.splice(i, 1);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).getOr(location);
+ };
+ var skipNoMovement = function (fromLocation, toLocation) {
+ return fromLocation.fold($_68e81l6jfuw8kyc.constant(true), function (fromLocation) {
+ return !isEq(fromLocation, toLocation);
+ });
+ };
+ var findLocationTraverse = function (forward, isInlineTarget, rootNode, fromLocation, pos) {
+ var from = $_exgtt937jfuw8loj.normalizePosition(forward, pos);
+ var to = $_25kl2c2cjfuw8ljh.fromPosition(forward, rootNode, from).map($_68e81l6jfuw8kyc.curry($_exgtt937jfuw8loj.normalizePosition, forward));
+ var location = to.fold(function () {
+ return fromLocation.map(outside);
+ }, function (to) {
+ return readLocation(isInlineTarget, rootNode, to).map($_68e81l6jfuw8kyc.curry(betweenInlines, forward, isInlineTarget, rootNode, from, to)).filter($_68e81l6jfuw8kyc.curry(skipNoMovement, fromLocation));
+ });
+ return location.filter(isValidLocation);
+ };
+ var findLocationSimple = function (forward, location) {
+ if (forward) {
+ return location.fold($_68e81l6jfuw8kyc.compose(Option.some, Location.start), Option.none, $_68e81l6jfuw8kyc.compose(Option.some, Location.after), Option.none);
+ } else {
+ return location.fold(Option.none, $_68e81l6jfuw8kyc.compose(Option.some, Location.before), Option.none, $_68e81l6jfuw8kyc.compose(Option.some, Location.end));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var findLocation = function (forward, isInlineTarget, rootNode, pos) {
+ var from = $_exgtt937jfuw8loj.normalizePosition(forward, pos);
+ var fromLocation = readLocation(isInlineTarget, rootNode, from);
+ return readLocation(isInlineTarget, rootNode, from).bind($_68e81l6jfuw8kyc.curry(findLocationSimple, forward)).orThunk(function () {
+ return findLocationTraverse(forward, isInlineTarget, rootNode, fromLocation, pos);
+ });
+ };
+ var $_80edfj3njfuw8lvb = {
+ readLocation: readLocation,
+ findLocation: findLocation,
+ prevLocation: $_68e81l6jfuw8kyc.curry(findLocation, false),
+ nextLocation: $_68e81l6jfuw8kyc.curry(findLocation, true),
+ getElement: getElement,
+ outside: outside,
+ inside: inside
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return FloatPanel;
- }
-);
-
-/**
- * Window.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new window.
- *
- * @-x-less Window.less
- * @class tinymce.ui.Window
- * @extends tinymce.ui.FloatPanel
- */
-define(
- 'tinymce.core.ui.Window',
- [
- "tinymce.core.ui.FloatPanel",
- "tinymce.core.ui.Panel",
- "tinymce.core.ui.DomUtils",
- "tinymce.core.dom.DomQuery",
- "tinymce.core.ui.DragHelper",
- "tinymce.core.ui.BoxUtils",
- "tinymce.core.Env",
- "tinymce.core.util.Delay"
- ],
- function (FloatPanel, Panel, DomUtils, $, DragHelper, BoxUtils, Env, Delay) {
- "use strict";
-
- var windows = [], oldMetaValue = '';
-
- function toggleFullScreenState(state) {
- var noScaleMetaValue = 'width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0',
- viewport = $("meta[name=viewport]")[0],
- contentValue;
-
- if (Env.overrideViewPort === false) {
- return;
- }
-
- if (!viewport) {
- viewport = document.createElement('meta');
- viewport.setAttribute('name', 'viewport');
- document.getElementsByTagName('head')[0].appendChild(viewport);
- }
-
- contentValue = viewport.getAttribute('content');
- if (contentValue && typeof oldMetaValue != 'undefined') {
- oldMetaValue = contentValue;
- }
-
- viewport.setAttribute('content', state ? noScaleMetaValue : oldMetaValue);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasSelectionModifyApi = function (editor) {
+ return $_16i8k47jfuw8kyi.isFunction(editor.selection.getSel().modify);
+ };
+ var moveRel = function (forward, selection, pos) {
+ var delta = forward ? 1 : -1;
+ selection.setRng(CaretPosition$1(pos.container(), pos.offset() + delta).toRange());
+ selection.getSel().modify('move', forward ? 'forward' : 'backward', 'word');
+ return true;
+ };
+ var moveByWord = function (forward, editor) {
+ var rng = editor.selection.getRng();
+ var pos = forward ? CaretPosition$1.fromRangeEnd(rng) : CaretPosition$1.fromRangeStart(rng);
+ if (!hasSelectionModifyApi(editor)) {
+ return false;
+ } else if (forward && isBeforeInline(pos)) {
+ return moveRel(true, editor.selection, pos);
+ } else if (!forward && isAfterInline(pos)) {
+ return moveRel(false, editor.selection, pos);
+ } else {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_9q8tuu3qjfuw8lvw = {
+ hasSelectionModifyApi: hasSelectionModifyApi,
+ moveByWord: moveByWord
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function toggleBodyFullScreenClasses(classPrefix, state) {
- if (checkFullscreenWindows() && state === false) {
- $([document.documentElement, document.body]).removeClass(classPrefix + 'fullscreen');
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setCaretPosition = function (editor, pos) {
+ var rng = editor.dom.createRng();
+ rng.setStart(pos.container(), pos.offset());
+ rng.setEnd(pos.container(), pos.offset());
+ editor.selection.setRng(rng);
+ };
+ var isFeatureEnabled = function (editor) {
+ return editor.settings.inline_boundaries !== false;
+ };
+ var setSelected = function (state, elm) {
+ if (state) {
+ elm.setAttribute('data-mce-selected', 'inline-boundary');
+ } else {
+ elm.removeAttribute('data-mce-selected');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function checkFullscreenWindows() {
- for (var i = 0; i < windows.length; i++) {
- if (windows[i]._fullscreen) {
- return true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var renderCaretLocation = function (editor, caret, location) {
+ return $_40d5vv3ljfuw8lv1.renderCaret(caret, location).map(function (pos) {
+ setCaretPosition(editor, pos);
+ return location;
+ });
+ };
+ var findLocation$1 = function (editor, caret, forward) {
+ var rootNode = editor.getBody();
+ var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());
+ var isInlineTarget = $_68e81l6jfuw8kyc.curry($_exgtt937jfuw8loj.isInlineTarget, editor);
+ var location = $_80edfj3njfuw8lvb.findLocation(forward, isInlineTarget, rootNode, from);
+ return location.bind(function (location) {
+ return renderCaretLocation(editor, caret, location);
+ });
+ };
+ var toggleInlines = function (isInlineTarget, dom, elms) {
+ var selectedInlines = $_9ek1bp4jfuw8kxg.filter(dom.select('*[data-mce-selected="inline-boundary"]'), isInlineTarget);
+ var targetInlines = $_9ek1bp4jfuw8kxg.filter(elms, isInlineTarget);
+ $_9ek1bp4jfuw8kxg.each($_9ek1bp4jfuw8kxg.difference(selectedInlines, targetInlines), $_68e81l6jfuw8kyc.curry(setSelected, false));
+ $_9ek1bp4jfuw8kxg.each($_9ek1bp4jfuw8kxg.difference(targetInlines, selectedInlines), $_68e81l6jfuw8kyc.curry(setSelected, true));
+ };
+ var safeRemoveCaretContainer = function (editor, caret) {
+ if (editor.selection.isCollapsed() && editor.composing !== true && caret.get()) {
+ var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng());
+ if (CaretPosition$1.isTextPosition(pos) && $_exgtt937jfuw8loj.isAtZwsp(pos) === false) {
+ setCaretPosition(editor, $_dpm5zo2ajfuw8liw.removeAndReposition(caret.get(), pos));
+ caret.set(null);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return false;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function handleWindowResize() {
- if (!Env.desktop) {
- var lastSize = {
- w: window.innerWidth,
- h: window.innerHeight
- };
-
- Delay.setInterval(function () {
- var w = window.innerWidth,
- h = window.innerHeight;
-
- if (lastSize.w != w || lastSize.h != h) {
- lastSize = {
- w: w,
- h: h
- };
-
- $(window).trigger('resize');
- }
- }, 100);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var renderInsideInlineCaret = function (isInlineTarget, editor, caret, elms) {
+ if (editor.selection.isCollapsed()) {
+ var inlines = $_9ek1bp4jfuw8kxg.filter(elms, isInlineTarget);
+ $_9ek1bp4jfuw8kxg.each(inlines, function (inline) {
+ var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng());
+ $_80edfj3njfuw8lvb.readLocation(isInlineTarget, editor.getBody(), pos).bind(function (location) {
+ return renderCaretLocation(editor, caret, location);
+ });
+ });
+ }
+ };
+ var move = function (editor, caret, forward) {
+ return function () {
+ return isFeatureEnabled(editor) ? findLocation$1(editor, caret, forward).isSome() : false;
+ };
+ };
+ var moveWord = function (forward, editor, caret) {
+ return function () {
+ return isFeatureEnabled(editor) ? $_9q8tuu3qjfuw8lvw.moveByWord(forward, editor) : false;
+ };
+ };
+ var setupSelectedState = function (editor) {
+ var caret = Cell(null);
+ var isInlineTarget = $_68e81l6jfuw8kyc.curry($_exgtt937jfuw8loj.isInlineTarget, editor);
+ editor.on('NodeChange', function (e) {
+ if (isFeatureEnabled(editor)) {
+ toggleInlines(isInlineTarget, editor.dom, e.parents);
+ safeRemoveCaretContainer(editor, caret);
+ renderInsideInlineCaret(isInlineTarget, editor, caret, e.parents);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ return caret;
+ };
+ var moveNextWord = $_68e81l6jfuw8kyc.curry(moveWord, true);
+ var movePrevWord = $_68e81l6jfuw8kyc.curry(moveWord, false);
+ var $_enc4983pjfuw8lvo = {
+ move: move,
+ moveNextWord: moveNextWord,
+ movePrevWord: movePrevWord,
+ setupSelectedState: setupSelectedState,
+ setCaretPosition: setCaretPosition
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function reposition() {
- var i, rect = DomUtils.getWindowSize(), layoutRect;
-
- for (i = 0; i < windows.length; i++) {
- layoutRect = windows[i].layoutRect();
-
- windows[i].moveTo(
- windows[i].settings.x || Math.max(0, rect.w / 2 - layoutRect.w / 2),
- windows[i].settings.y || Math.max(0, rect.h / 2 - layoutRect.h / 2)
- );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isFeatureEnabled$1 = function (editor) {
+ return editor.settings.inline_boundaries !== false;
+ };
+ var rangeFromPositions = function (from, to) {
+ var range = document.createRange();
+ range.setStart(from.container(), from.offset());
+ range.setEnd(to.container(), to.offset());
+ return range;
+ };
+ var hasOnlyTwoOrLessPositionsLeft = function (elm) {
+ return $_5gv5dd26jfuw8li3.liftN([
+ $_25kl2c2cjfuw8ljh.firstPositionIn(elm),
+ $_25kl2c2cjfuw8ljh.lastPositionIn(elm)
+ ], function (firstPos, lastPos) {
+ var normalizedFirstPos = $_exgtt937jfuw8loj.normalizePosition(true, firstPos);
+ var normalizedLastPos = $_exgtt937jfuw8loj.normalizePosition(false, lastPos);
+ return $_25kl2c2cjfuw8ljh.nextPosition(elm, normalizedFirstPos).map(function (pos) {
+ return pos.isEqual(normalizedLastPos);
+ }).getOr(true);
+ }).getOr(true);
+ };
+ var setCaretLocation = function (editor, caret) {
+ return function (location) {
+ return $_40d5vv3ljfuw8lv1.renderCaret(caret, location).map(function (pos) {
+ $_enc4983pjfuw8lvo.setCaretPosition(editor, pos);
+ return true;
+ }).getOr(false);
+ };
+ };
+ var deleteFromTo = function (editor, caret, from, to) {
+ var rootNode = editor.getBody();
+ var isInlineTarget = $_68e81l6jfuw8kyc.curry($_exgtt937jfuw8loj.isInlineTarget, editor);
+ editor.undoManager.ignore(function () {
+ editor.selection.setRng(rangeFromPositions(from, to));
+ editor.execCommand('Delete');
+ $_80edfj3njfuw8lvb.readLocation(isInlineTarget, rootNode, CaretPosition$1.fromRangeStart(editor.selection.getRng())).map($_80edfj3njfuw8lvb.inside).map(setCaretLocation(editor, caret));
+ });
+ editor.nodeChanged();
+ };
+ var rescope$1 = function (rootNode, node) {
+ var parentBlock = getParentBlock(node, rootNode);
+ return parentBlock ? parentBlock : rootNode;
+ };
+ var backspaceDeleteCollapsed = function (editor, caret, forward, from) {
+ var rootNode = rescope$1(editor.getBody(), from.container());
+ var isInlineTarget = $_68e81l6jfuw8kyc.curry($_exgtt937jfuw8loj.isInlineTarget, editor);
+ var fromLocation = $_80edfj3njfuw8lvb.readLocation(isInlineTarget, rootNode, from);
+ return fromLocation.bind(function (location) {
+ if (forward) {
+ return location.fold($_68e81l6jfuw8kyc.constant(Option.some($_80edfj3njfuw8lvb.inside(location))), Option.none, $_68e81l6jfuw8kyc.constant(Option.some($_80edfj3njfuw8lvb.outside(location))), Option.none);
+ } else {
+ return location.fold(Option.none, $_68e81l6jfuw8kyc.constant(Option.some($_80edfj3njfuw8lvb.outside(location))), Option.none, $_68e81l6jfuw8kyc.constant(Option.some($_80edfj3njfuw8lvb.inside(location))));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $(window).on('resize', reposition);
- }
-
- var Window = FloatPanel.extend({
- modal: true,
-
- Defaults: {
- border: 1,
- layout: 'flex',
- containerCls: 'panel',
- role: 'dialog',
- callbacks: {
- submit: function () {
- this.fire('submit', { data: this.toJSON() });
- },
-
- close: function () {
- this.close();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).map(setCaretLocation(editor, caret)).getOrThunk(function () {
+ var toPosition = $_25kl2c2cjfuw8ljh.navigate(forward, rootNode, from);
+ var toLocation = toPosition.bind(function (pos) {
+ return $_80edfj3njfuw8lvb.readLocation(isInlineTarget, rootNode, pos);
+ });
+ if (fromLocation.isSome() && toLocation.isSome()) {
+ return $_exgtt937jfuw8loj.findRootInline(isInlineTarget, rootNode, from).map(function (elm) {
+ if (hasOnlyTwoOrLessPositionsLeft(elm)) {
+ $_ge41qn3jjfuw8lr1.deleteElement(editor, forward, $_c9h6qlzjfuw8l98.fromDom(elm));
+ return true;
+ } else {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- },
-
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
-
- if (self.isRtl()) {
- self.classes.add('rtl');
- }
-
- self.classes.add('window');
- self.bodyClasses.add('window-body');
- self.state.set('fixed', true);
-
- // Create statusbar
- if (settings.buttons) {
- self.statusbar = new Panel({
- layout: 'flex',
- border: '1 0 0 0',
- spacing: 3,
- padding: 10,
- align: 'center',
- pack: self.isRtl() ? 'start' : 'end',
- defaults: {
- type: 'button'
- },
- items: settings.buttons
- });
-
- self.statusbar.classes.add('foot');
- self.statusbar.parent(self);
- }
-
- self.on('click', function (e) {
- var closeClass = self.classPrefix + 'close';
-
- if (DomUtils.hasClass(e.target, closeClass) || DomUtils.hasClass(e.target.parentNode, closeClass)) {
- self.close();
- }
- });
-
- self.on('cancel', function () {
- self.close();
- });
-
- self.aria('describedby', self.describedBy || self._id + '-none');
- self.aria('label', settings.title);
- self._fullscreen = false;
- },
-
- /**
- * Recalculates the positions of the controls in the current container.
- * This is invoked by the reflow method and shouldn't be called directly.
- *
- * @method recalc
- */
- recalc: function () {
- var self = this, statusbar = self.statusbar, layoutRect, width, x, needsRecalc;
-
- if (self._fullscreen) {
- self.layoutRect(DomUtils.getWindowSize());
- self.layoutRect().contentH = self.layoutRect().innerH;
- }
-
- self._super();
-
- layoutRect = self.layoutRect();
-
- // Resize window based on title width
- if (self.settings.title && !self._fullscreen) {
- width = layoutRect.headerW;
- if (width > layoutRect.w) {
- x = layoutRect.x - Math.max(0, width / 2);
- self.layoutRect({ w: width, x: x });
- needsRecalc = true;
- }
- }
-
- // Resize window based on statusbar width
- if (statusbar) {
- statusbar.layoutRect({ w: self.layoutRect().innerW }).recalc();
-
- width = statusbar.layoutRect().minW + layoutRect.deltaW;
- if (width > layoutRect.w) {
- x = layoutRect.x - Math.max(0, width - layoutRect.w);
- self.layoutRect({ w: width, x: x });
- needsRecalc = true;
- }
- }
-
- // Recalc body and disable auto resize
- if (needsRecalc) {
- self.recalc();
- }
- },
-
- /**
- * Initializes the current controls layout rect.
- * This will be executed by the layout managers to determine the
- * default minWidth/minHeight etc.
- *
- * @method initLayoutRect
- * @return {Object} Layout rect instance.
- */
- initLayoutRect: function () {
- var self = this, layoutRect = self._super(), deltaH = 0, headEl;
-
- // Reserve vertical space for title
- if (self.settings.title && !self._fullscreen) {
- headEl = self.getEl('head');
-
- var size = DomUtils.getSize(headEl);
-
- layoutRect.headerW = size.width;
- layoutRect.headerH = size.height;
-
- deltaH += layoutRect.headerH;
- }
-
- // Reserve vertical space for statusbar
- if (self.statusbar) {
- deltaH += self.statusbar.layoutRect().h;
- }
-
- layoutRect.deltaH += deltaH;
- layoutRect.minH += deltaH;
- //layoutRect.innerH -= deltaH;
- layoutRect.h += deltaH;
-
- var rect = DomUtils.getWindowSize();
-
- layoutRect.x = self.settings.x || Math.max(0, rect.w / 2 - layoutRect.w / 2);
- layoutRect.y = self.settings.y || Math.max(0, rect.h / 2 - layoutRect.h / 2);
-
- return layoutRect;
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, layout = self._layout, id = self._id, prefix = self.classPrefix;
- var settings = self.settings, headerHtml = '', footerHtml = '', html = settings.html;
-
- self.preRender();
- layout.preRender(self);
-
- if (settings.title) {
- headerHtml = (
- '<div id="' + id + '-head" class="' + prefix + 'window-head">' +
- '<div id="' + id + '-title" class="' + prefix + 'title">' + self.encode(settings.title) + '</div>' +
- '<div id="' + id + '-dragh" class="' + prefix + 'dragh"></div>' +
- '<button type="button" class="' + prefix + 'close" aria-hidden="true">' +
- '<i class="mce-ico mce-i-remove"></i>' +
- '</button>' +
- '</div>'
- );
- }
-
- if (settings.url) {
- html = '<iframe src="' + settings.url + '" tabindex="-1"></iframe>';
- }
-
- if (typeof html == "undefined") {
- html = layout.renderHtml(self);
- }
-
- if (self.statusbar) {
- footerHtml = self.statusbar.renderHtml();
- }
-
- return (
- '<div id="' + id + '" class="' + self.classes + '" hidefocus="1">' +
- '<div class="' + self.classPrefix + 'reset" role="application">' +
- headerHtml +
- '<div id="' + id + '-body" class="' + self.bodyClasses + '">' +
- html +
- '</div>' +
- footerHtml +
- '</div>' +
- '</div>'
- );
- },
-
- /**
- * Switches the window fullscreen mode.
- *
- * @method fullscreen
- * @param {Boolean} state True/false state.
- * @return {tinymce.ui.Window} Current window instance.
- */
- fullscreen: function (state) {
- var self = this, documentElement = document.documentElement, slowRendering, prefix = self.classPrefix, layoutRect;
-
- if (state != self._fullscreen) {
- $(window).on('resize', function () {
- var time;
-
- if (self._fullscreen) {
- // Time the layout time if it's to slow use a timeout to not hog the CPU
- if (!slowRendering) {
- time = new Date().getTime();
-
- var rect = DomUtils.getWindowSize();
- self.moveTo(0, 0).resizeTo(rect.w, rect.h);
-
- if ((new Date().getTime()) - time > 50) {
- slowRendering = true;
- }
- } else {
- if (!self._timer) {
- self._timer = Delay.setTimeout(function () {
- var rect = DomUtils.getWindowSize();
- self.moveTo(0, 0).resizeTo(rect.w, rect.h);
-
- self._timer = 0;
- }, 50);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).getOr(false);
+ } else {
+ return toLocation.bind(function (_) {
+ return toPosition.map(function (to) {
+ if (forward) {
+ deleteFromTo(editor, caret, from, to);
+ } else {
+ deleteFromTo(editor, caret, to, from);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- layoutRect = self.layoutRect();
- self._fullscreen = state;
-
- if (!state) {
- self.borderBox = BoxUtils.parseBox(self.settings.border);
- self.getEl('head').style.display = '';
- layoutRect.deltaH += layoutRect.headerH;
- $([documentElement, document.body]).removeClass(prefix + 'fullscreen');
- self.classes.remove('fullscreen');
- self.moveTo(self._initial.x, self._initial.y).resizeTo(self._initial.w, self._initial.h);
- } else {
- self._initial = { x: layoutRect.x, y: layoutRect.y, w: layoutRect.w, h: layoutRect.h };
-
- self.borderBox = BoxUtils.parseBox('0');
- self.getEl('head').style.display = 'none';
- layoutRect.deltaH -= layoutRect.headerH + 2;
- $([documentElement, document.body]).addClass(prefix + 'fullscreen');
- self.classes.add('fullscreen');
-
- var rect = DomUtils.getWindowSize();
- self.moveTo(0, 0).resizeTo(rect.w, rect.h);
- }
- }
-
- return self.reflow();
- },
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this, startPos;
-
- setTimeout(function () {
- self.classes.add('in');
- self.fire('open');
- }, 0);
-
- self._super();
-
- if (self.statusbar) {
- self.statusbar.postRender();
- }
-
- self.focus();
-
- this.dragHelper = new DragHelper(self._id + '-dragh', {
- start: function () {
- startPos = {
- x: self.layoutRect().x,
- y: self.layoutRect().y
- };
- },
-
- drag: function (e) {
- self.moveTo(startPos.x + e.deltaX, startPos.y + e.deltaY);
- }
- });
-
- self.on('submit', function (e) {
- if (!e.isDefaultPrevented()) {
- self.close();
- }
- });
-
- windows.push(self);
- toggleFullScreenState(true);
- },
-
- /**
- * Fires a submit event with the serialized form.
- *
- * @method submit
- * @return {Object} Event arguments object.
- */
- submit: function () {
- return this.fire('submit', { data: this.toJSON() });
- },
-
- /**
- * Removes the current control from DOM and from UI collections.
- *
- * @method remove
- * @return {tinymce.ui.Control} Current control instance.
- */
- remove: function () {
- var self = this, i;
-
- self.dragHelper.destroy();
- self._super();
-
- if (self.statusbar) {
- this.statusbar.remove();
- }
-
- toggleBodyFullScreenClasses(self.classPrefix, false);
-
- i = windows.length;
- while (i--) {
- if (windows[i] === self) {
- windows.splice(i, 1);
- }
- }
-
- toggleFullScreenState(windows.length > 0);
- },
-
- /**
- * Returns the contentWindow object of the iframe if it exists.
- *
- * @method getContentWindow
- * @return {Window} window object or null.
- */
- getContentWindow: function () {
- var ifr = this.getEl().getElementsByTagName('iframe')[0];
- return ifr ? ifr.contentWindow : null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).getOr(false);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var backspaceDelete$3 = function (editor, caret, forward) {
+ if (editor.selection.isCollapsed() && isFeatureEnabled$1(editor)) {
+ var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());
+ return backspaceDeleteCollapsed(editor, caret, forward, from);
+ }
+ return false;
+ };
+ var $_qeu9d3kjfuw8luq = { backspaceDelete: backspaceDelete$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- handleWindowResize();
-
- return Window;
- }
-);
-/**
- * MessageBox.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class is used to create MessageBoxes like alerts/confirms etc.
- *
- * @class tinymce.ui.MessageBox
- * @extends tinymce.ui.FloatPanel
- */
-define(
- 'tinymce.core.ui.MessageBox',
- [
- "tinymce.core.ui.Window"
- ],
- function (Window) {
- "use strict";
-
- var MessageBox = Window.extend({
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- */
- init: function (settings) {
- settings = {
- border: 1,
- padding: 20,
- layout: 'flex',
- pack: "center",
- align: "center",
- containerCls: 'panel',
- autoScroll: true,
- buttons: { type: "button", text: "Ok", action: "ok" },
- items: {
- type: "label",
- multiline: true,
- maxWidth: 500,
- maxHeight: 200
- }
- };
-
- this._super(settings);
- },
-
- Statics: {
- /**
- * Ok buttons constant.
- *
- * @static
- * @final
- * @field {Number} OK
- */
- OK: 1,
-
- /**
- * Ok/cancel buttons constant.
- *
- * @static
- * @final
- * @field {Number} OK_CANCEL
- */
- OK_CANCEL: 2,
-
- /**
- * yes/no buttons constant.
- *
- * @static
- * @final
- * @field {Number} YES_NO
- */
- YES_NO: 3,
-
- /**
- * yes/no/cancel buttons constant.
- *
- * @static
- * @final
- * @field {Number} YES_NO_CANCEL
- */
- YES_NO_CANCEL: 4,
-
- /**
- * Constructs a new message box and renders it to the body element.
- *
- * @static
- * @method msgBox
- * @param {Object} settings Name/value object with settings.
- */
- msgBox: function (settings) {
- var buttons, callback = settings.callback || function () { };
-
- function createButton(text, status, primary) {
- return {
- type: "button",
- text: text,
- subtype: primary ? 'primary' : '',
- onClick: function (e) {
- e.control.parents()[1].close();
- callback(status);
- }
- };
- }
-
- switch (settings.buttons) {
- case MessageBox.OK_CANCEL:
- buttons = [
- createButton('Ok', true, true),
- createButton('Cancel', false)
- ];
- break;
-
- case MessageBox.YES_NO:
- case MessageBox.YES_NO_CANCEL:
- buttons = [
- createButton('Yes', 1, true),
- createButton('No', 0)
- ];
-
- if (settings.buttons == MessageBox.YES_NO_CANCEL) {
- buttons.push(createButton('Cancel', -1));
- }
- break;
-
- default:
- buttons = [
- createButton('Ok', true, true)
- ];
- break;
- }
-
- return new Window({
- padding: 20,
- x: settings.x,
- y: settings.y,
- minWidth: 300,
- minHeight: 100,
- layout: "flex",
- pack: "center",
- align: "center",
- buttons: buttons,
- title: settings.title,
- role: 'alertdialog',
- items: {
- type: "label",
- multiline: true,
- maxWidth: 500,
- maxHeight: 200,
- text: settings.text
- },
- onPostRender: function () {
- this.aria('describedby', this.items()[0]._id);
- },
- onClose: settings.onClose,
- onCancel: function () {
- callback(false);
- }
- }).renderTo(document.body).reflow();
- },
-
- /**
- * Creates a new alert dialog.
- *
- * @method alert
- * @param {Object} settings Settings for the alert dialog.
- * @param {function} [callback] Callback to execute when the user makes a choice.
- */
- alert: function (settings, callback) {
- if (typeof settings == "string") {
- settings = { text: settings };
- }
-
- settings.callback = callback;
- return MessageBox.msgBox(settings);
- },
-
- /**
- * Creates a new confirm dialog.
- *
- * @method confirm
- * @param {Object} settings Settings for the confirm dialog.
- * @param {function} [callback] Callback to execute when the user makes a choice.
- */
- confirm: function (settings, callback) {
- if (typeof settings == "string") {
- settings = { text: settings };
- }
-
- settings.callback = callback;
- settings.buttons = MessageBox.OK_CANCEL;
-
- return MessageBox.msgBox(settings);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var tableCellRng = $_1a7eqh18jfuw8lb9.immutable('start', 'end');
+ var tableSelection = $_1a7eqh18jfuw8lb9.immutable('rng', 'table', 'cells');
+ var deleteAction = $_5ac1li3ijfuw8lqv.generate([
+ { removeTable: ['element'] },
+ { emptyCells: ['cells'] }
+ ]);
+ var isRootFromElement = function (root) {
+ return $_68e81l6jfuw8kyc.curry($_4fb96d1djfuw8lbl.eq, root);
+ };
+ var getClosestCell$1 = function (container, isRoot) {
+ return $_94zo1v3cjfuw8lpg.closest($_c9h6qlzjfuw8l98.fromDom(container), 'td,th', isRoot);
+ };
+ var getClosestTable = function (cell, isRoot) {
+ return $_94zo1v3cjfuw8lpg.ancestor(cell, 'table', isRoot);
+ };
+ var isExpandedCellRng = function (cellRng) {
+ return $_4fb96d1djfuw8lbl.eq(cellRng.start(), cellRng.end()) === false;
+ };
+ var getTableFromCellRng = function (cellRng, isRoot) {
+ return getClosestTable(cellRng.start(), isRoot).bind(function (startParentTable) {
+ return getClosestTable(cellRng.end(), isRoot).bind(function (endParentTable) {
+ return $_4fb96d1djfuw8lbl.eq(startParentTable, endParentTable) ? Option.some(startParentTable) : Option.none();
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return MessageBox;
- }
-);
-
-/**
- * WindowManagerImpl.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ui.WindowManagerImpl',
- [
- "tinymce.core.ui.Window",
- "tinymce.core.ui.MessageBox"
- ],
- function (Window, MessageBox) {
- return function (editor) {
- var open = function (args, params, closeCallback) {
- var win;
-
- args.title = args.title || ' ';
-
- // Handle URL
- args.url = args.url || args.file; // Legacy
- if (args.url) {
- args.width = parseInt(args.width || 320, 10);
- args.height = parseInt(args.height || 240, 10);
- }
-
- // Handle body
- if (args.body) {
- args.items = {
- defaults: args.defaults,
- type: args.bodyType || 'form',
- items: args.body,
- data: args.data,
- callbacks: args.commands
- };
- }
-
- if (!args.url && !args.buttons) {
- args.buttons = [
- {
- text: 'Ok', subtype: 'primary', onclick: function () {
- win.find('form')[0].submit();
- }
- },
-
- {
- text: 'Cancel', onclick: function () {
- win.close();
- }
- }
- ];
- }
-
- win = new Window(args);
-
- win.on('close', function () {
- closeCallback(win);
- });
-
- // Handle data
- if (args.data) {
- win.on('postRender', function () {
- this.find('*').each(function (ctrl) {
- var name = ctrl.name();
-
- if (name in args.data) {
- ctrl.value(args.data[name]);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getTableCells = function (table) {
+ return $_ryxde2gjfuw8lkk.descendants(table, 'td,th');
+ };
+ var getCellRangeFromStartTable = function (cellRng, isRoot) {
+ return getClosestTable(cellRng.start(), isRoot).bind(function (table) {
+ return $_9ek1bp4jfuw8kxg.last(getTableCells(table)).map(function (endCell) {
+ return tableCellRng(cellRng.start(), endCell);
+ });
+ });
+ };
+ var partialSelection = function (isRoot, rng) {
+ var startCell = getClosestCell$1(rng.startContainer, isRoot);
+ var endCell = getClosestCell$1(rng.endContainer, isRoot);
+ return rng.collapsed ? Option.none() : $_5gv5dd26jfuw8li3.liftN([
+ startCell,
+ endCell
+ ], tableCellRng).fold(function () {
+ return startCell.fold(function () {
+ return endCell.bind(function (endCell) {
+ return getClosestTable(endCell, isRoot).bind(function (table) {
+ return $_9ek1bp4jfuw8kxg.head(getTableCells(table)).map(function (startCell) {
+ return tableCellRng(startCell, endCell);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // store args and parameters
- win.features = args || {};
- win.params = params || {};
-
- win = win.renderTo().reflow();
-
- return win;
- };
-
- var alert = function (message, choiceCallback, closeCallback) {
- var win;
-
- win = MessageBox.alert(message, function () {
- choiceCallback();
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- win.on('close', function () {
- closeCallback(win);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, function (startCell) {
+ return getClosestTable(startCell, isRoot).bind(function (table) {
+ return $_9ek1bp4jfuw8kxg.last(getTableCells(table)).map(function (endCell) {
+ return tableCellRng(startCell, endCell);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }, function (cellRng) {
+ return isWithinSameTable(isRoot, cellRng) ? Option.none() : getCellRangeFromStartTable(cellRng, isRoot);
+ });
+ };
+ var isWithinSameTable = function (isRoot, cellRng) {
+ return getTableFromCellRng(cellRng, isRoot).isSome();
+ };
+ var getCellRng = function (rng, isRoot) {
+ var startCell = getClosestCell$1(rng.startContainer, isRoot);
+ var endCell = getClosestCell$1(rng.endContainer, isRoot);
+ return $_5gv5dd26jfuw8li3.liftN([
+ startCell,
+ endCell
+ ], tableCellRng).filter(isExpandedCellRng).filter(function (cellRng) {
+ return isWithinSameTable(isRoot, cellRng);
+ }).orThunk(function () {
+ return partialSelection(isRoot, rng);
+ });
+ };
+ var getTableSelectionFromCellRng = function (cellRng, isRoot) {
+ return getTableFromCellRng(cellRng, isRoot).map(function (table) {
+ return tableSelection(cellRng, table, getTableCells(table));
+ });
+ };
+ var getTableSelectionFromRng = function (root, rng) {
+ var isRoot = isRootFromElement(root);
+ return getCellRng(rng, isRoot).bind(function (cellRng) {
+ return getTableSelectionFromCellRng(cellRng, isRoot);
+ });
+ };
+ var getCellIndex = function (cells, cell) {
+ return $_9ek1bp4jfuw8kxg.findIndex(cells, function (x) {
+ return $_4fb96d1djfuw8lbl.eq(x, cell);
+ });
+ };
+ var getSelectedCells = function (tableSelection) {
+ return $_5gv5dd26jfuw8li3.liftN([
+ getCellIndex(tableSelection.cells(), tableSelection.rng().start()),
+ getCellIndex(tableSelection.cells(), tableSelection.rng().end())
+ ], function (startIndex, endIndex) {
+ return tableSelection.cells().slice(startIndex, endIndex + 1);
+ });
+ };
+ var getAction = function (tableSelection) {
+ return getSelectedCells(tableSelection).map(function (selected) {
+ var cells = tableSelection.cells();
+ return selected.length === cells.length ? deleteAction.removeTable(tableSelection.table()) : deleteAction.emptyCells(selected);
+ });
+ };
+ var getActionFromCells = function (cells) {
+ return deleteAction.emptyCells(cells);
+ };
+ var getActionFromRange = function (root, rng) {
+ return getTableSelectionFromRng(root, rng).bind(getAction);
+ };
+ var $_71oei73sjfuw8lwd = {
+ getActionFromRange: getActionFromRange,
+ getActionFromCells: getActionFromCells
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return win;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getRanges = function (selection) {
+ var ranges = [];
+ if (selection) {
+ for (var i = 0; i < selection.rangeCount; i++) {
+ ranges.push(selection.getRangeAt(i));
+ }
+ }
+ return ranges;
+ };
+ var getSelectedNodes = function (ranges) {
+ return $_9ek1bp4jfuw8kxg.bind(ranges, function (range) {
+ var node = getSelectedNode(range);
+ return node ? [$_c9h6qlzjfuw8l98.fromDom(node)] : [];
+ });
+ };
+ var hasMultipleRanges = function (selection) {
+ return getRanges(selection).length > 1;
+ };
+ var $_asx40h3ujfuw8lx3 = {
+ getRanges: getRanges,
+ getSelectedNodes: getSelectedNodes,
+ hasMultipleRanges: hasMultipleRanges
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var confirm = function (message, choiceCallback, closeCallback) {
- var win;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getCellsFromRanges = function (ranges) {
+ return $_9ek1bp4jfuw8kxg.filter($_asx40h3ujfuw8lx3.getSelectedNodes(ranges), isTableCell);
+ };
+ var getCellsFromElement = function (elm) {
+ var selectedCells = $_ryxde2gjfuw8lkk.descendants(elm, 'td[data-mce-selected],th[data-mce-selected]');
+ return selectedCells;
+ };
+ var getCellsFromElementOrRanges = function (ranges, element) {
+ var selectedCells = getCellsFromElement(element);
+ var rangeCells = getCellsFromRanges(ranges);
+ return selectedCells.length > 0 ? selectedCells : rangeCells;
+ };
+ var getCellsFromEditor = function (editor) {
+ return getCellsFromElementOrRanges($_asx40h3ujfuw8lx3.getRanges(editor.selection.getSel()), $_c9h6qlzjfuw8l98.fromDom(editor.getBody()));
+ };
+ var $_6icyb83tjfuw8lwy = {
+ getCellsFromRanges: getCellsFromRanges,
+ getCellsFromElement: getCellsFromElement,
+ getCellsFromElementOrRanges: getCellsFromElementOrRanges,
+ getCellsFromEditor: getCellsFromEditor
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- win = MessageBox.confirm(message, function (state) {
- choiceCallback(state);
- });
-
- win.on('close', function () {
- closeCallback(win);
- });
-
- return win;
- };
-
- var close = function (window) {
- window.close();
- };
-
- var getParams = function (window) {
- return window.params;
- };
-
- var setParams = function (window, params) {
- window.params = params;
- };
-
- return {
- open: open,
- alert: alert,
- confirm: confirm,
- close: close,
- getParams: getParams,
- setParams: setParams
- };
- };
- }
-);
-
-/**
- * WindowManager.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class handles the creation of native windows and dialogs. This class can be extended to provide for example inline dialogs.
- *
- * @class tinymce.WindowManager
- * @example
- * // Opens a new dialog with the file.htm file and the size 320x240
- * // It also adds a custom parameter this can be retrieved by using tinyMCEPopup.getWindowArg inside the dialog.
- * tinymce.activeEditor.windowManager.open({
- * url: 'file.htm',
- * width: 320,
- * height: 240
- * }, {
- * custom_param: 1
- * });
- *
- * // Displays an alert box using the active editors window manager instance
- * tinymce.activeEditor.windowManager.alert('Hello world!');
- *
- * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm
- * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s, ) {
- * if (s)
- * tinymce.activeEditor.windowManager.alert("Ok");
- * else
- * tinymce.activeEditor.windowManager.alert("Cancel");
- * });
- */
-define(
- 'tinymce.core.api.WindowManager',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Option',
- 'tinymce.core.ui.WindowManagerImpl'
- ],
- function (Arr, Option, WindowManagerImpl) {
- return function (editor) {
- var windows = [];
-
- var getImplementation = function () {
- var theme = editor.theme;
- return theme && theme.getWindowManagerImpl ? theme.getWindowManagerImpl() : WindowManagerImpl(editor);
- };
-
- var funcBind = function (scope, f) {
- return function () {
- return f ? f.apply(scope, arguments) : undefined;
- };
- };
-
- var fireOpenEvent = function (win) {
- editor.fire('OpenWindow', {
- win: win
- });
- };
-
- var fireCloseEvent = function (win) {
- editor.fire('CloseWindow', {
- win: win
- });
- };
-
- var addWindow = function (win) {
- windows.push(win);
- fireOpenEvent(win);
- };
-
- var closeWindow = function (win) {
- Arr.findIndex(windows, function (otherWindow) {
- return otherWindow === win;
- }).each(function (index) {
- // Mutate here since third party might have stored away the window array, consider breaking this api
- windows.splice(index, 1);
-
- fireCloseEvent(win);
-
- // Move focus back to editor when the last window is closed
- if (windows.length === 0) {
- editor.focus();
- }
- });
- };
-
- var getTopWindow = function () {
- return Option.from(windows[windows.length - 1]);
- };
-
- var open = function (args, params) {
- editor.editorManager.setActive(editor);
-
- // Takes a snapshot in the FocusManager of the selection before focus is lost to dialog
- if (windows.length === 0) {
- editor.nodeChanged();
- }
-
- var win = getImplementation().open(args, params, closeWindow);
- addWindow(win);
- return win;
- };
-
- var alert = function (message, callback, scope) {
- var win = getImplementation().alert(message, funcBind(scope ? scope : this, callback), closeWindow);
- addWindow(win);
- };
-
- var confirm = function (message, callback, scope) {
- var win = getImplementation().confirm(message, funcBind(scope ? scope : this, callback), closeWindow);
- addWindow(win);
- };
-
- var close = function () {
- getTopWindow().each(function (win) {
- getImplementation().close(win);
- closeWindow(win);
- });
- };
-
- var getParams = function () {
- return getTopWindow().map(getImplementation().getParams).getOr(null);
- };
-
- var setParams = function (params) {
- getTopWindow().each(function (win) {
- getImplementation().setParams(win, params);
- });
- };
-
- var getWindows = function () {
- return windows;
- };
-
- editor.on('remove', function () {
- Arr.each(windows.slice(0), function (win) {
- getImplementation().close(win);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var emptyCells = function (editor, cells) {
+ $_9ek1bp4jfuw8kxg.each(cells, $_5udnjn2tjfuw8lm4.fillWithPaddingBr);
+ editor.selection.setCursorLocation(cells[0].dom(), 0);
+ return true;
+ };
+ var deleteTableElement = function (editor, table) {
+ $_ge41qn3jjfuw8lr1.deleteElement(editor, false, table);
+ return true;
+ };
+ var deleteCellRange = function (editor, rootElm, rng) {
+ return $_71oei73sjfuw8lwd.getActionFromRange(rootElm, rng).map(function (action) {
+ return action.fold($_68e81l6jfuw8kyc.curry(deleteTableElement, editor), $_68e81l6jfuw8kyc.curry(emptyCells, editor));
+ });
+ };
+ var deleteCaptionRange = function (editor, caption) {
+ return emptyElement(editor, caption);
+ };
+ var deleteTableRange = function (editor, rootElm, rng, startElm) {
+ return getParentCaption(rootElm, startElm).fold(function () {
+ return deleteCellRange(editor, rootElm, rng);
+ }, function (caption) {
+ return deleteCaptionRange(editor, caption);
+ }).getOr(false);
+ };
+ var deleteRange$1 = function (editor, startElm) {
+ var rootNode = $_c9h6qlzjfuw8l98.fromDom(editor.getBody());
+ var rng = editor.selection.getRng();
+ var selectedCells = $_6icyb83tjfuw8lwy.getCellsFromEditor(editor);
+ return selectedCells.length !== 0 ? emptyCells(editor, selectedCells) : deleteTableRange(editor, rootNode, rng, startElm);
+ };
+ var getParentCell = function (rootElm, elm) {
+ return $_9ek1bp4jfuw8kxg.find($_3t5pi43ejfuw8lq0.parentsAndSelf(elm, rootElm), isTableCell);
+ };
+ var getParentCaption = function (rootElm, elm) {
+ return $_9ek1bp4jfuw8kxg.find($_3t5pi43ejfuw8lq0.parentsAndSelf(elm, rootElm), function (elm) {
+ return $_eaw33d10jfuw8l9f.name(elm) === 'caption';
+ });
+ };
+ var deleteBetweenCells = function (editor, rootElm, forward, fromCell, from) {
+ return $_25kl2c2cjfuw8ljh.navigate(forward, editor.getBody(), from).bind(function (to) {
+ return getParentCell(rootElm, $_c9h6qlzjfuw8l98.fromDom(to.getNode())).map(function (toCell) {
+ return $_4fb96d1djfuw8lbl.eq(toCell, fromCell) === false;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var emptyElement = function (editor, elm) {
+ $_5udnjn2tjfuw8lm4.fillWithPaddingBr(elm);
+ editor.selection.setCursorLocation(elm.dom(), 0);
+ return Option.some(true);
+ };
+ var isDeleteOfLastCharPos = function (fromCaption, forward, from, to) {
+ return $_25kl2c2cjfuw8ljh.firstPositionIn(fromCaption.dom()).bind(function (first) {
+ return $_25kl2c2cjfuw8ljh.lastPositionIn(fromCaption.dom()).map(function (last) {
+ return forward ? from.isEqual(first) && to.isEqual(last) : from.isEqual(last) && to.isEqual(first);
+ });
+ }).getOr(true);
+ };
+ var emptyCaretCaption = function (editor, elm) {
+ return emptyElement(editor, elm);
+ };
+ var validateCaretCaption = function (rootElm, fromCaption, to) {
+ return getParentCaption(rootElm, $_c9h6qlzjfuw8l98.fromDom(to.getNode())).map(function (toCaption) {
+ return $_4fb96d1djfuw8lbl.eq(toCaption, fromCaption) === false;
+ });
+ };
+ var deleteCaretInsideCaption = function (editor, rootElm, forward, fromCaption, from) {
+ return $_25kl2c2cjfuw8ljh.navigate(forward, editor.getBody(), from).bind(function (to) {
+ return isDeleteOfLastCharPos(fromCaption, forward, from, to) ? emptyCaretCaption(editor, fromCaption) : validateCaretCaption(rootElm, fromCaption, to);
+ }).or(Option.some(true));
+ };
+ var deleteCaretCells = function (editor, forward, rootElm, startElm) {
+ var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());
+ return getParentCell(rootElm, startElm).bind(function (fromCell) {
+ return $_9f7o8q3ajfuw8lp7.isEmpty(fromCell) ? emptyElement(editor, fromCell) : deleteBetweenCells(editor, rootElm, forward, fromCell, from);
+ });
+ };
+ var deleteCaretCaption = function (editor, forward, rootElm, fromCaption) {
+ var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());
+ return $_9f7o8q3ajfuw8lp7.isEmpty(fromCaption) ? emptyElement(editor, fromCaption) : deleteCaretInsideCaption(editor, rootElm, forward, fromCaption, from);
+ };
+ var deleteCaret = function (editor, forward, startElm) {
+ var rootElm = $_c9h6qlzjfuw8l98.fromDom(editor.getBody());
+ return getParentCaption(rootElm, startElm).fold(function () {
+ return deleteCaretCells(editor, forward, rootElm, startElm);
+ }, function (fromCaption) {
+ return deleteCaretCaption(editor, forward, rootElm, fromCaption);
+ }).getOr(false);
+ };
+ var backspaceDelete$4 = function (editor, forward) {
+ var startElm = $_c9h6qlzjfuw8l98.fromDom(editor.selection.getStart(true));
+ var cells = $_6icyb83tjfuw8lwy.getCellsFromEditor(editor);
+ return editor.selection.isCollapsed() && cells.length === 0 ? deleteCaret(editor, forward, startElm) : deleteRange$1(editor, startElm);
+ };
+ var $_dt1e6j3rjfuw8lw0 = { backspaceDelete: backspaceDelete$4 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- // Used by the legacy3x compat layer and possible third party
- // TODO: Deprecate this, and possible switch to a immutable window array for getWindows
- windows: windows,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var nativeCommand = function (editor, command) {
+ editor.getDoc().execCommand(command, false, null);
+ };
+ var deleteCommand = function (editor) {
+ if ($_a7skkj3gjfuw8lqf.backspaceDelete(editor, false)) {
+ return;
+ } else if ($_qeu9d3kjfuw8luq.backspaceDelete(editor, false)) {
+ return;
+ } else if ($_cwwff132jfuw8ln7.backspaceDelete(editor, false)) {
+ return;
+ } else if ($_dt1e6j3rjfuw8lw0.backspaceDelete(editor)) {
+ return;
+ } else if ($_f34seo3fjfuw8lq6.backspaceDelete(editor, false)) {
+ return;
+ } else {
+ nativeCommand(editor, 'Delete');
+ $_43wr4w34jfuw8lnu.paddEmptyBody(editor);
+ }
+ };
+ var forwardDeleteCommand = function (editor) {
+ if ($_a7skkj3gjfuw8lqf.backspaceDelete(editor, true)) {
+ return;
+ } else if ($_qeu9d3kjfuw8luq.backspaceDelete(editor, true)) {
+ return;
+ } else if ($_cwwff132jfuw8ln7.backspaceDelete(editor, true)) {
+ return;
+ } else if ($_dt1e6j3rjfuw8lw0.backspaceDelete(editor)) {
+ return;
+ } else if ($_f34seo3fjfuw8lq6.backspaceDelete(editor, true)) {
+ return;
+ } else {
+ nativeCommand(editor, 'ForwardDelete');
+ }
+ };
+ var $_93erqy31jfuw8ln6 = {
+ deleteCommand: deleteCommand,
+ forwardDeleteCommand: forwardDeleteCommand
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Opens a new window.
- *
- * @method open
- * @param {Object} args Optional name/value settings collection contains things like width/height/url etc.
- * @param {Object} params Options like title, file, width, height etc.
- * @option {String} title Window title.
- * @option {String} file URL of the file to open in the window.
- * @option {Number} width Width in pixels.
- * @option {Number} height Height in pixels.
- * @option {Boolean} autoScroll Specifies whether the popup window can have scrollbars if required (i.e. content
- * larger than the popup size specified).
- */
- open: open,
-
- /**
- * Creates a alert dialog. Please don't use the blocking behavior of this
- * native version use the callback method instead then it can be extended.
- *
- * @method alert
- * @param {String} message Text to display in the new alert dialog.
- * @param {function} callback Callback function to be executed after the user has selected ok.
- * @param {Object} scope Optional scope to execute the callback in.
- * @example
- * // Displays an alert box using the active editors window manager instance
- * tinymce.activeEditor.windowManager.alert('Hello world!');
- */
- alert: alert,
-
- /**
- * Creates a confirm dialog. Please don't use the blocking behavior of this
- * native version use the callback method instead then it can be extended.
- *
- * @method confirm
- * @param {String} message Text to display in the new confirm dialog.
- * @param {function} callback Callback function to be executed after the user has selected ok or cancel.
- * @param {Object} scope Optional scope to execute the callback in.
- * @example
- * // Displays an confirm box and an alert message will be displayed depending on what you choose in the confirm
- * tinymce.activeEditor.windowManager.confirm("Do you want to do something", function(s) {
- * if (s)
- * tinymce.activeEditor.windowManager.alert("Ok");
- * else
- * tinymce.activeEditor.windowManager.alert("Cancel");
- * });
- */
- confirm: confirm,
-
- /**
- * Closes the top most window.
- *
- * @method close
- */
- close: close,
-
- /**
- * Returns the params of the last window open call. This can be used in iframe based
- * dialog to get params passed from the tinymce plugin.
- *
- * @example
- * var dialogArguments = top.tinymce.activeEditor.windowManager.getParams();
- *
- * @method getParams
- * @return {Object} Name/value object with parameters passed from windowManager.open call.
- */
- getParams: getParams,
-
- /**
- * Sets the params of the last opened window.
- *
- * @method setParams
- * @param {Object} params Params object to set for the last opened window.
- */
- setParams: setParams,
-
- /**
- * Returns the currently opened window objects.
- *
- * @method getWindows
- * @return {Array} Array of the currently opened windows.
- */
- getWindows: getWindows
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getSpecifiedFontProp = function (propName, rootElm, elm) {
+ var getProperty = function (elm) {
+ return $_cworr512jfuw8l9j.getRaw(elm, propName);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * RangePoint.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.RangePoint',
- [
- 'ephox.katamari.api.Arr',
- 'tinymce.core.geom.ClientRect'
- ],
- function (Arr, ClientRect) {
- var isXYWithinRange = function (clientX, clientY, range) {
- if (range.collapsed) {
- return false;
- }
-
- return Arr.foldl(range.getClientRects(), function (state, rect) {
- return state || ClientRect.containsXY(rect, clientX, clientY);
- }, false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isRoot = function (elm) {
+ return $_4fb96d1djfuw8lbl.eq($_c9h6qlzjfuw8l98.fromDom(rootElm), elm);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- isXYWithinRange: isXYWithinRange
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $_chabeg35jfuw8lo3.closest($_c9h6qlzjfuw8l98.fromDom(elm), function (elm) {
+ return getProperty(elm).isSome();
+ }, isRoot).bind(getProperty);
+ };
+ var round$1 = function (number, precision) {
+ var factor = Math.pow(10, precision);
+ return Math.round(number * factor) / factor;
+ };
+ var toPt = function (fontSize, precision) {
+ if (/[0-9.]+px$/.test(fontSize)) {
+ return round$1(parseInt(fontSize, 10) * 72 / 96, precision || 0) + 'pt';
+ }
+ return fontSize;
+ };
+ var normalizeFontFamily = function (fontFamily) {
+ return fontFamily.replace(/[\'\"\\]/g, '').replace(/,\s+/g, ',');
+ };
+ var getComputedFontProp = function (propName, elm) {
+ return Option.from(DOMUtils$1.DOM.getStyle(elm, propName, true));
+ };
+ var getFontProp = function (propName) {
+ return function (rootElm, elm) {
+ return Option.from(elm).map($_c9h6qlzjfuw8l98.fromDom).filter($_eaw33d10jfuw8l9f.isElement).bind(function (element) {
+ return getSpecifiedFontProp(propName, rootElm, element.dom()).or(getComputedFontProp(propName, element.dom()));
+ }).getOr('');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * VK.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_6b0g9e3wjfuw8lxd = {
+ getFontSize: getFontProp('font-size'),
+ getFontFamily: $_68e81l6jfuw8kyc.compose(normalizeFontFamily, getFontProp('font-family')),
+ toPt: toPt
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * This file exposes a set of the common KeyCodes for use. Please grow it as needed.
- */
-define(
- 'tinymce.core.util.VK',
- [
- "tinymce.core.Env"
- ],
- function (Env) {
- return {
- BACKSPACE: 8,
- DELETE: 46,
- DOWN: 40,
- ENTER: 13,
- LEFT: 37,
- RIGHT: 39,
- SPACEBAR: 32,
- TAB: 9,
- UP: 38,
-
- modifierPressed: function (e) {
- return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);
- },
-
- metaKeyPressed: function (e) {
- // Check if ctrl or meta key is pressed. Edge case for AltGr on Windows where it produces ctrlKey+altKey states
- return (Env.mac ? e.metaKey : e.ctrlKey && !e.altKey);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var findFirstCaretElement = function (editor) {
+ return $_25kl2c2cjfuw8ljh.firstPositionIn(editor.getBody()).map(function (caret) {
+ var container = caret.container();
+ return $_ey7ka11qjfuw8ldg.isText(container) ? container.parentNode : container;
+ });
+ };
+ var isRangeAtStartOfNode = function (rng, root) {
+ return rng.startContainer === root && rng.startOffset === 0;
+ };
+ var getCaretElement = function (editor) {
+ return Option.from(editor.selection.getRng()).bind(function (rng) {
+ var root = editor.getBody();
+ return isRangeAtStartOfNode(rng, root) ? Option.none() : Option.from(editor.selection.getStart(true));
+ });
+ };
+ var fromFontSizeNumber = function (editor, value) {
+ var fontSizeNumber = parseInt(value, 10);
+ if (fontSizeNumber >= 1 && fontSizeNumber <= 7) {
+ var fontSizes = $_6msxiw2jjfuw8lkv.getFontStyleValues(editor);
+ var fontClasses = $_6msxiw2jjfuw8lkv.getFontSizeClasses(editor);
+ if (fontClasses) {
+ return fontClasses[fontSizeNumber - 1] || value;
+ } else {
+ return fontSizes[fontSizeNumber - 1] || value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ return value;
+ }
+ };
+ var fontNameAction = function (editor, value) {
+ editor.formatter.toggle('fontname', { value: fromFontSizeNumber(editor, value) });
+ editor.nodeChanged();
+ };
+ var fontNameQuery = function (editor) {
+ return getCaretElement(editor).fold(function () {
+ return findFirstCaretElement(editor).map(function (caretElement) {
+ return $_6b0g9e3wjfuw8lxd.getFontFamily(editor.getBody(), caretElement);
+ }).getOr('');
+ }, function (caretElement) {
+ return $_6b0g9e3wjfuw8lxd.getFontFamily(editor.getBody(), caretElement);
+ });
+ };
+ var fontSizeAction = function (editor, value) {
+ editor.formatter.toggle('fontsize', { value: fromFontSizeNumber(editor, value) });
+ editor.nodeChanged();
+ };
+ var fontSizeQuery = function (editor) {
+ return getCaretElement(editor).fold(function () {
+ return findFirstCaretElement(editor).map(function (caretElement) {
+ return $_6b0g9e3wjfuw8lxd.getFontSize(editor.getBody(), caretElement);
+ }).getOr('');
+ }, function (caretElement) {
+ return $_6b0g9e3wjfuw8lxd.getFontSize(editor.getBody(), caretElement);
+ });
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ControlSelection.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isEq$1 = function (rng1, rng2) {
+ return rng1 && rng2 && (rng1.startContainer === rng2.startContainer && rng1.startOffset === rng2.startOffset) && (rng1.endContainer === rng2.endContainer && rng1.endOffset === rng2.endOffset);
+ };
+ var $_87lezn3zjfuw8ly9 = { isEq: isEq$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * This class handles control selection of elements. Controls are elements
- * that can be resized and needs to be selected as a whole. It adds custom resize handles
- * to all browser engines that support properly disabling the built in resize logic.
- *
- * @class tinymce.dom.ControlSelection
- */
-define(
- 'tinymce.core.dom.ControlSelection',
- [
- 'ephox.katamari.api.Fun',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.Selectors',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.RangePoint',
- 'tinymce.core.Env',
- 'tinymce.core.util.Delay',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.VK'
- ],
- function (Fun, Element, Selectors, NodeType, RangePoint, Env, Delay, Tools, VK) {
- var isContentEditableFalse = NodeType.isContentEditableFalse;
- var isContentEditableTrue = NodeType.isContentEditableTrue;
-
- function getContentEditableRoot(root, node) {
- while (node && node != root) {
- if (isContentEditableTrue(node) || isContentEditableFalse(node)) {
- return node;
- }
-
- node = node.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var findParent = function (node, rootNode, predicate) {
+ while (node && node !== rootNode) {
+ if (predicate(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isImage = function (elm) {
- return elm && elm.nodeName === 'IMG';
- };
-
- var isEventOnImageOutsideRange = function (evt, range) {
- return isImage(evt.target) && !RangePoint.isXYWithinRange(evt.clientX, evt.clientY, range);
- };
-
- var contextMenuSelectImage = function (editor, evt) {
- var target = evt.target;
-
- if (isEventOnImageOutsideRange(evt, editor.selection.getRng()) && !evt.isDefaultPrevented()) {
- evt.preventDefault();
- editor.selection.select(target);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
+ };
+ var hasParent = function (node, rootNode, predicate) {
+ return findParent(node, rootNode, predicate) !== null;
+ };
+ var hasParentWithName = function (node, rootNode, name) {
+ return hasParent(node, rootNode, function (node) {
+ return node.nodeName === name;
+ });
+ };
+ var isTable$2 = function (node) {
+ return node && node.nodeName === 'TABLE';
+ };
+ var isTableCell$3 = function (node) {
+ return node && /^(TD|TH|CAPTION)$/.test(node.nodeName);
+ };
+ var isCeFalseCaretContainer = function (node, rootNode) {
+ return isCaretContainer(node) && hasParent(node, rootNode, isCaretNode) === false;
+ };
+ var hasBrBeforeAfter = function (dom, node, left) {
+ var walker = new TreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || dom.getRoot());
+ while (node = walker[left ? 'prev' : 'next']()) {
+ if ($_ey7ka11qjfuw8ldg.isBr(node)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- return function (selection, editor) {
- var dom = editor.dom, each = Tools.each;
- var selectedElm, selectedElmGhost, resizeHelper, resizeHandles, selectedHandle, lastMouseDownEvent;
- var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted;
- var width, height, editableDoc = editor.getDoc(), rootDocument = document, isIE = Env.ie && Env.ie < 11;
- var abs = Math.abs, round = Math.round, rootElement = editor.getBody(), startScrollWidth, startScrollHeight;
-
- // Details about each resize handle how to scale etc
- resizeHandles = {
- // Name: x multiplier, y multiplier, delta size x, delta size y
- /*n: [0.5, 0, 0, -1],
- e: [1, 0.5, 1, 0],
- s: [0.5, 1, 0, 1],
- w: [0, 0.5, -1, 0],*/
- nw: [0, 0, -1, -1],
- ne: [1, 0, 1, -1],
- se: [1, 1, 1, 1],
- sw: [0, 1, -1, 1]
- };
-
- // Add CSS for resize handles, cloned element and selected
- var rootClass = '.mce-content-body';
- editor.contentStyles.push(
- rootClass + ' div.mce-resizehandle {' +
- 'position: absolute;' +
- 'border: 1px solid black;' +
- 'box-sizing: box-sizing;' +
- 'background: #FFF;' +
- 'width: 7px;' +
- 'height: 7px;' +
- 'z-index: 10000' +
- '}' +
- rootClass + ' .mce-resizehandle:hover {' +
- 'background: #000' +
- '}' +
- rootClass + ' img[data-mce-selected],' + rootClass + ' hr[data-mce-selected] {' +
- 'outline: 1px solid black;' +
- 'resize: none' + // Have been talks about implementing this in browsers
- '}' +
- rootClass + ' .mce-clonedresizable {' +
- 'position: absolute;' +
- (Env.gecko ? '' : 'outline: 1px dashed black;') + // Gecko produces trails while resizing
- 'opacity: .5;' +
- 'filter: alpha(opacity=50);' +
- 'z-index: 10000' +
- '}' +
- rootClass + ' .mce-resize-helper {' +
- 'background: #555;' +
- 'background: rgba(0,0,0,0.75);' +
- 'border-radius: 3px;' +
- 'border: 1px;' +
- 'color: white;' +
- 'display: none;' +
- 'font-family: sans-serif;' +
- 'font-size: 12px;' +
- 'white-space: nowrap;' +
- 'line-height: 14px;' +
- 'margin: 5px 10px;' +
- 'padding: 5px;' +
- 'position: absolute;' +
- 'z-index: 10001' +
- '}'
- );
-
- function isResizable(elm) {
- var selector = editor.settings.object_resizing;
-
- if (selector === false || Env.iOS) {
- return false;
- }
-
- if (typeof selector != 'string') {
- selector = 'table,img,div';
- }
-
- if (elm.getAttribute('data-mce-resize') === 'false') {
- return false;
- }
-
- if (elm == editor.getBody()) {
- return false;
- }
-
- return Selectors.is(Element.fromDom(elm), selector);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var isPrevNode = function (node, name) {
+ return node.previousSibling && node.previousSibling.nodeName === name;
+ };
+ var hasContentEditableFalseParent = function (body, node) {
+ while (node && node !== body) {
+ if ($_ey7ka11qjfuw8ldg.isContentEditableFalse(node)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function resizeGhostElement(e) {
- var deltaX, deltaY, proportional;
- var resizeHelperX, resizeHelperY;
-
- // Calc new width/height
- deltaX = e.screenX - startX;
- deltaY = e.screenY - startY;
-
- // Calc new size
- width = deltaX * selectedHandle[2] + startW;
- height = deltaY * selectedHandle[3] + startH;
-
- // Never scale down lower than 5 pixels
- width = width < 5 ? 5 : width;
- height = height < 5 ? 5 : height;
-
- if (selectedElm.nodeName == "IMG" && editor.settings.resize_img_proportional !== false) {
- proportional = !VK.modifierPressed(e);
- } else {
- proportional = VK.modifierPressed(e) || (selectedElm.nodeName == "IMG" && selectedHandle[2] * selectedHandle[3] !== 0);
- }
-
- // Constrain proportions
- if (proportional) {
- if (abs(deltaX) > abs(deltaY)) {
- height = round(width * ratio);
- width = round(height / ratio);
- } else {
- width = round(height / ratio);
- height = round(width * ratio);
- }
- }
-
- // Update ghost size
- dom.setStyles(selectedElmGhost, {
- width: width,
- height: height
- });
-
- // Update resize helper position
- resizeHelperX = selectedHandle.startPos.x + deltaX;
- resizeHelperY = selectedHandle.startPos.y + deltaY;
- resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0;
- resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0;
-
- dom.setStyles(resizeHelper, {
- left: resizeHelperX,
- top: resizeHelperY,
- display: 'block'
- });
-
- resizeHelper.innerHTML = width + ' × ' + height;
-
- // Update ghost X position if needed
- if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) {
- dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width));
- }
-
- // Update ghost Y position if needed
- if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) {
- dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height));
- }
-
- // Calculate how must overflow we got
- deltaX = rootElement.scrollWidth - startScrollWidth;
- deltaY = rootElement.scrollHeight - startScrollHeight;
-
- // Re-position the resize helper based on the overflow
- if (deltaX + deltaY !== 0) {
- dom.setStyles(resizeHelper, {
- left: resizeHelperX - deltaX,
- top: resizeHelperY - deltaY
- });
- }
-
- if (!resizeStarted) {
- editor.fire('ObjectResizeStart', { target: selectedElm, width: startW, height: startH });
- resizeStarted = true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
+ }
+ return false;
+ };
+ var findTextNodeRelative = function (dom, isAfterNode, collapsed, left, startNode) {
+ var walker, lastInlineElement, parentBlockContainer;
+ var body = dom.getRoot();
+ var node;
+ var nonEmptyElementsMap = dom.schema.getNonEmptyElements();
+ parentBlockContainer = dom.getParent(startNode.parentNode, dom.isBlock) || body;
+ if (left && $_ey7ka11qjfuw8ldg.isBr(startNode) && isAfterNode && dom.isEmpty(parentBlockContainer)) {
+ return Option.some(CaretPosition(startNode.parentNode, dom.nodeIndex(startNode)));
+ }
+ walker = new TreeWalker(startNode, parentBlockContainer);
+ while (node = walker[left ? 'prev' : 'next']()) {
+ if (dom.getContentEditableParent(node) === 'false' || isCeFalseCaretContainer(node, body)) {
+ return Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function endGhostResize() {
- resizeStarted = false;
-
- function setSizeProp(name, value) {
- if (value) {
- // Resize by using style or attribute
- if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) {
- dom.setStyle(selectedElm, name, value);
- } else {
- dom.setAttrib(selectedElm, name, value);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_ey7ka11qjfuw8ldg.isText(node) && node.nodeValue.length > 0) {
+ if (hasParentWithName(node, body, 'A') === false) {
+ return Option.some(CaretPosition(node, left ? node.nodeValue.length : 0));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Set width/height properties
- setSizeProp('width', width);
- setSizeProp('height', height);
-
- dom.unbind(editableDoc, 'mousemove', resizeGhostElement);
- dom.unbind(editableDoc, 'mouseup', endGhostResize);
-
- if (rootDocument != editableDoc) {
- dom.unbind(rootDocument, 'mousemove', resizeGhostElement);
- dom.unbind(rootDocument, 'mouseup', endGhostResize);
- }
-
- // Remove ghost/helper and update resize handle positions
- dom.remove(selectedElmGhost);
- dom.remove(resizeHelper);
-
- if (!isIE || selectedElm.nodeName == "TABLE") {
- showResizeRect(selectedElm);
- }
-
- editor.fire('ObjectResized', { target: selectedElm, width: width, height: height });
- dom.setAttrib(selectedElm, 'style', dom.getAttrib(selectedElm, 'style'));
- editor.nodeChanged();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function showResizeRect(targetElm, mouseDownHandleName, mouseDownEvent) {
- var position, targetWidth, targetHeight, e, rect;
-
- hideResizeRect();
- unbindResizeHandleEvents();
-
- // Get position and size of target
- position = dom.getPos(targetElm, rootElement);
- selectedElmX = position.x;
- selectedElmY = position.y;
- rect = targetElm.getBoundingClientRect(); // Fix for Gecko offsetHeight for table with caption
- targetWidth = rect.width || (rect.right - rect.left);
- targetHeight = rect.height || (rect.bottom - rect.top);
-
- // Reset width/height if user selects a new image/table
- if (selectedElm != targetElm) {
- detachResizeStartListener();
- selectedElm = targetElm;
- width = height = 0;
- }
-
- // Makes it possible to disable resizing
- e = editor.fire('ObjectSelected', { target: targetElm });
-
- if (isResizable(targetElm) && !e.isDefaultPrevented()) {
- each(resizeHandles, function (handle, name) {
- var handleElm;
-
- function startDrag(e) {
- startX = e.screenX;
- startY = e.screenY;
- startW = selectedElm.clientWidth;
- startH = selectedElm.clientHeight;
- ratio = startH / startW;
- selectedHandle = handle;
-
- handle.startPos = {
- x: targetWidth * handle[0] + selectedElmX,
- y: targetHeight * handle[1] + selectedElmY
- };
-
- startScrollWidth = rootElement.scrollWidth;
- startScrollHeight = rootElement.scrollHeight;
-
- selectedElmGhost = selectedElm.cloneNode(true);
- dom.addClass(selectedElmGhost, 'mce-clonedresizable');
- dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all');
- selectedElmGhost.contentEditable = false; // Hides IE move layer cursor
- selectedElmGhost.unSelectabe = true;
- dom.setStyles(selectedElmGhost, {
- left: selectedElmX,
- top: selectedElmY,
- margin: 0
- });
-
- selectedElmGhost.removeAttribute('data-mce-selected');
- rootElement.appendChild(selectedElmGhost);
-
- dom.bind(editableDoc, 'mousemove', resizeGhostElement);
- dom.bind(editableDoc, 'mouseup', endGhostResize);
-
- if (rootDocument != editableDoc) {
- dom.bind(rootDocument, 'mousemove', resizeGhostElement);
- dom.bind(rootDocument, 'mouseup', endGhostResize);
- }
-
- resizeHelper = dom.add(rootElement, 'div', {
- 'class': 'mce-resize-helper',
- 'data-mce-bogus': 'all'
- }, startW + ' × ' + startH);
- }
-
- if (mouseDownHandleName) {
- // Drag started by IE native resizestart
- if (name == mouseDownHandleName) {
- startDrag(mouseDownEvent);
- }
-
- return;
- }
-
- // Get existing or render resize handle
- handleElm = dom.get('mceResizeHandle' + name);
- if (handleElm) {
- dom.remove(handleElm);
- }
-
- handleElm = dom.add(rootElement, 'div', {
- id: 'mceResizeHandle' + name,
- 'data-mce-bogus': 'all',
- 'class': 'mce-resizehandle',
- unselectable: true,
- style: 'cursor:' + name + '-resize; margin:0; padding:0'
- });
-
- // Hides IE move layer cursor
- // If we set it on Chrome we get this wounderful bug: #6725
- if (Env.ie) {
- handleElm.contentEditable = false;
- }
-
- dom.bind(handleElm, 'mousedown', function (e) {
- e.stopImmediatePropagation();
- e.preventDefault();
- startDrag(e);
- });
-
- handle.elm = handleElm;
-
- // Position element
- dom.setStyles(handleElm, {
- left: (targetWidth * handle[0] + selectedElmX) - (handleElm.offsetWidth / 2),
- top: (targetHeight * handle[1] + selectedElmY) - (handleElm.offsetHeight / 2)
- });
- });
- } else {
- hideResizeRect();
- }
-
- selectedElm.setAttribute('data-mce-selected', '1');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) {
+ return Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hideResizeRect() {
- var name, handleElm;
-
- unbindResizeHandleEvents();
-
- if (selectedElm) {
- selectedElm.removeAttribute('data-mce-selected');
- }
-
- for (name in resizeHandles) {
- handleElm = dom.get('mceResizeHandle' + name);
- if (handleElm) {
- dom.unbind(handleElm);
- dom.remove(handleElm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ lastInlineElement = node;
+ }
+ if (collapsed && lastInlineElement) {
+ return Option.some(CaretPosition(lastInlineElement, 0));
+ }
+ return Option.none();
+ };
+ var normalizeEndPoint = function (dom, collapsed, start, rng) {
+ var container, offset, walker;
+ var body = dom.getRoot();
+ var node, nonEmptyElementsMap;
+ var directionLeft, isAfterNode, normalized = false;
+ container = rng[(start ? 'start' : 'end') + 'Container'];
+ offset = rng[(start ? 'start' : 'end') + 'Offset'];
+ isAfterNode = $_ey7ka11qjfuw8ldg.isElement(container) && offset === container.childNodes.length;
+ nonEmptyElementsMap = dom.schema.getNonEmptyElements();
+ directionLeft = start;
+ if (isCaretContainer(container)) {
+ return Option.none();
+ }
+ if ($_ey7ka11qjfuw8ldg.isElement(container) && offset > container.childNodes.length - 1) {
+ directionLeft = false;
+ }
+ if ($_ey7ka11qjfuw8ldg.isDocument(container)) {
+ container = body;
+ offset = 0;
+ }
+ if (container === body) {
+ if (directionLeft) {
+ node = container.childNodes[offset > 0 ? offset - 1 : 0];
+ if (node) {
+ if (isCaretContainer(node)) {
+ return Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (nonEmptyElementsMap[node.nodeName] || isTable$2(node)) {
+ return Option.none();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function updateResizeRect(e) {
- var startElm, controlElm;
-
- function isChildOrEqual(node, parent) {
- if (node) {
- do {
- if (node === parent) {
- return true;
- }
- } while ((node = node.parentNode));
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (container.hasChildNodes()) {
+ offset = Math.min(!directionLeft && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1);
+ container = container.childNodes[offset];
+ offset = $_ey7ka11qjfuw8ldg.isText(container) && isAfterNode ? container.data.length : 0;
+ if (!collapsed && container === body.lastChild && isTable$2(container)) {
+ return Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Ignore all events while resizing or if the editor instance was removed
- if (resizeStarted || editor.removed) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (hasContentEditableFalseParent(body, container) || isCaretContainer(container)) {
+ return Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v
- each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function (img) {
- img.removeAttribute('data-mce-selected');
- });
-
- controlElm = e.type == 'mousedown' ? e.target : selection.getNode();
- controlElm = dom.$(controlElm).closest(isIE ? 'table' : 'table,img,hr')[0];
-
- if (isChildOrEqual(controlElm, rootElement)) {
- disableGeckoResize();
- startElm = selection.getStart(true);
-
- if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) {
- if (!isIE || (controlElm != startElm && startElm.nodeName !== 'IMG')) {
- showResizeRect(controlElm);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (container.hasChildNodes() && isTable$2(container) === false) {
+ node = container;
+ walker = new TreeWalker(container, body);
+ do {
+ if ($_ey7ka11qjfuw8ldg.isContentEditableFalse(node) || isCaretContainer(node)) {
+ normalized = false;
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_ey7ka11qjfuw8ldg.isText(node) && node.nodeValue.length > 0) {
+ offset = directionLeft ? 0 : node.nodeValue.length;
+ container = node;
+ normalized = true;
+ break;
+ }
+ if (nonEmptyElementsMap[node.nodeName.toLowerCase()] && !isTableCell$3(node)) {
+ offset = dom.nodeIndex(node);
+ container = node.parentNode;
+ if (!directionLeft) {
+ offset++;
+ }
+ normalized = true;
+ break;
+ }
+ } while (node = directionLeft ? walker.next() : walker.prev());
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- hideResizeRect();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function attachEvent(elm, name, func) {
- if (elm && elm.attachEvent) {
- elm.attachEvent('on' + name, func);
- }
- }
-
- function detachEvent(elm, name, func) {
- if (elm && elm.detachEvent) {
- elm.detachEvent('on' + name, func);
- }
- }
-
- function resizeNativeStart(e) {
- var target = e.srcElement, pos, name, corner, cornerX, cornerY, relativeX, relativeY;
-
- pos = target.getBoundingClientRect();
- relativeX = lastMouseDownEvent.clientX - pos.left;
- relativeY = lastMouseDownEvent.clientY - pos.top;
-
- // Figure out what corner we are draging on
- for (name in resizeHandles) {
- corner = resizeHandles[name];
-
- cornerX = target.offsetWidth * corner[0];
- cornerY = target.offsetHeight * corner[1];
-
- if (abs(cornerX - relativeX) < 8 && abs(cornerY - relativeY) < 8) {
- selectedHandle = corner;
- break;
- }
- }
-
- // Remove native selection and let the magic begin
- resizeStarted = true;
- editor.fire('ObjectResizeStart', {
- target: selectedElm,
- width: selectedElm.clientWidth,
- height: selectedElm.clientHeight
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (collapsed) {
+ if ($_ey7ka11qjfuw8ldg.isText(container) && offset === 0) {
+ findTextNodeRelative(dom, isAfterNode, collapsed, true, container).each(function (pos) {
+ container = pos.container();
+ offset = pos.offset();
+ normalized = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.getDoc().selection.empty();
- showResizeRect(target, name, lastMouseDownEvent);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function preventDefault(e) {
- if (e.preventDefault) {
- e.preventDefault();
- } else {
- e.returnValue = false; // IE
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_ey7ka11qjfuw8ldg.isElement(container)) {
+ node = container.childNodes[offset];
+ if (!node) {
+ node = container.childNodes[offset - 1];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function isWithinContentEditableFalse(elm) {
- return isContentEditableFalse(getContentEditableRoot(editor.getBody(), elm));
- }
-
- function nativeControlSelect(e) {
- var target = e.srcElement;
-
- if (isWithinContentEditableFalse(target)) {
- preventDefault(e);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node && $_ey7ka11qjfuw8ldg.isBr(node) && !isPrevNode(node, 'A') && !hasBrBeforeAfter(dom, node, false) && !hasBrBeforeAfter(dom, node, true)) {
+ findTextNodeRelative(dom, isAfterNode, collapsed, true, node).each(function (pos) {
+ container = pos.container();
+ offset = pos.offset();
+ normalized = true;
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (target != selectedElm) {
- editor.fire('ObjectSelected', { target: target });
- detachResizeStartListener();
-
- if (target.id.indexOf('mceResizeHandle') === 0) {
- e.returnValue = false;
- return;
- }
-
- if (target.nodeName == 'IMG' || target.nodeName == 'TABLE') {
- hideResizeRect();
- selectedElm = target;
- attachEvent(target, 'resizestart', resizeNativeStart);
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function detachResizeStartListener() {
- detachEvent(selectedElm, 'resizestart', resizeNativeStart);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (directionLeft && !collapsed && $_ey7ka11qjfuw8ldg.isText(container) && offset === container.nodeValue.length) {
+ findTextNodeRelative(dom, isAfterNode, collapsed, false, container).each(function (pos) {
+ container = pos.container();
+ offset = pos.offset();
+ normalized = true;
+ });
+ }
+ return normalized ? Option.some(CaretPosition(container, offset)) : Option.none();
+ };
+ var normalize$1 = function (dom, rng) {
+ var collapsed = rng.collapsed, normRng = rng.cloneRange();
+ var startPos = CaretPosition.fromRangeStart(rng);
+ normalizeEndPoint(dom, collapsed, true, normRng).each(function (pos) {
+ if (!collapsed || !CaretPosition.isAbove(startPos, pos)) {
+ normRng.setStart(pos.container(), pos.offset());
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ if (!collapsed) {
+ normalizeEndPoint(dom, collapsed, false, normRng).each(function (pos) {
+ normRng.setEnd(pos.container(), pos.offset());
+ });
+ }
+ if (collapsed) {
+ normRng.collapse(true);
+ }
+ return $_87lezn3zjfuw8ly9.isEq(rng, normRng) ? Option.none() : Option.some(normRng);
+ };
+ var $_970szt3yjfuw8ly1 = { normalize: normalize$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function unbindResizeHandleEvents() {
- for (var name in resizeHandles) {
- var handle = resizeHandles[name];
-
- if (handle.elm) {
- dom.unbind(handle.elm);
- delete handle.elm;
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasRightSideContent = function (schema, container, parentBlock) {
+ var walker = new TreeWalker(container, parentBlock);
+ var node;
+ var nonEmptyElementsMap = schema.getNonEmptyElements();
+ while (node = walker.next()) {
+ if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function disableGeckoResize() {
- try {
- // Disable object resizing on Gecko
- editor.getDoc().execCommand('enableObjectResizing', false, false);
- } catch (ex) {
- // Ignore
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var scrollToBr = function (dom, selection, brElm) {
+ var marker = dom.create('span', {}, ' ');
+ brElm.parentNode.insertBefore(marker, brElm);
+ selection.scrollIntoView(marker);
+ dom.remove(marker);
+ };
+ var moveSelectionToBr = function (dom, selection, brElm, extraBr) {
+ var rng = dom.createRng();
+ if (!extraBr) {
+ rng.setStartAfter(brElm);
+ rng.setEndAfter(brElm);
+ } else {
+ rng.setStartBefore(brElm);
+ rng.setEndBefore(brElm);
+ }
+ selection.setRng(rng);
+ };
+ var insertBrAtCaret = function (editor, evt) {
+ var selection = editor.selection, dom = editor.dom;
+ var brElm, extraBr;
+ var rng = selection.getRng();
+ $_970szt3yjfuw8ly1.normalize(dom, rng).each(function (normRng) {
+ rng.setStart(normRng.startContainer, normRng.startOffset);
+ rng.setEnd(normRng.endContainer, normRng.endOffset);
+ });
+ var offset = rng.startOffset;
+ var container = rng.startContainer;
+ if (container.nodeType === 1 && container.hasChildNodes()) {
+ var isAfterLastNodeInContainer = offset > container.childNodes.length - 1;
+ container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
+ if (isAfterLastNodeInContainer && container.nodeType === 3) {
+ offset = container.nodeValue.length;
+ } else {
+ offset = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function controlSelect(elm) {
- var ctrlRng;
-
- if (!isIE) {
- return;
- }
-
- ctrlRng = editableDoc.body.createControlRange();
-
- try {
- ctrlRng.addElement(elm);
- ctrlRng.select();
- return true;
- } catch (ex) {
- // Ignore since the element can't be control selected for example a P tag
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ var parentBlock = dom.getParent(container, dom.isBlock);
+ var containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;
+ var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : '';
+ var isControlKey = evt && evt.ctrlKey;
+ if (containerBlockName === 'LI' && !isControlKey) {
+ parentBlock = containerBlock;
+ }
+ if (container && container.nodeType === 3 && offset >= container.nodeValue.length) {
+ if (!hasRightSideContent(editor.schema, container, parentBlock)) {
+ brElm = dom.create('br');
+ rng.insertNode(brElm);
+ rng.setStartAfter(brElm);
+ rng.setEndAfter(brElm);
+ extraBr = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ brElm = dom.create('br');
+ rng.insertNode(brElm);
+ scrollToBr(dom, selection, brElm);
+ moveSelectionToBr(dom, selection, brElm, extraBr);
+ editor.undoManager.add();
+ };
+ var insertBrBefore = function (editor, inline) {
+ var br = $_c9h6qlzjfuw8l98.fromTag('br');
+ $_doli6x2kjfuw8lky.before($_c9h6qlzjfuw8l98.fromDom(inline), br);
+ editor.undoManager.add();
+ };
+ var insertBrAfter = function (editor, inline) {
+ if (!hasBrAfter(editor.getBody(), inline)) {
+ $_doli6x2kjfuw8lky.after($_c9h6qlzjfuw8l98.fromDom(inline), $_c9h6qlzjfuw8l98.fromTag('br'));
+ }
+ var br = $_c9h6qlzjfuw8l98.fromTag('br');
+ $_doli6x2kjfuw8lky.after($_c9h6qlzjfuw8l98.fromDom(inline), br);
+ scrollToBr(editor.dom, editor.selection, br.dom());
+ moveSelectionToBr(editor.dom, editor.selection, br.dom(), false);
+ editor.undoManager.add();
+ };
+ var isBeforeBr = function (pos) {
+ return $_ey7ka11qjfuw8ldg.isBr(pos.getNode());
+ };
+ var hasBrAfter = function (rootNode, startNode) {
+ if (isBeforeBr(CaretPosition$1.after(startNode))) {
+ return true;
+ } else {
+ return $_25kl2c2cjfuw8ljh.nextPosition(rootNode, CaretPosition$1.after(startNode)).map(function (pos) {
+ return $_ey7ka11qjfuw8ldg.isBr(pos.getNode());
+ }).getOr(false);
+ }
+ };
+ var isAnchorLink = function (elm) {
+ return elm && elm.nodeName === 'A' && 'href' in elm;
+ };
+ var isInsideAnchor = function (location) {
+ return location.fold($_68e81l6jfuw8kyc.constant(false), isAnchorLink, isAnchorLink, $_68e81l6jfuw8kyc.constant(false));
+ };
+ var readInlineAnchorLocation = function (editor) {
+ var isInlineTarget = $_68e81l6jfuw8kyc.curry($_exgtt937jfuw8loj.isInlineTarget, editor);
+ var position = CaretPosition$1.fromRangeStart(editor.selection.getRng());
+ return $_80edfj3njfuw8lvb.readLocation(isInlineTarget, editor.getBody(), position).filter(isInsideAnchor);
+ };
+ var insertBrOutsideAnchor = function (editor, location) {
+ location.fold($_68e81l6jfuw8kyc.noop, $_68e81l6jfuw8kyc.curry(insertBrBefore, editor), $_68e81l6jfuw8kyc.curry(insertBrAfter, editor), $_68e81l6jfuw8kyc.noop);
+ };
+ var insert = function (editor, evt) {
+ var anchorLocation = readInlineAnchorLocation(editor);
+ if (anchorLocation.isSome()) {
+ anchorLocation.each($_68e81l6jfuw8kyc.curry(insertBrOutsideAnchor, editor));
+ } else {
+ insertBrAtCaret(editor, evt);
+ }
+ };
+ var $_c7z3y13xjfuw8lxq = { insert: insert };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('init', function () {
- if (isIE) {
- // Hide the resize rect on resize and reselect the image
- editor.on('ObjectResized', function (e) {
- if (e.target.nodeName != 'TABLE') {
- hideResizeRect();
- controlSelect(e.target);
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var adt = $_5ac1li3ijfuw8lqv.generate([
+ { 'before': ['element'] },
+ {
+ 'on': [
+ 'element',
+ 'offset'
+ ]
+ },
+ { after: ['element'] }
+ ]);
+ var cata = function (subject, onBefore, onOn, onAfter) {
+ return subject.fold(onBefore, onOn, onAfter);
+ };
+ var getStart = function (situ) {
+ return situ.fold($_68e81l6jfuw8kyc.identity, $_68e81l6jfuw8kyc.identity, $_68e81l6jfuw8kyc.identity);
+ };
+ var $_7hz43j42jfuw8lz1 = {
+ before: adt.before,
+ on: adt.on,
+ after: adt.after,
+ cata: cata,
+ getStart: getStart
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- attachEvent(rootElement, 'controlselect', nativeControlSelect);
-
- editor.on('mousedown', function (e) {
- lastMouseDownEvent = e;
- });
- } else {
- disableGeckoResize();
-
- // Sniff sniff, hard to feature detect this stuff
- if (Env.ie >= 11) {
- // Needs to be mousedown for drag/drop to work on IE 11
- // Needs to be click on Edge to properly select images
- editor.on('mousedown click', function (e) {
- var target = e.target, nodeName = target.nodeName;
-
- if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName) && !isWithinContentEditableFalse(target)) {
- if (e.button !== 2) {
- editor.selection.select(target, nodeName == 'TABLE');
- }
-
- // Only fire once since nodeChange is expensive
- if (e.type == 'mousedown') {
- editor.nodeChanged();
- }
- }
- });
-
- editor.dom.bind(rootElement, 'mscontrolselect', function (e) {
- function delayedSelect(node) {
- Delay.setEditorTimeout(editor, function () {
- editor.selection.select(node);
- });
- }
-
- if (isWithinContentEditableFalse(e.target)) {
- e.preventDefault();
- delayedSelect(e.target);
- return;
- }
-
- if (/^(TABLE|IMG|HR)$/.test(e.target.nodeName)) {
- e.preventDefault();
-
- // This moves the selection from being a control selection to a text like selection like in WebKit #6753
- // TODO: Fix this the day IE works like other browsers without this nasty native ugly control selections.
- if (e.target.tagName == 'IMG') {
- delayedSelect(e.target);
- }
- }
- });
- }
- }
-
- var throttledUpdateResizeRect = Delay.throttle(function (e) {
- if (!editor.composing) {
- updateResizeRect(e);
- }
- });
-
- editor.on('nodechange ResizeEditor ResizeWindow drop', throttledUpdateResizeRect);
-
- // Update resize rect while typing in a table
- editor.on('keyup compositionend', function (e) {
- // Don't update the resize rect while composing since it blows away the IME see: #2710
- if (selectedElm && selectedElm.nodeName == "TABLE") {
- throttledUpdateResizeRect(e);
- }
- });
-
- editor.on('hide blur', hideResizeRect);
- editor.on('contextmenu', Fun.curry(contextMenuSelectImage, editor));
-
- // Hide rect on focusout since it would float on top of windows otherwise
- //editor.on('focusout', hideResizeRect);
- });
-
- editor.on('remove', unbindResizeHandleEvents);
-
- function destroy() {
- selectedElm = selectedElmGhost = null;
-
- if (isIE) {
- detachResizeStartListener();
- detachEvent(rootElement, 'controlselect', nativeControlSelect);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var type$1 = $_5ac1li3ijfuw8lqv.generate([
+ { domRange: ['rng'] },
+ {
+ relative: [
+ 'startSitu',
+ 'finishSitu'
+ ]
+ },
+ {
+ exact: [
+ 'start',
+ 'soffset',
+ 'finish',
+ 'foffset'
+ ]
+ }
+ ]);
+ var range$1 = $_1a7eqh18jfuw8lb9.immutable('start', 'soffset', 'finish', 'foffset');
+ var exactFromRange = function (simRange) {
+ return type$1.exact(simRange.start(), simRange.soffset(), simRange.finish(), simRange.foffset());
+ };
+ var getStart$1 = function (selection) {
+ return selection.match({
+ domRange: function (rng) {
+ return $_c9h6qlzjfuw8l98.fromDom(rng.startContainer);
+ },
+ relative: function (startSitu, finishSitu) {
+ return $_7hz43j42jfuw8lz1.getStart(startSitu);
+ },
+ exact: function (start, soffset, finish, foffset) {
+ return start;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var getWin = function (selection) {
+ var start = getStart$1(selection);
+ return $_2j4g5u17jfuw8lav.defaultView(start);
+ };
+ var $_8xsorm41jfuw8lyv = {
+ domRange: type$1.domRange,
+ relative: type$1.relative,
+ exact: type$1.exact,
+ exactFromRange: exactFromRange,
+ range: range$1,
+ getWin: getWin
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- isResizable: isResizable,
- showResizeRect: showResizeRect,
- hideResizeRect: hideResizeRect,
- updateResizeRect: updateResizeRect,
- controlSelect: controlSelect,
- destroy: destroy
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var browser$3 = $_f1lbzgnjfuw8l7o.detect().browser;
+ var clamp = function (offset, element) {
+ var max = $_eaw33d10jfuw8l9f.isText(element) ? $_buobzn2wjfuw8lmp.get(element).length : $_2j4g5u17jfuw8lav.children(element).length + 1;
+ if (offset > max) {
+ return max;
+ } else if (offset < 0) {
+ return 0;
+ }
+ return offset;
+ };
+ var normalizeRng = function (rng) {
+ return $_8xsorm41jfuw8lyv.range(rng.start(), clamp(rng.soffset(), rng.start()), rng.finish(), clamp(rng.foffset(), rng.finish()));
+ };
+ var isOrContains = function (root, elm) {
+ return $_4fb96d1djfuw8lbl.contains(root, elm) || $_4fb96d1djfuw8lbl.eq(root, elm);
+ };
+ var isRngInRoot = function (root) {
+ return function (rng) {
+ return isOrContains(root, rng.start()) && isOrContains(root, rng.finish());
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var shouldStore = function (editor) {
+ return editor.inline === true || browser$3.isIE();
+ };
+ var nativeRangeToSelectionRange = function (r) {
+ return $_8xsorm41jfuw8lyv.range($_c9h6qlzjfuw8l98.fromDom(r.startContainer), r.startOffset, $_c9h6qlzjfuw8l98.fromDom(r.endContainer), r.endOffset);
+ };
+ var readRange = function (win) {
+ var selection = win.getSelection();
+ var rng = !selection || selection.rangeCount === 0 ? Option.none() : Option.from(selection.getRangeAt(0));
+ return rng.map(nativeRangeToSelectionRange);
+ };
+ var getBookmark$2 = function (root) {
+ var win = $_2j4g5u17jfuw8lav.defaultView(root);
+ return readRange(win.dom()).filter(isRngInRoot(root));
+ };
+ var validate = function (root, bookmark) {
+ return Option.from(bookmark).filter(isRngInRoot(root)).map(normalizeRng);
+ };
+ var bookmarkToNativeRng = function (bookmark) {
+ var rng = document.createRange();
+ try {
+ rng.setStart(bookmark.start().dom(), bookmark.soffset());
+ rng.setEnd(bookmark.finish().dom(), bookmark.foffset());
+ return Option.some(rng);
+ } catch (_) {
+ return Option.none();
+ }
+ };
+ var store = function (editor) {
+ var newBookmark = shouldStore(editor) ? getBookmark$2($_c9h6qlzjfuw8l98.fromDom(editor.getBody())) : Option.none();
+ editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark;
+ };
+ var storeNative = function (editor, rng) {
+ var root = $_c9h6qlzjfuw8l98.fromDom(editor.getBody());
+ var range = shouldStore(editor) ? Option.from(rng) : Option.none();
+ var newBookmark = range.map(nativeRangeToSelectionRange).filter(isRngInRoot(root));
+ editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark;
+ };
+ var getRng = function (editor) {
+ var bookmark = editor.bookmark ? editor.bookmark : Option.none();
+ return bookmark.bind($_68e81l6jfuw8kyc.curry(validate, $_c9h6qlzjfuw8l98.fromDom(editor.getBody()))).bind(bookmarkToNativeRng);
+ };
+ var restore = function (editor) {
+ getRng(editor).each(function (rng) {
+ editor.selection.setRng(rng);
+ });
+ };
+ var $_2a7vvg40jfuw8lyb = {
+ store: store,
+ storeNative: storeNative,
+ readRange: readRange,
+ restore: restore,
+ getRng: getRng,
+ getBookmark: getBookmark$2,
+ validate: validate
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ScrollIntoView.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.ScrollIntoView',
- [
- 'tinymce.core.dom.NodeType'
- ],
- function (NodeType) {
- var getPos = function (elm) {
- var x = 0, y = 0;
-
- var offsetParent = elm;
- while (offsetParent && offsetParent.nodeType) {
- x += offsetParent.offsetLeft || 0;
- y += offsetParent.offsetTop || 0;
- offsetParent = offsetParent.offsetParent;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var indentElement = function (dom, command, useMargin, value, unit, element) {
+ if (dom.getContentEditable(element) === 'false') {
+ return;
+ }
+ if (element.nodeName !== 'LI') {
+ var indentStyleName = useMargin ? 'margin' : 'padding';
+ indentStyleName = element.nodeName === 'TABLE' ? 'margin' : indentStyleName;
+ indentStyleName += dom.getStyle(element, 'direction', true) === 'rtl' ? 'Right' : 'Left';
+ if (command === 'outdent') {
+ var styleValue = Math.max(0, parseInt(element.style[indentStyleName] || 0, 10) - value);
+ dom.setStyle(element, indentStyleName, styleValue ? styleValue + unit : '');
+ } else {
+ var styleValue = parseInt(element.style[indentStyleName] || 0, 10) + value + unit;
+ dom.setStyle(element, indentStyleName, styleValue);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var handle = function (editor, command) {
+ var settings = editor.settings, dom = editor.dom, selection = editor.selection, formatter = editor.formatter;
+ var indentUnit = /[a-z%]+$/i.exec(settings.indentation)[0];
+ var indentValue = parseInt(settings.indentation, 10);
+ var useMargin = editor.getParam('indent_use_margin', false);
+ if (!editor.queryCommandState('InsertUnorderedList') && !editor.queryCommandState('InsertOrderedList')) {
+ if (!settings.forced_root_block && !dom.getParent(selection.getNode(), dom.isBlock)) {
+ formatter.apply('div');
+ }
+ $_9ek1bp4jfuw8kxg.each(selection.getSelectedBlocks(), function (element) {
+ return indentElement(dom, command, useMargin, indentValue, indentUnit, element);
+ });
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return { x: x, y: y };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$9 = $_52qop8kjfuw8l6v.each;
+ var extend$2 = $_52qop8kjfuw8l6v.extend;
+ var map$2 = $_52qop8kjfuw8l6v.map;
+ var inArray$2 = $_52qop8kjfuw8l6v.inArray;
+ function EditorCommands (editor) {
+ var dom, selection, formatter;
+ var commands = {
+ state: {},
+ exec: {},
+ value: {}
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var fireScrollIntoViewEvent = function (editor, elm, alignToTop) {
- var scrollEvent = { elm: elm, alignToTop: alignToTop };
- editor.fire('scrollIntoView', scrollEvent);
- return scrollEvent.isDefaultPrevented();
- };
-
- var scrollIntoView = function (editor, elm, alignToTop) {
- var y, viewPort, dom = editor.dom, root = dom.getRoot(), viewPortY, viewPortH, offsetY = 0;
-
- if (fireScrollIntoViewEvent(editor, elm, alignToTop)) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var settings = editor.settings, bookmark;
+ editor.on('PreInit', function () {
+ dom = editor.dom;
+ selection = editor.selection;
+ settings = editor.settings;
+ formatter = editor.formatter;
+ });
+ var execCommand = function (command, ui, value, args) {
+ var func, customCommand, state = false;
+ if (editor.removed) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!NodeType.isElement(elm)) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) {
+ editor.focus();
+ } else {
+ $_2a7vvg40jfuw8lyb.restore(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (alignToTop === false) {
- offsetY = elm.offsetHeight;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ args = editor.fire('BeforeExecCommand', {
+ command: command,
+ ui: ui,
+ value: value
+ });
+ if (args.isDefaultPrevented()) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (root.nodeName !== 'BODY') {
- var scrollContainer = editor.selection.getScrollContainer();
- if (scrollContainer) {
- y = getPos(elm).y - getPos(scrollContainer).y + offsetY;
- viewPortH = scrollContainer.clientHeight;
- viewPortY = scrollContainer.scrollTop;
- if (y < viewPortY || y + 25 > viewPortY + viewPortH) {
- scrollContainer.scrollTop = y < viewPortY ? y : y - viewPortH + 25;
- }
-
- return;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ customCommand = command.toLowerCase();
+ if (func = commands.exec[customCommand]) {
+ func(customCommand, ui, value);
+ editor.fire('ExecCommand', {
+ command: command,
+ ui: ui,
+ value: value
+ });
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- viewPort = dom.getViewPort(editor.getWin());
- y = dom.getPos(elm).y + offsetY;
- viewPortY = viewPort.y;
- viewPortH = viewPort.h;
- if (y < viewPort.y || y + 25 > viewPortY + viewPortH) {
- editor.getWin().scrollTo(0, y < viewPortY ? y : y - viewPortH + 25);
- }
- };
-
- return {
- scrollIntoView: scrollIntoView
- };
- }
-);
-
-/**
- * TridentSelection.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Selection class for old explorer versions. This one fakes the
- * native selection object available on modern browsers.
- *
- * @private
- * @class tinymce.dom.TridentSelection
- */
-define(
- 'tinymce.core.dom.TridentSelection',
- [
- ],
- function () {
- function Selection(selection) {
- var self = this, dom = selection.dom, FALSE = false;
-
- function getPosition(rng, start) {
- var checkRng, startIndex = 0, endIndex, inside,
- children, child, offset, index, position = -1, parent;
-
- // Setup test range, collapse it and get the parent
- checkRng = rng.duplicate();
- checkRng.collapse(start);
- parent = checkRng.parentElement();
-
- // Check if the selection is within the right document
- if (parent.ownerDocument !== selection.dom.doc) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ each$9(editor.plugins, function (p) {
+ if (p.execCommand && p.execCommand(command, ui, value)) {
+ editor.fire('ExecCommand', {
+ command: command,
+ ui: ui,
+ value: value
+ });
+ state = true;
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // IE will report non editable elements as it's parent so look for an editable one
- while (parent.contentEditable === "false") {
- parent = parent.parentNode;
- }
-
- // If parent doesn't have any children then return that we are inside the element
- if (!parent.hasChildNodes()) {
- return { node: parent, inside: 1 };
- }
-
- // Setup node list and endIndex
- children = parent.children;
- endIndex = children.length - 1;
-
- // Perform a binary search for the position
- while (startIndex <= endIndex) {
- index = Math.floor((startIndex + endIndex) / 2);
-
- // Move selection to node and compare the ranges
- child = children[index];
- checkRng.moveToElementText(child);
- position = checkRng.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', rng);
-
- // Before/after or an exact match
- if (position > 0) {
- endIndex = index - 1;
- } else if (position < 0) {
- startIndex = index + 1;
- } else {
- return { node: child };
- }
- }
-
- // Check if child position is before or we didn't find a position
- if (position < 0) {
- // No element child was found use the parent element and the offset inside that
- if (!child) {
- checkRng.moveToElementText(parent);
- checkRng.collapse(true);
- child = parent;
- inside = true;
- } else {
- checkRng.collapse(false);
- }
-
- // Walk character by character in text node until we hit the selected range endpoint,
- // hit the end of document or parent isn't the right one
- // We need to walk char by char since rng.text or rng.htmlText will trim line endings
- offset = 0;
- while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) {
- if (checkRng.move('character', 1) === 0 || parent != checkRng.parentElement()) {
- break;
- }
-
- offset++;
- }
- } else {
- // Child position is after the selection endpoint
- checkRng.collapse(true);
-
- // Walk character by character in text node until we hit the selected range endpoint, hit
- // the end of document or parent isn't the right one
- offset = 0;
- while (checkRng.compareEndPoints(start ? 'StartToStart' : 'StartToEnd', rng) !== 0) {
- if (checkRng.move('character', -1) === 0 || parent != checkRng.parentElement()) {
- break;
- }
-
- offset++;
- }
- }
-
- return { node: child, position: position, offset: offset, inside: inside };
- }
-
- // Returns a W3C DOM compatible range object by using the IE Range API
- function getRange() {
- var ieRange = selection.getRng(), domRange = dom.createRng(), element, collapsed, tmpRange, element2, bookmark;
-
- // If selection is outside the current document just return an empty range
- element = ieRange.item ? ieRange.item(0) : ieRange.parentElement();
- if (element.ownerDocument != dom.doc) {
- return domRange;
- }
-
- collapsed = selection.isCollapsed();
-
- // Handle control selection
- if (ieRange.item) {
- domRange.setStart(element.parentNode, dom.nodeIndex(element));
- domRange.setEnd(domRange.startContainer, domRange.startOffset + 1);
-
- return domRange;
- }
-
- function findEndPoint(start) {
- var endPoint = getPosition(ieRange, start), container, offset, textNodeOffset = 0, sibling, undef, nodeValue;
-
- container = endPoint.node;
- offset = endPoint.offset;
-
- if (endPoint.inside && !container.hasChildNodes()) {
- domRange[start ? 'setStart' : 'setEnd'](container, 0);
- return;
- }
-
- if (offset === undef) {
- domRange[start ? 'setStartBefore' : 'setEndAfter'](container);
- return;
- }
-
- if (endPoint.position < 0) {
- sibling = endPoint.inside ? container.firstChild : container.nextSibling;
-
- if (!sibling) {
- domRange[start ? 'setStartAfter' : 'setEndAfter'](container);
- return;
- }
-
- if (!offset) {
- if (sibling.nodeType == 3) {
- domRange[start ? 'setStart' : 'setEnd'](sibling, 0);
- } else {
- domRange[start ? 'setStartBefore' : 'setEndBefore'](sibling);
- }
-
- return;
- }
-
- // Find the text node and offset
- while (sibling) {
- if (sibling.nodeType == 3) {
- nodeValue = sibling.nodeValue;
- textNodeOffset += nodeValue.length;
-
- // We are at or passed the position we where looking for
- if (textNodeOffset >= offset) {
- container = sibling;
- textNodeOffset -= offset;
- textNodeOffset = nodeValue.length - textNodeOffset;
- break;
- }
- }
-
- sibling = sibling.nextSibling;
- }
- } else {
- // Find the text node and offset
- sibling = container.previousSibling;
-
- if (!sibling) {
- return domRange[start ? 'setStartBefore' : 'setEndBefore'](container);
- }
-
- // If there isn't any text to loop then use the first position
- if (!offset) {
- if (container.nodeType == 3) {
- domRange[start ? 'setStart' : 'setEnd'](sibling, container.nodeValue.length);
- } else {
- domRange[start ? 'setStartAfter' : 'setEndAfter'](sibling);
- }
-
- return;
- }
-
- while (sibling) {
- if (sibling.nodeType == 3) {
- textNodeOffset += sibling.nodeValue.length;
-
- // We are at or passed the position we where looking for
- if (textNodeOffset >= offset) {
- container = sibling;
- textNodeOffset -= offset;
- break;
- }
- }
-
- sibling = sibling.previousSibling;
- }
- }
-
- domRange[start ? 'setStart' : 'setEnd'](container, textNodeOffset);
- }
-
- try {
- // Find start point
- findEndPoint(true);
-
- // Find end point if needed
- if (!collapsed) {
- findEndPoint();
- }
- } catch (ex) {
- // IE has a nasty bug where text nodes might throw "invalid argument" when you
- // access the nodeValue or other properties of text nodes. This seems to happen when
- // text nodes are split into two nodes by a delete/backspace call.
- // So let us detect and try to fix it.
- if (ex.number == -2147024809) {
- // Get the current selection
- bookmark = self.getBookmark(2);
-
- // Get start element
- tmpRange = ieRange.duplicate();
- tmpRange.collapse(true);
- element = tmpRange.parentElement();
-
- // Get end element
- if (!collapsed) {
- tmpRange = ieRange.duplicate();
- tmpRange.collapse(false);
- element2 = tmpRange.parentElement();
- element2.innerHTML = element2.innerHTML;
- }
-
- // Remove the broken elements
- element.innerHTML = element.innerHTML;
-
- // Restore the selection
- self.moveToBookmark(bookmark);
-
- // Since the range has moved we need to re-get it
- ieRange = selection.getRng();
-
- // Find start point
- findEndPoint(true);
-
- // Find end point if needed
- if (!collapsed) {
- findEndPoint();
- }
- } else {
- throw ex; // Throw other errors
- }
- }
-
- return domRange;
- }
-
- this.getBookmark = function (type) {
- var rng = selection.getRng(), bookmark = {};
-
- function getIndexes(node) {
- var parent, root, children, i, indexes = [];
-
- parent = node.parentNode;
- root = dom.getRoot().parentNode;
-
- while (parent != root && parent.nodeType !== 9) {
- children = parent.children;
-
- i = children.length;
- while (i--) {
- if (node === children[i]) {
- indexes.push(i);
- break;
- }
- }
-
- node = parent;
- parent = parent.parentNode;
- }
-
- return indexes;
- }
-
- function getBookmarkEndPoint(start) {
- var position;
-
- position = getPosition(rng, start);
- if (position) {
- return {
- position: position.position,
- offset: position.offset,
- indexes: getIndexes(position.node),
- inside: position.inside
- };
- }
- }
-
- // Non ubstructive bookmark
- if (type === 2) {
- // Handle text selection
- if (!rng.item) {
- bookmark.start = getBookmarkEndPoint(true);
-
- if (!selection.isCollapsed()) {
- bookmark.end = getBookmarkEndPoint();
- }
- } else {
- bookmark.start = { ctrl: true, indexes: getIndexes(rng.item(0)) };
- }
- }
-
- return bookmark;
- };
-
- this.moveToBookmark = function (bookmark) {
- var rng, body = dom.doc.body;
-
- function resolveIndexes(indexes) {
- var node, i, idx, children;
-
- node = dom.getRoot();
- for (i = indexes.length - 1; i >= 0; i--) {
- children = node.children;
- idx = indexes[i];
-
- if (idx <= children.length - 1) {
- node = children[idx];
- }
- }
-
- return node;
- }
-
- function setBookmarkEndPoint(start) {
- var endPoint = bookmark[start ? 'start' : 'end'], moveLeft, moveRng, undef, offset;
-
- if (endPoint) {
- moveLeft = endPoint.position > 0;
-
- moveRng = body.createTextRange();
- moveRng.moveToElementText(resolveIndexes(endPoint.indexes));
-
- offset = endPoint.offset;
- if (offset !== undef) {
- moveRng.collapse(endPoint.inside || moveLeft);
- moveRng.moveStart('character', moveLeft ? -offset : offset);
- } else {
- moveRng.collapse(start);
- }
-
- rng.setEndPoint(start ? 'StartToStart' : 'EndToStart', moveRng);
-
- if (start) {
- rng.collapse(true);
- }
- }
- }
-
- if (bookmark.start) {
- if (bookmark.start.ctrl) {
- rng = body.createControlRange();
- rng.addElement(resolveIndexes(bookmark.start.indexes));
- rng.select();
- } else {
- rng = body.createTextRange();
- setBookmarkEndPoint(true);
- setBookmarkEndPoint();
- rng.select();
- }
- }
- };
-
- this.addRange = function (rng) {
- var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, sibling,
- doc = selection.dom.doc, body = doc.body, nativeRng, ctrlElm;
-
- function setEndPoint(start) {
- var container, offset, marker, tmpRng, nodes;
-
- marker = dom.create('a');
- container = start ? startContainer : endContainer;
- offset = start ? startOffset : endOffset;
- tmpRng = ieRng.duplicate();
-
- if (container == doc || container == doc.documentElement) {
- container = body;
- offset = 0;
- }
-
- if (container.nodeType == 3) {
- container.parentNode.insertBefore(marker, container);
- tmpRng.moveToElementText(marker);
- tmpRng.moveStart('character', offset);
- dom.remove(marker);
- ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);
- } else {
- nodes = container.childNodes;
-
- if (nodes.length) {
- if (offset >= nodes.length) {
- dom.insertAfter(marker, nodes[nodes.length - 1]);
- } else {
- container.insertBefore(marker, nodes[offset]);
- }
-
- tmpRng.moveToElementText(marker);
- } else if (container.canHaveHTML) {
- // Empty node selection for example <div>|</div>
- // Setting innerHTML with a span marker then remove that marker seems to keep empty block elements open
- container.innerHTML = '<span></span>';
- marker = container.firstChild;
- tmpRng.moveToElementText(marker);
- tmpRng.collapse(FALSE); // Collapse false works better than true for some odd reason
- }
-
- ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);
- dom.remove(marker);
- }
- }
-
- // Setup some shorter versions
- startContainer = rng.startContainer;
- startOffset = rng.startOffset;
- endContainer = rng.endContainer;
- endOffset = rng.endOffset;
- ieRng = body.createTextRange();
-
- // If single element selection then try making a control selection out of it
- if (startContainer == endContainer && startContainer.nodeType == 1) {
- // Trick to place the caret inside an empty block element like <p></p>
- if (startOffset == endOffset && !startContainer.hasChildNodes()) {
- if (startContainer.canHaveHTML) {
- // Check if previous sibling is an empty block if it is then we need to render it
- // IE would otherwise move the caret into the sibling instead of the empty startContainer see: #5236
- // Example this: <p></p><p>|</p> would become this: <p>|</p><p></p>
- sibling = startContainer.previousSibling;
- if (sibling && !sibling.hasChildNodes() && dom.isBlock(sibling)) {
- sibling.innerHTML = '';
- } else {
- sibling = null;
- }
-
- startContainer.innerHTML = '<span></span><span></span>';
- ieRng.moveToElementText(startContainer.lastChild);
- ieRng.select();
- dom.doc.selection.clear();
- startContainer.innerHTML = '';
-
- if (sibling) {
- sibling.innerHTML = '';
- }
- return;
- }
-
- startOffset = dom.nodeIndex(startContainer);
- startContainer = startContainer.parentNode;
- }
-
- if (startOffset == endOffset - 1) {
- try {
- ctrlElm = startContainer.childNodes[startOffset];
- ctrlRng = body.createControlRange();
- ctrlRng.addElement(ctrlElm);
- ctrlRng.select();
-
- // Check if the range produced is on the correct element and is a control range
- // On IE 8 it will select the parent contentEditable container if you select an inner element see: #5398
- nativeRng = selection.getRng();
- if (nativeRng.item && ctrlElm === nativeRng.item(0)) {
- return;
- }
- } catch (ex) {
- // Ignore
- }
- }
- }
-
- // Set start/end point of selection
- setEndPoint(true);
- setEndPoint();
-
- // Select the new range and scroll it into view
- ieRng.select();
- };
-
- // Expose range method
- this.getRangeAt = getRange;
- }
-
- return Selection;
- }
-);
-
-define(
- 'ephox.sugar.api.dom.Replication',
-
- [
- 'ephox.sugar.api.properties.Attr',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.dom.Insert',
- 'ephox.sugar.api.dom.InsertAll',
- 'ephox.sugar.api.dom.Remove',
- 'ephox.sugar.api.search.Traverse'
- ],
-
- function (Attr, Element, Insert, InsertAll, Remove, Traverse) {
- var clone = function (original, deep) {
- return Element.fromDom(original.dom().cloneNode(deep));
- };
-
- /** Shallow clone - just the tag, no children */
- var shallow = function (original) {
- return clone(original, false);
- };
-
- /** Deep clone - everything copied including children */
- var deep = function (original) {
- return clone(original, true);
- };
-
- /** Shallow clone, with a new tag */
- var shallowAs = function (original, tag) {
- var nu = Element.fromTag(tag);
-
- var attributes = Attr.clone(original);
- Attr.setAll(nu, attributes);
-
- return nu;
- };
-
- /** Deep clone, with a new tag */
- var copy = function (original, tag) {
- var nu = shallowAs(original, tag);
-
- // NOTE
- // previously this used serialisation:
- // nu.dom().innerHTML = original.dom().innerHTML;
- //
- // Clone should be equivalent (and faster), but if TD <-> TH toggle breaks, put it back.
-
- var cloneChildren = Traverse.children(deep(original));
- InsertAll.append(nu, cloneChildren);
-
- return nu;
- };
-
- /** Change the tag name, but keep all children */
- var mutate = function (original, tag) {
- var nu = shallowAs(original, tag);
-
- Insert.before(original, nu);
- var children = Traverse.children(original);
- InsertAll.append(nu, children);
- Remove.remove(original);
- return nu;
- };
-
- return {
- shallow: shallow,
- shallowAs: shallowAs,
- deep: deep,
- copy: copy,
- mutate: mutate
- };
- }
-);
-
-define(
- 'ephox.sugar.api.node.Fragment',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.node.Element',
- 'global!document'
- ],
-
- function (Arr, Element, document) {
- var fromElements = function (elements, scope) {
- var doc = scope || document;
- var fragment = doc.createDocumentFragment();
- Arr.each(elements, function (element) {
- fragment.appendChild(element.dom());
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Element.fromDom(fragment);
- };
-
- return {
- fromElements: fromElements
- };
- }
-);
-
-define(
- 'ephox.sugar.impl.ClosestOrAncestor',
-
- [
- 'ephox.katamari.api.Type',
- 'ephox.katamari.api.Option'
- ],
-
- function (Type, Option) {
- return function (is, ancestor, scope, a, isRoot) {
- return is(scope, a) ?
- Option.some(scope) :
- Type.isFunction(isRoot) && isRoot(scope) ?
- Option.none() :
- ancestor(scope, a, isRoot);
- };
- }
-);
-define(
- 'ephox.sugar.api.search.PredicateFind',
-
- [
- 'ephox.katamari.api.Type',
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.sugar.api.node.Body',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.impl.ClosestOrAncestor'
- ],
-
- function (Type, Arr, Fun, Option, Body, Compare, Element, ClosestOrAncestor) {
- var first = function (predicate) {
- return descendant(Body.body(), predicate);
- };
-
- var ancestor = function (scope, predicate, isRoot) {
- var element = scope.dom();
- var stop = Type.isFunction(isRoot) ? isRoot : Fun.constant(false);
-
- while (element.parentNode) {
- element = element.parentNode;
- var el = Element.fromDom(element);
-
- if (predicate(el)) return Option.some(el);
- else if (stop(el)) break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (state) {
+ return state;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Option.none();
- };
-
- var closest = function (scope, predicate, isRoot) {
- // This is required to avoid ClosestOrAncestor passing the predicate to itself
- var is = function (scope) {
- return predicate(scope);
- };
- return ClosestOrAncestor(is, ancestor, scope, predicate, isRoot);
- };
-
- var sibling = function (scope, predicate) {
- var element = scope.dom();
- if (!element.parentNode) return Option.none();
-
- return child(Element.fromDom(element.parentNode), function (x) {
- return !Compare.eq(scope, x) && predicate(x);
- });
- };
-
- var child = function (scope, predicate) {
- var result = Arr.find(scope.dom().childNodes,
- Fun.compose(predicate, Element.fromDom));
- return result.map(Element.fromDom);
- };
-
- var descendant = function (scope, predicate) {
- var descend = function (element) {
- for (var i = 0; i < element.childNodes.length; i++) {
- if (predicate(Element.fromDom(element.childNodes[i])))
- return Option.some(Element.fromDom(element.childNodes[i]));
-
- var res = descend(element.childNodes[i]);
- if (res.isSome())
- return res;
- }
-
- return Option.none();
- };
-
- return descend(scope.dom());
- };
-
- return {
- first: first,
- ancestor: ancestor,
- closest: closest,
- sibling: sibling,
- child: child,
- descendant: descendant
- };
- }
-);
-
-define(
- 'ephox.sugar.api.search.SelectorFind',
-
- [
- 'ephox.sugar.api.search.PredicateFind',
- 'ephox.sugar.api.search.Selectors',
- 'ephox.sugar.impl.ClosestOrAncestor'
- ],
-
- function (PredicateFind, Selectors, ClosestOrAncestor) {
- // TODO: An internal SelectorFilter module that doesn't Element.fromDom() everything
-
- var first = function (selector) {
- return Selectors.one(selector);
- };
-
- var ancestor = function (scope, selector, isRoot) {
- return PredicateFind.ancestor(scope, function (e) {
- return Selectors.is(e, selector);
- }, isRoot);
- };
-
- var sibling = function (scope, selector) {
- return PredicateFind.sibling(scope, function (e) {
- return Selectors.is(e, selector);
- });
- };
-
- var child = function (scope, selector) {
- return PredicateFind.child(scope, function (e) {
- return Selectors.is(e, selector);
- });
- };
-
- var descendant = function (scope, selector) {
- return Selectors.one(selector, scope);
- };
-
- var closest = function (scope, selector, isRoot) {
- return ClosestOrAncestor(Selectors.is, ancestor, scope, selector, isRoot);
- };
-
- return {
- first: first,
- ancestor: ancestor,
- sibling: sibling,
- child: child,
- descendant: descendant,
- closest: closest
- };
- }
-);
-
-/**
- * Parents.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.Parents',
- [
- 'ephox.katamari.api.Fun',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.search.Traverse'
- ],
- function (Fun, Compare, Traverse) {
- var dropLast = function (xs) {
- return xs.slice(0, -1);
- };
-
- var parentsUntil = function (startNode, rootElm, predicate) {
- if (Compare.contains(rootElm, startNode)) {
- return dropLast(Traverse.parents(startNode, function (elm) {
- return predicate(elm) || Compare.eq(elm, rootElm);
- }));
- } else {
- return [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (editor.theme && editor.theme.execCommand && editor.theme.execCommand(command, ui, value)) {
+ editor.fire('ExecCommand', {
+ command: command,
+ ui: ui,
+ value: value
+ });
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var parents = function (startNode, rootElm) {
- return parentsUntil(startNode, rootElm, Fun.constant(false));
- };
-
- var parentsAndSelf = function (startNode, rootElm) {
- return [startNode].concat(parents(startNode, rootElm));
- };
-
- return {
- parentsUntil: parentsUntil,
- parents: parents,
- parentsAndSelf: parentsAndSelf
- };
- }
-);
-
-define(
- 'ephox.katamari.api.Options',
-
- [
- 'ephox.katamari.api.Option'
- ],
-
- function (Option) {
- /** cat :: [Option a] -> [a] */
- var cat = function (arr) {
- var r = [];
- var push = function (x) {
- r.push(x);
- };
- for (var i = 0; i < arr.length; i++) {
- arr[i].each(push);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ try {
+ state = editor.getDoc().execCommand(command, ui, value);
+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return r;
- };
-
- /** findMap :: ([a], (a, Int -> Option b)) -> Option b */
- var findMap = function (arr, f) {
- for (var i = 0; i < arr.length; i++) {
- var r = f(arr[i], i);
- if (r.isSome()) {
- return r;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (state) {
+ editor.fire('ExecCommand', {
+ command: command,
+ ui: ui,
+ value: value
+ });
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * if all elements in arr are 'some', their inner values are passed as arguments to f
- * f must have arity arr.length
- */
- var liftN = function(arr, f) {
- var r = [];
- for (var i = 0; i < arr.length; i++) {
- var x = arr[i];
- if (x.isSome()) {
- r.push(x.getOrDie());
- } else {
- return Option.none();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var queryCommandState = function (command) {
+ var func;
+ if (editor.quirks.isHidden() || editor.removed) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Option.some(f.apply(null, r));
- };
-
- return {
- cat: cat,
- findMap: findMap,
- liftN: liftN
- };
- }
-);
-
-/**
- * SelectionUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.selection.SelectionUtils',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.api.Options',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.node.Node',
- 'ephox.sugar.api.search.Traverse',
- 'tinymce.core.dom.NodeType'
- ],
- function (Arr, Fun, Option, Options, Compare, Element, Node, Traverse, NodeType) {
- var getStartNode = function (rng) {
- var sc = rng.startContainer, so = rng.startOffset;
- if (NodeType.isText(sc)) {
- return so === 0 ? Option.some(Element.fromDom(sc)) : Option.none();
- } else {
- return Option.from(sc.childNodes[so]).map(Element.fromDom);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ command = command.toLowerCase();
+ if (func = commands.state[command]) {
+ return func(command);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var getEndNode = function (rng) {
- var ec = rng.endContainer, eo = rng.endOffset;
- if (NodeType.isText(ec)) {
- return eo === ec.data.length ? Option.some(Element.fromDom(ec)) : Option.none();
- } else {
- return Option.from(ec.childNodes[eo - 1]).map(Element.fromDom);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ try {
+ return editor.getDoc().queryCommandState(command);
+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getFirstChildren = function (node) {
- return Traverse.firstChild(node).fold(
- Fun.constant([node]),
- function (child) {
- return [node].concat(getFirstChildren(child));
- }
- );
- };
-
- var getLastChildren = function (node) {
- return Traverse.lastChild(node).fold(
- Fun.constant([node]),
- function (child) {
- if (Node.name(child) === 'br') {
- return Traverse.prevSibling(child).map(function (sibling) {
- return [node].concat(getLastChildren(sibling));
- }).getOr([]);
- } else {
- return [node].concat(getLastChildren(child));
- }
- }
- );
- };
-
- var hasAllContentsSelected = function (elm, rng) {
- return Options.liftN([getStartNode(rng), getEndNode(rng)], function (startNode, endNode) {
- var start = Arr.find(getFirstChildren(elm), Fun.curry(Compare.eq, startNode));
- var end = Arr.find(getLastChildren(elm), Fun.curry(Compare.eq, endNode));
- return start.isSome() && end.isSome();
- }).getOr(false);
- };
-
- return {
- hasAllContentsSelected: hasAllContentsSelected
- };
- }
-);
-
-/**
- * SimpleTableModel.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.selection.SimpleTableModel',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.api.Struct',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.dom.Insert',
- 'ephox.sugar.api.dom.InsertAll',
- 'ephox.sugar.api.dom.Replication',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.properties.Attr',
- 'ephox.sugar.api.search.SelectorFilter'
- ],
- function (Arr, Option, Struct, Compare, Insert, InsertAll, Replication, Element, Attr, SelectorFilter) {
- var tableModel = Struct.immutable('element', 'width', 'rows');
- var tableRow = Struct.immutable('element', 'cells');
- var cellPosition = Struct.immutable('x', 'y');
-
- var getSpan = function (td, key) {
- var value = parseInt(Attr.get(td, key), 10);
- return isNaN(value) ? 1 : value;
- };
-
- var fillout = function (table, x, y, tr, td) {
- var rowspan = getSpan(td, 'rowspan');
- var colspan = getSpan(td, 'colspan');
- var rows = table.rows();
-
- for (var y2 = y; y2 < y + rowspan; y2++) {
- if (!rows[y2]) {
- rows[y2] = tableRow(Replication.deep(tr), []);
- }
-
- for (var x2 = x; x2 < x + colspan; x2++) {
- var cells = rows[y2].cells();
-
- // not filler td:s are purposely not cloned so that we can
- // find cells in the model by element object references
- cells[x2] = y2 == y && x2 == x ? td : Replication.shallow(td);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var queryCommandValue = function (command) {
+ var func;
+ if (editor.quirks.isHidden() || editor.removed) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var cellExists = function (table, x, y) {
- var rows = table.rows();
- var cells = rows[y] ? rows[y].cells() : [];
- return !!cells[x];
- };
-
- var skipCellsX = function (table, x, y) {
- while (cellExists(table, x, y)) {
- x++;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ command = command.toLowerCase();
+ if (func = commands.value[command]) {
+ return func(command);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return x;
- };
-
- var getWidth = function (rows) {
- return Arr.foldl(rows, function (acc, row) {
- return row.cells().length > acc ? row.cells().length : acc;
- }, 0);
- };
-
- var findElementPos = function (table, element) {
- var rows = table.rows();
- for (var y = 0; y < rows.length; y++) {
- var cells = rows[y].cells();
- for (var x = 0; x < cells.length; x++) {
- if (Compare.eq(cells[x], element)) {
- return Option.some(cellPosition(x, y));
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ try {
+ return editor.getDoc().queryCommandValue(command);
+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Option.none();
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var extractRows = function (table, sx, sy, ex, ey) {
- var newRows = [];
- var rows = table.rows();
-
- for (var y = sy; y <= ey; y++) {
- var cells = rows[y].cells();
- var slice = sx < ex ? cells.slice(sx, ex + 1) : cells.slice(ex, sx + 1);
- newRows.push(tableRow(rows[y].element(), slice));
- }
-
- return newRows;
- };
-
- var subTable = function (table, startPos, endPos) {
- var sx = startPos.x(), sy = startPos.y();
- var ex = endPos.x(), ey = endPos.y();
- var newRows = sy < ey ? extractRows(table, sx, sy, ex, ey) : extractRows(table, sx, ey, ex, sy);
-
- return tableModel(table.element(), getWidth(newRows), newRows);
- };
-
- var createDomTable = function (table, rows) {
- var tableElement = Replication.shallow(table.element());
- var tableBody = Element.fromTag('tbody');
-
- InsertAll.append(tableBody, rows);
- Insert.append(tableElement, tableBody);
-
- return tableElement;
- };
-
- var modelRowsToDomRows = function (table) {
- return Arr.map(table.rows(), function (row) {
- var cells = Arr.map(row.cells(), function (cell) {
- var td = Replication.deep(cell);
- Attr.remove(td, 'colspan');
- Attr.remove(td, 'rowspan');
- return td;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addCommands = function (commandList, type) {
+ type = type || 'exec';
+ each$9(commandList, function (callback, command) {
+ each$9(command.toLowerCase().split(','), function (command) {
+ commands[type][command] = callback;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var tr = Replication.shallow(row.element());
- InsertAll.append(tr, cells);
- return tr;
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var fromDom = function (tableElm) {
- var table = tableModel(Replication.shallow(tableElm), 0, []);
-
- Arr.each(SelectorFilter.descendants(tableElm, 'tr'), function (tr, y) {
- Arr.each(SelectorFilter.descendants(tr, 'td,th'), function (td, x) {
- fillout(table, skipCellsX(table, x, y), y, tr, td);
- });
- });
-
- return tableModel(table.element(), getWidth(table.rows()), table.rows());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addCommand = function (command, callback, scope) {
+ command = command.toLowerCase();
+ commands.exec[command] = function (command, ui, value, args) {
+ return callback.call(scope || editor, ui, value, args);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var toDom = function (table) {
- return createDomTable(table, modelRowsToDomRows(table));
- };
-
- var subsection = function (table, startElement, endElement) {
- return findElementPos(table, startElement).bind(function (startPos) {
- return findElementPos(table, endElement).map(function (endPos) {
- return subTable(table, startPos, endPos);
- });
- });
- };
-
- return {
- fromDom: fromDom,
- toDom: toDom,
- subsection: subsection
- };
- }
-);
-
-/**
- * MultiRange.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.selection.MultiRange',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.node.Element',
- 'tinymce.core.dom.RangeUtils'
- ],
- function (Arr, Element, RangeUtils) {
- var getRanges = function (selection) {
- var ranges = [];
-
- if (selection) {
- for (var i = 0; i < selection.rangeCount; i++) {
- ranges.push(selection.getRangeAt(i));
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var queryCommandSupported = function (command) {
+ command = command.toLowerCase();
+ if (commands.exec[command]) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return ranges;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ try {
+ return editor.getDoc().queryCommandSupported(command);
+ } catch (ex) {
+ }
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getSelectedNodes = function (ranges) {
- return Arr.bind(ranges, function (range) {
- var node = RangeUtils.getSelectedNode(range);
- return node ? [ Element.fromDom(node) ] : [];
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addQueryStateHandler = function (command, callback, scope) {
+ command = command.toLowerCase();
+ commands.state[command] = function () {
+ return callback.call(scope || editor);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var hasMultipleRanges = function (selection) {
- return getRanges(selection).length > 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addQueryValueHandler = function (command, callback, scope) {
+ command = command.toLowerCase();
+ commands.value[command] = function () {
+ return callback.call(scope || editor);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- getRanges: getRanges,
- getSelectedNodes: getSelectedNodes,
- hasMultipleRanges: hasMultipleRanges
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasCustomCommand = function (command) {
+ command = command.toLowerCase();
+ return !!commands.exec[command];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * TableCellSelection.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.selection.TableCellSelection',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.SelectorFilter',
- 'tinymce.core.dom.ElementType',
- 'tinymce.core.selection.MultiRange'
- ],
- function (Arr, Element, SelectorFilter, ElementType, MultiRange) {
- var getCellsFromRanges = function (ranges) {
- return Arr.filter(MultiRange.getSelectedNodes(ranges), ElementType.isTableCell);
- };
-
- var getCellsFromElement = function (elm) {
- var selectedCells = SelectorFilter.descendants(elm, 'td[data-mce-selected],th[data-mce-selected]');
- return selectedCells;
- };
-
- var getCellsFromElementOrRanges = function (ranges, element) {
- var selectedCells = getCellsFromElement(element);
- var rangeCells = getCellsFromRanges(ranges);
- return selectedCells.length > 0 ? selectedCells : rangeCells;
- };
-
- var getCellsFromEditor = function (editor) {
- return getCellsFromElementOrRanges(MultiRange.getRanges(editor.selection.getSel()), Element.fromDom(editor.getBody()));
- };
-
- return {
- getCellsFromRanges: getCellsFromRanges,
- getCellsFromElement: getCellsFromElement,
- getCellsFromElementOrRanges: getCellsFromElementOrRanges,
- getCellsFromEditor: getCellsFromEditor
- };
- }
-);
-
-/**
- * FragmentReader.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.selection.FragmentReader',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.dom.Insert',
- 'ephox.sugar.api.dom.Replication',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.node.Fragment',
- 'ephox.sugar.api.node.Node',
- 'ephox.sugar.api.search.SelectorFind',
- 'ephox.sugar.api.search.Traverse',
- 'tinymce.core.dom.ElementType',
- 'tinymce.core.dom.Parents',
- 'tinymce.core.selection.SelectionUtils',
- 'tinymce.core.selection.SimpleTableModel',
- 'tinymce.core.selection.TableCellSelection'
- ],
- function (Arr, Fun, Compare, Insert, Replication, Element, Fragment, Node, SelectorFind, Traverse, ElementType, Parents, SelectionUtils, SimpleTableModel, TableCellSelection) {
- var findParentListContainer = function (parents) {
- return Arr.find(parents, function (elm) {
- return Node.name(elm) === 'ul' || Node.name(elm) === 'ol';
- });
- };
-
- var getFullySelectedListWrappers = function (parents, rng) {
- return Arr.find(parents, function (elm) {
- return Node.name(elm) === 'li' && SelectionUtils.hasAllContentsSelected(elm, rng);
- }).fold(
- Fun.constant([]),
- function (li) {
- return findParentListContainer(parents).map(function (listCont) {
- return [
- Element.fromTag('li'),
- Element.fromTag(Node.name(listCont))
- ];
- }).getOr([]);
- }
- );
- };
-
- var wrap = function (innerElm, elms) {
- var wrapped = Arr.foldl(elms, function (acc, elm) {
- Insert.append(elm, acc);
- return elm;
- }, innerElm);
- return elms.length > 0 ? Fragment.fromElements([wrapped]) : wrapped;
- };
-
- var directListWrappers = function (commonAnchorContainer) {
- if (ElementType.isListItem(commonAnchorContainer)) {
- return Traverse.parent(commonAnchorContainer).filter(ElementType.isList).fold(
- Fun.constant([]),
- function (listElm) {
- return [ commonAnchorContainer, listElm ];
- }
- );
- } else {
- return ElementType.isList(commonAnchorContainer) ? [ commonAnchorContainer ] : [ ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ extend$2(this, {
+ execCommand: execCommand,
+ queryCommandState: queryCommandState,
+ queryCommandValue: queryCommandValue,
+ queryCommandSupported: queryCommandSupported,
+ addCommands: addCommands,
+ addCommand: addCommand,
+ addQueryStateHandler: addQueryStateHandler,
+ addQueryValueHandler: addQueryValueHandler,
+ hasCustomCommand: hasCustomCommand
+ });
+ var execNativeCommand = function (command, ui, value) {
+ if (ui === undefined) {
+ ui = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (value === undefined) {
+ value = null;
+ }
+ return editor.getDoc().execCommand(command, ui, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getWrapElements = function (rootNode, rng) {
- var commonAnchorContainer = Element.fromDom(rng.commonAncestorContainer);
- var parents = Parents.parentsAndSelf(commonAnchorContainer, rootNode);
- var wrapElements = Arr.filter(parents, function (elm) {
- return ElementType.isInline(elm) || ElementType.isHeading(elm);
- });
- var listWrappers = getFullySelectedListWrappers(parents, rng);
- var allWrappers = wrapElements.concat(listWrappers.length ? listWrappers : directListWrappers(commonAnchorContainer));
- return Arr.map(allWrappers, Replication.shallow);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isFormatMatch = function (name) {
+ return formatter.match(name);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var emptyFragment = function () {
- return Fragment.fromElements([]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toggleFormat = function (name, value) {
+ formatter.toggle(name, value ? { value: value } : undefined);
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getFragmentFromRange = function (rootNode, rng) {
- return wrap(Element.fromDom(rng.cloneContents()), getWrapElements(rootNode, rng));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var storeSelection = function (type) {
+ bookmark = selection.getBookmark(type);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getParentTable = function (rootElm, cell) {
- return SelectorFind.ancestor(cell, 'table', Fun.curry(Compare.eq, rootElm));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var restoreSelection = function () {
+ selection.moveToBookmark(bookmark);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getTableFragment = function (rootNode, selectedTableCells) {
- return getParentTable(rootNode, selectedTableCells[0]).bind(function (tableElm) {
- var firstCell = selectedTableCells[0];
- var lastCell = selectedTableCells[selectedTableCells.length - 1];
- var fullTableModel = SimpleTableModel.fromDom(tableElm);
-
- return SimpleTableModel.subsection(fullTableModel, firstCell, lastCell).map(function (sectionedTableModel) {
- return Fragment.fromElements([SimpleTableModel.toDom(sectionedTableModel)]);
- });
- }).getOrThunk(emptyFragment);
- };
-
- var getSelectionFragment = function (rootNode, ranges) {
- return ranges.length > 0 && ranges[0].collapsed ? emptyFragment() : getFragmentFromRange(rootNode, ranges[0]);
- };
-
- var read = function (rootNode, ranges) {
- var selectedCells = TableCellSelection.getCellsFromElementOrRanges(ranges, rootNode);
- return selectedCells.length > 0 ? getTableFragment(rootNode, selectedCells) : getSelectionFragment(rootNode, ranges);
- };
-
- return {
- read: read
- };
- }
-);
-
-/**
- * Selection.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class handles text and control selection it's an crossbrowser utility class.
- * Consult the TinyMCE Wiki API for more details and examples on how to use this class.
- *
- * @class tinymce.dom.Selection
- * @example
- * // Getting the currently selected node for the active editor
- * alert(tinymce.activeEditor.selection.getNode().nodeName);
- */
-define(
- 'tinymce.core.dom.Selection',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.dom.BookmarkManager',
- 'tinymce.core.dom.ControlSelection',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.dom.ScrollIntoView',
- 'tinymce.core.dom.TreeWalker',
- 'tinymce.core.dom.TridentSelection',
- 'tinymce.core.Env',
- 'tinymce.core.selection.FragmentReader',
- 'tinymce.core.selection.MultiRange',
- 'tinymce.core.text.Zwsp',
- 'tinymce.core.util.Tools'
- ],
- function (
- Arr, Compare, Element, CaretPosition, BookmarkManager, ControlSelection, NodeType, RangeUtils, ScrollIntoView, TreeWalker, TridentSelection, Env, FragmentReader,
- MultiRange, Zwsp, Tools
- ) {
- var each = Tools.each, trim = Tools.trim;
- var isIE = Env.ie;
-
- var isAttachedToDom = function (node) {
- return !!(node && node.ownerDocument) && Compare.contains(Element.fromDom(node.ownerDocument), Element.fromDom(node));
- };
-
- var isValidRange = function (rng) {
- if (!rng) {
- return false;
- } else if (rng.select) { // Native IE range still produced by placeCaretAt
- return true;
- } else {
- return isAttachedToDom(rng.startContainer) && isAttachedToDom(rng.endContainer);
- }
- };
-
- var eventProcessRanges = function (editor, ranges) {
- return Arr.map(ranges, function (range) {
- var evt = editor.fire('GetSelectionRange', { range: range });
- return evt.range !== range ? evt.range : range;
- });
- };
-
- /**
- * Constructs a new selection instance.
- *
- * @constructor
- * @method Selection
- * @param {tinymce.dom.DOMUtils} dom DOMUtils object reference.
- * @param {Window} win Window to bind the selection object to.
- * @param {tinymce.Editor} editor Editor instance of the selection.
- * @param {tinymce.dom.Serializer} serializer DOM serialization class to use for getContent.
- */
- function Selection(dom, win, serializer, editor) {
- var self = this;
-
- self.dom = dom;
- self.win = win;
- self.serializer = serializer;
- self.editor = editor;
- self.bookmarkManager = new BookmarkManager(self);
- self.controlSelection = new ControlSelection(self, editor);
-
- // No W3C Range support
- if (!self.win.getSelection) {
- self.tridentSel = new TridentSelection(self);
- }
- }
-
- Selection.prototype = {
- /**
- * Move the selection cursor range to the specified node and offset.
- * If there is no node specified it will move it to the first suitable location within the body.
- *
- * @method setCursorLocation
- * @param {Node} node Optional node to put the cursor in.
- * @param {Number} offset Optional offset from the start of the node to put the cursor at.
- */
- setCursorLocation: function (node, offset) {
- var self = this, rng = self.dom.createRng();
-
- if (!node) {
- self._moveEndPoint(rng, self.editor.getBody(), true);
- self.setRng(rng);
- } else {
- rng.setStart(node, offset);
- rng.setEnd(node, offset);
- self.setRng(rng);
- self.collapse(false);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ addCommands({
+ 'mceResetDesignMode,mceBeginUndoLevel': function () {
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the selected contents using the DOM serializer passed in to this class.
- *
- * @method getContent
- * @param {Object} args Optional settings class with for example output format text or html.
- * @return {String} Selected contents in for example HTML format.
- * @example
- * // Alerts the currently selected contents
- * alert(tinymce.activeEditor.selection.getContent());
- *
- * // Alerts the currently selected contents as plain text
- * alert(tinymce.activeEditor.selection.getContent({format: 'text'}));
- */
- getContent: function (args) {
- var self = this, rng = self.getRng(), tmpElm = self.dom.create("body");
- var se = self.getSel(), whiteSpaceBefore, whiteSpaceAfter, fragment;
- var ranges = eventProcessRanges(self.editor, MultiRange.getRanges(this.getSel()));
-
- args = args || {};
- whiteSpaceBefore = whiteSpaceAfter = '';
- args.get = true;
- args.format = args.format || 'html';
- args.selection = true;
- self.editor.fire('BeforeGetContent', args);
-
- if (args.format === 'text') {
- return self.isCollapsed() ? '' : Zwsp.trim(rng.text || (se.toString ? se.toString() : ''));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceEndUndoLevel,mceAddUndoLevel': function () {
+ editor.undoManager.add();
+ },
+ 'Cut,Copy,Paste': function (command) {
+ var doc = editor.getDoc();
+ var failed;
+ try {
+ execNativeCommand(command);
+ } catch (ex) {
+ failed = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rng.cloneContents) {
- fragment = args.contextual ? FragmentReader.read(Element.fromDom(self.editor.getBody()), ranges).dom() : rng.cloneContents();
- if (fragment) {
- tmpElm.appendChild(fragment);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (command === 'paste' && !doc.queryCommandEnabled(command)) {
+ failed = true;
+ }
+ if (failed || !doc.queryCommandSupported(command)) {
+ var msg = editor.translate('Your browser doesn\'t support direct access to the clipboard. ' + 'Please use the Ctrl+X/C/V keyboard shortcuts instead.');
+ if ($_9fhi43ajfuw8l13.mac) {
+ msg = msg.replace(/Ctrl\+/g, '\u2318+');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if (rng.item !== undefined || rng.htmlText !== undefined) {
- // IE will produce invalid markup if elements are present that
- // it doesn't understand like custom elements or HTML5 elements.
- // Adding a BR in front of the contents and then remoiving it seems to fix it though.
- tmpElm.innerHTML = '<br>' + (rng.item ? rng.item(0).outerHTML : rng.htmlText);
- tmpElm.removeChild(tmpElm.firstChild);
- } else {
- tmpElm.innerHTML = rng.toString();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.notificationManager.open({
+ text: msg,
+ type: 'error'
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Keep whitespace before and after
- if (/^\s/.test(tmpElm.innerHTML)) {
- whiteSpaceBefore = ' ';
- }
-
- if (/\s+$/.test(tmpElm.innerHTML)) {
- whiteSpaceAfter = ' ';
- }
-
- args.getInner = true;
-
- args.content = self.isCollapsed() ? '' : whiteSpaceBefore + self.serializer.serialize(tmpElm, args) + whiteSpaceAfter;
- self.editor.fire('GetContent', args);
-
- return args.content;
</del><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Sets the current selection to the specified content. If any contents is selected it will be replaced
- * with the contents passed in to this function. If there is no selection the contents will be inserted
- * where the caret is placed in the editor/page.
- *
- * @method setContent
- * @param {String} content HTML contents to set could also be other formats depending on settings.
- * @param {Object} args Optional settings object with for example data format.
- * @example
- * // Inserts some HTML contents at the current selection
- * tinymce.activeEditor.selection.setContent('<strong>Some contents</strong>');
- */
- setContent: function (content, args) {
- var self = this, rng = self.getRng(), caretNode, doc = self.win.document, frag, temp;
-
- args = args || { format: 'html' };
- args.set = true;
- args.selection = true;
- args.content = content;
-
- // Dispatch before set content event
- if (!args.no_events) {
- self.editor.fire('BeforeSetContent', args);
- }
-
- content = args.content;
-
- if (rng.insertNode) {
- // Make caret marker since insertNode places the caret in the beginning of text after insert
- content += '<span id="__caret">_</span>';
-
- // Delete and insert new node
- if (rng.startContainer == doc && rng.endContainer == doc) {
- // WebKit will fail if the body is empty since the range is then invalid and it can't insert contents
- doc.body.innerHTML = content;
- } else {
- rng.deleteContents();
-
- if (doc.body.childNodes.length === 0) {
- doc.body.innerHTML = content;
- } else {
- // createContextualFragment doesn't exists in IE 9 DOMRanges
- if (rng.createContextualFragment) {
- rng.insertNode(rng.createContextualFragment(content));
- } else {
- // Fake createContextualFragment call in IE 9
- frag = doc.createDocumentFragment();
- temp = doc.createElement('div');
-
- frag.appendChild(temp);
- temp.outerHTML = content;
-
- rng.insertNode(frag);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'unlink': function () {
+ if (selection.isCollapsed()) {
+ var elm = editor.dom.getParent(editor.selection.getStart(), 'a');
+ if (elm) {
+ editor.dom.remove(elm, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Move to caret marker
- caretNode = self.dom.get('__caret');
-
- // Make sure we wrap it compleatly, Opera fails with a simple select call
- rng = doc.createRange();
- rng.setStartBefore(caretNode);
- rng.setEndBefore(caretNode);
- self.setRng(rng);
-
- // Remove the caret position
- self.dom.remove('__caret');
-
- try {
- self.setRng(rng);
- } catch (ex) {
- // Might fail on Opera for some odd reason
- }
- } else {
- if (rng.item) {
- // Delete content and get caret text selection
- doc.execCommand('Delete', false, null);
- rng = self.getRng();
- }
-
- // Explorer removes spaces from the beginning of pasted contents
- if (/^\s+/.test(content)) {
- rng.pasteHTML('<span id="__mce_tmp">_</span>' + content);
- self.dom.remove('__mce_tmp');
- } else {
- rng.pasteHTML(content);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Dispatch set content event
- if (!args.no_events) {
- self.editor.fire('SetContent', args);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ formatter.remove('link');
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the start element of a selection range. If the start is in a text
- * node the parent element will be returned.
- *
- * @method getStart
- * @param {Boolean} real Optional state to get the real parent when the selection is collapsed not the closest element.
- * @return {Element} Start element of selection range.
- */
- getStart: function (real) {
- var self = this, rng = self.getRng(), startElement, parentElement, checkRng, node;
-
- if (rng.duplicate || rng.item) {
- // Control selection, return first item
- if (rng.item) {
- return rng.item(0);
- }
-
- // Get start element
- checkRng = rng.duplicate();
- checkRng.collapse(1);
- startElement = checkRng.parentElement();
- if (startElement.ownerDocument !== self.dom.doc) {
- startElement = self.dom.getRoot();
- }
-
- // Check if range parent is inside the start element, then return the inner parent element
- // This will fix issues when a single element is selected, IE would otherwise return the wrong start element
- parentElement = node = rng.parentElement();
- while ((node = node.parentNode)) {
- if (node == startElement) {
- startElement = parentElement;
- break;
- }
- }
-
- return startElement;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone': function (command) {
+ var align = command.substring(7);
+ if (align === 'full') {
+ align = 'justify';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- startElement = rng.startContainer;
-
- if (startElement.nodeType == 1 && startElement.hasChildNodes()) {
- if (!real || !rng.collapsed) {
- startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ each$9('left,center,right,justify'.split(','), function (name) {
+ if (align !== name) {
+ formatter.remove('align' + name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ if (align !== 'none') {
+ toggleFormat('align' + align);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (startElement && startElement.nodeType == 3) {
- return startElement.parentNode;
- }
-
- return startElement;
</del><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the end element of a selection range. If the end is in a text
- * node the parent element will be returned.
- *
- * @method getEnd
- * @param {Boolean} real Optional state to get the real parent when the selection is collapsed not the closest element.
- * @return {Element} End element of selection range.
- */
- getEnd: function (real) {
- var self = this, rng = self.getRng(), endElement, endOffset;
-
- if (rng.duplicate || rng.item) {
- if (rng.item) {
- return rng.item(0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'InsertUnorderedList,InsertOrderedList': function (command) {
+ var listElm, listParent;
+ execNativeCommand(command);
+ listElm = dom.getParent(selection.getNode(), 'ol,ul');
+ if (listElm) {
+ listParent = listElm.parentNode;
+ if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {
+ storeSelection();
+ dom.split(listParent, listElm);
+ restoreSelection();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- rng = rng.duplicate();
- rng.collapse(0);
- endElement = rng.parentElement();
- if (endElement.ownerDocument !== self.dom.doc) {
- endElement = self.dom.getRoot();
- }
-
- if (endElement && endElement.nodeName == 'BODY') {
- return endElement.lastChild || endElement;
- }
-
- return endElement;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- endElement = rng.endContainer;
- endOffset = rng.endOffset;
-
- if (endElement.nodeType == 1 && endElement.hasChildNodes()) {
- if (!real || !rng.collapsed) {
- endElement = endElement.childNodes[endOffset > 0 ? endOffset - 1 : endOffset];
- }
- }
-
- if (endElement && endElement.nodeType == 3) {
- return endElement.parentNode;
- }
-
- return endElement;
</del><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns a bookmark location for the current selection. This bookmark object
- * can then be used to restore the selection after some content modification to the document.
- *
- * @method getBookmark
- * @param {Number} type Optional state if the bookmark should be simple or not. Default is complex.
- * @param {Boolean} normalized Optional state that enables you to get a position that it would be after normalization.
- * @return {Object} Bookmark object, use moveToBookmark with this object to restore the selection.
- * @example
- * // Stores a bookmark of the current selection
- * var bm = tinymce.activeEditor.selection.getBookmark();
- *
- * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');
- *
- * // Restore the selection bookmark
- * tinymce.activeEditor.selection.moveToBookmark(bm);
- */
- getBookmark: function (type, normalized) {
- return this.bookmarkManager.getBookmark(type, normalized);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) {
+ toggleFormat(command);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Restores the selection to the specified bookmark.
- *
- * @method moveToBookmark
- * @param {Object} bookmark Bookmark to restore selection from.
- * @return {Boolean} true/false if it was successful or not.
- * @example
- * // Stores a bookmark of the current selection
- * var bm = tinymce.activeEditor.selection.getBookmark();
- *
- * tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');
- *
- * // Restore the selection bookmark
- * tinymce.activeEditor.selection.moveToBookmark(bm);
- */
- moveToBookmark: function (bookmark) {
- return this.bookmarkManager.moveToBookmark(bookmark);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'ForeColor,HiliteColor': function (command, ui, value) {
+ toggleFormat(command, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Selects the specified element. This will place the start and end of the selection range around the element.
- *
- * @method select
- * @param {Element} node HTML DOM element to select.
- * @param {Boolean} content Optional bool state if the contents should be selected or not on non IE browser.
- * @return {Element} Selected element the same element as the one that got passed in.
- * @example
- * // Select the first paragraph in the active editor
- * tinymce.activeEditor.selection.select(tinymce.activeEditor.dom.select('p')[0]);
- */
- select: function (node, content) {
- var self = this, dom = self.dom, rng = dom.createRng(), idx;
-
- // Clear stored range set by FocusManager
- self.lastFocusBookmark = null;
-
- if (node) {
- if (!content && self.controlSelection.controlSelect(node)) {
- return;
- }
-
- idx = dom.nodeIndex(node);
- rng.setStart(node.parentNode, idx);
- rng.setEnd(node.parentNode, idx + 1);
-
- // Find first/last text node or BR element
- if (content) {
- self._moveEndPoint(rng, node, true);
- self._moveEndPoint(rng, node);
- }
-
- self.setRng(rng);
- }
-
- return node;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'FontName': function (command, ui, value) {
+ fontNameAction(editor, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns true/false if the selection range is collapsed or not. Collapsed means if it's a caret or a larger selection.
- *
- * @method isCollapsed
- * @return {Boolean} true/false state if the selection range is collapsed or not.
- * Collapsed means if it's a caret or a larger selection.
- */
- isCollapsed: function () {
- var self = this, rng = self.getRng(), sel = self.getSel();
-
- if (!rng || rng.item) {
- return false;
- }
-
- if (rng.compareEndPoints) {
- return rng.compareEndPoints('StartToEnd', rng) === 0;
- }
-
- return !sel || rng.collapsed;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'FontSize': function (command, ui, value) {
+ fontSizeAction(editor, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Collapse the selection to start or end of range.
- *
- * @method collapse
- * @param {Boolean} toStart Optional boolean state if to collapse to end or not. Defaults to false.
- */
- collapse: function (toStart) {
- var self = this, rng = self.getRng(), node;
-
- // Control range on IE
- if (rng.item) {
- node = rng.item(0);
- rng = self.win.document.body.createTextRange();
- rng.moveToElementText(node);
- }
-
- rng.collapse(!!toStart);
- self.setRng(rng);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'RemoveFormat': function (command) {
+ formatter.remove(command);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the browsers internal selection object.
- *
- * @method getSel
- * @return {Selection} Internal browser selection object.
- */
- getSel: function () {
- var win = this.win;
-
- return win.getSelection ? win.getSelection() : win.document.selection;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceBlockQuote': function () {
+ toggleFormat('blockquote');
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the browsers internal range object.
- *
- * @method getRng
- * @param {Boolean} w3c Forces a compatible W3C range on IE.
- * @return {Range} Internal browser range object.
- * @see http://www.quirksmode.org/dom/range_intro.html
- * @see http://www.dotvoid.com/2001/03/using-the-range-object-in-mozilla/
- */
- getRng: function (w3c) {
- var self = this, selection, rng, elm, doc, ieRng;
-
- function tryCompareBoundaryPoints(how, sourceRange, destinationRange) {
- try {
- return sourceRange.compareBoundaryPoints(how, destinationRange);
- } catch (ex) {
- // Gecko throws wrong document exception if the range points
- // to nodes that where removed from the dom #6690
- // Browsers should mutate existing DOMRange instances so that they always point
- // to something in the document this is not the case in Gecko works fine in IE/WebKit/Blink
- // For performance reasons just return -1
- return -1;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'FormatBlock': function (command, ui, value) {
+ return toggleFormat(value || 'p');
+ },
+ 'mceCleanup': function () {
+ var bookmark = selection.getBookmark();
+ editor.setContent(editor.getContent());
+ selection.moveToBookmark(bookmark);
+ },
+ 'mceRemoveNode': function (command, ui, value) {
+ var node = value || selection.getNode();
+ if (node !== editor.getBody()) {
+ storeSelection();
+ editor.dom.remove(node, true);
+ restoreSelection();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!self.win) {
- return null;
- }
-
- doc = self.win.document;
-
- if (typeof doc === 'undefined' || doc === null) {
- return null;
- }
-
- // Use last rng passed from FocusManager if it's available this enables
- // calls to editor.selection.getStart() to work when caret focus is lost on IE
- if (!w3c && self.lastFocusBookmark) {
- var bookmark = self.lastFocusBookmark;
-
- // Convert bookmark to range IE 11 fix
- if (bookmark.startContainer) {
- rng = doc.createRange();
- rng.setStart(bookmark.startContainer, bookmark.startOffset);
- rng.setEnd(bookmark.endContainer, bookmark.endOffset);
- } else {
- rng = bookmark;
- }
-
- return rng;
- }
-
- // Found tridentSel object then we need to use that one
- if (w3c && self.tridentSel) {
- return self.tridentSel.getRangeAt(0);
- }
-
- try {
- if ((selection = self.getSel())) {
- if (selection.rangeCount > 0) {
- rng = selection.getRangeAt(0);
- } else {
- rng = selection.createRange ? selection.createRange() : doc.createRange();
- }
- }
- } catch (ex) {
- // IE throws unspecified error here if TinyMCE is placed in a frame/iframe
- }
-
- rng = eventProcessRanges(self.editor, [ rng ])[0];
-
- // We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet
- // IE 11 doesn't support the selection object so we check for that as well
- if (isIE && rng && rng.setStart && doc.selection) {
- try {
- // IE will sometimes throw an exception here
- ieRng = doc.selection.createRange();
- } catch (ex) {
- // Ignore
- }
-
- if (ieRng && ieRng.item) {
- elm = ieRng.item(0);
- rng = doc.createRange();
- rng.setStartBefore(elm);
- rng.setEndAfter(elm);
- }
- }
-
- // No range found then create an empty one
- // This can occur when the editor is placed in a hidden container element on Gecko
- // Or on IE when there was an exception
- if (!rng) {
- rng = doc.createRange ? doc.createRange() : doc.body.createTextRange();
- }
-
- // If range is at start of document then move it to start of body
- if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) {
- elm = self.dom.getRoot();
- rng.setStart(elm, 0);
- rng.setEnd(elm, 0);
- }
-
- if (self.selectedRange && self.explicitRange) {
- if (tryCompareBoundaryPoints(rng.START_TO_START, rng, self.selectedRange) === 0 &&
- tryCompareBoundaryPoints(rng.END_TO_END, rng, self.selectedRange) === 0) {
- // Safari, Opera and Chrome only ever select text which causes the range to change.
- // This lets us use the originally set range if the selection hasn't been changed by the user.
- rng = self.explicitRange;
- } else {
- self.selectedRange = null;
- self.explicitRange = null;
- }
- }
-
- return rng;
</del><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Changes the selection to the specified DOM range.
- *
- * @method setRng
- * @param {Range} rng Range to select.
- * @param {Boolean} forward Optional boolean if the selection is forwards or backwards.
- */
- setRng: function (rng, forward) {
- var self = this, sel, node, evt;
-
- if (!isValidRange(rng)) {
- return;
- }
-
- // Is IE specific range
- if (rng.select) {
- self.explicitRange = null;
-
- try {
- rng.select();
- } catch (ex) {
- // Needed for some odd IE bug #1843306
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceSelectNodeDepth': function (command, ui, value) {
+ var counter = 0;
+ dom.getParent(selection.getNode(), function (node) {
+ if (node.nodeType === 1 && counter++ === value) {
+ selection.select(node);
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return;
- }
-
- if (!self.tridentSel) {
- sel = self.getSel();
-
- evt = self.editor.fire('SetSelectionRange', { range: rng, forward: forward });
- rng = evt.range;
-
- if (sel) {
- self.explicitRange = rng;
-
- try {
- sel.removeAllRanges();
- sel.addRange(rng);
- } catch (ex) {
- // IE might throw errors here if the editor is within a hidden container and selection is changed
- }
-
- // Forward is set to false and we have an extend function
- if (forward === false && sel.extend) {
- sel.collapse(rng.endContainer, rng.endOffset);
- sel.extend(rng.startContainer, rng.startOffset);
- }
-
- // adding range isn't always successful so we need to check range count otherwise an exception can occur
- self.selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
- }
-
- // WebKit egde case selecting images works better using setBaseAndExtent when the image is floated
- if (!rng.collapsed && rng.startContainer === rng.endContainer && sel.setBaseAndExtent && !Env.ie) {
- if (rng.endOffset - rng.startOffset < 2) {
- if (rng.startContainer.hasChildNodes()) {
- node = rng.startContainer.childNodes[rng.startOffset];
- if (node && node.tagName === 'IMG') {
- sel.setBaseAndExtent(
- rng.startContainer,
- rng.startOffset,
- rng.endContainer,
- rng.endOffset
- );
-
- // Since the setBaseAndExtent is fixed in more recent Blink versions we
- // need to detect if it's doing the wrong thing and falling back to the
- // crazy incorrect behavior api call since that seems to be the only way
- // to get it to work on Safari WebKit as of 2017-02-23
- if (sel.anchorNode !== rng.startContainer || sel.focusNode !== rng.endContainer) {
- sel.setBaseAndExtent(node, 0, node, 1);
- }
- }
- }
- }
- }
-
- self.editor.fire('AfterSetSelectionRange', { range: rng, forward: forward });
- } else {
- // Is W3C Range fake range on IE
- if (rng.cloneRange) {
- try {
- self.tridentSel.addRange(rng);
- } catch (ex) {
- //IE9 throws an error here if called before selection is placed in the editor
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, editor.getBody());
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Sets the current selection to the specified DOM element.
- *
- * @method setNode
- * @param {Element} elm Element to set as the contents of the selection.
- * @return {Element} Returns the element that got passed in.
- * @example
- * // Inserts a DOM node at current selection/caret location
- * tinymce.activeEditor.selection.setNode(tinymce.activeEditor.dom.create('img', {src: 'some.gif', title: 'some title'}));
- */
- setNode: function (elm) {
- var self = this;
-
- self.setContent(self.dom.getOuterHTML(elm));
-
- return elm;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceSelectNode': function (command, ui, value) {
+ selection.select(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the currently selected element or the common ancestor element for both start and end of the selection.
- *
- * @method getNode
- * @return {Element} Currently selected element or common ancestor element.
- * @example
- * // Alerts the currently selected elements node name
- * alert(tinymce.activeEditor.selection.getNode().nodeName);
- */
- getNode: function () {
- var self = this, rng = self.getRng(), elm;
- var startContainer, endContainer, startOffset, endOffset, root = self.dom.getRoot();
-
- function skipEmptyTextNodes(node, forwards) {
- var orig = node;
-
- while (node && node.nodeType === 3 && node.length === 0) {
- node = forwards ? node.nextSibling : node.previousSibling;
- }
-
- return node || orig;
- }
-
- // Range maybe lost after the editor is made visible again
- if (!rng) {
- return root;
- }
-
- startContainer = rng.startContainer;
- endContainer = rng.endContainer;
- startOffset = rng.startOffset;
- endOffset = rng.endOffset;
-
- if (rng.setStart) {
- elm = rng.commonAncestorContainer;
-
- // Handle selection a image or other control like element such as anchors
- if (!rng.collapsed) {
- if (startContainer == endContainer) {
- if (endOffset - startOffset < 2) {
- if (startContainer.hasChildNodes()) {
- elm = startContainer.childNodes[startOffset];
- }
- }
- }
-
- // If the anchor node is a element instead of a text node then return this element
- //if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1)
- // return sel.anchorNode.childNodes[sel.anchorOffset];
-
- // Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent.
- // This happens when you double click an underlined word in FireFox.
- if (startContainer.nodeType === 3 && endContainer.nodeType === 3) {
- if (startContainer.length === startOffset) {
- startContainer = skipEmptyTextNodes(startContainer.nextSibling, true);
- } else {
- startContainer = startContainer.parentNode;
- }
-
- if (endOffset === 0) {
- endContainer = skipEmptyTextNodes(endContainer.previousSibling, false);
- } else {
- endContainer = endContainer.parentNode;
- }
-
- if (startContainer && startContainer === endContainer) {
- return startContainer;
- }
- }
- }
-
- if (elm && elm.nodeType == 3) {
- return elm.parentNode;
- }
-
- return elm;
- }
-
- elm = rng.item ? rng.item(0) : rng.parentElement();
-
- // IE 7 might return elements outside the iframe
- if (elm.ownerDocument !== self.win.document) {
- elm = root;
- }
-
- return elm;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceInsertContent': function (command, ui, value) {
+ $_c8z6p81wjfuw8lg5.insertAtCaret(editor, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- getSelectedBlocks: function (startElm, endElm) {
- var self = this, dom = self.dom, node, root, selectedBlocks = [];
-
- root = dom.getRoot();
- startElm = dom.getParent(startElm || self.getStart(), dom.isBlock);
- endElm = dom.getParent(endElm || self.getEnd(), dom.isBlock);
-
- if (startElm && startElm != root) {
- selectedBlocks.push(startElm);
- }
-
- if (startElm && endElm && startElm != endElm) {
- node = startElm;
-
- var walker = new TreeWalker(startElm, root);
- while ((node = walker.next()) && node != endElm) {
- if (dom.isBlock(node)) {
- selectedBlocks.push(node);
- }
- }
- }
-
- if (endElm && startElm != endElm && endElm != root) {
- selectedBlocks.push(endElm);
- }
-
- return selectedBlocks;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceInsertRawHTML': function (command, ui, value) {
+ var content = editor.getContent();
+ selection.setContent('tiny_mce_marker');
+ editor.setContent(content.replace(/tiny_mce_marker/g, function () {
+ return value;
+ }));
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- isForward: function () {
- var dom = this.dom, sel = this.getSel(), anchorRange, focusRange;
-
- // No support for selection direction then always return true
- if (!sel || !sel.anchorNode || !sel.focusNode) {
- return true;
- }
-
- anchorRange = dom.createRng();
- anchorRange.setStart(sel.anchorNode, sel.anchorOffset);
- anchorRange.collapse(true);
-
- focusRange = dom.createRng();
- focusRange.setStart(sel.focusNode, sel.focusOffset);
- focusRange.collapse(true);
-
- return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceToggleFormat': function (command, ui, value) {
+ toggleFormat(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- normalize: function () {
- var self = this, rng = self.getRng();
-
- if (new RangeUtils(self.dom).normalize(rng) && !MultiRange.hasMultipleRanges(self.getSel())) {
- self.setRng(rng, self.isForward());
- }
-
- return rng;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceSetContent': function (command, ui, value) {
+ editor.setContent(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Executes callback when the current selection starts/stops matching the specified selector. The current
- * state will be passed to the callback as it's first argument.
- *
- * @method selectorChanged
- * @param {String} selector CSS selector to check for.
- * @param {function} callback Callback with state and args when the selector is matches or not.
- */
- selectorChanged: function (selector, callback) {
- var self = this, currentSelectors;
-
- if (!self.selectorChangedData) {
- self.selectorChangedData = {};
- currentSelectors = {};
-
- self.editor.on('NodeChange', function (e) {
- var node = e.element, dom = self.dom, parents = dom.getParents(node, null, dom.getRoot()), matchedSelectors = {};
-
- // Check for new matching selectors
- each(self.selectorChangedData, function (callbacks, selector) {
- each(parents, function (node) {
- if (dom.is(node, selector)) {
- if (!currentSelectors[selector]) {
- // Execute callbacks
- each(callbacks, function (callback) {
- callback(true, { node: node, selector: selector, parents: parents });
- });
-
- currentSelectors[selector] = callbacks;
- }
-
- matchedSelectors[selector] = callbacks;
- return false;
- }
- });
- });
-
- // Check if current selectors still match
- each(currentSelectors, function (callbacks, selector) {
- if (!matchedSelectors[selector]) {
- delete currentSelectors[selector];
-
- each(callbacks, function (callback) {
- callback(false, { node: node, selector: selector, parents: parents });
- });
- }
- });
- });
- }
-
- // Add selector listeners
- if (!self.selectorChangedData[selector]) {
- self.selectorChangedData[selector] = [];
- }
-
- self.selectorChangedData[selector].push(callback);
-
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'Indent,Outdent': function (command) {
+ handle(editor, command);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- getScrollContainer: function () {
- var scrollContainer, node = this.dom.getRoot();
-
- while (node && node.nodeName != 'BODY') {
- if (node.scrollHeight > node.clientHeight) {
- scrollContainer = node;
- break;
- }
-
- node = node.parentNode;
- }
-
- return scrollContainer;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceRepaint': function () {
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- scrollIntoView: function (elm, alignToTop) {
- ScrollIntoView.scrollIntoView(this.editor, elm, alignToTop);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'InsertHorizontalRule': function () {
+ editor.execCommand('mceInsertContent', false, '<hr />');
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- placeCaretAt: function (clientX, clientY) {
- this.setRng(RangeUtils.getCaretRangeFromPoint(clientX, clientY, this.editor.getDoc()));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceToggleVisualAid': function () {
+ editor.hasVisual = !editor.hasVisual;
+ editor.addVisual();
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- _moveEndPoint: function (rng, node, start) {
- var root = node, walker = new TreeWalker(node, root);
- var nonEmptyElementsMap = this.dom.schema.getNonEmptyElements();
-
- do {
- // Text node
- if (node.nodeType == 3 && trim(node.nodeValue).length !== 0) {
- if (start) {
- rng.setStart(node, 0);
- } else {
- rng.setEnd(node, node.nodeValue.length);
- }
-
- return;
- }
-
- // BR/IMG/INPUT elements but not table cells
- if (nonEmptyElementsMap[node.nodeName] && !/^(TD|TH)$/.test(node.nodeName)) {
- if (start) {
- rng.setStartBefore(node);
- } else {
- if (node.nodeName == 'BR') {
- rng.setEndBefore(node);
- } else {
- rng.setEndAfter(node);
- }
- }
-
- return;
- }
-
- // Found empty text block old IE can place the selection inside those
- if (Env.ie && Env.ie < 11 && this.dom.isBlock(node) && this.dom.isEmpty(node)) {
- if (start) {
- rng.setStart(node, 0);
- } else {
- rng.setEnd(node, 0);
- }
-
- return;
- }
- } while ((node = (start ? walker.next() : walker.prev())));
-
- // Failed to find any text node or other suitable location then move to the root of body
- if (root.nodeName == 'BODY') {
- if (start) {
- rng.setStart(root, 0);
- } else {
- rng.setEnd(root, root.childNodes.length);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceReplaceContent': function (command, ui, value) {
+ editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, selection.getContent({ format: 'text' })));
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- getBoundingClientRect: function () {
- var rng = this.getRng();
- return rng.collapsed ? CaretPosition.fromRangeStart(rng).getClientRects()[0] : rng.getBoundingClientRect();
- },
-
- destroy: function () {
- this.win = null;
- this.controlSelection.destroy();
- }
- };
-
- return Selection;
- }
-);
-
-/**
- * Node.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class is a minimalistic implementation of a DOM like node used by the DomParser class.
- *
- * @example
- * var node = new tinymce.html.Node('strong', 1);
- * someRoot.append(node);
- *
- * @class tinymce.html.Node
- * @version 3.4
- */
-define(
- 'tinymce.core.html.Node',
- [
- ],
- function () {
- var whiteSpaceRegExp = /^[ \t\r\n]*$/;
- var typeLookup = {
- '#text': 3,
- '#comment': 8,
- '#cdata': 4,
- '#pi': 7,
- '#doctype': 10,
- '#document-fragment': 11
- };
-
- // Walks the tree left/right
- function walk(node, rootNode, prev) {
- var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next';
-
- // Walk into nodes if it has a start
- if (node[startName]) {
- return node[startName];
- }
-
- // Return the sibling if it has one
- if (node !== rootNode) {
- sibling = node[siblingName];
-
- if (sibling) {
- return sibling;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceInsertLink': function (command, ui, value) {
+ var anchor;
+ if (typeof value === 'string') {
+ value = { href: value };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Walk up the parents to look for siblings
- for (parent = node.parent; parent && parent !== rootNode; parent = parent.parent) {
- sibling = parent[siblingName];
-
- if (sibling) {
- return sibling;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ anchor = dom.getParent(selection.getNode(), 'a');
+ value.href = value.href.replace(' ', '%20');
+ if (!anchor || !value.href) {
+ formatter.remove('link');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- }
-
- /**
- * Constructs a new Node instance.
- *
- * @constructor
- * @method Node
- * @param {String} name Name of the node type.
- * @param {Number} type Numeric type representing the node.
- */
- function Node(name, type) {
- this.name = name;
- this.type = type;
-
- if (type === 1) {
- this.attributes = [];
- this.attributes.map = {};
- }
- }
-
- Node.prototype = {
- /**
- * Replaces the current node with the specified one.
- *
- * @example
- * someNode.replace(someNewNode);
- *
- * @method replace
- * @param {tinymce.html.Node} node Node to replace the current node with.
- * @return {tinymce.html.Node} The old node that got replaced.
- */
- replace: function (node) {
- var self = this;
-
- if (node.parent) {
- node.remove();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (value.href) {
+ formatter.apply('link', value, anchor);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.insert(node, self);
- self.remove();
-
- return self;
</del><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Gets/sets or removes an attribute by name.
- *
- * @example
- * someNode.attr("name", "value"); // Sets an attribute
- * console.log(someNode.attr("name")); // Gets an attribute
- * someNode.attr("name", null); // Removes an attribute
- *
- * @method attr
- * @param {String} name Attribute name to set or get.
- * @param {String} value Optional value to set.
- * @return {String/tinymce.html.Node} String or undefined on a get operation or the current node on a set operation.
- */
- attr: function (name, value) {
- var self = this, attrs, i, undef;
-
- if (typeof name !== "string") {
- for (i in name) {
- self.attr(i, name[i]);
- }
-
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'selectAll': function () {
+ var editingHost = dom.getParent(selection.getStart(), $_ey7ka11qjfuw8ldg.isContentEditableTrue);
+ if (editingHost) {
+ var rng = dom.createRng();
+ rng.selectNodeContents(editingHost);
+ selection.setRng(rng);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if ((attrs = self.attributes)) {
- if (value !== undef) {
- // Remove attribute
- if (value === null) {
- if (name in attrs.map) {
- delete attrs.map[name];
-
- i = attrs.length;
- while (i--) {
- if (attrs[i].name === name) {
- attrs = attrs.splice(i, 1);
- return self;
- }
- }
- }
-
- return self;
- }
-
- // Set attribute
- if (name in attrs.map) {
- // Set attribute
- i = attrs.length;
- while (i--) {
- if (attrs[i].name === name) {
- attrs[i].value = value;
- break;
- }
- }
- } else {
- attrs.push({ name: name, value: value });
- }
-
- attrs.map[name] = value;
-
- return self;
- }
-
- return attrs.map[name];
- }
</del><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Does a shallow clones the node into a new node. It will also exclude id attributes since
- * there should only be one id per document.
- *
- * @example
- * var clonedNode = node.clone();
- *
- * @method clone
- * @return {tinymce.html.Node} New copy of the original node.
- */
- clone: function () {
- var self = this, clone = new Node(self.name, self.type), i, l, selfAttrs, selfAttr, cloneAttrs;
-
- // Clone element attributes
- if ((selfAttrs = self.attributes)) {
- cloneAttrs = [];
- cloneAttrs.map = {};
-
- for (i = 0, l = selfAttrs.length; i < l; i++) {
- selfAttr = selfAttrs[i];
-
- // Clone everything except id
- if (selfAttr.name !== 'id') {
- cloneAttrs[cloneAttrs.length] = { name: selfAttr.name, value: selfAttr.value };
- cloneAttrs.map[selfAttr.name] = selfAttr.value;
- }
- }
-
- clone.attributes = cloneAttrs;
- }
-
- clone.value = self.value;
- clone.shortEnded = self.shortEnded;
-
- return clone;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'delete': function () {
+ $_93erqy31jfuw8ln6.deleteCommand(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Wraps the node in in another node.
- *
- * @example
- * node.wrap(wrapperNode);
- *
- * @method wrap
- */
- wrap: function (wrapper) {
- var self = this;
-
- self.parent.insert(wrapper, self);
- wrapper.append(self);
-
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'forwardDelete': function () {
+ $_93erqy31jfuw8ln6.forwardDeleteCommand(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Unwraps the node in other words it removes the node but keeps the children.
- *
- * @example
- * node.unwrap();
- *
- * @method unwrap
- */
- unwrap: function () {
- var self = this, node, next;
-
- for (node = self.firstChild; node;) {
- next = node.next;
- self.insert(node, self, true);
- node = next;
- }
-
- self.remove();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceNewDocument': function () {
+ editor.setContent('');
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Removes the node from it's parent.
- *
- * @example
- * node.remove();
- *
- * @method remove
- * @return {tinymce.html.Node} Current node that got removed.
- */
- remove: function () {
- var self = this, parent = self.parent, next = self.next, prev = self.prev;
-
- if (parent) {
- if (parent.firstChild === self) {
- parent.firstChild = next;
-
- if (next) {
- next.prev = null;
- }
- } else {
- prev.next = next;
- }
-
- if (parent.lastChild === self) {
- parent.lastChild = prev;
-
- if (prev) {
- prev.next = null;
- }
- } else {
- next.prev = prev;
- }
-
- self.parent = self.next = self.prev = null;
- }
-
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'InsertLineBreak': function (command, ui, value) {
+ $_c7z3y13xjfuw8lxq.insert(editor, value);
+ return true;
+ }
+ });
+ addCommands({
+ 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull': function (command) {
+ var name = 'align' + command.substring(7);
+ var nodes = selection.isCollapsed() ? [dom.getParent(selection.getNode(), dom.isBlock)] : selection.getSelectedBlocks();
+ var matches = map$2(nodes, function (node) {
+ return !!formatter.matchNode(node, name);
+ });
+ return inArray$2(matches, true) !== -1;
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Appends a new node as a child of the current node.
- *
- * @example
- * node.append(someNode);
- *
- * @method append
- * @param {tinymce.html.Node} node Node to append as a child of the current one.
- * @return {tinymce.html.Node} The node that got appended.
- */
- append: function (node) {
- var self = this, last;
-
- if (node.parent) {
- node.remove();
- }
-
- last = self.lastChild;
- if (last) {
- last.next = node;
- node.prev = last;
- self.lastChild = node;
- } else {
- self.lastChild = self.firstChild = node;
- }
-
- node.parent = self;
-
- return node;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) {
+ return isFormatMatch(command);
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Inserts a node at a specific position as a child of the current node.
- *
- * @example
- * parentNode.insert(newChildNode, oldChildNode);
- *
- * @method insert
- * @param {tinymce.html.Node} node Node to insert as a child of the current node.
- * @param {tinymce.html.Node} refNode Reference node to set node before/after.
- * @param {Boolean} before Optional state to insert the node before the reference node.
- * @return {tinymce.html.Node} The node that got inserted.
- */
- insert: function (node, refNode, before) {
- var parent;
-
- if (node.parent) {
- node.remove();
- }
-
- parent = refNode.parent || this;
-
- if (before) {
- if (refNode === parent.firstChild) {
- parent.firstChild = node;
- } else {
- refNode.prev.next = node;
- }
-
- node.prev = refNode.prev;
- node.next = refNode;
- refNode.prev = node;
- } else {
- if (refNode === parent.lastChild) {
- parent.lastChild = node;
- } else {
- refNode.next.prev = node;
- }
-
- node.next = refNode.next;
- node.prev = refNode;
- refNode.next = node;
- }
-
- node.parent = parent;
-
- return node;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'mceBlockQuote': function () {
+ return isFormatMatch('blockquote');
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Get all children by name.
- *
- * @method getAll
- * @param {String} name Name of the child nodes to collect.
- * @return {Array} Array with child nodes matchin the specified name.
- */
- getAll: function (name) {
- var self = this, node, collection = [];
-
- for (node = self.firstChild; node; node = walk(node, self)) {
- if (node.name === name) {
- collection.push(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'Outdent': function () {
+ var node;
+ if (settings.inline_styles) {
+ if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return collection;
- },
-
- /**
- * Removes all children of the current node.
- *
- * @method empty
- * @return {tinymce.html.Node} The current node that got cleared.
- */
- empty: function () {
- var self = this, nodes, i, node;
-
- // Remove all children
- if (self.firstChild) {
- nodes = [];
-
- // Collect the children
- for (node = self.firstChild; node; node = walk(node, self)) {
- nodes.push(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove the children
- i = nodes.length;
- while (i--) {
- node = nodes[i];
- node.parent = node.firstChild = node.lastChild = node.next = node.prev = null;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.firstChild = self.lastChild = null;
-
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return queryCommandState('InsertUnorderedList') || queryCommandState('InsertOrderedList') || !settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE');
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns true/false if the node is to be considered empty or not.
- *
- * @example
- * node.isEmpty({img: true});
- * @method isEmpty
- * @param {Object} elements Name/value object with elements that are automatically treated as non empty elements.
- * @param {Object} whitespace Name/value object with elements that are automatically treated whitespace preservables.
- * @param {function} predicate Optional predicate that gets called after the other rules determine that the node is empty. Should return true if the node is a content node.
- * @return {Boolean} true/false if the node is empty or not.
- */
- isEmpty: function (elements, whitespace, predicate) {
- var self = this, node = self.firstChild, i, name;
-
- whitespace = whitespace || {};
-
- if (node) {
- do {
- if (node.type === 1) {
- // Ignore bogus elements
- if (node.attributes.map['data-mce-bogus']) {
- continue;
- }
-
- // Keep empty elements like <img />
- if (elements[node.name]) {
- return false;
- }
-
- // Keep bookmark nodes and name attribute like <a name="1"></a>
- i = node.attributes.length;
- while (i--) {
- name = node.attributes[i].name;
- if (name === "name" || name.indexOf('data-mce-bookmark') === 0) {
- return false;
- }
- }
- }
-
- // Keep comments
- if (node.type === 8) {
- return false;
- }
-
- // Keep non whitespace text nodes
- if (node.type === 3 && !whiteSpaceRegExp.test(node.value)) {
- return false;
- }
-
- // Keep whitespace preserve elements
- if (node.type === 3 && node.parent && whitespace[node.parent.name] && whiteSpaceRegExp.test(node.value)) {
- return false;
- }
-
- // Predicate tells that the node is contents
- if (predicate && predicate(node)) {
- return false;
- }
- } while ((node = walk(node, self)));
- }
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'InsertUnorderedList,InsertOrderedList': function (command) {
+ var list = dom.getParent(selection.getNode(), 'ul,ol');
+ return list && (command === 'insertunorderedlist' && list.tagName === 'UL' || command === 'insertorderedlist' && list.tagName === 'OL');
+ }
+ }, 'state');
+ addCommands({
+ Undo: function () {
+ editor.undoManager.undo();
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Walks to the next or previous node and returns that node or null if it wasn't found.
- *
- * @method walk
- * @param {Boolean} prev Optional previous node state defaults to false.
- * @return {tinymce.html.Node} Node that is next to or previous of the current node.
- */
- walk: function (prev) {
- return walk(this, null, prev);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Redo: function () {
+ editor.undoManager.redo();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- /**
- * Creates a node of a specific type.
- *
- * @static
- * @method create
- * @param {String} name Name of the node type to create for example "b" or "#text".
- * @param {Object} attrs Name/value collection of attributes that will be applied to elements.
- */
- Node.create = function (name, attrs) {
- var node, attrName;
-
- // Create node
- node = new Node(name, typeLookup[name] || 1);
-
- // Add attributes if needed
- if (attrs) {
- for (attrName in attrs) {
- node.attr(attrName, attrs[attrName]);
- }
- }
-
- return node;
- };
-
- return Node;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ addQueryValueHandler('FontName', function () {
+ return fontNameQuery(editor);
+ }, this);
+ addQueryValueHandler('FontSize', function () {
+ return fontSizeQuery(editor);
+ }, this);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-/**
- * SaxParser.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/*eslint max-depth:[2, 9] */
-
-/**
- * This class parses HTML code using pure JavaScript and executes various events for each item it finds. It will
- * always execute the events in the right order for tag soup code like <b><p></b></p>. It will also remove elements
- * and attributes that doesn't fit the schema if the validate setting is enabled.
- *
- * @example
- * var parser = new tinymce.html.SaxParser({
- * validate: true,
- *
- * comment: function(text) {
- * console.log('Comment:', text);
- * },
- *
- * cdata: function(text) {
- * console.log('CDATA:', text);
- * },
- *
- * text: function(text, raw) {
- * console.log('Text:', text, 'Raw:', raw);
- * },
- *
- * start: function(name, attrs, empty) {
- * console.log('Start:', name, attrs, empty);
- * },
- *
- * end: function(name) {
- * console.log('End:', name);
- * },
- *
- * pi: function(name, text) {
- * console.log('PI:', name, text);
- * },
- *
- * doctype: function(text) {
- * console.log('DocType:', text);
- * }
- * }, schema);
- * @class tinymce.html.SaxParser
- * @version 3.4
- */
-define(
- 'tinymce.core.html.SaxParser',
- [
- "tinymce.core.html.Schema",
- "tinymce.core.html.Entities",
- "tinymce.core.util.Tools"
- ],
- function (Schema, Entities, Tools) {
- var each = Tools.each;
-
- var isValidPrefixAttrName = function (name) {
- return name.indexOf('data-') === 0 || name.indexOf('aria-') === 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var nativeEvents = $_52qop8kjfuw8l6v.makeMap('focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange ' + 'mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover ' + 'draggesture dragdrop drop drag submit ' + 'compositionstart compositionend compositionupdate touchstart touchmove touchend', ' ');
+ var Dispatcher = function (settings) {
+ var self = this;
+ var scope, bindings = {}, toggleEvent;
+ var returnFalse = function () {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var trimComments = function (text) {
- return text.replace(/<!--|-->/g, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var returnTrue = function () {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the index of the end tag for a specific start tag. This can be
- * used to skip all children of a parent element from being processed.
- *
- * @private
- * @method findEndTag
- * @param {tinymce.html.Schema} schema Schema instance to use to match short ended elements.
- * @param {String} html HTML string to find the end tag in.
- * @param {Number} startIndex Indext to start searching at should be after the start tag.
- * @return {Number} Index of the end tag.
- */
- function findEndTag(schema, html, startIndex) {
- var count = 1, index, matches, tokenRegExp, shortEndedElements;
-
- shortEndedElements = schema.getShortEndedElements();
- tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g;
- tokenRegExp.lastIndex = index = startIndex;
-
- while ((matches = tokenRegExp.exec(html))) {
- index = tokenRegExp.lastIndex;
-
- if (matches[1] === '/') { // End element
- count--;
- } else if (!matches[1]) { // Start element
- if (matches[2] in shortEndedElements) {
- continue;
- }
-
- count++;
- }
-
- if (count === 0) {
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ settings = settings || {};
+ scope = settings.scope || self;
+ toggleEvent = settings.toggleEvent || returnFalse;
+ var fire = function (name, args) {
+ var handlers, i, l, callback;
+ name = name.toLowerCase();
+ args = args || {};
+ args.type = name;
+ if (!args.target) {
+ args.target = scope;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return index;
- }
-
- /**
- * Constructs a new SaxParser instance.
- *
- * @constructor
- * @method SaxParser
- * @param {Object} settings Name/value collection of settings. comment, cdata, text, start and end are callbacks.
- * @param {tinymce.html.Schema} schema HTML Schema class to use when parsing.
- */
- function SaxParser(settings, schema) {
- var self = this;
-
- function noop() { }
-
- settings = settings || {};
- self.schema = schema = schema || new Schema();
-
- if (settings.fix_self_closing !== false) {
- settings.fix_self_closing = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!args.preventDefault) {
+ args.preventDefault = function () {
+ args.isDefaultPrevented = returnTrue;
+ };
+ args.stopPropagation = function () {
+ args.isPropagationStopped = returnTrue;
+ };
+ args.stopImmediatePropagation = function () {
+ args.isImmediatePropagationStopped = returnTrue;
+ };
+ args.isDefaultPrevented = returnFalse;
+ args.isPropagationStopped = returnFalse;
+ args.isImmediatePropagationStopped = returnFalse;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Add handler functions from settings and setup default handlers
- each('comment cdata text start end pi doctype'.split(' '), function (name) {
- if (name) {
- self[name] = settings[name] || noop;
- }
- });
-
- /**
- * Parses the specified HTML string and executes the callbacks for each item it finds.
- *
- * @example
- * new SaxParser({...}).parse('<b>text</b>');
- * @method parse
- * @param {String} html Html string to sax parse.
- */
- self.parse = function (html) {
- var self = this, matches, index = 0, value, endRegExp, stack = [], attrList, i, text, name;
- var isInternalElement, removeInternalElements, shortEndedElements, fillAttrsMap, isShortEnded;
- var validate, elementRule, isValidElement, attr, attribsValue, validAttributesMap, validAttributePatterns;
- var attributesRequired, attributesDefault, attributesForced, processHtml;
- var anyAttributesRequired, selfClosing, tokenRegExp, attrRegExp, specialElements, attrValue, idCount = 0;
- var decode = Entities.decode, fixSelfClosing, filteredUrlAttrs = Tools.makeMap('src,href,data,background,formaction,poster');
- var scriptUriRegExp = /((java|vb)script|mhtml):/i, dataUriRegExp = /^data:/i;
-
- function processEndTag(name) {
- var pos, i;
-
- // Find position of parent of the same type
- pos = stack.length;
- while (pos--) {
- if (stack[pos].name === name) {
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (settings.beforeFire) {
+ settings.beforeFire(args);
+ }
+ handlers = bindings[name];
+ if (handlers) {
+ for (i = 0, l = handlers.length; i < l; i++) {
+ callback = handlers[i];
+ if (callback.once) {
+ off(name, callback.func);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Found parent
- if (pos >= 0) {
- // Close all the open elements
- for (i = stack.length - 1; i >= pos; i--) {
- name = stack[i];
-
- if (name.valid) {
- self.end(name.name);
- }
- }
-
- // Remove the open elements from the stack
- stack.length = pos;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (args.isImmediatePropagationStopped()) {
+ args.stopPropagation();
+ return args;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function parseAttribute(match, name, value, val2, val3) {
- var attrRule, i, trimRegExp = /[\s\u0000-\u001F]+/g;
-
- name = name.toLowerCase();
- value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute
-
- // Validate name and value pass through all data- attributes
- if (validate && !isInternalElement && isValidPrefixAttrName(name) === false) {
- attrRule = validAttributesMap[name];
-
- // Find rule by pattern matching
- if (!attrRule && validAttributePatterns) {
- i = validAttributePatterns.length;
- while (i--) {
- attrRule = validAttributePatterns[i];
- if (attrRule.pattern.test(name)) {
- break;
- }
- }
-
- // No rule matched
- if (i === -1) {
- attrRule = null;
- }
- }
-
- // No attribute rule found
- if (!attrRule) {
- return;
- }
-
- // Validate value
- if (attrRule.validValues && !(value in attrRule.validValues)) {
- return;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (callback.func.call(scope, args) === false) {
+ args.preventDefault();
+ return args;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Block any javascript: urls or non image data uris
- if (filteredUrlAttrs[name] && !settings.allow_script_urls) {
- var uri = value.replace(trimRegExp, '');
-
- try {
- // Might throw malformed URI sequence
- uri = decodeURIComponent(uri);
- } catch (ex) {
- // Fallback to non UTF-8 decoder
- uri = unescape(uri);
- }
-
- if (scriptUriRegExp.test(uri)) {
- return;
- }
-
- if (!settings.allow_html_data_urls && dataUriRegExp.test(uri) && !/^data:image\//i.test(uri)) {
- return;
- }
- }
-
- // Block data or event attributes on elements marked as internal
- if (isInternalElement && (name in filteredUrlAttrs || name.indexOf('on') === 0)) {
- return;
- }
-
- // Add attribute to list and map
- attrList.map[name] = value;
- attrList.push({
- name: name,
- value: value
- });
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Precompile RegExps and map objects
- tokenRegExp = new RegExp('<(?:' +
- '(?:!--([\\w\\W]*?)-->)|' + // Comment
- '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + // CDATA
- '(?:!DOCTYPE([\\w\\W]*?)>)|' + // DOCTYPE
- '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + // PI
- '(?:\\/([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)>)|' + // End element
- '(?:([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + // Start element
- ')', 'g');
-
- attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g;
-
- // Setup lookup tables for empty elements and boolean attributes
- shortEndedElements = schema.getShortEndedElements();
- selfClosing = settings.self_closing_elements || schema.getSelfClosingElements();
- fillAttrsMap = schema.getBoolAttrs();
- validate = settings.validate;
- removeInternalElements = settings.remove_internals;
- fixSelfClosing = settings.fix_self_closing;
- specialElements = schema.getSpecialElements();
- processHtml = html + '>';
-
- while ((matches = tokenRegExp.exec(processHtml))) { // Adds and extra '>' to keep regexps from doing catastrofic backtracking on malformed html
- // Text
- if (index < matches.index) {
- self.text(decode(html.substr(index, matches.index - index)));
- }
-
- if ((value = matches[6])) { // End element
- value = value.toLowerCase();
-
- // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements
- if (value.charAt(0) === ':') {
- value = value.substr(1);
- }
-
- processEndTag(value);
- } else if ((value = matches[7])) { // Start element
- // Did we consume the extra character then treat it as text
- // This handles the case with html like this: "text a<b text"
- if (matches.index + matches[0].length > html.length) {
- self.text(decode(html.substr(matches.index)));
- index = matches.index + matches[0].length;
- continue;
- }
-
- value = value.toLowerCase();
-
- // IE will add a ":" in front of elements it doesn't understand like custom elements or HTML5 elements
- if (value.charAt(0) === ':') {
- value = value.substr(1);
- }
-
- isShortEnded = value in shortEndedElements;
-
- // Is self closing tag for example an <li> after an open <li>
- if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value) {
- processEndTag(value);
- }
-
- // Validate element
- if (!validate || (elementRule = schema.getElementRule(value))) {
- isValidElement = true;
-
- // Grab attributes map and patters when validation is enabled
- if (validate) {
- validAttributesMap = elementRule.attributes;
- validAttributePatterns = elementRule.attributePatterns;
- }
-
- // Parse attributes
- if ((attribsValue = matches[8])) {
- isInternalElement = attribsValue.indexOf('data-mce-type') !== -1; // Check if the element is an internal element
-
- // If the element has internal attributes then remove it if we are told to do so
- if (isInternalElement && removeInternalElements) {
- isValidElement = false;
- }
-
- attrList = [];
- attrList.map = {};
-
- attribsValue.replace(attrRegExp, parseAttribute);
- } else {
- attrList = [];
- attrList.map = {};
- }
-
- // Process attributes if validation is enabled
- if (validate && !isInternalElement) {
- attributesRequired = elementRule.attributesRequired;
- attributesDefault = elementRule.attributesDefault;
- attributesForced = elementRule.attributesForced;
- anyAttributesRequired = elementRule.removeEmptyAttrs;
-
- // Check if any attribute exists
- if (anyAttributesRequired && !attrList.length) {
- isValidElement = false;
- }
-
- // Handle forced attributes
- if (attributesForced) {
- i = attributesForced.length;
- while (i--) {
- attr = attributesForced[i];
- name = attr.name;
- attrValue = attr.value;
-
- if (attrValue === '{$uid}') {
- attrValue = 'mce_' + idCount++;
- }
-
- attrList.map[name] = attrValue;
- attrList.push({ name: name, value: attrValue });
- }
- }
-
- // Handle default attributes
- if (attributesDefault) {
- i = attributesDefault.length;
- while (i--) {
- attr = attributesDefault[i];
- name = attr.name;
-
- if (!(name in attrList.map)) {
- attrValue = attr.value;
-
- if (attrValue === '{$uid}') {
- attrValue = 'mce_' + idCount++;
- }
-
- attrList.map[name] = attrValue;
- attrList.push({ name: name, value: attrValue });
- }
- }
- }
-
- // Handle required attributes
- if (attributesRequired) {
- i = attributesRequired.length;
- while (i--) {
- if (attributesRequired[i] in attrList.map) {
- break;
- }
- }
-
- // None of the required attributes where found
- if (i === -1) {
- isValidElement = false;
- }
- }
-
- // Invalidate element if it's marked as bogus
- if ((attr = attrList.map['data-mce-bogus'])) {
- if (attr === 'all') {
- index = findEndTag(schema, html, tokenRegExp.lastIndex);
- tokenRegExp.lastIndex = index;
- continue;
- }
-
- isValidElement = false;
- }
- }
-
- if (isValidElement) {
- self.start(value, attrList, isShortEnded);
- }
- } else {
- isValidElement = false;
- }
-
- // Treat script, noscript and style a bit different since they may include code that looks like elements
- if ((endRegExp = specialElements[value])) {
- endRegExp.lastIndex = index = matches.index + matches[0].length;
-
- if ((matches = endRegExp.exec(html))) {
- if (isValidElement) {
- text = html.substr(index, matches.index - index);
- }
-
- index = matches.index + matches[0].length;
- } else {
- text = html.substr(index);
- index = html.length;
- }
-
- if (isValidElement) {
- if (text.length > 0) {
- self.text(text, true);
- }
-
- self.end(value);
- }
-
- tokenRegExp.lastIndex = index;
- continue;
- }
-
- // Push value on to stack
- if (!isShortEnded) {
- if (!attribsValue || attribsValue.indexOf('/') != attribsValue.length - 1) {
- stack.push({ name: value, valid: isValidElement });
- } else if (isValidElement) {
- self.end(value);
- }
- }
- } else if ((value = matches[1])) { // Comment
- // Padd comment value to avoid browsers from parsing invalid comments as HTML
- if (value.charAt(0) === '>') {
- value = ' ' + value;
- }
-
- if (!settings.allow_conditional_comments && value.substr(0, 3).toLowerCase() === '[if') {
- value = ' ' + value;
- }
-
- self.comment(value);
- } else if ((value = matches[2])) { // CDATA
- self.cdata(trimComments(value));
- } else if ((value = matches[3])) { // DOCTYPE
- self.doctype(value);
- } else if ((value = matches[4])) { // PI
- self.pi(value, matches[5]);
- }
-
- index = matches.index + matches[0].length;
- }
-
- // Text
- if (index < html.length) {
- self.text(decode(html.substr(index)));
- }
-
- // Close any open elements
- for (i = stack.length - 1; i >= 0; i--) {
- value = stack[i];
-
- if (value.valid) {
- self.end(value.name);
- }
- }
- };
- }
-
- SaxParser.findEndTag = findEndTag;
-
- return SaxParser;
- }
-);
-/**
- * DomParser.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class parses HTML code into a DOM like structure of nodes it will remove redundant whitespace and make
- * sure that the node tree is valid according to the specified schema.
- * So for example: <p>a<p>b</p>c</p> will become <p>a</p><p>b</p><p>c</p>
- *
- * @example
- * var parser = new tinymce.html.DomParser({validate: true}, schema);
- * var rootNode = parser.parse('<h1>content</h1>');
- *
- * @class tinymce.html.DomParser
- * @version 3.4
- */
-define(
- 'tinymce.core.html.DomParser',
- [
- "tinymce.core.html.Node",
- "tinymce.core.html.Schema",
- "tinymce.core.html.SaxParser",
- "tinymce.core.util.Tools"
- ],
- function (Node, Schema, SaxParser, Tools) {
- var makeMap = Tools.makeMap, each = Tools.each, explode = Tools.explode, extend = Tools.extend;
-
- var paddEmptyNode = function (settings, node) {
- if (settings.padd_empty_with_br) {
- node.empty().append(new Node('br', '1')).shortEnded = true;
- } else {
- node.empty().append(new Node('#text', '3')).value = '\u00a0';
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return args;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var hasOnlyChild = function (node, name) {
- return node && node.firstChild === node.lastChild && node.firstChild.name === name;
- };
-
- var isPadded = function (schema, node) {
- var rule = schema.getElementRule(node.name);
- return rule && rule.paddEmpty;
- };
-
- var isEmpty = function (schema, nonEmptyElements, whitespaceElements, node) {
- return node.isEmpty(nonEmptyElements, whitespaceElements, function (node) {
- return isPadded(schema, node);
- });
- };
-
- /**
- * Constructs a new DomParser instance.
- *
- * @constructor
- * @method DomParser
- * @param {Object} settings Name/value collection of settings. comment, cdata, text, start and end are callbacks.
- * @param {tinymce.html.Schema} schema HTML Schema class to use when parsing.
- */
- return function (settings, schema) {
- var self = this, nodeFilters = {}, attributeFilters = [], matchedNodes = {}, matchedAttributes = {};
-
- settings = settings || {};
- settings.validate = "validate" in settings ? settings.validate : true;
- settings.root_name = settings.root_name || 'body';
- self.schema = schema = schema || new Schema();
-
- function fixInvalidChildren(nodes) {
- var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i;
- var nonEmptyElements, whitespaceElements, nonSplitableElements, textBlockElements, specialElements, sibling, nextNode;
-
- nonSplitableElements = makeMap('tr,td,th,tbody,thead,tfoot,table');
- nonEmptyElements = schema.getNonEmptyElements();
- whitespaceElements = schema.getWhiteSpaceElements();
- textBlockElements = schema.getTextBlockElements();
- specialElements = schema.getSpecialElements();
-
- for (ni = 0; ni < nodes.length; ni++) {
- node = nodes[ni];
-
- // Already removed or fixed
- if (!node.parent || node.fixed) {
- continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var on = function (name, callback, prepend, extra) {
+ var handlers, names, i;
+ if (callback === false) {
+ callback = returnFalse;
+ }
+ if (callback) {
+ callback = { func: callback };
+ if (extra) {
+ $_52qop8kjfuw8l6v.extend(callback, extra);
+ }
+ names = name.toLowerCase().split(' ');
+ i = names.length;
+ while (i--) {
+ name = names[i];
+ handlers = bindings[name];
+ if (!handlers) {
+ handlers = bindings[name] = [];
+ toggleEvent(name, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // If the invalid element is a text block and the text block is within a parent LI element
- // Then unwrap the first text block and convert other sibling text blocks to LI elements similar to Word/Open Office
- if (textBlockElements[node.name] && node.parent.name == 'li') {
- // Move sibling text blocks after LI element
- sibling = node.next;
- while (sibling) {
- if (textBlockElements[sibling.name]) {
- sibling.name = 'li';
- sibling.fixed = true;
- node.parent.insert(sibling, node.parent);
- } else {
- break;
- }
-
- sibling = sibling.next;
- }
-
- // Unwrap current text block
- node.unwrap(node);
- continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (prepend) {
+ handlers.unshift(callback);
+ } else {
+ handlers.push(callback);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Get list of all parent nodes until we find a valid parent to stick the child into
- parents = [node];
- for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) &&
- !nonSplitableElements[parent.name]; parent = parent.parent) {
- parents.push(parent);
- }
-
- // Found a suitable parent
- if (parent && parents.length > 1) {
- // Reverse the array since it makes looping easier
- parents.reverse();
-
- // Clone the related parent and insert that after the moved node
- newParent = currentNode = self.filterNode(parents[0].clone());
-
- // Start cloning and moving children on the left side of the target node
- for (i = 0; i < parents.length - 1; i++) {
- if (schema.isValidChild(currentNode.name, parents[i].name)) {
- tempNode = self.filterNode(parents[i].clone());
- currentNode.append(tempNode);
- } else {
- tempNode = currentNode;
- }
-
- for (childNode = parents[i].firstChild; childNode && childNode != parents[i + 1];) {
- nextNode = childNode.next;
- tempNode.append(childNode);
- childNode = nextNode;
- }
-
- currentNode = tempNode;
- }
-
- if (!isEmpty(schema, nonEmptyElements, whitespaceElements, newParent)) {
- parent.insert(newParent, parents[0], true);
- parent.insert(node, newParent);
- } else {
- parent.insert(node, parents[0], true);
- }
-
- // Check if the element is empty by looking through it's contents and special treatment for <p><br /></p>
- parent = parents[0];
- if (isEmpty(schema, nonEmptyElements, whitespaceElements, parent) || hasOnlyChild(parent, 'br')) {
- parent.empty().remove();
- }
- } else if (node.parent) {
- // If it's an LI try to find a UL/OL for it or wrap it
- if (node.name === 'li') {
- sibling = node.prev;
- if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {
- sibling.append(node);
- continue;
- }
-
- sibling = node.next;
- if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {
- sibling.insert(node, sibling.firstChild, true);
- continue;
- }
-
- node.wrap(self.filterNode(new Node('ul', 1)));
- continue;
- }
-
- // Try wrapping the element in a DIV
- if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) {
- node.wrap(self.filterNode(new Node('div', 1)));
- } else {
- // We failed wrapping it, then remove or unwrap it
- if (specialElements[node.name]) {
- node.empty().remove();
- } else {
- node.unwrap();
- }
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Runs the specified node though the element and attributes filters.
- *
- * @method filterNode
- * @param {tinymce.html.Node} Node the node to run filters on.
- * @return {tinymce.html.Node} The passed in node.
- */
- self.filterNode = function (node) {
- var i, name, list;
-
- // Run element filters
- if (name in nodeFilters) {
- list = matchedNodes[name];
-
- if (list) {
- list.push(node);
- } else {
- matchedNodes[name] = [node];
- }
- }
-
- // Run attribute filters
- i = attributeFilters.length;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
+ };
+ var off = function (name, callback) {
+ var i, handlers, bindingName, names, hi;
+ if (name) {
+ names = name.toLowerCase().split(' ');
+ i = names.length;
</ins><span class="cx" style="display: block; padding: 0 10px"> while (i--) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- name = attributeFilters[i].name;
-
- if (name in node.attributes.map) {
- list = matchedAttributes[name];
-
- if (list) {
- list.push(node);
- } else {
- matchedAttributes[name] = [node];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ name = names[i];
+ handlers = bindings[name];
+ if (!name) {
+ for (bindingName in bindings) {
+ toggleEvent(bindingName, false);
+ delete bindings[bindingName];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return node;
- };
-
- /**
- * Adds a node filter function to the parser, the parser will collect the specified nodes by name
- * and then execute the callback ones it has finished parsing the document.
- *
- * @example
- * parser.addNodeFilter('p,h1', function(nodes, name) {
- * for (var i = 0; i < nodes.length; i++) {
- * console.log(nodes[i].name);
- * }
- * });
- * @method addNodeFilter
- * @method {String} name Comma separated list of nodes to collect.
- * @param {function} callback Callback function to execute once it has collected nodes.
- */
- self.addNodeFilter = function (name, callback) {
- each(explode(name), function (name) {
- var list = nodeFilters[name];
-
- if (!list) {
- nodeFilters[name] = list = [];
- }
-
- list.push(callback);
- });
- };
-
- /**
- * Adds a attribute filter function to the parser, the parser will collect nodes that has the specified attributes
- * and then execute the callback ones it has finished parsing the document.
- *
- * @example
- * parser.addAttributeFilter('src,href', function(nodes, name) {
- * for (var i = 0; i < nodes.length; i++) {
- * console.log(nodes[i].name);
- * }
- * });
- * @method addAttributeFilter
- * @method {String} name Comma separated list of nodes to collect.
- * @param {function} callback Callback function to execute once it has collected nodes.
- */
- self.addAttributeFilter = function (name, callback) {
- each(explode(name), function (name) {
- var i;
-
- for (i = 0; i < attributeFilters.length; i++) {
- if (attributeFilters[i].name === name) {
- attributeFilters[i].callbacks.push(callback);
- return;
- }
- }
-
- attributeFilters.push({ name: name, callbacks: [callback] });
- });
- };
-
- /**
- * Parses the specified HTML string into a DOM like node tree and returns the result.
- *
- * @example
- * var rootNode = new DomParser({...}).parse('<b>text</b>');
- * @method parse
- * @param {String} html Html string to sax parse.
- * @param {Object} args Optional args object that gets passed to all filter functions.
- * @return {tinymce.html.Node} Root node containing the tree.
- */
- self.parse = function (html, args) {
- var parser, rootNode, node, nodes, i, l, fi, fl, list, name, validate;
- var blockElements, startWhiteSpaceRegExp, invalidChildren = [], isInWhiteSpacePreservedElement;
- var endWhiteSpaceRegExp, allWhiteSpaceRegExp, isAllWhiteSpaceRegExp, whiteSpaceElements;
- var children, nonEmptyElements, rootBlockName;
-
- args = args || {};
- matchedNodes = {};
- matchedAttributes = {};
- blockElements = extend(makeMap('script,style,head,html,body,title,meta,param'), schema.getBlockElements());
- nonEmptyElements = schema.getNonEmptyElements();
- children = schema.children;
- validate = settings.validate;
- rootBlockName = "forced_root_block" in args ? args.forced_root_block : settings.forced_root_block;
-
- whiteSpaceElements = schema.getWhiteSpaceElements();
- startWhiteSpaceRegExp = /^[ \t\r\n]+/;
- endWhiteSpaceRegExp = /[ \t\r\n]+$/;
- allWhiteSpaceRegExp = /[ \t\r\n]+/g;
- isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/;
-
- function addRootBlocks() {
- var node = rootNode.firstChild, next, rootBlockNode;
-
- // Removes whitespace at beginning and end of block so:
- // <p> x </p> -> <p>x</p>
- function trim(rootBlockNode) {
- if (rootBlockNode) {
- node = rootBlockNode.firstChild;
- if (node && node.type == 3) {
- node.value = node.value.replace(startWhiteSpaceRegExp, '');
- }
-
- node = rootBlockNode.lastChild;
- if (node && node.type == 3) {
- node.value = node.value.replace(endWhiteSpaceRegExp, '');
- }
- }
- }
-
- // Check if rootBlock is valid within rootNode for example if P is valid in H1 if H1 is the contentEditabe root
- if (!schema.isValidChild(rootNode.name, rootBlockName.toLowerCase())) {
- return;
- }
-
- while (node) {
- next = node.next;
-
- if (node.type == 3 || (node.type == 1 && node.name !== 'p' &&
- !blockElements[node.name] && !node.attr('data-mce-type'))) {
- if (!rootBlockNode) {
- // Create a new root block element
- rootBlockNode = createNode(rootBlockName, 1);
- rootBlockNode.attr(settings.forced_root_block_attrs);
- rootNode.insert(rootBlockNode, node);
- rootBlockNode.append(node);
- } else {
- rootBlockNode.append(node);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (handlers) {
+ if (!callback) {
+ handlers.length = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- trim(rootBlockNode);
- rootBlockNode = null;
- }
-
- node = next;
- }
-
- trim(rootBlockNode);
- }
-
- function createNode(name, type) {
- var node = new Node(name, type), list;
-
- if (name in nodeFilters) {
- list = matchedNodes[name];
-
- if (list) {
- list.push(node);
- } else {
- matchedNodes[name] = [node];
- }
- }
-
- return node;
- }
-
- function removeWhitespaceBefore(node) {
- var textNode, textNodeNext, textVal, sibling, blockElements = schema.getBlockElements();
-
- for (textNode = node.prev; textNode && textNode.type === 3;) {
- textVal = textNode.value.replace(endWhiteSpaceRegExp, '');
-
- // Found a text node with non whitespace then trim that and break
- if (textVal.length > 0) {
- textNode.value = textVal;
- return;
- }
-
- textNodeNext = textNode.next;
-
- // Fix for bug #7543 where bogus nodes would produce empty
- // text nodes and these would be removed if a nested list was before it
- if (textNodeNext) {
- if (textNodeNext.type == 3 && textNodeNext.value.length) {
- textNode = textNode.prev;
- continue;
- }
-
- if (!blockElements[textNodeNext.name] && textNodeNext.name != 'script' && textNodeNext.name != 'style') {
- textNode = textNode.prev;
- continue;
- }
- }
-
- sibling = textNode.prev;
- textNode.remove();
- textNode = sibling;
- }
- }
-
- function cloneAndExcludeBlocks(input) {
- var name, output = {};
-
- for (name in input) {
- if (name !== 'li' && name != 'p') {
- output[name] = input[name];
- }
- }
-
- return output;
- }
-
- parser = new SaxParser({
- validate: validate,
- allow_script_urls: settings.allow_script_urls,
- allow_conditional_comments: settings.allow_conditional_comments,
-
- // Exclude P and LI from DOM parsing since it's treated better by the DOM parser
- self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()),
-
- cdata: function (text) {
- node.append(createNode('#cdata', 4)).value = text;
- },
-
- text: function (text, raw) {
- var textNode;
-
- // Trim all redundant whitespace on non white space elements
- if (!isInWhiteSpacePreservedElement) {
- text = text.replace(allWhiteSpaceRegExp, ' ');
-
- if (node.lastChild && blockElements[node.lastChild.name]) {
- text = text.replace(startWhiteSpaceRegExp, '');
- }
- }
-
- // Do we need to create the node
- if (text.length !== 0) {
- textNode = createNode('#text', 3);
- textNode.raw = !!raw;
- node.append(textNode).value = text;
- }
- },
-
- comment: function (text) {
- node.append(createNode('#comment', 8)).value = text;
- },
-
- pi: function (name, text) {
- node.append(createNode(name, 7)).value = text;
- removeWhitespaceBefore(node);
- },
-
- doctype: function (text) {
- var newNode;
-
- newNode = node.append(createNode('#doctype', 10));
- newNode.value = text;
- removeWhitespaceBefore(node);
- },
-
- start: function (name, attrs, empty) {
- var newNode, attrFiltersLen, elementRule, attrName, parent;
-
- elementRule = validate ? schema.getElementRule(name) : {};
- if (elementRule) {
- newNode = createNode(elementRule.outputName || name, 1);
- newNode.attributes = attrs;
- newNode.shortEnded = empty;
-
- node.append(newNode);
-
- // Check if node is valid child of the parent node is the child is
- // unknown we don't collect it since it's probably a custom element
- parent = children[node.name];
- if (parent && children[newNode.name] && !parent[newNode.name]) {
- invalidChildren.push(newNode);
- }
-
- attrFiltersLen = attributeFilters.length;
- while (attrFiltersLen--) {
- attrName = attributeFilters[attrFiltersLen].name;
-
- if (attrName in attrs.map) {
- list = matchedAttributes[attrName];
-
- if (list) {
- list.push(newNode);
- } else {
- matchedAttributes[attrName] = [newNode];
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ hi = handlers.length;
+ while (hi--) {
+ if (handlers[hi].func === callback) {
+ handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1));
+ bindings[name] = handlers;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Trim whitespace before block
- if (blockElements[name]) {
- removeWhitespaceBefore(newNode);
- }
-
- // Change current node if the element wasn't empty i.e not <br /> or <img />
- if (!empty) {
- node = newNode;
- }
-
- // Check if we are inside a whitespace preserved element
- if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {
- isInWhiteSpacePreservedElement = true;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- end: function (name) {
- var textNode, elementRule, text, sibling, tempNode;
-
- elementRule = validate ? schema.getElementRule(name) : {};
- if (elementRule) {
- if (blockElements[name]) {
- if (!isInWhiteSpacePreservedElement) {
- // Trim whitespace of the first node in a block
- textNode = node.firstChild;
- if (textNode && textNode.type === 3) {
- text = textNode.value.replace(startWhiteSpaceRegExp, '');
-
- // Any characters left after trim or should we remove it
- if (text.length > 0) {
- textNode.value = text;
- textNode = textNode.next;
- } else {
- sibling = textNode.next;
- textNode.remove();
- textNode = sibling;
-
- // Remove any pure whitespace siblings
- while (textNode && textNode.type === 3) {
- text = textNode.value;
- sibling = textNode.next;
-
- if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {
- textNode.remove();
- textNode = sibling;
- }
-
- textNode = sibling;
- }
- }
- }
-
- // Trim whitespace of the last node in a block
- textNode = node.lastChild;
- if (textNode && textNode.type === 3) {
- text = textNode.value.replace(endWhiteSpaceRegExp, '');
-
- // Any characters left after trim or should we remove it
- if (text.length > 0) {
- textNode.value = text;
- textNode = textNode.prev;
- } else {
- sibling = textNode.prev;
- textNode.remove();
- textNode = sibling;
-
- // Remove any pure whitespace siblings
- while (textNode && textNode.type === 3) {
- text = textNode.value;
- sibling = textNode.prev;
-
- if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {
- textNode.remove();
- textNode = sibling;
- }
-
- textNode = sibling;
- }
- }
- }
- }
-
- // Trim start white space
- // Removed due to: #5424
- /*textNode = node.prev;
- if (textNode && textNode.type === 3) {
- text = textNode.value.replace(startWhiteSpaceRegExp, '');
-
- if (text.length > 0)
- textNode.value = text;
- else
- textNode.remove();
- }*/
- }
-
- // Check if we exited a whitespace preserved element
- if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {
- isInWhiteSpacePreservedElement = false;
- }
-
- // Handle empty nodes
- if (elementRule.removeEmpty || elementRule.paddEmpty) {
- if (isEmpty(schema, nonEmptyElements, whiteSpaceElements, node)) {
- if (elementRule.paddEmpty) {
- paddEmptyNode(settings, node);
- } else {
- // Leave nodes that have a name like <a name="name">
- if (!node.attributes.map.name && !node.attributes.map.id) {
- tempNode = node.parent;
-
- if (blockElements[node.name]) {
- node.empty().remove();
- } else {
- node.unwrap();
- }
-
- node = tempNode;
- return;
- }
- }
- }
- }
-
- node = node.parent;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!handlers.length) {
+ toggleEvent(name, false);
+ delete bindings[name];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }, schema);
-
- rootNode = node = new Node(args.context || settings.root_name, 11);
-
- parser.parse(html);
-
- // Fix invalid children or report invalid children in a contextual parsing
- if (validate && invalidChildren.length) {
- if (!args.context) {
- fixInvalidChildren(invalidChildren);
- } else {
- args.invalid = true;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Wrap nodes in the root into block elements if the root is body
- if (rootBlockName && (rootNode.name == 'body' || args.isRootContent)) {
- addRootBlocks();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ for (name in bindings) {
+ toggleEvent(name, false);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Run filters only when the contents is valid
- if (!args.invalid) {
- // Run node filters
- for (name in matchedNodes) {
- list = nodeFilters[name];
- nodes = matchedNodes[name];
-
- // Remove already removed children
- fi = nodes.length;
- while (fi--) {
- if (!nodes[fi].parent) {
- nodes.splice(fi, 1);
- }
- }
-
- for (i = 0, l = list.length; i < l; i++) {
- list[i](nodes, name, args);
- }
- }
-
- // Run attribute filters
- for (i = 0, l = attributeFilters.length; i < l; i++) {
- list = attributeFilters[i];
-
- if (list.name in matchedAttributes) {
- nodes = matchedAttributes[list.name];
-
- // Remove already removed children
- fi = nodes.length;
- while (fi--) {
- if (!nodes[fi].parent) {
- nodes.splice(fi, 1);
- }
- }
-
- for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) {
- list.callbacks[fi](nodes, list.name, args);
- }
- }
- }
- }
-
- return rootNode;
- };
-
- // Remove <br> at end of block elements Gecko and WebKit injects BR elements to
- // make it possible to place the caret inside empty blocks. This logic tries to remove
- // these elements and keep br elements that where intended to be there intact
- if (settings.remove_trailing_brs) {
- self.addNodeFilter('br', function (nodes) {
- var i, l = nodes.length, node, blockElements = extend({}, schema.getBlockElements());
- var nonEmptyElements = schema.getNonEmptyElements(), parent, lastParent, prev, prevName;
- var whiteSpaceElements = schema.getNonEmptyElements();
- var elementRule, textNode;
-
- // Remove brs from body element as well
- blockElements.body = 1;
-
- // Must loop forwards since it will otherwise remove all brs in <p>a<br><br><br></p>
- for (i = 0; i < l; i++) {
- node = nodes[i];
- parent = node.parent;
-
- if (blockElements[node.parent.name] && node === parent.lastChild) {
- // Loop all nodes to the left of the current node and check for other BR elements
- // excluding bookmarks since they are invisible
- prev = node.prev;
- while (prev) {
- prevName = prev.name;
-
- // Ignore bookmarks
- if (prevName !== "span" || prev.attr('data-mce-type') !== 'bookmark') {
- // Found a non BR element
- if (prevName !== "br") {
- break;
- }
-
- // Found another br it's a <br><br> structure then don't remove anything
- if (prevName === 'br') {
- node = null;
- break;
- }
- }
-
- prev = prev.prev;
- }
-
- if (node) {
- node.remove();
-
- // Is the parent to be considered empty after we removed the BR
- if (isEmpty(schema, nonEmptyElements, whiteSpaceElements, parent)) {
- elementRule = schema.getElementRule(parent.name);
-
- // Remove or padd the element depending on schema rule
- if (elementRule) {
- if (elementRule.removeEmpty) {
- parent.remove();
- } else if (elementRule.paddEmpty) {
- paddEmptyNode(settings, parent);
- }
- }
- }
- }
- } else {
- // Replaces BR elements inside inline elements like <p><b><i><br></i></b></p>
- // so they become <p><b><i> </i></b></p>
- lastParent = node;
- while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) {
- lastParent = parent;
-
- if (blockElements[parent.name]) {
- break;
- }
-
- parent = parent.parent;
- }
-
- if (lastParent === parent && settings.padd_empty_with_br !== true) {
- textNode = new Node('#text', 3);
- textNode.value = '\u00a0';
- node.replace(textNode);
- }
- }
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ bindings = {};
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
+ };
+ var once = function (name, callback, prepend) {
+ return on(name, callback, prepend, { once: true });
+ };
+ var has = function (name) {
+ name = name.toLowerCase();
+ return !(!bindings[name] || bindings[name].length === 0);
+ };
+ self.fire = fire;
+ self.on = on;
+ self.off = off;
+ self.once = once;
+ self.has = has;
+ };
+ Dispatcher.isNative = function (name) {
+ return !!nativeEvents[name.toLowerCase()];
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.addAttributeFilter('href', function (nodes) {
- var i = nodes.length, node;
-
- var appendRel = function (rel) {
- var parts = rel.split(' ').filter(function (p) {
- return p.length > 0;
- });
- return parts.concat(['noopener']).sort().join(' ');
- };
-
- var addNoOpener = function (rel) {
- var newRel = rel ? Tools.trim(rel) : '';
- if (!/\b(noopener)\b/g.test(newRel)) {
- return appendRel(newRel);
- } else {
- return newRel;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getEventDispatcher = function (obj) {
+ if (!obj._eventDispatcher) {
+ obj._eventDispatcher = new Dispatcher({
+ scope: obj,
+ toggleEvent: function (name, state) {
+ if (Dispatcher.isNative(name) && obj.toggleNativeEvent) {
+ obj.toggleNativeEvent(name, state);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- if (!settings.allow_unsafe_link_target) {
- while (i--) {
- node = nodes[i];
- if (node.name === 'a' && node.attr('target') === '_blank') {
- node.attr('rel', addNoOpener(node.attr('rel')));
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Force anchor names closed, unless the setting "allow_html_in_named_anchor" is explicitly included.
- if (!settings.allow_html_in_named_anchor) {
- self.addAttributeFilter('id,name', function (nodes) {
- var i = nodes.length, sibling, prevSibling, parent, node;
-
- while (i--) {
- node = nodes[i];
- if (node.name === 'a' && node.firstChild && !node.attr('href')) {
- parent = node.parent;
-
- // Move children after current node
- sibling = node.lastChild;
- do {
- prevSibling = sibling.prev;
- parent.insert(sibling, node);
- sibling = prevSibling;
- } while (sibling);
- }
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return obj._eventDispatcher;
+ };
+ var $_17qpde45jfuw8lze = {
+ fire: function (name, args, bubble) {
+ var self = this;
+ if (self.removed && name !== 'remove') {
+ return args;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ args = getEventDispatcher(self).fire(name, args, bubble);
+ if (bubble !== false && self.parent) {
+ var parent_1 = self.parent();
+ while (parent_1 && !args.isPropagationStopped()) {
+ parent_1.fire(name, args, false);
+ parent_1 = parent_1.parent();
+ }
+ }
+ return args;
+ },
+ on: function (name, callback, prepend) {
+ return getEventDispatcher(this).on(name, callback, prepend);
+ },
+ off: function (name, callback) {
+ return getEventDispatcher(this).off(name, callback);
+ },
+ once: function (name, callback) {
+ return getEventDispatcher(this).once(name, callback);
+ },
+ hasEventListeners: function (name) {
+ return getEventDispatcher(this).has(name);
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (settings.fix_list_elements) {
- self.addNodeFilter('ul,ol', function (nodes) {
- var i = nodes.length, node, parentNode;
-
- while (i--) {
- node = nodes[i];
- parentNode = node.parent;
-
- if (parentNode.name === 'ul' || parentNode.name === 'ol') {
- if (node.prev && node.prev.name === 'li') {
- node.prev.append(node);
- } else {
- var li = new Node('li', 1);
- li.attr('style', 'list-style-type: none');
- node.wrap(li);
- }
- }
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$1 = DOMUtils$1.DOM;
+ var customEventRootDelegates;
+ var getEventTarget = function (editor, eventName) {
+ if (eventName === 'selectionchange') {
+ return editor.getDoc();
+ }
+ if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) {
+ return editor.getDoc().documentElement;
+ }
+ if (editor.settings.event_root) {
+ if (!editor.eventRoot) {
+ editor.eventRoot = DOM$1.select(editor.settings.event_root)[0];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.validate && schema.getValidClasses()) {
- self.addAttributeFilter('class', function (nodes) {
- var i = nodes.length, node, classList, ci, className, classValue;
- var validClasses = schema.getValidClasses(), validClassesMap, valid;
-
- while (i--) {
- node = nodes[i];
- classList = node.attr('class').split(' ');
- classValue = '';
-
- for (ci = 0; ci < classList.length; ci++) {
- className = classList[ci];
- valid = false;
-
- validClassesMap = validClasses['*'];
- if (validClassesMap && validClassesMap[className]) {
- valid = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return editor.eventRoot;
+ }
+ return editor.getBody();
+ };
+ var bindEventDelegate = function (editor, eventName) {
+ var eventRootElm, delegate;
+ var isListening = function (editor) {
+ return !editor.hidden && !editor.readonly;
+ };
+ if (!editor.delegates) {
+ editor.delegates = {};
+ }
+ if (editor.delegates[eventName] || editor.removed) {
+ return;
+ }
+ eventRootElm = getEventTarget(editor, eventName);
+ if (editor.settings.event_root) {
+ if (!customEventRootDelegates) {
+ customEventRootDelegates = {};
+ editor.editorManager.on('removeEditor', function () {
+ var name;
+ if (!editor.editorManager.activeEditor) {
+ if (customEventRootDelegates) {
+ for (name in customEventRootDelegates) {
+ editor.dom.unbind(getEventTarget(editor, name));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- validClassesMap = validClasses[node.name];
- if (!valid && validClassesMap && validClassesMap[className]) {
- valid = true;
- }
-
- if (valid) {
- if (classValue) {
- classValue += ' ';
- }
-
- classValue += className;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ customEventRootDelegates = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!classValue.length) {
- classValue = null;
- }
-
- node.attr('class', classValue);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- }
-);
-/**
- * Writer.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class is used to write HTML tags out it can be used with the Serializer or the SaxParser.
- *
- * @class tinymce.html.Writer
- * @example
- * var writer = new tinymce.html.Writer({indent: true});
- * var parser = new tinymce.html.SaxParser(writer).parse('<p><br></p>');
- * console.log(writer.getContent());
- *
- * @class tinymce.html.Writer
- * @version 3.4
- */
-define(
- 'tinymce.core.html.Writer',
- [
- "tinymce.core.html.Entities",
- "tinymce.core.util.Tools"
- ],
- function (Entities, Tools) {
- var makeMap = Tools.makeMap;
-
- /**
- * Constructs a new Writer instance.
- *
- * @constructor
- * @method Writer
- * @param {Object} settings Name/value settings object.
- */
- return function (settings) {
- var html = [], indent, indentBefore, indentAfter, encode, htmlOutput;
-
- settings = settings || {};
- indent = settings.indent;
- indentBefore = makeMap(settings.indent_before || '');
- indentAfter = makeMap(settings.indent_after || '');
- encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities);
- htmlOutput = settings.element_format == "html";
-
- return {
- /**
- * Writes the a start element such as <p id="a">.
- *
- * @method start
- * @param {String} name Name of the element.
- * @param {Array} attrs Optional attribute array or undefined if it hasn't any.
- * @param {Boolean} empty Optional empty state if the tag should end like <br />.
- */
- start: function (name, attrs, empty) {
- var i, l, attr, value;
-
- if (indent && indentBefore[name] && html.length > 0) {
- value = html[html.length - 1];
-
- if (value.length > 0 && value !== '\n') {
- html.push('\n');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (customEventRootDelegates[eventName]) {
+ return;
+ }
+ delegate = function (e) {
+ var target = e.target;
+ var editors = editor.editorManager.get();
+ var i = editors.length;
+ while (i--) {
+ var body = editors[i].getBody();
+ if (body === target || DOM$1.isChildOf(target, body)) {
+ if (isListening(editors[i])) {
+ editors[i].fire(eventName, e);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- html.push('<', name);
-
- if (attrs) {
- for (i = 0, l = attrs.length; i < l; i++) {
- attr = attrs[i];
- html.push(' ', attr.name, '="', encode(attr.value, true), '"');
- }
- }
-
- if (!empty || htmlOutput) {
- html[html.length] = '>';
- } else {
- html[html.length] = ' />';
- }
-
- if (empty && indent && indentAfter[name] && html.length > 0) {
- value = html[html.length - 1];
-
- if (value.length > 0 && value !== '\n') {
- html.push('\n');
- }
- }
- },
-
- /**
- * Writes the a end element such as </p>.
- *
- * @method end
- * @param {String} name Name of the element.
- */
- end: function (name) {
- var value;
-
- /*if (indent && indentBefore[name] && html.length > 0) {
- value = html[html.length - 1];
-
- if (value.length > 0 && value !== '\n')
- html.push('\n');
- }*/
-
- html.push('</', name, '>');
-
- if (indent && indentAfter[name] && html.length > 0) {
- value = html[html.length - 1];
-
- if (value.length > 0 && value !== '\n') {
- html.push('\n');
- }
- }
- },
-
- /**
- * Writes a text node.
- *
- * @method text
- * @param {String} text String to write out.
- * @param {Boolean} raw Optional raw state if true the contents wont get encoded.
- */
- text: function (text, raw) {
- if (text.length > 0) {
- html[html.length] = raw ? text : encode(text);
- }
- },
-
- /**
- * Writes a cdata node such as <![CDATA[data]]>.
- *
- * @method cdata
- * @param {String} text String to write out inside the cdata.
- */
- cdata: function (text) {
- html.push('<![CDATA[', text, ']]>');
- },
-
- /**
- * Writes a comment node such as <!-- Comment -->.
- *
- * @method cdata
- * @param {String} text String to write out inside the comment.
- */
- comment: function (text) {
- html.push('<!--', text, '-->');
- },
-
- /**
- * Writes a PI node such as <?xml attr="value" ?>.
- *
- * @method pi
- * @param {String} name Name of the pi.
- * @param {String} text String to write out inside the pi.
- */
- pi: function (name, text) {
- if (text) {
- html.push('<?', name, ' ', encode(text), '?>');
- } else {
- html.push('<?', name, '?>');
- }
-
- if (indent) {
- html.push('\n');
- }
- },
-
- /**
- * Writes a doctype node such as <!DOCTYPE data>.
- *
- * @method doctype
- * @param {String} text String to write out inside the doctype.
- */
- doctype: function (text) {
- html.push('<!DOCTYPE', text, '>', indent ? '\n' : '');
- },
-
- /**
- * Resets the internal buffer if one wants to reuse the writer.
- *
- * @method reset
- */
- reset: function () {
- html.length = 0;
- },
-
- /**
- * Returns the contents that got serialized.
- *
- * @method getContent
- * @return {String} HTML contents that got written down.
- */
- getContent: function () {
- return html.join('').replace(/\n$/, '');
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- }
-);
-/**
- * Serializer.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class is used to serialize down the DOM tree into a string using a Writer instance.
- *
- *
- * @example
- * new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('<p>text</p>'));
- * @class tinymce.html.Serializer
- * @version 3.4
- */
-define(
- 'tinymce.core.html.Serializer',
- [
- "tinymce.core.html.Writer",
- "tinymce.core.html.Schema"
- ],
- function (Writer, Schema) {
- /**
- * Constructs a new Serializer instance.
- *
- * @constructor
- * @method Serializer
- * @param {Object} settings Name/value settings object.
- * @param {tinymce.html.Schema} schema Schema instance to use.
- */
- return function (settings, schema) {
- var self = this, writer = new Writer(settings);
-
- settings = settings || {};
- settings.validate = "validate" in settings ? settings.validate : true;
-
- self.schema = schema = schema || new Schema();
- self.writer = writer;
-
- /**
- * Serializes the specified node into a string.
- *
- * @example
- * new tinymce.html.Serializer().serialize(new tinymce.html.DomParser().parse('<p>text</p>'));
- * @method serialize
- * @param {tinymce.html.Node} node Node instance to serialize.
- * @return {String} String with HTML based on DOM tree.
- */
- self.serialize = function (node) {
- var handlers, validate;
-
- validate = settings.validate;
-
- handlers = {
- // #text
- 3: function (node) {
- writer.text(node.value, node.raw);
- },
-
- // #comment
- 8: function (node) {
- writer.comment(node.value);
- },
-
- // Processing instruction
- 7: function (node) {
- writer.pi(node.name, node.value);
- },
-
- // Doctype
- 10: function (node) {
- writer.doctype(node.value);
- },
-
- // CDATA
- 4: function (node) {
- writer.cdata(node.value);
- },
-
- // Document fragment
- 11: function (node) {
- if ((node = node.firstChild)) {
- do {
- walk(node);
- } while ((node = node.next));
- }
- }
- };
-
- writer.reset();
-
- function walk(node) {
- var handler = handlers[node.type], name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule;
-
- if (!handler) {
- name = node.name;
- isEmpty = node.shortEnded;
- attrs = node.attributes;
-
- // Sort attributes
- if (validate && attrs && attrs.length > 1) {
- sortedAttrs = [];
- sortedAttrs.map = {};
-
- elementRule = schema.getElementRule(node.name);
- if (elementRule) {
- for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {
- attrName = elementRule.attributesOrder[i];
-
- if (attrName in attrs.map) {
- attrValue = attrs.map[attrName];
- sortedAttrs.map[attrName] = attrValue;
- sortedAttrs.push({ name: attrName, value: attrValue });
- }
- }
-
- for (i = 0, l = attrs.length; i < l; i++) {
- attrName = attrs[i].name;
-
- if (!(attrName in sortedAttrs.map)) {
- attrValue = attrs.map[attrName];
- sortedAttrs.map[attrName] = attrValue;
- sortedAttrs.push({ name: attrName, value: attrValue });
- }
- }
-
- attrs = sortedAttrs;
- }
- }
-
- writer.start(node.name, attrs, isEmpty);
-
- if (!isEmpty) {
- if ((node = node.firstChild)) {
- do {
- walk(node);
- } while ((node = node.next));
- }
-
- writer.end(name);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ customEventRootDelegates[eventName] = delegate;
+ DOM$1.bind(eventRootElm, eventName, delegate);
+ } else {
+ delegate = function (e) {
+ if (isListening(editor)) {
+ editor.fire(eventName, e);
+ }
+ };
+ DOM$1.bind(eventRootElm, eventName, delegate);
+ editor.delegates[eventName] = delegate;
+ }
+ };
+ var EditorObservable = {
+ bindPendingEventDelegates: function () {
+ var self = this;
+ $_52qop8kjfuw8l6v.each(self._pendingNativeEvents, function (name) {
+ bindEventDelegate(self, name);
+ });
+ },
+ toggleNativeEvent: function (name, state) {
+ var self = this;
+ if (name === 'focus' || name === 'blur') {
+ return;
+ }
+ if (state) {
+ if (self.initialized) {
+ bindEventDelegate(self, name);
+ } else {
+ if (!self._pendingNativeEvents) {
+ self._pendingNativeEvents = [name];
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- handler(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self._pendingNativeEvents.push(name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Serialize element and treat all non elements as fragments
- if (node.type == 1 && !settings.inner) {
- walk(node);
- } else {
- handlers[11](node);
- }
-
- return writer.getContent();
- };
- };
- }
-);
-
-/**
- * Serializer.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class is used to serialize DOM trees into a string. Consult the TinyMCE Wiki API for
- * more details and examples on how to use this class.
- *
- * @class tinymce.dom.Serializer
- */
-define(
- 'tinymce.core.dom.Serializer',
- [
- "tinymce.core.dom.DOMUtils",
- "tinymce.core.html.DomParser",
- "tinymce.core.html.SaxParser",
- "tinymce.core.html.Entities",
- "tinymce.core.html.Serializer",
- "tinymce.core.html.Node",
- "tinymce.core.html.Schema",
- "tinymce.core.Env",
- "tinymce.core.util.Tools",
- "tinymce.core.text.Zwsp"
- ],
- function (DOMUtils, DomParser, SaxParser, Entities, Serializer, Node, Schema, Env, Tools, Zwsp) {
- var each = Tools.each, trim = Tools.trim;
- var DOM = DOMUtils.DOM;
-
- /**
- * IE 11 has a fantastic bug where it will produce two trailing BR elements to iframe bodies when
- * the iframe is hidden by display: none on a parent container. The DOM is actually out of sync
- * with innerHTML in this case. It's like IE adds shadow DOM BR elements that appears on innerHTML
- * but not as the lastChild of the body. So this fix simply removes the last two
- * BR elements at the end of the document.
- *
- * Example of what happens: <body>text</body> becomes <body>text<br><br></body>
- */
- function trimTrailingBr(rootNode) {
- var brNode1, brNode2;
-
- function isBr(node) {
- return node && node.name === 'br';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (self.initialized) {
+ self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);
+ delete self.delegates[name];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- brNode1 = rootNode.lastChild;
- if (isBr(brNode1)) {
- brNode2 = brNode1.prev;
-
- if (isBr(brNode2)) {
- brNode1.remove();
- brNode2.remove();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ unbindAllNativeEvents: function () {
+ var self = this;
+ var body = self.getBody();
+ var dom = self.dom;
+ var name;
+ if (self.delegates) {
+ for (name in self.delegates) {
+ self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ delete self.delegates;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- /**
- * Constructs a new DOM serializer class.
- *
- * @constructor
- * @method Serializer
- * @param {Object} settings Serializer settings object.
- * @param {tinymce.Editor} editor Optional editor to bind events to and get schema/dom from.
- */
- return function (settings, editor) {
- var dom, schema, htmlParser, tempAttrs = ["data-mce-selected"];
-
- if (editor) {
- dom = editor.dom;
- schema = editor.schema;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!self.inline && body && dom) {
+ body.onload = null;
+ dom.unbind(self.getWin());
+ dom.unbind(self.getDoc());
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function trimHtml(html) {
- var trimContentRegExp = new RegExp([
- '<span[^>]+data-mce-bogus[^>]+>[\u200B\uFEFF]+<\\/span>', // Trim bogus spans like caret containers
- '\\s?(' + tempAttrs.join('|') + ')="[^"]+"' // Trim temporaty data-mce prefixed attributes like data-mce-selected
- ].join('|'), 'gi');
-
- html = Zwsp.trim(html.replace(trimContentRegExp, ''));
-
- return html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (dom) {
+ dom.unbind(body);
+ dom.unbind(self.getContainer());
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ EditorObservable = $_52qop8kjfuw8l6v.extend({}, $_17qpde45jfuw8lze, EditorObservable);
+ var EditorObservable$1 = EditorObservable;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function trimContent(html) {
- var content = html;
- var bogusAllRegExp = /<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g;
- var endTagIndex, index, matchLength, matches, shortEndedElements, schema = editor.schema;
-
- content = trimHtml(content);
- shortEndedElements = schema.getShortEndedElements();
-
- // Remove all bogus elements marked with "all"
- while ((matches = bogusAllRegExp.exec(content))) {
- index = bogusAllRegExp.lastIndex;
- matchLength = matches[0].length;
-
- if (shortEndedElements[matches[1]]) {
- endTagIndex = index;
- } else {
- endTagIndex = SaxParser.findEndTag(schema, content, index);
- }
-
- content = content.substring(0, index - matchLength) + content.substring(endTagIndex);
- bogusAllRegExp.lastIndex = index - matchLength;
- }
-
- return content;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setEditorCommandState = function (editor, cmd, state) {
+ try {
+ editor.getDoc().execCommand(cmd, false, state);
+ } catch (ex) {
+ }
+ };
+ var clickBlocker = function (editor) {
+ var target, handler;
+ target = editor.getBody();
+ handler = function (e) {
+ if (editor.dom.getParents(e.target, 'a').length > 0) {
+ e.preventDefault();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns a trimmed version of the editor contents to be used for the undo level. This
- * will remove any data-mce-bogus="all" marked elements since these are used for UI it will also
- * remove the data-mce-selected attributes used for selection of objects and caret containers.
- * It will keep all data-mce-bogus="1" elements since these can be used to place the caret etc and will
- * be removed by the serialization logic when you save.
- *
- * @private
- * @return {String} HTML contents of the editor excluding some internal bogus elements.
- */
- function getTrimmedContent() {
- return trimContent(editor.getBody().innerHTML);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ editor.dom.bind(target, 'click', handler);
+ return {
+ unbind: function () {
+ editor.dom.unbind(target, 'click', handler);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function addTempAttr(name) {
- if (Tools.inArray(tempAttrs, name) === -1) {
- htmlParser.addAttributeFilter(name, function (nodes, name) {
- var i = nodes.length;
-
- while (i--) {
- nodes[i].attr(name, null);
- }
- });
-
- tempAttrs.push(name);
- }
- }
-
- // Default DOM and Schema if they are undefined
- dom = dom || DOM;
- schema = schema || new Schema(settings);
- settings.entity_encoding = settings.entity_encoding || 'named';
- settings.remove_trailing_brs = "remove_trailing_brs" in settings ? settings.remove_trailing_brs : true;
-
- htmlParser = new DomParser(settings, schema);
-
- // Convert tabindex back to elements when serializing contents
- htmlParser.addAttributeFilter('data-mce-tabindex', function (nodes, name) {
- var i = nodes.length, node;
-
- while (i--) {
- node = nodes[i];
- node.attr('tabindex', node.attributes.map['data-mce-tabindex']);
- node.attr(name, null);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ };
+ var toggleReadOnly = function (editor, state) {
+ if (editor._clickBlocker) {
+ editor._clickBlocker.unbind();
+ editor._clickBlocker = null;
+ }
+ if (state) {
+ editor._clickBlocker = clickBlocker(editor);
+ editor.selection.controlSelection.hideResizeRect();
+ editor.readonly = true;
+ editor.getBody().contentEditable = false;
+ } else {
+ editor.readonly = false;
+ editor.getBody().contentEditable = true;
+ setEditorCommandState(editor, 'StyleWithCSS', false);
+ setEditorCommandState(editor, 'enableInlineTableEditing', false);
+ setEditorCommandState(editor, 'enableObjectResizing', false);
+ editor.focus();
+ editor.nodeChanged();
+ }
+ };
+ var setMode = function (editor, mode) {
+ var currentMode = editor.readonly ? 'readonly' : 'design';
+ if (mode === currentMode) {
+ return;
+ }
+ if (editor.initialized) {
+ toggleReadOnly(editor, mode === 'readonly');
+ } else {
+ editor.on('init', function () {
+ toggleReadOnly(editor, mode === 'readonly');
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ editor.fire('SwitchMode', { mode: mode });
+ };
+ var $_886hp247jfuw8lzl = { setMode: setMode };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Convert move data-mce-src, data-mce-href and data-mce-style into nodes or process them if needed
- htmlParser.addAttributeFilter('src,href,style', function (nodes, name) {
- var i = nodes.length, node, value, internalName = 'data-mce-' + name;
- var urlConverter = settings.url_converter, urlConverterScope = settings.url_converter_scope, undef;
-
- while (i--) {
- node = nodes[i];
-
- value = node.attributes.map[internalName];
- if (value !== undef) {
- // Set external name to internal value and remove internal
- node.attr(name, value.length > 0 ? value : null);
- node.attr(internalName, null);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$10 = $_52qop8kjfuw8l6v.each;
+ var explode$2 = $_52qop8kjfuw8l6v.explode;
+ var keyCodeLookup = {
+ f9: 120,
+ f10: 121,
+ f11: 122
+ };
+ var modifierNames = $_52qop8kjfuw8l6v.makeMap('alt,ctrl,shift,meta,access');
+ function Shortcuts (editor) {
+ var self = this;
+ var shortcuts = {};
+ var pendingPatterns = [];
+ var parseShortcut = function (pattern) {
+ var id, key;
+ var shortcut = {};
+ each$10(explode$2(pattern, '+'), function (value) {
+ if (value in modifierNames) {
+ shortcut[value] = true;
+ } else {
+ if (/^[0-9]{2,}$/.test(value)) {
+ shortcut.keyCode = parseInt(value, 10);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // No internal attribute found then convert the value we have in the DOM
- value = node.attributes.map[name];
-
- if (name === "style") {
- value = dom.serializeStyle(dom.parseStyle(value), node.name);
- } else if (urlConverter) {
- value = urlConverter.call(urlConverterScope, value, name, node.name);
- }
-
- node.attr(name, value.length > 0 ? value : null);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ shortcut.charCode = value.charCodeAt(0);
+ shortcut.keyCode = keyCodeLookup[value] || value.toUpperCase().charCodeAt(0);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove internal classes mceItem<..> or mceSelected
- htmlParser.addAttributeFilter('class', function (nodes) {
- var i = nodes.length, node, value;
-
- while (i--) {
- node = nodes[i];
- value = node.attr('class');
-
- if (value) {
- value = node.attr('class').replace(/(?:^|\s)mce-item-\w+(?!\S)/g, '');
- node.attr('class', value.length > 0 ? value : null);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ id = [shortcut.keyCode];
+ for (key in modifierNames) {
+ if (shortcut[key]) {
+ id.push(key);
+ } else {
+ shortcut[key] = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- // Remove bookmark elements
- htmlParser.addAttributeFilter('data-mce-type', function (nodes, name, args) {
- var i = nodes.length, node;
-
- while (i--) {
- node = nodes[i];
-
- if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup) {
- node.remove();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ shortcut.id = id.join(',');
+ if (shortcut.access) {
+ shortcut.alt = true;
+ if ($_9fhi43ajfuw8l13.mac) {
+ shortcut.ctrl = true;
+ } else {
+ shortcut.shift = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- htmlParser.addNodeFilter('noscript', function (nodes) {
- var i = nodes.length, node;
-
- while (i--) {
- node = nodes[i].firstChild;
-
- if (node) {
- node.value = Entities.decode(node.value);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (shortcut.meta) {
+ if ($_9fhi43ajfuw8l13.mac) {
+ shortcut.meta = true;
+ } else {
+ shortcut.ctrl = true;
+ shortcut.meta = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return shortcut;
+ };
+ var createShortcut = function (pattern, desc, cmdFunc, scope) {
+ var shortcuts;
+ shortcuts = $_52qop8kjfuw8l6v.map(explode$2(pattern, '>'), parseShortcut);
+ shortcuts[shortcuts.length - 1] = $_52qop8kjfuw8l6v.extend(shortcuts[shortcuts.length - 1], {
+ func: cmdFunc,
+ scope: scope || editor
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Force script into CDATA sections and remove the mce- prefix also add comments around styles
- htmlParser.addNodeFilter('script,style', function (nodes, name) {
- var i = nodes.length, node, value, type;
-
- function trim(value) {
- /*jshint maxlen:255 */
- /*eslint max-len:0 */
- return value.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n')
- .replace(/^[\r\n]*|[\r\n]*$/g, '')
- .replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi, '')
- .replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, '');
- }
-
- while (i--) {
- node = nodes[i];
- value = node.firstChild ? node.firstChild.value : '';
-
- if (name === "script") {
- // Remove mce- prefix from script elements and remove default type since the user specified
- // a script element without type attribute
- type = node.attr('type');
- if (type) {
- node.attr('type', type == 'mce-no/type' ? null : type.replace(/^mce\-/, ''));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $_52qop8kjfuw8l6v.extend(shortcuts[0], {
+ desc: editor.translate(desc),
+ subpatterns: shortcuts.slice(1)
+ });
+ };
+ var hasModifier = function (e) {
+ return e.altKey || e.ctrlKey || e.metaKey;
+ };
+ var isFunctionKey = function (e) {
+ return e.type === 'keydown' && e.keyCode >= 112 && e.keyCode <= 123;
+ };
+ var matchShortcut = function (e, shortcut) {
+ if (!shortcut) {
+ return false;
+ }
+ if (shortcut.ctrl !== e.ctrlKey || shortcut.meta !== e.metaKey) {
+ return false;
+ }
+ if (shortcut.alt !== e.altKey || shortcut.shift !== e.shiftKey) {
+ return false;
+ }
+ if (e.keyCode === shortcut.keyCode || e.charCode && e.charCode === shortcut.charCode) {
+ e.preventDefault();
+ return true;
+ }
+ return false;
+ };
+ var executeShortcutAction = function (shortcut) {
+ return shortcut.func ? shortcut.func.call(shortcut.scope) : null;
+ };
+ editor.on('keyup keypress keydown', function (e) {
+ if ((hasModifier(e) || isFunctionKey(e)) && !e.isDefaultPrevented()) {
+ each$10(shortcuts, function (shortcut) {
+ if (matchShortcut(e, shortcut)) {
+ pendingPatterns = shortcut.subpatterns.slice(0);
+ if (e.type === 'keydown') {
+ executeShortcutAction(shortcut);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (value.length > 0) {
- node.firstChild.value = '// <![CDATA[\n' + trim(value) + '\n// ]]>';
- }
- } else {
- if (value.length > 0) {
- node.firstChild.value = '<!--\n' + trim(value) + '\n-->';
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- });
-
- // Convert comments to cdata and handle protected comments
- htmlParser.addNodeFilter('#comment', function (nodes) {
- var i = nodes.length, node;
-
- while (i--) {
- node = nodes[i];
-
- if (node.value.indexOf('[CDATA[') === 0) {
- node.name = '#cdata';
- node.type = 4;
- node.value = node.value.replace(/^\[CDATA\[|\]\]$/g, '');
- } else if (node.value.indexOf('mce:protected ') === 0) {
- node.name = "#text";
- node.type = 3;
- node.raw = true;
- node.value = unescape(node.value).substr(14);
- }
- }
- });
-
- htmlParser.addNodeFilter('xml:namespace,input', function (nodes, name) {
- var i = nodes.length, node;
-
- while (i--) {
- node = nodes[i];
- if (node.type === 7) {
- node.remove();
- } else if (node.type === 1) {
- if (name === "input" && !("type" in node.attributes.map)) {
- node.attr('type', 'text');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ if (matchShortcut(e, pendingPatterns[0])) {
+ if (pendingPatterns.length === 1) {
+ if (e.type === 'keydown') {
+ executeShortcutAction(pendingPatterns[0]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ pendingPatterns.shift();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ self.add = function (pattern, desc, cmdFunc, scope) {
+ var cmd;
+ cmd = cmdFunc;
+ if (typeof cmdFunc === 'string') {
+ cmdFunc = function () {
+ editor.execCommand(cmd, false, null);
+ };
+ } else if ($_52qop8kjfuw8l6v.isArray(cmd)) {
+ cmdFunc = function () {
+ editor.execCommand(cmd[0], cmd[1], cmd[2]);
+ };
+ }
+ each$10(explode$2($_52qop8kjfuw8l6v.trim(pattern.toLowerCase())), function (pattern) {
+ var shortcut = createShortcut(pattern, desc, cmdFunc, scope);
+ shortcuts[shortcut.id] = shortcut;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove internal data attributes
- htmlParser.addAttributeFilter(
- 'data-mce-src,data-mce-href,data-mce-style,' +
- 'data-mce-selected,data-mce-expando,' +
- 'data-mce-type,data-mce-resize',
-
- function (nodes, name) {
- var i = nodes.length;
-
- while (i--) {
- nodes[i].attr(name, null);
- }
- }
- );
-
- // Return public methods
- return {
- /**
- * Schema instance that was used to when the Serializer was constructed.
- *
- * @field {tinymce.html.Schema} schema
- */
- schema: schema,
-
- /**
- * Adds a node filter function to the parser used by the serializer, the parser will collect the specified nodes by name
- * and then execute the callback ones it has finished parsing the document.
- *
- * @example
- * parser.addNodeFilter('p,h1', function(nodes, name) {
- * for (var i = 0; i < nodes.length; i++) {
- * console.log(nodes[i].name);
- * }
- * });
- * @method addNodeFilter
- * @method {String} name Comma separated list of nodes to collect.
- * @param {function} callback Callback function to execute once it has collected nodes.
- */
- addNodeFilter: htmlParser.addNodeFilter,
-
- /**
- * Adds a attribute filter function to the parser used by the serializer, the parser will
- * collect nodes that has the specified attributes
- * and then execute the callback ones it has finished parsing the document.
- *
- * @example
- * parser.addAttributeFilter('src,href', function(nodes, name) {
- * for (var i = 0; i < nodes.length; i++) {
- * console.log(nodes[i].name);
- * }
- * });
- * @method addAttributeFilter
- * @method {String} name Comma separated list of nodes to collect.
- * @param {function} callback Callback function to execute once it has collected nodes.
- */
- addAttributeFilter: htmlParser.addAttributeFilter,
-
- /**
- * Serializes the specified browser DOM node into a HTML string.
- *
- * @method serialize
- * @param {DOMNode} node DOM node to serialize.
- * @param {Object} args Arguments option that gets passed to event handlers.
- */
- serialize: function (node, args) {
- var self = this, impl, doc, oldDoc, htmlSerializer, content, rootNode;
-
- // Explorer won't clone contents of script and style and the
- // selected index of select elements are cleared on a clone operation.
- if (Env.ie && dom.select('script,style,select,map').length > 0) {
- content = node.innerHTML;
- node = node.cloneNode(false);
- dom.setHTML(node, content);
- } else {
- node = node.cloneNode(true);
- }
-
- // Nodes needs to be attached to something in WebKit/Opera
- // This fix will make DOM ranges and make Sizzle happy!
- impl = document.implementation;
- if (impl.createHTMLDocument) {
- // Create an empty HTML document
- doc = impl.createHTMLDocument("");
-
- // Add the element or it's children if it's a body element to the new document
- each(node.nodeName == 'BODY' ? node.childNodes : [node], function (node) {
- doc.body.appendChild(doc.importNode(node, true));
- });
-
- // Grab first child or body element for serialization
- if (node.nodeName != 'BODY') {
- node = doc.body.firstChild;
- } else {
- node = doc.body;
- }
-
- // set the new document in DOMUtils so createElement etc works
- oldDoc = dom.doc;
- dom.doc = doc;
- }
-
- args = args || {};
- args.format = args.format || 'html';
-
- // Don't wrap content if we want selected html
- if (args.selection) {
- args.forced_root_block = '';
- }
-
- // Pre process
- if (!args.no_events) {
- args.node = node;
- self.onPreProcess(args);
- }
-
- // Parse HTML
- content = Zwsp.trim(trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node)));
- rootNode = htmlParser.parse(content, args);
- trimTrailingBr(rootNode);
-
- // Serialize HTML
- htmlSerializer = new Serializer(settings, schema);
- args.content = htmlSerializer.serialize(rootNode);
-
- // Post process
- if (!args.no_events) {
- self.onPostProcess(args);
- }
-
- // Restore the old document if it was changed
- if (oldDoc) {
- dom.doc = oldDoc;
- }
-
- args.node = null;
-
- return args.content;
- },
-
- /**
- * Adds valid elements rules to the serializers schema instance this enables you to specify things
- * like what elements should be outputted and what attributes specific elements might have.
- * Consult the Wiki for more details on this format.
- *
- * @method addRules
- * @param {String} rules Valid elements rules string to add to schema.
- */
- addRules: function (rules) {
- schema.addValidElements(rules);
- },
-
- /**
- * Sets the valid elements rules to the serializers schema instance this enables you to specify things
- * like what elements should be outputted and what attributes specific elements might have.
- * Consult the Wiki for more details on this format.
- *
- * @method setRules
- * @param {String} rules Valid elements rules string.
- */
- setRules: function (rules) {
- schema.setValidElements(rules);
- },
-
- onPreProcess: function (args) {
- if (editor) {
- editor.fire('PreProcess', args);
- }
- },
-
- onPostProcess: function (args) {
- if (editor) {
- editor.fire('PostProcess', args);
- }
- },
-
- /**
- * Adds a temporary internal attribute these attributes will get removed on undo and
- * when getting contents out of the editor.
- *
- * @method addTempAttr
- * @param {String} name string
- */
- addTempAttr: addTempAttr,
-
- // Internal
- trimHtml: trimHtml,
- getTrimmedContent: getTrimmedContent,
- trimContent: trimContent
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.remove = function (pattern) {
+ var shortcut = createShortcut(pattern);
+ if (shortcuts[shortcut.id]) {
+ delete shortcuts[shortcut.id];
+ return true;
+ }
+ return false;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * DeleteUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var any$1 = function (predicate) {
+ return $_chabeg35jfuw8lo3.first(predicate).isSome();
+ };
+ var ancestor$3 = function (scope, predicate, isRoot) {
+ return $_chabeg35jfuw8lo3.ancestor(scope, predicate, isRoot).isSome();
+ };
+ var closest$3 = function (scope, predicate, isRoot) {
+ return $_chabeg35jfuw8lo3.closest(scope, predicate, isRoot).isSome();
+ };
+ var sibling$4 = function (scope, predicate) {
+ return $_chabeg35jfuw8lo3.sibling(scope, predicate).isSome();
+ };
+ var child$4 = function (scope, predicate) {
+ return $_chabeg35jfuw8lo3.child(scope, predicate).isSome();
+ };
+ var descendant$3 = function (scope, predicate) {
+ return $_chabeg35jfuw8lo3.descendant(scope, predicate).isSome();
+ };
+ var $_4oy4vv4bjfuw8m07 = {
+ any: any$1,
+ ancestor: ancestor$3,
+ closest: closest$3,
+ sibling: sibling$4,
+ child: child$4,
+ descendant: descendant$3
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.delete.DeleteUtils',
- [
- 'ephox.katamari.api.Option',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.PredicateFind',
- 'tinymce.core.dom.ElementType'
- ],
- function (Option, Compare, Element, PredicateFind, ElementType) {
- var isBeforeRoot = function (rootNode) {
- return function (elm) {
- return Compare.eq(rootNode, Element.fromDom(elm.dom().parentNode));
- };
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var focus = function (element) {
+ element.dom().focus();
+ };
+ var blur = function (element) {
+ element.dom().blur();
+ };
+ var hasFocus = function (element) {
+ var doc = $_2j4g5u17jfuw8lav.owner(element).dom();
+ return element.dom() === doc.activeElement;
+ };
+ var active = function (_doc) {
+ var doc = _doc !== undefined ? _doc.dom() : document;
+ return Option.from(doc.activeElement).map($_c9h6qlzjfuw8l98.fromDom);
+ };
+ var focusInside = function (element) {
+ var doc = $_2j4g5u17jfuw8lav.owner(element);
+ var inside = active(doc).filter(function (a) {
+ return $_4oy4vv4bjfuw8m07.closest(a, $_68e81l6jfuw8kyc.curry($_4fb96d1djfuw8lbl.eq, element));
+ });
+ inside.fold(function () {
+ focus(element);
+ }, $_68e81l6jfuw8kyc.noop);
+ };
+ var search = function (element) {
+ return active($_2j4g5u17jfuw8lav.owner(element)).filter(function (e) {
+ return element.dom().contains(e.dom());
+ });
+ };
+ var $_8mrg7v4ajfuw8m02 = {
+ hasFocus: hasFocus,
+ focus: focus,
+ blur: blur,
+ active: active,
+ search: search,
+ focusInside: focusInside
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getParentBlock = function (rootNode, elm) {
- return Compare.contains(rootNode, elm) ? PredicateFind.closest(elm, function (element) {
- return ElementType.isTextBlock(element) || ElementType.isListItem(element);
- }, isBeforeRoot(rootNode)) : Option.none();
- };
-
- var placeCaretInEmptyBody = function (editor) {
- var body = editor.getBody();
- var node = body.firstChild && editor.dom.isBlock(body.firstChild) ? body.firstChild : body;
- editor.selection.setCursorLocation(node, 0);
- };
-
- var paddEmptyBody = function (editor) {
- if (editor.dom.isEmpty(editor.getBody())) {
- editor.setContent('');
- placeCaretInEmptyBody(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getContentEditableHost = function (editor, node) {
+ return editor.dom.getParent(node, function (node) {
+ return editor.dom.getContentEditable(node) === 'true';
+ });
+ };
+ var getCollapsedNode = function (rng) {
+ return rng.collapsed ? Option.from(getNode(rng.startContainer, rng.startOffset)).map($_c9h6qlzjfuw8l98.fromDom) : Option.none();
+ };
+ var getFocusInElement = function (root, rng) {
+ return getCollapsedNode(rng).bind(function (node) {
+ if (isTableSection(node)) {
+ return Option.some(node);
+ } else if ($_4fb96d1djfuw8lbl.contains(root, node) === false) {
+ return Option.some(root);
+ } else {
+ return Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var normalizeSelection = function (editor, rng) {
+ getFocusInElement($_c9h6qlzjfuw8l98.fromDom(editor.getBody()), rng).bind(function (elm) {
+ return $_25kl2c2cjfuw8ljh.firstPositionIn(elm.dom());
+ }).fold(function () {
+ editor.selection.normalize();
+ return;
+ }, function (caretPos) {
+ return editor.selection.setRng(caretPos.toRange());
+ });
+ };
+ var focusBody = function (body) {
+ if (body.setActive) {
+ try {
+ body.setActive();
+ } catch (ex) {
+ body.focus();
+ }
+ } else {
+ body.focus();
+ }
+ };
+ var hasElementFocus = function (elm) {
+ return $_8mrg7v4ajfuw8m02.hasFocus(elm) || $_8mrg7v4ajfuw8m02.search(elm).isSome();
+ };
+ var hasIframeFocus = function (editor) {
+ return editor.iframeElement && $_8mrg7v4ajfuw8m02.hasFocus($_c9h6qlzjfuw8l98.fromDom(editor.iframeElement));
+ };
+ var hasInlineFocus = function (editor) {
+ var rawBody = editor.getBody();
+ return rawBody && hasElementFocus($_c9h6qlzjfuw8l98.fromDom(rawBody));
+ };
+ var hasFocus$1 = function (editor) {
+ return editor.inline ? hasInlineFocus(editor) : hasIframeFocus(editor);
+ };
+ var focusEditor = function (editor) {
+ var selection = editor.selection, contentEditable = editor.settings.content_editable;
+ var body = editor.getBody();
+ var rng = selection.getRng();
+ editor.quirks.refreshContentEditable();
+ var contentEditableHost = getContentEditableHost(editor, selection.getNode());
+ if (editor.$.contains(body, contentEditableHost)) {
+ focusBody(contentEditableHost);
+ normalizeSelection(editor, rng);
+ activateEditor(editor);
+ return;
+ }
+ if (editor.bookmark !== undefined && hasFocus$1(editor) === false) {
+ $_2a7vvg40jfuw8lyb.getRng(editor).each(function (bookmarkRng) {
+ editor.selection.setRng(bookmarkRng);
+ rng = bookmarkRng;
+ });
+ }
+ if (!contentEditable) {
+ if (!$_9fhi43ajfuw8l13.opera) {
+ focusBody(body);
+ }
+ editor.getWin().focus();
+ }
+ if ($_9fhi43ajfuw8l13.gecko || contentEditable) {
+ focusBody(body);
+ normalizeSelection(editor, rng);
+ }
+ activateEditor(editor);
+ };
+ var activateEditor = function (editor) {
+ return editor.editorManager.setActive(editor);
+ };
+ var focus$1 = function (editor, skipFocus) {
+ if (editor.removed) {
+ return;
+ }
+ skipFocus ? activateEditor(editor) : focusEditor(editor);
+ };
+ var $_18lipa49jfuw8lzt = {
+ focus: focus$1,
+ hasFocus: hasFocus$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getProp = function (propName, elm) {
+ var rawElm = elm.dom();
+ return rawElm[propName];
+ };
+ var getComputedSizeProp = function (propName, elm) {
+ return parseInt($_cworr512jfuw8l9j.get(elm, propName), 10);
+ };
+ var getClientWidth = $_68e81l6jfuw8kyc.curry(getProp, 'clientWidth');
+ var getClientHeight = $_68e81l6jfuw8kyc.curry(getProp, 'clientHeight');
+ var getMarginTop = $_68e81l6jfuw8kyc.curry(getComputedSizeProp, 'margin-top');
+ var getMarginLeft = $_68e81l6jfuw8kyc.curry(getComputedSizeProp, 'margin-left');
+ var getBoundingClientRect$1 = function (elm) {
+ return elm.dom().getBoundingClientRect();
+ };
+ var isInsideElementContentArea = function (bodyElm, clientX, clientY) {
+ var clientWidth = getClientWidth(bodyElm);
+ var clientHeight = getClientHeight(bodyElm);
+ return clientX >= 0 && clientY >= 0 && clientX <= clientWidth && clientY <= clientHeight;
+ };
+ var transpose = function (inline, elm, clientX, clientY) {
+ var clientRect = getBoundingClientRect$1(elm);
+ var deltaX = inline ? clientRect.left + elm.dom().clientLeft + getMarginLeft(elm) : 0;
+ var deltaY = inline ? clientRect.top + elm.dom().clientTop + getMarginTop(elm) : 0;
+ var x = clientX - deltaX;
+ var y = clientY - deltaY;
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- getParentBlock: getParentBlock,
- paddEmptyBody: paddEmptyBody
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ x: x,
+ y: y
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isXYInContentArea = function (editor, clientX, clientY) {
+ var bodyElm = $_c9h6qlzjfuw8l98.fromDom(editor.getBody());
+ var targetElm = editor.inline ? bodyElm : $_2j4g5u17jfuw8lav.documentElement(bodyElm);
+ var transposedPoint = transpose(editor.inline, targetElm, clientX, clientY);
+ return isInsideElementContentArea(targetElm, transposedPoint.x, transposedPoint.y);
+ };
+ var fromDomSafe = function (node) {
+ return Option.from(node).map($_c9h6qlzjfuw8l98.fromDom);
+ };
+ var isEditorAttachedToDom = function (editor) {
+ var rawContainer = editor.inline ? editor.getBody() : editor.getContentAreaContainer();
+ return fromDomSafe(rawContainer).map(function (container) {
+ return $_4fb96d1djfuw8lbl.contains($_2j4g5u17jfuw8lav.owner(container), container);
+ }).getOr(false);
+ };
+ var $_dy1qjd4ejfuw8m0u = {
+ isXYInContentArea: isXYInContentArea,
+ isEditorAttachedToDom: isEditorAttachedToDom
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'ephox.sugar.api.search.SelectorExists',
-
- [
- 'ephox.sugar.api.search.SelectorFind'
- ],
-
- function (SelectorFind) {
- var any = function (selector) {
- return SelectorFind.first(selector).isSome();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function NotificationManagerImpl () {
+ var unimplemented = function () {
+ throw new Error('Theme did not provide a NotificationManager implementation.');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var ancestor = function (scope, selector, isRoot) {
- return SelectorFind.ancestor(scope, selector, isRoot).isSome();
- };
-
- var sibling = function (scope, selector) {
- return SelectorFind.sibling(scope, selector).isSome();
- };
-
- var child = function (scope, selector) {
- return SelectorFind.child(scope, selector).isSome();
- };
-
- var descendant = function (scope, selector) {
- return SelectorFind.descendant(scope, selector).isSome();
- };
-
- var closest = function (scope, selector, isRoot) {
- return SelectorFind.closest(scope, selector, isRoot).isSome();
- };
-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- any: any,
- ancestor: ancestor,
- sibling: sibling,
- child: child,
- descendant: descendant,
- closest: closest
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ open: unimplemented,
+ close: unimplemented,
+ reposition: unimplemented,
+ getArgs: unimplemented
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Empty.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.dom.Empty',
- [
- 'ephox.katamari.api.Fun',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.SelectorExists',
- 'tinymce.core.caret.CaretCandidate',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.TreeWalker'
- ],
- function (Fun, Compare, Element, SelectorExists, CaretCandidate, NodeType, TreeWalker) {
- var hasWhitespacePreserveParent = function (rootNode, node) {
- var rootElement = Element.fromDom(rootNode);
- var startNode = Element.fromDom(node);
- return SelectorExists.ancestor(startNode, 'pre,code', Fun.curry(Compare.eq, rootElement));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function NotificationManager (editor) {
+ var notifications = [];
+ var getImplementation = function () {
+ var theme = editor.theme;
+ return theme && theme.getNotificationManagerImpl ? theme.getNotificationManagerImpl() : NotificationManagerImpl();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isWhitespace = function (rootNode, node) {
- return NodeType.isText(node) && /^[ \t\r\n]*$/.test(node.data) && hasWhitespacePreserveParent(rootNode, node) === false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getTopNotification = function () {
+ return Option.from(notifications[0]);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isNamedAnchor = function (node) {
- return NodeType.isElement(node) && node.nodeName === 'A' && node.hasAttribute('name');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isEqual = function (a, b) {
+ return a.type === b.type && a.text === b.text && !a.progressBar && !a.timeout && !b.progressBar && !b.timeout;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isContent = function (rootNode, node) {
- return (CaretCandidate.isCaretCandidate(node) && isWhitespace(rootNode, node) === false) || isNamedAnchor(node) || isBookmark(node);
- };
-
- var isBookmark = NodeType.hasAttribute('data-mce-bookmark');
- var isBogus = NodeType.hasAttribute('data-mce-bogus');
- var isBogusAll = NodeType.hasAttributeValue('data-mce-bogus', 'all');
-
- var isEmptyNode = function (targetNode) {
- var walker, node, brCount = 0;
-
- if (isContent(targetNode, targetNode)) {
- return false;
- } else {
- node = targetNode.firstChild;
- if (!node) {
- return true;
- }
-
- walker = new TreeWalker(node, targetNode);
- do {
- if (isBogusAll(node)) {
- node = walker.next(true);
- continue;
- }
-
- if (isBogus(node)) {
- node = walker.next();
- continue;
- }
-
- if (NodeType.isBr(node)) {
- brCount++;
- node = walker.next();
- continue;
- }
-
- if (isContent(targetNode, node)) {
- return false;
- }
-
- node = walker.next();
- } while (node);
-
- return brCount <= 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var reposition = function () {
+ if (notifications.length > 0) {
+ getImplementation().reposition(notifications);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isEmpty = function (elm) {
- return isEmptyNode(elm.dom());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addNotification = function (notification) {
+ notifications.push(notification);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- isEmpty: isEmpty
- };
- }
-);
-
-/**
- * BlockBoundary.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.delete.BlockBoundary',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.api.Options',
- 'ephox.katamari.api.Struct',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.node.Node',
- 'ephox.sugar.api.search.PredicateFind',
- 'ephox.sugar.api.search.Traverse',
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.delete.DeleteUtils',
- 'tinymce.core.dom.Empty',
- 'tinymce.core.dom.NodeType'
- ],
- function (Arr, Fun, Option, Options, Struct, Compare, Element, Node, PredicateFind, Traverse, CaretFinder, CaretPosition, DeleteUtils, Empty, NodeType) {
- var BlockPosition = Struct.immutable('block', 'position');
- var BlockBoundary = Struct.immutable('from', 'to');
-
- var getBlockPosition = function (rootNode, pos) {
- var rootElm = Element.fromDom(rootNode);
- var containerElm = Element.fromDom(pos.container());
- return DeleteUtils.getParentBlock(rootElm, containerElm).map(function (block) {
- return BlockPosition(block, pos);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var closeNotification = function (notification) {
+ $_9ek1bp4jfuw8kxg.findIndex(notifications, function (otherNotification) {
+ return otherNotification === notification;
+ }).each(function (index) {
+ notifications.splice(index, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isDifferentBlocks = function (blockBoundary) {
- return Compare.eq(blockBoundary.from().block(), blockBoundary.to().block()) === false;
- };
-
- var hasSameParent = function (blockBoundary) {
- return Traverse.parent(blockBoundary.from().block()).bind(function (parent1) {
- return Traverse.parent(blockBoundary.to().block()).filter(function (parent2) {
- return Compare.eq(parent1, parent2);
- });
- }).isSome();
- };
-
- var isEditable = function (blockBoundary) {
- return NodeType.isContentEditableFalse(blockBoundary.from().block()) === false && NodeType.isContentEditableFalse(blockBoundary.to().block()) === false;
- };
-
- var skipLastBr = function (rootNode, forward, blockPosition) {
- if (NodeType.isBr(blockPosition.position().getNode()) && Empty.isEmpty(blockPosition.block()) === false) {
- return CaretFinder.positionIn(false, blockPosition.block().dom()).bind(function (lastPositionInBlock) {
- if (lastPositionInBlock.isEqual(blockPosition.position())) {
- return CaretFinder.fromPosition(forward, rootNode, lastPositionInBlock).bind(function (to) {
- return getBlockPosition(rootNode, to);
- });
- } else {
- return Option.some(blockPosition);
- }
- }).getOr(blockPosition);
- } else {
- return blockPosition;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var open = function (args) {
+ if (editor.removed || !$_dy1qjd4ejfuw8m0u.isEditorAttachedToDom(editor)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var readFromRange = function (rootNode, forward, rng) {
- var fromBlockPos = getBlockPosition(rootNode, CaretPosition.fromRangeStart(rng));
- var toBlockPos = fromBlockPos.bind(function (blockPos) {
- return CaretFinder.fromPosition(forward, rootNode, blockPos.position()).bind(function (to) {
- return getBlockPosition(rootNode, to).map(function (blockPos) {
- return skipLastBr(rootNode, forward, blockPos);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $_9ek1bp4jfuw8kxg.find(notifications, function (notification) {
+ return isEqual(getImplementation().getArgs(notification), args);
+ }).getOrThunk(function () {
+ editor.editorManager.setActive(editor);
+ var notification = getImplementation().open(args, function () {
+ closeNotification(notification);
+ reposition();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ addNotification(notification);
+ reposition();
+ return notification;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Options.liftN([fromBlockPos, toBlockPos], BlockBoundary).filter(function (blockBoundary) {
- return isDifferentBlocks(blockBoundary) && hasSameParent(blockBoundary) && isEditable(blockBoundary);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var close = function () {
+ getTopNotification().each(function (notification) {
+ getImplementation().close(notification);
+ closeNotification(notification);
+ reposition();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var read = function (rootNode, forward, rng) {
- return rng.collapsed ? readFromRange(rootNode, forward, rng) : Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getNotifications = function () {
+ return notifications;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- read: read
- };
- }
-);
-
-/**
- * MergeBlocks.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.delete.MergeBlocks',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Option',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.dom.Insert',
- 'ephox.sugar.api.dom.Remove',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.Traverse',
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.dom.ElementType',
- 'tinymce.core.dom.Empty',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.Parents'
- ],
- function (Arr, Option, Compare, Insert, Remove, Element, Traverse, CaretFinder, CaretPosition, ElementType, Empty, NodeType, Parents) {
- var getChildrenUntilBlockBoundary = function (block) {
- var children = Traverse.children(block);
- return Arr.findIndex(children, ElementType.isBlock).fold(
- function () {
- return children;
- },
- function (index) {
- return children.slice(0, index);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var registerEvents = function (editor) {
+ editor.on('SkinLoaded', function () {
+ var serviceMessage = editor.settings.service_message;
+ if (serviceMessage) {
+ open({
+ text: serviceMessage,
+ type: 'warning',
+ timeout: 0,
+ icon: ''
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- );
- };
-
- var extractChildren = function (block) {
- var children = getChildrenUntilBlockBoundary(block);
-
- Arr.each(children, function (node) {
- Remove.remove(node);
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return children;
- };
-
- var trimBr = function (first, block) {
- CaretFinder.positionIn(first, block.dom()).each(function (position) {
- var node = position.getNode();
- if (NodeType.isBr(node)) {
- Remove.remove(Element.fromDom(node));
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('ResizeEditor ResizeWindow', function () {
+ $_2m8wq9hjfuw8l41.requestAnimationFrame(reposition);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var removeEmptyRoot = function (rootNode, block) {
- var parents = Parents.parentsAndSelf(block, rootNode);
- return Arr.find(parents.reverse(), Empty.isEmpty).each(Remove.remove);
- };
-
- var findParentInsertPoint = function (toBlock, block) {
- var parents = Traverse.parents(block, function (elm) {
- return Compare.eq(elm, toBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('remove', function () {
+ $_9ek1bp4jfuw8kxg.each(notifications, function (notification) {
+ getImplementation().close(notification);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Option.from(parents[parents.length - 2]);
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getInsertionPoint = function (fromBlock, toBlock) {
- if (Compare.contains(toBlock, fromBlock)) {
- return Traverse.parent(fromBlock).bind(function (parent) {
- return Compare.eq(parent, toBlock) ? Option.some(fromBlock) : findParentInsertPoint(toBlock, fromBlock);
- });
- } else {
- return Option.none();
- }
- };
-
- var mergeBlockInto = function (rootNode, fromBlock, toBlock) {
- if (Empty.isEmpty(toBlock)) {
- Remove.remove(toBlock);
- return CaretFinder.firstPositionIn(fromBlock.dom());
- } else {
- trimBr(true, fromBlock);
- trimBr(false, toBlock);
-
- var children = extractChildren(fromBlock);
-
- return getInsertionPoint(fromBlock, toBlock).fold(
- function () {
- removeEmptyRoot(rootNode, fromBlock);
-
- var position = CaretFinder.lastPositionIn(toBlock.dom());
-
- Arr.each(children, function (node) {
- Insert.append(toBlock, node);
- });
-
- return position;
- },
- function (target) {
- var position = CaretFinder.prevPosition(toBlock.dom(), CaretPosition.before(target.dom()));
-
- Arr.each(children, function (node) {
- Insert.before(target, node);
- });
-
- removeEmptyRoot(rootNode, fromBlock);
-
- return position;
- }
- );
- }
- };
-
- var mergeBlocks = function (rootNode, forward, block1, block2) {
- return forward ? mergeBlockInto(rootNode, block2, block1) : mergeBlockInto(rootNode, block1, block2);
- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ registerEvents(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- mergeBlocks: mergeBlocks
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ open: open,
+ close: close,
+ getNotifications: getNotifications
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * BlockBoundaryDelete.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.delete.BlockBoundaryDelete',
- [
- 'ephox.sugar.api.node.Element',
- 'tinymce.core.delete.BlockBoundary',
- 'tinymce.core.delete.MergeBlocks'
- ],
- function (Element, BlockBoundary, MergeBlocks) {
- var backspaceDelete = function (editor, forward) {
- var position, rootNode = Element.fromDom(editor.getBody());
-
- position = BlockBoundary.read(rootNode.dom(), forward, editor.selection.getRng()).bind(function (blockBoundary) {
- return MergeBlocks.mergeBlocks(rootNode, forward, blockBoundary.from().block(), blockBoundary.to().block());
- });
-
- position.each(function (pos) {
- editor.selection.setRng(pos.toRange());
- });
-
- return position.isSome();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function WindowManagerImpl () {
+ var unimplemented = function () {
+ throw new Error('Theme did not provide a WindowManager implementation.');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- backspaceDelete: backspaceDelete
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ open: unimplemented,
+ alert: unimplemented,
+ confirm: unimplemented,
+ close: unimplemented,
+ getParams: unimplemented,
+ setParams: unimplemented
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * BlockRangeDelete.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.delete.BlockRangeDelete',
- [
- 'ephox.katamari.api.Options',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element',
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.delete.DeleteUtils',
- 'tinymce.core.delete.MergeBlocks'
- ],
- function (Options, Compare, Element, CaretFinder, CaretPosition, DeleteUtils, MergeBlocks) {
- var deleteRangeMergeBlocks = function (rootNode, selection) {
- var rng = selection.getRng();
-
- return Options.liftN([
- DeleteUtils.getParentBlock(rootNode, Element.fromDom(rng.startContainer)),
- DeleteUtils.getParentBlock(rootNode, Element.fromDom(rng.endContainer))
- ], function (block1, block2) {
- if (Compare.eq(block1, block2) === false) {
- rng.deleteContents();
-
- MergeBlocks.mergeBlocks(rootNode, true, block1, block2).each(function (pos) {
- selection.setRng(pos.toRange());
- });
-
- return true;
- } else {
- return false;
- }
- }).getOr(false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function WindowManager (editor) {
+ var windows = [];
+ var getImplementation = function () {
+ var theme = editor.theme;
+ return theme && theme.getWindowManagerImpl ? theme.getWindowManagerImpl() : WindowManagerImpl();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isEverythingSelected = function (rootNode, rng) {
- var noPrevious = CaretFinder.prevPosition(rootNode.dom(), CaretPosition.fromRangeStart(rng)).isNone();
- var noNext = CaretFinder.nextPosition(rootNode.dom(), CaretPosition.fromRangeEnd(rng)).isNone();
- return noPrevious && noNext;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var funcBind = function (scope, f) {
+ return function () {
+ return f ? f.apply(scope, arguments) : undefined;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var emptyEditor = function (editor) {
- editor.setContent('');
- editor.selection.setCursorLocation();
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fireOpenEvent = function (win) {
+ editor.fire('OpenWindow', { win: win });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var deleteRange = function (editor) {
- var rootNode = Element.fromDom(editor.getBody());
- var rng = editor.selection.getRng();
- return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fireCloseEvent = function (win) {
+ editor.fire('CloseWindow', { win: win });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var backspaceDelete = function (editor, forward) {
- return editor.selection.isCollapsed() ? false : deleteRange(editor, editor.selection.getRng());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addWindow = function (win) {
+ windows.push(win);
+ fireOpenEvent(win);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- backspaceDelete: backspaceDelete
- };
- }
-);
-
-define(
- 'ephox.katamari.api.Adt',
-
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Obj',
- 'ephox.katamari.api.Type',
- 'global!Array',
- 'global!Error',
- 'global!console'
- ],
-
- function (Arr, Obj, Type, Array, Error, console) {
- /*
- * Generates a church encoded ADT (https://en.wikipedia.org/wiki/Church_encoding)
- * For syntax and use, look at the test code.
- */
- var generate = function (cases) {
- // validation
- if (!Type.isArray(cases)) {
- throw new Error('cases must be an array');
- }
- if (cases.length === 0) {
- throw new Error('there must be at least one case');
- }
-
- var constructors = [ ];
-
- // adt is mutated to add the individual cases
- var adt = {};
- Arr.each(cases, function (acase, count) {
- var keys = Obj.keys(acase);
-
- // validation
- if (keys.length !== 1) {
- throw new Error('one and only one name per case');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var closeWindow = function (win) {
+ $_9ek1bp4jfuw8kxg.findIndex(windows, function (otherWindow) {
+ return otherWindow === win;
+ }).each(function (index) {
+ windows.splice(index, 1);
+ fireCloseEvent(win);
+ if (windows.length === 0) {
+ editor.focus();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var key = keys[0];
- var value = acase[key];
-
- // validation
- if (adt[key] !== undefined) {
- throw new Error('duplicate key detected:' + key);
- } else if (key === 'cata') {
- throw new Error('cannot have a case named cata (sorry)');
- } else if (!Type.isArray(value)) {
- // this implicitly checks if acase is an object
- throw new Error('case arguments must be an array');
- }
-
- constructors.push(key);
- //
- // constructor for key
- //
- adt[key] = function () {
- var argLength = arguments.length;
-
- // validation
- if (argLength !== value.length) {
- throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength);
- }
-
- // Don't use array slice(arguments), makes the whole function unoptimisable on Chrome
- var args = new Array(argLength);
- for (var i = 0; i < args.length; i++) args[i] = arguments[i];
-
-
- var match = function (branches) {
- var branchKeys = Obj.keys(branches);
- if (constructors.length !== branchKeys.length) {
- throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\nActual: ' + branchKeys.join(','));
- }
-
- var allReqd = Arr.forall(constructors, function (reqKey) {
- return Arr.contains(branchKeys, reqKey);
- });
-
- if (!allReqd) throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\nRequired: ' + constructors.join(', '));
-
- return branches[key].apply(null, args);
- };
-
- //
- // the fold function for key
- //
- return {
- fold: function (/* arguments */) {
- // runtime validation
- if (arguments.length !== cases.length) {
- throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + arguments.length);
- }
- var target = arguments[count];
- return target.apply(null, args);
- },
- match: match,
-
- // NOTE: Only for debugging.
- log: function (label) {
- console.log(label, {
- constructors: constructors,
- constructor: key,
- params: args
- });
- }
- };
- };
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return adt;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- generate: generate
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getTopWindow = function () {
+ return Option.from(windows[windows.length - 1]);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * CefDeleteAction.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.delete.CefDeleteAction',
- [
- 'ephox.katamari.api.Adt',
- 'ephox.katamari.api.Option',
- 'ephox.sugar.api.node.Element',
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.caret.CaretUtils',
- 'tinymce.core.delete.DeleteUtils',
- 'tinymce.core.dom.Empty',
- 'tinymce.core.dom.NodeType'
- ],
- function (Adt, Option, Element, CaretFinder, CaretPosition, CaretUtils, DeleteUtils, Empty, NodeType) {
- var DeleteAction = Adt.generate([
- { remove: [ 'element' ] },
- { moveToElement: [ 'element' ] },
- { moveToPosition: [ 'position' ] }
- ]);
-
- var isAtContentEditableBlockCaret = function (forward, from) {
- var elm = from.getNode(forward === false);
- var caretLocation = forward ? 'after' : 'before';
- return NodeType.isElement(elm) && elm.getAttribute('data-mce-caret') === caretLocation;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var open = function (args, params) {
+ editor.editorManager.setActive(editor);
+ $_2a7vvg40jfuw8lyb.store(editor);
+ var win = getImplementation().open(args, params, closeWindow);
+ addWindow(win);
+ return win;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var deleteEmptyBlockOrMoveToCef = function (rootNode, forward, from, to) {
- var toCefElm = to.getNode(forward === false);
- return DeleteUtils.getParentBlock(Element.fromDom(rootNode), Element.fromDom(from.getNode())).map(function (blockElm) {
- return Empty.isEmpty(blockElm) ? DeleteAction.remove(blockElm.dom()) : DeleteAction.moveToElement(toCefElm);
- }).orThunk(function () {
- return Option.some(DeleteAction.moveToElement(toCefElm));
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var alert = function (message, callback, scope) {
+ var win = getImplementation().alert(message, funcBind(scope ? scope : this, callback), closeWindow);
+ addWindow(win);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var findCefPosition = function (rootNode, forward, from) {
- return CaretFinder.fromPosition(forward, rootNode, from).bind(function (to) {
- if (forward && NodeType.isContentEditableFalse(to.getNode())) {
- return deleteEmptyBlockOrMoveToCef(rootNode, forward, from, to);
- } else if (forward === false && NodeType.isContentEditableFalse(to.getNode(true))) {
- return deleteEmptyBlockOrMoveToCef(rootNode, forward, from, to);
- } else if (forward && CaretUtils.isAfterContentEditableFalse(from)) {
- return Option.some(DeleteAction.moveToPosition(to));
- } else if (forward === false && CaretUtils.isBeforeContentEditableFalse(from)) {
- return Option.some(DeleteAction.moveToPosition(to));
- } else {
- return Option.none();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var confirm = function (message, callback, scope) {
+ var win = getImplementation().confirm(message, funcBind(scope ? scope : this, callback), closeWindow);
+ addWindow(win);
+ };
+ var close = function () {
+ getTopWindow().each(function (win) {
+ getImplementation().close(win);
+ closeWindow(win);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getContentEditableBlockAction = function (forward, elm) {
- if (forward && NodeType.isContentEditableFalse(elm.nextSibling)) {
- return Option.some(DeleteAction.moveToElement(elm.nextSibling));
- } else if (forward === false && NodeType.isContentEditableFalse(elm.previousSibling)) {
- return Option.some(DeleteAction.moveToElement(elm.previousSibling));
- } else {
- return Option.none();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getParams = function () {
+ return getTopWindow().map(getImplementation().getParams).getOr(null);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getContentEditableAction = function (rootNode, forward, from) {
- if (isAtContentEditableBlockCaret(forward, from)) {
- return getContentEditableBlockAction(forward, from.getNode(forward === false))
- .fold(
- function () {
- return findCefPosition(rootNode, forward, from);
- },
- Option.some
- );
- } else {
- return findCefPosition(rootNode, forward, from);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setParams = function (params) {
+ getTopWindow().each(function (win) {
+ getImplementation().setParams(win, params);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var read = function (rootNode, forward, rng) {
- var normalizedRange = CaretUtils.normalizeRange(forward ? 1 : -1, rootNode, rng);
- var from = CaretPosition.fromRangeStart(normalizedRange);
-
- if (forward === false && CaretUtils.isAfterContentEditableFalse(from)) {
- return Option.some(DeleteAction.remove(from.getNode(true)));
- } else if (forward && CaretUtils.isBeforeContentEditableFalse(from)) {
- return Option.some(DeleteAction.remove(from.getNode()));
- } else {
- return getContentEditableAction(rootNode, forward, from);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getWindows = function () {
+ return windows;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('remove', function () {
+ $_9ek1bp4jfuw8kxg.each(windows.slice(0), function (win) {
+ getImplementation().close(win);
+ });
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- read: read
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ windows: windows,
+ open: open,
+ alert: alert,
+ confirm: confirm,
+ close: close,
+ getParams: getParams,
+ setParams: setParams,
+ getWindows: getWindows
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * DeleteElement.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.delete.DeleteElement',
- [
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.api.Options',
- 'ephox.sugar.api.dom.Insert',
- 'ephox.sugar.api.dom.Remove',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.node.Node',
- 'ephox.sugar.api.search.PredicateFind',
- 'ephox.sugar.api.search.Traverse',
- 'tinymce.core.caret.CaretCandidate',
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.dom.Empty',
- 'tinymce.core.dom.NodeType'
- ],
- function (Fun, Option, Options, Insert, Remove, Element, Node, PredicateFind, Traverse, CaretCandidate, CaretFinder, CaretPosition, Empty, NodeType) {
- var needsReposition = function (pos, elm) {
- var container = pos.container();
- var offset = pos.offset();
- return CaretPosition.isTextPosition(pos) === false && container === elm.parentNode && offset > CaretPosition.before(elm).offset();
- };
-
- var reposition = function (elm, pos) {
- return needsReposition(pos, elm) ? new CaretPosition(pos.container(), pos.offset() - 1) : pos;
- };
-
- var beforeOrStartOf = function (node) {
- return NodeType.isText(node) ? new CaretPosition(node, 0) : CaretPosition.before(node);
- };
-
- var afterOrEndOf = function (node) {
- return NodeType.isText(node) ? new CaretPosition(node, node.data.length) : CaretPosition.after(node);
- };
-
- var getPreviousSiblingCaretPosition = function (elm) {
- if (CaretCandidate.isCaretCandidate(elm.previousSibling)) {
- return Option.some(afterOrEndOf(elm.previousSibling));
- } else {
- return elm.previousSibling ? CaretFinder.lastPositionIn(elm.previousSibling) : Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var PluginManager = AddOnManager.PluginManager;
+ var resolvePluginName = function (targetUrl, suffix) {
+ for (var name_1 in PluginManager.urls) {
+ var matchUrl = PluginManager.urls[name_1] + '/plugin' + suffix + '.js';
+ if (matchUrl === targetUrl) {
+ return name_1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var getNextSiblingCaretPosition = function (elm) {
- if (CaretCandidate.isCaretCandidate(elm.nextSibling)) {
- return Option.some(beforeOrStartOf(elm.nextSibling));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return null;
+ };
+ var pluginUrlToMessage = function (editor, url) {
+ var plugin = resolvePluginName(url, editor.suffix);
+ return plugin ? 'Failed to load plugin: ' + plugin + ' from url ' + url : 'Failed to load plugin url: ' + url;
+ };
+ var displayNotification = function (editor, message) {
+ editor.notificationManager.open({
+ type: 'error',
+ text: message
+ });
+ };
+ var displayError = function (editor, message) {
+ if (editor._skinLoaded) {
+ displayNotification(editor, message);
+ } else {
+ editor.on('SkinLoaded', function () {
+ displayNotification(editor, message);
+ });
+ }
+ };
+ var uploadError = function (editor, message) {
+ displayError(editor, 'Failed to upload image: ' + message);
+ };
+ var pluginLoadError = function (editor, url) {
+ displayError(editor, pluginUrlToMessage(editor, url));
+ };
+ var initError = function (message) {
+ var x = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ x[_i - 1] = arguments[_i];
+ }
+ var console = window.console;
+ if (console) {
+ if (console.error) {
+ console.error.apply(console, arguments);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return elm.nextSibling ? CaretFinder.firstPositionIn(elm.nextSibling) : Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ console.log.apply(console, arguments);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var $_80cv3b4ijfuw8m1d = {
+ pluginLoadError: pluginLoadError,
+ uploadError: uploadError,
+ displayError: displayError,
+ initError: initError
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var findCaretPositionBackwardsFromElm = function (rootElement, elm) {
- var startPosition = CaretPosition.before(elm.previousSibling ? elm.previousSibling : elm.parentNode);
- return CaretFinder.prevPosition(rootElement, startPosition).fold(
- function () {
- return CaretFinder.nextPosition(rootElement, CaretPosition.after(elm));
- },
- Option.some
- );
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var PluginManager$1 = AddOnManager.PluginManager;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var findCaretPositionForwardsFromElm = function (rootElement, elm) {
- return CaretFinder.nextPosition(rootElement, CaretPosition.after(elm)).fold(
- function () {
- return CaretFinder.prevPosition(rootElement, CaretPosition.before(elm));
- },
- Option.some
- );
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ThemeManager = AddOnManager.ThemeManager;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var findCaretPositionBackwards = function (rootElement, elm) {
- return getPreviousSiblingCaretPosition(elm).orThunk(function () {
- return getNextSiblingCaretPosition(elm);
- }).orThunk(function () {
- return findCaretPositionBackwardsFromElm(rootElement, elm);
- });
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function XMLHttpRequest () {
+ var f = $_3hdbe8cjfuw8l1e.getOrDie('XMLHttpRequest');
+ return new f();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var findCaretPositionForward = function (rootElement, elm) {
- return getNextSiblingCaretPosition(elm).orThunk(function () {
- return getPreviousSiblingCaretPosition(elm);
- }).orThunk(function () {
- return findCaretPositionForwardsFromElm(rootElement, elm);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function Uploader (uploadStatus, settings) {
+ var pendingPromises = {};
+ var pathJoin = function (path1, path2) {
+ if (path1) {
+ return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, '');
+ }
+ return path2;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var findCaretPosition = function (forward, rootElement, elm) {
- return forward ? findCaretPositionForward(rootElement, elm) : findCaretPositionBackwards(rootElement, elm);
- };
-
- var findCaretPosOutsideElmAfterDelete = function (forward, rootElement, elm) {
- return findCaretPosition(forward, rootElement, elm).map(Fun.curry(reposition, elm));
- };
-
- var setSelection = function (editor, forward, pos) {
- pos.fold(
- function () {
- editor.focus();
- },
- function (pos) {
- editor.selection.setRng(pos.toRange(), forward);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var defaultHandler = function (blobInfo, success, failure, progress) {
+ var xhr, formData;
+ xhr = new XMLHttpRequest();
+ xhr.open('POST', settings.url);
+ xhr.withCredentials = settings.credentials;
+ xhr.upload.onprogress = function (e) {
+ progress(e.loaded / e.total * 100);
+ };
+ xhr.onerror = function () {
+ failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);
+ };
+ xhr.onload = function () {
+ var json;
+ if (xhr.status < 200 || xhr.status >= 300) {
+ failure('HTTP Error: ' + xhr.status);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- );
- };
-
- var eqRawNode = function (rawNode) {
- return function (elm) {
- return elm.dom() === rawNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ json = JSON.parse(xhr.responseText);
+ if (!json || typeof json.location !== 'string') {
+ failure('Invalid JSON: ' + xhr.responseText);
+ return;
+ }
+ success(pathJoin(settings.basePath, json.location));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ formData = new FormData();
+ formData.append('file', blobInfo.blob(), blobInfo.filename());
+ xhr.send(formData);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isBlock = function (editor, elm) {
- return elm && editor.schema.getBlockElements().hasOwnProperty(Node.name(elm));
- };
-
- var paddEmptyBlock = function (elm) {
- if (Empty.isEmpty(elm)) {
- var br = Element.fromHtml('<br data-mce-bogus="1">');
- Remove.empty(elm);
- Insert.append(elm, br);
- return Option.some(CaretPosition.before(br.dom()));
- } else {
- return Option.none();
- }
- };
-
- // When deleting an element between two text nodes IE 11 doesn't automatically merge the adjacent text nodes
- var deleteNormalized = function (elm, afterDeletePosOpt) {
- return Options.liftN([Traverse.prevSibling(elm), Traverse.nextSibling(elm), afterDeletePosOpt], function (prev, next, afterDeletePos) {
- var offset, prevNode = prev.dom(), nextNode = next.dom();
-
- if (NodeType.isText(prevNode) && NodeType.isText(nextNode)) {
- offset = prevNode.data.length;
- prevNode.appendData(nextNode.data);
- Remove.remove(next);
- Remove.remove(elm);
- if (afterDeletePos.container() === nextNode) {
- return new CaretPosition(prevNode, offset);
- } else {
- return afterDeletePos;
- }
- } else {
- Remove.remove(elm);
- return afterDeletePos;
- }
- }).orThunk(function () {
- Remove.remove(elm);
- return afterDeletePosOpt;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var noUpload = function () {
+ return new promiseObj(function (resolve) {
+ resolve([]);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var deleteElement = function (editor, forward, elm) {
- var afterDeletePos = findCaretPosOutsideElmAfterDelete(forward, editor.getBody(), elm.dom());
- var parentBlock = PredicateFind.ancestor(elm, Fun.curry(isBlock, editor), eqRawNode(editor.getBody()));
- var normalizedAfterDeletePos = deleteNormalized(elm, afterDeletePos);
-
- parentBlock.bind(paddEmptyBlock).fold(
- function () {
- setSelection(editor, forward, normalizedAfterDeletePos);
- },
- function (paddPos) {
- setSelection(editor, forward, Option.some(paddPos));
- }
- );
- };
-
- return {
- deleteElement: deleteElement
- };
- }
-);
-/**
- * CefDelete.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.delete.CefDelete',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.dom.Remove',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.SelectorFilter',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.delete.CefDeleteAction',
- 'tinymce.core.delete.DeleteElement',
- 'tinymce.core.delete.DeleteUtils',
- 'tinymce.core.dom.NodeType'
- ],
- function (Arr, Remove, Element, SelectorFilter, CaretPosition, CefDeleteAction, DeleteElement, DeleteUtils, NodeType) {
- var deleteElement = function (editor, forward) {
- return function (element) {
- DeleteElement.deleteElement(editor, forward, Element.fromDom(element));
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var handlerSuccess = function (blobInfo, url) {
+ return {
+ url: url,
+ blobInfo: blobInfo,
+ status: true
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var moveToElement = function (editor, forward) {
- return function (element) {
- var pos = forward ? CaretPosition.before(element) : CaretPosition.after(element);
- editor.selection.setRng(pos.toRange());
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var handlerFailure = function (blobInfo, error) {
+ return {
+ url: '',
+ blobInfo: blobInfo,
+ status: false,
+ error: error
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var moveToPosition = function (editor) {
- return function (pos) {
- editor.selection.setRng(pos.toRange());
- return true;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var resolvePending = function (blobUri, result) {
+ $_52qop8kjfuw8l6v.each(pendingPromises[blobUri], function (resolve) {
+ resolve(result);
+ });
+ delete pendingPromises[blobUri];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var backspaceDeleteCaret = function (editor, forward) {
- var result = CefDeleteAction.read(editor.getBody(), forward, editor.selection.getRng()).map(function (deleteAction) {
- return deleteAction.fold(
- deleteElement(editor, forward),
- moveToElement(editor, forward),
- moveToPosition(editor)
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var uploadBlobInfo = function (blobInfo, handler, openNotification) {
+ uploadStatus.markPending(blobInfo.blobUri());
+ return new promiseObj(function (resolve) {
+ var notification, progress;
+ var noop = function () {
+ };
+ try {
+ var closeNotification_1 = function () {
+ if (notification) {
+ notification.close();
+ progress = noop;
+ }
+ };
+ var success = function (url) {
+ closeNotification_1();
+ uploadStatus.markUploaded(blobInfo.blobUri(), url);
+ resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url));
+ resolve(handlerSuccess(blobInfo, url));
+ };
+ var failure = function (error) {
+ closeNotification_1();
+ uploadStatus.removeFailed(blobInfo.blobUri());
+ resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error));
+ resolve(handlerFailure(blobInfo, error));
+ };
+ progress = function (percent) {
+ if (percent < 0 || percent > 100) {
+ return;
+ }
+ if (!notification) {
+ notification = openNotification();
+ }
+ notification.progressBar.value(percent);
+ };
+ handler(blobInfo, success, failure, progress);
+ } catch (ex) {
+ resolve(handlerFailure(blobInfo, ex.message));
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return result.getOr(false);
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var deleteOffscreenSelection = function (rootElement) {
- Arr.each(SelectorFilter.descendants(rootElement, '.mce-offscreen-selection'), Remove.remove);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isDefaultHandler = function (handler) {
+ return handler === defaultHandler;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var backspaceDeleteRange = function (editor, forward) {
- var selectedElement = editor.selection.getNode();
- if (NodeType.isContentEditableFalse(selectedElement)) {
- deleteOffscreenSelection(Element.fromDom(editor.getBody()));
- DeleteElement.deleteElement(editor, forward, Element.fromDom(editor.selection.getNode()));
- DeleteUtils.paddEmptyBody(editor);
- return true;
- } else {
- return false;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var pendingUploadBlobInfo = function (blobInfo) {
+ var blobUri = blobInfo.blobUri();
+ return new promiseObj(function (resolve) {
+ pendingPromises[blobUri] = pendingPromises[blobUri] || [];
+ pendingPromises[blobUri].push(resolve);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getContentEditableRoot = function (root, node) {
- while (node && node !== root) {
- if (NodeType.isContentEditableTrue(node) || NodeType.isContentEditableFalse(node)) {
- return node;
- }
-
- node = node.parentNode;
- }
-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var uploadBlobs = function (blobInfos, openNotification) {
+ blobInfos = $_52qop8kjfuw8l6v.grep(blobInfos, function (blobInfo) {
+ return !uploadStatus.isUploaded(blobInfo.blobUri());
+ });
+ return promiseObj.all($_52qop8kjfuw8l6v.map(blobInfos, function (blobInfo) {
+ return uploadStatus.isPending(blobInfo.blobUri()) ? pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification);
+ }));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var paddEmptyElement = function (editor) {
- var br, ceRoot = getContentEditableRoot(editor.getBody(), editor.selection.getNode());
-
- if (NodeType.isContentEditableTrue(ceRoot) && editor.dom.isBlock(ceRoot) && editor.dom.isEmpty(ceRoot)) {
- br = editor.dom.create('br', { "data-mce-bogus": "1" });
- editor.dom.setHTML(ceRoot, '');
- ceRoot.appendChild(br);
- editor.selection.setRng(CaretPosition.before(br).toRange());
- }
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var upload = function (blobInfos, openNotification) {
+ return !settings.url && isDefaultHandler(settings.handler) ? noUpload() : uploadBlobs(blobInfos, openNotification);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ settings = $_52qop8kjfuw8l6v.extend({
+ credentials: false,
+ handler: defaultHandler
+ }, settings);
+ return { upload: upload };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var backspaceDelete = function (editor, forward) {
- if (editor.selection.isCollapsed()) {
- return backspaceDeleteCaret(editor, forward);
- } else {
- return backspaceDeleteRange(editor, forward);
- }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function Blob (parts, properties) {
+ var f = $_3hdbe8cjfuw8l1e.getOrDie('Blob');
+ return new f(parts, properties);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- backspaceDelete: backspaceDelete,
- paddEmptyElement: paddEmptyElement
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function FileReader () {
+ var f = $_3hdbe8cjfuw8l1e.getOrDie('FileReader');
+ return new f();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * CaretContainerInline.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.caret.CaretContainerInline',
- [
- 'ephox.katamari.api.Fun',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.text.Zwsp'
- ],
- function (Fun, NodeType, Zwsp) {
- var isText = NodeType.isText;
-
- var startsWithCaretContainer = function (node) {
- return isText(node) && node.data[0] === Zwsp.ZWSP;
- };
-
- var endsWithCaretContainer = function (node) {
- return isText(node) && node.data[node.data.length - 1] === Zwsp.ZWSP;
- };
-
- var createZwsp = function (node) {
- return node.ownerDocument.createTextNode(Zwsp.ZWSP);
- };
-
- var insertBefore = function (node) {
- if (isText(node.previousSibling)) {
- if (endsWithCaretContainer(node.previousSibling)) {
- return node.previousSibling;
- } else {
- node.previousSibling.appendData(Zwsp.ZWSP);
- return node.previousSibling;
- }
- } else if (isText(node)) {
- if (startsWithCaretContainer(node)) {
- return node;
- } else {
- node.insertData(0, Zwsp.ZWSP);
- return node;
- }
- } else {
- var newNode = createZwsp(node);
- node.parentNode.insertBefore(newNode, node);
- return newNode;
- }
- };
-
- var insertAfter = function (node) {
- if (isText(node.nextSibling)) {
- if (startsWithCaretContainer(node.nextSibling)) {
- return node.nextSibling;
- } else {
- node.nextSibling.insertData(0, Zwsp.ZWSP);
- return node.nextSibling;
- }
- } else if (isText(node)) {
- if (endsWithCaretContainer(node)) {
- return node;
- } else {
- node.appendData(Zwsp.ZWSP);
- return node;
- }
- } else {
- var newNode = createZwsp(node);
- if (node.nextSibling) {
- node.parentNode.insertBefore(newNode, node.nextSibling);
- } else {
- node.parentNode.appendChild(newNode);
- }
- return newNode;
- }
- };
-
- var insertInline = function (before, node) {
- return before ? insertBefore(node) : insertAfter(node);
- };
-
- return {
- insertInline: insertInline,
- insertInlineBefore: Fun.curry(insertInline, true),
- insertInlineAfter: Fun.curry(insertInline, false)
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function Uint8Array (arr) {
+ var f = $_3hdbe8cjfuw8l1e.getOrDie('Uint8Array');
+ return new f(arr);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-/**
- * CaretContainerRemove.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.caret.CaretContainerRemove',
- [
- 'ephox.katamari.api.Arr',
- 'tinymce.core.caret.CaretContainer',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.text.Zwsp',
- 'tinymce.core.util.Tools'
- ],
- function (Arr, CaretContainer, CaretPosition, NodeType, Zwsp, Tools) {
- var isElement = NodeType.isElement;
- var isText = NodeType.isText;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var requestAnimationFrame$1 = function (callback) {
+ var f = $_3hdbe8cjfuw8l1e.getOrDie('requestAnimationFrame');
+ f(callback);
+ };
+ var atob = function (base64) {
+ var f = $_3hdbe8cjfuw8l1e.getOrDie('atob');
+ return f(base64);
+ };
+ var $_bq13994vjfuw8m39 = {
+ atob: atob,
+ requestAnimationFrame: requestAnimationFrame$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var removeNode = function (node) {
- var parentNode = node.parentNode;
- if (parentNode) {
- parentNode.removeChild(node);
- }
- };
-
- var getNodeValue = function (node) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var blobUriToBlob = function (url) {
+ return new promiseObj(function (resolve, reject) {
+ var rejectWithError = function () {
+ reject('Cannot convert ' + url + ' to Blob. Resource might not exist or is inaccessible.');
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> try {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return node.nodeValue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', url, true);
+ xhr.responseType = 'blob';
+ xhr.onload = function () {
+ if (this.status === 200) {
+ resolve(this.response);
+ } else {
+ rejectWithError();
+ }
+ };
+ xhr.onerror = rejectWithError;
+ xhr.send();
</ins><span class="cx" style="display: block; padding: 0 10px"> } catch (ex) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // IE sometimes produces "Invalid argument" on nodes
- return "";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ rejectWithError();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var parseDataUri = function (uri) {
+ var type, matches;
+ uri = decodeURIComponent(uri).split(',');
+ matches = /data:([^;]+)/.exec(uri[0]);
+ if (matches) {
+ type = matches[1];
+ }
+ return {
+ type: type,
+ data: uri[1]
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var setNodeValue = function (node, text) {
- if (text.length === 0) {
- removeNode(node);
- } else {
- node.nodeValue = text;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var dataUriToBlob = function (uri) {
+ return new promiseObj(function (resolve) {
+ var str, arr, i;
+ uri = parseDataUri(uri);
+ try {
+ str = $_bq13994vjfuw8m39.atob(uri.data);
+ } catch (e) {
+ resolve(new Blob([]));
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ arr = new Uint8Array(str.length);
+ for (i = 0; i < arr.length; i++) {
+ arr[i] = str.charCodeAt(i);
+ }
+ resolve(new Blob([arr], { type: uri.type }));
+ });
+ };
+ var uriToBlob = function (url) {
+ if (url.indexOf('blob:') === 0) {
+ return blobUriToBlob(url);
+ }
+ if (url.indexOf('data:') === 0) {
+ return dataUriToBlob(url);
+ }
+ return null;
+ };
+ var blobToDataUri = function (blob) {
+ return new promiseObj(function (resolve) {
+ var reader = new FileReader();
+ reader.onloadend = function () {
+ resolve(reader.result);
+ };
+ reader.readAsDataURL(blob);
+ });
+ };
+ var $_ar3id44rjfuw8m2o = {
+ uriToBlob: uriToBlob,
+ blobToDataUri: blobToDataUri,
+ parseDataUri: parseDataUri
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var trimCount = function (text) {
- var trimmedText = Zwsp.trim(text);
- return { count: text.length - trimmedText.length, text: trimmedText };
- };
-
- var removeUnchanged = function (caretContainer, pos) {
- remove(caretContainer);
- return pos;
- };
-
- var removeTextAndReposition = function (caretContainer, pos) {
- var before = trimCount(caretContainer.data.substr(0, pos.offset()));
- var after = trimCount(caretContainer.data.substr(pos.offset()));
- var text = before.text + after.text;
-
- if (text.length > 0) {
- setNodeValue(caretContainer, text);
- return new CaretPosition(caretContainer, pos.offset() - before.count);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var count = 0;
+ var uniqueId = function (prefix) {
+ return (prefix || 'blobid') + count++;
+ };
+ var imageToBlobInfo = function (blobCache, img, resolve, reject) {
+ var base64, blobInfo;
+ if (img.src.indexOf('blob:') === 0) {
+ blobInfo = blobCache.getByUri(img.src);
+ if (blobInfo) {
+ resolve({
+ image: img,
+ blobInfo: blobInfo
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return pos;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_ar3id44rjfuw8m2o.uriToBlob(img.src).then(function (blob) {
+ $_ar3id44rjfuw8m2o.blobToDataUri(blob).then(function (dataUri) {
+ base64 = $_ar3id44rjfuw8m2o.parseDataUri(dataUri).data;
+ blobInfo = blobCache.create(uniqueId(), blob, base64);
+ blobCache.add(blobInfo);
+ resolve({
+ image: img,
+ blobInfo: blobInfo
+ });
+ });
+ }, function (err) {
+ reject(err);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var removeElementAndReposition = function (caretContainer, pos) {
- var parentNode = pos.container();
- var newPosition = Arr.indexOf(parentNode.childNodes, caretContainer).map(function (index) {
- return index < pos.offset() ? new CaretPosition(parentNode, pos.offset() - 1) : pos;
- }).getOr(pos);
- remove(caretContainer);
- return newPosition;
- };
-
- var removeTextCaretContainer = function (caretContainer, pos) {
- return pos.container() === caretContainer ? removeTextAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);
- };
-
- var removeElementCaretContainer = function (caretContainer, pos) {
- return pos.container() === caretContainer.parentNode ? removeElementAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);
- };
-
- var removeAndReposition = function (container, pos) {
- return CaretPosition.isTextPosition(pos) ? removeTextCaretContainer(container, pos) : removeElementCaretContainer(container, pos);
- };
-
- var remove = function (caretContainerNode) {
- if (isElement(caretContainerNode) && CaretContainer.isCaretContainer(caretContainerNode)) {
- if (CaretContainer.hasContent(caretContainerNode)) {
- caretContainerNode.removeAttribute('data-mce-caret');
- } else {
- removeNode(caretContainerNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
+ }
+ base64 = $_ar3id44rjfuw8m2o.parseDataUri(img.src).data;
+ blobInfo = blobCache.findFirst(function (cachedBlobInfo) {
+ return cachedBlobInfo.base64() === base64;
+ });
+ if (blobInfo) {
+ resolve({
+ image: img,
+ blobInfo: blobInfo
+ });
+ } else {
+ $_ar3id44rjfuw8m2o.uriToBlob(img.src).then(function (blob) {
+ blobInfo = blobCache.create(uniqueId(), blob, base64);
+ blobCache.add(blobInfo);
+ resolve({
+ image: img,
+ blobInfo: blobInfo
+ });
+ }, function (err) {
+ reject(err);
+ });
+ }
+ };
+ var getAllImages = function (elm) {
+ return elm ? elm.getElementsByTagName('img') : [];
+ };
+ function ImageScanner (uploadStatus, blobCache) {
+ var cachedPromises = {};
+ var findAll = function (elm, predicate) {
+ var images;
+ if (!predicate) {
+ predicate = $_ebfy8j25jfuw8li1.constant(true);
+ }
+ images = $_djuh8tljfuw8l74.filter(getAllImages(elm), function (img) {
+ var src = img.src;
+ if (!$_9fhi43ajfuw8l13.fileApi) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- if (isText(caretContainerNode)) {
- var text = Zwsp.trim(getNodeValue(caretContainerNode));
- setNodeValue(caretContainerNode, text);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (img.hasAttribute('data-mce-bogus')) {
+ return false;
+ }
+ if (img.hasAttribute('data-mce-placeholder')) {
+ return false;
+ }
+ if (!src || src === $_9fhi43ajfuw8l13.transparentSrc) {
+ return false;
+ }
+ if (src.indexOf('blob:') === 0) {
+ return !uploadStatus.isUploaded(src);
+ }
+ if (src.indexOf('data:') === 0) {
+ return predicate(img);
+ }
+ return false;
+ });
+ var promises = $_djuh8tljfuw8l74.map(images, function (img) {
+ if (cachedPromises[img.src]) {
+ return new promiseObj(function (resolve) {
+ cachedPromises[img.src].then(function (imageInfo) {
+ if (typeof imageInfo === 'string') {
+ return imageInfo;
+ }
+ resolve({
+ image: img,
+ blobInfo: imageInfo.blobInfo
+ });
+ });
+ });
+ }
+ var newPromise = new promiseObj(function (resolve, reject) {
+ imageToBlobInfo(blobCache, img, resolve, reject);
+ }).then(function (result) {
+ delete cachedPromises[result.image.src];
+ return result;
+ }).catch(function (error) {
+ delete cachedPromises[img.src];
+ return error;
+ });
+ cachedPromises[img.src] = newPromise;
+ return newPromise;
+ });
+ return promiseObj.all(promises);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- removeAndReposition: removeAndReposition,
- remove: remove
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return { findAll: findAll };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-/**
- * DefaultSettings.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.EditorSettings',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Obj',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.api.Strings',
- 'ephox.katamari.api.Struct',
- 'ephox.katamari.api.Type',
- 'ephox.sand.api.PlatformDetection',
- 'tinymce.core.util.Tools'
- ],
- function (Arr, Fun, Obj, Option, Strings, Struct, Type, PlatformDetection, Tools) {
- var sectionResult = Struct.immutable('sections', 'settings');
- var detection = PlatformDetection.detect();
- var isTouch = detection.deviceType.isTouch();
- var mobilePlugins = [ 'lists', 'autolink', 'autosave' ];
-
- var normalizePlugins = function (plugins) {
- return Type.isArray(plugins) ? plugins.join(' ') : plugins;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var count$1 = 0;
+ var seed = function () {
+ var rnd = function () {
+ return Math.round(Math.random() * 4294967295).toString(36);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var now = new Date().getTime();
+ return 's' + now.toString(36) + rnd() + rnd() + rnd();
+ };
+ var uuid = function (prefix) {
+ return prefix + count$1++ + seed();
+ };
+ var $_cbl0d24xjfuw8m3f = { uuid: uuid };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var filterMobilePlugins = function (plugins) {
- var trimmedPlugins = Arr.map(normalizePlugins(plugins).split(' '), Strings.trim);
- return Arr.filter(trimmedPlugins, Fun.curry(Arr.contains, mobilePlugins)).join(' ');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function BlobCache () {
+ var cache = [];
+ var constant = $_ebfy8j25jfuw8li1.constant;
+ var mimeToExt = function (mime) {
+ var mimes = {
+ 'image/jpeg': 'jpg',
+ 'image/jpg': 'jpg',
+ 'image/gif': 'gif',
+ 'image/png': 'png'
+ };
+ return mimes[mime.toLowerCase()] || 'dat';
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var extractSections = function (keys, settings) {
- var result = Obj.bifilter(settings, function (value, key) {
- return Arr.contains(keys, key);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var create = function (o, blob, base64, filename) {
+ return typeof o === 'object' ? toBlobInfo(o) : toBlobInfo({
+ id: o,
+ name: filename,
+ blob: blob,
+ base64: base64
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return sectionResult(result.t, result.f);
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getSection = function (sectionResult, name) {
- var sections = sectionResult.sections();
- return sections.hasOwnProperty(name) ? sections[name] : { };
- };
-
- var hasSection = function (sectionResult, name) {
- return sectionResult.sections().hasOwnProperty(name);
- };
-
- var getDefaultSettings = function (id, documentBaseUrl, editor) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toBlobInfo = function (o) {
+ var id, name;
+ if (!o.blob || !o.base64) {
+ throw new Error('blob and base64 representations of the image are required for BlobInfo to be created');
+ }
+ id = o.id || $_cbl0d24xjfuw8m3f.uuid('blobid');
+ name = o.name || id;
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- id: id,
- theme: 'modern',
- delta_width: 0,
- delta_height: 0,
- popup_css: '',
- plugins: '',
- document_base_url: documentBaseUrl,
- add_form_submit_trigger: true,
- submit_patch: true,
- add_unload_trigger: true,
- convert_urls: true,
- relative_urls: true,
- remove_script_host: true,
- object_resizing: true,
- doctype: '<!DOCTYPE html>',
- visual: true,
- font_size_style_values: 'xx-small,x-small,small,medium,large,x-large,xx-large',
-
- // See: http://www.w3.org/TR/CSS2/fonts.html#propdef-font-size
- font_size_legacy_values: 'xx-small,small,medium,large,x-large,xx-large,300%',
- forced_root_block: 'p',
- hidden_input: true,
- padd_empty_editor: true,
- render_ui: true,
- indentation: '30px',
- inline_styles: true,
- convert_fonts_to_spans: true,
- indent: 'simple',
- indent_before: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' +
- 'tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist',
- indent_after: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' +
- 'tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist',
- entity_encoding: 'named',
- url_converter: editor.convertURL,
- url_converter_scope: editor,
- ie7_compat: true
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ id: constant(id),
+ name: constant(name),
+ filename: constant(name + '.' + mimeToExt(o.blob.type)),
+ blob: constant(o.blob),
+ base64: constant(o.base64),
+ blobUri: constant(o.blobUri || $_b6ehwsbjfuw8l1c.createObjectURL(o.blob)),
+ uri: constant(o.uri)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getExternalPlugins = function (overrideSettings, settings) {
- var userDefinedExternalPlugins = settings.external_plugins ? settings.external_plugins : { };
-
- if (overrideSettings && overrideSettings.external_plugins) {
- return Tools.extend({}, overrideSettings.external_plugins, userDefinedExternalPlugins);
- } else {
- return userDefinedExternalPlugins;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var add = function (blobInfo) {
+ if (!get(blobInfo.id())) {
+ cache.push(blobInfo);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var combineSettings = function (defaultSettings, defaultOverrideSettings, settings) {
- var sectionResult = extractSections(['mobile'], settings);
- var plugins = sectionResult.settings().plugins;
-
- var extendedSettings = Tools.extend(
- // Default settings
- defaultSettings,
-
- // tinymce.overrideDefaults settings
- defaultOverrideSettings,
-
- // User settings
- sectionResult.settings(),
-
- // Sections
- isTouch ? getSection(sectionResult, 'mobile') : { },
-
- // Forced settings
- {
- validate: true,
- content_editable: sectionResult.settings().inline,
- external_plugins: getExternalPlugins(defaultOverrideSettings, sectionResult.settings())
- },
-
- // TODO: Remove this once we fix each plugin with a mobile version
- isTouch && plugins && hasSection(sectionResult, 'mobile') ? { plugins: filterMobilePlugins(plugins) } : { }
- );
-
- return extendedSettings;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get = function (id) {
+ return findFirst(function (cachedBlobInfo) {
+ return cachedBlobInfo.id() === id;
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getEditorSettings = function (editor, id, documentBaseUrl, defaultOverrideSettings, settings) {
- var defaultSettings = getDefaultSettings(id, documentBaseUrl, editor);
- return combineSettings(defaultSettings, defaultOverrideSettings, settings);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var findFirst = function (predicate) {
+ return $_djuh8tljfuw8l74.filter(cache, predicate)[0];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var get = function (editor, name) {
- return Option.from(editor.settings[name]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getByUri = function (blobUri) {
+ return findFirst(function (blobInfo) {
+ return blobInfo.blobUri() === blobUri;
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getFiltered = function (predicate, editor, name) {
- return Option.from(editor.settings[name]).filter(predicate);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var removeByUri = function (blobUri) {
+ cache = $_djuh8tljfuw8l74.filter(cache, function (blobInfo) {
+ if (blobInfo.blobUri() === blobUri) {
+ $_b6ehwsbjfuw8l1c.revokeObjectURL(blobInfo.blobUri());
+ return false;
+ }
+ return true;
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var destroy = function () {
+ $_djuh8tljfuw8l74.each(cache, function (cachedBlobInfo) {
+ $_b6ehwsbjfuw8l1c.revokeObjectURL(cachedBlobInfo.blobUri());
+ });
+ cache = [];
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- getEditorSettings: getEditorSettings,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ create: create,
+ add: add,
</ins><span class="cx" style="display: block; padding: 0 10px"> get: get,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- getString: Fun.curry(getFiltered, Type.isString),
-
- // TODO: Remove this once we have proper mobile plugins
- filterMobilePlugins: filterMobilePlugins
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ getByUri: getByUri,
+ findFirst: findFirst,
+ removeByUri: removeByUri,
+ destroy: destroy
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Bidi.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.text.Bidi',
- [
- ],
- function () {
- var strongRtl = /[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/;
-
- var hasStrongRtl = function (text) {
- return strongRtl.test(text);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function UploadStatus () {
+ var PENDING = 1, UPLOADED = 2;
+ var blobUriStatuses = {};
+ var createStatus = function (status, resultUri) {
+ return {
+ status: status,
+ resultUri: resultUri
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- hasStrongRtl: hasStrongRtl
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasBlobUri = function (blobUri) {
+ return blobUri in blobUriStatuses;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * InlineUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.InlineUtils',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.api.Options',
- 'ephox.katamari.api.Type',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.Selectors',
- 'tinymce.core.caret.CaretContainer',
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.caret.CaretUtils',
- 'tinymce.core.caret.CaretWalker',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.EditorSettings',
- 'tinymce.core.text.Bidi'
- ],
- function (
- Arr, Fun, Option, Options, Type, Element, Selectors, CaretContainer, CaretFinder, CaretPosition, CaretUtils, CaretWalker, DOMUtils, NodeType, EditorSettings,
- Bidi
- ) {
- var isInlineTarget = function (editor, elm) {
- var selector = EditorSettings.getString(editor, 'inline_boundaries_selector').getOr('a[href],code');
- return Selectors.is(Element.fromDom(elm), selector);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getResultUri = function (blobUri) {
+ var result = blobUriStatuses[blobUri];
+ return result ? result.resultUri : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isRtl = function (element) {
- return DOMUtils.DOM.getStyle(element, 'direction', true) === 'rtl' || Bidi.hasStrongRtl(element.textContent);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isPending = function (blobUri) {
+ return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === PENDING : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var findInlineParents = function (isInlineTarget, rootNode, pos) {
- return Arr.filter(DOMUtils.DOM.getParents(pos.container(), '*', rootNode), isInlineTarget);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isUploaded = function (blobUri) {
+ return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === UPLOADED : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var findRootInline = function (isInlineTarget, rootNode, pos) {
- var parents = findInlineParents(isInlineTarget, rootNode, pos);
- return Option.from(parents[parents.length - 1]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var markPending = function (blobUri) {
+ blobUriStatuses[blobUri] = createStatus(PENDING, null);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var hasSameParentBlock = function (rootNode, node1, node2) {
- var block1 = CaretUtils.getParentBlock(node1, rootNode);
- var block2 = CaretUtils.getParentBlock(node2, rootNode);
- return block1 && block1 === block2;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var markUploaded = function (blobUri, resultUri) {
+ blobUriStatuses[blobUri] = createStatus(UPLOADED, resultUri);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isAtZwsp = function (pos) {
- return CaretContainer.isBeforeInline(pos) || CaretContainer.isAfterInline(pos);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var removeFailed = function (blobUri) {
+ delete blobUriStatuses[blobUri];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var normalizePosition = function (forward, pos) {
- var container = pos.container(), offset = pos.offset();
-
- if (forward) {
- if (CaretContainer.isCaretContainerInline(container)) {
- if (NodeType.isText(container.nextSibling)) {
- return new CaretPosition(container.nextSibling, 0);
- } else {
- return CaretPosition.after(container);
- }
- } else {
- return CaretContainer.isBeforeInline(pos) ? new CaretPosition(container, offset + 1) : pos;
- }
- } else {
- if (CaretContainer.isCaretContainerInline(container)) {
- if (NodeType.isText(container.previousSibling)) {
- return new CaretPosition(container.previousSibling, container.previousSibling.data.length);
- } else {
- return CaretPosition.before(container);
- }
- } else {
- return CaretContainer.isAfterInline(pos) ? new CaretPosition(container, offset - 1) : pos;
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var destroy = function () {
+ blobUriStatuses = {};
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var normalizeForwards = Fun.curry(normalizePosition, true);
- var normalizeBackwards = Fun.curry(normalizePosition, false);
-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- isInlineTarget: isInlineTarget,
- findRootInline: findRootInline,
- isRtl: isRtl,
- isAtZwsp: isAtZwsp,
- normalizePosition: normalizePosition,
- normalizeForwards: normalizeForwards,
- normalizeBackwards: normalizeBackwards,
- hasSameParentBlock: hasSameParentBlock
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ hasBlobUri: hasBlobUri,
+ getResultUri: getResultUri,
+ isPending: isPending,
+ isUploaded: isUploaded,
+ markPending: markPending,
+ markUploaded: markUploaded,
+ removeFailed: removeFailed,
+ destroy: destroy
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-/**
- * BoundaryCaret.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.keyboard.BoundaryCaret',
- [
- 'ephox.katamari.api.Option',
- 'tinymce.core.caret.CaretContainer',
- 'tinymce.core.caret.CaretContainerInline',
- 'tinymce.core.caret.CaretContainerRemove',
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.keyboard.InlineUtils'
- ],
- function (Option, CaretContainer, CaretContainerInline, CaretContainerRemove, CaretFinder, CaretPosition, NodeType, InlineUtils) {
- var insertInlinePos = function (pos, before) {
- if (NodeType.isText(pos.container())) {
- return CaretContainerInline.insertInline(before, pos.container());
- } else {
- return CaretContainerInline.insertInline(before, pos.getNode());
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function EditorUpload (editor) {
+ var blobCache = BlobCache();
+ var uploader, imageScanner;
+ var settings = editor.settings;
+ var uploadStatus = UploadStatus();
+ var aliveGuard = function (callback) {
+ return function (result) {
+ if (editor.selection) {
+ return callback(result);
+ }
+ return [];
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isPosCaretContainer = function (pos, caret) {
- var caretNode = caret.get();
- return caretNode && pos.container() === caretNode && CaretContainer.isCaretContainerInline(caretNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var cacheInvalidator = function () {
+ return '?' + new Date().getTime();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var renderCaret = function (caret, location) {
- return location.fold(
- function (element) { // Before
- CaretContainerRemove.remove(caret.get());
- var text = CaretContainerInline.insertInlineBefore(element);
- caret.set(text);
- return Option.some(new CaretPosition(text, text.length - 1));
- },
- function (element) { // Start
- return CaretFinder.firstPositionIn(element).map(function (pos) {
- if (!isPosCaretContainer(pos, caret)) {
- CaretContainerRemove.remove(caret.get());
- var text = insertInlinePos(pos, true);
- caret.set(text);
- return new CaretPosition(text, 1);
- } else {
- return new CaretPosition(caret.get(), 1);
- }
- });
- },
- function (element) { // End
- return CaretFinder.lastPositionIn(element).map(function (pos) {
- if (!isPosCaretContainer(pos, caret)) {
- CaretContainerRemove.remove(caret.get());
- var text = insertInlinePos(pos, false);
- caret.set(text);
- return new CaretPosition(text, text.length - 1);
- } else {
- return new CaretPosition(caret.get(), caret.get().length - 1);
- }
- });
- },
- function (element) { // After
- CaretContainerRemove.remove(caret.get());
- var text = CaretContainerInline.insertInlineAfter(element);
- caret.set(text);
- return Option.some(new CaretPosition(text, 1));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var replaceString = function (content, search, replace) {
+ var index = 0;
+ do {
+ index = content.indexOf(search, index);
+ if (index !== -1) {
+ content = content.substring(0, index) + replace + content.substr(index + search.length);
+ index += replace.length - search.length + 1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } while (index !== -1);
+ return content;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- renderCaret: renderCaret
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var replaceImageUrl = function (content, targetUrl, replacementUrl) {
+ content = replaceString(content, 'src="' + targetUrl + '"', 'src="' + replacementUrl + '"');
+ content = replaceString(content, 'data-mce-src="' + targetUrl + '"', 'data-mce-src="' + replacementUrl + '"');
+ return content;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * LazyEvaluator.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.LazyEvaluator',
- [
- 'ephox.katamari.api.Option'
- ],
- function (Option) {
- var evaluateUntil = function (fns, args) {
- for (var i = 0; i < fns.length; i++) {
- var result = fns[i].apply(null, args);
- if (result.isSome()) {
- return result;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var replaceUrlInUndoStack = function (targetUrl, replacementUrl) {
+ $_djuh8tljfuw8l74.each(editor.undoManager.data, function (level) {
+ if (level.type === 'fragmented') {
+ level.fragments = $_djuh8tljfuw8l74.map(level.fragments, function (fragment) {
+ return replaceImageUrl(fragment, targetUrl, replacementUrl);
+ });
+ } else {
+ level.content = replaceImageUrl(level.content, targetUrl, replacementUrl);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- return Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- evaluateUntil: evaluateUntil
- };
- }
-);
-/**
- * BoundaryLocation.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.BoundaryLocation',
- [
- 'ephox.katamari.api.Adt',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.api.Options',
- 'tinymce.core.caret.CaretContainer',
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.caret.CaretUtils',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.keyboard.InlineUtils',
- 'tinymce.core.util.LazyEvaluator'
- ],
- function (Adt, Fun, Option, Options, CaretContainer, CaretFinder, CaretPosition, CaretUtils, NodeType, InlineUtils, LazyEvaluator) {
- var Location = Adt.generate([
- { before: [ 'element' ] },
- { start: [ 'element' ] },
- { end: [ 'element' ] },
- { after: [ 'element' ] }
- ]);
-
- var rescope = function (rootNode, node) {
- var parentBlock = CaretUtils.getParentBlock(node, rootNode);
- return parentBlock ? parentBlock : rootNode;
- };
-
- var before = function (isInlineTarget, rootNode, pos) {
- var nPos = InlineUtils.normalizeForwards(pos);
- var scope = rescope(rootNode, nPos.container());
- return InlineUtils.findRootInline(isInlineTarget, scope, nPos).fold(
- function () {
- return CaretFinder.nextPosition(scope, nPos)
- .bind(Fun.curry(InlineUtils.findRootInline, isInlineTarget, scope))
- .map(function (inline) {
- return Location.before(inline);
- });
- },
- Option.none
- );
- };
-
- var start = function (isInlineTarget, rootNode, pos) {
- var nPos = InlineUtils.normalizeBackwards(pos);
- return InlineUtils.findRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) {
- var prevPos = CaretFinder.prevPosition(inline, nPos);
- return prevPos.isNone() ? Option.some(Location.start(inline)) : Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var openNotification = function () {
+ return editor.notificationManager.open({
+ text: editor.translate('Image uploading...'),
+ type: 'info',
+ timeout: -1,
+ progressBar: true
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var end = function (isInlineTarget, rootNode, pos) {
- var nPos = InlineUtils.normalizeForwards(pos);
- return InlineUtils.findRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) {
- var nextPos = CaretFinder.nextPosition(inline, nPos);
- return nextPos.isNone() ? Option.some(Location.end(inline)) : Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var replaceImageUri = function (image, resultUri) {
+ blobCache.removeByUri(image.src);
+ replaceUrlInUndoStack(image.src, resultUri);
+ editor.$(image).attr({
+ 'src': settings.images_reuse_filename ? resultUri + cacheInvalidator() : resultUri,
+ 'data-mce-src': editor.convertURL(resultUri, 'src')
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var after = function (isInlineTarget, rootNode, pos) {
- var nPos = InlineUtils.normalizeBackwards(pos);
- var scope = rescope(rootNode, nPos.container());
- return InlineUtils.findRootInline(isInlineTarget, scope, nPos).fold(
- function () {
- return CaretFinder.prevPosition(scope, nPos)
- .bind(Fun.curry(InlineUtils.findRootInline, isInlineTarget, scope))
- .map(function (inline) {
- return Location.after(inline);
- });
- },
- Option.none
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var uploadImages = function (callback) {
+ if (!uploader) {
+ uploader = Uploader(uploadStatus, {
+ url: settings.images_upload_url,
+ basePath: settings.images_upload_base_path,
+ credentials: settings.images_upload_credentials,
+ handler: settings.images_upload_handler
+ });
+ }
+ return scanForImages().then(aliveGuard(function (imageInfos) {
+ var blobInfos;
+ blobInfos = $_djuh8tljfuw8l74.map(imageInfos, function (imageInfo) {
+ return imageInfo.blobInfo;
+ });
+ return uploader.upload(blobInfos, openNotification).then(aliveGuard(function (result) {
+ var filteredResult = $_djuh8tljfuw8l74.map(result, function (uploadInfo, index) {
+ var image = imageInfos[index].image;
+ if (uploadInfo.status && editor.settings.images_replace_blob_uris !== false) {
+ replaceImageUri(image, uploadInfo.url);
+ } else if (uploadInfo.error) {
+ $_80cv3b4ijfuw8m1d.uploadError(editor, uploadInfo.error);
+ }
+ return {
+ element: image,
+ status: uploadInfo.status
+ };
+ });
+ if (callback) {
+ callback(filteredResult);
+ }
+ return filteredResult;
+ }));
+ }));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isValidLocation = function (location) {
- return InlineUtils.isRtl(getElement(location)) === false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var uploadImagesAuto = function (callback) {
+ if (settings.automatic_uploads !== false) {
+ return uploadImages(callback);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var readLocation = function (isInlineTarget, rootNode, pos) {
- var location = LazyEvaluator.evaluateUntil([
- before,
- start,
- end,
- after
- ], [isInlineTarget, rootNode, pos]);
-
- return location.filter(isValidLocation);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isValidDataUriImage = function (imgElm) {
+ return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getElement = function (location) {
- return location.fold(
- Fun.identity, // Before
- Fun.identity, // Start
- Fun.identity, // End
- Fun.identity // After
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var scanForImages = function () {
+ if (!imageScanner) {
+ imageScanner = ImageScanner(uploadStatus, blobCache);
+ }
+ return imageScanner.findAll(editor.getBody(), isValidDataUriImage).then(aliveGuard(function (result) {
+ result = $_djuh8tljfuw8l74.filter(result, function (resultItem) {
+ if (typeof resultItem === 'string') {
+ $_80cv3b4ijfuw8m1d.displayError(editor, resultItem);
+ return false;
+ }
+ return true;
+ });
+ $_djuh8tljfuw8l74.each(result, function (resultItem) {
+ replaceUrlInUndoStack(resultItem.image.src, resultItem.blobInfo.blobUri());
+ resultItem.image.src = resultItem.blobInfo.blobUri();
+ resultItem.image.removeAttribute('data-mce-src');
+ });
+ return result;
+ }));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getName = function (location) {
- return location.fold(
- Fun.constant('before'), // Before
- Fun.constant('start'), // Start
- Fun.constant('end'), // End
- Fun.constant('after') // After
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var destroy = function () {
+ blobCache.destroy();
+ uploadStatus.destroy();
+ imageScanner = uploader = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var outside = function (location) {
- return location.fold(
- Location.before, // Before
- Location.before, // Start
- Location.after, // End
- Location.after // After
- );
- };
-
- var inside = function (location) {
- return location.fold(
- Location.start, // Before
- Location.start, // Start
- Location.end, // End
- Location.end // After
- );
- };
-
- var isEq = function (location1, location2) {
- return getName(location1) === getName(location2) && getElement(location1) === getElement(location2);
- };
-
- var betweenInlines = function (forward, isInlineTarget, rootNode, from, to, location) {
- return Options.liftN([
- InlineUtils.findRootInline(isInlineTarget, rootNode, from),
- InlineUtils.findRootInline(isInlineTarget, rootNode, to)
- ], function (fromInline, toInline) {
- if (fromInline !== toInline && InlineUtils.hasSameParentBlock(rootNode, fromInline, toInline)) {
- // Force after since some browsers normalize and lean left into the closest inline
- return Location.after(forward ? fromInline : toInline);
- } else {
- return location;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var replaceBlobUris = function (content) {
+ return content.replace(/src="(blob:[^"]+)"/g, function (match, blobUri) {
+ var resultUri = uploadStatus.getResultUri(blobUri);
+ if (resultUri) {
+ return 'src="' + resultUri + '"';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }).getOr(location);
- };
-
- var skipNoMovement = function (fromLocation, toLocation) {
- return fromLocation.fold(
- Fun.constant(true),
- function (fromLocation) {
- return !isEq(fromLocation, toLocation);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var blobInfo = blobCache.getByUri(blobUri);
+ if (!blobInfo) {
+ blobInfo = $_djuh8tljfuw8l74.reduce(editor.editorManager.get(), function (result, editor) {
+ return result || editor.editorUpload && editor.editorUpload.blobCache.getByUri(blobUri);
+ }, null);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- );
- };
-
- var findLocationTraverse = function (forward, isInlineTarget, rootNode, fromLocation, pos) {
- var from = InlineUtils.normalizePosition(forward, pos);
- var to = CaretFinder.fromPosition(forward, rootNode, from).map(Fun.curry(InlineUtils.normalizePosition, forward));
-
- var location = to.fold(
- function () {
- return fromLocation.map(outside);
- },
- function (to) {
- return readLocation(isInlineTarget, rootNode, to)
- .map(Fun.curry(betweenInlines, forward, isInlineTarget, rootNode, from, to))
- .filter(Fun.curry(skipNoMovement, fromLocation));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (blobInfo) {
+ return 'src="data:' + blobInfo.blob().type + ';base64,' + blobInfo.base64() + '"';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- );
-
- return location.filter(isValidLocation);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return match;
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var findLocationSimple = function (forward, location) {
- if (forward) {
- return location.fold(
- Fun.compose(Option.some, Location.start), // Before -> Start
- Option.none,
- Fun.compose(Option.some, Location.after), // End -> After
- Option.none
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('setContent', function () {
+ if (editor.settings.automatic_uploads !== false) {
+ uploadImagesAuto();
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return location.fold(
- Option.none,
- Fun.compose(Option.some, Location.before), // Before <- Start
- Option.none,
- Fun.compose(Option.some, Location.end) // End <- After
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ scanForImages();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var findLocation = function (forward, isInlineTarget, rootNode, pos) {
- var from = InlineUtils.normalizePosition(forward, pos);
- var fromLocation = readLocation(isInlineTarget, rootNode, from);
-
- return readLocation(isInlineTarget, rootNode, from).bind(Fun.curry(findLocationSimple, forward)).orThunk(function () {
- return findLocationTraverse(forward, isInlineTarget, rootNode, fromLocation, pos);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('RawSaveContent', function (e) {
+ e.content = replaceBlobUris(e.content);
+ });
+ editor.on('getContent', function (e) {
+ if (e.source_view || e.format === 'raw') {
+ return;
+ }
+ e.content = replaceBlobUris(e.content);
+ });
+ editor.on('PostRender', function () {
+ editor.parser.addNodeFilter('img', function (images) {
+ $_djuh8tljfuw8l74.each(images, function (img) {
+ var src = img.attr('src');
+ if (blobCache.getByUri(src)) {
+ return;
+ }
+ var resultUri = uploadStatus.getResultUri(src);
+ if (resultUri) {
+ img.attr('src', resultUri);
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- readLocation: readLocation,
- findLocation: findLocation,
- prevLocation: Fun.curry(findLocation, false),
- nextLocation: Fun.curry(findLocation, true),
- getElement: getElement,
- outside: outside,
- inside: inside
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ blobCache: blobCache,
+ uploadImages: uploadImages,
+ uploadImagesAuto: uploadImagesAuto,
+ scanForImages: scanForImages,
+ destroy: destroy
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-/**
- * BoundarySelection.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.keyboard.BoundarySelection',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Cell',
- 'ephox.katamari.api.Fun',
- 'tinymce.core.caret.CaretContainerRemove',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.keyboard.BoundaryCaret',
- 'tinymce.core.keyboard.BoundaryLocation',
- 'tinymce.core.keyboard.InlineUtils'
- ],
- function (Arr, Cell, Fun, CaretContainerRemove, CaretPosition, BoundaryCaret, BoundaryLocation, InlineUtils) {
- var setCaretPosition = function (editor, pos) {
- var rng = editor.dom.createRng();
- rng.setStart(pos.container(), pos.offset());
- rng.setEnd(pos.container(), pos.offset());
- editor.selection.setRng(rng);
- };
-
- var isFeatureEnabled = function (editor) {
- return editor.settings.inline_boundaries !== false;
- };
-
- var setSelected = function (state, elm) {
- if (state) {
- elm.setAttribute('data-mce-selected', '1');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isBlockElement = function (blockElements, node) {
+ return blockElements.hasOwnProperty(node.nodeName);
+ };
+ var isValidTarget = function (blockElements, node) {
+ if ($_ey7ka11qjfuw8ldg.isText(node)) {
+ return true;
+ } else if ($_ey7ka11qjfuw8ldg.isElement(node)) {
+ return !isBlockElement(blockElements, node) && !$_disscn2njfuw8ll3.isBookmarkNode(node);
+ } else {
+ return false;
+ }
+ };
+ var hasBlockParent = function (blockElements, root, node) {
+ return $_9ek1bp4jfuw8kxg.exists($_3t5pi43ejfuw8lq0.parents($_c9h6qlzjfuw8l98.fromDom(node), $_c9h6qlzjfuw8l98.fromDom(root)), function (elm) {
+ return isBlockElement(blockElements, elm.dom());
+ });
+ };
+ var shouldRemoveTextNode = function (blockElements, node) {
+ if ($_ey7ka11qjfuw8ldg.isText(node)) {
+ if (node.nodeValue.length === 0) {
+ return true;
+ } else if (/^\s+$/.test(node.nodeValue) && (!node.nextSibling || isBlockElement(blockElements, node.nextSibling))) {
+ return true;
+ }
+ }
+ return false;
+ };
+ var addRootBlocks = function (editor) {
+ var settings = editor.settings, dom = editor.dom, selection = editor.selection;
+ var schema = editor.schema, blockElements = schema.getBlockElements();
+ var node = selection.getStart();
+ var rootNode = editor.getBody();
+ var rng;
+ var startContainer, startOffset, endContainer, endOffset, rootBlockNode;
+ var tempNode, wrapped, restoreSelection;
+ var rootNodeName, forcedRootBlock;
+ forcedRootBlock = settings.forced_root_block;
+ if (!node || !$_ey7ka11qjfuw8ldg.isElement(node) || !forcedRootBlock) {
+ return;
+ }
+ rootNodeName = rootNode.nodeName.toLowerCase();
+ if (!schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase()) || hasBlockParent(blockElements, rootNode, node)) {
+ return;
+ }
+ rng = selection.getRng();
+ startContainer = rng.startContainer;
+ startOffset = rng.startOffset;
+ endContainer = rng.endContainer;
+ endOffset = rng.endOffset;
+ restoreSelection = $_18lipa49jfuw8lzt.hasFocus(editor);
+ node = rootNode.firstChild;
+ while (node) {
+ if (isValidTarget(blockElements, node)) {
+ if (shouldRemoveTextNode(blockElements, node)) {
+ tempNode = node;
+ node = node.nextSibling;
+ dom.remove(tempNode);
+ continue;
+ }
+ if (!rootBlockNode) {
+ rootBlockNode = dom.create(forcedRootBlock, editor.settings.forced_root_block_attrs);
+ node.parentNode.insertBefore(rootBlockNode, node);
+ wrapped = true;
+ }
+ tempNode = node;
+ node = node.nextSibling;
+ rootBlockNode.appendChild(tempNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- elm.removeAttribute('data-mce-selected', '1');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ rootBlockNode = null;
+ node = node.nextSibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (wrapped && restoreSelection) {
+ rng.setStart(startContainer, startOffset);
+ rng.setEnd(endContainer, endOffset);
+ selection.setRng(rng);
+ editor.nodeChanged();
+ }
+ };
+ var setup = function (editor) {
+ if (editor.settings.forced_root_block) {
+ editor.on('NodeChange', $_68e81l6jfuw8kyc.curry(addRootBlocks, editor));
+ }
+ };
+ var $_1x8v3o4zjfuw8m3j = { setup: setup };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var renderCaretLocation = function (editor, caret, location) {
- return BoundaryCaret.renderCaret(caret, location).map(function (pos) {
- setCaretPosition(editor, pos);
- return location;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function NodeChange (editor) {
+ var lastRng, lastPath = [];
+ var isSameElementPath = function (startElm) {
+ var i, currentPath;
+ currentPath = editor.$(startElm).parentsUntil(editor.getBody()).add(startElm);
+ if (currentPath.length === lastPath.length) {
+ for (i = currentPath.length; i >= 0; i--) {
+ if (currentPath[i] !== lastPath[i]) {
+ break;
+ }
+ }
+ if (i === -1) {
+ lastPath = currentPath;
+ return true;
+ }
+ }
+ lastPath = currentPath;
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var findLocation = function (editor, caret, forward) {
- var rootNode = editor.getBody();
- var from = CaretPosition.fromRangeStart(editor.selection.getRng());
- var isInlineTarget = Fun.curry(InlineUtils.isInlineTarget, editor);
- var location = BoundaryLocation.findLocation(forward, isInlineTarget, rootNode, from);
- return location.bind(function (location) {
- return renderCaretLocation(editor, caret, location);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!('onselectionchange' in editor.getDoc())) {
+ editor.on('NodeChange Click MouseUp KeyUp Focus', function (e) {
+ var nativeRng, fakeRng;
+ nativeRng = editor.selection.getRng();
+ fakeRng = {
+ startContainer: nativeRng.startContainer,
+ startOffset: nativeRng.startOffset,
+ endContainer: nativeRng.endContainer,
+ endOffset: nativeRng.endOffset
+ };
+ if (e.type === 'nodechange' || !$_87lezn3zjfuw8ly9.isEq(fakeRng, lastRng)) {
+ editor.fire('SelectionChange');
+ }
+ lastRng = fakeRng;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var toggleInlines = function (isInlineTarget, dom, elms) {
- var selectedInlines = Arr.filter(dom.select('*[data-mce-selected]'), isInlineTarget);
- var targetInlines = Arr.filter(elms, isInlineTarget);
- Arr.each(Arr.difference(selectedInlines, targetInlines), Fun.curry(setSelected, false));
- Arr.each(Arr.difference(targetInlines, selectedInlines), Fun.curry(setSelected, true));
- };
-
- var safeRemoveCaretContainer = function (editor, caret) {
- if (editor.selection.isCollapsed() && editor.composing !== true && caret.get()) {
- var pos = CaretPosition.fromRangeStart(editor.selection.getRng());
- if (CaretPosition.isTextPosition(pos) && InlineUtils.isAtZwsp(pos) === false) {
- setCaretPosition(editor, CaretContainerRemove.removeAndReposition(caret.get(), pos));
- caret.set(null);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ editor.on('contextmenu', function () {
+ editor.fire('SelectionChange');
+ });
+ editor.on('SelectionChange', function () {
+ var startElm = editor.selection.getStart(true);
+ if (!startElm || !$_9fhi43ajfuw8l13.range && editor.selection.isCollapsed()) {
+ return;
+ }
+ if (!isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) {
+ editor.nodeChanged({ selectionChange: true });
+ }
+ });
+ editor.on('MouseUp', function (e) {
+ if (!e.isDefaultPrevented()) {
+ if (editor.selection.getNode().nodeName === 'IMG') {
+ $_2m8wq9hjfuw8l41.setEditorTimeout(editor, function () {
+ editor.nodeChanged();
+ });
+ } else {
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var renderInsideInlineCaret = function (isInlineTarget, editor, caret, elms) {
- if (editor.selection.isCollapsed()) {
- var inlines = Arr.filter(elms, isInlineTarget);
- Arr.each(inlines, function (inline) {
- var pos = CaretPosition.fromRangeStart(editor.selection.getRng());
- BoundaryLocation.readLocation(isInlineTarget, editor.getBody(), pos).bind(function (location) {
- return renderCaretLocation(editor, caret, location);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ this.nodeChanged = function (args) {
+ var selection = editor.selection;
+ var node, parents, root;
+ if (editor.initialized && selection && !editor.settings.disable_nodechange && !editor.readonly) {
+ root = editor.getBody();
+ node = selection.getStart(true) || root;
+ if (node.ownerDocument !== editor.getDoc() || !editor.dom.isChildOf(node, root)) {
+ node = root;
+ }
+ parents = [];
+ editor.dom.getParent(node, function (node) {
+ if (node === root) {
+ return true;
+ }
+ parents.push(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ args = args || {};
+ args.element = node;
+ args.parents = parents;
+ editor.fire('NodeChange', args);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var move = function (editor, caret, forward) {
- return function () {
- return isFeatureEnabled(editor) ? findLocation(editor, caret, forward).isSome() : false;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getAbsolutePosition = function (elm) {
+ var doc, docElem, win, clientRect;
+ clientRect = elm.getBoundingClientRect();
+ doc = elm.ownerDocument;
+ docElem = doc.documentElement;
+ win = doc.defaultView;
+ return {
+ top: clientRect.top + win.pageYOffset - docElem.clientTop,
+ left: clientRect.left + win.pageXOffset - docElem.clientLeft
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var setupSelectedState = function (editor) {
- var caret = new Cell(null);
- var isInlineTarget = Fun.curry(InlineUtils.isInlineTarget, editor);
-
- editor.on('NodeChange', function (e) {
- if (isFeatureEnabled(editor)) {
- toggleInlines(isInlineTarget, editor.dom, e.parents);
- safeRemoveCaretContainer(editor, caret);
- renderInsideInlineCaret(isInlineTarget, editor, caret, e.parents);
- }
- });
-
- return caret;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getBodyPosition = function (editor) {
+ return editor.inline ? getAbsolutePosition(editor.getBody()) : {
+ left: 0,
+ top: 0
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- move: move,
- setupSelectedState: setupSelectedState,
- setCaretPosition: setCaretPosition
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getScrollPosition = function (editor) {
+ var body = editor.getBody();
+ return editor.inline ? {
+ left: body.scrollLeft,
+ top: body.scrollTop
+ } : {
+ left: 0,
+ top: 0
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * InlineBoundaryDelete.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.delete.InlineBoundaryDelete',
- [
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.api.Options',
- 'ephox.sugar.api.node.Element',
- 'tinymce.core.caret.CaretContainer',
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.caret.CaretUtils',
- 'tinymce.core.delete.DeleteElement',
- 'tinymce.core.keyboard.BoundaryCaret',
- 'tinymce.core.keyboard.BoundaryLocation',
- 'tinymce.core.keyboard.BoundarySelection',
- 'tinymce.core.keyboard.InlineUtils'
- ],
- function (
- Fun, Option, Options, Element, CaretContainer, CaretFinder, CaretPosition, CaretUtils, DeleteElement, BoundaryCaret, BoundaryLocation, BoundarySelection,
- InlineUtils
- ) {
- var isFeatureEnabled = function (editor) {
- return editor.settings.inline_boundaries !== false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getBodyScroll = function (editor) {
+ var body = editor.getBody(), docElm = editor.getDoc().documentElement;
+ var inlineScroll = {
+ left: body.scrollLeft,
+ top: body.scrollTop
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var rangeFromPositions = function (from, to) {
- var range = document.createRange();
-
- range.setStart(from.container(), from.offset());
- range.setEnd(to.container(), to.offset());
-
- return range;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var iframeScroll = {
+ left: body.scrollLeft || docElm.scrollLeft,
+ top: body.scrollTop || docElm.scrollTop
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Checks for delete at <code>|a</code> when there is only one item left except the zwsp caret container nodes
- var hasOnlyTwoOrLessPositionsLeft = function (elm) {
- return Options.liftN([
- CaretFinder.firstPositionIn(elm),
- CaretFinder.lastPositionIn(elm)
- ], function (firstPos, lastPos) {
- var normalizedFirstPos = InlineUtils.normalizePosition(true, firstPos);
- var normalizedLastPos = InlineUtils.normalizePosition(false, lastPos);
-
- return CaretFinder.nextPosition(elm, normalizedFirstPos).map(function (pos) {
- return pos.isEqual(normalizedLastPos);
- }).getOr(true);
- }).getOr(true);
- };
-
- var setCaretLocation = function (editor, caret) {
- return function (location) {
- return BoundaryCaret.renderCaret(caret, location).map(function (pos) {
- BoundarySelection.setCaretPosition(editor, pos);
- return true;
- }).getOr(false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return editor.inline ? inlineScroll : iframeScroll;
+ };
+ var getMousePosition = function (editor, event) {
+ if (event.target.ownerDocument !== editor.getDoc()) {
+ var iframePosition = getAbsolutePosition(editor.getContentAreaContainer());
+ var scrollPosition = getBodyScroll(editor);
+ return {
+ left: event.pageX - iframePosition.left + scrollPosition.left,
+ top: event.pageY - iframePosition.top + scrollPosition.top
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return {
+ left: event.pageX,
+ top: event.pageY
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var deleteFromTo = function (editor, caret, from, to) {
- var rootNode = editor.getBody();
- var isInlineTarget = Fun.curry(InlineUtils.isInlineTarget, editor);
-
- editor.undoManager.ignore(function () {
- editor.selection.setRng(rangeFromPositions(from, to));
- editor.execCommand('Delete');
-
- BoundaryLocation.readLocation(isInlineTarget, rootNode, CaretPosition.fromRangeStart(editor.selection.getRng()))
- .map(BoundaryLocation.inside)
- .map(setCaretLocation(editor, caret));
- });
-
- editor.nodeChanged();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) {
+ return {
+ pageX: mousePosition.left - bodyPosition.left + scrollPosition.left,
+ pageY: mousePosition.top - bodyPosition.top + scrollPosition.top
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var calc = function (editor, event) {
+ return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));
+ };
+ var $_bx2jdz53jfuw8m4l = { calc: calc };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var rescope = function (rootNode, node) {
- var parentBlock = CaretUtils.getParentBlock(node, rootNode);
- return parentBlock ? parentBlock : rootNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isContentEditableFalse$7 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var isContentEditableTrue$4 = $_ey7ka11qjfuw8ldg.isContentEditableTrue;
+ var isDraggable = function (rootElm, elm) {
+ return isContentEditableFalse$7(elm) && elm !== rootElm;
+ };
+ var isValidDropTarget = function (editor, targetElement, dragElement) {
+ if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) {
+ return false;
+ }
+ if (isContentEditableFalse$7(targetElement)) {
+ return false;
+ }
+ return true;
+ };
+ var cloneElement = function (elm) {
+ var cloneElm = elm.cloneNode(true);
+ cloneElm.removeAttribute('data-mce-selected');
+ return cloneElm;
+ };
+ var createGhost = function (editor, elm, width, height) {
+ var clonedElm = elm.cloneNode(true);
+ editor.dom.setStyles(clonedElm, {
+ width: width,
+ height: height
+ });
+ editor.dom.setAttrib(clonedElm, 'data-mce-selected', null);
+ var ghostElm = editor.dom.create('div', {
+ 'class': 'mce-drag-container',
+ 'data-mce-bogus': 'all',
+ 'unselectable': 'on',
+ 'contenteditable': 'false'
+ });
+ editor.dom.setStyles(ghostElm, {
+ position: 'absolute',
+ opacity: 0.5,
+ overflow: 'hidden',
+ border: 0,
+ padding: 0,
+ margin: 0,
+ width: width,
+ height: height
+ });
+ editor.dom.setStyles(clonedElm, {
+ margin: 0,
+ boxSizing: 'border-box'
+ });
+ ghostElm.appendChild(clonedElm);
+ return ghostElm;
+ };
+ var appendGhostToBody = function (ghostElm, bodyElm) {
+ if (ghostElm.parentNode !== bodyElm) {
+ bodyElm.appendChild(ghostElm);
+ }
+ };
+ var moveGhost = function (ghostElm, position, width, height, maxX, maxY) {
+ var overflowX = 0, overflowY = 0;
+ ghostElm.style.left = position.pageX + 'px';
+ ghostElm.style.top = position.pageY + 'px';
+ if (position.pageX + width > maxX) {
+ overflowX = position.pageX + width - maxX;
+ }
+ if (position.pageY + height > maxY) {
+ overflowY = position.pageY + height - maxY;
+ }
+ ghostElm.style.width = width - overflowX + 'px';
+ ghostElm.style.height = height - overflowY + 'px';
+ };
+ var removeElement = function (elm) {
+ if (elm && elm.parentNode) {
+ elm.parentNode.removeChild(elm);
+ }
+ };
+ var isLeftMouseButtonPressed = function (e) {
+ return e.button === 0;
+ };
+ var hasDraggableElement = function (state) {
+ return state.element;
+ };
+ var applyRelPos = function (state, position) {
+ return {
+ pageX: position.pageX - state.relX,
+ pageY: position.pageY + 5
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var backspaceDeleteCollapsed = function (editor, caret, forward, from) {
- var rootNode = rescope(editor.getBody(), from.container());
- var isInlineTarget = Fun.curry(InlineUtils.isInlineTarget, editor);
- var fromLocation = BoundaryLocation.readLocation(isInlineTarget, rootNode, from);
-
- return fromLocation.bind(function (location) {
- if (forward) {
- return location.fold(
- Fun.constant(Option.some(BoundaryLocation.inside(location))), // Before
- Option.none, // Start
- Fun.constant(Option.some(BoundaryLocation.outside(location))), // End
- Option.none // After
- );
- } else {
- return location.fold(
- Option.none, // Before
- Fun.constant(Option.some(BoundaryLocation.outside(location))), // Start
- Option.none, // End
- Fun.constant(Option.some(BoundaryLocation.inside(location))) // After
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var start$1 = function (state, editor) {
+ return function (e) {
+ if (isLeftMouseButtonPressed(e)) {
+ var ceElm = $_djuh8tljfuw8l74.find(editor.dom.getParents(e.target), $_ebfy8j25jfuw8li1.or(isContentEditableFalse$7, isContentEditableTrue$4));
+ if (isDraggable(editor.getBody(), ceElm)) {
+ var elmPos = editor.dom.getPos(ceElm);
+ var bodyElm = editor.getBody();
+ var docElm = editor.getDoc().documentElement;
+ state.element = ceElm;
+ state.screenX = e.screenX;
+ state.screenY = e.screenY;
+ state.maxX = (editor.inline ? bodyElm.scrollWidth : docElm.offsetWidth) - 2;
+ state.maxY = (editor.inline ? bodyElm.scrollHeight : docElm.offsetHeight) - 2;
+ state.relX = e.pageX - elmPos.x;
+ state.relY = e.pageY - elmPos.y;
+ state.width = ceElm.offsetWidth;
+ state.height = ceElm.offsetHeight;
+ state.ghost = createGhost(editor, ceElm, state.width, state.height);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- })
- .map(setCaretLocation(editor, caret))
- .getOrThunk(function () {
- var toPosition = CaretFinder.navigate(forward, rootNode, from);
- var toLocation = toPosition.bind(function (pos) {
- return BoundaryLocation.readLocation(isInlineTarget, rootNode, pos);
- });
-
- if (fromLocation.isSome() && toLocation.isSome()) {
- return InlineUtils.findRootInline(isInlineTarget, rootNode, from).map(function (elm) {
- if (hasOnlyTwoOrLessPositionsLeft(elm)) {
- DeleteElement.deleteElement(editor, forward, Element.fromDom(elm));
- return true;
- } else {
- return false;
- }
- }).getOr(false);
- } else {
- return toLocation.bind(function (_) {
- return toPosition.map(function (to) {
- if (forward) {
- deleteFromTo(editor, caret, from, to);
- } else {
- deleteFromTo(editor, caret, to, from);
- }
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ };
+ var move$1 = function (state, editor) {
+ var throttledPlaceCaretAt = $_2m8wq9hjfuw8l41.throttle(function (clientX, clientY) {
+ editor._selectionOverrides.hideFakeCaret();
+ editor.selection.placeCaretAt(clientX, clientY);
+ }, 0);
+ return function (e) {
+ var movement = Math.max(Math.abs(e.screenX - state.screenX), Math.abs(e.screenY - state.screenY));
+ if (hasDraggableElement(state) && !state.dragging && movement > 10) {
+ var args = editor.fire('dragstart', { target: state.element });
+ if (args.isDefaultPrevented()) {
+ return;
+ }
+ state.dragging = true;
+ editor.focus();
+ }
+ if (state.dragging) {
+ var targetPos = applyRelPos(state, $_bx2jdz53jfuw8m4l.calc(editor, e));
+ appendGhostToBody(state.ghost, editor.getBody());
+ moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY);
+ throttledPlaceCaretAt(e.clientX, e.clientY);
+ }
+ };
+ };
+ var getRawTarget = function (selection) {
+ var rng = selection.getSel().getRangeAt(0);
+ var startContainer = rng.startContainer;
+ return startContainer.nodeType === 3 ? startContainer.parentNode : startContainer;
+ };
+ var drop = function (state, editor) {
+ return function (e) {
+ if (state.dragging) {
+ if (isValidDropTarget(editor, getRawTarget(editor.selection), state.element)) {
+ var targetClone_1 = cloneElement(state.element);
+ var args = editor.fire('drop', {
+ targetClone: targetClone_1,
+ clientX: e.clientX,
+ clientY: e.clientY
+ });
+ if (!args.isDefaultPrevented()) {
+ targetClone_1 = args.targetClone;
+ editor.undoManager.transact(function () {
+ removeElement(state.element);
+ editor.insertContent(editor.dom.getOuterHTML(targetClone_1));
+ editor._selectionOverrides.hideFakeCaret();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }).getOr(false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ removeDragState(state);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var backspaceDelete = function (editor, caret, forward) {
- if (editor.selection.isCollapsed() && isFeatureEnabled(editor)) {
- var from = CaretPosition.fromRangeStart(editor.selection.getRng());
- return backspaceDeleteCollapsed(editor, caret, forward, from);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var stop = function (state, editor) {
+ return function () {
+ removeDragState(state);
+ if (state.dragging) {
+ editor.fire('dragend');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var removeDragState = function (state) {
+ state.dragging = false;
+ state.element = null;
+ removeElement(state.ghost);
+ };
+ var bindFakeDragEvents = function (editor) {
+ var state = {};
+ var pageDom, dragStartHandler, dragHandler, dropHandler, dragEndHandler, rootDocument;
+ pageDom = DOMUtils$1.DOM;
+ rootDocument = document;
+ dragStartHandler = start$1(state, editor);
+ dragHandler = move$1(state, editor);
+ dropHandler = drop(state, editor);
+ dragEndHandler = stop(state, editor);
+ editor.on('mousedown', dragStartHandler);
+ editor.on('mousemove', dragHandler);
+ editor.on('mouseup', dropHandler);
+ pageDom.bind(rootDocument, 'mousemove', dragHandler);
+ pageDom.bind(rootDocument, 'mouseup', dragEndHandler);
+ editor.on('remove', function () {
+ pageDom.unbind(rootDocument, 'mousemove', dragHandler);
+ pageDom.unbind(rootDocument, 'mouseup', dragEndHandler);
+ });
+ };
+ var blockIeDrop = function (editor) {
+ editor.on('drop', function (e) {
+ var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null;
+ if (isContentEditableFalse$7(realTarget) || isContentEditableFalse$7(editor.dom.getContentEditableParent(realTarget))) {
+ e.preventDefault();
+ }
+ });
+ };
+ var init = function (editor) {
+ bindFakeDragEvents(editor);
+ blockIeDrop(editor);
+ };
+ var $_7g0llv52jfuw8m4f = { init: init };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- backspaceDelete: backspaceDelete
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getNodeClientRects = function (node) {
+ var toArrayWithNode = function (clientRects) {
+ return $_djuh8tljfuw8l74.map(clientRects, function (clientRect) {
+ clientRect = clone$1(clientRect);
+ clientRect.node = node;
+ return clientRect;
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-define(
- 'tinymce.core.delete.TableDeleteAction',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_ey7ka11qjfuw8ldg.isElement(node)) {
+ return toArrayWithNode(node.getClientRects());
+ }
+ if ($_ey7ka11qjfuw8ldg.isText(node)) {
+ var rng = node.ownerDocument.createRange();
+ rng.setStart(node, 0);
+ rng.setEnd(node, node.data.length);
+ return toArrayWithNode(rng.getClientRects());
+ }
+ };
+ var getClientRects = function (node) {
+ return $_djuh8tljfuw8l74.reduce(node, function (result, node) {
+ return result.concat(getNodeClientRects(node));
+ }, []);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- [
- 'ephox.katamari.api.Adt',
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.katamari.api.Options',
- 'ephox.katamari.api.Struct',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.SelectorFilter',
- 'ephox.sugar.api.search.SelectorFind'
- ],
-
- function (Adt, Arr, Fun, Option, Options, Struct, Compare, Element, SelectorFilter, SelectorFind) {
- var tableCellRng = Struct.immutable('start', 'end');
- var tableSelection = Struct.immutable('rng', 'table', 'cells');
- var deleteAction = Adt.generate([
- { removeTable: [ 'element' ] },
- { emptyCells: [ 'cells' ] }
- ]);
-
- var getClosestCell = function (container, isRoot) {
- return SelectorFind.closest(Element.fromDom(container), 'td,th', isRoot);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var VDirection;
+ (function (VDirection) {
+ VDirection[VDirection['Up'] = -1] = 'Up';
+ VDirection[VDirection['Down'] = 1] = 'Down';
+ }(VDirection || (VDirection = {})));
+ var findUntil = function (direction, root, predicateFn, node) {
+ while (node = findNode(node, direction, isEditableCaretCandidate, root)) {
+ if (predicateFn(node)) {
+ return;
+ }
+ }
+ };
+ var walkUntil = function (direction, isAboveFn, isBeflowFn, root, predicateFn, caretPosition) {
+ var line = 0, node;
+ var result = [];
+ var targetClientRect;
+ var add = function (node) {
+ var i, clientRect, clientRects;
+ clientRects = getClientRects([node]);
+ if (direction === -1) {
+ clientRects = clientRects.reverse();
+ }
+ for (i = 0; i < clientRects.length; i++) {
+ clientRect = clientRects[i];
+ if (isBeflowFn(clientRect, targetClientRect)) {
+ continue;
+ }
+ if (result.length > 0 && isAboveFn(clientRect, $_djuh8tljfuw8l74.last(result))) {
+ line++;
+ }
+ clientRect.line = line;
+ if (predicateFn(clientRect)) {
+ return true;
+ }
+ result.push(clientRect);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getClosestTable = function (cell, isRoot) {
- return SelectorFind.ancestor(cell, 'table', isRoot);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ targetClientRect = $_djuh8tljfuw8l74.last(caretPosition.getClientRects());
+ if (!targetClientRect) {
+ return result;
+ }
+ node = caretPosition.getNode();
+ add(node);
+ findUntil(direction, root, add, node);
+ return result;
+ };
+ var aboveLineNumber = function (lineNumber, clientRect) {
+ return clientRect.line > lineNumber;
+ };
+ var isLineNumber = function (lineNumber, clientRect) {
+ return clientRect.line === lineNumber;
+ };
+ var upUntil = $_68e81l6jfuw8kyc.curry(walkUntil, VDirection.Up, isAbove, isBelow);
+ var downUntil = $_68e81l6jfuw8kyc.curry(walkUntil, VDirection.Down, isBelow, isAbove);
+ var positionsUntil = function (direction, root, predicateFn, node) {
+ var caretWalker = CaretWalker(root);
+ var walkFn, isBelowFn, isAboveFn, caretPosition;
+ var result = [];
+ var line = 0, clientRect, targetClientRect;
+ var getClientRect = function (caretPosition) {
+ if (direction === 1) {
+ return $_djuh8tljfuw8l74.last(caretPosition.getClientRects());
+ }
+ return $_djuh8tljfuw8l74.last(caretPosition.getClientRects());
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isExpandedCellRng = function (cellRng) {
- return Compare.eq(cellRng.start(), cellRng.end()) === false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (direction === 1) {
+ walkFn = caretWalker.next;
+ isBelowFn = isBelow;
+ isAboveFn = isAbove;
+ caretPosition = CaretPosition$1.after(node);
+ } else {
+ walkFn = caretWalker.prev;
+ isBelowFn = isAbove;
+ isAboveFn = isBelow;
+ caretPosition = CaretPosition$1.before(node);
+ }
+ targetClientRect = getClientRect(caretPosition);
+ do {
+ if (!caretPosition.isVisible()) {
+ continue;
+ }
+ clientRect = getClientRect(caretPosition);
+ if (isAboveFn(clientRect, targetClientRect)) {
+ continue;
+ }
+ if (result.length > 0 && isBelowFn(clientRect, $_djuh8tljfuw8l74.last(result))) {
+ line++;
+ }
+ clientRect = clone$1(clientRect);
+ clientRect.position = caretPosition;
+ clientRect.line = line;
+ if (predicateFn(clientRect)) {
+ return result;
+ }
+ result.push(clientRect);
+ } while (caretPosition = walkFn(caretPosition));
+ return result;
+ };
+ var isAboveLine = function (lineNumber) {
+ return function (clientRect) {
+ return aboveLineNumber(lineNumber, clientRect);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getTableFromCellRng = function (cellRng, isRoot) {
- return getClosestTable(cellRng.start(), isRoot)
- .bind(function (startParentTable) {
- return getClosestTable(cellRng.end(), isRoot)
- .bind(function (endParentTable) {
- return Compare.eq(startParentTable, endParentTable) ? Option.some(startParentTable) : Option.none();
- });
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var isLine = function (lineNumber) {
+ return function (clientRect) {
+ return isLineNumber(lineNumber, clientRect);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getCellRng = function (rng, isRoot) {
- return Options.liftN([ // get start and end cell
- getClosestCell(rng.startContainer, isRoot),
- getClosestCell(rng.endContainer, isRoot)
- ], tableCellRng)
- .filter(isExpandedCellRng);
- };
-
- var getTableSelectionFromCellRng = function (cellRng, isRoot) {
- return getTableFromCellRng(cellRng, isRoot)
- .bind(function (table) {
- var cells = SelectorFilter.descendants(table, 'td,th');
-
- return tableSelection(cellRng, table, cells);
- });
- };
-
- var getTableSelectionFromRng = function (rootNode, rng) {
- var isRoot = Fun.curry(Compare.eq, rootNode);
-
- return getCellRng(rng, isRoot)
- .map(function (cellRng) {
- return getTableSelectionFromCellRng(cellRng, isRoot);
- });
- };
-
- var getCellIndex = function (cellArray, cell) {
- return Arr.findIndex(cellArray, function (x) {
- return Compare.eq(x, cell);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isContentEditableFalse$8 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var findNode$1 = findNode;
+ var distanceToRectLeft = function (clientRect, clientX) {
+ return Math.abs(clientRect.left - clientX);
+ };
+ var distanceToRectRight = function (clientRect, clientX) {
+ return Math.abs(clientRect.right - clientX);
+ };
+ var isInside = function (clientX, clientRect) {
+ return clientX >= clientRect.left && clientX <= clientRect.right;
+ };
+ var findClosestClientRect = function (clientRects, clientX) {
+ return $_djuh8tljfuw8l74.reduce(clientRects, function (oldClientRect, clientRect) {
+ var oldDistance, newDistance;
+ oldDistance = Math.min(distanceToRectLeft(oldClientRect, clientX), distanceToRectRight(oldClientRect, clientX));
+ newDistance = Math.min(distanceToRectLeft(clientRect, clientX), distanceToRectRight(clientRect, clientX));
+ if (isInside(clientX, clientRect)) {
+ return clientRect;
+ }
+ if (isInside(clientX, oldClientRect)) {
+ return oldClientRect;
+ }
+ if (newDistance === oldDistance && isContentEditableFalse$8(clientRect.node)) {
+ return clientRect;
+ }
+ if (newDistance < oldDistance) {
+ return clientRect;
+ }
+ return oldClientRect;
+ });
+ };
+ var walkUntil$1 = function (direction, root, predicateFn, node) {
+ while (node = findNode$1(node, direction, isEditableCaretCandidate, root)) {
+ if (predicateFn(node)) {
+ return;
+ }
+ }
+ };
+ var findLineNodeRects = function (root, targetNodeRect) {
+ var clientRects = [];
+ var collect = function (checkPosFn, node) {
+ var lineRects;
+ lineRects = $_djuh8tljfuw8l74.filter(getClientRects([node]), function (clientRect) {
+ return !checkPosFn(clientRect, targetNodeRect);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ clientRects = clientRects.concat(lineRects);
+ return lineRects.length === 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getSelectedCells = function (tableSelection) {
- return Options.liftN([
- getCellIndex(tableSelection.cells(), tableSelection.rng().start()),
- getCellIndex(tableSelection.cells(), tableSelection.rng().end())
- ], function (startIndex, endIndex) {
- return tableSelection.cells().slice(startIndex, endIndex + 1);
- });
- };
-
- var getAction = function (tableSelection) {
- return getSelectedCells(tableSelection)
- .bind(function (selected) {
- var cells = tableSelection.cells();
-
- return selected.length === cells.length ? deleteAction.removeTable(tableSelection.table()) : deleteAction.emptyCells(selected);
- });
- };
-
- var getActionFromCells = function (cells) {
- return deleteAction.emptyCells(cells);
- };
-
- var getActionFromRange = function (rootNode, rng) {
- return getTableSelectionFromRng(rootNode, rng)
- .map(getAction);
- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ clientRects.push(targetNodeRect);
+ walkUntil$1(VDirection.Up, root, $_68e81l6jfuw8kyc.curry(collect, isAbove), targetNodeRect.node);
+ walkUntil$1(VDirection.Down, root, $_68e81l6jfuw8kyc.curry(collect, isBelow), targetNodeRect.node);
+ return clientRects;
+ };
+ var getFakeCaretTargets = function (root) {
+ return $_djuh8tljfuw8l74.filter($_djuh8tljfuw8l74.toArray(root.getElementsByTagName('*')), isFakeCaretTarget);
+ };
+ var caretInfo = function (clientRect, clientX) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- getActionFromRange: getActionFromRange,
- getActionFromCells: getActionFromCells
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node: clientRect.node,
+ before: distanceToRectLeft(clientRect, clientX) < distanceToRectRight(clientRect, clientX)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var closestCaret = function (root, clientX, clientY) {
+ var closestNodeRect;
+ var contentEditableFalseNodeRects = getClientRects(getFakeCaretTargets(root));
+ var targetNodeRects = $_djuh8tljfuw8l74.filter(contentEditableFalseNodeRects, function (rect) {
+ return clientY >= rect.top && clientY <= rect.bottom;
+ });
+ closestNodeRect = findClosestClientRect(targetNodeRects, clientX);
+ if (closestNodeRect) {
+ closestNodeRect = findClosestClientRect(findLineNodeRects(root, closestNodeRect), clientX);
+ if (closestNodeRect && isFakeCaretTarget(closestNodeRect.node)) {
+ return caretInfo(closestNodeRect, clientX);
+ }
+ }
+ return null;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * TableDelete.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isXYWithinRange = function (clientX, clientY, range) {
+ if (range.collapsed) {
+ return false;
+ }
+ return $_9ek1bp4jfuw8kxg.foldl(range.getClientRects(), function (state, rect) {
+ return state || containsXY(rect, clientX, clientY);
+ }, false);
+ };
+ var $_ew17fe57jfuw8m5c = { isXYWithinRange: isXYWithinRange };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.delete.TableDelete',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.sugar.api.node.Element',
- 'tinymce.core.delete.DeleteElement',
- 'tinymce.core.delete.TableDeleteAction',
- 'tinymce.core.dom.PaddingBr',
- 'tinymce.core.selection.TableCellSelection'
- ],
- function (Arr, Fun, Element, DeleteElement, TableDeleteAction, PaddingBr, TableCellSelection) {
- var emptyCells = function (editor, cells) {
- Arr.each(cells, PaddingBr.fillWithPaddingBr);
- editor.selection.setCursorLocation(cells[0].dom(), 0);
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var adaptable = function (fn, rate) {
+ var timer = null;
+ var args = null;
+ var cancel = function () {
+ if (timer !== null) {
+ clearTimeout(timer);
+ timer = null;
+ args = null;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var deleteTableElement = function (editor, table) {
- DeleteElement.deleteElement(editor, false, table);
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var throttle = function () {
+ args = arguments;
+ if (timer === null) {
+ timer = setTimeout(function () {
+ fn.apply(null, args);
+ timer = null;
+ args = null;
+ }, rate);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var handleCellRange = function (editor, rootNode, rng) {
- return TableDeleteAction.getActionFromRange(rootNode, rng)
- .map(function (action) {
- return action.fold(
- Fun.curry(deleteTableElement, editor),
- Fun.curry(emptyCells, editor)
- );
- }).getOr(false);
- };
-
- var deleteRange = function (editor) {
- var rootNode = Element.fromDom(editor.getBody());
- var rng = editor.selection.getRng();
- var selectedCells = TableCellSelection.getCellsFromEditor(editor);
-
- return selectedCells.length !== 0 ? emptyCells(editor, selectedCells) : handleCellRange(editor, rootNode, rng);
- };
-
- var backspaceDelete = function (editor) {
- return editor.selection.isCollapsed() ? false : deleteRange(editor);
- };
-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- backspaceDelete: backspaceDelete
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ cancel: cancel,
+ throttle: throttle
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Commands.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.delete.DeleteCommands',
- [
- 'tinymce.core.delete.BlockBoundaryDelete',
- 'tinymce.core.delete.BlockRangeDelete',
- 'tinymce.core.delete.CefDelete',
- 'tinymce.core.delete.DeleteUtils',
- 'tinymce.core.delete.InlineBoundaryDelete',
- 'tinymce.core.delete.TableDelete'
- ],
- function (BlockBoundaryDelete, BlockRangeDelete, CefDelete, DeleteUtils, BoundaryDelete, TableDelete) {
- var nativeCommand = function (editor, command) {
- editor.getDoc().execCommand(command, false, null);
- };
-
- var deleteCommand = function (editor) {
- if (CefDelete.backspaceDelete(editor, false)) {
- return;
- } else if (BoundaryDelete.backspaceDelete(editor, false)) {
- return;
- } else if (BlockBoundaryDelete.backspaceDelete(editor, false)) {
- return;
- } else if (TableDelete.backspaceDelete(editor)) {
- return;
- } else if (BlockRangeDelete.backspaceDelete(editor, false)) {
- return;
- } else {
- nativeCommand(editor, 'Delete');
- DeleteUtils.paddEmptyBody(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var first$3 = function (fn, rate) {
+ var timer = null;
+ var cancel = function () {
+ if (timer !== null) {
+ clearTimeout(timer);
+ timer = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var forwardDeleteCommand = function (editor) {
- if (CefDelete.backspaceDelete(editor, true)) {
- return;
- } else if (BoundaryDelete.backspaceDelete(editor, true)) {
- return;
- } else if (BlockBoundaryDelete.backspaceDelete(editor, true)) {
- return;
- } else if (TableDelete.backspaceDelete(editor)) {
- return;
- } else if (BlockRangeDelete.backspaceDelete(editor, true)) {
- return;
- } else {
- nativeCommand(editor, 'ForwardDelete');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var throttle = function () {
+ var args = arguments;
+ if (timer === null) {
+ timer = setTimeout(function () {
+ fn.apply(null, args);
+ timer = null;
+ args = null;
+ }, rate);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- deleteCommand: deleteCommand,
- forwardDeleteCommand: forwardDeleteCommand
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ cancel: cancel,
+ throttle: throttle
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * InsertList.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Handles inserts of lists into the editor instance.
- *
- * @class tinymce.InsertList
- * @private
- */
-define(
- 'tinymce.core.InsertList',
- [
- "tinymce.core.util.Tools",
- "tinymce.core.caret.CaretWalker",
- "tinymce.core.caret.CaretPosition"
- ],
- function (Tools, CaretWalker, CaretPosition) {
- var hasOnlyOneChild = function (node) {
- return node.firstChild && node.firstChild === node.lastChild;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var last$3 = function (fn, rate) {
+ var timer = null;
+ var cancel = function () {
+ if (timer !== null) {
+ clearTimeout(timer);
+ timer = null;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isPaddingNode = function (node) {
- return node.name === 'br' || node.value === '\u00a0';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var throttle = function () {
+ var args = arguments;
+ if (timer !== null)
+ clearTimeout(timer);
+ timer = setTimeout(function () {
+ fn.apply(null, args);
+ timer = null;
+ args = null;
+ }, rate);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isPaddedEmptyBlock = function (schema, node) {
- var blockElements = schema.getBlockElements();
- return blockElements[node.name] && hasOnlyOneChild(node) && isPaddingNode(node.firstChild);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return {
+ cancel: cancel,
+ throttle: throttle
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_6aemaw59jfuw8m5h = {
+ adaptable: adaptable,
+ first: first$3,
+ last: last$3
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isEmptyFragmentElement = function (schema, node) {
- var nonEmptyElements = schema.getNonEmptyElements();
- return node && (node.isEmpty(nonEmptyElements) || isPaddedEmptyBlock(schema, node));
- };
-
- var isListFragment = function (schema, fragment) {
- var firstChild = fragment.firstChild;
- var lastChild = fragment.lastChild;
-
- // Skip meta since it's likely <meta><ul>..</ul>
- if (firstChild && firstChild.name === 'meta') {
- firstChild = firstChild.next;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setup$1 = function (editor) {
+ var renderFocusCaret = $_6aemaw59jfuw8m5h.first(function () {
+ if (!editor.removed) {
+ var rng = editor.selection.getRng();
+ if (rng.collapsed) {
+ var caretRange = renderRangeCaret(editor, editor.selection.getRng(), false);
+ editor.selection.setRng(caretRange);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, 0);
+ editor.on('focus', function () {
+ renderFocusCaret.throttle();
+ });
+ editor.on('blur', function () {
+ renderFocusCaret.cancel();
+ });
+ };
+ var $_eq1t5458jfuw8m5e = { setup: setup$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Skip mce_marker since it's likely <ul>..</ul><span id="mce_marker"></span>
- if (lastChild && lastChild.attr('id') === 'mce_marker') {
- lastChild = lastChild.prev;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_1nvqmv5ajfuw8m5j = {
+ BACKSPACE: 8,
+ DELETE: 46,
+ DOWN: 40,
+ ENTER: 13,
+ LEFT: 37,
+ RIGHT: 39,
+ SPACEBAR: 32,
+ TAB: 9,
+ UP: 38,
+ modifierPressed: function (e) {
+ return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);
+ },
+ metaKeyPressed: function (e) {
+ return $_9fhi43ajfuw8l13.mac ? e.metaKey : e.ctrlKey && !e.altKey;
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Skip last child if it's an empty block
- if (isEmptyFragmentElement(schema, lastChild)) {
- lastChild = lastChild.prev;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isContentEditableTrue$5 = $_ey7ka11qjfuw8ldg.isContentEditableTrue;
+ var isContentEditableFalse$9 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var isAfterContentEditableFalse$1 = isAfterContentEditableFalse;
+ var isBeforeContentEditableFalse$1 = isBeforeContentEditableFalse;
+ var getContentEditableRoot$1 = function (editor, node) {
+ var root = editor.getBody();
+ while (node && node !== root) {
+ if (isContentEditableTrue$5(node) || isContentEditableFalse$9(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!firstChild || firstChild !== lastChild) {
- return false;
- }
-
- return firstChild.name === 'ul' || firstChild.name === 'ol';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
+ }
+ return null;
+ };
+ var SelectionOverrides = function (editor) {
+ var isBlock = function (node) {
+ return editor.dom.isBlock(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var cleanupDomFragment = function (domFragment) {
- var firstChild = domFragment.firstChild;
- var lastChild = domFragment.lastChild;
-
- // TODO: remove the meta tag from paste logic
- if (firstChild && firstChild.nodeName === 'META') {
- firstChild.parentNode.removeChild(firstChild);
- }
-
- if (lastChild && lastChild.id === 'mce_marker') {
- lastChild.parentNode.removeChild(lastChild);
- }
-
- return domFragment;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var rootNode = editor.getBody();
+ var fakeCaret = FakeCaret(editor.getBody(), isBlock, function () {
+ return $_18lipa49jfuw8lzt.hasFocus(editor);
+ });
+ var realSelectionId = 'sel-' + editor.dom.uniqueId();
+ var selectedContentEditableNode;
+ var isFakeSelectionElement = function (elm) {
+ return editor.dom.hasClass(elm, 'mce-offscreen-selection');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var toDomFragment = function (dom, serializer, fragment) {
- var html = serializer.serialize(fragment);
- var domFragment = dom.createFragment(html);
-
- return cleanupDomFragment(domFragment);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getRealSelectionElement = function () {
+ var container = editor.dom.get(realSelectionId);
+ return container ? container.getElementsByTagName('*')[0] : container;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var listItems = function (elm) {
- return Tools.grep(elm.childNodes, function (child) {
- return child.nodeName === 'LI';
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setRange = function (range) {
+ if (range) {
+ editor.selection.setRng(range);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isEmpty = function (elm) {
- return !elm.firstChild;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getRange = function () {
+ return editor.selection.getRng();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var trimListItems = function (elms) {
- return elms.length > 0 && isEmpty(elms[elms.length - 1]) ? elms.slice(0, -1) : elms;
- };
-
- var getParentLi = function (dom, node) {
- var parentBlock = dom.getParent(node, dom.isBlock);
- return parentBlock && parentBlock.nodeName === 'LI' ? parentBlock : null;
- };
-
- var isParentBlockLi = function (dom, node) {
- return !!getParentLi(dom, node);
- };
-
- var getSplit = function (parentNode, rng) {
- var beforeRng = rng.cloneRange();
- var afterRng = rng.cloneRange();
-
- beforeRng.setStartBefore(parentNode);
- afterRng.setEndAfter(parentNode);
-
- return [
- beforeRng.cloneContents(),
- afterRng.cloneContents()
- ];
- };
-
- var findFirstIn = function (node, rootNode) {
- var caretPos = CaretPosition.before(node);
- var caretWalker = new CaretWalker(rootNode);
- var newCaretPos = caretWalker.next(caretPos);
-
- return newCaretPos ? newCaretPos.toRange() : null;
- };
-
- var findLastOf = function (node, rootNode) {
- var caretPos = CaretPosition.after(node);
- var caretWalker = new CaretWalker(rootNode);
- var newCaretPos = caretWalker.prev(caretPos);
-
- return newCaretPos ? newCaretPos.toRange() : null;
- };
-
- var insertMiddle = function (target, elms, rootNode, rng) {
- var parts = getSplit(target, rng);
- var parentElm = target.parentNode;
-
- parentElm.insertBefore(parts[0], target);
- Tools.each(elms, function (li) {
- parentElm.insertBefore(li, target);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var showCaret$$1 = function (direction, node, before, scrollIntoView) {
+ if (scrollIntoView === void 0) {
+ scrollIntoView = true;
+ }
+ var e;
+ e = editor.fire('ShowCaret', {
+ target: node,
+ direction: direction,
+ before: before
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- parentElm.insertBefore(parts[1], target);
- parentElm.removeChild(target);
-
- return findLastOf(elms[elms.length - 1], rootNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (e.isDefaultPrevented()) {
+ return null;
+ }
+ if (scrollIntoView) {
+ editor.selection.scrollIntoView(node, direction === -1);
+ }
+ return fakeCaret.show(before, node);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var insertBefore = function (target, elms, rootNode) {
- var parentElm = target.parentNode;
-
- Tools.each(elms, function (elm) {
- parentElm.insertBefore(elm, target);
- });
-
- return findFirstIn(target, rootNode);
- };
-
- var insertAfter = function (target, elms, rootNode, dom) {
- dom.insertAfter(elms.reverse(), target);
- return findLastOf(elms[0], rootNode);
- };
-
- var insertAtCaret = function (serializer, dom, rng, fragment) {
- var domFragment = toDomFragment(dom, serializer, fragment);
- var liTarget = getParentLi(dom, rng.startContainer);
- var liElms = trimListItems(listItems(domFragment.firstChild));
- var BEGINNING = 1, END = 2;
- var rootNode = dom.getRoot();
-
- var isAt = function (location) {
- var caretPos = CaretPosition.fromRangeStart(rng);
- var caretWalker = new CaretWalker(dom.getRoot());
- var newPos = location === BEGINNING ? caretWalker.prev(caretPos) : caretWalker.next(caretPos);
-
- return newPos ? getParentLi(dom, newPos.getNode()) !== liTarget : true;
- };
-
- if (isAt(BEGINNING)) {
- return insertBefore(liTarget, liElms, rootNode);
- } else if (isAt(END)) {
- return insertAfter(liTarget, liElms, rootNode, dom);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getNormalizedRangeEndPoint$$1 = function (direction, range) {
+ range = normalizeRange(direction, rootNode, range);
+ if (direction === -1) {
+ return CaretPosition$1.fromRangeStart(range);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return insertMiddle(liTarget, liElms, rootNode, rng);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return CaretPosition$1.fromRangeEnd(range);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- isListFragment: isListFragment,
- insertAtCaret: insertAtCaret,
- isParentBlockLi: isParentBlockLi,
- trimListItems: trimListItems,
- listItems: listItems
- };
- }
-);
-/**
- * InsertContent.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Handles inserts of contents into the editor instance.
- *
- * @class tinymce.InsertContent
- * @private
- */
-define(
- 'tinymce.core.InsertContent',
- [
- 'ephox.katamari.api.Option',
- 'ephox.sugar.api.node.Element',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.caret.CaretWalker',
- 'tinymce.core.dom.ElementUtils',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.PaddingBr',
- 'tinymce.core.dom.RangeNormalizer',
- 'tinymce.core.Env',
- 'tinymce.core.html.Serializer',
- 'tinymce.core.InsertList',
- 'tinymce.core.util.Tools'
- ],
- function (Option, Element, CaretPosition, CaretWalker, ElementUtils, NodeType, PaddingBr, RangeNormalizer, Env, Serializer, InsertList, Tools) {
- var isTableCell = NodeType.matchNodeNames('td th');
-
- var validInsertion = function (editor, value, parentNode) {
- // Should never insert content into bogus elements, since these can
- // be resize handles or similar
- if (parentNode.getAttribute('data-mce-bogus') === 'all') {
- parentNode.parentNode.insertBefore(editor.dom.createFragment(value), parentNode);
- } else {
- // Check if parent is empty or only has one BR element then set the innerHTML of that parent
- var node = parentNode.firstChild;
- var node2 = parentNode.lastChild;
- if (!node || (node === node2 && node.nodeName === 'BR')) {///
- editor.dom.setHTML(parentNode, value);
- } else {
- editor.selection.setContent(value);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var showBlockCaretContainer = function (blockCaretContainer) {
+ if (blockCaretContainer.hasAttribute('data-mce-caret')) {
+ showCaretContainerBlock(blockCaretContainer);
+ setRange(getRange());
+ editor.selection.scrollIntoView(blockCaretContainer[0]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var trimBrsFromTableCell = function (dom, elm) {
- Option.from(dom.getParent(elm, 'td,th')).map(Element.fromDom).each(PaddingBr.trimBlockTrailingBr);
- };
-
- var insertHtmlAtCaret = function (editor, value, details) {
- var parser, serializer, parentNode, rootNode, fragment, args;
- var marker, rng, node, node2, bookmarkHtml, merge;
- var textInlineElements = editor.schema.getTextInlineElements();
- var selection = editor.selection, dom = editor.dom;
-
- function trimOrPaddLeftRight(html) {
- var rng, container, offset;
-
- rng = selection.getRng(true);
- container = rng.startContainer;
- offset = rng.startOffset;
-
- function hasSiblingText(siblingName) {
- return container[siblingName] && container[siblingName].nodeType == 3;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var registerEvents = function () {
+ editor.on('mouseup', function (e) {
+ var range = getRange();
+ if (range.collapsed && $_dy1qjd4ejfuw8m0u.isXYInContentArea(editor, e.clientX, e.clientY)) {
+ setRange(renderCaretAtRange(editor, range, false));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (container.nodeType == 3) {
- if (offset > 0) {
- html = html.replace(/^ /, ' ');
- } else if (!hasSiblingText('previousSibling')) {
- html = html.replace(/^ /, ' ');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('click', function (e) {
+ var contentEditableRoot;
+ contentEditableRoot = getContentEditableRoot$1(editor, e.target);
+ if (contentEditableRoot) {
+ if (isContentEditableFalse$9(contentEditableRoot)) {
+ e.preventDefault();
+ editor.focus();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (offset < container.length) {
- html = html.replace(/ (<br>|)$/, ' ');
- } else if (!hasSiblingText('nextSibling')) {
- html = html.replace(/( | )(<br>|)$/, ' ');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isContentEditableTrue$5(contentEditableRoot)) {
+ if (editor.dom.isChildOf(contentEditableRoot, editor.selection.getNode())) {
+ removeContentEditableSelection();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return html;
- }
-
- // Removes from a [b] c -> a c -> a c
- function trimNbspAfterDeleteAndPaddValue() {
- var rng, container, offset;
-
- rng = selection.getRng(true);
- container = rng.startContainer;
- offset = rng.startOffset;
-
- if (container.nodeType == 3 && rng.collapsed) {
- if (container.data[offset] === '\u00a0') {
- container.deleteData(offset, 1);
-
- if (!/[\u00a0| ]$/.test(value)) {
- value += ' ';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('blur NewBlock', function () {
+ removeContentEditableSelection();
+ });
+ editor.on('ResizeWindow FullscreenStateChanged', function () {
+ return fakeCaret.reposition();
+ });
+ var handleTouchSelect = function (editor) {
+ var moved = false;
+ editor.on('touchstart', function () {
+ moved = false;
+ });
+ editor.on('touchmove', function () {
+ moved = true;
+ });
+ editor.on('touchend', function (e) {
+ var contentEditableRoot = getContentEditableRoot$1(editor, e.target);
+ if (isContentEditableFalse$9(contentEditableRoot)) {
+ if (!moved) {
+ e.preventDefault();
+ setContentEditableSelection(selectNode(editor, contentEditableRoot));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if (container.data[offset - 1] === '\u00a0') {
- container.deleteData(offset - 1, 1);
-
- if (!/[\u00a0| ]$/.test(value)) {
- value = ' ' + value;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var hasNormalCaretPosition = function (elm) {
+ var caretWalker = CaretWalker(elm);
+ if (!elm.firstChild) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function reduceInlineTextElements() {
- if (merge) {
- var root = editor.getBody(), elementUtils = new ElementUtils(dom);
-
- Tools.each(dom.select('*[data-mce-fragment]'), function (node) {
- for (var testNode = node.parentNode; testNode && testNode != root; testNode = testNode.parentNode) {
- if (textInlineElements[node.nodeName.toLowerCase()] && elementUtils.compare(testNode, node)) {
- dom.remove(node, true);
- }
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var startPos = CaretPosition$1.before(elm.firstChild);
+ var newPos = caretWalker.next(startPos);
+ return newPos && !isBeforeContentEditableFalse$1(newPos) && !isAfterContentEditableFalse$1(newPos);
+ };
+ var isInSameBlock$$1 = function (node1, node2) {
+ var block1 = editor.dom.getParent(node1, editor.dom.isBlock);
+ var block2 = editor.dom.getParent(node2, editor.dom.isBlock);
+ return block1 === block2;
+ };
+ var hasBetterMouseTarget = function (targetNode, caretNode) {
+ var targetBlock = editor.dom.getParent(targetNode, editor.dom.isBlock);
+ var caretBlock = editor.dom.getParent(caretNode, editor.dom.isBlock);
+ if (targetBlock && editor.dom.isChildOf(targetBlock, caretBlock) && isContentEditableFalse$9(getContentEditableRoot$1(editor, targetBlock)) === false) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function markFragmentElements(fragment) {
- var node = fragment;
-
- while ((node = node.walk())) {
- if (node.type === 1) {
- node.attr('data-mce-fragment', '1');
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return targetBlock && !isInSameBlock$$1(targetBlock, caretBlock) && hasNormalCaretPosition(targetBlock);
+ };
+ handleTouchSelect(editor);
+ editor.on('mousedown', function (e) {
+ var contentEditableRoot;
+ var targetElm = e.target;
+ if (targetElm !== rootNode && targetElm.nodeName !== 'HTML' && !editor.dom.isChildOf(targetElm, rootNode)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function umarkFragmentElements(elm) {
- Tools.each(elm.getElementsByTagName('*'), function (elm) {
- elm.removeAttribute('data-mce-fragment');
- });
- }
-
- function isPartOfFragment(node) {
- return !!node.getAttribute('data-mce-fragment');
- }
-
- function canHaveChildren(node) {
- return node && !editor.schema.getShortEndedElements()[node.nodeName];
- }
-
- function moveSelectionToMarker(marker) {
- var parentEditableFalseElm, parentBlock, nextRng;
-
- function getContentEditableFalseParent(node) {
- var root = editor.getBody();
-
- for (; node && node !== root; node = node.parentNode) {
- if (editor.dom.getContentEditable(node) === 'false') {
- return node;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_dy1qjd4ejfuw8m0u.isXYInContentArea(editor, e.clientX, e.clientY) === false) {
+ return;
+ }
+ contentEditableRoot = getContentEditableRoot$1(editor, targetElm);
+ if (contentEditableRoot) {
+ if (isContentEditableFalse$9(contentEditableRoot)) {
+ e.preventDefault();
+ setContentEditableSelection(selectNode(editor, contentEditableRoot));
+ } else {
+ removeContentEditableSelection();
+ if (!(isContentEditableTrue$5(contentEditableRoot) && e.shiftKey) && !$_ew17fe57jfuw8m5c.isXYWithinRange(e.clientX, e.clientY, editor.selection.getRng())) {
+ editor.selection.placeCaretAt(e.clientX, e.clientY);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (isFakeCaretTarget(targetElm) === false) {
+ removeContentEditableSelection();
+ hideFakeCaret();
+ var caretInfo = closestCaret(rootNode, e.clientX, e.clientY);
+ if (caretInfo) {
+ if (!hasBetterMouseTarget(e.target, caretInfo.node)) {
+ e.preventDefault();
+ var range = showCaret$$1(1, caretInfo.node, caretInfo.before, false);
+ editor.getBody().focus();
+ setRange(range);
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!marker) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('keypress', function (e) {
+ if ($_1nvqmv5ajfuw8m5j.modifierPressed(e)) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- selection.scrollIntoView(marker);
-
- // If marker is in cE=false then move selection to that element instead
- parentEditableFalseElm = getContentEditableFalseParent(marker);
- if (parentEditableFalseElm) {
- dom.remove(marker);
- selection.select(parentEditableFalseElm);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch (e.keyCode) {
+ default:
+ if (isContentEditableFalse$9(editor.selection.getNode())) {
+ e.preventDefault();
+ }
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Move selection before marker and remove it
- rng = dom.createRng();
-
- // If previous sibling is a text node set the selection to the end of that node
- node = marker.previousSibling;
- if (node && node.nodeType == 3) {
- rng.setStart(node, node.nodeValue.length);
-
- // TODO: Why can't we normalize on IE
- if (!Env.ie) {
- node2 = marker.nextSibling;
- if (node2 && node2.nodeType == 3) {
- node.appendData(node2.data);
- node2.parentNode.removeChild(node2);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('getSelectionRange', function (e) {
+ var rng = e.range;
+ if (selectedContentEditableNode) {
+ if (!selectedContentEditableNode.parentNode) {
+ selectedContentEditableNode = null;
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- // If the previous sibling isn't a text node or doesn't exist set the selection before the marker node
- rng.setStartBefore(marker);
- rng.setEndBefore(marker);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ rng = rng.cloneRange();
+ rng.selectNode(selectedContentEditableNode);
+ e.range = rng;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function findNextCaretRng(rng) {
- var caretPos = CaretPosition.fromRangeStart(rng);
- var caretWalker = new CaretWalker(editor.getBody());
-
- caretPos = caretWalker.next(caretPos);
- if (caretPos) {
- return caretPos.toRange();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('setSelectionRange', function (e) {
+ var rng;
+ rng = setContentEditableSelection(e.range, e.forward);
+ if (rng) {
+ e.range = rng;
+ }
+ });
+ editor.on('AfterSetSelectionRange', function (e) {
+ var rng = e.range;
+ if (!isRangeInCaretContainer(rng)) {
+ hideFakeCaret();
+ }
+ if (!isFakeSelectionElement(rng.startContainer.parentNode)) {
+ removeContentEditableSelection();
+ }
+ });
+ editor.on('copy', function (e) {
+ var clipboardData = e.clipboardData;
+ if (!e.isDefaultPrevented() && e.clipboardData && !$_9fhi43ajfuw8l13.ie) {
+ var realSelectionElement = getRealSelectionElement();
+ if (realSelectionElement) {
+ e.preventDefault();
+ clipboardData.clearData();
+ clipboardData.setData('text/html', realSelectionElement.outerHTML);
+ clipboardData.setData('text/plain', realSelectionElement.outerText);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove the marker node and set the new range
- parentBlock = dom.getParent(marker, dom.isBlock);
- dom.remove(marker);
-
- if (parentBlock && dom.isEmpty(parentBlock)) {
- editor.$(parentBlock).empty();
-
- rng.setStart(parentBlock, 0);
- rng.setEnd(parentBlock, 0);
-
- if (!isTableCell(parentBlock) && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) {
- rng = nextRng;
- dom.remove(parentBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ $_7g0llv52jfuw8m4f.init(editor);
+ $_eq1t5458jfuw8m5e.setup(editor);
+ };
+ var addCss = function () {
+ var styles = editor.contentStyles, rootClass = '.mce-content-body';
+ styles.push(fakeCaret.getCss());
+ styles.push(rootClass + ' .mce-offscreen-selection {' + 'position: absolute;' + 'left: -9999999999px;' + 'max-width: 1000000px;' + '}' + rootClass + ' *[contentEditable=false] {' + 'cursor: default;' + '}' + rootClass + ' *[contentEditable=true] {' + 'cursor: text;' + '}');
+ };
+ var isWithinCaretContainer = function (node) {
+ return isCaretContainer(node) || startsWithCaretContainer(node) || endsWithCaretContainer(node);
+ };
+ var isRangeInCaretContainer = function (rng) {
+ return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer);
+ };
+ var setContentEditableSelection = function (range, forward) {
+ var node;
+ var $ = editor.$;
+ var dom = editor.dom;
+ var $realSelectionContainer, sel, startContainer, startOffset, endOffset, e, caretPosition, targetClone, origTargetClone;
+ if (!range) {
+ return null;
+ }
+ if (range.collapsed) {
+ if (!isRangeInCaretContainer(range)) {
+ if (forward === false) {
+ caretPosition = getNormalizedRangeEndPoint$$1(-1, range);
+ if (isFakeCaretTarget(caretPosition.getNode(true))) {
+ return showCaret$$1(-1, caretPosition.getNode(true), false, false);
+ }
+ if (isFakeCaretTarget(caretPosition.getNode())) {
+ return showCaret$$1(-1, caretPosition.getNode(), !caretPosition.isAtEnd(), false);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- dom.add(parentBlock, dom.create('br', { 'data-mce-bogus': '1' }));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ caretPosition = getNormalizedRangeEndPoint$$1(1, range);
+ if (isFakeCaretTarget(caretPosition.getNode())) {
+ return showCaret$$1(1, caretPosition.getNode(), !caretPosition.isAtEnd(), false);
+ }
+ if (isFakeCaretTarget(caretPosition.getNode(true))) {
+ return showCaret$$1(1, caretPosition.getNode(true), false, false);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- selection.setRng(rng);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Check for whitespace before/after value
- if (/^ | $/.test(value)) {
- value = trimOrPaddLeftRight(value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ startContainer = range.startContainer;
+ startOffset = range.startOffset;
+ endOffset = range.endOffset;
+ if (startContainer.nodeType === 3 && startOffset === 0 && isContentEditableFalse$9(startContainer.parentNode)) {
+ startContainer = startContainer.parentNode;
+ startOffset = dom.nodeIndex(startContainer);
+ startContainer = startContainer.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Setup parser and serializer
- parser = editor.parser;
- merge = details.merge;
-
- serializer = new Serializer({
- validate: editor.settings.validate
- }, editor.schema);
- bookmarkHtml = '<span id="mce_marker" data-mce-type="bookmark">​</span>';
-
- // Run beforeSetContent handlers on the HTML to be inserted
- args = { content: value, format: 'html', selection: true };
- editor.fire('BeforeSetContent', args);
- value = args.content;
-
- // Add caret at end of contents if it's missing
- if (value.indexOf('{$caret}') == -1) {
- value += '{$caret}';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (startContainer.nodeType !== 1) {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Replace the caret marker with a span bookmark element
- value = value.replace(/\{\$caret\}/, bookmarkHtml);
-
- // If selection is at <body>|<p></p> then move it into <body><p>|</p>
- rng = selection.getRng();
- var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null);
- var body = editor.getBody();
- if (caretElement === body && selection.isCollapsed()) {
- if (dom.isBlock(body.firstChild) && canHaveChildren(body.firstChild) && dom.isEmpty(body.firstChild)) {
- rng = dom.createRng();
- rng.setStart(body.firstChild, 0);
- rng.setEnd(body.firstChild, 0);
- selection.setRng(rng);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (endOffset === startOffset + 1) {
+ node = startContainer.childNodes[startOffset];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Insert node maker where we will insert the new HTML and get it's parent
- if (!selection.isCollapsed()) {
- // Fix for #2595 seems that delete removes one extra character on
- // WebKit for some odd reason if you double click select a word
- editor.selection.setRng(RangeNormalizer.normalize(editor.selection.getRng()));
- editor.getDoc().execCommand('Delete', false, null);
- trimNbspAfterDeleteAndPaddValue();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!isContentEditableFalse$9(node)) {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- parentNode = selection.getNode();
-
- // Parse the fragment within the context of the parent node
- var parserArgs = { context: parentNode.nodeName.toLowerCase(), data: details.data };
- fragment = parser.parse(value, parserArgs);
-
- // Custom handling of lists
- if (details.paste === true && InsertList.isListFragment(editor.schema, fragment) && InsertList.isParentBlockLi(dom, parentNode)) {
- rng = InsertList.insertAtCaret(serializer, dom, editor.selection.getRng(true), fragment);
- editor.selection.setRng(rng);
- editor.fire('SetContent', args);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ targetClone = origTargetClone = node.cloneNode(true);
+ e = editor.fire('ObjectSelected', {
+ target: node,
+ targetClone: targetClone
+ });
+ if (e.isDefaultPrevented()) {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- markFragmentElements(fragment);
-
- // Move the caret to a more suitable location
- node = fragment.lastChild;
- if (node.attr('id') == 'mce_marker') {
- marker = node;
-
- for (node = node.prev; node; node = node.walk(true)) {
- if (node.type == 3 || !dom.isBlock(node.name)) {
- if (editor.schema.isValidChild(node.parent.name, 'span')) {
- node.parent.insert(marker, node, node.name === 'br');
- }
- break;
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $realSelectionContainer = $_94zo1v3cjfuw8lpg.descendant($_c9h6qlzjfuw8l98.fromDom(editor.getBody()), '#' + realSelectionId).fold(function () {
+ return $([]);
+ }, function (elm) {
+ return $([elm.dom()]);
+ });
+ targetClone = e.targetClone;
+ if ($realSelectionContainer.length === 0) {
+ $realSelectionContainer = $('<div data-mce-bogus="all" class="mce-offscreen-selection"></div>').attr('id', realSelectionId);
+ $realSelectionContainer.appendTo(editor.getBody());
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor._selectionOverrides.showBlockCaretContainer(parentNode);
-
- // If parser says valid we can insert the contents into that parent
- if (!parserArgs.invalid) {
- value = serializer.serialize(fragment);
- validInsertion(editor, value, parentNode);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ range = editor.dom.createRng();
+ if (targetClone === origTargetClone && $_9fhi43ajfuw8l13.ie) {
+ $realSelectionContainer.empty().append('<p style="font-size: 0" data-mce-bogus="all">\xA0</p>').append(targetClone);
+ range.setStartAfter($realSelectionContainer[0].firstChild.firstChild);
+ range.setEndAfter(targetClone);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If the fragment was invalid within that context then we need
- // to parse and process the parent it's inserted into
-
- // Insert bookmark node and get the parent
- selection.setContent(bookmarkHtml);
- parentNode = selection.getNode();
- rootNode = editor.getBody();
-
- // Opera will return the document node when selection is in root
- if (parentNode.nodeType == 9) {
- parentNode = node = rootNode;
- } else {
- node = parentNode;
- }
-
- // Find the ancestor just before the root element
- while (node !== rootNode) {
- parentNode = node;
- node = node.parentNode;
- }
-
- // Get the outer/inner HTML depending on if we are in the root and parser and serialize that
- value = parentNode == rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode);
- value = serializer.serialize(
- parser.parse(
- // Need to replace by using a function since $ in the contents would otherwise be a problem
- value.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i, function () {
- return serializer.serialize(fragment);
- })
- )
- );
-
- // Set the inner/outer HTML depending on if we are in the root or not
- if (parentNode == rootNode) {
- dom.setHTML(rootNode, value);
- } else {
- dom.setOuterHTML(parentNode, value);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $realSelectionContainer.empty().append('\xA0').append(targetClone).append('\xA0');
+ range.setStart($realSelectionContainer[0].firstChild, 1);
+ range.setEnd($realSelectionContainer[0].lastChild, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- reduceInlineTextElements();
- moveSelectionToMarker(dom.get('mce_marker'));
- umarkFragmentElements(editor.getBody());
- trimBrsFromTableCell(editor.dom, editor.selection.getStart());
-
- editor.fire('SetContent', args);
- editor.addVisual();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $realSelectionContainer.css({ top: dom.getPos(node, editor.getBody()).y });
+ $realSelectionContainer[0].focus();
+ sel = editor.selection.getSel();
+ sel.removeAllRanges();
+ sel.addRange(range);
+ $_9ek1bp4jfuw8kxg.each($_ryxde2gjfuw8lkk.descendants($_c9h6qlzjfuw8l98.fromDom(editor.getBody()), '*[data-mce-selected]'), function (elm) {
+ $_8g002u14jfuw8la5.remove(elm, 'data-mce-selected');
+ });
+ node.setAttribute('data-mce-selected', '1');
+ selectedContentEditableNode = node;
+ hideFakeCaret();
+ return range;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var processValue = function (value) {
- var details;
-
- if (typeof value !== 'string') {
- details = Tools.extend({
- paste: value.paste,
- data: {
- paste: value.paste
- }
- }, value);
-
- return {
- content: value.content,
- details: details
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var removeContentEditableSelection = function () {
+ if (selectedContentEditableNode) {
+ selectedContentEditableNode.removeAttribute('data-mce-selected');
+ $_94zo1v3cjfuw8lpg.descendant($_c9h6qlzjfuw8l98.fromDom(editor.getBody()), '#' + realSelectionId).each($_byg6a92ujfuw8lmi.remove);
+ selectedContentEditableNode = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- content: value,
- details: {}
- };
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var insertAtCaret = function (editor, value) {
- var result = processValue(value);
- insertHtmlAtCaret(editor, result.content, result.details);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var destroy = function () {
+ fakeCaret.destroy();
+ selectedContentEditableNode = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hideFakeCaret = function () {
+ fakeCaret.hide();
+ };
+ if ($_9fhi43ajfuw8l13.ceFalse) {
+ registerEvents();
+ addCss();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- insertAtCaret: insertAtCaret
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ showCaret: showCaret$$1,
+ showBlockCaretContainer: showBlockCaretContainer,
+ hideFakeCaret: hideFakeCaret,
+ destroy: destroy
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * EditorCommands.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * This class enables you to add custom editor commands and it contains
- * overrides for native browser commands to address various bugs and issues.
- *
- * @class tinymce.EditorCommands
- */
-define(
- 'tinymce.core.EditorCommands',
- [
- 'tinymce.core.delete.DeleteCommands',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.dom.TreeWalker',
- 'tinymce.core.Env',
- 'tinymce.core.InsertContent',
- 'tinymce.core.util.Tools'
- ],
- function (DeleteCommands, NodeType, RangeUtils, TreeWalker, Env, InsertContent, Tools) {
- // Added for compression purposes
- var each = Tools.each, extend = Tools.extend;
- var map = Tools.map, inArray = Tools.inArray, explode = Tools.explode;
- var isOldIE = Env.ie && Env.ie < 11;
- var TRUE = true, FALSE = false;
-
- return function (editor) {
- var dom, selection, formatter,
- commands = { state: {}, exec: {}, value: {} },
- settings = editor.settings,
- bookmark;
-
- editor.on('PreInit', function () {
- dom = editor.dom;
- selection = editor.selection;
- settings = editor.settings;
- formatter = editor.formatter;
- });
-
- /**
- * Executes the specified command.
- *
- * @method execCommand
- * @param {String} command Command to execute.
- * @param {Boolean} ui Optional user interface state.
- * @param {Object} value Optional value for command.
- * @param {Object} args Optional extra arguments to the execCommand.
- * @return {Boolean} true/false if the command was found or not.
- */
- function execCommand(command, ui, value, args) {
- var func, customCommand, state = 0;
-
- if (editor.removed) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$11 = $_52qop8kjfuw8l6v.each;
+ var isValidPrefixAttrName = function (name) {
+ return name.indexOf('data-') === 0 || name.indexOf('aria-') === 0;
+ };
+ var trimComments = function (text) {
+ return text.replace(/<!--|-->/g, '');
+ };
+ var findEndTagIndex = function (schema, html, startIndex) {
+ var count = 1, index, matches, tokenRegExp, shortEndedElements;
+ shortEndedElements = schema.getShortEndedElements();
+ tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g;
+ tokenRegExp.lastIndex = index = startIndex;
+ while (matches = tokenRegExp.exec(html)) {
+ index = tokenRegExp.lastIndex;
+ if (matches[1] === '/') {
+ count--;
+ } else if (!matches[1]) {
+ if (matches[2] in shortEndedElements) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) {
- editor.focus();
- }
-
- args = editor.fire('BeforeExecCommand', { command: command, ui: ui, value: value });
- if (args.isDefaultPrevented()) {
- return false;
- }
-
- customCommand = command.toLowerCase();
- if ((func = commands.exec[customCommand])) {
- func(customCommand, ui, value);
- editor.fire('ExecCommand', { command: command, ui: ui, value: value });
- return true;
- }
-
- // Plugin commands
- each(editor.plugins, function (p) {
- if (p.execCommand && p.execCommand(command, ui, value)) {
- editor.fire('ExecCommand', { command: command, ui: ui, value: value });
- state = true;
- return false;
- }
- });
-
- if (state) {
- return state;
- }
-
- // Theme commands
- if (editor.theme && editor.theme.execCommand && editor.theme.execCommand(command, ui, value)) {
- editor.fire('ExecCommand', { command: command, ui: ui, value: value });
- return true;
- }
-
- // Browser commands
- try {
- state = editor.getDoc().execCommand(command, ui, value);
- } catch (ex) {
- // Ignore old IE errors
- }
-
- if (state) {
- editor.fire('ExecCommand', { command: command, ui: ui, value: value });
- return true;
- }
-
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ count++;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Queries the current state for a command for example if the current selection is "bold".
- *
- * @method queryCommandState
- * @param {String} command Command to check the state of.
- * @return {Boolean/Number} true/false if the selected contents is bold or not, -1 if it's not found.
- */
- function queryCommandState(command) {
- var func;
-
- if (editor.quirks.isHidden() || editor.removed) {
- return;
- }
-
- command = command.toLowerCase();
- if ((func = commands.state[command])) {
- return func(command);
- }
-
- // Browser commands
- try {
- return editor.getDoc().queryCommandState(command);
- } catch (ex) {
- // Fails sometimes see bug: 1896577
- }
-
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (count === 0) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Queries the command value for example the current fontsize.
- *
- * @method queryCommandValue
- * @param {String} command Command to check the value of.
- * @return {Object} Command value of false if it's not found.
- */
- function queryCommandValue(command) {
- var func;
-
- if (editor.quirks.isHidden() || editor.removed) {
- return;
- }
-
- command = command.toLowerCase();
- if ((func = commands.value[command])) {
- return func(command);
- }
-
- // Browser commands
- try {
- return editor.getDoc().queryCommandValue(command);
- } catch (ex) {
- // Fails sometimes see bug: 1896577
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return index;
+ };
+ function SaxParser(settings, schema) {
+ if (schema === void 0) {
+ schema = Schema();
+ }
+ var noop = function () {
+ };
+ settings = settings || {};
+ if (settings.fix_self_closing !== false) {
+ settings.fix_self_closing = true;
+ }
+ each$11('comment cdata text start end pi doctype'.split(' '), function (name) {
+ if (name) {
+ self[name] = settings[name] || noop;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Adds commands to the command collection.
- *
- * @method addCommands
- * @param {Object} commandList Name/value collection with commands to add, the names can also be comma separated.
- * @param {String} type Optional type to add, defaults to exec. Can be value or state as well.
- */
- function addCommands(commandList, type) {
- type = type || 'exec';
-
- each(commandList, function (callback, command) {
- each(command.toLowerCase().split(','), function (command) {
- commands[type][command] = callback;
- });
- });
- }
-
- function addCommand(command, callback, scope) {
- command = command.toLowerCase();
- commands.exec[command] = function (command, ui, value, args) {
- return callback.call(scope || editor, ui, value, args);
- };
- }
-
- /**
- * Returns true/false if the command is supported or not.
- *
- * @method queryCommandSupported
- * @param {String} command Command that we check support for.
- * @return {Boolean} true/false if the command is supported or not.
- */
- function queryCommandSupported(command) {
- command = command.toLowerCase();
-
- if (commands.exec[command]) {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ var comment = settings.comment ? settings.comment : noop;
+ var cdata = settings.cdata ? settings.cdata : noop;
+ var text = settings.text ? settings.text : noop;
+ var start = settings.start ? settings.start : noop;
+ var end = settings.end ? settings.end : noop;
+ var pi = settings.pi ? settings.pi : noop;
+ var doctype = settings.doctype ? settings.doctype : noop;
+ var parse = function (html) {
+ var matches, index = 0, value, endRegExp;
+ var stack = [];
+ var attrList, i, textData, name;
+ var isInternalElement, removeInternalElements, shortEndedElements, fillAttrsMap, isShortEnded;
+ var validate, elementRule, isValidElement, attr, attribsValue, validAttributesMap, validAttributePatterns;
+ var attributesRequired, attributesDefault, attributesForced, processHtml;
+ var anyAttributesRequired, selfClosing, tokenRegExp, attrRegExp, specialElements, attrValue, idCount = 0;
+ var decode = $_8uzsfe1rjfuw8ldm.decode;
+ var fixSelfClosing;
+ var filteredUrlAttrs = $_52qop8kjfuw8l6v.makeMap('src,href,data,background,formaction,poster');
+ var scriptUriRegExp = /((java|vb)script|mhtml):/i, dataUriRegExp = /^data:/i;
+ var processEndTag = function (name) {
+ var pos, i;
+ pos = stack.length;
+ while (pos--) {
+ if (stack[pos].name === name) {
+ break;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Browser commands
- try {
- return editor.getDoc().queryCommandSupported(command);
- } catch (ex) {
- // Fails sometimes see bug: 1896577
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (pos >= 0) {
+ for (i = stack.length - 1; i >= pos; i--) {
+ name = stack[i];
+ if (name.valid) {
+ end(name.name);
+ }
+ }
+ stack.length = pos;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
- }
-
- function addQueryStateHandler(command, callback, scope) {
- command = command.toLowerCase();
- commands.state[command] = function () {
- return callback.call(scope || editor);
- };
- }
-
- function addQueryValueHandler(command, callback, scope) {
- command = command.toLowerCase();
- commands.value[command] = function () {
- return callback.call(scope || editor);
- };
- }
-
- function hasCustomCommand(command) {
- command = command.toLowerCase();
- return !!commands.exec[command];
- }
-
- // Expose public methods
- extend(this, {
- execCommand: execCommand,
- queryCommandState: queryCommandState,
- queryCommandValue: queryCommandValue,
- queryCommandSupported: queryCommandSupported,
- addCommands: addCommands,
- addCommand: addCommand,
- addQueryStateHandler: addQueryStateHandler,
- addQueryValueHandler: addQueryValueHandler,
- hasCustomCommand: hasCustomCommand
- });
-
- // Private methods
-
- function execNativeCommand(command, ui, value) {
- if (ui === undefined) {
- ui = FALSE;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var parseAttribute = function (match, name, value, val2, val3) {
+ var attrRule, i;
+ var trimRegExp = /[\s\u0000-\u001F]+/g;
+ name = name.toLowerCase();
+ value = name in fillAttrsMap ? name : decode(value || val2 || val3 || '');
+ if (validate && !isInternalElement && isValidPrefixAttrName(name) === false) {
+ attrRule = validAttributesMap[name];
+ if (!attrRule && validAttributePatterns) {
+ i = validAttributePatterns.length;
+ while (i--) {
+ attrRule = validAttributePatterns[i];
+ if (attrRule.pattern.test(name)) {
+ break;
+ }
+ }
+ if (i === -1) {
+ attrRule = null;
+ }
+ }
+ if (!attrRule) {
+ return;
+ }
+ if (attrRule.validValues && !(value in attrRule.validValues)) {
+ return;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (value === undefined) {
- value = null;
- }
-
- return editor.getDoc().execCommand(command, ui, value);
- }
-
- function isFormatMatch(name) {
- return formatter.match(name);
- }
-
- function toggleFormat(name, value) {
- formatter.toggle(name, value ? { value: value } : undefined);
- editor.nodeChanged();
- }
-
- function storeSelection(type) {
- bookmark = selection.getBookmark(type);
- }
-
- function restoreSelection() {
- selection.moveToBookmark(bookmark);
- }
-
- // Add execCommand overrides
- addCommands({
- // Ignore these, added for compatibility
- 'mceResetDesignMode,mceBeginUndoLevel': function () { },
-
- // Add undo manager logic
- 'mceEndUndoLevel,mceAddUndoLevel': function () {
- editor.undoManager.add();
- },
-
- 'Cut,Copy,Paste': function (command) {
- var doc = editor.getDoc(), failed;
-
- // Try executing the native command
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (filteredUrlAttrs[name] && !settings.allow_script_urls) {
+ var uri = value.replace(trimRegExp, '');
</ins><span class="cx" style="display: block; padding: 0 10px"> try {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- execNativeCommand(command);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ uri = decodeURIComponent(uri);
</ins><span class="cx" style="display: block; padding: 0 10px"> } catch (ex) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Command failed
- failed = TRUE;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ uri = unescape(uri);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Chrome reports the paste command as supported however older IE:s will return false for cut/paste
- if (command === 'paste' && !doc.queryCommandEnabled(command)) {
- failed = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (scriptUriRegExp.test(uri)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Present alert message about clipboard access not being available
- if (failed || !doc.queryCommandSupported(command)) {
- var msg = editor.translate(
- "Your browser doesn't support direct access to the clipboard. " +
- "Please use the Ctrl+X/C/V keyboard shortcuts instead."
- );
-
- if (Env.mac) {
- msg = msg.replace(/Ctrl\+/g, '\u2318+');
- }
-
- editor.notificationManager.open({ text: msg, type: 'error' });
- }
- },
-
- // Override unlink command
- unlink: function () {
- if (selection.isCollapsed()) {
- var elm = editor.dom.getParent(editor.selection.getStart(), 'a');
- if (elm) {
- editor.dom.remove(elm, true);
- }
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!settings.allow_html_data_urls && dataUriRegExp.test(uri) && !/^data:image\//i.test(uri)) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- formatter.remove("link");
- },
-
- // Override justify commands to use the text formatter engine
- 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone': function (command) {
- var align = command.substring(7);
-
- if (align == 'full') {
- align = 'justify';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (isInternalElement && (name in filteredUrlAttrs || name.indexOf('on') === 0)) {
+ return;
+ }
+ attrList.map[name] = value;
+ attrList.push({
+ name: name,
+ value: value
+ });
+ };
+ tokenRegExp = new RegExp('<(?:' + '(?:!--([\\w\\W]*?)-->)|' + '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + '(?:!DOCTYPE([\\w\\W]*?)>)|' + '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + '(?:\\/([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)>)|' + '(?:([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + ')', 'g');
+ attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g;
+ shortEndedElements = schema.getShortEndedElements();
+ selfClosing = settings.self_closing_elements || schema.getSelfClosingElements();
+ fillAttrsMap = schema.getBoolAttrs();
+ validate = settings.validate;
+ removeInternalElements = settings.remove_internals;
+ fixSelfClosing = settings.fix_self_closing;
+ specialElements = schema.getSpecialElements();
+ processHtml = html + '>';
+ while (matches = tokenRegExp.exec(processHtml)) {
+ if (index < matches.index) {
+ text(decode(html.substr(index, matches.index - index)));
+ }
+ if (value = matches[6]) {
+ value = value.toLowerCase();
+ if (value.charAt(0) === ':') {
+ value = value.substr(1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Remove all other alignments first
- each('left,center,right,justify'.split(','), function (name) {
- if (align != name) {
- formatter.remove('align' + name);
- }
- });
-
- if (align != 'none') {
- toggleFormat('align' + align);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ processEndTag(value);
+ } else if (value = matches[7]) {
+ if (matches.index + matches[0].length > html.length) {
+ text(decode(html.substr(matches.index)));
+ index = matches.index + matches[0].length;
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- // Override list commands to fix WebKit bug
- 'InsertUnorderedList,InsertOrderedList': function (command) {
- var listElm, listParent;
-
- execNativeCommand(command);
-
- // WebKit produces lists within block elements so we need to split them
- // we will replace the native list creation logic to custom logic later on
- // TODO: Remove this when the list creation logic is removed
- listElm = dom.getParent(selection.getNode(), 'ol,ul');
- if (listElm) {
- listParent = listElm.parentNode;
-
- // If list is within a text block then split that block
- if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {
- storeSelection();
- dom.split(listParent, listElm);
- restoreSelection();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ value = value.toLowerCase();
+ if (value.charAt(0) === ':') {
+ value = value.substr(1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- // Override commands to use the text formatter engine
- 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) {
- toggleFormat(command);
- },
-
- // Override commands to use the text formatter engine
- 'ForeColor,HiliteColor,FontName': function (command, ui, value) {
- toggleFormat(command, value);
- },
-
- FontSize: function (command, ui, value) {
- var fontClasses, fontSizes;
-
- // Convert font size 1-7 to styles
- if (value >= 1 && value <= 7) {
- fontSizes = explode(settings.font_size_style_values);
- fontClasses = explode(settings.font_size_classes);
-
- if (fontClasses) {
- value = fontClasses[value - 1] || value;
- } else {
- value = fontSizes[value - 1] || value;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ isShortEnded = value in shortEndedElements;
+ if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value) {
+ processEndTag(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- toggleFormat(command, value);
- },
-
- RemoveFormat: function (command) {
- formatter.remove(command);
- },
-
- mceBlockQuote: function () {
- toggleFormat('blockquote');
- },
-
- FormatBlock: function (command, ui, value) {
- return toggleFormat(value || 'p');
- },
-
- mceCleanup: function () {
- var bookmark = selection.getBookmark();
-
- editor.setContent(editor.getContent({ cleanup: TRUE }), { cleanup: TRUE });
-
- selection.moveToBookmark(bookmark);
- },
-
- mceRemoveNode: function (command, ui, value) {
- var node = value || selection.getNode();
-
- // Make sure that the body node isn't removed
- if (node != editor.getBody()) {
- storeSelection();
- editor.dom.remove(node, TRUE);
- restoreSelection();
- }
- },
-
- mceSelectNodeDepth: function (command, ui, value) {
- var counter = 0;
-
- dom.getParent(selection.getNode(), function (node) {
- if (node.nodeType == 1 && counter++ == value) {
- selection.select(node);
- return FALSE;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!validate || (elementRule = schema.getElementRule(value))) {
+ isValidElement = true;
+ if (validate) {
+ validAttributesMap = elementRule.attributes;
+ validAttributePatterns = elementRule.attributePatterns;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }, editor.getBody());
- },
-
- mceSelectNode: function (command, ui, value) {
- selection.select(value);
- },
-
- mceInsertContent: function (command, ui, value) {
- InsertContent.insertAtCaret(editor, value);
- },
-
- mceInsertRawHTML: function (command, ui, value) {
- selection.setContent('tiny_mce_marker');
- editor.setContent(
- editor.getContent().replace(/tiny_mce_marker/g, function () {
- return value;
- })
- );
- },
-
- mceToggleFormat: function (command, ui, value) {
- toggleFormat(value);
- },
-
- mceSetContent: function (command, ui, value) {
- editor.setContent(value);
- },
-
- 'Indent,Outdent': function (command) {
- var intentValue, indentUnit, value;
-
- // Setup indent level
- intentValue = settings.indentation;
- indentUnit = /[a-z%]+$/i.exec(intentValue);
- intentValue = parseInt(intentValue, 10);
-
- if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) {
- // If forced_root_blocks is set to false we don't have a block to indent so lets create a div
- if (!settings.forced_root_block && !dom.getParent(selection.getNode(), dom.isBlock)) {
- formatter.apply('div');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (attribsValue = matches[8]) {
+ isInternalElement = attribsValue.indexOf('data-mce-type') !== -1;
+ if (isInternalElement && removeInternalElements) {
+ isValidElement = false;
+ }
+ attrList = [];
+ attrList.map = {};
+ attribsValue.replace(attrRegExp, parseAttribute);
+ } else {
+ attrList = [];
+ attrList.map = {};
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- each(selection.getSelectedBlocks(), function (element) {
- if (dom.getContentEditable(element) === "false") {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (validate && !isInternalElement) {
+ attributesRequired = elementRule.attributesRequired;
+ attributesDefault = elementRule.attributesDefault;
+ attributesForced = elementRule.attributesForced;
+ anyAttributesRequired = elementRule.removeEmptyAttrs;
+ if (anyAttributesRequired && !attrList.length) {
+ isValidElement = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (element.nodeName !== "LI") {
- var indentStyleName = editor.getParam('indent_use_margin', false) ? 'margin' : 'padding';
- indentStyleName = element.nodeName === 'TABLE' ? 'margin' : indentStyleName;
- indentStyleName += dom.getStyle(element, 'direction', true) == 'rtl' ? 'Right' : 'Left';
-
- if (command == 'outdent') {
- value = Math.max(0, parseInt(element.style[indentStyleName] || 0, 10) - intentValue);
- dom.setStyle(element, indentStyleName, value ? value + indentUnit : '');
- } else {
- value = (parseInt(element.style[indentStyleName] || 0, 10) + intentValue) + indentUnit;
- dom.setStyle(element, indentStyleName, value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (attributesForced) {
+ i = attributesForced.length;
+ while (i--) {
+ attr = attributesForced[i];
+ name = attr.name;
+ attrValue = attr.value;
+ if (attrValue === '{$uid}') {
+ attrValue = 'mce_' + idCount++;
+ }
+ attrList.map[name] = attrValue;
+ attrList.push({
+ name: name,
+ value: attrValue
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- } else {
- execNativeCommand(command);
- }
- },
-
- mceRepaint: function () {
- },
-
- InsertHorizontalRule: function () {
- editor.execCommand('mceInsertContent', false, '<hr />');
- },
-
- mceToggleVisualAid: function () {
- editor.hasVisual = !editor.hasVisual;
- editor.addVisual();
- },
-
- mceReplaceContent: function (command, ui, value) {
- editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, selection.getContent({ format: 'text' })));
- },
-
- mceInsertLink: function (command, ui, value) {
- var anchor;
-
- if (typeof value == 'string') {
- value = { href: value };
- }
-
- anchor = dom.getParent(selection.getNode(), 'a');
-
- // Spaces are never valid in URLs and it's a very common mistake for people to make so we fix it here.
- value.href = value.href.replace(' ', '%20');
-
- // Remove existing links if there could be child links or that the href isn't specified
- if (!anchor || !value.href) {
- formatter.remove('link');
- }
-
- // Apply new link to selection
- if (value.href) {
- formatter.apply('link', value, anchor);
- }
- },
-
- selectAll: function () {
- var root = dom.getRoot(), rng;
-
- if (selection.getRng().setStart) {
- var editingHost = dom.getParent(selection.getStart(), NodeType.isContentEditableTrue);
- if (editingHost) {
- rng = dom.createRng();
- rng.selectNodeContents(editingHost);
- selection.setRng(rng);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (attributesDefault) {
+ i = attributesDefault.length;
+ while (i--) {
+ attr = attributesDefault[i];
+ name = attr.name;
+ if (!(name in attrList.map)) {
+ attrValue = attr.value;
+ if (attrValue === '{$uid}') {
+ attrValue = 'mce_' + idCount++;
+ }
+ attrList.map[name] = attrValue;
+ attrList.push({
+ name: name,
+ value: attrValue
+ });
+ }
+ }
+ }
+ if (attributesRequired) {
+ i = attributesRequired.length;
+ while (i--) {
+ if (attributesRequired[i] in attrList.map) {
+ break;
+ }
+ }
+ if (i === -1) {
+ isValidElement = false;
+ }
+ }
+ if (attr = attrList.map['data-mce-bogus']) {
+ if (attr === 'all') {
+ index = findEndTagIndex(schema, html, tokenRegExp.lastIndex);
+ tokenRegExp.lastIndex = index;
+ continue;
+ }
+ isValidElement = false;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isValidElement) {
+ start(value, attrList, isShortEnded);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // IE will render it's own root level block elements and sometimes
- // even put font elements in them when the user starts typing. So we need to
- // move the selection to a more suitable element from this:
- // <body>|<p></p></body> to this: <body><p>|</p></body>
- rng = selection.getRng();
- if (!rng.item) {
- rng.moveToElementText(root);
- rng.select();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ isValidElement = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- "delete": function () {
- DeleteCommands.deleteCommand(editor);
- },
-
- "forwardDelete": function () {
- DeleteCommands.forwardDeleteCommand(editor);
- },
-
- mceNewDocument: function () {
- editor.setContent('');
- },
-
- InsertLineBreak: function (command, ui, value) {
- // We load the current event in from EnterKey.js when appropriate to heed
- // certain event-specific variations such as ctrl-enter in a list
- var evt = value;
- var brElm, extraBr, marker;
- var rng = selection.getRng(true);
- new RangeUtils(dom).normalize(rng);
-
- var offset = rng.startOffset;
- var container = rng.startContainer;
-
- // Resolve node index
- if (container.nodeType == 1 && container.hasChildNodes()) {
- var isAfterLastNodeInContainer = offset > container.childNodes.length - 1;
-
- container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
- if (isAfterLastNodeInContainer && container.nodeType == 3) {
- offset = container.nodeValue.length;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (endRegExp = specialElements[value]) {
+ endRegExp.lastIndex = index = matches.index + matches[0].length;
+ if (matches = endRegExp.exec(html)) {
+ if (isValidElement) {
+ textData = html.substr(index, matches.index - index);
+ }
+ index = matches.index + matches[0].length;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- offset = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ textData = html.substr(index);
+ index = html.length;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- var parentBlock = dom.getParent(container, dom.isBlock);
- var parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
- var containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;
- var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
-
- // Enter inside block contained within a LI then split or insert before/after LI
- var isControlKey = evt && evt.ctrlKey;
- if (containerBlockName == 'LI' && !isControlKey) {
- parentBlock = containerBlock;
- parentBlockName = containerBlockName;
- }
-
- // Walks the parent block to the right and look for BR elements
- function hasRightSideContent() {
- var walker = new TreeWalker(container, parentBlock), node;
- var nonEmptyElementsMap = editor.schema.getNonEmptyElements();
-
- while ((node = walker.next())) {
- if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isValidElement) {
+ if (textData.length > 0) {
+ text(textData, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ end(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ tokenRegExp.lastIndex = index;
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
- // Insert extra BR element at the end block elements
- if (!isOldIE && !hasRightSideContent()) {
- brElm = dom.create('br');
- rng.insertNode(brElm);
- rng.setStartAfter(brElm);
- rng.setEndAfter(brElm);
- extraBr = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!isShortEnded) {
+ if (!attribsValue || attribsValue.indexOf('/') !== attribsValue.length - 1) {
+ stack.push({
+ name: value,
+ valid: isValidElement
+ });
+ } else if (isValidElement) {
+ end(value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- brElm = dom.create('br');
- rng.insertNode(brElm);
-
- // Rendering modes below IE8 doesn't display BR elements in PRE unless we have a \n before it
- var documentMode = dom.doc.documentMode;
- if (isOldIE && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) {
- brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (value = matches[1]) {
+ if (value.charAt(0) === '>') {
+ value = ' ' + value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!settings.allow_conditional_comments && value.substr(0, 3).toLowerCase() === '[if') {
+ value = ' ' + value;
+ }
+ comment(value);
+ } else if (value = matches[2]) {
+ cdata(trimComments(value));
+ } else if (value = matches[3]) {
+ doctype(value);
+ } else if (value = matches[4]) {
+ pi(value, matches[5]);
+ }
+ index = matches.index + matches[0].length;
+ }
+ if (index < html.length) {
+ text(decode(html.substr(index)));
+ }
+ for (i = stack.length - 1; i >= 0; i--) {
+ value = stack[i];
+ if (value.valid) {
+ end(value.name);
+ }
+ }
+ };
+ return { parse: parse };
+ }
+ (function (SaxParser) {
+ SaxParser.findEndTag = findEndTagIndex;
+ }(SaxParser || (SaxParser = {})));
+ var SaxParser$1 = SaxParser;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Insert temp marker and scroll to that
- marker = dom.create('span', {}, ' ');
- brElm.parentNode.insertBefore(marker, brElm);
- selection.scrollIntoView(marker);
- dom.remove(marker);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var trimHtml = function (tempAttrs, html) {
+ var trimContentRegExp = new RegExp(['\\s?(' + tempAttrs.join('|') + ')="[^"]+"'].join('|'), 'gi');
+ return html.replace(trimContentRegExp, '');
+ };
+ var trimInternal = function (serializer, html) {
+ var content = html;
+ var bogusAllRegExp = /<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g;
+ var endTagIndex, index, matchLength, matches, shortEndedElements;
+ var schema = serializer.schema;
+ content = trimHtml(serializer.getTempAttrs(), content);
+ shortEndedElements = schema.getShortEndedElements();
+ while (matches = bogusAllRegExp.exec(content)) {
+ index = bogusAllRegExp.lastIndex;
+ matchLength = matches[0].length;
+ if (shortEndedElements[matches[1]]) {
+ endTagIndex = index;
+ } else {
+ endTagIndex = SaxParser$1.findEndTag(schema, content, index);
+ }
+ content = content.substring(0, index - matchLength) + content.substring(endTagIndex);
+ bogusAllRegExp.lastIndex = index - matchLength;
+ }
+ return $_dpfg1321jfuw8lhn.trim(content);
+ };
+ var trimExternal = trimInternal;
+ var $_fglg0l5djfuw8m62 = {
+ trimExternal: trimExternal,
+ trimInternal: trimInternal
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (!extraBr) {
- rng.setStartAfter(brElm);
- rng.setEndAfter(brElm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var KEEP = 0;
+ var INSERT = 1;
+ var DELETE = 2;
+ var diff = function (left, right) {
+ var size = left.length + right.length + 2;
+ var vDown = new Array(size);
+ var vUp = new Array(size);
+ var snake = function (start, end, diag) {
+ return {
+ start: start,
+ end: end,
+ diag: diag
+ };
+ };
+ var buildScript = function (start1, end1, start2, end2, script) {
+ var middle = getMiddleSnake(start1, end1, start2, end2);
+ if (middle === null || middle.start === end1 && middle.diag === end1 - end2 || middle.end === start1 && middle.diag === start1 - start2) {
+ var i = start1;
+ var j = start2;
+ while (i < end1 || j < end2) {
+ if (i < end1 && j < end2 && left[i] === right[j]) {
+ script.push([
+ KEEP,
+ left[i]
+ ]);
+ ++i;
+ ++j;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rng.setStartBefore(brElm);
- rng.setEndBefore(brElm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (end1 - start1 > end2 - start2) {
+ script.push([
+ DELETE,
+ left[i]
+ ]);
+ ++i;
+ } else {
+ script.push([
+ INSERT,
+ right[j]
+ ]);
+ ++j;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- selection.setRng(rng);
- editor.undoManager.add();
-
- return TRUE;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- // Add queryCommandState overrides
- addCommands({
- // Override justify commands
- 'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull': function (command) {
- var name = 'align' + command.substring(7);
- var nodes = selection.isCollapsed() ? [dom.getParent(selection.getNode(), dom.isBlock)] : selection.getSelectedBlocks();
- var matches = map(nodes, function (node) {
- return !!formatter.matchNode(node, name);
- });
- return inArray(matches, TRUE) !== -1;
- },
-
- 'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) {
- return isFormatMatch(command);
- },
-
- mceBlockQuote: function () {
- return isFormatMatch('blockquote');
- },
-
- Outdent: function () {
- var node;
-
- if (settings.inline_styles) {
- if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) {
- return TRUE;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ buildScript(start1, middle.start, start2, middle.start - middle.diag, script);
+ for (var i2 = middle.start; i2 < middle.end; ++i2) {
+ script.push([
+ KEEP,
+ left[i2]
+ ]);
+ }
+ buildScript(middle.end, end1, middle.end - middle.diag, end2, script);
+ }
+ };
+ var buildSnake = function (start, diag, end1, end2) {
+ var end = start;
+ while (end - diag < end2 && end < end1 && left[end] === right[end - diag]) {
+ ++end;
+ }
+ return snake(start, end, diag);
+ };
+ var getMiddleSnake = function (start1, end1, start2, end2) {
+ var m = end1 - start1;
+ var n = end2 - start2;
+ if (m === 0 || n === 0) {
+ return null;
+ }
+ var delta = m - n;
+ var sum = n + m;
+ var offset = (sum % 2 === 0 ? sum : sum + 1) / 2;
+ vDown[1 + offset] = start1;
+ vUp[1 + offset] = end1 + 1;
+ var d, k, i, x, y;
+ for (d = 0; d <= offset; ++d) {
+ for (k = -d; k <= d; k += 2) {
+ i = k + offset;
+ if (k === -d || k !== d && vDown[i - 1] < vDown[i + 1]) {
+ vDown[i] = vDown[i + 1];
+ } else {
+ vDown[i] = vDown[i - 1] + 1;
+ }
+ x = vDown[i];
+ y = x - start1 + start2 - k;
+ while (x < end1 && y < end2 && left[x] === right[y]) {
+ vDown[i] = ++x;
+ ++y;
+ }
+ if (delta % 2 !== 0 && delta - d <= k && k <= delta + d) {
+ if (vUp[i - delta] <= vDown[i]) {
+ return buildSnake(vUp[i - delta], k + start1 - start2, end1, end2);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft, 10) > 0) {
- return TRUE;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return (
- queryCommandState('InsertUnorderedList') ||
- queryCommandState('InsertOrderedList') ||
- (!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE'))
- );
- },
-
- 'InsertUnorderedList,InsertOrderedList': function (command) {
- var list = dom.getParent(selection.getNode(), 'ul,ol');
-
- return list &&
- (
- command === 'insertunorderedlist' && list.tagName === 'UL' ||
- command === 'insertorderedlist' && list.tagName === 'OL'
- );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }, 'state');
-
- // Add queryCommandValue overrides
- addCommands({
- 'FontSize,FontName': function (command) {
- var value = 0, parent;
-
- if ((parent = dom.getParent(selection.getNode(), 'span'))) {
- if (command == 'fontsize') {
- value = parent.style.fontSize;
- } else {
- value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (k = delta - d; k <= delta + d; k += 2) {
+ i = k + offset - delta;
+ if (k === delta - d || k !== delta + d && vUp[i + 1] <= vUp[i - 1]) {
+ vUp[i] = vUp[i + 1] - 1;
+ } else {
+ vUp[i] = vUp[i - 1];
+ }
+ x = vUp[i] - 1;
+ y = x - start1 + start2 - k;
+ while (x >= start1 && y >= start2 && left[x] === right[y]) {
+ vUp[i] = x--;
+ y--;
+ }
+ if (delta % 2 === 0 && -d <= k && k <= d) {
+ if (vUp[i] <= vDown[i + delta]) {
+ return buildSnake(vUp[i], k + start1 - start2, end1, end2);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return value;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }, 'value');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var script = [];
+ buildScript(0, left.length, 0, right.length, script);
+ return script;
+ };
+ var $_9jf9ba5gjfuw8m6m = {
+ KEEP: KEEP,
+ DELETE: DELETE,
+ INSERT: INSERT,
+ diff: diff
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Add undo manager logic
- addCommands({
- Undo: function () {
- editor.undoManager.undo();
- },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getOuterHtml = function (elm) {
+ if ($_ey7ka11qjfuw8ldg.isElement(elm)) {
+ return elm.outerHTML;
+ } else if ($_ey7ka11qjfuw8ldg.isText(elm)) {
+ return $_8uzsfe1rjfuw8ldm.encodeRaw(elm.data, false);
+ } else if ($_ey7ka11qjfuw8ldg.isComment(elm)) {
+ return '<!--' + elm.data + '-->';
+ }
+ return '';
+ };
+ var createFragment$1 = function (html) {
+ var frag, node, container;
+ container = document.createElement('div');
+ frag = document.createDocumentFragment();
+ if (html) {
+ container.innerHTML = html;
+ }
+ while (node = container.firstChild) {
+ frag.appendChild(node);
+ }
+ return frag;
+ };
+ var insertAt = function (elm, html, index) {
+ var fragment = createFragment$1(html);
+ if (elm.hasChildNodes() && index < elm.childNodes.length) {
+ var target = elm.childNodes[index];
+ target.parentNode.insertBefore(fragment, target);
+ } else {
+ elm.appendChild(fragment);
+ }
+ };
+ var removeAt = function (elm, index) {
+ if (elm.hasChildNodes() && index < elm.childNodes.length) {
+ var target = elm.childNodes[index];
+ target.parentNode.removeChild(target);
+ }
+ };
+ var applyDiff = function (diff, elm) {
+ var index = 0;
+ $_djuh8tljfuw8l74.each(diff, function (action) {
+ if (action[0] === $_9jf9ba5gjfuw8m6m.KEEP) {
+ index++;
+ } else if (action[0] === $_9jf9ba5gjfuw8m6m.INSERT) {
+ insertAt(elm, action[1], index);
+ index++;
+ } else if (action[0] === $_9jf9ba5gjfuw8m6m.DELETE) {
+ removeAt(elm, index);
+ }
+ });
+ };
+ var read$2 = function (elm) {
+ return $_djuh8tljfuw8l74.filter($_djuh8tljfuw8l74.map(elm.childNodes, getOuterHtml), function (item) {
+ return item.length > 0;
+ });
+ };
+ var write = function (fragments, elm) {
+ var currentFragments = $_djuh8tljfuw8l74.map(elm.childNodes, getOuterHtml);
+ applyDiff($_9jf9ba5gjfuw8m6m.diff(currentFragments, fragments), elm);
+ return elm;
+ };
+ var $_3bhk0u5fjfuw8m6j = {
+ read: read$2,
+ write: write
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Redo: function () {
- editor.undoManager.redo();
- }
- });
- };
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fromHtml$1 = function (html, scope) {
+ var doc = scope || document;
+ var div = doc.createElement('div');
+ div.innerHTML = html;
+ return $_2j4g5u17jfuw8lav.children($_c9h6qlzjfuw8l98.fromDom(div));
+ };
+ var fromTags = function (tags, scope) {
+ return $_9ek1bp4jfuw8kxg.map(tags, function (x) {
+ return $_c9h6qlzjfuw8l98.fromTag(x, scope);
+ });
+ };
+ var fromText$1 = function (texts, scope) {
+ return $_9ek1bp4jfuw8kxg.map(texts, function (x) {
+ return $_c9h6qlzjfuw8l98.fromText(x, scope);
+ });
+ };
+ var fromDom$1 = function (nodes) {
+ return $_9ek1bp4jfuw8kxg.map(nodes, $_c9h6qlzjfuw8l98.fromDom);
+ };
+ var $_565w5h5ijfuw8m6s = {
+ fromHtml: fromHtml$1,
+ fromTags: fromTags,
+ fromText: fromText$1,
+ fromDom: fromDom$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * EditorFocus.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get$4 = function (element) {
+ return element.dom().innerHTML;
+ };
+ var set$3 = function (element, content) {
+ var owner = $_2j4g5u17jfuw8lav.owner(element);
+ var docDom = owner.dom();
+ var fragment = $_c9h6qlzjfuw8l98.fromDom(docDom.createDocumentFragment());
+ var contentElements = $_565w5h5ijfuw8m6s.fromHtml(content, docDom);
+ $_84jjow2vjfuw8lml.append(fragment, contentElements);
+ $_byg6a92ujfuw8lmi.empty(element);
+ $_doli6x2kjfuw8lky.append(element, fragment);
+ };
+ var getOuter = function (element) {
+ var container = $_c9h6qlzjfuw8l98.fromTag('div');
+ var clone = $_c9h6qlzjfuw8l98.fromDom(element.dom().cloneNode(true));
+ $_doli6x2kjfuw8lky.append(container, clone);
+ return get$4(container);
+ };
+ var $_98tc655hjfuw8m6r = {
+ get: get$4,
+ set: set$3,
+ getOuter: getOuter
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.EditorFocus',
- [
- 'ephox.katamari.api.Option',
- 'ephox.sugar.api.dom.Compare',
- 'ephox.sugar.api.node.Element',
- 'tinymce.core.caret.CaretFinder',
- 'tinymce.core.dom.ElementType',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.Env'
- ],
- function (Option, Compare, Element, CaretFinder, ElementType, RangeUtils, Env) {
- var getContentEditableHost = function (editor, node) {
- return editor.dom.getParent(node, function (node) {
- return editor.dom.getContentEditable(node) === "true";
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasIframes = function (html) {
+ return html.indexOf('</iframe>') !== -1;
+ };
+ var createFragmentedLevel = function (fragments) {
+ return {
+ type: 'fragmented',
+ fragments: fragments,
+ content: '',
+ bookmark: null,
+ beforeBookmark: null
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getCollapsedNode = function (rng) {
- return rng.collapsed ? Option.from(RangeUtils.getNode(rng.startContainer, rng.startOffset)).map(Element.fromDom) : Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var createCompleteLevel = function (content) {
+ return {
+ type: 'complete',
+ fragments: null,
+ content: content,
+ bookmark: null,
+ beforeBookmark: null
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var createFromEditor = function (editor) {
+ var fragments, content, trimmedFragments;
+ fragments = $_3bhk0u5fjfuw8m6j.read(editor.getBody());
+ trimmedFragments = $_9ek1bp4jfuw8kxg.bind(fragments, function (html) {
+ var trimmed = $_fglg0l5djfuw8m62.trimInternal(editor.serializer, html);
+ return trimmed.length > 0 ? [trimmed] : [];
+ });
+ content = trimmedFragments.join('');
+ return hasIframes(content) ? createFragmentedLevel(trimmedFragments) : createCompleteLevel(content);
+ };
+ var applyToEditor = function (editor, level, before) {
+ if (level.type === 'fragmented') {
+ $_3bhk0u5fjfuw8m6j.write(level.fragments, editor.getBody());
+ } else {
+ editor.setContent(level.content, { format: 'raw' });
+ }
+ editor.selection.moveToBookmark(before ? level.beforeBookmark : level.bookmark);
+ };
+ var getLevelContent = function (level) {
+ return level.type === 'fragmented' ? level.fragments.join('') : level.content;
+ };
+ var getCleanLevelContent = function (level) {
+ var elm = $_c9h6qlzjfuw8l98.fromTag('body');
+ $_98tc655hjfuw8m6r.set(elm, getLevelContent(level));
+ $_9ek1bp4jfuw8kxg.each($_ryxde2gjfuw8lkk.descendants(elm, '*[data-mce-bogus]'), $_byg6a92ujfuw8lmi.unwrap);
+ return $_98tc655hjfuw8m6r.get(elm);
+ };
+ var hasEqualContent = function (level1, level2) {
+ return getLevelContent(level1) === getLevelContent(level2);
+ };
+ var hasEqualCleanedContent = function (level1, level2) {
+ return getCleanLevelContent(level1) === getCleanLevelContent(level2);
+ };
+ var isEq$2 = function (level1, level2) {
+ if (!level1 || !level2) {
+ return false;
+ } else if (hasEqualContent(level1, level2)) {
+ return true;
+ } else {
+ return hasEqualCleanedContent(level1, level2);
+ }
+ };
+ var $_7pq3kv5cjfuw8m5t = {
+ createFragmentedLevel: createFragmentedLevel,
+ createCompleteLevel: createCompleteLevel,
+ createFromEditor: createFromEditor,
+ applyToEditor: applyToEditor,
+ isEq: isEq$2
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getFocusInElement = function (root, rng) {
- return getCollapsedNode(rng).bind(function (node) {
- if (ElementType.isTableSection(node)) {
- return Option.some(node);
- } else if (Compare.contains(root, node) === false) {
- return Option.some(root);
- } else {
- return Option.none();
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function UndoManager (editor) {
+ var self = this, index = 0, data = [], beforeBookmark, isFirstTypedCharacter, locks = 0;
+ var isUnlocked = function () {
+ return locks === 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var normalizeSelection = function (editor, rng) {
- getFocusInElement(Element.fromDom(editor.getBody()), rng).bind(function (elm) {
- return CaretFinder.firstPositionIn(elm.dom());
- }).fold(
- function () {
- editor.selection.normalize();
- },
- function (caretPos) {
- editor.selection.setRng(caretPos.toRange());
- }
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setTyping = function (typing) {
+ if (isUnlocked()) {
+ self.typing = typing;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var focusBody = function (body) {
- if (body.setActive) {
- // IE 11 sometimes throws "Invalid function" then fallback to focus
- // setActive is better since it doesn't scroll to the element being focused
- try {
- body.setActive();
- } catch (ex) {
- body.focus();
- }
- } else {
- body.focus();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setDirty = function (state) {
+ editor.setDirty(state);
+ };
+ var addNonTypingUndoLevel = function (e) {
+ setTyping(false);
+ self.add({}, e);
+ };
+ var endTyping = function () {
+ if (self.typing) {
+ setTyping(false);
+ self.add();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var focusEditor = function (editor) {
- var selection = editor.selection, contentEditable = editor.settings.content_editable, rng;
- var controlElm, doc = editor.getDoc(), body = editor.getBody(), contentEditableHost;
-
- // Get selected control element
- rng = selection.getRng();
- if (rng.item) {
- controlElm = rng.item(0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('init', function () {
+ self.add();
+ });
+ editor.on('BeforeExecCommand', function (e) {
+ var cmd = e.command;
+ if (cmd !== 'Undo' && cmd !== 'Redo' && cmd !== 'mceRepaint') {
+ endTyping();
+ self.beforeChange();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.quirks.refreshContentEditable();
-
- // Move focus to contentEditable=true child if needed
- contentEditableHost = getContentEditableHost(editor, selection.getNode());
- if (editor.$.contains(body, contentEditableHost)) {
- focusBody(contentEditableHost);
- normalizeSelection(editor, rng);
- activateEditor(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('ExecCommand', function (e) {
+ var cmd = e.command;
+ if (cmd !== 'Undo' && cmd !== 'Redo' && cmd !== 'mceRepaint') {
+ addNonTypingUndoLevel(e);
+ }
+ });
+ editor.on('ObjectResizeStart Cut', function () {
+ self.beforeChange();
+ });
+ editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel);
+ editor.on('DragEnd', addNonTypingUndoLevel);
+ editor.on('KeyUp', function (e) {
+ var keyCode = e.keyCode;
+ if (e.isDefaultPrevented()) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Focus the window iframe
- if (!contentEditable) {
- // WebKit needs this call to fire focusin event properly see #5948
- // But Opera pre Blink engine will produce an empty selection so skip Opera
- if (!Env.opera) {
- focusBody(body);
- }
-
- editor.getWin().focus();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45 || e.ctrlKey) {
+ addNonTypingUndoLevel();
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Focus the body as well since it's contentEditable
- if (Env.gecko || contentEditable) {
- // Restore previous selection before focus to prevent Chrome from
- // jumping to the top of the document in long inline editors
- if (contentEditable && document.activeElement !== body) {
- editor.selection.setRng(editor.lastRng);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (keyCode === 46 || keyCode === 8) {
+ editor.nodeChanged();
+ }
+ if (isFirstTypedCharacter && self.typing && $_7pq3kv5cjfuw8m5t.isEq($_7pq3kv5cjfuw8m5t.createFromEditor(editor), data[0]) === false) {
+ if (editor.isDirty() === false) {
+ setDirty(true);
+ editor.fire('change', {
+ level: data[0],
+ lastLevel: null
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- focusBody(body);
- normalizeSelection(editor, rng);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.fire('TypingUndo');
+ isFirstTypedCharacter = false;
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Restore selected control element
- // This is needed when for example an image is selected within a
- // layer a call to focus will then remove the control selection
- if (controlElm && controlElm.ownerDocument === doc) {
- rng = doc.body.createControlRange();
- rng.addElement(controlElm);
- rng.select();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('KeyDown', function (e) {
+ var keyCode = e.keyCode;
+ if (e.isDefaultPrevented()) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- activateEditor(editor);
- };
-
- var activateEditor = function (editor) {
- editor.editorManager.setActive(editor);
- };
-
- var focus = function (editor, skipFocus) {
- if (editor.removed) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45) {
+ if (self.typing) {
+ addNonTypingUndoLevel(e);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- skipFocus ? activateEditor(editor) : focusEditor(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var modKey = e.ctrlKey && !e.altKey || e.metaKey;
+ if ((keyCode < 16 || keyCode > 20) && keyCode !== 224 && keyCode !== 91 && !self.typing && !modKey) {
+ self.beforeChange();
+ setTyping(true);
+ self.add({}, e);
+ isFirstTypedCharacter = true;
+ }
+ });
+ editor.on('MouseDown', function (e) {
+ if (self.typing) {
+ addNonTypingUndoLevel(e);
+ }
+ });
+ var isInsertReplacementText = function (event) {
+ return event.inputType === 'insertReplacementText';
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- focus: focus
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isInsertTextDataNull = function (event) {
+ return event.inputType === 'insertText' && event.data === null;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * EditorObservable.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This mixin contains the event logic for the tinymce.Editor class.
- *
- * @mixin tinymce.EditorObservable
- * @extends tinymce.util.Observable
- */
-define(
- 'tinymce.core.EditorObservable',
- [
- "tinymce.core.util.Observable",
- "tinymce.core.dom.DOMUtils",
- "tinymce.core.util.Tools"
- ],
- function (Observable, DOMUtils, Tools) {
- var DOM = DOMUtils.DOM, customEventRootDelegates;
-
- /**
- * Returns the event target so for the specified event. Some events fire
- * only on document, some fire on documentElement etc. This also handles the
- * custom event root setting where it returns that element instead of the body.
- *
- * @private
- * @param {tinymce.Editor} editor Editor instance to get event target from.
- * @param {String} eventName Name of the event for example "click".
- * @return {Element/Document} HTML Element or document target to bind on.
- */
- function getEventTarget(editor, eventName) {
- if (eventName == 'selectionchange') {
- return editor.getDoc();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('input', function (e) {
+ if (e.inputType && (isInsertReplacementText(e) || isInsertTextDataNull(e))) {
+ addNonTypingUndoLevel(e);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Need to bind mousedown/mouseup etc to document not body in iframe mode
- // Since the user might click on the HTML element not the BODY
- if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) {
- return editor.getDoc().documentElement;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.addShortcut('meta+z', '', 'Undo');
+ editor.addShortcut('meta+y,meta+shift+z', '', 'Redo');
+ editor.on('AddUndo Undo Redo ClearUndos', function (e) {
+ if (!e.isDefaultPrevented()) {
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Bind to event root instead of body if it's defined
- if (editor.settings.event_root) {
- if (!editor.eventRoot) {
- editor.eventRoot = DOM.select(editor.settings.event_root)[0];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ self = {
+ data: data,
+ typing: false,
+ beforeChange: function () {
+ if (isUnlocked()) {
+ beforeBookmark = $_cpdbfi2ojfuw8ll6.getUndoBookmark(editor.selection);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return editor.eventRoot;
- }
-
- return editor.getBody();
- }
-
- /**
- * Binds a event delegate for the specified name this delegate will fire
- * the event to the editor dispatcher.
- *
- * @private
- * @param {tinymce.Editor} editor Editor instance to get event target from.
- * @param {String} eventName Name of the event for example "click".
- */
- function bindEventDelegate(editor, eventName) {
- var eventRootElm, delegate;
-
- function isListening(editor) {
- return !editor.hidden && !editor.readonly;
- }
-
- if (!editor.delegates) {
- editor.delegates = {};
- }
-
- if (editor.delegates[eventName] || editor.removed) {
- return;
- }
-
- eventRootElm = getEventTarget(editor, eventName);
-
- if (editor.settings.event_root) {
- if (!customEventRootDelegates) {
- customEventRootDelegates = {};
- editor.editorManager.on('removeEditor', function () {
- var name;
-
- if (!editor.editorManager.activeEditor) {
- if (customEventRootDelegates) {
- for (name in customEventRootDelegates) {
- editor.dom.unbind(getEventTarget(editor, name));
- }
-
- customEventRootDelegates = null;
- }
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ add: function (level, event) {
+ var i;
+ var settings = editor.settings;
+ var lastLevel, currentLevel;
+ currentLevel = $_7pq3kv5cjfuw8m5t.createFromEditor(editor);
+ level = level || {};
+ level = $_52qop8kjfuw8l6v.extend(level, currentLevel);
+ if (isUnlocked() === false || editor.removed) {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (customEventRootDelegates[eventName]) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ lastLevel = data[index];
+ if (editor.fire('BeforeAddUndo', {
+ level: level,
+ lastLevel: lastLevel,
+ originalEvent: event
+ }).isDefaultPrevented()) {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- delegate = function (e) {
- var target = e.target, editors = editor.editorManager.get(), i = editors.length;
-
- while (i--) {
- var body = editors[i].getBody();
-
- if (body === target || DOM.isChildOf(target, body)) {
- if (isListening(editors[i])) {
- editors[i].fire(eventName, e);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (lastLevel && $_7pq3kv5cjfuw8m5t.isEq(lastLevel, level)) {
+ return null;
+ }
+ if (data[index]) {
+ data[index].beforeBookmark = beforeBookmark;
+ }
+ if (settings.custom_undo_redo_levels) {
+ if (data.length > settings.custom_undo_redo_levels) {
+ for (i = 0; i < data.length - 1; i++) {
+ data[i] = data[i + 1];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ data.length--;
+ index = data.length;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ level.bookmark = $_cpdbfi2ojfuw8ll6.getUndoBookmark(editor.selection);
+ if (index < data.length - 1) {
+ data.length = index + 1;
+ }
+ data.push(level);
+ index = data.length - 1;
+ var args = {
+ level: level,
+ lastLevel: lastLevel,
+ originalEvent: event
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- customEventRootDelegates[eventName] = delegate;
- DOM.bind(eventRootElm, eventName, delegate);
- } else {
- delegate = function (e) {
- if (isListening(editor)) {
- editor.fire(eventName, e);
- }
- };
-
- DOM.bind(eventRootElm, eventName, delegate);
- editor.delegates[eventName] = delegate;
- }
- }
-
- var EditorObservable = {
- /**
- * Bind any pending event delegates. This gets executed after the target body/document is created.
- *
- * @private
- */
- bindPendingEventDelegates: function () {
- var self = this;
-
- Tools.each(self._pendingNativeEvents, function (name) {
- bindEventDelegate(self, name);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.fire('AddUndo', args);
+ if (index > 0) {
+ setDirty(true);
+ editor.fire('change', args);
+ }
+ return level;
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Toggles a native event on/off this is called by the EventDispatcher when
- * the first native event handler is added and when the last native event handler is removed.
- *
- * @private
- */
- toggleNativeEvent: function (name, state) {
- var self = this;
-
- // Never bind focus/blur since the FocusManager fakes those
- if (name == "focus" || name == "blur") {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ undo: function () {
+ var level;
+ if (self.typing) {
+ self.add();
+ self.typing = false;
+ setTyping(false);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (state) {
- if (self.initialized) {
- bindEventDelegate(self, name);
- } else {
- if (!self._pendingNativeEvents) {
- self._pendingNativeEvents = [name];
- } else {
- self._pendingNativeEvents.push(name);
- }
- }
- } else if (self.initialized) {
- self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);
- delete self.delegates[name];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (index > 0) {
+ level = data[--index];
+ $_7pq3kv5cjfuw8m5t.applyToEditor(editor, level, true);
+ setDirty(true);
+ editor.fire('undo', { level: level });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return level;
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Unbinds all native event handlers that means delegates, custom events bound using the Events API etc.
- *
- * @private
- */
- unbindAllNativeEvents: function () {
- var self = this, name;
-
- if (self.delegates) {
- for (name in self.delegates) {
- self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ redo: function () {
+ var level;
+ if (index < data.length - 1) {
+ level = data[++index];
+ $_7pq3kv5cjfuw8m5t.applyToEditor(editor, level, false);
+ setDirty(true);
+ editor.fire('redo', { level: level });
+ }
+ return level;
+ },
+ clear: function () {
+ data = [];
+ index = 0;
+ self.typing = false;
+ self.data = data;
+ editor.fire('ClearUndos');
+ },
+ hasUndo: function () {
+ return index > 0 || self.typing && data[0] && !$_7pq3kv5cjfuw8m5t.isEq($_7pq3kv5cjfuw8m5t.createFromEditor(editor), data[0]);
+ },
+ hasRedo: function () {
+ return index < data.length - 1 && !self.typing;
+ },
+ transact: function (callback) {
+ endTyping();
+ self.beforeChange();
+ self.ignore(callback);
+ return self.add();
+ },
+ ignore: function (callback) {
+ try {
+ locks++;
+ callback();
+ } finally {
+ locks--;
+ }
+ },
+ extra: function (callback1, callback2) {
+ var lastLevel, bookmark;
+ if (self.transact(callback1)) {
+ bookmark = data[index].bookmark;
+ lastLevel = data[index - 1];
+ $_7pq3kv5cjfuw8m5t.applyToEditor(editor, lastLevel, true);
+ if (self.transact(callback2)) {
+ data[index - 1].beforeBookmark = bookmark;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- delete self.delegates;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!self.inline) {
- self.getBody().onload = null;
- self.dom.unbind(self.getWin());
- self.dom.unbind(self.getDoc());
- }
-
- self.dom.unbind(self.getBody());
- self.dom.unbind(self.getContainer());
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- EditorObservable = Tools.extend({}, Observable, EditorObservable);
-
- return EditorObservable;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ErrorReporter.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Various error reporting helper functions.
- *
- * @class tinymce.ErrorReporter
- * @private
- */
-define(
- 'tinymce.core.ErrorReporter',
- [
- 'tinymce.core.AddOnManager'
- ],
- function (AddOnManager) {
- var PluginManager = AddOnManager.PluginManager;
-
- var resolvePluginName = function (targetUrl, suffix) {
- for (var name in PluginManager.urls) {
- var matchUrl = PluginManager.urls[name] + '/plugin' + suffix + '.js';
- if (matchUrl === targetUrl) {
- return name;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isInlineBlock = function (node) {
+ return node && /^(IMG)$/.test(node.nodeName);
+ };
+ var moveStart = function (dom, selection, rng) {
+ var offset = rng.startOffset;
+ var container = rng.startContainer, walker, node, nodes;
+ if (rng.startContainer === rng.endContainer) {
+ if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
- };
-
- var pluginUrlToMessage = function (editor, url) {
- var plugin = resolvePluginName(url, editor.suffix);
- return plugin ?
- 'Failed to load plugin: ' + plugin + ' from url ' + url :
- 'Failed to load plugin url: ' + url;
- };
-
- var displayNotification = function (editor, message) {
- editor.notificationManager.open({
- type: 'error',
- text: message
- });
- };
-
- var displayError = function (editor, message) {
- if (editor._skinLoaded) {
- displayNotification(editor, message);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (container.nodeType === 1) {
+ nodes = container.childNodes;
+ if (offset < nodes.length) {
+ container = nodes[offset];
+ walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.on('SkinLoaded', function () {
- displayNotification(editor, message);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = nodes[nodes.length - 1];
+ walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));
+ walker.next(true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var uploadError = function (editor, message) {
- displayError(editor, 'Failed to upload image: ' + message);
- };
-
- var pluginLoadError = function (editor, url) {
- displayError(editor, pluginUrlToMessage(editor, url));
- };
-
- var initError = function (message) {
- var console = window.console;
- if (console && !window.test) { // Skip test env
- if (console.error) {
- console.error.apply(console, arguments);
- } else {
- console.log.apply(console, arguments);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (node = walker.current(); node; node = walker.next()) {
+ if (node.nodeType === 3 && !isWhiteSpaceNode(node)) {
+ rng.setStart(node, 0);
+ selection.setRng(rng);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- return {
- pluginLoadError: pluginLoadError,
- uploadError: uploadError,
- displayError: displayError,
- initError: initError
- };
- }
-);
-/**
- * CaretContainerInput.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module shows the invisble block that the caret is currently in when contents is added to that block.
- */
-define(
- 'tinymce.core.caret.CaretContainerInput',
- [
- 'ephox.katamari.api.Fun',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.SelectorFind',
- 'tinymce.core.caret.CaretContainer'
- ],
- function (Fun, Element, SelectorFind, CaretContainer) {
- var findBlockCaretContainer = function (editor) {
- return SelectorFind.descendant(Element.fromDom(editor.getBody()), '*[data-mce-caret]').fold(Fun.constant(null), function (elm) {
- return elm.dom();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var getNonWhiteSpaceSibling = function (node, next, inc) {
+ if (node) {
+ next = next ? 'nextSibling' : 'previousSibling';
+ for (node = inc ? node : node[next]; node; node = node[next]) {
+ if (node.nodeType === 1 || !isWhiteSpaceNode(node)) {
+ return node;
+ }
+ }
+ }
+ };
+ var isTextBlock$1 = function (editor, name) {
+ if (name.nodeType) {
+ name = name.nodeName;
+ }
+ return !!editor.schema.getTextBlockElements()[name.toLowerCase()];
+ };
+ var isValid = function (ed, parent, child) {
+ return ed.schema.isValidChild(parent, child);
+ };
+ var isWhiteSpaceNode = function (node) {
+ return node && node.nodeType === 3 && /^([\t \r\n]+|)$/.test(node.nodeValue);
+ };
+ var replaceVars = function (value, vars) {
+ if (typeof value !== 'string') {
+ value = value(vars);
+ } else if (vars) {
+ value = value.replace(/%(\w+)/g, function (str, name) {
+ return vars[name] || str;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return value;
+ };
+ var isEq$3 = function (str1, str2) {
+ str1 = str1 || '';
+ str2 = str2 || '';
+ str1 = '' + (str1.nodeName || str1);
+ str2 = '' + (str2.nodeName || str2);
+ return str1.toLowerCase() === str2.toLowerCase();
+ };
+ var normalizeStyleValue = function (dom, value, name) {
+ if (name === 'color' || name === 'backgroundColor') {
+ value = dom.toHex(value);
+ }
+ if (name === 'fontWeight' && value === 700) {
+ value = 'bold';
+ }
+ if (name === 'fontFamily') {
+ value = value.replace(/[\'\"]/g, '').replace(/,\s+/g, ',');
+ }
+ return '' + value;
+ };
+ var getStyle = function (dom, node, name) {
+ return normalizeStyleValue(dom, dom.getStyle(node, name), name);
+ };
+ var getTextDecoration = function (dom, node) {
+ var decoration;
+ dom.getParent(node, function (n) {
+ decoration = dom.getStyle(n, 'text-decoration');
+ return decoration && decoration !== 'none';
+ });
+ return decoration;
+ };
+ var getParents$1 = function (dom, node, selector) {
+ return dom.getParents(node, selector, dom.getRoot());
+ };
+ var $_5nzvub5njfuw8m89 = {
+ isInlineBlock: isInlineBlock,
+ moveStart: moveStart,
+ getNonWhiteSpaceSibling: getNonWhiteSpaceSibling,
+ isTextBlock: isTextBlock$1,
+ isValid: isValid,
+ isWhiteSpaceNode: isWhiteSpaceNode,
+ replaceVars: replaceVars,
+ isEq: isEq$3,
+ normalizeStyleValue: normalizeStyleValue,
+ getStyle: getStyle,
+ getTextDecoration: getTextDecoration,
+ getParents: getParents$1
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var removeIeControlRect = function (editor) {
- editor.selection.setRng(editor.selection.getRng());
- };
-
- var showBlockCaretContainer = function (editor, blockCaretContainer) {
- if (blockCaretContainer.hasAttribute('data-mce-caret')) {
- CaretContainer.showCaretContainerBlock(blockCaretContainer);
- removeIeControlRect(editor);
- editor.selection.scrollIntoView(blockCaretContainer);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isBookmarkNode$2 = $_disscn2njfuw8ll3.isBookmarkNode;
+ var getParents$2 = $_5nzvub5njfuw8m89.getParents;
+ var isWhiteSpaceNode$1 = $_5nzvub5njfuw8m89.isWhiteSpaceNode;
+ var isTextBlock$2 = $_5nzvub5njfuw8m89.isTextBlock;
+ var findLeaf = function (node, offset) {
+ if (typeof offset === 'undefined') {
+ offset = node.nodeType === 3 ? node.length : node.childNodes.length;
+ }
+ while (node && node.hasChildNodes()) {
+ node = node.childNodes[offset];
+ if (node) {
+ offset = node.nodeType === 3 ? node.length : node.childNodes.length;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return {
+ node: node,
+ offset: offset
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var handleBlockContainer = function (editor, e) {
- var blockCaretContainer = findBlockCaretContainer(editor);
-
- if (!blockCaretContainer) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var excludeTrailingWhitespace = function (endContainer, endOffset) {
+ var leaf = findLeaf(endContainer, endOffset);
+ if (leaf.node) {
+ while (leaf.node && leaf.offset === 0 && leaf.node.previousSibling) {
+ leaf = findLeaf(leaf.node.previousSibling);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (e.type === 'compositionstart') {
- e.preventDefault();
- e.stopPropagation();
- showBlockCaretContainer(blockCaretContainer);
- return;
- }
-
- if (CaretContainer.hasContent(blockCaretContainer)) {
- showBlockCaretContainer(editor, blockCaretContainer);
- }
- };
-
- var setup = function (editor) {
- editor.on('keyup compositionstart', Fun.curry(handleBlockContainer, editor));
- };
-
- return {
- setup: setup
- };
- }
-);
-/**
- * Uploader.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Upload blobs or blob infos to the specified URL or handler.
- *
- * @private
- * @class tinymce.file.Uploader
- * @example
- * var uploader = new Uploader({
- * url: '/upload.php',
- * basePath: '/base/path',
- * credentials: true,
- * handler: function(data, success, failure) {
- * ...
- * }
- * });
- *
- * uploader.upload(blobInfos).then(function(result) {
- * ...
- * });
- */
-define(
- 'tinymce.core.file.Uploader',
- [
- "tinymce.core.util.Promise",
- "tinymce.core.util.Tools",
- "tinymce.core.util.Fun"
- ],
- function (Promise, Tools, Fun) {
- return function (uploadStatus, settings) {
- var pendingPromises = {};
-
- function pathJoin(path1, path2) {
- if (path1) {
- return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (leaf.node && leaf.offset > 0 && leaf.node.nodeType === 3 && leaf.node.nodeValue.charAt(leaf.offset - 1) === ' ') {
+ if (leaf.offset > 1) {
+ endContainer = leaf.node;
+ endContainer.splitText(leaf.offset - 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return path2;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function defaultHandler(blobInfo, success, failure, progress) {
- var xhr, formData;
-
- xhr = new XMLHttpRequest();
- xhr.open('POST', settings.url);
- xhr.withCredentials = settings.credentials;
-
- xhr.upload.onprogress = function (e) {
- progress(e.loaded / e.total * 100);
- };
-
- xhr.onerror = function () {
- failure("Image upload failed due to a XHR Transport error. Code: " + xhr.status);
- };
-
- xhr.onload = function () {
- var json;
-
- if (xhr.status < 200 || xhr.status >= 300) {
- failure("HTTP Error: " + xhr.status);
- return;
- }
-
- json = JSON.parse(xhr.responseText);
-
- if (!json || typeof json.location != "string") {
- failure("Invalid JSON: " + xhr.responseText);
- return;
- }
-
- success(pathJoin(settings.basePath, json.location));
- };
-
- formData = new FormData();
- formData.append('file', blobInfo.blob(), blobInfo.filename());
-
- xhr.send(formData);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return endContainer;
+ };
+ var isBogusBr = function (node) {
+ return node.nodeName === 'BR' && node.getAttribute('data-mce-bogus') && !node.nextSibling;
+ };
+ var findParentContentEditable = function (dom, node) {
+ var parent = node;
+ while (parent) {
+ if (parent.nodeType === 1 && dom.getContentEditable(parent)) {
+ return dom.getContentEditable(parent) === 'false' ? parent : node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function noUpload() {
- return new Promise(function (resolve) {
- resolve([]);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent = parent.parentNode;
+ }
+ return node;
+ };
+ var findSpace = function (start, remove, node, offset) {
+ var pos, pos2;
+ var str = node.nodeValue;
+ if (typeof offset === 'undefined') {
+ offset = start ? str.length : 0;
+ }
+ if (start) {
+ pos = str.lastIndexOf(' ', offset);
+ pos2 = str.lastIndexOf('\xA0', offset);
+ pos = pos > pos2 ? pos : pos2;
+ if (pos !== -1 && !remove) {
+ pos++;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function handlerSuccess(blobInfo, url) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ pos = str.indexOf(' ', offset);
+ pos2 = str.indexOf('\xA0', offset);
+ pos = pos !== -1 && (pos2 === -1 || pos < pos2) ? pos : pos2;
+ }
+ return pos;
+ };
+ var findWordEndPoint = function (dom, body, container, offset, start, remove) {
+ var walker, node, pos, lastTextNode;
+ if (container.nodeType === 3) {
+ pos = findSpace(start, remove, container, offset);
+ if (pos !== -1) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- url: url,
- blobInfo: blobInfo,
- status: true
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container: container,
+ offset: pos
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function handlerFailure(blobInfo, error) {
- return {
- url: '',
- blobInfo: blobInfo,
- status: false,
- error: error
- };
- }
-
- function resolvePending(blobUri, result) {
- Tools.each(pendingPromises[blobUri], function (resolve) {
- resolve(result);
- });
-
- delete pendingPromises[blobUri];
- }
-
- function uploadBlobInfo(blobInfo, handler, openNotification) {
- uploadStatus.markPending(blobInfo.blobUri());
-
- return new Promise(function (resolve) {
- var notification, progress;
-
- var noop = function () {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ lastTextNode = container;
+ }
+ walker = new TreeWalker(container, dom.getParent(container, dom.isBlock) || body);
+ while (node = walker[start ? 'prev' : 'next']()) {
+ if (node.nodeType === 3) {
+ lastTextNode = node;
+ pos = findSpace(start, remove, node);
+ if (pos !== -1) {
+ return {
+ container: node,
+ offset: pos
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- try {
- var closeNotification = function () {
- if (notification) {
- notification.close();
- progress = noop; // Once it's closed it's closed
- }
- };
-
- var success = function (url) {
- closeNotification();
- uploadStatus.markUploaded(blobInfo.blobUri(), url);
- resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url));
- resolve(handlerSuccess(blobInfo, url));
- };
-
- var failure = function (error) {
- closeNotification();
- uploadStatus.removeFailed(blobInfo.blobUri());
- resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error));
- resolve(handlerFailure(blobInfo, error));
- };
-
- progress = function (percent) {
- if (percent < 0 || percent > 100) {
- return;
- }
-
- if (!notification) {
- notification = openNotification();
- }
-
- notification.progressBar.value(percent);
- };
-
- handler(blobInfo, success, failure, progress);
- } catch (ex) {
- resolve(handlerFailure(blobInfo, ex.message));
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ } else if (dom.isBlock(node)) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isDefaultHandler(handler) {
- return handler === defaultHandler;
- }
-
- function pendingUploadBlobInfo(blobInfo) {
- var blobUri = blobInfo.blobUri();
-
- return new Promise(function (resolve) {
- pendingPromises[blobUri] = pendingPromises[blobUri] || [];
- pendingPromises[blobUri].push(resolve);
- });
- }
-
- function uploadBlobs(blobInfos, openNotification) {
- blobInfos = Tools.grep(blobInfos, function (blobInfo) {
- return !uploadStatus.isUploaded(blobInfo.blobUri());
- });
-
- return Promise.all(Tools.map(blobInfos, function (blobInfo) {
- return uploadStatus.isPending(blobInfo.blobUri()) ?
- pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification);
- }));
- }
-
- function upload(blobInfos, openNotification) {
- return (!settings.url && isDefaultHandler(settings.handler)) ? noUpload() : uploadBlobs(blobInfos, openNotification);
- }
-
- settings = Tools.extend({
- credentials: false,
- // We are adding a notify argument to this (at the moment, until it doesn't work)
- handler: defaultHandler
- }, settings);
-
- return {
- upload: upload
- };
- };
- }
-);
-define(
- 'ephox.sand.api.Window',
-
- [
- 'ephox.sand.util.Global'
- ],
-
- function (Global) {
- /******************************************************************************************
- * BIG BIG WARNING: Don't put anything other than top-level window functions in here.
- *
- * Objects that are technically available as window.X should be in their own module X (e.g. Blob, FileReader, URL).
- ******************************************************************************************
- */
-
- /*
- * IE10 and above per
- * https://developer.mozilla.org/en/docs/Web/API/window.requestAnimationFrame
- */
- var requestAnimationFrame = function (callback) {
- var f = Global.getOrDie('requestAnimationFrame');
- f(callback);
- };
-
- /*
- * IE10 and above per
- * https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64.atob
- */
- var atob = function (base64) {
- var f = Global.getOrDie('atob');
- return f(base64);
- };
-
- return {
- atob: atob,
- requestAnimationFrame: requestAnimationFrame
- };
- }
-);
-/**
- * Conversions.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Converts blob/uris back and forth.
- *
- * @private
- * @class tinymce.file.Conversions
- */
-define(
- 'tinymce.core.file.Conversions',
- [
- 'ephox.sand.api.Window',
- 'tinymce.core.util.Promise'
- ],
- function (Window, Promise) {
- function blobUriToBlob(url) {
- return new Promise(function (resolve, reject) {
-
- var rejectWithError = function () {
- reject("Cannot convert " + url + " to Blob. Resource might not exist or is inaccessible.");
- };
-
- try {
- var xhr = new XMLHttpRequest();
-
- xhr.open('GET', url, true);
- xhr.responseType = 'blob';
-
- xhr.onload = function () {
- if (this.status == 200) {
- resolve(this.response);
- } else {
- // IE11 makes it into onload but responds with status 500
- rejectWithError();
- }
- };
-
- // Chrome fires an error event instead of the exception
- // Also there seems to be no way to intercept the message that is logged to the console
- xhr.onerror = rejectWithError;
-
- xhr.send();
- } catch (ex) {
- rejectWithError();
- }
- });
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function parseDataUri(uri) {
- var type, matches;
-
- uri = decodeURIComponent(uri).split(',');
-
- matches = /data:([^;]+)/.exec(uri[0]);
- if (matches) {
- type = matches[1];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (lastTextNode) {
+ if (start) {
+ offset = 0;
+ } else {
+ offset = lastTextNode.length;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- type: type,
- data: uri[1]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container: lastTextNode,
+ offset: offset
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function dataUriToBlob(uri) {
- return new Promise(function (resolve) {
- var str, arr, i;
-
- uri = parseDataUri(uri);
-
- // Might throw error if data isn't proper base64
- try {
- str = Window.atob(uri.data);
- } catch (e) {
- resolve(new Blob([]));
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var findSelectorEndPoint = function (dom, format, rng, container, siblingName) {
+ var parents, i, y, curFormat;
+ if (container.nodeType === 3 && container.nodeValue.length === 0 && container[siblingName]) {
+ container = container[siblingName];
+ }
+ parents = getParents$2(dom, container);
+ for (i = 0; i < parents.length; i++) {
+ for (y = 0; y < format.length; y++) {
+ curFormat = format[y];
+ if ('collapsed' in curFormat && curFormat.collapsed !== rng.collapsed) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- arr = new Uint8Array(str.length);
-
- for (i = 0; i < arr.length; i++) {
- arr[i] = str.charCodeAt(i);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (dom.is(parents[i], curFormat.selector)) {
+ return parents[i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- resolve(new Blob([arr], { type: uri.type }));
- });
- }
-
- function uriToBlob(url) {
- if (url.indexOf('blob:') === 0) {
- return blobUriToBlob(url);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (url.indexOf('data:') === 0) {
- return dataUriToBlob(url);
- }
-
- return null;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function blobToDataUri(blob) {
- return new Promise(function (resolve) {
- var reader = new FileReader();
-
- reader.onloadend = function () {
- resolve(reader.result);
- };
-
- reader.readAsDataURL(blob);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return container;
+ };
+ var findBlockEndPoint = function (editor, format, container, siblingName) {
+ var node;
+ var dom = editor.dom;
+ var root = dom.getRoot();
+ if (!format[0].wrapper) {
+ node = dom.getParent(container, format[0].block, root);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- uriToBlob: uriToBlob,
- blobToDataUri: blobToDataUri,
- parseDataUri: parseDataUri
- };
- }
-);
-/**
- * ImageScanner.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Finds images with data uris or blob uris. If data uris are found it will convert them into blob uris.
- *
- * @private
- * @class tinymce.file.ImageScanner
- */
-define(
- 'tinymce.core.file.ImageScanner',
- [
- "tinymce.core.util.Promise",
- "tinymce.core.util.Arr",
- "tinymce.core.util.Fun",
- "tinymce.core.file.Conversions",
- "tinymce.core.Env"
- ],
- function (Promise, Arr, Fun, Conversions, Env) {
- var count = 0;
-
- var uniqueId = function (prefix) {
- return (prefix || 'blobid') + (count++);
- };
-
- var imageToBlobInfo = function (blobCache, img, resolve, reject) {
- var base64, blobInfo;
-
- if (img.src.indexOf('blob:') === 0) {
- blobInfo = blobCache.getByUri(img.src);
-
- if (blobInfo) {
- resolve({
- image: img,
- blobInfo: blobInfo
- });
- } else {
- Conversions.uriToBlob(img.src).then(function (blob) {
- Conversions.blobToDataUri(blob).then(function (dataUri) {
- base64 = Conversions.parseDataUri(dataUri).data;
- blobInfo = blobCache.create(uniqueId(), blob, base64);
- blobCache.add(blobInfo);
-
- resolve({
- image: img,
- blobInfo: blobInfo
- });
- });
- }, function (err) {
- reject(err);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!node) {
+ var scopeRoot = dom.getParent(container, 'LI,TD,TH');
+ node = dom.getParent(container.nodeType === 3 ? container.parentNode : container, function (node) {
+ return node !== root && isTextBlock$2(editor, node);
+ }, scopeRoot);
+ }
+ if (node && format[0].wrapper) {
+ node = getParents$2(dom, node, 'ul,ol').reverse()[0] || node;
+ }
+ if (!node) {
+ node = container;
+ while (node[siblingName] && !dom.isBlock(node[siblingName])) {
+ node = node[siblingName];
+ if ($_5nzvub5njfuw8m89.isEq(node, 'br')) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- base64 = Conversions.parseDataUri(img.src).data;
- blobInfo = blobCache.findFirst(function (cachedBlobInfo) {
- return cachedBlobInfo.base64() === base64;
- });
-
- if (blobInfo) {
- resolve({
- image: img,
- blobInfo: blobInfo
- });
- } else {
- Conversions.uriToBlob(img.src).then(function (blob) {
- blobInfo = blobCache.create(uniqueId(), blob, base64);
- blobCache.add(blobInfo);
-
- resolve({
- image: img,
- blobInfo: blobInfo
- });
- }, function (err) {
- reject(err);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return node || container;
+ };
+ var findParentContainer = function (dom, format, startContainer, startOffset, endContainer, endOffset, start) {
+ var container, parent, sibling, siblingName, root;
+ container = parent = start ? startContainer : endContainer;
+ siblingName = start ? 'previousSibling' : 'nextSibling';
+ root = dom.getRoot();
+ if (container.nodeType === 3 && !isWhiteSpaceNode$1(container)) {
+ if (start ? startOffset > 0 : endOffset < container.nodeValue.length) {
+ return container;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var getAllImages = function (elm) {
- return elm ? elm.getElementsByTagName('img') : [];
- };
-
- return function (uploadStatus, blobCache) {
- var cachedPromises = {};
-
- function findAll(elm, predicate) {
- var images, promises;
-
- if (!predicate) {
- predicate = Fun.constant(true);
- }
-
- images = Arr.filter(getAllImages(elm), function (img) {
- var src = img.src;
-
- if (!Env.fileApi) {
- return false;
- }
-
- if (img.hasAttribute('data-mce-bogus')) {
- return false;
- }
-
- if (img.hasAttribute('data-mce-placeholder')) {
- return false;
- }
-
- if (!src || src == Env.transparentSrc) {
- return false;
- }
-
- if (src.indexOf('blob:') === 0) {
- return !uploadStatus.isUploaded(src);
- }
-
- if (src.indexOf('data:') === 0) {
- return predicate(img);
- }
-
- return false;
- });
-
- promises = Arr.map(images, function (img) {
- var newPromise;
-
- if (cachedPromises[img.src]) {
- // Since the cached promise will return the cached image
- // We need to wrap it and resolve with the actual image
- return new Promise(function (resolve) {
- cachedPromises[img.src].then(function (imageInfo) {
- if (typeof imageInfo === 'string') { // error apparently
- return imageInfo;
- }
- resolve({
- image: img,
- blobInfo: imageInfo.blobInfo
- });
- });
- });
- }
-
- newPromise = new Promise(function (resolve, reject) {
- imageToBlobInfo(blobCache, img, resolve, reject);
- }).then(function (result) {
- delete cachedPromises[result.image.src];
- return result;
- })['catch'](function (error) {
- delete cachedPromises[img.src];
- return error;
- });
-
- cachedPromises[img.src] = newPromise;
-
- return newPromise;
- });
-
- return Promise.all(promises);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ while (true) {
+ if (!format[0].block_expand && dom.isBlock(parent)) {
+ return parent;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- findAll: findAll
- };
- };
- }
-);
-define(
- 'ephox.sand.api.URL',
-
- [
- 'ephox.sand.util.Global'
- ],
-
- function (Global) {
- /*
- * IE10 and above per
- * https://developer.mozilla.org/en-US/docs/Web/API/URL.createObjectURL
- *
- * Also Safari 6.1+
- * Safari 6.0 has 'webkitURL' instead, but doesn't support flexbox so we
- * aren't supporting it anyway
- */
- var url = function () {
- return Global.getOrDie('URL');
- };
-
- var createObjectURL = function (blob) {
- return url().createObjectURL(blob);
- };
-
- var revokeObjectURL = function (u) {
- url().revokeObjectURL(u);
- };
-
- return {
- createObjectURL: createObjectURL,
- revokeObjectURL: revokeObjectURL
- };
- }
-);
-/**
- * Uuid.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Generates unique ids.
- *
- * @class tinymce.util.Uuid
- * @private
- */
-define(
- 'tinymce.core.util.Uuid',
- [
- ],
- function () {
- var count = 0;
-
- var seed = function () {
- var rnd = function () {
- return Math.round(Math.random() * 0xFFFFFFFF).toString(36);
- };
-
- var now = new Date().getTime();
- return 's' + now.toString(36) + rnd() + rnd() + rnd();
- };
-
- var uuid = function (prefix) {
- return prefix + (count++) + seed();
- };
-
- return {
- uuid: uuid
- };
- }
-);
-
-/**
- * BlobCache.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Hold blob info objects where a blob has extra internal information.
- *
- * @private
- * @class tinymce.file.BlobCache
- */
-define(
- 'tinymce.core.file.BlobCache',
- [
- 'ephox.sand.api.URL',
- 'tinymce.core.util.Arr',
- 'tinymce.core.util.Fun',
- 'tinymce.core.util.Uuid'
- ],
- function (URL, Arr, Fun, Uuid) {
- return function () {
- var cache = [], constant = Fun.constant;
-
- function mimeToExt(mime) {
- var mimes = {
- 'image/jpeg': 'jpg',
- 'image/jpg': 'jpg',
- 'image/gif': 'gif',
- 'image/png': 'png'
- };
-
- return mimes[mime.toLowerCase()] || 'dat';
- }
-
- function create(o, blob, base64, filename) {
- return typeof o === 'object' ? toBlobInfo(o) : toBlobInfo({
- id: o,
- name: filename,
- blob: blob,
- base64: base64
- });
- }
-
- function toBlobInfo(o) {
- var id, name;
-
- if (!o.blob || !o.base64) {
- throw "blob and base64 representations of the image are required for BlobInfo to be created";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {
+ if (!isBookmarkNode$2(sibling) && !isWhiteSpaceNode$1(sibling) && !isBogusBr(sibling)) {
+ return parent;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- id = o.id || Uuid.uuid('blobid');
- name = o.name || id;
-
- return {
- id: constant(id),
- name: constant(name),
- filename: constant(name + '.' + mimeToExt(o.blob.type)),
- blob: constant(o.blob),
- base64: constant(o.base64),
- blobUri: constant(o.blobUri || URL.createObjectURL(o.blob)),
- uri: constant(o.uri)
- };
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function add(blobInfo) {
- if (!get(blobInfo.id())) {
- cache.push(blobInfo);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (parent === root || parent.parentNode === root) {
+ container = parent;
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function get(id) {
- return findFirst(function (cachedBlobInfo) {
- return cachedBlobInfo.id() === id;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent = parent.parentNode;
+ }
+ return container;
+ };
+ var expandRng = function (editor, rng, format, remove) {
+ var endPoint, startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset;
+ var dom = editor.dom;
+ if (startContainer.nodeType === 1 && startContainer.hasChildNodes()) {
+ startContainer = getNode(startContainer, startOffset);
+ if (startContainer.nodeType === 3) {
+ startOffset = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function findFirst(predicate) {
- return Arr.filter(cache, predicate)[0];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (endContainer.nodeType === 1 && endContainer.hasChildNodes()) {
+ endContainer = getNode(endContainer, rng.collapsed ? endOffset : endOffset - 1);
+ if (endContainer.nodeType === 3) {
+ endOffset = endContainer.nodeValue.length;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getByUri(blobUri) {
- return findFirst(function (blobInfo) {
- return blobInfo.blobUri() == blobUri;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ startContainer = findParentContentEditable(dom, startContainer);
+ endContainer = findParentContentEditable(dom, endContainer);
+ if (isBookmarkNode$2(startContainer.parentNode) || isBookmarkNode$2(startContainer)) {
+ startContainer = isBookmarkNode$2(startContainer) ? startContainer : startContainer.parentNode;
+ startContainer = startContainer.nextSibling || startContainer;
+ if (startContainer.nodeType === 3) {
+ startOffset = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function removeByUri(blobUri) {
- cache = Arr.filter(cache, function (blobInfo) {
- if (blobInfo.blobUri() === blobUri) {
- URL.revokeObjectURL(blobInfo.blobUri());
- return false;
- }
-
- return true;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (isBookmarkNode$2(endContainer.parentNode) || isBookmarkNode$2(endContainer)) {
+ endContainer = isBookmarkNode$2(endContainer) ? endContainer : endContainer.parentNode;
+ endContainer = endContainer.previousSibling || endContainer;
+ if (endContainer.nodeType === 3) {
+ endOffset = endContainer.length;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function destroy() {
- Arr.each(cache, function (cachedBlobInfo) {
- URL.revokeObjectURL(cachedBlobInfo.blobUri());
- });
-
- cache = [];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (format[0].inline) {
+ if (rng.collapsed) {
+ endPoint = findWordEndPoint(dom, editor.getBody(), startContainer, startOffset, true, remove);
+ if (endPoint) {
+ startContainer = endPoint.container;
+ startOffset = endPoint.offset;
+ }
+ endPoint = findWordEndPoint(dom, editor.getBody(), endContainer, endOffset, false, remove);
+ if (endPoint) {
+ endContainer = endPoint.container;
+ endOffset = endPoint.offset;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- create: create,
- add: add,
- get: get,
- getByUri: getByUri,
- findFirst: findFirst,
- removeByUri: removeByUri,
- destroy: destroy
- };
- };
- }
-);
-/**
- * UploadStatus.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Holds the current status of a blob uri, if it's pending or uploaded and what the result urls was.
- *
- * @private
- * @class tinymce.file.UploadStatus
- */
-define(
- 'tinymce.core.file.UploadStatus',
- [
- ],
- function () {
- return function () {
- var PENDING = 1, UPLOADED = 2;
- var blobUriStatuses = {};
-
- function createStatus(status, resultUri) {
- return {
- status: status,
- resultUri: resultUri
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ endContainer = remove ? endContainer : excludeTrailingWhitespace(endContainer, endOffset);
+ }
+ if (format[0].inline || format[0].block_expand) {
+ if (!format[0].inline || (startContainer.nodeType !== 3 || startOffset === 0)) {
+ startContainer = findParentContainer(dom, format, startContainer, startOffset, endContainer, endOffset, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hasBlobUri(blobUri) {
- return blobUri in blobUriStatuses;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!format[0].inline || (endContainer.nodeType !== 3 || endOffset === endContainer.nodeValue.length)) {
+ endContainer = findParentContainer(dom, format, startContainer, startOffset, endContainer, endOffset, false);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getResultUri(blobUri) {
- var result = blobUriStatuses[blobUri];
-
- return result ? result.resultUri : null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (format[0].selector && format[0].expand !== false && !format[0].inline) {
+ startContainer = findSelectorEndPoint(dom, format, rng, startContainer, 'previousSibling');
+ endContainer = findSelectorEndPoint(dom, format, rng, endContainer, 'nextSibling');
+ }
+ if (format[0].block || format[0].selector) {
+ startContainer = findBlockEndPoint(editor, format, startContainer, 'previousSibling');
+ endContainer = findBlockEndPoint(editor, format, endContainer, 'nextSibling');
+ if (format[0].block) {
+ if (!dom.isBlock(startContainer)) {
+ startContainer = findParentContainer(dom, format, startContainer, startOffset, endContainer, endOffset, true);
+ }
+ if (!dom.isBlock(endContainer)) {
+ endContainer = findParentContainer(dom, format, startContainer, startOffset, endContainer, endOffset, false);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isPending(blobUri) {
- return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === PENDING : false;
- }
-
- function isUploaded(blobUri) {
- return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === UPLOADED : false;
- }
-
- function markPending(blobUri) {
- blobUriStatuses[blobUri] = createStatus(PENDING, null);
- }
-
- function markUploaded(blobUri, resultUri) {
- blobUriStatuses[blobUri] = createStatus(UPLOADED, resultUri);
- }
-
- function removeFailed(blobUri) {
- delete blobUriStatuses[blobUri];
- }
-
- function destroy() {
- blobUriStatuses = {};
- }
-
- return {
- hasBlobUri: hasBlobUri,
- getResultUri: getResultUri,
- isPending: isPending,
- isUploaded: isUploaded,
- markPending: markPending,
- markUploaded: markUploaded,
- removeFailed: removeFailed,
- destroy: destroy
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (startContainer.nodeType === 1) {
+ startOffset = dom.nodeIndex(startContainer);
+ startContainer = startContainer.parentNode;
+ }
+ if (endContainer.nodeType === 1) {
+ endOffset = dom.nodeIndex(endContainer) + 1;
+ endContainer = endContainer.parentNode;
+ }
+ return {
+ startContainer: startContainer,
+ startOffset: startOffset,
+ endContainer: endContainer,
+ endOffset: endOffset
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * EditorUpload.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_eq6rbn5mjfuw8m82 = { expandRng: expandRng };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Handles image uploads, updates undo stack and patches over various internal functions.
- *
- * @private
- * @class tinymce.EditorUpload
- */
-define(
- 'tinymce.core.EditorUpload',
- [
- "tinymce.core.util.Arr",
- "tinymce.core.file.Uploader",
- "tinymce.core.file.ImageScanner",
- "tinymce.core.file.BlobCache",
- "tinymce.core.file.UploadStatus",
- "tinymce.core.ErrorReporter"
- ],
- function (Arr, Uploader, ImageScanner, BlobCache, UploadStatus, ErrorReporter) {
- return function (editor) {
- var blobCache = new BlobCache(), uploader, imageScanner, settings = editor.settings;
- var uploadStatus = new UploadStatus();
-
- function aliveGuard(callback) {
- return function (result) {
- if (editor.selection) {
- return callback(result);
- }
-
- return [];
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isEq$4 = $_5nzvub5njfuw8m89.isEq;
+ var matchesUnInheritedFormatSelector = function (ed, node, name) {
+ var formatList = ed.formatter.get(name);
+ if (formatList) {
+ for (var i = 0; i < formatList.length; i++) {
+ if (formatList[i].inherit === false && ed.dom.is(node, formatList[i].selector)) {
+ return true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function cacheInvalidator() {
- return '?' + (new Date()).getTime();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return false;
+ };
+ var matchParents = function (editor, node, name, vars) {
+ var root = editor.dom.getRoot();
+ if (node === root) {
+ return false;
+ }
+ node = editor.dom.getParent(node, function (node) {
+ if (matchesUnInheritedFormatSelector(editor, node, name)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Replaces strings without regexps to avoid FF regexp to big issue
- function replaceString(content, search, replace) {
- var index = 0;
-
- do {
- index = content.indexOf(search, index);
-
- if (index !== -1) {
- content = content.substring(0, index) + replace + content.substr(index + search.length);
- index += replace.length - search.length + 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return node.parentNode === root || !!matchNode(editor, node, name, vars, true);
+ });
+ return matchNode(editor, node, name, vars);
+ };
+ var matchName = function (dom, node, format) {
+ if (isEq$4(node, format.inline)) {
+ return true;
+ }
+ if (isEq$4(node, format.block)) {
+ return true;
+ }
+ if (format.selector) {
+ return node.nodeType === 1 && dom.is(node, format.selector);
+ }
+ };
+ var matchItems = function (dom, node, format, itemName, similar, vars) {
+ var key, value;
+ var items = format[itemName];
+ var i;
+ if (format.onmatch) {
+ return format.onmatch(node, format, itemName);
+ }
+ if (items) {
+ if (typeof items.length === 'undefined') {
+ for (key in items) {
+ if (items.hasOwnProperty(key)) {
+ if (itemName === 'attributes') {
+ value = dom.getAttrib(node, key);
+ } else {
+ value = $_5nzvub5njfuw8m89.getStyle(dom, node, key);
+ }
+ if (similar && !value && !format.exact) {
+ return;
+ }
+ if ((!similar || format.exact) && !isEq$4(value, $_5nzvub5njfuw8m89.normalizeStyleValue(dom, $_5nzvub5njfuw8m89.replaceVars(items[key], vars), key))) {
+ return;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } while (index !== -1);
-
- return content;
- }
-
- function replaceImageUrl(content, targetUrl, replacementUrl) {
- content = replaceString(content, 'src="' + targetUrl + '"', 'src="' + replacementUrl + '"');
- content = replaceString(content, 'data-mce-src="' + targetUrl + '"', 'data-mce-src="' + replacementUrl + '"');
-
- return content;
- }
-
- function replaceUrlInUndoStack(targetUrl, replacementUrl) {
- Arr.each(editor.undoManager.data, function (level) {
- if (level.type === 'fragmented') {
- level.fragments = Arr.map(level.fragments, function (fragment) {
- return replaceImageUrl(fragment, targetUrl, replacementUrl);
- });
- } else {
- level.content = replaceImageUrl(level.content, targetUrl, replacementUrl);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ } else {
+ for (i = 0; i < items.length; i++) {
+ if (itemName === 'attributes' ? dom.getAttrib(node, items[i]) : $_5nzvub5njfuw8m89.getStyle(dom, node, items[i])) {
+ return format;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function openNotification() {
- return editor.notificationManager.open({
- text: editor.translate('Image uploading...'),
- type: 'info',
- timeout: -1,
- progressBar: true
- });
- }
-
- function replaceImageUri(image, resultUri) {
- blobCache.removeByUri(image.src);
- replaceUrlInUndoStack(image.src, resultUri);
-
- editor.$(image).attr({
- src: settings.images_reuse_filename ? resultUri + cacheInvalidator() : resultUri,
- 'data-mce-src': editor.convertURL(resultUri, 'src')
- });
- }
-
- function uploadImages(callback) {
- if (!uploader) {
- uploader = new Uploader(uploadStatus, {
- url: settings.images_upload_url,
- basePath: settings.images_upload_base_path,
- credentials: settings.images_upload_credentials,
- handler: settings.images_upload_handler
- });
- }
-
- return scanForImages().then(aliveGuard(function (imageInfos) {
- var blobInfos;
-
- blobInfos = Arr.map(imageInfos, function (imageInfo) {
- return imageInfo.blobInfo;
- });
-
- return uploader.upload(blobInfos, openNotification).then(aliveGuard(function (result) {
- var filteredResult = Arr.map(result, function (uploadInfo, index) {
- var image = imageInfos[index].image;
-
- if (uploadInfo.status && editor.settings.images_replace_blob_uris !== false) {
- replaceImageUri(image, uploadInfo.url);
- } else if (uploadInfo.error) {
- ErrorReporter.uploadError(editor, uploadInfo.error);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return format;
+ };
+ var matchNode = function (ed, node, name, vars, similar) {
+ var formatList = ed.formatter.get(name);
+ var format, i, x, classes;
+ var dom = ed.dom;
+ if (formatList && node) {
+ for (i = 0; i < formatList.length; i++) {
+ format = formatList[i];
+ if (matchName(ed.dom, node, format) && matchItems(dom, node, format, 'attributes', similar, vars) && matchItems(dom, node, format, 'styles', similar, vars)) {
+ if (classes = format.classes) {
+ for (x = 0; x < classes.length; x++) {
+ if (!ed.dom.hasClass(node, classes[x])) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- element: image,
- status: uploadInfo.status
- };
- });
-
- if (callback) {
- callback(filteredResult);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return filteredResult;
- }));
- }));
- }
-
- function uploadImagesAuto(callback) {
- if (settings.automatic_uploads !== false) {
- return uploadImages(callback);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return format;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isValidDataUriImage(imgElm) {
- return settings.images_dataimg_filter ? settings.images_dataimg_filter(imgElm) : true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var match = function (editor, name, vars, node) {
+ var startNode;
+ if (node) {
+ return matchParents(editor, node, name, vars);
+ }
+ node = editor.selection.getNode();
+ if (matchParents(editor, node, name, vars)) {
+ return true;
+ }
+ startNode = editor.selection.getStart();
+ if (startNode !== node) {
+ if (matchParents(editor, startNode, name, vars)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function scanForImages() {
- if (!imageScanner) {
- imageScanner = new ImageScanner(uploadStatus, blobCache);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return false;
+ };
+ var matchAll = function (editor, names, vars) {
+ var startElement;
+ var matchedFormatNames = [];
+ var checkedMap = {};
+ startElement = editor.selection.getStart();
+ editor.dom.getParent(startElement, function (node) {
+ var i, name;
+ for (i = 0; i < names.length; i++) {
+ name = names[i];
+ if (!checkedMap[name] && matchNode(editor, node, name, vars)) {
+ checkedMap[name] = true;
+ matchedFormatNames.push(name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return imageScanner.findAll(editor.getBody(), isValidDataUriImage).then(aliveGuard(function (result) {
- result = Arr.filter(result, function (resultItem) {
- // ImageScanner internally converts images that it finds, but it may fail to do so if image source is inaccessible.
- // In such case resultItem will contain appropriate text error message, instead of image data.
- if (typeof resultItem === 'string') {
- ErrorReporter.displayError(editor, resultItem);
- return false;
- }
- return true;
- });
-
- Arr.each(result, function (resultItem) {
- replaceUrlInUndoStack(resultItem.image.src, resultItem.blobInfo.blobUri());
- resultItem.image.src = resultItem.blobInfo.blobUri();
- resultItem.image.removeAttribute('data-mce-src');
- });
-
- return result;
- }));
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function destroy() {
- blobCache.destroy();
- uploadStatus.destroy();
- imageScanner = uploader = null;
- }
-
- function replaceBlobUris(content) {
- return content.replace(/src="(blob:[^"]+)"/g, function (match, blobUri) {
- var resultUri = uploadStatus.getResultUri(blobUri);
-
- if (resultUri) {
- return 'src="' + resultUri + '"';
- }
-
- var blobInfo = blobCache.getByUri(blobUri);
-
- if (!blobInfo) {
- blobInfo = Arr.reduce(editor.editorManager.get(), function (result, editor) {
- return result || editor.editorUpload && editor.editorUpload.blobCache.getByUri(blobUri);
- }, null);
- }
-
- if (blobInfo) {
- return 'src="data:' + blobInfo.blob().type + ';base64,' + blobInfo.base64() + '"';
- }
-
- return match;
- });
- }
-
- editor.on('setContent', function () {
- if (editor.settings.automatic_uploads !== false) {
- uploadImagesAuto();
- } else {
- scanForImages();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, editor.dom.getRoot());
+ return matchedFormatNames;
+ };
+ var canApply = function (editor, name) {
+ var formatList = editor.formatter.get(name);
+ var startNode, parents, i, x, selector;
+ var dom = editor.dom;
+ if (formatList) {
+ startNode = editor.selection.getStart();
+ parents = $_5nzvub5njfuw8m89.getParents(dom, startNode);
+ for (x = formatList.length - 1; x >= 0; x--) {
+ selector = formatList[x].selector;
+ if (!selector || formatList[x].defaultBlock) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- editor.on('RawSaveContent', function (e) {
- e.content = replaceBlobUris(e.content);
- });
-
- editor.on('getContent', function (e) {
- if (e.source_view || e.format == 'raw') {
- return;
- }
-
- e.content = replaceBlobUris(e.content);
- });
-
- editor.on('PostRender', function () {
- editor.parser.addNodeFilter('img', function (images) {
- Arr.each(images, function (img) {
- var src = img.attr('src');
-
- if (blobCache.getByUri(src)) {
- return;
- }
-
- var resultUri = uploadStatus.getResultUri(src);
- if (resultUri) {
- img.attr('src', resultUri);
- }
- });
- });
- });
-
- return {
- blobCache: blobCache,
- uploadImages: uploadImages,
- uploadImagesAuto: uploadImagesAuto,
- scanForImages: scanForImages,
- destroy: destroy
- };
- };
- }
-);
-/**
- * ForceBlocks.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Makes sure that everything gets wrapped in paragraphs.
- *
- * @private
- * @class tinymce.ForceBlocks
- */
-define(
- 'tinymce.core.ForceBlocks',
- [
- 'ephox.katamari.api.Fun'
- ],
- function (Fun) {
- var addRootBlocks = function (editor) {
- var settings = editor.settings, dom = editor.dom, selection = editor.selection;
- var schema = editor.schema, blockElements = schema.getBlockElements();
- var node = selection.getStart(), rootNode = editor.getBody(), rng;
- var startContainer, startOffset, endContainer, endOffset, rootBlockNode;
- var tempNode, offset = -0xFFFFFF, wrapped, restoreSelection;
- var tmpRng, rootNodeName, forcedRootBlock;
-
- forcedRootBlock = settings.forced_root_block;
-
- if (!node || node.nodeType !== 1 || !forcedRootBlock) {
- return;
- }
-
- // Check if node is wrapped in block
- while (node && node !== rootNode) {
- if (blockElements[node.nodeName]) {
- return;
- }
-
- node = node.parentNode;
- }
-
- // Get current selection
- rng = selection.getRng();
- if (rng.setStart) {
- startContainer = rng.startContainer;
- startOffset = rng.startOffset;
- endContainer = rng.endContainer;
- endOffset = rng.endOffset;
-
- try {
- restoreSelection = editor.getDoc().activeElement === rootNode;
- } catch (ex) {
- // IE throws unspecified error here sometimes
- }
- } else {
- // Force control range into text range
- if (rng.item) {
- node = rng.item(0);
- rng = editor.getDoc().body.createTextRange();
- rng.moveToElementText(node);
- }
-
- restoreSelection = rng.parentElement().ownerDocument === editor.getDoc();
- tmpRng = rng.duplicate();
- tmpRng.collapse(true);
- startOffset = tmpRng.move('character', offset) * -1;
-
- if (!tmpRng.collapsed) {
- tmpRng = rng.duplicate();
- tmpRng.collapse(false);
- endOffset = (tmpRng.move('character', offset) * -1) - startOffset;
- }
- }
-
- // Wrap non block elements and text nodes
- node = rootNode.firstChild;
- rootNodeName = rootNode.nodeName.toLowerCase();
- while (node) {
- // TODO: Break this up, too complex
- if (((node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName]))) &&
- schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase())) {
- // Remove empty text nodes
- if (node.nodeType === 3 && node.nodeValue.length === 0) {
- tempNode = node;
- node = node.nextSibling;
- dom.remove(tempNode);
- continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (i = parents.length - 1; i >= 0; i--) {
+ if (dom.is(parents[i], selector)) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!rootBlockNode) {
- rootBlockNode = dom.create(forcedRootBlock, editor.settings.forced_root_block_attrs);
- node.parentNode.insertBefore(rootBlockNode, node);
- wrapped = true;
- }
-
- tempNode = node;
- node = node.nextSibling;
- rootBlockNode.appendChild(tempNode);
- } else {
- rootBlockNode = null;
- node = node.nextSibling;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return false;
+ };
+ var $_ggpery5ojfuw8m8e = {
+ matchNode: matchNode,
+ matchName: matchName,
+ match: match,
+ matchAll: matchAll,
+ canApply: canApply,
+ matchesUnInheritedFormatSelector: matchesUnInheritedFormatSelector
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (wrapped && restoreSelection) {
- if (rng.setStart) {
- rng.setStart(startContainer, startOffset);
- rng.setEnd(endContainer, endOffset);
- selection.setRng(rng);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var splitText = function (node, offset) {
+ return node.splitText(offset);
+ };
+ var split$1 = function (rng) {
+ var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset;
+ if (startContainer === endContainer && $_ey7ka11qjfuw8ldg.isText(startContainer)) {
+ if (startOffset > 0 && startOffset < startContainer.nodeValue.length) {
+ endContainer = splitText(startContainer, startOffset);
+ startContainer = endContainer.previousSibling;
+ if (endOffset > startOffset) {
+ endOffset = endOffset - startOffset;
+ startContainer = endContainer = splitText(endContainer, endOffset).previousSibling;
+ endOffset = endContainer.nodeValue.length;
+ startOffset = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Only select if the previous selection was inside the document to prevent auto focus in quirks mode
- try {
- rng = editor.getDoc().body.createTextRange();
- rng.moveToElementText(rootNode);
- rng.collapse(true);
- rng.moveStart('character', startOffset);
-
- if (endOffset > 0) {
- rng.moveEnd('character', endOffset);
- }
-
- rng.select();
- } catch (ex) {
- // Ignore
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ endOffset = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.nodeChanged();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var setup = function (editor) {
- if (editor.settings.forced_root_block) {
- editor.on('NodeChange', Fun.curry(addRootBlocks, editor));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if ($_ey7ka11qjfuw8ldg.isText(startContainer) && startOffset > 0 && startOffset < startContainer.nodeValue.length) {
+ startContainer = splitText(startContainer, startOffset);
+ startOffset = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_ey7ka11qjfuw8ldg.isText(endContainer) && endOffset > 0 && endOffset < endContainer.nodeValue.length) {
+ endContainer = splitText(endContainer, endOffset).previousSibling;
+ endOffset = endContainer.nodeValue.length;
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- setup: setup
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ startContainer: startContainer,
+ startOffset: startOffset,
+ endContainer: endContainer,
+ endOffset: endOffset
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Dimensions.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_5l67ss5pjfuw8m8j = { split: split$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * This module measures nodes and returns client rects. The client rects has an
- * extra node property.
- *
- * @private
- * @class tinymce.dom.Dimensions
- */
-define(
- 'tinymce.core.dom.Dimensions',
- [
- "tinymce.core.util.Arr",
- "tinymce.core.dom.NodeType",
- "tinymce.core.geom.ClientRect"
- ],
- function (Arr, NodeType, ClientRect) {
-
- function getClientRects(node) {
- function toArrayWithNode(clientRects) {
- return Arr.map(clientRects, function (clientRect) {
- clientRect = ClientRect.clone(clientRect);
- clientRect.node = node;
-
- return clientRect;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var ZWSP$1 = $_dpfg1321jfuw8lhn.ZWSP;
+ var CARET_ID$1 = '_mce_caret';
+ var importNode = function (ownerDocument, node) {
+ return ownerDocument.importNode(node, true);
+ };
+ var getEmptyCaretContainers = function (node) {
+ var nodes = [];
+ while (node) {
+ if (node.nodeType === 3 && node.nodeValue !== ZWSP$1 || node.childNodes.length > 1) {
+ return [];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (Arr.isArray(node)) {
- return Arr.reduce(node, function (result, node) {
- return result.concat(getClientRects(node));
- }, []);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.nodeType === 1) {
+ nodes.push(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (NodeType.isElement(node)) {
- return toArrayWithNode(node.getClientRects());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.firstChild;
+ }
+ return nodes;
+ };
+ var isCaretContainerEmpty = function (node) {
+ return getEmptyCaretContainers(node).length > 0;
+ };
+ var findFirstTextNode = function (node) {
+ var walker;
+ if (node) {
+ walker = new TreeWalker(node, node);
+ for (node = walker.current(); node; node = walker.next()) {
+ if (node.nodeType === 3) {
+ return node;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (NodeType.isText(node)) {
- var rng = node.ownerDocument.createRange();
-
- rng.setStart(node, 0);
- rng.setEnd(node, node.data.length);
-
- return toArrayWithNode(rng.getClientRects());
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- /**
- * Returns the client rects for a specific node.
- *
- * @method getClientRects
- * @param {Array/DOMNode} node Node or array of nodes to get client rects on.
- * @param {Array} Array of client rects with a extra node property.
- */
- getClientRects: getClientRects
- };
- }
-);
-/**
- * LineUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Utility functions for working with lines.
- *
- * @private
- * @class tinymce.caret.LineUtils
- */
-define(
- 'tinymce.core.caret.LineUtils',
- [
- "tinymce.core.util.Fun",
- "tinymce.core.util.Arr",
- "tinymce.core.dom.NodeType",
- "tinymce.core.dom.Dimensions",
- "tinymce.core.geom.ClientRect",
- "tinymce.core.caret.CaretUtils",
- "tinymce.core.caret.CaretCandidate"
- ],
- function (Fun, Arr, NodeType, Dimensions, ClientRect, CaretUtils, CaretCandidate) {
- var isContentEditableFalse = NodeType.isContentEditableFalse,
- findNode = CaretUtils.findNode,
- curry = Fun.curry;
-
- function distanceToRectLeft(clientRect, clientX) {
- return Math.abs(clientRect.left - clientX);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
+ };
+ var createCaretContainer = function (fill) {
+ var caretContainer = $_c9h6qlzjfuw8l98.fromTag('span');
+ $_8g002u14jfuw8la5.setAll(caretContainer, {
+ 'id': CARET_ID$1,
+ 'data-mce-bogus': '1',
+ 'data-mce-type': 'format-caret'
+ });
+ if (fill) {
+ $_doli6x2kjfuw8lky.append(caretContainer, $_c9h6qlzjfuw8l98.fromText(ZWSP$1));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function distanceToRectRight(clientRect, clientX) {
- return Math.abs(clientRect.right - clientX);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return caretContainer;
+ };
+ var trimZwspFromCaretContainer = function (caretContainerNode) {
+ var textNode = findFirstTextNode(caretContainerNode);
+ if (textNode && textNode.nodeValue.charAt(0) === ZWSP$1) {
+ textNode.deleteData(0, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function findClosestClientRect(clientRects, clientX) {
- function isInside(clientX, clientRect) {
- return clientX >= clientRect.left && clientX <= clientRect.right;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return textNode;
+ };
+ var removeCaretContainerNode = function (dom, selection, node, moveCaret) {
+ var rng, block, textNode;
+ rng = selection.getRng(true);
+ block = dom.getParent(node, dom.isBlock);
+ if (isCaretContainerEmpty(node)) {
+ if (moveCaret !== false) {
+ rng.setStartBefore(node);
+ rng.setEndBefore(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Arr.reduce(clientRects, function (oldClientRect, clientRect) {
- var oldDistance, newDistance;
-
- oldDistance = Math.min(distanceToRectLeft(oldClientRect, clientX), distanceToRectRight(oldClientRect, clientX));
- newDistance = Math.min(distanceToRectLeft(clientRect, clientX), distanceToRectRight(clientRect, clientX));
-
- if (isInside(clientX, clientRect)) {
- return clientRect;
- }
-
- if (isInside(clientX, oldClientRect)) {
- return oldClientRect;
- }
-
- // cE=false has higher priority
- if (newDistance == oldDistance && isContentEditableFalse(clientRect.node)) {
- return clientRect;
- }
-
- if (newDistance < oldDistance) {
- return clientRect;
- }
-
- return oldClientRect;
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.remove(node);
+ } else {
+ textNode = trimZwspFromCaretContainer(node);
+ if (rng.startContainer === textNode && rng.startOffset > 0) {
+ rng.setStart(textNode, rng.startOffset - 1);
+ }
+ if (rng.endContainer === textNode && rng.endOffset > 0) {
+ rng.setEnd(textNode, rng.endOffset - 1);
+ }
+ dom.remove(node, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function walkUntil(direction, rootNode, predicateFn, node) {
- while ((node = findNode(node, direction, CaretCandidate.isEditableCaretCandidate, rootNode))) {
- if (predicateFn(node)) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (block && dom.isEmpty(block)) {
+ $_5udnjn2tjfuw8lm4.fillWithPaddingBr($_c9h6qlzjfuw8l98.fromDom(block));
+ }
+ selection.setRng(rng);
+ };
+ var removeCaretContainer = function (body, dom, selection, node, moveCaret) {
+ if (!node) {
+ node = getParentCaretContainer(body, selection.getStart());
+ if (!node) {
+ while (node = dom.get(CARET_ID$1)) {
+ removeCaretContainerNode(dom, selection, node, false);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ removeCaretContainerNode(dom, selection, node, moveCaret);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function findLineNodeRects(rootNode, targetNodeRect) {
- var clientRects = [];
-
- function collect(checkPosFn, node) {
- var lineRects;
-
- lineRects = Arr.filter(Dimensions.getClientRects(node), function (clientRect) {
- return !checkPosFn(clientRect, targetNodeRect);
- });
-
- clientRects = clientRects.concat(lineRects);
-
- return lineRects.length === 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var insertCaretContainerNode = function (editor, caretContainer, formatNode) {
+ var dom = editor.dom, block = dom.getParent(formatNode, $_ebfy8j25jfuw8li1.curry($_5nzvub5njfuw8m89.isTextBlock, editor));
+ if (block && dom.isEmpty(block)) {
+ formatNode.parentNode.replaceChild(caretContainer, formatNode);
+ } else {
+ $_5udnjn2tjfuw8lm4.removeTrailingBr($_c9h6qlzjfuw8l98.fromDom(formatNode));
+ if (dom.isEmpty(formatNode)) {
+ formatNode.parentNode.replaceChild(caretContainer, formatNode);
+ } else {
+ dom.insertAfter(caretContainer, formatNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- clientRects.push(targetNodeRect);
- walkUntil(-1, rootNode, curry(collect, ClientRect.isAbove), targetNodeRect.node);
- walkUntil(1, rootNode, curry(collect, ClientRect.isBelow), targetNodeRect.node);
-
- return clientRects;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getContentEditableFalseChildren(rootNode) {
- return Arr.filter(Arr.toArray(rootNode.getElementsByTagName('*')), isContentEditableFalse);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var appendNode = function (parentNode, node) {
+ parentNode.appendChild(node);
+ return node;
+ };
+ var insertFormatNodesIntoCaretContainer = function (formatNodes, caretContainer) {
+ var innerMostFormatNode = $_9ek1bp4jfuw8kxg.foldr(formatNodes, function (parentNode, formatNode) {
+ return appendNode(parentNode, formatNode.cloneNode(false));
+ }, caretContainer);
+ return appendNode(innerMostFormatNode, innerMostFormatNode.ownerDocument.createTextNode(ZWSP$1));
+ };
+ var applyCaretFormat = function (editor, name, vars) {
+ var rng, caretContainer, textNode, offset, bookmark, container, text;
+ var selection = editor.selection;
+ rng = selection.getRng(true);
+ offset = rng.startOffset;
+ container = rng.startContainer;
+ text = container.nodeValue;
+ caretContainer = getParentCaretContainer(editor.getBody(), selection.getStart());
+ if (caretContainer) {
+ textNode = findFirstTextNode(caretContainer);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function caretInfo(clientRect, clientX) {
- return {
- node: clientRect.node,
- before: distanceToRectLeft(clientRect, clientX) < distanceToRectRight(clientRect, clientX)
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var wordcharRegex = /[^\s\u00a0\u00ad\u200b\ufeff]/;
+ if (text && offset > 0 && offset < text.length && wordcharRegex.test(text.charAt(offset)) && wordcharRegex.test(text.charAt(offset - 1))) {
+ bookmark = selection.getBookmark();
+ rng.collapse(true);
+ rng = $_eq6rbn5mjfuw8m82.expandRng(editor, rng, editor.formatter.get(name));
+ rng = $_5l67ss5pjfuw8m8j.split(rng);
+ editor.formatter.apply(name, vars, rng);
+ selection.moveToBookmark(bookmark);
+ } else {
+ if (!caretContainer || textNode.nodeValue !== ZWSP$1) {
+ caretContainer = importNode(editor.getDoc(), createCaretContainer(true).dom());
+ textNode = caretContainer.firstChild;
+ rng.insertNode(caretContainer);
+ offset = 1;
+ editor.formatter.apply(name, vars, caretContainer);
+ } else {
+ editor.formatter.apply(name, vars, caretContainer);
+ }
+ selection.setCursorLocation(textNode, offset);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function closestCaret(rootNode, clientX, clientY) {
- var contentEditableFalseNodeRects, closestNodeRect;
-
- contentEditableFalseNodeRects = Dimensions.getClientRects(getContentEditableFalseChildren(rootNode));
- contentEditableFalseNodeRects = Arr.filter(contentEditableFalseNodeRects, function (clientRect) {
- return clientY >= clientRect.top && clientY <= clientRect.bottom;
- });
-
- closestNodeRect = findClosestClientRect(contentEditableFalseNodeRects, clientX);
- if (closestNodeRect) {
- closestNodeRect = findClosestClientRect(findLineNodeRects(rootNode, closestNodeRect), clientX);
- if (closestNodeRect && isContentEditableFalse(closestNodeRect.node)) {
- return caretInfo(closestNodeRect, clientX);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var removeCaretFormat = function (editor, name, vars, similar) {
+ var dom = editor.dom, selection = editor.selection;
+ var container, offset, bookmark;
+ var hasContentAfter, node, formatNode;
+ var parents = [], rng = selection.getRng();
+ var caretContainer;
+ container = rng.startContainer;
+ offset = rng.startOffset;
+ node = container;
+ if (container.nodeType === 3) {
+ if (offset !== container.nodeValue.length) {
+ hasContentAfter = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- findClosestClientRect: findClosestClientRect,
- findLineNodeRects: findLineNodeRects,
- closestCaret: closestCaret
- };
- }
-);
-/**
- * LineWalker.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module lets you walk the document line by line
- * returing nodes and client rects for each line.
- *
- * @private
- * @class tinymce.caret.LineWalker
- */
-define(
- 'tinymce.core.caret.LineWalker',
- [
- "tinymce.core.util.Fun",
- "tinymce.core.util.Arr",
- "tinymce.core.dom.Dimensions",
- "tinymce.core.caret.CaretCandidate",
- "tinymce.core.caret.CaretUtils",
- "tinymce.core.caret.CaretWalker",
- "tinymce.core.caret.CaretPosition",
- "tinymce.core.geom.ClientRect"
- ],
- function (Fun, Arr, Dimensions, CaretCandidate, CaretUtils, CaretWalker, CaretPosition, ClientRect) {
- var curry = Fun.curry;
-
- function findUntil(direction, rootNode, predicateFn, node) {
- while ((node = CaretUtils.findNode(node, direction, CaretCandidate.isEditableCaretCandidate, rootNode))) {
- if (predicateFn(node)) {
- return;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (node) {
+ if ($_ggpery5ojfuw8m8e.matchNode(editor, node, name, vars, similar)) {
+ formatNode = node;
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.nextSibling) {
+ hasContentAfter = true;
+ }
+ parents.push(node);
+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function walkUntil(direction, isAboveFn, isBeflowFn, rootNode, predicateFn, caretPosition) {
- var line = 0, node, result = [], targetClientRect;
-
- function add(node) {
- var i, clientRect, clientRects;
-
- clientRects = Dimensions.getClientRects(node);
- if (direction == -1) {
- clientRects = clientRects.reverse();
- }
-
- for (i = 0; i < clientRects.length; i++) {
- clientRect = clientRects[i];
- if (isBeflowFn(clientRect, targetClientRect)) {
- continue;
- }
-
- if (result.length > 0 && isAboveFn(clientRect, Arr.last(result))) {
- line++;
- }
-
- clientRect.line = line;
-
- if (predicateFn(clientRect)) {
- return true;
- }
-
- result.push(clientRect);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!formatNode) {
+ return;
+ }
+ if (hasContentAfter) {
+ bookmark = selection.getBookmark();
+ rng.collapse(true);
+ var expandedRng = $_eq6rbn5mjfuw8m82.expandRng(editor, rng, editor.formatter.get(name), true);
+ expandedRng = $_5l67ss5pjfuw8m8j.split(expandedRng);
+ editor.formatter.remove(name, vars, expandedRng);
+ selection.moveToBookmark(bookmark);
+ } else {
+ caretContainer = getParentCaretContainer(editor.getBody(), formatNode);
+ var newCaretContainer = createCaretContainer(false).dom();
+ var caretNode = insertFormatNodesIntoCaretContainer(parents, newCaretContainer);
+ if (caretContainer) {
+ insertCaretContainerNode(editor, newCaretContainer, caretContainer);
+ } else {
+ insertCaretContainerNode(editor, newCaretContainer, formatNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- targetClientRect = Arr.last(caretPosition.getClientRects());
- if (!targetClientRect) {
- return result;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ removeCaretContainerNode(dom, selection, caretContainer, false);
+ selection.setCursorLocation(caretNode, 1);
+ if (dom.isEmpty(formatNode)) {
+ dom.remove(formatNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node = caretPosition.getNode();
- add(node);
- findUntil(direction, rootNode, add, node);
-
- return result;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function aboveLineNumber(lineNumber, clientRect) {
- return clientRect.line > lineNumber;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var disableCaretContainer = function (body, dom, selection, keyCode) {
+ removeCaretContainer(body, dom, selection, null, false);
+ if (keyCode === 8 && selection.isCollapsed() && selection.getStart().innerHTML === ZWSP$1) {
+ removeCaretContainer(body, dom, selection, getParentCaretContainer(body, selection.getStart()));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function isLine(lineNumber, clientRect) {
- return clientRect.line === lineNumber;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (keyCode === 37 || keyCode === 39) {
+ removeCaretContainer(body, dom, selection, getParentCaretContainer(body, selection.getStart()));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var setup$2 = function (editor) {
+ var dom = editor.dom, selection = editor.selection;
+ var body = editor.getBody();
+ editor.on('mouseup keydown', function (e) {
+ disableCaretContainer(body, dom, selection, e.keyCode);
+ });
+ };
+ var replaceWithCaretFormat = function (targetNode, formatNodes) {
+ var caretContainer = createCaretContainer(false);
+ var innerMost = insertFormatNodesIntoCaretContainer(formatNodes, caretContainer.dom());
+ $_doli6x2kjfuw8lky.before($_c9h6qlzjfuw8l98.fromDom(targetNode), caretContainer);
+ $_byg6a92ujfuw8lmi.remove($_c9h6qlzjfuw8l98.fromDom(targetNode));
+ return CaretPosition$1(innerMost, 0);
+ };
+ var isFormatElement = function (editor, element) {
+ var inlineElements = editor.schema.getTextInlineElements();
+ return inlineElements.hasOwnProperty($_eaw33d10jfuw8l9f.name(element)) && !isCaretNode(element.dom()) && !$_ey7ka11qjfuw8ldg.isBogus(element.dom());
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var upUntil = curry(walkUntil, -1, ClientRect.isAbove, ClientRect.isBelow);
- var downUntil = curry(walkUntil, 1, ClientRect.isBelow, ClientRect.isAbove);
-
- function positionsUntil(direction, rootNode, predicateFn, node) {
- var caretWalker = new CaretWalker(rootNode), walkFn, isBelowFn, isAboveFn,
- caretPosition, result = [], line = 0, clientRect, targetClientRect;
-
- function getClientRect(caretPosition) {
- if (direction == 1) {
- return Arr.last(caretPosition.getClientRects());
- }
-
- return Arr.last(caretPosition.getClientRects());
- }
-
- if (direction == 1) {
- walkFn = caretWalker.next;
- isBelowFn = ClientRect.isBelow;
- isAboveFn = ClientRect.isAbove;
- caretPosition = CaretPosition.after(node);
- } else {
- walkFn = caretWalker.prev;
- isBelowFn = ClientRect.isAbove;
- isAboveFn = ClientRect.isBelow;
- caretPosition = CaretPosition.before(node);
- }
-
- targetClientRect = getClientRect(caretPosition);
-
- do {
- if (!caretPosition.isVisible()) {
- continue;
- }
-
- clientRect = getClientRect(caretPosition);
-
- if (isAboveFn(clientRect, targetClientRect)) {
- continue;
- }
-
- if (result.length > 0 && isBelowFn(clientRect, Arr.last(result))) {
- line++;
- }
-
- clientRect = ClientRect.clone(clientRect);
- clientRect.position = caretPosition;
- clientRect.line = line;
-
- if (predicateFn(clientRect)) {
- return result;
- }
-
- result.push(clientRect);
- } while ((caretPosition = walkFn(caretPosition)));
-
- return result;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var postProcessHooks = {};
+ var filter$2 = $_djuh8tljfuw8l74.filter;
+ var each$12 = $_djuh8tljfuw8l74.each;
+ var addPostProcessHook = function (name, hook) {
+ var hooks = postProcessHooks[name];
+ if (!hooks) {
+ postProcessHooks[name] = hooks = [];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- upUntil: upUntil,
- downUntil: downUntil,
-
- /**
- * Find client rects with line and caret position until the predicate returns true.
- *
- * @method positionsUntil
- * @param {Number} direction Direction forward/backward 1/-1.
- * @param {DOMNode} rootNode Root node to walk within.
- * @param {function} predicateFn Gets the client rect as it's input.
- * @param {DOMNode} node Node to start walking from.
- * @return {Array} Array of client rects with line and position properties.
- */
- positionsUntil: positionsUntil,
-
- isAboveLine: curry(aboveLineNumber),
- isLine: curry(isLine)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ postProcessHooks[name].push(hook);
+ };
+ var postProcess = function (name, editor) {
+ each$12(postProcessHooks[name], function (hook) {
+ hook(editor);
+ });
+ };
+ addPostProcessHook('pre', function (editor) {
+ var rng = editor.selection.getRng();
+ var isPre, blocks;
+ var hasPreSibling = function (pre) {
+ return isPre(pre.previousSibling) && $_djuh8tljfuw8l74.indexOf(blocks, pre.previousSibling) !== -1;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * CefUtils.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.CefUtils',
- [
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.caret.CaretUtils',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.util.Fun'
- ],
- function (CaretPosition, CaretUtils, NodeType, Fun) {
- var isContentEditableTrue = NodeType.isContentEditableTrue;
- var isContentEditableFalse = NodeType.isContentEditableFalse;
-
- var showCaret = function (direction, editor, node, before) {
- // TODO: Figure out a better way to handle this dependency
- return editor._selectionOverrides.showCaret(direction, node, before);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var joinPre = function (pre1, pre2) {
+ DomQuery(pre2).remove();
+ DomQuery(pre1).append('<br><br>').append(pre2.childNodes);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ isPre = $_ey7ka11qjfuw8ldg.matchNodeNames('pre');
+ if (!rng.collapsed) {
+ blocks = editor.selection.getSelectedBlocks();
+ each$12(filter$2(filter$2(blocks, isPre), hasPreSibling), function (pre) {
+ joinPre(pre.previousSibling, pre);
+ });
+ }
+ });
+ var $_18y3c15qjfuw8m8m = { postProcess: postProcess };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getNodeRange = function (node) {
- var rng = node.ownerDocument.createRange();
- rng.selectNode(node);
- return rng;
- };
-
- var selectNode = function (editor, node) {
- var e;
-
- e = editor.fire('BeforeObjectSelected', { target: node });
- if (e.isDefaultPrevented()) {
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$13 = $_52qop8kjfuw8l6v.each;
+ var getEndChild = function (container, index) {
+ var childNodes = container.childNodes;
+ index--;
+ if (index > childNodes.length - 1) {
+ index = childNodes.length - 1;
+ } else if (index < 0) {
+ index = 0;
+ }
+ return childNodes[index] || container;
+ };
+ var walk$2 = function (dom, rng, callback) {
+ var startContainer = rng.startContainer;
+ var startOffset = rng.startOffset;
+ var endContainer = rng.endContainer;
+ var endOffset = rng.endOffset;
+ var ancestor;
+ var startPoint;
+ var endPoint;
+ var node;
+ var parent;
+ var siblings;
+ var nodes;
+ nodes = dom.select('td[data-mce-selected],th[data-mce-selected]');
+ if (nodes.length > 0) {
+ each$13(nodes, function (node) {
+ callback([node]);
+ });
+ return;
+ }
+ var exclude = function (nodes) {
+ var node;
+ node = nodes[0];
+ if (node.nodeType === 3 && node === startContainer && startOffset >= node.nodeValue.length) {
+ nodes.splice(0, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return getNodeRange(node);
- };
-
- var renderCaretAtRange = function (editor, range) {
- var caretPosition, ceRoot;
-
- range = CaretUtils.normalizeRange(1, editor.getBody(), range);
- caretPosition = CaretPosition.fromRangeStart(range);
-
- if (isContentEditableFalse(caretPosition.getNode())) {
- return showCaret(1, editor, caretPosition.getNode(), !caretPosition.isAtEnd());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = nodes[nodes.length - 1];
+ if (endOffset === 0 && nodes.length > 0 && node === endContainer && node.nodeType === 3) {
+ nodes.splice(nodes.length - 1, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isContentEditableFalse(caretPosition.getNode(true))) {
- return showCaret(1, editor, caretPosition.getNode(true), false);
- }
-
- // TODO: Should render caret before/after depending on where you click on the page forces after now
- ceRoot = editor.dom.getParent(caretPosition.getNode(), Fun.or(isContentEditableFalse, isContentEditableTrue));
- if (isContentEditableFalse(ceRoot)) {
- return showCaret(1, editor, ceRoot, false);
- }
-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return nodes;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var renderRangeCaret = function (editor, range) {
- var caretRange;
-
- if (!range || !range.collapsed) {
- return range;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var collectSiblings = function (node, name, endNode) {
+ var siblings = [];
+ for (; node && node !== endNode; node = node[name]) {
+ siblings.push(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- caretRange = renderCaretAtRange(editor, range);
- if (caretRange) {
- return caretRange;
- }
-
- return range;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return siblings;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- showCaret: showCaret,
- selectNode: selectNode,
- renderCaretAtRange: renderCaretAtRange,
- renderRangeCaret: renderRangeCaret
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var findEndPoint = function (node, root) {
+ do {
+ if (node.parentNode === root) {
+ return node;
+ }
+ node = node.parentNode;
+ } while (node);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * CefNavigation.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.CefNavigation',
- [
- 'tinymce.core.caret.CaretContainer',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.caret.CaretUtils',
- 'tinymce.core.caret.CaretWalker',
- 'tinymce.core.caret.LineUtils',
- 'tinymce.core.caret.LineWalker',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.Env',
- 'tinymce.core.keyboard.CefUtils',
- 'tinymce.core.util.Arr',
- 'tinymce.core.util.Fun'
- ],
- function (CaretContainer, CaretPosition, CaretUtils, CaretWalker, LineUtils, LineWalker, NodeType, RangeUtils, Env, CefUtils, Arr, Fun) {
- var isContentEditableFalse = NodeType.isContentEditableFalse;
- var getSelectedNode = RangeUtils.getSelectedNode;
- var isAfterContentEditableFalse = CaretUtils.isAfterContentEditableFalse;
- var isBeforeContentEditableFalse = CaretUtils.isBeforeContentEditableFalse;
-
- var getVisualCaretPosition = function (walkFn, caretPosition) {
- while ((caretPosition = walkFn(caretPosition))) {
- if (caretPosition.isVisible()) {
- return caretPosition;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var walkBoundary = function (startNode, endNode, next) {
+ var siblingName = next ? 'nextSibling' : 'previousSibling';
+ for (node = startNode, parent = node.parentNode; node && node !== endNode; node = parent) {
+ parent = node.parentNode;
+ siblings = collectSiblings(node === startNode ? node : node[siblingName], siblingName);
+ if (siblings.length) {
+ if (!next) {
+ siblings.reverse();
+ }
+ callback(exclude(siblings));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return caretPosition;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isMoveInsideSameBlock = function (fromCaretPosition, toCaretPosition) {
- var inSameBlock = CaretUtils.isInSameBlock(fromCaretPosition, toCaretPosition);
-
- // Handle bogus BR <p>abc|<br></p>
- if (!inSameBlock && NodeType.isBr(fromCaretPosition.getNode())) {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (startContainer.nodeType === 1 && startContainer.hasChildNodes()) {
+ startContainer = startContainer.childNodes[startOffset];
+ }
+ if (endContainer.nodeType === 1 && endContainer.hasChildNodes()) {
+ endContainer = getEndChild(endContainer, endOffset);
+ }
+ if (startContainer === endContainer) {
+ return callback(exclude([startContainer]));
+ }
+ ancestor = dom.findCommonAncestor(startContainer, endContainer);
+ for (node = startContainer; node; node = node.parentNode) {
+ if (node === endContainer) {
+ return walkBoundary(startContainer, ancestor, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return inSameBlock;
- };
-
- var isRangeInCaretContainerBlock = function (range) {
- return CaretContainer.isCaretContainerBlock(range.startContainer);
- };
-
- var getNormalizedRangeEndPoint = function (direction, rootNode, range) {
- range = CaretUtils.normalizeRange(direction, rootNode, range);
-
- if (direction === -1) {
- return CaretPosition.fromRangeStart(range);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node === ancestor) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return CaretPosition.fromRangeEnd(range);
- };
-
- var moveToCeFalseHorizontally = function (direction, editor, getNextPosFn, isBeforeContentEditableFalseFn, range) {
- var node, caretPosition, peekCaretPosition, rangeIsInContainerBlock;
-
- if (!range.collapsed) {
- node = getSelectedNode(range);
- if (isContentEditableFalse(node)) {
- return CefUtils.showCaret(direction, editor, node, direction === -1);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ for (node = endContainer; node; node = node.parentNode) {
+ if (node === startContainer) {
+ return walkBoundary(endContainer, ancestor);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node === ancestor) {
+ break;
+ }
+ }
+ startPoint = findEndPoint(startContainer, ancestor) || startContainer;
+ endPoint = findEndPoint(endContainer, ancestor) || endContainer;
+ walkBoundary(startContainer, startPoint, true);
+ siblings = collectSiblings(startPoint === startContainer ? startPoint : startPoint.nextSibling, 'nextSibling', endPoint === endContainer ? endPoint.nextSibling : endPoint);
+ if (siblings.length) {
+ callback(exclude(siblings));
+ }
+ walkBoundary(endContainer, endPoint);
+ };
+ var $_1l4f5i5tjfuw8m9h = { walk: walk$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rangeIsInContainerBlock = isRangeInCaretContainerBlock(range);
- caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range);
-
- if (isBeforeContentEditableFalseFn(caretPosition)) {
- return CefUtils.selectNode(editor, caretPosition.getNode(direction === -1));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var MCE_ATTR_RE = /^(src|href|style)$/;
+ var each$14 = $_52qop8kjfuw8l6v.each;
+ var isEq$5 = $_5nzvub5njfuw8m89.isEq;
+ var isTableCell$4 = function (node) {
+ return /^(TH|TD)$/.test(node.nodeName);
+ };
+ var getContainer = function (ed, rng, start) {
+ var container, offset, lastIdx;
+ container = rng[start ? 'startContainer' : 'endContainer'];
+ offset = rng[start ? 'startOffset' : 'endOffset'];
+ if ($_ey7ka11qjfuw8ldg.isElement(container)) {
+ lastIdx = container.childNodes.length - 1;
+ if (!start && offset) {
+ offset--;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- caretPosition = getNextPosFn(caretPosition);
- if (!caretPosition) {
- if (rangeIsInContainerBlock) {
- return range;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = container.childNodes[offset > lastIdx ? lastIdx : offset];
+ }
+ if ($_ey7ka11qjfuw8ldg.isText(container) && start && offset >= container.nodeValue.length) {
+ container = new TreeWalker(container, ed.getBody()).next() || container;
+ }
+ if ($_ey7ka11qjfuw8ldg.isText(container) && !start && offset === 0) {
+ container = new TreeWalker(container, ed.getBody()).prev() || container;
+ }
+ return container;
+ };
+ var wrap$2 = function (dom, node, name, attrs) {
+ var wrapper = dom.create(name, attrs);
+ node.parentNode.insertBefore(wrapper, node);
+ wrapper.appendChild(node);
+ return wrapper;
+ };
+ var matchName$1 = function (dom, node, format) {
+ if (isEq$5(node, format.inline)) {
+ return true;
+ }
+ if (isEq$5(node, format.block)) {
+ return true;
+ }
+ if (format.selector) {
+ return $_ey7ka11qjfuw8ldg.isElement(node) && dom.is(node, format.selector);
+ }
+ };
+ var isColorFormatAndAnchor = function (node, format) {
+ return format.links && node.tagName === 'A';
+ };
+ var find$4 = function (dom, node, next, inc) {
+ node = $_5nzvub5njfuw8m89.getNonWhiteSpaceSibling(node, next, inc);
+ return !node || (node.nodeName === 'BR' || dom.isBlock(node));
+ };
+ var removeNode$1 = function (ed, node, format) {
+ var parentNode = node.parentNode;
+ var rootBlockElm;
+ var dom = ed.dom, forcedRootBlock = ed.settings.forced_root_block;
+ if (format.block) {
+ if (!forcedRootBlock) {
+ if (dom.isBlock(node) && !dom.isBlock(parentNode)) {
+ if (!find$4(dom, node, false) && !find$4(dom, node.firstChild, true, 1)) {
+ node.insertBefore(dom.create('br'), node.firstChild);
+ }
+ if (!find$4(dom, node, true) && !find$4(dom, node.lastChild, false, 1)) {
+ node.appendChild(dom.create('br'));
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if (parentNode === dom.getRoot()) {
+ if (!format.list_block || !isEq$5(node, format.list_block)) {
+ each$14($_52qop8kjfuw8l6v.grep(node.childNodes), function (node) {
+ if ($_5nzvub5njfuw8m89.isValid(ed, forcedRootBlock, node.nodeName.toLowerCase())) {
+ if (!rootBlockElm) {
+ rootBlockElm = wrap$2(dom, node, forcedRootBlock);
+ dom.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs);
+ } else {
+ rootBlockElm.appendChild(node);
+ }
+ } else {
+ rootBlockElm = 0;
+ }
+ });
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isBeforeContentEditableFalseFn(caretPosition)) {
- return CefUtils.showCaret(direction, editor, caretPosition.getNode(direction === -1), direction === 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (format.selector && format.inline && !isEq$5(format.inline, node)) {
+ return;
+ }
+ dom.remove(node, 1);
+ };
+ var removeFormat = function (ed, format, vars, node, compareNode) {
+ var i, attrs, stylesModified;
+ var dom = ed.dom;
+ if (!matchName$1(dom, node, format) && !isColorFormatAndAnchor(node, format)) {
+ return false;
+ }
+ if (format.remove !== 'all') {
+ each$14(format.styles, function (value, name) {
+ value = $_5nzvub5njfuw8m89.normalizeStyleValue(dom, $_5nzvub5njfuw8m89.replaceVars(value, vars), name);
+ if (typeof name === 'number') {
+ name = value;
+ compareNode = 0;
+ }
+ if (format.remove_similar || (!compareNode || isEq$5($_5nzvub5njfuw8m89.getStyle(dom, compareNode, name), value))) {
+ dom.setStyle(node, name, '');
+ }
+ stylesModified = 1;
+ });
+ if (stylesModified && dom.getAttrib(node, 'style') === '') {
+ node.removeAttribute('style');
+ node.removeAttribute('data-mce-style');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Peek ahead for handling of ab|c<span cE=false> -> abc|<span cE=false>
- peekCaretPosition = getNextPosFn(caretPosition);
- if (isBeforeContentEditableFalseFn(peekCaretPosition)) {
- if (isMoveInsideSameBlock(caretPosition, peekCaretPosition)) {
- return CefUtils.showCaret(direction, editor, peekCaretPosition.getNode(direction === -1), direction === 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ each$14(format.attributes, function (value, name) {
+ var valueOut;
+ value = $_5nzvub5njfuw8m89.replaceVars(value, vars);
+ if (typeof name === 'number') {
+ name = value;
+ compareNode = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!compareNode || isEq$5(dom.getAttrib(compareNode, name), value)) {
+ if (name === 'class') {
+ value = dom.getAttrib(node, name);
+ if (value) {
+ valueOut = '';
+ each$14(value.split(/\s+/), function (cls) {
+ if (/mce\-\w+/.test(cls)) {
+ valueOut += (valueOut ? ' ' : '') + cls;
+ }
+ });
+ if (valueOut) {
+ dom.setAttrib(node, name, valueOut);
+ return;
+ }
+ }
+ }
+ if (name === 'class') {
+ node.removeAttribute('className');
+ }
+ if (MCE_ATTR_RE.test(name)) {
+ node.removeAttribute('data-mce-' + name);
+ }
+ node.removeAttribute(name);
+ }
+ });
+ each$14(format.classes, function (value) {
+ value = $_5nzvub5njfuw8m89.replaceVars(value, vars);
+ if (!compareNode || dom.hasClass(compareNode, value)) {
+ dom.removeClass(node, value);
+ }
+ });
+ attrs = dom.getAttribs(node);
+ for (i = 0; i < attrs.length; i++) {
+ var attrName = attrs[i].nodeName;
+ if (attrName.indexOf('_') !== 0 && attrName.indexOf('data-') !== 0) {
+ return false;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rangeIsInContainerBlock) {
- return CefUtils.renderRangeCaret(editor, caretPosition.toRange());
- }
-
- return null;
- };
-
- var moveToCeFalseVertically = function (direction, editor, walkerFn, range) {
- var caretPosition, linePositions, nextLinePositions,
- closestNextLineRect, caretClientRect, clientX,
- dist1, dist2, contentEditableFalseNode;
-
- contentEditableFalseNode = getSelectedNode(range);
- caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range);
- linePositions = walkerFn(editor.getBody(), LineWalker.isAboveLine(1), caretPosition);
- nextLinePositions = Arr.filter(linePositions, LineWalker.isLine(1));
- caretClientRect = Arr.last(caretPosition.getClientRects());
-
- if (isBeforeContentEditableFalse(caretPosition)) {
- contentEditableFalseNode = caretPosition.getNode();
- }
-
- if (isAfterContentEditableFalse(caretPosition)) {
- contentEditableFalseNode = caretPosition.getNode(true);
- }
-
- if (!caretClientRect) {
- return null;
- }
-
- clientX = caretClientRect.left;
-
- closestNextLineRect = LineUtils.findClosestClientRect(nextLinePositions, clientX);
- if (closestNextLineRect) {
- if (isContentEditableFalse(closestNextLineRect.node)) {
- dist1 = Math.abs(clientX - closestNextLineRect.left);
- dist2 = Math.abs(clientX - closestNextLineRect.right);
-
- return CefUtils.showCaret(direction, editor, closestNextLineRect.node, dist1 < dist2);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (format.remove !== 'none') {
+ removeNode$1(ed, node, format);
+ return true;
+ }
+ };
+ var findFormatRoot = function (editor, container, name, vars, similar) {
+ var formatRoot;
+ each$14($_5nzvub5njfuw8m89.getParents(editor.dom, container.parentNode).reverse(), function (parent) {
+ var format;
+ if (!formatRoot && parent.id !== '_start' && parent.id !== '_end') {
+ format = $_ggpery5ojfuw8m8e.matchNode(editor, parent, name, vars, similar);
+ if (format && format.split !== false) {
+ formatRoot = parent;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (contentEditableFalseNode) {
- var caretPositions = LineWalker.positionsUntil(direction, editor.getBody(), LineWalker.isAboveLine(1), contentEditableFalseNode);
-
- closestNextLineRect = LineUtils.findClosestClientRect(Arr.filter(caretPositions, LineWalker.isLine(1)), clientX);
- if (closestNextLineRect) {
- return CefUtils.renderRangeCaret(editor, closestNextLineRect.position.toRange());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ return formatRoot;
+ };
+ var wrapAndSplit = function (editor, formatList, formatRoot, container, target, split, format, vars) {
+ var parent, clone, lastClone, firstClone, i, formatRootParent;
+ var dom = editor.dom;
+ if (formatRoot) {
+ formatRootParent = formatRoot.parentNode;
+ for (parent = container.parentNode; parent && parent !== formatRootParent; parent = parent.parentNode) {
+ clone = dom.clone(parent, false);
+ for (i = 0; i < formatList.length; i++) {
+ if (removeFormat(editor, formatList[i], vars, clone, clone)) {
+ clone = 0;
+ break;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- closestNextLineRect = Arr.last(Arr.filter(caretPositions, LineWalker.isLine(0)));
- if (closestNextLineRect) {
- return CefUtils.renderRangeCaret(editor, closestNextLineRect.position.toRange());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (clone) {
+ if (lastClone) {
+ clone.appendChild(lastClone);
+ }
+ if (!firstClone) {
+ firstClone = clone;
+ }
+ lastClone = clone;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (split && (!format.mixed || !dom.isBlock(formatRoot))) {
+ container = dom.split(formatRoot, container);
+ }
+ if (lastClone) {
+ target.parentNode.insertBefore(lastClone, target);
+ firstClone.appendChild(target);
+ }
+ }
+ return container;
+ };
+ var remove$4 = function (ed, name, vars, node, similar) {
+ var formatList = ed.formatter.get(name), format = formatList[0];
+ var bookmark, rng, contentEditable = true;
+ var dom = ed.dom;
+ var selection = ed.selection;
+ var splitToFormatRoot = function (container) {
+ var formatRoot = findFormatRoot(ed, container, name, vars, similar);
+ return wrapAndSplit(ed, formatList, formatRoot, container, container, true, format, vars);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var createTextBlock = function (editor) {
- var textBlock = editor.dom.create(editor.settings.forced_root_block);
-
- if (!Env.ie || Env.ie >= 11) {
- textBlock.innerHTML = '<br data-mce-bogus="1">';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var process = function (node) {
+ var children, i, l, lastContentEditable, hasContentEditableState;
+ if ($_ey7ka11qjfuw8ldg.isElement(node) && dom.getContentEditable(node)) {
+ lastContentEditable = contentEditable;
+ contentEditable = dom.getContentEditable(node) === 'true';
+ hasContentEditableState = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return textBlock;
- };
-
- var exitPreBlock = function (editor, direction, range) {
- var pre, caretPos, newBlock;
- var caretWalker = new CaretWalker(editor.getBody());
- var getNextVisualCaretPosition = Fun.curry(getVisualCaretPosition, caretWalker.next);
- var getPrevVisualCaretPosition = Fun.curry(getVisualCaretPosition, caretWalker.prev);
-
- if (range.collapsed && editor.settings.forced_root_block) {
- pre = editor.dom.getParent(range.startContainer, 'PRE');
- if (!pre) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ children = $_52qop8kjfuw8l6v.grep(node.childNodes);
+ if (contentEditable && !hasContentEditableState) {
+ for (i = 0, l = formatList.length; i < l; i++) {
+ if (removeFormat(ed, formatList[i], vars, node, node)) {
+ break;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (direction === 1) {
- caretPos = getNextVisualCaretPosition(CaretPosition.fromRangeStart(range));
- } else {
- caretPos = getPrevVisualCaretPosition(CaretPosition.fromRangeStart(range));
- }
-
- if (!caretPos) {
- newBlock = createTextBlock(editor);
-
- if (direction === 1) {
- editor.$(pre).after(newBlock);
- } else {
- editor.$(pre).before(newBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (format.deep) {
+ if (children.length) {
+ for (i = 0, l = children.length; i < l; i++) {
+ process(children[i]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.selection.select(newBlock, true);
- editor.selection.collapse();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (hasContentEditableState) {
+ contentEditable = lastContentEditable;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getHorizontalRange = function (editor, forward) {
- var caretWalker = new CaretWalker(editor.getBody());
- var getNextVisualCaretPosition = Fun.curry(getVisualCaretPosition, caretWalker.next);
- var getPrevVisualCaretPosition = Fun.curry(getVisualCaretPosition, caretWalker.prev);
- var newRange, direction = forward ? 1 : -1;
- var getNextPosFn = forward ? getNextVisualCaretPosition : getPrevVisualCaretPosition;
- var isBeforeContentEditableFalseFn = forward ? isBeforeContentEditableFalse : isAfterContentEditableFalse;
- var range = editor.selection.getRng();
-
- newRange = moveToCeFalseHorizontally(direction, editor, getNextPosFn, isBeforeContentEditableFalseFn, range);
- if (newRange) {
- return newRange;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var unwrap = function (start) {
+ var node = dom.get(start ? '_start' : '_end');
+ var out = node[start ? 'firstChild' : 'lastChild'];
+ if ($_disscn2njfuw8ll3.isBookmarkNode(out)) {
+ out = out[start ? 'firstChild' : 'lastChild'];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- newRange = exitPreBlock(editor, direction, range);
- if (newRange) {
- return newRange;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_ey7ka11qjfuw8ldg.isText(out) && out.data.length === 0) {
+ out = start ? node.previousSibling || node.nextSibling : node.nextSibling || node.previousSibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.remove(node, true);
+ return out;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getVerticalRange = function (editor, down) {
- var newRange, direction = down ? 1 : -1;
- var walkerFn = down ? LineWalker.downUntil : LineWalker.upUntil;
- var range = editor.selection.getRng();
-
- newRange = moveToCeFalseVertically(direction, editor, walkerFn, range);
- if (newRange) {
- return newRange;
- }
-
- newRange = exitPreBlock(editor, direction, range);
- if (newRange) {
- return newRange;
- }
-
- return null;
- };
-
- var moveH = function (editor, forward) {
- return function () {
- var newRng = getHorizontalRange(editor, forward);
-
- if (newRng) {
- editor.selection.setRng(newRng);
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var removeRngStyle = function (rng) {
+ var startContainer, endContainer;
+ var commonAncestorContainer = rng.commonAncestorContainer;
+ rng = $_eq6rbn5mjfuw8m82.expandRng(ed, rng, formatList, true);
+ if (format.split) {
+ startContainer = getContainer(ed, rng, true);
+ endContainer = getContainer(ed, rng);
+ if (startContainer !== endContainer) {
+ if (/^(TR|TH|TD)$/.test(startContainer.nodeName) && startContainer.firstChild) {
+ if (startContainer.nodeName === 'TR') {
+ startContainer = startContainer.firstChild.firstChild || startContainer;
+ } else {
+ startContainer = startContainer.firstChild || startContainer;
+ }
+ }
+ if (commonAncestorContainer && /^T(HEAD|BODY|FOOT|R)$/.test(commonAncestorContainer.nodeName) && isTableCell$4(endContainer) && endContainer.firstChild) {
+ endContainer = endContainer.firstChild || endContainer;
+ }
+ if (dom.isChildOf(startContainer, endContainer) && startContainer !== endContainer && !dom.isBlock(endContainer) && !isTableCell$4(startContainer) && !isTableCell$4(endContainer)) {
+ startContainer = wrap$2(dom, startContainer, 'span', {
+ 'id': '_start',
+ 'data-mce-type': 'bookmark'
+ });
+ splitToFormatRoot(startContainer);
+ startContainer = unwrap(true);
+ return;
+ }
+ startContainer = wrap$2(dom, startContainer, 'span', {
+ 'id': '_start',
+ 'data-mce-type': 'bookmark'
+ });
+ endContainer = wrap$2(dom, endContainer, 'span', {
+ 'id': '_end',
+ 'data-mce-type': 'bookmark'
+ });
+ splitToFormatRoot(startContainer);
+ splitToFormatRoot(endContainer);
+ startContainer = unwrap(true);
+ endContainer = unwrap();
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ startContainer = endContainer = splitToFormatRoot(startContainer);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- };
-
- var moveV = function (editor, down) {
- return function () {
- var newRng = getVerticalRange(editor, down);
-
- if (newRng) {
- editor.selection.setRng(newRng);
- return true;
- } else {
- return false;
- }
- };
- };
-
- return {
- moveH: moveH,
- moveV: moveV
- };
- }
-);
-
-define(
- 'ephox.katamari.api.Merger',
-
- [
- 'ephox.katamari.api.Type',
- 'global!Array',
- 'global!Error'
- ],
-
- function (Type, Array, Error) {
-
- var shallow = function (old, nu) {
- return nu;
- };
-
- var deep = function (old, nu) {
- var bothObjects = Type.isObject(old) && Type.isObject(nu);
- return bothObjects ? deepMerge(old, nu) : nu;
- };
-
- var baseMerge = function (merger) {
- return function() {
- // Don't use array slice(arguments), makes the whole function unoptimisable on Chrome
- var objects = new Array(arguments.length);
- for (var i = 0; i < objects.length; i++) objects[i] = arguments[i];
-
- if (objects.length === 0) throw new Error('Can\'t merge zero objects');
-
- var ret = {};
- for (var j = 0; j < objects.length; j++) {
- var curObject = objects[j];
- for (var key in curObject) if (curObject.hasOwnProperty(key)) {
- ret[key] = merger(ret[key], curObject[key]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ rng.startContainer = startContainer.parentNode ? startContainer.parentNode : startContainer;
+ rng.startOffset = dom.nodeIndex(startContainer);
+ rng.endContainer = endContainer.parentNode ? endContainer.parentNode : endContainer;
+ rng.endOffset = dom.nodeIndex(endContainer) + 1;
+ }
+ $_1l4f5i5tjfuw8m9h.walk(dom, rng, function (nodes) {
+ each$14(nodes, function (node) {
+ process(node);
+ if ($_ey7ka11qjfuw8ldg.isElement(node) && ed.dom.getStyle(node, 'text-decoration') === 'underline' && node.parentNode && $_5nzvub5njfuw8m89.getTextDecoration(dom, node.parentNode) === 'underline') {
+ removeFormat(ed, {
+ deep: false,
+ exact: true,
+ inline: 'span',
+ styles: { textDecoration: 'underline' }
+ }, null, node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- return ret;
- };
- };
-
- var deepMerge = baseMerge(deep);
- var merge = baseMerge(shallow);
-
- return {
- deepMerge: deepMerge,
- merge: merge
- };
- }
-);
-/**
- * MatchKeys.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.MatchKeys',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Merger'
- ],
- function (Arr, Fun, Merger) {
- var defaultPatterns = function (patterns) {
- return Arr.map(patterns, function (pattern) {
- return Merger.merge({
- shiftKey: false,
- altKey: false,
- ctrlKey: false,
- metaKey: false,
- keyCode: 0,
- action: Fun.noop
- }, pattern);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var matchesEvent = function (pattern, evt) {
- return (
- evt.keyCode === pattern.keyCode &&
- evt.shiftKey === pattern.shiftKey &&
- evt.altKey === pattern.altKey &&
- evt.ctrlKey === pattern.ctrlKey &&
- evt.metaKey === pattern.metaKey
- );
- };
-
- var match = function (patterns, evt) {
- return Arr.bind(defaultPatterns(patterns), function (pattern) {
- return matchesEvent(pattern, evt) ? [pattern] : [ ];
- });
- };
-
- var action = function (f) {
- var args = Array.prototype.slice.call(arguments, 1);
- return function () {
- return f.apply(null, args);
- };
- };
-
- var execute = function (patterns, evt) {
- return Arr.find(match(patterns, evt), function (pattern) {
- return pattern.action();
- });
- };
-
- return {
- match: match,
- action: action,
- execute: execute
- };
- }
-);
-/**
- * ArrowKeys.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.ArrowKeys',
- [
- 'tinymce.core.keyboard.BoundarySelection',
- 'tinymce.core.keyboard.CefNavigation',
- 'tinymce.core.keyboard.MatchKeys',
- 'tinymce.core.util.VK'
- ],
- function (BoundarySelection, CefNavigation, MatchKeys, VK) {
- var executeKeydownOverride = function (editor, caret, evt) {
- MatchKeys.execute([
- { keyCode: VK.RIGHT, action: CefNavigation.moveH(editor, true) },
- { keyCode: VK.LEFT, action: CefNavigation.moveH(editor, false) },
- { keyCode: VK.UP, action: CefNavigation.moveV(editor, false) },
- { keyCode: VK.DOWN, action: CefNavigation.moveV(editor, true) },
- { keyCode: VK.RIGHT, action: BoundarySelection.move(editor, caret, true) },
- { keyCode: VK.LEFT, action: BoundarySelection.move(editor, caret, false) }
- ], evt).each(function (_) {
- evt.preventDefault();
- });
- };
-
- var setup = function (editor, caret) {
- editor.on('keydown', function (evt) {
- if (evt.isDefaultPrevented() === false) {
- executeKeydownOverride(editor, caret, evt);
- }
- });
- };
-
- return {
- setup: setup
- };
- }
-);
-
-/**
- * DeleteBackspaceKeys.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.DeleteBackspaceKeys',
- [
- 'tinymce.core.delete.BlockBoundaryDelete',
- 'tinymce.core.delete.BlockRangeDelete',
- 'tinymce.core.delete.CefDelete',
- 'tinymce.core.delete.InlineBoundaryDelete',
- 'tinymce.core.keyboard.MatchKeys',
- 'tinymce.core.util.VK'
- ],
- function (BlockBoundaryDelete, BlockRangeDelete, CefDelete, InlineBoundaryDelete, MatchKeys, VK) {
- var executeKeydownOverride = function (editor, caret, evt) {
- MatchKeys.execute([
- { keyCode: VK.BACKSPACE, action: MatchKeys.action(CefDelete.backspaceDelete, editor, false) },
- { keyCode: VK.DELETE, action: MatchKeys.action(CefDelete.backspaceDelete, editor, true) },
- { keyCode: VK.BACKSPACE, action: MatchKeys.action(InlineBoundaryDelete.backspaceDelete, editor, caret, false) },
- { keyCode: VK.DELETE, action: MatchKeys.action(InlineBoundaryDelete.backspaceDelete, editor, caret, true) },
- { keyCode: VK.BACKSPACE, action: MatchKeys.action(BlockRangeDelete.backspaceDelete, editor, false) },
- { keyCode: VK.DELETE, action: MatchKeys.action(BlockRangeDelete.backspaceDelete, editor, true) },
- { keyCode: VK.BACKSPACE, action: MatchKeys.action(BlockBoundaryDelete.backspaceDelete, editor, false) },
- { keyCode: VK.DELETE, action: MatchKeys.action(BlockBoundaryDelete.backspaceDelete, editor, true) }
- ], evt).each(function (_) {
- evt.preventDefault();
- });
- };
-
- var executeKeyupOverride = function (editor, evt) {
- MatchKeys.execute([
- { keyCode: VK.BACKSPACE, action: MatchKeys.action(CefDelete.paddEmptyElement, editor) },
- { keyCode: VK.DELETE, action: MatchKeys.action(CefDelete.paddEmptyElement, editor) }
- ], evt);
- };
-
- var setup = function (editor, caret) {
- editor.on('keydown', function (evt) {
- if (evt.isDefaultPrevented() === false) {
- executeKeydownOverride(editor, caret, evt);
- }
- });
-
- editor.on('keyup', function (evt) {
- if (evt.isDefaultPrevented() === false) {
- executeKeyupOverride(editor, evt);
- }
- });
- };
-
- return {
- setup: setup
- };
- }
-);
-
-/**
- * InsertNewLine.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.InsertNewLine',
- [
- 'tinymce.core.caret.CaretContainer',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.dom.TreeWalker',
- 'tinymce.core.text.Zwsp',
- 'tinymce.core.util.Tools'
- ],
- function (CaretContainer, NodeType, RangeUtils, TreeWalker, Zwsp, Tools) {
- var isEmptyAnchor = function (elm) {
- return elm && elm.nodeName === "A" && Tools.trim(Zwsp.trim(elm.innerText || elm.textContent)).length === 0;
- };
-
- var isTableCell = function (node) {
- return node && /^(TD|TH|CAPTION)$/.test(node.nodeName);
- };
-
- var hasFirstChild = function (elm, name) {
- return elm.firstChild && elm.firstChild.nodeName == name;
- };
-
- var hasParent = function (elm, parentName) {
- return elm && elm.parentNode && elm.parentNode.nodeName === parentName;
- };
-
- var emptyBlock = function (elm) {
- elm.innerHTML = '<br data-mce-bogus="1">';
- };
-
- var containerAndSiblingName = function (container, nodeName) {
- return container.nodeName === nodeName || (container.previousSibling && container.previousSibling.nodeName === nodeName);
- };
-
- var isListBlock = function (elm) {
- return elm && /^(OL|UL|LI)$/.test(elm.nodeName);
- };
-
- var isNestedList = function (elm) {
- return isListBlock(elm) && isListBlock(elm.parentNode);
- };
-
- // Returns true if the block can be split into two blocks or not
- var canSplitBlock = function (dom, node) {
- return node &&
- dom.isBlock(node) &&
- !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) &&
- !/^(fixed|absolute)/i.test(node.style.position) &&
- dom.getContentEditable(node) !== "true";
- };
-
- // Remove the first empty inline element of the block so this: <p><b><em></em></b>x</p> becomes this: <p>x</p>
- var trimInlineElementsOnLeftSideOfBlock = function (dom, nonEmptyElementsMap, block) {
- var node = block, firstChilds = [], i;
-
- if (!node) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node) {
+ if (node.nodeType) {
+ rng = dom.createRng();
+ rng.setStartBefore(node);
+ rng.setEndAfter(node);
+ removeRngStyle(rng);
+ } else {
+ removeRngStyle(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Find inner most first child ex: <p><i><b>*</b></i></p>
- while ((node = node.firstChild)) {
- if (dom.isBlock(node)) {
- return;
- }
-
- if (node.nodeType == 1 && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) {
- firstChilds.push(node);
- }
- }
-
- i = firstChilds.length;
- while (i--) {
- node = firstChilds[i];
- if (!node.hasChildNodes() || (node.firstChild == node.lastChild && node.firstChild.nodeValue === '')) {
- dom.remove(node);
- } else {
- if (isEmptyAnchor(node)) {
- dom.remove(node);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
+ }
+ if (dom.getContentEditable(selection.getNode()) === 'false') {
+ node = selection.getNode();
+ for (var i = 0, l = formatList.length; i < l; i++) {
+ if (formatList[i].ceFalseOverride) {
+ if (removeFormat(ed, formatList[i], vars, node, node)) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
+ }
+ if (!selection.isCollapsed() || !format.inline || dom.select('td[data-mce-selected],th[data-mce-selected]').length) {
+ bookmark = $_cpdbfi2ojfuw8ll6.getPersistentBookmark(ed.selection, true);
+ removeRngStyle(selection.getRng());
+ selection.moveToBookmark(bookmark);
+ if (format.inline && $_ggpery5ojfuw8m8e.match(ed, name, vars, selection.getStart())) {
+ $_5nzvub5njfuw8m89.moveStart(dom, selection, selection.getRng());
+ }
+ ed.nodeChanged();
+ } else {
+ removeCaretFormat(ed, name, vars, similar);
+ }
+ };
+ var $_cm1urk5sjfuw8m8x = {
+ removeFormat: removeFormat,
+ remove: remove$4
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var normalizeZwspOffset = function (start, container, offset) {
- if (NodeType.isText(container) === false) {
- return offset;
- } if (start) {
- return offset === 1 && container.data.charAt(offset - 1) === Zwsp.ZWSP ? 0 : offset;
- } else {
- return offset === container.data.length - 1 && container.data.charAt(offset) === Zwsp.ZWSP ? container.data.length : offset;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$15 = $_52qop8kjfuw8l6v.each;
+ var isElementNode = function (node) {
+ return node && node.nodeType === 1 && !$_disscn2njfuw8ll3.isBookmarkNode(node) && !isCaretNode(node) && !$_ey7ka11qjfuw8ldg.isBogus(node);
+ };
+ var findElementSibling = function (node, siblingName) {
+ var sibling;
+ for (sibling = node; sibling; sibling = sibling[siblingName]) {
+ if (sibling.nodeType === 3 && sibling.nodeValue.length !== 0) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var includeZwspInRange = function (rng) {
- var newRng = rng.cloneRange();
- newRng.setStart(rng.startContainer, normalizeZwspOffset(true, rng.startContainer, rng.startOffset));
- newRng.setEnd(rng.endContainer, normalizeZwspOffset(false, rng.endContainer, rng.endOffset));
- return newRng;
- };
-
- var firstNonWhiteSpaceNodeSibling = function (node) {
- while (node) {
- if (node.nodeType === 1 || (node.nodeType === 3 && node.data && /[\r\n\s]/.test(node.data))) {
- return node;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (sibling.nodeType === 1 && !$_disscn2njfuw8ll3.isBookmarkNode(sibling)) {
+ return sibling;
+ }
+ }
+ return node;
+ };
+ var mergeSiblingsNodes = function (dom, prev, next) {
+ var sibling, tmpSibling;
+ var elementUtils = new ElementUtils(dom);
+ if (prev && next) {
+ prev = findElementSibling(prev, 'previousSibling');
+ next = findElementSibling(next, 'nextSibling');
+ if (elementUtils.compare(prev, next)) {
+ for (sibling = prev.nextSibling; sibling && sibling !== next;) {
+ tmpSibling = sibling;
+ sibling = sibling.nextSibling;
+ prev.appendChild(tmpSibling);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node = node.nextSibling;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.remove(next);
+ $_52qop8kjfuw8l6v.each($_52qop8kjfuw8l6v.grep(next.childNodes), function (node) {
+ prev.appendChild(node);
+ });
+ return prev;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- // Inserts a BR element if the forced_root_block option is set to false or empty string
- var insertBr = function (editor, evt) {
- editor.execCommand("InsertLineBreak", false, evt);
- };
-
- // Trims any linebreaks at the beginning of node user for example when pressing enter in a PRE element
- var trimLeadingLineBreaks = function (node) {
- do {
- if (node.nodeType === 3) {
- node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return next;
+ };
+ var processChildElements = function (node, filter, process) {
+ each$15(node.childNodes, function (node) {
+ if (isElementNode(node)) {
+ if (filter(node)) {
+ process(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node = node.firstChild;
- } while (node);
- };
-
- var getEditableRoot = function (dom, node) {
- var root = dom.getRoot(), parent, editableRoot;
-
- // Get all parents until we hit a non editable parent or the root
- parent = node;
- while (parent !== root && dom.getContentEditable(parent) !== "false") {
- if (dom.getContentEditable(parent) === "true") {
- editableRoot = parent;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.hasChildNodes()) {
+ processChildElements(node, filter, process);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- parent = parent.parentNode;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return parent !== root ? editableRoot : root;
- };
-
- var setForcedBlockAttrs = function (editor, node) {
- var forcedRootBlockName = editor.settings.forced_root_block;
-
- if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {
- editor.dom.setAttribs(node, editor.settings.forced_root_block_attrs);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var hasStyle = function (dom, name) {
+ return $_68e81l6jfuw8kyc.curry(function (name, node) {
+ return !!(node && $_5nzvub5njfuw8m89.getStyle(dom, node, name));
+ }, name);
+ };
+ var applyStyle = function (dom, name, value) {
+ return $_68e81l6jfuw8kyc.curry(function (name, value, node) {
+ dom.setStyle(node, name, value);
+ if (node.getAttribute('style') === '') {
+ node.removeAttribute('style');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- // Wraps any text nodes or inline elements in the specified forced root block name
- var wrapSelfAndSiblingsInDefaultBlock = function (editor, newBlockName, rng, container, offset) {
- var newBlock, parentBlock, startNode, node, next, rootBlockName, blockName = newBlockName || 'P';
- var dom = editor.dom, editableRoot = getEditableRoot(dom, container);
-
- // Not in a block element or in a table cell or caption
- parentBlock = dom.getParent(container, dom.isBlock);
- if (!parentBlock || !canSplitBlock(dom, parentBlock)) {
- parentBlock = parentBlock || editableRoot;
-
- if (parentBlock == editor.getBody() || isTableCell(parentBlock)) {
- rootBlockName = parentBlock.nodeName.toLowerCase();
- } else {
- rootBlockName = parentBlock.parentNode.nodeName.toLowerCase();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unwrapEmptySpan(dom, node);
+ }, name, value);
+ };
+ var unwrapEmptySpan = function (dom, node) {
+ if (node.nodeName === 'SPAN' && dom.getAttribs(node).length === 0) {
+ dom.remove(node, true);
+ }
+ };
+ var processUnderlineAndColor = function (dom, node) {
+ var textDecoration;
+ if (node.nodeType === 1 && node.parentNode && node.parentNode.nodeType === 1) {
+ textDecoration = $_5nzvub5njfuw8m89.getTextDecoration(dom, node.parentNode);
+ if (dom.getStyle(node, 'color') && textDecoration) {
+ dom.setStyle(node, 'text-decoration', textDecoration);
+ } else if (dom.getStyle(node, 'text-decoration') === textDecoration) {
+ dom.setStyle(node, 'text-decoration', null);
+ }
+ }
+ };
+ var mergeUnderlineAndColor = function (dom, format, vars, node) {
+ if (format.styles.color || format.styles.textDecoration) {
+ $_52qop8kjfuw8l6v.walk(node, $_68e81l6jfuw8kyc.curry(processUnderlineAndColor, dom), 'childNodes');
+ processUnderlineAndColor(dom, node);
+ }
+ };
+ var mergeBackgroundColorAndFontSize = function (dom, format, vars, node) {
+ if (format.styles && format.styles.backgroundColor) {
+ processChildElements(node, hasStyle(dom, 'fontSize'), applyStyle(dom, 'backgroundColor', $_5nzvub5njfuw8m89.replaceVars(format.styles.backgroundColor, vars)));
+ }
+ };
+ var mergeSubSup = function (dom, format, vars, node) {
+ if (format.inline === 'sub' || format.inline === 'sup') {
+ processChildElements(node, hasStyle(dom, 'fontSize'), applyStyle(dom, 'fontSize', ''));
+ dom.remove(dom.select(format.inline === 'sup' ? 'sub' : 'sup', node), true);
+ }
+ };
+ var mergeSiblings = function (dom, format, vars, node) {
+ if (node && format.merge_siblings !== false) {
+ node = mergeSiblingsNodes(dom, $_5nzvub5njfuw8m89.getNonWhiteSpaceSibling(node), node);
+ node = mergeSiblingsNodes(dom, node, $_5nzvub5njfuw8m89.getNonWhiteSpaceSibling(node, true));
+ }
+ };
+ var clearChildStyles = function (dom, format, node) {
+ if (format.clear_child_styles) {
+ var selector = format.links ? '*:not(a)' : '*';
+ each$15(dom.select(selector, node), function (node) {
+ if (isElementNode(node)) {
+ each$15(format.styles, function (value, name) {
+ dom.setStyle(node, name, '');
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!parentBlock.hasChildNodes()) {
- newBlock = dom.create(blockName);
- setForcedBlockAttrs(editor, newBlock);
- parentBlock.appendChild(newBlock);
- rng.setStart(newBlock, 0);
- rng.setEnd(newBlock, 0);
- return newBlock;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ };
+ var mergeWithChildren = function (editor, formatList, vars, node) {
+ each$15(formatList, function (format) {
+ each$15(editor.dom.select(format.inline, node), function (child) {
+ if (!isElementNode(child)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Find parent that is the first child of parentBlock
- node = container;
- while (node.parentNode != parentBlock) {
- node = node.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_cm1urk5sjfuw8m8x.removeFormat(editor, format, vars, child, format.exact ? child : null);
+ });
+ clearChildStyles(editor.dom, format, node);
+ });
+ };
+ var mergeWithParents = function (editor, format, name, vars, node) {
+ if ($_ggpery5ojfuw8m8e.matchNode(editor, node.parentNode, name, vars)) {
+ if ($_cm1urk5sjfuw8m8x.removeFormat(editor, format, vars, node)) {
+ return;
+ }
+ }
+ if (format.merge_with_parents) {
+ editor.dom.getParent(node.parentNode, function (parent) {
+ if ($_ggpery5ojfuw8m8e.matchNode(editor, parent, name, vars)) {
+ $_cm1urk5sjfuw8m8x.removeFormat(editor, format, vars, node);
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ };
+ var $_5wjyn05rjfuw8m8o = {
+ mergeWithChildren: mergeWithChildren,
+ mergeUnderlineAndColor: mergeUnderlineAndColor,
+ mergeBackgroundColorAndFontSize: mergeBackgroundColorAndFontSize,
+ mergeSubSup: mergeSubSup,
+ mergeSiblings: mergeSiblings,
+ mergeWithParents: mergeWithParents
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Loop left to find start node start wrapping at
- while (node && !dom.isBlock(node)) {
- startNode = node;
- node = node.previousSibling;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$16 = $_52qop8kjfuw8l6v.each;
+ var isElementNode$1 = function (node) {
+ return node && node.nodeType === 1 && !$_disscn2njfuw8ll3.isBookmarkNode(node) && !isCaretNode(node) && !$_ey7ka11qjfuw8ldg.isBogus(node);
+ };
+ var applyFormat = function (ed, name, vars, node) {
+ var formatList = ed.formatter.get(name);
+ var format = formatList[0];
+ var bookmark, rng;
+ var isCollapsed = !node && ed.selection.isCollapsed();
+ var dom = ed.dom, selection = ed.selection;
+ var setElementFormat = function (elm, fmt) {
+ fmt = fmt || format;
+ if (elm) {
+ if (fmt.onformat) {
+ fmt.onformat(elm, fmt, vars, node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (startNode && editor.schema.isValidChild(rootBlockName, blockName.toLowerCase())) {
- newBlock = dom.create(blockName);
- setForcedBlockAttrs(editor, newBlock);
- startNode.parentNode.insertBefore(newBlock, startNode);
-
- // Start wrapping until we hit a block
- node = startNode;
- while (node && !dom.isBlock(node)) {
- next = node.nextSibling;
- newBlock.appendChild(node);
- node = next;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ each$16(fmt.styles, function (value, name) {
+ dom.setStyle(elm, name, $_5nzvub5njfuw8m89.replaceVars(value, vars));
+ });
+ if (fmt.styles) {
+ var styleVal = dom.getAttrib(elm, 'style');
+ if (styleVal) {
+ elm.setAttribute('data-mce-style', styleVal);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Restore range to it's past location
- rng.setStart(container, offset);
- rng.setEnd(container, offset);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ each$16(fmt.attributes, function (value, name) {
+ dom.setAttrib(elm, name, $_5nzvub5njfuw8m89.replaceVars(value, vars));
+ });
+ each$16(fmt.classes, function (value) {
+ value = $_5nzvub5njfuw8m89.replaceVars(value, vars);
+ if (!dom.hasClass(elm, value)) {
+ dom.addClass(elm, value);
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return container;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Adds a BR at the end of blocks that only contains an IMG or INPUT since
- // these might be floated and then they won't expand the block
- var addBrToBlockIfNeeded = function (dom, block) {
- var lastChild;
-
- // IE will render the blocks correctly other browsers needs a BR
- block.normalize(); // Remove empty text nodes that got left behind by the extract
-
- // Check if the block is empty or contains a floated last child
- lastChild = block.lastChild;
- if (!lastChild || (/^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true)))) {
- dom.add(block, 'br');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var applyNodeStyle = function (formatList, node) {
+ var found = false;
+ if (!format.selector) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var getContainerBlock = function (containerBlock) {
- var containerBlockParent = containerBlock.parentNode;
-
- if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) {
- return containerBlockParent;
- }
-
- return containerBlock;
- };
-
- var isFirstOrLastLi = function (containerBlock, parentBlock, first) {
- var node = containerBlock[first ? 'firstChild' : 'lastChild'];
-
- // Find first/last element since there might be whitespace there
- while (node) {
- if (node.nodeType == 1) {
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ each$16(formatList, function (format) {
+ if ('collapsed' in format && format.collapsed !== isCollapsed) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node = node[first ? 'nextSibling' : 'previousSibling'];
- }
-
- return node === parentBlock;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (dom.is(node, format.selector) && !isCaretNode(node)) {
+ setElementFormat(node, format);
+ found = true;
+ return false;
+ }
+ });
+ return found;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var insert = function (editor, evt) {
- var tmpRng, editableRoot, container, offset, parentBlock, shiftKey;
- var newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName, isAfterLastNodeInContainer;
- var dom = editor.dom, selection = editor.selection, settings = editor.settings;
- var schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements();
- var rng = editor.selection.getRng();
-
- // Moves the caret to a suitable position within the root for example in the first non
- // pure whitespace text node or before an image
- function moveToCaretPosition(root) {
- var walker, node, rng, lastNode = root, tempElm;
- var moveCaretBeforeOnEnterElementsMap = schema.getMoveCaretBeforeOnEnterElements();
-
- if (!root) {
- return;
- }
-
- if (/^(LI|DT|DD)$/.test(root.nodeName)) {
- var firstChild = firstNonWhiteSpaceNodeSibling(root.firstChild);
-
- if (firstChild && /^(UL|OL|DL)$/.test(firstChild.nodeName)) {
- root.insertBefore(dom.doc.createTextNode('\u00a0'), root.firstChild);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var applyRngStyle = function (dom, rng, bookmark, nodeSpecific) {
+ var newWrappers = [];
+ var wrapName, wrapElm, contentEditable = true;
+ wrapName = format.inline || format.block;
+ wrapElm = dom.create(wrapName);
+ setElementFormat(wrapElm);
+ $_1l4f5i5tjfuw8m9h.walk(dom, rng, function (nodes) {
+ var currentWrapElm;
+ var process = function (node) {
+ var nodeName, parentName, hasContentEditableState, lastContentEditable;
+ lastContentEditable = contentEditable;
+ nodeName = node.nodeName.toLowerCase();
+ parentName = node.parentNode.nodeName.toLowerCase();
+ if (node.nodeType === 1 && dom.getContentEditable(node)) {
+ lastContentEditable = contentEditable;
+ contentEditable = dom.getContentEditable(node) === 'true';
+ hasContentEditableState = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- rng = dom.createRng();
- root.normalize();
-
- if (root.hasChildNodes()) {
- walker = new TreeWalker(root, root);
-
- while ((node = walker.current())) {
- if (node.nodeType == 3) {
- rng.setStart(node, 0);
- rng.setEnd(node, 0);
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_5nzvub5njfuw8m89.isEq(nodeName, 'br')) {
+ currentWrapElm = 0;
+ if (format.block) {
+ dom.remove(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (moveCaretBeforeOnEnterElementsMap[node.nodeName.toLowerCase()]) {
- rng.setStartBefore(node);
- rng.setEndBefore(node);
- break;
- }
-
- lastNode = node;
- node = walker.next();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!node) {
- rng.setStart(lastNode, 0);
- rng.setEnd(lastNode, 0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (format.wrapper && $_ggpery5ojfuw8m8e.matchNode(ed, node, name, vars)) {
+ currentWrapElm = 0;
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- if (root.nodeName == 'BR') {
- if (root.nextSibling && dom.isBlock(root.nextSibling)) {
- rng.setStartBefore(root);
- rng.setEndBefore(root);
- } else {
- rng.setStartAfter(root);
- rng.setEndAfter(root);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (contentEditable && !hasContentEditableState && format.block && !format.wrapper && $_5nzvub5njfuw8m89.isTextBlock(ed, nodeName) && $_5nzvub5njfuw8m89.isValid(ed, parentName, wrapName)) {
+ node = dom.rename(node, wrapName);
+ setElementFormat(node);
+ newWrappers.push(node);
+ currentWrapElm = 0;
+ return;
+ }
+ if (format.selector) {
+ var found = applyNodeStyle(formatList, node);
+ if (!format.inline || found) {
+ currentWrapElm = 0;
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (contentEditable && !hasContentEditableState && $_5nzvub5njfuw8m89.isValid(ed, wrapName, nodeName) && $_5nzvub5njfuw8m89.isValid(ed, parentName, wrapName) && !(!nodeSpecific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node) && (!format.inline || !dom.isBlock(node))) {
+ if (!currentWrapElm) {
+ currentWrapElm = dom.clone(wrapElm, false);
+ node.parentNode.insertBefore(currentWrapElm, node);
+ newWrappers.push(currentWrapElm);
+ }
+ currentWrapElm.appendChild(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rng.setStart(root, 0);
- rng.setEnd(root, 0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ currentWrapElm = 0;
+ each$16($_52qop8kjfuw8l6v.grep(node.childNodes), process);
+ if (hasContentEditableState) {
+ contentEditable = lastContentEditable;
+ }
+ currentWrapElm = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- selection.setRng(rng);
-
- // Remove tempElm created for old IE:s
- dom.remove(tempElm);
- selection.scrollIntoView(root);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ each$16(nodes, process);
+ });
+ if (format.links === true) {
+ each$16(newWrappers, function (node) {
+ var process = function (node) {
+ if (node.nodeName === 'A') {
+ setElementFormat(node, format);
+ }
+ each$16($_52qop8kjfuw8l6v.grep(node.childNodes), process);
+ };
+ process(node);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Creates a new block element by cloning the current one or creating a new one if the name is specified
- // This function will also copy any text formatting from the parent block and add it to the new one
- function createNewBlock(name) {
- var node = container, block, clonedNode, caretNode, textInlineElements = schema.getTextInlineElements();
-
- if (name || parentBlockName == "TABLE" || parentBlockName == "HR") {
- block = dom.create(name || newBlockName);
- setForcedBlockAttrs(editor, block);
- } else {
- block = parentBlock.cloneNode(false);
- }
-
- caretNode = block;
-
- if (settings.keep_styles === false) {
- dom.setAttrib(block, 'style', null); // wipe out any styles that came over with the block
- dom.setAttrib(block, 'class', null);
- } else {
- // Clone any parent styles
- do {
- if (textInlineElements[node.nodeName]) {
- // Never clone a caret containers
- if (node.id == '_mce_caret') {
- continue;
- }
-
- clonedNode = node.cloneNode(false);
- dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique
-
- if (block.hasChildNodes()) {
- clonedNode.appendChild(block.firstChild);
- block.appendChild(clonedNode);
- } else {
- caretNode = clonedNode;
- block.appendChild(clonedNode);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ each$16(newWrappers, function (node) {
+ var childCount;
+ var getChildCount = function (node) {
+ var count = 0;
+ each$16(node.childNodes, function (node) {
+ if (!$_5nzvub5njfuw8m89.isWhiteSpaceNode(node) && !$_disscn2njfuw8ll3.isBookmarkNode(node)) {
+ count++;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } while ((node = node.parentNode) && node != editableRoot);
- }
-
- emptyBlock(caretNode);
-
- return block;
- }
-
- // Returns true/false if the caret is at the start/end of the parent block element
- function isCaretAtStartOrEndOfBlock(start) {
- var walker, node, name, normalizedOffset;
-
- normalizedOffset = normalizeZwspOffset(start, container, offset);
-
- // Caret is in the middle of a text node like "a|b"
- if (container.nodeType == 3 && (start ? normalizedOffset > 0 : normalizedOffset < container.nodeValue.length)) {
- return false;
- }
-
- // If after the last element in block node edge case for #5091
- if (container.parentNode == parentBlock && isAfterLastNodeInContainer && !start) {
- return true;
- }
-
- // If the caret if before the first element in parentBlock
- if (start && container.nodeType == 1 && container == parentBlock.firstChild) {
- return true;
- }
-
- // Caret can be before/after a table or a hr
- if (containerAndSiblingName(container, 'TABLE') || containerAndSiblingName(container, 'HR')) {
- return (isAfterLastNodeInContainer && !start) || (!isAfterLastNodeInContainer && start);
- }
-
- // Walk the DOM and look for text nodes or non empty elements
- walker = new TreeWalker(container, parentBlock);
-
- // If caret is in beginning or end of a text block then jump to the next/previous node
- if (container.nodeType == 3) {
- if (start && normalizedOffset === 0) {
- walker.prev();
- } else if (!start && normalizedOffset == container.nodeValue.length) {
- walker.next();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ return count;
+ };
+ var getChildElementNode = function (root) {
+ var child = false;
+ each$16(root.childNodes, function (node) {
+ if (isElementNode$1(node)) {
+ child = node;
+ return false;
+ }
+ });
+ return child;
+ };
+ var mergeStyles = function (node) {
+ var child, clone;
+ child = getChildElementNode(node);
+ if (child && !$_disscn2njfuw8ll3.isBookmarkNode(child) && $_ggpery5ojfuw8m8e.matchName(dom, child, format)) {
+ clone = dom.clone(child, false);
+ setElementFormat(clone);
+ dom.replace(clone, node, true);
+ dom.remove(child, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return clone || node;
+ };
+ childCount = getChildCount(node);
+ if ((newWrappers.length > 1 || !dom.isBlock(node)) && childCount === 0) {
+ dom.remove(node, 1);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- while ((node = walker.current())) {
- if (node.nodeType === 1) {
- // Ignore bogus elements
- if (!node.getAttribute('data-mce-bogus')) {
- // Keep empty elements like <img /> <input /> but not trailing br:s like <p>text|<br></p>
- name = node.nodeName.toLowerCase();
- if (nonEmptyElementsMap[name] && name !== 'br') {
- return false;
- }
- }
- } else if (node.nodeType === 3 && !/^[ \t\r\n]*$/.test(node.nodeValue)) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (format.inline || format.wrapper) {
+ if (!format.exact && childCount === 1) {
+ node = mergeStyles(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (start) {
- walker.prev();
- } else {
- walker.next();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_5wjyn05rjfuw8m8o.mergeWithChildren(ed, formatList, vars, node);
+ $_5wjyn05rjfuw8m8o.mergeWithParents(ed, format, name, vars, node);
+ $_5wjyn05rjfuw8m8o.mergeBackgroundColorAndFontSize(dom, format, vars, node);
+ $_5wjyn05rjfuw8m8o.mergeSubSup(dom, format, vars, node);
+ $_5wjyn05rjfuw8m8o.mergeSiblings(dom, format, vars, node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return true;
- }
-
- // Inserts a block or br before/after or in the middle of a split list of the LI is empty
- function handleEmptyListItem() {
- if (containerBlock == editor.getBody()) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ if (dom.getContentEditable(selection.getNode()) === 'false') {
+ node = selection.getNode();
+ for (var i = 0, l = formatList.length; i < l; i++) {
+ if (formatList[i].ceFalseOverride && dom.is(node, formatList[i].selector)) {
+ setElementFormat(node, formatList[i]);
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isNestedList(containerBlock)) {
- newBlockName = 'LI';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return;
+ }
+ if (format) {
+ if (node) {
+ if (node.nodeType) {
+ if (!applyNodeStyle(formatList, node)) {
+ rng = dom.createRng();
+ rng.setStartBefore(node);
+ rng.setEndAfter(node);
+ applyRngStyle(dom, $_eq6rbn5mjfuw8m82.expandRng(ed, rng, formatList), null, true);
+ }
+ } else {
+ applyRngStyle(dom, node, null, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR');
-
- if (isFirstOrLastLi(containerBlock, parentBlock, true) && isFirstOrLastLi(containerBlock, parentBlock, false)) {
- if (hasParent(containerBlock, 'LI')) {
- // Nested list is inside a LI
- dom.insertAfter(newBlock, getContainerBlock(containerBlock));
- } else {
- // Is first and last list item then replace the OL/UL with a text block
- dom.replace(newBlock, containerBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if (!isCollapsed || !format.inline || dom.select('td[data-mce-selected],th[data-mce-selected]').length) {
+ var curSelNode = ed.selection.getNode();
+ if (!ed.settings.forced_root_block && formatList[0].defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) {
+ applyFormat(ed, formatList[0].defaultBlock);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if (isFirstOrLastLi(containerBlock, parentBlock, true)) {
- if (hasParent(containerBlock, 'LI')) {
- // List nested in an LI then move the list to a new sibling LI
- dom.insertAfter(newBlock, getContainerBlock(containerBlock));
- newBlock.appendChild(dom.doc.createTextNode(' ')); // Needed for IE so the caret can be placed
- newBlock.appendChild(containerBlock);
- } else {
- // First LI in list then remove LI and add text block before list
- containerBlock.parentNode.insertBefore(newBlock, containerBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ed.selection.setRng($_538lml30jfuw8ln4.normalize(ed.selection.getRng()));
+ bookmark = $_cpdbfi2ojfuw8ll6.getPersistentBookmark(ed.selection, true);
+ applyRngStyle(dom, $_eq6rbn5mjfuw8m82.expandRng(ed, selection.getRng(), formatList), bookmark);
+ if (format.styles) {
+ $_5wjyn05rjfuw8m8o.mergeUnderlineAndColor(dom, format, vars, curSelNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else if (isFirstOrLastLi(containerBlock, parentBlock, false)) {
- // Last LI in list then remove LI and add text block after list
- dom.insertAfter(newBlock, getContainerBlock(containerBlock));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ selection.moveToBookmark(bookmark);
+ $_5nzvub5njfuw8m89.moveStart(dom, selection, selection.getRng());
+ ed.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Middle LI in list the split the list and insert a text block in the middle
- // Extract after fragment and insert it after the current block
- containerBlock = getContainerBlock(containerBlock);
- tmpRng = rng.cloneRange();
- tmpRng.setStartAfter(parentBlock);
- tmpRng.setEndAfter(containerBlock);
- fragment = tmpRng.extractContents();
-
- if (newBlockName === 'LI' && hasFirstChild(fragment, 'LI')) {
- newBlock = fragment.firstChild;
- dom.insertAfter(fragment, containerBlock);
- } else {
- dom.insertAfter(fragment, containerBlock);
- dom.insertAfter(newBlock, containerBlock);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ applyCaretFormat(ed, name, vars);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- dom.remove(parentBlock);
- moveToCaretPosition(newBlock);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_18y3c15qjfuw8m8m.postProcess(name, ed);
+ }
+ };
+ var $_62fw7e5kjfuw8m7d = { applyFormat: applyFormat };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function insertNewBlockAfter() {
- // If the caret is at the end of a header we produce a P tag after it similar to Word unless we are in a hgroup
- if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName != 'HGROUP') {
- newBlock = createNewBlock(newBlockName);
- } else {
- newBlock = createNewBlock();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$17 = $_52qop8kjfuw8l6v.each;
+ var setup$3 = function (formatChangeData, editor) {
+ var currentFormats = {};
+ formatChangeData.set({});
+ editor.on('NodeChange', function (e) {
+ var parents = $_5nzvub5njfuw8m89.getParents(editor.dom, e.element);
+ var matchedFormats = {};
+ parents = $_52qop8kjfuw8l6v.grep(parents, function (node) {
+ return node.nodeType === 1 && !node.getAttribute('data-mce-bogus');
+ });
+ each$17(formatChangeData.get(), function (callbacks, format) {
+ each$17(parents, function (node) {
+ if (editor.formatter.matchNode(node, format, {}, callbacks.similar)) {
+ if (!currentFormats[format]) {
+ each$17(callbacks, function (callback) {
+ callback(true, {
+ node: node,
+ format: format,
+ parents: parents
+ });
+ });
+ currentFormats[format] = callbacks;
+ }
+ matchedFormats[format] = callbacks;
+ return false;
+ }
+ if ($_ggpery5ojfuw8m8e.matchesUnInheritedFormatSelector(editor, node, format)) {
+ return false;
+ }
+ });
+ });
+ each$17(currentFormats, function (callbacks, format) {
+ if (!matchedFormats[format]) {
+ delete currentFormats[format];
+ each$17(callbacks, function (callback) {
+ callback(false, {
+ node: e.element,
+ format: format,
+ parents: parents
+ });
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Split the current container block element if enter is pressed inside an empty inner block element
- if (settings.end_container_on_empty_block && canSplitBlock(dom, containerBlock) && dom.isEmpty(parentBlock)) {
- // Split container block for example a BLOCKQUOTE at the current blockParent location for example a P
- newBlock = dom.split(containerBlock, parentBlock);
- } else {
- dom.insertAfter(newBlock, parentBlock);
- }
-
- moveToCaretPosition(newBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ });
+ };
+ var addListeners = function (formatChangeData, formats, callback, similar) {
+ var formatChangeItems = formatChangeData.get();
+ each$17(formats.split(','), function (format) {
+ if (!formatChangeItems[format]) {
+ formatChangeItems[format] = [];
+ formatChangeItems[format].similar = similar;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ formatChangeItems[format].push(callback);
+ });
+ formatChangeData.set(formatChangeItems);
+ };
+ var formatChanged = function (editor, formatChangeState, formats, callback, similar) {
+ if (formatChangeState.get() === null) {
+ setup$3(formatChangeState, editor);
+ }
+ addListeners(formatChangeState, formats, callback, similar);
+ };
+ var $_coezzd5ujfuw8m9l = { formatChanged: formatChanged };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Setup range items and newBlockName
- new RangeUtils(dom).normalize(rng);
- container = rng.startContainer;
- offset = rng.startOffset;
- newBlockName = (settings.force_p_newlines ? 'p' : '') || settings.forced_root_block;
- newBlockName = newBlockName ? newBlockName.toUpperCase() : '';
- shiftKey = evt.shiftKey;
-
- // Resolve node index
- if (container.nodeType == 1 && container.hasChildNodes()) {
- isAfterLastNodeInContainer = offset > container.childNodes.length - 1;
-
- container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
- if (isAfterLastNodeInContainer && container.nodeType == 3) {
- offset = container.nodeValue.length;
- } else {
- offset = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var get$5 = function (dom) {
+ var formats = {
+ valigntop: [{
+ selector: 'td,th',
+ styles: { verticalAlign: 'top' }
+ }],
+ valignmiddle: [{
+ selector: 'td,th',
+ styles: { verticalAlign: 'middle' }
+ }],
+ valignbottom: [{
+ selector: 'td,th',
+ styles: { verticalAlign: 'bottom' }
+ }],
+ alignleft: [
+ {
+ selector: 'figure.image',
+ collapsed: false,
+ classes: 'align-left',
+ ceFalseOverride: true,
+ preview: 'font-family font-size'
+ },
+ {
+ selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',
+ styles: { textAlign: 'left' },
+ inherit: false,
+ preview: false,
+ defaultBlock: 'div'
+ },
+ {
+ selector: 'img,table',
+ collapsed: false,
+ styles: { float: 'left' },
+ preview: 'font-family font-size'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Get editable root node, normally the body element but sometimes a div or span
- editableRoot = getEditableRoot(dom, container);
-
- // If there is no editable root then enter is done inside a contentEditable false element
- if (!editableRoot) {
- return;
- }
-
- // If editable root isn't block nor the root of the editor
- if (!dom.isBlock(editableRoot) && editableRoot != dom.getRoot()) {
- if (!newBlockName || shiftKey) {
- insertBr(editor, evt);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ],
+ aligncenter: [
+ {
+ selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',
+ styles: { textAlign: 'center' },
+ inherit: false,
+ preview: 'font-family font-size',
+ defaultBlock: 'div'
+ },
+ {
+ selector: 'figure.image',
+ collapsed: false,
+ classes: 'align-center',
+ ceFalseOverride: true,
+ preview: 'font-family font-size'
+ },
+ {
+ selector: 'img',
+ collapsed: false,
+ styles: {
+ display: 'block',
+ marginLeft: 'auto',
+ marginRight: 'auto'
+ },
+ preview: false
+ },
+ {
+ selector: 'table',
+ collapsed: false,
+ styles: {
+ marginLeft: 'auto',
+ marginRight: 'auto'
+ },
+ preview: 'font-family font-size'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return;
- }
-
- // Wrap the current node and it's sibling in a default block if it's needed.
- // for example this <td>text|<b>text2</b></td> will become this <td><p>text|<b>text2</p></b></td>
- // This won't happen if root blocks are disabled or the shiftKey is pressed
- if ((newBlockName && !shiftKey) || (!newBlockName && shiftKey)) {
- container = wrapSelfAndSiblingsInDefaultBlock(editor, newBlockName, rng, container, offset);
- }
-
- // Find parent block and setup empty block paddings
- parentBlock = dom.getParent(container, dom.isBlock);
- containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;
-
- // Setup block names
- parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
- containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
-
- // Enter inside block contained within a LI then split or insert before/after LI
- if (containerBlockName == 'LI' && !evt.ctrlKey) {
- parentBlock = containerBlock;
- containerBlock = containerBlock.parentNode;
- parentBlockName = containerBlockName;
- }
-
- // Handle enter in list item
- if (/^(LI|DT|DD)$/.test(parentBlockName)) {
- if (!newBlockName && shiftKey) {
- insertBr(editor, evt);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ],
+ alignright: [
+ {
+ selector: 'figure.image',
+ collapsed: false,
+ classes: 'align-right',
+ ceFalseOverride: true,
+ preview: 'font-family font-size'
+ },
+ {
+ selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',
+ styles: { textAlign: 'right' },
+ inherit: false,
+ preview: 'font-family font-size',
+ defaultBlock: 'div'
+ },
+ {
+ selector: 'img,table',
+ collapsed: false,
+ styles: { float: 'right' },
+ preview: 'font-family font-size'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Handle enter inside an empty list item
- if (dom.isEmpty(parentBlock)) {
- handleEmptyListItem();
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ],
+ alignjustify: [{
+ selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',
+ styles: { textAlign: 'justify' },
+ inherit: false,
+ defaultBlock: 'div',
+ preview: 'font-family font-size'
+ }],
+ bold: [
+ {
+ inline: 'strong',
+ remove: 'all'
+ },
+ {
+ inline: 'span',
+ styles: { fontWeight: 'bold' }
+ },
+ {
+ inline: 'b',
+ remove: 'all'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Don't split PRE tags but insert a BR instead easier when writing code samples etc
- if (parentBlockName == 'PRE' && settings.br_in_pre !== false) {
- if (!shiftKey) {
- insertBr(editor, evt);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ],
+ italic: [
+ {
+ inline: 'em',
+ remove: 'all'
+ },
+ {
+ inline: 'span',
+ styles: { fontStyle: 'italic' }
+ },
+ {
+ inline: 'i',
+ remove: 'all'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } else {
- // If no root block is configured then insert a BR by default or if the shiftKey is pressed
- if ((!newBlockName && !shiftKey && parentBlockName != 'LI') || (newBlockName && shiftKey)) {
- insertBr(editor, evt);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ],
+ underline: [
+ {
+ inline: 'span',
+ styles: { textDecoration: 'underline' },
+ exact: true
+ },
+ {
+ inline: 'u',
+ remove: 'all'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // If parent block is root then never insert new blocks
- if (newBlockName && parentBlock === editor.getBody()) {
- return;
- }
-
- // Default block name if it's not configured
- newBlockName = newBlockName || 'P';
-
- // Insert new block before/after the parent block depending on caret location
- if (CaretContainer.isCaretContainerBlock(parentBlock)) {
- newBlock = CaretContainer.showCaretContainerBlock(parentBlock);
- if (dom.isEmpty(parentBlock)) {
- emptyBlock(parentBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ],
+ strikethrough: [
+ {
+ inline: 'span',
+ styles: { textDecoration: 'line-through' },
+ exact: true
+ },
+ {
+ inline: 'strike',
+ remove: 'all'
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- moveToCaretPosition(newBlock);
- } else if (isCaretAtStartOrEndOfBlock()) {
- insertNewBlockAfter();
- } else if (isCaretAtStartOrEndOfBlock(true)) {
- // Insert new block before
- newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock);
-
- // Adjust caret position if HR
- containerAndSiblingName(parentBlock, 'HR') ? moveToCaretPosition(newBlock) : moveToCaretPosition(parentBlock);
- } else {
- // Extract after fragment and insert it after the current block
- tmpRng = includeZwspInRange(rng).cloneRange();
- tmpRng.setEndAfter(parentBlock);
- fragment = tmpRng.extractContents();
- trimLeadingLineBreaks(fragment);
- newBlock = fragment.firstChild;
- dom.insertAfter(fragment, parentBlock);
- trimInlineElementsOnLeftSideOfBlock(dom, nonEmptyElementsMap, newBlock);
- addBrToBlockIfNeeded(dom, parentBlock);
-
- if (dom.isEmpty(parentBlock)) {
- emptyBlock(parentBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ],
+ forecolor: {
+ inline: 'span',
+ styles: { color: '%value' },
+ links: true,
+ remove_similar: true,
+ clear_child_styles: true
+ },
+ hilitecolor: {
+ inline: 'span',
+ styles: { backgroundColor: '%value' },
+ links: true,
+ remove_similar: true,
+ clear_child_styles: true
+ },
+ fontname: {
+ inline: 'span',
+ toggle: false,
+ styles: { fontFamily: '%value' },
+ clear_child_styles: true
+ },
+ fontsize: {
+ inline: 'span',
+ toggle: false,
+ styles: { fontSize: '%value' },
+ clear_child_styles: true
+ },
+ fontsize_class: {
+ inline: 'span',
+ attributes: { class: '%value' }
+ },
+ blockquote: {
+ block: 'blockquote',
+ wrapper: 1,
+ remove: 'all'
+ },
+ subscript: { inline: 'sub' },
+ superscript: { inline: 'sup' },
+ code: { inline: 'code' },
+ link: {
+ inline: 'a',
+ selector: 'a',
+ remove: 'all',
+ split: true,
+ deep: true,
+ onmatch: function () {
+ return true;
+ },
+ onformat: function (elm, fmt, vars) {
+ $_52qop8kjfuw8l6v.each(vars, function (value, key) {
+ dom.setAttrib(elm, key, value);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- newBlock.normalize();
-
- // New block might become empty if it's <p><b>a |</b></p>
- if (dom.isEmpty(newBlock)) {
- dom.remove(newBlock);
- insertNewBlockAfter();
- } else {
- moveToCaretPosition(newBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ removeformat: [
+ {
+ selector: 'b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins',
+ remove: 'all',
+ split: true,
+ expand: false,
+ block_expand: true,
+ deep: true
+ },
+ {
+ selector: 'span',
+ attributes: [
+ 'style',
+ 'class'
+ ],
+ remove: 'empty',
+ split: true,
+ expand: false,
+ deep: true
+ },
+ {
+ selector: '*',
+ attributes: [
+ 'style',
+ 'class'
+ ],
+ split: false,
+ expand: false,
+ deep: true
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- dom.setAttrib(newBlock, 'id', ''); // Remove ID since it needs to be document unique
-
- // Allow custom handling of new blocks
- editor.fire('NewBlock', { newBlock: newBlock });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ]
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_52qop8kjfuw8l6v.each('p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp'.split(/\s/), function (name) {
+ formats[name] = {
+ block: name,
+ remove: 'all'
+ };
+ });
+ return formats;
+ };
+ var $_4hczfz5wjfuw8m9q = { get: get$5 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- insert: insert
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function FormatRegistry (editor) {
+ var formats = {};
+ var get = function (name) {
+ return name ? formats[name] : formats;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * EnterKey.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.EnterKey',
- [
- 'tinymce.core.keyboard.InsertNewLine',
- 'tinymce.core.util.VK'
- ],
- function (InsertNewLine, VK) {
- var endTypingLevel = function (undoManager) {
- if (undoManager.typing) {
- undoManager.typing = false;
- undoManager.add();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (name, format) {
+ if (name) {
+ if (typeof name !== 'string') {
+ $_52qop8kjfuw8l6v.each(name, function (format, name) {
+ register(name, format);
+ });
+ } else {
+ format = format.length ? format : [format];
+ $_52qop8kjfuw8l6v.each(format, function (format) {
+ if (typeof format.deep === 'undefined') {
+ format.deep = !format.selector;
+ }
+ if (typeof format.split === 'undefined') {
+ format.split = !format.selector || format.inline;
+ }
+ if (typeof format.remove === 'undefined' && format.selector && !format.inline) {
+ format.remove = 'none';
+ }
+ if (format.selector && format.inline) {
+ format.mixed = true;
+ format.block_expand = true;
+ }
+ if (typeof format.classes === 'string') {
+ format.classes = format.classes.split(/\s+/);
+ }
+ });
+ formats[name] = format;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var handleEnterKeyEvent = function (editor, event) {
- if (event.isDefaultPrevented()) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var unregister = function (name) {
+ if (name && formats[name]) {
+ delete formats[name];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- event.preventDefault();
-
- endTypingLevel(editor.undoManager);
- editor.undoManager.transact(function () {
- if (editor.selection.isCollapsed() === false) {
- editor.execCommand('Delete');
- }
-
- InsertNewLine.insert(editor, event);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return formats;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var setup = function (editor) {
- editor.on('keydown', function (event) {
- if (event.keyCode === VK.ENTER) {
- handleEnterKeyEvent(editor, event);
- }
- });
- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ register($_4hczfz5wjfuw8m9q.get(editor.dom));
+ register(editor.settings.formats);
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- setup: setup
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ get: get,
+ register: register,
+ unregister: unregister
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * InsertSpace.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.InsertSpace',
- [
- 'ephox.katamari.api.Fun',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.keyboard.BoundaryLocation',
- 'tinymce.core.keyboard.InlineUtils'
- ],
- function (Fun, CaretPosition, NodeType, BoundaryLocation, InlineUtils) {
- var isValidInsertPoint = function (location, caretPosition) {
- return isAtStartOrEnd(location) && NodeType.isText(caretPosition.container());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$18 = $_52qop8kjfuw8l6v.each;
+ var dom = DOMUtils$1.DOM;
+ var parsedSelectorToHtml = function (ancestry, editor) {
+ var elm, item, fragment;
+ var schema = editor && editor.schema || Schema({});
+ var decorate = function (elm, item) {
+ if (item.classes.length) {
+ dom.addClass(elm, item.classes.join(' '));
+ }
+ dom.setAttribs(elm, item.attrs);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var insertNbspAtPosition = function (editor, caretPosition) {
- var container = caretPosition.container();
- var offset = caretPosition.offset();
-
- container.insertData(offset, '\u00a0');
- editor.selection.setCursorLocation(container, offset + 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createElement = function (sItem) {
+ var elm;
+ item = typeof sItem === 'string' ? {
+ name: sItem,
+ classes: [],
+ attrs: {}
+ } : sItem;
+ elm = dom.create(item.name);
+ decorate(elm, item);
+ return elm;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var insertAtLocation = function (editor, caretPosition, location) {
- if (isValidInsertPoint(location, caretPosition)) {
- insertNbspAtPosition(editor, caretPosition);
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getRequiredParent = function (elm, candidate) {
+ var name = typeof elm !== 'string' ? elm.nodeName.toLowerCase() : elm;
+ var elmRule = schema.getElementRule(name);
+ var parentsRequired = elmRule && elmRule.parentsRequired;
+ if (parentsRequired && parentsRequired.length) {
+ return candidate && $_52qop8kjfuw8l6v.inArray(parentsRequired, candidate) !== -1 ? candidate : parentsRequired[0];
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var insertAtCaret = function (editor) {
- var isInlineTarget = Fun.curry(InlineUtils.isInlineTarget, editor);
- var caretPosition = CaretPosition.fromRangeStart(editor.selection.getRng());
- var boundaryLocation = BoundaryLocation.readLocation(isInlineTarget, editor.getBody(), caretPosition);
- return boundaryLocation.map(Fun.curry(insertAtLocation, editor, caretPosition)).getOr(false);
- };
-
- var isAtStartOrEnd = function (location) {
- return location.fold(
- Fun.constant(false), // Before
- Fun.constant(true), // Start
- Fun.constant(true), // End
- Fun.constant(false) // After
- );
- };
-
- var insertAtSelection = function (editor) {
- return editor.selection.isCollapsed() ? insertAtCaret(editor) : false;
- };
-
- return {
- insertAtSelection: insertAtSelection
- };
- }
-);
-
-/**
- * SpaceKey.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.SpaceKey',
- [
- 'tinymce.core.keyboard.InsertSpace',
- 'tinymce.core.keyboard.MatchKeys',
- 'tinymce.core.util.VK'
- ],
- function (InsertSpace, MatchKeys, VK) {
- var executeKeydownOverride = function (editor, evt) {
- MatchKeys.execute([
- { keyCode: VK.SPACEBAR, action: MatchKeys.action(InsertSpace.insertAtSelection, editor) }
- ], evt).each(function (_) {
- evt.preventDefault();
- });
- };
-
- var setup = function (editor) {
- editor.on('keydown', function (evt) {
- if (evt.isDefaultPrevented() === false) {
- executeKeydownOverride(editor, evt);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var wrapInHtml = function (elm, ancestry, siblings) {
+ var parent, parentCandidate, parentRequired;
+ var ancestor = ancestry.length > 0 && ancestry[0];
+ var ancestorName = ancestor && ancestor.name;
+ parentRequired = getRequiredParent(elm, ancestorName);
+ if (parentRequired) {
+ if (ancestorName === parentRequired) {
+ parentCandidate = ancestry[0];
+ ancestry = ancestry.slice(1);
+ } else {
+ parentCandidate = parentRequired;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (ancestor) {
+ parentCandidate = ancestry[0];
+ ancestry = ancestry.slice(1);
+ } else if (!siblings) {
+ return elm;
+ }
+ if (parentCandidate) {
+ parent = createElement(parentCandidate);
+ parent.appendChild(elm);
+ }
+ if (siblings) {
+ if (!parent) {
+ parent = dom.create('div');
+ parent.appendChild(elm);
+ }
+ $_52qop8kjfuw8l6v.each(siblings, function (sibling) {
+ var siblingElm = createElement(sibling);
+ parent.insertBefore(siblingElm, elm);
+ });
+ }
+ return wrapInHtml(parent, ancestry, parentCandidate && parentCandidate.siblings);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- setup: setup
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (ancestry && ancestry.length) {
+ item = ancestry[0];
+ elm = createElement(item);
+ fragment = dom.create('div');
+ fragment.appendChild(wrapInHtml(elm, ancestry.slice(1), item.siblings));
+ return fragment;
+ } else {
+ return '';
+ }
+ };
+ var selectorToHtml = function (selector, editor) {
+ return parsedSelectorToHtml(parseSelector(selector), editor);
+ };
+ var parseSelectorItem = function (item) {
+ var tagName;
+ var obj = {
+ classes: [],
+ attrs: {}
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * KeyboardOverrides.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.keyboard.KeyboardOverrides',
- [
- 'tinymce.core.keyboard.ArrowKeys',
- 'tinymce.core.keyboard.BoundarySelection',
- 'tinymce.core.keyboard.DeleteBackspaceKeys',
- 'tinymce.core.keyboard.EnterKey',
- 'tinymce.core.keyboard.SpaceKey'
- ],
- function (ArrowKeys, BoundarySelection, DeleteBackspaceKeys, EnterKey, SpaceKey) {
- var setup = function (editor) {
- var caret = BoundarySelection.setupSelectedState(editor);
-
- ArrowKeys.setup(editor, caret);
- DeleteBackspaceKeys.setup(editor, caret);
- EnterKey.setup(editor);
- SpaceKey.setup(editor);
- };
-
- return {
- setup: setup
- };
- }
-);
-/**
- * NodeChange.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class handles the nodechange event dispatching both manual and through selection change events.
- *
- * @class tinymce.NodeChange
- * @private
- */
-define(
- 'tinymce.core.NodeChange',
- [
- "tinymce.core.dom.RangeUtils",
- "tinymce.core.Env",
- "tinymce.core.util.Delay"
- ],
- function (RangeUtils, Env, Delay) {
- return function (editor) {
- var lastRng, lastPath = [];
-
- /**
- * Returns true/false if the current element path has been changed or not.
- *
- * @private
- * @return {Boolean} True if the element path is the same false if it's not.
- */
- function isSameElementPath(startElm) {
- var i, currentPath;
-
- currentPath = editor.$(startElm).parentsUntil(editor.getBody()).add(startElm);
- if (currentPath.length === lastPath.length) {
- for (i = currentPath.length; i >= 0; i--) {
- if (currentPath[i] !== lastPath[i]) {
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ item = obj.selector = $_52qop8kjfuw8l6v.trim(item);
+ if (item !== '*') {
+ tagName = item.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g, function ($0, $1, $2, $3, $4) {
+ switch ($1) {
+ case '#':
+ obj.attrs.id = $2;
+ break;
+ case '.':
+ obj.classes.push($2);
+ break;
+ case ':':
+ if ($_52qop8kjfuw8l6v.inArray('checked disabled enabled read-only required'.split(' '), $2) !== -1) {
+ obj.attrs[$2] = $2;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (i === -1) {
- lastPath = currentPath;
- return true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- lastPath = currentPath;
-
- return false;
- }
-
- // Gecko doesn't support the "selectionchange" event
- if (!('onselectionchange' in editor.getDoc())) {
- editor.on('NodeChange Click MouseUp KeyUp Focus', function (e) {
- var nativeRng, fakeRng;
-
- // Since DOM Ranges mutate on modification
- // of the DOM we need to clone it's contents
- nativeRng = editor.selection.getRng();
- fakeRng = {
- startContainer: nativeRng.startContainer,
- startOffset: nativeRng.startOffset,
- endContainer: nativeRng.endContainer,
- endOffset: nativeRng.endOffset
- };
-
- // Always treat nodechange as a selectionchange since applying
- // formatting to the current range wouldn't update the range but it's parent
- if (e.type == 'nodechange' || !RangeUtils.compareRanges(fakeRng, lastRng)) {
- editor.fire('SelectionChange');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($3 === '[') {
+ var m = $4.match(/([\w\-]+)(?:\=\"([^\"]+))?/);
+ if (m) {
+ obj.attrs[m[1]] = m[2];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- lastRng = fakeRng;
- });
- }
-
- // IE has a bug where it fires a selectionchange on right click that has a range at the start of the body
- // When the contextmenu event fires the selection is located at the right location
- editor.on('contextmenu', function () {
- editor.fire('SelectionChange');
- });
-
- // Selection change is delayed ~200ms on IE when you click inside the current range
- editor.on('SelectionChange', function () {
- var startElm = editor.selection.getStart(true);
-
- // When focusout from after cef element to other input element the startelm can be undefined.
- // IE 8 will fire a selectionchange event with an incorrect selection
- // when focusing out of table cells. Click inside cell -> toolbar = Invalid SelectionChange event
- if (!startElm || (!Env.range && editor.selection.isCollapsed())) {
- return;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) {
- editor.nodeChanged({ selectionChange: true });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return '';
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Fire an extra nodeChange on mouseup for compatibility reasons
- editor.on('MouseUp', function (e) {
- if (!e.isDefaultPrevented()) {
- // Delay nodeChanged call for WebKit edge case issue where the range
- // isn't updated until after you click outside a selected image
- if (editor.selection.getNode().nodeName == 'IMG') {
- Delay.setEditorTimeout(editor, function () {
- editor.nodeChanged();
- });
- } else {
- editor.nodeChanged();
- }
- }
- });
-
- /**
- * Dispatches out a onNodeChange event to all observers. This method should be called when you
- * need to update the UI states or element path etc.
- *
- * @method nodeChanged
- * @param {Object} args Optional args to pass to NodeChange event handlers.
- */
- this.nodeChanged = function (args) {
- var selection = editor.selection, node, parents, root;
-
- // Fix for bug #1896577 it seems that this can not be fired while the editor is loading
- if (editor.initialized && selection && !editor.settings.disable_nodechange && !editor.readonly) {
- // Get start node
- root = editor.getBody();
- node = selection.getStart(true) || root;
-
- // Make sure the node is within the editor root or is the editor root
- if (node.ownerDocument != editor.getDoc() || !editor.dom.isChildOf(node, root)) {
- node = root;
- }
-
- // Get parents and add them to object
- parents = [];
- editor.dom.getParent(node, function (node) {
- if (node === root) {
- return true;
- }
-
- parents.push(node);
- });
-
- args = args || {};
- args.element = node;
- args.parents = parents;
-
- editor.fire('NodeChange', args);
- }
- };
- };
- }
-);
-
-/**
- * MousePosition.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module calculates an absolute coordinate inside the editor body for both local and global mouse events.
- *
- * @private
- * @class tinymce.dom.MousePosition
- */
-define(
- 'tinymce.core.dom.MousePosition',
- [
- ],
- function () {
- var getAbsolutePosition = function (elm) {
- var doc, docElem, win, clientRect;
-
- clientRect = elm.getBoundingClientRect();
- doc = elm.ownerDocument;
- docElem = doc.documentElement;
- win = doc.defaultView;
-
- return {
- top: clientRect.top + win.pageYOffset - docElem.clientTop,
- left: clientRect.left + win.pageXOffset - docElem.clientLeft
- };
- };
-
- var getBodyPosition = function (editor) {
- return editor.inline ? getAbsolutePosition(editor.getBody()) : { left: 0, top: 0 };
- };
-
- var getScrollPosition = function (editor) {
- var body = editor.getBody();
- return editor.inline ? { left: body.scrollLeft, top: body.scrollTop } : { left: 0, top: 0 };
- };
-
- var getBodyScroll = function (editor) {
- var body = editor.getBody(), docElm = editor.getDoc().documentElement;
- var inlineScroll = { left: body.scrollLeft, top: body.scrollTop };
- var iframeScroll = { left: body.scrollLeft || docElm.scrollLeft, top: body.scrollTop || docElm.scrollTop };
-
- return editor.inline ? inlineScroll : iframeScroll;
- };
-
- var getMousePosition = function (editor, event) {
- if (event.target.ownerDocument !== editor.getDoc()) {
- var iframePosition = getAbsolutePosition(editor.getContentAreaContainer());
- var scrollPosition = getBodyScroll(editor);
-
- return {
- left: event.pageX - iframePosition.left + scrollPosition.left,
- top: event.pageY - iframePosition.top + scrollPosition.top
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ obj.name = tagName || 'div';
+ return obj;
+ };
+ var parseSelector = function (selector) {
+ if (!selector || typeof selector !== 'string') {
+ return [];
+ }
+ selector = selector.split(/\s*,\s*/)[0];
+ selector = selector.replace(/\s*(~\+|~|\+|>)\s*/g, '$1');
+ return $_52qop8kjfuw8l6v.map(selector.split(/(?:>|\s+(?![^\[\]]+\]))/), function (item) {
+ var siblings = $_52qop8kjfuw8l6v.map(item.split(/(?:~\+|~|\+)/), parseSelectorItem);
+ var obj = siblings.pop();
+ if (siblings.length) {
+ obj.siblings = siblings;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- left: event.pageX,
- top: event.pageY
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return obj;
+ }).reverse();
+ };
+ var getCssText = function (editor, format) {
+ var name, previewFrag, previewElm, items;
+ var previewCss = '', parentFontSize, previewStyles;
+ previewStyles = editor.settings.preview_styles;
+ if (previewStyles === false) {
+ return '';
+ }
+ if (typeof previewStyles !== 'string') {
+ previewStyles = 'font-family font-size font-weight font-style text-decoration ' + 'text-transform color background-color border border-radius outline text-shadow';
+ }
+ var removeVars = function (val) {
+ return val.replace(/%(\w+)/g, '');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) {
- return {
- pageX: (mousePosition.left - bodyPosition.left) + scrollPosition.left,
- pageY: (mousePosition.top - bodyPosition.top) + scrollPosition.top
- };
- };
-
- var calc = function (editor, event) {
- return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));
- };
-
- return {
- calc: calc
- };
- }
-);
-
-/**
- * DragDropOverrides.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module contains logic overriding the drag/drop logic of the editor.
- *
- * @private
- * @class tinymce.DragDropOverrides
- */
-define(
- 'tinymce.core.DragDropOverrides',
- [
- "tinymce.core.dom.NodeType",
- "tinymce.core.util.Arr",
- "tinymce.core.util.Fun",
- "tinymce.core.util.Delay",
- "tinymce.core.dom.DOMUtils",
- "tinymce.core.dom.MousePosition"
- ],
- function (
- NodeType, Arr, Fun, Delay, DOMUtils, MousePosition
- ) {
- var isContentEditableFalse = NodeType.isContentEditableFalse,
- isContentEditableTrue = NodeType.isContentEditableTrue;
-
- var isDraggable = function (rootElm, elm) {
- return isContentEditableFalse(elm) && elm !== rootElm;
- };
-
- var isValidDropTarget = function (editor, targetElement, dragElement) {
- if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (typeof format === 'string') {
+ format = editor.formatter.get(format);
+ if (!format) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isContentEditableFalse(targetElement)) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ format = format[0];
+ }
+ if ('preview' in format) {
+ previewStyles = format.preview;
+ if (previewStyles === false) {
+ return '';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return true;
- };
-
- var cloneElement = function (elm) {
- var cloneElm = elm.cloneNode(true);
- cloneElm.removeAttribute('data-mce-selected');
- return cloneElm;
- };
-
- var createGhost = function (editor, elm, width, height) {
- var clonedElm = elm.cloneNode(true);
-
- editor.dom.setStyles(clonedElm, { width: width, height: height });
- editor.dom.setAttrib(clonedElm, 'data-mce-selected', null);
-
- var ghostElm = editor.dom.create('div', {
- 'class': 'mce-drag-container',
- 'data-mce-bogus': 'all',
- unselectable: 'on',
- contenteditable: 'false'
- });
-
- editor.dom.setStyles(ghostElm, {
- position: 'absolute',
- opacity: 0.5,
- overflow: 'hidden',
- border: 0,
- padding: 0,
- margin: 0,
- width: width,
- height: height
- });
-
- editor.dom.setStyles(clonedElm, {
- margin: 0,
- boxSizing: 'border-box'
- });
-
- ghostElm.appendChild(clonedElm);
-
- return ghostElm;
- };
-
- var appendGhostToBody = function (ghostElm, bodyElm) {
- if (ghostElm.parentNode !== bodyElm) {
- bodyElm.appendChild(ghostElm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ name = format.block || format.inline || 'span';
+ items = parseSelector(format.selector);
+ if (items.length) {
+ if (!items[0].name) {
+ items[0].name = name;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var moveGhost = function (ghostElm, position, width, height, maxX, maxY) {
- var overflowX = 0, overflowY = 0;
-
- ghostElm.style.left = position.pageX + 'px';
- ghostElm.style.top = position.pageY + 'px';
-
- if (position.pageX + width > maxX) {
- overflowX = (position.pageX + width) - maxX;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ name = format.selector;
+ previewFrag = parsedSelectorToHtml(items, editor);
+ } else {
+ previewFrag = parsedSelectorToHtml([name], editor);
+ }
+ previewElm = dom.select(name, previewFrag)[0] || previewFrag.firstChild;
+ each$18(format.styles, function (value, name) {
+ value = removeVars(value);
+ if (value) {
+ dom.setStyle(previewElm, name, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (position.pageY + height > maxY) {
- overflowY = (position.pageY + height) - maxY;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ each$18(format.attributes, function (value, name) {
+ value = removeVars(value);
+ if (value) {
+ dom.setAttrib(previewElm, name, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- ghostElm.style.width = (width - overflowX) + 'px';
- ghostElm.style.height = (height - overflowY) + 'px';
- };
-
- var removeElement = function (elm) {
- if (elm && elm.parentNode) {
- elm.parentNode.removeChild(elm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ each$18(format.classes, function (value) {
+ value = removeVars(value);
+ if (!dom.hasClass(previewElm, value)) {
+ dom.addClass(previewElm, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var isLeftMouseButtonPressed = function (e) {
- return e.button === 0;
- };
-
- var hasDraggableElement = function (state) {
- return state.element;
- };
-
- var applyRelPos = function (state, position) {
- return {
- pageX: position.pageX - state.relX,
- pageY: position.pageY + 5
- };
- };
-
- var start = function (state, editor) {
- return function (e) {
- if (isLeftMouseButtonPressed(e)) {
- var ceElm = Arr.find(editor.dom.getParents(e.target), Fun.or(isContentEditableFalse, isContentEditableTrue));
-
- if (isDraggable(editor.getBody(), ceElm)) {
- var elmPos = editor.dom.getPos(ceElm);
- var bodyElm = editor.getBody();
- var docElm = editor.getDoc().documentElement;
-
- state.element = ceElm;
- state.screenX = e.screenX;
- state.screenY = e.screenY;
- state.maxX = (editor.inline ? bodyElm.scrollWidth : docElm.offsetWidth) - 2;
- state.maxY = (editor.inline ? bodyElm.scrollHeight : docElm.offsetHeight) - 2;
- state.relX = e.pageX - elmPos.x;
- state.relY = e.pageY - elmPos.y;
- state.width = ceElm.offsetWidth;
- state.height = ceElm.offsetHeight;
- state.ghost = createGhost(editor, ceElm, state.width, state.height);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.fire('PreviewFormats');
+ dom.setStyles(previewFrag, {
+ position: 'absolute',
+ left: -65535
+ });
+ editor.getBody().appendChild(previewFrag);
+ parentFontSize = dom.getStyle(editor.getBody(), 'fontSize', true);
+ parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0;
+ each$18(previewStyles.split(' '), function (name) {
+ var value = dom.getStyle(previewElm, name, true);
+ if (name === 'background-color' && /transparent|rgba\s*\([^)]+,\s*0\)/.test(value)) {
+ value = dom.getStyle(editor.getBody(), name, true);
+ if (dom.toHex(value).toLowerCase() === '#ffffff') {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- };
-
- var move = function (state, editor) {
- // Reduces laggy drag behavior on Gecko
- var throttledPlaceCaretAt = Delay.throttle(function (clientX, clientY) {
- editor._selectionOverrides.hideFakeCaret();
- editor.selection.placeCaretAt(clientX, clientY);
- }, 0);
-
- return function (e) {
- var movement = Math.max(Math.abs(e.screenX - state.screenX), Math.abs(e.screenY - state.screenY));
-
- if (hasDraggableElement(state) && !state.dragging && movement > 10) {
- var args = editor.fire('dragstart', { target: state.element });
- if (args.isDefaultPrevented()) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (name === 'color') {
+ if (dom.toHex(value).toLowerCase() === '#000000') {
+ return;
+ }
+ }
+ if (name === 'font-size') {
+ if (/em|%$/.test(value)) {
+ if (parentFontSize === 0) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- state.dragging = true;
- editor.focus();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var numValue = parseFloat(value) / (/%$/.test(value) ? 100 : 1);
+ value = numValue * parentFontSize + 'px';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (name === 'border' && value) {
+ previewCss += 'padding:0 2px;';
+ }
+ previewCss += name + ':' + value + ';';
+ });
+ editor.fire('AfterPreviewFormats');
+ dom.remove(previewFrag);
+ return previewCss;
+ };
+ var $_85m0vg5xjfuw8m9v = {
+ getCssText: getCssText,
+ parseSelector: parseSelector,
+ selectorToHtml: selectorToHtml
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (state.dragging) {
- var targetPos = applyRelPos(state, MousePosition.calc(editor, e));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var toggle = function (editor, formats, name, vars, node) {
+ var fmt = formats.get(name);
+ if ($_ggpery5ojfuw8m8e.match(editor, name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) {
+ $_cm1urk5sjfuw8m8x.remove(editor, name, vars, node);
+ } else {
+ $_62fw7e5kjfuw8m7d.applyFormat(editor, name, vars, node);
+ }
+ };
+ var $_22sexu5yjfuw8ma1 = { toggle: toggle };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- appendGhostToBody(state.ghost, editor.getBody());
- moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setup$4 = function (editor) {
+ editor.addShortcut('meta+b', '', 'Bold');
+ editor.addShortcut('meta+i', '', 'Italic');
+ editor.addShortcut('meta+u', '', 'Underline');
+ for (var i = 1; i <= 6; i++) {
+ editor.addShortcut('access+' + i, '', [
+ 'FormatBlock',
+ false,
+ 'h' + i
+ ]);
+ }
+ editor.addShortcut('access+7', '', [
+ 'FormatBlock',
+ false,
+ 'p'
+ ]);
+ editor.addShortcut('access+8', '', [
+ 'FormatBlock',
+ false,
+ 'div'
+ ]);
+ editor.addShortcut('access+9', '', [
+ 'FormatBlock',
+ false,
+ 'address'
+ ]);
+ };
+ var $_cw7jar5zjfuw8ma2 = { setup: setup$4 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- throttledPlaceCaretAt(e.clientX, e.clientY);
- }
- };
- };
-
- // Returns the raw element instead of the fake cE=false element
- var getRawTarget = function (selection) {
- var rng = selection.getSel().getRangeAt(0);
- var startContainer = rng.startContainer;
- return startContainer.nodeType === 3 ? startContainer.parentNode : startContainer;
- };
-
- var drop = function (state, editor) {
- return function (e) {
- if (state.dragging) {
- if (isValidDropTarget(editor, getRawTarget(editor.selection), state.element)) {
- var targetClone = cloneElement(state.element);
-
- var args = editor.fire('drop', {
- targetClone: targetClone,
- clientX: e.clientX,
- clientY: e.clientY
- });
-
- if (!args.isDefaultPrevented()) {
- targetClone = args.targetClone;
-
- editor.undoManager.transact(function () {
- removeElement(state.element);
- editor.insertContent(editor.dom.getOuterHTML(targetClone));
- editor._selectionOverrides.hideFakeCaret();
- });
- }
- }
- }
-
- removeDragState(state);
- };
- };
-
- var stop = function (state, editor) {
- return function () {
- removeDragState(state);
- if (state.dragging) {
- editor.fire('dragend');
- }
- };
- };
-
- var removeDragState = function (state) {
- state.dragging = false;
- state.element = null;
- removeElement(state.ghost);
- };
-
- var bindFakeDragEvents = function (editor) {
- var state = {}, pageDom, dragStartHandler, dragHandler, dropHandler, dragEndHandler, rootDocument;
-
- pageDom = DOMUtils.DOM;
- rootDocument = document;
- dragStartHandler = start(state, editor);
- dragHandler = move(state, editor);
- dropHandler = drop(state, editor);
- dragEndHandler = stop(state, editor);
-
- editor.on('mousedown', dragStartHandler);
- editor.on('mousemove', dragHandler);
- editor.on('mouseup', dropHandler);
-
- pageDom.bind(rootDocument, 'mousemove', dragHandler);
- pageDom.bind(rootDocument, 'mouseup', dragEndHandler);
-
- editor.on('remove', function () {
- pageDom.unbind(rootDocument, 'mousemove', dragHandler);
- pageDom.unbind(rootDocument, 'mouseup', dragEndHandler);
- });
- };
-
- var blockIeDrop = function (editor) {
- editor.on('drop', function (e) {
- // FF doesn't pass out clientX/clientY for drop since this is for IE we just use null instead
- var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null;
-
- if (isContentEditableFalse(realTarget) || isContentEditableFalse(editor.dom.getContentEditableParent(realTarget))) {
- e.preventDefault();
- }
- });
- };
-
- var init = function (editor) {
- bindFakeDragEvents(editor);
- blockIeDrop(editor);
- };
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function Formatter (editor) {
+ var formats = FormatRegistry(editor);
+ var formatChangeState = Cell(null);
+ $_cw7jar5zjfuw8ma2.setup(editor);
+ setup$2(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- init: init
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ get: formats.get,
+ register: formats.register,
+ unregister: formats.unregister,
+ apply: $_68e81l6jfuw8kyc.curry($_62fw7e5kjfuw8m7d.applyFormat, editor),
+ remove: $_68e81l6jfuw8kyc.curry($_cm1urk5sjfuw8m8x.remove, editor),
+ toggle: $_68e81l6jfuw8kyc.curry($_22sexu5yjfuw8ma1.toggle, editor, formats),
+ match: $_68e81l6jfuw8kyc.curry($_ggpery5ojfuw8m8e.match, editor),
+ matchAll: $_68e81l6jfuw8kyc.curry($_ggpery5ojfuw8m8e.matchAll, editor),
+ matchNode: $_68e81l6jfuw8kyc.curry($_ggpery5ojfuw8m8e.matchNode, editor),
+ canApply: $_68e81l6jfuw8kyc.curry($_ggpery5ojfuw8m8e.canApply, editor),
+ formatChanged: $_68e81l6jfuw8kyc.curry($_coezzd5ujfuw8m9l.formatChanged, editor, formatChangeState),
+ getCssText: $_68e81l6jfuw8kyc.curry($_85m0vg5xjfuw8m9v.getCssText, editor)
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * FakeCaret.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module contains logic for rendering a fake visual caret.
- *
- * @private
- * @class tinymce.caret.FakeCaret
- */
-define(
- 'tinymce.core.caret.FakeCaret',
- [
- 'tinymce.core.caret.CaretContainer',
- 'tinymce.core.caret.CaretContainerRemove',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.dom.DomQuery',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.geom.ClientRect',
- 'tinymce.core.util.Delay'
- ],
- function (CaretContainer, CaretContainerRemove, CaretPosition, DomQuery, NodeType, RangeUtils, ClientRect, Delay) {
- var isContentEditableFalse = NodeType.isContentEditableFalse;
-
- var isTableCell = function (node) {
- return node && /^(TD|TH)$/i.test(node.nodeName);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var shallow = function (old, nu) {
+ return nu;
+ };
+ var deep = function (old, nu) {
+ var bothObjects = $_16i8k47jfuw8kyi.isObject(old) && $_16i8k47jfuw8kyi.isObject(nu);
+ return bothObjects ? deepMerge(old, nu) : nu;
+ };
+ var baseMerge = function (merger) {
+ return function () {
+ var objects = new Array(arguments.length);
+ for (var i = 0; i < objects.length; i++)
+ objects[i] = arguments[i];
+ if (objects.length === 0)
+ throw new Error('Can\'t merge zero objects');
+ var ret = {};
+ for (var j = 0; j < objects.length; j++) {
+ var curObject = objects[j];
+ for (var key in curObject)
+ if (curObject.hasOwnProperty(key)) {
+ ret[key] = merger(ret[key], curObject[key]);
+ }
+ }
+ return ret;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var deepMerge = baseMerge(deep);
+ var merge = baseMerge(shallow);
+ var $_dt8zuf62jfuw8mab = {
+ deepMerge: deepMerge,
+ merge: merge
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return function (rootNode, isBlock) {
- var cursorInterval, $lastVisualCaret, caretContainerNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var firePreProcess = function (editor, args) {
+ return editor.fire('PreProcess', args);
+ };
+ var firePostProcess = function (editor, args) {
+ return editor.fire('PostProcess', args);
+ };
+ var fireRemove = function (editor) {
+ return editor.fire('remove');
+ };
+ var $_47gnpy63jfuw8mad = {
+ firePreProcess: firePreProcess,
+ firePostProcess: firePostProcess,
+ fireRemove: fireRemove
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function getAbsoluteClientRect(node, before) {
- var clientRect = ClientRect.collapse(node.getBoundingClientRect(), before),
- docElm, scrollX, scrollY, margin, rootRect;
-
- if (rootNode.tagName == 'BODY') {
- docElm = rootNode.ownerDocument.documentElement;
- scrollX = rootNode.scrollLeft || docElm.scrollLeft;
- scrollY = rootNode.scrollTop || docElm.scrollTop;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register = function (htmlParser, settings, dom) {
+ htmlParser.addAttributeFilter('data-mce-tabindex', function (nodes, name) {
+ var i = nodes.length, node;
+ while (i--) {
+ node = nodes[i];
+ node.attr('tabindex', node.attributes.map['data-mce-tabindex']);
+ node.attr(name, null);
+ }
+ });
+ htmlParser.addAttributeFilter('src,href,style', function (nodes, name) {
+ var i = nodes.length, node, value;
+ var internalName = 'data-mce-' + name;
+ var urlConverter = settings.url_converter;
+ var urlConverterScope = settings.url_converter_scope;
+ while (i--) {
+ node = nodes[i];
+ value = node.attributes.map[internalName];
+ if (value !== undefined) {
+ node.attr(name, value.length > 0 ? value : null);
+ node.attr(internalName, null);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rootRect = rootNode.getBoundingClientRect();
- scrollX = rootNode.scrollLeft - rootRect.left;
- scrollY = rootNode.scrollTop - rootRect.top;
- }
-
- clientRect.left += scrollX;
- clientRect.right += scrollX;
- clientRect.top += scrollY;
- clientRect.bottom += scrollY;
- clientRect.width = 1;
-
- margin = node.offsetWidth - node.clientWidth;
-
- if (margin > 0) {
- if (before) {
- margin *= -1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ value = node.attributes.map[name];
+ if (name === 'style') {
+ value = dom.serializeStyle(dom.parseStyle(value), node.name);
+ } else if (urlConverter) {
+ value = urlConverter.call(urlConverterScope, value, name, node.name);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- clientRect.left += margin;
- clientRect.right += margin;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.attr(name, value.length > 0 ? value : null);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return clientRect;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function trimInlineCaretContainers() {
- var contentEditableFalseNodes, node, sibling, i, data;
-
- contentEditableFalseNodes = DomQuery('*[contentEditable=false]', rootNode);
- for (i = 0; i < contentEditableFalseNodes.length; i++) {
- node = contentEditableFalseNodes[i];
-
- sibling = node.previousSibling;
- if (CaretContainer.endsWithCaretContainer(sibling)) {
- data = sibling.data;
-
- if (data.length == 1) {
- sibling.parentNode.removeChild(sibling);
- } else {
- sibling.deleteData(data.length - 1, 1);
- }
- }
-
- sibling = node.nextSibling;
- if (CaretContainer.startsWithCaretContainer(sibling)) {
- data = sibling.data;
-
- if (data.length == 1) {
- sibling.parentNode.removeChild(sibling);
- } else {
- sibling.deleteData(0, 1);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ htmlParser.addAttributeFilter('class', function (nodes) {
+ var i = nodes.length, node, value;
+ while (i--) {
+ node = nodes[i];
+ value = node.attr('class');
+ if (value) {
+ value = node.attr('class').replace(/(?:^|\s)mce-item-\w+(?!\S)/g, '');
+ node.attr('class', value.length > 0 ? value : null);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function show(before, node) {
- var clientRect, rng;
-
- hide();
-
- if (isTableCell(node)) {
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ htmlParser.addAttributeFilter('data-mce-type', function (nodes, name, args) {
+ var i = nodes.length, node;
+ while (i--) {
+ node = nodes[i];
+ if (node.attributes.map['data-mce-type'] === 'bookmark' && !args.cleanup) {
+ node.remove();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isBlock(node)) {
- caretContainerNode = CaretContainer.insertBlock('p', node, before);
- clientRect = getAbsoluteClientRect(node, before);
- DomQuery(caretContainerNode).css('top', clientRect.top);
-
- $lastVisualCaret = DomQuery('<div class="mce-visual-caret" data-mce-bogus="all"></div>').css(clientRect).appendTo(rootNode);
-
- if (before) {
- $lastVisualCaret.addClass('mce-visual-caret-before');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ htmlParser.addNodeFilter('noscript', function (nodes) {
+ var i = nodes.length, node;
+ while (i--) {
+ node = nodes[i].firstChild;
+ if (node) {
+ node.value = $_8uzsfe1rjfuw8ldm.decode(node.value);
+ }
+ }
+ });
+ htmlParser.addNodeFilter('script,style', function (nodes, name) {
+ var i = nodes.length, node, value, type;
+ var trim = function (value) {
+ return value.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n').replace(/^[\r\n]*|[\r\n]*$/g, '').replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi, '').replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g, '');
+ };
+ while (i--) {
+ node = nodes[i];
+ value = node.firstChild ? node.firstChild.value : '';
+ if (name === 'script') {
+ type = node.attr('type');
+ if (type) {
+ node.attr('type', type === 'mce-no/type' ? null : type.replace(/^mce\-/, ''));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- startBlink();
-
- rng = node.ownerDocument.createRange();
- rng.setStart(caretContainerNode, 0);
- rng.setEnd(caretContainerNode, 0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (settings.element_format === 'xhtml' && value.length > 0) {
+ node.firstChild.value = '// <![CDATA[\n' + trim(value) + '\n// ]]>';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- caretContainerNode = CaretContainer.insertInline(node, before);
- rng = node.ownerDocument.createRange();
-
- if (isContentEditableFalse(caretContainerNode.nextSibling)) {
- rng.setStart(caretContainerNode, 0);
- rng.setEnd(caretContainerNode, 0);
- } else {
- rng.setStart(caretContainerNode, 1);
- rng.setEnd(caretContainerNode, 1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (settings.element_format === 'xhtml' && value.length > 0) {
+ node.firstChild.value = '<!--\n' + trim(value) + '\n-->';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return rng;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return rng;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hide() {
- trimInlineCaretContainers();
-
- if (caretContainerNode) {
- CaretContainerRemove.remove(caretContainerNode);
- caretContainerNode = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ htmlParser.addNodeFilter('#comment', function (nodes) {
+ var i = nodes.length, node;
+ while (i--) {
+ node = nodes[i];
+ if (node.value.indexOf('[CDATA[') === 0) {
+ node.name = '#cdata';
+ node.type = 4;
+ node.value = node.value.replace(/^\[CDATA\[|\]\]$/g, '');
+ } else if (node.value.indexOf('mce:protected ') === 0) {
+ node.name = '#text';
+ node.type = 3;
+ node.raw = true;
+ node.value = unescape(node.value).substr(14);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if ($lastVisualCaret) {
- $lastVisualCaret.remove();
- $lastVisualCaret = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ htmlParser.addNodeFilter('xml:namespace,input', function (nodes, name) {
+ var i = nodes.length, node;
+ while (i--) {
+ node = nodes[i];
+ if (node.type === 7) {
+ node.remove();
+ } else if (node.type === 1) {
+ if (name === 'input' && !('type' in node.attributes.map)) {
+ node.attr('type', 'text');
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- clearInterval(cursorInterval);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function startBlink() {
- cursorInterval = Delay.setInterval(function () {
- DomQuery('div.mce-visual-caret', rootNode).toggleClass('mce-visual-caret-hidden');
- }, 500);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ htmlParser.addAttributeFilter('data-mce-type', function (nodes) {
+ $_9ek1bp4jfuw8kxg.each(nodes, function (node) {
+ if (node.attr('data-mce-type') === 'format-caret') {
+ if (node.isEmpty(htmlParser.schema.getNonEmptyElements())) {
+ node.remove();
+ } else {
+ node.unwrap();
+ }
+ }
+ });
+ });
+ htmlParser.addAttributeFilter('data-mce-src,data-mce-href,data-mce-style,' + 'data-mce-selected,data-mce-expando,' + 'data-mce-type,data-mce-resize', function (nodes, name) {
+ var i = nodes.length;
+ while (i--) {
+ nodes[i].attr(name, null);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function destroy() {
- Delay.clearInterval(cursorInterval);
- }
-
- function getCss() {
- return (
- '.mce-visual-caret {' +
- 'position: absolute;' +
- 'background-color: black;' +
- 'background-color: currentcolor;' +
- '}' +
- '.mce-visual-caret-hidden {' +
- 'display: none;' +
- '}' +
- '*[data-mce-caret] {' +
- 'position: absolute;' +
- 'left: -1000px;' +
- 'right: auto;' +
- 'top: 0;' +
- 'margin: 0;' +
- 'padding: 0;' +
- '}'
- );
- }
-
- return {
- show: show,
- hide: hide,
- getCss: getCss,
- destroy: destroy
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var trimTrailingBr = function (rootNode) {
+ var brNode1, brNode2;
+ var isBr = function (node) {
+ return node && node.name === 'br';
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * SelectionOverrides.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module contains logic overriding the selection with keyboard/mouse
- * around contentEditable=false regions.
- *
- * @example
- * // Disable the default cE=false selection
- * tinymce.activeEditor.on('ShowCaret BeforeObjectSelected', function(e) {
- * e.preventDefault();
- * });
- *
- * @private
- * @class tinymce.SelectionOverrides
- */
-define(
- 'tinymce.core.SelectionOverrides',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.sugar.api.dom.Remove',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.properties.Attr',
- 'ephox.sugar.api.search.SelectorFilter',
- 'ephox.sugar.api.search.SelectorFind',
- 'tinymce.core.DragDropOverrides',
- 'tinymce.core.EditorView',
- 'tinymce.core.Env',
- 'tinymce.core.caret.CaretContainer',
- 'tinymce.core.caret.CaretPosition',
- 'tinymce.core.caret.CaretUtils',
- 'tinymce.core.caret.CaretWalker',
- 'tinymce.core.caret.FakeCaret',
- 'tinymce.core.caret.LineUtils',
- 'tinymce.core.dom.ElementType',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.dom.RangePoint',
- 'tinymce.core.keyboard.CefUtils',
- 'tinymce.core.util.Delay',
- 'tinymce.core.util.VK'
- ],
- function (
- Arr, Remove, Element, Attr, SelectorFilter, SelectorFind, DragDropOverrides, EditorView, Env, CaretContainer, CaretPosition, CaretUtils, CaretWalker, FakeCaret,
- LineUtils, ElementType, NodeType, RangePoint, CefUtils, Delay, VK
- ) {
- var isContentEditableTrue = NodeType.isContentEditableTrue,
- isContentEditableFalse = NodeType.isContentEditableFalse,
- isAfterContentEditableFalse = CaretUtils.isAfterContentEditableFalse,
- isBeforeContentEditableFalse = CaretUtils.isBeforeContentEditableFalse;
-
- function SelectionOverrides(editor) {
- var rootNode = editor.getBody();
- var fakeCaret = new FakeCaret(editor.getBody(), isBlock),
- realSelectionId = 'sel-' + editor.dom.uniqueId(),
- selectedContentEditableNode;
-
- function isFakeSelectionElement(elm) {
- return editor.dom.hasClass(elm, 'mce-offscreen-selection');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ brNode1 = rootNode.lastChild;
+ if (isBr(brNode1)) {
+ brNode2 = brNode1.prev;
+ if (isBr(brNode2)) {
+ brNode1.remove();
+ brNode2.remove();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var $_fdsvd664jfuw8maf = {
+ register: register,
+ trimTrailingBr: trimTrailingBr
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function getRealSelectionElement() {
- var container = editor.dom.get(realSelectionId);
- return container ? container.getElementsByTagName('*')[0] : container;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var preProcess = function (editor, node, args) {
+ var impl, doc, oldDoc;
+ var dom = editor.dom;
+ node = node.cloneNode(true);
+ impl = document.implementation;
+ if (impl.createHTMLDocument) {
+ doc = impl.createHTMLDocument('');
+ $_52qop8kjfuw8l6v.each(node.nodeName === 'BODY' ? node.childNodes : [node], function (node) {
+ doc.body.appendChild(doc.importNode(node, true));
+ });
+ if (node.nodeName !== 'BODY') {
+ node = doc.body.firstChild;
+ } else {
+ node = doc.body;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ oldDoc = dom.doc;
+ dom.doc = doc;
+ }
+ $_47gnpy63jfuw8mad.firePreProcess(editor, $_dt8zuf62jfuw8mab.merge(args, { node: node }));
+ if (oldDoc) {
+ dom.doc = oldDoc;
+ }
+ return node;
+ };
+ var shouldFireEvent = function (editor, args) {
+ return editor && editor.hasEventListeners('PreProcess') && !args.no_events;
+ };
+ var process = function (editor, node, args) {
+ return shouldFireEvent(editor, args) ? preProcess(editor, node, args) : node;
+ };
+ var $_8z5s265jfuw8mal = { process: process };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function isBlock(node) {
- return editor.dom.isBlock(node);
- }
-
- function setRange(range) {
- //console.log('setRange', range);
- if (range) {
- editor.selection.setRng(range);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var removeAttrs = function (node, names) {
+ $_9ek1bp4jfuw8kxg.each(names, function (name) {
+ node.attr(name, null);
+ });
+ };
+ var addFontToSpansFilter = function (domParser, styles, fontSizes) {
+ domParser.addNodeFilter('font', function (nodes) {
+ $_9ek1bp4jfuw8kxg.each(nodes, function (node) {
+ var props = styles.parse(node.attr('style'));
+ var color = node.attr('color');
+ var face = node.attr('face');
+ var size = node.attr('size');
+ if (color) {
+ props.color = color;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (face) {
+ props['font-family'] = face;
+ }
+ if (size) {
+ props['font-size'] = fontSizes[parseInt(node.attr('size'), 10) - 1];
+ }
+ node.name = 'span';
+ node.attr('style', styles.serialize(props));
+ removeAttrs(node, [
+ 'color',
+ 'face',
+ 'size'
+ ]);
+ });
+ });
+ };
+ var addStrikeToSpanFilter = function (domParser, styles) {
+ domParser.addNodeFilter('strike', function (nodes) {
+ $_9ek1bp4jfuw8kxg.each(nodes, function (node) {
+ var props = styles.parse(node.attr('style'));
+ props['text-decoration'] = 'line-through';
+ node.name = 'span';
+ node.attr('style', styles.serialize(props));
+ });
+ });
+ };
+ var addFilters = function (domParser, settings) {
+ var styles = Styles();
+ if (settings.convert_fonts_to_spans) {
+ addFontToSpansFilter(domParser, styles, $_52qop8kjfuw8l6v.explode(settings.font_size_legacy_values));
+ }
+ addStrikeToSpanFilter(domParser, styles);
+ };
+ var register$1 = function (domParser, settings) {
+ if (settings.inline_styles) {
+ addFilters(domParser, settings);
+ }
+ };
+ var $_5qetf467jfuw8mbf = { register: register$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function getRange() {
- return editor.selection.getRng();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var whiteSpaceRegExp$3 = /^[ \t\r\n]*$/;
+ var typeLookup = {
+ '#text': 3,
+ '#comment': 8,
+ '#cdata': 4,
+ '#pi': 7,
+ '#doctype': 10,
+ '#document-fragment': 11
+ };
+ var walk$3 = function (node, root, prev) {
+ var sibling;
+ var parent;
+ var startName = prev ? 'lastChild' : 'firstChild';
+ var siblingName = prev ? 'prev' : 'next';
+ if (node[startName]) {
+ return node[startName];
+ }
+ if (node !== root) {
+ sibling = node[siblingName];
+ if (sibling) {
+ return sibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function scrollIntoView(node, alignToTop) {
- editor.selection.scrollIntoView(node, alignToTop);
- }
-
- function showCaret(direction, node, before) {
- var e;
-
- e = editor.fire('ShowCaret', {
- target: node,
- direction: direction,
- before: before
- });
-
- if (e.isDefaultPrevented()) {
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (parent = node.parent; parent && parent !== root; parent = parent.parent) {
+ sibling = parent[siblingName];
+ if (sibling) {
+ return sibling;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- scrollIntoView(node, direction === -1);
-
- return fakeCaret.show(before, node);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function getNormalizedRangeEndPoint(direction, range) {
- range = CaretUtils.normalizeRange(direction, rootNode, range);
-
- if (direction == -1) {
- return CaretPosition.fromRangeStart(range);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var Node$2 = function () {
+ function Node(name, type) {
+ this.name = name;
+ this.type = type;
+ if (type === 1) {
+ this.attributes = [];
+ this.attributes.map = {};
+ }
+ }
+ Node.create = function (name, attrs) {
+ var node, attrName;
+ node = new Node(name, typeLookup[name] || 1);
+ if (attrs) {
+ for (attrName in attrs) {
+ node.attr(attrName, attrs[attrName]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return CaretPosition.fromRangeEnd(range);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function showBlockCaretContainer(blockCaretContainer) {
- if (blockCaretContainer.hasAttribute('data-mce-caret')) {
- CaretContainer.showCaretContainerBlock(blockCaretContainer);
- setRange(getRange()); // Removes control rect on IE
- scrollIntoView(blockCaretContainer[0]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return node;
+ };
+ Node.prototype.replace = function (node) {
+ var self = this;
+ if (node.parent) {
+ node.remove();
+ }
+ self.insert(node, self);
+ self.remove();
+ return self;
+ };
+ Node.prototype.attr = function (name, value) {
+ var self = this;
+ var attrs, i;
+ if (typeof name !== 'string') {
+ for (i in name) {
+ self.attr(i, name[i]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function registerEvents() {
- function getContentEditableRoot(node) {
- var root = editor.getBody();
-
- while (node && node != root) {
- if (isContentEditableTrue(node) || isContentEditableFalse(node)) {
- return node;
- }
-
- node = node.parentNode;
- }
-
- return null;
- }
-
- // Some browsers (Chrome) lets you place the caret after a cE=false
- // Make sure we render the caret container in this case
- editor.on('mouseup', function (e) {
- var range = getRange();
-
- if (range.collapsed && EditorView.isXYInContentArea(editor, e.clientX, e.clientY)) {
- setRange(CefUtils.renderCaretAtRange(editor, range));
- }
- });
-
- editor.on('click', function (e) {
- var contentEditableRoot;
-
- contentEditableRoot = getContentEditableRoot(e.target);
- if (contentEditableRoot) {
- // Prevent clicks on links in a cE=false element
- if (isContentEditableFalse(contentEditableRoot)) {
- e.preventDefault();
- editor.focus();
- }
-
- // Removes fake selection if a cE=true is clicked within a cE=false like the toc title
- if (isContentEditableTrue(contentEditableRoot)) {
- if (editor.dom.isChildOf(contentEditableRoot, editor.selection.getNode())) {
- removeContentEditableSelection();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (attrs = self.attributes) {
+ if (value !== undefined) {
+ if (value === null) {
+ if (name in attrs.map) {
+ delete attrs.map[name];
+ i = attrs.length;
+ while (i--) {
+ if (attrs[i].name === name) {
+ attrs = attrs.splice(i, 1);
+ return self;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- editor.on('blur NewBlock', function () {
- removeContentEditableSelection();
- hideFakeCaret();
- });
-
- function handleTouchSelect(editor) {
- var moved = false;
-
- editor.on('touchstart', function () {
- moved = false;
- });
-
- editor.on('touchmove', function () {
- moved = true;
- });
-
- editor.on('touchend', function (e) {
- var contentEditableRoot = getContentEditableRoot(e.target);
-
- if (isContentEditableFalse(contentEditableRoot)) {
- if (!moved) {
- e.preventDefault();
- setContentEditableSelection(CefUtils.selectNode(editor, contentEditableRoot));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (name in attrs.map) {
+ i = attrs.length;
+ while (i--) {
+ if (attrs[i].name === name) {
+ attrs[i].value = value;
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-
- var hasNormalCaretPosition = function (elm) {
- var caretWalker = new CaretWalker(elm);
-
- if (!elm.firstChild) {
- return false;
- }
-
- var startPos = CaretPosition.before(elm.firstChild);
- var newPos = caretWalker.next(startPos);
-
- return newPos && !isBeforeContentEditableFalse(newPos) && !isAfterContentEditableFalse(newPos);
- };
-
- var isInSameBlock = function (node1, node2) {
- var block1 = editor.dom.getParent(node1, editor.dom.isBlock);
- var block2 = editor.dom.getParent(node2, editor.dom.isBlock);
- return block1 === block2;
- };
-
- // Checks if the target node is in a block and if that block has a caret position better than the
- // suggested caretNode this is to prevent the caret from being sucked in towards a cE=false block if
- // they are adjacent on the vertical axis
- var hasBetterMouseTarget = function (targetNode, caretNode) {
- var targetBlock = editor.dom.getParent(targetNode, editor.dom.isBlock);
- var caretBlock = editor.dom.getParent(caretNode, editor.dom.isBlock);
-
- return targetBlock && !isInSameBlock(targetBlock, caretBlock) && hasNormalCaretPosition(targetBlock);
- };
-
- handleTouchSelect(editor);
-
- editor.on('mousedown', function (e) {
- var contentEditableRoot;
-
- if (EditorView.isXYInContentArea(editor, e.clientX, e.clientY) === false) {
- return;
- }
-
- contentEditableRoot = getContentEditableRoot(e.target);
- if (contentEditableRoot) {
- if (isContentEditableFalse(contentEditableRoot)) {
- e.preventDefault();
- setContentEditableSelection(CefUtils.selectNode(editor, contentEditableRoot));
- } else {
- removeContentEditableSelection();
-
- // Check that we're not attempting a shift + click select within a contenteditable='true' element
- if (!(isContentEditableTrue(contentEditableRoot) && e.shiftKey) && !RangePoint.isXYWithinRange(e.clientX, e.clientY, editor.selection.getRng())) {
- ElementType.isVoid(Element.fromDom(e.target)) ? editor.selection.select(e.target) : editor.selection.placeCaretAt(e.clientX, e.clientY);
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Remove needs to be called here since the mousedown might alter the selection without calling selection.setRng
- // and therefore not fire the AfterSetSelectionRange event.
- removeContentEditableSelection();
- hideFakeCaret();
-
- var caretInfo = LineUtils.closestCaret(rootNode, e.clientX, e.clientY);
- if (caretInfo) {
- if (!hasBetterMouseTarget(e.target, caretInfo.node)) {
- e.preventDefault();
- editor.getBody().focus();
- setRange(showCaret(1, caretInfo.node, caretInfo.before));
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ attrs.push({
+ name: name,
+ value: value
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- editor.on('keypress', function (e) {
- if (VK.modifierPressed(e)) {
- return;
- }
-
- switch (e.keyCode) {
- default:
- if (isContentEditableFalse(editor.selection.getNode())) {
- e.preventDefault();
- }
- break;
- }
- });
-
- editor.on('getSelectionRange', function (e) {
- var rng = e.range;
-
- if (selectedContentEditableNode) {
- if (!selectedContentEditableNode.parentNode) {
- selectedContentEditableNode = null;
- return;
- }
-
- rng = rng.cloneRange();
- rng.selectNode(selectedContentEditableNode);
- e.range = rng;
- }
- });
-
- editor.on('setSelectionRange', function (e) {
- var rng;
-
- rng = setContentEditableSelection(e.range, e.forward);
- if (rng) {
- e.range = rng;
- }
- });
-
- editor.on('AfterSetSelectionRange', function (e) {
- var rng = e.range;
-
- if (!isRangeInCaretContainer(rng)) {
- hideFakeCaret();
- }
-
- if (!isFakeSelectionElement(rng.startContainer.parentNode)) {
- removeContentEditableSelection();
- }
- });
-
- editor.on('focus', function () {
- // Make sure we have a proper fake caret on focus
- Delay.setEditorTimeout(editor, function () {
- editor.selection.setRng(CefUtils.renderRangeCaret(editor, editor.selection.getRng()));
- }, 0);
- });
-
- editor.on('copy', function (e) {
- var clipboardData = e.clipboardData;
-
- // Make sure we get proper html/text for the fake cE=false selection
- // Doesn't work at all on Edge since it doesn't have proper clipboardData support
- if (!e.isDefaultPrevented() && e.clipboardData && !Env.ie) {
- var realSelectionElement = getRealSelectionElement();
- if (realSelectionElement) {
- e.preventDefault();
- clipboardData.clearData();
- clipboardData.setData('text/html', realSelectionElement.outerHTML);
- clipboardData.setData('text/plain', realSelectionElement.outerText);
- }
- }
- });
-
- DragDropOverrides.init(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ attrs.map[name] = value;
+ return self;
+ }
+ return attrs.map[name];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function addCss() {
- var styles = editor.contentStyles, rootClass = '.mce-content-body';
-
- styles.push(fakeCaret.getCss());
- styles.push(
- rootClass + ' .mce-offscreen-selection {' +
- 'position: absolute;' +
- 'left: -9999999999px;' +
- 'max-width: 1000000px;' +
- '}' +
- rootClass + ' *[contentEditable=false] {' +
- 'cursor: default;' +
- '}' +
- rootClass + ' *[contentEditable=true] {' +
- 'cursor: text;' +
- '}'
- );
- }
-
- function isWithinCaretContainer(node) {
- return (
- CaretContainer.isCaretContainer(node) ||
- CaretContainer.startsWithCaretContainer(node) ||
- CaretContainer.endsWithCaretContainer(node)
- );
- }
-
- function isRangeInCaretContainer(rng) {
- return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer);
- }
-
- function setContentEditableSelection(range, forward) {
- var node, $ = editor.$, dom = editor.dom, $realSelectionContainer, sel,
- startContainer, startOffset, endOffset, e, caretPosition, targetClone, origTargetClone;
-
- if (!range) {
- return null;
- }
-
- if (range.collapsed) {
- if (!isRangeInCaretContainer(range)) {
- if (forward === false) {
- caretPosition = getNormalizedRangeEndPoint(-1, range);
-
- if (isContentEditableFalse(caretPosition.getNode(true))) {
- return showCaret(-1, caretPosition.getNode(true), false);
- }
-
- if (isContentEditableFalse(caretPosition.getNode())) {
- return showCaret(-1, caretPosition.getNode(), !caretPosition.isAtEnd());
- }
- } else {
- caretPosition = getNormalizedRangeEndPoint(1, range);
-
- if (isContentEditableFalse(caretPosition.getNode())) {
- return showCaret(1, caretPosition.getNode(), !caretPosition.isAtEnd());
- }
-
- if (isContentEditableFalse(caretPosition.getNode(true))) {
- return showCaret(1, caretPosition.getNode(true), false);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ Node.prototype.clone = function () {
+ var self = this;
+ var clone = new Node(self.name, self.type);
+ var i, l, selfAttrs, selfAttr, cloneAttrs;
+ if (selfAttrs = self.attributes) {
+ cloneAttrs = [];
+ cloneAttrs.map = {};
+ for (i = 0, l = selfAttrs.length; i < l; i++) {
+ selfAttr = selfAttrs[i];
+ if (selfAttr.name !== 'id') {
+ cloneAttrs[cloneAttrs.length] = {
+ name: selfAttr.name,
+ value: selfAttr.value
+ };
+ cloneAttrs.map[selfAttr.name] = selfAttr.value;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- startContainer = range.startContainer;
- startOffset = range.startOffset;
- endOffset = range.endOffset;
-
- // Normalizes <span cE=false>[</span>] to [<span cE=false></span>]
- if (startContainer.nodeType == 3 && startOffset == 0 && isContentEditableFalse(startContainer.parentNode)) {
- startContainer = startContainer.parentNode;
- startOffset = dom.nodeIndex(startContainer);
- startContainer = startContainer.parentNode;
- }
-
- if (startContainer.nodeType != 1) {
- return null;
- }
-
- if (endOffset == startOffset + 1) {
- node = startContainer.childNodes[startOffset];
- }
-
- if (!isContentEditableFalse(node)) {
- return null;
- }
-
- targetClone = origTargetClone = node.cloneNode(true);
- e = editor.fire('ObjectSelected', { target: node, targetClone: targetClone });
- if (e.isDefaultPrevented()) {
- return null;
- }
-
- $realSelectionContainer = SelectorFind.descendant(Element.fromDom(editor.getBody()), '#' + realSelectionId).fold(
- function () {
- return $([]);
- },
- function (elm) {
- return $([elm.dom()]);
- }
- );
-
- targetClone = e.targetClone;
- if ($realSelectionContainer.length === 0) {
- $realSelectionContainer = $(
- '<div data-mce-bogus="all" class="mce-offscreen-selection"></div>'
- ).attr('id', realSelectionId);
-
- $realSelectionContainer.appendTo(editor.getBody());
- }
-
- range = editor.dom.createRng();
-
- // WHY is IE making things so hard! Copy on <i contentEditable="false">x</i> produces: <em>x</em>
- // This is a ridiculous hack where we place the selection from a block over the inline element
- // so that just the inline element is copied as is and not converted.
- if (targetClone === origTargetClone && Env.ie) {
- $realSelectionContainer.empty().append('<p style="font-size: 0" data-mce-bogus="all">\u00a0</p>').append(targetClone);
- range.setStartAfter($realSelectionContainer[0].firstChild.firstChild);
- range.setEndAfter(targetClone);
- } else {
- $realSelectionContainer.empty().append('\u00a0').append(targetClone).append('\u00a0');
- range.setStart($realSelectionContainer[0].firstChild, 1);
- range.setEnd($realSelectionContainer[0].lastChild, 0);
- }
-
- $realSelectionContainer.css({
- top: dom.getPos(node, editor.getBody()).y
- });
-
- $realSelectionContainer[0].focus();
- sel = editor.selection.getSel();
- sel.removeAllRanges();
- sel.addRange(range);
-
- Arr.each(SelectorFilter.descendants(Element.fromDom(editor.getBody()), '*[data-mce-selected]'), function (elm) {
- Attr.remove(elm, 'data-mce-selected');
- });
-
- node.setAttribute('data-mce-selected', 1);
- selectedContentEditableNode = node;
- hideFakeCaret();
-
- return range;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ clone.attributes = cloneAttrs;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function removeContentEditableSelection() {
- if (selectedContentEditableNode) {
- selectedContentEditableNode.removeAttribute('data-mce-selected');
- SelectorFind.descendant(Element.fromDom(editor.getBody()), '#' + realSelectionId).each(Remove.remove);
- selectedContentEditableNode = null;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ clone.value = self.value;
+ clone.shortEnded = self.shortEnded;
+ return clone;
+ };
+ Node.prototype.wrap = function (wrapper) {
+ var self = this;
+ self.parent.insert(wrapper, self);
+ wrapper.append(self);
+ return self;
+ };
+ Node.prototype.unwrap = function () {
+ var self = this;
+ var node, next;
+ for (node = self.firstChild; node;) {
+ next = node.next;
+ self.insert(node, self, true);
+ node = next;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function destroy() {
- fakeCaret.destroy();
- selectedContentEditableNode = null;
- }
-
- function hideFakeCaret() {
- fakeCaret.hide();
- }
-
- if (Env.ceFalse) {
- registerEvents();
- addCss();
- }
-
- return {
- showCaret: showCaret,
- showBlockCaretContainer: showBlockCaretContainer,
- hideFakeCaret: hideFakeCaret,
- destroy: destroy
- };
- }
-
- return SelectionOverrides;
- }
-);
-
-/**
- * Diff.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * JS Implementation of the O(ND) Difference Algorithm by Eugene W. Myers.
- *
- * @class tinymce.undo.Diff
- * @private
- */
-define(
- 'tinymce.core.undo.Diff',
- [
- ],
- function () {
- var KEEP = 0, INSERT = 1, DELETE = 2;
-
- var diff = function (left, right) {
- var size = left.length + right.length + 2;
- var vDown = new Array(size);
- var vUp = new Array(size);
-
- var snake = function (start, end, diag) {
- return {
- start: start,
- end: end,
- diag: diag
- };
- };
-
- var buildScript = function (start1, end1, start2, end2, script) {
- var middle = getMiddleSnake(start1, end1, start2, end2);
-
- if (middle === null || middle.start === end1 && middle.diag === end1 - end2 ||
- middle.end === start1 && middle.diag === start1 - start2) {
- var i = start1;
- var j = start2;
- while (i < end1 || j < end2) {
- if (i < end1 && j < end2 && left[i] === right[j]) {
- script.push([KEEP, left[i]]);
- ++i;
- ++j;
- } else {
- if (end1 - start1 > end2 - start2) {
- script.push([DELETE, left[i]]);
- ++i;
- } else {
- script.push([INSERT, right[j]]);
- ++j;
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.remove();
+ };
+ Node.prototype.remove = function () {
+ var self = this, parent = self.parent, next = self.next, prev = self.prev;
+ if (parent) {
+ if (parent.firstChild === self) {
+ parent.firstChild = next;
+ if (next) {
+ next.prev = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- buildScript(start1, middle.start, start2, middle.start - middle.diag, script);
- for (var i2 = middle.start; i2 < middle.end; ++i2) {
- script.push([KEEP, left[i2]]);
- }
- buildScript(middle.end, end1, middle.end - middle.diag, end2, script);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ prev.next = next;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var buildSnake = function (start, diag, end1, end2) {
- var end = start;
- while (end - diag < end2 && end < end1 && left[end] === right[end - diag]) {
- ++end;
- }
- return snake(start, end, diag);
- };
-
- var getMiddleSnake = function (start1, end1, start2, end2) {
- // Myers Algorithm
- // Initialisations
- var m = end1 - start1;
- var n = end2 - start2;
- if (m === 0 || n === 0) {
- return null;
- }
-
- var delta = m - n;
- var sum = n + m;
- var offset = (sum % 2 === 0 ? sum : sum + 1) / 2;
- vDown[1 + offset] = start1;
- vUp[1 + offset] = end1 + 1;
-
- for (var d = 0; d <= offset; ++d) {
- // Down
- for (var k = -d; k <= d; k += 2) {
- // First step
-
- var i = k + offset;
- if (k === -d || k != d && vDown[i - 1] < vDown[i + 1]) {
- vDown[i] = vDown[i + 1];
- } else {
- vDown[i] = vDown[i - 1] + 1;
- }
-
- var x = vDown[i];
- var y = x - start1 + start2 - k;
-
- while (x < end1 && y < end2 && left[x] === right[y]) {
- vDown[i] = ++x;
- ++y;
- }
- // Second step
- if (delta % 2 != 0 && delta - d <= k && k <= delta + d) {
- if (vUp[i - delta] <= vDown[i]) {
- return buildSnake(vUp[i - delta], k + start1 - start2, end1, end2);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (parent.lastChild === self) {
+ parent.lastChild = prev;
+ if (prev) {
+ prev.next = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Up
- for (k = delta - d; k <= delta + d; k += 2) {
- // First step
- i = k + offset - delta;
- if (k === delta - d || k != delta + d && vUp[i + 1] <= vUp[i - 1]) {
- vUp[i] = vUp[i + 1] - 1;
- } else {
- vUp[i] = vUp[i - 1];
- }
-
- x = vUp[i] - 1;
- y = x - start1 + start2 - k;
- while (x >= start1 && y >= start2 && left[x] === right[y]) {
- vUp[i] = x--;
- y--;
- }
- // Second step
- if (delta % 2 === 0 && -d <= k && k <= d) {
- if (vUp[i] <= vDown[i + delta]) {
- return buildSnake(vUp[i], k + start1 - start2, end1, end2);
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ next.prev = prev;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var script = [];
- buildScript(0, left.length, 0, right.length, script);
- return script;
- };
-
- return {
- KEEP: KEEP,
- DELETE: DELETE,
- INSERT: INSERT,
- diff: diff
- };
- }
-);
-/**
- * Fragments.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module reads and applies html fragments from/to dom nodes.
- *
- * @class tinymce.undo.Fragments
- * @private
- */
-define(
- 'tinymce.core.undo.Fragments',
- [
- "tinymce.core.util.Arr",
- "tinymce.core.html.Entities",
- "tinymce.core.undo.Diff"
- ],
- function (Arr, Entities, Diff) {
- var getOuterHtml = function (elm) {
- if (elm.nodeType === 1) {
- return elm.outerHTML;
- } else if (elm.nodeType === 3) {
- return Entities.encodeRaw(elm.data, false);
- } else if (elm.nodeType === 8) {
- return '<!--' + elm.data + '-->';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.parent = self.next = self.prev = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var createFragment = function (html) {
- var frag, node, container;
-
- container = document.createElement("div");
- frag = document.createDocumentFragment();
-
- if (html) {
- container.innerHTML = html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Node.prototype.append = function (node) {
+ var self = this;
+ var last;
+ if (node.parent) {
+ node.remove();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- while ((node = container.firstChild)) {
- frag.appendChild(node);
- }
-
- return frag;
- };
-
- var insertAt = function (elm, html, index) {
- var fragment = createFragment(html);
- if (elm.hasChildNodes() && index < elm.childNodes.length) {
- var target = elm.childNodes[index];
- target.parentNode.insertBefore(fragment, target);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ last = self.lastChild;
+ if (last) {
+ last.next = node;
+ node.prev = last;
+ self.lastChild = node;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- elm.appendChild(fragment);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.lastChild = self.firstChild = node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.parent = self;
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var removeAt = function (elm, index) {
- if (elm.hasChildNodes() && index < elm.childNodes.length) {
- var target = elm.childNodes[index];
- target.parentNode.removeChild(target);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Node.prototype.insert = function (node, refNode, before) {
+ var parent;
+ if (node.parent) {
+ node.remove();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- var applyDiff = function (diff, elm) {
- var index = 0;
- Arr.each(diff, function (action) {
- if (action[0] === Diff.KEEP) {
- index++;
- } else if (action[0] === Diff.INSERT) {
- insertAt(elm, action[1], index);
- index++;
- } else if (action[0] === Diff.DELETE) {
- removeAt(elm, index);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent = refNode.parent || this;
+ if (before) {
+ if (refNode === parent.firstChild) {
+ parent.firstChild = node;
+ } else {
+ refNode.prev.next = node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- };
-
- var read = function (elm) {
- return Arr.filter(Arr.map(elm.childNodes, getOuterHtml), function (item) {
- return item.length > 0;
- });
- };
-
- var write = function (fragments, elm) {
- var currentFragments = Arr.map(elm.childNodes, getOuterHtml);
- applyDiff(Diff.diff(currentFragments, fragments), elm);
- return elm;
- };
-
- return {
- read: read,
- write: write
- };
- }
-);
-/**
- * Levels.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module handles getting/setting undo levels to/from editor instances.
- *
- * @class tinymce.undo.Levels
- * @private
- */
-define(
- 'tinymce.core.undo.Levels',
- [
- "tinymce.core.util.Arr",
- "tinymce.core.undo.Fragments"
- ],
- function (Arr, Fragments) {
- var hasIframes = function (html) {
- return html.indexOf('</iframe>') !== -1;
- };
-
- var createFragmentedLevel = function (fragments) {
- return {
- type: 'fragmented',
- fragments: fragments,
- content: '',
- bookmark: null,
- beforeBookmark: null
- };
- };
-
- var createCompleteLevel = function (content) {
- return {
- type: 'complete',
- fragments: null,
- content: content,
- bookmark: null,
- beforeBookmark: null
- };
- };
-
- var createFromEditor = function (editor) {
- var fragments, content, trimmedFragments;
-
- fragments = Fragments.read(editor.getBody());
- trimmedFragments = Arr.map(fragments, function (html) {
- return editor.serializer.trimContent(html);
- });
- content = trimmedFragments.join('');
-
- return hasIframes(content) ? createFragmentedLevel(trimmedFragments) : createCompleteLevel(content);
- };
-
- var applyToEditor = function (editor, level, before) {
- if (level.type === 'fragmented') {
- Fragments.write(level.fragments, editor.getBody());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.prev = refNode.prev;
+ node.next = refNode;
+ refNode.prev = node;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.setContent(level.content, { format: 'raw' });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (refNode === parent.lastChild) {
+ parent.lastChild = node;
+ } else {
+ refNode.next.prev = node;
+ }
+ node.next = refNode.next;
+ node.prev = refNode;
+ refNode.next = node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.selection.moveToBookmark(before ? level.beforeBookmark : level.bookmark);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.parent = parent;
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getLevelContent = function (level) {
- return level.type === 'fragmented' ? level.fragments.join('') : level.content;
- };
-
- var isEq = function (level1, level2) {
- return !!level1 && !!level2 && getLevelContent(level1) === getLevelContent(level2);
- };
-
- return {
- createFragmentedLevel: createFragmentedLevel,
- createCompleteLevel: createCompleteLevel,
- createFromEditor: createFromEditor,
- applyToEditor: applyToEditor,
- isEq: isEq
- };
- }
-);
-/**
- * UndoManager.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class handles the undo/redo history levels for the editor. Since the built-in undo/redo has major drawbacks a custom one was needed.
- *
- * @class tinymce.UndoManager
- */
-define(
- 'tinymce.core.UndoManager',
- [
- "tinymce.core.util.VK",
- "tinymce.core.util.Tools",
- "tinymce.core.undo.Levels"
- ],
- function (VK, Tools, Levels) {
- return function (editor) {
- var self = this, index = 0, data = [], beforeBookmark, isFirstTypedCharacter, locks = 0;
-
- var isUnlocked = function () {
- return locks === 0;
- };
-
- var setTyping = function (typing) {
- if (isUnlocked()) {
- self.typing = typing;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Node.prototype.getAll = function (name) {
+ var self = this;
+ var node;
+ var collection = [];
+ for (node = self.firstChild; node; node = walk$3(node, self)) {
+ if (node.name === name) {
+ collection.push(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- function setDirty(state) {
- editor.setDirty(state);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function addNonTypingUndoLevel(e) {
- setTyping(false);
- self.add({}, e);
- }
-
- function endTyping() {
- if (self.typing) {
- setTyping(false);
- self.add();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return collection;
+ };
+ Node.prototype.empty = function () {
+ var self = this;
+ var nodes, i, node;
+ if (self.firstChild) {
+ nodes = [];
+ for (node = self.firstChild; node; node = walk$3(node, self)) {
+ nodes.push(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ i = nodes.length;
+ while (i--) {
+ node = nodes[i];
+ node.parent = node.firstChild = node.lastChild = node.next = node.prev = null;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Add initial undo level when the editor is initialized
- editor.on('init', function () {
- self.add();
- });
-
- // Get position before an execCommand is processed
- editor.on('BeforeExecCommand', function (e) {
- var cmd = e.command;
-
- if (cmd !== 'Undo' && cmd !== 'Redo' && cmd !== 'mceRepaint') {
- endTyping();
- self.beforeChange();
- }
- });
-
- // Add undo level after an execCommand call was made
- editor.on('ExecCommand', function (e) {
- var cmd = e.command;
-
- if (cmd !== 'Undo' && cmd !== 'Redo' && cmd !== 'mceRepaint') {
- addNonTypingUndoLevel(e);
- }
- });
-
- editor.on('ObjectResizeStart Cut', function () {
- self.beforeChange();
- });
-
- editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel);
- editor.on('DragEnd', addNonTypingUndoLevel);
-
- editor.on('KeyUp', function (e) {
- var keyCode = e.keyCode;
-
- // If key is prevented then don't add undo level
- // This would happen on keyboard shortcuts for example
- if (e.isDefaultPrevented()) {
- return;
- }
-
- if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode === 45 || e.ctrlKey) {
- addNonTypingUndoLevel();
- editor.nodeChanged();
- }
-
- if (keyCode === 46 || keyCode === 8) {
- editor.nodeChanged();
- }
-
- // Fire a TypingUndo/Change event on the first character entered
- if (isFirstTypedCharacter && self.typing && Levels.isEq(Levels.createFromEditor(editor), data[0]) === false) {
- if (editor.isDirty() === false) {
- setDirty(true);
- editor.fire('change', { level: data[0], lastLevel: null });
- }
-
- editor.fire('TypingUndo');
- isFirstTypedCharacter = false;
- editor.nodeChanged();
- }
- });
-
- editor.on('KeyDown', function (e) {
- var keyCode = e.keyCode;
-
- // If key is prevented then don't add undo level
- // This would happen on keyboard shortcuts for example
- if (e.isDefaultPrevented()) {
- return;
- }
-
- // Is character position keys left,right,up,down,home,end,pgdown,pgup,enter
- if ((keyCode >= 33 && keyCode <= 36) || (keyCode >= 37 && keyCode <= 40) || keyCode === 45) {
- if (self.typing) {
- addNonTypingUndoLevel(e);
- }
-
- return;
- }
-
- // If key isn't Ctrl+Alt/AltGr
- var modKey = (e.ctrlKey && !e.altKey) || e.metaKey;
- if ((keyCode < 16 || keyCode > 20) && keyCode !== 224 && keyCode !== 91 && !self.typing && !modKey) {
- self.beforeChange();
- setTyping(true);
- self.add({}, e);
- isFirstTypedCharacter = true;
- }
- });
-
- editor.on('MouseDown', function (e) {
- if (self.typing) {
- addNonTypingUndoLevel(e);
- }
- });
-
- // Add keyboard shortcuts for undo/redo keys
- editor.addShortcut('meta+z', '', 'Undo');
- editor.addShortcut('meta+y,meta+shift+z', '', 'Redo');
-
- editor.on('AddUndo Undo Redo ClearUndos', function (e) {
- if (!e.isDefaultPrevented()) {
- editor.nodeChanged();
- }
- });
-
- /*eslint consistent-this:0 */
- self = {
- // Explode for debugging reasons
- data: data,
-
- /**
- * State if the user is currently typing or not. This will add a typing operation into one undo
- * level instead of one new level for each keystroke.
- *
- * @field {Boolean} typing
- */
- typing: false,
-
- /**
- * Stores away a bookmark to be used when performing an undo action so that the selection is before
- * the change has been made.
- *
- * @method beforeChange
- */
- beforeChange: function () {
- if (isUnlocked()) {
- beforeBookmark = editor.selection.getBookmark(2, true);
- }
- },
-
- /**
- * Adds a new undo level/snapshot to the undo list.
- *
- * @method add
- * @param {Object} level Optional undo level object to add.
- * @param {DOMEvent} event Optional event responsible for the creation of the undo level.
- * @return {Object} Undo level that got added or null it a level wasn't needed.
- */
- add: function (level, event) {
- var i, settings = editor.settings, lastLevel, currentLevel;
-
- currentLevel = Levels.createFromEditor(editor);
- level = level || {};
- level = Tools.extend(level, currentLevel);
-
- if (isUnlocked() === false || editor.removed) {
- return null;
- }
-
- lastLevel = data[index];
- if (editor.fire('BeforeAddUndo', { level: level, lastLevel: lastLevel, originalEvent: event }).isDefaultPrevented()) {
- return null;
- }
-
- // Add undo level if needed
- if (lastLevel && Levels.isEq(lastLevel, level)) {
- return null;
- }
-
- // Set before bookmark on previous level
- if (data[index]) {
- data[index].beforeBookmark = beforeBookmark;
- }
-
- // Time to compress
- if (settings.custom_undo_redo_levels) {
- if (data.length > settings.custom_undo_redo_levels) {
- for (i = 0; i < data.length - 1; i++) {
- data[i] = data[i + 1];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.firstChild = self.lastChild = null;
+ return self;
+ };
+ Node.prototype.isEmpty = function (elements, whitespace, predicate) {
+ var self = this;
+ var node = self.firstChild, i, name;
+ whitespace = whitespace || {};
+ if (node) {
+ do {
+ if (node.type === 1) {
+ if (node.attributes.map['data-mce-bogus']) {
+ continue;
+ }
+ if (elements[node.name]) {
+ return false;
+ }
+ i = node.attributes.length;
+ while (i--) {
+ name = node.attributes[i].name;
+ if (name === 'name' || name.indexOf('data-mce-bookmark') === 0) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- data.length--;
- index = data.length;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Get a non intrusive normalized bookmark
- level.bookmark = editor.selection.getBookmark(2, true);
-
- // Crop array if needed
- if (index < data.length - 1) {
- data.length = index + 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.type === 8) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- data.push(level);
- index = data.length - 1;
-
- var args = { level: level, lastLevel: lastLevel, originalEvent: event };
-
- editor.fire('AddUndo', args);
-
- if (index > 0) {
- setDirty(true);
- editor.fire('change', args);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.type === 3 && !whiteSpaceRegExp$3.test(node.value)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return level;
- },
-
- /**
- * Undoes the last action.
- *
- * @method undo
- * @return {Object} Undo level or null if no undo was performed.
- */
- undo: function () {
- var level;
-
- if (self.typing) {
- self.add();
- self.typing = false;
- setTyping(false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node.type === 3 && node.parent && whitespace[node.parent.name] && whiteSpaceRegExp$3.test(node.value)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (index > 0) {
- level = data[--index];
- Levels.applyToEditor(editor, level, true);
- setDirty(true);
- editor.fire('undo', { level: level });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (predicate && predicate(node)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } while (node = walk$3(node, self));
+ }
+ return true;
+ };
+ Node.prototype.walk = function (prev) {
+ return walk$3(this, null, prev);
+ };
+ return Node;
+ }();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return level;
- },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var paddEmptyNode = function (settings, args, blockElements, node) {
+ var brPreferred = settings.padd_empty_with_br || args.insert;
+ if (brPreferred && blockElements[node.name]) {
+ node.empty().append(new Node$2('br', 1)).shortEnded = true;
+ } else {
+ node.empty().append(new Node$2('#text', 3)).value = '\xA0';
+ }
+ };
+ var isPaddedWithNbsp = function (node) {
+ return hasOnlyChild(node, '#text') && node.firstChild.value === '\xA0';
+ };
+ var hasOnlyChild = function (node, name) {
+ return node && node.firstChild && node.firstChild === node.lastChild && node.firstChild.name === name;
+ };
+ var isPadded = function (schema, node) {
+ var rule = schema.getElementRule(node.name);
+ return rule && rule.paddEmpty;
+ };
+ var isEmpty$2 = function (schema, nonEmptyElements, whitespaceElements, node) {
+ return node.isEmpty(nonEmptyElements, whitespaceElements, function (node) {
+ return isPadded(schema, node);
+ });
+ };
+ var isLineBreakNode = function (node, blockElements) {
+ return node && (blockElements[node.name] || node.name === 'br');
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Redoes the last action.
- *
- * @method redo
- * @return {Object} Redo level or null if no redo was performed.
- */
- redo: function () {
- var level;
-
- if (index < data.length - 1) {
- level = data[++index];
- Levels.applyToEditor(editor, level, false);
- setDirty(true);
- editor.fire('redo', { level: level });
- }
-
- return level;
- },
-
- /**
- * Removes all undo levels.
- *
- * @method clear
- */
- clear: function () {
- data = [];
- index = 0;
- self.typing = false;
- self.data = data;
- editor.fire('ClearUndos');
- },
-
- /**
- * Returns true/false if the undo manager has any undo levels.
- *
- * @method hasUndo
- * @return {Boolean} true/false if the undo manager has any undo levels.
- */
- hasUndo: function () {
- // Has undo levels or typing and content isn't the same as the initial level
- return index > 0 || (self.typing && data[0] && !Levels.isEq(Levels.createFromEditor(editor), data[0]));
- },
-
- /**
- * Returns true/false if the undo manager has any redo levels.
- *
- * @method hasRedo
- * @return {Boolean} true/false if the undo manager has any redo levels.
- */
- hasRedo: function () {
- return index < data.length - 1 && !self.typing;
- },
-
- /**
- * Executes the specified mutator function as an undo transaction. The selection
- * before the modification will be stored to the undo stack and if the DOM changes
- * it will add a new undo level. Any logic within the translation that adds undo levels will
- * be ignored. So a translation can include calls to execCommand or editor.insertContent.
- *
- * @method transact
- * @param {function} callback Function that gets executed and has dom manipulation logic in it.
- * @return {Object} Undo level that got added or null it a level wasn't needed.
- */
- transact: function (callback) {
- endTyping();
- self.beforeChange();
- self.ignore(callback);
- return self.add();
- },
-
- /**
- * Executes the specified mutator function as an undo transaction. But without adding an undo level.
- * Any logic within the translation that adds undo levels will be ignored. So a translation can
- * include calls to execCommand or editor.insertContent.
- *
- * @method ignore
- * @param {function} callback Function that gets executed and has dom manipulation logic in it.
- * @return {Object} Undo level that got added or null it a level wasn't needed.
- */
- ignore: function (callback) {
- try {
- locks++;
- callback();
- } finally {
- locks--;
- }
- },
-
- /**
- * Adds an extra "hidden" undo level by first applying the first mutation and store that to the undo stack
- * then roll back that change and do the second mutation on top of the stack. This will produce an extra
- * undo level that the user doesn't see until they undo.
- *
- * @method extra
- * @param {function} callback1 Function that does mutation but gets stored as a "hidden" extra undo level.
- * @param {function} callback2 Function that does mutation but gets displayed to the user.
- */
- extra: function (callback1, callback2) {
- var lastLevel, bookmark;
-
- if (self.transact(callback1)) {
- bookmark = data[index].bookmark;
- lastLevel = data[index - 1];
- Levels.applyToEditor(editor, lastLevel, true);
-
- if (self.transact(callback2)) {
- data[index - 1].beforeBookmark = bookmark;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var register$2 = function (parser, settings) {
+ var schema = parser.schema;
+ if (settings.remove_trailing_brs) {
+ parser.addNodeFilter('br', function (nodes, _, args) {
+ var i;
+ var l = nodes.length;
+ var node;
+ var blockElements = $_52qop8kjfuw8l6v.extend({}, schema.getBlockElements());
+ var nonEmptyElements = schema.getNonEmptyElements();
+ var parent, lastParent, prev, prevName;
+ var whiteSpaceElements = schema.getNonEmptyElements();
+ var elementRule, textNode;
+ blockElements.body = 1;
+ for (i = 0; i < l; i++) {
+ node = nodes[i];
+ parent = node.parent;
+ if (blockElements[node.parent.name] && node === parent.lastChild) {
+ prev = node.prev;
+ while (prev) {
+ prevName = prev.name;
+ if (prevName !== 'span' || prev.attr('data-mce-type') !== 'bookmark') {
+ if (prevName !== 'br') {
+ break;
+ }
+ if (prevName === 'br') {
+ node = null;
+ break;
+ }
+ }
+ prev = prev.prev;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (node) {
+ node.remove();
+ if (isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, parent)) {
+ elementRule = schema.getElementRule(parent.name);
+ if (elementRule) {
+ if (elementRule.removeEmpty) {
+ parent.remove();
+ } else if (elementRule.paddEmpty) {
+ paddEmptyNode(settings, args, blockElements, parent);
+ }
+ }
+ }
+ }
+ } else {
+ lastParent = node;
+ while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) {
+ lastParent = parent;
+ if (blockElements[parent.name]) {
+ break;
+ }
+ parent = parent.parent;
+ }
+ if (lastParent === parent && settings.padd_empty_with_br !== true) {
+ textNode = new Node$2('#text', 3);
+ textNode.value = '\xA0';
+ node.replace(textNode);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ parser.addAttributeFilter('href', function (nodes) {
+ var i = nodes.length, node;
+ var appendRel = function (rel) {
+ var parts = rel.split(' ').filter(function (p) {
+ return p.length > 0;
+ });
+ return parts.concat(['noopener']).sort().join(' ');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return self;
- };
- }
-);
-
-/**
- * NodePath.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Handles paths of nodes within an element.
- *
- * @private
- * @class tinymce.dom.NodePath
- */
-define(
- 'tinymce.core.dom.NodePath',
- [
- "tinymce.core.dom.DOMUtils"
- ],
- function (DOMUtils) {
- function create(rootNode, targetNode, normalized) {
- var path = [];
-
- for (; targetNode && targetNode != rootNode; targetNode = targetNode.parentNode) {
- path.push(DOMUtils.nodeIndex(targetNode, normalized));
- }
-
- return path;
- }
-
- function resolve(rootNode, path) {
- var i, node, children;
-
- for (node = rootNode, i = path.length - 1; i >= 0; i--) {
- children = node.childNodes;
-
- if (path[i] > children.length - 1) {
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addNoOpener = function (rel) {
+ var newRel = rel ? $_52qop8kjfuw8l6v.trim(rel) : '';
+ if (!/\b(noopener)\b/g.test(newRel)) {
+ return appendRel(newRel);
+ } else {
+ return newRel;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node = children[path[i]];
- }
-
- return node;
- }
-
- return {
- create: create,
- resolve: resolve
- };
- }
-);
-/**
- * Quirks.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- *
- * @ignore-file
- */
-
-/**
- * This file includes fixes for various browser quirks it's made to make it easy to add/remove browser specific fixes.
- *
- * @private
- * @class tinymce.util.Quirks
- */
-define(
- 'tinymce.core.util.Quirks',
- [
- "tinymce.core.util.VK",
- "tinymce.core.dom.RangeUtils",
- "tinymce.core.dom.TreeWalker",
- "tinymce.core.dom.NodePath",
- "tinymce.core.html.Node",
- "tinymce.core.html.Entities",
- "tinymce.core.Env",
- "tinymce.core.util.Tools",
- "tinymce.core.util.Delay",
- "tinymce.core.caret.CaretContainer",
- "tinymce.core.caret.CaretPosition",
- "tinymce.core.caret.CaretWalker"
- ],
- function (VK, RangeUtils, TreeWalker, NodePath, Node, Entities, Env, Tools, Delay, CaretContainer, CaretPosition, CaretWalker) {
- return function (editor) {
- var each = Tools.each;
- var BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection,
- settings = editor.settings, parser = editor.parser, serializer = editor.serializer;
- var isGecko = Env.gecko, isIE = Env.ie, isWebKit = Env.webkit;
- var mceInternalUrlPrefix = 'data:text/mce-internal,';
- var mceInternalDataType = isIE ? 'Text' : 'URL';
-
- /**
- * Executes a command with a specific state this can be to enable/disable browser editing features.
- */
- function setEditorCommandState(cmd, state) {
- try {
- editor.getDoc().execCommand(cmd, false, state);
- } catch (ex) {
- // Ignore
- }
- }
-
- /**
- * Returns current IE document mode.
- */
- function getDocumentMode() {
- var documentMode = editor.getDoc().documentMode;
-
- return documentMode ? documentMode : 6;
- }
-
- /**
- * Returns true/false if the event is prevented or not.
- *
- * @private
- * @param {Event} e Event object.
- * @return {Boolean} true/false if the event is prevented or not.
- */
- function isDefaultPrevented(e) {
- return e.isDefaultPrevented();
- }
-
- /**
- * Sets Text/URL data on the event's dataTransfer object to a special data:text/mce-internal url.
- * This is to workaround the inability to set custom contentType on IE and Safari.
- * The editor's selected content is encoded into this url so drag and drop between editors will work.
- *
- * @private
- * @param {DragEvent} e Event object
- */
- function setMceInternalContent(e) {
- var selectionHtml, internalContent;
-
- if (e.dataTransfer) {
- if (editor.selection.isCollapsed() && e.target.tagName == 'IMG') {
- selection.select(e.target);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (!settings.allow_unsafe_link_target) {
+ while (i--) {
+ node = nodes[i];
+ if (node.name === 'a' && node.attr('target') === '_blank') {
+ node.attr('rel', addNoOpener(node.attr('rel')));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- selectionHtml = editor.selection.getContent();
-
- // Safari/IE doesn't support custom dataTransfer items so we can only use URL and Text
- if (selectionHtml.length > 0) {
- internalContent = mceInternalUrlPrefix + escape(editor.id) + ',' + escape(selectionHtml);
- e.dataTransfer.setData(mceInternalDataType, internalContent);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Gets content of special data:text/mce-internal url on the event's dataTransfer object.
- * This is to workaround the inability to set custom contentType on IE and Safari.
- * The editor's selected content is encoded into this url so drag and drop between editors will work.
- *
- * @private
- * @param {DragEvent} e Event object
- * @returns {String} mce-internal content
- */
- function getMceInternalContent(e) {
- var internalContent;
-
- if (e.dataTransfer) {
- internalContent = e.dataTransfer.getData(mceInternalDataType);
-
- if (internalContent && internalContent.indexOf(mceInternalUrlPrefix) >= 0) {
- internalContent = internalContent.substr(mceInternalUrlPrefix.length).split(',');
-
- return {
- id: unescape(internalContent[0]),
- html: unescape(internalContent[1])
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ if (!settings.allow_html_in_named_anchor) {
+ parser.addAttributeFilter('id,name', function (nodes) {
+ var i = nodes.length, sibling, prevSibling, parent, node;
+ while (i--) {
+ node = nodes[i];
+ if (node.name === 'a' && node.firstChild && !node.attr('href')) {
+ parent = node.parent;
+ sibling = node.lastChild;
+ do {
+ prevSibling = sibling.prev;
+ parent.insert(sibling, node);
+ sibling = prevSibling;
+ } while (sibling);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
- }
-
- /**
- * Inserts contents using the paste clipboard command if it's available if it isn't it will fallback
- * to the core command.
- *
- * @private
- * @param {String} content Content to insert at selection.
- * @param {Boolean} internal State if the paste is to be considered internal or external.
- */
- function insertClipboardContents(content, internal) {
- if (editor.queryCommandSupported('mceInsertClipboardContent')) {
- editor.execCommand('mceInsertClipboardContent', false, { content: content, internal: internal });
- } else {
- editor.execCommand('mceInsertContent', false, content);
- }
- }
-
- /**
- * Makes sure that the editor body becomes empty when backspace or delete is pressed in empty editors.
- *
- * For example:
- * <p><b>|</b></p>
- *
- * Or:
- * <h1>|</h1>
- *
- * Or:
- * [<h1></h1>]
- */
- function emptyEditorWhenDeleting() {
- function serializeRng(rng) {
- var body = dom.create("body");
- var contents = rng.cloneContents();
- body.appendChild(contents);
- return selection.serializer.serialize(body, { format: 'html' });
- }
-
- function allContentsSelected(rng) {
- if (!rng.setStart) {
- if (rng.item) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ if (settings.fix_list_elements) {
+ parser.addNodeFilter('ul,ol', function (nodes) {
+ var i = nodes.length, node, parentNode;
+ while (i--) {
+ node = nodes[i];
+ parentNode = node.parent;
+ if (parentNode.name === 'ul' || parentNode.name === 'ol') {
+ if (node.prev && node.prev.name === 'li') {
+ node.prev.append(node);
+ } else {
+ var li = new Node$2('li', 1);
+ li.attr('style', 'list-style-type: none');
+ node.wrap(li);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var bodyRng = rng.duplicate();
- bodyRng.moveToElementText(editor.getBody());
- return RangeUtils.compareRanges(rng, bodyRng);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var selection = serializeRng(rng);
-
- var allRng = dom.createRng();
- allRng.selectNode(editor.getBody());
-
- var allSelection = serializeRng(allRng);
- return selection === allSelection;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.on('keydown', function (e) {
- var keyCode = e.keyCode, isCollapsed, body;
-
- // Empty the editor if it's needed for example backspace at <p><b>|</b></p>
- if (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {
- isCollapsed = editor.selection.isCollapsed();
- body = editor.getBody();
-
- // Selection is collapsed but the editor isn't empty
- if (isCollapsed && !dom.isEmpty(body)) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ if (settings.validate && schema.getValidClasses()) {
+ parser.addAttributeFilter('class', function (nodes) {
+ var i = nodes.length, node, classList, ci, className, classValue;
+ var validClasses = schema.getValidClasses();
+ var validClassesMap, valid;
+ while (i--) {
+ node = nodes[i];
+ classList = node.attr('class').split(' ');
+ classValue = '';
+ for (ci = 0; ci < classList.length; ci++) {
+ className = classList[ci];
+ valid = false;
+ validClassesMap = validClasses['*'];
+ if (validClassesMap && validClassesMap[className]) {
+ valid = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Selection isn't collapsed but not all the contents is selected
- if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ validClassesMap = validClasses[node.name];
+ if (!valid && validClassesMap && validClassesMap[className]) {
+ valid = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Manually empty the editor
- e.preventDefault();
- editor.setContent('');
-
- if (body.firstChild && dom.isBlock(body.firstChild)) {
- editor.selection.setCursorLocation(body.firstChild, 0);
- } else {
- editor.selection.setCursorLocation(body, 0);
- }
-
- editor.nodeChanged();
- }
- });
- }
-
- /**
- * WebKit doesn't select all the nodes in the body when you press Ctrl+A.
- * IE selects more than the contents <body>[<p>a</p>]</body> instead of <body><p>[a]</p]</body> see bug #6438
- * This selects the whole body so that backspace/delete logic will delete everything
- */
- function selectAll() {
- editor.shortcuts.add('meta+a', null, 'SelectAll');
- }
-
- /**
- * WebKit has a weird issue where it some times fails to properly convert keypresses to input method keystrokes.
- * The IME on Mac doesn't initialize when it doesn't fire a proper focus event.
- *
- * This seems to happen when the user manages to click the documentElement element then the window doesn't get proper focus until
- * you enter a character into the editor.
- *
- * It also happens when the first focus in made to the body.
- *
- * See: https://bugs.webkit.org/show_bug.cgi?id=83566
- */
- function inputMethodFocus() {
- if (!editor.settings.content_editable) {
- // Case 1 IME doesn't initialize if you focus the document
- // Disabled since it was interferring with the cE=false logic
- // Also coultn't reproduce the issue on Safari 9
- /*dom.bind(editor.getDoc(), 'focusin', function() {
- selection.setRng(selection.getRng());
- });*/
-
- // Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event
- // Needs to be both down/up due to weird rendering bug on Chrome Windows
- dom.bind(editor.getDoc(), 'mousedown mouseup', function (e) {
- var rng;
-
- if (e.target == editor.getDoc().documentElement) {
- rng = selection.getRng();
- editor.getBody().focus();
-
- if (e.type == 'mousedown') {
- if (CaretContainer.isCaretContainer(rng.startContainer)) {
- return;
- }
-
- // Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret
- selection.placeCaretAt(e.clientX, e.clientY);
- } else {
- selection.setRng(rng);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (valid) {
+ if (classValue) {
+ classValue += ' ';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ classValue += className;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
- }
-
- /**
- * Backspacing in FireFox/IE from a paragraph into a horizontal rule results in a floating text node because the
- * browser just deletes the paragraph - the browser fails to merge the text node with a horizontal rule so it is
- * left there. TinyMCE sees a floating text node and wraps it in a paragraph on the key up event (ForceBlocks.js
- * addRootBlocks), meaning the action does nothing. With this code, FireFox/IE matche the behaviour of other
- * browsers.
- *
- * It also fixes a bug on Firefox where it's impossible to delete HR elements.
- */
- function removeHrOnBackspace() {
- editor.on('keydown', function (e) {
- if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {
- // Check if there is any HR elements this is faster since getRng on IE 7 & 8 is slow
- if (!editor.getBody().getElementsByTagName('hr').length) {
- return;
- }
-
- if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {
- var node = selection.getNode();
- var previousSibling = node.previousSibling;
-
- if (node.nodeName == 'HR') {
- dom.remove(node);
- e.preventDefault();
- return;
- }
-
- if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "hr") {
- dom.remove(previousSibling);
- e.preventDefault();
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-
- /**
- * Firefox 3.x has an issue where the body element won't get proper focus if you click out
- * side it's rectangle.
- */
- function focusBody() {
- // Fix for a focus bug in FF 3.x where the body element
- // wouldn't get proper focus if the user clicked on the HTML element
- if (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4
- editor.on('mousedown', function (e) {
- if (!isDefaultPrevented(e) && e.target.nodeName === "HTML") {
- var body = editor.getBody();
-
- // Blur the body it's focused but not correctly focused
- body.blur();
-
- // Refocus the body after a little while
- Delay.setEditorTimeout(editor, function () {
- body.focus();
- });
- }
- });
- }
- }
-
- /**
- * WebKit has a bug where it isn't possible to select image, hr or anchor elements
- * by clicking on them so we need to fake that.
- */
- function selectControlElements() {
- editor.on('click', function (e) {
- var target = e.target;
-
- // Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
- // WebKit can't even do simple things like selecting an image
- // Needs to be the setBaseAndExtend or it will fail to select floated images
- if (/^(IMG|HR)$/.test(target.nodeName) && dom.getContentEditableParent(target) !== "false") {
- e.preventDefault();
- editor.selection.select(target);
- editor.nodeChanged();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!classValue.length) {
+ classValue = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (target.nodeName == 'A' && dom.hasClass(target, 'mce-item-anchor')) {
- e.preventDefault();
- selection.select(target);
- }
- });
- }
-
- /**
- * Fixes a Gecko bug where the style attribute gets added to the wrong element when deleting between two block elements.
- *
- * Fixes do backspace/delete on this:
- * <p>bla[ck</p><p style="color:red">r]ed</p>
- *
- * Would become:
- * <p>bla|ed</p>
- *
- * Instead of:
- * <p style="color:red">bla|ed</p>
- */
- function removeStylesWhenDeletingAcrossBlockElements() {
- function getAttributeApplyFunction() {
- var template = dom.getAttribs(selection.getStart().cloneNode(false));
-
- return function () {
- var target = selection.getStart();
-
- if (target !== editor.getBody()) {
- dom.setAttrib(target, "style", null);
-
- each(template, function (attr) {
- target.setAttributeNode(attr.cloneNode(true));
- });
- }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.attr('class', classValue);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function isSelectionAcrossElements() {
- return !selection.isCollapsed() &&
- dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var makeMap$4 = $_52qop8kjfuw8l6v.makeMap;
+ var each$19 = $_52qop8kjfuw8l6v.each;
+ var explode$3 = $_52qop8kjfuw8l6v.explode;
+ var extend$3 = $_52qop8kjfuw8l6v.extend;
+ function DomParser (settings, schema) {
+ if (schema === void 0) {
+ schema = Schema();
+ }
+ var nodeFilters = {};
+ var attributeFilters = [];
+ var matchedNodes = {};
+ var matchedAttributes = {};
+ settings = settings || {};
+ settings.validate = 'validate' in settings ? settings.validate : true;
+ settings.root_name = settings.root_name || 'body';
+ var fixInvalidChildren = function (nodes) {
+ var ni, node, parent, parents, newParent, currentNode, tempNode, childNode, i;
+ var nonEmptyElements, whitespaceElements, nonSplitableElements, textBlockElements, specialElements, sibling, nextNode;
+ nonSplitableElements = makeMap$4('tr,td,th,tbody,thead,tfoot,table');
+ nonEmptyElements = schema.getNonEmptyElements();
+ whitespaceElements = schema.getWhiteSpaceElements();
+ textBlockElements = schema.getTextBlockElements();
+ specialElements = schema.getSpecialElements();
+ for (ni = 0; ni < nodes.length; ni++) {
+ node = nodes[ni];
+ if (!node.parent || node.fixed) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.on('keypress', function (e) {
- var applyAttributes;
-
- if (!isDefaultPrevented(e) && (e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) {
- applyAttributes = getAttributeApplyFunction();
- editor.getDoc().execCommand('delete', false, null);
- applyAttributes();
- e.preventDefault();
- return false;
- }
- });
-
- dom.bind(editor.getDoc(), 'cut', function (e) {
- var applyAttributes;
-
- if (!isDefaultPrevented(e) && isSelectionAcrossElements()) {
- applyAttributes = getAttributeApplyFunction();
-
- Delay.setEditorTimeout(editor, function () {
- applyAttributes();
- });
- }
- });
- }
-
- /**
- * Screen readers on IE needs to have the role application set on the body.
- */
- function ensureBodyHasRoleApplication() {
- document.body.setAttribute("role", "application");
- }
-
- /**
- * Backspacing into a table behaves differently depending upon browser type.
- * Therefore, disable Backspace when cursor immediately follows a table.
- */
- function disableBackspaceIntoATable() {
- editor.on('keydown', function (e) {
- if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {
- if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {
- var previousSibling = selection.getNode().previousSibling;
- if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") {
- e.preventDefault();
- return false;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (textBlockElements[node.name] && node.parent.name === 'li') {
+ sibling = node.next;
+ while (sibling) {
+ if (textBlockElements[sibling.name]) {
+ sibling.name = 'li';
+ sibling.fixed = true;
+ node.parent.insert(sibling, node.parent);
+ } else {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sibling = sibling.next;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-
- /**
- * Old IE versions can't properly render BR elements in PRE tags white in contentEditable mode. So this
- * logic adds a \n before the BR so that it will get rendered.
- */
- function addNewLinesBeforeBrInPre() {
- // IE8+ rendering mode does the right thing with BR in PRE
- if (getDocumentMode() > 7) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.unwrap(node);
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Enable display: none in area and add a specific class that hides all BR elements in PRE to
- // avoid the caret from getting stuck at the BR elements while pressing the right arrow key
- setEditorCommandState('RespectVisibilityInDesign', true);
- editor.contentStyles.push('.mceHideBrInPre pre br {display: none}');
- dom.addClass(editor.getBody(), 'mceHideBrInPre');
-
- // Adds a \n before all BR elements in PRE to get them visual
- parser.addNodeFilter('pre', function (nodes) {
- var i = nodes.length, brNodes, j, brElm, sibling;
-
- while (i--) {
- brNodes = nodes[i].getAll('br');
- j = brNodes.length;
- while (j--) {
- brElm = brNodes[j];
-
- // Add \n before BR in PRE elements on older IE:s so the new lines get rendered
- sibling = brElm.prev;
- if (sibling && sibling.type === 3 && sibling.value.charAt(sibling.value - 1) != '\n') {
- sibling.value += '\n';
- } else {
- brElm.parent.insert(new Node('#text', 3), brElm, true).value = '\n';
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parents = [node];
+ for (parent = node.parent; parent && !schema.isValidChild(parent.name, node.name) && !nonSplitableElements[parent.name]; parent = parent.parent) {
+ parents.push(parent);
+ }
+ if (parent && parents.length > 1) {
+ parents.reverse();
+ newParent = currentNode = filterNode(parents[0].clone());
+ for (i = 0; i < parents.length - 1; i++) {
+ if (schema.isValidChild(currentNode.name, parents[i].name)) {
+ tempNode = filterNode(parents[i].clone());
+ currentNode.append(tempNode);
+ } else {
+ tempNode = currentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- });
-
- // Removes any \n before BR elements in PRE since other browsers and in contentEditable=false mode they will be visible
- serializer.addNodeFilter('pre', function (nodes) {
- var i = nodes.length, brNodes, j, brElm, sibling;
-
- while (i--) {
- brNodes = nodes[i].getAll('br');
- j = brNodes.length;
- while (j--) {
- brElm = brNodes[j];
- sibling = brElm.prev;
- if (sibling && sibling.type == 3) {
- sibling.value = sibling.value.replace(/\r?\n$/, '');
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (childNode = parents[i].firstChild; childNode && childNode !== parents[i + 1];) {
+ nextNode = childNode.next;
+ tempNode.append(childNode);
+ childNode = nextNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ currentNode = tempNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-
- /**
- * Moves style width/height to attribute width/height when the user resizes an image on IE.
- */
- function removePreSerializedStylesWhenSelectingControls() {
- dom.bind(editor.getBody(), 'mouseup', function () {
- var value, node = selection.getNode();
-
- // Moved styles to attributes on IMG eements
- if (node.nodeName == 'IMG') {
- // Convert style width to width attribute
- if ((value = dom.getStyle(node, 'width'))) {
- dom.setAttrib(node, 'width', value.replace(/[^0-9%]+/g, ''));
- dom.setStyle(node, 'width', '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!isEmpty$2(schema, nonEmptyElements, whitespaceElements, newParent)) {
+ parent.insert(newParent, parents[0], true);
+ parent.insert(node, newParent);
+ } else {
+ parent.insert(node, parents[0], true);
+ }
+ parent = parents[0];
+ if (isEmpty$2(schema, nonEmptyElements, whitespaceElements, parent) || hasOnlyChild(parent, 'br')) {
+ parent.empty().remove();
+ }
+ } else if (node.parent) {
+ if (node.name === 'li') {
+ sibling = node.prev;
+ if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {
+ sibling.append(node);
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Convert style height to height attribute
- if ((value = dom.getStyle(node, 'height'))) {
- dom.setAttrib(node, 'height', value.replace(/[^0-9%]+/g, ''));
- dom.setStyle(node, 'height', '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sibling = node.next;
+ if (sibling && (sibling.name === 'ul' || sibling.name === 'ul')) {
+ sibling.insert(node, sibling.firstChild, true);
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.wrap(filterNode(new Node$2('ul', 1)));
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-
- /**
- * Removes a blockquote when backspace is pressed at the beginning of it.
- *
- * For example:
- * <blockquote><p>|x</p></blockquote>
- *
- * Becomes:
- * <p>|x</p>
- */
- function removeBlockQuoteOnBackSpace() {
- // Add block quote deletion handler
- editor.on('keydown', function (e) {
- var rng, container, offset, root, parent;
-
- if (isDefaultPrevented(e) || e.keyCode != VK.BACKSPACE) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) {
+ node.wrap(filterNode(new Node$2('div', 1)));
+ } else {
+ if (specialElements[node.name]) {
+ node.empty().remove();
+ } else {
+ node.unwrap();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- rng = selection.getRng();
- container = rng.startContainer;
- offset = rng.startOffset;
- root = dom.getRoot();
- parent = container;
-
- if (!rng.collapsed || offset !== 0) {
- return;
- }
-
- while (parent && parent.parentNode && parent.parentNode.firstChild == parent && parent.parentNode != root) {
- parent = parent.parentNode;
- }
-
- // Is the cursor at the beginning of a blockquote?
- if (parent.tagName === 'BLOCKQUOTE') {
- // Remove the blockquote
- editor.formatter.toggle('blockquote', null, parent);
-
- // Move the caret to the beginning of container
- rng = dom.createRng();
- rng.setStart(container, 0);
- rng.setEnd(container, 0);
- selection.setRng(rng);
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Sets various Gecko editing options on mouse down and before a execCommand to disable inline table editing that is broken etc.
- */
- function setGeckoEditingOptions() {
- function setOpts() {
- refreshContentEditable();
-
- setEditorCommandState("StyleWithCSS", false);
- setEditorCommandState("enableInlineTableEditing", false);
-
- if (!settings.object_resizing) {
- setEditorCommandState("enableObjectResizing", false);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var filterNode = function (node) {
+ var i, name, list;
+ if (name in nodeFilters) {
+ list = matchedNodes[name];
+ if (list) {
+ list.push(node);
+ } else {
+ matchedNodes[name] = [node];
+ }
+ }
+ i = attributeFilters.length;
+ while (i--) {
+ name = attributeFilters[i].name;
+ if (name in node.attributes.map) {
+ list = matchedAttributes[name];
+ if (list) {
+ list.push(node);
+ } else {
+ matchedAttributes[name] = [node];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!settings.readonly) {
- editor.on('BeforeExecCommand MouseDown', setOpts);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Fixes a gecko link bug, when a link is placed at the end of block elements there is
- * no way to move the caret behind the link. This fix adds a bogus br element after the link.
- *
- * For example this:
- * <p><b><a href="#">x</a></b></p>
- *
- * Becomes this:
- * <p><b><a href="#">x</a></b><br></p>
- */
- function addBrAfterLastLinks() {
- function fixLinks() {
- each(dom.select('a'), function (node) {
- var parentNode = node.parentNode, root = dom.getRoot();
-
- if (parentNode.lastChild === node) {
- while (parentNode && !dom.isBlock(parentNode)) {
- if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) {
- return;
- }
-
- parentNode = parentNode.parentNode;
- }
-
- dom.add(parentNode, 'br', { 'data-mce-bogus': 1 });
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return node;
+ };
+ var addNodeFilter = function (name, callback) {
+ each$19(explode$3(name), function (name) {
+ var list = nodeFilters[name];
+ if (!list) {
+ nodeFilters[name] = list = [];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.on('SetContent ExecCommand', function (e) {
- if (e.type == "setcontent" || e.command === 'mceInsertLink') {
- fixLinks();
- }
- });
- }
-
- /**
- * WebKit will produce DIV elements here and there by default. But since TinyMCE uses paragraphs by
- * default we want to change that behavior.
- */
- function setDefaultBlockType() {
- if (settings.forced_root_block) {
- editor.on('init', function () {
- setEditorCommandState('DefaultParagraphSeparator', settings.forced_root_block);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ list.push(callback);
+ });
+ };
+ var getNodeFilters = function () {
+ var out = [];
+ for (var name_1 in nodeFilters) {
+ if (nodeFilters.hasOwnProperty(name_1)) {
+ out.push({
+ name: name_1,
+ callbacks: nodeFilters[name_1]
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Deletes the selected image on IE instead of navigating to previous page.
- */
- function deleteControlItemOnBackSpace() {
- editor.on('keydown', function (e) {
- var rng;
-
- if (!isDefaultPrevented(e) && e.keyCode == BACKSPACE) {
- rng = editor.getDoc().selection.createRange();
- if (rng && rng.item) {
- e.preventDefault();
- editor.undoManager.beforeChange();
- dom.remove(rng.item(0));
- editor.undoManager.add();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return out;
+ };
+ var addAttributeFilter = function (name, callback) {
+ each$19(explode$3(name), function (name) {
+ var i;
+ for (i = 0; i < attributeFilters.length; i++) {
+ if (attributeFilters[i].name === name) {
+ attributeFilters[i].callbacks.push(callback);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ attributeFilters.push({
+ name: name,
+ callbacks: [callback]
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- /**
- * IE10 doesn't properly render block elements with the right height until you add contents to them.
- * This fixes that by adding a padding-right to all empty text block elements.
- * See: https://connect.microsoft.com/IE/feedback/details/743881
- */
- function renderEmptyBlocksFix() {
- var emptyBlocksCSS;
-
- // IE10+
- if (getDocumentMode() >= 10) {
- emptyBlocksCSS = '';
- each('p div h1 h2 h3 h4 h5 h6'.split(' '), function (name, i) {
- emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty';
- });
-
- editor.contentStyles.push(emptyBlocksCSS + '{padding-right: 1px !important}');
- }
- }
-
- /**
- * Old IE versions can't retain contents within noscript elements so this logic will store the contents
- * as a attribute and the insert that value as it's raw text when the DOM is serialized.
- */
- function keepNoScriptContents() {
- if (getDocumentMode() < 9) {
- parser.addNodeFilter('noscript', function (nodes) {
- var i = nodes.length, node, textNode;
-
- while (i--) {
- node = nodes[i];
- textNode = node.firstChild;
-
- if (textNode) {
- node.attr('data-mce-innertext', textNode.value);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var getAttributeFilters = function () {
+ return [].concat(attributeFilters);
+ };
+ var parse = function (html, args) {
+ var parser, nodes, i, l, fi, fl, list, name;
+ var blockElements;
+ var invalidChildren = [];
+ var isInWhiteSpacePreservedElement;
+ var node;
+ args = args || {};
+ matchedNodes = {};
+ matchedAttributes = {};
+ blockElements = extend$3(makeMap$4('script,style,head,html,body,title,meta,param'), schema.getBlockElements());
+ var nonEmptyElements = schema.getNonEmptyElements();
+ var children = schema.children;
+ var validate = settings.validate;
+ var rootBlockName = 'forced_root_block' in args ? args.forced_root_block : settings.forced_root_block;
+ var whiteSpaceElements = schema.getWhiteSpaceElements();
+ var startWhiteSpaceRegExp = /^[ \t\r\n]+/;
+ var endWhiteSpaceRegExp = /[ \t\r\n]+$/;
+ var allWhiteSpaceRegExp = /[ \t\r\n]+/g;
+ var isAllWhiteSpaceRegExp = /^[ \t\r\n]+$/;
+ var addRootBlocks = function () {
+ var node = rootNode.firstChild, next, rootBlockNode;
+ var trim = function (rootBlockNode) {
+ if (rootBlockNode) {
+ node = rootBlockNode.firstChild;
+ if (node && node.type === 3) {
+ node.value = node.value.replace(startWhiteSpaceRegExp, '');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- serializer.addNodeFilter('noscript', function (nodes) {
- var i = nodes.length, node, textNode, value;
-
- while (i--) {
- node = nodes[i];
- textNode = nodes[i].firstChild;
-
- if (textNode) {
- textNode.value = Entities.decode(textNode.value);
- } else {
- // Old IE can't retain noscript value so an attribute is used to store it
- value = node.attributes.map['data-mce-innertext'];
- if (value) {
- node.attr('data-mce-innertext', null);
- textNode = new Node('#text', 3);
- textNode.value = value;
- textNode.raw = true;
- node.append(textNode);
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = rootBlockNode.lastChild;
+ if (node && node.type === 3) {
+ node.value = node.value.replace(endWhiteSpaceRegExp, '');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
- }
-
- /**
- * IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode.
- */
- function fixCaretSelectionOfDocumentElementOnIe() {
- var doc = dom.doc, body = doc.body, started, startRng, htmlElm;
-
- // Return range from point or null if it failed
- function rngFromPoint(x, y) {
- var rng = body.createTextRange();
-
- try {
- rng.moveToPoint(x, y);
- } catch (ex) {
- // IE sometimes throws and exception, so lets just ignore it
- rng = null;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return rng;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (!schema.isValidChild(rootNode.name, rootBlockName.toLowerCase())) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Fires while the selection is changing
- function selectionChange(e) {
- var pointRng;
-
- // Check if the button is down or not
- if (e.button) {
- // Create range from mouse position
- pointRng = rngFromPoint(e.x, e.y);
-
- if (pointRng) {
- // Check if pointRange is before/after selection then change the endPoint
- if (pointRng.compareEndPoints('StartToStart', startRng) > 0) {
- pointRng.setEndPoint('StartToStart', startRng);
- } else {
- pointRng.setEndPoint('EndToEnd', startRng);
- }
-
- pointRng.select();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (node) {
+ next = node.next;
+ if (node.type === 3 || node.type === 1 && node.name !== 'p' && !blockElements[node.name] && !node.attr('data-mce-type')) {
+ if (!rootBlockNode) {
+ rootBlockNode = createNode(rootBlockName, 1);
+ rootBlockNode.attr(settings.forced_root_block_attrs);
+ rootNode.insert(rootBlockNode, node);
+ rootBlockNode.append(node);
+ } else {
+ rootBlockNode.append(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- endSelection();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ trim(rootBlockNode);
+ rootBlockNode = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = next;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Removes listeners
- function endSelection() {
- var rng = doc.selection.createRange();
-
- // If the range is collapsed then use the last start range
- if (startRng && !rng.item && rng.compareEndPoints('StartToEnd', rng) === 0) {
- startRng.select();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ trim(rootBlockNode);
+ };
+ var createNode = function (name, type) {
+ var node = new Node$2(name, type);
+ var list;
+ if (name in nodeFilters) {
+ list = matchedNodes[name];
+ if (list) {
+ list.push(node);
+ } else {
+ matchedNodes[name] = [node];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- dom.unbind(doc, 'mouseup', endSelection);
- dom.unbind(doc, 'mousemove', selectionChange);
- startRng = started = 0;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Make HTML element unselectable since we are going to handle selection by hand
- doc.documentElement.unselectable = true;
-
- // Detect when user selects outside BODY
- dom.bind(doc, 'mousedown contextmenu', function (e) {
- if (e.target.nodeName === 'HTML') {
- if (started) {
- endSelection();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return node;
+ };
+ var removeWhitespaceBefore = function (node) {
+ var textNode, textNodeNext, textVal, sibling;
+ var blockElements = schema.getBlockElements();
+ for (textNode = node.prev; textNode && textNode.type === 3;) {
+ textVal = textNode.value.replace(endWhiteSpaceRegExp, '');
+ if (textVal.length > 0) {
+ textNode.value = textVal;
+ return;
+ }
+ textNodeNext = textNode.next;
+ if (textNodeNext) {
+ if (textNodeNext.type === 3 && textNodeNext.value.length) {
+ textNode = textNode.prev;
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Detect vertical scrollbar, since IE will fire a mousedown on the scrollbar and have target set as HTML
- htmlElm = doc.documentElement;
- if (htmlElm.scrollHeight > htmlElm.clientHeight) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!blockElements[textNodeNext.name] && textNodeNext.name !== 'script' && textNodeNext.name !== 'style') {
+ textNode = textNode.prev;
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- started = 1;
- // Setup start position
- startRng = rngFromPoint(e.x, e.y);
- if (startRng) {
- // Listen for selection change events
- dom.bind(doc, 'mouseup', endSelection);
- dom.bind(doc, 'mousemove', selectionChange);
-
- dom.getRoot().focus();
- startRng.select();
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-
- /**
- * Fixes selection issues where the caret can be placed between two inline elements like <b>a</b>|<b>b</b>
- * this fix will lean the caret right into the closest inline element.
- */
- function normalizeSelection() {
- // Normalize selection for example <b>a</b><i>|a</i> becomes <b>a|</b><i>a</i> except for Ctrl+A since it selects everything
- editor.on('keyup focusin mouseup', function (e) {
- if (e.keyCode != 65 || !VK.metaKeyPressed(e)) {
- // We can't normalize on non collapsed ranges on keyboard events since that would cause
- // issues with moving the selection over empty paragraphs. See #TINY-1130
- if (e.type !== 'keyup' || editor.selection.isCollapsed()) {
- selection.normalize();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sibling = textNode.prev;
+ textNode.remove();
+ textNode = sibling;
+ }
+ };
+ var cloneAndExcludeBlocks = function (input) {
+ var name;
+ var output = {};
+ for (name in input) {
+ if (name !== 'li' && name !== 'p') {
+ output[name] = input[name];
+ }
+ }
+ return output;
+ };
+ parser = SaxParser$1({
+ validate: validate,
+ allow_script_urls: settings.allow_script_urls,
+ allow_conditional_comments: settings.allow_conditional_comments,
+ self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()),
+ cdata: function (text) {
+ node.append(createNode('#cdata', 4)).value = text;
+ },
+ text: function (text, raw) {
+ var textNode;
+ if (!isInWhiteSpacePreservedElement) {
+ text = text.replace(allWhiteSpaceRegExp, ' ');
+ if (isLineBreakNode(node.lastChild, blockElements)) {
+ text = text.replace(startWhiteSpaceRegExp, '');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }, true);
- }
-
- /**
- * Forces Gecko to render a broken image icon if it fails to load an image.
- */
- function showBrokenImageIcon() {
- editor.contentStyles.push(
- 'img:-moz-broken {' +
- '-moz-force-broken-image-icon:1;' +
- 'min-width:24px;' +
- 'min-height:24px' +
- '}'
- );
- }
-
- /**
- * iOS has a bug where it's impossible to type if the document has a touchstart event
- * bound and the user touches the document while having the on screen keyboard visible.
- *
- * The touch event moves the focus to the parent document while having the caret inside the iframe
- * this fix moves the focus back into the iframe document.
- */
- function restoreFocusOnKeyDown() {
- if (!editor.inline) {
- editor.on('keydown', function () {
- if (document.activeElement == document.body) {
- editor.getWin().focus();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (text.length !== 0) {
+ textNode = createNode('#text', 3);
+ textNode.raw = !!raw;
+ node.append(textNode).value = text;
+ }
+ },
+ comment: function (text) {
+ node.append(createNode('#comment', 8)).value = text;
+ },
+ pi: function (name, text) {
+ node.append(createNode(name, 7)).value = text;
+ removeWhitespaceBefore(node);
+ },
+ doctype: function (text) {
+ var newNode;
+ newNode = node.append(createNode('#doctype', 10));
+ newNode.value = text;
+ removeWhitespaceBefore(node);
+ },
+ start: function (name, attrs, empty) {
+ var newNode, attrFiltersLen, elementRule, attrName, parent;
+ elementRule = validate ? schema.getElementRule(name) : {};
+ if (elementRule) {
+ newNode = createNode(elementRule.outputName || name, 1);
+ newNode.attributes = attrs;
+ newNode.shortEnded = empty;
+ node.append(newNode);
+ parent = children[node.name];
+ if (parent && children[newNode.name] && !parent[newNode.name]) {
+ invalidChildren.push(newNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
- }
-
- /**
- * IE 11 has an annoying issue where you can't move focus into the editor
- * by clicking on the white area HTML element. We used to be able to to fix this with
- * the fixCaretSelectionOfDocumentElementOnIe fix. But since M$ removed the selection
- * object it's not possible anymore. So we need to hack in a ungly CSS to force the
- * body to be at least 150px. If the user clicks the HTML element out side this 150px region
- * we simply move the focus into the first paragraph. Not ideal since you loose the
- * positioning of the caret but goot enough for most cases.
- */
- function bodyHeight() {
- if (!editor.inline) {
- editor.contentStyles.push('body {min-height: 150px}');
- editor.on('click', function (e) {
- var rng;
-
- if (e.target.nodeName == 'HTML') {
- // Edge seems to only need focus if we set the range
- // the caret will become invisible and moved out of the iframe!!
- if (Env.ie > 11) {
- editor.getBody().focus();
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ attrFiltersLen = attributeFilters.length;
+ while (attrFiltersLen--) {
+ attrName = attributeFilters[attrFiltersLen].name;
+ if (attrName in attrs.map) {
+ list = matchedAttributes[attrName];
+ if (list) {
+ list.push(newNode);
+ } else {
+ matchedAttributes[attrName] = [newNode];
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Need to store away non collapsed ranges since the focus call will mess that up see #7382
- rng = editor.selection.getRng();
- editor.getBody().focus();
- editor.selection.setRng(rng);
- editor.selection.normalize();
- editor.nodeChanged();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
- }
-
- /**
- * Firefox on Mac OS will move the browser back to the previous page if you press CMD+Left arrow.
- * You might then loose all your work so we need to block that behavior and replace it with our own.
- */
- function blockCmdArrowNavigation() {
- if (Env.mac) {
- editor.on('keydown', function (e) {
- if (VK.metaKeyPressed(e) && !e.shiftKey && (e.keyCode == 37 || e.keyCode == 39)) {
- e.preventDefault();
- editor.selection.getSel().modify('move', e.keyCode == 37 ? 'backward' : 'forward', 'lineboundary');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (blockElements[name]) {
+ removeWhitespaceBefore(newNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
- }
-
- /**
- * Disables the autolinking in IE 9+ this is then re-enabled by the autolink plugin.
- */
- function disableAutoUrlDetect() {
- setEditorCommandState("AutoUrlDetect", false);
- }
-
- /**
- * iOS 7.1 introduced two new bugs:
- * 1) It's possible to open links within a contentEditable area by clicking on them.
- * 2) If you hold down the finger it will display the link/image touch callout menu.
- */
- function tapLinksAndImages() {
- editor.on('click', function (e) {
- var elm = e.target;
-
- do {
- if (elm.tagName === 'A') {
- e.preventDefault();
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!empty) {
+ node = newNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } while ((elm = elm.parentNode));
- });
-
- editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}');
- }
-
- /**
- * iOS Safari and possible other browsers have a bug where it won't fire
- * a click event when a contentEditable is focused. This function fakes click events
- * by using touchstart/touchend and measuring the time and distance travelled.
- */
- /*
- function touchClickEvent() {
- editor.on('touchstart', function(e) {
- var elm, time, startTouch, changedTouches;
-
- elm = e.target;
- time = new Date().getTime();
- changedTouches = e.changedTouches;
-
- if (!changedTouches || changedTouches.length > 1) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {
+ isInWhiteSpacePreservedElement = true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- startTouch = changedTouches[0];
-
- editor.once('touchend', function(e) {
- var endTouch = e.changedTouches[0], args;
-
- if (new Date().getTime() - time > 500) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ end: function (name) {
+ var textNode, elementRule, text, sibling, tempNode;
+ elementRule = validate ? schema.getElementRule(name) : {};
+ if (elementRule) {
+ if (blockElements[name]) {
+ if (!isInWhiteSpacePreservedElement) {
+ textNode = node.firstChild;
+ if (textNode && textNode.type === 3) {
+ text = textNode.value.replace(startWhiteSpaceRegExp, '');
+ if (text.length > 0) {
+ textNode.value = text;
+ textNode = textNode.next;
+ } else {
+ sibling = textNode.next;
+ textNode.remove();
+ textNode = sibling;
+ while (textNode && textNode.type === 3) {
+ text = textNode.value;
+ sibling = textNode.next;
+ if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {
+ textNode.remove();
+ textNode = sibling;
+ }
+ textNode = sibling;
+ }
+ }
+ }
+ textNode = node.lastChild;
+ if (textNode && textNode.type === 3) {
+ text = textNode.value.replace(endWhiteSpaceRegExp, '');
+ if (text.length > 0) {
+ textNode.value = text;
+ textNode = textNode.prev;
+ } else {
+ sibling = textNode.prev;
+ textNode.remove();
+ textNode = sibling;
+ while (textNode && textNode.type === 3) {
+ text = textNode.value;
+ sibling = textNode.prev;
+ if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {
+ textNode.remove();
+ textNode = sibling;
+ }
+ textNode = sibling;
+ }
+ }
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (Math.abs(startTouch.clientX - endTouch.clientX) > 5) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {
+ isInWhiteSpacePreservedElement = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (Math.abs(startTouch.clientY - endTouch.clientY) > 5) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (elementRule.removeEmpty && isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, node)) {
+ if (!node.attributes.map.name && !node.attr('id')) {
+ tempNode = node.parent;
+ if (blockElements[node.name]) {
+ node.empty().remove();
+ } else {
+ node.unwrap();
+ }
+ node = tempNode;
+ return;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- args = {
- target: elm
- };
-
- each('pageX pageY clientX clientY screenX screenY'.split(' '), function(key) {
- args[key] = endTouch[key];
- });
-
- args = editor.fire('click', args);
-
- if (!args.isDefaultPrevented()) {
- // iOS WebKit can't place the caret properly once
- // you bind touch events so we need to do this manually
- // TODO: Expand to the closest word? Touble tap still works.
- editor.selection.placeCaretAt(endTouch.clientX, endTouch.clientY);
- editor.nodeChanged();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (elementRule.paddEmpty && (isPaddedWithNbsp(node) || isEmpty$2(schema, nonEmptyElements, whiteSpaceElements, node))) {
+ paddEmptyNode(settings, args, blockElements, node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- });
- }
- */
-
- /**
- * WebKit has a bug where it will allow forms to be submitted if they are inside a contentEditable element.
- * For example this: <form><button></form>
- */
- function blockFormSubmitInsideEditor() {
- editor.on('init', function () {
- editor.dom.bind(editor.getBody(), 'submit', function (e) {
- e.preventDefault();
- });
- });
- }
-
- /**
- * Sometimes WebKit/Blink generates BR elements with the Apple-interchange-newline class.
- *
- * Scenario:
- * 1) Create a table 2x2.
- * 2) Select and copy cells A2-B2.
- * 3) Paste and it will add BR element to table cell.
- */
- function removeAppleInterchangeBrs() {
- parser.addNodeFilter('br', function (nodes) {
- var i = nodes.length;
-
- while (i--) {
- if (nodes[i].attr('class') == 'Apple-interchange-newline') {
- nodes[i].remove();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parent;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-
- /**
- * IE cannot set custom contentType's on drag events, and also does not properly drag/drop between
- * editors. This uses a special data:text/mce-internal URL to pass data when drag/drop between editors.
- */
- function ieInternalDragAndDrop() {
- editor.on('dragstart', function (e) {
- setMceInternalContent(e);
- });
-
- editor.on('drop', function (e) {
- if (!isDefaultPrevented(e)) {
- var internalContent = getMceInternalContent(e);
-
- if (internalContent && internalContent.id != editor.id) {
- e.preventDefault();
-
- var rng = RangeUtils.getCaretRangeFromPoint(e.x, e.y, editor.getDoc());
- selection.setRng(rng);
- insertClipboardContents(internalContent.html, true);
- }
- }
- });
- }
-
- function refreshContentEditable() {
- // No-op since Mozilla seems to have fixed the caret repaint issues
- }
-
- function isHidden() {
- var sel;
-
- if (!isGecko || editor.removed) {
- return 0;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Weird, wheres that cursor selection?
- sel = editor.selection.getSel();
- return (!sel || !sel.rangeCount || sel.rangeCount === 0);
- }
-
- // All browsers
- removeBlockQuoteOnBackSpace();
- emptyEditorWhenDeleting();
-
- // Windows phone will return a range like [body, 0] on mousedown so
- // it will always normalize to the wrong location
- if (!Env.windowsPhone) {
- normalizeSelection();
- }
-
- // WebKit
- if (isWebKit) {
- inputMethodFocus();
- selectControlElements();
- setDefaultBlockType();
- blockFormSubmitInsideEditor();
- disableBackspaceIntoATable();
- removeAppleInterchangeBrs();
-
- //touchClickEvent();
-
- // iOS
- if (Env.iOS) {
- restoreFocusOnKeyDown();
- bodyHeight();
- tapLinksAndImages();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, schema);
+ var rootNode = node = new Node$2(args.context || settings.root_name, 11);
+ parser.parse(html);
+ if (validate && invalidChildren.length) {
+ if (!args.context) {
+ fixInvalidChildren(invalidChildren);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- selectAll();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ args.invalid = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // IE
- if (isIE && Env.ie < 11) {
- removeHrOnBackspace();
- ensureBodyHasRoleApplication();
- addNewLinesBeforeBrInPre();
- removePreSerializedStylesWhenSelectingControls();
- deleteControlItemOnBackSpace();
- renderEmptyBlocksFix();
- keepNoScriptContents();
- fixCaretSelectionOfDocumentElementOnIe();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (rootBlockName && (rootNode.name === 'body' || args.isRootContent)) {
+ addRootBlocks();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (Env.ie >= 11) {
- bodyHeight();
- disableBackspaceIntoATable();
- }
-
- if (Env.ie) {
- selectAll();
- disableAutoUrlDetect();
- ieInternalDragAndDrop();
- }
-
- // Gecko
- if (isGecko) {
- removeHrOnBackspace();
- focusBody();
- removeStylesWhenDeletingAcrossBlockElements();
- setGeckoEditingOptions();
- addBrAfterLastLinks();
- showBrokenImageIcon();
- blockCmdArrowNavigation();
- disableBackspaceIntoATable();
- }
-
- return {
- refreshContentEditable: refreshContentEditable,
- isHidden: isHidden
- };
- };
- }
-);
-
-/**
- * InitContentBody.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.init.InitContentBody',
- [
- 'ephox.sugar.api.dom.Insert',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.properties.Attr',
- 'global!document',
- 'global!window',
- 'tinymce.core.api.Formatter',
- 'tinymce.core.caret.CaretContainerInput',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.dom.Selection',
- 'tinymce.core.dom.Serializer',
- 'tinymce.core.EditorUpload',
- 'tinymce.core.ErrorReporter',
- 'tinymce.core.ForceBlocks',
- 'tinymce.core.html.DomParser',
- 'tinymce.core.html.Node',
- 'tinymce.core.html.Schema',
- 'tinymce.core.keyboard.KeyboardOverrides',
- 'tinymce.core.NodeChange',
- 'tinymce.core.SelectionOverrides',
- 'tinymce.core.UndoManager',
- 'tinymce.core.util.Delay',
- 'tinymce.core.util.Quirks',
- 'tinymce.core.util.Tools'
- ],
- function (
- Insert, Element, Attr, document, window, Formatter, CaretContainerInput, DOMUtils, Selection, Serializer, EditorUpload, ErrorReporter, ForceBlocks, DomParser,
- Node, Schema, KeyboardOverrides, NodeChange, SelectionOverrides, UndoManager, Delay, Quirks, Tools
- ) {
- var DOM = DOMUtils.DOM;
-
- var appendStyle = function (editor, text) {
- var head = Element.fromDom(editor.getDoc().head);
- var tag = Element.fromTag('style');
- Attr.set(tag, 'type', 'text/css');
- Insert.append(tag, Element.fromText(text));
- Insert.append(head, tag);
- };
-
- var createParser = function (editor) {
- var parser = new DomParser(editor.settings, editor.schema);
-
- // Convert src and href into data-mce-src, data-mce-href and data-mce-style
- parser.addAttributeFilter('src,href,style,tabindex', function (nodes, name) {
- var i = nodes.length, node, dom = editor.dom, value, internalName;
-
- while (i--) {
- node = nodes[i];
- value = node.attr(name);
- internalName = 'data-mce-' + name;
-
- // Add internal attribute if we need to we don't on a refresh of the document
- if (!node.attributes.map[internalName]) {
- // Don't duplicate these since they won't get modified by any browser
- if (value.indexOf('data:') === 0 || value.indexOf('blob:') === 0) {
- continue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!args.invalid) {
+ for (name in matchedNodes) {
+ list = nodeFilters[name];
+ nodes = matchedNodes[name];
+ fi = nodes.length;
+ while (fi--) {
+ if (!nodes[fi].parent) {
+ nodes.splice(fi, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (name === "style") {
- value = dom.serializeStyle(dom.parseStyle(value), node.name);
-
- if (!value.length) {
- value = null;
- }
-
- node.attr(internalName, value);
- node.attr(name, value);
- } else if (name === "tabindex") {
- node.attr(internalName, value);
- node.attr(name, null);
- } else {
- node.attr(internalName, editor.convertURL(value, name, node.name));
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- });
-
- // Keep scripts from executing
- parser.addNodeFilter('script', function (nodes) {
- var i = nodes.length, node, type;
-
- while (i--) {
- node = nodes[i];
- type = node.attr('type') || 'no/type';
- if (type.indexOf('mce-') !== 0) {
- node.attr('type', 'mce-' + type);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (i = 0, l = list.length; i < l; i++) {
+ list[i](nodes, name, args);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- parser.addNodeFilter('#cdata', function (nodes) {
- var i = nodes.length, node;
-
- while (i--) {
- node = nodes[i];
- node.type = 8;
- node.name = '#comment';
- node.value = '[CDATA[' + node.value + ']]';
- }
- });
-
- parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function (nodes) {
- var i = nodes.length, node, nonEmptyElements = editor.schema.getNonEmptyElements();
-
- while (i--) {
- node = nodes[i];
-
- if (node.isEmpty(nonEmptyElements) && node.getAll('br').length === 0) {
- node.append(new Node('br', 1)).shortEnded = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (i = 0, l = attributeFilters.length; i < l; i++) {
+ list = attributeFilters[i];
+ if (list.name in matchedAttributes) {
+ nodes = matchedAttributes[list.name];
+ fi = nodes.length;
+ while (fi--) {
+ if (!nodes[fi].parent) {
+ nodes.splice(fi, 1);
+ }
+ }
+ for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) {
+ list.callbacks[fi](nodes, list.name, args);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- return parser;
- };
-
- var autoFocus = function (editor) {
- if (editor.settings.auto_focus) {
- Delay.setEditorTimeout(editor, function () {
- var focusEditor;
-
- if (editor.settings.auto_focus === true) {
- focusEditor = editor;
- } else {
- focusEditor = editor.editorManager.get(editor.settings.auto_focus);
- }
-
- if (!focusEditor.destroyed) {
- focusEditor.focus();
- }
- }, 100);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return rootNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var initEditor = function (editor) {
- editor.bindPendingEventDelegates();
- editor.initialized = true;
- editor.fire('init');
- editor.focus(true);
- editor.nodeChanged({ initial: true });
- editor.execCallback('init_instance_callback', editor);
- autoFocus(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var exports = {
+ schema: schema,
+ addAttributeFilter: addAttributeFilter,
+ getAttributeFilters: getAttributeFilters,
+ addNodeFilter: addNodeFilter,
+ getNodeFilters: getNodeFilters,
+ filterNode: filterNode,
+ parse: parse
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ register$2(exports, settings);
+ $_5qetf467jfuw8mbf.register(exports, settings);
+ return exports;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getStyleSheetLoader = function (editor) {
- return editor.inline ? DOM.styleSheetLoader : editor.dom.styleSheetLoader;
- };
-
- var initContentBody = function (editor, skipWrite) {
- var settings = editor.settings, targetElm = editor.getElement(), doc = editor.getDoc(), body, contentCssText;
-
- // Restore visibility on target element
- if (!settings.inline) {
- editor.getElement().style.visibility = editor.orgVisibility;
- }
-
- // Setup iframe body
- if (!skipWrite && !settings.content_editable) {
- doc.open();
- doc.write(editor.iframeHTML);
- doc.close();
- }
-
- if (settings.content_editable) {
- editor.on('remove', function () {
- var bodyEl = this.getBody();
-
- DOM.removeClass(bodyEl, 'mce-content-body');
- DOM.removeClass(bodyEl, 'mce-edit-focus');
- DOM.setAttrib(bodyEl, 'contentEditable', null);
- });
-
- DOM.addClass(targetElm, 'mce-content-body');
- editor.contentDocument = doc = settings.content_document || document;
- editor.contentWindow = settings.content_window || window;
- editor.bodyElement = targetElm;
-
- // Prevent leak in IE
- settings.content_document = settings.content_window = null;
-
- // TODO: Fix this
- settings.root_name = targetElm.nodeName.toLowerCase();
- }
-
- // It will not steal focus while setting contentEditable
- body = editor.getBody();
- body.disabled = true;
- editor.readonly = settings.readonly;
-
- if (!editor.readonly) {
- if (editor.inline && DOM.getStyle(body, 'position', true) === 'static') {
- body.style.position = 'relative';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var addTempAttr = function (htmlParser, tempAttrs, name) {
+ if ($_52qop8kjfuw8l6v.inArray(tempAttrs, name) === -1) {
+ htmlParser.addAttributeFilter(name, function (nodes, name) {
+ var i = nodes.length;
+ while (i--) {
+ nodes[i].attr(name, null);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- body.contentEditable = editor.getParam('content_editable_state', true);
- }
-
- body.disabled = false;
-
- editor.editorUpload = new EditorUpload(editor);
- editor.schema = new Schema(settings);
- editor.dom = new DOMUtils(doc, {
- keep_values: true,
- url_converter: editor.convertURL,
- url_converter_scope: editor,
- hex_colors: settings.force_hex_style_colors,
- class_filter: settings.class_filter,
- update_styles: true,
- root_element: editor.inline ? editor.getBody() : null,
- collect: settings.content_editable,
- schema: editor.schema,
- onSetAttrib: function (e) {
- editor.fire('SetAttrib', e);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.parser = createParser(editor);
- editor.serializer = new Serializer(settings, editor);
- editor.selection = new Selection(editor.dom, editor.getWin(), editor.serializer, editor);
- editor.formatter = new Formatter(editor);
- editor.undoManager = new UndoManager(editor);
- editor._nodeChangeDispatcher = new NodeChange(editor);
- editor._selectionOverrides = new SelectionOverrides(editor);
-
- CaretContainerInput.setup(editor);
- KeyboardOverrides.setup(editor);
- ForceBlocks.setup(editor);
-
- editor.fire('PreInit');
-
- if (!settings.browser_spellcheck && !settings.gecko_spellcheck) {
- doc.body.spellcheck = false; // Gecko
- DOM.setAttrib(body, "spellcheck", "false");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ tempAttrs.push(name);
+ }
+ };
+ var postProcess$1 = function (editor, args, content) {
+ if (!args.no_events && editor) {
+ var outArgs = $_47gnpy63jfuw8mad.firePostProcess(editor, $_dt8zuf62jfuw8mab.merge(args, { content: content }));
+ return outArgs.content;
+ } else {
+ return content;
+ }
+ };
+ var getHtmlFromNode = function (dom, node, args) {
+ var html = $_dpfg1321jfuw8lhn.trim(args.getInner ? node.innerHTML : dom.getOuterHTML(node));
+ return args.selection ? html : $_52qop8kjfuw8l6v.trim(html);
+ };
+ var parseHtml = function (htmlParser, dom, html, args) {
+ var parserArgs = args.selection ? $_dt8zuf62jfuw8mab.merge({ forced_root_block: false }, args) : args;
+ var rootNode = htmlParser.parse(html, parserArgs);
+ $_fdsvd664jfuw8maf.trimTrailingBr(rootNode);
+ return rootNode;
+ };
+ var serializeNode = function (settings, schema, node) {
+ var htmlSerializer = HtmlSerializer(settings, schema);
+ return htmlSerializer.serialize(node);
+ };
+ var toHtml = function (editor, settings, schema, rootNode, args) {
+ var content = serializeNode(settings, schema, rootNode);
+ return postProcess$1(editor, args, content);
+ };
+ function DomSerializer (settings, editor) {
+ var dom, schema, htmlParser;
+ var tempAttrs = ['data-mce-selected'];
+ dom = editor && editor.dom ? editor.dom : DOMUtils$1.DOM;
+ schema = editor && editor.schema ? editor.schema : Schema(settings);
+ settings.entity_encoding = settings.entity_encoding || 'named';
+ settings.remove_trailing_brs = 'remove_trailing_brs' in settings ? settings.remove_trailing_brs : true;
+ htmlParser = DomParser(settings, schema);
+ $_fdsvd664jfuw8maf.register(htmlParser, settings, dom);
+ var serialize = function (node, parserArgs) {
+ var args = $_dt8zuf62jfuw8mab.merge({ format: 'html' }, parserArgs ? parserArgs : {});
+ var targetNode = $_8z5s265jfuw8mal.process(editor, node, args);
+ var html = getHtmlFromNode(dom, targetNode, args);
+ var rootNode = parseHtml(htmlParser, dom, html, args);
+ return args.format === 'tree' ? rootNode : toHtml(editor, settings, schema, rootNode, args);
+ };
+ return {
+ schema: schema,
+ addNodeFilter: htmlParser.addNodeFilter,
+ addAttributeFilter: htmlParser.addAttributeFilter,
+ serialize: serialize,
+ addRules: function (rules) {
+ schema.addValidElements(rules);
+ },
+ setRules: function (rules) {
+ schema.setValidElements(rules);
+ },
+ addTempAttr: $_68e81l6jfuw8kyc.curry(addTempAttr, htmlParser, tempAttrs),
+ getTempAttrs: function () {
+ return tempAttrs;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.quirks = new Quirks(editor);
- editor.fire('PostRender');
-
- if (settings.directionality) {
- body.dir = settings.directionality;
- }
-
- if (settings.nowrap) {
- body.style.whiteSpace = "nowrap";
- }
-
- if (settings.protect) {
- editor.on('BeforeSetContent', function (e) {
- Tools.each(settings.protect, function (pattern) {
- e.content = e.content.replace(pattern, function (str) {
- return '<!--mce:protected ' + escape(str) + '-->';
- });
- });
- });
- }
-
- editor.on('SetContent', function () {
- editor.addVisual(editor.getBody());
- });
-
- // Remove empty contents
- if (settings.padd_empty_editor) {
- editor.on('PostProcess', function (e) {
- e.content = e.content.replace(/^(<p[^>]*>( | |\s|\u00a0|<br \/>|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');
- });
- }
-
- editor.load({ initial: true, format: 'html' });
- editor.startContent = editor.getContent({ format: 'raw' });
-
- editor.on('compositionstart compositionend', function (e) {
- editor.composing = e.type === 'compositionstart';
- });
-
- // Add editor specific CSS styles
- if (editor.contentStyles.length > 0) {
- contentCssText = '';
-
- Tools.each(editor.contentStyles, function (style) {
- contentCssText += style + "\r\n";
- });
-
- editor.dom.addStyle(contentCssText);
- }
-
- getStyleSheetLoader(editor).loadAll(
- editor.contentCSS,
- function (_) {
- initEditor(editor);
- },
- function (urls) {
- initEditor(editor);
- }
- );
-
- // Append specified content CSS last
- if (settings.content_style) {
- appendStyle(editor, settings.content_style);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function DomSerializer$1 (settings, editor) {
+ var domSerializer = DomSerializer(settings, editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- initContentBody: initContentBody
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ schema: domSerializer.schema,
+ addNodeFilter: domSerializer.addNodeFilter,
+ addAttributeFilter: domSerializer.addAttributeFilter,
+ serialize: domSerializer.serialize,
+ addRules: domSerializer.addRules,
+ setRules: domSerializer.setRules,
+ addTempAttr: domSerializer.addTempAttr,
+ getTempAttrs: domSerializer.getTempAttrs
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * PluginManager.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.PluginManager',
- [
- 'tinymce.core.AddOnManager'
- ],
- function (AddOnManager) {
- return AddOnManager.PluginManager;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function BookmarkManager(selection) {
+ return {
+ getBookmark: $_68e81l6jfuw8kyc.curry($_disscn2njfuw8ll3.getBookmark, selection),
+ moveToBookmark: $_68e81l6jfuw8kyc.curry($_disscn2njfuw8ll3.moveToBookmark, selection)
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ (function (BookmarkManager) {
+ BookmarkManager.isBookmarkNode = $_disscn2njfuw8ll3.isBookmarkNode;
+ }(BookmarkManager || (BookmarkManager = {})));
+ var BookmarkManager$1 = BookmarkManager;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * ThemeManager.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ThemeManager',
- [
- 'tinymce.core.AddOnManager'
- ],
- function (AddOnManager) {
- return AddOnManager.ThemeManager;
- }
-);
-
-/**
- * Init.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.init.Init',
- [
- 'global!document',
- 'global!window',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.Env',
- 'tinymce.core.init.InitContentBody',
- 'tinymce.core.PluginManager',
- 'tinymce.core.ThemeManager',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.Uuid'
- ],
- function (document, window, DOMUtils, Env, InitContentBody, PluginManager, ThemeManager, Tools, Uuid) {
- var DOM = DOMUtils.DOM;
-
- var initPlugin = function (editor, initializedPlugins, plugin) {
- var Plugin = PluginManager.get(plugin), pluginUrl, pluginInstance;
-
- pluginUrl = PluginManager.urls[plugin] || editor.documentBaseUrl.replace(/\/$/, '');
- plugin = Tools.trim(plugin);
- if (Plugin && Tools.inArray(initializedPlugins, plugin) === -1) {
- Tools.each(PluginManager.dependencies(plugin), function (dep) {
- initPlugin(editor, initializedPlugins, dep);
- });
-
- if (editor.plugins[plugin]) {
- return;
- }
-
- pluginInstance = new Plugin(editor, pluginUrl, editor.$);
-
- editor.plugins[plugin] = pluginInstance;
-
- if (pluginInstance.init) {
- pluginInstance.init(editor, pluginUrl);
- initializedPlugins.push(plugin);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isContentEditableFalse$10 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var isContentEditableTrue$6 = $_ey7ka11qjfuw8ldg.isContentEditableTrue;
+ var getContentEditableRoot$2 = function (root, node) {
+ while (node && node !== root) {
+ if (isContentEditableTrue$6(node) || isContentEditableFalse$10(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
+ }
+ return null;
+ };
+ var ControlSelection = function (selection, editor) {
+ var dom = editor.dom, each = $_52qop8kjfuw8l6v.each;
+ var selectedElm, selectedElmGhost, resizeHelper, resizeHandles, selectedHandle;
+ var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted;
+ var width, height;
+ var editableDoc = editor.getDoc(), rootDocument = document;
+ var abs = Math.abs, round = Math.round, rootElement = editor.getBody();
+ var startScrollWidth, startScrollHeight;
+ resizeHandles = {
+ nw: [
+ 0,
+ 0,
+ -1,
+ -1
+ ],
+ ne: [
+ 1,
+ 0,
+ 1,
+ -1
+ ],
+ se: [
+ 1,
+ 1,
+ 1,
+ 1
+ ],
+ sw: [
+ 0,
+ 1,
+ -1,
+ 1
+ ]
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var trimLegacyPrefix = function (name) {
- // Themes and plugins can be prefixed with - to prevent them from being lazy loaded
- return name.replace(/^\-/, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var rootClass = '.mce-content-body';
+ editor.contentStyles.push(rootClass + ' div.mce-resizehandle {' + 'position: absolute;' + 'border: 1px solid black;' + 'box-sizing: content-box;' + 'background: #FFF;' + 'width: 7px;' + 'height: 7px;' + 'z-index: 10000' + '}' + rootClass + ' .mce-resizehandle:hover {' + 'background: #000' + '}' + rootClass + ' img[data-mce-selected],' + rootClass + ' hr[data-mce-selected] {' + 'outline: 1px solid black;' + 'resize: none' + '}' + rootClass + ' .mce-clonedresizable {' + 'position: absolute;' + ($_9fhi43ajfuw8l13.gecko ? '' : 'outline: 1px dashed black;') + 'opacity: .5;' + 'filter: alpha(opacity=50);' + 'z-index: 10000' + '}' + rootClass + ' .mce-resize-helper {' + 'background: #555;' + 'background: rgba(0,0,0,0.75);' + 'border-radius: 3px;' + 'border: 1px;' + 'color: white;' + 'display: none;' + 'font-family: sans-serif;' + 'font-size: 12px;' + 'white-space: nowrap;' + 'line-height: 14px;' + 'margin: 5px 10px;' + 'padding: 5px;' + 'position: absolute;' + 'z-index: 10001' + '}');
+ var isImage = function (elm) {
+ return elm && (elm.nodeName === 'IMG' || editor.dom.is(elm, 'figure.image'));
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var initPlugins = function (editor) {
- var initializedPlugins = [];
-
- Tools.each(editor.settings.plugins.split(/[ ,]/), function (name) {
- initPlugin(editor, initializedPlugins, trimLegacyPrefix(name));
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isEventOnImageOutsideRange = function (evt, range) {
+ return isImage(evt.target) && !$_ew17fe57jfuw8m5c.isXYWithinRange(evt.clientX, evt.clientY, range);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var initTheme = function (editor) {
- var Theme, settings = editor.settings;
-
- if (settings.theme) {
- if (typeof settings.theme != "function") {
- settings.theme = trimLegacyPrefix(settings.theme);
-
- Theme = ThemeManager.get(settings.theme);
- editor.theme = new Theme(editor, ThemeManager.urls[settings.theme]);
-
- if (editor.theme.init) {
- editor.theme.init(editor, ThemeManager.urls[settings.theme] || editor.documentBaseUrl.replace(/\/$/, ''), editor.$);
- }
- } else {
- editor.theme = settings.theme;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var contextMenuSelectImage = function (evt) {
+ var target = evt.target;
+ if (isEventOnImageOutsideRange(evt, editor.selection.getRng()) && !evt.isDefaultPrevented()) {
+ evt.preventDefault();
+ editor.selection.select(target);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var measueBox = function (editor) {
- var w, h, minHeight, re, o, settings = editor.settings, elm = editor.getElement();
-
- // Measure box
- if (settings.render_ui && editor.theme) {
- editor.orgDisplay = elm.style.display;
-
- if (typeof settings.theme != "function") {
- w = settings.width || DOM.getStyle(elm, 'width') || '100%';
- h = settings.height || DOM.getStyle(elm, 'height') || elm.offsetHeight;
- minHeight = settings.min_height || 100;
- re = /^[0-9\.]+(|px)$/i;
-
- if (re.test('' + w)) {
- w = Math.max(parseInt(w, 10), 100);
- }
-
- if (re.test('' + h)) {
- h = Math.max(parseInt(h, 10), minHeight);
- }
-
- // Render UI
- o = editor.theme.renderUI({
- targetNode: elm,
- width: w,
- height: h,
- deltaWidth: settings.delta_width,
- deltaHeight: settings.delta_height
- });
-
- // Resize editor
- if (!settings.content_editable) {
- h = (o.iframeHeight || h) + (typeof h === 'number' ? (o.deltaHeight || 0) : '');
- if (h < minHeight) {
- h = minHeight;
- }
- }
- } else {
- o = settings.theme(editor, elm);
-
- if (o.editorContainer.nodeType) {
- o.editorContainer.id = o.editorContainer.id || editor.id + "_parent";
- }
-
- if (o.iframeContainer.nodeType) {
- o.iframeContainer.id = o.iframeContainer.id || editor.id + "_iframecontainer";
- }
-
- // Use specified iframe height or the targets offsetHeight
- h = o.iframeHeight || elm.offsetHeight;
- }
-
- editor.editorContainer = o.editorContainer;
- o.height = h;
- }
-
- return o;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getResizeTarget = function (elm) {
+ return editor.dom.is(elm, 'figure.image') ? elm.querySelector('img') : elm;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var relaxDomain = function (editor, ifr) {
- // Domain relaxing is required since the user has messed around with document.domain
- // This only applies to IE 11 other browsers including Edge seems to handle document.domain
- if (document.domain !== window.location.hostname && Env.ie && Env.ie < 12) {
- var bodyUuid = Uuid.uuid('mce');
-
- editor[bodyUuid] = function () {
- InitContentBody.initContentBody(editor);
- };
-
- /*eslint no-script-url:0 */
- var domainRelaxUrl = 'javascript:(function(){' +
- 'document.open();document.domain="' + document.domain + '";' +
- 'var ed = window.parent.tinymce.get("' + editor.id + '");document.write(ed.iframeHTML);' +
- 'document.close();ed.' + bodyUuid + '(true);})()';
-
- DOM.setAttrib(ifr, 'src', domainRelaxUrl);
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isResizable = function (elm) {
+ var selector = editor.settings.object_resizing;
+ if (selector === false || $_9fhi43ajfuw8l13.iOS) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
- };
-
- var createIframe = function (editor, o) {
- var settings = editor.settings, bodyId, bodyClass;
-
- editor.iframeHTML = settings.doctype + '<html><head>';
-
- // We only need to override paths if we have to
- // IE has a bug where it remove site absolute urls to relative ones if this is specified
- if (settings.document_base_url != editor.documentBaseUrl) {
- editor.iframeHTML += '<base href="' + editor.documentBaseURI.getURI() + '" />';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (typeof selector !== 'string') {
+ selector = 'table,img,figure.image,div';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // IE8 doesn't support carets behind images setting ie7_compat would force IE8+ to run in IE7 compat mode.
- if (!Env.caretAfter && settings.ie7_compat) {
- editor.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (elm.getAttribute('data-mce-resize') === 'false') {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
-
- bodyId = settings.body_id || 'tinymce';
- if (bodyId.indexOf('=') != -1) {
- bodyId = editor.getParam('body_id', '', 'hash');
- bodyId = bodyId[editor.id] || bodyId;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (elm === editor.getBody()) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- bodyClass = settings.body_class || '';
- if (bodyClass.indexOf('=') != -1) {
- bodyClass = editor.getParam('body_class', '', 'hash');
- bodyClass = bodyClass[editor.id] || '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $_fbwcti1fjfuw8lbx.is($_c9h6qlzjfuw8l98.fromDom(elm), selector);
+ };
+ var resizeGhostElement = function (e) {
+ var deltaX, deltaY, proportional;
+ var resizeHelperX, resizeHelperY;
+ deltaX = e.screenX - startX;
+ deltaY = e.screenY - startY;
+ width = deltaX * selectedHandle[2] + startW;
+ height = deltaY * selectedHandle[3] + startH;
+ width = width < 5 ? 5 : width;
+ height = height < 5 ? 5 : height;
+ if (isImage(selectedElm) && editor.settings.resize_img_proportional !== false) {
+ proportional = !$_1nvqmv5ajfuw8m5j.modifierPressed(e);
+ } else {
+ proportional = $_1nvqmv5ajfuw8m5j.modifierPressed(e) || isImage(selectedElm) && selectedHandle[2] * selectedHandle[3] !== 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.content_security_policy) {
- editor.iframeHTML += '<meta http-equiv="Content-Security-Policy" content="' + settings.content_security_policy + '" />';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (proportional) {
+ if (abs(deltaX) > abs(deltaY)) {
+ height = round(width * ratio);
+ width = round(height / ratio);
+ } else {
+ width = round(height / ratio);
+ height = round(width * ratio);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.iframeHTML += '</head><body id="' + bodyId +
- '" class="mce-content-body ' + bodyClass +
- '" data-id="' + editor.id + '"><br></body></html>';
-
- // Create iframe
- // TODO: ACC add the appropriate description on this.
- var ifr = DOM.create('iframe', {
- id: editor.id + "_ifr",
- frameBorder: '0',
- allowTransparency: "true",
- title: editor.editorManager.translate(
- "Rich Text Area. Press ALT-F9 for menu. " +
- "Press ALT-F10 for toolbar. Press ALT-0 for help"
- ),
- style: {
- width: '100%',
- height: o.height,
- display: 'block' // Important for Gecko to render the iframe correctly
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.setStyles(getResizeTarget(selectedElmGhost), {
+ width: width,
+ height: height
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- ifr.onload = function () {
- ifr.onload = null;
- editor.fire("load");
- };
-
- var isDomainRelaxed = relaxDomain(editor, ifr);
-
- editor.contentAreaContainer = o.iframeContainer;
- editor.iframeElement = ifr;
-
- DOM.add(o.iframeContainer, ifr);
-
- return isDomainRelaxed;
- };
-
- var init = function (editor) {
- var settings = editor.settings, elm = editor.getElement(), boxInfo;
-
- editor.rtl = settings.rtl_ui || editor.editorManager.i18n.rtl;
- editor.editorManager.i18n.setCode(settings.language);
- settings.aria_label = settings.aria_label || DOM.getAttrib(elm, 'aria-label', editor.getLang('aria.rich_text_area'));
-
- editor.fire('ScriptsLoaded');
-
- initTheme(editor);
- initPlugins(editor);
- boxInfo = measueBox(editor);
-
- // Load specified content CSS last
- if (settings.content_css) {
- Tools.each(Tools.explode(settings.content_css), function (u) {
- editor.contentCSS.push(editor.documentBaseURI.toAbsolute(u));
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ resizeHelperX = selectedHandle.startPos.x + deltaX;
+ resizeHelperY = selectedHandle.startPos.y + deltaY;
+ resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0;
+ resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0;
+ dom.setStyles(resizeHelper, {
+ left: resizeHelperX,
+ top: resizeHelperY,
+ display: 'block'
+ });
+ resizeHelper.innerHTML = width + ' × ' + height;
+ if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) {
+ dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Content editable mode ends here
- if (settings.content_editable) {
- return InitContentBody.initContentBody(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) {
+ dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isDomainRelaxed = createIframe(editor, boxInfo);
-
- if (boxInfo.editorContainer) {
- DOM.get(boxInfo.editorContainer).style.display = editor.orgDisplay;
- editor.hidden = DOM.isHidden(boxInfo.editorContainer);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ deltaX = rootElement.scrollWidth - startScrollWidth;
+ deltaY = rootElement.scrollHeight - startScrollHeight;
+ if (deltaX + deltaY !== 0) {
+ dom.setStyles(resizeHelper, {
+ left: resizeHelperX - deltaX,
+ top: resizeHelperY - deltaY
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.getElement().style.display = 'none';
- DOM.setAttrib(editor.id, 'aria-hidden', true);
-
- if (!isDomainRelaxed) {
- InitContentBody.initContentBody(editor);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!resizeStarted) {
+ editor.fire('ObjectResizeStart', {
+ target: selectedElm,
+ width: startW,
+ height: startH
+ });
+ resizeStarted = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- init: init
- };
- }
-);
-
-/**
- * Render.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.init.Render',
- [
- 'global!window',
- 'tinymce.core.api.NotificationManager',
- 'tinymce.core.api.WindowManager',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.dom.EventUtils',
- 'tinymce.core.dom.ScriptLoader',
- 'tinymce.core.Env',
- 'tinymce.core.ErrorReporter',
- 'tinymce.core.init.Init',
- 'tinymce.core.PluginManager',
- 'tinymce.core.ThemeManager',
- 'tinymce.core.util.Tools'
- ],
- function (window, NotificationManager, WindowManager, DOMUtils, EventUtils, ScriptLoader, Env, ErrorReporter, Init, PluginManager, ThemeManager, Tools) {
- var DOM = DOMUtils.DOM;
-
- var loadScripts = function (editor, suffix) {
- var settings = editor.settings, scriptLoader = ScriptLoader.ScriptLoader;
-
- if (settings.language && settings.language != 'en' && !settings.language_url) {
- settings.language_url = editor.editorManager.baseURL + '/langs/' + settings.language + '.js';
- }
-
- if (settings.language_url) {
- scriptLoader.add(settings.language_url);
- }
-
- if (settings.theme && typeof settings.theme != "function" &&
- settings.theme.charAt(0) != '-' && !ThemeManager.urls[settings.theme]) {
- var themeUrl = settings.theme_url;
-
- if (themeUrl) {
- themeUrl = editor.documentBaseURI.toAbsolute(themeUrl);
- } else {
- themeUrl = 'themes/' + settings.theme + '/theme' + suffix + '.js';
- }
-
- ThemeManager.load(settings.theme, themeUrl);
- }
-
- if (Tools.isArray(settings.plugins)) {
- settings.plugins = settings.plugins.join(' ');
- }
-
- Tools.each(settings.external_plugins, function (url, name) {
- PluginManager.load(name, url);
- settings.plugins += ' ' + name;
- });
-
- Tools.each(settings.plugins.split(/[ ,]/), function (plugin) {
- plugin = Tools.trim(plugin);
-
- if (plugin && !PluginManager.urls[plugin]) {
- if (plugin.charAt(0) === '-') {
- plugin = plugin.substr(1, plugin.length);
-
- var dependencies = PluginManager.dependencies(plugin);
-
- Tools.each(dependencies, function (dep) {
- var defaultSettings = {
- prefix: 'plugins/',
- resource: dep,
- suffix: '/plugin' + suffix + '.js'
- };
-
- dep = PluginManager.createUrl(defaultSettings, dep);
- PluginManager.load(dep.resource, dep);
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var endGhostResize = function () {
+ resizeStarted = false;
+ var setSizeProp = function (name, value) {
+ if (value) {
+ if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) {
+ dom.setStyle(getResizeTarget(selectedElm), name, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- PluginManager.load(plugin, {
- prefix: 'plugins/',
- resource: plugin,
- suffix: '/plugin' + suffix + '.js'
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.setAttrib(getResizeTarget(selectedElm), name, value);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ setSizeProp('width', width);
+ setSizeProp('height', height);
+ dom.unbind(editableDoc, 'mousemove', resizeGhostElement);
+ dom.unbind(editableDoc, 'mouseup', endGhostResize);
+ if (rootDocument !== editableDoc) {
+ dom.unbind(rootDocument, 'mousemove', resizeGhostElement);
+ dom.unbind(rootDocument, 'mouseup', endGhostResize);
+ }
+ dom.remove(selectedElmGhost);
+ dom.remove(resizeHelper);
+ showResizeRect(selectedElm);
+ editor.fire('ObjectResized', {
+ target: selectedElm,
+ width: width,
+ height: height
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- scriptLoader.loadQueue(function () {
- if (!editor.removed) {
- Init.init(editor);
- }
- }, editor, function (urls) {
- ErrorReporter.pluginLoadError(editor, urls[0]);
-
- if (!editor.removed) {
- Init.init(editor);
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.setAttrib(selectedElm, 'style', dom.getAttrib(selectedElm, 'style'));
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var render = function (editor) {
- var settings = editor.settings, id = editor.id;
-
- function readyHandler() {
- DOM.unbind(window, 'ready', readyHandler);
- editor.render();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var showResizeRect = function (targetElm) {
+ var position, targetWidth, targetHeight, e, rect;
+ hideResizeRect();
+ unbindResizeHandleEvents();
+ position = dom.getPos(targetElm, rootElement);
+ selectedElmX = position.x;
+ selectedElmY = position.y;
+ rect = targetElm.getBoundingClientRect();
+ targetWidth = rect.width || rect.right - rect.left;
+ targetHeight = rect.height || rect.bottom - rect.top;
+ if (selectedElm !== targetElm) {
+ selectedElm = targetElm;
+ width = height = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Page is not loaded yet, wait for it
- if (!EventUtils.Event.domLoaded) {
- DOM.bind(window, 'ready', readyHandler);
- return;
- }
-
- // Element not found, then skip initialization
- if (!editor.getElement()) {
- return;
- }
-
- // No editable support old iOS versions etc
- if (!Env.contentEditable) {
- return;
- }
-
- // Hide target element early to prevent content flashing
- if (!settings.inline) {
- editor.orgVisibility = editor.getElement().style.visibility;
- editor.getElement().style.visibility = 'hidden';
- } else {
- editor.inline = true;
- }
-
- var form = editor.getElement().form || DOM.getParent(id, 'form');
- if (form) {
- editor.formElement = form;
-
- // Add hidden input for non input elements inside form elements
- if (settings.hidden_input && !/TEXTAREA|INPUT/i.test(editor.getElement().nodeName)) {
- DOM.insertAfter(DOM.create('input', { type: 'hidden', name: id }), id);
- editor.hasHiddenInput = true;
- }
-
- // Pass submit/reset from form to editor instance
- editor.formEventDelegate = function (e) {
- editor.fire(e.type, e);
- };
-
- DOM.bind(form, 'submit reset', editor.formEventDelegate);
-
- // Reset contents in editor when the form is reset
- editor.on('reset', function () {
- editor.setContent(editor.startContent, { format: 'raw' });
- });
-
- // Check page uses id="submit" or name="submit" for it's submit button
- if (settings.submit_patch && !form.submit.nodeType && !form.submit.length && !form._mceOldSubmit) {
- form._mceOldSubmit = form.submit;
- form.submit = function () {
- editor.editorManager.triggerSave();
- editor.setDirty(false);
-
- return form._mceOldSubmit(form);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ e = editor.fire('ObjectSelected', { target: targetElm });
+ if (isResizable(targetElm) && !e.isDefaultPrevented()) {
+ each(resizeHandles, function (handle, name) {
+ var handleElm;
+ var startDrag = function (e) {
+ startX = e.screenX;
+ startY = e.screenY;
+ startW = getResizeTarget(selectedElm).clientWidth;
+ startH = getResizeTarget(selectedElm).clientHeight;
+ ratio = startH / startW;
+ selectedHandle = handle;
+ handle.startPos = {
+ x: targetWidth * handle[0] + selectedElmX,
+ y: targetHeight * handle[1] + selectedElmY
+ };
+ startScrollWidth = rootElement.scrollWidth;
+ startScrollHeight = rootElement.scrollHeight;
+ selectedElmGhost = selectedElm.cloneNode(true);
+ dom.addClass(selectedElmGhost, 'mce-clonedresizable');
+ dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all');
+ selectedElmGhost.contentEditable = false;
+ selectedElmGhost.unSelectabe = true;
+ dom.setStyles(selectedElmGhost, {
+ left: selectedElmX,
+ top: selectedElmY,
+ margin: 0
+ });
+ selectedElmGhost.removeAttribute('data-mce-selected');
+ rootElement.appendChild(selectedElmGhost);
+ dom.bind(editableDoc, 'mousemove', resizeGhostElement);
+ dom.bind(editableDoc, 'mouseup', endGhostResize);
+ if (rootDocument !== editableDoc) {
+ dom.bind(rootDocument, 'mousemove', resizeGhostElement);
+ dom.bind(rootDocument, 'mouseup', endGhostResize);
+ }
+ resizeHelper = dom.add(rootElement, 'div', {
+ 'class': 'mce-resize-helper',
+ 'data-mce-bogus': 'all'
+ }, startW + ' × ' + startH);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- }
-
- editor.windowManager = new WindowManager(editor);
- editor.notificationManager = new NotificationManager(editor);
-
- if (settings.encoding === 'xml') {
- editor.on('GetContent', function (e) {
- if (e.save) {
- e.content = DOM.encode(e.content);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ handleElm = dom.get('mceResizeHandle' + name);
+ if (handleElm) {
+ dom.remove(handleElm);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-
- if (settings.add_form_submit_trigger) {
- editor.on('submit', function () {
- if (editor.initialized) {
- editor.save();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ handleElm = dom.add(rootElement, 'div', {
+ 'id': 'mceResizeHandle' + name,
+ 'data-mce-bogus': 'all',
+ 'class': 'mce-resizehandle',
+ 'unselectable': true,
+ 'style': 'cursor:' + name + '-resize; margin:0; padding:0'
+ });
+ if ($_9fhi43ajfuw8l13.ie) {
+ handleElm.contentEditable = false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.bind(handleElm, 'mousedown', function (e) {
+ e.stopImmediatePropagation();
+ e.preventDefault();
+ startDrag(e);
+ });
+ handle.elm = handleElm;
+ dom.setStyles(handleElm, {
+ left: targetWidth * handle[0] + selectedElmX - handleElm.offsetWidth / 2,
+ top: targetHeight * handle[1] + selectedElmY - handleElm.offsetHeight / 2
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ hideResizeRect();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.add_unload_trigger) {
- editor._beforeUnload = function () {
- if (editor.initialized && !editor.destroyed && !editor.isHidden()) {
- editor.save({ format: 'raw', no_events: true, set_dirty: false });
- }
- };
-
- editor.editorManager.on('BeforeUnload', editor._beforeUnload);
- }
-
- editor.editorManager.add(editor);
- loadScripts(editor, editor.suffix);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ selectedElm.setAttribute('data-mce-selected', '1');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- render: render
- };
- }
-);
-
-/**
- * Mode.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Mode switcher logic.
- *
- * @private
- * @class tinymce.Mode
- */
-define(
- 'tinymce.core.Mode',
- [
- ],
- function () {
- function setEditorCommandState(editor, cmd, state) {
- try {
- editor.getDoc().execCommand(cmd, false, state);
- } catch (ex) {
- // Ignore
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hideResizeRect = function () {
+ var name, handleElm;
+ unbindResizeHandleEvents();
+ if (selectedElm) {
+ selectedElm.removeAttribute('data-mce-selected');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function clickBlocker(editor) {
- var target, handler;
-
- target = editor.getBody();
-
- handler = function (e) {
- if (editor.dom.getParents(e.target, 'a').length > 0) {
- e.preventDefault();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (name in resizeHandles) {
+ handleElm = dom.get('mceResizeHandle' + name);
+ if (handleElm) {
+ dom.unbind(handleElm);
+ dom.remove(handleElm);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- editor.dom.bind(target, 'click', handler);
-
- return {
- unbind: function () {
- editor.dom.unbind(target, 'click', handler);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var updateResizeRect = function (e) {
+ var startElm, controlElm;
+ var isChildOrEqual = function (node, parent) {
+ if (node) {
+ do {
+ if (node === parent) {
+ return true;
+ }
+ } while (node = node.parentNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function toggleReadOnly(editor, state) {
- if (editor._clickBlocker) {
- editor._clickBlocker.unbind();
- editor._clickBlocker = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (resizeStarted || editor.removed) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (state) {
- editor._clickBlocker = clickBlocker(editor);
- editor.selection.controlSelection.hideResizeRect();
- editor.readonly = true;
- editor.getBody().contentEditable = false;
- } else {
- editor.readonly = false;
- editor.getBody().contentEditable = true;
- setEditorCommandState(editor, "StyleWithCSS", false);
- setEditorCommandState(editor, "enableInlineTableEditing", false);
- setEditorCommandState(editor, "enableObjectResizing", false);
- editor.focus();
- editor.nodeChanged();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function (img) {
+ img.removeAttribute('data-mce-selected');
+ });
+ controlElm = e.type === 'mousedown' ? e.target : selection.getNode();
+ controlElm = dom.$(controlElm).closest('table,img,figure.image,hr')[0];
+ if (isChildOrEqual(controlElm, rootElement)) {
+ disableGeckoResize();
+ startElm = selection.getStart(true);
+ if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) {
+ showResizeRect(controlElm);
+ return;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function setMode(editor, mode) {
- var currentMode = editor.readonly ? 'readonly' : 'design';
-
- if (mode == currentMode) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ hideResizeRect();
+ };
+ var isWithinContentEditableFalse = function (elm) {
+ return isContentEditableFalse$10(getContentEditableRoot$2(editor.getBody(), elm));
+ };
+ var unbindResizeHandleEvents = function () {
+ for (var name_1 in resizeHandles) {
+ var handle = resizeHandles[name_1];
+ if (handle.elm) {
+ dom.unbind(handle.elm);
+ delete handle.elm;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (editor.initialized) {
- toggleReadOnly(editor, mode == 'readonly');
- } else {
- editor.on('init', function () {
- toggleReadOnly(editor, mode == 'readonly');
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var disableGeckoResize = function () {
+ try {
+ editor.getDoc().execCommand('enableObjectResizing', false, false);
+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Event is NOT preventable
- editor.fire('SwitchMode', { mode: mode });
- }
-
- return {
- setMode: setMode
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Shortcuts.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Contains logic for handling keyboard shortcuts.
- *
- * @class tinymce.Shortcuts
- * @example
- * editor.shortcuts.add('ctrl+a', "description of the shortcut", function() {});
- * editor.shortcuts.add('meta+a', "description of the shortcut", function() {}); // "meta" maps to Command on Mac and Ctrl on PC
- * editor.shortcuts.add('ctrl+alt+a', "description of the shortcut", function() {});
- * editor.shortcuts.add('access+a', "description of the shortcut", function() {}); // "access" maps to ctrl+alt on Mac and shift+alt on PC
- */
-define(
- 'tinymce.core.Shortcuts',
- [
- 'tinymce.core.util.Tools',
- 'tinymce.core.Env'
- ],
- function (Tools, Env) {
- var each = Tools.each, explode = Tools.explode;
-
- var keyCodeLookup = {
- "f9": 120,
- "f10": 121,
- "f11": 122
- };
-
- var modifierNames = Tools.makeMap('alt,ctrl,shift,meta,access');
-
- return function (editor) {
- var self = this, shortcuts = {}, pendingPatterns = [];
-
- function parseShortcut(pattern) {
- var id, key, shortcut = {};
-
- // Parse modifiers and keys ctrl+alt+b for example
- each(explode(pattern, '+'), function (value) {
- if (value in modifierNames) {
- shortcut[value] = true;
- } else {
- // Allow numeric keycodes like ctrl+219 for ctrl+[
- if (/^[0-9]{2,}$/.test(value)) {
- shortcut.keyCode = parseInt(value, 10);
- } else {
- shortcut.charCode = value.charCodeAt(0);
- shortcut.keyCode = keyCodeLookup[value] || value.toUpperCase().charCodeAt(0);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('init', function () {
+ disableGeckoResize();
+ if ($_9fhi43ajfuw8l13.ie && $_9fhi43ajfuw8l13.ie >= 11) {
+ editor.on('mousedown click', function (e) {
+ var target = e.target, nodeName = target.nodeName;
+ if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName) && !isWithinContentEditableFalse(target)) {
+ if (e.button !== 2) {
+ editor.selection.select(target, nodeName === 'TABLE');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (e.type === 'mousedown') {
+ editor.nodeChanged();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Generate unique id for modifier combination and set default state for unused modifiers
- id = [shortcut.keyCode];
- for (key in modifierNames) {
- if (shortcut[key]) {
- id.push(key);
- } else {
- shortcut[key] = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.dom.bind(rootElement, 'mscontrolselect', function (e) {
+ var delayedSelect = function (node) {
+ $_2m8wq9hjfuw8l41.setEditorTimeout(editor, function () {
+ editor.selection.select(node);
+ });
+ };
+ if (isWithinContentEditableFalse(e.target)) {
+ e.preventDefault();
+ delayedSelect(e.target);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- shortcut.id = id.join(',');
-
- // Handle special access modifier differently depending on Mac/Win
- if (shortcut.access) {
- shortcut.alt = true;
-
- if (Env.mac) {
- shortcut.ctrl = true;
- } else {
- shortcut.shift = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (/^(TABLE|IMG|HR)$/.test(e.target.nodeName)) {
+ e.preventDefault();
+ if (e.target.tagName === 'IMG') {
+ delayedSelect(e.target);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- // Handle special meta modifier differently depending on Mac/Win
- if (shortcut.meta) {
- if (Env.mac) {
- shortcut.meta = true;
- } else {
- shortcut.ctrl = true;
- shortcut.meta = false;
- }
- }
-
- return shortcut;
- }
-
- function createShortcut(pattern, desc, cmdFunc, scope) {
- var shortcuts;
-
- shortcuts = Tools.map(explode(pattern, '>'), parseShortcut);
- shortcuts[shortcuts.length - 1] = Tools.extend(shortcuts[shortcuts.length - 1], {
- func: cmdFunc,
- scope: scope || editor
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Tools.extend(shortcuts[0], {
- desc: editor.translate(desc),
- subpatterns: shortcuts.slice(1)
- });
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hasModifier(e) {
- return e.altKey || e.ctrlKey || e.metaKey;
- }
-
- function isFunctionKey(e) {
- return e.type === "keydown" && e.keyCode >= 112 && e.keyCode <= 123;
- }
-
- function matchShortcut(e, shortcut) {
- if (!shortcut) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var throttledUpdateResizeRect = $_2m8wq9hjfuw8l41.throttle(function (e) {
+ if (!editor.composing) {
+ updateResizeRect(e);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (shortcut.ctrl != e.ctrlKey || shortcut.meta != e.metaKey) {
- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ editor.on('nodechange ResizeEditor ResizeWindow drop FullscreenStateChanged', throttledUpdateResizeRect);
+ editor.on('keyup compositionend', function (e) {
+ if (selectedElm && selectedElm.nodeName === 'TABLE') {
+ throttledUpdateResizeRect(e);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (shortcut.alt != e.altKey || shortcut.shift != e.shiftKey) {
- return false;
- }
-
- if (e.keyCode == shortcut.keyCode || (e.charCode && e.charCode == shortcut.charCode)) {
- e.preventDefault();
- return true;
- }
-
- return false;
- }
-
- function executeShortcutAction(shortcut) {
- return shortcut.func ? shortcut.func.call(shortcut.scope) : null;
- }
-
- editor.on('keyup keypress keydown', function (e) {
- if ((hasModifier(e) || isFunctionKey(e)) && !e.isDefaultPrevented()) {
- each(shortcuts, function (shortcut) {
- if (matchShortcut(e, shortcut)) {
- pendingPatterns = shortcut.subpatterns.slice(0);
-
- if (e.type == "keydown") {
- executeShortcutAction(shortcut);
- }
-
- return true;
- }
- });
-
- if (matchShortcut(e, pendingPatterns[0])) {
- if (pendingPatterns.length === 1) {
- if (e.type == "keydown") {
- executeShortcutAction(pendingPatterns[0]);
- }
- }
-
- pendingPatterns.shift();
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Adds a keyboard shortcut for some command or function.
- *
- * @method add
- * @param {String} pattern Shortcut pattern. Like for example: ctrl+alt+o.
- * @param {String} desc Text description for the command.
- * @param {String/Function} cmdFunc Command name string or function to execute when the key is pressed.
- * @param {Object} scope Optional scope to execute the function in.
- * @return {Boolean} true/false state if the shortcut was added or not.
- */
- self.add = function (pattern, desc, cmdFunc, scope) {
- var cmd;
-
- cmd = cmdFunc;
-
- if (typeof cmdFunc === 'string') {
- cmdFunc = function () {
- editor.execCommand(cmd, false, null);
- };
- } else if (Tools.isArray(cmd)) {
- cmdFunc = function () {
- editor.execCommand(cmd[0], cmd[1], cmd[2]);
- };
- }
-
- each(explode(Tools.trim(pattern.toLowerCase())), function (pattern) {
- var shortcut = createShortcut(pattern, desc, cmdFunc, scope);
- shortcuts[shortcut.id] = shortcut;
- });
-
- return true;
- };
-
- /**
- * Remove a keyboard shortcut by pattern.
- *
- * @method remove
- * @param {String} pattern Shortcut pattern. Like for example: ctrl+alt+o.
- * @return {Boolean} true/false state if the shortcut was removed or not.
- */
- self.remove = function (pattern) {
- var shortcut = createShortcut(pattern);
-
- if (shortcuts[shortcut.id]) {
- delete shortcuts[shortcut.id];
- return true;
- }
-
- return false;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('hide blur', hideResizeRect);
+ editor.on('contextmenu', contextMenuSelectImage);
+ });
+ editor.on('remove', unbindResizeHandleEvents);
+ var destroy = function () {
+ selectedElm = selectedElmGhost = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Sidebar.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module handle sidebar instances for the editor.
- *
- * @class tinymce.ui.Sidebar
- * @private
- */
-define(
- 'tinymce.core.ui.Sidebar',
- [
- ],
- function (
- ) {
- var add = function (editor, name, settings) {
- var sidebars = editor.sidebars ? editor.sidebars : [];
- sidebars.push({ name: name, settings: settings });
- editor.sidebars = sidebars;
- };
-
</del><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add: add
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ isResizable: isResizable,
+ showResizeRect: showResizeRect,
+ hideResizeRect: hideResizeRect,
+ updateResizeRect: updateResizeRect,
+ destroy: destroy
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * URI.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class handles parsing, modification and serialization of URI/URL strings.
- * @class tinymce.util.URI
- */
-define(
- 'tinymce.core.util.URI',
- [
- 'global!document',
- 'tinymce.core.util.Tools'
- ],
- function (document, Tools) {
- var each = Tools.each, trim = Tools.trim;
- var queryParts = "source protocol authority userInfo user password host port relative path directory file query anchor".split(' ');
- var DEFAULT_PORTS = {
- 'ftp': 21,
- 'http': 80,
- 'https': 443,
- 'mailto': 25
- };
-
- /**
- * Constructs a new URI instance.
- *
- * @constructor
- * @method URI
- * @param {String} url URI string to parse.
- * @param {Object} settings Optional settings object.
- */
- function URI(url, settings) {
- var self = this, baseUri, baseUrl;
-
- url = trim(url);
- settings = self.settings = settings || {};
- baseUri = settings.base_uri;
-
- // Strange app protocol that isn't http/https or local anchor
- // For example: mailto,skype,tel etc.
- if (/^([\w\-]+):([^\/]{2})/i.test(url) || /^\s*#/.test(url)) {
- self.source = url;
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasCeProperty = function (node) {
+ return $_ey7ka11qjfuw8ldg.isContentEditableTrue(node) || $_ey7ka11qjfuw8ldg.isContentEditableFalse(node);
+ };
+ var findParent$1 = function (node, rootNode, predicate) {
+ while (node && node !== rootNode) {
+ if (predicate(node)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isProtocolRelative = url.indexOf('//') === 0;
-
- // Absolute path with no host, fake host and protocol
- if (url.indexOf('/') === 0 && !isProtocolRelative) {
- url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
+ }
+ return null;
+ };
+ var findClosestIeRange = function (clientX, clientY, doc) {
+ var element, rng, rects;
+ element = doc.elementFromPoint(clientX, clientY);
+ rng = doc.body.createTextRange();
+ if (!element || element.tagName === 'HTML') {
+ element = doc.body;
+ }
+ rng.moveToElementText(element);
+ rects = $_52qop8kjfuw8l6v.toArray(rng.getClientRects());
+ rects = rects.sort(function (a, b) {
+ a = Math.abs(Math.max(a.top - clientY, a.bottom - clientY));
+ b = Math.abs(Math.max(b.top - clientY, b.bottom - clientY));
+ return a - b;
+ });
+ if (rects.length > 0) {
+ clientY = (rects[0].bottom + rects[0].top) / 2;
+ try {
+ rng.moveToPoint(clientX, clientY);
+ rng.collapse(true);
+ return rng;
+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Relative path http:// or protocol relative //path
- if (!/^[\w\-]*:?\/\//.test(url)) {
- baseUrl = settings.base_uri ? settings.base_uri.path : new URI(document.location.href).directory;
- if (settings.base_uri.protocol === "") {
- url = '//mce_host' + self.toAbsPath(baseUrl, url);
- } else {
- url = /([^#?]*)([#?]?.*)/.exec(url);
- url = ((baseUri && baseUri.protocol) || 'http') + '://mce_host' + self.toAbsPath(baseUrl, url[1]) + url[2];
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return null;
+ };
+ var moveOutOfContentEditableFalse = function (rng, rootNode) {
+ var parentElement = rng && rng.parentElement ? rng.parentElement() : null;
+ return $_ey7ka11qjfuw8ldg.isContentEditableFalse(findParent$1(parentElement, rootNode, hasCeProperty)) ? null : rng;
+ };
+ var fromPoint$1 = function (clientX, clientY, doc) {
+ var rng, point;
+ var pointDoc = doc;
+ if (pointDoc.caretPositionFromPoint) {
+ point = pointDoc.caretPositionFromPoint(clientX, clientY);
+ if (point) {
+ rng = doc.createRange();
+ rng.setStart(point.offsetNode, point.offset);
+ rng.collapse(true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)
- url = url.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something
-
- /*jshint maxlen: 255 */
- /*eslint max-len: 0 */
- url = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url);
-
- each(queryParts, function (v, i) {
- var part = url[i];
-
- // Zope 3 workaround, they use @@something
- if (part) {
- part = part.replace(/\(mce_at\)/g, '@@');
- }
-
- self[v] = part;
- });
-
- if (baseUri) {
- if (!self.protocol) {
- self.protocol = baseUri.protocol;
- }
-
- if (!self.userInfo) {
- self.userInfo = baseUri.userInfo;
- }
-
- if (!self.port && self.host === 'mce_host') {
- self.port = baseUri.port;
- }
-
- if (!self.host || self.host === 'mce_host') {
- self.host = baseUri.host;
- }
-
- self.source = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (doc.caretRangeFromPoint) {
+ rng = doc.caretRangeFromPoint(clientX, clientY);
+ } else if (pointDoc.body.createTextRange) {
+ rng = pointDoc.body.createTextRange();
+ try {
+ rng.moveToPoint(clientX, clientY);
+ rng.collapse(true);
+ } catch (ex) {
+ rng = findClosestIeRange(clientX, clientY, doc);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (isProtocolRelative) {
- self.protocol = '';
- }
-
- //t.path = t.path || '/';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return moveOutOfContentEditableFalse(rng, doc.body);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return rng;
+ };
+ var $_dyytu76ejfuw8md2 = { fromPoint: fromPoint$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- URI.prototype = {
- /**
- * Sets the internal path part of the URI.
- *
- * @method setPath
- * @param {string} path Path string to set.
- */
- setPath: function (path) {
- var self = this;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var processRanges = function (editor, ranges) {
+ return $_9ek1bp4jfuw8kxg.map(ranges, function (range) {
+ var evt = editor.fire('GetSelectionRange', { range: range });
+ return evt.range !== range ? evt.range : range;
+ });
+ };
+ var $_2shlx66fjfuw8md6 = { processRanges: processRanges };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- path = /^(.*?)\/?(\w+)?$/.exec(path);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var clone$2 = function (original, deep) {
+ return $_c9h6qlzjfuw8l98.fromDom(original.dom().cloneNode(deep));
+ };
+ var shallow$1 = function (original) {
+ return clone$2(original, false);
+ };
+ var deep$1 = function (original) {
+ return clone$2(original, true);
+ };
+ var shallowAs = function (original, tag) {
+ var nu = $_c9h6qlzjfuw8l98.fromTag(tag);
+ var attributes = $_8g002u14jfuw8la5.clone(original);
+ $_8g002u14jfuw8la5.setAll(nu, attributes);
+ return nu;
+ };
+ var copy$1 = function (original, tag) {
+ var nu = shallowAs(original, tag);
+ var cloneChildren = $_2j4g5u17jfuw8lav.children(deep$1(original));
+ $_84jjow2vjfuw8lml.append(nu, cloneChildren);
+ return nu;
+ };
+ var mutate = function (original, tag) {
+ var nu = shallowAs(original, tag);
+ $_doli6x2kjfuw8lky.before(original, nu);
+ var children = $_2j4g5u17jfuw8lav.children(original);
+ $_84jjow2vjfuw8lml.append(nu, children);
+ $_byg6a92ujfuw8lmi.remove(original);
+ return nu;
+ };
+ var $_bde3we6ijfuw8mdt = {
+ shallow: shallow$1,
+ shallowAs: shallowAs,
+ deep: deep$1,
+ copy: copy$1,
+ mutate: mutate
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Update path parts
- self.path = path[0];
- self.directory = path[1];
- self.file = path[2];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var fromElements = function (elements, scope) {
+ var doc = scope || document;
+ var fragment = doc.createDocumentFragment();
+ $_9ek1bp4jfuw8kxg.each(elements, function (element) {
+ fragment.appendChild(element.dom());
+ });
+ return $_c9h6qlzjfuw8l98.fromDom(fragment);
+ };
+ var $_aj5cq36jjfuw8mdv = { fromElements: fromElements };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Rebuild source
- self.source = '';
- self.getURI();
- },
-
- /**
- * Converts the specified URI into a relative URI based on the current URI instance location.
- *
- * @method toRelative
- * @param {String} uri URI to convert into a relative path/URI.
- * @return {String} Relative URI from the point specified in the current URI instance.
- * @example
- * // Converts an absolute URL to an relative URL url will be somedir/somefile.htm
- * var url = new tinymce.util.URI('http://www.site.com/dir/').toRelative('http://www.site.com/dir/somedir/somefile.htm');
- */
- toRelative: function (uri) {
- var self = this, output;
-
- if (uri === "./") {
- return uri;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getStartNode = function (rng) {
+ var sc = rng.startContainer, so = rng.startOffset;
+ if ($_ey7ka11qjfuw8ldg.isText(sc)) {
+ return so === 0 ? Option.some($_c9h6qlzjfuw8l98.fromDom(sc)) : Option.none();
+ } else {
+ return Option.from(sc.childNodes[so]).map($_c9h6qlzjfuw8l98.fromDom);
+ }
+ };
+ var getEndNode = function (rng) {
+ var ec = rng.endContainer, eo = rng.endOffset;
+ if ($_ey7ka11qjfuw8ldg.isText(ec)) {
+ return eo === ec.data.length ? Option.some($_c9h6qlzjfuw8l98.fromDom(ec)) : Option.none();
+ } else {
+ return Option.from(ec.childNodes[eo - 1]).map($_c9h6qlzjfuw8l98.fromDom);
+ }
+ };
+ var getFirstChildren = function (node) {
+ return $_2j4g5u17jfuw8lav.firstChild(node).fold($_68e81l6jfuw8kyc.constant([node]), function (child) {
+ return [node].concat(getFirstChildren(child));
+ });
+ };
+ var getLastChildren$1 = function (node) {
+ return $_2j4g5u17jfuw8lav.lastChild(node).fold($_68e81l6jfuw8kyc.constant([node]), function (child) {
+ if ($_eaw33d10jfuw8l9f.name(child) === 'br') {
+ return $_2j4g5u17jfuw8lav.prevSibling(child).map(function (sibling) {
+ return [node].concat(getLastChildren$1(sibling));
+ }).getOr([]);
+ } else {
+ return [node].concat(getLastChildren$1(child));
+ }
+ });
+ };
+ var hasAllContentsSelected = function (elm, rng) {
+ return $_5gv5dd26jfuw8li3.liftN([
+ getStartNode(rng),
+ getEndNode(rng)
+ ], function (startNode, endNode) {
+ var start = $_9ek1bp4jfuw8kxg.find(getFirstChildren(elm), $_68e81l6jfuw8kyc.curry($_4fb96d1djfuw8lbl.eq, startNode));
+ var end = $_9ek1bp4jfuw8kxg.find(getLastChildren$1(elm), $_68e81l6jfuw8kyc.curry($_4fb96d1djfuw8lbl.eq, endNode));
+ return start.isSome() && end.isSome();
+ }).getOr(false);
+ };
+ var moveEndPoint$1 = function (dom, rng, node, start) {
+ var root = node, walker = new TreeWalker(node, root);
+ var nonEmptyElementsMap = dom.schema.getNonEmptyElements();
+ do {
+ if (node.nodeType === 3 && $_52qop8kjfuw8l6v.trim(node.nodeValue).length !== 0) {
+ if (start) {
+ rng.setStart(node, 0);
+ } else {
+ rng.setEnd(node, node.nodeValue.length);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- uri = new URI(uri, { base_uri: self });
-
- // Not on same domain/port or protocol
- if ((uri.host != 'mce_host' && self.host != uri.host && uri.host) || self.port != uri.port ||
- (self.protocol != uri.protocol && uri.protocol !== "")) {
- return uri.getURI();
- }
-
- var tu = self.getURI(), uu = uri.getURI();
-
- // Allow usage of the base_uri when relative_urls = true
- if (tu == uu || (tu.charAt(tu.length - 1) == "/" && tu.substr(0, tu.length - 1) == uu)) {
- return tu;
- }
-
- output = self.toRelPath(self.path, uri.path);
-
- // Add query
- if (uri.query) {
- output += '?' + uri.query;
- }
-
- // Add anchor
- if (uri.anchor) {
- output += '#' + uri.anchor;
- }
-
- return output;
- },
-
- /**
- * Converts the specified URI into a absolute URI based on the current URI instance location.
- *
- * @method toAbsolute
- * @param {String} uri URI to convert into a relative path/URI.
- * @param {Boolean} noHost No host and protocol prefix.
- * @return {String} Absolute URI from the point specified in the current URI instance.
- * @example
- * // Converts an relative URL to an absolute URL url will be http://www.site.com/dir/somedir/somefile.htm
- * var url = new tinymce.util.URI('http://www.site.com/dir/').toAbsolute('somedir/somefile.htm');
- */
- toAbsolute: function (uri, noHost) {
- uri = new URI(uri, { base_uri: this });
-
- return uri.getURI(noHost && this.isSameOrigin(uri));
- },
-
- /**
- * Determine whether the given URI has the same origin as this URI. Based on RFC-6454.
- * Supports default ports for protocols listed in DEFAULT_PORTS. Unsupported protocols will fail safe: they
- * won't match, if the port specifications differ.
- *
- * @method isSameOrigin
- * @param {tinymce.util.URI} uri Uri instance to compare.
- * @returns {Boolean} True if the origins are the same.
- */
- isSameOrigin: function (uri) {
- if (this.host == uri.host && this.protocol == uri.protocol) {
- if (this.port == uri.port) {
- return true;
- }
-
- var defaultPort = DEFAULT_PORTS[this.protocol];
- if (defaultPort && ((this.port || defaultPort) == (uri.port || defaultPort))) {
- return true;
- }
- }
-
- return false;
- },
-
- /**
- * Converts a absolute path into a relative path.
- *
- * @method toRelPath
- * @param {String} base Base point to convert the path from.
- * @param {String} path Absolute path to convert into a relative path.
- */
- toRelPath: function (base, path) {
- var items, breakPoint = 0, out = '', i, l;
-
- // Split the paths
- base = base.substring(0, base.lastIndexOf('/'));
- base = base.split('/');
- items = path.split('/');
-
- if (base.length >= items.length) {
- for (i = 0, l = base.length; i < l; i++) {
- if (i >= items.length || base[i] != items[i]) {
- breakPoint = i + 1;
- break;
- }
- }
- }
-
- if (base.length < items.length) {
- for (i = 0, l = items.length; i < l; i++) {
- if (i >= base.length || base[i] != items[i]) {
- breakPoint = i + 1;
- break;
- }
- }
- }
-
- if (breakPoint === 1) {
- return path;
- }
-
- for (i = 0, l = base.length - (breakPoint - 1); i < l; i++) {
- out += "../";
- }
-
- for (i = breakPoint - 1, l = items.length; i < l; i++) {
- if (i != breakPoint - 1) {
- out += "/" + items[i];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
+ }
+ if (nonEmptyElementsMap[node.nodeName] && !/^(TD|TH)$/.test(node.nodeName)) {
+ if (start) {
+ rng.setStartBefore(node);
+ } else {
+ if (node.nodeName === 'BR') {
+ rng.setEndBefore(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- out += items[i];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ rng.setEndAfter(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return out;
- },
-
- /**
- * Converts a relative path into a absolute path.
- *
- * @method toAbsPath
- * @param {String} base Base point to convert the path from.
- * @param {String} path Relative path to convert into an absolute path.
- */
- toAbsPath: function (base, path) {
- var i, nb = 0, o = [], tr, outPath;
-
- // Split paths
- tr = /\/$/.test(path) ? '/' : '';
- base = base.split('/');
- path = path.split('/');
-
- // Remove empty chunks
- each(base, function (k) {
- if (k) {
- o.push(k);
- }
- });
-
- base = o;
-
- // Merge relURLParts chunks
- for (i = path.length - 1, o = []; i >= 0; i--) {
- // Ignore empty or .
- if (path[i].length === 0 || path[i] === ".") {
- continue;
- }
-
- // Is parent
- if (path[i] === '..') {
- nb++;
- continue;
- }
-
- // Move up
- if (nb > 0) {
- nb--;
- continue;
- }
-
- o.push(path[i]);
- }
-
- i = base.length - nb;
-
- // If /a/b/c or /
- if (i <= 0) {
- outPath = o.reverse().join('/');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
+ }
+ if ($_9fhi43ajfuw8l13.ie && $_9fhi43ajfuw8l13.ie < 11 && dom.isBlock(node) && dom.isEmpty(node)) {
+ if (start) {
+ rng.setStart(node, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ rng.setEnd(node, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Add front / if it's needed
- if (outPath.indexOf('/') !== 0) {
- outPath = '/' + outPath;
- }
-
- // Add traling / if it's needed
- if (tr && outPath.lastIndexOf('/') !== outPath.length - 1) {
- outPath += tr;
- }
-
- return outPath;
- },
-
- /**
- * Returns the full URI of the internal structure.
- *
- * @method getURI
- * @param {Boolean} noProtoHost Optional no host and protocol part. Defaults to false.
- */
- getURI: function (noProtoHost) {
- var s, self = this;
-
- // Rebuild source
- if (!self.source || noProtoHost) {
- s = '';
-
- if (!noProtoHost) {
- if (self.protocol) {
- s += self.protocol + '://';
- } else {
- s += '//';
- }
-
- if (self.userInfo) {
- s += self.userInfo + '@';
- }
-
- if (self.host) {
- s += self.host;
- }
-
- if (self.port) {
- s += ':' + self.port;
- }
- }
-
- if (self.path) {
- s += self.path;
- }
-
- if (self.query) {
- s += '?' + self.query;
- }
-
- if (self.anchor) {
- s += '#' + self.anchor;
- }
-
- self.source = s;
- }
-
- return self.source;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- URI.parseDataUri = function (uri) {
- var type, matches;
-
- uri = decodeURIComponent(uri).split(',');
-
- matches = /data:([^;]+)/.exec(uri[0]);
- if (matches) {
- type = matches[1];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } while (node = start ? walker.next() : walker.prev());
+ if (root.nodeName === 'BODY') {
+ if (start) {
+ rng.setStart(root, 0);
+ } else {
+ rng.setEnd(root, root.childNodes.length);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {
- type: type,
- data: uri[1]
- };
- };
-
- URI.getDocumentBaseUrl = function (loc) {
- var baseUrl;
-
- // Pass applewebdata:// and other non web protocols though
- if (loc.protocol.indexOf('http') !== 0 && loc.protocol !== 'file:') {
- baseUrl = loc.href;
- } else {
- baseUrl = loc.protocol + '//' + loc.host + loc.pathname;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var tableModel = $_1a7eqh18jfuw8lb9.immutable('element', 'width', 'rows');
+ var tableRow = $_1a7eqh18jfuw8lb9.immutable('element', 'cells');
+ var cellPosition = $_1a7eqh18jfuw8lb9.immutable('x', 'y');
+ var getSpan = function (td, key) {
+ var value = parseInt($_8g002u14jfuw8la5.get(td, key), 10);
+ return isNaN(value) ? 1 : value;
+ };
+ var fillout = function (table, x, y, tr, td) {
+ var rowspan = getSpan(td, 'rowspan');
+ var colspan = getSpan(td, 'colspan');
+ var rows = table.rows();
+ for (var y2 = y; y2 < y + rowspan; y2++) {
+ if (!rows[y2]) {
+ rows[y2] = tableRow($_bde3we6ijfuw8mdt.deep(tr), []);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (/^[^:]+:\/\/\/?[^\/]+\//.test(baseUrl)) {
- baseUrl = baseUrl.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
-
- if (!/[\/\\]$/.test(baseUrl)) {
- baseUrl += '/';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for (var x2 = x; x2 < x + colspan; x2++) {
+ var cells = rows[y2].cells();
+ cells[x2] = y2 === y && x2 === x ? td : $_bde3we6ijfuw8mdt.shallow(td);
+ }
+ }
+ };
+ var cellExists = function (table, x, y) {
+ var rows = table.rows();
+ var cells = rows[y] ? rows[y].cells() : [];
+ return !!cells[x];
+ };
+ var skipCellsX = function (table, x, y) {
+ while (cellExists(table, x, y)) {
+ x++;
+ }
+ return x;
+ };
+ var getWidth = function (rows) {
+ return $_9ek1bp4jfuw8kxg.foldl(rows, function (acc, row) {
+ return row.cells().length > acc ? row.cells().length : acc;
+ }, 0);
+ };
+ var findElementPos = function (table, element) {
+ var rows = table.rows();
+ for (var y = 0; y < rows.length; y++) {
+ var cells = rows[y].cells();
+ for (var x = 0; x < cells.length; x++) {
+ if ($_4fb96d1djfuw8lbl.eq(cells[x], element)) {
+ return Option.some(cellPosition(x, y));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return Option.none();
+ };
+ var extractRows = function (table, sx, sy, ex, ey) {
+ var newRows = [];
+ var rows = table.rows();
+ for (var y = sy; y <= ey; y++) {
+ var cells = rows[y].cells();
+ var slice = sx < ex ? cells.slice(sx, ex + 1) : cells.slice(ex, sx + 1);
+ newRows.push(tableRow(rows[y].element(), slice));
+ }
+ return newRows;
+ };
+ var subTable = function (table, startPos, endPos) {
+ var sx = startPos.x(), sy = startPos.y();
+ var ex = endPos.x(), ey = endPos.y();
+ var newRows = sy < ey ? extractRows(table, sx, sy, ex, ey) : extractRows(table, sx, ey, ex, sy);
+ return tableModel(table.element(), getWidth(newRows), newRows);
+ };
+ var createDomTable = function (table, rows) {
+ var tableElement = $_bde3we6ijfuw8mdt.shallow(table.element());
+ var tableBody = $_c9h6qlzjfuw8l98.fromTag('tbody');
+ $_84jjow2vjfuw8lml.append(tableBody, rows);
+ $_doli6x2kjfuw8lky.append(tableElement, tableBody);
+ return tableElement;
+ };
+ var modelRowsToDomRows = function (table) {
+ return $_9ek1bp4jfuw8kxg.map(table.rows(), function (row) {
+ var cells = $_9ek1bp4jfuw8kxg.map(row.cells(), function (cell) {
+ var td = $_bde3we6ijfuw8mdt.deep(cell);
+ $_8g002u14jfuw8la5.remove(td, 'colspan');
+ $_8g002u14jfuw8la5.remove(td, 'rowspan');
+ return td;
+ });
+ var tr = $_bde3we6ijfuw8mdt.shallow(row.element());
+ $_84jjow2vjfuw8lml.append(tr, cells);
+ return tr;
+ });
+ };
+ var fromDom$2 = function (tableElm) {
+ var table = tableModel($_bde3we6ijfuw8mdt.shallow(tableElm), 0, []);
+ $_9ek1bp4jfuw8kxg.each($_ryxde2gjfuw8lkk.descendants(tableElm, 'tr'), function (tr, y) {
+ $_9ek1bp4jfuw8kxg.each($_ryxde2gjfuw8lkk.descendants(tr, 'td,th'), function (td, x) {
+ fillout(table, skipCellsX(table, x, y), y, tr, td);
+ });
+ });
+ return tableModel(table.element(), getWidth(table.rows()), table.rows());
+ };
+ var toDom = function (table) {
+ return createDomTable(table, modelRowsToDomRows(table));
+ };
+ var subsection = function (table, startElement, endElement) {
+ return findElementPos(table, startElement).bind(function (startPos) {
+ return findElementPos(table, endElement).map(function (endPos) {
+ return subTable(table, startPos, endPos);
+ });
+ });
+ };
+ var $_ep4zvn6ljfuw8mee = {
+ fromDom: fromDom$2,
+ toDom: toDom,
+ subsection: subsection
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return baseUrl;
- };
-
- return URI;
- }
-);
-
-/**
- * Editor.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/*jshint scripturl:true */
-
-/**
- * Include the base event class documentation.
- *
- * @include ../../../../../tools/docs/tinymce.Event.js
- */
-
-/**
- * This class contains the core logic for a TinyMCE editor.
- *
- * @class tinymce.Editor
- * @mixes tinymce.util.Observable
- * @example
- * // Add a class to all paragraphs in the editor.
- * tinymce.activeEditor.dom.addClass(tinymce.activeEditor.dom.select('p'), 'someclass');
- *
- * // Gets the current editors selection as text
- * tinymce.activeEditor.selection.getContent({format: 'text'});
- *
- * // Creates a new editor instance
- * var ed = new tinymce.Editor('textareaid', {
- * some_setting: 1
- * }, tinymce.EditorManager);
- *
- * ed.render();
- */
-define(
- 'tinymce.core.Editor',
- [
- 'tinymce.core.AddOnManager',
- 'tinymce.core.dom.DomQuery',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.EditorCommands',
- 'tinymce.core.EditorFocus',
- 'tinymce.core.EditorObservable',
- 'tinymce.core.EditorSettings',
- 'tinymce.core.Env',
- 'tinymce.core.html.Serializer',
- 'tinymce.core.init.Render',
- 'tinymce.core.Mode',
- 'tinymce.core.Shortcuts',
- 'tinymce.core.ui.Sidebar',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.URI',
- 'tinymce.core.util.Uuid'
- ],
- function (
- AddOnManager, DomQuery, DOMUtils, EditorCommands, EditorFocus, EditorObservable, EditorSettings, Env, Serializer, Render, Mode, Shortcuts, Sidebar, Tools,
- URI, Uuid
- ) {
- // Shorten these names
- var DOM = DOMUtils.DOM;
- var extend = Tools.extend, each = Tools.each;
- var trim = Tools.trim, resolve = Tools.resolve;
- var ie = Env.ie;
-
- /**
- * Include Editor API docs.
- *
- * @include ../../../../../tools/docs/tinymce.Editor.js
- */
-
- /**
- * Constructs a editor instance by id.
- *
- * @constructor
- * @method Editor
- * @param {String} id Unique id for the editor.
- * @param {Object} settings Settings for the editor.
- * @param {tinymce.EditorManager} editorManager EditorManager instance.
- */
- function Editor(id, settings, editorManager) {
- var self = this, documentBaseUrl, baseUri;
-
- documentBaseUrl = self.documentBaseUrl = editorManager.documentBaseURL;
- baseUri = editorManager.baseURI;
-
- /**
- * Name/value collection with editor settings.
- *
- * @property settings
- * @type Object
- * @example
- * // Get the value of the theme setting
- * tinymce.activeEditor.windowManager.alert("You are using the " + tinymce.activeEditor.settings.theme + " theme");
- */
- settings = EditorSettings.getEditorSettings(self, id, documentBaseUrl, editorManager.defaultSettings, settings);
- self.settings = settings;
-
- AddOnManager.language = settings.language || 'en';
- AddOnManager.languageLoad = settings.language_load;
- AddOnManager.baseURL = editorManager.baseURL;
-
- /**
- * Editor instance id, normally the same as the div/textarea that was replaced.
- *
- * @property id
- * @type String
- */
- self.id = id;
-
- /**
- * State to force the editor to return false on a isDirty call.
- *
- * @property isNotDirty
- * @type Boolean
- * @deprecated Use editor.setDirty instead.
- */
- self.setDirty(false);
-
- /**
- * Name/Value object containing plugin instances.
- *
- * @property plugins
- * @type Object
- * @example
- * // Execute a method inside a plugin directly
- * tinymce.activeEditor.plugins.someplugin.someMethod();
- */
- self.plugins = {};
-
- /**
- * URI object to document configured for the TinyMCE instance.
- *
- * @property documentBaseURI
- * @type tinymce.util.URI
- * @example
- * // Get relative URL from the location of document_base_url
- * tinymce.activeEditor.documentBaseURI.toRelative('/somedir/somefile.htm');
- *
- * // Get absolute URL from the location of document_base_url
- * tinymce.activeEditor.documentBaseURI.toAbsolute('somefile.htm');
- */
- self.documentBaseURI = new URI(settings.document_base_url, {
- base_uri: baseUri
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var findParentListContainer = function (parents) {
+ return $_9ek1bp4jfuw8kxg.find(parents, function (elm) {
+ return $_eaw33d10jfuw8l9f.name(elm) === 'ul' || $_eaw33d10jfuw8l9f.name(elm) === 'ol';
+ });
+ };
+ var getFullySelectedListWrappers = function (parents, rng) {
+ return $_9ek1bp4jfuw8kxg.find(parents, function (elm) {
+ return $_eaw33d10jfuw8l9f.name(elm) === 'li' && hasAllContentsSelected(elm, rng);
+ }).fold($_68e81l6jfuw8kyc.constant([]), function (li) {
+ return findParentListContainer(parents).map(function (listCont) {
+ return [
+ $_c9h6qlzjfuw8l98.fromTag('li'),
+ $_c9h6qlzjfuw8l98.fromTag($_eaw33d10jfuw8l9f.name(listCont))
+ ];
+ }).getOr([]);
+ });
+ };
+ var wrap$3 = function (innerElm, elms) {
+ var wrapped = $_9ek1bp4jfuw8kxg.foldl(elms, function (acc, elm) {
+ $_doli6x2kjfuw8lky.append(elm, acc);
+ return elm;
+ }, innerElm);
+ return elms.length > 0 ? $_aj5cq36jjfuw8mdv.fromElements([wrapped]) : wrapped;
+ };
+ var directListWrappers = function (commonAnchorContainer) {
+ if (isListItem(commonAnchorContainer)) {
+ return $_2j4g5u17jfuw8lav.parent(commonAnchorContainer).filter(isList).fold($_68e81l6jfuw8kyc.constant([]), function (listElm) {
+ return [
+ commonAnchorContainer,
+ listElm
+ ];
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ return isList(commonAnchorContainer) ? [commonAnchorContainer] : [];
+ }
+ };
+ var getWrapElements = function (rootNode, rng) {
+ var commonAnchorContainer = $_c9h6qlzjfuw8l98.fromDom(rng.commonAncestorContainer);
+ var parents = $_3t5pi43ejfuw8lq0.parentsAndSelf(commonAnchorContainer, rootNode);
+ var wrapElements = $_9ek1bp4jfuw8kxg.filter(parents, function (elm) {
+ return isInline(elm) || isHeading(elm);
+ });
+ var listWrappers = getFullySelectedListWrappers(parents, rng);
+ var allWrappers = wrapElements.concat(listWrappers.length ? listWrappers : directListWrappers(commonAnchorContainer));
+ return $_9ek1bp4jfuw8kxg.map(allWrappers, $_bde3we6ijfuw8mdt.shallow);
+ };
+ var emptyFragment = function () {
+ return $_aj5cq36jjfuw8mdv.fromElements([]);
+ };
+ var getFragmentFromRange = function (rootNode, rng) {
+ return wrap$3($_c9h6qlzjfuw8l98.fromDom(rng.cloneContents()), getWrapElements(rootNode, rng));
+ };
+ var getParentTable = function (rootElm, cell) {
+ return $_94zo1v3cjfuw8lpg.ancestor(cell, 'table', $_68e81l6jfuw8kyc.curry($_4fb96d1djfuw8lbl.eq, rootElm));
+ };
+ var getTableFragment = function (rootNode, selectedTableCells) {
+ return getParentTable(rootNode, selectedTableCells[0]).bind(function (tableElm) {
+ var firstCell = selectedTableCells[0];
+ var lastCell = selectedTableCells[selectedTableCells.length - 1];
+ var fullTableModel = $_ep4zvn6ljfuw8mee.fromDom(tableElm);
+ return $_ep4zvn6ljfuw8mee.subsection(fullTableModel, firstCell, lastCell).map(function (sectionedTableModel) {
+ return $_aj5cq36jjfuw8mdv.fromElements([$_ep4zvn6ljfuw8mee.toDom(sectionedTableModel)]);
+ });
+ }).getOrThunk(emptyFragment);
+ };
+ var getSelectionFragment = function (rootNode, ranges) {
+ return ranges.length > 0 && ranges[0].collapsed ? emptyFragment() : getFragmentFromRange(rootNode, ranges[0]);
+ };
+ var read$3 = function (rootNode, ranges) {
+ var selectedCells = $_6icyb83tjfuw8lwy.getCellsFromElementOrRanges(ranges, rootNode);
+ return selectedCells.length > 0 ? getTableFragment(rootNode, selectedCells) : getSelectionFragment(rootNode, ranges);
+ };
+ var $_f00v4h6hjfuw8mde = { read: read$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * URI object to current document that holds the TinyMCE editor instance.
- *
- * @property baseURI
- * @type tinymce.util.URI
- * @example
- * // Get relative URL from the location of the API
- * tinymce.activeEditor.baseURI.toRelative('/somedir/somefile.htm');
- *
- * // Get absolute URL from the location of the API
- * tinymce.activeEditor.baseURI.toAbsolute('somefile.htm');
- */
- self.baseURI = baseUri;
-
- /**
- * Array with CSS files to load into the iframe.
- *
- * @property contentCSS
- * @type Array
- */
- self.contentCSS = [];
-
- /**
- * Array of CSS styles to add to head of document when the editor loads.
- *
- * @property contentStyles
- * @type Array
- */
- self.contentStyles = [];
-
- // Creates all events like onClick, onSetContent etc see Editor.Events.js for the actual logic
- self.shortcuts = new Shortcuts(self);
- self.loadedCSS = {};
- self.editorCommands = new EditorCommands(self);
- self.suffix = editorManager.suffix;
- self.editorManager = editorManager;
- self.inline = settings.inline;
-
- if (settings.cache_suffix) {
- Env.cacheSuffix = settings.cache_suffix.replace(/^[\?\&]+/, '');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getContent = function (editor, args) {
+ var rng = editor.selection.getRng(), tmpElm = editor.dom.create('body');
+ var sel = editor.selection.getSel();
+ var fragment;
+ var ranges = $_2shlx66fjfuw8md6.processRanges(editor, $_asx40h3ujfuw8lx3.getRanges(sel));
+ args = args || {};
+ args.get = true;
+ args.format = args.format || 'html';
+ args.selection = true;
+ args = editor.fire('BeforeGetContent', args);
+ if (args.isDefaultPrevented()) {
+ editor.fire('GetContent', args);
+ return args.content;
+ }
+ if (args.format === 'text') {
+ return editor.selection.isCollapsed() ? '' : $_dpfg1321jfuw8lhn.trim(rng.text || (sel.toString ? sel.toString() : ''));
+ }
+ if (rng.cloneContents) {
+ fragment = args.contextual ? $_f00v4h6hjfuw8mde.read($_c9h6qlzjfuw8l98.fromDom(editor.getBody()), ranges).dom() : rng.cloneContents();
+ if (fragment) {
+ tmpElm.appendChild(fragment);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (rng.item !== undefined || rng.htmlText !== undefined) {
+ tmpElm.innerHTML = '<br>' + (rng.item ? rng.item(0).outerHTML : rng.htmlText);
+ tmpElm.removeChild(tmpElm.firstChild);
+ } else {
+ tmpElm.innerHTML = rng.toString();
+ }
+ args.getInner = true;
+ var content = editor.selection.serializer.serialize(tmpElm, args);
+ if (args.format === 'tree') {
+ return content;
+ }
+ args.content = editor.selection.isCollapsed() ? '' : content;
+ editor.fire('GetContent', args);
+ return args.content;
+ };
+ var $_elw9bs6gjfuw8md8 = { getContent: getContent };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (settings.override_viewport === false) {
- Env.overrideViewPort = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setContent = function (editor, content, args) {
+ var rng = editor.selection.getRng(), caretNode;
+ var doc = editor.getDoc();
+ var frag, temp;
+ args = args || { format: 'html' };
+ args.set = true;
+ args.selection = true;
+ args.content = content;
+ if (!args.no_events) {
+ args = editor.fire('BeforeSetContent', args);
+ if (args.isDefaultPrevented()) {
+ editor.fire('SetContent', args);
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Call setup
- editorManager.fire('SetupEditor', self);
- self.execCallback('setup', self);
-
- /**
- * Dom query instance with default scope to the editor document and default element is the body of the editor.
- *
- * @property $
- * @type tinymce.dom.DomQuery
- * @example
- * tinymce.activeEditor.$('p').css('color', 'red');
- * tinymce.activeEditor.$().append('<p>new</p>');
- */
- self.$ = DomQuery.overrideDefaults(function () {
- return {
- context: self.inline ? self.getBody() : self.getDoc(),
- element: self.getBody()
- };
- });
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- Editor.prototype = {
- /**
- * Renders the editor/adds it to the page.
- *
- * @method render
- */
- render: function () {
- Render.render(this);
- },
-
- /**
- * Focuses/activates the editor. This will set this editor as the activeEditor in the tinymce collection
- * it will also place DOM focus inside the editor.
- *
- * @method focus
- * @param {Boolean} skipFocus Skip DOM focus. Just set is as the active editor.
- */
- focus: function (skipFocus) {
- EditorFocus.focus(this, skipFocus);
- },
-
- /**
- * Executes a legacy callback. This method is useful to call old 2.x option callbacks.
- * There new event model is a better way to add callback so this method might be removed in the future.
- *
- * @method execCallback
- * @param {String} name Name of the callback to execute.
- * @return {Object} Return value passed from callback function.
- */
- execCallback: function (name) {
- var self = this, callback = self.settings[name], scope;
-
- if (!callback) {
- return;
- }
-
- // Look through lookup
- if (self.callbackLookup && (scope = self.callbackLookup[name])) {
- callback = scope.func;
- scope = scope.scope;
- }
-
- if (typeof callback === 'string') {
- scope = callback.replace(/\.\w+$/, '');
- scope = scope ? resolve(scope) : 0;
- callback = resolve(callback);
- self.callbackLookup = self.callbackLookup || {};
- self.callbackLookup[name] = { func: callback, scope: scope };
- }
-
- return callback.apply(scope || self, Array.prototype.slice.call(arguments, 1));
- },
-
- /**
- * Translates the specified string by replacing variables with language pack items it will also check if there is
- * a key matching the input.
- *
- * @method translate
- * @param {String} text String to translate by the language pack data.
- * @return {String} Translated string.
- */
- translate: function (text) {
- if (text && Tools.is(text, 'string')) {
- var lang = this.settings.language || 'en', i18n = this.editorManager.i18n;
-
- text = i18n.data[lang + '.' + text] || text.replace(/\{\#([^\}]+)\}/g, function (a, b) {
- return i18n.data[lang + '.' + b] || '{#' + b + '}';
- });
- }
-
- return this.editorManager.translate(text);
- },
-
- /**
- * Returns a language pack item by name/key.
- *
- * @method getLang
- * @param {String} name Name/key to get from the language pack.
- * @param {String} defaultVal Optional default value to retrieve.
- */
- getLang: function (name, defaultVal) {
- return (
- this.editorManager.i18n.data[(this.settings.language || 'en') + '.' + name] ||
- (defaultVal !== undefined ? defaultVal : '{#' + name + '}')
- );
- },
-
- /**
- * Returns a configuration parameter by name.
- *
- * @method getParam
- * @param {String} name Configruation parameter to retrieve.
- * @param {String} defaultVal Optional default value to return.
- * @param {String} type Optional type parameter.
- * @return {String} Configuration parameter value or default value.
- * @example
- * // Returns a specific config value from the currently active editor
- * var someval = tinymce.activeEditor.getParam('myvalue');
- *
- * // Returns a specific config value from a specific editor instance by id
- * var someval2 = tinymce.get('my_editor').getParam('myvalue');
- */
- getParam: function (name, defaultVal, type) {
- var value = name in this.settings ? this.settings[name] : defaultVal, output;
-
- if (type === 'hash') {
- output = {};
-
- if (typeof value === 'string') {
- each(value.indexOf('=') > 0 ? value.split(/[;,](?![^=;,]*(?:[;,]|$))/) : value.split(','), function (value) {
- value = value.split('=');
-
- if (value.length > 1) {
- output[trim(value[0])] = trim(value[1]);
- } else {
- output[trim(value[0])] = trim(value);
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ content = args.content;
+ if (rng.insertNode) {
+ content += '<span id="__caret">_</span>';
+ if (rng.startContainer === doc && rng.endContainer === doc) {
+ doc.body.innerHTML = content;
+ } else {
+ rng.deleteContents();
+ if (doc.body.childNodes.length === 0) {
+ doc.body.innerHTML = content;
+ } else {
+ if (rng.createContextualFragment) {
+ rng.insertNode(rng.createContextualFragment(content));
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- output = value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ frag = doc.createDocumentFragment();
+ temp = doc.createElement('div');
+ frag.appendChild(temp);
+ temp.outerHTML = content;
+ rng.insertNode(frag);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return output;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ caretNode = editor.dom.get('__caret');
+ rng = doc.createRange();
+ rng.setStartBefore(caretNode);
+ rng.setEndBefore(caretNode);
+ editor.selection.setRng(rng);
+ editor.dom.remove('__caret');
+ try {
+ editor.selection.setRng(rng);
+ } catch (ex) {
+ }
+ } else {
+ if (rng.item) {
+ doc.execCommand('Delete', false, null);
+ rng = editor.getRng();
+ }
+ if (/^\s+/.test(content)) {
+ rng.pasteHTML('<span id="__mce_tmp">_</span>' + content);
+ editor.dom.remove('__mce_tmp');
+ } else {
+ rng.pasteHTML(content);
+ }
+ }
+ if (!args.no_events) {
+ editor.fire('SetContent', args);
+ }
+ };
+ var $_629mjb6mjfuw8mf2 = { setContent: setContent };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return value;
- },
-
- /**
- * Dispatches out a onNodeChange event to all observers. This method should be called when you
- * need to update the UI states or element path etc.
- *
- * @method nodeChanged
- * @param {Object} args Optional args to pass to NodeChange event handlers.
- */
- nodeChanged: function (args) {
- this._nodeChangeDispatcher.nodeChanged(args);
- },
-
- /**
- * Adds a button that later gets created by the theme in the editors toolbars.
- *
- * @method addButton
- * @param {String} name Button name to add.
- * @param {Object} settings Settings object with title, cmd etc.
- * @example
- * // Adds a custom button to the editor that inserts contents when clicked
- * tinymce.init({
- * ...
- *
- * toolbar: 'example'
- *
- * setup: function(ed) {
- * ed.addButton('example', {
- * title: 'My title',
- * image: '../js/tinymce/plugins/example/img/example.gif',
- * onclick: function() {
- * ed.insertContent('Hello world!!');
- * }
- * });
- * }
- * });
- */
- addButton: function (name, settings) {
- var self = this;
-
- if (settings.cmd) {
- settings.onclick = function () {
- self.execCommand(settings.cmd);
- };
- }
-
- if (!settings.text && !settings.icon) {
- settings.icon = name;
- }
-
- self.buttons = self.buttons || {};
- settings.tooltip = settings.tooltip || settings.title;
- self.buttons[name] = settings;
- },
-
- /**
- * Adds a sidebar for the editor instance.
- *
- * @method addSidebar
- * @param {String} name Sidebar name to add.
- * @param {Object} settings Settings object with icon, onshow etc.
- * @example
- * // Adds a custom sidebar that when clicked logs the panel element
- * tinymce.init({
- * ...
- * setup: function(ed) {
- * ed.addSidebar('example', {
- * tooltip: 'My sidebar',
- * icon: 'my-side-bar',
- * onshow: function(api) {
- * console.log(api.element());
- * }
- * });
- * }
- * });
- */
- addSidebar: function (name, settings) {
- return Sidebar.add(this, name, settings);
- },
-
- /**
- * Adds a menu item to be used in the menus of the theme. There might be multiple instances
- * of this menu item for example it might be used in the main menus of the theme but also in
- * the context menu so make sure that it's self contained and supports multiple instances.
- *
- * @method addMenuItem
- * @param {String} name Menu item name to add.
- * @param {Object} settings Settings object with title, cmd etc.
- * @example
- * // Adds a custom menu item to the editor that inserts contents when clicked
- * // The context option allows you to add the menu item to an existing default menu
- * tinymce.init({
- * ...
- *
- * setup: function(ed) {
- * ed.addMenuItem('example', {
- * text: 'My menu item',
- * context: 'tools',
- * onclick: function() {
- * ed.insertContent('Hello world!!');
- * }
- * });
- * }
- * });
- */
- addMenuItem: function (name, settings) {
- var self = this;
-
- if (settings.cmd) {
- settings.onclick = function () {
- self.execCommand(settings.cmd);
- };
- }
-
- self.menuItems = self.menuItems || {};
- self.menuItems[name] = settings;
- },
-
- /**
- * Adds a contextual toolbar to be rendered when the selector matches.
- *
- * @method addContextToolbar
- * @param {function/string} predicate Predicate that needs to return true if provided strings get converted into CSS predicates.
- * @param {String/Array} items String or array with items to add to the context toolbar.
- */
- addContextToolbar: function (predicate, items) {
- var self = this, selector;
-
- self.contextToolbars = self.contextToolbars || [];
-
- // Convert selector to predicate
- if (typeof predicate == "string") {
- selector = predicate;
- predicate = function (elm) {
- return self.dom.is(elm, selector);
- };
- }
-
- self.contextToolbars.push({
- id: Uuid.uuid('mcet'),
- predicate: predicate,
- items: items
- });
- },
-
- /**
- * Adds a custom command to the editor, you can also override existing commands with this method.
- * The command that you add can be executed with execCommand.
- *
- * @method addCommand
- * @param {String} name Command name to add/override.
- * @param {addCommandCallback} callback Function to execute when the command occurs.
- * @param {Object} scope Optional scope to execute the function in.
- * @example
- * // Adds a custom command that later can be executed using execCommand
- * tinymce.init({
- * ...
- *
- * setup: function(ed) {
- * // Register example command
- * ed.addCommand('mycommand', function(ui, v) {
- * ed.windowManager.alert('Hello world!! Selection: ' + ed.selection.getContent({format: 'text'}));
- * });
- * }
- * });
- */
- addCommand: function (name, callback, scope) {
- /**
- * Callback function that gets called when a command is executed.
- *
- * @callback addCommandCallback
- * @param {Boolean} ui Display UI state true/false.
- * @param {Object} value Optional value for command.
- * @return {Boolean} True/false state if the command was handled or not.
- */
- this.editorCommands.addCommand(name, callback, scope);
- },
-
- /**
- * Adds a custom query state command to the editor, you can also override existing commands with this method.
- * The command that you add can be executed with queryCommandState function.
- *
- * @method addQueryStateHandler
- * @param {String} name Command name to add/override.
- * @param {addQueryStateHandlerCallback} callback Function to execute when the command state retrieval occurs.
- * @param {Object} scope Optional scope to execute the function in.
- */
- addQueryStateHandler: function (name, callback, scope) {
- /**
- * Callback function that gets called when a queryCommandState is executed.
- *
- * @callback addQueryStateHandlerCallback
- * @return {Boolean} True/false state if the command is enabled or not like is it bold.
- */
- this.editorCommands.addQueryStateHandler(name, callback, scope);
- },
-
- /**
- * Adds a custom query value command to the editor, you can also override existing commands with this method.
- * The command that you add can be executed with queryCommandValue function.
- *
- * @method addQueryValueHandler
- * @param {String} name Command name to add/override.
- * @param {addQueryValueHandlerCallback} callback Function to execute when the command value retrieval occurs.
- * @param {Object} scope Optional scope to execute the function in.
- */
- addQueryValueHandler: function (name, callback, scope) {
- /**
- * Callback function that gets called when a queryCommandValue is executed.
- *
- * @callback addQueryValueHandlerCallback
- * @return {Object} Value of the command or undefined.
- */
- this.editorCommands.addQueryValueHandler(name, callback, scope);
- },
-
- /**
- * Adds a keyboard shortcut for some command or function.
- *
- * @method addShortcut
- * @param {String} pattern Shortcut pattern. Like for example: ctrl+alt+o.
- * @param {String} desc Text description for the command.
- * @param {String/Function} cmdFunc Command name string or function to execute when the key is pressed.
- * @param {Object} sc Optional scope to execute the function in.
- * @return {Boolean} true/false state if the shortcut was added or not.
- */
- addShortcut: function (pattern, desc, cmdFunc, scope) {
- this.shortcuts.add(pattern, desc, cmdFunc, scope);
- },
-
- /**
- * Executes a command on the current instance. These commands can be TinyMCE internal commands prefixed with "mce" or
- * they can be build in browser commands such as "Bold". A compleate list of browser commands is available on MSDN or Mozilla.org.
- * This function will dispatch the execCommand function on each plugin, theme or the execcommand_callback option if none of these
- * return true it will handle the command as a internal browser command.
- *
- * @method execCommand
- * @param {String} cmd Command name to execute, for example mceLink or Bold.
- * @param {Boolean} ui True/false state if a UI (dialog) should be presented or not.
- * @param {mixed} value Optional command value, this can be anything.
- * @param {Object} args Optional arguments object.
- */
- execCommand: function (cmd, ui, value, args) {
- return this.editorCommands.execCommand(cmd, ui, value, args);
- },
-
- /**
- * Returns a command specific state, for example if bold is enabled or not.
- *
- * @method queryCommandState
- * @param {string} cmd Command to query state from.
- * @return {Boolean} Command specific state, for example if bold is enabled or not.
- */
- queryCommandState: function (cmd) {
- return this.editorCommands.queryCommandState(cmd);
- },
-
- /**
- * Returns a command specific value, for example the current font size.
- *
- * @method queryCommandValue
- * @param {string} cmd Command to query value from.
- * @return {Object} Command specific value, for example the current font size.
- */
- queryCommandValue: function (cmd) {
- return this.editorCommands.queryCommandValue(cmd);
- },
-
- /**
- * Returns true/false if the command is supported or not.
- *
- * @method queryCommandSupported
- * @param {String} cmd Command that we check support for.
- * @return {Boolean} true/false if the command is supported or not.
- */
- queryCommandSupported: function (cmd) {
- return this.editorCommands.queryCommandSupported(cmd);
- },
-
- /**
- * Shows the editor and hides any textarea/div that the editor is supposed to replace.
- *
- * @method show
- */
- show: function () {
- var self = this;
-
- if (self.hidden) {
- self.hidden = false;
-
- if (self.inline) {
- self.getBody().contentEditable = true;
- } else {
- DOM.show(self.getContainer());
- DOM.hide(self.id);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getEndpointElement = function (root, rng, start, real, resolve) {
+ var container = start ? rng.startContainer : rng.endContainer;
+ var offset = start ? rng.startOffset : rng.endOffset;
+ return Option.from(container).map($_c9h6qlzjfuw8l98.fromDom).map(function (elm) {
+ return !real || !rng.collapsed ? $_2j4g5u17jfuw8lav.child(elm, resolve(elm, offset)).getOr(elm) : elm;
+ }).bind(function (elm) {
+ return $_eaw33d10jfuw8l9f.isElement(elm) ? Option.some(elm) : $_2j4g5u17jfuw8lav.parent(elm);
+ }).map(function (elm) {
+ return elm.dom();
+ }).getOr(root);
+ };
+ var getStart$2 = function (root, rng, real) {
+ return getEndpointElement(root, rng, true, real, function (elm, offset) {
+ return Math.min($_2j4g5u17jfuw8lav.childNodesCount(elm), offset);
+ });
+ };
+ var getEnd = function (root, rng, real) {
+ return getEndpointElement(root, rng, false, real, function (elm, offset) {
+ return offset > 0 ? offset - 1 : offset;
+ });
+ };
+ var skipEmptyTextNodes = function (node, forwards) {
+ var orig = node;
+ while (node && $_ey7ka11qjfuw8ldg.isText(node) && node.length === 0) {
+ node = forwards ? node.nextSibling : node.previousSibling;
+ }
+ return node || orig;
+ };
+ var getNode$1 = function (root, rng) {
+ var elm, startContainer, endContainer, startOffset, endOffset;
+ if (!rng) {
+ return root;
+ }
+ startContainer = rng.startContainer;
+ endContainer = rng.endContainer;
+ startOffset = rng.startOffset;
+ endOffset = rng.endOffset;
+ elm = rng.commonAncestorContainer;
+ if (!rng.collapsed) {
+ if (startContainer === endContainer) {
+ if (endOffset - startOffset < 2) {
+ if (startContainer.hasChildNodes()) {
+ elm = startContainer.childNodes[startOffset];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.load();
- self.fire('show');
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Hides the editor and shows any textarea/div that the editor is supposed to replace.
- *
- * @method hide
- */
- hide: function () {
- var self = this, doc = self.getDoc();
-
- if (!self.hidden) {
- // Fixed bug where IE has a blinking cursor left from the editor
- if (ie && doc && !self.inline) {
- doc.execCommand('SelectAll');
- }
-
- // We must save before we hide so Safari doesn't crash
- self.save();
-
- if (self.inline) {
- self.getBody().contentEditable = false;
-
- // Make sure the editor gets blurred
- if (self == self.editorManager.focusedEditor) {
- self.editorManager.focusedEditor = null;
- }
- } else {
- DOM.hide(self.getContainer());
- DOM.setStyle(self.id, 'display', self.orgDisplay);
- }
-
- self.hidden = true;
- self.fire('hide');
- }
- },
-
- /**
- * Returns true/false if the editor is hidden or not.
- *
- * @method isHidden
- * @return {Boolean} True/false if the editor is hidden or not.
- */
- isHidden: function () {
- return !!this.hidden;
- },
-
- /**
- * Sets the progress state, this will display a throbber/progess for the editor.
- * This is ideal for asynchronous operations like an AJAX save call.
- *
- * @method setProgressState
- * @param {Boolean} state Boolean state if the progress should be shown or hidden.
- * @param {Number} time Optional time to wait before the progress gets shown.
- * @return {Boolean} Same as the input state.
- * @example
- * // Show progress for the active editor
- * tinymce.activeEditor.setProgressState(true);
- *
- * // Hide progress for the active editor
- * tinymce.activeEditor.setProgressState(false);
- *
- * // Show progress after 3 seconds
- * tinymce.activeEditor.setProgressState(true, 3000);
- */
- setProgressState: function (state, time) {
- this.fire('ProgressState', { state: state, time: time });
- },
-
- /**
- * Loads contents from the textarea or div element that got converted into an editor instance.
- * This method will move the contents from that textarea or div into the editor by using setContent
- * so all events etc that method has will get dispatched as well.
- *
- * @method load
- * @param {Object} args Optional content object, this gets passed around through the whole load process.
- * @return {String} HTML string that got set into the editor.
- */
- load: function (args) {
- var self = this, elm = self.getElement(), html;
-
- if (self.removed) {
- return '';
- }
-
- if (elm) {
- args = args || {};
- args.load = true;
-
- html = self.setContent(elm.value !== undefined ? elm.value : elm.innerHTML, args);
- args.element = elm;
-
- if (!args.no_events) {
- self.fire('LoadContent', args);
- }
-
- args.element = elm = null;
-
- return html;
- }
- },
-
- /**
- * Saves the contents from a editor out to the textarea or div element that got converted into an editor instance.
- * This method will move the HTML contents from the editor into that textarea or div by getContent
- * so all events etc that method has will get dispatched as well.
- *
- * @method save
- * @param {Object} args Optional content object, this gets passed around through the whole save process.
- * @return {String} HTML string that got set into the textarea/div.
- */
- save: function (args) {
- var self = this, elm = self.getElement(), html, form;
-
- if (!elm || !self.initialized || self.removed) {
- return;
- }
-
- args = args || {};
- args.save = true;
-
- args.element = elm;
- html = args.content = self.getContent(args);
-
- if (!args.no_events) {
- self.fire('SaveContent', args);
- }
-
- // Always run this internal event
- if (args.format == 'raw') {
- self.fire('RawSaveContent', args);
- }
-
- html = args.content;
-
- if (!/TEXTAREA|INPUT/i.test(elm.nodeName)) {
- // Update DIV element when not in inline mode
- if (!self.inline) {
- elm.innerHTML = html;
- }
-
- // Update hidden form element
- if ((form = DOM.getParent(self.id, 'form'))) {
- each(form.elements, function (elm) {
- if (elm.name == self.id) {
- elm.value = html;
- return false;
- }
- });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (startContainer.nodeType === 3 && endContainer.nodeType === 3) {
+ if (startContainer.length === startOffset) {
+ startContainer = skipEmptyTextNodes(startContainer.nextSibling, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- elm.value = html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ startContainer = startContainer.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- args.element = elm = null;
-
- if (args.set_dirty !== false) {
- self.setDirty(false);
- }
-
- return html;
- },
-
- /**
- * Sets the specified content to the editor instance, this will cleanup the content before it gets set using
- * the different cleanup rules options.
- *
- * @method setContent
- * @param {String} content Content to set to editor, normally HTML contents but can be other formats as well.
- * @param {Object} args Optional content object, this gets passed around through the whole set process.
- * @return {String} HTML string that got set into the editor.
- * @example
- * // Sets the HTML contents of the activeEditor editor
- * tinymce.activeEditor.setContent('<span>some</span> html');
- *
- * // Sets the raw contents of the activeEditor editor
- * tinymce.activeEditor.setContent('<span>some</span> html', {format: 'raw'});
- *
- * // Sets the content of a specific editor (my_editor in this example)
- * tinymce.get('my_editor').setContent(data);
- *
- * // Sets the bbcode contents of the activeEditor editor if the bbcode plugin was added
- * tinymce.activeEditor.setContent('[b]some[/b] html', {format: 'bbcode'});
- */
- setContent: function (content, args) {
- var self = this, body = self.getBody(), forcedRootBlockName, padd;
-
- // Setup args object
- args = args || {};
- args.format = args.format || 'html';
- args.set = true;
- args.content = content;
-
- // Do preprocessing
- if (!args.no_events) {
- self.fire('BeforeSetContent', args);
- }
-
- content = args.content;
-
- // Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
- // It will also be impossible to place the caret in the editor unless there is a BR element present
- if (content.length === 0 || /^\s+$/.test(content)) {
- padd = ie && ie < 11 ? '' : '<br data-mce-bogus="1">';
-
- // Todo: There is a lot more root elements that need special padding
- // so separate this and add all of them at some point.
- if (body.nodeName == 'TABLE') {
- content = '<tr><td>' + padd + '</td></tr>';
- } else if (/^(UL|OL)$/.test(body.nodeName)) {
- content = '<li>' + padd + '</li>';
- }
-
- forcedRootBlockName = self.settings.forced_root_block;
-
- // Check if forcedRootBlock is configured and that the block is a valid child of the body
- if (forcedRootBlockName && self.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) {
- // Padd with bogus BR elements on modern browsers and IE 7 and 8 since they don't render empty P tags properly
- content = padd;
- content = self.dom.createHTML(forcedRootBlockName, self.settings.forced_root_block_attrs, content);
- } else if (!ie && !content) {
- // We need to add a BR when forced_root_block is disabled on non IE browsers to place the caret
- content = '<br data-mce-bogus="1">';
- }
-
- self.dom.setHTML(body, content);
-
- self.fire('SetContent', args);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (endOffset === 0) {
+ endContainer = skipEmptyTextNodes(endContainer.previousSibling, false);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Parse and serialize the html
- if (args.format !== 'raw') {
- content = new Serializer({
- validate: self.validate
- }, self.schema).serialize(
- self.parser.parse(content, { isRootContent: true })
- );
- }
-
- // Set the new cleaned contents to the editor
- args.content = trim(content);
- self.dom.setHTML(body, args.content);
-
- // Do post processing
- if (!args.no_events) {
- self.fire('SetContent', args);
- }
-
- // Don't normalize selection if the focused element isn't the body in
- // content editable mode since it will steal focus otherwise
- /*if (!self.settings.content_editable || document.activeElement === self.getBody()) {
- self.selection.normalize();
- }*/
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ endContainer = endContainer.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return args.content;
- },
-
- /**
- * Gets the content from the editor instance, this will cleanup the content before it gets returned using
- * the different cleanup rules options.
- *
- * @method getContent
- * @param {Object} args Optional content object, this gets passed around through the whole get process.
- * @return {String} Cleaned content string, normally HTML contents.
- * @example
- * // Get the HTML contents of the currently active editor
- * console.debug(tinymce.activeEditor.getContent());
- *
- * // Get the raw contents of the currently active editor
- * tinymce.activeEditor.getContent({format: 'raw'});
- *
- * // Get content of a specific editor:
- * tinymce.get('content id').getContent()
- */
- getContent: function (args) {
- var self = this, content, body = self.getBody();
-
- if (self.removed) {
- return '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (startContainer && startContainer === endContainer) {
+ return startContainer;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Setup args object
- args = args || {};
- args.format = args.format || 'html';
- args.get = true;
- args.getInner = true;
-
- // Do preprocessing
- if (!args.no_events) {
- self.fire('BeforeGetContent', args);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ }
+ if (elm && elm.nodeType === 3) {
+ return elm.parentNode;
+ }
+ return elm;
+ };
+ var getSelectedBlocks = function (dom, rng, startElm, endElm) {
+ var node, root;
+ var selectedBlocks = [];
+ root = dom.getRoot();
+ startElm = dom.getParent(startElm || getStart$2(root, rng, false), dom.isBlock);
+ endElm = dom.getParent(endElm || getEnd(root, rng, false), dom.isBlock);
+ if (startElm && startElm !== root) {
+ selectedBlocks.push(startElm);
+ }
+ if (startElm && endElm && startElm !== endElm) {
+ node = startElm;
+ var walker = new TreeWalker(startElm, root);
+ while ((node = walker.next()) && node !== endElm) {
+ if (dom.isBlock(node)) {
+ selectedBlocks.push(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ }
+ if (endElm && startElm !== endElm && endElm !== root) {
+ selectedBlocks.push(endElm);
+ }
+ return selectedBlocks;
+ };
+ var select$1 = function (dom, node, content) {
+ return Option.from(node).map(function (node) {
+ var idx = dom.nodeIndex(node);
+ var rng = dom.createRng();
+ rng.setStart(node.parentNode, idx);
+ rng.setEnd(node.parentNode, idx + 1);
+ if (content) {
+ moveEndPoint$1(dom, rng, node, true);
+ moveEndPoint$1(dom, rng, node, false);
+ }
+ return rng;
+ });
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Get raw contents or by default the cleaned contents
- if (args.format == 'raw') {
- content = Tools.trim(self.serializer.getTrimmedContent());
- } else if (args.format == 'text') {
- content = body.innerText || body.textContent;
- } else {
- content = self.serializer.serialize(body, args);
- }
-
- // Trim whitespace in beginning/end of HTML
- if (args.format != 'text') {
- args.content = trim(content);
- } else {
- args.content = content;
- }
-
- // Do post processing
- if (!args.no_events) {
- self.fire('GetContent', args);
- }
-
- return args.content;
- },
-
- /**
- * Inserts content at caret position.
- *
- * @method insertContent
- * @param {String} content Content to insert.
- * @param {Object} args Optional args to pass to insert call.
- */
- insertContent: function (content, args) {
- if (args) {
- content = extend({ content: content }, args);
- }
-
- this.execCommand('mceInsertContent', false, content);
- },
-
- /**
- * Returns true/false if the editor is dirty or not. It will get dirty if the user has made modifications to the contents.
- *
- * The dirty state is automatically set to true if you do modifications to the content in other
- * words when new undo levels is created or if you undo/redo to update the contents of the editor. It will also be set
- * to false if you call editor.save().
- *
- * @method isDirty
- * @return {Boolean} True/false if the editor is dirty or not. It will get dirty if the user has made modifications to the contents.
- * @example
- * if (tinymce.activeEditor.isDirty())
- * alert("You must save your contents.");
- */
- isDirty: function () {
- return !this.isNotDirty;
- },
-
- /**
- * Explicitly sets the dirty state. This will fire the dirty event if the editor dirty state is changed from false to true
- * by invoking this method.
- *
- * @method setDirty
- * @param {Boolean} state True/false if the editor is considered dirty.
- * @example
- * function ajaxSave() {
- * var editor = tinymce.get('elm1');
- *
- * // Save contents using some XHR call
- * alert(editor.getContent());
- *
- * editor.setDirty(false); // Force not dirty state
- * }
- */
- setDirty: function (state) {
- var oldState = !this.isNotDirty;
-
- this.isNotDirty = !state;
-
- if (state && state != oldState) {
- this.fire('dirty');
- }
- },
-
- /**
- * Sets the editor mode. Mode can be for example "design", "code" or "readonly".
- *
- * @method setMode
- * @param {String} mode Mode to set the editor in.
- */
- setMode: function (mode) {
- Mode.setMode(this, mode);
- },
-
- /**
- * Returns the editors container element. The container element wrappes in
- * all the elements added to the page for the editor. Such as UI, iframe etc.
- *
- * @method getContainer
- * @return {Element} HTML DOM element for the editor container.
- */
- getContainer: function () {
- var self = this;
-
- if (!self.container) {
- self.container = DOM.get(self.editorContainer || self.id + '_parent');
- }
-
- return self.container;
- },
-
- /**
- * Returns the editors content area container element. The this element is the one who
- * holds the iframe or the editable element.
- *
- * @method getContentAreaContainer
- * @return {Element} HTML DOM element for the editor area container.
- */
- getContentAreaContainer: function () {
- return this.contentAreaContainer;
- },
-
- /**
- * Returns the target element/textarea that got replaced with a TinyMCE editor instance.
- *
- * @method getElement
- * @return {Element} HTML DOM element for the replaced element.
- */
- getElement: function () {
- if (!this.targetElm) {
- this.targetElm = DOM.get(this.id);
- }
-
- return this.targetElm;
- },
-
- /**
- * Returns the iframes window object.
- *
- * @method getWin
- * @return {Window} Iframe DOM window object.
- */
- getWin: function () {
- var self = this, elm;
-
- if (!self.contentWindow) {
- elm = self.iframeElement;
-
- if (elm) {
- self.contentWindow = elm.contentWindow;
- }
- }
-
- return self.contentWindow;
- },
-
- /**
- * Returns the iframes document object.
- *
- * @method getDoc
- * @return {Document} Iframe DOM document object.
- */
- getDoc: function () {
- var self = this, win;
-
- if (!self.contentDocument) {
- win = self.getWin();
-
- if (win) {
- self.contentDocument = win.document;
- }
- }
-
- return self.contentDocument;
- },
-
- /**
- * Returns the root element of the editable area.
- * For a non-inline iframe-based editor, returns the iframe's body element.
- *
- * @method getBody
- * @return {Element} The root element of the editable area.
- */
- getBody: function () {
- var doc = this.getDoc();
- return this.bodyElement || (doc ? doc.body : null);
- },
-
- /**
- * URL converter function this gets executed each time a user adds an img, a or
- * any other element that has a URL in it. This will be called both by the DOM and HTML
- * manipulation functions.
- *
- * @method convertURL
- * @param {string} url URL to convert.
- * @param {string} name Attribute name src, href etc.
- * @param {string/HTMLElement} elm Tag name or HTML DOM element depending on HTML or DOM insert.
- * @return {string} Converted URL string.
- */
- convertURL: function (url, name, elm) {
- var self = this, settings = self.settings;
-
- // Use callback instead
- if (settings.urlconverter_callback) {
- return self.execCallback('urlconverter_callback', url, elm, true, name);
- }
-
- // Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs
- if (!settings.convert_urls || (elm && elm.nodeName == 'LINK') || url.indexOf('file:') === 0 || url.length === 0) {
- return url;
- }
-
- // Convert to relative
- if (settings.relative_urls) {
- return self.documentBaseURI.toRelative(url);
- }
-
- // Convert to absolute
- url = self.documentBaseURI.toAbsolute(url, settings.remove_script_host);
-
- return url;
- },
-
- /**
- * Adds visual aid for tables, anchors etc so they can be more easily edited inside the editor.
- *
- * @method addVisual
- * @param {Element} elm Optional root element to loop though to find tables etc that needs the visual aid.
- */
- addVisual: function (elm) {
- var self = this, settings = self.settings, dom = self.dom, cls;
-
- elm = elm || self.getBody();
-
- if (self.hasVisual === undefined) {
- self.hasVisual = settings.visual;
- }
-
- each(dom.select('table,a', elm), function (elm) {
- var value;
-
- switch (elm.nodeName) {
- case 'TABLE':
- cls = settings.visual_table_class || 'mce-item-table';
- value = dom.getAttrib(elm, 'border');
-
- if ((!value || value == '0') && self.hasVisual) {
- dom.addClass(elm, cls);
- } else {
- dom.removeClass(elm, cls);
- }
-
- return;
-
- case 'A':
- if (!dom.getAttrib(elm, 'href', false)) {
- value = dom.getAttrib(elm, 'name') || elm.id;
- cls = settings.visual_anchor_class || 'mce-item-anchor';
-
- if (value && self.hasVisual) {
- dom.addClass(elm, cls);
- } else {
- dom.removeClass(elm, cls);
- }
- }
-
- return;
- }
- });
-
- self.fire('VisualAid', { element: elm, hasVisual: self.hasVisual });
- },
-
- /**
- * Removes the editor from the dom and tinymce collection.
- *
- * @method remove
- */
- remove: function () {
- var self = this;
-
- if (!self.removed) {
- self.save();
- self.removed = 1;
- self.unbindAllNativeEvents();
-
- // Remove any hidden input
- if (self.hasHiddenInput) {
- DOM.remove(self.getElement().nextSibling);
- }
-
- if (!self.inline) {
- // IE 9 has a bug where the selection stops working if you place the
- // caret inside the editor then remove the iframe
- if (ie && ie < 10) {
- self.getDoc().execCommand('SelectAll', false, null);
- }
-
- DOM.setStyle(self.id, 'display', self.orgDisplay);
- self.getBody().onload = null; // Prevent #6816
- }
-
- self.fire('remove');
-
- self.editorManager.remove(self);
- DOM.remove(self.getContainer());
- self._selectionOverrides.destroy();
- self.editorUpload.destroy();
- self.destroy();
- }
- },
-
- /**
- * Destroys the editor instance by removing all events, element references or other resources
- * that could leak memory. This method will be called automatically when the page is unloaded
- * but you can also call it directly if you know what you are doing.
- *
- * @method destroy
- * @param {Boolean} automatic Optional state if the destroy is an automatic destroy or user called one.
- */
- destroy: function (automatic) {
- var self = this, form;
-
- // One time is enough
- if (self.destroyed) {
- return;
- }
-
- // If user manually calls destroy and not remove
- // Users seems to have logic that calls destroy instead of remove
- if (!automatic && !self.removed) {
- self.remove();
- return;
- }
-
- if (!automatic) {
- self.editorManager.off('beforeunload', self._beforeUnload);
-
- // Manual destroy
- if (self.theme && self.theme.destroy) {
- self.theme.destroy();
- }
-
- // Destroy controls, selection and dom
- self.selection.destroy();
- self.dom.destroy();
- }
-
- form = self.formElement;
- if (form) {
- if (form._mceOldSubmit) {
- form.submit = form._mceOldSubmit;
- form._mceOldSubmit = null;
- }
-
- DOM.unbind(form, 'submit reset', self.formEventDelegate);
- }
-
- self.contentAreaContainer = self.formElement = self.container = self.editorContainer = null;
- self.bodyElement = self.contentDocument = self.contentWindow = null;
- self.iframeElement = self.targetElm = null;
-
- if (self.selection) {
- self.selection = self.selection.win = self.selection.dom = self.selection.dom.doc = null;
- }
-
- self.destroyed = 1;
- },
-
- /**
- * Uploads all data uri/blob uri images in the editor contents to server.
- *
- * @method uploadImages
- * @param {function} callback Optional callback with images and status for each image.
- * @return {tinymce.util.Promise} Promise instance.
- */
- uploadImages: function (callback) {
- return this.editorUpload.uploadImages(callback);
- },
-
- // Internal functions
-
- _scanForImages: function () {
- return this.editorUpload.scanForImages();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$20 = $_52qop8kjfuw8l6v.each;
+ var isNativeIeSelection = function (rng) {
+ return !!rng.select;
+ };
+ var isAttachedToDom = function (node) {
+ return !!(node && node.ownerDocument) && $_4fb96d1djfuw8lbl.contains($_c9h6qlzjfuw8l98.fromDom(node.ownerDocument), $_c9h6qlzjfuw8l98.fromDom(node));
+ };
+ var isValidRange = function (rng) {
+ if (!rng) {
+ return false;
+ } else if (isNativeIeSelection(rng)) {
+ return true;
+ } else {
+ return isAttachedToDom(rng.startContainer) && isAttachedToDom(rng.endContainer);
+ }
+ };
+ var Selection$1 = function (dom, win, serializer, editor) {
+ var bookmarkManager, controlSelection;
+ var selectedRange, explicitRange, selectorChangedData;
+ var setCursorLocation = function (node, offset) {
+ var rng = dom.createRng();
+ if (!node) {
+ moveEndPoint$1(dom, rng, editor.getBody(), true);
+ setRng(rng);
+ } else {
+ rng.setStart(node, offset);
+ rng.setEnd(node, offset);
+ setRng(rng);
+ collapse(false);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- extend(Editor.prototype, EditorObservable);
-
- return Editor;
- }
-);
-
-/**
- * FocusManager.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class manages the focus/blur state of the editor. This class is needed since some
- * browsers fire false focus/blur states when the selection is moved to a UI dialog or similar.
- *
- * This class will fire two events focus and blur on the editor instances that got affected.
- * It will also handle the restore of selection when the focus is lost and returned.
- *
- * @class tinymce.FocusManager
- */
-define(
- 'tinymce.core.FocusManager',
- [
- "tinymce.core.dom.DOMUtils",
- "tinymce.core.util.Delay",
- "tinymce.core.Env"
- ],
- function (DOMUtils, Delay, Env) {
- var selectionChangeHandler, documentFocusInHandler, documentMouseUpHandler, DOM = DOMUtils.DOM;
-
- var isUIElement = function (editor, elm) {
- var customSelector = editor ? editor.settings.custom_ui_selector : '';
- var parent = DOM.getParent(elm, function (elm) {
- return (
- FocusManager.isEditorUIElement(elm) ||
- (customSelector ? editor.dom.is(elm, customSelector) : false)
- );
- });
- return parent !== null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getContent = function (args) {
+ return $_elw9bs6gjfuw8md8.getContent(editor, args);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isInlineEditor = function (editor) {
- return editor.inline === true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setContent = function (content, args) {
+ return $_629mjb6mjfuw8mf2.setContent(editor, content, args);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isElementOursideInlineEditor = function (editor, target) {
- return isInlineEditor(editor) === false || editor.dom.isChildOf(target, editor.getBody()) === false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getStart = function (real) {
+ return getStart$2(editor.getBody(), getRng(), real);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Constructs a new focus manager instance.
- *
- * @constructor FocusManager
- * @param {tinymce.EditorManager} editorManager Editor manager instance to handle focus for.
- */
- function FocusManager(editorManager) {
- function getActiveElement() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getEnd$$1 = function (real) {
+ return getEnd(editor.getBody(), getRng(), real);
+ };
+ var getBookmark = function (type, normalized) {
+ return bookmarkManager.getBookmark(type, normalized);
+ };
+ var moveToBookmark = function (bookmark) {
+ return bookmarkManager.moveToBookmark(bookmark);
+ };
+ var select = function (node, content) {
+ select$1(dom, node, content).each(setRng);
+ return node;
+ };
+ var isCollapsed = function () {
+ var rng = getRng(), sel = getSel();
+ if (!rng || rng.item) {
+ return false;
+ }
+ if (rng.compareEndPoints) {
+ return rng.compareEndPoints('StartToEnd', rng) === 0;
+ }
+ return !sel || rng.collapsed;
+ };
+ var collapse = function (toStart) {
+ var rng = getRng();
+ rng.collapse(!!toStart);
+ setRng(rng);
+ };
+ var getSel = function () {
+ return win.getSelection ? win.getSelection() : win.document.selection;
+ };
+ var getRng = function () {
+ var selection, rng, elm, doc;
+ var tryCompareBoundaryPoints = function (how, sourceRange, destinationRange) {
</ins><span class="cx" style="display: block; padding: 0 10px"> try {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return document.activeElement;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return sourceRange.compareBoundaryPoints(how, destinationRange);
</ins><span class="cx" style="display: block; padding: 0 10px"> } catch (ex) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // IE sometimes fails to get the activeElement when resizing table
- // TODO: Investigate this
- return document.body;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return -1;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ if (!win) {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // We can't store a real range on IE 11 since it gets mutated so we need to use a bookmark object
- // TODO: Move this to a separate range utils class since it's it's logic is present in Selection as well.
- function createBookmark(dom, rng) {
- if (rng && rng.startContainer) {
- // Verify that the range is within the root of the editor
- if (!dom.isChildOf(rng.startContainer, dom.getRoot()) || !dom.isChildOf(rng.endContainer, dom.getRoot())) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ doc = win.document;
+ if (typeof doc === 'undefined' || doc === null) {
+ return null;
+ }
+ if (editor.bookmark !== undefined && $_18lipa49jfuw8lzt.hasFocus(editor) === false) {
+ var bookmark = $_2a7vvg40jfuw8lyb.getRng(editor);
+ if (bookmark.isSome()) {
+ return bookmark.map(function (r) {
+ return $_2shlx66fjfuw8md6.processRanges(editor, [r])[0];
+ }).getOr(doc.createRange());
+ }
+ }
+ try {
+ if (selection = getSel()) {
+ if (selection.rangeCount > 0) {
+ rng = selection.getRangeAt(0);
+ } else {
+ rng = selection.createRange ? selection.createRange() : doc.createRange();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- startContainer: rng.startContainer,
- startOffset: rng.startOffset,
- endContainer: rng.endContainer,
- endOffset: rng.endOffset
- };
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return rng;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function bookmarkToRng(editor, bookmark) {
- var rng;
-
- if (bookmark.startContainer) {
- rng = editor.getDoc().createRange();
- rng.setStart(bookmark.startContainer, bookmark.startOffset);
- rng.setEnd(bookmark.endContainer, bookmark.endOffset);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ rng = $_2shlx66fjfuw8md6.processRanges(editor, [rng])[0];
+ if (!rng) {
+ rng = doc.createRange ? doc.createRange() : doc.body.createTextRange();
+ }
+ if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) {
+ elm = dom.getRoot();
+ rng.setStart(elm, 0);
+ rng.setEnd(elm, 0);
+ }
+ if (selectedRange && explicitRange) {
+ if (tryCompareBoundaryPoints(rng.START_TO_START, rng, selectedRange) === 0 && tryCompareBoundaryPoints(rng.END_TO_END, rng, selectedRange) === 0) {
+ rng = explicitRange;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- rng = bookmark;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ selectedRange = null;
+ explicitRange = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return rng;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function registerEvents(e) {
- var editor = e.editor;
-
- editor.on('init', function () {
- // Gecko/WebKit has ghost selections in iframes and IE only has one selection per browser tab
- if (editor.inline || Env.ie) {
- // Use the onbeforedeactivate event when available since it works better see #7023
- if ("onbeforedeactivate" in document && Env.ie < 9) {
- editor.dom.bind(editor.getBody(), 'beforedeactivate', function (e) {
- if (e.target != editor.getBody()) {
- return;
- }
-
- try {
- editor.lastRng = editor.selection.getRng();
- } catch (ex) {
- // IE throws "Unexcpected call to method or property access" some times so lets ignore it
- }
- });
- } else {
- // On other browsers take snapshot on nodechange in inline mode since they have Ghost selections for iframes
- editor.on('nodechange mouseup keyup', function (e) {
- var node = getActiveElement();
-
- // Only act on manual nodechanges
- if (e.type == 'nodechange' && e.selectionChange) {
- return;
- }
-
- // IE 11 reports active element as iframe not body of iframe
- if (node && node.id == editor.id + '_ifr') {
- node = editor.getBody();
- }
-
- if (editor.dom.isChildOf(node, editor.getBody())) {
- editor.lastRng = editor.selection.getRng();
- }
- });
- }
- }
- });
-
- editor.on('setcontent', function () {
- editor.lastRng = null;
- });
-
- // Remove last selection bookmark on mousedown see #6305
- editor.on('mousedown', function () {
- editor.selection.lastFocusBookmark = null;
- });
-
- editor.on('focusin', function () {
- var focusedEditor = editorManager.focusedEditor, lastRng;
-
- if (editor.selection.lastFocusBookmark) {
- lastRng = bookmarkToRng(editor, editor.selection.lastFocusBookmark);
- editor.selection.lastFocusBookmark = null;
- editor.selection.setRng(lastRng);
- }
-
- if (focusedEditor != editor) {
- if (focusedEditor) {
- focusedEditor.fire('blur', { focusedEditor: editor });
- }
-
- editorManager.setActive(editor);
- editorManager.focusedEditor = editor;
- editor.fire('focus', { blurredEditor: focusedEditor });
- editor.focus(true);
- }
-
- editor.lastRng = null;
- });
-
- editor.on('focusout', function () {
- Delay.setEditorTimeout(editor, function () {
- var focusedEditor = editorManager.focusedEditor;
-
- // Still the same editor the blur was outside any editor UI
- if (!isUIElement(editor, getActiveElement()) && focusedEditor == editor) {
- editor.fire('blur', { focusedEditor: null });
- editorManager.focusedEditor = null;
-
- // Make sure selection is valid could be invalid if the editor is blured and removed before the timeout occurs
- if (editor.selection) {
- editor.selection.lastFocusBookmark = null;
- }
- }
- });
- });
-
- // Check if focus is moved to an element outside the active editor by checking if the target node
- // isn't within the body of the activeEditor nor a UI element such as a dialog child control
- if (!documentFocusInHandler) {
- documentFocusInHandler = function (e) {
- var activeEditor = editorManager.activeEditor, target;
-
- target = e.target;
-
- if (activeEditor && target.ownerDocument === document) {
- // Check to make sure we have a valid selection don't update the bookmark if it's
- // a focusin to the body of the editor see #7025
- if (activeEditor.selection && target !== activeEditor.getBody() && isElementOursideInlineEditor(editor, target)) {
- activeEditor.selection.lastFocusBookmark = createBookmark(activeEditor.dom, activeEditor.lastRng);
- }
-
- // Fire a blur event if the element isn't a UI element
- if (target !== document.body && !isUIElement(activeEditor, target) && editorManager.focusedEditor === activeEditor) {
- activeEditor.fire('blur', { focusedEditor: null });
- editorManager.focusedEditor = null;
- }
- }
- };
-
- DOM.bind(document, 'focusin', documentFocusInHandler);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return rng;
+ };
+ var setRng = function (rng, forward) {
+ var sel, node, evt;
+ if (!isValidRange(rng)) {
+ return;
+ }
+ var ieRange = isNativeIeSelection(rng) ? rng : null;
+ if (ieRange) {
+ explicitRange = null;
+ try {
+ ieRange.select();
+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Handle edge case when user starts the selection inside the editor and releases
- // the mouse outside the editor producing a new selection. This weird workaround is needed since
- // Gecko doesn't have the "selectionchange" event we need to do this. Fixes: #6843
- if (editor.inline && !documentMouseUpHandler) {
- documentMouseUpHandler = function (e) {
- var activeEditor = editorManager.activeEditor, dom = activeEditor.dom;
-
- if (activeEditor.inline && dom && !dom.isChildOf(e.target, activeEditor.getBody())) {
- var rng = activeEditor.selection.getRng();
-
- if (!rng.collapsed) {
- activeEditor.lastRng = rng;
- }
- }
- };
-
- DOM.bind(document, 'mouseup', documentMouseUpHandler);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function unregisterDocumentEvents(e) {
- if (editorManager.focusedEditor == e.editor) {
- editorManager.focusedEditor = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sel = getSel();
+ evt = editor.fire('SetSelectionRange', {
+ range: rng,
+ forward: forward
+ });
+ rng = evt.range;
+ if (sel) {
+ explicitRange = rng;
+ try {
+ sel.removeAllRanges();
+ sel.addRange(rng);
+ } catch (ex) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!editorManager.activeEditor) {
- DOM.unbind(document, 'selectionchange', selectionChangeHandler);
- DOM.unbind(document, 'focusin', documentFocusInHandler);
- DOM.unbind(document, 'mouseup', documentMouseUpHandler);
- selectionChangeHandler = documentFocusInHandler = documentMouseUpHandler = null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (forward === false && sel.extend) {
+ sel.collapse(rng.endContainer, rng.endOffset);
+ sel.extend(rng.startContainer, rng.startOffset);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editorManager.on('AddEditor', registerEvents);
- editorManager.on('RemoveEditor', unregisterDocumentEvents);
- }
-
- /**
- * Returns true if the specified element is part of the UI for example an button or text input.
- *
- * @method isEditorUIElement
- * @param {Element} elm Element to check if it's part of the UI or not.
- * @return {Boolean} True/false state if the element is part of the UI or not.
- */
- FocusManager.isEditorUIElement = function (elm) {
- // Needs to be converted to string since svg can have focus: #6776
- return elm.className.toString().indexOf('mce-') !== -1;
- };
-
- FocusManager._isUIElement = isUIElement;
-
- return FocusManager;
- }
-);
-
-/**
- * LegacyInput.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Converts legacy input to modern HTML.
- *
- * @class tinymce.LegacyInput
- * @private
- */
-define(
- 'tinymce.core.LegacyInput',
- [
- "tinymce.core.util.Tools"
- ],
- function (Tools) {
- var each = Tools.each, explode = Tools.explode;
-
- var register = function (EditorManager) {
- EditorManager.on('AddEditor', function (e) {
- var editor = e.editor;
-
- editor.on('preInit', function () {
- var filters, fontSizes, dom, settings = editor.settings;
-
- function replaceWithSpan(node, styles) {
- each(styles, function (value, name) {
- if (value) {
- dom.setStyle(node, name, value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!rng.collapsed && rng.startContainer === rng.endContainer && sel.setBaseAndExtent && !$_9fhi43ajfuw8l13.ie) {
+ if (rng.endOffset - rng.startOffset < 2) {
+ if (rng.startContainer.hasChildNodes()) {
+ node = rng.startContainer.childNodes[rng.startOffset];
+ if (node && node.tagName === 'IMG') {
+ sel.setBaseAndExtent(rng.startContainer, rng.startOffset, rng.endContainer, rng.endOffset);
+ if (sel.anchorNode !== rng.startContainer || sel.focusNode !== rng.endContainer) {
+ sel.setBaseAndExtent(node, 0, node, 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- dom.rename(node, 'span');
- }
-
- function convert(e) {
- dom = editor.dom;
-
- if (settings.convert_fonts_to_spans) {
- each(dom.select('font,u,strike', e.node), function (node) {
- filters[node.nodeName.toLowerCase()](dom, node);
- });
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.inline_styles) {
- fontSizes = explode(settings.font_size_legacy_values);
-
- filters = {
- font: function (dom, node) {
- replaceWithSpan(node, {
- backgroundColor: node.style.backgroundColor,
- color: node.color,
- fontFamily: node.face,
- fontSize: fontSizes[parseInt(node.size, 10) - 1]
- });
- },
-
- u: function (dom, node) {
- // HTML5 allows U element
- if (editor.settings.schema === "html4") {
- replaceWithSpan(node, {
- textDecoration: 'underline'
- });
- }
- },
-
- strike: function (dom, node) {
- replaceWithSpan(node, {
- textDecoration: 'line-through'
- });
- }
- };
-
- editor.on('PreProcess SetContent', convert);
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ }
+ editor.fire('AfterSetSelectionRange', {
+ range: rng,
+ forward: forward
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- register: register
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setNode = function (elm) {
+ setContent(dom.getOuterHTML(elm));
+ return elm;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * I18n.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * I18n class that handles translation of TinyMCE UI.
- * Uses po style with csharp style parameters.
- *
- * @class tinymce.util.I18n
- */
-define(
- 'tinymce.core.util.I18n',
- [
- "tinymce.core.util.Tools"
- ],
- function (Tools) {
- "use strict";
-
- var data = {}, code = "en";
-
- return {
- /**
- * Sets the current language code.
- *
- * @method setCode
- * @param {String} newCode Current language code.
- */
- setCode: function (newCode) {
- if (newCode) {
- code = newCode;
- this.rtl = this.data[newCode] ? this.data[newCode]._dir === 'rtl' : false;
- }
- },
-
- /**
- * Returns the current language code.
- *
- * @method getCode
- * @return {String} Current language code.
- */
- getCode: function () {
- return code;
- },
-
- /**
- * Property gets set to true if a RTL language pack was loaded.
- *
- * @property rtl
- * @type Boolean
- */
- rtl: false,
-
- /**
- * Adds translations for a specific language code.
- *
- * @method add
- * @param {String} code Language code like sv_SE.
- * @param {Array} items Name/value array with English en_US to sv_SE.
- */
- add: function (code, items) {
- var langData = data[code];
-
- if (!langData) {
- data[code] = langData = {};
- }
-
- for (var name in items) {
- langData[name] = items[name];
- }
-
- this.setCode(code);
- },
-
- /**
- * Translates the specified text.
- *
- * It has a few formats:
- * I18n.translate("Text");
- * I18n.translate(["Text {0}/{1}", 0, 1]);
- * I18n.translate({raw: "Raw string"});
- *
- * @method translate
- * @param {String/Object/Array} text Text to translate.
- * @return {String} String that got translated.
- */
- translate: function (text) {
- var langData = data[code] || {};
-
- /**
- * number - string
- * null, undefined and empty string - empty string
- * array - comma-delimited string
- * object - in [object Object]
- * function - in [object Function]
- *
- * @param obj
- * @returns {string}
- */
- function toString(obj) {
- if (Tools.is(obj, 'function')) {
- return Object.prototype.toString.call(obj);
- }
- return !isEmpty(obj) ? '' + obj : '';
- }
-
- function isEmpty(text) {
- return text === '' || text === null || Tools.is(text, 'undefined');
- }
-
- function getLangData(text) {
- // make sure we work on a string and return a string
- text = toString(text);
- return Tools.hasOwn(langData, text) ? toString(langData[text]) : text;
- }
-
-
- if (isEmpty(text)) {
- return '';
- }
-
- if (Tools.is(text, 'object') && Tools.hasOwn(text, 'raw')) {
- return toString(text.raw);
- }
-
- if (Tools.is(text, 'array')) {
- var values = text.slice(1);
- text = getLangData(text[0]).replace(/\{([0-9]+)\}/g, function ($1, $2) {
- return Tools.hasOwn(values, $2) ? toString(values[$2]) : $1;
- });
- }
-
- return getLangData(text).replace(/{context:\w+}$/, '');
- },
-
- data: data
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getNode = function () {
+ return getNode$1(editor.getBody(), getRng());
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * EditorManager.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class used as a factory for manager for tinymce.Editor instances.
- *
- * @example
- * tinymce.EditorManager.init({});
- *
- * @class tinymce.EditorManager
- * @mixes tinymce.util.Observable
- * @static
- */
-define(
- 'tinymce.core.EditorManager',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Type',
- 'tinymce.core.AddOnManager',
- 'tinymce.core.dom.DomQuery',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.Editor',
- 'tinymce.core.Env',
- 'tinymce.core.ErrorReporter',
- 'tinymce.core.FocusManager',
- 'tinymce.core.LegacyInput',
- 'tinymce.core.util.I18n',
- 'tinymce.core.util.Observable',
- 'tinymce.core.util.Promise',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.URI'
- ],
- function (Arr, Type, AddOnManager, DomQuery, DOMUtils, Editor, Env, ErrorReporter, FocusManager, LegacyInput, I18n, Observable, Promise, Tools, URI) {
- var DOM = DOMUtils.DOM;
- var explode = Tools.explode, each = Tools.each, extend = Tools.extend;
- var instanceCounter = 0, beforeUnloadDelegate, EditorManager, boundGlobalEvents = false;
- var legacyEditors = [], editors = [];
-
- var isValidLegacyKey = function (id) {
- // In theory we could filter out any editor id:s that clash
- // with array prototype items but that could break existing integrations
- return id !== 'length';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getSelectedBlocks$$1 = function (startElm, endElm) {
+ return getSelectedBlocks(dom, getRng(), startElm, endElm);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function globalEventDelegate(e) {
- each(EditorManager.get(), function (editor) {
- if (e.type === 'scroll') {
- editor.fire('ScrollWindow', e);
- } else {
- editor.fire('ResizeWindow', e);
- }
- });
- }
-
- function toggleGlobalEvents(state) {
- if (state !== boundGlobalEvents) {
- if (state) {
- DomQuery(window).on('resize scroll', globalEventDelegate);
- } else {
- DomQuery(window).off('resize scroll', globalEventDelegate);
- }
-
- boundGlobalEvents = state;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isForward = function () {
+ var sel = getSel();
+ var anchorRange, focusRange;
+ if (!sel || !sel.anchorNode || !sel.focusNode) {
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function removeEditorFromList(targetEditor) {
- var oldEditors = editors;
-
- delete legacyEditors[targetEditor.id];
- for (var i = 0; i < legacyEditors.length; i++) {
- if (legacyEditors[i] === targetEditor) {
- legacyEditors.splice(i, 1);
- break;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ anchorRange = dom.createRng();
+ anchorRange.setStart(sel.anchorNode, sel.anchorOffset);
+ anchorRange.collapse(true);
+ focusRange = dom.createRng();
+ focusRange.setStart(sel.focusNode, sel.focusOffset);
+ focusRange.collapse(true);
+ return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0;
+ };
+ var normalize = function () {
+ var rng = getRng();
+ if (!$_asx40h3ujfuw8lx3.hasMultipleRanges(getSel())) {
+ var normRng = $_970szt3yjfuw8ly1.normalize(dom, rng);
+ normRng.each(function (normRng) {
+ setRng(normRng, isForward());
+ });
+ return normRng.getOr(rng);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editors = Arr.filter(editors, function (editor) {
- return targetEditor !== editor;
- });
-
- // Select another editor since the active one was removed
- if (EditorManager.activeEditor === targetEditor) {
- EditorManager.activeEditor = editors.length > 0 ? editors[0] : null;
- }
-
- // Clear focusedEditor if necessary, so that we don't try to blur the destroyed editor
- if (EditorManager.focusedEditor === targetEditor) {
- EditorManager.focusedEditor = null;
- }
-
- return oldEditors.length !== editors.length;
- }
-
- function purgeDestroyedEditor(editor) {
- // User has manually destroyed the editor lets clean up the mess
- if (editor && editor.initialized && !(editor.getContainer() || editor.getBody()).parentNode) {
- removeEditorFromList(editor);
- editor.unbindAllNativeEvents();
- editor.destroy(true);
- editor.removed = true;
- editor = null;
- }
-
- return editor;
- }
-
- EditorManager = {
- /**
- * Dom query instance.
- *
- * @property $
- * @type tinymce.dom.DomQuery
- */
- $: DomQuery,
-
- /**
- * Major version of TinyMCE build.
- *
- * @property majorVersion
- * @type String
- */
- majorVersion: '4',
-
- /**
- * Minor version of TinyMCE build.
- *
- * @property minorVersion
- * @type String
- */
- minorVersion: '6.7',
-
- /**
- * Release date of TinyMCE build.
- *
- * @property releaseDate
- * @type String
- */
- releaseDate: '2017-09-18',
-
- /**
- * Collection of editor instances. Deprecated use tinymce.get() instead.
- *
- * @property editors
- * @type Object
- */
- editors: legacyEditors,
-
- /**
- * Collection of language pack data.
- *
- * @property i18n
- * @type Object
- */
- i18n: I18n,
-
- /**
- * Currently active editor instance.
- *
- * @property activeEditor
- * @type tinymce.Editor
- * @example
- * tinyMCE.activeEditor.selection.getContent();
- * tinymce.EditorManager.activeEditor.selection.getContent();
- */
- activeEditor: null,
-
- settings: {},
-
- setup: function () {
- var self = this, baseURL, documentBaseURL, suffix = "", preInit, src;
-
- // Get base URL for the current document
- documentBaseURL = URI.getDocumentBaseUrl(document.location);
-
- // Check if the URL is a document based format like: http://site/dir/file and file:///
- // leave other formats like applewebdata://... intact
- if (/^[^:]+:\/\/\/?[^\/]+\//.test(documentBaseURL)) {
- documentBaseURL = documentBaseURL.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
-
- if (!/[\/\\]$/.test(documentBaseURL)) {
- documentBaseURL += '/';
- }
- }
-
- // If tinymce is defined and has a base use that or use the old tinyMCEPreInit
- preInit = window.tinymce || window.tinyMCEPreInit;
- if (preInit) {
- baseURL = preInit.base || preInit.baseURL;
- suffix = preInit.suffix;
- } else {
- // Get base where the tinymce script is located
- var scripts = document.getElementsByTagName('script');
- for (var i = 0; i < scripts.length; i++) {
- src = scripts[i].src;
-
- // Script types supported:
- // tinymce.js tinymce.min.js tinymce.dev.js
- // tinymce.jquery.js tinymce.jquery.min.js tinymce.jquery.dev.js
- // tinymce.full.js tinymce.full.min.js tinymce.full.dev.js
- var srcScript = src.substring(src.lastIndexOf('/'));
- if (/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(src)) {
- if (srcScript.indexOf('.min') != -1) {
- suffix = '.min';
- }
-
- baseURL = src.substring(0, src.lastIndexOf('/'));
- break;
- }
- }
-
- // We didn't find any baseURL by looking at the script elements
- // Try to use the document.currentScript as a fallback
- if (!baseURL && document.currentScript) {
- src = document.currentScript.src;
-
- if (src.indexOf('.min') != -1) {
- suffix = '.min';
- }
-
- baseURL = src.substring(0, src.lastIndexOf('/'));
- }
- }
-
- /**
- * Base URL where the root directory if TinyMCE is located.
- *
- * @property baseURL
- * @type String
- */
- self.baseURL = new URI(documentBaseURL).toAbsolute(baseURL);
-
- /**
- * Document base URL where the current document is located.
- *
- * @property documentBaseURL
- * @type String
- */
- self.documentBaseURL = documentBaseURL;
-
- /**
- * Absolute baseURI for the installation path of TinyMCE.
- *
- * @property baseURI
- * @type tinymce.util.URI
- */
- self.baseURI = new URI(self.baseURL);
-
- /**
- * Current suffix to add to each plugin/theme that gets loaded for example ".min".
- *
- * @property suffix
- * @type String
- */
- self.suffix = suffix;
-
- self.focusManager = new FocusManager(self);
- },
-
- /**
- * Overrides the default settings for editor instances.
- *
- * @method overrideDefaults
- * @param {Object} defaultSettings Defaults settings object.
- */
- overrideDefaults: function (defaultSettings) {
- var baseUrl, suffix;
-
- baseUrl = defaultSettings.base_url;
- if (baseUrl) {
- this.baseURL = new URI(this.documentBaseURL).toAbsolute(baseUrl.replace(/\/+$/, ''));
- this.baseURI = new URI(this.baseURL);
- }
-
- suffix = defaultSettings.suffix;
- if (defaultSettings.suffix) {
- this.suffix = suffix;
- }
-
- this.defaultSettings = defaultSettings;
-
- var pluginBaseUrls = defaultSettings.plugin_base_urls;
- for (var name in pluginBaseUrls) {
- AddOnManager.PluginManager.urls[name] = pluginBaseUrls[name];
- }
- },
-
- /**
- * Initializes a set of editors. This method will create editors based on various settings.
- *
- * @method init
- * @param {Object} settings Settings object to be passed to each editor instance.
- * @return {tinymce.util.Promise} Promise that gets resolved with an array of editors when all editor instances are initialized.
- * @example
- * // Initializes a editor using the longer method
- * tinymce.EditorManager.init({
- * some_settings : 'some value'
- * });
- *
- * // Initializes a editor instance using the shorter version and with a promise
- * tinymce.init({
- * some_settings : 'some value'
- * }).then(function(editors) {
- * ...
- * });
- */
- init: function (settings) {
- var self = this, result, invalidInlineTargets;
-
- invalidInlineTargets = Tools.makeMap(
- 'area base basefont br col frame hr img input isindex link meta param embed source wbr track ' +
- 'colgroup option tbody tfoot thead tr script noscript style textarea video audio iframe object menu',
- ' '
- );
-
- function isInvalidInlineTarget(settings, elm) {
- return settings.inline && elm.tagName.toLowerCase() in invalidInlineTargets;
- }
-
- function createId(elm) {
- var id = elm.id;
-
- // Use element id, or unique name or generate a unique id
- if (!id) {
- id = elm.name;
-
- if (id && !DOM.get(id)) {
- id = elm.name;
- } else {
- // Generate unique name
- id = DOM.uniqueId();
- }
-
- elm.setAttribute('id', id);
- }
-
- return id;
- }
-
- function execCallback(name) {
- var callback = settings[name];
-
- if (!callback) {
- return;
- }
-
- return callback.apply(self, Array.prototype.slice.call(arguments, 2));
- }
-
- function hasClass(elm, className) {
- return className.constructor === RegExp ? className.test(elm.className) : DOM.hasClass(elm, className);
- }
-
- function findTargets(settings) {
- var l, targets = [];
-
- if (Env.ie && Env.ie < 11) {
- ErrorReporter.initError(
- 'TinyMCE does not support the browser you are using. For a list of supported' +
- ' browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/'
- );
- return [];
- }
-
- if (settings.types) {
- each(settings.types, function (type) {
- targets = targets.concat(DOM.select(type.selector));
- });
-
- return targets;
- } else if (settings.selector) {
- return DOM.select(settings.selector);
- } else if (settings.target) {
- return [settings.target];
- }
-
- // Fallback to old setting
- switch (settings.mode) {
- case "exact":
- l = settings.elements || '';
-
- if (l.length > 0) {
- each(explode(l), function (id) {
- var elm;
-
- if ((elm = DOM.get(id))) {
- targets.push(elm);
- } else {
- each(document.forms, function (f) {
- each(f.elements, function (e) {
- if (e.name === id) {
- id = 'mce_editor_' + instanceCounter++;
- DOM.setAttrib(e, 'id', id);
- targets.push(e);
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return rng;
+ };
+ var selectorChanged = function (selector, callback) {
+ var currentSelectors;
+ if (!selectorChangedData) {
+ selectorChangedData = {};
+ currentSelectors = {};
+ editor.on('NodeChange', function (e) {
+ var node = e.element, parents = dom.getParents(node, null, dom.getRoot()), matchedSelectors = {};
+ each$20(selectorChangedData, function (callbacks, selector) {
+ each$20(parents, function (node) {
+ if (dom.is(node, selector)) {
+ if (!currentSelectors[selector]) {
+ each$20(callbacks, function (callback) {
+ callback(true, {
+ node: node,
+ selector: selector,
+ parents: parents
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
- });
- }
- break;
-
- case "textareas":
- case "specific_textareas":
- each(DOM.select('textarea'), function (elm) {
- if (settings.editor_deselector && hasClass(elm, settings.editor_deselector)) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ currentSelectors[selector] = callbacks;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!settings.editor_selector || hasClass(elm, settings.editor_selector)) {
- targets.push(elm);
- }
- });
- break;
- }
-
- return targets;
- }
-
- var provideResults = function (editors) {
- result = editors;
- };
-
- function initEditors() {
- var initCount = 0, editors = [], targets;
-
- function createEditor(id, settings, targetElm) {
- var editor = new Editor(id, settings, self);
-
- editors.push(editor);
-
- editor.on('init', function () {
- if (++initCount === targets.length) {
- provideResults(editors);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ matchedSelectors[selector] = callbacks;
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.targetElm = editor.targetElm || targetElm;
- editor.render();
- }
-
- DOM.unbind(window, 'ready', initEditors);
- execCallback('onpageload');
-
- targets = DomQuery.unique(findTargets(settings));
-
- // TODO: Deprecate this one
- if (settings.types) {
- each(settings.types, function (type) {
- Tools.each(targets, function (elm) {
- if (DOM.is(elm, type.selector)) {
- createEditor(createId(elm), extend({}, settings, type), elm);
- return false;
- }
-
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ each$20(currentSelectors, function (callbacks, selector) {
+ if (!matchedSelectors[selector]) {
+ delete currentSelectors[selector];
+ each$20(callbacks, function (callback) {
+ callback(false, {
+ node: node,
+ selector: selector,
+ parents: parents
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- return;
- }
-
- Tools.each(targets, function (elm) {
- purgeDestroyedEditor(self.get(elm.id));
- });
-
- targets = Tools.grep(targets, function (elm) {
- return !self.get(elm.id);
- });
-
- if (targets.length === 0) {
- provideResults([]);
- } else {
- each(targets, function (elm) {
- if (isInvalidInlineTarget(settings, elm)) {
- ErrorReporter.initError('Could not initialize inline editor on invalid inline target element', elm);
- } else {
- createEditor(createId(elm), settings, elm);
- }
- });
- }
- }
-
- self.settings = settings;
- DOM.bind(window, 'ready', initEditors);
-
- return new Promise(function (resolve) {
- if (result) {
- resolve(result);
- } else {
- provideResults = function (editors) {
- resolve(editors);
- };
- }
- });
- },
-
- /**
- * Returns a editor instance by id.
- *
- * @method get
- * @param {String/Number} id Editor instance id or index to return.
- * @return {tinymce.Editor/Array} Editor instance to return or array of editor instances.
- * @example
- * // Adds an onclick event to an editor by id
- * tinymce.get('mytextbox').on('click', function(e) {
- * ed.windowManager.alert('Hello world!');
- * });
- *
- * // Adds an onclick event to an editor by index
- * tinymce.get(0).on('click', function(e) {
- * ed.windowManager.alert('Hello world!');
- * });
- *
- * // Adds an onclick event to an editor by id (longer version)
- * tinymce.EditorManager.get('mytextbox').on('click', function(e) {
- * ed.windowManager.alert('Hello world!');
- * });
- */
- get: function (id) {
- if (arguments.length === 0) {
- return editors.slice(0);
- } else if (Type.isString(id)) {
- return Arr.find(editors, function (editor) {
- return editor.id === id;
- }).getOr(null);
- } else if (Type.isNumber(id)) {
- return editors[id] ? editors[id] : null;
- } else {
- return null;
- }
- },
-
- /**
- * Adds an editor instance to the editor collection. This will also set it as the active editor.
- *
- * @method add
- * @param {tinymce.Editor} editor Editor instance to add to the collection.
- * @return {tinymce.Editor} The same instance that got passed in.
- */
- add: function (editor) {
- var self = this, existingEditor;
-
- // Prevent existing editors from beeing added again this could happen
- // if a user calls createEditor then render or add multiple times.
- existingEditor = legacyEditors[editor.id];
- if (existingEditor === editor) {
- return editor;
- }
-
- if (self.get(editor.id) === null) {
- // Add to legacy editors array, this is what breaks in HTML5 where ID:s with numbers are valid
- // We can't get rid of this strange object and array at the same time since it seems to be used all over the web
- if (isValidLegacyKey(editor.id)) {
- legacyEditors[editor.id] = editor;
- }
-
- legacyEditors.push(editor);
-
- editors.push(editor);
- }
-
- toggleGlobalEvents(true);
-
- // Doesn't call setActive method since we don't want
- // to fire a bunch of activate/deactivate calls while initializing
- self.activeEditor = editor;
-
- self.fire('AddEditor', { editor: editor });
-
- if (!beforeUnloadDelegate) {
- beforeUnloadDelegate = function () {
- self.fire('BeforeUnload');
- };
-
- DOM.bind(window, 'beforeunload', beforeUnloadDelegate);
- }
-
- return editor;
- },
-
- /**
- * Creates an editor instance and adds it to the EditorManager collection.
- *
- * @method createEditor
- * @param {String} id Instance id to use for editor.
- * @param {Object} settings Editor instance settings.
- * @return {tinymce.Editor} Editor instance that got created.
- */
- createEditor: function (id, settings) {
- return this.add(new Editor(id, settings, this));
- },
-
- /**
- * Removes a editor or editors form page.
- *
- * @example
- * // Remove all editors bound to divs
- * tinymce.remove('div');
- *
- * // Remove all editors bound to textareas
- * tinymce.remove('textarea');
- *
- * // Remove all editors
- * tinymce.remove();
- *
- * // Remove specific instance by id
- * tinymce.remove('#id');
- *
- * @method remove
- * @param {tinymce.Editor/String/Object} [selector] CSS selector or editor instance to remove.
- * @return {tinymce.Editor} The editor that got passed in will be return if it was found otherwise null.
- */
- remove: function (selector) {
- var self = this, i, editor;
-
- // Remove all editors
- if (!selector) {
- for (i = editors.length - 1; i >= 0; i--) {
- self.remove(editors[i]);
- }
-
- return;
- }
-
- // Remove editors by selector
- if (Type.isString(selector)) {
- selector = selector.selector || selector;
-
- each(DOM.select(selector), function (elm) {
- editor = self.get(elm.id);
-
- if (editor) {
- self.remove(editor);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return;
- }
-
- // Remove specific editor
- editor = selector;
-
- // Not in the collection
- if (Type.isNull(self.get(editor.id))) {
- return null;
- }
-
- if (removeEditorFromList(editor)) {
- self.fire('RemoveEditor', { editor: editor });
- }
-
- if (editors.length === 0) {
- DOM.unbind(window, 'beforeunload', beforeUnloadDelegate);
- }
-
- editor.remove();
-
- toggleGlobalEvents(editors.length > 0);
-
- return editor;
- },
-
- /**
- * Executes a specific command on the currently active editor.
- *
- * @method execCommand
- * @param {String} cmd Command to perform for example Bold.
- * @param {Boolean} ui Optional boolean state if a UI should be presented for the command or not.
- * @param {String} value Optional value parameter like for example an URL to a link.
- * @return {Boolean} true/false if the command was executed or not.
- */
- execCommand: function (cmd, ui, value) {
- var self = this, editor = self.get(value);
-
- // Manager commands
- switch (cmd) {
- case "mceAddEditor":
- if (!self.get(value)) {
- new Editor(value, self.settings, self).render();
- }
-
- return true;
-
- case "mceRemoveEditor":
- if (editor) {
- editor.remove();
- }
-
- return true;
-
- case 'mceToggleEditor':
- if (!editor) {
- self.execCommand('mceAddEditor', 0, value);
- return true;
- }
-
- if (editor.isHidden()) {
- editor.show();
- } else {
- editor.hide();
- }
-
- return true;
- }
-
- // Run command on active editor
- if (self.activeEditor) {
- return self.activeEditor.execCommand(cmd, ui, value);
- }
-
- return false;
- },
-
- /**
- * Calls the save method on all editor instances in the collection. This can be useful when a form is to be submitted.
- *
- * @method triggerSave
- * @example
- * // Saves all contents
- * tinyMCE.triggerSave();
- */
- triggerSave: function () {
- each(editors, function (editor) {
- editor.save();
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Adds a language pack, this gets called by the loaded language files like en.js.
- *
- * @method addI18n
- * @param {String} code Optional language code.
- * @param {Object} items Name/value object with translations.
- */
- addI18n: function (code, items) {
- I18n.add(code, items);
- },
-
- /**
- * Translates the specified string using the language pack items.
- *
- * @method translate
- * @param {String/Array/Object} text String to translate
- * @return {String} Translated string.
- */
- translate: function (text) {
- return I18n.translate(text);
- },
-
- /**
- * Sets the active editor instance and fires the deactivate/activate events.
- *
- * @method setActive
- * @param {tinymce.Editor} editor Editor instance to set as the active instance.
- */
- setActive: function (editor) {
- var activeEditor = this.activeEditor;
-
- if (this.activeEditor != editor) {
- if (activeEditor) {
- activeEditor.fire('deactivate', { relatedTarget: editor });
- }
-
- editor.fire('activate', { relatedTarget: activeEditor });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (!selectorChangedData[selector]) {
+ selectorChangedData[selector] = [];
+ }
+ selectorChangedData[selector].push(callback);
+ return exports;
+ };
+ var getScrollContainer = function () {
+ var scrollContainer;
+ var node = dom.getRoot();
+ while (node && node.nodeName !== 'BODY') {
+ if (node.scrollHeight > node.clientHeight) {
+ scrollContainer = node;
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- this.activeEditor = editor;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return scrollContainer;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var scrollIntoView = function (elm, alignToTop) {
+ return $_254q5e2ijfuw8lkq.scrollElementIntoView(editor, elm, alignToTop);
+ };
+ var placeCaretAt = function (clientX, clientY) {
+ return setRng($_dyytu76ejfuw8md2.fromPoint(clientX, clientY, editor.getDoc()));
+ };
+ var getBoundingClientRect = function () {
+ var rng = getRng();
+ return rng.collapsed ? CaretPosition$1.fromRangeStart(rng).getClientRects()[0] : rng.getBoundingClientRect();
+ };
+ var destroy = function () {
+ win = selectedRange = explicitRange = null;
+ controlSelection.destroy();
+ };
+ var exports = {
+ bookmarkManager: null,
+ controlSelection: null,
+ dom: dom,
+ win: win,
+ serializer: serializer,
+ editor: editor,
+ collapse: collapse,
+ setCursorLocation: setCursorLocation,
+ getContent: getContent,
+ setContent: setContent,
+ getBookmark: getBookmark,
+ moveToBookmark: moveToBookmark,
+ select: select,
+ isCollapsed: isCollapsed,
+ isForward: isForward,
+ setNode: setNode,
+ getNode: getNode,
+ getSel: getSel,
+ setRng: setRng,
+ getRng: getRng,
+ getStart: getStart,
+ getEnd: getEnd$$1,
+ getSelectedBlocks: getSelectedBlocks$$1,
+ normalize: normalize,
+ selectorChanged: selectorChanged,
+ getScrollContainer: getScrollContainer,
+ scrollIntoView: scrollIntoView,
+ placeCaretAt: placeCaretAt,
+ getBoundingClientRect: getBoundingClientRect,
+ destroy: destroy
+ };
+ bookmarkManager = BookmarkManager$1(exports);
+ controlSelection = ControlSelection(exports, editor);
+ exports.bookmarkManager = bookmarkManager;
+ exports.controlSelection = controlSelection;
+ return exports;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- extend(EditorManager, Observable);
-
- EditorManager.setup();
- LegacyInput.register(EditorManager);
-
- return EditorManager;
- }
-);
-
-/**
- * Rect.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Contains various tools for rect/position calculation.
- *
- * @class tinymce.geom.Rect
- */
-define(
- 'tinymce.core.geom.Rect',
- [
- ],
- function () {
- "use strict";
-
- var min = Math.min, max = Math.max, round = Math.round;
-
- /**
- * Returns the rect positioned based on the relative position name
- * to the target rect.
- *
- * @method relativePosition
- * @param {Rect} rect Source rect to modify into a new rect.
- * @param {Rect} targetRect Rect to move relative to based on the rel option.
- * @param {String} rel Relative position. For example: tr-bl.
- */
- function relativePosition(rect, targetRect, rel) {
- var x, y, w, h, targetW, targetH;
-
- x = targetRect.x;
- y = targetRect.y;
- w = rect.w;
- h = rect.h;
- targetW = targetRect.w;
- targetH = targetRect.h;
-
- rel = (rel || '').split('');
-
- if (rel[0] === 'b') {
- y += targetH;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isContentEditableFalse$11 = $_ey7ka11qjfuw8ldg.isContentEditableFalse;
+ var getSelectedNode$1 = getSelectedNode;
+ var isAfterContentEditableFalse$2 = isAfterContentEditableFalse;
+ var isBeforeContentEditableFalse$2 = isBeforeContentEditableFalse;
+ var getVisualCaretPosition = function (walkFn, caretPosition) {
+ while (caretPosition = walkFn(caretPosition)) {
+ if (caretPosition.isVisible()) {
+ return caretPosition;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rel[1] === 'r') {
- x += targetW;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return caretPosition;
+ };
+ var isMoveInsideSameBlock = function (from, to) {
+ var inSameBlock = isInSameBlock(from, to);
+ if (!inSameBlock && $_ey7ka11qjfuw8ldg.isBr(from.getNode())) {
+ return true;
+ }
+ return inSameBlock;
+ };
+ var moveToCeFalseHorizontally = function (direction, editor, getNextPosFn, range) {
+ var node, caretPosition, peekCaretPosition, rangeIsInContainerBlock;
+ var forwards = direction === HDirection.Forwards;
+ var isBeforeContentEditableFalseFn = forwards ? isBeforeContentEditableFalse$2 : isAfterContentEditableFalse$2;
+ if (!range.collapsed) {
+ node = getSelectedNode$1(range);
+ if (isContentEditableFalse$11(node)) {
+ return showCaret(direction, editor, node, direction === HDirection.Backwards, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rel[0] === 'c') {
- y += round(targetH / 2);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ rangeIsInContainerBlock = isRangeInCaretContainerBlock(range);
+ caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range);
+ if (isBeforeContentEditableFalseFn(caretPosition)) {
+ return selectNode(editor, caretPosition.getNode(!forwards));
+ }
+ caretPosition = getNextPosFn(caretPosition);
+ if (!caretPosition) {
+ if (rangeIsInContainerBlock) {
+ return range;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rel[1] === 'c') {
- x += round(targetW / 2);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
+ }
+ if (isBeforeContentEditableFalseFn(caretPosition)) {
+ return showCaret(direction, editor, caretPosition.getNode(!forwards), forwards, true);
+ }
+ peekCaretPosition = getNextPosFn(caretPosition);
+ if (isBeforeContentEditableFalseFn(peekCaretPosition)) {
+ if (isMoveInsideSameBlock(caretPosition, peekCaretPosition)) {
+ return showCaret(direction, editor, peekCaretPosition.getNode(!forwards), forwards, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rel[3] === 'b') {
- y -= h;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (rangeIsInContainerBlock) {
+ return renderRangeCaret(editor, caretPosition.toRange(), true);
+ }
+ return null;
+ };
+ var moveToCeFalseVertically = function (direction, editor, walkerFn, range) {
+ var caretPosition, linePositions, nextLinePositions;
+ var closestNextLineRect, caretClientRect, clientX;
+ var dist1, dist2, contentEditableFalseNode;
+ contentEditableFalseNode = getSelectedNode$1(range);
+ caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range);
+ linePositions = walkerFn(editor.getBody(), isAboveLine(1), caretPosition);
+ nextLinePositions = $_djuh8tljfuw8l74.filter(linePositions, isLine(1));
+ caretClientRect = $_djuh8tljfuw8l74.last(caretPosition.getClientRects());
+ if (isBeforeContentEditableFalse$2(caretPosition) || isBeforeTable(caretPosition)) {
+ contentEditableFalseNode = caretPosition.getNode();
+ }
+ if (isAfterContentEditableFalse$2(caretPosition) || isAfterTable(caretPosition)) {
+ contentEditableFalseNode = caretPosition.getNode(true);
+ }
+ if (!caretClientRect) {
+ return null;
+ }
+ clientX = caretClientRect.left;
+ closestNextLineRect = findClosestClientRect(nextLinePositions, clientX);
+ if (closestNextLineRect) {
+ if (isContentEditableFalse$11(closestNextLineRect.node)) {
+ dist1 = Math.abs(clientX - closestNextLineRect.left);
+ dist2 = Math.abs(clientX - closestNextLineRect.right);
+ return showCaret(direction, editor, closestNextLineRect.node, dist1 < dist2, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rel[4] === 'r') {
- x -= w;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (contentEditableFalseNode) {
+ var caretPositions = positionsUntil(direction, editor.getBody(), isAboveLine(1), contentEditableFalseNode);
+ closestNextLineRect = findClosestClientRect($_djuh8tljfuw8l74.filter(caretPositions, isLine(1)), clientX);
+ if (closestNextLineRect) {
+ return renderRangeCaret(editor, closestNextLineRect.position.toRange(), true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rel[3] === 'c') {
- y -= round(h / 2);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ closestNextLineRect = $_djuh8tljfuw8l74.last($_djuh8tljfuw8l74.filter(caretPositions, isLine(0)));
+ if (closestNextLineRect) {
+ return renderRangeCaret(editor, closestNextLineRect.position.toRange(), true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (rel[4] === 'c') {
- x -= round(w / 2);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var createTextBlock = function (editor) {
+ var textBlock = editor.dom.create(editor.settings.forced_root_block);
+ if (!$_9fhi43ajfuw8l13.ie || $_9fhi43ajfuw8l13.ie >= 11) {
+ textBlock.innerHTML = '<br data-mce-bogus="1">';
+ }
+ return textBlock;
+ };
+ var exitPreBlock = function (editor, direction, range) {
+ var pre, caretPos, newBlock;
+ var caretWalker = CaretWalker(editor.getBody());
+ var getNextVisualCaretPosition = $_ebfy8j25jfuw8li1.curry(getVisualCaretPosition, caretWalker.next);
+ var getPrevVisualCaretPosition = $_ebfy8j25jfuw8li1.curry(getVisualCaretPosition, caretWalker.prev);
+ if (range.collapsed && editor.settings.forced_root_block) {
+ pre = editor.dom.getParent(range.startContainer, 'PRE');
+ if (!pre) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return create(x, y, w, h);
- }
-
- /**
- * Tests various positions to get the most suitable one.
- *
- * @method findBestRelativePosition
- * @param {Rect} rect Rect to use as source.
- * @param {Rect} targetRect Rect to move relative to.
- * @param {Rect} constrainRect Rect to constrain within.
- * @param {Array} rels Array of relative positions to test against.
- */
- function findBestRelativePosition(rect, targetRect, constrainRect, rels) {
- var pos, i;
-
- for (i = 0; i < rels.length; i++) {
- pos = relativePosition(rect, targetRect, rels[i]);
-
- if (pos.x >= constrainRect.x && pos.x + pos.w <= constrainRect.w + constrainRect.x &&
- pos.y >= constrainRect.y && pos.y + pos.h <= constrainRect.h + constrainRect.y) {
- return rels[i];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (direction === 1) {
+ caretPos = getNextVisualCaretPosition(CaretPosition$1.fromRangeStart(range));
+ } else {
+ caretPos = getPrevVisualCaretPosition(CaretPosition$1.fromRangeStart(range));
+ }
+ if (!caretPos) {
+ newBlock = createTextBlock(editor);
+ if (direction === 1) {
+ editor.$(pre).after(newBlock);
+ } else {
+ editor.$(pre).before(newBlock);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.selection.select(newBlock, true);
+ editor.selection.collapse();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return null;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Inflates the rect in all directions.
- *
- * @method inflate
- * @param {Rect} rect Rect to expand.
- * @param {Number} w Relative width to expand by.
- * @param {Number} h Relative height to expand by.
- * @return {Rect} New expanded rect.
- */
- function inflate(rect, w, h) {
- return create(rect.x - w, rect.y - h, rect.w + w * 2, rect.h + h * 2);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getHorizontalRange = function (editor, forward) {
+ var caretWalker = CaretWalker(editor.getBody());
+ var getNextVisualCaretPosition = $_ebfy8j25jfuw8li1.curry(getVisualCaretPosition, caretWalker.next);
+ var getPrevVisualCaretPosition = $_ebfy8j25jfuw8li1.curry(getVisualCaretPosition, caretWalker.prev);
+ var newRange;
+ var direction = forward ? HDirection.Forwards : HDirection.Backwards;
+ var getNextPosFn = forward ? getNextVisualCaretPosition : getPrevVisualCaretPosition;
+ var range = editor.selection.getRng();
+ newRange = moveToCeFalseHorizontally(direction, editor, getNextPosFn, range);
+ if (newRange) {
+ return newRange;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the intersection of the specified rectangles.
- *
- * @method intersect
- * @param {Rect} rect The first rectangle to compare.
- * @param {Rect} cropRect The second rectangle to compare.
- * @return {Rect} The intersection of the two rectangles or null if they don't intersect.
- */
- function intersect(rect, cropRect) {
- var x1, y1, x2, y2;
-
- x1 = max(rect.x, cropRect.x);
- y1 = max(rect.y, cropRect.y);
- x2 = min(rect.x + rect.w, cropRect.x + cropRect.w);
- y2 = min(rect.y + rect.h, cropRect.y + cropRect.h);
-
- if (x2 - x1 < 0 || y2 - y1 < 0) {
- return null;
- }
-
- return create(x1, y1, x2 - x1, y2 - y1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ newRange = exitPreBlock(editor, direction, range);
+ if (newRange) {
+ return newRange;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns a rect clamped within the specified clamp rect. This forces the
- * rect to be inside the clamp rect.
- *
- * @method clamp
- * @param {Rect} rect Rectangle to force within clamp rect.
- * @param {Rect} clampRect Rectable to force within.
- * @param {Boolean} fixedSize True/false if size should be fixed.
- * @return {Rect} Clamped rect.
- */
- function clamp(rect, clampRect, fixedSize) {
- var underflowX1, underflowY1, overflowX2, overflowY2,
- x1, y1, x2, y2, cx2, cy2;
-
- x1 = rect.x;
- y1 = rect.y;
- x2 = rect.x + rect.w;
- y2 = rect.y + rect.h;
- cx2 = clampRect.x + clampRect.w;
- cy2 = clampRect.y + clampRect.h;
-
- underflowX1 = max(0, clampRect.x - x1);
- underflowY1 = max(0, clampRect.y - y1);
- overflowX2 = max(0, x2 - cx2);
- overflowY2 = max(0, y2 - cy2);
-
- x1 += underflowX1;
- y1 += underflowY1;
-
- if (fixedSize) {
- x2 += underflowX1;
- y2 += underflowY1;
- x1 -= overflowX2;
- y1 -= overflowY2;
- }
-
- x2 -= overflowX2;
- y2 -= overflowY2;
-
- return create(x1, y1, x2 - x1, y2 - y1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
+ };
+ var getVerticalRange = function (editor, down) {
+ var newRange;
+ var direction = down ? 1 : -1;
+ var walkerFn = down ? downUntil : upUntil;
+ var range = editor.selection.getRng();
+ newRange = moveToCeFalseVertically(direction, editor, walkerFn, range);
+ if (newRange) {
+ return newRange;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Creates a new rectangle object.
- *
- * @method create
- * @param {Number} x Rectangle x location.
- * @param {Number} y Rectangle y location.
- * @param {Number} w Rectangle width.
- * @param {Number} h Rectangle height.
- * @return {Rect} New rectangle object.
- */
- function create(x, y, w, h) {
- return { x: x, y: y, w: w, h: h };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ newRange = exitPreBlock(editor, direction, range);
+ if (newRange) {
+ return newRange;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
+ };
+ var moveH$1 = function (editor, forward) {
+ return function () {
+ var newRng = getHorizontalRange(editor, forward);
+ if (newRng) {
+ editor.selection.setRng(newRng);
+ return true;
+ } else {
+ return false;
+ }
+ };
+ };
+ var moveV$1 = function (editor, down) {
+ return function () {
+ var newRng = getVerticalRange(editor, down);
+ if (newRng) {
+ editor.selection.setRng(newRng);
+ return true;
+ } else {
+ return false;
+ }
+ };
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Creates a new rectangle object form a clientRects object.
- *
- * @method fromClientRect
- * @param {ClientRect} clientRect DOM ClientRect object.
- * @return {Rect} New rectangle object.
- */
- function fromClientRect(clientRect) {
- return create(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var defaultPatterns = function (patterns) {
+ return $_9ek1bp4jfuw8kxg.map(patterns, function (pattern) {
+ return $_dt8zuf62jfuw8mab.merge({
+ shiftKey: false,
+ altKey: false,
+ ctrlKey: false,
+ metaKey: false,
+ keyCode: 0,
+ action: $_68e81l6jfuw8kyc.noop
+ }, pattern);
+ });
+ };
+ var matchesEvent = function (pattern, evt) {
+ return evt.keyCode === pattern.keyCode && evt.shiftKey === pattern.shiftKey && evt.altKey === pattern.altKey && evt.ctrlKey === pattern.ctrlKey && evt.metaKey === pattern.metaKey;
+ };
+ var match$1 = function (patterns, evt) {
+ return $_9ek1bp4jfuw8kxg.bind(defaultPatterns(patterns), function (pattern) {
+ return matchesEvent(pattern, evt) ? [pattern] : [];
+ });
+ };
+ var action = function (f) {
+ var x = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ x[_i - 1] = arguments[_i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- inflate: inflate,
- relativePosition: relativePosition,
- findBestRelativePosition: findBestRelativePosition,
- intersect: intersect,
- clamp: clamp,
- create: create,
- fromClientRect: fromClientRect
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var args = Array.prototype.slice.call(arguments, 1);
+ return function () {
+ return f.apply(null, args);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var execute = function (patterns, evt) {
+ return $_9ek1bp4jfuw8kxg.find(match$1(patterns, evt), function (pattern) {
+ return pattern.action();
+ });
+ };
+ var $_16uyj26rjfuw8mfp = {
+ match: match$1,
+ action: action,
+ execute: execute
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Layout.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Base layout manager class.
- *
- * @class tinymce.ui.Layout
- */
-define(
- 'tinymce.core.ui.Layout',
- [
- "tinymce.core.util.Class",
- "tinymce.core.util.Tools"
- ],
- function (Class, Tools) {
- "use strict";
-
- return Class.extend({
- Defaults: {
- firstControlClass: 'first',
- lastControlClass: 'last'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var executeKeydownOverride = function (editor, caret, evt) {
+ var os = $_f1lbzgnjfuw8l7o.detect().os;
+ $_16uyj26rjfuw8mfp.execute([
+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.RIGHT,
+ action: moveH$1(editor, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Constructs a layout instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- */
- init: function (settings) {
- this.settings = Tools.extend({}, this.Defaults, settings);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.LEFT,
+ action: moveH$1(editor, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * This method gets invoked before the layout renders the controls.
- *
- * @method preRender
- * @param {tinymce.ui.Container} container Container instance to preRender.
- */
- preRender: function (container) {
- container.bodyClasses.add(this.settings.containerClass);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.UP,
+ action: moveV$1(editor, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Applies layout classes to the container.
- *
- * @private
- */
- applyClasses: function (items) {
- var self = this, settings = self.settings, firstClass, lastClass, firstItem, lastItem;
-
- firstClass = settings.firstControlClass;
- lastClass = settings.lastControlClass;
-
- items.each(function (item) {
- item.classes.remove(firstClass).remove(lastClass).add(settings.controlClass);
-
- if (item.visible()) {
- if (!firstItem) {
- firstItem = item;
- }
-
- lastItem = item;
- }
- });
-
- if (firstItem) {
- firstItem.classes.add(firstClass);
- }
-
- if (lastItem) {
- lastItem.classes.add(lastClass);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.DOWN,
+ action: moveV$1(editor, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Renders the specified container and any layout specific HTML.
- *
- * @method renderHtml
- * @param {tinymce.ui.Container} container Container to render HTML for.
- */
- renderHtml: function (container) {
- var self = this, html = '';
-
- self.applyClasses(container.items());
-
- container.items().each(function (item) {
- html += item.renderHtml();
- });
-
- return html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.RIGHT,
+ action: moveH(editor, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Recalculates the positions of the controls in the specified container.
- *
- * @method recalc
- * @param {tinymce.ui.Container} container Container instance to recalc.
- */
- recalc: function () {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.LEFT,
+ action: moveH(editor, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * This method gets invoked after the layout renders the controls.
- *
- * @method postRender
- * @param {tinymce.ui.Container} container Container instance to postRender.
- */
- postRender: function () {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.UP,
+ action: moveV(editor, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- isNative: function () {
- return false;
- }
- });
- }
-);
-/**
- * AbsoluteLayout.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * LayoutManager for absolute positioning. This layout manager is more of
- * a base class for other layouts but can be created and used directly.
- *
- * @-x-less AbsoluteLayout.less
- * @class tinymce.ui.AbsoluteLayout
- * @extends tinymce.ui.Layout
- */
-define(
- 'tinymce.core.ui.AbsoluteLayout',
- [
- "tinymce.core.ui.Layout"
- ],
- function (Layout) {
- "use strict";
-
- return Layout.extend({
- Defaults: {
- containerClass: 'abs-layout',
- controlClass: 'abs-layout-item'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.DOWN,
+ action: moveV(editor, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Recalculates the positions of the controls in the specified container.
- *
- * @method recalc
- * @param {tinymce.ui.Container} container Container instance to recalc.
- */
- recalc: function (container) {
- container.items().filter(':visible').each(function (ctrl) {
- var settings = ctrl.settings;
-
- ctrl.layoutRect({
- x: settings.x,
- y: settings.y,
- w: settings.w,
- h: settings.h
- });
-
- if (ctrl.recalc) {
- ctrl.recalc();
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.RIGHT,
+ action: $_enc4983pjfuw8lvo.move(editor, caret, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Renders the specified container and any layout specific HTML.
- *
- * @method renderHtml
- * @param {tinymce.ui.Container} container Container to render HTML for.
- */
- renderHtml: function (container) {
- return '<div id="' + container._id + '-absend" class="' + container.classPrefix + 'abs-end"></div>' + this._super(container);
- }
- });
- }
-);
-/**
- * Button.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class is used to create buttons. You can create them directly or through the Factory.
- *
- * @example
- * // Create and render a button to the body element
- * tinymce.ui.Factory.create({
- * type: 'button',
- * text: 'My button'
- * }).renderTo(document.body);
- *
- * @-x-less Button.less
- * @class tinymce.ui.Button
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.Button',
- [
- "tinymce.core.ui.Widget"
- ],
- function (Widget) {
- "use strict";
-
- return Widget.extend({
- Defaults: {
- classes: "widget btn",
- role: "button"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.LEFT,
+ action: $_enc4983pjfuw8lvo.move(editor, caret, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Constructs a new button instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {String} size Size of the button small|medium|large.
- * @setting {String} image Image to use for icon.
- * @setting {String} icon Icon to use for button.
- */
- init: function (settings) {
- var self = this, size;
-
- self._super(settings);
- settings = self.settings;
-
- size = self.settings.size;
-
- self.on('click mousedown', function (e) {
- e.preventDefault();
- });
-
- self.on('touchstart', function (e) {
- self.fire('click', e);
- e.preventDefault();
- });
-
- if (settings.subtype) {
- self.classes.add(settings.subtype);
- }
-
- if (size) {
- self.classes.add('btn-' + size);
- }
-
- if (settings.icon) {
- self.icon(settings.icon);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.RIGHT,
+ ctrlKey: !os.isOSX(),
+ altKey: os.isOSX(),
+ action: $_enc4983pjfuw8lvo.moveNextWord(editor, caret)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Sets/gets the current button icon.
- *
- * @method icon
- * @param {String} [icon] New icon identifier.
- * @return {String|tinymce.ui.MenuButton} Current icon or current MenuButton instance.
- */
- icon: function (icon) {
- if (!arguments.length) {
- return this.state.get('icon');
- }
-
- this.state.set('icon', icon);
-
- return this;
- },
-
- /**
- * Repaints the button for example after it's been resizes by a layout engine.
- *
- * @method repaint
- */
- repaint: function () {
- var btnElm = this.getEl().firstChild,
- btnStyle;
-
- if (btnElm) {
- btnStyle = btnElm.style;
- btnStyle.width = btnStyle.height = "100%";
- }
-
- this._super();
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, id = self._id, prefix = self.classPrefix;
- var icon = self.state.get('icon'), image, text = self.state.get('text'), textHtml = '';
-
- image = self.settings.image;
- if (image) {
- icon = 'none';
-
- // Support for [high dpi, low dpi] image sources
- if (typeof image != "string") {
- image = window.getSelection ? image[0] : image[1];
- }
-
- image = ' style="background-image: url(\'' + image + '\')"';
- } else {
- image = '';
- }
-
- if (text) {
- self.classes.add('btn-has-text');
- textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
- }
-
- icon = icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
-
- return (
- '<div id="' + id + '" class="' + self.classes + '" tabindex="-1">' +
- '<button id="' + id + '-button" role="presentation" type="button" tabindex="-1">' +
- (icon ? '<i class="' + icon + '"' + image + '></i>' : '') +
- textHtml +
- '</button>' +
- '</div>'
- );
- },
-
- bindStates: function () {
- var self = this, $ = self.$, textCls = self.classPrefix + 'txt';
-
- function setButtonText(text) {
- var $span = $('span.' + textCls, self.getEl());
-
- if (text) {
- if (!$span[0]) {
- $('button:first', self.getEl()).append('<span class="' + textCls + '"></span>');
- $span = $('span.' + textCls, self.getEl());
- }
-
- $span.html(self.encode(text));
- } else {
- $span.remove();
- }
-
- self.classes.toggle('btn-has-text', !!text);
- }
-
- self.state.on('change:text', function (e) {
- setButtonText(e.value);
- });
-
- self.state.on('change:icon', function (e) {
- var icon = e.value, prefix = self.classPrefix;
-
- self.settings.icon = icon;
- icon = icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
-
- var btnElm = self.getEl().firstChild, iconElm = btnElm.getElementsByTagName('i')[0];
-
- if (icon) {
- if (!iconElm || iconElm != btnElm.firstChild) {
- iconElm = document.createElement('i');
- btnElm.insertBefore(iconElm, btnElm.firstChild);
- }
-
- iconElm.className = icon;
- } else if (iconElm) {
- btnElm.removeChild(iconElm);
- }
-
- setButtonText(self.state.get('text'));
- });
-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.LEFT,
+ ctrlKey: !os.isOSX(),
+ altKey: os.isOSX(),
+ action: $_enc4983pjfuw8lvo.movePrevWord(editor, caret)
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ], evt).each(function (_) {
+ evt.preventDefault();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * ButtonGroup.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This control enables you to put multiple buttons into a group. This is
- * useful when you want to combine similar toolbar buttons into a group.
- *
- * @example
- * // Create and render a buttongroup with two buttons to the body element
- * tinymce.ui.Factory.create({
- * type: 'buttongroup',
- * items: [
- * {text: 'Button A'},
- * {text: 'Button B'}
- * ]
- * }).renderTo(document.body);
- *
- * @-x-less ButtonGroup.less
- * @class tinymce.ui.ButtonGroup
- * @extends tinymce.ui.Container
- */
-define(
- 'tinymce.core.ui.ButtonGroup',
- [
- "tinymce.core.ui.Container"
- ],
- function (Container) {
- "use strict";
-
- return Container.extend({
- Defaults: {
- defaultType: 'button',
- role: 'group'
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, layout = self._layout;
-
- self.classes.add('btn-group');
- self.preRender();
- layout.preRender(self);
-
- return (
- '<div id="' + self._id + '" class="' + self.classes + '">' +
- '<div id="' + self._id + '-body">' +
- (self.settings.html || '') + layout.renderHtml(self) +
- '</div>' +
- '</div>'
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var setup$5 = function (editor, caret) {
+ editor.on('keydown', function (evt) {
+ if (evt.isDefaultPrevented() === false) {
+ executeKeydownOverride(editor, caret, evt);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * Checkbox.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_2prsz46pjfuw8mff = { setup: setup$5 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * This control creates a custom checkbox.
- *
- * @example
- * // Create and render a checkbox to the body element
- * tinymce.ui.Factory.create({
- * type: 'checkbox',
- * checked: true,
- * text: 'My checkbox'
- * }).renderTo(document.body);
- *
- * @-x-less Checkbox.less
- * @class tinymce.ui.Checkbox
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.Checkbox',
- [
- "tinymce.core.ui.Widget"
- ],
- function (Widget) {
- "use strict";
-
- return Widget.extend({
- Defaults: {
- classes: "checkbox",
- role: "checkbox",
- checked: false
- },
-
- /**
- * Constructs a new Checkbox instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Boolean} checked True if the checkbox should be checked by default.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
-
- self.on('click mousedown', function (e) {
- e.preventDefault();
- });
-
- self.on('click', function (e) {
- e.preventDefault();
-
- if (!self.disabled()) {
- self.checked(!self.checked());
- }
- });
-
- self.checked(self.settings.checked);
- },
-
- /**
- * Getter/setter function for the checked state.
- *
- * @method checked
- * @param {Boolean} [state] State to be set.
- * @return {Boolean|tinymce.ui.Checkbox} True/false or checkbox if it's a set operation.
- */
- checked: function (state) {
- if (!arguments.length) {
- return this.state.get('checked');
- }
-
- this.state.set('checked', state);
-
- return this;
- },
-
- /**
- * Getter/setter function for the value state.
- *
- * @method value
- * @param {Boolean} [state] State to be set.
- * @return {Boolean|tinymce.ui.Checkbox} True/false or checkbox if it's a set operation.
- */
- value: function (state) {
- if (!arguments.length) {
- return this.checked();
- }
-
- return this.checked(state);
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, id = self._id, prefix = self.classPrefix;
-
- return (
- '<div id="' + id + '" class="' + self.classes + '" unselectable="on" aria-labelledby="' + id + '-al" tabindex="-1">' +
- '<i class="' + prefix + 'ico ' + prefix + 'i-checkbox"></i>' +
- '<span id="' + id + '-al" class="' + prefix + 'label">' + self.encode(self.state.get('text')) + '</span>' +
- '</div>'
- );
- },
-
- bindStates: function () {
- var self = this;
-
- function checked(state) {
- self.classes.toggle("checked", state);
- self.aria('checked', state);
- }
-
- self.state.on('change:text', function (e) {
- self.getEl('al').firstChild.data = self.translate(e.value);
- });
-
- self.state.on('change:checked change:value', function (e) {
- self.fire('change');
- checked(e.value);
- });
-
- self.state.on('change:icon', function (e) {
- var icon = e.value, prefix = self.classPrefix;
-
- if (typeof icon == 'undefined') {
- return self.settings.icon;
- }
-
- self.settings.icon = icon;
- icon = icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
-
- var btnElm = self.getEl().firstChild, iconElm = btnElm.getElementsByTagName('i')[0];
-
- if (icon) {
- if (!iconElm || iconElm != btnElm.firstChild) {
- iconElm = document.createElement('i');
- btnElm.insertBefore(iconElm, btnElm.firstChild);
- }
-
- iconElm.className = icon;
- } else if (iconElm) {
- btnElm.removeChild(iconElm);
- }
- });
-
- if (self.state.get('checked')) {
- checked(true);
- }
-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getParentInlines = function (rootElm, startElm) {
+ var parents = $_3t5pi43ejfuw8lq0.parentsAndSelf(startElm, rootElm);
+ return $_9ek1bp4jfuw8kxg.findIndex(parents, isBlock).fold($_68e81l6jfuw8kyc.constant(parents), function (index) {
+ return parents.slice(0, index);
+ });
+ };
+ var hasOnlyOneChild$1 = function (elm) {
+ return $_2j4g5u17jfuw8lav.children(elm).length === 1;
+ };
+ var deleteLastPosition = function (forward, editor, target, parentInlines) {
+ var isFormatElement$$1 = $_68e81l6jfuw8kyc.curry(isFormatElement, editor);
+ var formatNodes = $_9ek1bp4jfuw8kxg.map($_9ek1bp4jfuw8kxg.filter(parentInlines, isFormatElement$$1), function (elm) {
+ return elm.dom();
+ });
+ if (formatNodes.length === 0) {
+ $_ge41qn3jjfuw8lr1.deleteElement(editor, forward, target);
+ } else {
+ var pos = replaceWithCaretFormat(target.dom(), formatNodes);
+ editor.selection.setRng(pos.toRange());
+ }
+ };
+ var deleteCaret$1 = function (editor, forward) {
+ var rootElm = $_c9h6qlzjfuw8l98.fromDom(editor.getBody());
+ var startElm = $_c9h6qlzjfuw8l98.fromDom(editor.selection.getStart());
+ var parentInlines = $_9ek1bp4jfuw8kxg.filter(getParentInlines(rootElm, startElm), hasOnlyOneChild$1);
+ return $_9ek1bp4jfuw8kxg.last(parentInlines).map(function (target) {
+ var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng());
+ if ($_43wr4w34jfuw8lnu.willDeleteLastPositionInElement(forward, fromPos, target.dom())) {
+ deleteLastPosition(forward, editor, target, parentInlines);
+ return true;
+ } else {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * ComboBox.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).getOr(false);
+ };
+ var backspaceDelete$5 = function (editor, forward) {
+ return editor.selection.isCollapsed() ? deleteCaret$1(editor, forward) : false;
+ };
+ var $_3zo6mo6tjfuw8mfy = { backspaceDelete: backspaceDelete$5 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * This class creates a combobox control. Select box that you select a value from or
- * type a value into.
- *
- * @-x-less ComboBox.less
- * @class tinymce.ui.ComboBox
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.ComboBox',
- [
- "tinymce.core.ui.Widget",
- "tinymce.core.ui.Factory",
- "tinymce.core.ui.DomUtils",
- "tinymce.core.dom.DomQuery",
- "tinymce.core.util.VK",
- "tinymce.core.util.Tools"
- ],
- function (Widget, Factory, DomUtils, $, VK, Tools) {
- "use strict";
-
- return Widget.extend({
- /**
- * Constructs a new control instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {String} placeholder Placeholder text to display.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
- settings = self.settings;
-
- self.classes.add('combobox');
- self.subinput = true;
- self.ariaTarget = 'inp'; // TODO: Figure out a better way
-
- settings.menu = settings.menu || settings.values;
-
- if (settings.menu) {
- settings.icon = 'caret';
- }
-
- self.on('click', function (e) {
- var elm = e.target, root = self.getEl();
-
- if (!$.contains(root, elm) && elm != root) {
- return;
- }
-
- while (elm && elm != root) {
- if (elm.id && elm.id.indexOf('-open') != -1) {
- self.fire('action');
-
- if (settings.menu) {
- self.showMenu();
-
- if (e.aria) {
- self.menu.items()[0].focus();
- }
- }
- }
-
- elm = elm.parentNode;
- }
- });
-
- // TODO: Rework this
- self.on('keydown', function (e) {
- var rootControl;
-
- if (e.keyCode == 13 && e.target.nodeName === 'INPUT') {
- e.preventDefault();
-
- // Find root control that we can do toJSON on
- self.parents().reverse().each(function (ctrl) {
- if (ctrl.toJSON) {
- rootControl = ctrl;
- return false;
- }
- });
-
- // Fire event on current text box with the serialized data of the whole form
- self.fire('submit', { data: rootControl.toJSON() });
- }
- });
-
- self.on('keyup', function (e) {
- if (e.target.nodeName == "INPUT") {
- var oldValue = self.state.get('value');
- var newValue = e.target.value;
-
- if (newValue !== oldValue) {
- self.state.set('value', newValue);
- self.fire('autocomplete', e);
- }
- }
- });
-
- self.on('mouseover', function (e) {
- var tooltip = self.tooltip().moveTo(-0xFFFF);
-
- if (self.statusLevel() && e.target.className.indexOf(self.classPrefix + 'status') !== -1) {
- var statusMessage = self.statusMessage() || 'Ok';
- var rel = tooltip.text(statusMessage).show().testMoveRel(e.target, ['bc-tc', 'bc-tl', 'bc-tr']);
-
- tooltip.classes.toggle('tooltip-n', rel == 'bc-tc');
- tooltip.classes.toggle('tooltip-nw', rel == 'bc-tl');
- tooltip.classes.toggle('tooltip-ne', rel == 'bc-tr');
-
- tooltip.moveRel(e.target, rel);
- }
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var executeKeydownOverride$1 = function (editor, caret, evt) {
+ $_16uyj26rjfuw8mfp.execute([
+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.BACKSPACE,
+ action: $_16uyj26rjfuw8mfp.action($_a7skkj3gjfuw8lqf.backspaceDelete, editor, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- statusLevel: function (value) {
- if (arguments.length > 0) {
- this.state.set('statusLevel', value);
- }
-
- return this.state.get('statusLevel');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.DELETE,
+ action: $_16uyj26rjfuw8mfp.action($_a7skkj3gjfuw8lqf.backspaceDelete, editor, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- statusMessage: function (value) {
- if (arguments.length > 0) {
- this.state.set('statusMessage', value);
- }
-
- return this.state.get('statusMessage');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.BACKSPACE,
+ action: $_16uyj26rjfuw8mfp.action($_qeu9d3kjfuw8luq.backspaceDelete, editor, caret, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- showMenu: function () {
- var self = this, settings = self.settings, menu;
-
- if (!self.menu) {
- menu = settings.menu || [];
-
- // Is menu array then auto constuct menu control
- if (menu.length) {
- menu = {
- type: 'menu',
- items: menu
- };
- } else {
- menu.type = menu.type || 'menu';
- }
-
- self.menu = Factory.create(menu).parent(self).renderTo(self.getContainerElm());
- self.fire('createmenu');
- self.menu.reflow();
- self.menu.on('cancel', function (e) {
- if (e.control === self.menu) {
- self.focus();
- }
- });
-
- self.menu.on('show hide', function (e) {
- e.control.items().each(function (ctrl) {
- ctrl.active(ctrl.value() == self.value());
- });
- }).fire('show');
-
- self.menu.on('select', function (e) {
- self.value(e.control.value());
- });
-
- self.on('focusin', function (e) {
- if (e.target.tagName.toUpperCase() == 'INPUT') {
- self.menu.hide();
- }
- });
-
- self.aria('expanded', true);
- }
-
- self.menu.show();
- self.menu.layoutRect({ w: self.layoutRect().w });
- self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.DELETE,
+ action: $_16uyj26rjfuw8mfp.action($_qeu9d3kjfuw8luq.backspaceDelete, editor, caret, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Focuses the input area of the control.
- *
- * @method focus
- */
- focus: function () {
- this.getEl('inp').focus();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.BACKSPACE,
+ action: $_16uyj26rjfuw8mfp.action($_f34seo3fjfuw8lq6.backspaceDelete, editor, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Repaints the control after a layout operation.
- *
- * @method repaint
- */
- repaint: function () {
- var self = this, elm = self.getEl(), openElm = self.getEl('open'), rect = self.layoutRect();
- var width, lineHeight, innerPadding = 0, inputElm = elm.firstChild;
-
- if (self.statusLevel() && self.statusLevel() !== 'none') {
- innerPadding = (
- parseInt(DomUtils.getRuntimeStyle(inputElm, 'padding-right'), 10) -
- parseInt(DomUtils.getRuntimeStyle(inputElm, 'padding-left'), 10)
- );
- }
-
- if (openElm) {
- width = rect.w - DomUtils.getSize(openElm).width - 10;
- } else {
- width = rect.w - 10;
- }
-
- // Detect old IE 7+8 add lineHeight to align caret vertically in the middle
- var doc = document;
- if (doc.all && (!doc.documentMode || doc.documentMode <= 8)) {
- lineHeight = (self.layoutRect().h - 2) + 'px';
- }
-
- $(inputElm).css({
- width: width - innerPadding,
- lineHeight: lineHeight
- });
-
- self._super();
-
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.DELETE,
+ action: $_16uyj26rjfuw8mfp.action($_f34seo3fjfuw8lq6.backspaceDelete, editor, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Post render method. Called after the control has been rendered to the target.
- *
- * @method postRender
- * @return {tinymce.ui.ComboBox} Current combobox instance.
- */
- postRender: function () {
- var self = this;
-
- $(this.getEl('inp')).on('change', function (e) {
- self.state.set('value', e.target.value);
- self.fire('change', e);
- });
-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.BACKSPACE,
+ action: $_16uyj26rjfuw8mfp.action($_cwwff132jfuw8ln7.backspaceDelete, editor, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix;
- var value = self.state.get('value') || '';
- var icon, text, openBtnHtml = '', extraAttrs = '', statusHtml = '';
-
- if ("spellcheck" in settings) {
- extraAttrs += ' spellcheck="' + settings.spellcheck + '"';
- }
-
- if (settings.maxLength) {
- extraAttrs += ' maxlength="' + settings.maxLength + '"';
- }
-
- if (settings.size) {
- extraAttrs += ' size="' + settings.size + '"';
- }
-
- if (settings.subtype) {
- extraAttrs += ' type="' + settings.subtype + '"';
- }
-
- statusHtml = '<i id="' + id + '-status" class="mce-status mce-ico" style="display: none"></i>';
-
- if (self.disabled()) {
- extraAttrs += ' disabled="disabled"';
- }
-
- icon = settings.icon;
- if (icon && icon != 'caret') {
- icon = prefix + 'ico ' + prefix + 'i-' + settings.icon;
- }
-
- text = self.state.get('text');
-
- if (icon || text) {
- openBtnHtml = (
- '<div id="' + id + '-open" class="' + prefix + 'btn ' + prefix + 'open" tabIndex="-1" role="button">' +
- '<button id="' + id + '-action" type="button" hidefocus="1" tabindex="-1">' +
- (icon != 'caret' ? '<i class="' + icon + '"></i>' : '<i class="' + prefix + 'caret"></i>') +
- (text ? (icon ? ' ' : '') + text : '') +
- '</button>' +
- '</div>'
- );
-
- self.classes.add('has-open');
- }
-
- return (
- '<div id="' + id + '" class="' + self.classes + '">' +
- '<input id="' + id + '-inp" class="' + prefix + 'textbox" value="' +
- self.encode(value, false) + '" hidefocus="1"' + extraAttrs + ' placeholder="' +
- self.encode(settings.placeholder) + '" />' +
- statusHtml +
- openBtnHtml +
- '</div>'
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.DELETE,
+ action: $_16uyj26rjfuw8mfp.action($_cwwff132jfuw8ln7.backspaceDelete, editor, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- value: function (value) {
- if (arguments.length) {
- this.state.set('value', value);
- return this;
- }
-
- // Make sure the real state is in sync
- if (this.state.get('rendered')) {
- this.state.set('value', this.getEl('inp').value);
- }
-
- return this.state.get('value');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.BACKSPACE,
+ action: $_16uyj26rjfuw8mfp.action($_dt1e6j3rjfuw8lw0.backspaceDelete, editor, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- showAutoComplete: function (items, term) {
- var self = this;
-
- if (items.length === 0) {
- self.hideMenu();
- return;
- }
-
- var insert = function (value, title) {
- return function () {
- self.fire('selectitem', {
- title: title,
- value: value
- });
- };
- };
-
- if (self.menu) {
- self.menu.items().remove();
- } else {
- self.menu = Factory.create({
- type: 'menu',
- classes: 'combobox-menu',
- layout: 'flow'
- }).parent(self).renderTo();
- }
-
- Tools.each(items, function (item) {
- self.menu.add({
- text: item.title,
- url: item.previewUrl,
- match: term,
- classes: 'menu-item-ellipsis',
- onclick: insert(item.value, item.title)
- });
- });
-
- self.menu.renderNew();
- self.hideMenu();
-
- self.menu.on('cancel', function (e) {
- if (e.control.parent() === self.menu) {
- e.stopPropagation();
- self.focus();
- self.hideMenu();
- }
- });
-
- self.menu.on('select', function () {
- self.focus();
- });
-
- var maxW = self.layoutRect().w;
- self.menu.layoutRect({ w: maxW, minW: 0, maxW: maxW });
- self.menu.reflow();
- self.menu.show();
- self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.DELETE,
+ action: $_16uyj26rjfuw8mfp.action($_dt1e6j3rjfuw8lw0.backspaceDelete, editor, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- hideMenu: function () {
- if (this.menu) {
- this.menu.hide();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.BACKSPACE,
+ action: $_16uyj26rjfuw8mfp.action($_3zo6mo6tjfuw8mfy.backspaceDelete, editor, false)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:value', function (e) {
- if (self.getEl('inp').value != e.value) {
- self.getEl('inp').value = e.value;
- }
- });
-
- self.state.on('change:disabled', function (e) {
- self.getEl('inp').disabled = e.value;
- });
-
- self.state.on('change:statusLevel', function (e) {
- var statusIconElm = self.getEl('status');
- var prefix = self.classPrefix, value = e.value;
-
- DomUtils.css(statusIconElm, 'display', value === 'none' ? 'none' : '');
- DomUtils.toggleClass(statusIconElm, prefix + 'i-checkmark', value === 'ok');
- DomUtils.toggleClass(statusIconElm, prefix + 'i-warning', value === 'warn');
- DomUtils.toggleClass(statusIconElm, prefix + 'i-error', value === 'error');
- self.classes.toggle('has-status', value !== 'none');
- self.repaint();
- });
-
- DomUtils.on(self.getEl('status'), 'mouseleave', function () {
- self.tooltip().hide();
- });
-
- self.on('cancel', function (e) {
- if (self.menu && self.menu.visible()) {
- e.stopPropagation();
- self.hideMenu();
- }
- });
-
- var focusIdx = function (idx, menu) {
- if (menu && menu.items().length > 0) {
- menu.items().eq(idx)[0].focus();
- }
- };
-
- self.on('keydown', function (e) {
- var keyCode = e.keyCode;
-
- if (e.target.nodeName === 'INPUT') {
- if (keyCode === VK.DOWN) {
- e.preventDefault();
- self.fire('autocomplete');
- focusIdx(0, self.menu);
- } else if (keyCode === VK.UP) {
- e.preventDefault();
- focusIdx(-1, self.menu);
- }
- }
- });
-
- return self._super();
- },
-
- remove: function () {
- $(this.getEl('inp')).off();
-
- if (this.menu) {
- this.menu.remove();
- }
-
- this._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.DELETE,
+ action: $_16uyj26rjfuw8mfp.action($_3zo6mo6tjfuw8mfy.backspaceDelete, editor, true)
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ], evt).each(function (_) {
+ evt.preventDefault();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * ColorBox.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This widget lets you enter colors and browse for colors by pressing the color button. It also displays
- * a preview of the current color.
- *
- * @-x-less ColorBox.less
- * @class tinymce.ui.ColorBox
- * @extends tinymce.ui.ComboBox
- */
-define(
- 'tinymce.core.ui.ColorBox',
- [
- "tinymce.core.ui.ComboBox"
- ],
- function (ComboBox) {
- "use strict";
-
- return ComboBox.extend({
- /**
- * Constructs a new control instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- */
- init: function (settings) {
- var self = this;
-
- settings.spellcheck = false;
-
- if (settings.onaction) {
- settings.icon = 'none';
- }
-
- self._super(settings);
-
- self.classes.add('colorbox');
- self.on('change keyup postrender', function () {
- self.repaintColor(self.value());
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var executeKeyupOverride = function (editor, evt) {
+ $_16uyj26rjfuw8mfp.execute([
+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.BACKSPACE,
+ action: $_16uyj26rjfuw8mfp.action($_a7skkj3gjfuw8lqf.paddEmptyElement, editor)
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- repaintColor: function (value) {
- var openElm = this.getEl('open');
- var elm = openElm ? openElm.getElementsByTagName('i')[0] : null;
-
- if (elm) {
- try {
- elm.style.background = value;
- } catch (ex) {
- // Ignore
- }
- }
- },
-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:value', function (e) {
- if (self.state.get('rendered')) {
- self.repaintColor(e.value);
- }
- });
-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ {
+ keyCode: $_1nvqmv5ajfuw8m5j.DELETE,
+ action: $_16uyj26rjfuw8mfp.action($_a7skkj3gjfuw8lqf.paddEmptyElement, editor)
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * PanelButton.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new panel button.
- *
- * @class tinymce.ui.PanelButton
- * @extends tinymce.ui.Button
- */
-define(
- 'tinymce.core.ui.PanelButton',
- [
- "tinymce.core.ui.Button",
- "tinymce.core.ui.FloatPanel"
- ],
- function (Button, FloatPanel) {
- "use strict";
-
- return Button.extend({
- /**
- * Shows the panel for the button.
- *
- * @method showPanel
- */
- showPanel: function () {
- var self = this, settings = self.settings;
-
- self.active(true);
-
- if (!self.panel) {
- var panelSettings = settings.panel;
-
- // Wrap panel in grid layout if type if specified
- // This makes it possible to add forms or other containers directly in the panel option
- if (panelSettings.type) {
- panelSettings = {
- layout: 'grid',
- items: panelSettings
- };
- }
-
- panelSettings.role = panelSettings.role || 'dialog';
- panelSettings.popover = true;
- panelSettings.autohide = true;
- panelSettings.ariaRoot = true;
-
- self.panel = new FloatPanel(panelSettings).on('hide', function () {
- self.active(false);
- }).on('cancel', function (e) {
- e.stopPropagation();
- self.focus();
- self.hidePanel();
- }).parent(self).renderTo(self.getContainerElm());
-
- self.panel.fire('show');
- self.panel.reflow();
- } else {
- self.panel.show();
- }
-
- var rel = self.panel.testMoveRel(self.getEl(), settings.popoverAlign || (self.isRtl() ? ['bc-tc', 'bc-tl', 'bc-tr'] : ['bc-tc', 'bc-tr', 'bc-tl']));
-
- self.panel.classes.toggle('start', rel === 'bc-tl');
- self.panel.classes.toggle('end', rel === 'bc-tr');
-
- self.panel.moveRel(self.getEl(), rel);
- },
-
- /**
- * Hides the panel for the button.
- *
- * @method hidePanel
- */
- hidePanel: function () {
- var self = this;
-
- if (self.panel) {
- self.panel.hide();
- }
- },
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this;
-
- self.aria('haspopup', true);
-
- self.on('click', function (e) {
- if (e.control === self) {
- if (self.panel && self.panel.visible()) {
- self.hidePanel();
- } else {
- self.showPanel();
- self.panel.focus(!!e.aria);
- }
- }
- });
-
- return self._super();
- },
-
- remove: function () {
- if (this.panel) {
- this.panel.remove();
- this.panel = null;
- }
-
- return this._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ], evt);
+ };
+ var setup$6 = function (editor, caret) {
+ editor.on('keydown', function (evt) {
+ if (evt.isDefaultPrevented() === false) {
+ executeKeydownOverride$1(editor, caret, evt);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * ColorButton.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class creates a color button control. This is a split button in which the main
- * button has a visual representation of the currently selected color. When clicked
- * the caret button displays a color picker, allowing the user to select a new color.
- *
- * @-x-less ColorButton.less
- * @class tinymce.ui.ColorButton
- * @extends tinymce.ui.PanelButton
- */
-define(
- 'tinymce.core.ui.ColorButton',
- [
- "tinymce.core.ui.PanelButton",
- "tinymce.core.dom.DOMUtils"
- ],
- function (PanelButton, DomUtils) {
- "use strict";
-
- var DOM = DomUtils.DOM;
-
- return PanelButton.extend({
- /**
- * Constructs a new ColorButton instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- */
- init: function (settings) {
- this._super(settings);
- this.classes.add('colorbutton');
- },
-
- /**
- * Getter/setter for the current color.
- *
- * @method color
- * @param {String} [color] Color to set.
- * @return {String|tinymce.ui.ColorButton} Current color or current instance.
- */
- color: function (color) {
- if (color) {
- this._color = color;
- this.getEl('preview').style.backgroundColor = color;
- return this;
- }
-
- return this._color;
- },
-
- /**
- * Resets the current color.
- *
- * @method resetColor
- * @return {tinymce.ui.ColorButton} Current instance.
- */
- resetColor: function () {
- this._color = null;
- this.getEl('preview').style.backgroundColor = null;
- return this;
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, id = self._id, prefix = self.classPrefix, text = self.state.get('text');
- var icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';
- var image = self.settings.image ? ' style="background-image: url(\'' + self.settings.image + '\')"' : '',
- textHtml = '';
-
- if (text) {
- self.classes.add('btn-has-text');
- textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
- }
-
- return (
- '<div id="' + id + '" class="' + self.classes + '" role="button" tabindex="-1" aria-haspopup="true">' +
- '<button role="presentation" hidefocus="1" type="button" tabindex="-1">' +
- (icon ? '<i class="' + icon + '"' + image + '></i>' : '') +
- '<span id="' + id + '-preview" class="' + prefix + 'preview"></span>' +
- textHtml +
- '</button>' +
- '<button type="button" class="' + prefix + 'open" hidefocus="1" tabindex="-1">' +
- ' <i class="' + prefix + 'caret"></i>' +
- '</button>' +
- '</div>'
- );
- },
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this, onClickHandler = self.settings.onclick;
-
- self.on('click', function (e) {
- if (e.aria && e.aria.key == 'down') {
- return;
- }
-
- if (e.control == self && !DOM.getParent(e.target, '.' + self.classPrefix + 'open')) {
- e.stopImmediatePropagation();
- onClickHandler.call(self, e);
- }
- });
-
- delete self.settings.onclick;
-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('keyup', function (evt) {
+ if (evt.isDefaultPrevented() === false) {
+ executeKeyupOverride(editor, evt);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var $_9h3qgr6sjfuw8mfv = { setup: setup$6 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Color.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class lets you parse/serialize colors and convert rgb/hsb.
- *
- * @class tinymce.util.Color
- * @example
- * var white = new tinymce.util.Color({r: 255, g: 255, b: 255});
- * var red = new tinymce.util.Color('#FF0000');
- *
- * console.log(white.toHex(), red.toHsv());
- */
-define(
- 'tinymce.core.util.Color',
- [
- ],
- function () {
- var min = Math.min, max = Math.max, round = Math.round;
-
- /**
- * Constructs a new color instance.
- *
- * @constructor
- * @method Color
- * @param {String} value Optional initial value to parse.
- */
- function Color(value) {
- var self = this, r = 0, g = 0, b = 0;
-
- function rgb2hsv(r, g, b) {
- var h, s, v, d, minRGB, maxRGB;
-
- h = 0;
- s = 0;
- v = 0;
- r = r / 255;
- g = g / 255;
- b = b / 255;
-
- minRGB = min(r, min(g, b));
- maxRGB = max(r, max(g, b));
-
- if (minRGB == maxRGB) {
- v = minRGB;
-
- return {
- h: 0,
- s: 0,
- v: v * 100
- };
- }
-
- /*eslint no-nested-ternary:0 */
- d = (r == minRGB) ? g - b : ((b == minRGB) ? r - g : b - r);
- h = (r == minRGB) ? 3 : ((b == minRGB) ? 1 : 5);
- h = 60 * (h - d / (maxRGB - minRGB));
- s = (maxRGB - minRGB) / maxRGB;
- v = maxRGB;
-
- return {
- h: round(h),
- s: round(s * 100),
- v: round(v * 100)
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var firstNonWhiteSpaceNodeSibling = function (node) {
+ while (node) {
+ if (node.nodeType === 1 || node.nodeType === 3 && node.data && /[\r\n\s]/.test(node.data)) {
+ return node;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hsvToRgb(hue, saturation, brightness) {
- var side, chroma, x, match;
-
- hue = (parseInt(hue, 10) || 0) % 360;
- saturation = parseInt(saturation, 10) / 100;
- brightness = parseInt(brightness, 10) / 100;
- saturation = max(0, min(saturation, 1));
- brightness = max(0, min(brightness, 1));
-
- if (saturation === 0) {
- r = g = b = round(255 * brightness);
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node.nextSibling;
+ }
+ };
+ var moveToCaretPosition = function (editor, root) {
+ var walker, node, rng, lastNode = root, tempElm;
+ var dom = editor.dom;
+ var moveCaretBeforeOnEnterElementsMap = editor.schema.getMoveCaretBeforeOnEnterElements();
+ if (!root) {
+ return;
+ }
+ if (/^(LI|DT|DD)$/.test(root.nodeName)) {
+ var firstChild = firstNonWhiteSpaceNodeSibling(root.firstChild);
+ if (firstChild && /^(UL|OL|DL)$/.test(firstChild.nodeName)) {
+ root.insertBefore(dom.doc.createTextNode('\xA0'), root.firstChild);
+ }
+ }
+ rng = dom.createRng();
+ root.normalize();
+ if (root.hasChildNodes()) {
+ walker = new TreeWalker(root, root);
+ while (node = walker.current()) {
+ if ($_ey7ka11qjfuw8ldg.isText(node)) {
+ rng.setStart(node, 0);
+ rng.setEnd(node, 0);
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- side = hue / 60;
- chroma = brightness * saturation;
- x = chroma * (1 - Math.abs(side % 2 - 1));
- match = brightness - chroma;
-
- switch (Math.floor(side)) {
- case 0:
- r = chroma;
- g = x;
- b = 0;
- break;
-
- case 1:
- r = x;
- g = chroma;
- b = 0;
- break;
-
- case 2:
- r = 0;
- g = chroma;
- b = x;
- break;
-
- case 3:
- r = 0;
- g = x;
- b = chroma;
- break;
-
- case 4:
- r = x;
- g = 0;
- b = chroma;
- break;
-
- case 5:
- r = chroma;
- g = 0;
- b = x;
- break;
-
- default:
- r = g = b = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (moveCaretBeforeOnEnterElementsMap[node.nodeName.toLowerCase()]) {
+ rng.setStartBefore(node);
+ rng.setEndBefore(node);
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- r = round(255 * (r + match));
- g = round(255 * (g + match));
- b = round(255 * (b + match));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ lastNode = node;
+ node = walker.next();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the hex string of the current color. For example: #ff00ff
- *
- * @method toHex
- * @return {String} Hex string of current color.
- */
- function toHex() {
- function hex(val) {
- val = parseInt(val, 10).toString(16);
-
- return val.length > 1 ? val : '0' + val;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!node) {
+ rng.setStart(lastNode, 0);
+ rng.setEnd(lastNode, 0);
+ }
+ } else {
+ if ($_ey7ka11qjfuw8ldg.isBr(root)) {
+ if (root.nextSibling && dom.isBlock(root.nextSibling)) {
+ rng.setStartBefore(root);
+ rng.setEndBefore(root);
+ } else {
+ rng.setStartAfter(root);
+ rng.setEndAfter(root);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return '#' + hex(r) + hex(g) + hex(b);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ rng.setStart(root, 0);
+ rng.setEnd(root, 0);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Returns the r, g, b values of the color. Each channel has a range from 0-255.
- *
- * @method toRgb
- * @return {Object} Object with r, g, b fields.
- */
- function toRgb() {
- return {
- r: r,
- g: g,
- b: b
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ editor.selection.setRng(rng);
+ dom.remove(tempElm);
+ editor.selection.scrollIntoView(root);
+ };
+ var getEditableRoot = function (dom, node) {
+ var root = dom.getRoot();
+ var parent, editableRoot;
+ parent = node;
+ while (parent !== root && dom.getContentEditable(parent) !== 'false') {
+ if (dom.getContentEditable(parent) === 'true') {
+ editableRoot = parent;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ parent = parent.parentNode;
+ }
+ return parent !== root ? editableRoot : root;
+ };
+ var getParentBlock$2 = function (editor) {
+ return Option.from(editor.dom.getParent(editor.selection.getStart(true), editor.dom.isBlock));
+ };
+ var getParentBlockName = function (editor) {
+ return getParentBlock$2(editor).fold($_68e81l6jfuw8kyc.constant(''), function (parentBlock) {
+ return parentBlock.nodeName.toUpperCase();
+ });
+ };
+ var isListItemParentBlock = function (editor) {
+ return getParentBlock$2(editor).filter(function (elm) {
+ return isListItem($_c9h6qlzjfuw8l98.fromDom(elm));
+ }).isSome();
+ };
+ var $_cm0iqf6yjfuw8mgv = {
+ moveToCaretPosition: moveToCaretPosition,
+ getEditableRoot: getEditableRoot,
+ getParentBlock: getParentBlock$2,
+ getParentBlockName: getParentBlockName,
+ isListItemParentBlock: isListItemParentBlock
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Returns the h, s, v values of the color. Ranges: h=0-360, s=0-100, v=0-100.
- *
- * @method toHsv
- * @return {Object} Object with h, s, v fields.
- */
- function toHsv() {
- return rgb2hsv(r, g, b);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var hasFirstChild = function (elm, name) {
+ return elm.firstChild && elm.firstChild.nodeName === name;
+ };
+ var hasParent$1 = function (elm, parentName) {
+ return elm && elm.parentNode && elm.parentNode.nodeName === parentName;
+ };
+ var isListBlock = function (elm) {
+ return elm && /^(OL|UL|LI)$/.test(elm.nodeName);
+ };
+ var isNestedList = function (elm) {
+ return isListBlock(elm) && isListBlock(elm.parentNode);
+ };
+ var getContainerBlock = function (containerBlock) {
+ var containerBlockParent = containerBlock.parentNode;
+ if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) {
+ return containerBlockParent;
+ }
+ return containerBlock;
+ };
+ var isFirstOrLastLi = function (containerBlock, parentBlock, first) {
+ var node = containerBlock[first ? 'firstChild' : 'lastChild'];
+ while (node) {
+ if ($_ey7ka11qjfuw8ldg.isElement(node)) {
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Parses the specified value and populates the color instance.
- *
- * Supported format examples:
- * * rbg(255,0,0)
- * * #ff0000
- * * #fff
- * * {r: 255, g: 0, b: 0}
- * * {h: 360, s: 100, v: 100}
- *
- * @method parse
- * @param {Object/String} value Color value to parse.
- * @return {tinymce.util.Color} Current color instance.
- */
- function parse(value) {
- var matches;
-
- if (typeof value == 'object') {
- if ("r" in value) {
- r = value.r;
- g = value.g;
- b = value.b;
- } else if ("v" in value) {
- hsvToRgb(value.h, value.s, value.v);
- }
- } else {
- if ((matches = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(value))) {
- r = parseInt(matches[1], 10);
- g = parseInt(matches[2], 10);
- b = parseInt(matches[3], 10);
- } else if ((matches = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value))) {
- r = parseInt(matches[1], 16);
- g = parseInt(matches[2], 16);
- b = parseInt(matches[3], 16);
- } else if ((matches = /#([0-F])([0-F])([0-F])/gi.exec(value))) {
- r = parseInt(matches[1] + matches[1], 16);
- g = parseInt(matches[2] + matches[2], 16);
- b = parseInt(matches[3] + matches[3], 16);
- }
- }
-
- r = r < 0 ? 0 : (r > 255 ? 255 : r);
- g = g < 0 ? 0 : (g > 255 ? 255 : g);
- b = b < 0 ? 0 : (b > 255 ? 255 : b);
-
- return self;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node = node[first ? 'nextSibling' : 'previousSibling'];
+ }
+ return node === parentBlock;
+ };
+ var insert$1 = function (editor, createNewBlock, containerBlock, parentBlock, newBlockName) {
+ var dom = editor.dom;
+ var rng = editor.selection.getRng();
+ if (containerBlock === editor.getBody()) {
+ return;
+ }
+ if (isNestedList(containerBlock)) {
+ newBlockName = 'LI';
+ }
+ var newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR');
+ if (isFirstOrLastLi(containerBlock, parentBlock, true) && isFirstOrLastLi(containerBlock, parentBlock, false)) {
+ if (hasParent$1(containerBlock, 'LI')) {
+ dom.insertAfter(newBlock, getContainerBlock(containerBlock));
+ } else {
+ dom.replace(newBlock, containerBlock);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (value) {
- parse(value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (isFirstOrLastLi(containerBlock, parentBlock, true)) {
+ if (hasParent$1(containerBlock, 'LI')) {
+ dom.insertAfter(newBlock, getContainerBlock(containerBlock));
+ newBlock.appendChild(dom.doc.createTextNode(' '));
+ newBlock.appendChild(containerBlock);
+ } else {
+ containerBlock.parentNode.insertBefore(newBlock, containerBlock);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if (isFirstOrLastLi(containerBlock, parentBlock, false)) {
+ dom.insertAfter(newBlock, getContainerBlock(containerBlock));
+ } else {
+ containerBlock = getContainerBlock(containerBlock);
+ var tmpRng = rng.cloneRange();
+ tmpRng.setStartAfter(parentBlock);
+ tmpRng.setEndAfter(containerBlock);
+ var fragment = tmpRng.extractContents();
+ if (newBlockName === 'LI' && hasFirstChild(fragment, 'LI')) {
+ newBlock = fragment.firstChild;
+ dom.insertAfter(fragment, containerBlock);
+ } else {
+ dom.insertAfter(fragment, containerBlock);
+ dom.insertAfter(newBlock, containerBlock);
+ }
+ }
+ dom.remove(parentBlock);
+ $_cm0iqf6yjfuw8mgv.moveToCaretPosition(editor, newBlock);
+ };
+ var $_cdzn766xjfuw8mgs = { insert: insert$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.toRgb = toRgb;
- self.toHsv = toHsv;
- self.toHex = toHex;
- self.parse = parse;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isEmptyAnchor = function (elm) {
+ return elm && elm.nodeName === 'A' && $_52qop8kjfuw8l6v.trim($_dpfg1321jfuw8lhn.trim(elm.innerText || elm.textContent)).length === 0;
+ };
+ var isTableCell$5 = function (node) {
+ return node && /^(TD|TH|CAPTION)$/.test(node.nodeName);
+ };
+ var emptyBlock = function (elm) {
+ elm.innerHTML = '<br data-mce-bogus="1">';
+ };
+ var containerAndSiblingName = function (container, nodeName) {
+ return container.nodeName === nodeName || container.previousSibling && container.previousSibling.nodeName === nodeName;
+ };
+ var canSplitBlock = function (dom, node) {
+ return node && dom.isBlock(node) && !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) && !/^(fixed|absolute)/i.test(node.style.position) && dom.getContentEditable(node) !== 'true';
+ };
+ var trimInlineElementsOnLeftSideOfBlock = function (dom, nonEmptyElementsMap, block) {
+ var node = block;
+ var firstChilds = [];
+ var i;
+ if (!node) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Color;
- }
-);
-
-/**
- * ColorPicker.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Color picker widget lets you select colors.
- *
- * @-x-less ColorPicker.less
- * @class tinymce.ui.ColorPicker
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.ColorPicker',
- [
- "tinymce.core.ui.Widget",
- "tinymce.core.ui.DragHelper",
- "tinymce.core.ui.DomUtils",
- "tinymce.core.util.Color"
- ],
- function (Widget, DragHelper, DomUtils, Color) {
- "use strict";
-
- return Widget.extend({
- Defaults: {
- classes: "widget colorpicker"
- },
-
- /**
- * Constructs a new colorpicker instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {String} color Initial color value.
- */
- init: function (settings) {
- this._super(settings);
- },
-
- postRender: function () {
- var self = this, color = self.color(), hsv, hueRootElm, huePointElm, svRootElm, svPointElm;
-
- hueRootElm = self.getEl('h');
- huePointElm = self.getEl('hp');
- svRootElm = self.getEl('sv');
- svPointElm = self.getEl('svp');
-
- function getPos(elm, event) {
- var pos = DomUtils.getPos(elm), x, y;
-
- x = event.pageX - pos.x;
- y = event.pageY - pos.y;
-
- x = Math.max(0, Math.min(x / elm.clientWidth, 1));
- y = Math.max(0, Math.min(y / elm.clientHeight, 1));
-
- return {
- x: x,
- y: y
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (node = node.firstChild) {
+ if (dom.isBlock(node)) {
+ return;
+ }
+ if ($_ey7ka11qjfuw8ldg.isElement(node) && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) {
+ firstChilds.push(node);
+ }
+ }
+ i = firstChilds.length;
+ while (i--) {
+ node = firstChilds[i];
+ if (!node.hasChildNodes() || node.firstChild === node.lastChild && node.firstChild.nodeValue === '') {
+ dom.remove(node);
+ } else {
+ if (isEmptyAnchor(node)) {
+ dom.remove(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function updateColor(hsv, hueUpdate) {
- var hue = (360 - hsv.h) / 360;
-
- DomUtils.css(huePointElm, {
- top: (hue * 100) + '%'
- });
-
- if (!hueUpdate) {
- DomUtils.css(svPointElm, {
- left: hsv.s + '%',
- top: (100 - hsv.v) + '%'
- });
- }
-
- svRootElm.style.background = new Color({ s: 100, v: 100, h: hsv.h }).toHex();
- self.color().parse({ s: hsv.s, v: hsv.v, h: hsv.h });
- }
-
- function updateSaturationAndValue(e) {
- var pos;
-
- pos = getPos(svRootElm, e);
- hsv.s = pos.x * 100;
- hsv.v = (1 - pos.y) * 100;
-
- updateColor(hsv);
- self.fire('change');
- }
-
- function updateHue(e) {
- var pos;
-
- pos = getPos(hueRootElm, e);
- hsv = color.toHsv();
- hsv.h = (1 - pos.y) * 360;
- updateColor(hsv, true);
- self.fire('change');
- }
-
- self._repaint = function () {
- hsv = color.toHsv();
- updateColor(hsv);
- };
-
- self._super();
-
- self._svdraghelper = new DragHelper(self._id + '-sv', {
- start: updateSaturationAndValue,
- drag: updateSaturationAndValue
- });
-
- self._hdraghelper = new DragHelper(self._id + '-h', {
- start: updateHue,
- drag: updateHue
- });
-
- self._repaint();
- },
-
- rgb: function () {
- return this.color().toRgb();
- },
-
- value: function (value) {
- var self = this;
-
- if (arguments.length) {
- self.color().parse(value);
-
- if (self._rendered) {
- self._repaint();
- }
- } else {
- return self.color().toHex();
- }
- },
-
- color: function () {
- if (!this._color) {
- this._color = new Color();
- }
-
- return this._color;
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, id = self._id, prefix = self.classPrefix, hueHtml;
- var stops = '#ff0000,#ff0080,#ff00ff,#8000ff,#0000ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000';
-
- function getOldIeFallbackHtml() {
- var i, l, html = '', gradientPrefix, stopsList;
-
- gradientPrefix = 'filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=';
- stopsList = stops.split(',');
- for (i = 0, l = stopsList.length - 1; i < l; i++) {
- html += (
- '<div class="' + prefix + 'colorpicker-h-chunk" style="' +
- 'height:' + (100 / l) + '%;' +
- gradientPrefix + stopsList[i] + ',endColorstr=' + stopsList[i + 1] + ');' +
- '-ms-' + gradientPrefix + stopsList[i] + ',endColorstr=' + stopsList[i + 1] + ')' +
- '"></div>'
- );
- }
-
- return html;
- }
-
- var gradientCssText = (
- 'background: -ms-linear-gradient(top,' + stops + ');' +
- 'background: linear-gradient(to bottom,' + stops + ');'
- );
-
- hueHtml = (
- '<div id="' + id + '-h" class="' + prefix + 'colorpicker-h" style="' + gradientCssText + '">' +
- getOldIeFallbackHtml() +
- '<div id="' + id + '-hp" class="' + prefix + 'colorpicker-h-marker"></div>' +
- '</div>'
- );
-
- return (
- '<div id="' + id + '" class="' + self.classes + '">' +
- '<div id="' + id + '-sv" class="' + prefix + 'colorpicker-sv">' +
- '<div class="' + prefix + 'colorpicker-overlay1">' +
- '<div class="' + prefix + 'colorpicker-overlay2">' +
- '<div id="' + id + '-svp" class="' + prefix + 'colorpicker-selector1">' +
- '<div class="' + prefix + 'colorpicker-selector2"></div>' +
- '</div>' +
- '</div>' +
- '</div>' +
- '</div>' +
- hueHtml +
- '</div>'
- );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * Path.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new path control.
- *
- * @-x-less Path.less
- * @class tinymce.ui.Path
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.Path',
- [
- "tinymce.core.ui.Widget"
- ],
- function (Widget) {
- "use strict";
-
- return Widget.extend({
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {String} delimiter Delimiter to display between row in path.
- */
- init: function (settings) {
- var self = this;
-
- if (!settings.delimiter) {
- settings.delimiter = '\u00BB';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var normalizeZwspOffset = function (start, container, offset) {
+ if ($_ey7ka11qjfuw8ldg.isText(container) === false) {
+ return offset;
+ } else if (start) {
+ return offset === 1 && container.data.charAt(offset - 1) === $_dpfg1321jfuw8lhn.ZWSP ? 0 : offset;
+ } else {
+ return offset === container.data.length - 1 && container.data.charAt(offset) === $_dpfg1321jfuw8lhn.ZWSP ? container.data.length : offset;
+ }
+ };
+ var includeZwspInRange = function (rng) {
+ var newRng = rng.cloneRange();
+ newRng.setStart(rng.startContainer, normalizeZwspOffset(true, rng.startContainer, rng.startOffset));
+ newRng.setEnd(rng.endContainer, normalizeZwspOffset(false, rng.endContainer, rng.endOffset));
+ return newRng;
+ };
+ var trimLeadingLineBreaks = function (node) {
+ do {
+ if ($_ey7ka11qjfuw8ldg.isText(node)) {
+ node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, '');
+ }
+ node = node.firstChild;
+ } while (node);
+ };
+ var getEditableRoot$1 = function (dom, node) {
+ var root = dom.getRoot();
+ var parent, editableRoot;
+ parent = node;
+ while (parent !== root && dom.getContentEditable(parent) !== 'false') {
+ if (dom.getContentEditable(parent) === 'true') {
+ editableRoot = parent;
+ }
+ parent = parent.parentNode;
+ }
+ return parent !== root ? editableRoot : root;
+ };
+ var setForcedBlockAttrs = function (editor, node) {
+ var forcedRootBlockName = $_6msxiw2jjfuw8lkv.getForcedRootBlock(editor);
+ if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {
+ editor.dom.setAttribs(node, $_6msxiw2jjfuw8lkv.getForcedRootBlockAttrs(editor));
+ }
+ };
+ var wrapSelfAndSiblingsInDefaultBlock = function (editor, newBlockName, rng, container, offset) {
+ var newBlock, parentBlock, startNode, node, next, rootBlockName;
+ var blockName = newBlockName || 'P';
+ var dom = editor.dom, editableRoot = getEditableRoot$1(dom, container);
+ parentBlock = dom.getParent(container, dom.isBlock);
+ if (!parentBlock || !canSplitBlock(dom, parentBlock)) {
+ parentBlock = parentBlock || editableRoot;
+ if (parentBlock === editor.getBody() || isTableCell$5(parentBlock)) {
+ rootBlockName = parentBlock.nodeName.toLowerCase();
+ } else {
+ rootBlockName = parentBlock.parentNode.nodeName.toLowerCase();
+ }
+ if (!parentBlock.hasChildNodes()) {
+ newBlock = dom.create(blockName);
+ setForcedBlockAttrs(editor, newBlock);
+ parentBlock.appendChild(newBlock);
+ rng.setStart(newBlock, 0);
+ rng.setEnd(newBlock, 0);
+ return newBlock;
+ }
+ node = container;
+ while (node.parentNode !== parentBlock) {
+ node = node.parentNode;
+ }
+ while (node && !dom.isBlock(node)) {
+ startNode = node;
+ node = node.previousSibling;
+ }
+ if (startNode && editor.schema.isValidChild(rootBlockName, blockName.toLowerCase())) {
+ newBlock = dom.create(blockName);
+ setForcedBlockAttrs(editor, newBlock);
+ startNode.parentNode.insertBefore(newBlock, startNode);
+ node = startNode;
+ while (node && !dom.isBlock(node)) {
+ next = node.nextSibling;
+ newBlock.appendChild(node);
+ node = next;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self._super(settings);
- self.classes.add('path');
- self.canFocus = true;
-
- self.on('click', function (e) {
- var index, target = e.target;
-
- if ((index = target.getAttribute('data-index'))) {
- self.fire('select', { value: self.row()[index], index: index });
- }
- });
-
- self.row(self.settings.row);
- },
-
- /**
- * Focuses the current control.
- *
- * @method focus
- * @return {tinymce.ui.Control} Current control instance.
- */
- focus: function () {
- var self = this;
-
- self.getEl().firstChild.focus();
-
- return self;
- },
-
- /**
- * Sets/gets the data to be used for the path.
- *
- * @method row
- * @param {Array} row Array with row name is rendered to path.
- */
- row: function (row) {
- if (!arguments.length) {
- return this.state.get('row');
- }
-
- this.state.set('row', row);
-
- return this;
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this;
-
- return (
- '<div id="' + self._id + '" class="' + self.classes + '">' +
- self._getDataPathHtml(self.state.get('row')) +
- '</div>'
- );
- },
-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:row', function (e) {
- self.innerHtml(self._getDataPathHtml(e.value));
- });
-
- return self._super();
- },
-
- _getDataPathHtml: function (data) {
- var self = this, parts = data || [], i, l, html = '', prefix = self.classPrefix;
-
- for (i = 0, l = parts.length; i < l; i++) {
- html += (
- (i > 0 ? '<div class="' + prefix + 'divider" aria-hidden="true"> ' + self.settings.delimiter + ' </div>' : '') +
- '<div role="button" class="' + prefix + 'path-item' + (i == l - 1 ? ' ' + prefix + 'last' : '') + '" data-index="' +
- i + '" tabindex="-1" id="' + self._id + '-' + i + '" aria-level="' + (i + 1) + '">' + parts[i].name + '</div>'
- );
- }
-
- if (!html) {
- html = '<div class="' + prefix + 'path-item">\u00a0</div>';
- }
-
- return html;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ rng.setStart(container, offset);
+ rng.setEnd(container, offset);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-
-/**
- * ElementPath.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This control creates an path for the current selections parent elements in TinyMCE.
- *
- * @class tinymce.ui.ElementPath
- * @extends tinymce.ui.Path
- */
-define(
- 'tinymce.core.ui.ElementPath',
- [
- "tinymce.core.ui.Path"
- ],
- function (Path) {
- return Path.extend({
- /**
- * Post render method. Called after the control has been rendered to the target.
- *
- * @method postRender
- * @return {tinymce.ui.ElementPath} Current combobox instance.
- */
- postRender: function () {
- var self = this, editor = self.settings.editor;
-
- function isHidden(elm) {
- if (elm.nodeType === 1) {
- if (elm.nodeName == "BR" || !!elm.getAttribute('data-mce-bogus')) {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return container;
+ };
+ var addBrToBlockIfNeeded = function (dom, block) {
+ var lastChild;
+ block.normalize();
+ lastChild = block.lastChild;
+ if (!lastChild || /^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true))) {
+ dom.add(block, 'br');
+ }
+ };
+ var insert$2 = function (editor, evt) {
+ var tmpRng, editableRoot, container, offset, parentBlock, shiftKey;
+ var newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName, isAfterLastNodeInContainer;
+ var dom = editor.dom;
+ var schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements();
+ var rng = editor.selection.getRng();
+ var createNewBlock = function (name) {
+ var node = container, block, clonedNode, caretNode;
+ var textInlineElements = schema.getTextInlineElements();
+ if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') {
+ block = dom.create(name || newBlockName);
+ setForcedBlockAttrs(editor, block);
+ } else {
+ block = parentBlock.cloneNode(false);
+ }
+ caretNode = block;
+ if ($_6msxiw2jjfuw8lkv.shouldKeepStyles(editor) === false) {
+ dom.setAttrib(block, 'style', null);
+ dom.setAttrib(block, 'class', null);
+ } else {
+ do {
+ if (textInlineElements[node.nodeName]) {
+ if (isCaretNode(node)) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (elm.getAttribute('data-mce-type') === 'bookmark') {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ clonedNode = node.cloneNode(false);
+ dom.setAttrib(clonedNode, 'id', '');
+ if (block.hasChildNodes()) {
+ clonedNode.appendChild(block.firstChild);
+ block.appendChild(clonedNode);
+ } else {
+ caretNode = clonedNode;
+ block.appendChild(clonedNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return false;
- }
-
- if (editor.settings.elementpath !== false) {
- self.on('select', function (e) {
- editor.focus();
- editor.selection.select(this.row()[e.index].element);
- editor.nodeChanged();
- });
-
- editor.on('nodeChange', function (e) {
- var outParents = [], parents = e.parents, i = parents.length;
-
- while (i--) {
- if (parents[i].nodeType == 1 && !isHidden(parents[i])) {
- var args = editor.fire('ResolveName', {
- name: parents[i].nodeName.toLowerCase(),
- target: parents[i]
- });
-
- if (!args.isDefaultPrevented()) {
- outParents.push({ name: args.name, element: parents[i] });
- }
-
- if (args.isPropagationStopped()) {
- break;
- }
- }
- }
-
- self.row(outParents);
- });
- }
-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } while ((node = node.parentNode) && node !== editableRoot);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * FormItem.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class is a container created by the form element with
- * a label and control item.
- *
- * @class tinymce.ui.FormItem
- * @extends tinymce.ui.Container
- * @setting {String} label Label to display for the form item.
- */
-define(
- 'tinymce.core.ui.FormItem',
- [
- "tinymce.core.ui.Container"
- ],
- function (Container) {
- "use strict";
-
- return Container.extend({
- Defaults: {
- layout: 'flex',
- align: 'center',
- defaults: {
- flex: 1
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ emptyBlock(caretNode);
+ return block;
+ };
+ var isCaretAtStartOrEndOfBlock = function (start) {
+ var walker, node, name, normalizedOffset;
+ normalizedOffset = normalizeZwspOffset(start, container, offset);
+ if ($_ey7ka11qjfuw8ldg.isText(container) && (start ? normalizedOffset > 0 : normalizedOffset < container.nodeValue.length)) {
+ return false;
+ }
+ if (container.parentNode === parentBlock && isAfterLastNodeInContainer && !start) {
+ return true;
+ }
+ if (start && $_ey7ka11qjfuw8ldg.isElement(container) && container === parentBlock.firstChild) {
+ return true;
+ }
+ if (containerAndSiblingName(container, 'TABLE') || containerAndSiblingName(container, 'HR')) {
+ return isAfterLastNodeInContainer && !start || !isAfterLastNodeInContainer && start;
+ }
+ walker = new TreeWalker(container, parentBlock);
+ if ($_ey7ka11qjfuw8ldg.isText(container)) {
+ if (start && normalizedOffset === 0) {
+ walker.prev();
+ } else if (!start && normalizedOffset === container.nodeValue.length) {
+ walker.next();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, layout = self._layout, prefix = self.classPrefix;
-
- self.classes.add('formitem');
- layout.preRender(self);
-
- return (
- '<div id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1">' +
- (self.settings.title ? ('<div id="' + self._id + '-title" class="' + prefix + 'title">' +
- self.settings.title + '</div>') : '') +
- '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' +
- (self.settings.html || '') + layout.renderHtml(self) +
- '</div>' +
- '</div>'
- );
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * Form.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class creates a form container. A form container has the ability
- * to automatically wrap items in tinymce.ui.FormItem instances.
- *
- * Each FormItem instance is a container for the label and the item.
- *
- * @example
- * tinymce.ui.Factory.create({
- * type: 'form',
- * items: [
- * {type: 'textbox', label: 'My text box'}
- * ]
- * }).renderTo(document.body);
- *
- * @class tinymce.ui.Form
- * @extends tinymce.ui.Container
- */
-define(
- 'tinymce.core.ui.Form',
- [
- "tinymce.core.ui.Container",
- "tinymce.core.ui.FormItem",
- "tinymce.core.util.Tools"
- ],
- function (Container, FormItem, Tools) {
- "use strict";
-
- return Container.extend({
- Defaults: {
- containerCls: 'form',
- layout: 'flex',
- direction: 'column',
- align: 'stretch',
- flex: 1,
- padding: 20,
- labelGap: 30,
- spacing: 10,
- callbacks: {
- submit: function () {
- this.submit();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (node = walker.current()) {
+ if ($_ey7ka11qjfuw8ldg.isElement(node)) {
+ if (!node.getAttribute('data-mce-bogus')) {
+ name = node.nodeName.toLowerCase();
+ if (nonEmptyElementsMap[name] && name !== 'br') {
+ return false;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else if ($_ey7ka11qjfuw8ldg.isText(node) && !/^[ \t\r\n]*$/.test(node.nodeValue)) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * This method gets invoked before the control is rendered.
- *
- * @method preRender
- */
- preRender: function () {
- var self = this, items = self.items();
-
- if (!self.settings.formItemDefaults) {
- self.settings.formItemDefaults = {
- layout: 'flex',
- autoResize: "overflow",
- defaults: { flex: 1 }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (start) {
+ walker.prev();
+ } else {
+ walker.next();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Wrap any labeled items in FormItems
- items.each(function (ctrl) {
- var formItem, label = ctrl.settings.label;
-
- if (label) {
- formItem = new FormItem(Tools.extend({
- items: {
- type: 'label',
- id: ctrl._id + '-l',
- text: label,
- flex: 0,
- forId: ctrl._id,
- disabled: ctrl.disabled()
- }
- }, self.settings.formItemDefaults));
-
- formItem.type = 'formitem';
- ctrl.aria('labelledby', ctrl._id + '-l');
-
- if (typeof ctrl.settings.flex == "undefined") {
- ctrl.settings.flex = 1;
- }
-
- self.replace(ctrl, formItem);
- formItem.add(ctrl);
- }
- });
- },
-
- /**
- * Fires a submit event with the serialized form.
- *
- * @method submit
- * @return {Object} Event arguments object.
- */
- submit: function () {
- return this.fire('submit', { data: this.toJSON() });
- },
-
- /**
- * Post render method. Called after the control has been rendered to the target.
- *
- * @method postRender
- * @return {tinymce.ui.ComboBox} Current combobox instance.
- */
- postRender: function () {
- var self = this;
-
- self._super();
- self.fromJSON(self.settings.data);
- },
-
- bindStates: function () {
- var self = this;
-
- self._super();
-
- function recalcLabels() {
- var maxLabelWidth = 0, labels = [], i, labelGap, items;
-
- if (self.settings.labelGapCalc === false) {
- return;
- }
-
- if (self.settings.labelGapCalc == "children") {
- items = self.find('formitem');
- } else {
- items = self.items();
- }
-
- items.filter('formitem').each(function (item) {
- var labelCtrl = item.items()[0], labelWidth = labelCtrl.getEl().clientWidth;
-
- maxLabelWidth = labelWidth > maxLabelWidth ? labelWidth : maxLabelWidth;
- labels.push(labelCtrl);
- });
-
- labelGap = self.settings.labelGap || 0;
-
- i = labels.length;
- while (i--) {
- labels[i].settings.minWidth = maxLabelWidth + labelGap;
- }
- }
-
- self.on('show', recalcLabels);
- recalcLabels();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * FieldSet.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class creates fieldset containers.
- *
- * @-x-less FieldSet.less
- * @class tinymce.ui.FieldSet
- * @extends tinymce.ui.Form
- */
-define(
- 'tinymce.core.ui.FieldSet',
- [
- "tinymce.core.ui.Form"
- ],
- function (Form) {
- "use strict";
-
- return Form.extend({
- Defaults: {
- containerCls: 'fieldset',
- layout: 'flex',
- direction: 'column',
- align: 'stretch',
- flex: 1,
- padding: "25 15 5 15",
- labelGap: 30,
- spacing: 10,
- border: 1
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, layout = self._layout, prefix = self.classPrefix;
-
- self.preRender();
- layout.preRender(self);
-
- return (
- '<fieldset id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1">' +
- (self.settings.title ? ('<legend id="' + self._id + '-title" class="' + prefix + 'fieldset-title">' +
- self.settings.title + '</legend>') : '') +
- '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' +
- (self.settings.html || '') + layout.renderHtml(self) +
- '</div>' +
- '</fieldset>'
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ };
+ var insertNewBlockAfter = function () {
+ if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName !== 'HGROUP') {
+ newBlock = createNewBlock(newBlockName);
+ } else {
+ newBlock = createNewBlock();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_6msxiw2jjfuw8lkv.shouldEndContainerOnEmptyBlock(editor) && canSplitBlock(dom, containerBlock) && dom.isEmpty(parentBlock)) {
+ newBlock = dom.split(containerBlock, parentBlock);
+ } else {
+ dom.insertAfter(newBlock, parentBlock);
+ }
+ $_cm0iqf6yjfuw8mgv.moveToCaretPosition(editor, newBlock);
+ };
+ $_970szt3yjfuw8ly1.normalize(dom, rng).each(function (normRng) {
+ rng.setStart(normRng.startContainer, normRng.startOffset);
+ rng.setEnd(normRng.endContainer, normRng.endOffset);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * LinkTargets.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This module is enables you to get anything that you can link to in a element.
- *
- * @private
- * @class tinymce.content.LinkTargets
- */
-define(
- 'tinymce.core.content.LinkTargets',
- [
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.SelectorFilter',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.dom.NodeType',
- 'tinymce.core.util.Arr',
- 'tinymce.core.util.Fun',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.Uuid'
- ],
- function (Element, SelectorFilter, DOMUtils, NodeType, Arr, Fun, Tools, Uuid) {
- var trim = Tools.trim;
-
- var create = function (type, title, url, level, attach) {
- return {
- type: type,
- title: title,
- url: url,
- level: level,
- attach: attach
- };
- };
-
- var isChildOfContentEditableTrue = function (node) {
- while ((node = node.parentNode)) {
- var value = node.contentEditable;
- if (value && value !== 'inherit') {
- return NodeType.isContentEditableTrue(node);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ container = rng.startContainer;
+ offset = rng.startOffset;
+ newBlockName = $_6msxiw2jjfuw8lkv.getForcedRootBlock(editor);
+ shiftKey = evt.shiftKey;
+ if ($_ey7ka11qjfuw8ldg.isElement(container) && container.hasChildNodes()) {
+ isAfterLastNodeInContainer = offset > container.childNodes.length - 1;
+ container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
+ if (isAfterLastNodeInContainer && $_ey7ka11qjfuw8ldg.isText(container)) {
+ offset = container.nodeValue.length;
+ } else {
+ offset = 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ editableRoot = getEditableRoot$1(dom, container);
+ if (!editableRoot) {
+ return;
+ }
+ if (newBlockName && !shiftKey || !newBlockName && shiftKey) {
+ container = wrapSelfAndSiblingsInDefaultBlock(editor, newBlockName, rng, container, offset);
+ }
+ parentBlock = dom.getParent(container, dom.isBlock);
+ containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;
+ parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : '';
+ containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : '';
+ if (containerBlockName === 'LI' && !evt.ctrlKey) {
+ parentBlock = containerBlock;
+ containerBlock = containerBlock.parentNode;
+ parentBlockName = containerBlockName;
+ }
+ if (/^(LI|DT|DD)$/.test(parentBlockName)) {
+ if (dom.isEmpty(parentBlock)) {
+ $_cdzn766xjfuw8mgs.insert(editor, createNewBlock, containerBlock, parentBlock, newBlockName);
+ return;
+ }
+ }
+ if (newBlockName && parentBlock === editor.getBody()) {
+ return;
+ }
+ newBlockName = newBlockName || 'P';
+ if (isCaretContainerBlock(parentBlock)) {
+ newBlock = showCaretContainerBlock(parentBlock);
+ if (dom.isEmpty(parentBlock)) {
+ emptyBlock(parentBlock);
+ }
+ $_cm0iqf6yjfuw8mgv.moveToCaretPosition(editor, newBlock);
+ } else if (isCaretAtStartOrEndOfBlock()) {
+ insertNewBlockAfter();
+ } else if (isCaretAtStartOrEndOfBlock(true)) {
+ newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock);
+ $_cm0iqf6yjfuw8mgv.moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') ? newBlock : parentBlock);
+ } else {
+ tmpRng = includeZwspInRange(rng).cloneRange();
+ tmpRng.setEndAfter(parentBlock);
+ fragment = tmpRng.extractContents();
+ trimLeadingLineBreaks(fragment);
+ newBlock = fragment.firstChild;
+ dom.insertAfter(fragment, parentBlock);
+ trimInlineElementsOnLeftSideOfBlock(dom, nonEmptyElementsMap, newBlock);
+ addBrToBlockIfNeeded(dom, parentBlock);
+ if (dom.isEmpty(parentBlock)) {
+ emptyBlock(parentBlock);
+ }
+ newBlock.normalize();
+ if (dom.isEmpty(newBlock)) {
+ dom.remove(newBlock);
+ insertNewBlockAfter();
+ } else {
+ $_cm0iqf6yjfuw8mgv.moveToCaretPosition(editor, newBlock);
+ }
+ }
+ dom.setAttrib(newBlock, 'id', '');
+ editor.fire('NewBlock', { newBlock: newBlock });
+ };
+ var $_8l5fmu6wjfuw8mgc = { insert: insert$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return false;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var matchesSelector = function (editor, selector) {
+ return $_cm0iqf6yjfuw8mgv.getParentBlock(editor).filter(function (parentBlock) {
+ return selector.length > 0 && $_fbwcti1fjfuw8lbx.is($_c9h6qlzjfuw8l98.fromDom(parentBlock), selector);
+ }).isSome();
+ };
+ var shouldInsertBr = function (editor) {
+ return matchesSelector(editor, $_6msxiw2jjfuw8lkv.getBrNewLineSelector(editor));
+ };
+ var shouldBlockNewLine = function (editor) {
+ return matchesSelector(editor, $_6msxiw2jjfuw8lkv.getNoNewLineSelector(editor));
+ };
+ var $_5bc62770jfuw8mh9 = {
+ shouldInsertBr: shouldInsertBr,
+ shouldBlockNewLine: shouldBlockNewLine
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var select = function (selector, root) {
- return Arr.map(SelectorFilter.descendants(Element.fromDom(root), selector), function (element) {
- return element.dom();
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var newLineAction = $_5ac1li3ijfuw8lqv.generate([
+ { br: [] },
+ { block: [] },
+ { none: [] }
+ ]);
+ var shouldBlockNewLine$1 = function (editor, shiftKey) {
+ return $_5bc62770jfuw8mh9.shouldBlockNewLine(editor);
+ };
+ var isBrMode = function (requiredState) {
+ return function (editor, shiftKey) {
+ var brMode = $_6msxiw2jjfuw8lkv.getForcedRootBlock(editor) === '';
+ return brMode === requiredState;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getElementText = function (elm) {
- return elm.innerText || elm.textContent;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var inListBlock = function (requiredState) {
+ return function (editor, shiftKey) {
+ return $_cm0iqf6yjfuw8mgv.isListItemParentBlock(editor) === requiredState;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getOrGenerateId = function (elm) {
- return elm.id ? elm.id : Uuid.uuid('h');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var inPreBlock = function (requiredState) {
+ return function (editor, shiftKey) {
+ var inPre = $_cm0iqf6yjfuw8mgv.getParentBlockName(editor) === 'PRE';
+ return inPre === requiredState;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isAnchor = function (elm) {
- return elm && elm.nodeName === 'A' && (elm.id || elm.name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var shouldPutBrInPre$1 = function (requiredState) {
+ return function (editor, shiftKey) {
+ return $_6msxiw2jjfuw8lkv.shouldPutBrInPre(editor) === requiredState;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isValidAnchor = function (elm) {
- return isAnchor(elm) && isEditable(elm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var inBrContext = function (editor, shiftKey) {
+ return $_5bc62770jfuw8mh9.shouldInsertBr(editor);
+ };
+ var hasShiftKey = function (editor, shiftKey) {
+ return shiftKey;
+ };
+ var canInsertIntoEditableRoot = function (editor) {
+ var forcedRootBlock = $_6msxiw2jjfuw8lkv.getForcedRootBlock(editor);
+ var rootEditable = $_cm0iqf6yjfuw8mgv.getEditableRoot(editor.dom, editor.selection.getStart());
+ return rootEditable && editor.schema.isValidChild(rootEditable.nodeName, forcedRootBlock ? forcedRootBlock : 'P');
+ };
+ var match$2 = function (predicates, action) {
+ return function (editor, shiftKey) {
+ var isMatch = $_9ek1bp4jfuw8kxg.foldl(predicates, function (res, p) {
+ return res && p(editor, shiftKey);
+ }, true);
+ return isMatch ? Option.some(action) : Option.none();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var getAction$1 = function (editor, evt) {
+ return $_d9qu763ojfuw8lvl.evaluateUntil([
+ match$2([shouldBlockNewLine$1], newLineAction.none()),
+ match$2([
+ inPreBlock(true),
+ shouldPutBrInPre$1(false),
+ hasShiftKey
+ ], newLineAction.br()),
+ match$2([
+ inPreBlock(true),
+ shouldPutBrInPre$1(false)
+ ], newLineAction.block()),
+ match$2([
+ inPreBlock(true),
+ shouldPutBrInPre$1(true),
+ hasShiftKey
+ ], newLineAction.block()),
+ match$2([
+ inPreBlock(true),
+ shouldPutBrInPre$1(true)
+ ], newLineAction.br()),
+ match$2([
+ inListBlock(true),
+ hasShiftKey
+ ], newLineAction.br()),
+ match$2([inListBlock(true)], newLineAction.block()),
+ match$2([
+ isBrMode(true),
+ hasShiftKey,
+ canInsertIntoEditableRoot
+ ], newLineAction.block()),
+ match$2([isBrMode(true)], newLineAction.br()),
+ match$2([inBrContext], newLineAction.br()),
+ match$2([
+ isBrMode(false),
+ hasShiftKey
+ ], newLineAction.br()),
+ match$2([canInsertIntoEditableRoot], newLineAction.block())
+ ], [
+ editor,
+ evt.shiftKey
+ ]).getOr(newLineAction.none());
+ };
+ var $_buedid6zjfuw8mh3 = { getAction: getAction$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isHeader = function (elm) {
- return elm && /^(H[1-6])$/.test(elm.nodeName);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var insert$3 = function (editor, evt) {
+ $_buedid6zjfuw8mh3.getAction(editor, evt).fold(function () {
+ $_c7z3y13xjfuw8lxq.insert(editor, evt);
+ }, function () {
+ $_8l5fmu6wjfuw8mgc.insert(editor, evt);
+ }, $_68e81l6jfuw8kyc.noop);
+ };
+ var $_1kudjf6vjfuw8mg6 = { insert: insert$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isEditable = function (elm) {
- return isChildOfContentEditableTrue(elm) && !NodeType.isContentEditableFalse(elm);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var endTypingLevel = function (undoManager) {
+ if (undoManager.typing) {
+ undoManager.typing = false;
+ undoManager.add();
+ }
+ };
+ var handleEnterKeyEvent = function (editor, event) {
+ if (event.isDefaultPrevented()) {
+ return;
+ }
+ event.preventDefault();
+ endTypingLevel(editor.undoManager);
+ editor.undoManager.transact(function () {
+ if (editor.selection.isCollapsed() === false) {
+ editor.execCommand('Delete');
+ }
+ $_1kudjf6vjfuw8mg6.insert(editor, event);
+ });
+ };
+ var setup$7 = function (editor) {
+ editor.on('keydown', function (event) {
+ if (event.keyCode === $_1nvqmv5ajfuw8m5j.ENTER) {
+ handleEnterKeyEvent(editor, event);
+ }
+ });
+ };
+ var $_650vyj6ujfuw8mg5 = { setup: setup$7 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var isValidHeader = function (elm) {
- return isHeader(elm) && isEditable(elm);
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isValidInsertPoint = function (location, caretPosition) {
+ return isAtStartOrEnd(location) && $_ey7ka11qjfuw8ldg.isText(caretPosition.container());
+ };
+ var insertNbspAtPosition = function (editor, caretPosition) {
+ var container = caretPosition.container();
+ var offset = caretPosition.offset();
+ container.insertData(offset, '\xA0');
+ editor.selection.setCursorLocation(container, offset + 1);
+ };
+ var insertAtLocation = function (editor, caretPosition, location) {
+ if (isValidInsertPoint(location, caretPosition)) {
+ insertNbspAtPosition(editor, caretPosition);
+ return true;
+ } else {
+ return false;
+ }
+ };
+ var insertAtCaret$2 = function (editor) {
+ var isInlineTarget = $_68e81l6jfuw8kyc.curry($_exgtt937jfuw8loj.isInlineTarget, editor);
+ var caretPosition = CaretPosition$1.fromRangeStart(editor.selection.getRng());
+ var boundaryLocation = $_80edfj3njfuw8lvb.readLocation(isInlineTarget, editor.getBody(), caretPosition);
+ return boundaryLocation.map($_68e81l6jfuw8kyc.curry(insertAtLocation, editor, caretPosition)).getOr(false);
+ };
+ var isAtStartOrEnd = function (location) {
+ return location.fold($_68e81l6jfuw8kyc.constant(false), $_68e81l6jfuw8kyc.constant(true), $_68e81l6jfuw8kyc.constant(true), $_68e81l6jfuw8kyc.constant(false));
+ };
+ var insertAtSelection = function (editor) {
+ return editor.selection.isCollapsed() ? insertAtCaret$2(editor) : false;
+ };
+ var $_62p2nv72jfuw8mhf = { insertAtSelection: insertAtSelection };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var getLevel = function (elm) {
- return isHeader(elm) ? parseInt(elm.nodeName.substr(1), 10) : 0;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var executeKeydownOverride$2 = function (editor, evt) {
+ $_16uyj26rjfuw8mfp.execute([{
+ keyCode: $_1nvqmv5ajfuw8m5j.SPACEBAR,
+ action: $_16uyj26rjfuw8mfp.action($_62p2nv72jfuw8mhf.insertAtSelection, editor)
+ }], evt).each(function (_) {
+ evt.preventDefault();
+ });
+ };
+ var setup$8 = function (editor) {
+ editor.on('keydown', function (evt) {
+ if (evt.isDefaultPrevented() === false) {
+ executeKeydownOverride$2(editor, evt);
+ }
+ });
+ };
+ var $_8bru0u71jfuw8mhd = { setup: setup$8 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var headerTarget = function (elm) {
- var headerId = getOrGenerateId(elm);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var findBlockCaretContainer = function (editor) {
+ return $_94zo1v3cjfuw8lpg.descendant($_c9h6qlzjfuw8l98.fromDom(editor.getBody()), '*[data-mce-caret]').fold($_68e81l6jfuw8kyc.constant(null), function (elm) {
+ return elm.dom();
+ });
+ };
+ var removeIeControlRect = function (editor) {
+ editor.selection.setRng(editor.selection.getRng());
+ };
+ var showBlockCaretContainer = function (editor, blockCaretContainer) {
+ if (blockCaretContainer.hasAttribute('data-mce-caret')) {
+ showCaretContainerBlock(blockCaretContainer);
+ removeIeControlRect(editor);
+ editor.selection.scrollIntoView(blockCaretContainer);
+ }
+ };
+ var handleBlockContainer = function (editor, e) {
+ var blockCaretContainer = findBlockCaretContainer(editor);
+ if (!blockCaretContainer) {
+ return;
+ }
+ if (e.type === 'compositionstart') {
+ e.preventDefault();
+ e.stopPropagation();
+ showBlockCaretContainer(editor, blockCaretContainer);
+ return;
+ }
+ if (hasContent(blockCaretContainer)) {
+ showBlockCaretContainer(editor, blockCaretContainer);
+ editor.undoManager.add();
+ }
+ };
+ var setup$9 = function (editor) {
+ editor.on('keyup compositionstart', $_68e81l6jfuw8kyc.curry(handleBlockContainer, editor));
+ };
+ var $_9ktdd473jfuw8mhi = { setup: setup$9 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var attach = function () {
- elm.id = headerId;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setup$10 = function (editor) {
+ var caret = $_enc4983pjfuw8lvo.setupSelectedState(editor);
+ $_9ktdd473jfuw8mhi.setup(editor);
+ $_2prsz46pjfuw8mff.setup(editor, caret);
+ $_9h3qgr6sjfuw8mfv.setup(editor, caret);
+ $_650vyj6ujfuw8mg5.setup(editor);
+ $_8bru0u71jfuw8mhd.setup(editor);
+ };
+ var $_8u7nyh6ojfuw8mfe = { setup: setup$10 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return create('header', getElementText(elm), '#' + headerId, getLevel(elm), attach);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function Quirks (editor) {
+ var each = $_52qop8kjfuw8l6v.each;
+ var BACKSPACE = $_1nvqmv5ajfuw8m5j.BACKSPACE, DELETE = $_1nvqmv5ajfuw8m5j.DELETE, dom = editor.dom, selection = editor.selection, settings = editor.settings, parser = editor.parser;
+ var isGecko = $_9fhi43ajfuw8l13.gecko, isIE = $_9fhi43ajfuw8l13.ie, isWebKit = $_9fhi43ajfuw8l13.webkit;
+ var mceInternalUrlPrefix = 'data:text/mce-internal,';
+ var mceInternalDataType = isIE ? 'Text' : 'URL';
+ var setEditorCommandState = function (cmd, state) {
+ try {
+ editor.getDoc().execCommand(cmd, false, state);
+ } catch (ex) {
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var anchorTarget = function (elm) {
- var anchorId = elm.id || elm.name;
- var anchorText = getElementText(elm);
-
- return create('anchor', anchorText ? anchorText : '#' + anchorId, '#' + anchorId, 0, Fun.noop);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isDefaultPrevented = function (e) {
+ return e.isDefaultPrevented();
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getHeaderTargets = function (elms) {
- return Arr.map(Arr.filter(elms, isValidHeader), headerTarget);
- };
-
- var getAnchorTargets = function (elms) {
- return Arr.map(Arr.filter(elms, isValidAnchor), anchorTarget);
- };
-
- var getTargetElements = function (elm) {
- var elms = select('h1,h2,h3,h4,h5,h6,a:not([href])', elm);
- return elms;
- };
-
- var hasTitle = function (target) {
- return trim(target.title).length > 0;
- };
-
- var find = function (elm) {
- var elms = getTargetElements(elm);
- return Arr.filter(getHeaderTargets(elms).concat(getAnchorTargets(elms)), hasTitle);
- };
-
- return {
- find: find
- };
- }
-);
-
-/**
- * FilePicker.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class creates a file picker control.
- *
- * @class tinymce.ui.FilePicker
- * @extends tinymce.ui.ComboBox
- */
-define(
- 'tinymce.core.ui.FilePicker',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'global!window',
- 'tinymce.core.content.LinkTargets',
- 'tinymce.core.EditorManager',
- 'tinymce.core.ui.ComboBox',
- 'tinymce.core.util.Tools'
- ],
- function (Arr, Fun, window, LinkTargets, EditorManager, ComboBox, Tools) {
- "use strict";
-
- var getActiveEditor = function () {
- return window.tinymce ? window.tinymce.activeEditor : EditorManager.activeEditor;
- };
-
- var history = {};
- var HISTORY_LENGTH = 5;
-
- var toMenuItem = function (target) {
- return {
- title: target.title,
- value: {
- title: { raw: target.title },
- url: target.url,
- attach: target.attach
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setMceInternalContent = function (e) {
+ var selectionHtml, internalContent;
+ if (e.dataTransfer) {
+ if (editor.selection.isCollapsed() && e.target.tagName === 'IMG') {
+ selection.select(e.target);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
- };
-
- var toMenuItems = function (targets) {
- return Tools.map(targets, toMenuItem);
- };
-
- var staticMenuItem = function (title, url) {
- return {
- title: title,
- value: {
- title: title,
- url: url,
- attach: Fun.noop
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ selectionHtml = editor.selection.getContent();
+ if (selectionHtml.length > 0) {
+ internalContent = mceInternalUrlPrefix + escape(editor.id) + ',' + escape(selectionHtml);
+ e.dataTransfer.setData(mceInternalDataType, internalContent);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var isUniqueUrl = function (url, targets) {
- var foundTarget = Arr.exists(targets, function (target) {
- return target.url === url;
- });
-
- return !foundTarget;
- };
-
- var getSetting = function (editorSettings, name, defaultValue) {
- var value = name in editorSettings ? editorSettings[name] : defaultValue;
- return value === false ? null : value;
- };
-
- var createMenuItems = function (term, targets, fileType, editorSettings) {
- var separator = { title: '-' };
-
- var fromHistoryMenuItems = function (history) {
- var historyItems = history.hasOwnProperty(fileType) ? history[fileType] : [ ];
- var uniqueHistory = Arr.filter(historyItems, function (url) {
- return isUniqueUrl(url, targets);
- });
-
- return Tools.map(uniqueHistory, function (url) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var getMceInternalContent = function (e) {
+ var internalContent;
+ if (e.dataTransfer) {
+ internalContent = e.dataTransfer.getData(mceInternalDataType);
+ if (internalContent && internalContent.indexOf(mceInternalUrlPrefix) >= 0) {
+ internalContent = internalContent.substr(mceInternalUrlPrefix.length).split(',');
</ins><span class="cx" style="display: block; padding: 0 10px"> return {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- title: url,
- value: {
- title: url,
- url: url,
- attach: Fun.noop
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ id: unescape(internalContent[0]),
+ html: unescape(internalContent[1])
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- };
-
- var fromMenuItems = function (type) {
- var filteredTargets = Arr.filter(targets, function (target) {
- return target.type === type;
- });
-
- return toMenuItems(filteredTargets);
- };
-
- var anchorMenuItems = function () {
- var anchorMenuItems = fromMenuItems('anchor');
- var topAnchor = getSetting(editorSettings, 'anchor_top', '#top');
- var bottomAchor = getSetting(editorSettings, 'anchor_bottom', '#bottom');
-
- if (topAnchor !== null) {
- anchorMenuItems.unshift(staticMenuItem('<top>', topAnchor));
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (bottomAchor !== null) {
- anchorMenuItems.push(staticMenuItem('<bottom>', bottomAchor));
- }
-
- return anchorMenuItems;
- };
-
- var join = function (items) {
- return Arr.foldl(items, function (a, b) {
- var bothEmpty = a.length === 0 || b.length === 0;
- return bothEmpty ? a.concat(b) : a.concat(separator, b);
- }, []);
- };
-
- if (editorSettings.typeahead_urls === false) {
- return [];
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return fileType === 'file' ? join([
- filterByQuery(term, fromHistoryMenuItems(history)),
- filterByQuery(term, fromMenuItems('header')),
- filterByQuery(term, anchorMenuItems())
- ]) : filterByQuery(term, fromHistoryMenuItems(history));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var addToHistory = function (url, fileType) {
- var items = history[fileType];
-
- if (!/^https?/.test(url)) {
- return;
- }
-
- if (items) {
- if (Arr.indexOf(items, url) === -1) {
- history[fileType] = items.slice(0, HISTORY_LENGTH).concat(url);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var insertClipboardContents = function (content, internal) {
+ if (editor.queryCommandSupported('mceInsertClipboardContent')) {
+ editor.execCommand('mceInsertClipboardContent', false, {
+ content: content,
+ internal: internal
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- history[fileType] = [url];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.execCommand('mceInsertContent', false, content);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var filterByQuery = function (term, menuItems) {
- var lowerCaseTerm = term.toLowerCase();
- var result = Tools.grep(menuItems, function (item) {
- return item.title.toLowerCase().indexOf(lowerCaseTerm) !== -1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var emptyEditorWhenDeleting = function () {
+ var serializeRng = function (rng) {
+ var body = dom.create('body');
+ var contents = rng.cloneContents();
+ body.appendChild(contents);
+ return selection.serializer.serialize(body, { format: 'html' });
+ };
+ var allContentsSelected = function (rng) {
+ var selection = serializeRng(rng);
+ var allRng = dom.createRng();
+ allRng.selectNode(editor.getBody());
+ var allSelection = serializeRng(allRng);
+ return selection === allSelection;
+ };
+ editor.on('keydown', function (e) {
+ var keyCode = e.keyCode;
+ var isCollapsed, body;
+ if (!isDefaultPrevented(e) && (keyCode === DELETE || keyCode === BACKSPACE)) {
+ isCollapsed = editor.selection.isCollapsed();
+ body = editor.getBody();
+ if (isCollapsed && !dom.isEmpty(body)) {
+ return;
+ }
+ if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {
+ return;
+ }
+ e.preventDefault();
+ editor.setContent('');
+ if (body.firstChild && dom.isBlock(body.firstChild)) {
+ editor.selection.setCursorLocation(body.firstChild, 0);
+ } else {
+ editor.selection.setCursorLocation(body, 0);
+ }
+ editor.nodeChanged();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return result.length === 1 && result[0].title === term ? [] : result;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getTitle = function (linkDetails) {
- var title = linkDetails.title;
- return title.raw ? title.raw : title;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var selectAll = function () {
+ editor.shortcuts.add('meta+a', null, 'SelectAll');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var setupAutoCompleteHandler = function (ctrl, editorSettings, bodyElm, fileType) {
- var autocomplete = function (term) {
- var linkTargets = LinkTargets.find(bodyElm);
- var menuItems = createMenuItems(term, linkTargets, fileType, editorSettings);
- ctrl.showAutoComplete(menuItems, term);
- };
-
- ctrl.on('autocomplete', function () {
- autocomplete(ctrl.value());
- });
-
- ctrl.on('selectitem', function (e) {
- var linkDetails = e.value;
-
- ctrl.value(linkDetails.url);
- var title = getTitle(linkDetails);
-
- if (fileType === 'image') {
- ctrl.fire('change', { meta: { alt: title, attach: linkDetails.attach } });
- } else {
- ctrl.fire('change', { meta: { text: title, attach: linkDetails.attach } });
- }
-
- ctrl.focus();
- });
-
- ctrl.on('click', function (e) {
- if (ctrl.value().length === 0 && e.target.nodeName === 'INPUT') {
- autocomplete('');
- }
- });
-
- ctrl.on('PostRender', function () {
- ctrl.getRoot().on('submit', function (e) {
- if (!e.isDefaultPrevented()) {
- addToHistory(ctrl.value(), fileType);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var inputMethodFocus = function () {
+ if (!editor.settings.content_editable) {
+ dom.bind(editor.getDoc(), 'mousedown mouseup', function (e) {
+ var rng;
+ if (e.target === editor.getDoc().documentElement) {
+ rng = selection.getRng();
+ editor.getBody().focus();
+ if (e.type === 'mousedown') {
+ if (isCaretContainer(rng.startContainer)) {
+ return;
+ }
+ selection.placeCaretAt(e.clientX, e.clientY);
+ } else {
+ selection.setRng(rng);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- };
-
- var statusToUiState = function (result) {
- var status = result.status, message = result.message;
-
- if (status === 'valid') {
- return { status: 'ok', message: message };
- } else if (status === 'unknown') {
- return { status: 'warn', message: message };
- } else if (status === 'invalid') {
- return { status: 'warn', message: message };
- } else {
- return { status: 'none', message: '' };
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var setupLinkValidatorHandler = function (ctrl, editorSettings, fileType) {
- var validatorHandler = editorSettings.filepicker_validator_handler;
- if (validatorHandler) {
- var validateUrl = function (url) {
- if (url.length === 0) {
- ctrl.statusLevel('none');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var removeHrOnBackspace = function () {
+ editor.on('keydown', function (e) {
+ if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {
+ if (!editor.getBody().getElementsByTagName('hr').length) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- validatorHandler({
- url: url,
- type: fileType
- }, function (result) {
- var uiState = statusToUiState(result);
-
- ctrl.statusMessage(uiState.message);
- ctrl.statusLevel(uiState.status);
- });
- };
-
- ctrl.state.on('change:value', function (e) {
- validateUrl(e.value);
- });
- }
- };
-
- return ComboBox.extend({
- /**
- * Constructs a new control instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- */
- init: function (settings) {
- var self = this, editor = getActiveEditor(), editorSettings = editor.settings;
- var actionCallback, fileBrowserCallback, fileBrowserCallbackTypes;
- var fileType = settings.filetype;
-
- settings.spellcheck = false;
-
- fileBrowserCallbackTypes = editorSettings.file_picker_types || editorSettings.file_browser_callback_types;
- if (fileBrowserCallbackTypes) {
- fileBrowserCallbackTypes = Tools.makeMap(fileBrowserCallbackTypes, /[, ]/);
- }
-
- if (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[fileType]) {
- fileBrowserCallback = editorSettings.file_picker_callback;
- if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[fileType])) {
- actionCallback = function () {
- var meta = self.fire('beforecall').meta;
-
- meta = Tools.extend({ filetype: fileType }, meta);
-
- // file_picker_callback(callback, currentValue, metaData)
- fileBrowserCallback.call(
- editor,
- function (value, meta) {
- self.value(value).fire('change', { meta: meta });
- },
- self.value(),
- meta
- );
- };
- } else {
- // Legacy callback: file_picker_callback(id, currentValue, filetype, window)
- fileBrowserCallback = editorSettings.file_browser_callback;
- if (fileBrowserCallback && (!fileBrowserCallbackTypes || fileBrowserCallbackTypes[fileType])) {
- actionCallback = function () {
- fileBrowserCallback(
- self.getEl('inp').id,
- self.value(),
- fileType,
- window
- );
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (selection.isCollapsed() && selection.getRng().startOffset === 0) {
+ var node = selection.getNode();
+ var previousSibling = node.previousSibling;
+ if (node.nodeName === 'HR') {
+ dom.remove(node);
+ e.preventDefault();
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === 'hr') {
+ dom.remove(previousSibling);
+ e.preventDefault();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (actionCallback) {
- settings.icon = 'browse';
- settings.onaction = actionCallback;
- }
-
- self._super(settings);
-
- setupAutoCompleteHandler(self, editorSettings, editor.getBody(), fileType);
- setupLinkValidatorHandler(self, editorSettings, fileType);
- }
- });
- }
-);
-/**
- * FitLayout.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This layout manager will resize the control to be the size of it's parent container.
- * In other words width: 100% and height: 100%.
- *
- * @-x-less FitLayout.less
- * @class tinymce.ui.FitLayout
- * @extends tinymce.ui.AbsoluteLayout
- */
-define(
- 'tinymce.core.ui.FitLayout',
- [
- "tinymce.core.ui.AbsoluteLayout"
- ],
- function (AbsoluteLayout) {
- "use strict";
-
- return AbsoluteLayout.extend({
- /**
- * Recalculates the positions of the controls in the specified container.
- *
- * @method recalc
- * @param {tinymce.ui.Container} container Container instance to recalc.
- */
- recalc: function (container) {
- var contLayoutRect = container.layoutRect(), paddingBox = container.paddingBox;
-
- container.items().filter(':visible').each(function (ctrl) {
- ctrl.layoutRect({
- x: paddingBox.left,
- y: paddingBox.top,
- w: contLayoutRect.innerW - paddingBox.right - paddingBox.left,
- h: contLayoutRect.innerH - paddingBox.top - paddingBox.bottom
- });
-
- if (ctrl.recalc) {
- ctrl.recalc();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var focusBody = function () {
+ if (!Range.prototype.getClientRects) {
+ editor.on('mousedown', function (e) {
+ if (!isDefaultPrevented(e) && e.target.nodeName === 'HTML') {
+ var body_1 = editor.getBody();
+ body_1.blur();
+ $_2m8wq9hjfuw8l41.setEditorTimeout(editor, function () {
+ body_1.focus();
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * FlexLayout.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This layout manager works similar to the CSS flex box.
- *
- * @setting {String} direction row|row-reverse|column|column-reverse
- * @setting {Number} flex A positive-number to flex by.
- * @setting {String} align start|end|center|stretch
- * @setting {String} pack start|end|justify
- *
- * @class tinymce.ui.FlexLayout
- * @extends tinymce.ui.AbsoluteLayout
- */
-define(
- 'tinymce.core.ui.FlexLayout',
- [
- "tinymce.core.ui.AbsoluteLayout"
- ],
- function (AbsoluteLayout) {
- "use strict";
-
- return AbsoluteLayout.extend({
- /**
- * Recalculates the positions of the controls in the specified container.
- *
- * @method recalc
- * @param {tinymce.ui.Container} container Container instance to recalc.
- */
- recalc: function (container) {
- // A ton of variables, needs to be in the same scope for performance
- var i, l, items, contLayoutRect, contPaddingBox, contSettings, align, pack, spacing, totalFlex, availableSpace, direction;
- var ctrl, ctrlLayoutRect, ctrlSettings, flex, maxSizeItems = [], size, maxSize, ratio, rect, pos, maxAlignEndPos;
- var sizeName, minSizeName, posName, maxSizeName, beforeName, innerSizeName, deltaSizeName, contentSizeName;
- var alignAxisName, alignInnerSizeName, alignSizeName, alignMinSizeName, alignBeforeName, alignAfterName;
- var alignDeltaSizeName, alignContentSizeName;
- var max = Math.max, min = Math.min;
-
- // Get container items, properties and settings
- items = container.items().filter(':visible');
- contLayoutRect = container.layoutRect();
- contPaddingBox = container.paddingBox;
- contSettings = container.settings;
- direction = container.isRtl() ? (contSettings.direction || 'row-reversed') : contSettings.direction;
- align = contSettings.align;
- pack = container.isRtl() ? (contSettings.pack || 'end') : contSettings.pack;
- spacing = contSettings.spacing || 0;
-
- if (direction == "row-reversed" || direction == "column-reverse") {
- items = items.set(items.toArray().reverse());
- direction = direction.split('-')[0];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var selectControlElements = function () {
+ editor.on('click', function (e) {
+ var target = e.target;
+ if (/^(IMG|HR)$/.test(target.nodeName) && dom.getContentEditableParent(target) !== 'false') {
+ e.preventDefault();
+ editor.selection.select(target);
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Setup axis variable name for row/column direction since the calculations is the same
- if (direction == "column") {
- posName = "y";
- sizeName = "h";
- minSizeName = "minH";
- maxSizeName = "maxH";
- innerSizeName = "innerH";
- beforeName = 'top';
- deltaSizeName = "deltaH";
- contentSizeName = "contentH";
-
- alignBeforeName = "left";
- alignSizeName = "w";
- alignAxisName = "x";
- alignInnerSizeName = "innerW";
- alignMinSizeName = "minW";
- alignAfterName = "right";
- alignDeltaSizeName = "deltaW";
- alignContentSizeName = "contentW";
- } else {
- posName = "x";
- sizeName = "w";
- minSizeName = "minW";
- maxSizeName = "maxW";
- innerSizeName = "innerW";
- beforeName = 'left';
- deltaSizeName = "deltaW";
- contentSizeName = "contentW";
-
- alignBeforeName = "top";
- alignSizeName = "h";
- alignAxisName = "y";
- alignInnerSizeName = "innerH";
- alignMinSizeName = "minH";
- alignAfterName = "bottom";
- alignDeltaSizeName = "deltaH";
- alignContentSizeName = "contentH";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (target.nodeName === 'A' && dom.hasClass(target, 'mce-item-anchor')) {
+ e.preventDefault();
+ selection.select(target);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Figure out total flex, availableSpace and collect any max size elements
- availableSpace = contLayoutRect[innerSizeName] - contPaddingBox[beforeName] - contPaddingBox[beforeName];
- maxAlignEndPos = totalFlex = 0;
- for (i = 0, l = items.length; i < l; i++) {
- ctrl = items[i];
- ctrlLayoutRect = ctrl.layoutRect();
- ctrlSettings = ctrl.settings;
- flex = ctrlSettings.flex;
- availableSpace -= (i < l - 1 ? spacing : 0);
-
- if (flex > 0) {
- totalFlex += flex;
-
- // Flexed item has a max size then we need to check if we will hit that size
- if (ctrlLayoutRect[maxSizeName]) {
- maxSizeItems.push(ctrl);
- }
-
- ctrlLayoutRect.flex = flex;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var removeStylesWhenDeletingAcrossBlockElements = function () {
+ var getAttributeApplyFunction = function () {
+ var template = dom.getAttribs(selection.getStart().cloneNode(false));
+ return function () {
+ var target = selection.getStart();
+ if (target !== editor.getBody()) {
+ dom.setAttrib(target, 'style', null);
+ each(template, function (attr) {
+ target.setAttributeNode(attr.cloneNode(true));
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- availableSpace -= ctrlLayoutRect[minSizeName];
-
- // Calculate the align end position to be used to check for overflow/underflow
- size = contPaddingBox[alignBeforeName] + ctrlLayoutRect[alignMinSizeName] + contPaddingBox[alignAfterName];
- if (size > maxAlignEndPos) {
- maxAlignEndPos = size;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ };
+ var isSelectionAcrossElements = function () {
+ return !selection.isCollapsed() && dom.getParent(selection.getStart(), dom.isBlock) !== dom.getParent(selection.getEnd(), dom.isBlock);
+ };
+ editor.on('keypress', function (e) {
+ var applyAttributes;
+ if (!isDefaultPrevented(e) && (e.keyCode === 8 || e.keyCode === 46) && isSelectionAcrossElements()) {
+ applyAttributes = getAttributeApplyFunction();
+ editor.getDoc().execCommand('delete', false, null);
+ applyAttributes();
+ e.preventDefault();
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Calculate minW/minH
- rect = {};
- if (availableSpace < 0) {
- rect[minSizeName] = contLayoutRect[minSizeName] - availableSpace + contLayoutRect[deltaSizeName];
- } else {
- rect[minSizeName] = contLayoutRect[innerSizeName] - availableSpace + contLayoutRect[deltaSizeName];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ dom.bind(editor.getDoc(), 'cut', function (e) {
+ var applyAttributes;
+ if (!isDefaultPrevented(e) && isSelectionAcrossElements()) {
+ applyAttributes = getAttributeApplyFunction();
+ $_2m8wq9hjfuw8l41.setEditorTimeout(editor, function () {
+ applyAttributes();
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- rect[alignMinSizeName] = maxAlignEndPos + contLayoutRect[alignDeltaSizeName];
-
- rect[contentSizeName] = contLayoutRect[innerSizeName] - availableSpace;
- rect[alignContentSizeName] = maxAlignEndPos;
- rect.minW = min(rect.minW, contLayoutRect.maxW);
- rect.minH = min(rect.minH, contLayoutRect.maxH);
- rect.minW = max(rect.minW, contLayoutRect.startMinWidth);
- rect.minH = max(rect.minH, contLayoutRect.startMinHeight);
-
- // Resize container container if minSize was changed
- if (contLayoutRect.autoResize && (rect.minW != contLayoutRect.minW || rect.minH != contLayoutRect.minH)) {
- rect.w = rect.minW;
- rect.h = rect.minH;
-
- container.layoutRect(rect);
- this.recalc(container);
-
- // Forced recalc for example if items are hidden/shown
- if (container._lastRect === null) {
- var parentCtrl = container.parent();
- if (parentCtrl) {
- parentCtrl._lastRect = null;
- parentCtrl.recalc();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var disableBackspaceIntoATable = function () {
+ editor.on('keydown', function (e) {
+ if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {
+ if (selection.isCollapsed() && selection.getRng().startOffset === 0) {
+ var previousSibling = selection.getNode().previousSibling;
+ if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === 'table') {
+ e.preventDefault();
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ };
+ var removeBlockQuoteOnBackSpace = function () {
+ editor.on('keydown', function (e) {
+ var rng, container, offset, root, parent;
+ if (isDefaultPrevented(e) || e.keyCode !== $_1nvqmv5ajfuw8m5j.BACKSPACE) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Handle max size elements, check if they will become to wide with current options
- ratio = availableSpace / totalFlex;
- for (i = 0, l = maxSizeItems.length; i < l; i++) {
- ctrl = maxSizeItems[i];
- ctrlLayoutRect = ctrl.layoutRect();
- maxSize = ctrlLayoutRect[maxSizeName];
- size = ctrlLayoutRect[minSizeName] + ctrlLayoutRect.flex * ratio;
-
- if (size > maxSize) {
- availableSpace -= (ctrlLayoutRect[maxSizeName] - ctrlLayoutRect[minSizeName]);
- totalFlex -= ctrlLayoutRect.flex;
- ctrlLayoutRect.flex = 0;
- ctrlLayoutRect.maxFlexSize = maxSize;
- } else {
- ctrlLayoutRect.maxFlexSize = 0;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ rng = selection.getRng();
+ container = rng.startContainer;
+ offset = rng.startOffset;
+ root = dom.getRoot();
+ parent = container;
+ if (!rng.collapsed || offset !== 0) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Setup new ratio, target layout rect, start position
- ratio = availableSpace / totalFlex;
- pos = contPaddingBox[beforeName];
- rect = {};
-
- // Handle pack setting moves the start position to end, center
- if (totalFlex === 0) {
- if (pack == "end") {
- pos = availableSpace + contPaddingBox[beforeName];
- } else if (pack == "center") {
- pos = Math.round(
- (contLayoutRect[innerSizeName] / 2) - ((contLayoutRect[innerSizeName] - availableSpace) / 2)
- ) + contPaddingBox[beforeName];
-
- if (pos < 0) {
- pos = contPaddingBox[beforeName];
- }
- } else if (pack == "justify") {
- pos = contPaddingBox[beforeName];
- spacing = Math.floor(availableSpace / (items.length - 1));
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ while (parent && parent.parentNode && parent.parentNode.firstChild === parent && parent.parentNode !== root) {
+ parent = parent.parentNode;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Default aligning (start) the other ones needs to be calculated while doing the layout
- rect[alignAxisName] = contPaddingBox[alignBeforeName];
-
- // Start laying out controls
- for (i = 0, l = items.length; i < l; i++) {
- ctrl = items[i];
- ctrlLayoutRect = ctrl.layoutRect();
- size = ctrlLayoutRect.maxFlexSize || ctrlLayoutRect[minSizeName];
-
- // Align the control on the other axis
- if (align === "center") {
- rect[alignAxisName] = Math.round((contLayoutRect[alignInnerSizeName] / 2) - (ctrlLayoutRect[alignSizeName] / 2));
- } else if (align === "stretch") {
- rect[alignSizeName] = max(
- ctrlLayoutRect[alignMinSizeName] || 0,
- contLayoutRect[alignInnerSizeName] - contPaddingBox[alignBeforeName] - contPaddingBox[alignAfterName]
- );
- rect[alignAxisName] = contPaddingBox[alignBeforeName];
- } else if (align === "end") {
- rect[alignAxisName] = contLayoutRect[alignInnerSizeName] - ctrlLayoutRect[alignSizeName] - contPaddingBox.top;
- }
-
- // Calculate new size based on flex
- if (ctrlLayoutRect.flex > 0) {
- size += ctrlLayoutRect.flex * ratio;
- }
-
- rect[sizeName] = size;
- rect[posName] = pos;
- ctrl.layoutRect(rect);
-
- // Recalculate containers
- if (ctrl.recalc) {
- ctrl.recalc();
- }
-
- // Move x/y position
- pos += size + spacing;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (parent.tagName === 'BLOCKQUOTE') {
+ editor.formatter.toggle('blockquote', null, parent);
+ rng = dom.createRng();
+ rng.setStart(container, 0);
+ rng.setEnd(container, 0);
+ selection.setRng(rng);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ };
+ var setGeckoEditingOptions = function () {
+ var setOpts = function () {
+ setEditorCommandState('StyleWithCSS', false);
+ setEditorCommandState('enableInlineTableEditing', false);
+ if (!settings.object_resizing) {
+ setEditorCommandState('enableObjectResizing', false);
+ }
+ };
+ if (!settings.readonly) {
+ editor.on('BeforeExecCommand MouseDown', setOpts);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * FlowLayout.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This layout manager will place the controls by using the browsers native layout.
- *
- * @-x-less FlowLayout.less
- * @class tinymce.ui.FlowLayout
- * @extends tinymce.ui.Layout
- */
-define(
- 'tinymce.core.ui.FlowLayout',
- [
- "tinymce.core.ui.Layout"
- ],
- function (Layout) {
- return Layout.extend({
- Defaults: {
- containerClass: 'flow-layout',
- controlClass: 'flow-layout-item',
- endClass: 'break'
- },
-
- /**
- * Recalculates the positions of the controls in the specified container.
- *
- * @method recalc
- * @param {tinymce.ui.Container} container Container instance to recalc.
- */
- recalc: function (container) {
- container.items().filter(':visible').each(function (ctrl) {
- if (ctrl.recalc) {
- ctrl.recalc();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var addBrAfterLastLinks = function () {
+ var fixLinks = function () {
+ each(dom.select('a'), function (node) {
+ var parentNode = node.parentNode;
+ var root = dom.getRoot();
+ if (parentNode.lastChild === node) {
+ while (parentNode && !dom.isBlock(parentNode)) {
+ if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) {
+ return;
+ }
+ parentNode = parentNode.parentNode;
+ }
+ dom.add(parentNode, 'br', { 'data-mce-bogus': 1 });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- isNative: function () {
- return true;
- }
- });
- }
-);
-/**
- * FontInfo.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Internal class for computing font size for elements.
- *
- * @private
- * @class tinymce.fmt.FontInfo
- */
-define(
- 'tinymce.core.fmt.FontInfo',
- [
- 'ephox.katamari.api.Fun',
- 'ephox.katamari.api.Option',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.node.Node',
- 'tinymce.core.dom.DOMUtils'
- ],
- function (Fun, Option, Element, Node, DOMUtils) {
- var getSpecifiedFontProp = function (propName, rootElm, elm) {
- while (elm !== rootElm) {
- if (elm.style[propName]) {
- var foundStyle = elm.style[propName];
- return foundStyle !== '' ? Option.some(foundStyle) : Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ editor.on('SetContent ExecCommand', function (e) {
+ if (e.type === 'setcontent' || e.command === 'mceInsertLink') {
+ fixLinks();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- elm = elm.parentNode;
- }
- return Option.none();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var toPt = function (fontSize) {
- if (/[0-9.]+px$/.test(fontSize)) {
- return Math.round(parseInt(fontSize, 10) * 72 / 96) + 'pt';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var setDefaultBlockType = function () {
+ if (settings.forced_root_block) {
+ editor.on('init', function () {
+ setEditorCommandState('DefaultParagraphSeparator', settings.forced_root_block);
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return fontSize;
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var normalizeFontFamily = function (fontFamily) {
- // 'Font name', Font -> Font name,Font
- return fontFamily.replace(/[\'\"]/g, '').replace(/,\s+/g, ',');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var normalizeSelection = function () {
+ editor.on('keyup focusin mouseup', function (e) {
+ if (!$_1nvqmv5ajfuw8m5j.modifierPressed(e)) {
+ selection.normalize();
+ }
+ }, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getComputedFontProp = function (propName, elm) {
- return Option.from(DOMUtils.DOM.getStyle(elm, propName, true));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var showBrokenImageIcon = function () {
+ editor.contentStyles.push('img:-moz-broken {' + '-moz-force-broken-image-icon:1;' + 'min-width:24px;' + 'min-height:24px' + '}');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var getFontProp = function (propName) {
- return function (rootElm, elm) {
- return Option.from(elm)
- .map(Element.fromDom)
- .filter(Node.isElement)
- .bind(function (element) {
- return getSpecifiedFontProp(propName, rootElm, element.dom())
- .or(getComputedFontProp(propName, element.dom()));
- })
- .getOr('');
- };
- };
-
- return {
- getFontSize: getFontProp('fontSize'),
- getFontFamily: Fun.compose(normalizeFontFamily, getFontProp('fontFamily')),
- toPt: toPt
- };
- }
-);
-
-/**
- * FormatControls.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Internal class containing all TinyMCE specific control types such as
- * format listboxes, fontlist boxes, toolbar buttons etc.
- *
- * @class tinymce.ui.FormatControls
- */
-define(
- 'tinymce.core.ui.FormatControls',
- [
- 'ephox.katamari.api.Arr',
- 'ephox.katamari.api.Fun',
- 'ephox.sugar.api.node.Element',
- 'ephox.sugar.api.search.SelectorFind',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.EditorManager',
- 'tinymce.core.Env',
- 'tinymce.core.fmt.FontInfo',
- 'tinymce.core.ui.Control',
- 'tinymce.core.ui.FloatPanel',
- 'tinymce.core.ui.Widget',
- 'tinymce.core.util.Tools'
- ],
- function (Arr, Fun, Element, SelectorFind, DOMUtils, EditorManager, Env, FontInfo, Control, FloatPanel, Widget, Tools) {
- var each = Tools.each;
-
- var flatten = function (ar) {
- return Arr.foldl(ar, function (result, item) {
- return result.concat(item);
- }, []);
- };
-
- EditorManager.on('AddEditor', function (e) {
- var editor = e.editor;
-
- setupRtlMode(editor);
- registerControls(editor);
- setupContainer(editor);
- });
-
- Control.translate = function (text) {
- return EditorManager.translate(text);
- };
-
- Widget.tooltips = !Env.iOS;
-
- function setupContainer(editor) {
- if (editor.settings.ui_container) {
- Env.container = SelectorFind.descendant(Element.fromDom(document.body), editor.settings.ui_container).fold(Fun.constant(null), function (elm) {
- return elm.dom();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var restoreFocusOnKeyDown = function () {
+ if (!editor.inline) {
+ editor.on('keydown', function () {
+ if (document.activeElement === document.body) {
+ editor.getWin().focus();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- function setupRtlMode(editor) {
- editor.on('ScriptsLoaded', function () {
- if (editor.rtl) {
- Control.rtl = true;
- }
- });
- }
-
- function registerControls(editor) {
- var formatMenu;
-
- function createListBoxChangeHandler(items, formatName) {
- return function () {
- var self = this;
-
- editor.on('nodeChange', function (e) {
- var formatter = editor.formatter;
- var value = null;
-
- each(e.parents, function (node) {
- each(items, function (item) {
- if (formatName) {
- if (formatter.matchNode(node, formatName, { value: item.value })) {
- value = item.value;
- }
- } else {
- if (formatter.matchNode(node, item.value)) {
- value = item.value;
- }
- }
-
- if (value) {
- return false;
- }
- });
-
- if (value) {
- return false;
- }
- });
-
- self.value(value);
- });
- };
- }
-
- function createFontNameListBoxChangeHandler(items) {
- return function () {
- var self = this;
-
- var getFirstFont = function (fontFamily) {
- return fontFamily ? fontFamily.split(',')[0] : '';
- };
-
- editor.on('init nodeChange', function (e) {
- var fontFamily, value = null;
-
- fontFamily = FontInfo.getFontFamily(editor.getBody(), e.element);
-
- each(items, function (item) {
- if (item.value.toLowerCase() === fontFamily.toLowerCase()) {
- value = item.value;
- }
- });
-
- each(items, function (item) {
- if (!value && getFirstFont(item.value).toLowerCase() === getFirstFont(fontFamily).toLowerCase()) {
- value = item.value;
- }
- });
-
- self.value(value);
-
- if (!value && fontFamily) {
- self.text(getFirstFont(fontFamily));
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var bodyHeight = function () {
+ if (!editor.inline) {
+ editor.contentStyles.push('body {min-height: 150px}');
+ editor.on('click', function (e) {
+ var rng;
+ if (e.target.nodeName === 'HTML') {
+ if ($_9fhi43ajfuw8l13.ie > 11) {
+ editor.getBody().focus();
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- };
- }
-
- function createFontSizeListBoxChangeHandler(items) {
- return function () {
- var self = this;
-
- editor.on('init nodeChange', function (e) {
- var px, pt, value = null;
-
- px = FontInfo.getFontSize(editor.getBody(), e.element);
- pt = FontInfo.toPt(px);
-
- each(items, function (item) {
- if (item.value === px) {
- value = px;
- } else if (item.value === pt) {
- value = pt;
- }
- });
-
- self.value(value);
-
- if (!value) {
- self.text(pt);
- }
- });
- };
- }
-
- function createFormats(formats) {
- formats = formats.replace(/;$/, '').split(';');
-
- var i = formats.length;
- while (i--) {
- formats[i] = formats[i].split('=');
- }
-
- return formats;
- }
-
- function createFormatMenu() {
- var count = 0, newFormats = [];
-
- var defaultStyleFormats = [
- {
- title: 'Headings', items: [
- { title: 'Heading 1', format: 'h1' },
- { title: 'Heading 2', format: 'h2' },
- { title: 'Heading 3', format: 'h3' },
- { title: 'Heading 4', format: 'h4' },
- { title: 'Heading 5', format: 'h5' },
- { title: 'Heading 6', format: 'h6' }
- ]
- },
-
- {
- title: 'Inline', items: [
- { title: 'Bold', icon: 'bold', format: 'bold' },
- { title: 'Italic', icon: 'italic', format: 'italic' },
- { title: 'Underline', icon: 'underline', format: 'underline' },
- { title: 'Strikethrough', icon: 'strikethrough', format: 'strikethrough' },
- { title: 'Superscript', icon: 'superscript', format: 'superscript' },
- { title: 'Subscript', icon: 'subscript', format: 'subscript' },
- { title: 'Code', icon: 'code', format: 'code' }
- ]
- },
-
- {
- title: 'Blocks', items: [
- { title: 'Paragraph', format: 'p' },
- { title: 'Blockquote', format: 'blockquote' },
- { title: 'Div', format: 'div' },
- { title: 'Pre', format: 'pre' }
- ]
- },
-
- {
- title: 'Alignment', items: [
- { title: 'Left', icon: 'alignleft', format: 'alignleft' },
- { title: 'Center', icon: 'aligncenter', format: 'aligncenter' },
- { title: 'Right', icon: 'alignright', format: 'alignright' },
- { title: 'Justify', icon: 'alignjustify', format: 'alignjustify' }
- ]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ rng = editor.selection.getRng();
+ editor.getBody().focus();
+ editor.selection.setRng(rng);
+ editor.selection.normalize();
+ editor.nodeChanged();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ];
-
- function createMenu(formats) {
- var menu = [];
-
- if (!formats) {
- return;
- }
-
- each(formats, function (format) {
- var menuItem = {
- text: format.title,
- icon: format.icon
- };
-
- if (format.items) {
- menuItem.menu = createMenu(format.items);
- } else {
- var formatName = format.format || "custom" + count++;
-
- if (!format.format) {
- format.name = formatName;
- newFormats.push(format);
- }
-
- menuItem.format = formatName;
- menuItem.cmd = format.cmd;
- }
-
- menu.push(menuItem);
- });
-
- return menu;
- }
-
- function createStylesMenu() {
- var menu;
-
- if (editor.settings.style_formats_merge) {
- if (editor.settings.style_formats) {
- menu = createMenu(defaultStyleFormats.concat(editor.settings.style_formats));
- } else {
- menu = createMenu(defaultStyleFormats);
- }
- } else {
- menu = createMenu(editor.settings.style_formats || defaultStyleFormats);
- }
-
- return menu;
- }
-
- editor.on('init', function () {
- each(newFormats, function (format) {
- editor.formatter.register(format.name, format);
- });
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- type: 'menu',
- items: createStylesMenu(),
- onPostRender: function (e) {
- editor.fire('renderFormatsMenu', { control: e.control });
- },
- itemDefaults: {
- preview: true,
-
- textStyle: function () {
- if (this.settings.format) {
- return editor.formatter.getCssText(this.settings.format);
- }
- },
-
- onPostRender: function () {
- var self = this;
-
- self.parent().on('show', function () {
- var formatName, command;
-
- formatName = self.settings.format;
- if (formatName) {
- self.disabled(!editor.formatter.canApply(formatName));
- self.active(editor.formatter.match(formatName));
- }
-
- command = self.settings.cmd;
- if (command) {
- self.active(editor.queryCommandState(command));
- }
- });
- },
-
- onclick: function () {
- if (this.settings.format) {
- toggleFormat(this.settings.format);
- }
-
- if (this.settings.cmd) {
- editor.execCommand(this.settings.cmd);
- }
- }
- }
- };
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- formatMenu = createFormatMenu();
-
- function initOnPostRender(name) {
- return function () {
- var self = this;
-
- // TODO: Fix this
- if (editor.formatter) {
- editor.formatter.formatChanged(name, function (state) {
- self.active(state);
- });
- } else {
- editor.on('init', function () {
- editor.formatter.formatChanged(name, function (state) {
- self.active(state);
- });
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var blockCmdArrowNavigation = function () {
+ if ($_9fhi43ajfuw8l13.mac) {
+ editor.on('keydown', function (e) {
+ if ($_1nvqmv5ajfuw8m5j.metaKeyPressed(e) && !e.shiftKey && (e.keyCode === 37 || e.keyCode === 39)) {
+ e.preventDefault();
+ editor.selection.getSel().modify('move', e.keyCode === 37 ? 'backward' : 'forward', 'lineboundary');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Simple format controls <control/format>:<UI text>
- each({
- bold: 'Bold',
- italic: 'Italic',
- underline: 'Underline',
- strikethrough: 'Strikethrough',
- subscript: 'Subscript',
- superscript: 'Superscript'
- }, function (text, name) {
- editor.addButton(name, {
- tooltip: text,
- onPostRender: initOnPostRender(name),
- onclick: function () {
- toggleFormat(name);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var disableAutoUrlDetect = function () {
+ setEditorCommandState('AutoUrlDetect', false);
+ };
+ var tapLinksAndImages = function () {
+ editor.on('click', function (e) {
+ var elm = e.target;
+ do {
+ if (elm.tagName === 'A') {
+ e.preventDefault();
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } while (elm = elm.parentNode);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Simple command controls <control>:[<UI text>,<Command>]
- each({
- outdent: ['Decrease indent', 'Outdent'],
- indent: ['Increase indent', 'Indent'],
- cut: ['Cut', 'Cut'],
- copy: ['Copy', 'Copy'],
- paste: ['Paste', 'Paste'],
- help: ['Help', 'mceHelp'],
- selectall: ['Select all', 'SelectAll'],
- removeformat: ['Clear formatting', 'RemoveFormat'],
- visualaid: ['Visual aids', 'mceToggleVisualAid'],
- newdocument: ['New document', 'mceNewDocument']
- }, function (item, name) {
- editor.addButton(name, {
- tooltip: item[0],
- cmd: item[1]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}');
+ };
+ var blockFormSubmitInsideEditor = function () {
+ editor.on('init', function () {
+ editor.dom.bind(editor.getBody(), 'submit', function (e) {
+ e.preventDefault();
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Simple command controls with format state
- each({
- blockquote: ['Blockquote', 'mceBlockQuote'],
- subscript: ['Subscript', 'Subscript'],
- superscript: ['Superscript', 'Superscript'],
- alignleft: ['Align left', 'JustifyLeft'],
- aligncenter: ['Align center', 'JustifyCenter'],
- alignright: ['Align right', 'JustifyRight'],
- alignjustify: ['Justify', 'JustifyFull'],
- alignnone: ['No alignment', 'JustifyNone']
- }, function (item, name) {
- editor.addButton(name, {
- tooltip: item[0],
- cmd: item[1],
- onPostRender: initOnPostRender(name)
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var removeAppleInterchangeBrs = function () {
+ parser.addNodeFilter('br', function (nodes) {
+ var i = nodes.length;
+ while (i--) {
+ if (nodes[i].attr('class') === 'Apple-interchange-newline') {
+ nodes[i].remove();
+ }
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function toggleUndoRedoState(type) {
- return function () {
- var self = this;
-
- function checkState() {
- var typeFn = type == 'redo' ? 'hasRedo' : 'hasUndo';
- return editor.undoManager ? editor.undoManager[typeFn]() : false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var ieInternalDragAndDrop = function () {
+ editor.on('dragstart', function (e) {
+ setMceInternalContent(e);
+ });
+ editor.on('drop', function (e) {
+ if (!isDefaultPrevented(e)) {
+ var internalContent = getMceInternalContent(e);
+ if (internalContent && internalContent.id !== editor.id) {
+ e.preventDefault();
+ var rng = $_dyytu76ejfuw8md2.fromPoint(e.x, e.y, editor.getDoc());
+ selection.setRng(rng);
+ insertClipboardContents(internalContent.html, true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.disabled(!checkState());
- editor.on('Undo Redo AddUndo TypingUndo ClearUndos SwitchMode', function () {
- self.disabled(editor.readonly || !checkState());
- });
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ };
+ var refreshContentEditable = function () {
+ };
+ var isHidden = function () {
+ var sel;
+ if (!isGecko || editor.removed) {
+ return 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ sel = editor.selection.getSel();
+ return !sel || !sel.rangeCount || sel.rangeCount === 0;
+ };
+ removeBlockQuoteOnBackSpace();
+ emptyEditorWhenDeleting();
+ if (!$_9fhi43ajfuw8l13.windowsPhone) {
+ normalizeSelection();
+ }
+ if (isWebKit) {
+ inputMethodFocus();
+ selectControlElements();
+ setDefaultBlockType();
+ blockFormSubmitInsideEditor();
+ disableBackspaceIntoATable();
+ removeAppleInterchangeBrs();
+ if ($_9fhi43ajfuw8l13.iOS) {
+ restoreFocusOnKeyDown();
+ bodyHeight();
+ tapLinksAndImages();
+ } else {
+ selectAll();
+ }
+ }
+ if ($_9fhi43ajfuw8l13.ie >= 11) {
+ bodyHeight();
+ disableBackspaceIntoATable();
+ }
+ if ($_9fhi43ajfuw8l13.ie) {
+ selectAll();
+ disableAutoUrlDetect();
+ ieInternalDragAndDrop();
+ }
+ if (isGecko) {
+ removeHrOnBackspace();
+ focusBody();
+ removeStylesWhenDeletingAcrossBlockElements();
+ setGeckoEditingOptions();
+ addBrAfterLastLinks();
+ showBrokenImageIcon();
+ blockCmdArrowNavigation();
+ disableBackspaceIntoATable();
+ }
+ return {
+ refreshContentEditable: refreshContentEditable,
+ isHidden: isHidden
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function toggleVisualAidState() {
- var self = this;
-
- editor.on('VisualAid', function (e) {
- self.active(e.hasVisual);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isTextBlockNode = function (node) {
+ return $_ey7ka11qjfuw8ldg.isElement(node) && isTextBlock($_c9h6qlzjfuw8l98.fromDom(node));
+ };
+ var normalizeSelection$1 = function (editor) {
+ var rng = editor.selection.getRng();
+ var startPos = CaretPosition.fromRangeStart(rng);
+ var endPos = CaretPosition.fromRangeEnd(rng);
+ if (CaretPosition.isElementPosition(startPos)) {
+ var container = startPos.container();
+ if (isTextBlockNode(container)) {
+ $_25kl2c2cjfuw8ljh.firstPositionIn(container).each(function (pos) {
+ return rng.setStart(pos.container(), pos.offset());
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.active(editor.hasVisual);
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var trimMenuItems = function (menuItems) {
- var outputMenuItems = menuItems;
-
- if (outputMenuItems.length > 0 && outputMenuItems[0].text === '-') {
- outputMenuItems = outputMenuItems.slice(1);
- }
-
- if (outputMenuItems.length > 0 && outputMenuItems[outputMenuItems.length - 1].text === '-') {
- outputMenuItems = outputMenuItems.slice(0, outputMenuItems.length - 1);
- }
-
- return outputMenuItems;
- };
-
- var createCustomMenuItems = function (names) {
- var items, nameList;
-
- if (typeof names === 'string') {
- nameList = names.split(' ');
- } else if (Tools.isArray(names)) {
- return flatten(Tools.map(names, createCustomMenuItems));
- }
-
- items = Tools.grep(nameList, function (name) {
- return name === '|' || name in editor.menuItems;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (CaretPosition.isElementPosition(endPos)) {
+ var container = startPos.container();
+ if (isTextBlockNode(container)) {
+ $_25kl2c2cjfuw8ljh.lastPositionIn(container).each(function (pos) {
+ return rng.setEnd(pos.container(), pos.offset());
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ }
+ editor.selection.setRng($_538lml30jfuw8ln4.normalize(rng));
+ };
+ var setup$11 = function (editor) {
+ editor.on('click', function (e) {
+ if (e.detail === 3) {
+ normalizeSelection$1(editor);
+ }
+ });
+ };
+ var $_3x9p1n75jfuw8mhz = { setup: setup$11 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return Tools.map(items, function (name) {
- return name === '|' ? { text: '-' } : editor.menuItems[name];
- });
- };
-
- var createContextMenuItems = function (context) {
- var outputMenuItems = [{ text: '-' }];
- var menuItems = Tools.grep(editor.menuItems, function (menuItem) {
- return menuItem.context === context;
- });
-
- Tools.each(menuItems, function (menuItem) {
- if (menuItem.separator == 'before') {
- outputMenuItems.push({ text: '|' });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$2 = DOMUtils$1.DOM;
+ var appendStyle = function (editor, text) {
+ var head = $_c9h6qlzjfuw8l98.fromDom(editor.getDoc().head);
+ var tag = $_c9h6qlzjfuw8l98.fromTag('style');
+ $_8g002u14jfuw8la5.set(tag, 'type', 'text/css');
+ $_doli6x2kjfuw8lky.append(tag, $_c9h6qlzjfuw8l98.fromText(text));
+ $_doli6x2kjfuw8lky.append(head, tag);
+ };
+ var createParser = function (editor) {
+ var parser = DomParser(editor.settings, editor.schema);
+ parser.addAttributeFilter('src,href,style,tabindex', function (nodes, name) {
+ var i = nodes.length, node;
+ var dom = editor.dom;
+ var value, internalName;
+ while (i--) {
+ node = nodes[i];
+ value = node.attr(name);
+ internalName = 'data-mce-' + name;
+ if (!node.attributes.map[internalName]) {
+ if (value.indexOf('data:') === 0 || value.indexOf('blob:') === 0) {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (menuItem.prependToContext) {
- outputMenuItems.unshift(menuItem);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (name === 'style') {
+ value = dom.serializeStyle(dom.parseStyle(value), node.name);
+ if (!value.length) {
+ value = null;
+ }
+ node.attr(internalName, value);
+ node.attr(name, value);
+ } else if (name === 'tabindex') {
+ node.attr(internalName, value);
+ node.attr(name, null);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- outputMenuItems.push(menuItem);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ node.attr(internalName, editor.convertURL(value, name, node.name));
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (menuItem.separator == 'after') {
- outputMenuItems.push({ text: '|' });
- }
- });
-
- return outputMenuItems;
- };
-
- var createInsertMenu = function (editorSettings) {
- if (editorSettings.insert_button_items) {
- return trimMenuItems(createCustomMenuItems(editorSettings.insert_button_items));
- } else {
- return trimMenuItems(createContextMenuItems('insert'));
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- editor.addButton('undo', {
- tooltip: 'Undo',
- onPostRender: toggleUndoRedoState('undo'),
- cmd: 'undo'
- });
-
- editor.addButton('redo', {
- tooltip: 'Redo',
- onPostRender: toggleUndoRedoState('redo'),
- cmd: 'redo'
- });
-
- editor.addMenuItem('newdocument', {
- text: 'New document',
- icon: 'newdocument',
- cmd: 'mceNewDocument'
- });
-
- editor.addMenuItem('undo', {
- text: 'Undo',
- icon: 'undo',
- shortcut: 'Meta+Z',
- onPostRender: toggleUndoRedoState('undo'),
- cmd: 'undo'
- });
-
- editor.addMenuItem('redo', {
- text: 'Redo',
- icon: 'redo',
- shortcut: 'Meta+Y',
- onPostRender: toggleUndoRedoState('redo'),
- cmd: 'redo'
- });
-
- editor.addMenuItem('visualaid', {
- text: 'Visual aids',
- selectable: true,
- onPostRender: toggleVisualAidState,
- cmd: 'mceToggleVisualAid'
- });
-
- editor.addButton('remove', {
- tooltip: 'Remove',
- icon: 'remove',
- cmd: 'Delete'
- });
-
- editor.addButton('insert', {
- type: 'menubutton',
- icon: 'insert',
- menu: [],
- oncreatemenu: function () {
- this.menu.add(createInsertMenu(editor.settings));
- this.menu.renderNew();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ });
+ parser.addNodeFilter('script', function (nodes) {
+ var i = nodes.length, node, type;
+ while (i--) {
+ node = nodes[i];
+ type = node.attr('type') || 'no/type';
+ if (type.indexOf('mce-') !== 0) {
+ node.attr('type', 'mce-' + type);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- each({
- cut: ['Cut', 'Cut', 'Meta+X'],
- copy: ['Copy', 'Copy', 'Meta+C'],
- paste: ['Paste', 'Paste', 'Meta+V'],
- selectall: ['Select all', 'SelectAll', 'Meta+A'],
- bold: ['Bold', 'Bold', 'Meta+B'],
- italic: ['Italic', 'Italic', 'Meta+I'],
- underline: ['Underline', 'Underline', 'Meta+U'],
- strikethrough: ['Strikethrough', 'Strikethrough'],
- subscript: ['Subscript', 'Subscript'],
- superscript: ['Superscript', 'Superscript'],
- removeformat: ['Clear formatting', 'RemoveFormat']
- }, function (item, name) {
- editor.addMenuItem(name, {
- text: item[0],
- icon: name,
- shortcut: item[2],
- cmd: item[1]
- });
- });
-
- editor.on('mousedown', function () {
- FloatPanel.hideAll();
- });
-
- function toggleFormat(fmt) {
- if (fmt.control) {
- fmt = fmt.control.value();
- }
-
- if (fmt) {
- editor.execCommand('mceToggleFormat', false, fmt);
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hideMenuObjects(menu) {
- var count = menu.length;
-
- Tools.each(menu, function (item) {
- if (item.menu) {
- item.hidden = hideMenuObjects(item.menu) === 0;
- }
-
- var formatName = item.format;
- if (formatName) {
- item.hidden = !editor.formatter.canApply(formatName);
- }
-
- if (item.hidden) {
- count--;
- }
- });
-
- return count;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ parser.addNodeFilter('#cdata', function (nodes) {
+ var i = nodes.length, node;
+ while (i--) {
+ node = nodes[i];
+ node.type = 8;
+ node.name = '#comment';
+ node.value = '[CDATA[' + node.value + ']]';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function hideFormatMenuItems(menu) {
- var count = menu.items().length;
-
- menu.items().each(function (item) {
- if (item.menu) {
- item.visible(hideFormatMenuItems(item.menu) > 0);
- }
-
- if (!item.menu && item.settings.menu) {
- item.visible(hideMenuObjects(item.settings.menu) > 0);
- }
-
- var formatName = item.settings.format;
- if (formatName) {
- item.visible(editor.formatter.canApply(formatName));
- }
-
- if (!item.visible()) {
- count--;
- }
- });
-
- return count;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function (nodes) {
+ var i = nodes.length, node;
+ var nonEmptyElements = editor.schema.getNonEmptyElements();
+ while (i--) {
+ node = nodes[i];
+ if (node.isEmpty(nonEmptyElements) && node.getAll('br').length === 0) {
+ node.append(new Node$2('br', 1)).shortEnded = true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.addButton('styleselect', {
- type: 'menubutton',
- text: 'Formats',
- menu: formatMenu,
- onShowMenu: function () {
- if (editor.settings.style_formats_autohide) {
- hideFormatMenuItems(this.menu);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ return parser;
+ };
+ var autoFocus = function (editor) {
+ if (editor.settings.auto_focus) {
+ $_2m8wq9hjfuw8l41.setEditorTimeout(editor, function () {
+ var focusEditor;
+ if (editor.settings.auto_focus === true) {
+ focusEditor = editor;
+ } else {
+ focusEditor = editor.editorManager.get(editor.settings.auto_focus);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!focusEditor.destroyed) {
+ focusEditor.focus();
+ }
+ }, 100);
+ }
+ };
+ var initEditor = function (editor) {
+ editor.bindPendingEventDelegates();
+ editor.initialized = true;
+ editor.fire('init');
+ editor.focus(true);
+ editor.nodeChanged({ initial: true });
+ editor.execCallback('init_instance_callback', editor);
+ autoFocus(editor);
+ };
+ var getStyleSheetLoader = function (editor) {
+ return editor.inline ? DOM$2.styleSheetLoader : editor.dom.styleSheetLoader;
+ };
+ var initContentBody = function (editor, skipWrite) {
+ var settings = editor.settings;
+ var targetElm = editor.getElement();
+ var doc = editor.getDoc(), body, contentCssText;
+ if (!settings.inline) {
+ editor.getElement().style.visibility = editor.orgVisibility;
+ }
+ if (!skipWrite && !settings.content_editable) {
+ doc.open();
+ doc.write(editor.iframeHTML);
+ doc.close();
+ }
+ if (settings.content_editable) {
+ editor.on('remove', function () {
+ var bodyEl = this.getBody();
+ DOM$2.removeClass(bodyEl, 'mce-content-body');
+ DOM$2.removeClass(bodyEl, 'mce-edit-focus');
+ DOM$2.setAttrib(bodyEl, 'contentEditable', null);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.addButton('formatselect', function () {
- var items = [], blocks = createFormats(editor.settings.block_formats ||
- 'Paragraph=p;' +
- 'Heading 1=h1;' +
- 'Heading 2=h2;' +
- 'Heading 3=h3;' +
- 'Heading 4=h4;' +
- 'Heading 5=h5;' +
- 'Heading 6=h6;' +
- 'Preformatted=pre'
- );
-
- each(blocks, function (block) {
- items.push({
- text: block[0],
- value: block[1],
- textStyle: function () {
- return editor.formatter.getCssText(block[1]);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ DOM$2.addClass(targetElm, 'mce-content-body');
+ editor.contentDocument = doc = settings.content_document || document;
+ editor.contentWindow = settings.content_window || window;
+ editor.bodyElement = targetElm;
+ settings.content_document = settings.content_window = null;
+ settings.root_name = targetElm.nodeName.toLowerCase();
+ }
+ body = editor.getBody();
+ body.disabled = true;
+ editor.readonly = settings.readonly;
+ if (!editor.readonly) {
+ if (editor.inline && DOM$2.getStyle(body, 'position', true) === 'static') {
+ body.style.position = 'relative';
+ }
+ body.contentEditable = editor.getParam('content_editable_state', true);
+ }
+ body.disabled = false;
+ editor.editorUpload = EditorUpload(editor);
+ editor.schema = Schema(settings);
+ editor.dom = DOMUtils$1(doc, {
+ keep_values: true,
+ url_converter: editor.convertURL,
+ url_converter_scope: editor,
+ hex_colors: settings.force_hex_style_colors,
+ class_filter: settings.class_filter,
+ update_styles: true,
+ root_element: editor.inline ? editor.getBody() : null,
+ collect: settings.content_editable,
+ schema: editor.schema,
+ onSetAttrib: function (e) {
+ editor.fire('SetAttrib', e);
+ }
+ });
+ editor.parser = createParser(editor);
+ editor.serializer = DomSerializer$1(settings, editor);
+ editor.selection = Selection$1(editor.dom, editor.getWin(), editor.serializer, editor);
+ editor.formatter = Formatter(editor);
+ editor.undoManager = UndoManager(editor);
+ editor._nodeChangeDispatcher = new NodeChange(editor);
+ editor._selectionOverrides = SelectionOverrides(editor);
+ $_3x9p1n75jfuw8mhz.setup(editor);
+ $_8u7nyh6ojfuw8mfe.setup(editor);
+ $_1x8v3o4zjfuw8m3j.setup(editor);
+ editor.fire('PreInit');
+ if (!settings.browser_spellcheck && !settings.gecko_spellcheck) {
+ doc.body.spellcheck = false;
+ DOM$2.setAttrib(body, 'spellcheck', 'false');
+ }
+ editor.quirks = Quirks(editor);
+ editor.fire('PostRender');
+ if (settings.directionality) {
+ body.dir = settings.directionality;
+ }
+ if (settings.nowrap) {
+ body.style.whiteSpace = 'nowrap';
+ }
+ if (settings.protect) {
+ editor.on('BeforeSetContent', function (e) {
+ $_52qop8kjfuw8l6v.each(settings.protect, function (pattern) {
+ e.content = e.content.replace(pattern, function (str) {
+ return '<!--mce:protected ' + escape(str) + '-->';
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return {
- type: 'listbox',
- text: blocks[0][0],
- values: items,
- fixedWidth: true,
- onselect: toggleFormat,
- onPostRender: createListBoxChangeHandler(items)
- };
</del><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.addButton('fontselect', function () {
- var defaultFontsFormats =
- 'Andale Mono=andale mono,monospace;' +
- 'Arial=arial,helvetica,sans-serif;' +
- 'Arial Black=arial black,sans-serif;' +
- 'Book Antiqua=book antiqua,palatino,serif;' +
- 'Comic Sans MS=comic sans ms,sans-serif;' +
- 'Courier New=courier new,courier,monospace;' +
- 'Georgia=georgia,palatino,serif;' +
- 'Helvetica=helvetica,arial,sans-serif;' +
- 'Impact=impact,sans-serif;' +
- 'Symbol=symbol;' +
- 'Tahoma=tahoma,arial,helvetica,sans-serif;' +
- 'Terminal=terminal,monaco,monospace;' +
- 'Times New Roman=times new roman,times,serif;' +
- 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' +
- 'Verdana=verdana,geneva,sans-serif;' +
- 'Webdings=webdings;' +
- 'Wingdings=wingdings,zapf dingbats';
-
- var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats);
-
- each(fonts, function (font) {
- items.push({
- text: { raw: font[0] },
- value: font[1],
- textStyle: font[1].indexOf('dings') == -1 ? 'font-family:' + font[1] : ''
- });
- });
-
- return {
- type: 'listbox',
- text: 'Font Family',
- tooltip: 'Font Family',
- values: items,
- fixedWidth: true,
- onPostRender: createFontNameListBoxChangeHandler(items),
- onselect: function (e) {
- if (e.control.settings.value) {
- editor.execCommand('FontName', false, e.control.settings.value);
- }
- }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ editor.on('SetContent', function () {
+ editor.addVisual(editor.getBody());
+ });
+ editor.load({
+ initial: true,
+ format: 'html'
+ });
+ editor.startContent = editor.getContent({ format: 'raw' });
+ editor.on('compositionstart compositionend', function (e) {
+ editor.composing = e.type === 'compositionstart';
+ });
+ if (editor.contentStyles.length > 0) {
+ contentCssText = '';
+ $_52qop8kjfuw8l6v.each(editor.contentStyles, function (style) {
+ contentCssText += style + '\r\n';
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.dom.addStyle(contentCssText);
+ }
+ getStyleSheetLoader(editor).loadAll(editor.contentCSS, function (_) {
+ initEditor(editor);
+ }, function (urls) {
+ initEditor(editor);
+ });
+ if (settings.content_style) {
+ appendStyle(editor, settings.content_style);
+ }
+ };
+ var $_89zvk04mjfuw8m1p = { initContentBody: initContentBody };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- editor.addButton('fontsizeselect', function () {
- var items = [], defaultFontsizeFormats = '8pt 10pt 12pt 14pt 18pt 24pt 36pt';
- var fontsizeFormats = editor.settings.fontsize_formats || defaultFontsizeFormats;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$3 = DOMUtils$1.DOM;
+ var relaxDomain = function (editor, ifr) {
+ if (document.domain !== window.location.hostname && $_9fhi43ajfuw8l13.ie && $_9fhi43ajfuw8l13.ie < 12) {
+ var bodyUuid = $_cbl0d24xjfuw8m3f.uuid('mce');
+ editor[bodyUuid] = function () {
+ $_89zvk04mjfuw8m1p.initContentBody(editor);
+ };
+ var domainRelaxUrl = 'javascript:(function(){' + 'document.open();document.domain="' + document.domain + '";' + 'var ed = window.parent.tinymce.get("' + editor.id + '");document.write(ed.iframeHTML);' + 'document.close();ed.' + bodyUuid + '(true);})()';
+ DOM$3.setAttrib(ifr, 'src', domainRelaxUrl);
+ return true;
+ }
+ return false;
+ };
+ var normalizeHeight = function (height) {
+ var normalizedHeight = typeof height === 'number' ? height + 'px' : height;
+ return normalizedHeight ? normalizedHeight : '';
+ };
+ var createIframeElement = function (id, title, height, customAttrs) {
+ var iframe = $_c9h6qlzjfuw8l98.fromTag('iframe');
+ $_8g002u14jfuw8la5.setAll(iframe, customAttrs);
+ $_8g002u14jfuw8la5.setAll(iframe, {
+ id: id + '_ifr',
+ frameBorder: '0',
+ allowTransparency: 'true',
+ title: title
+ });
+ $_cworr512jfuw8l9j.setAll(iframe, {
+ width: '100%',
+ height: normalizeHeight(height),
+ display: 'block'
+ });
+ return iframe;
+ };
+ var getIframeHtml = function (editor) {
+ var bodyId, bodyClass, iframeHTML;
+ iframeHTML = $_6msxiw2jjfuw8lkv.getDocType(editor) + '<html><head>';
+ if ($_6msxiw2jjfuw8lkv.getDocumentBaseUrl(editor) !== editor.documentBaseUrl) {
+ iframeHTML += '<base href="' + editor.documentBaseURI.getURI() + '" />';
+ }
+ iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
+ bodyId = $_6msxiw2jjfuw8lkv.getBodyId(editor);
+ bodyClass = $_6msxiw2jjfuw8lkv.getBodyClass(editor);
+ if ($_6msxiw2jjfuw8lkv.getContentSecurityPolicy(editor)) {
+ iframeHTML += '<meta http-equiv="Content-Security-Policy" content="' + $_6msxiw2jjfuw8lkv.getContentSecurityPolicy(editor) + '" />';
+ }
+ iframeHTML += '</head><body id="' + bodyId + '" class="mce-content-body ' + bodyClass + '" data-id="' + editor.id + '"><br></body></html>';
+ return iframeHTML;
+ };
+ var createIframe = function (editor, o) {
+ var title = editor.editorManager.translate('Rich Text Area. Press ALT-F9 for menu. ' + 'Press ALT-F10 for toolbar. Press ALT-0 for help');
+ var ifr = createIframeElement(editor.id, title, o.height, $_6msxiw2jjfuw8lkv.getIframeAttrs(editor)).dom();
+ ifr.onload = function () {
+ ifr.onload = null;
+ editor.fire('load');
+ };
+ var isDomainRelaxed = relaxDomain(editor, ifr);
+ editor.contentAreaContainer = o.iframeContainer;
+ editor.iframeElement = ifr;
+ editor.iframeHTML = getIframeHtml(editor);
+ DOM$3.add(o.iframeContainer, ifr);
+ return isDomainRelaxed;
+ };
+ var init$1 = function (editor, boxInfo) {
+ var isDomainRelaxed = createIframe(editor, boxInfo);
+ if (boxInfo.editorContainer) {
+ DOM$3.get(boxInfo.editorContainer).style.display = editor.orgDisplay;
+ editor.hidden = DOM$3.isHidden(boxInfo.editorContainer);
+ }
+ editor.getElement().style.display = 'none';
+ DOM$3.setAttrib(editor.id, 'aria-hidden', 'true');
+ if (!isDomainRelaxed) {
+ $_89zvk04mjfuw8m1p.initContentBody(editor);
+ }
+ };
+ var $_fvi56r76jfuw8mi2 = { init: init$1 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- each(fontsizeFormats.split(' '), function (item) {
- var text = item, value = item;
- // Allow text=value font sizes.
- var values = item.split('=');
- if (values.length > 1) {
- text = values[0];
- value = values[1];
- }
- items.push({ text: text, value: value });
- });
-
- return {
- type: 'listbox',
- text: 'Font Sizes',
- tooltip: 'Font Sizes',
- values: items,
- fixedWidth: true,
- onPostRender: createFontSizeListBoxChangeHandler(items),
- onclick: function (e) {
- if (e.control.settings.value) {
- editor.execCommand('FontSize', false, e.control.settings.value);
- }
- }
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$4 = DOMUtils$1.DOM;
+ var initPlugin = function (editor, initializedPlugins, plugin) {
+ var Plugin = PluginManager$1.get(plugin);
+ var pluginUrl, pluginInstance;
+ pluginUrl = PluginManager$1.urls[plugin] || editor.documentBaseUrl.replace(/\/$/, '');
+ plugin = $_52qop8kjfuw8l6v.trim(plugin);
+ if (Plugin && $_52qop8kjfuw8l6v.inArray(initializedPlugins, plugin) === -1) {
+ $_52qop8kjfuw8l6v.each(PluginManager$1.dependencies(plugin), function (dep) {
+ initPlugin(editor, initializedPlugins, dep);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- editor.addMenuItem('formats', {
- text: 'Formats',
- menu: formatMenu
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (editor.plugins[plugin]) {
+ return;
+ }
+ pluginInstance = new Plugin(editor, pluginUrl, editor.$);
+ editor.plugins[plugin] = pluginInstance;
+ if (pluginInstance.init) {
+ pluginInstance.init(editor, pluginUrl);
+ initializedPlugins.push(plugin);
+ }
+ }
+ };
+ var trimLegacyPrefix = function (name) {
+ return name.replace(/^\-/, '');
+ };
+ var initPlugins = function (editor) {
+ var initializedPlugins = [];
+ $_52qop8kjfuw8l6v.each(editor.settings.plugins.split(/[ ,]/), function (name) {
+ initPlugin(editor, initializedPlugins, trimLegacyPrefix(name));
+ });
+ };
+ var initTheme = function (editor) {
+ var Theme;
+ var theme = editor.settings.theme;
+ if ($_16i8k47jfuw8kyi.isString(theme)) {
+ editor.settings.theme = trimLegacyPrefix(theme);
+ Theme = ThemeManager.get(theme);
+ editor.theme = new Theme(editor, ThemeManager.urls[theme]);
+ if (editor.theme.init) {
+ editor.theme.init(editor, ThemeManager.urls[theme] || editor.documentBaseUrl.replace(/\/$/, ''), editor.$);
+ }
+ } else {
+ editor.theme = {};
+ }
+ };
+ var renderFromLoadedTheme = function (editor) {
+ var w, h, minHeight, re, info;
+ var settings = editor.settings;
+ var elm = editor.getElement();
+ w = settings.width || DOM$4.getStyle(elm, 'width') || '100%';
+ h = settings.height || DOM$4.getStyle(elm, 'height') || elm.offsetHeight;
+ minHeight = settings.min_height || 100;
+ re = /^[0-9\.]+(|px)$/i;
+ if (re.test('' + w)) {
+ w = Math.max(parseInt(w, 10), 100);
+ }
+ if (re.test('' + h)) {
+ h = Math.max(parseInt(h, 10), minHeight);
+ }
+ info = editor.theme.renderUI({
+ targetNode: elm,
+ width: w,
+ height: h,
+ deltaWidth: settings.delta_width,
+ deltaHeight: settings.delta_height
+ });
+ if (!settings.content_editable) {
+ h = (info.iframeHeight || h) + (typeof h === 'number' ? info.deltaHeight || 0 : '');
+ if (h < minHeight) {
+ h = minHeight;
+ }
+ }
+ info.height = h;
+ return info;
+ };
+ var renderFromThemeFunc = function (editor) {
+ var info;
+ var elm = editor.getElement();
+ info = editor.settings.theme(editor, elm);
+ if (info.editorContainer.nodeType) {
+ info.editorContainer.id = info.editorContainer.id || editor.id + '_parent';
+ }
+ if (info.iframeContainer && info.iframeContainer.nodeType) {
+ info.iframeContainer.id = info.iframeContainer.id || editor.id + '_iframecontainer';
+ }
+ info.height = info.iframeHeight ? info.iframeHeight : elm.offsetHeight;
+ return info;
+ };
+ var createThemeFalseResult = function (element) {
+ return {
+ editorContainer: element,
+ iframeContainer: element
+ };
+ };
+ var renderThemeFalseIframe = function (targetElement) {
+ var iframeContainer = DOM$4.create('div');
+ DOM$4.insertAfter(iframeContainer, targetElement);
+ return createThemeFalseResult(iframeContainer);
+ };
+ var renderThemeFalse = function (editor) {
+ var targetElement = editor.getElement();
+ return editor.inline ? createThemeFalseResult(null) : renderThemeFalseIframe(targetElement);
+ };
+ var renderThemeUi = function (editor) {
+ var settings = editor.settings, elm = editor.getElement();
+ editor.orgDisplay = elm.style.display;
+ if ($_16i8k47jfuw8kyi.isString(settings.theme)) {
+ return renderFromLoadedTheme(editor);
+ } else if ($_16i8k47jfuw8kyi.isFunction(settings.theme)) {
+ return renderFromThemeFunc(editor);
+ } else {
+ return renderThemeFalse(editor);
+ }
+ };
+ var init$2 = function (editor) {
+ var settings = editor.settings;
+ var elm = editor.getElement();
+ var boxInfo;
+ editor.rtl = settings.rtl_ui || editor.editorManager.i18n.rtl;
+ editor.editorManager.i18n.setCode(settings.language);
+ settings.aria_label = settings.aria_label || DOM$4.getAttrib(elm, 'aria-label', editor.getLang('aria.rich_text_area'));
+ editor.fire('ScriptsLoaded');
+ initTheme(editor);
+ initPlugins(editor);
+ boxInfo = renderThemeUi(editor);
+ editor.editorContainer = boxInfo.editorContainer ? boxInfo.editorContainer : null;
+ if (settings.content_css) {
+ $_52qop8kjfuw8l6v.each($_52qop8kjfuw8l6v.explode(settings.content_css), function (u) {
+ editor.contentCSS.push(editor.documentBaseURI.toAbsolute(u));
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (settings.content_editable) {
+ return $_89zvk04mjfuw8m1p.initContentBody(editor);
+ } else {
+ return $_fvi56r76jfuw8mi2.init(editor, boxInfo);
+ }
+ };
+ var $_b5t8gg4jjfuw8m1h = { init: init$2 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return {};
- }
-);
-
-/**
- * GridLayout.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This layout manager places controls in a grid.
- *
- * @setting {Number} spacing Spacing between controls.
- * @setting {Number} spacingH Horizontal spacing between controls.
- * @setting {Number} spacingV Vertical spacing between controls.
- * @setting {Number} columns Number of columns to use.
- * @setting {String/Array} alignH start|end|center|stretch or array of values for each column.
- * @setting {String/Array} alignV start|end|center|stretch or array of values for each column.
- * @setting {String} pack start|end
- *
- * @class tinymce.ui.GridLayout
- * @extends tinymce.ui.AbsoluteLayout
- */
-define(
- 'tinymce.core.ui.GridLayout',
- [
- "tinymce.core.ui.AbsoluteLayout"
- ],
- function (AbsoluteLayout) {
- "use strict";
-
- return AbsoluteLayout.extend({
- /**
- * Recalculates the positions of the controls in the specified container.
- *
- * @method recalc
- * @param {tinymce.ui.Container} container Container instance to recalc.
- */
- recalc: function (container) {
- var settings, rows, cols, items, contLayoutRect, width, height, rect,
- ctrlLayoutRect, ctrl, x, y, posX, posY, ctrlSettings, contPaddingBox, align, spacingH, spacingV, alignH, alignV, maxX, maxY,
- colWidths = [], rowHeights = [], ctrlMinWidth, ctrlMinHeight, availableWidth, availableHeight, reverseRows, idx;
-
- // Get layout settings
- settings = container.settings;
- items = container.items().filter(':visible');
- contLayoutRect = container.layoutRect();
- cols = settings.columns || Math.ceil(Math.sqrt(items.length));
- rows = Math.ceil(items.length / cols);
- spacingH = settings.spacingH || settings.spacing || 0;
- spacingV = settings.spacingV || settings.spacing || 0;
- alignH = settings.alignH || settings.align;
- alignV = settings.alignV || settings.align;
- contPaddingBox = container.paddingBox;
- reverseRows = 'reverseRows' in settings ? settings.reverseRows : container.isRtl();
-
- if (alignH && typeof alignH == "string") {
- alignH = [alignH];
- }
-
- if (alignV && typeof alignV == "string") {
- alignV = [alignV];
- }
-
- // Zero padd columnWidths
- for (x = 0; x < cols; x++) {
- colWidths.push(0);
- }
-
- // Zero padd rowHeights
- for (y = 0; y < rows; y++) {
- rowHeights.push(0);
- }
-
- // Calculate columnWidths and rowHeights
- for (y = 0; y < rows; y++) {
- for (x = 0; x < cols; x++) {
- ctrl = items[y * cols + x];
-
- // Out of bounds
- if (!ctrl) {
- break;
- }
-
- ctrlLayoutRect = ctrl.layoutRect();
- ctrlMinWidth = ctrlLayoutRect.minW;
- ctrlMinHeight = ctrlLayoutRect.minH;
-
- colWidths[x] = ctrlMinWidth > colWidths[x] ? ctrlMinWidth : colWidths[x];
- rowHeights[y] = ctrlMinHeight > rowHeights[y] ? ctrlMinHeight : rowHeights[y];
- }
- }
-
- // Calculate maxX
- availableWidth = contLayoutRect.innerW - contPaddingBox.left - contPaddingBox.right;
- for (maxX = 0, x = 0; x < cols; x++) {
- maxX += colWidths[x] + (x > 0 ? spacingH : 0);
- availableWidth -= (x > 0 ? spacingH : 0) + colWidths[x];
- }
-
- // Calculate maxY
- availableHeight = contLayoutRect.innerH - contPaddingBox.top - contPaddingBox.bottom;
- for (maxY = 0, y = 0; y < rows; y++) {
- maxY += rowHeights[y] + (y > 0 ? spacingV : 0);
- availableHeight -= (y > 0 ? spacingV : 0) + rowHeights[y];
- }
-
- maxX += contPaddingBox.left + contPaddingBox.right;
- maxY += contPaddingBox.top + contPaddingBox.bottom;
-
- // Calculate minW/minH
- rect = {};
- rect.minW = maxX + (contLayoutRect.w - contLayoutRect.innerW);
- rect.minH = maxY + (contLayoutRect.h - contLayoutRect.innerH);
-
- rect.contentW = rect.minW - contLayoutRect.deltaW;
- rect.contentH = rect.minH - contLayoutRect.deltaH;
- rect.minW = Math.min(rect.minW, contLayoutRect.maxW);
- rect.minH = Math.min(rect.minH, contLayoutRect.maxH);
- rect.minW = Math.max(rect.minW, contLayoutRect.startMinWidth);
- rect.minH = Math.max(rect.minH, contLayoutRect.startMinHeight);
-
- // Resize container container if minSize was changed
- if (contLayoutRect.autoResize && (rect.minW != contLayoutRect.minW || rect.minH != contLayoutRect.minH)) {
- rect.w = rect.minW;
- rect.h = rect.minH;
-
- container.layoutRect(rect);
- this.recalc(container);
-
- // Forced recalc for example if items are hidden/shown
- if (container._lastRect === null) {
- var parentCtrl = container.parent();
- if (parentCtrl) {
- parentCtrl._lastRect = null;
- parentCtrl.recalc();
- }
- }
-
- return;
- }
-
- // Update contentW/contentH so absEnd moves correctly
- if (contLayoutRect.autoResize) {
- rect = container.layoutRect(rect);
- rect.contentW = rect.minW - contLayoutRect.deltaW;
- rect.contentH = rect.minH - contLayoutRect.deltaH;
- }
-
- var flexV;
-
- if (settings.packV == 'start') {
- flexV = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$5 = DOMUtils$1.DOM;
+ var hasSkipLoadPrefix = function (name) {
+ return name.charAt(0) === '-';
+ };
+ var loadLanguage = function (scriptLoader, editor) {
+ var settings = editor.settings;
+ if (settings.language && settings.language !== 'en' && !settings.language_url) {
+ settings.language_url = editor.editorManager.baseURL + '/langs/' + settings.language + '.js';
+ }
+ if (settings.language_url && !editor.editorManager.i18n.data[settings.language]) {
+ scriptLoader.add(settings.language_url);
+ }
+ };
+ var loadTheme = function (scriptLoader, editor, suffix, callback) {
+ var settings = editor.settings, theme = settings.theme;
+ if ($_16i8k47jfuw8kyi.isString(theme)) {
+ if (!hasSkipLoadPrefix(theme) && !ThemeManager.urls.hasOwnProperty(theme)) {
+ var themeUrl = settings.theme_url;
+ if (themeUrl) {
+ ThemeManager.load(theme, editor.documentBaseURI.toAbsolute(themeUrl));
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- flexV = availableHeight > 0 ? Math.floor(availableHeight / rows) : 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ThemeManager.load(theme, 'themes/' + theme + '/theme' + suffix + '.js');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Calculate totalFlex
- var totalFlex = 0;
- var flexWidths = settings.flexWidths;
- if (flexWidths) {
- for (x = 0; x < flexWidths.length; x++) {
- totalFlex += flexWidths[x];
- }
- } else {
- totalFlex = cols;
- }
-
- // Calculate new column widths based on flex values
- var ratio = availableWidth / totalFlex;
- for (x = 0; x < cols; x++) {
- colWidths[x] += flexWidths ? flexWidths[x] * ratio : ratio;
- }
-
- // Move/resize controls
- posY = contPaddingBox.top;
- for (y = 0; y < rows; y++) {
- posX = contPaddingBox.left;
- height = rowHeights[y] + flexV;
-
- for (x = 0; x < cols; x++) {
- if (reverseRows) {
- idx = y * cols + cols - 1 - x;
- } else {
- idx = y * cols + x;
- }
-
- ctrl = items[idx];
-
- // No more controls to render then break
- if (!ctrl) {
- break;
- }
-
- // Get control settings and calculate x, y
- ctrlSettings = ctrl.settings;
- ctrlLayoutRect = ctrl.layoutRect();
- width = Math.max(colWidths[x], ctrlLayoutRect.startMinWidth);
- ctrlLayoutRect.x = posX;
- ctrlLayoutRect.y = posY;
-
- // Align control horizontal
- align = ctrlSettings.alignH || (alignH ? (alignH[x] || alignH[0]) : null);
- if (align == "center") {
- ctrlLayoutRect.x = posX + (width / 2) - (ctrlLayoutRect.w / 2);
- } else if (align == "right") {
- ctrlLayoutRect.x = posX + width - ctrlLayoutRect.w;
- } else if (align == "stretch") {
- ctrlLayoutRect.w = width;
- }
-
- // Align control vertical
- align = ctrlSettings.alignV || (alignV ? (alignV[x] || alignV[0]) : null);
- if (align == "center") {
- ctrlLayoutRect.y = posY + (height / 2) - (ctrlLayoutRect.h / 2);
- } else if (align == "bottom") {
- ctrlLayoutRect.y = posY + height - ctrlLayoutRect.h;
- } else if (align == "stretch") {
- ctrlLayoutRect.h = height;
- }
-
- ctrl.layoutRect(ctrlLayoutRect);
-
- posX += width + spacingH;
-
- if (ctrl.recalc) {
- ctrl.recalc();
- }
- }
-
- posY += height + spacingV;
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ scriptLoader.loadQueue(function () {
+ ThemeManager.waitFor(theme, callback);
+ });
+ } else {
+ callback();
+ }
+ };
+ var loadPlugins = function (settings, suffix) {
+ if ($_52qop8kjfuw8l6v.isArray(settings.plugins)) {
+ settings.plugins = settings.plugins.join(' ');
+ }
+ $_52qop8kjfuw8l6v.each(settings.external_plugins, function (url, name) {
+ PluginManager$1.load(name, url);
+ settings.plugins += ' ' + name;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Iframe.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/*jshint scripturl:true */
-
-/**
- * This class creates an iframe.
- *
- * @setting {String} url Url to open in the iframe.
- *
- * @-x-less Iframe.less
- * @class tinymce.ui.Iframe
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.Iframe',
- [
- "tinymce.core.ui.Widget",
- "tinymce.core.util.Delay"
- ],
- function (Widget, Delay) {
- "use strict";
-
- return Widget.extend({
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this;
-
- self.classes.add('iframe');
- self.canFocus = false;
-
- /*eslint no-script-url:0 */
- return (
- '<iframe id="' + self._id + '" class="' + self.classes + '" tabindex="-1" src="' +
- (self.settings.url || "javascript:''") + '" frameborder="0"></iframe>'
- );
- },
-
- /**
- * Setter for the iframe source.
- *
- * @method src
- * @param {String} src Source URL for iframe.
- */
- src: function (src) {
- this.getEl().src = src;
- },
-
- /**
- * Inner HTML for the iframe.
- *
- * @method html
- * @param {String} html HTML string to set as HTML inside the iframe.
- * @param {function} callback Optional callback to execute when the iframe body is filled with contents.
- * @return {tinymce.ui.Iframe} Current iframe control.
- */
- html: function (html, callback) {
- var self = this, body = this.getEl().contentWindow.document.body;
-
- // Wait for iframe to initialize IE 10 takes time
- if (!body) {
- Delay.setTimeout(function () {
- self.html(html);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_52qop8kjfuw8l6v.each(settings.plugins.split(/[ ,]/), function (plugin) {
+ plugin = $_52qop8kjfuw8l6v.trim(plugin);
+ if (plugin && !PluginManager$1.urls[plugin]) {
+ if (hasSkipLoadPrefix(plugin)) {
+ plugin = plugin.substr(1, plugin.length);
+ var dependencies = PluginManager$1.dependencies(plugin);
+ $_52qop8kjfuw8l6v.each(dependencies, function (dep) {
+ var defaultSettings = {
+ prefix: 'plugins/',
+ resource: dep,
+ suffix: '/plugin' + suffix + '.js'
+ };
+ dep = PluginManager$1.createUrl(defaultSettings, dep);
+ PluginManager$1.load(dep.resource, dep);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- body.innerHTML = html;
-
- if (callback) {
- callback();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ PluginManager$1.load(plugin, {
+ prefix: 'plugins/',
+ resource: plugin,
+ suffix: '/plugin' + suffix + '.js'
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return this;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * InfoBox.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * ....
- *
- * @-x-less InfoBox.less
- * @class tinymce.ui.InfoBox
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.InfoBox',
- [
- "tinymce.core.ui.Widget"
- ],
- function (Widget) {
- "use strict";
-
- return Widget.extend({
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Boolean} multiline Multiline label.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
- self.classes.add('widget').add('infobox');
- self.canFocus = false;
- },
-
- severity: function (level) {
- this.classes.remove('error');
- this.classes.remove('warning');
- this.classes.remove('success');
- this.classes.add(level);
- },
-
- help: function (state) {
- this.state.set('help', state);
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, prefix = self.classPrefix;
-
- return (
- '<div id="' + self._id + '" class="' + self.classes + '">' +
- '<div id="' + self._id + '-body">' +
- self.encode(self.state.get('text')) +
- '<button role="button" tabindex="-1">' +
- '<i class="' + prefix + 'ico ' + prefix + 'i-help"></i>' +
- '</button>' +
- '</div>' +
- '</div>'
- );
- },
-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:text', function (e) {
- self.getEl('body').firstChild.data = self.encode(e.value);
-
- if (self.state.get('rendered')) {
- self.updateLayoutRect();
- }
- });
-
- self.state.on('change:help', function (e) {
- self.classes.toggle('has-help', e.value);
-
- if (self.state.get('rendered')) {
- self.updateLayoutRect();
- }
- });
-
- return self._super();
- }
- });
- }
-);
-
-/**
- * Label.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class creates a label element. A label is a simple text control
- * that can be bound to other controls.
- *
- * @-x-less Label.less
- * @class tinymce.ui.Label
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.Label',
- [
- "tinymce.core.ui.Widget",
- "tinymce.core.ui.DomUtils"
- ],
- function (Widget, DomUtils) {
- "use strict";
-
- return Widget.extend({
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Boolean} multiline Multiline label.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
- self.classes.add('widget').add('label');
- self.canFocus = false;
-
- if (settings.multiline) {
- self.classes.add('autoscroll');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var loadScripts = function (editor, suffix) {
+ var scriptLoader = ScriptLoader.ScriptLoader;
+ loadTheme(scriptLoader, editor, suffix, function () {
+ loadLanguage(scriptLoader, editor);
+ loadPlugins(editor.settings, suffix);
+ scriptLoader.loadQueue(function () {
+ if (!editor.removed) {
+ $_b5t8gg4jjfuw8m1h.init(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.strong) {
- self.classes.add('strong');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }, editor, function (urls) {
+ $_80cv3b4ijfuw8m1d.pluginLoadError(editor, urls[0]);
+ if (!editor.removed) {
+ $_b5t8gg4jjfuw8m1h.init(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Initializes the current controls layout rect.
- * This will be executed by the layout managers to determine the
- * default minWidth/minHeight etc.
- *
- * @method initLayoutRect
- * @return {Object} Layout rect instance.
- */
- initLayoutRect: function () {
- var self = this, layoutRect = self._super();
-
- if (self.settings.multiline) {
- var size = DomUtils.getSize(self.getEl());
-
- // Check if the text fits within maxW if not then try word wrapping it
- if (size.width > layoutRect.maxW) {
- layoutRect.minW = layoutRect.maxW;
- self.classes.add('multiline');
- }
-
- self.getEl().style.width = layoutRect.minW + 'px';
- layoutRect.startMinH = layoutRect.h = layoutRect.minH = Math.min(layoutRect.maxH, DomUtils.getSize(self.getEl()).height);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ });
+ };
+ var render = function (editor) {
+ var settings = editor.settings, id = editor.id;
+ var readyHandler = function () {
+ DOM$5.unbind(window, 'ready', readyHandler);
+ editor.render();
+ };
+ if (!EventUtils.Event.domLoaded) {
+ DOM$5.bind(window, 'ready', readyHandler);
+ return;
+ }
+ if (!editor.getElement()) {
+ return;
+ }
+ if (!$_9fhi43ajfuw8l13.contentEditable) {
+ return;
+ }
+ if (!settings.inline) {
+ editor.orgVisibility = editor.getElement().style.visibility;
+ editor.getElement().style.visibility = 'hidden';
+ } else {
+ editor.inline = true;
+ }
+ var form = editor.getElement().form || DOM$5.getParent(id, 'form');
+ if (form) {
+ editor.formElement = form;
+ if (settings.hidden_input && !/TEXTAREA|INPUT/i.test(editor.getElement().nodeName)) {
+ DOM$5.insertAfter(DOM$5.create('input', {
+ type: 'hidden',
+ name: id
+ }), id);
+ editor.hasHiddenInput = true;
+ }
+ editor.formEventDelegate = function (e) {
+ editor.fire(e.type, e);
+ };
+ DOM$5.bind(form, 'submit reset', editor.formEventDelegate);
+ editor.on('reset', function () {
+ editor.setContent(editor.startContent, { format: 'raw' });
+ });
+ if (settings.submit_patch && !form.submit.nodeType && !form.submit.length && !form._mceOldSubmit) {
+ form._mceOldSubmit = form.submit;
+ form.submit = function () {
+ editor.editorManager.triggerSave();
+ editor.setDirty(false);
+ return form._mceOldSubmit(form);
+ };
+ }
+ }
+ editor.windowManager = WindowManager(editor);
+ editor.notificationManager = NotificationManager(editor);
+ if (settings.encoding === 'xml') {
+ editor.on('GetContent', function (e) {
+ if (e.save) {
+ e.content = DOM$5.encode(e.content);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return layoutRect;
- },
-
- /**
- * Repaints the control after a layout operation.
- *
- * @method repaint
- */
- repaint: function () {
- var self = this;
-
- if (!self.settings.multiline) {
- self.getEl().style.lineHeight = self.layoutRect().h + 'px';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ if (settings.add_form_submit_trigger) {
+ editor.on('submit', function () {
+ if (editor.initialized) {
+ editor.save();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return self._super();
- },
-
- severity: function (level) {
- this.classes.remove('error');
- this.classes.remove('warning');
- this.classes.remove('success');
- this.classes.add(level);
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, targetCtrl, forName, forId = self.settings.forId;
- var text = self.settings.html ? self.settings.html : self.encode(self.state.get('text'));
-
- if (!forId && (forName = self.settings.forName)) {
- targetCtrl = self.getRoot().find('#' + forName)[0];
-
- if (targetCtrl) {
- forId = targetCtrl._id;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ if (settings.add_unload_trigger) {
+ editor._beforeUnload = function () {
+ if (editor.initialized && !editor.destroyed && !editor.isHidden()) {
+ editor.save({
+ format: 'raw',
+ no_events: true,
+ set_dirty: false
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ editor.editorManager.on('BeforeUnload', editor._beforeUnload);
+ }
+ editor.editorManager.add(editor);
+ loadScripts(editor, editor.suffix);
+ };
+ var $_7wiqk54cjfuw8m0b = { render: render };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (forId) {
- return (
- '<label id="' + self._id + '" class="' + self.classes + '"' + (forId ? ' for="' + forId + '"' : '') + '>' +
- text +
- '</label>'
- );
- }
-
- return (
- '<span id="' + self._id + '" class="' + self.classes + '">' +
- text +
- '</span>'
- );
- },
-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:text', function (e) {
- self.innerHtml(self.encode(e.value));
-
- if (self.state.get('rendered')) {
- self.updateLayoutRect();
- }
- });
-
- return self._super();
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var add = function (editor, name, settings) {
+ var sidebars = editor.sidebars ? editor.sidebars : [];
+ sidebars.push({
+ name: name,
+ settings: settings
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.sidebars = sidebars;
+ };
+ var $_777mua77jfuw8mih = { add: add };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Toolbar.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new toolbar.
- *
- * @class tinymce.ui.Toolbar
- * @extends tinymce.ui.Container
- */
-define(
- 'tinymce.core.ui.Toolbar',
- [
- "tinymce.core.ui.Container"
- ],
- function (Container) {
- "use strict";
-
- return Container.extend({
- Defaults: {
- role: 'toolbar',
- layout: 'flow'
- },
-
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
- self.classes.add('toolbar');
- },
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this;
-
- self.items().each(function (ctrl) {
- ctrl.classes.add('toolbar-item');
- });
-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$21 = $_52qop8kjfuw8l6v.each;
+ var trim$4 = $_52qop8kjfuw8l6v.trim;
+ var queryParts = 'source protocol authority userInfo user password host port relative path directory file query anchor'.split(' ');
+ var DEFAULT_PORTS = {
+ ftp: 21,
+ http: 80,
+ https: 443,
+ mailto: 25
+ };
+ var URI = function (url, settings) {
+ var self = this;
+ var baseUri, baseUrl;
+ url = trim$4(url);
+ settings = self.settings = settings || {};
+ baseUri = settings.base_uri;
+ if (/^([\w\-]+):([^\/]{2})/i.test(url) || /^\s*#/.test(url)) {
+ self.source = url;
+ return;
+ }
+ var isProtocolRelative = url.indexOf('//') === 0;
+ if (url.indexOf('/') === 0 && !isProtocolRelative) {
+ url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url;
+ }
+ if (!/^[\w\-]*:?\/\//.test(url)) {
+ baseUrl = settings.base_uri ? settings.base_uri.path : new URI(document.location.href).directory;
+ if (settings.base_uri.protocol == '') {
+ url = '//mce_host' + self.toAbsPath(baseUrl, url);
+ } else {
+ url = /([^#?]*)([#?]?.*)/.exec(url);
+ url = (baseUri && baseUri.protocol || 'http') + '://mce_host' + self.toAbsPath(baseUrl, url[1]) + url[2];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ url = url.replace(/@@/g, '(mce_at)');
+ url = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url);
+ each$21(queryParts, function (v, i) {
+ var part = url[i];
+ if (part) {
+ part = part.replace(/\(mce_at\)/g, '@@');
+ }
+ self[v] = part;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * MenuBar.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new menubar.
- *
- * @-x-less MenuBar.less
- * @class tinymce.ui.MenuBar
- * @extends tinymce.ui.Container
- */
-define(
- 'tinymce.core.ui.MenuBar',
- [
- "tinymce.core.ui.Toolbar"
- ],
- function (Toolbar) {
- "use strict";
-
- return Toolbar.extend({
- Defaults: {
- role: 'menubar',
- containerCls: 'menubar',
- ariaRoot: true,
- defaults: {
- type: 'menubutton'
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (baseUri) {
+ if (!self.protocol) {
+ self.protocol = baseUri.protocol;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * MenuButton.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new menu button.
- *
- * @-x-less MenuButton.less
- * @class tinymce.ui.MenuButton
- * @extends tinymce.ui.Button
- */
-define(
- 'tinymce.core.ui.MenuButton',
- [
- "tinymce.core.ui.Button",
- "tinymce.core.ui.Factory",
- "tinymce.core.ui.MenuBar"
- ],
- function (Button, Factory, MenuBar) {
- "use strict";
-
- // TODO: Maybe add as some global function
- function isChildOf(node, parent) {
- while (node) {
- if (parent === node) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!self.userInfo) {
+ self.userInfo = baseUri.userInfo;
+ }
+ if (!self.port && self.host === 'mce_host') {
+ self.port = baseUri.port;
+ }
+ if (!self.host || self.host === 'mce_host') {
+ self.host = baseUri.host;
+ }
+ self.source = '';
+ }
+ if (isProtocolRelative) {
+ self.protocol = '';
+ }
+ };
+ URI.prototype = {
+ setPath: function (path) {
+ var self = this;
+ path = /^(.*?)\/?(\w+)?$/.exec(path);
+ self.path = path[0];
+ self.directory = path[1];
+ self.file = path[2];
+ self.source = '';
+ self.getURI();
+ },
+ toRelative: function (uri) {
+ var self = this;
+ var output;
+ if (uri === './') {
+ return uri;
+ }
+ uri = new URI(uri, { base_uri: self });
+ if (uri.host !== 'mce_host' && self.host !== uri.host && uri.host || self.port !== uri.port || self.protocol !== uri.protocol && uri.protocol !== '') {
+ return uri.getURI();
+ }
+ var tu = self.getURI(), uu = uri.getURI();
+ if (tu === uu || tu.charAt(tu.length - 1) === '/' && tu.substr(0, tu.length - 1) === uu) {
+ return tu;
+ }
+ output = self.toRelPath(self.path, uri.path);
+ if (uri.query) {
+ output += '?' + uri.query;
+ }
+ if (uri.anchor) {
+ output += '#' + uri.anchor;
+ }
+ return output;
+ },
+ toAbsolute: function (uri, noHost) {
+ uri = new URI(uri, { base_uri: this });
+ return uri.getURI(noHost && this.isSameOrigin(uri));
+ },
+ isSameOrigin: function (uri) {
+ if (this.host == uri.host && this.protocol == uri.protocol) {
+ if (this.port == uri.port) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- node = node.parentNode;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var defaultPort = DEFAULT_PORTS[this.protocol];
+ if (defaultPort && (this.port || defaultPort) == (uri.port || defaultPort)) {
+ return true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- var MenuButton = Button.extend({
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- */
- init: function (settings) {
- var self = this;
-
- self._renderOpen = true;
-
- self._super(settings);
- settings = self.settings;
-
- self.classes.add('menubtn');
-
- if (settings.fixedWidth) {
- self.classes.add('fixed-width');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ toRelPath: function (base, path) {
+ var items, breakPoint = 0, out = '', i, l;
+ base = base.substring(0, base.lastIndexOf('/'));
+ base = base.split('/');
+ items = path.split('/');
+ if (base.length >= items.length) {
+ for (i = 0, l = base.length; i < l; i++) {
+ if (i >= items.length || base[i] !== items[i]) {
+ breakPoint = i + 1;
+ break;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.aria('haspopup', true);
-
- self.state.set('menu', settings.menu || self.render());
- },
-
- /**
- * Shows the menu for the button.
- *
- * @method showMenu
- */
- showMenu: function (toggle) {
- var self = this, menu;
-
- if (self.menu && self.menu.visible() && toggle !== false) {
- return self.hideMenu();
- }
-
- if (!self.menu) {
- menu = self.state.get('menu') || [];
-
- // Is menu array then auto constuct menu control
- if (menu.length) {
- menu = {
- type: 'menu',
- items: menu
- };
- } else {
- menu.type = menu.type || 'menu';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (base.length < items.length) {
+ for (i = 0, l = items.length; i < l; i++) {
+ if (i >= base.length || base[i] !== items[i]) {
+ breakPoint = i + 1;
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!menu.renderTo) {
- self.menu = Factory.create(menu).parent(self).renderTo();
- } else {
- self.menu = menu.parent(self).show().renderTo();
- }
-
- self.fire('createmenu');
- self.menu.reflow();
- self.menu.on('cancel', function (e) {
- if (e.control.parent() === self.menu) {
- e.stopPropagation();
- self.focus();
- self.hideMenu();
- }
- });
-
- // Move focus to button when a menu item is selected/clicked
- self.menu.on('select', function () {
- self.focus();
- });
-
- self.menu.on('show hide', function (e) {
- if (e.control == self.menu) {
- self.activeMenu(e.type == 'show');
- }
-
- self.aria('expanded', e.type == 'show');
- }).fire('show');
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.menu.show();
- self.menu.layoutRect({ w: self.layoutRect().w });
- self.menu.moveRel(self.getEl(), self.isRtl() ? ['br-tr', 'tr-br'] : ['bl-tl', 'tl-bl']);
- self.fire('showmenu');
- },
-
- /**
- * Hides the menu for the button.
- *
- * @method hideMenu
- */
- hideMenu: function () {
- var self = this;
-
- if (self.menu) {
- self.menu.items().each(function (item) {
- if (item.hideMenu) {
- item.hideMenu();
- }
- });
-
- self.menu.hide();
- }
- },
-
- /**
- * Sets the active menu state.
- *
- * @private
- */
- activeMenu: function (state) {
- this.classes.toggle('active', state);
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, id = self._id, prefix = self.classPrefix;
- var icon = self.settings.icon, image, text = self.state.get('text'),
- textHtml = '';
-
- image = self.settings.image;
- if (image) {
- icon = 'none';
-
- // Support for [high dpi, low dpi] image sources
- if (typeof image != "string") {
- image = window.getSelection ? image[0] : image[1];
- }
-
- image = ' style="background-image: url(\'' + image + '\')"';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ if (breakPoint === 1) {
+ return path;
+ }
+ for (i = 0, l = base.length - (breakPoint - 1); i < l; i++) {
+ out += '../';
+ }
+ for (i = breakPoint - 1, l = items.length; i < l; i++) {
+ if (i !== breakPoint - 1) {
+ out += '/' + items[i];
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- image = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ out += items[i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (text) {
- self.classes.add('btn-has-text');
- textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
- }
-
- icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
-
- self.aria('role', self.parent() instanceof MenuBar ? 'menuitem' : 'button');
-
- return (
- '<div id="' + id + '" class="' + self.classes + '" tabindex="-1" aria-labelledby="' + id + '">' +
- '<button id="' + id + '-open" role="presentation" type="button" tabindex="-1">' +
- (icon ? '<i class="' + icon + '"' + image + '></i>' : '') +
- textHtml +
- ' <i class="' + prefix + 'caret"></i>' +
- '</button>' +
- '</div>'
- );
- },
-
- /**
- * Gets invoked after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this;
-
- self.on('click', function (e) {
- if (e.control === self && isChildOf(e.target, self.getEl())) {
- self.focus();
- self.showMenu(!e.aria);
-
- if (e.aria) {
- self.menu.items().filter(':visible')[0].focus();
- }
- }
- });
-
- self.on('mouseenter', function (e) {
- var overCtrl = e.control, parent = self.parent(), hasVisibleSiblingMenu;
-
- if (overCtrl && parent && overCtrl instanceof MenuButton && overCtrl.parent() == parent) {
- parent.items().filter('MenuButton').each(function (ctrl) {
- if (ctrl.hideMenu && ctrl != overCtrl) {
- if (ctrl.menu && ctrl.menu.visible()) {
- hasVisibleSiblingMenu = true;
- }
-
- ctrl.hideMenu();
- }
- });
-
- if (hasVisibleSiblingMenu) {
- overCtrl.focus(); // Fix for: #5887
- overCtrl.showMenu();
- }
- }
- });
-
- return self._super();
- },
-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:menu', function () {
- if (self.menu) {
- self.menu.remove();
- }
-
- self.menu = null;
- });
-
- return self._super();
- },
-
- /**
- * Removes the control and it's menus.
- *
- * @method remove
- */
- remove: function () {
- this._super();
-
- if (this.menu) {
- this.menu.remove();
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
-
- return MenuButton;
- }
-);
-
-/**
- * MenuItem.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new menu item.
- *
- * @-x-less MenuItem.less
- * @class tinymce.ui.MenuItem
- * @extends tinymce.ui.Control
- */
-define(
- 'tinymce.core.ui.MenuItem',
- [
- "tinymce.core.ui.Widget",
- "tinymce.core.ui.Factory",
- "tinymce.core.Env",
- "tinymce.core.util.Delay"
- ],
- function (Widget, Factory, Env, Delay) {
- "use strict";
-
- return Widget.extend({
- Defaults: {
- border: 0,
- role: 'menuitem'
- },
-
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Boolean} selectable Selectable menu.
- * @setting {Array} menu Submenu array with items.
- * @setting {String} shortcut Shortcut to display for menu item. Example: Ctrl+X
- */
- init: function (settings) {
- var self = this, text;
-
- self._super(settings);
-
- settings = self.settings;
-
- self.classes.add('menu-item');
-
- if (settings.menu) {
- self.classes.add('menu-item-expand');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return out;
+ },
+ toAbsPath: function (base, path) {
+ var i, nb = 0, o = [], tr, outPath;
+ tr = /\/$/.test(path) ? '/' : '';
+ base = base.split('/');
+ path = path.split('/');
+ each$21(base, function (k) {
+ if (k) {
+ o.push(k);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.preview) {
- self.classes.add('menu-item-preview');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ base = o;
+ for (i = path.length - 1, o = []; i >= 0; i--) {
+ if (path[i].length === 0 || path[i] === '.') {
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- text = self.state.get('text');
- if (text === '-' || text === '|') {
- self.classes.add('menu-item-sep');
- self.aria('role', 'separator');
- self.state.set('text', '-');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (path[i] === '..') {
+ nb++;
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.selectable) {
- self.aria('role', 'menuitemcheckbox');
- self.classes.add('menu-item-checkbox');
- settings.icon = 'selected';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (nb > 0) {
+ nb--;
+ continue;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!settings.preview && !settings.selectable) {
- self.classes.add('menu-item-normal');
- }
-
- self.on('mousedown', function (e) {
- e.preventDefault();
- });
-
- if (settings.menu && !settings.ariaHideMenu) {
- self.aria('haspopup', true);
- }
- },
-
- /**
- * Returns true/false if the menuitem has sub menu.
- *
- * @method hasMenus
- * @return {Boolean} True/false state if it has submenu.
- */
- hasMenus: function () {
- return !!this.settings.menu;
- },
-
- /**
- * Shows the menu for the menu item.
- *
- * @method showMenu
- */
- showMenu: function () {
- var self = this, settings = self.settings, menu, parent = self.parent();
-
- parent.items().each(function (ctrl) {
- if (ctrl !== self) {
- ctrl.hideMenu();
- }
- });
-
- if (settings.menu) {
- menu = self.menu;
-
- if (!menu) {
- menu = settings.menu;
-
- // Is menu array then auto constuct menu control
- if (menu.length) {
- menu = {
- type: 'menu',
- items: menu
- };
- } else {
- menu.type = menu.type || 'menu';
- }
-
- if (parent.settings.itemDefaults) {
- menu.itemDefaults = parent.settings.itemDefaults;
- }
-
- menu = self.menu = Factory.create(menu).parent(self).renderTo();
- menu.reflow();
- menu.on('cancel', function (e) {
- e.stopPropagation();
- self.focus();
- menu.hide();
- });
- menu.on('show hide', function (e) {
- if (e.control.items) {
- e.control.items().each(function (ctrl) {
- ctrl.active(ctrl.settings.selected);
- });
- }
- }).fire('show');
-
- menu.on('hide', function (e) {
- if (e.control === menu) {
- self.classes.remove('selected');
- }
- });
-
- menu.submenu = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ o.push(path[i]);
+ }
+ i = base.length - nb;
+ if (i <= 0) {
+ outPath = o.reverse().join('/');
+ } else {
+ outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/');
+ }
+ if (outPath.indexOf('/') !== 0) {
+ outPath = '/' + outPath;
+ }
+ if (tr && outPath.lastIndexOf('/') !== outPath.length - 1) {
+ outPath += tr;
+ }
+ return outPath;
+ },
+ getURI: function (noProtoHost) {
+ var s;
+ var self = this;
+ if (!self.source || noProtoHost) {
+ s = '';
+ if (!noProtoHost) {
+ if (self.protocol) {
+ s += self.protocol + '://';
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- menu.show();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ s += '//';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- menu._parentMenu = parent;
-
- menu.classes.add('menu-sub');
-
- var rel = menu.testMoveRel(
- self.getEl(),
- self.isRtl() ? ['tl-tr', 'bl-br', 'tr-tl', 'br-bl'] : ['tr-tl', 'br-bl', 'tl-tr', 'bl-br']
- );
-
- menu.moveRel(self.getEl(), rel);
- menu.rel = rel;
-
- rel = 'menu-sub-' + rel;
- menu.classes.remove(menu._lastRel).add(rel);
- menu._lastRel = rel;
-
- self.classes.add('selected');
- self.aria('expanded', true);
- }
- },
-
- /**
- * Hides the menu for the menu item.
- *
- * @method hideMenu
- */
- hideMenu: function () {
- var self = this;
-
- if (self.menu) {
- self.menu.items().each(function (item) {
- if (item.hideMenu) {
- item.hideMenu();
- }
- });
-
- self.menu.hide();
- self.aria('expanded', false);
- }
-
- return self;
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix, text = self.state.get('text');
- var icon = self.settings.icon, image = '', shortcut = settings.shortcut;
- var url = self.encode(settings.url), iconHtml = '';
-
- // Converts shortcut format to Mac/PC variants
- function convertShortcut(shortcut) {
- var i, value, replace = {};
-
- if (Env.mac) {
- replace = {
- alt: '⌥',
- ctrl: '⌘',
- shift: '⇧',
- meta: '⌘'
- };
- } else {
- replace = {
- meta: 'Ctrl'
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.userInfo) {
+ s += self.userInfo + '@';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- shortcut = shortcut.split('+');
-
- for (i = 0; i < shortcut.length; i++) {
- value = replace[shortcut[i].toLowerCase()];
-
- if (value) {
- shortcut[i] = value;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.host) {
+ s += self.host;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return shortcut.join('+');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.port) {
+ s += ':' + self.port;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function escapeRegExp(str) {
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.path) {
+ s += self.path;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function markMatches(text) {
- var match = settings.match || '';
-
- return match ? text.replace(new RegExp(escapeRegExp(match), 'gi'), function (match) {
- return '!mce~match[' + match + ']mce~match!';
- }) : text;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.query) {
+ s += '?' + self.query;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function boldMatches(text) {
- return text.
- replace(new RegExp(escapeRegExp('!mce~match['), 'g'), '<b>').
- replace(new RegExp(escapeRegExp(']mce~match!'), 'g'), '</b>');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.anchor) {
+ s += '#' + self.anchor;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.source = s;
+ }
+ return self.source;
+ }
+ };
+ URI.parseDataUri = function (uri) {
+ var type, matches;
+ uri = decodeURIComponent(uri).split(',');
+ matches = /data:([^;]+)/.exec(uri[0]);
+ if (matches) {
+ type = matches[1];
+ }
+ return {
+ type: type,
+ data: uri[1]
+ };
+ };
+ URI.getDocumentBaseUrl = function (loc) {
+ var baseUrl;
+ if (loc.protocol.indexOf('http') !== 0 && loc.protocol !== 'file:') {
+ baseUrl = loc.href;
+ } else {
+ baseUrl = loc.protocol + '//' + loc.host + loc.pathname;
+ }
+ if (/^[^:]+:\/\/\/?[^\/]+\//.test(baseUrl)) {
+ baseUrl = baseUrl.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
+ if (!/[\/\\]$/.test(baseUrl)) {
+ baseUrl += '/';
+ }
+ }
+ return baseUrl;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (icon) {
- self.parent().classes.add('menu-has-icons');
- }
-
- if (settings.image) {
- image = ' style="background-image: url(\'' + settings.image + '\')"';
- }
-
- if (shortcut) {
- shortcut = convertShortcut(shortcut);
- }
-
- icon = prefix + 'ico ' + prefix + 'i-' + (self.settings.icon || 'none');
- iconHtml = (text !== '-' ? '<i class="' + icon + '"' + image + '></i>\u00a0' : '');
-
- text = boldMatches(self.encode(markMatches(text)));
- url = boldMatches(self.encode(markMatches(url)));
-
- return (
- '<div id="' + id + '" class="' + self.classes + '" tabindex="-1">' +
- iconHtml +
- (text !== '-' ? '<span id="' + id + '-text" class="' + prefix + 'text">' + text + '</span>' : '') +
- (shortcut ? '<div id="' + id + '-shortcut" class="' + prefix + 'menu-shortcut">' + shortcut + '</div>' : '') +
- (settings.menu ? '<div class="' + prefix + 'caret"></div>' : '') +
- (url ? '<div class="' + prefix + 'menu-item-link">' + url + '</div>' : '') +
- '</div>'
- );
- },
-
- /**
- * Gets invoked after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this, settings = self.settings;
-
- var textStyle = settings.textStyle;
- if (typeof textStyle == "function") {
- textStyle = textStyle.call(this);
- }
-
- if (textStyle) {
- var textElm = self.getEl('text');
- if (textElm) {
- textElm.setAttribute('style', textStyle);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var traverse = function (node, fn) {
+ fn(node);
+ if (node.firstChild) {
+ traverse(node.firstChild, fn);
+ }
+ if (node.next) {
+ traverse(node.next, fn);
+ }
+ };
+ var findMatchingNodes = function (nodeFilters, attributeFilters, node) {
+ var nodeMatches = {};
+ var attrMatches = {};
+ var matches = [];
+ if (node.firstChild) {
+ traverse(node.firstChild, function (node) {
+ $_9ek1bp4jfuw8kxg.each(nodeFilters, function (filter) {
+ if (filter.name === node.name) {
+ if (nodeMatches[filter.name]) {
+ nodeMatches[filter.name].nodes.push(node);
+ } else {
+ nodeMatches[filter.name] = {
+ filter: filter,
+ nodes: [node]
+ };
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-
- self.on('mouseenter click', function (e) {
- if (e.control === self) {
- if (!settings.menu && e.type === 'click') {
- self.fire('select');
-
- // Edge will crash if you stress it see #2660
- Delay.requestAnimationFrame(function () {
- self.parent().hideAll();
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ $_9ek1bp4jfuw8kxg.each(attributeFilters, function (filter) {
+ if (typeof node.attr(filter.name) === 'string') {
+ if (attrMatches[filter.name]) {
+ attrMatches[filter.name].nodes.push(node);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.showMenu();
-
- if (e.aria) {
- self.menu.focus(true);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ attrMatches[filter.name] = {
+ filter: filter,
+ nodes: [node]
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ }
+ for (var name_1 in nodeMatches) {
+ if (nodeMatches.hasOwnProperty(name_1)) {
+ matches.push(nodeMatches[name_1]);
+ }
+ }
+ for (var name_2 in attrMatches) {
+ if (attrMatches.hasOwnProperty(name_2)) {
+ matches.push(attrMatches[name_2]);
+ }
+ }
+ return matches;
+ };
+ var filter$3 = function (nodeFilters, attributeFilters, node) {
+ var matches = findMatchingNodes(nodeFilters, attributeFilters, node);
+ $_9ek1bp4jfuw8kxg.each(matches, function (match) {
+ $_9ek1bp4jfuw8kxg.each(match.filter.callbacks, function (callback) {
+ callback(match.nodes, match.filter.name, {});
+ });
+ });
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var defaultFormat = 'html';
+ var isTreeNode = function (content) {
+ return content instanceof Node$2;
+ };
+ var setContentString = function (editor, body, content, args) {
+ var forcedRootBlockName, padd;
+ if (content.length === 0 || /^\s+$/.test(content)) {
+ padd = '<br data-mce-bogus="1">';
+ if (body.nodeName === 'TABLE') {
+ content = '<tr><td>' + padd + '</td></tr>';
+ } else if (/^(UL|OL)$/.test(body.nodeName)) {
+ content = '<li>' + padd + '</li>';
+ }
+ forcedRootBlockName = $_6msxiw2jjfuw8lkv.getForcedRootBlock(editor);
+ if (forcedRootBlockName && editor.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) {
+ content = padd;
+ content = editor.dom.createHTML(forcedRootBlockName, editor.settings.forced_root_block_attrs, content);
+ } else if (!content) {
+ content = '<br data-mce-bogus="1">';
+ }
+ editor.dom.setHTML(body, content);
+ editor.fire('SetContent', args);
+ } else {
+ if (args.format !== 'raw') {
+ content = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(editor.parser.parse(content, {
+ isRootContent: true,
+ insert: true
+ }));
+ }
+ args.content = $_52qop8kjfuw8l6v.trim(content);
+ editor.dom.setHTML(body, args.content);
+ if (!args.no_events) {
+ editor.fire('SetContent', args);
+ }
+ }
+ return args.content;
+ };
+ var setContentTree = function (editor, body, content, args) {
+ filter$3(editor.parser.getNodeFilters(), editor.parser.getAttributeFilters(), content);
+ var html = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(content);
+ args.content = $_52qop8kjfuw8l6v.trim(html);
+ editor.dom.setHTML(body, args.content);
+ if (!args.no_events) {
+ editor.fire('SetContent', args);
+ }
+ return content;
+ };
+ var trimEmptyContents = function (editor, html) {
+ var blockName = $_6msxiw2jjfuw8lkv.getForcedRootBlock(editor);
+ var emptyRegExp = new RegExp('^(<' + blockName + '[^>]*>( | |\\s|\xA0|<br \\/>|)<\\/' + blockName + '>[\r\n]*|<br \\/>[\r\n]*)$');
+ return html.replace(emptyRegExp, '');
+ };
+ var getContentFromBody = function (editor, args, body) {
+ var content;
+ args.format = args.format ? args.format : defaultFormat;
+ args.get = true;
+ args.getInner = true;
+ if (!args.no_events) {
+ editor.fire('BeforeGetContent', args);
+ }
+ if (args.format === 'raw') {
+ content = $_52qop8kjfuw8l6v.trim($_fglg0l5djfuw8m62.trimExternal(editor.serializer, body.innerHTML));
+ } else if (args.format === 'text') {
+ content = $_dpfg1321jfuw8lhn.trim(body.innerText || body.textContent);
+ } else if (args.format === 'tree') {
+ return editor.serializer.serialize(body, args);
+ } else {
+ content = trimEmptyContents(editor, editor.serializer.serialize(body, args));
+ }
+ if (args.format !== 'text') {
+ args.content = $_52qop8kjfuw8l6v.trim(content);
+ } else {
+ args.content = content;
+ }
+ if (!args.no_events) {
+ editor.fire('GetContent', args);
+ }
+ return args.content;
+ };
+ var setContent$1 = function (editor, content, args) {
+ if (args === void 0) {
+ args = {};
+ }
+ args.format = args.format ? args.format : defaultFormat;
+ args.set = true;
+ args.content = isTreeNode(content) ? '' : content;
+ if (!isTreeNode(content) && !args.no_events) {
+ editor.fire('BeforeSetContent', args);
+ content = args.content;
+ }
+ return Option.from(editor.getBody()).fold($_68e81l6jfuw8kyc.constant(content), function (body) {
+ return isTreeNode(content) ? setContentTree(editor, body, content, args) : setContentString(editor, body, content, args);
+ });
+ };
+ var getContent$1 = function (editor, args) {
+ if (args === void 0) {
+ args = {};
+ }
+ return Option.from(editor.getBody()).fold($_68e81l6jfuw8kyc.constant(args.format === 'tree' ? new Node$2('body', 11) : ''), function (body) {
+ return getContentFromBody(editor, args, body);
+ });
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return self;
- },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$6 = DOMUtils$1.DOM;
+ var restoreOriginalStyles = function (editor) {
+ DOM$6.setStyle(editor.id, 'display', editor.orgDisplay);
+ };
+ var safeDestroy = function (x) {
+ return Option.from(x).each(function (x) {
+ return x.destroy();
+ });
+ };
+ var clearDomReferences = function (editor) {
+ editor.contentAreaContainer = editor.formElement = editor.container = editor.editorContainer = null;
+ editor.bodyElement = editor.contentDocument = editor.contentWindow = null;
+ editor.iframeElement = editor.targetElm = null;
+ if (editor.selection) {
+ editor.selection = editor.selection.win = editor.selection.dom = editor.selection.dom.doc = null;
+ }
+ };
+ var restoreForm = function (editor) {
+ var form = editor.formElement;
+ if (form) {
+ if (form._mceOldSubmit) {
+ form.submit = form._mceOldSubmit;
+ form._mceOldSubmit = null;
+ }
+ DOM$6.unbind(form, 'submit reset', editor.formEventDelegate);
+ }
+ };
+ var remove$5 = function (editor) {
+ if (!editor.removed) {
+ var _selectionOverrides = editor._selectionOverrides, editorUpload = editor.editorUpload;
+ var body = editor.getBody();
+ var element = editor.getElement();
+ if (body) {
+ editor.save();
+ }
+ editor.removed = true;
+ editor.unbindAllNativeEvents();
+ if (editor.hasHiddenInput && element) {
+ DOM$6.remove(element.nextSibling);
+ }
+ if (!editor.inline && body) {
+ restoreOriginalStyles(editor);
+ }
+ $_47gnpy63jfuw8mad.fireRemove(editor);
+ editor.editorManager.remove(editor);
+ DOM$6.remove(editor.getContainer());
+ safeDestroy(_selectionOverrides);
+ safeDestroy(editorUpload);
+ editor.destroy();
+ }
+ };
+ var destroy = function (editor, automatic) {
+ var selection = editor.selection, dom = editor.dom;
+ if (editor.destroyed) {
+ return;
+ }
+ if (!automatic && !editor.removed) {
+ editor.remove();
+ return;
+ }
+ if (!automatic) {
+ editor.editorManager.off('beforeunload', editor._beforeUnload);
+ if (editor.theme && editor.theme.destroy) {
+ editor.theme.destroy();
+ }
+ safeDestroy(selection);
+ safeDestroy(dom);
+ }
+ restoreForm(editor);
+ clearDomReferences(editor);
+ editor.destroyed = true;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- hover: function () {
- var self = this;
-
- self.parent().items().each(function (ctrl) {
- ctrl.classes.remove('selected');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$7 = DOMUtils$1.DOM;
+ var extend$4 = $_52qop8kjfuw8l6v.extend;
+ var each$22 = $_52qop8kjfuw8l6v.each;
+ var resolve$4 = $_52qop8kjfuw8l6v.resolve;
+ var ie$2 = $_9fhi43ajfuw8l13.ie;
+ var Editor = function (id, settings, editorManager) {
+ var self = this;
+ var documentBaseUrl = self.documentBaseUrl = editorManager.documentBaseURL;
+ var baseUri = editorManager.baseURI;
+ settings = getEditorSettings(self, id, documentBaseUrl, editorManager.defaultSettings, settings);
+ self.settings = settings;
+ AddOnManager.language = settings.language || 'en';
+ AddOnManager.languageLoad = settings.language_load;
+ AddOnManager.baseURL = editorManager.baseURL;
+ self.id = id;
+ self.setDirty(false);
+ self.plugins = {};
+ self.documentBaseURI = new URI(settings.document_base_url, { base_uri: baseUri });
+ self.baseURI = baseUri;
+ self.contentCSS = [];
+ self.contentStyles = [];
+ self.shortcuts = new Shortcuts(self);
+ self.loadedCSS = {};
+ self.editorCommands = new EditorCommands(self);
+ self.suffix = editorManager.suffix;
+ self.editorManager = editorManager;
+ self.inline = settings.inline;
+ self.buttons = {};
+ self.menuItems = {};
+ if (settings.cache_suffix) {
+ $_9fhi43ajfuw8l13.cacheSuffix = settings.cache_suffix.replace(/^[\?\&]+/, '');
+ }
+ if (settings.override_viewport === false) {
+ $_9fhi43ajfuw8l13.overrideViewPort = false;
+ }
+ editorManager.fire('SetupEditor', { editor: self });
+ self.execCallback('setup', self);
+ self.$ = DomQuery.overrideDefaults(function () {
+ return {
+ context: self.inline ? self.getBody() : self.getDoc(),
+ element: self.getBody()
+ };
+ });
+ };
+ Editor.prototype = {
+ render: function () {
+ $_7wiqk54cjfuw8m0b.render(this);
+ },
+ focus: function (skipFocus) {
+ $_18lipa49jfuw8lzt.focus(this, skipFocus);
+ },
+ hasFocus: function () {
+ return $_18lipa49jfuw8lzt.hasFocus(this);
+ },
+ execCallback: function (name) {
+ var x = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ x[_i - 1] = arguments[_i];
+ }
+ var self = this;
+ var callback = self.settings[name], scope;
+ if (!callback) {
+ return;
+ }
+ if (self.callbackLookup && (scope = self.callbackLookup[name])) {
+ callback = scope.func;
+ scope = scope.scope;
+ }
+ if (typeof callback === 'string') {
+ scope = callback.replace(/\.\w+$/, '');
+ scope = scope ? resolve$4(scope) : 0;
+ callback = resolve$4(callback);
+ self.callbackLookup = self.callbackLookup || {};
+ self.callbackLookup[name] = {
+ func: callback,
+ scope: scope
+ };
+ }
+ return callback.apply(scope || self, Array.prototype.slice.call(arguments, 1));
+ },
+ translate: function (text) {
+ if (text && $_52qop8kjfuw8l6v.is(text, 'string')) {
+ var lang_1 = this.settings.language || 'en', i18n_1 = this.editorManager.i18n;
+ text = i18n_1.data[lang_1 + '.' + text] || text.replace(/\{\#([^\}]+)\}/g, function (a, b) {
+ return i18n_1.data[lang_1 + '.' + b] || '{#' + b + '}';
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.classes.toggle('selected', true);
-
- return self;
- },
-
- active: function (state) {
- if (typeof state != "undefined") {
- this.aria('checked', state);
- }
-
- return this._super(state);
- },
-
- /**
- * Removes the control and it's menus.
- *
- * @method remove
- */
- remove: function () {
- this._super();
-
- if (this.menu) {
- this.menu.remove();
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-
-/**
- * Throbber.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class enables you to display a Throbber for any element.
- *
- * @-x-less Throbber.less
- * @class tinymce.ui.Throbber
- */
-define(
- 'tinymce.core.ui.Throbber',
- [
- "tinymce.core.dom.DomQuery",
- "tinymce.core.ui.Control",
- "tinymce.core.util.Delay"
- ],
- function ($, Control, Delay) {
- "use strict";
-
- /**
- * Constructs a new throbber.
- *
- * @constructor
- * @param {Element} elm DOM Html element to display throbber in.
- * @param {Boolean} inline Optional true/false state if the throbber should be appended to end of element for infinite scroll.
- */
- return function (elm, inline) {
- var self = this, state, classPrefix = Control.classPrefix, timer;
-
- /**
- * Shows the throbber.
- *
- * @method show
- * @param {Number} [time] Time to wait before showing.
- * @param {function} [callback] Optional callback to execute when the throbber is shown.
- * @return {tinymce.ui.Throbber} Current throbber instance.
- */
- self.show = function (time, callback) {
- function render() {
- if (state) {
- $(elm).append(
- '<div class="' + classPrefix + 'throbber' + (inline ? ' ' + classPrefix + 'throbber-inline' : '') + '"></div>'
- );
-
- if (callback) {
- callback();
- }
- }
- }
-
- self.hide();
-
- state = true;
-
- if (time) {
- timer = Delay.setTimeout(render, time);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return this.editorManager.translate(text);
+ },
+ getLang: function (name, defaultVal) {
+ return this.editorManager.i18n.data[(this.settings.language || 'en') + '.' + name] || (defaultVal !== undefined ? defaultVal : '{#' + name + '}');
+ },
+ getParam: function (name, defaultVal, type) {
+ return getParam(this, name, defaultVal, type);
+ },
+ nodeChanged: function (args) {
+ this._nodeChangeDispatcher.nodeChanged(args);
+ },
+ addButton: function (name, settings) {
+ var self = this;
+ if (settings.cmd) {
+ settings.onclick = function () {
+ self.execCommand(settings.cmd);
+ };
+ }
+ if (settings.stateSelector && typeof settings.active === 'undefined') {
+ settings.active = false;
+ }
+ if (!settings.text && !settings.icon) {
+ settings.icon = name;
+ }
+ self.buttons = self.buttons;
+ settings.tooltip = settings.tooltip || settings.title;
+ self.buttons[name] = settings;
+ },
+ addSidebar: function (name, settings) {
+ return $_777mua77jfuw8mih.add(this, name, settings);
+ },
+ addMenuItem: function (name, settings) {
+ var self = this;
+ if (settings.cmd) {
+ settings.onclick = function () {
+ self.execCommand(settings.cmd);
+ };
+ }
+ self.menuItems = self.menuItems;
+ self.menuItems[name] = settings;
+ },
+ addContextToolbar: function (predicate, items) {
+ var self = this;
+ var selector;
+ self.contextToolbars = self.contextToolbars || [];
+ if (typeof predicate === 'string') {
+ selector = predicate;
+ predicate = function (elm) {
+ return self.dom.is(elm, selector);
+ };
+ }
+ self.contextToolbars.push({
+ id: $_cbl0d24xjfuw8m3f.uuid('mcet'),
+ predicate: predicate,
+ items: items
+ });
+ },
+ addCommand: function (name, callback, scope) {
+ this.editorCommands.addCommand(name, callback, scope);
+ },
+ addQueryStateHandler: function (name, callback, scope) {
+ this.editorCommands.addQueryStateHandler(name, callback, scope);
+ },
+ addQueryValueHandler: function (name, callback, scope) {
+ this.editorCommands.addQueryValueHandler(name, callback, scope);
+ },
+ addShortcut: function (pattern, desc, cmdFunc, scope) {
+ this.shortcuts.add(pattern, desc, cmdFunc, scope);
+ },
+ execCommand: function (cmd, ui, value, args) {
+ return this.editorCommands.execCommand(cmd, ui, value, args);
+ },
+ queryCommandState: function (cmd) {
+ return this.editorCommands.queryCommandState(cmd);
+ },
+ queryCommandValue: function (cmd) {
+ return this.editorCommands.queryCommandValue(cmd);
+ },
+ queryCommandSupported: function (cmd) {
+ return this.editorCommands.queryCommandSupported(cmd);
+ },
+ show: function () {
+ var self = this;
+ if (self.hidden) {
+ self.hidden = false;
+ if (self.inline) {
+ self.getBody().contentEditable = true;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- render();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ DOM$7.show(self.getContainer());
+ DOM$7.hide(self.id);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return self;
- };
-
- /**
- * Hides the throbber.
- *
- * @method hide
- * @return {tinymce.ui.Throbber} Current throbber instance.
- */
- self.hide = function () {
- var child = elm.lastChild;
-
- Delay.clearTimeout(timer);
-
- if (child && child.className.indexOf('throbber') != -1) {
- child.parentNode.removeChild(child);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.load();
+ self.fire('show');
+ }
+ },
+ hide: function () {
+ var self = this, doc = self.getDoc();
+ if (!self.hidden) {
+ if (ie$2 && doc && !self.inline) {
+ doc.execCommand('SelectAll');
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- state = false;
-
- return self;
- };
- };
- }
-);
-
-/**
- * Menu.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new menu.
- *
- * @-x-less Menu.less
- * @class tinymce.ui.Menu
- * @extends tinymce.ui.FloatPanel
- */
-define(
- 'tinymce.core.ui.Menu',
- [
- "tinymce.core.ui.FloatPanel",
- "tinymce.core.ui.MenuItem",
- "tinymce.core.ui.Throbber",
- "tinymce.core.util.Tools"
- ],
- function (FloatPanel, MenuItem, Throbber, Tools) {
- "use strict";
-
- return FloatPanel.extend({
- Defaults: {
- defaultType: 'menuitem',
- border: 1,
- layout: 'stack',
- role: 'application',
- bodyRole: 'menu',
- ariaRoot: true
- },
-
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- */
- init: function (settings) {
- var self = this;
-
- settings.autohide = true;
- settings.constrainToViewport = true;
-
- if (typeof settings.items === 'function') {
- settings.itemsFactory = settings.items;
- settings.items = [];
- }
-
- if (settings.itemDefaults) {
- var items = settings.items, i = items.length;
-
- while (i--) {
- items[i] = Tools.extend({}, settings.itemDefaults, items[i]);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.save();
+ if (self.inline) {
+ self.getBody().contentEditable = false;
+ if (self === self.editorManager.focusedEditor) {
+ self.editorManager.focusedEditor = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ DOM$7.hide(self.getContainer());
+ DOM$7.setStyle(self.id, 'display', self.orgDisplay);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self._super(settings);
- self.classes.add('menu');
- },
-
- /**
- * Repaints the control after a layout operation.
- *
- * @method repaint
- */
- repaint: function () {
- this.classes.toggle('menu-align', true);
-
- this._super();
-
- this.getEl().style.height = '';
- this.getEl('body').style.height = '';
-
- return this;
- },
-
- /**
- * Hides/closes the menu.
- *
- * @method cancel
- */
- cancel: function () {
- var self = this;
-
- self.hideAll();
- self.fire('select');
- },
-
- /**
- * Loads new items from the factory items function.
- *
- * @method load
- */
- load: function () {
- var self = this, time, factory;
-
- function hideThrobber() {
- if (self.throbber) {
- self.throbber.hide();
- self.throbber = null;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.hidden = true;
+ self.fire('hide');
+ }
+ },
+ isHidden: function () {
+ return !!this.hidden;
+ },
+ setProgressState: function (state, time) {
+ this.fire('ProgressState', {
+ state: state,
+ time: time
+ });
+ },
+ load: function (args) {
+ var self = this;
+ var elm = self.getElement(), html;
+ if (self.removed) {
+ return '';
+ }
+ if (elm) {
+ args = args || {};
+ args.load = true;
+ html = self.setContent(elm.value !== undefined ? elm.value : elm.innerHTML, args);
+ args.element = elm;
+ if (!args.no_events) {
+ self.fire('LoadContent', args);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- factory = self.settings.itemsFactory;
- if (!factory) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ args.element = elm = null;
+ return html;
+ }
+ },
+ save: function (args) {
+ var self = this;
+ var elm = self.getElement(), html, form;
+ if (!elm || !self.initialized || self.removed) {
+ return;
+ }
+ args = args || {};
+ args.save = true;
+ args.element = elm;
+ html = args.content = self.getContent(args);
+ if (!args.no_events) {
+ self.fire('SaveContent', args);
+ }
+ if (args.format === 'raw') {
+ self.fire('RawSaveContent', args);
+ }
+ html = args.content;
+ if (!/TEXTAREA|INPUT/i.test(elm.nodeName)) {
+ if (!self.inline) {
+ elm.innerHTML = html;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (!self.throbber) {
- self.throbber = new Throbber(self.getEl('body'), true);
-
- if (self.items().length === 0) {
- self.throbber.show();
- self.fire('loading');
- } else {
- self.throbber.show(100, function () {
- self.items().remove();
- self.fire('loading');
- });
- }
-
- self.on('hide close', hideThrobber);
- }
-
- self.requestTime = time = new Date().getTime();
-
- self.settings.itemsFactory(function (items) {
- if (items.length === 0) {
- self.hide();
- return;
- }
-
- if (self.requestTime !== time) {
- return;
- }
-
- self.getEl().style.width = '';
- self.getEl('body').style.width = '';
-
- hideThrobber();
- self.items().remove();
- self.getEl('body').innerHTML = '';
-
- self.add(items);
- self.renderNew();
- self.fire('loaded');
- });
- },
-
- /**
- * Hide menu and all sub menus.
- *
- * @method hideAll
- */
- hideAll: function () {
- var self = this;
-
- this.find('menuitem').exec('hideMenu');
-
- return self._super();
- },
-
- /**
- * Invoked before the menu is rendered.
- *
- * @method preRender
- */
- preRender: function () {
- var self = this;
-
- self.items().each(function (ctrl) {
- var settings = ctrl.settings;
-
- if (settings.icon || settings.image || settings.selectable) {
- self._hasIcons = true;
- return false;
- }
- });
-
- if (self.settings.itemsFactory) {
- self.on('postrender', function () {
- if (self.settings.itemsFactory) {
- self.load();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (form = DOM$7.getParent(self.id, 'form')) {
+ each$22(form.elements, function (elm) {
+ if (elm.name === self.id) {
+ elm.value = html;
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ elm.value = html;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-
-/**
- * ListBox.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new list box control.
- *
- * @-x-less ListBox.less
- * @class tinymce.ui.ListBox
- * @extends tinymce.ui.MenuButton
- */
-define(
- 'tinymce.core.ui.ListBox',
- [
- "tinymce.core.ui.MenuButton",
- "tinymce.core.ui.Menu"
- ],
- function (MenuButton, Menu) {
- "use strict";
-
- return MenuButton.extend({
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Array} values Array with values to add to list box.
- */
- init: function (settings) {
- var self = this, values, selected, selectedText, lastItemCtrl;
-
- function setSelected(menuValues) {
- // Try to find a selected value
- for (var i = 0; i < menuValues.length; i++) {
- selected = menuValues[i].selected || settings.value === menuValues[i].value;
-
- if (selected) {
- selectedText = selectedText || menuValues[i].text;
- self.state.set('value', menuValues[i].value);
- return true;
- }
-
- // If the value has a submenu, try to find the selected values in that menu
- if (menuValues[i].menu) {
- if (setSelected(menuValues[i].menu)) {
- return true;
- }
- }
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ args.element = elm = null;
+ if (args.set_dirty !== false) {
+ self.setDirty(false);
+ }
+ return html;
+ },
+ setContent: function (content, args) {
+ return setContent$1(this, content, args);
+ },
+ getContent: function (args) {
+ return getContent$1(this, args);
+ },
+ insertContent: function (content, args) {
+ if (args) {
+ content = extend$4({ content: content }, args);
+ }
+ this.execCommand('mceInsertContent', false, content);
+ },
+ isDirty: function () {
+ return !this.isNotDirty;
+ },
+ setDirty: function (state) {
+ var oldState = !this.isNotDirty;
+ this.isNotDirty = !state;
+ if (state && state !== oldState) {
+ this.fire('dirty');
+ }
+ },
+ setMode: function (mode) {
+ $_886hp247jfuw8lzl.setMode(this, mode);
+ },
+ getContainer: function () {
+ var self = this;
+ if (!self.container) {
+ self.container = DOM$7.get(self.editorContainer || self.id + '_parent');
+ }
+ return self.container;
+ },
+ getContentAreaContainer: function () {
+ return this.contentAreaContainer;
+ },
+ getElement: function () {
+ if (!this.targetElm) {
+ this.targetElm = DOM$7.get(this.id);
+ }
+ return this.targetElm;
+ },
+ getWin: function () {
+ var self = this;
+ var elm;
+ if (!self.contentWindow) {
+ elm = self.iframeElement;
+ if (elm) {
+ self.contentWindow = elm.contentWindow;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self._super(settings);
- settings = self.settings;
-
- self._values = values = settings.values;
- if (values) {
- if (typeof settings.value != "undefined") {
- setSelected(values);
- }
-
- // Default with first item
- if (!selected && values.length > 0) {
- selectedText = values[0].text;
- self.state.set('value', values[0].value);
- }
-
- self.state.set('menu', values);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return self.contentWindow;
+ },
+ getDoc: function () {
+ var self = this;
+ var win;
+ if (!self.contentDocument) {
+ win = self.getWin();
+ if (win) {
+ self.contentDocument = win.document;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.state.set('text', settings.text || selectedText);
-
- self.classes.add('listbox');
-
- self.on('select', function (e) {
- var ctrl = e.control;
-
- if (lastItemCtrl) {
- e.lastControl = lastItemCtrl;
- }
-
- if (settings.multiple) {
- ctrl.active(!ctrl.active());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return self.contentDocument;
+ },
+ getBody: function () {
+ var doc = this.getDoc();
+ return this.bodyElement || (doc ? doc.body : null);
+ },
+ convertURL: function (url, name, elm) {
+ var self = this, settings = self.settings;
+ if (settings.urlconverter_callback) {
+ return self.execCallback('urlconverter_callback', url, elm, true, name);
+ }
+ if (!settings.convert_urls || elm && elm.nodeName === 'LINK' || url.indexOf('file:') === 0 || url.length === 0) {
+ return url;
+ }
+ if (settings.relative_urls) {
+ return self.documentBaseURI.toRelative(url);
+ }
+ url = self.documentBaseURI.toAbsolute(url, settings.remove_script_host);
+ return url;
+ },
+ addVisual: function (elm) {
+ var self = this;
+ var settings = self.settings;
+ var dom = self.dom;
+ var cls;
+ elm = elm || self.getBody();
+ if (self.hasVisual === undefined) {
+ self.hasVisual = settings.visual;
+ }
+ each$22(dom.select('table,a', elm), function (elm) {
+ var value;
+ switch (elm.nodeName) {
+ case 'TABLE':
+ cls = settings.visual_table_class || 'mce-item-table';
+ value = dom.getAttrib(elm, 'border');
+ if ((!value || value === '0') && self.hasVisual) {
+ dom.addClass(elm, cls);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.value(e.control.value());
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ dom.removeClass(elm, cls);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- lastItemCtrl = ctrl;
- });
- },
-
- /**
- * Getter/setter function for the control value.
- *
- * @method value
- * @param {String} [value] Value to be set.
- * @return {Boolean/tinymce.ui.ListBox} Value or self if it's a set operation.
- */
- bindStates: function () {
- var self = this;
-
- function activateMenuItemsByValue(menu, value) {
- if (menu instanceof Menu) {
- menu.items().each(function (ctrl) {
- if (!ctrl.hasMenus()) {
- ctrl.active(ctrl.value() === value);
- }
- });
- }
- }
-
- function getSelectedItem(menuValues, value) {
- var selectedItem;
-
- if (!menuValues) {
- return;
- }
-
- for (var i = 0; i < menuValues.length; i++) {
- if (menuValues[i].value === value) {
- return menuValues[i];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
+ case 'A':
+ if (!dom.getAttrib(elm, 'href')) {
+ value = dom.getAttrib(elm, 'name') || elm.id;
+ cls = settings.visual_anchor_class || 'mce-item-anchor';
+ if (value && self.hasVisual) {
+ dom.addClass(elm, cls);
+ } else {
+ dom.removeClass(elm, cls);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (menuValues[i].menu) {
- selectedItem = getSelectedItem(menuValues[i].menu, value);
- if (selectedItem) {
- return selectedItem;
- }
- }
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ self.fire('VisualAid', {
+ element: elm,
+ hasVisual: self.hasVisual
+ });
+ },
+ remove: function () {
+ remove$5(this);
+ },
+ destroy: function (automatic) {
+ destroy(this, automatic);
+ },
+ uploadImages: function (callback) {
+ return this.editorUpload.uploadImages(callback);
+ },
+ _scanForImages: function () {
+ return this.editorUpload.scanForImages();
+ }
+ };
+ extend$4(Editor.prototype, EditorObservable$1);
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.on('show', function (e) {
- activateMenuItemsByValue(e.control, self.value());
- });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isEditorUIElement = function (elm) {
+ return elm.className.toString().indexOf('mce-') !== -1;
+ };
+ var $_du4u8r7ejfuw8mjp = { isEditorUIElement: isEditorUIElement };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.state.on('change:value', function (e) {
- var selectedItem = getSelectedItem(self.state.get('menu'), e.value);
-
- if (selectedItem) {
- self.text(selectedItem.text);
- } else {
- self.text(self.settings.text);
- }
- });
-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var isManualNodeChange = function (e) {
+ return e.type === 'nodechange' && e.selectionChange;
+ };
+ var registerPageMouseUp = function (editor, throttledStore) {
+ var mouseUpPage = function () {
+ throttledStore.throttle();
+ };
+ DOMUtils$1.DOM.bind(document, 'mouseup', mouseUpPage);
+ editor.on('remove', function () {
+ DOMUtils$1.DOM.unbind(document, 'mouseup', mouseUpPage);
+ });
+ };
+ var registerFocusOut = function (editor) {
+ editor.on('focusout', function () {
+ $_2a7vvg40jfuw8lyb.store(editor);
+ });
+ };
+ var registerMouseUp = function (editor, throttledStore) {
+ editor.on('mouseup touchend', function (e) {
+ throttledStore.throttle();
+ });
+ };
+ var registerEditorEvents = function (editor, throttledStore) {
+ var browser = $_f1lbzgnjfuw8l7o.detect().browser;
+ if (browser.isIE() || browser.isEdge()) {
+ registerFocusOut(editor);
+ } else {
+ registerMouseUp(editor, throttledStore);
+ }
+ editor.on('keyup nodechange', function (e) {
+ if (!isManualNodeChange(e)) {
+ $_2a7vvg40jfuw8lyb.store(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var register$3 = function (editor) {
+ var throttledStore = $_6aemaw59jfuw8m5h.first(function () {
+ $_2a7vvg40jfuw8lyb.store(editor);
+ }, 0);
+ if (editor.inline) {
+ registerPageMouseUp(editor, throttledStore);
+ }
+ editor.on('init', function () {
+ registerEditorEvents(editor, throttledStore);
+ });
+ editor.on('remove', function () {
+ throttledStore.cancel();
+ });
+ };
+ var $_5uzmvs7fjfuw8mjq = { register: register$3 };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Radio.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new radio button.
- *
- * @-x-less Radio.less
- * @class tinymce.ui.Radio
- * @extends tinymce.ui.Checkbox
- */
-define(
- 'tinymce.core.ui.Radio',
- [
- "tinymce.core.ui.Checkbox"
- ],
- function (Checkbox) {
- "use strict";
-
- return Checkbox.extend({
- Defaults: {
- classes: "radio",
- role: "radio"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var documentFocusInHandler;
+ var DOM$8 = DOMUtils$1.DOM;
+ var isEditorUIElement$1 = function (elm) {
+ return $_du4u8r7ejfuw8mjp.isEditorUIElement(elm);
+ };
+ var isUIElement = function (editor, elm) {
+ var customSelector = editor ? editor.settings.custom_ui_selector : '';
+ var parent = DOM$8.getParent(elm, function (elm) {
+ return isEditorUIElement$1(elm) || (customSelector ? editor.dom.is(elm, customSelector) : false);
+ });
+ return parent !== null;
+ };
+ var getActiveElement = function () {
+ try {
+ return document.activeElement;
+ } catch (ex) {
+ return document.body;
+ }
+ };
+ var registerEvents = function (editorManager, e) {
+ var editor = e.editor;
+ $_5uzmvs7fjfuw8mjq.register(editor);
+ editor.on('focusin', function () {
+ var self = this;
+ var focusedEditor = editorManager.focusedEditor;
+ if (focusedEditor !== self) {
+ if (focusedEditor) {
+ focusedEditor.fire('blur', { focusedEditor: self });
+ }
+ editorManager.setActive(self);
+ editorManager.focusedEditor = self;
+ self.fire('focus', { blurredEditor: focusedEditor });
+ self.focus(true);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * ResizeHandle.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Renders a resize handle that fires ResizeStart, Resize and ResizeEnd events.
- *
- * @-x-less ResizeHandle.less
- * @class tinymce.ui.ResizeHandle
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.ResizeHandle',
- [
- "tinymce.core.ui.Widget",
- "tinymce.core.ui.DragHelper"
- ],
- function (Widget, DragHelper) {
- "use strict";
-
- return Widget.extend({
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, prefix = self.classPrefix;
-
- self.classes.add('resizehandle');
-
- if (self.settings.direction == "both") {
- self.classes.add('resizehandle-both');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.on('focusout', function () {
+ var self = this;
+ $_2m8wq9hjfuw8l41.setEditorTimeout(self, function () {
+ var focusedEditor = editorManager.focusedEditor;
+ if (!isUIElement(self, getActiveElement()) && focusedEditor === self) {
+ self.fire('blur', { focusedEditor: null });
+ editorManager.focusedEditor = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.canFocus = false;
-
- return (
- '<div id="' + self._id + '" class="' + self.classes + '">' +
- '<i class="' + prefix + 'ico ' + prefix + 'i-resize"></i>' +
- '</div>'
- );
- },
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this;
-
- self._super();
-
- self.resizeDragHelper = new DragHelper(this._id, {
- start: function () {
- self.fire('ResizeStart');
- },
-
- drag: function (e) {
- if (self.settings.direction != "both") {
- e.deltaX = 0;
- }
-
- self.fire('Resize', e);
- },
-
- stop: function () {
- self.fire('ResizeEnd');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ });
+ if (!documentFocusInHandler) {
+ documentFocusInHandler = function (e) {
+ var activeEditor = editorManager.activeEditor;
+ var target;
+ target = e.target;
+ if (activeEditor && target.ownerDocument === document) {
+ if (target !== document.body && !isUIElement(activeEditor, target) && editorManager.focusedEditor === activeEditor) {
+ activeEditor.fire('blur', { focusedEditor: null });
+ editorManager.focusedEditor = null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- },
-
- remove: function () {
- if (this.resizeDragHelper) {
- this.resizeDragHelper.destroy();
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ DOM$8.bind(document, 'focusin', documentFocusInHandler);
+ }
+ };
+ var unregisterDocumentEvents = function (editorManager, e) {
+ if (editorManager.focusedEditor === e.editor) {
+ editorManager.focusedEditor = null;
+ }
+ if (!editorManager.activeEditor) {
+ DOM$8.unbind(document, 'focusin', documentFocusInHandler);
+ documentFocusInHandler = null;
+ }
+ };
+ var setup$12 = function (editorManager) {
+ editorManager.on('AddEditor', $_68e81l6jfuw8kyc.curry(registerEvents, editorManager));
+ editorManager.on('RemoveEditor', $_68e81l6jfuw8kyc.curry(unregisterDocumentEvents, editorManager));
+ };
+ var $_4p4q557djfuw8mjm = {
+ setup: setup$12,
+ isEditorUIElement: isEditorUIElement$1,
+ isUIElement: isUIElement
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return this._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var data = {};
+ var code = 'en';
+ var $_ai97we7gjfuw8mjv = {
+ setCode: function (newCode) {
+ if (newCode) {
+ code = newCode;
+ this.rtl = this.data[newCode] ? this.data[newCode]._dir === 'rtl' : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-
-/**
- * SelectBox.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new select box control.
- *
- * @-x-less SelectBox.less
- * @class tinymce.ui.SelectBox
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.SelectBox',
- [
- "tinymce.core.ui.Widget"
- ],
- function (Widget) {
- "use strict";
-
- function createOptions(options) {
- var strOptions = '';
- if (options) {
- for (var i = 0; i < options.length; i++) {
- strOptions += '<option value="' + options[i] + '">' + options[i] + '</option>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ getCode: function () {
+ return code;
+ },
+ rtl: false,
+ add: function (code, items) {
+ var langData = data[code];
+ if (!langData) {
+ data[code] = langData = {};
+ }
+ for (var name_1 in items) {
+ langData[name_1] = items[name_1];
+ }
+ this.setCode(code);
+ },
+ translate: function (text) {
+ var langData = data[code] || {};
+ var toString = function (obj) {
+ if ($_52qop8kjfuw8l6v.is(obj, 'function')) {
+ return Object.prototype.toString.call(obj);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return !isEmpty(obj) ? '' + obj : '';
+ };
+ var isEmpty = function (text) {
+ return text === '' || text === null || $_52qop8kjfuw8l6v.is(text, 'undefined');
+ };
+ var getLangData = function (text) {
+ text = toString(text);
+ return $_52qop8kjfuw8l6v.hasOwn(langData, text) ? toString(langData[text]) : text;
+ };
+ if (isEmpty(text)) {
+ return '';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return strOptions;
- }
-
- return Widget.extend({
- Defaults: {
- classes: "selectbox",
- role: "selectbox",
- options: []
- },
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Array} options Array with options to add to the select box.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
-
- if (self.settings.size) {
- self.size = self.settings.size;
- }
-
- if (self.settings.options) {
- self._options = self.settings.options;
- }
-
- self.on('keydown', function (e) {
- var rootControl;
-
- if (e.keyCode == 13) {
- e.preventDefault();
-
- // Find root control that we can do toJSON on
- self.parents().reverse().each(function (ctrl) {
- if (ctrl.toJSON) {
- rootControl = ctrl;
- return false;
- }
- });
-
- // Fire event on current text box with the serialized data of the whole form
- self.fire('submit', { data: rootControl.toJSON() });
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ($_52qop8kjfuw8l6v.is(text, 'object') && $_52qop8kjfuw8l6v.hasOwn(text, 'raw')) {
+ return toString(text.raw);
+ }
+ if ($_52qop8kjfuw8l6v.is(text, 'array')) {
+ var values_1 = text.slice(1);
+ text = getLangData(text[0]).replace(/\{([0-9]+)\}/g, function ($1, $2) {
+ return $_52qop8kjfuw8l6v.hasOwn(values_1, $2) ? toString(values_1[$2]) : $1;
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return getLangData(text).replace(/{context:\w+}$/, '');
+ },
+ data: data
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Getter/setter function for the options state.
- *
- * @method options
- * @param {Array} [state] State to be set.
- * @return {Array|tinymce.ui.SelectBox} Array of string options.
- */
- options: function (state) {
- if (!arguments.length) {
- return this.state.get('options');
- }
-
- this.state.set('options', state);
-
- return this;
- },
-
- renderHtml: function () {
- var self = this, options, size = '';
-
- options = createOptions(self._options);
-
- if (self.size) {
- size = ' size = "' + self.size + '"';
- }
-
- return (
- '<select id="' + self._id + '" class="' + self.classes + '"' + size + '>' +
- options +
- '</select>'
- );
- },
-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:options', function (e) {
- self.getEl().innerHTML = createOptions(e.value);
- });
-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var DOM$9 = DOMUtils$1.DOM;
+ var explode$4 = $_52qop8kjfuw8l6v.explode;
+ var each$23 = $_52qop8kjfuw8l6v.each;
+ var extend$5 = $_52qop8kjfuw8l6v.extend;
+ var instanceCounter = 0;
+ var beforeUnloadDelegate;
+ var EditorManager;
+ var boundGlobalEvents = false;
+ var legacyEditors = [];
+ var editors = [];
+ var isValidLegacyKey = function (id) {
+ return id !== 'length';
+ };
+ var globalEventDelegate = function (e) {
+ each$23(EditorManager.get(), function (editor) {
+ if (e.type === 'scroll') {
+ editor.fire('ScrollWindow', e);
+ } else {
+ editor.fire('ResizeWindow', e);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * Slider.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Slider control.
- *
- * @-x-less Slider.less
- * @class tinymce.ui.Slider
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.Slider',
- [
- "tinymce.core.ui.Widget",
- "tinymce.core.ui.DragHelper",
- "tinymce.core.ui.DomUtils"
- ],
- function (Widget, DragHelper, DomUtils) {
- "use strict";
-
- function constrain(value, minVal, maxVal) {
- if (value < minVal) {
- value = minVal;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ var toggleGlobalEvents = function (state) {
+ if (state !== boundGlobalEvents) {
+ if (state) {
+ DomQuery(window).on('resize scroll', globalEventDelegate);
+ } else {
+ DomQuery(window).off('resize scroll', globalEventDelegate);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (value > maxVal) {
- value = maxVal;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ boundGlobalEvents = state;
+ }
+ };
+ var removeEditorFromList = function (targetEditor) {
+ var oldEditors = editors;
+ delete legacyEditors[targetEditor.id];
+ for (var i = 0; i < legacyEditors.length; i++) {
+ if (legacyEditors[i] === targetEditor) {
+ legacyEditors.splice(i, 1);
+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return value;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function setAriaProp(el, name, value) {
- el.setAttribute('aria-' + name, value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editors = $_9ek1bp4jfuw8kxg.filter(editors, function (editor) {
+ return targetEditor !== editor;
+ });
+ if (EditorManager.activeEditor === targetEditor) {
+ EditorManager.activeEditor = editors.length > 0 ? editors[0] : null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function updateSliderHandle(ctrl, value) {
- var maxHandlePos, shortSizeName, sizeName, stylePosName, styleValue, handleEl;
-
- if (ctrl.settings.orientation == "v") {
- stylePosName = "top";
- sizeName = "height";
- shortSizeName = "h";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (EditorManager.focusedEditor === targetEditor) {
+ EditorManager.focusedEditor = null;
+ }
+ return oldEditors.length !== editors.length;
+ };
+ var purgeDestroyedEditor = function (editor) {
+ if (editor && editor.initialized && !(editor.getContainer() || editor.getBody()).parentNode) {
+ removeEditorFromList(editor);
+ editor.unbindAllNativeEvents();
+ editor.destroy(true);
+ editor.removed = true;
+ editor = null;
+ }
+ return editor;
+ };
+ EditorManager = {
+ defaultSettings: {},
+ $: DomQuery,
+ majorVersion: '4',
+ minorVersion: '7.11',
+ releaseDate: '2018-04-11',
+ editors: legacyEditors,
+ i18n: $_ai97we7gjfuw8mjv,
+ activeEditor: null,
+ settings: {},
+ setup: function () {
+ var self = this;
+ var baseURL, documentBaseURL, suffix = '', preInit, src;
+ documentBaseURL = URI.getDocumentBaseUrl(document.location);
+ if (/^[^:]+:\/\/\/?[^\/]+\//.test(documentBaseURL)) {
+ documentBaseURL = documentBaseURL.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
+ if (!/[\/\\]$/.test(documentBaseURL)) {
+ documentBaseURL += '/';
+ }
+ }
+ preInit = window.tinymce || window.tinyMCEPreInit;
+ if (preInit) {
+ baseURL = preInit.base || preInit.baseURL;
+ suffix = preInit.suffix;
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- stylePosName = "left";
- sizeName = "width";
- shortSizeName = "w";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0; i < scripts.length; i++) {
+ src = scripts[i].src;
+ var srcScript = src.substring(src.lastIndexOf('/'));
+ if (/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(src)) {
+ if (srcScript.indexOf('.min') !== -1) {
+ suffix = '.min';
+ }
+ baseURL = src.substring(0, src.lastIndexOf('/'));
+ break;
+ }
+ }
+ if (!baseURL && document.currentScript) {
+ src = document.currentScript.src;
+ if (src.indexOf('.min') !== -1) {
+ suffix = '.min';
+ }
+ baseURL = src.substring(0, src.lastIndexOf('/'));
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- handleEl = ctrl.getEl('handle');
- maxHandlePos = (ctrl.layoutRect()[shortSizeName] || 100) - DomUtils.getSize(handleEl)[sizeName];
-
- styleValue = (maxHandlePos * ((value - ctrl._minValue) / (ctrl._maxValue - ctrl._minValue))) + 'px';
- handleEl.style[stylePosName] = styleValue;
- handleEl.style.height = ctrl.layoutRect().h + 'px';
-
- setAriaProp(handleEl, 'valuenow', value);
- setAriaProp(handleEl, 'valuetext', '' + ctrl.settings.previewFilter(value));
- setAriaProp(handleEl, 'valuemin', ctrl._minValue);
- setAriaProp(handleEl, 'valuemax', ctrl._maxValue);
- }
-
- return Widget.extend({
- init: function (settings) {
- var self = this;
-
- if (!settings.previewFilter) {
- settings.previewFilter = function (value) {
- return Math.round(value * 100) / 100.0;
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.baseURL = new URI(documentBaseURL).toAbsolute(baseURL);
+ self.documentBaseURL = documentBaseURL;
+ self.baseURI = new URI(self.baseURL);
+ self.suffix = suffix;
+ $_4p4q557djfuw8mjm.setup(self);
+ },
+ overrideDefaults: function (defaultSettings) {
+ var baseUrl, suffix;
+ baseUrl = defaultSettings.base_url;
+ if (baseUrl) {
+ this.baseURL = new URI(this.documentBaseURL).toAbsolute(baseUrl.replace(/\/+$/, ''));
+ this.baseURI = new URI(this.baseURL);
+ }
+ suffix = defaultSettings.suffix;
+ if (defaultSettings.suffix) {
+ this.suffix = suffix;
+ }
+ this.defaultSettings = defaultSettings;
+ var pluginBaseUrls = defaultSettings.plugin_base_urls;
+ for (var name_1 in pluginBaseUrls) {
+ AddOnManager.PluginManager.urls[name_1] = pluginBaseUrls[name_1];
+ }
+ },
+ init: function (settings) {
+ var self = this;
+ var result, invalidInlineTargets;
+ invalidInlineTargets = $_52qop8kjfuw8l6v.makeMap('area base basefont br col frame hr img input isindex link meta param embed source wbr track ' + 'colgroup option tbody tfoot thead tr script noscript style textarea video audio iframe object menu', ' ');
+ var isInvalidInlineTarget = function (settings, elm) {
+ return settings.inline && elm.tagName.toLowerCase() in invalidInlineTargets;
+ };
+ var createId = function (elm) {
+ var id = elm.id;
+ if (!id) {
+ id = elm.name;
+ if (id && !DOM$9.get(id)) {
+ id = elm.name;
+ } else {
+ id = DOM$9.uniqueId();
+ }
+ elm.setAttribute('id', id);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self._super(settings);
- self.classes.add('slider');
-
- if (settings.orientation == "v") {
- self.classes.add('vertical');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return id;
+ };
+ var execCallback = function (name) {
+ var callback = settings[name];
+ if (!callback) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self._minValue = settings.minValue || 0;
- self._maxValue = settings.maxValue || 100;
- self._initValue = self.state.get('value');
- },
-
- renderHtml: function () {
- var self = this, id = self._id, prefix = self.classPrefix;
-
- return (
- '<div id="' + id + '" class="' + self.classes + '">' +
- '<div id="' + id + '-handle" class="' + prefix + 'slider-handle" role="slider" tabindex="-1"></div>' +
- '</div>'
- );
- },
-
- reset: function () {
- this.value(this._initValue).repaint();
- },
-
- postRender: function () {
- var self = this, minValue, maxValue, screenCordName,
- stylePosName, sizeName, shortSizeName;
-
- function toFraction(min, max, val) {
- return (val + min) / (max - min);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return callback.apply(self, Array.prototype.slice.call(arguments, 2));
+ };
+ var hasClass = function (elm, className) {
+ return className.constructor === RegExp ? className.test(elm.className) : DOM$9.hasClass(elm, className);
+ };
+ var findTargets = function (settings) {
+ var l, targets = [];
+ if ($_9fhi43ajfuw8l13.ie && $_9fhi43ajfuw8l13.ie < 11) {
+ $_80cv3b4ijfuw8m1d.initError('TinyMCE does not support the browser you are using. For a list of supported' + ' browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/');
+ return [];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function fromFraction(min, max, val) {
- return (val * (max - min)) - min;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (settings.types) {
+ each$23(settings.types, function (type) {
+ targets = targets.concat(DOM$9.select(type.selector));
+ });
+ return targets;
+ } else if (settings.selector) {
+ return DOM$9.select(settings.selector);
+ } else if (settings.target) {
+ return [settings.target];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function handleKeyboard(minValue, maxValue) {
- function alter(delta) {
- var value;
-
- value = self.value();
- value = fromFraction(minValue, maxValue, toFraction(minValue, maxValue, value) + (delta * 0.05));
- value = constrain(value, minValue, maxValue);
-
- self.value(value);
-
- self.fire('dragstart', { value: value });
- self.fire('drag', { value: value });
- self.fire('dragend', { value: value });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ switch (settings.mode) {
+ case 'exact':
+ l = settings.elements || '';
+ if (l.length > 0) {
+ each$23(explode$4(l), function (id) {
+ var elm;
+ if (elm = DOM$9.get(id)) {
+ targets.push(elm);
+ } else {
+ each$23(document.forms, function (f) {
+ each$23(f.elements, function (e) {
+ if (e.name === id) {
+ id = 'mce_editor_' + instanceCounter++;
+ DOM$9.setAttrib(e, 'id', id);
+ targets.push(e);
+ }
+ });
+ });
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.on('keydown', function (e) {
- switch (e.keyCode) {
- case 37:
- case 38:
- alter(-1);
- break;
-
- case 39:
- case 40:
- alter(1);
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
+ case 'textareas':
+ case 'specific_textareas':
+ each$23(DOM$9.select('textarea'), function (elm) {
+ if (settings.editor_deselector && hasClass(elm, settings.editor_deselector)) {
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (!settings.editor_selector || hasClass(elm, settings.editor_selector)) {
+ targets.push(elm);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ break;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function handleDrag(minValue, maxValue, handleEl) {
- var startPos, startHandlePos, maxHandlePos, handlePos, value;
-
- self._dragHelper = new DragHelper(self._id, {
- handle: self._id + "-handle",
-
- start: function (e) {
- startPos = e[screenCordName];
- startHandlePos = parseInt(self.getEl('handle').style[stylePosName], 10);
- maxHandlePos = (self.layoutRect()[shortSizeName] || 100) - DomUtils.getSize(handleEl)[sizeName];
- self.fire('dragstart', { value: value });
- },
-
- drag: function (e) {
- var delta = e[screenCordName] - startPos;
-
- handlePos = constrain(startHandlePos + delta, 0, maxHandlePos);
- handleEl.style[stylePosName] = handlePos + 'px';
-
- value = minValue + (handlePos / maxHandlePos) * (maxValue - minValue);
- self.value(value);
-
- self.tooltip().text('' + self.settings.previewFilter(value)).show().moveRel(handleEl, 'bc tc');
-
- self.fire('drag', { value: value });
- },
-
- stop: function () {
- self.tooltip().hide();
- self.fire('dragend', { value: value });
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return targets;
+ };
+ var provideResults = function (editors) {
+ result = editors;
+ };
+ var initEditors = function () {
+ var initCount = 0;
+ var editors = [];
+ var targets;
+ var createEditor = function (id, settings, targetElm) {
+ var editor = new Editor(id, settings, self);
+ editors.push(editor);
+ editor.on('init', function () {
+ if (++initCount === targets.length) {
+ provideResults(editors);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.targetElm = editor.targetElm || targetElm;
+ editor.render();
+ };
+ DOM$9.unbind(window, 'ready', initEditors);
+ execCallback('onpageload');
+ targets = DomQuery.unique(findTargets(settings));
+ if (settings.types) {
+ each$23(settings.types, function (type) {
+ $_52qop8kjfuw8l6v.each(targets, function (elm) {
+ if (DOM$9.is(elm, type.selector)) {
+ createEditor(createId(elm), extend$5({}, settings, type), elm);
+ return false;
+ }
+ return true;
+ });
+ });
+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- minValue = self._minValue;
- maxValue = self._maxValue;
-
- if (self.settings.orientation == "v") {
- screenCordName = "screenY";
- stylePosName = "top";
- sizeName = "height";
- shortSizeName = "h";
- } else {
- screenCordName = "screenX";
- stylePosName = "left";
- sizeName = "width";
- shortSizeName = "w";
- }
-
- self._super();
-
- handleKeyboard(minValue, maxValue, self.getEl('handle'));
- handleDrag(minValue, maxValue, self.getEl('handle'));
- },
-
- repaint: function () {
- this._super();
- updateSliderHandle(this, this.value());
- },
-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:value', function (e) {
- updateSliderHandle(self, e.value);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_52qop8kjfuw8l6v.each(targets, function (elm) {
+ purgeDestroyedEditor(self.get(elm.id));
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return self._super();
- }
- });
- }
-);
-/**
- * Spacer.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a spacer. This control is used in flex layouts for example.
- *
- * @-x-less Spacer.less
- * @class tinymce.ui.Spacer
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.Spacer',
- [
- "tinymce.core.ui.Widget"
- ],
- function (Widget) {
- "use strict";
-
- return Widget.extend({
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this;
-
- self.classes.add('spacer');
- self.canFocus = false;
-
- return '<div id="' + self._id + '" class="' + self.classes + '"></div>';
- }
- });
- }
-);
-/**
- * SplitButton.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a split button.
- *
- * @-x-less SplitButton.less
- * @class tinymce.ui.SplitButton
- * @extends tinymce.ui.Button
- */
-define(
- 'tinymce.core.ui.SplitButton',
- [
- "tinymce.core.ui.MenuButton",
- "tinymce.core.ui.DomUtils",
- "tinymce.core.dom.DomQuery"
- ],
- function (MenuButton, DomUtils, $) {
- return MenuButton.extend({
- Defaults: {
- classes: "widget btn splitbtn",
- role: "button"
- },
-
- /**
- * Repaints the control after a layout operation.
- *
- * @method repaint
- */
- repaint: function () {
- var self = this, elm = self.getEl(), rect = self.layoutRect(), mainButtonElm, menuButtonElm;
-
- self._super();
-
- mainButtonElm = elm.firstChild;
- menuButtonElm = elm.lastChild;
-
- $(mainButtonElm).css({
- width: rect.w - DomUtils.getSize(menuButtonElm).width,
- height: rect.h - 2
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ targets = $_52qop8kjfuw8l6v.grep(targets, function (elm) {
+ return !self.get(elm.id);
</ins><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $(menuButtonElm).css({
- height: rect.h - 2
- });
-
- return self;
- },
-
- /**
- * Sets the active menu state.
- *
- * @private
- */
- activeMenu: function (state) {
- var self = this;
-
- $(self.getEl().lastChild).toggleClass(self.classPrefix + 'active', state);
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, id = self._id, prefix = self.classPrefix, image;
- var icon = self.state.get('icon'), text = self.state.get('text'),
- textHtml = '';
-
- image = self.settings.image;
- if (image) {
- icon = 'none';
-
- // Support for [high dpi, low dpi] image sources
- if (typeof image != "string") {
- image = window.getSelection ? image[0] : image[1];
- }
-
- image = ' style="background-image: url(\'' + image + '\')"';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (targets.length === 0) {
+ provideResults([]);
</ins><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- image = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ each$23(targets, function (elm) {
+ if (isInvalidInlineTarget(settings, elm)) {
+ $_80cv3b4ijfuw8m1d.initError('Could not initialize inline editor on invalid inline target element', elm);
+ } else {
+ createEditor(createId(elm), settings, elm);
+ }
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
-
- if (text) {
- self.classes.add('btn-has-text');
- textHtml = '<span class="' + prefix + 'txt">' + self.encode(text) + '</span>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
+ self.settings = settings;
+ DOM$9.bind(window, 'ready', initEditors);
+ return new promiseObj(function (resolve) {
+ if (result) {
+ resolve(result);
+ } else {
+ provideResults = function (editors) {
+ resolve(editors);
+ };
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return (
- '<div id="' + id + '" class="' + self.classes + '" role="button" tabindex="-1">' +
- '<button type="button" hidefocus="1" tabindex="-1">' +
- (icon ? '<i class="' + icon + '"' + image + '></i>' : '') +
- textHtml +
- '</button>' +
- '<button type="button" class="' + prefix + 'open" hidefocus="1" tabindex="-1">' +
- //(icon ? '<i class="' + icon + '"></i>' : '') +
- (self._menuBtnText ? (icon ? '\u00a0' : '') + self._menuBtnText : '') +
- ' <i class="' + prefix + 'caret"></i>' +
- '</button>' +
- '</div>'
- );
- },
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this, onClickHandler = self.settings.onclick;
-
- self.on('click', function (e) {
- var node = e.target;
-
- if (e.control == this) {
- // Find clicks that is on the main button
- while (node) {
- if ((e.aria && e.aria.key != 'down') || (node.nodeName == 'BUTTON' && node.className.indexOf('open') == -1)) {
- e.stopImmediatePropagation();
-
- if (onClickHandler) {
- onClickHandler.call(this, e);
- }
-
- return;
- }
-
- node = node.parentNode;
- }
- }
- });
-
- delete self.settings.onclick;
-
- return self._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ },
+ get: function (id) {
+ if (arguments.length === 0) {
+ return editors.slice(0);
+ } else if ($_16i8k47jfuw8kyi.isString(id)) {
+ return $_9ek1bp4jfuw8kxg.find(editors, function (editor) {
+ return editor.id === id;
+ }).getOr(null);
+ } else if ($_16i8k47jfuw8kyi.isNumber(id)) {
+ return editors[id] ? editors[id] : null;
+ } else {
+ return null;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * StackLayout.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This layout uses the browsers layout when the items are blocks.
- *
- * @-x-less StackLayout.less
- * @class tinymce.ui.StackLayout
- * @extends tinymce.ui.FlowLayout
- */
-define(
- 'tinymce.core.ui.StackLayout',
- [
- "tinymce.core.ui.FlowLayout"
- ],
- function (FlowLayout) {
- "use strict";
-
- return FlowLayout.extend({
- Defaults: {
- containerClass: 'stack-layout',
- controlClass: 'stack-layout-item',
- endClass: 'break'
- },
-
- isNative: function () {
- return true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ add: function (editor) {
+ var self = this;
+ var existingEditor;
+ existingEditor = legacyEditors[editor.id];
+ if (existingEditor === editor) {
+ return editor;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-/**
- * TabPanel.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a tab panel control.
- *
- * @-x-less TabPanel.less
- * @class tinymce.ui.TabPanel
- * @extends tinymce.ui.Panel
- *
- * @setting {Number} activeTab Active tab index.
- */
-define(
- 'tinymce.core.ui.TabPanel',
- [
- "tinymce.core.ui.Panel",
- "tinymce.core.dom.DomQuery",
- "tinymce.core.ui.DomUtils"
- ],
- function (Panel, $, DomUtils) {
- "use strict";
-
- return Panel.extend({
- Defaults: {
- layout: 'absolute',
- defaults: {
- type: 'panel'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.get(editor.id) === null) {
+ if (isValidLegacyKey(editor.id)) {
+ legacyEditors[editor.id] = editor;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Activates the specified tab by index.
- *
- * @method activateTab
- * @param {Number} idx Index of the tab to activate.
- */
- activateTab: function (idx) {
- var activeTabElm;
-
- if (this.activeTabId) {
- activeTabElm = this.getEl(this.activeTabId);
- $(activeTabElm).removeClass(this.classPrefix + 'active');
- activeTabElm.setAttribute('aria-selected', "false");
- }
-
- this.activeTabId = 't' + idx;
-
- activeTabElm = this.getEl('t' + idx);
- activeTabElm.setAttribute('aria-selected', "true");
- $(activeTabElm).addClass(this.classPrefix + 'active');
-
- this.items()[idx].show().fire('showtab');
- this.reflow();
-
- this.items().each(function (item, i) {
- if (idx != i) {
- item.hide();
- }
- });
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, layout = self._layout, tabsHtml = '', prefix = self.classPrefix;
-
- self.preRender();
- layout.preRender(self);
-
- self.items().each(function (ctrl, i) {
- var id = self._id + '-t' + i;
-
- ctrl.aria('role', 'tabpanel');
- ctrl.aria('labelledby', id);
-
- tabsHtml += (
- '<div id="' + id + '" class="' + prefix + 'tab" ' +
- 'unselectable="on" role="tab" aria-controls="' + ctrl._id + '" aria-selected="false" tabIndex="-1">' +
- self.encode(ctrl.settings.title) +
- '</div>'
- );
- });
-
- return (
- '<div id="' + self._id + '" class="' + self.classes + '" hidefocus="1" tabindex="-1">' +
- '<div id="' + self._id + '-head" class="' + prefix + 'tabs" role="tablist">' +
- tabsHtml +
- '</div>' +
- '<div id="' + self._id + '-body" class="' + self.bodyClasses + '">' +
- layout.renderHtml(self) +
- '</div>' +
- '</div>'
- );
- },
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this;
-
- self._super();
-
- self.settings.activeTab = self.settings.activeTab || 0;
- self.activateTab(self.settings.activeTab);
-
- this.on('click', function (e) {
- var targetParent = e.target.parentNode;
-
- if (targetParent && targetParent.id == self._id + '-head') {
- var i = targetParent.childNodes.length;
-
- while (i--) {
- if (targetParent.childNodes[i] == e.target) {
- self.activateTab(i);
- }
- }
- }
- });
- },
-
- /**
- * Initializes the current controls layout rect.
- * This will be executed by the layout managers to determine the
- * default minWidth/minHeight etc.
- *
- * @method initLayoutRect
- * @return {Object} Layout rect instance.
- */
- initLayoutRect: function () {
- var self = this, rect, minW, minH;
-
- minW = DomUtils.getSize(self.getEl('head')).width;
- minW = minW < 0 ? 0 : minW;
- minH = 0;
-
- self.items().each(function (item) {
- minW = Math.max(minW, item.layoutRect().minW);
- minH = Math.max(minH, item.layoutRect().minH);
- });
-
- self.items().each(function (ctrl) {
- ctrl.settings.x = 0;
- ctrl.settings.y = 0;
- ctrl.settings.w = minW;
- ctrl.settings.h = minH;
-
- ctrl.layoutRect({
- x: 0,
- y: 0,
- w: minW,
- h: minH
- });
- });
-
- var headH = DomUtils.getSize(self.getEl('head')).height;
-
- self.settings.minWidth = minW;
- self.settings.minHeight = minH + headH;
-
- rect = self._super();
- rect.deltaH += headH;
- rect.innerH = rect.h - rect.deltaH;
-
- return rect;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ legacyEditors.push(editor);
+ editors.push(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-
-/**
- * TextBox.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new textbox.
- *
- * @-x-less TextBox.less
- * @class tinymce.ui.TextBox
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.TextBox',
- [
- "tinymce.core.ui.Widget",
- "tinymce.core.util.Tools",
- "tinymce.core.ui.DomUtils"
- ],
- function (Widget, Tools, DomUtils) {
- return Widget.extend({
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Boolean} multiline True if the textbox is a multiline control.
- * @setting {Number} maxLength Max length for the textbox.
- * @setting {Number} size Size of the textbox in characters.
- */
- init: function (settings) {
- var self = this;
-
- self._super(settings);
-
- self.classes.add('textbox');
-
- if (settings.multiline) {
- self.classes.add('multiline');
- } else {
- self.on('keydown', function (e) {
- var rootControl;
-
- if (e.keyCode == 13) {
- e.preventDefault();
-
- // Find root control that we can do toJSON on
- self.parents().reverse().each(function (ctrl) {
- if (ctrl.toJSON) {
- rootControl = ctrl;
- return false;
- }
- });
-
- // Fire event on current text box with the serialized data of the whole form
- self.fire('submit', { data: rootControl.toJSON() });
- }
- });
-
- self.on('keyup', function (e) {
- self.state.set('value', e.target.value);
- });
- }
- },
-
- /**
- * Repaints the control after a layout operation.
- *
- * @method repaint
- */
- repaint: function () {
- var self = this, style, rect, borderBox, borderW, borderH = 0, lastRepaintRect;
-
- style = self.getEl().style;
- rect = self._layoutRect;
- lastRepaintRect = self._lastRepaintRect || {};
-
- // Detect old IE 7+8 add lineHeight to align caret vertically in the middle
- var doc = document;
- if (!self.settings.multiline && doc.all && (!doc.documentMode || doc.documentMode <= 8)) {
- style.lineHeight = (rect.h - borderH) + 'px';
- }
-
- borderBox = self.borderBox;
- borderW = borderBox.left + borderBox.right + 8;
- borderH = borderBox.top + borderBox.bottom + (self.settings.multiline ? 8 : 0);
-
- if (rect.x !== lastRepaintRect.x) {
- style.left = rect.x + 'px';
- lastRepaintRect.x = rect.x;
- }
-
- if (rect.y !== lastRepaintRect.y) {
- style.top = rect.y + 'px';
- lastRepaintRect.y = rect.y;
- }
-
- if (rect.w !== lastRepaintRect.w) {
- style.width = (rect.w - borderW) + 'px';
- lastRepaintRect.w = rect.w;
- }
-
- if (rect.h !== lastRepaintRect.h) {
- style.height = (rect.h - borderH) + 'px';
- lastRepaintRect.h = rect.h;
- }
-
- self._lastRepaintRect = lastRepaintRect;
- self.fire('repaint', {}, false);
-
- return self;
- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, settings = self.settings, attrs, elm;
-
- attrs = {
- id: self._id,
- hidefocus: '1'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ toggleGlobalEvents(true);
+ self.activeEditor = editor;
+ self.fire('AddEditor', { editor: editor });
+ if (!beforeUnloadDelegate) {
+ beforeUnloadDelegate = function () {
+ self.fire('BeforeUnload');
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- Tools.each([
- 'rows', 'spellcheck', 'maxLength', 'size', 'readonly', 'min',
- 'max', 'step', 'list', 'pattern', 'placeholder', 'required', 'multiple'
- ], function (name) {
- attrs[name] = settings[name];
- });
-
- if (self.disabled()) {
- attrs.disabled = 'disabled';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ DOM$9.bind(window, 'beforeunload', beforeUnloadDelegate);
+ }
+ return editor;
+ },
+ createEditor: function (id, settings) {
+ return this.add(new Editor(id, settings, this));
+ },
+ remove: function (selector) {
+ var self = this;
+ var i, editor;
+ if (!selector) {
+ for (i = editors.length - 1; i >= 0; i--) {
+ self.remove(editors[i]);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (settings.subtype) {
- attrs.type = settings.subtype;
- }
-
- elm = DomUtils.create(settings.multiline ? 'textarea' : 'input', attrs);
- elm.value = self.state.get('value');
- elm.className = self.classes;
-
- return elm.outerHTML;
- },
-
- value: function (value) {
- if (arguments.length) {
- this.state.set('value', value);
- return this;
- }
-
- // Make sure the real state is in sync
- if (this.state.get('rendered')) {
- this.state.set('value', this.getEl().value);
- }
-
- return this.state.get('value');
- },
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this;
-
- self.getEl().value = self.state.get('value');
- self._super();
-
- self.$el.on('change', function (e) {
- self.state.set('value', e.target.value);
- self.fire('change', e);
- });
- },
-
- bindStates: function () {
- var self = this;
-
- self.state.on('change:value', function (e) {
- if (self.getEl().value != e.value) {
- self.getEl().value = e.value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
+ }
+ if ($_16i8k47jfuw8kyi.isString(selector)) {
+ selector = selector.selector || selector;
+ each$23(DOM$9.select(selector), function (elm) {
+ editor = self.get(elm.id);
+ if (editor) {
+ self.remove(editor);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- self.state.on('change:disabled', function (e) {
- self.getEl().disabled = e.value;
- });
-
- return self._super();
- },
-
- remove: function () {
- this.$el.off();
- this._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-
-defineGlobal("global!RegExp", RegExp);
-/**
- * DropZone.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new dropzone.
- *
- * @-x-less DropZone.less
- * @class tinymce.ui.DropZone
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.DropZone',
- [
- 'tinymce.core.ui.Widget',
- 'tinymce.core.util.Tools',
- 'tinymce.core.ui.DomUtils',
- 'global!RegExp'
- ],
- function (Widget, Tools, DomUtils, RegExp) {
- return Widget.extend({
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Boolean} multiple True if the dropzone is a multiple control.
- * @setting {Number} maxLength Max length for the dropzone.
- * @setting {Number} size Size of the dropzone in characters.
- */
- init: function (settings) {
- var self = this;
-
- settings = Tools.extend({
- height: 100,
- text: "Drop an image here",
- multiple: false,
- accept: null // by default accept any files
- }, settings);
-
- self._super(settings);
-
- self.classes.add('dropzone');
-
- if (settings.multiple) {
- self.classes.add('multiple');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor = selector;
+ if ($_16i8k47jfuw8kyi.isNull(self.get(editor.id))) {
+ return null;
+ }
+ if (removeEditorFromList(editor)) {
+ self.fire('RemoveEditor', { editor: editor });
+ }
+ if (editors.length === 0) {
+ DOM$9.unbind(window, 'beforeunload', beforeUnloadDelegate);
+ }
+ editor.remove();
+ toggleGlobalEvents(editors.length > 0);
+ return editor;
+ },
+ execCommand: function (cmd, ui, value) {
+ var self = this, editor = self.get(value);
+ switch (cmd) {
+ case 'mceAddEditor':
+ if (!self.get(value)) {
+ new Editor(value, self.settings, self).render();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Renders the control as a HTML string.
- *
- * @method renderHtml
- * @return {String} HTML representing the control.
- */
- renderHtml: function () {
- var self = this, attrs, elm;
- var cfg = self.settings;
-
- attrs = {
- id: self._id,
- hidefocus: '1'
- };
-
- elm = DomUtils.create('div', attrs, '<span>' + this.translate(cfg.text) + '</span>');
-
- if (cfg.height) {
- DomUtils.css(elm, 'height', cfg.height + 'px');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ case 'mceRemoveEditor':
+ if (editor) {
+ editor.remove();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (cfg.width) {
- DomUtils.css(elm, 'width', cfg.width + 'px');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
+ case 'mceToggleEditor':
+ if (!editor) {
+ self.execCommand('mceAddEditor', 0, value);
+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- elm.className = self.classes;
-
- return elm.outerHTML;
- },
-
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this;
-
- var toggleDragClass = function (e) {
- e.preventDefault();
- self.classes.toggle('dragenter');
- self.getEl().className = self.classes;
- };
-
- var filter = function (files) {
- var accept = self.settings.accept;
- if (typeof accept !== 'string') {
- return files;
- }
-
- var re = new RegExp('(' + accept.split(/\s*,\s*/).join('|') + ')$', 'i');
- return Tools.grep(files, function (file) {
- return re.test(file.name);
- });
- };
-
- self._super();
-
- self.$el.on('dragover', function (e) {
- e.preventDefault();
- });
-
- self.$el.on('dragenter', toggleDragClass);
- self.$el.on('dragleave', toggleDragClass);
-
- self.$el.on('drop', function (e) {
- e.preventDefault();
-
- if (self.state.get('disabled')) {
- return;
- }
-
- var files = filter(e.dataTransfer.files);
-
- self.value = function () {
- if (!files.length) {
- return null;
- } else if (self.settings.multiple) {
- return files;
- } else {
- return files[0];
- }
- };
-
- if (files.length) {
- self.fire('change', e);
- }
- });
- },
-
- remove: function () {
- this.$el.off();
- this._super();
- }
- });
- }
-);
-
-/**
- * BrowseButton.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * Creates a new browse button.
- *
- * @-x-less BrowseButton.less
- * @class tinymce.ui.BrowseButton
- * @extends tinymce.ui.Widget
- */
-define(
- 'tinymce.core.ui.BrowseButton',
- [
- 'tinymce.core.ui.Button',
- 'tinymce.core.util.Tools',
- 'tinymce.core.ui.DomUtils',
- 'tinymce.core.dom.DomQuery',
- 'global!RegExp'
- ],
- function (Button, Tools, DomUtils, $, RegExp) {
- return Button.extend({
- /**
- * Constructs a instance with the specified settings.
- *
- * @constructor
- * @param {Object} settings Name/value object with settings.
- * @setting {Boolean} multiple True if the dropzone is a multiple control.
- * @setting {Number} maxLength Max length for the dropzone.
- * @setting {Number} size Size of the dropzone in characters.
- */
- init: function (settings) {
- var self = this;
-
- settings = Tools.extend({
- text: "Browse...",
- multiple: false,
- accept: null // by default accept any files
- }, settings);
-
- self._super(settings);
-
- self.classes.add('browsebutton');
-
- if (settings.multiple) {
- self.classes.add('multiple');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (editor.isHidden()) {
+ editor.show();
+ } else {
+ editor.hide();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Called after the control has been rendered.
- *
- * @method postRender
- */
- postRender: function () {
- var self = this;
-
- var input = DomUtils.create('input', {
- type: 'file',
- id: self._id + '-browse',
- accept: self.settings.accept
- });
-
- self._super();
-
- $(input).on('change', function (e) {
- var files = e.target.files;
-
- self.value = function () {
- if (!files.length) {
- return null;
- } else if (self.settings.multiple) {
- return files;
- } else {
- return files[0];
- }
- };
-
- e.preventDefault();
-
- if (files.length) {
- self.fire('change', e);
- }
- });
-
- // ui.Button prevents default on click, so we shouldn't let the click to propagate up to it
- $(input).on('click', function (e) {
- e.stopPropagation();
- });
-
- $(self.getEl('button')).on('click', function (e) {
- e.stopPropagation();
- input.click();
- });
-
- // in newer browsers input doesn't have to be attached to dom to trigger browser dialog
- // however older IE11 (< 11.1358.14393.0) still requires this
- self.getEl().appendChild(input);
- },
-
-
- remove: function () {
- $(this.getEl('button')).off();
- $(this.getEl('input')).off();
-
- this._super();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return true;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- });
- }
-);
-
-/**
- * Api.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.ui.Api',
- [
- 'tinymce.core.ui.Selector',
- 'tinymce.core.ui.Collection',
- 'tinymce.core.ui.ReflowQueue',
- 'tinymce.core.ui.Control',
- 'tinymce.core.ui.Factory',
- 'tinymce.core.ui.KeyboardNavigation',
- 'tinymce.core.ui.Container',
- 'tinymce.core.ui.DragHelper',
- 'tinymce.core.ui.Scrollable',
- 'tinymce.core.ui.Panel',
- 'tinymce.core.ui.Movable',
- 'tinymce.core.ui.Resizable',
- 'tinymce.core.ui.FloatPanel',
- 'tinymce.core.ui.Window',
- 'tinymce.core.ui.MessageBox',
- 'tinymce.core.ui.Tooltip',
- 'tinymce.core.ui.Widget',
- 'tinymce.core.ui.Progress',
- 'tinymce.core.ui.Notification',
- 'tinymce.core.ui.Layout',
- 'tinymce.core.ui.AbsoluteLayout',
- 'tinymce.core.ui.Button',
- 'tinymce.core.ui.ButtonGroup',
- 'tinymce.core.ui.Checkbox',
- 'tinymce.core.ui.ComboBox',
- 'tinymce.core.ui.ColorBox',
- 'tinymce.core.ui.PanelButton',
- 'tinymce.core.ui.ColorButton',
- 'tinymce.core.ui.ColorPicker',
- 'tinymce.core.ui.Path',
- 'tinymce.core.ui.ElementPath',
- 'tinymce.core.ui.FormItem',
- 'tinymce.core.ui.Form',
- 'tinymce.core.ui.FieldSet',
- 'tinymce.core.ui.FilePicker',
- 'tinymce.core.ui.FitLayout',
- 'tinymce.core.ui.FlexLayout',
- 'tinymce.core.ui.FlowLayout',
- 'tinymce.core.ui.FormatControls',
- 'tinymce.core.ui.GridLayout',
- 'tinymce.core.ui.Iframe',
- 'tinymce.core.ui.InfoBox',
- 'tinymce.core.ui.Label',
- 'tinymce.core.ui.Toolbar',
- 'tinymce.core.ui.MenuBar',
- 'tinymce.core.ui.MenuButton',
- 'tinymce.core.ui.MenuItem',
- 'tinymce.core.ui.Throbber',
- 'tinymce.core.ui.Menu',
- 'tinymce.core.ui.ListBox',
- 'tinymce.core.ui.Radio',
- 'tinymce.core.ui.ResizeHandle',
- 'tinymce.core.ui.SelectBox',
- 'tinymce.core.ui.Slider',
- 'tinymce.core.ui.Spacer',
- 'tinymce.core.ui.SplitButton',
- 'tinymce.core.ui.StackLayout',
- 'tinymce.core.ui.TabPanel',
- 'tinymce.core.ui.TextBox',
- 'tinymce.core.ui.DropZone',
- 'tinymce.core.ui.BrowseButton'
- ],
- function (
- Selector, Collection, ReflowQueue, Control, Factory, KeyboardNavigation, Container, DragHelper, Scrollable, Panel, Movable,
- Resizable, FloatPanel, Window, MessageBox, Tooltip, Widget, Progress, Notification, Layout, AbsoluteLayout, Button,
- ButtonGroup, Checkbox, ComboBox, ColorBox, PanelButton, ColorButton, ColorPicker, Path, ElementPath, FormItem, Form,
- FieldSet, FilePicker, FitLayout, FlexLayout, FlowLayout, FormatControls, GridLayout, Iframe, InfoBox, Label, Toolbar,
- MenuBar, MenuButton, MenuItem, Throbber, Menu, ListBox, Radio, ResizeHandle, SelectBox, Slider, Spacer, SplitButton,
- StackLayout, TabPanel, TextBox, DropZone, BrowseButton
- ) {
- "use strict";
-
- var registerToFactory = function (id, ref) {
- Factory.add(id.split('.').pop(), ref);
- };
-
- var expose = function (target, id, ref) {
- var i, fragments;
-
- fragments = id.split(/[.\/]/);
- for (i = 0; i < fragments.length - 1; ++i) {
- if (target[fragments[i]] === undefined) {
- target[fragments[i]] = {};
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (self.activeEditor) {
+ return self.activeEditor.execCommand(cmd, ui, value);
+ }
+ return false;
+ },
+ triggerSave: function () {
+ each$23(editors, function (editor) {
+ editor.save();
+ });
+ },
+ addI18n: function (code, items) {
+ $_ai97we7gjfuw8mjv.add(code, items);
+ },
+ translate: function (text) {
+ return $_ai97we7gjfuw8mjv.translate(text);
+ },
+ setActive: function (editor) {
+ var activeEditor = this.activeEditor;
+ if (this.activeEditor !== editor) {
+ if (activeEditor) {
+ activeEditor.fire('deactivate', { relatedTarget: editor });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- target = target[fragments[i]];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ editor.fire('activate', { relatedTarget: activeEditor });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ this.activeEditor = editor;
+ }
+ };
+ extend$5(EditorManager, $_17qpde45jfuw8lze);
+ EditorManager.setup();
+ var EditorManager$1 = EditorManager;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- target[fragments[fragments.length - 1]] = ref;
-
- registerToFactory(id, ref);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ function RangeUtils(dom) {
+ var walk = function (rng, callback) {
+ return $_1l4f5i5tjfuw8m9h.walk(dom, rng, callback);
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var appendTo = function (target) {
- expose(target, 'ui.Selector', Selector);
- expose(target, 'ui.Collection', Collection);
- expose(target, 'ui.ReflowQueue', ReflowQueue);
- expose(target, 'ui.Control', Control);
- expose(target, 'ui.Factory', Factory);
- expose(target, 'ui.KeyboardNavigation', KeyboardNavigation);
- expose(target, 'ui.Container', Container);
- expose(target, 'ui.DragHelper', DragHelper);
- expose(target, 'ui.Scrollable', Scrollable);
- expose(target, 'ui.Panel', Panel);
- expose(target, 'ui.Movable', Movable);
- expose(target, 'ui.Resizable', Resizable);
- expose(target, 'ui.FloatPanel', FloatPanel);
- expose(target, 'ui.Window', Window);
- expose(target, 'ui.MessageBox', MessageBox);
- expose(target, 'ui.Tooltip', Tooltip);
- expose(target, 'ui.Widget', Widget);
- expose(target, 'ui.Progress', Progress);
- expose(target, 'ui.Notification', Notification);
- expose(target, 'ui.Layout', Layout);
- expose(target, 'ui.AbsoluteLayout', AbsoluteLayout);
- expose(target, 'ui.Button', Button);
- expose(target, 'ui.ButtonGroup', ButtonGroup);
- expose(target, 'ui.Checkbox', Checkbox);
- expose(target, 'ui.ComboBox', ComboBox);
- expose(target, 'ui.ColorBox', ColorBox);
- expose(target, 'ui.PanelButton', PanelButton);
- expose(target, 'ui.ColorButton', ColorButton);
- expose(target, 'ui.ColorPicker', ColorPicker);
- expose(target, 'ui.Path', Path);
- expose(target, 'ui.ElementPath', ElementPath);
- expose(target, 'ui.FormItem', FormItem);
- expose(target, 'ui.Form', Form);
- expose(target, 'ui.FieldSet', FieldSet);
- expose(target, 'ui.FilePicker', FilePicker);
- expose(target, 'ui.FitLayout', FitLayout);
- expose(target, 'ui.FlexLayout', FlexLayout);
- expose(target, 'ui.FlowLayout', FlowLayout);
- expose(target, 'ui.FormatControls', FormatControls);
- expose(target, 'ui.GridLayout', GridLayout);
- expose(target, 'ui.Iframe', Iframe);
- expose(target, 'ui.InfoBox', InfoBox);
- expose(target, 'ui.Label', Label);
- expose(target, 'ui.Toolbar', Toolbar);
- expose(target, 'ui.MenuBar', MenuBar);
- expose(target, 'ui.MenuButton', MenuButton);
- expose(target, 'ui.MenuItem', MenuItem);
- expose(target, 'ui.Throbber', Throbber);
- expose(target, 'ui.Menu', Menu);
- expose(target, 'ui.ListBox', ListBox);
- expose(target, 'ui.Radio', Radio);
- expose(target, 'ui.ResizeHandle', ResizeHandle);
- expose(target, 'ui.SelectBox', SelectBox);
- expose(target, 'ui.Slider', Slider);
- expose(target, 'ui.Spacer', Spacer);
- expose(target, 'ui.SplitButton', SplitButton);
- expose(target, 'ui.StackLayout', StackLayout);
- expose(target, 'ui.TabPanel', TabPanel);
- expose(target, 'ui.TextBox', TextBox);
- expose(target, 'ui.DropZone', DropZone);
- expose(target, 'ui.BrowseButton', BrowseButton);
- expose(target, 'ui.Api', Api);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var split = $_5l67ss5pjfuw8m8j.split;
+ var normalize = function (rng) {
+ return $_970szt3yjfuw8ly1.normalize(dom, rng).fold($_68e81l6jfuw8kyc.constant(false), function (normalizedRng) {
+ rng.setStart(normalizedRng.startContainer, normalizedRng.startOffset);
+ rng.setEnd(normalizedRng.endContainer, normalizedRng.endOffset);
+ return true;
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- var Api = {
- appendTo: appendTo
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return {
+ walk: walk,
+ split: split,
+ normalize: normalize
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return Api;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-);
-/**
- * JSON.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ (function (RangeUtils) {
+ RangeUtils.compareRanges = $_87lezn3zjfuw8ly9.isEq;
+ RangeUtils.getCaretRangeFromPoint = $_dyytu76ejfuw8md2.fromPoint;
+ RangeUtils.getSelectedNode = getSelectedNode;
+ RangeUtils.getNode = getNode;
+ }(RangeUtils || (RangeUtils = {})));
+ var RangeUtils$1 = RangeUtils;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * JSON parser and serializer class.
- *
- * @class tinymce.util.JSON
- * @static
- * @example
- * // JSON parse a string into an object
- * var obj = tinymce.util.JSON.parse(somestring);
- *
- * // JSON serialize a object into an string
- * var str = tinymce.util.JSON.serialize(obj);
- */
-define(
- 'tinymce.core.util.JSON',
- [
- ],
- function () {
- function serialize(o, quote) {
- var i, v, t, name;
-
- quote = quote || '"';
-
- if (o === null) {
- return 'null';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var min = Math.min;
+ var max = Math.max;
+ var round$2 = Math.round;
+ var relativePosition = function (rect, targetRect, rel) {
+ var x, y, w, h, targetW, targetH;
+ x = targetRect.x;
+ y = targetRect.y;
+ w = rect.w;
+ h = rect.h;
+ targetW = targetRect.w;
+ targetH = targetRect.h;
+ rel = (rel || '').split('');
+ if (rel[0] === 'b') {
+ y += targetH;
+ }
+ if (rel[1] === 'r') {
+ x += targetW;
+ }
+ if (rel[0] === 'c') {
+ y += round$2(targetH / 2);
+ }
+ if (rel[1] === 'c') {
+ x += round$2(targetW / 2);
+ }
+ if (rel[3] === 'b') {
+ y -= h;
+ }
+ if (rel[4] === 'r') {
+ x -= w;
+ }
+ if (rel[3] === 'c') {
+ y -= round$2(h / 2);
+ }
+ if (rel[4] === 'c') {
+ x -= round$2(w / 2);
+ }
+ return create$2(x, y, w, h);
+ };
+ var findBestRelativePosition = function (rect, targetRect, constrainRect, rels) {
+ var pos, i;
+ for (i = 0; i < rels.length; i++) {
+ pos = relativePosition(rect, targetRect, rels[i]);
+ if (pos.x >= constrainRect.x && pos.x + pos.w <= constrainRect.w + constrainRect.x && pos.y >= constrainRect.y && pos.y + pos.h <= constrainRect.h + constrainRect.y) {
+ return rels[i];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ return null;
+ };
+ var inflate = function (rect, w, h) {
+ return create$2(rect.x - w, rect.y - h, rect.w + w * 2, rect.h + h * 2);
+ };
+ var intersect = function (rect, cropRect) {
+ var x1, y1, x2, y2;
+ x1 = max(rect.x, cropRect.x);
+ y1 = max(rect.y, cropRect.y);
+ x2 = min(rect.x + rect.w, cropRect.x + cropRect.w);
+ y2 = min(rect.y + rect.h, cropRect.y + cropRect.h);
+ if (x2 - x1 < 0 || y2 - y1 < 0) {
+ return null;
+ }
+ return create$2(x1, y1, x2 - x1, y2 - y1);
+ };
+ var clamp$1 = function (rect, clampRect, fixedSize) {
+ var underflowX1, underflowY1, overflowX2, overflowY2, x1, y1, x2, y2, cx2, cy2;
+ x1 = rect.x;
+ y1 = rect.y;
+ x2 = rect.x + rect.w;
+ y2 = rect.y + rect.h;
+ cx2 = clampRect.x + clampRect.w;
+ cy2 = clampRect.y + clampRect.h;
+ underflowX1 = max(0, clampRect.x - x1);
+ underflowY1 = max(0, clampRect.y - y1);
+ overflowX2 = max(0, x2 - cx2);
+ overflowY2 = max(0, y2 - cy2);
+ x1 += underflowX1;
+ y1 += underflowY1;
+ if (fixedSize) {
+ x2 += underflowX1;
+ y2 += underflowY1;
+ x1 -= overflowX2;
+ y1 -= overflowY2;
+ }
+ x2 -= overflowX2;
+ y2 -= overflowY2;
+ return create$2(x1, y1, x2 - x1, y2 - y1);
+ };
+ var create$2 = function (x, y, w, h) {
+ return {
+ x: x,
+ y: y,
+ w: w,
+ h: h
+ };
+ };
+ var fromClientRect = function (clientRect) {
+ return create$2(clientRect.left, clientRect.top, clientRect.width, clientRect.height);
+ };
+ var $_nkvpl7ijfuw8mkc = {
+ inflate: inflate,
+ relativePosition: relativePosition,
+ findBestRelativePosition: findBestRelativePosition,
+ intersect: intersect,
+ clamp: clamp$1,
+ create: create$2,
+ fromClientRect: fromClientRect
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- t = typeof o;
-
- if (t == 'string') {
- v = '\bb\tt\nn\ff\rr\""\'\'\\\\';
-
- /*eslint no-control-regex:0 */
- return quote + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g, function (a, b) {
- // Make sure single quotes never get encoded inside double quotes for JSON compatibility
- if (quote === '"' && a === "'") {
- return a;
- }
-
- i = v.indexOf(b);
-
- if (i + 1) {
- return '\\' + v.charAt(i + 1);
- }
-
- a = b.charCodeAt().toString(16);
-
- return '\\u' + '0000'.substring(a.length) + a;
- }) + quote;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var types = {};
+ var $_81mtl67jjfuw8mkg = {
+ add: function (type, typeClass) {
+ types[type.toLowerCase()] = typeClass;
+ },
+ has: function (type) {
+ return !!types[type.toLowerCase()];
+ },
+ get: function (type) {
+ var lctype = type.toLowerCase();
+ var controlType = types.hasOwnProperty(lctype) ? types[lctype] : null;
+ if (controlType === null) {
+ throw new Error('Could not find module for type: ' + type);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return controlType;
+ },
+ create: function (type, settings) {
+ var ControlType;
+ if (typeof type === 'string') {
+ settings = settings || {};
+ settings.type = type;
+ } else {
+ settings = type;
+ type = settings.type;
+ }
+ type = type.toLowerCase();
+ ControlType = types[type];
+ if (!ControlType) {
+ throw new Error('Could not find control by type: ' + type);
+ }
+ ControlType = new ControlType(settings);
+ ControlType.type = type;
+ return ControlType;
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if (t == 'object') {
- if (o.hasOwnProperty && Object.prototype.toString.call(o) === '[object Array]') {
- for (i = 0, v = '['; i < o.length; i++) {
- v += (i > 0 ? ',' : '') + serialize(o[i], quote);
- }
-
- return v + ']';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var each$24 = $_52qop8kjfuw8l6v.each;
+ var extend$6 = $_52qop8kjfuw8l6v.extend;
+ var extendClass;
+ var initializing;
+ var Class = function () {
+ };
+ Class.extend = extendClass = function (prop) {
+ var self = this;
+ var _super = self.prototype;
+ var prototype, name, member;
+ var Class = function () {
+ var i, mixins, mixin;
+ var self = this;
+ if (!initializing) {
+ if (self.init) {
+ self.init.apply(self, arguments);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- v = '{';
-
- for (name in o) {
- if (o.hasOwnProperty(name)) {
- v += typeof o[name] != 'function' ? (v.length > 1 ? ',' + quote : quote) + name +
- quote + ':' + serialize(o[name], quote) : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ mixins = self.Mixins;
+ if (mixins) {
+ i = mixins.length;
+ while (i--) {
+ mixin = mixins[i];
+ if (mixin.init) {
+ mixin.init.apply(self, arguments);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return v + '}';
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- return '' + o;
- }
-
- return {
- /**
- * Serializes the specified object as a JSON string.
- *
- * @method serialize
- * @param {Object} obj Object to serialize as a JSON string.
- * @param {String} quote Optional quote string defaults to ".
- * @return {string} JSON string serialized from input.
- */
- serialize: serialize,
-
- /**
- * Unserializes/parses the specified JSON string into a object.
- *
- * @method parse
- * @param {string} s JSON String to parse into a JavaScript object.
- * @return {Object} Object from input JSON string or undefined if it failed.
- */
- parse: function (text) {
- try {
- // Trick uglify JS
- return window[String.fromCharCode(101) + 'val']('(' + text + ')');
- } catch (ex) {
- // Ignore
- }
- }
-
- /**#@-*/
</del><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-
-/**
- * JSONP.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.util.JSONP',
- [
- "tinymce.core.dom.DOMUtils"
- ],
- function (DOMUtils) {
- return {
- callbacks: {},
- count: 0,
-
- send: function (settings) {
- var self = this, dom = DOMUtils.DOM, count = settings.count !== undefined ? settings.count : self.count;
- var id = 'tinymce_jsonp_' + count;
-
- self.callbacks[count] = function (json) {
- dom.remove(id);
- delete self.callbacks[count];
-
- settings.callback(json);
- };
-
- dom.add(dom.doc.body, 'script', {
- id: id,
- src: settings.url,
- type: 'text/javascript'
- });
-
- self.count++;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var dummy = function () {
+ return this;
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- }
-);
-/**
- * XHR.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class enables you to send XMLHTTPRequests cross browser.
- * @class tinymce.util.XHR
- * @mixes tinymce.util.Observable
- * @static
- * @example
- * // Sends a low level Ajax request
- * tinymce.util.XHR.send({
- * url: 'someurl',
- * success: function(text) {
- * console.debug(text);
- * }
- * });
- *
- * // Add custom header to XHR request
- * tinymce.util.XHR.on('beforeSend', function(e) {
- * e.xhr.setRequestHeader('X-Requested-With', 'Something');
- * });
- */
-define(
- 'tinymce.core.util.XHR',
- [
- "tinymce.core.util.Observable",
- "tinymce.core.util.Tools"
- ],
- function (Observable, Tools) {
- var XHR = {
- /**
- * Sends a XMLHTTPRequest.
- * Consult the Wiki for details on what settings this method takes.
- *
- * @method send
- * @param {Object} settings Object will target URL, callbacks and other info needed to make the request.
- */
- send: function (settings) {
- var xhr, count = 0;
-
- function ready() {
- if (!settings.async || xhr.readyState == 4 || count++ > 10000) {
- if (settings.success && count < 10000 && xhr.status == 200) {
- settings.success.call(settings.success_scope, '' + xhr.responseText, xhr, settings);
- } else if (settings.error) {
- settings.error.call(settings.error_scope, count > 10000 ? 'TIMED_OUT' : 'GENERAL', xhr, settings);
- }
-
- xhr = null;
- } else {
- setTimeout(ready, 10);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var createMethod = function (name, fn) {
+ return function () {
+ var self = this;
+ var tmp = self._super;
+ var ret;
+ self._super = _super[name];
+ ret = fn.apply(self, arguments);
+ self._super = tmp;
+ return ret;
+ };
+ };
+ initializing = true;
+ prototype = new self();
+ initializing = false;
+ if (prop.Mixins) {
+ each$24(prop.Mixins, function (mixin) {
+ for (var name_1 in mixin) {
+ if (name_1 !== 'init') {
+ prop[name_1] = mixin[name_1];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- // Default settings
- settings.scope = settings.scope || this;
- settings.success_scope = settings.success_scope || settings.scope;
- settings.error_scope = settings.error_scope || settings.scope;
- settings.async = settings.async === false ? false : true;
- settings.data = settings.data || '';
-
- XHR.fire('beforeInitialize', { settings: settings });
-
- xhr = new XMLHttpRequest();
-
- if (xhr) {
- if (xhr.overrideMimeType) {
- xhr.overrideMimeType(settings.content_type);
- }
-
- xhr.open(settings.type || (settings.data ? 'POST' : 'GET'), settings.url, settings.async);
-
- if (settings.crossDomain) {
- xhr.withCredentials = true;
- }
-
- if (settings.content_type) {
- xhr.setRequestHeader('Content-Type', settings.content_type);
- }
-
- if (settings.requestheaders) {
- Tools.each(settings.requestheaders, function (header) {
- xhr.setRequestHeader(header.key, header.value);
- });
- }
-
- xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
-
- xhr = XHR.fire('beforeSend', { xhr: xhr, settings: settings }).xhr;
- xhr.send(settings.data);
-
- // Syncronous request
- if (!settings.async) {
- return ready();
- }
-
- // Wait for response, onReadyStateChange can not be used since it leaks memory in IE
- setTimeout(ready, 10);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
+ if (_super.Mixins) {
+ prop.Mixins = _super.Mixins.concat(prop.Mixins);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
-
- Tools.extend(XHR, Observable);
-
- return XHR;
- }
-);
-
-/**
- * JSONRequest.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class enables you to use JSON-RPC to call backend methods.
- *
- * @class tinymce.util.JSONRequest
- * @example
- * var json = new tinymce.util.JSONRequest({
- * url: 'somebackend.php'
- * });
- *
- * // Send RPC call 1
- * json.send({
- * method: 'someMethod1',
- * params: ['a', 'b'],
- * success: function(result) {
- * console.dir(result);
- * }
- * });
- *
- * // Send RPC call 2
- * json.send({
- * method: 'someMethod2',
- * params: ['a', 'b'],
- * success: function(result) {
- * console.dir(result);
- * }
- * });
- */
-define(
- 'tinymce.core.util.JSONRequest',
- [
- "tinymce.core.util.JSON",
- "tinymce.core.util.XHR",
- "tinymce.core.util.Tools"
- ],
- function (JSON, XHR, Tools) {
- var extend = Tools.extend;
-
- function JSONRequest(settings) {
- this.settings = extend({}, settings);
- this.count = 0;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Simple helper function to send a JSON-RPC request without the need to initialize an object.
- * Consult the Wiki API documentation for more details on what you can pass to this function.
- *
- * @method sendRPC
- * @static
- * @param {Object} o Call object where there are three field id, method and params this object should also contain callbacks etc.
- */
- JSONRequest.sendRPC = function (o) {
- return new JSONRequest().send(o);
- };
-
- JSONRequest.prototype = {
- /**
- * Sends a JSON-RPC call. Consult the Wiki API documentation for more details on what you can pass to this function.
- *
- * @method send
- * @param {Object} args Call object where there are three field id, method and params this object should also contain callbacks etc.
- */
- send: function (args) {
- var ecb = args.error, scb = args.success;
-
- args = extend(this.settings, args);
-
- args.success = function (c, x) {
- c = JSON.parse(c);
-
- if (typeof c == 'undefined') {
- c = {
- error: 'JSON Parse error.'
- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (prop.Methods) {
+ each$24(prop.Methods.split(','), function (name) {
+ prop[name] = dummy;
+ });
+ }
+ if (prop.Properties) {
+ each$24(prop.Properties.split(','), function (name) {
+ var fieldName = '_' + name;
+ prop[name] = function (value) {
+ var self = this;
+ if (value !== undefined) {
+ self[fieldName] = value;
+ return self;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if (c.error) {
- ecb.call(args.error_scope || args.scope, c.error, x);
- } else {
- scb.call(args.success_scope || args.scope, c.result);
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return self[fieldName];
</ins><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- args.error = function (ty, x) {
- if (ecb) {
- ecb.call(args.error_scope || args.scope, ty, x);
- }
- };
-
- args.data = JSON.serialize({
- id: args.id || 'c' + (this.count++),
- method: args.method,
- params: args.params
- });
-
- // JSON content type for Ruby on rails. Bug: #1883287
- args.content_type = 'application/json';
-
- XHR.send(args);
- }
- };
-
- return JSONRequest;
- }
-);
-/**
- * LocalStorage.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-/**
- * This class will simulate LocalStorage on IE 7 and return the native version on modern browsers.
- * Storage is done using userData on IE 7 and a special serialization format. The format is designed
- * to be as small as possible by making sure that the keys and values doesn't need to be encoded. This
- * makes it possible to store for example HTML data.
- *
- * Storage format for userData:
- * <base 32 key length>,<key string>,<base 32 value length>,<value>,...
- *
- * For example this data key1=value1,key2=value2 would be:
- * 4,key1,6,value1,4,key2,6,value2
- *
- * @class tinymce.util.LocalStorage
- * @static
- * @version 4.0
- * @example
- * tinymce.util.LocalStorage.setItem('key', 'value');
- * var value = tinymce.util.LocalStorage.getItem('key');
- */
-define(
- 'tinymce.core.util.LocalStorage',
- [
- ],
- function () {
- var LocalStorage, storageElm, items, keys, userDataKey, hasOldIEDataSupport;
-
- // Check for native support
- try {
- if (window.localStorage) {
- return localStorage;
- }
- } catch (ex) {
- // Ignore
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- userDataKey = "tinymce";
- storageElm = document.documentElement;
- hasOldIEDataSupport = !!storageElm.addBehavior;
-
- if (hasOldIEDataSupport) {
- storageElm.addBehavior('#default#userData');
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (prop.Statics) {
+ each$24(prop.Statics, function (func, name) {
+ Class[name] = func;
+ });
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Gets the keys names and updates LocalStorage.length property. Since IE7 doesn't have any getters/setters.
- */
- function updateKeys() {
- keys = [];
-
- for (var key in items) {
- keys.push(key);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (prop.Defaults && _super.Defaults) {
+ prop.Defaults = extend$6({}, _super.Defaults, prop.Defaults);
+ }
+ for (name in prop) {
+ member = prop[name];
+ if (typeof member === 'function' && _super[name]) {
+ prototype[name] = createMethod(name, member);
+ } else {
+ prototype[name] = member;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- LocalStorage.length = keys.length;
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Class.prototype = prototype;
+ Class.constructor = Class;
+ Class.extend = extendClass;
+ return Class;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Loads the userData string and parses it into the items structure.
- */
- function load() {
- var key, data, value, pos = 0;
-
- items = {};
-
- // localStorage can be disabled on WebKit/Gecko so make a dummy storage
- if (!hasOldIEDataSupport) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var min$1 = Math.min;
+ var max$1 = Math.max;
+ var round$3 = Math.round;
+ var Color = function (value) {
+ var self = {};
+ var r = 0, g = 0, b = 0;
+ var rgb2hsv = function (r, g, b) {
+ var h, s, v, d, minRGB, maxRGB;
+ h = 0;
+ s = 0;
+ v = 0;
+ r = r / 255;
+ g = g / 255;
+ b = b / 255;
+ minRGB = min$1(r, min$1(g, b));
+ maxRGB = max$1(r, max$1(g, b));
+ if (minRGB === maxRGB) {
+ v = minRGB;
+ return {
+ h: 0,
+ s: 0,
+ v: v * 100
+ };
+ }
+ d = r === minRGB ? g - b : b === minRGB ? r - g : b - r;
+ h = r === minRGB ? 3 : b === minRGB ? 1 : 5;
+ h = 60 * (h - d / (maxRGB - minRGB));
+ s = (maxRGB - minRGB) / maxRGB;
+ v = maxRGB;
+ return {
+ h: round$3(h),
+ s: round$3(s * 100),
+ v: round$3(v * 100)
+ };
+ };
+ var hsvToRgb = function (hue, saturation, brightness) {
+ var side, chroma, x, match;
+ hue = (parseInt(hue, 10) || 0) % 360;
+ saturation = parseInt(saturation, 10) / 100;
+ brightness = parseInt(brightness, 10) / 100;
+ saturation = max$1(0, min$1(saturation, 1));
+ brightness = max$1(0, min$1(brightness, 1));
+ if (saturation === 0) {
+ r = g = b = round$3(255 * brightness);
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- function next(end) {
- var value, nextPos;
-
- nextPos = end !== undefined ? pos + end : data.indexOf(',', pos);
- if (nextPos === -1 || nextPos > data.length) {
- return null;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ side = hue / 60;
+ chroma = brightness * saturation;
+ x = chroma * (1 - Math.abs(side % 2 - 1));
+ match = brightness - chroma;
+ switch (Math.floor(side)) {
+ case 0:
+ r = chroma;
+ g = x;
+ b = 0;
+ break;
+ case 1:
+ r = x;
+ g = chroma;
+ b = 0;
+ break;
+ case 2:
+ r = 0;
+ g = chroma;
+ b = x;
+ break;
+ case 3:
+ r = 0;
+ g = x;
+ b = chroma;
+ break;
+ case 4:
+ r = x;
+ g = 0;
+ b = chroma;
+ break;
+ case 5:
+ r = chroma;
+ g = 0;
+ b = x;
+ break;
+ default:
+ r = g = b = 0;
+ }
+ r = round$3(255 * (r + match));
+ g = round$3(255 * (g + match));
+ b = round$3(255 * (b + match));
+ };
+ var toHex = function () {
+ var hex = function (val) {
+ val = parseInt(val, 10).toString(16);
+ return val.length > 1 ? val : '0' + val;
+ };
+ return '#' + hex(r) + hex(g) + hex(b);
+ };
+ var toRgb = function () {
+ return {
+ r: r,
+ g: g,
+ b: b
+ };
+ };
+ var toHsv = function () {
+ return rgb2hsv(r, g, b);
+ };
+ var parse = function (value) {
+ var matches;
+ if (typeof value === 'object') {
+ if ('r' in value) {
+ r = value.r;
+ g = value.g;
+ b = value.b;
+ } else if ('v' in value) {
+ hsvToRgb(value.h, value.s, value.v);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- value = data.substring(pos, nextPos);
- pos = nextPos + 1;
-
- return value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } else {
+ if (matches = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(value)) {
+ r = parseInt(matches[1], 10);
+ g = parseInt(matches[2], 10);
+ b = parseInt(matches[3], 10);
+ } else if (matches = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value)) {
+ r = parseInt(matches[1], 16);
+ g = parseInt(matches[2], 16);
+ b = parseInt(matches[3], 16);
+ } else if (matches = /#([0-F])([0-F])([0-F])/gi.exec(value)) {
+ r = parseInt(matches[1] + matches[1], 16);
+ g = parseInt(matches[2] + matches[2], 16);
+ b = parseInt(matches[3] + matches[3], 16);
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ r = r < 0 ? 0 : r > 255 ? 255 : r;
+ g = g < 0 ? 0 : g > 255 ? 255 : g;
+ b = b < 0 ? 0 : b > 255 ? 255 : b;
+ return self;
+ };
+ if (value) {
+ parse(value);
+ }
+ self.toRgb = toRgb;
+ self.toHsv = toHsv;
+ self.toHex = toHex;
+ self.parse = parse;
+ return self;
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- storageElm.load(userDataKey);
- data = storageElm.getAttribute(userDataKey) || '';
-
- do {
- var offset = next();
- if (offset === null) {
- break;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var serialize = function (o, quote) {
+ var i, v, t, name;
+ quote = quote || '"';
+ if (o === null) {
+ return 'null';
+ }
+ t = typeof o;
+ if (t === 'string') {
+ v = '\bb\tt\nn\ff\rr""\'\'\\\\';
+ return quote + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g, function (a, b) {
+ if (quote === '"' && a === '\'') {
+ return a;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- key = next(parseInt(offset, 32) || 0);
- if (key !== null) {
- offset = next();
- if (offset === null) {
- break;
- }
-
- value = next(parseInt(offset, 32) || 0);
-
- if (key) {
- items[key] = value;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ i = v.indexOf(b);
+ if (i + 1) {
+ return '\\' + v.charAt(i + 1);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } while (key !== null);
-
- updateKeys();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ a = b.charCodeAt().toString(16);
+ return '\\u' + '0000'.substring(a.length) + a;
+ }) + quote;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * Saves the items structure into a the userData format.
- */
- function save() {
- var value, data = '';
-
- // localStorage can be disabled on WebKit/Gecko so make a dummy storage
- if (!hasOldIEDataSupport) {
- return;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if (t === 'object') {
+ if (o.hasOwnProperty && Object.prototype.toString.call(o) === '[object Array]') {
+ for (i = 0, v = '['; i < o.length; i++) {
+ v += (i > 0 ? ',' : '') + serialize(o[i], quote);
+ }
+ return v + ']';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- for (var key in items) {
- value = items[key];
- data += (data ? ',' : '') + key.length.toString(32) + ',' + key + ',' + value.length.toString(32) + ',' + value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ v = '{';
+ for (name in o) {
+ if (o.hasOwnProperty(name)) {
+ v += typeof o[name] !== 'function' ? (v.length > 1 ? ',' + quote : quote) + name + quote + ':' + serialize(o[name], quote) : '';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- storageElm.setAttribute(userDataKey, data);
-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return v + '}';
+ }
+ return '' + o;
+ };
+ var $_43kb9b7mjfuw8mkq = {
+ serialize: serialize,
+ parse: function (text) {
</ins><span class="cx" style="display: block; padding: 0 10px"> try {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- storageElm.save(userDataKey);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return JSON.parse(text);
</ins><span class="cx" style="display: block; padding: 0 10px"> } catch (ex) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Ignore disk full
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- updateKeys();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var $_10akm7njfuw8mks = {
+ callbacks: {},
+ count: 0,
+ send: function (settings) {
+ var self = this, dom = DOMUtils$1.DOM, count = settings.count !== undefined ? settings.count : self.count;
+ var id = 'tinymce_jsonp_' + count;
+ self.callbacks[count] = function (json) {
+ dom.remove(id);
+ delete self.callbacks[count];
+ settings.callback(json);
+ };
+ dom.add(dom.doc.body, 'script', {
+ id: id,
+ src: settings.url,
+ type: 'text/javascript'
+ });
+ self.count++;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- LocalStorage = {
- /**
- * Length of the number of items in storage.
- *
- * @property length
- * @type Number
- * @return {Number} Number of items in storage.
- */
- //length:0,
-
- /**
- * Returns the key name by index.
- *
- * @method key
- * @param {Number} index Index of key to return.
- * @return {String} Key value or null if it wasn't found.
- */
- key: function (index) {
- return keys[index];
- },
-
- /**
- * Returns the value if the specified key or null if it wasn't found.
- *
- * @method getItem
- * @param {String} key Key of item to retrieve.
- * @return {String} Value of the specified item or null if it wasn't found.
- */
- getItem: function (key) {
- return key in items ? items[key] : null;
- },
-
- /**
- * Sets the value of the specified item by it's key.
- *
- * @method setItem
- * @param {String} key Key of the item to set.
- * @param {String} value Value of the item to set.
- */
- setItem: function (key, value) {
- items[key] = "" + value;
- save();
- },
-
- /**
- * Removes the specified item by key.
- *
- * @method removeItem
- * @param {String} key Key of item to remove.
- */
- removeItem: function (key) {
- delete items[key];
- save();
- },
-
- /**
- * Removes all items.
- *
- * @method clear
- */
- clear: function () {
- items = {};
- save();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var XHR = {
+ send: function (settings) {
+ var xhr, count = 0;
+ var ready = function () {
+ if (!settings.async || xhr.readyState === 4 || count++ > 10000) {
+ if (settings.success && count < 10000 && xhr.status === 200) {
+ settings.success.call(settings.success_scope, '' + xhr.responseText, xhr, settings);
+ } else if (settings.error) {
+ settings.error.call(settings.error_scope, count > 10000 ? 'TIMED_OUT' : 'GENERAL', xhr, settings);
+ }
+ xhr = null;
+ } else {
+ setTimeout(ready, 10);
+ }
+ };
+ settings.scope = settings.scope || this;
+ settings.success_scope = settings.success_scope || settings.scope;
+ settings.error_scope = settings.error_scope || settings.scope;
+ settings.async = settings.async === false ? false : true;
+ settings.data = settings.data || '';
+ XHR.fire('beforeInitialize', { settings: settings });
+ xhr = new XMLHttpRequest();
+ if (xhr) {
+ if (xhr.overrideMimeType) {
+ xhr.overrideMimeType(settings.content_type);
+ }
+ xhr.open(settings.type || (settings.data ? 'POST' : 'GET'), settings.url, settings.async);
+ if (settings.crossDomain) {
+ xhr.withCredentials = true;
+ }
+ if (settings.content_type) {
+ xhr.setRequestHeader('Content-Type', settings.content_type);
+ }
+ if (settings.requestheaders) {
+ $_52qop8kjfuw8l6v.each(settings.requestheaders, function (header) {
+ xhr.setRequestHeader(header.key, header.value);
+ });
+ }
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+ xhr = XHR.fire('beforeSend', {
+ xhr: xhr,
+ settings: settings
+ }).xhr;
+ xhr.send(settings.data);
+ if (!settings.async) {
+ return ready();
+ }
+ setTimeout(ready, 10);
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ $_52qop8kjfuw8l6v.extend(XHR, $_17qpde45jfuw8lze);
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- load();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var extend$7 = $_52qop8kjfuw8l6v.extend;
+ var JSONRequest = function (settings) {
+ this.settings = extend$7({}, settings);
+ this.count = 0;
+ };
+ JSONRequest.sendRPC = function (o) {
+ return new JSONRequest().send(o);
+ };
+ JSONRequest.prototype = {
+ send: function (args) {
+ var ecb = args.error, scb = args.success;
+ args = extend$7(this.settings, args);
+ args.success = function (c, x) {
+ c = $_43kb9b7mjfuw8mkq.parse(c);
+ if (typeof c === 'undefined') {
+ c = { error: 'JSON Parse error.' };
+ }
+ if (c.error) {
+ ecb.call(args.error_scope || args.scope, c.error, x);
+ } else {
+ scb.call(args.success_scope || args.scope, c.result);
+ }
+ };
+ args.error = function (ty, x) {
+ if (ecb) {
+ ecb.call(args.error_scope || args.scope, ty, x);
+ }
+ };
+ args.data = $_43kb9b7mjfuw8mkq.serialize({
+ id: args.id || 'c' + this.count++,
+ method: args.method,
+ params: args.params
+ });
+ args.content_type = 'application/json';
+ XHR.send(args);
+ }
+ };
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return LocalStorage;
- }
-);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var localStorage = window.localStorage;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/**
- * Tinymce.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var tinymce = EditorManager$1;
+ var publicApi = {
+ geom: { Rect: $_nkvpl7ijfuw8mkc },
+ util: {
+ Promise: promiseObj,
+ Delay: $_2m8wq9hjfuw8l41,
+ Tools: $_52qop8kjfuw8l6v,
+ VK: $_1nvqmv5ajfuw8m5j,
+ URI: URI,
+ Class: Class,
+ EventDispatcher: Dispatcher,
+ Observable: $_17qpde45jfuw8lze,
+ I18n: $_ai97we7gjfuw8mjv,
+ XHR: XHR,
+ JSON: $_43kb9b7mjfuw8mkq,
+ JSONRequest: JSONRequest,
+ JSONP: $_10akm7njfuw8mks,
+ LocalStorage: localStorage,
+ Color: Color
+ },
+ dom: {
+ EventUtils: EventUtils,
+ Sizzle: Sizzle,
+ DomQuery: DomQuery,
+ TreeWalker: TreeWalker,
+ DOMUtils: DOMUtils$1,
+ ScriptLoader: ScriptLoader,
+ RangeUtils: RangeUtils$1,
+ Serializer: DomSerializer$1,
+ ControlSelection: ControlSelection,
+ BookmarkManager: BookmarkManager$1,
+ Selection: Selection$1,
+ Event: EventUtils.Event
+ },
+ html: {
+ Styles: Styles,
+ Entities: $_8uzsfe1rjfuw8ldm,
+ Node: Node$2,
+ Schema: Schema,
+ SaxParser: SaxParser$1,
+ DomParser: DomParser,
+ Writer: Writer,
+ Serializer: HtmlSerializer
+ },
+ ui: { Factory: $_81mtl67jjfuw8mkg },
+ Env: $_9fhi43ajfuw8l13,
+ AddOnManager: AddOnManager,
+ Formatter: Formatter,
+ UndoManager: UndoManager,
+ EditorCommands: EditorCommands,
+ WindowManager: WindowManager,
+ NotificationManager: NotificationManager,
+ EditorObservable: EditorObservable$1,
+ Shortcuts: Shortcuts,
+ Editor: Editor,
+ FocusManager: $_du4u8r7ejfuw8mjp,
+ EditorManager: EditorManager$1,
+ DOM: DOMUtils$1.DOM,
+ ScriptLoader: ScriptLoader.ScriptLoader,
+ PluginManager: AddOnManager.PluginManager,
+ ThemeManager: AddOnManager.ThemeManager,
+ trim: $_52qop8kjfuw8l6v.trim,
+ isArray: $_52qop8kjfuw8l6v.isArray,
+ is: $_52qop8kjfuw8l6v.is,
+ toArray: $_52qop8kjfuw8l6v.toArray,
+ makeMap: $_52qop8kjfuw8l6v.makeMap,
+ each: $_52qop8kjfuw8l6v.each,
+ map: $_52qop8kjfuw8l6v.map,
+ grep: $_52qop8kjfuw8l6v.grep,
+ inArray: $_52qop8kjfuw8l6v.inArray,
+ extend: $_52qop8kjfuw8l6v.extend,
+ create: $_52qop8kjfuw8l6v.create,
+ walk: $_52qop8kjfuw8l6v.walk,
+ createNS: $_52qop8kjfuw8l6v.createNS,
+ resolve: $_52qop8kjfuw8l6v.resolve,
+ explode: $_52qop8kjfuw8l6v.explode,
+ _addCacheSuffix: $_52qop8kjfuw8l6v._addCacheSuffix,
+ isOpera: $_9fhi43ajfuw8l13.opera,
+ isWebKit: $_9fhi43ajfuw8l13.webkit,
+ isIE: $_9fhi43ajfuw8l13.ie,
+ isGecko: $_9fhi43ajfuw8l13.gecko,
+ isMac: $_9fhi43ajfuw8l13.mac
+ };
+ tinymce = $_52qop8kjfuw8l6v.extend(tinymce, publicApi);
+ var Tinymce = tinymce;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define(
- 'tinymce.core.api.Tinymce',
- [
- 'tinymce.core.AddOnManager',
- 'tinymce.core.api.Formatter',
- 'tinymce.core.api.NotificationManager',
- 'tinymce.core.api.WindowManager',
- 'tinymce.core.dom.BookmarkManager',
- 'tinymce.core.dom.ControlSelection',
- 'tinymce.core.dom.DomQuery',
- 'tinymce.core.dom.DOMUtils',
- 'tinymce.core.dom.EventUtils',
- 'tinymce.core.dom.RangeUtils',
- 'tinymce.core.dom.ScriptLoader',
- 'tinymce.core.dom.Selection',
- 'tinymce.core.dom.Serializer',
- 'tinymce.core.dom.Sizzle',
- 'tinymce.core.dom.TreeWalker',
- 'tinymce.core.Editor',
- 'tinymce.core.EditorCommands',
- 'tinymce.core.EditorManager',
- 'tinymce.core.EditorObservable',
- 'tinymce.core.Env',
- 'tinymce.core.FocusManager',
- 'tinymce.core.geom.Rect',
- 'tinymce.core.html.DomParser',
- 'tinymce.core.html.Entities',
- 'tinymce.core.html.Node',
- 'tinymce.core.html.SaxParser',
- 'tinymce.core.html.Schema',
- 'tinymce.core.html.Serializer',
- 'tinymce.core.html.Styles',
- 'tinymce.core.html.Writer',
- 'tinymce.core.Shortcuts',
- 'tinymce.core.ui.Api',
- 'tinymce.core.UndoManager',
- 'tinymce.core.util.Class',
- 'tinymce.core.util.Color',
- 'tinymce.core.util.Delay',
- 'tinymce.core.util.EventDispatcher',
- 'tinymce.core.util.I18n',
- 'tinymce.core.util.JSON',
- 'tinymce.core.util.JSONP',
- 'tinymce.core.util.JSONRequest',
- 'tinymce.core.util.LocalStorage',
- 'tinymce.core.util.Observable',
- 'tinymce.core.util.Promise',
- 'tinymce.core.util.Tools',
- 'tinymce.core.util.URI',
- 'tinymce.core.util.VK',
- 'tinymce.core.util.XHR'
- ],
- function (
- AddOnManager, Formatter, NotificationManager, WindowManager, BookmarkManager, ControlSelection, DomQuery, DOMUtils, EventUtils, RangeUtils, ScriptLoader,
- Selection, DomSerializer, Sizzle, TreeWalker, Editor, EditorCommands, EditorManager, EditorObservable, Env, FocusManager, Rect, DomParser, Entities, Node,
- SaxParser, Schema, HtmlSerializer, Styles, Writer, Shortcuts, UiApi, UndoManager, Class, Color, Delay, EventDispatcher, I18n, JSON, JSONP, JSONRequest, LocalStorage,
- Observable, Promise, Tools, URI, VK, XHR
- ) {
- var tinymce = EditorManager;
-
- /**
- * @include ../../../../../../tools/docs/tinymce.js
- */
- var publicApi = {
- geom: {
- Rect: Rect
- },
-
- util: {
- Promise: Promise,
- Delay: Delay,
- Tools: Tools,
- VK: VK,
- URI: URI,
- Class: Class,
- EventDispatcher: EventDispatcher,
- Observable: Observable,
- I18n: I18n,
- XHR: XHR,
- JSON: JSON,
- JSONRequest: JSONRequest,
- JSONP: JSONP,
- LocalStorage: LocalStorage,
- Color: Color
- },
-
- dom: {
- EventUtils: EventUtils,
- Sizzle: Sizzle,
- DomQuery: DomQuery,
- TreeWalker: TreeWalker,
- DOMUtils: DOMUtils,
- ScriptLoader: ScriptLoader,
- RangeUtils: RangeUtils,
- Serializer: DomSerializer,
- ControlSelection: ControlSelection,
- BookmarkManager: BookmarkManager,
- Selection: Selection,
- Event: EventUtils.Event
- },
-
- html: {
- Styles: Styles,
- Entities: Entities,
- Node: Node,
- Schema: Schema,
- SaxParser: SaxParser,
- DomParser: DomParser,
- Writer: Writer,
- Serializer: HtmlSerializer
- },
-
- Env: Env,
- AddOnManager: AddOnManager,
- Formatter: Formatter,
- UndoManager: UndoManager,
- EditorCommands: EditorCommands,
- WindowManager: WindowManager,
- NotificationManager: NotificationManager,
- EditorObservable: EditorObservable,
- Shortcuts: Shortcuts,
- Editor: Editor,
- FocusManager: FocusManager,
- EditorManager: EditorManager,
-
- // Global instances
- DOM: DOMUtils.DOM,
- ScriptLoader: ScriptLoader.ScriptLoader,
- PluginManager: AddOnManager.PluginManager,
- ThemeManager: AddOnManager.ThemeManager,
-
- // Global utility functions
- trim: Tools.trim,
- isArray: Tools.isArray,
- is: Tools.is,
- toArray: Tools.toArray,
- makeMap: Tools.makeMap,
- each: Tools.each,
- map: Tools.map,
- grep: Tools.grep,
- inArray: Tools.inArray,
- extend: Tools.extend,
- create: Tools.create,
- walk: Tools.walk,
- createNS: Tools.createNS,
- resolve: Tools.resolve,
- explode: Tools.explode,
- _addCacheSuffix: Tools._addCacheSuffix,
-
- // Legacy browser detection
- isOpera: Env.opera,
- isWebKit: Env.webkit,
- isIE: Env.ie,
- isGecko: Env.gecko,
- isMac: Env.mac
- };
-
- tinymce = Tools.extend(tinymce, publicApi);
- UiApi.appendTo(tinymce);
-
- return tinymce;
- }
-);
-
-/**
- * Main.js
- *
- * Released under LGPL License.
- * Copyright (c) 1999-2017 Ephox Corp. All rights reserved
- *
- * License: http://www.tinymce.com/license
- * Contributing: http://www.tinymce.com/contributing
- */
-
-define(
- 'tinymce.core.api.Main',
- [
- 'ephox.katamari.api.Fun',
- 'tinymce.core.api.Tinymce'
- ],
- function (Fun, Tinymce) {
- /*eslint consistent-this: 0 */
- var context = this || window;
-
- var exportToModuleLoaders = function (tinymce) {
- // Bolt
- if (typeof context.define === "function" && !context.define.amd) {
- context.define("ephox/tinymce", [], Fun.constant(tinymce));
- context.define("tinymce.core.EditorManager", [], Fun.constant(tinymce));
- }
-
- // CommonJS
- if (typeof module === 'object') {
- /* global module */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ var exportToModuleLoaders = function (tinymce) {
+ if (typeof module === 'object') {
+ try {
</ins><span class="cx" style="display: block; padding: 0 10px"> module.exports = tinymce;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } catch (_) {
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- };
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }
+ };
+ var exportToWindowGlobal = function (tinymce) {
+ window.tinymce = tinymce;
+ window.tinyMCE = tinymce;
+ };
+ exportToWindowGlobal(Tinymce);
+ exportToModuleLoaders(Tinymce);
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- var exportToWindowGlobal = function (tinymce) {
- window.tinymce = tinymce;
- window.tinyMCE = tinymce;
- };
-
- return function () {
- exportToWindowGlobal(Tinymce);
- exportToModuleLoaders(Tinymce);
- return Tinymce;
- };
- }
-);
-
-dem('tinymce.core.api.Main')();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}());
</ins><span class="cx" style="display: block; padding: 0 10px"> })();
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymcetinymceminjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/tinymce.min.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/tinymce.min.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/tinymce.min.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,17 +1,2 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e.push(d(a[f]));b.apply(null,b)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("global!Array",Array),h("global!Error",Er
ror),g("ephox.katamari.api.Fun",["global!Array","global!Error"],function(a,b){var c=function(){},d=function(a,b){return function(){return a(b.apply(null,arguments))}},e=function(a){return function(){return a}},f=function(a){return a},g=function(a,b){return a===b},h=function(b){for(var c=new a(arguments.length-1),d=1;d<arguments.length;d++)c[d-1]=arguments[d];return function(){for(var d=new a(arguments.length),e=0;e<d.length;e++)d[e]=arguments[e];var f=c.concat(d);return b.apply(null,f)}},i=function(a){return function(){return!a.apply(null,arguments)}},j=function(a){return function(){throw new b(a)}},k=function(a){return a()},l=function(a){a()},m=e(!1),n=e(!0);return{noop:c,compose:d,constant:e,identity:f,tripleEquals:g,curry:h,not:i,die:j,apply:k,call:l,never:m,always:n}}),g("tinymce.core.util.Promise",[],function(){function a(a,b){return function(){a.apply(b,arguments)}}function b(b){if("object"!=typeof this)throw new TypeErro
r("Promises must be constructed via new");if("function"!=typeof b)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],h(b,a(d,this),a(e,this))}function c(a){var b=this;return null===this._state?void this._deferreds.push(a):void i(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function d(b){try{if(b===this)throw new TypeError("A promise cannot be resolved with itself.");if(b&&("object"==typeof b||"function"==typeof b)){var c=b.then;if("function"==typeof c)return void h(a(c,b),a(d,this),a(e,this))}this._state=!0,this._value=b,f.call(this)}catch(g){e.call(this,g)}}function e(a){this._state=!1,this._value=a,f.call(this)}function f(){for(var a=0,b=this._deferreds.length;a<b;a++)c.call(this,this._deferreds[a]);this._deferreds=null}f
unction g(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function h(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}if(window.Promise)return window.Promise;var i=b.immediateFn||"function"==typeof setImmediate&&setImmediate||function(a){setTimeout(a,1)},j=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};return b.prototype["catch"]=function(a){return this.then(null,a)},b.prototype.then=function(a,d){var e=this;return new b(function(b,f){c.call(e,new g(a,d,b,f))})},b.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&j(arguments[0])?arguments[0]:arguments);return new b(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h
)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;f<a.length;f++)d(f,a[f])})},b.resolve=function(a){return a&&"object"==typeof a&&a.constructor===b?a:new b(function(b){b(a)})},b.reject=function(a){return new b(function(b,c){c(a)})},b.race=function(a){return new b(function(b,c){for(var d=0,e=a.length;d<e;d++)a[d].then(b,c)})},b}),g("tinymce.core.util.Delay",["tinymce.core.util.Promise"],function(a){function b(a,b){function c(a){window.setTimeout(a,0)}var d,e=window.requestAnimationFrame,f=["ms","moz","webkit"];for(d=0;d<f.length&&!e;d++)e=window[f[d]+"RequestAnimationFrame"];e||(e=c),e(a,b)}function c(a,b){return"number"!=typeof b&&(b=0),setTimeout(a,b)}function d(a,b){return"number"!=typeof b&&(b=1),setInterval(a,b)}function e(a){return clearTimeout(a)}func
tion f(a){return clearInterval(a)}function g(a,b){var d,e;return e=function(){var e=arguments;clearTimeout(d),d=c(function(){a.apply(this,e)},b)},e.stop=function(){clearTimeout(d)},e}var h;return{requestAnimationFrame:function(c,d){return h?void h.then(c):void(h=new a(function(a){d||(d=document.body),b(a,d)}).then(c))},setTimeout:c,setInterval:d,setEditorTimeout:function(a,b,d){return c(function(){a.removed||b()},d)},setEditorInterval:function(a,b,c){var e;return e=d(function(){a.removed?clearInterval(e):b()},c)},debounce:g,throttle:g,clearInterval:f,clearTimeout:e}}),g("tinymce.core.Env",[],function(){function a(a){return"matchMedia"in window&&matchMedia(a).matches}var b,c,d,e,f,g,h,i,j,k,l,m,n,o=navigator,p=o.userAgent;b=window.opera&&window.opera.buildNumber,j=/Android/.test(p),c=/WebKit/.test(p),d=!c&&!b&&/MSIE/gi.test(p)&&/Explorer/gi.test(o.appName),d=d&&/MSIE (\w+)\./.exec(p)[1],e=p.indexOf("Trident/&quo
t;)!=-1&&(p.indexOf("rv:")!=-1||o.appName.indexOf("Netscape")!=-1)&&11,f=p.indexOf("Edge/")!=-1&&!d&&!e&&12,d=d||e||f,g=!c&&!e&&/Gecko/.test(p),h=p.indexOf("Mac")!=-1,i=/(iPad|iPhone)/.test(p),k="FormData"in window&&"FileReader"in window&&"URL"in window&&!!URL.createObjectURL,l=a("only screen and (max-device-width: 480px)")&&(j||i),m=a("only screen and (min-width: 800px)")&&(j||i),n=p.indexOf("Windows Phone")!=-1,f&&(c=!1);var q=!i||k||p.match(/AppleWebKit\/(\d*)/)[1]>=534;return{opera:b,webkit:c,ie:d,gecko:g,mac:h,iOS:i,android:j,contentEditable:q,transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",caretAfter:8!=d,range:window.getSelection&&"Range"in window,documentMode:d&&!f?document.documentMode||7
:10,fileApi:k,ceFalse:d===!1||d>8,canHaveCSP:d===!1||d>11,desktop:!l&&!m,windowsPhone:n}}),g("tinymce.core.dom.EventUtils",["tinymce.core.util.Delay","tinymce.core.Env"],function(a,b){"use strict";function c(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d||!1):a.attachEvent&&a.attachEvent("on"+b,c)}function d(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d||!1):a.detachEvent&&a.detachEvent("on"+b,c)}function e(a,b){var c,d=b;return c=a.path,c&&c.length>0&&(d=c[0]),a.deepPath&&(c=a.deepPath(),c&&c.length>0&&(d=c[0])),d}function f(a,c){var d,f,g=c||{};for(d in a)k[d]||(g[d]=a[d]);if(g.target||(g.target=g.srcElement||document),b.experimentalShadowDom&&(g.target=e(a,g.target)),a&&j.test(a.type)&&a.pageX===f&&a.clientX!==f){var h=g.target.ownerDocument||document,i=h.documentElement,o=h.body;g.pageX=a.client
X+(i&&i.scrollLeft||o&&o.scrollLeft||0)-(i&&i.clientLeft||o&&o.clientLeft||0),g.pageY=a.clientY+(i&&i.scrollTop||o&&o.scrollTop||0)-(i&&i.clientTop||o&&o.clientTop||0)}return g.preventDefault=function(){g.isDefaultPrevented=n,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},g.stopPropagation=function(){g.isPropagationStopped=n,a&&(a.stopPropagation?a.stopPropagation():a.cancelBubble=!0)},g.stopImmediatePropagation=function(){g.isImmediatePropagationStopped=n,g.stopPropagation()},l(g)===!1&&(g.isDefaultPrevented=m,g.isPropagationStopped=m,g.isImmediatePropagationStopped=m),"undefined"==typeof g.metaKey&&(g.metaKey=!1),g}function g(e,f,g){function h(){return"complete"===l.readyState||"interactive"===l.readyState&&l.body}function i(){g.domLoaded||(g.domLoaded=!0,f(m))}function j(){h()&&(d(l,"readystatechange",j),i())}function
k(){try{l.documentElement.doScroll("left")}catch(b){return void a.setTimeout(k)}i()}var l=e.document,m={type:"ready"};return g.domLoaded?void f(m):(!l.addEventListener||b.ie&&b.ie<11?(c(l,"readystatechange",j),l.documentElement.doScroll&&e.self===e.top&&k()):h()?i():c(e,"DOMContentLoaded",i),void c(e,"load",i))}function h(){function a(a,b){var c,d,e,f,g=m[b];if(c=g&&g[a.type])for(d=0,e=c.length;d<e;d++)if(f=c[d],f&&f.func.call(f.scope,a)===!1&&a.preventDefault(),a.isImmediatePropagationStopped())return}var b,e,h,j,k,l=this,m={};e=i+(+new Date).toString(32),j="onmouseenter"in document.documentElement,h="onfocusin"in document.documentElement,k={mouseenter:"mouseover",mouseleave:"mouseout"},b=1,l.domLoaded=!1,l.events=m,l.bind=function(d,i,n,o){function p(b){a(f(b||x.event),q)}var q,r,s,t,u,v,w,x=window;if(d&&3!==d.nodeType&&8!=
=d.nodeType){for(d[e]?q=d[e]:(q=b++,d[e]=q,m[q]={}),o=o||d,i=i.split(" "),s=i.length;s--;)t=i[s],v=p,u=w=!1,"DOMContentLoaded"===t&&(t="ready"),l.domLoaded&&"ready"===t&&"complete"==d.readyState?n.call(o,f({type:t})):(j||(u=k[t],u&&(v=function(b){var c,d;if(c=b.currentTarget,d=b.relatedTarget,d&&c.contains)d=c.contains(d);else for(;d&&d!==c;)d=d.parentNode;d||(b=f(b||x.event),b.type="mouseout"===b.type?"mouseleave":"mouseenter",b.target=c,a(b,q))})),h||"focusin"!==t&&"focusout"!==t||(w=!0,u="focusin"===t?"focus":"blur",v=function(b){b=f(b||x.event),b.type="focus"===b.type?"focusin":"focusout",a(b,q)}),r=m[q][t],r?"ready"===t&&l.domLoaded?n({type:t}):r.push({func:n,scope:o}):(m[q][t]=r=[{func:n,scope:o}],r.fakeName=u,r.capture=w,r.nativeHandler=v,"r
eady"===t?g(d,v,l):c(d,u||t,v,w)));return d=r=0,n}},l.unbind=function(a,b,c){var f,g,h,i,j,k;if(!a||3===a.nodeType||8===a.nodeType)return l;if(f=a[e]){if(k=m[f],b){for(b=b.split(" "),h=b.length;h--;)if(j=b[h],g=k[j]){if(c)for(i=g.length;i--;)if(g[i].func===c){var n=g.nativeHandler,o=g.fakeName,p=g.capture;g=g.slice(0,i).concat(g.slice(i+1)),g.nativeHandler=n,g.fakeName=o,g.capture=p,k[j]=g}c&&0!==g.length||(delete k[j],d(a,g.fakeName||j,g.nativeHandler,g.capture))}}else{for(j in k)g=k[j],d(a,g.fakeName||j,g.nativeHandler,g.capture);k={}}for(j in k)return l;delete m[f];try{delete a[e]}catch(q){a[e]=null}}return l},l.fire=function(b,c,d){var g;if(!b||3===b.nodeType||8===b.nodeType)return l;d=f(null,d),d.type=c,d.target=b;do g=b[e],g&&a(d,g),b=b.parentNode||b.ownerDocument||b.defaultView||b.parentWindow;while(b&&!d.isPropagationStopped());return l},l.clean=function(a){var b,c,d=l.unbind;if(!a||3===a.nodeType||8===a.nodeType)return l;if(a[e]&&a
mp;d(a),a.getElementsByTagName||(a=a.document),a&&a.getElementsByTagName)for(d(a),c=a.getElementsByTagName("*"),b=c.length;b--;)a=c[b],a[e]&&d(a);return l},l.destroy=function(){m={}},l.cancel=function(a){return a&&(a.preventDefault(),a.stopImmediatePropagation()),!1}}var i="mce-data-",j=/^(?:mouse|contextmenu)|click/,k={keyLocation:1,layerX:1,layerY:1,returnValue:1,webkitMovementX:1,webkitMovementY:1,keyIdentifier:1},l=function(a){return a.isDefaultPrevented===n||a.isDefaultPrevented===m},m=function(){return!1},n=function(){return!0};return h.Event=new h,h.Event.bind(window,"ready",function(){}),h}),g("tinymce.core.dom.Sizzle",[],function(){function a(a,b,c,d){var e,f,g,i,k,l,m,n,o,p;if((b?b.ownerDocument||b:L)!==D&&C(b),b=b||D,c=c||[],!a||"string"!=typeof a)return c;if(1!==(i=b.nodeType)&&9!==i)return[];if(F&&!d){if(e=oa.exec(a))if(g=e[1]){if(9===i){if(f=b.getElementById(g),!f||!f.pare
ntNode)return c;if(f.id===g)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&J(b,f)&&f.id===g)return c.push(f),c}else{if(e[2])return Y.apply(c,b.getElementsByTagName(a)),c;if((g=e[3])&&s.getElementsByClassName)return Y.apply(c,b.getElementsByClassName(g)),c}if(s.qsa&&(!G||!G.test(a))){if(n=m=K,o=b,p=9===i&&a,1===i&&"object"!==b.nodeName.toLowerCase()){for(l=w(a),(m=b.getAttribute("id"))?n=m.replace(qa,"\\$&"):b.setAttribute("id",n),n="[id='"+n+"'] ",k=l.length;k--;)l[k]=n+j(l[k]);o=pa.test(a)&&h(b.parentNode)||b,p=l.join(",")}if(p)try{return Y.apply(c,o.querySelectorAll(p)),c}catch(q){}finally{m||b.removeAttribute("id")}}}return y(a.replace(ea,"$1"),b,c,d)}function b(){function a(c,d){return b.push(c+" ")>t.cacheLength&&delete a[b.shift()],a[c+" "]=d}var b=[];retu
rn a}function c(a){return a[K]=!0,a}function d(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||T)-(~a.sourceIndex||T);if(d)return d;if(c)for(;c=c.nextSibling;)if(c===b)return-1;return a?1:-1}function e(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function f(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function g(a){return c(function(b){return b=+b,c(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function h(a){return a&&typeof a.getElementsByTagName!==S&&a}function i(){}function j(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function k(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=N++;return b.first?function(b,c,f){for(;b=b[d];)if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g
){var h,i,j=[M,f];if(g){for(;b=b[d];)if((1===b.nodeType||e)&&a(b,c,g))return!0}else for(;b=b[d];)if(1===b.nodeType||e){if(i=b[K]||(b[K]={}),(h=i[d])&&h[0]===M&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function l(a){return a.length>1?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function m(b,c,d){for(var e=0,f=c.length;e<f;e++)a(b,c[e],d);return d}function n(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function o(a,b,d,e,f,g){return e&&!e[K]&&(e=o(e)),f&&!f[K]&&(f=o(f,g)),c(function(c,g,h,i){var j,k,l,o=[],p=[],q=g.length,r=c||m(b||"*",h.nodeType?[h]:h,[]),s=!a||!c&&b?r:n(r,o,a,h,i),t=d?f||(c?a:q||e)?[]:g:s;if(d&&d(s,t,h,i),e)for(j=n(t,p),e(j,[],h,i),k=j.length;k--;)(l=j[k])&&(t[p[k]]=!(s[p[k]]=l));if(c){if(f||a){if(f){for(j=[],k=t.lengt
h;k--;)(l=t[k])&&j.push(s[k]=l);f(null,t=[],j,i)}for(k=t.length;k--;)(l=t[k])&&(j=f?$.call(c,l):o[k])>-1&&(c[j]=!(g[j]=l))}}else t=n(t===g?t.splice(q,t.length):t),f?f(null,g,t,i):Y.apply(g,t)})}function p(a){for(var b,c,d,e=a.length,f=t.relative[a[0].type],g=f||t.relative[" "],h=f?1:0,i=k(function(a){return a===b},g,!0),m=k(function(a){return $.call(b,a)>-1},g,!0),n=[function(a,c,d){return!f&&(d||c!==z)||((b=c).nodeType?i(a,c,d):m(a,c,d))}];h<e;h++)if(c=t.relative[a[h].type])n=[k(l(n),c)];else{if(c=t.filter[a[h].type].apply(null,a[h].matches),c[K]){for(d=++h;d<e&&!t.relative[a[d].type];d++);return o(h>1&&l(n),h>1&&j(a.slice(0,h-1).concat({value:" "===a[h-2].type?"*":""})).replace(ea,"$1"),c,h<d&&p(a.slice(h,d)),d<e&&p(a=a.slice(d)),d<e&&j(a))}n.push(c)}return l(n)}function q(b,d){var e=d.length>0,f=b.length>0,g=function(c,
g,h,i,j){var k,l,m,o=0,p="0",q=c&&[],r=[],s=z,u=c||f&&t.find.TAG("*",j),v=M+=null==s?1:Math.random()||.1,w=u.length;for(j&&(z=g!==D&&g);p!==w&&null!=(k=u[p]);p++){if(f&&k){for(l=0;m=b[l++];)if(m(k,g,h)){i.push(k);break}j&&(M=v)}e&&((k=!m&&k)&&o--,c&&q.push(k))}if(o+=p,e&&p!==o){for(l=0;m=d[l++];)m(q,r,g,h);if(c){if(o>0)for(;p--;)q[p]||r[p]||(r[p]=W.call(i));r=n(r)}Y.apply(i,r),j&&!c&&r.length>0&&o+d.length>1&&a.uniqueSort(i)}return j&&(M=v,z=s),q};return e?c(g):g}var r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K="sizzle"+-new Date,L=window.document,M=0,N=0,O=b(),P=b(),Q=b(),R=function(a,b){return a===b&&(B=!0),0},S="undefined",T=1<<31,U={}.hasOwnProperty,V=[],W=V.pop,X=V.push,Y=V.push,Z=V.slice,$=V.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]===a)return b;return-1},_=&q
uot;checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",aa="[\\x20\\t\\r\\n\\f]",ba="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ca="\\["+aa+"*("+ba+")(?:"+aa+"*([*^$|!~]?=)"+aa+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+ba+"))|)"+aa+"*\\]",da=":("+ba+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ca+")*)|.*)\\)|)",ea=new RegExp("^"+aa+"+|((?:^|[^\\\\])(?:\\\\.)*)"+aa+"+$","g"),fa=new RegExp("^"+aa+"*,"+aa+"*"),ga=new RegExp("^"+aa+"*([>+~]|"+aa+")"+aa+"*"),ha=new RegExp("="+aa+"*([^\\]'\"]*?)"+aa+"*\\]","g"),ia=new RegExp(da),ja=new RegExp("^"+ba+&
quot;$"),ka={ID:new RegExp("^#("+ba+")"),CLASS:new RegExp("^\\.("+ba+")"),TAG:new RegExp("^("+ba+"|[*])"),ATTR:new RegExp("^"+ca),PSEUDO:new RegExp("^"+da),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+aa+"*(even|odd|(([+-]|)(\\d*)n|)"+aa+"*(?:([+-]|)"+aa+"*(\\d+)|))"+aa+"*\\)|)","i"),bool:new RegExp("^(?:"+_+")$","i"),needsContext:new RegExp("^"+aa+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+aa+"*((?:-\\d)?\\d*)"+aa+"*\\)|)(?=[^-]|$)","i")},la=/^(?:input|select|textarea|button)$/i,ma=/^h\d$/i,na=/^[^{]+\{\s*\[native \w/,oa=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,pa=/[+~]/,qa=/'|\\/g,ra=new RegExp("\\\\([\\da-f]{1,6}"+aa+"?|("+aa+")|.)","ig"),sa=function(a,b,c){var d="0x"+b-65536;
return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{Y.apply(V=Z.call(L.childNodes),L.childNodes),V[L.childNodes.length].nodeType}catch(ta){Y={apply:V.length?function(a,b){X.apply(a,Z.call(b))}:function(a,b){for(var c=a.length,d=0;a[c++]=b[d++];);a.length=c-1}}}s=a.support={},v=a.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},C=a.setDocument=function(a){function b(a){try{return a.top}catch(b){}return null}var c,e=a?a.ownerDocument||a:L,f=e.defaultView;return e!==D&&9===e.nodeType&&e.documentElement?(D=e,E=e.documentElement,F=!v(e),f&&f!==b(f)&&(f.addEventListener?f.addEventListener("unload",function(){C()},!1):f.attachEvent&&f.attachEvent("onunload",function(){C()})),s.attributes=!0,s.getElementsByTagName=!0,s.getElementsByClassName=na.test(e.getElementsByClassName),s.getById=!0,t.find.ID=
function(a,b){if(typeof b.getElementById!==S&&F){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},t.filter.ID=function(a){var b=a.replace(ra,sa);return function(a){return a.getAttribute("id")===b}},t.find.TAG=s.getElementsByTagName?function(a,b){if(typeof b.getElementsByTagName!==S)return b.getElementsByTagName(a)}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e++];)1===c.nodeType&&d.push(c);return d}return f},t.find.CLASS=s.getElementsByClassName&&function(a,b){if(F)return b.getElementsByClassName(a)},H=[],G=[],s.disconnectedMatch=!0,G=G.length&&new RegExp(G.join("|")),H=H.length&&new RegExp(H.join("|")),c=na.test(E.compareDocumentPosition),J=c||na.test(E.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compa
reDocumentPosition(d)))}:function(a,b){if(b)for(;b=b.parentNode;)if(b===a)return!0;return!1},R=c?function(a,b){if(a===b)return B=!0,0;var c=!a.compareDocumentPosition-!b.compareDocumentPosition;return c?c:(c=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&c||!s.sortDetached&&b.compareDocumentPosition(a)===c?a===e||a.ownerDocument===L&&J(L,a)?-1:b===e||b.ownerDocument===L&&J(L,b)?1:A?$.call(A,a)-$.call(A,b):0:4&c?-1:1)}:function(a,b){if(a===b)return B=!0,0;var c,f=0,g=a.parentNode,h=b.parentNode,i=[a],j=[b];if(!g||!h)return a===e?-1:b===e?1:g?-1:h?1:A?$.call(A,a)-$.call(A,b):0;if(g===h)return d(a,b);for(c=a;c=c.parentNode;)i.unshift(c);for(c=b;c=c.parentNode;)j.unshift(c);for(;i[f]===j[f];)f++;return f?d(i[f],j[f]):i[f]===L?-1:j[f]===L?1:0},e):D},a.matches=function(b,c){return a(b,null,null,c)},a.matchesSelector=function(b,c){if((b.ownerDocument||b)!==D&&C(b),c=c.replace(ha,"='$1']"),s.matchesSelector&
&F&&(!H||!H.test(c))&&(!G||!G.test(c)))try{var d=I.call(b,c);if(d||s.disconnectedMatch||b.document&&11!==b.document.nodeType)return d}catch(e){}return a(c,D,null,[b]).length>0},a.contains=function(a,b){return(a.ownerDocument||a)!==D&&C(a),J(a,b)},a.attr=function(a,b){(a.ownerDocument||a)!==D&&C(a);var c=t.attrHandle[b.toLowerCase()],d=c&&U.call(t.attrHandle,b.toLowerCase())?c(a,b,!F):void 0;return void 0!==d?d:s.attributes||!F?a.getAttribute(b):(d=a.getAttributeNode(b))&&d.specified?d.value:null},a.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},a.uniqueSort=function(a){var b,c=[],d=0,e=0;if(B=!s.detectDuplicates,A=!s.sortStable&&a.slice(0),a.sort(R),B){for(;b=a[e++];)b===a[e]&&(d=c.push(e));for(;d--;)a.splice(c[d],1)}return A=null,a},u=a.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textCo
ntent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=u(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d++];)c+=u(b);return c},t=a.selectors={cacheLength:50,createPseudo:c,match:ka,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ra,sa),a[3]=(a[3]||a[4]||a[5]||"").replace(ra,sa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(b){return b[1]=b[1].toLowerCase(),"nth"===b[1].slice(0,3)?(b[3]||a.error(b[0]),b[4]=+(b[4]?b[5]+(b[6]||1):2*("even"===b[3]||"odd"===b[3])),b[5]=+(b[7]+b[8]||"odd"===b[3])):b[3]&&a.error(b[0]),b},PSEUDO:function(a){var b,c=!a[6]&&a[2];return ka.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]|
|"":c&&ia.test(c)&&(b=w(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ra,sa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=O[a+" "];return b||(b=new RegExp("(^|"+aa+")"+a+"("+aa+"|$)"))&&O(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==S&&a.getAttribute("class")||"")})},ATTR:function(b,c,d){return function(e){var f=a.attr(e,b);return null==f?"!="===c:!c||(f+="","="===c?f===d:"!="===c?f!==d:"^="===c?d&&0===f.indexOf(d):"*="===c?d&&f.indexOf(d)>-1:"$="===c?d&&f.slice(-d.length)===d:"
;~="===c?(" "+f+" ").indexOf(d)>-1:"|="===c&&(f===d||f.slice(0,d.length+1)===d+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){for(;p;){for(l=b;l=l[p];)if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){for(k=q[K]||(q[K]={}),j=k[a]||[],n=j[0]===M&&j[1],m=j[0]===M&&j[2],l=n&&q.childNodes[n];l=++n&&l&&l[p]||(m=n=0)||o.pop();)if(1===l.nodeType&&++m&&l===b){k[a]=[M,n,m];break}}else if(s&&(j=(b[K]||(b[K]={}))[a])&&j[0]
===M)m=j[1];else for(;(l=++n&&l&&l[p]||(m=n=0)||o.pop())&&((h?l.nodeName.toLowerCase()!==r:1!==l.nodeType)||!++m||(s&&((l[K]||(l[K]={}))[a]=[M,m]),l!==b)););return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(b,d){var e,f=t.pseudos[b]||t.setFilters[b.toLowerCase()]||a.error("unsupported pseudo: "+b);return f[K]?f(d):f.length>1?(e=[b,b,"",d],t.setFilters.hasOwnProperty(b.toLowerCase())?c(function(a,b){for(var c,e=f(a,d),g=e.length;g--;)c=$.call(a,e[g]),a[c]=!(b[c]=e[g])}):function(a){return f(a,0,e)}):f}},pseudos:{not:c(function(a){var b=[],d=[],e=x(a.replace(ea,"$1"));return e[K]?c(function(a,b,c,d){for(var f,g=e(a,null,d,[]),h=a.length;h--;)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,c,f){return b[0]=a,e(b,null,f,d),!d.pop()}}),has:c(function(b){return function(c){return a(b,c).length>0}}),contains:c(function(a){return a=a.replace(ra,sa),function(b){return(b.textContent||b.innerText||u(b)).indexOf(
a)>-1}}),lang:c(function(b){return ja.test(b||"")||a.error("unsupported lang: "+b),b=b.replace(ra,sa).toLowerCase(),function(a){var c;do if(c=F?a.lang:a.getAttribute("xml:lang")||a.getAttribute("lang"))return c=c.toLowerCase(),c===b||0===c.indexOf(b+"-");while((a=a.parentNode)&&1===a.nodeType);return!1}}),target:function(a){var b=window.location&&window.location.hash;return b&&b.slice(1)===a.id},root:function(a){return a===E},focus:function(a){return a===D.activeElement&&(!D.hasFocus||D.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild
;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!t.pseudos.empty(a)},header:function(a){return ma.test(a.nodeName)},input:function(a){return la.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:g(function(){return[0]}),last:g(function(a,b){return[b-1]}),eq:g(function(a,b,c){return[c<0?c+b:c]}),even:g(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:g(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:g(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:g(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},t.pseudos.nth=t.pseudos.eq;for(r in{radio:!0,checkbox:!0,file:!0,pa
ssword:!0,image:!0})t.pseudos[r]=e(r);for(r in{submit:!0,reset:!0})t.pseudos[r]=f(r);return i.prototype=t.filters=t.pseudos,t.setFilters=new i,w=a.tokenize=function(b,c){var d,e,f,g,h,i,j,k=P[b+" "];if(k)return c?0:k.slice(0);for(h=b,i=[],j=t.preFilter;h;){d&&!(e=fa.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),d=!1,(e=ga.exec(h))&&(d=e.shift(),f.push({value:d,type:e[0].replace(ea," ")}),h=h.slice(d.length));for(g in t.filter)!(e=ka[g].exec(h))||j[g]&&!(e=j[g](e))||(d=e.shift(),f.push({value:d,type:g,matches:e}),h=h.slice(d.length));if(!d)break}return c?h.length:h?a.error(b):P(b,i).slice(0)},x=a.compile=function(a,b){var c,d=[],e=[],f=Q[a+" "];if(!f){for(b||(b=w(a)),c=b.length;c--;)f=p(b[c]),f[K]?d.push(f):e.push(f);f=Q(a,q(e,d)),f.selector=a}return f},y=a.select=function(a,b,c,d){var e,f,g,i,k,l="function"==typeof a&&a,m=!d&&w(a=l.selector||a);if(c=c||[],1===m.length){if(f=m[0]=m[0].sl
ice(0),f.length>2&&"ID"===(g=f[0]).type&&s.getById&&9===b.nodeType&&F&&t.relative[f[1].type]){if(b=(t.find.ID(g.matches[0].replace(ra,sa),b)||[])[0],!b)return c;l&&(b=b.parentNode),a=a.slice(f.shift().value.length)}for(e=ka.needsContext.test(a)?0:f.length;e--&&(g=f[e],!t.relative[i=g.type]);)if((k=t.find[i])&&(d=k(g.matches[0].replace(ra,sa),pa.test(f[0].type)&&h(b.parentNode)||b))){if(f.splice(e,1),a=d.length&&j(f),!a)return Y.apply(c,d),c;break}}return(l||x(a,m))(d,b,!F,c,pa.test(a)&&h(b.parentNode)||b),c},s.sortStable=K.split("").sort(R).join("")===K,s.detectDuplicates=!!B,C(),s.sortDetached=!0,a}),g("tinymce.core.util.Arr",[],function(){function a(a){var b,c,d=a;if(!j(a))for(d=[],b=0,c=a.length;b<c;b++)d[b]=a[b];return d}function b(a,b,c){var d,e;if(!a)return 0;if(c=c||a,void 0!==a.length){for(d=0,e=a.length;d<e;d++)if(b.call(c,a[d],d,a)===!1)r
eturn 0}else for(d in a)if(a.hasOwnProperty(d)&&b.call(c,a[d],d,a)===!1)return 0;return 1}function c(a,c){var d=[];return b(a,function(b,e){d.push(c(b,e,a))}),d}function d(a,c){var d=[];return b(a,function(b,e){c&&!c(b,e,a)||d.push(b)}),d}function e(a,b){var c,d;if(a)for(c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1}function f(a,b,c,d){var e=0;for(arguments.length<3&&(c=a[0]);e<a.length;e++)c=b.call(d,c,a[e],e);return c}function g(a,b,c){var d,e;for(d=0,e=a.length;d<e;d++)if(b.call(c,a[d],d,a))return d;return-1}function h(a,b,c){var d=g(a,b,c);if(d!==-1)return a[d]}function i(a){return a[a.length-1]}var j=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};return{isArray:j,toArray:a,each:b,map:c,filter:d,indexOf:e,reduce:f,findIndex:g,find:h,last:i}}),g("tinymce.core.util.Tools",["tinymce.core.Env","tinymce.core.util.Arr"],function(a,b){function c(a){return null===a|
|void 0===a?"":(""+a).replace(n,"")}function d(a,c){return c?!("array"!=c||!b.isArray(a))||typeof a==c:void 0!==a}function e(a,b,c){var d;for(a=a||[],b=b||",","string"==typeof a&&(a=a.split(b)),c=c||{},d=a.length;d--;)c[a[d]]={};return c}function f(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function g(a,b,c){var d,e,f,g,h,i=this,j=0;if(a=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(a),f=a[3].match(/(^|\.)(\w+)$/i)[2],e=i.createNS(a[3].replace(/\.\w+$/,""),c),!e[f]){if("static"==a[2])return e[f]=b,void(this.onCreate&&this.onCreate(a[2],a[3],e[f]));b[f]||(b[f]=function(){},j=1),e[f]=b[f],i.extend(e[f].prototype,b),a[5]&&(d=i.resolve(a[5]).prototype,g=a[5].match(/\.(\w+)$/i)[1],h=e[f],j?e[f]=function(){return d[g].apply(this,arguments)}:e[f]=function(){return this.parent=d[g],h.apply(this,arguments)},e[f].prototype[f]=e[f],i.each(d,function(a,b){e[f].prototype[b]=d[b]}),i.each
(b,function(a,b){d[b]?e[f].prototype[b]=function(){return this.parent=d[b],a.apply(this,arguments)}:b!=f&&(e[f].prototype[b]=a)})),i.each(b["static"],function(a,b){e[f][b]=a})}}function h(a,b){var c,d,e,f,g=arguments;for(c=1,d=g.length;c<d;c++){b=g[c];for(e in b)b.hasOwnProperty(e)&&(f=b[e],void 0!==f&&(a[e]=f))}return a}function i(a,c,d,e){e=e||this,a&&(d&&(a=a[d]),b.each(a,function(a,b){return c.call(e,a,b,d)!==!1&&void i(a,c,d,e)}))}function j(a,b){var c,d;for(b=b||window,a=a.split("."),c=0;c<a.length;c++)d=a[c],b[d]||(b[d]={}),b=b[d];return b}function k(a,b){var c,d;for(b=b||window,a=a.split("."),c=0,d=a.length;c<d&&(b=b[a[c]],b);c++);return b}function l(a,e){return!a||d(a,"array")?a:b.map(a.split(e||","),c)}function m(b){var c=a.cacheSuffix;return c&&(b+=(b.indexOf("?")===-1?"?":"&")+c),b}var n=/^\s*|\s*$/g;return{trim:c,is
Array:b.isArray,is:d,toArray:b.toArray,makeMap:e,each:b.each,map:b.map,grep:b.filter,inArray:b.indexOf,hasOwn:f,extend:h,create:g,walk:i,createNS:j,resolve:k,explode:l,_addCacheSuffix:m}}),g("tinymce.core.dom.DomQuery",["tinymce.core.dom.EventUtils","tinymce.core.dom.Sizzle","tinymce.core.util.Tools","tinymce.core.Env"],function(a,b,c,d){function e(a){return"undefined"!=typeof a}function f(a){return"string"==typeof a}function g(a){return a&&a==a.window}function h(a,b){var c,d,e;for(b=b||w,e=b.createElement("div"),c=b.createDocumentFragment(),e.innerHTML=a;d=e.firstChild;)c.appendChild(d);return c}function i(a,b,c,d){var e;if(f(b))b=h(b,q(a[0]));else if(b.length&&!b.nodeType){if(b=l.makeArray(b),d)for(e=b.length-1;e>=0;e--)i(a,b[e],c,d);else for(e=0;e<b.length;e++)i(a,b[e],c,d);return a}if(b.nodeType)for(e=a.length;e--;)c.call(a[e],b);return a}function j(a,b){return a&&b&
&(" "+a.className+" ").indexOf(" "+b+" ")!==-1}function k(a,b,c){var d,e;return b=l(b)[0],a.each(function(){var a=this;c&&d==a.parentNode?e.appendChild(a):(d=a.parentNode,e=b.cloneNode(!1),a.parentNode.insertBefore(e,a),e.appendChild(a))}),a}function l(a,b){return new l.fn.init(a,b)}function m(a,b){var c;if(b.indexOf)return b.indexOf(a);for(c=b.length;c--;)if(b[c]===a)return c;return-1}function n(a){return null===a||a===v?"":(""+a).replace(I,"")}function o(a,b){var c,d,e,f,g;if(a)if(c=a.length,c===f){for(d in a)if(a.hasOwnProperty(d)&&(g=a[d],b.call(g,d,g)===!1))break}else for(e=0;e<c&&(g=a[e],b.call(g,e,g)!==!1);e++);return a}function p(a,b){var c=[];return o(a,function(a,d){b(d,a)&&c.push(d)}),c}function q(a){return a?9==a.nodeType?a:a.ownerDocument:w}function r(a,b,c){var d=[],e=a[b];for("string"!=typeof c&&c instanceof l&&(c=c[0]);e&&9!==
e.nodeType;){if(void 0!==c){if(e===c)break;if("string"==typeof c&&l(e).is(c))break}1===e.nodeType&&d.push(e),e=e[b]}return d}function s(a,b,c,d){var e=[];for(d instanceof l&&(d=d[0]);a;a=a[b])if(!c||a.nodeType===c){if(void 0!==d){if(a===d)break;if("string"==typeof d&&l(a).is(d))break}e.push(a)}return e}function t(a,b,c){for(a=a[b];a;a=a[b])if(a.nodeType==c)return a;return null}function u(a,b,c){o(c,function(c,d){a[c]=a[c]||{},a[c][b]=d})}var v,w=document,x=Array.prototype.push,y=Array.prototype.slice,z=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,A=a.Event,B=c.makeMap("children,contents,next,prev"),C=c.makeMap("fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom"," "),D=c.makeMap("checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected"," "),E={
-"for":"htmlFor","class":"className",readonly:"readOnly"},F={"float":"cssFloat"},G={},H={},I=/^\s*|\s*$/g;return l.fn=l.prototype={constructor:l,selector:"",context:null,length:0,init:function(a,b){var c,d,e=this;if(!a)return e;if(a.nodeType)return e.context=e[0]=a,e.length=1,e;if(b&&b.nodeType)e.context=b;else{if(b)return l(a).attr(b);e.context=b=document}if(f(a)){if(e.selector=a,c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c)return l(b).find(a);if(c[1])for(d=h(a,q(b)).firstChild;d;)x.call(e,d),d=d.nextSibling;else{if(d=q(b).getElementById(c[2]),!d)return e;if(d.id!==c[2])return e.find(a);e.length=1,e[0]=d}}else this.add(a,!1);return e},toArray:function(){return c.toArray(this)},add:function(a,b){var c,d,e=this;if(f(a))return e.add(l(a));if(b!==!1)for(c=l.unique(e.toArray().concat(l.makeArray(a))),e.length=c.len
gth,d=0;d<c.length;d++)e[d]=c[d];else x.apply(e,l.makeArray(a));return e},attr:function(a,b){var c,d=this;if("object"==typeof a)o(a,function(a,b){d.attr(a,b)});else{if(!e(b)){if(d[0]&&1===d[0].nodeType){if(c=G[a],c&&c.get)return c.get(d[0],a);if(D[a])return d.prop(a)?a:v;b=d[0].getAttribute(a,2),null===b&&(b=v)}return b}this.each(function(){var c;if(1===this.nodeType){if(c=G[a],c&&c.set)return void c.set(this,b);null===b?this.removeAttribute(a,2):this.setAttribute(a,b,2)}})}return d},removeAttr:function(a){return this.attr(a,null)},prop:function(a,b){var c=this;if(a=E[a]||a,"object"==typeof a)o(a,function(a,b){c.prop(a,b)});else{if(!e(b))return c[0]&&c[0].nodeType&&a in c[0]?c[0][a]:b;this.each(function(){1==this.nodeType&&(this[a]=b)})}return c},css:function(a,b){function c(a){return a.replace(/-(\D)/g,function(a,b){return b.toUpperCase()})}function d(a){return a.replace(/[A-Z]/g,function(a){return"
-"+a})}var f,g,h=this;if("object"==typeof a)o(a,function(a,b){h.css(a,b)});else if(e(b))a=c(a),"number"!=typeof b||C[a]||(b+="px"),h.each(function(){var c=this.style;if(g=H[a],g&&g.set)return void g.set(this,b);try{this.style[F[a]||a]=b}catch(e){}null!==b&&""!==b||(c.removeProperty?c.removeProperty(d(a)):c.removeAttribute(a))});else{if(f=h[0],g=H[a],g&&g.get)return g.get(f);if(f.ownerDocument.defaultView)try{return f.ownerDocument.defaultView.getComputedStyle(f,null).getPropertyValue(d(a))}catch(i){return v}else if(f.currentStyle)return f.currentStyle[c(a)]}return h},remove:function(){for(var a,b=this,c=this.length;c--;)a=b[c],A.clean(a),a.parentNode&&a.parentNode.removeChild(a);return this},empty:function(){for(var a,b=this,c=this.length;c--;)for(a=b[c];a.firstChild;)a.removeChild(a.firstChild);return this},html:function(a){var b,c=this;if(e(a)){b=c.length;try{for(;b--;)c[b].innerHTML=a}catch(d){l(c[b]).em
pty().append(a)}return c}return c[0]?c[0].innerHTML:""},text:function(a){var b,c=this;if(e(a)){for(b=c.length;b--;)"innerText"in c[b]?c[b].innerText=a:c[0].textContent=a;return c}return c[0]?c[0].innerText||c[0].textContent:""},append:function(){return i(this,arguments,function(a){(1===this.nodeType||this.host&&1===this.host.nodeType)&&this.appendChild(a)})},prepend:function(){return i(this,arguments,function(a){(1===this.nodeType||this.host&&1===this.host.nodeType)&&this.insertBefore(a,this.firstChild)},!0)},before:function(){var a=this;return a[0]&&a[0].parentNode?i(a,arguments,function(a){this.parentNode.insertBefore(a,this)}):a},after:function(){var a=this;return a[0]&&a[0].parentNode?i(a,arguments,function(a){this.parentNode.insertBefore(a,this.nextSibling)},!0):a},appendTo:function(a){return l(a).append(this),this},prependTo:function(a){return l(a).prepend(this),this},replaceWith:function(a){return t
his.before(a).remove()},wrap:function(a){return k(this,a)},wrapAll:function(a){return k(this,a,!0)},wrapInner:function(a){return this.each(function(){l(this).contents().wrapAll(a)}),this},unwrap:function(){return this.parent().each(function(){l(this).replaceWith(this.childNodes)})},clone:function(){var a=[];return this.each(function(){a.push(this.cloneNode(!0))}),l(a)},addClass:function(a){return this.toggleClass(a,!0)},removeClass:function(a){return this.toggleClass(a,!1)},toggleClass:function(a,b){var c=this;return"string"!=typeof a?c:(a.indexOf(" ")!==-1?o(a.split(" "),function(){c.toggleClass(this,b)}):c.each(function(c,d){var e,f;f=j(d,a),f!==b&&(e=d.className,f?d.className=n((" "+e+" ").replace(" "+a+" "," ")):d.className+=e?" "+a:a)}),c)},hasClass:function(a){return j(this[0],a)},each:function(a){return o(this,a)},on:function(a,b){return this.each(function(){A.bind(this,a,b)})},o
ff:function(a,b){return this.each(function(){A.unbind(this,a,b)})},trigger:function(a){return this.each(function(){"object"==typeof a?A.fire(this,a.type,a):A.fire(this,a)})},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},slice:function(){return new l(y.apply(this,arguments))},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},find:function(a){var b,c,d=[];for(b=0,c=this.length;b<c;b++)l.find(a,this[b],d);return l(d)},filter:function(a){return l("function"==typeof a?p(this.toArray(),function(b,c){return a(c,b)}):l.filter(a,this.toArray()))},closest:function(a){var b=[];return a instanceof l&&(a=a[0]),this.each(function(c,d){for(;d;){if("string"==typeof a&&l(d).is(a)){b.push(d);break}if(d==a){b.push(d);break}d=d.parentNode}}),l(b)},offset:function(a){var b,c,d,e,f=
0,g=0;return a?this.css(a):(b=this[0],b&&(c=b.ownerDocument,d=c.documentElement,b.getBoundingClientRect&&(e=b.getBoundingClientRect(),f=e.left+(d.scrollLeft||c.body.scrollLeft)-d.clientLeft,g=e.top+(d.scrollTop||c.body.scrollTop)-d.clientTop)),{left:f,top:g})},push:x,sort:[].sort,splice:[].splice},c.extend(l,{extend:c.extend,makeArray:function(a){return g(a)||a.nodeType?[a]:c.toArray(a)},inArray:m,isArray:c.isArray,each:o,trim:n,grep:p,find:b,expr:b.selectors,unique:b.uniqueSort,text:b.getText,contains:b.contains,filter:function(a,b,c){var d=b.length;for(c&&(a=":not("+a+")");d--;)1!=b[d].nodeType&&b.splice(d,1);return b=1===b.length?l.find.matchesSelector(b[0],a)?[b[0]]:[]:l.find.matches(a,b)}}),o({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return r(a,"parentNode")},next:function(a){return t(a,"nextSibling",1)},prev:function(a){return t(a,"previousSib
ling",1)},children:function(a){return s(a.firstChild,"nextSibling",1)},contents:function(a){return c.toArray(("iframe"===a.nodeName?a.contentDocument||a.contentWindow.document:a).childNodes)}},function(a,b){l.fn[a]=function(c){var d=this,e=[];return d.each(function(){var a=b.call(e,this,c,e);a&&(l.isArray(a)?e.push.apply(e,a):e.push(a))}),this.length>1&&(B[a]||(e=l.unique(e)),0===a.indexOf("parents")&&(e=e.reverse())),e=l(e),c?e.filter(c):e}}),o({parentsUntil:function(a,b){return r(a,"parentNode",b)},nextUntil:function(a,b){return s(a,"nextSibling",1,b).slice(1)},prevUntil:function(a,b){return s(a,"previousSibling",1,b).slice(1)}},function(a,b){l.fn[a]=function(c,d){var e=this,f=[];return e.each(function(){var a=b.call(f,this,c,f);a&&(l.isArray(a)?f.push.apply(f,a):f.push(a))}),this.length>1&&(f=l.unique(f),0!==a.indexOf("parents")&&"prevUntil"!=
=a||(f=f.reverse())),f=l(f),d?f.filter(d):f}}),l.fn.is=function(a){return!!a&&this.filter(a).length>0},l.fn.init.prototype=l.fn,l.overrideDefaults=function(a){function b(d,e){return c=c||a(),0===arguments.length&&(d=c.element),e||(e=c.context),new b.fn.init(d,e)}var c;return l.extend(b,this),b},d.ie&&d.ie<8&&(u(G,"get",{maxlength:function(a){var b=a.maxLength;return 2147483647===b?v:b},size:function(a){var b=a.size;return 20===b?v:b},"class":function(a){return a.className},style:function(a){var b=a.style.cssText;return 0===b.length?v:b}}),u(G,"set",{"class":function(a,b){a.className=b},style:function(a,b){a.style.cssText=b}})),d.ie&&d.ie<9&&(F["float"]="styleFloat",u(H,"set",{opacity:function(a,b){var c=a.style;null===b||""===b?c.removeAttribute("filter"):(c.zoom=1,c.filter="alpha(opacity="+100*b+")")}})),l.attrHooks=G
,l.cssHooks=H,l}),g("tinymce.core.dom.Range",["tinymce.core.util.Tools"],function(a){function b(c){function d(){return J.createDocumentFragment()}function e(a,b){x(N,a,b)}function f(a,b){x(O,a,b)}function g(a){e(a.parentNode,U(a))}function h(a){e(a.parentNode,U(a)+1)}function i(a){f(a.parentNode,U(a))}function j(a){f(a.parentNode,U(a)+1)}function k(a){a?(I[R]=I[Q],I[S]=I[P]):(I[Q]=I[R],I[P]=I[S]),I.collapsed=N}function l(a){g(a),j(a)}function m(a){e(a,0),f(a,1===a.nodeType?a.childNodes.length:a.nodeValue.length)}function n(a,b){var c=I[Q],d=I[P],e=I[R],f=I[S],g=b.startContainer,h=b.startOffset,i=b.endContainer,j=b.endOffset;return 0===a?w(c,d,g,h):1===a?w(e,f,g,h):2===a?w(e,f,i,j):3===a?w(c,d,i,j):void 0}function o(){y(M)}function p(){return y(K)}function q(){return y(L)}function r(a){var b,d,e=this[Q],f=this[P];3!==e.nodeType&&4!==e.nodeType||!e.nodeValue?(e.childNodes.length>0&&(d=e.childNodes[f]),d?e.insertBefore(a,d):3==e.nodeType?c.insertA
fter(a,e):e.appendChild(a)):f?f>=e.nodeValue.length?c.insertAfter(a,e):(b=e.splitText(f),e.parentNode.insertBefore(a,b)):e.parentNode.insertBefore(a,e)}function s(a){var b=I.extractContents();I.insertNode(a),a.appendChild(b),I.selectNode(a)}function t(){return T(new b(c),{startContainer:I[Q],startOffset:I[P],endContainer:I[R],endOffset:I[S],collapsed:I.collapsed,commonAncestorContainer:I.commonAncestorContainer})}function u(a,b){var c;if(3==a.nodeType)return a;if(b<0)return a;for(c=a.firstChild;c&&b>0;)--b,c=c.nextSibling;return c?c:a}function v(){return I[Q]==I[R]&&I[P]==I[S]}function w(a,b,d,e){var f,g,h,i,j,k;if(a==d)return b==e?0:b<e?-1:1;for(f=d;f&&f.parentNode!=a;)f=f.parentNode;if(f){for(g=0,h=a.firstChild;h!=f&&g<b;)g++,h=h.nextSibling;return b<=g?-1:1}for(f=a;f&&f.parentNode!=d;)f=f.parentNode;if(f){for(g=0,h=d.firstChild;h!=f&&g<e;)g++,h=h.nextSibling;return g<e?-1:1}for(i=c.findCommonAncestor(a,d),j=a
;j&&j.parentNode!=i;)j=j.parentNode;for(j||(j=i),k=d;k&&k.parentNode!=i;)k=k.parentNode;if(k||(k=i),j==k)return 0;for(h=i.firstChild;h;){if(h==j)return-1;if(h==k)return 1;h=h.nextSibling}}function x(a,b,d){var e,f;for(a?(I[Q]=b,I[P]=d):(I[R]=b,I[S]=d),e=I[R];e.parentNode;)e=e.parentNode;for(f=I[Q];f.parentNode;)f=f.parentNode;f==e?w(I[Q],I[P],I[R],I[S])>0&&I.collapse(a):I.collapse(a),I.collapsed=v(),I.commonAncestorContainer=c.findCommonAncestor(I[Q],I[R])}function y(a){var b,c,d,e,f,g,h,i=0,j=0;if(I[Q]==I[R])return z(a);for(b=I[R],c=b.parentNode;c;b=c,c=c.parentNode){if(c==I[Q])return A(b,a);++i}for(b=I[Q],c=b.parentNode;c;b=c,c=c.parentNode){if(c==I[R])return B(b,a);++j}for(d=j-i,e=I[Q];d>0;)e=e.parentNode,d--;for(f=I[R];d<0;)f=f.parentNode,d++;for(g=e.parentNode,h=f.parentNode;g!=h;g=g.parentNode,h=h.parentNode)e=g,f=h;return C(e,f,a)}function z(a){var b,c,e,f,g,h,i,j,k;if(a!=M&&(b=d()),I[P]==I[S])return b;if(3==I[Q].nodeType){if(c=I[Q].no
deValue,e=c.substring(I[P],I[S]),a!=L&&(f=I[Q],j=I[P],k=I[S]-I[P],0===j&&k>=f.nodeValue.length-1?f.parentNode.removeChild(f):f.deleteData(j,k),I.collapse(N)),a==M)return;return e.length>0&&b.appendChild(J.createTextNode(e)),b}for(f=u(I[Q],I[P]),g=I[S]-I[P];f&&g>0;)h=f.nextSibling,i=G(f,a),b&&b.appendChild(i),--g,f=h;return a!=L&&I.collapse(N),b}function A(a,b){var c,e,f,g,h,i;if(b!=M&&(c=d()),e=D(a,b),c&&c.appendChild(e),f=U(a),g=f-I[P],g<=0)return b!=L&&(I.setEndBefore(a),I.collapse(O)),c;for(e=a.previousSibling;g>0;)h=e.previousSibling,i=G(e,b),c&&c.insertBefore(i,c.firstChild),--g,e=h;return b!=L&&(I.setEndBefore(a),I.collapse(O)),c}function B(a,b){var c,e,f,g,h,i;for(b!=M&&(c=d()),f=E(a,b),c&&c.appendChild(f),e=U(a),++e,g=I[S]-e,f=a.nextSibling;f&&g>0;)h=f.nextSibling,i=G(f,b),c&&c.appendChild(i),--g,f=h;return b!=L&&(I.setStartAfter(a
),I.collapse(N)),c}function C(a,b,c){var e,f,g,h,i,j,k;for(c!=M&&(f=d()),e=E(a,c),f&&f.appendChild(e),g=U(a),h=U(b),++g,i=h-g,j=a.nextSibling;i>0;)k=j.nextSibling,e=G(j,c),f&&f.appendChild(e),j=k,--i;return e=D(b,c),f&&f.appendChild(e),c!=L&&(I.setStartAfter(a),I.collapse(N)),f}function D(a,b){var c,d,e,f,g,h=u(I[R],I[S]-1),i=h!=I[R];if(h==a)return F(h,i,O,b);for(c=h.parentNode,d=F(c,O,O,b);c;){for(;h;)e=h.previousSibling,f=F(h,i,O,b),b!=M&&d.insertBefore(f,d.firstChild),i=N,h=e;if(c==a)return d;h=c.previousSibling,c=c.parentNode,g=F(c,O,O,b),b!=M&&g.appendChild(d),d=g}}function E(a,b){var c,d,e,f,g,h=u(I[Q],I[P]),i=h!=I[Q];if(h==a)return F(h,i,N,b);for(c=h.parentNode,d=F(c,O,N,b);c;){for(;h;)e=h.nextSibling,f=F(h,i,N,b),b!=M&&d.appendChild(f),i=N,h=e;if(c==a)return d;h=c.nextSibling,c=c.parentNode,g=F(c,O,N,b),b!=M&&g.appendChild(d),d=g}}function F(a,b,d,e){var f,g,h,i,j;if(b)return G(a,e);if(3==a.nodeType){
if(f=a.nodeValue,d?(i=I[P],g=f.substring(i),h=f.substring(0,i)):(i=I[S],g=f.substring(0,i),h=f.substring(i)),e!=L&&(a.nodeValue=h),e==M)return;return j=c.clone(a,O),j.nodeValue=g,j}if(e!=M)return c.clone(a,O)}function G(a,b){return b!=M?b==L?c.clone(a,N):a:void a.parentNode.removeChild(a)}function H(){return c.create("body",null,q()).outerText}var I=this,J=c.doc,K=0,L=1,M=2,N=!0,O=!1,P="startOffset",Q="startContainer",R="endContainer",S="endOffset",T=a.extend,U=c.nodeIndex;return T(I,{startContainer:J,startOffset:0,endContainer:J,endOffset:0,collapsed:N,commonAncestorContainer:J,START_TO_START:0,START_TO_END:1,END_TO_END:2,END_TO_START:3,setStart:e,setEnd:f,setStartBefore:g,setStartAfter:h,setEndBefore:i,setEndAfter:j,collapse:k,selectNode:l,selectNodeContents:m,compareBoundaryPoints:n,deleteContents:o,extractContents:p,cloneContents:q,insertNode:r,surroundContents:s,cloneRange:t,toStringIE:H}),I}return b.prototype.toString=f
unction(){return this.toStringIE()},b}),h("global!Object",Object),g("ephox.katamari.api.Option",["ephox.katamari.api.Fun","global!Object"],function(a,b){var c=a.never,d=a.always,e=function(){return f},f=function(){var f=function(a){return a.isNone()},g=function(a){return a()},h=function(a){return a},i=function(){},j={fold:function(a,b){return a()},is:c,isSome:c,isNone:d,getOr:h,getOrThunk:g,getOrDie:function(a){throw new Error(a||"error: getOrDie called on none.")},or:h,orThunk:g,map:e,ap:e,each:i,bind:e,flatten:e,exists:c,forall:d,filter:e,equals:f,equals_:f,toArray:function(){return[]},toString:a.constant("none()")};return b.freeze&&b.freeze(j),j}(),g=function(a){var b=function(){return a},h=function(){return k},i=function(b){return g(b(a))},j=function(b){return b(a)},k={fold:function(b,c){return c(a)},is:function(b){return a===b},isSome:d,isNone:c,getOr:b,getOrThunk:b,getOrDie:b,or:h,orThunk:h,map:i,ap:function(b
){return b.fold(e,function(b){return g(b(a))})},each:function(b){b(a)},bind:j,flatten:b,exists:j,forall:j,filter:function(b){return b(a)?k:f},equals:function(b){return b.is(a)},equals_:function(b,d){return b.fold(c,function(b){return d(a,b)})},toArray:function(){return[a]},toString:function(){return"some("+a+")"}};return k},h=function(a){return null===a||void 0===a?f:g(a)};return{some:g,none:e,from:h}}),h("global!String",String),g("ephox.katamari.api.Arr",["ephox.katamari.api.Option","global!Array","global!Error","global!String"],function(a,b,c,d){var e=function(){var a=b.prototype.indexOf,c=function(b,c){return a.call(b,c)},d=function(a,b){return u(a,b)};return void 0===a?d:c}(),f=function(b,c){var d=e(b,c);return d===-1?a.none():a.some(d)},g=function(a,b){return e(a,b)>-1},h=function(a,b){return t(a,b).isSome()},i=function(a,b){for(var c=[],d=0;d<a;d++)c.push(b(d));return c},j=function(a,b){for(v
ar c=[],d=0;d<a.length;d+=b){var e=a.slice(d,d+b);c.push(e)}return c},k=function(a,c){for(var d=a.length,e=new b(d),f=0;f<d;f++){var g=a[f];e[f]=c(g,f,a)}return e},l=function(a,b){for(var c=0,d=a.length;c<d;c++){var e=a[c];b(e,c,a)}},m=function(a,b){for(var c=a.length-1;c>=0;c--){var d=a[c];b(d,c,a)}},n=function(a,b){for(var c=[],d=[],e=0,f=a.length;e<f;e++){var g=a[e],h=b(g,e,a)?c:d;h.push(g)}return{pass:c,fail:d}},o=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++){var f=a[d];b(f,d,a)&&c.push(f)}return c},p=function(a,b){if(0===a.length)return[];for(var c=b(a[0]),d=[],e=[],f=0,g=a.length;f<g;f++){var h=a[f],i=b(h);i!==c&&(d.push(e),e=[]),c=i,e.push(h)}return 0!==e.length&&d.push(e),d},q=function(a,b,c){return m(a,function(a){c=b(c,a)}),c},r=function(a,b,c){return l(a,function(a){c=b(c,a)}),c},s=function(b,c){for(var d=0,e=b.length;d<e;d++){var f=b[d];if(c(f,d,b))return a.some(f)}return a.none()},t=function(b,c){for(var d=0,e=b.lengt
h;d<e;d++){var f=b[d];if(c(f,d,b))return a.some(d)}return a.none()},u=function(a,b){for(var c=0,d=a.length;c<d;++c)if(a[c]===b)return c;return-1},v=b.prototype.push,w=function(a){for(var d=[],e=0,f=a.length;e<f;++e){if(!b.prototype.isPrototypeOf(a[e]))throw new c("Arr.flatten item "+e+" was not an array, input: "+a);v.apply(d,a[e])}return d},x=function(a,b){var c=k(a,b);return w(c)},y=function(a,b){for(var c=0,d=a.length;c<d;++c){var e=a[c];if(b(e,c,a)!==!0)return!1}return!0},z=function(a,b){return a.length===b.length&&y(a,function(a,c){return a===b[c]})},A=b.prototype.slice,B=function(a){var b=A.call(a,0);return b.reverse(),b},C=function(a,b){return o(a,function(a){return!g(b,a)})},D=function(a,b){for(var c={},e=0,f=a.length;e<f;e++){var g=a[e];c[d(g)]=b(g,e)}return c},E=function(a){return[a]},F=function(a,b){var c=A.call(a,0);return c.sort(b),c};return{map:k,each:l,eachr:m,partition:n,filter:o,groupBy:p,indexOf:f,foldr:q,foldl:r,find:s,fi
ndIndex:t,flatten:w,bind:x,forall:y,exists:h,contains:g,equal:z,reverse:B,chunk:j,difference:C,mapToObject:D,pure:E,sort:F,range:i}}),h("global!setTimeout",setTimeout),g("ephox.katamari.api.LazyValue",["ephox.katamari.api.Arr","ephox.katamari.api.Option","global!setTimeout"],function(a,b,c){var d=function(e){var f=b.none(),g=[],h=function(a){return d(function(b){i(function(c){b(a(c))})})},i=function(a){k()?m(a):g.push(a)},j=function(a){f=b.some(a),l(g),g=[]},k=function(){return f.isSome()},l=function(b){a.each(b,m)},m=function(a){f.each(function(b){c(function(){a(b)},0)})};return e(j),{get:i,map:h,isReady:k}},e=function(a){return d(function(b){b(a)})};return{nu:d,pure:e}}),g("ephox.katamari.async.Bounce",["global!Array","global!setTimeout"],function(a,b){var c=function(c){return function(){var d=a.prototype.slice.call(arguments),e=this;b(function(){c.apply(e,d)},0)}};return{bounce:c}}),g("ephox.kata
mari.api.Future",["ephox.katamari.api.LazyValue","ephox.katamari.async.Bounce"],function(a,b){var c=function(d){var e=function(a){d(b.bounce(a))},f=function(a){return c(function(b){e(function(c){var d=a(c);b(d)})})},g=function(a){return c(function(b){e(function(c){a(c).get(b)})})},h=function(a){return c(function(b){e(function(c){a.get(b)})})},i=function(){return a.nu(e)};return{map:f,bind:g,anonBind:h,toLazy:i,get:e}},d=function(a){return c(function(b){b(a)})};return{nu:c,pure:d}}),g("ephox.katamari.async.AsyncValues",["ephox.katamari.api.Arr"],function(a){var b=function(b,c){return c(function(c){var d=[],e=0,f=function(a){return function(f){d[a]=f,e++,e>=b.length&&c(d)}};0===b.length?c([]):a.each(b,function(a,b){a.get(f(b))})})};return{par:b}}),g("ephox.katamari.api.Futures",["ephox.katamari.api.Arr","ephox.katamari.api.Future","ephox.katamari.async.AsyncValues"],function(a,b,c){var d=fu
nction(a){return c.par(a,b.nu)},e=function(b,c){var e=a.map(b,c);return d(e)},f=function(a,b){return function(c){return b(c).bind(a)}};return{par:d,mapM:e,compose:f}}),g("ephox.katamari.api.Result",["ephox.katamari.api.Fun","ephox.katamari.api.Option"],function(a,b){var c=function(d){var e=function(a){return d===a},f=function(a){return c(d)},g=function(a){return c(d)},h=function(a){return c(a(d))},i=function(a){a(d)},j=function(a){return a(d)},k=function(a,b){return b(d)},l=function(a){return a(d)},m=function(a){return a(d)},n=function(){return b.some(d)};return{is:e,isValue:a.constant(!0),isError:a.constant(!1),getOr:a.constant(d),getOrThunk:a.constant(d),getOrDie:a.constant(d),or:f,orThunk:g,fold:k,map:h,each:i,bind:j,exists:l,forall:m,toOption:n}},d=function(c){var e=function(a){return a()},f=function(){return a.die(c)()},g=function(a){return a},h=function(a){return a()},i=function(a){return d(c)},j=function(a){return d(c)},k=function(a,b){return a(c
)};return{is:a.constant(!1),isValue:a.constant(!1),isError:a.constant(!0),getOr:a.identity,getOrThunk:e,getOrDie:f,or:g,orThunk:h,fold:k,map:i,each:a.noop,bind:j,exists:a.constant(!1),forall:a.constant(!0),toOption:b.none}};return{value:c,error:d}}),g("tinymce.core.dom.StyleSheetLoader",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.katamari.api.Future","ephox.katamari.api.Futures","ephox.katamari.api.Result","tinymce.core.util.Delay","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g){"use strict";return function(h,i){function j(a){h.getElementsByTagName("head")[0].appendChild(a)}function k(a,b,c){function d(){for(var a=t.passed,b=a.length;b--;)a[b]();t.status=2,t.passed=[],t.failed=[]}function e(){for(var a=t.failed,b=a.length;b--;)a[b]();t.status=3,t.passed=[],t.failed=[]}function i(){var a=navigator.userAgent.match(/WebKit\/(\d*)/);return!!(a&&a[1]<536)}functi
on k(a,b){a()||((new Date).getTime()-s<l?f.setTimeout(b):e())}function o(){k(function(){for(var a,b,c=h.styleSheets,e=c.length;e--;)if(a=c[e],b=a.ownerNode?a.ownerNode:a.owningElement,b&&b.id===q.id)return d(),!0},o)}function p(){k(function(){try{var a=r.sheet.cssRules;return d(),!!a}catch(b){}},p)}var q,r,s,t;if(a=g._addCacheSuffix(a),n[a]?t=n[a]:(t={passed:[],failed:[]},n[a]=t),b&&t.passed.push(b),c&&t.failed.push(c),1!=t.status){if(2==t.status)return void d();if(3==t.status)return void e();if(t.status=1,q=h.createElement("link"),q.rel="stylesheet",q.type="text/css",q.id="u"+m++,q.async=!1,q.defer=!1,s=(new Date).getTime(),"onload"in q&&!i())q.onload=o,q.onerror=e;else{if(navigator.userAgent.indexOf("Firefox")>0)return r=h.createElement("style"),r.textContent='@import "'+a+'"',p(),void j(r);o()}j(q),q.href=a}}var l,m=0,n={};i=i||{},l=i.maxLoadTime||5e3;var o=functi
on(a){return c.nu(function(c){k(a,b.compose(c,b.constant(e.value(a))),b.compose(c,b.constant(e.error(a))))})},p=function(a){return a.fold(b.identity,b.identity)},q=function(b,c,e){d.par(a.map(b,o)).get(function(b){var d=a.partition(b,function(a){return a.isValue()});d.fail.length>0?e(d.fail.map(p)):c(d.pass.map(p))})};return{load:k,loadAll:q}}}),g("tinymce.core.dom.TreeWalker",[],function(){return function(a,b){function c(a,c,d,e){var f,g;if(a){if(!e&&a[c])return a[c];if(a!=b){if(f=a[d])return f;for(g=a.parentNode;g&&g!=b;g=g.parentNode)if(f=g[d])return f}}}function d(a,c,d,e){var f,g,h;if(a){if(f=a[d],b&&f===b)return;if(f){if(!e)for(h=f[c];h;h=h[c])if(!h[c])return h;return f}if(g=a.parentNode,g&&g!==b)return g}}var e=a;this.current=function(){return e},this.next=function(a){return e=c(e,"firstChild","nextSibling",a)},this.prev=function(a){return e=c(e,"lastChild","previousSibling",a)},this.prev2=fu
nction(a){return e=d(e,"lastChild","previousSibling",a)}}}),g("tinymce.core.html.Entities",["tinymce.core.util.Tools"],function(a){function b(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.textContent||b.innerText||a}function c(a,b){var c,d,f,g={};if(a){for(a=a.split(","),b=b||10,c=0;c<a.length;c+=2)d=String.fromCharCode(parseInt(a[c],b)),e[d]||(f="&"+a[c+1]+";",g[d]=f,g[f]=d);return g}}var d,e,f,g=a.makeMap,h=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,i=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,j=/[<>&\"\']/g,k=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,l={128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:&
quot;\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"};e={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},f={"<":"<",">":">","&":"&",""":'"',"'":"'"},d=c("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,par
a,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,x
i,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagg
er,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);var m={encodeRaw:function(a,b){return a.replace(b?h:i,function(a){return e[a]||a})},encodeAllRaw:function(a){return(""+a).replace(j,function(a){return e[a]||a})},encodeNumeric:function(a,b){return a.replace(b?h:i,function(a){return a.length>1?"&#"+(1024*(a.charCodeAt(0)-55296)+(a.charCodeAt(1)-56320)+65536)+";":e[a]||"&#"+a.charCodeAt(0)+";"})},encodeNamed:function(a,b,c){return c=c||d,a.replace(b?h:i,function(a){return e[a]||c[a]||a})},getEncodeFunc:function(a,b){function f(a,c){return a.replace(c?h:i,function(a){return void 0!==e[a]?e[a]:void 0!==b[a]?b[a]:a.length>1?"&#"+(1024*(a.charCodeAt(0)-55296)+(a.charCodeAt(1)-56320)+65536)+";":"&#"+a.charCodeAt(0)+";"})}function j(a,c){return m.encodeNamed(a,c,b)}return b=c(b)||d,a=g(a.replace(/\+/g,",")),a.named&&a.numeric?f:a.named?b?j:m.encode
Named:a.numeric?m.encodeNumeric:m.encodeRaw},decode:function(a){return a.replace(k,function(a,c){return c?(c="x"===c.charAt(0).toLowerCase()?parseInt(c.substr(1),16):parseInt(c,10),c>65535?(c-=65536,String.fromCharCode(55296+(c>>10),56320+(1023&c))):l[c]||String.fromCharCode(c)):f[a]||d[a]||b(a)})}};return m}),g("tinymce.core.html.Schema",["tinymce.core.util.Tools"],function(a){function b(b,c){return b=a.trim(b),b?b.split(c||" "):[]}function c(a){function c(a,c,d){function e(a,b){var c,d,e={};for(c=0,d=a.length;c<d;c++)e[a[c]]=b||{};return e}var h,i,j;for(d=d||[],c=c||"","string"==typeof d&&(d=b(d)),a=b(a),h=a.length;h--;)i=b([g,c].join(" ")),j={attributes:e(i),attributesOrder:i,children:e(d,f)},n[a[h]]=j}function d(a,c){var d,e,f,g;for(a=b(a),d=a.length,c=b(c);d--;)for(e=n[a[d]],f=0,g=c.length;f<g;f++)e.attributes[c[f]]={},e.attributesOrder.push(c[f])}var g,i,j,k,l,m,n={};return e[a]?e[
a]:(g="id accesskey class dir lang style tabindex title role",i="address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul",j="a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment","html4"!=a&&(g+=" contenteditable contextmenu draggable dropzone hidden spellcheck translate",i+=" article aside details dialog figure header footer hgroup section nav",j+=" audio canvas command datalist mark meter output picture progress time wbr video ruby bdi keygen"),"html5-strict"!=a&&(g+=" xml:lang",m="acronym applet basefont big font strike tt",j=[j,m].join(" "),h(b(m),function(a){c(a,"",j)}),l="center dir isindex noframes",i=[i,l].join(" "),k=[i,j].join(" "),h(b(l),function(a){c(a,&
quot;",k)})),k=k||[i,j].join(" "),c("html","manifest","head body"),c("head","","base command link meta noscript script style title"),c("title hr noscript br"),c("base","href target"),c("link","href rel media hreflang type sizes hreflang"),c("meta","name http-equiv content charset"),c("style","media type scoped"),c("script","src async defer type charset"),c("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",k),c("address dt dd div caption","",k),c("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",j),c("blockquote","cite",k),c(
"ol","reversed start type","li"),c("ul","","li"),c("li","value",k),c("dl","","dt dd"),c("a","href target rel media hreflang type",j),c("q","cite",j),c("ins del","cite datetime",k),c("img","src sizes srcset alt usemap ismap width height"),c("iframe","src name width height",k),c("embed","src type width height"),c("object","data type typemustmatch name usemap form width height",[k,"param"].join(" ")),c("param","name value"),c("map","name",[k,"area"].join(" ")),c("area","alt coords shape href target rel media hreflang type"),c("table","border","caption colgroup thead tfoot tbody tr"+("html4"==a?" co
l":"")),c("colgroup","span","col"),c("col","span"),c("tbody thead tfoot","","tr"),c("tr","","td th"),c("td","colspan rowspan headers",k),c("th","colspan rowspan headers scope abbr",k),c("form","accept-charset action autocomplete enctype method name novalidate target",k),c("fieldset","disabled form name",[k,"legend"].join(" ")),c("label","form for",j),c("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),c("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"==a?k:j),c(
"select","disabled form multiple name required size","option optgroup"),c("optgroup","disabled label","option"),c("option","disabled label selected value"),c("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),c("menu","type label",[k,"li"].join(" ")),c("noscript","",k),"html4"!=a&&(c("wbr"),c("ruby","",[j,"rt rp"].join(" ")),c("figcaption","",k),c("mark rt rp summary bdi","",j),c("canvas","width height",k),c("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[k,"track source"].join(" ")),c("audio","src crossorigin preload autoplay mediagroup loop muted controls b
uffered volume",[k,"track source"].join(" ")),c("picture","","img source"),c("source","src srcset type media sizes"),c("track","kind src srclang label default"),c("datalist","",[j,"option"].join(" ")),c("article section nav aside header footer","",k),c("hgroup","","h1 h2 h3 h4 h5 h6"),c("figure","",[k,"figcaption"].join(" ")),c("time","datetime",j),c("dialog","open",k),c("command","type label icon disabled checked radiogroup command"),c("output","for form name",j),c("progress","value max",j),c("meter","value min max low high optimum",j),c("details","open",[k,"summary"].join(" ")),c("keygen",&quo
t;autofocus challenge disabled form keytype name")),
-"html5-strict"!=a&&(d("script","language xml:space"),d("style","xml:space"),d("object","declare classid code codebase codetype archive standby align border hspace vspace"),d("embed","align name hspace vspace"),d("param","valuetype type"),d("a","charset name rev shape coords"),d("br","clear"),d("applet","codebase archive code object alt name width height align hspace vspace"),d("img","name longdesc align border hspace vspace"),d("iframe","longdesc frameborder marginwidth marginheight scrolling align"),d("font basefont","size color face"),d("input","usemap align"),d("select","onchange"),d("textarea"),d("h1 h2 h3 h4 h5 h6 div p legend caption","align"),d("ul","type com
pact"),d("li","type"),d("ol dl menu dir","compact"),d("pre","width xml:space"),d("hr","align noshade size width"),d("isindex","prompt"),d("table","summary width frame rules cellspacing cellpadding align bgcolor"),d("col","width align char charoff valign"),d("colgroup","width align char charoff valign"),d("thead","align char charoff valign"),d("tr","align char charoff valign bgcolor"),d("th","axis align char charoff valign nowrap bgcolor width height"),d("form","accept"),d("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),d("tfoot","align char charoff valign"),d("tbody","align char charoff valign"),d("area","nohref"),d("body",&
quot;background bgcolor text link vlink alink")),"html4"!=a&&(d("input button select textarea","autofocus"),d("input textarea","placeholder"),d("a","download"),d("link script img","crossorigin"),d("iframe","sandbox seamless allowfullscreen")),h(b("a form meter progress dfn"),function(a){n[a]&&delete n[a].children[a]}),delete n.caption.children.table,delete n.script,e[a]=n,n)}function d(a,b){var c;return a&&(c={},"string"==typeof a&&(a={"*":a}),h(a,function(a,d){c[d]=c[d.toUpperCase()]="map"==b?g(a,/[, ]/):j(a,/[, ]/)})),c}var e={},f={},g=a.makeMap,h=a.each,i=a.extend,j=a.explode,k=a.inArray;return function(a){function f(b,c,d){var f=a[b];return f?f=g(f,/[, ]/,g(f.toUpperCase(),/[, ]/)):(f=e[b],f||(f=g(c," ",g(c.toUpperCase()," ")),f=i(f,d),e[b]=f)),f}function l(a){return new RegE
xp("^"+a.replace(/([?+*])/g,".$1")+"$")}function m(a){var c,d,e,f,h,i,j,m,n,o,p,q,r,s,t,u,v,w,x,y=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/,z=/^([!\-])?(\w+::\w+|[^=:<]+)?(?:([=:<])(.*))?$/,A=/[*?+]/;if(a)for(a=b(a,","),F["@"]&&(u=F["@"].attributes,v=F["@"].attributesOrder),c=0,d=a.length;c<d;c++)if(h=y.exec(a[c])){if(s=h[1],n=h[2],t=h[3],m=h[5],q={},r=[],i={attributes:q,attributesOrder:r},"#"===s&&(i.paddEmpty=!0),"-"===s&&(i.removeEmpty=!0),"!"===h[4]&&(i.removeEmptyAttrs=!0),u){for(w in u)q[w]=u[w];r.push.apply(r,v)}if(m)for(m=b(m,"|"),e=0,f=m.length;e<f;e++)if(h=z.exec(m[e])){if(j={},p=h[1],o=h[2].replace(/::/g,":"),s=h[3],x=h[4],"!"===p&&(i.attributesRequired=i.attributesRequired||[],i.attributesRequired.push(o),j.required=!0),"-"===p){delete q[o],r.splice(k(r,o),1);con
tinue}s&&("="===s&&(i.attributesDefault=i.attributesDefault||[],i.attributesDefault.push({name:o,value:x}),j.defaultValue=x),":"===s&&(i.attributesForced=i.attributesForced||[],i.attributesForced.push({name:o,value:x}),j.forcedValue=x),"<"===s&&(j.validValues=g(x,"?"))),A.test(o)?(i.attributePatterns=i.attributePatterns||[],j.pattern=l(o),i.attributePatterns.push(j)):(q[o]||r.push(o),q[o]=j)}u||"@"!=n||(u=q,v=r),t&&(i.outputName=n,F[t]=i),A.test(n)?(i.pattern=l(n),H.push(i)):F[n]=i}}function n(a){F={},H=[],m(a),h(t,function(a,b){G[b]=a.children})}function o(a){var c=/^(~)?(.+)$/;a&&(e.text_block_elements=e.block_elements=null,h(b(a,","),function(a){var b=c.exec(a),d="~"===b[1],e=d?"span":"div",f=b[2];if(G[f]=G[e],I[f]=e,d||(z[f.toUpperCase()]={},z[f]={}),!F[f]){var g=F[e];g=i({},g),delete g.removeEmptyAttrs,delete g.removeEmpty,F[f]=g}h(G,funct
ion(a,b){a[e]&&(G[b]=a=i({},G[b]),a[f]=a[e])})}))}function p(c){var d=/^([+\-]?)(\w+)\[([^\]]+)\]$/;e[a.schema]=null,c&&h(b(c,","),function(a){var c,e,f=d.exec(a);f&&(e=f[1],c=e?G[f[2]]:G[f[2]]={"#comment":{}},c=G[f[2]],h(b(f[3],"|"),function(a){"-"===e?delete c[a]:c[a]={}}))})}function q(a){var b,c=F[a];if(c)return c;for(b=H.length;b--;)if(c=H[b],c.pattern.test(a))return c}var r,s,t,u,v,w,x,y,z,A,B,C,D,E=this,F={},G={},H=[],I={},J={};a=a||{},t=c(a.schema),a.verify_html===!1&&(a.valid_elements="*[*]"),r=d(a.valid_styles),s=d(a.invalid_styles,"map"),y=d(a.valid_classes,"map"),u=f("whitespace_elements","pre script noscript style textarea video audio iframe object code"),v=f("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),w=f("short_ended_elements","area base basefont br col frame hr img input isindex lin
k meta param embed source wbr track"),x=f("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls"),A=f("non_empty_elements","td th iframe video audio object script pre code",w),B=f("move_caret_before_on_enter_elements","table",A),C=f("text_block_elements","h1 h2 h3 h4 h5 h6 p div address pre form blockquote center dir fieldset header footer article section hgroup aside nav figure"),z=f("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption",C),D=f("text_inline_elements","span strong b em i font strike u var cite dfn code mark q sup sub samp"),h((a.special||"script noscript noframes noembed title style textarea xmp").split(" "),function(a){J[a]=new RegExp("
</"+a+"[^>]*>","gi")}),a.valid_elements?n(a.valid_elements):(h(t,function(a,b){F[b]={attributes:a.attributes,attributesOrder:a.attributesOrder},G[b]=a.children}),"html5"!=a.schema&&h(b("strong/b em/i"),function(a){a=b(a,"/"),F[a[1]].outputName=a[0]}),h(b("ol ul sub sup blockquote span font a table tbody tr strong em b i"),function(a){F[a]&&(F[a].removeEmpty=!0)}),h(b("p h1 h2 h3 h4 h5 h6 th td pre div address caption"),function(a){F[a].paddEmpty=!0}),h(b("span"),function(a){F[a].removeEmptyAttrs=!0})),o(a.custom_elements),p(a.valid_children),m(a.extended_valid_elements),p("+ol[ul|ol],+ul[ul|ol]"),h({dd:"dl",dt:"dl",li:"ul ol",td:"tr",th:"tr",tr:"tbody thead tfoot",tbody:"table",thead:"table",tfoot:"table",legend:"fieldset",area:"map",param:"video audio
object"},function(a,c){F[c]&&(F[c].parentsRequired=b(a))}),a.invalid_elements&&h(j(a.invalid_elements),function(a){F[a]&&delete F[a]}),q("span")||m("span[!data-mce-type|*]"),E.children=G,E.getValidStyles=function(){return r},E.getInvalidStyles=function(){return s},E.getValidClasses=function(){return y},E.getBoolAttrs=function(){return x},E.getBlockElements=function(){return z},E.getTextBlockElements=function(){return C},E.getTextInlineElements=function(){return D},E.getShortEndedElements=function(){return w},E.getSelfClosingElements=function(){return v},E.getNonEmptyElements=function(){return A},E.getMoveCaretBeforeOnEnterElements=function(){return B},E.getWhiteSpaceElements=function(){return u},E.getSpecialElements=function(){return J},E.isValidChild=function(a,b){var c=G[a.toLowerCase()];return!(!c||!c[b.toLowerCase()])},E.isValid=function(a,b){var c,d,e=q(a);if(e){if(!b)return!0;if(e.attributes[b])return!0;if(c=e.attributePatterns
)for(d=c.length;d--;)if(c[d].pattern.test(a))return!0}return!1},E.getElementRule=q,E.getCustomElements=function(){return I},E.addValidElements=m,E.setValidElements=n,E.addCustomElements=o,E.addValidChildren=p,E.elements=F}}),g("tinymce.core.html.Styles",[],function(){return function(a,b){function c(a,b,c,d){function e(a){return a=parseInt(a,10).toString(16),a.length>1?a:"0"+a}return"#"+e(b)+e(c)+e(d)}var d,e,f,g,h=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,i=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,j=/\s*([^:]+):\s*([^;]+);?/g,k=/\s+$/,l={},m="\ufeff";for(a=a||{},b&&(f=b.getValidStyles(),g=b.getInvalidStyles()),e=("\\\" \\' \\; \\: ; : "+m).split(" "),d=0;d<e.length;d++)l[e[d]]=m+d,l[m+d]=e[d];return{toHex:function(a){return a.replace(h,c)},parse:function(b){function e(a,b,c)
{var e,f,g,h;if(e=w[a+"-top"+b],e&&(f=w[a+"-right"+b],f&&(g=w[a+"-bottom"+b],g&&(h=w[a+"-left"+b])))){var i=[e,f,g,h];for(d=i.length-1;d--&&i[d]===i[d+1];);d>-1&&c||(w[a+b]=d==-1?i[0]:i.join(" "),delete w[a+"-top"+b],delete w[a+"-right"+b],delete w[a+"-bottom"+b],delete w[a+"-left"+b])}}function f(a){var b,c=w[a];if(c){for(c=c.split(" "),b=c.length;b--;)if(c[b]!==c[0])return!1;return w[a]=c[0],!0}}function g(a,b,c,d){f(b)&&f(c)&&f(d)&&(w[a]=w[b]+" "+w[c]+" "+w[d],delete w[b],delete w[c],delete w[d])}function n(a){return v=!0,l[a]}function o(a,b){return v&&(a=a.replace(/\uFEFF[0-9]/g,function(a){return l[a]})),b||(a=a.replace(/\\([\'\";:])/g,"$1")),a}function p(a){return String.fromCharCode(parseInt(a.slice(1),16))}function q(a){return a.replace(/\\[0-9a-f]+/gi,p)}function r(b,
c,d,e,f,g){if(f=f||g)return f=o(f),"'"+f.replace(/\'/g,"\\'")+"'";if(c=o(c||d||e),!a.allow_script_urls){var h=c.replace(/[\s\r\n]+/g,"");if(/(java|vb)script:/i.test(h))return"";if(!a.allow_svg_data_urls&&/^data:image\/svg/i.test(h))return""}return x&&(c=x.call(y,c,"style")),"url('"+c.replace(/\'/g,"\\'")+"')"}var s,t,u,v,w={},x=a.url_converter,y=a.url_converter_scope||this;if(b){for(b=b.replace(/[\u0000-\u001F]/g,""),b=b.replace(/\\[\"\';:\uFEFF]/g,n).replace(/\"[^\"]+\"|\'[^\']+\'/g,function(a){return a.replace(/[;:]/g,n)});s=j.exec(b);)if(j.lastIndex=s.index+s[0].length,t=s[1].replace(k,"").toLowerCase(),u=s[2].replace(k,""),t&&u){if(t=q(t),u=q(u),t.indexOf(m)!==-1||t.indexOf('"')!==-1)continue;if(!a.allow_script_urls&&("behavior"==t||/expression\s*\(|\/\*|\*\//.test(u)))continue;"f
ont-weight"===t&&"700"===u?u="bold":"color"!==t&&"background-color"!==t||(u=u.toLowerCase()),u=u.replace(h,c),u=u.replace(i,r),w[t]=v?o(u,!0):u}e("border","",!0),e("border","-width"),e("border","-color"),e("border","-style"),e("padding",""),e("margin",""),g("border","border-width","border-style","border-color"),"medium none"===w.border&&delete w.border,"none"===w["border-image"]&&delete w["border-image"]}return w},serialize:function(a,b){function c(b){var c,d,e,g;if(c=f[b])for(d=0,e=c.length;d<e;d++)b=c[d],g=a[b],g&&(i+=(i.length>0?" ":"")+b+": "+g+";")}function d(a,b){var c;return c=g["*"],(!c||!c[a])&&(c=g[b],!c||!c[a])}var e,h,i="&q
uot;;if(b&&f)c("*"),c(b);else for(e in a)h=a[e],!h||g&&!d(e,b)||(i+=(i.length>0?" ":"")+e+": "+h+";");return i}}}}),g("tinymce.core.dom.DOMUtils",["tinymce.core.dom.DomQuery","tinymce.core.dom.EventUtils","tinymce.core.dom.Range","tinymce.core.dom.Sizzle","tinymce.core.dom.StyleSheetLoader","tinymce.core.dom.TreeWalker","tinymce.core.Env","tinymce.core.html.Entities","tinymce.core.html.Schema","tinymce.core.html.Styles","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g,h,i,j,k){function l(a,b){var c,d={},e=b.keep_values;return c={set:function(c,d,e){b.url_converter&&(d=b.url_converter.call(b.url_converter_scope||a,d,e,c[0])),c.attr("data-mce-"+e,d).attr(e,d)},get:function(a,b){return a.attr("data-mce-"+b)||a.attr(b)}},d={style:{set:function(a,b){return null!==b&&
;"object"==typeof b?void a.css(b):(e&&a.attr("data-mce-style",b),void a.attr("style",b))},get:function(b){var c=b.attr("data-mce-style")||b.attr("style");return c=a.serializeStyle(a.parseStyle(c),b[0].nodeName)}}},e&&(d.href=d.src=c),d}function m(a,b){var c=b.attr("style");c=a.serializeStyle(a.parseStyle(c),b[0].nodeName),c||(c=null),b.attr("data-mce-style",c)}function n(a,b){var c,d,e=0;if(a)for(c=a.nodeType,a=a.previousSibling;a;a=a.previousSibling)d=a.nodeType,(!b||3!=d||d!=c&&a.nodeValue.length)&&(e++,c=d);return e}function o(c,d){var f,g=this;g.doc=c,g.win=window,g.files={},g.counter=0,g.stdMode=!t||c.documentMode>=8,g.boxModel=!t||"CSS1Compat"==c.compatMode||g.stdMode,g.styleSheetLoader=new e(c),g.boundEvents=[],g.settings=d=d||{},g.schema=d.schema?d.schema:new i({}),g.styles=new j({url_converter:d.url_converter,url_converter_scope:d.url_converter_scope},d.schema)
,g.fixDoc(c),g.events=d.ownEvents?new b(d.proxy):b.Event,g.attrHooks=l(g,d),f=d.schema?d.schema.getBlockElements():{},g.$=a.overrideDefaults(function(){return{context:c,element:g.getRoot()}}),g.isBlock=function(a){if(!a)return!1;var b=a.nodeType;return b?!(1!==b||!f[a.nodeName]):!!f[a]}}var p=k.each,q=k.is,r=k.grep,s=k.trim,t=g.ie,u=/^([a-z0-9],?)+$/i,v=/^[ \t\r\n]*$/;return o.prototype={$$:function(a){return"string"==typeof a&&(a=this.get(a)),this.$(a)},root:null,fixDoc:function(a){var b,c=this.settings;if(t&&c.schema){"abbr article aside audio canvas details figcaption figure footer header hgroup mark menu meter nav output progress section summary time video".replace(/\w+/g,function(b){a.createElement(b)});for(b in c.schema.getCustomElements())a.createElement(b)}},clone:function(a,b){var c,d,e=this;return!t||1!==a.nodeType||b?a.cloneNode(b):(d=e.doc,b?c.firstChild:(c=d.createElement(a.nodeName),p(e.getAttribs(a),function(b){e.setAttrib(c,b.nodeN
ame,e.getAttrib(a,b.nodeName))}),c))},getRoot:function(){var a=this;return a.settings.root_element||a.doc.body},getViewPort:function(a){var b,c;return a=a?a:this.win,b=a.document,c=this.boxModel?b.documentElement:b.body,{x:a.pageXOffset||c.scrollLeft,y:a.pageYOffset||c.scrollTop,w:a.innerWidth||c.clientWidth,h:a.innerHeight||c.clientHeight}},getRect:function(a){var b,c,d=this;return a=d.get(a),b=d.getPos(a),c=d.getSize(a),{x:b.x,y:b.y,w:c.w,h:c.h}},getSize:function(a){var b,c,d=this;return a=d.get(a),b=d.getStyle(a,"width"),c=d.getStyle(a,"height"),b.indexOf("px")===-1&&(b=0),c.indexOf("px")===-1&&(c=0),{w:parseInt(b,10)||a.offsetWidth||a.clientWidth,h:parseInt(c,10)||a.offsetHeight||a.clientHeight}},getParent:function(a,b,c){return this.getParents(a,b,c,!1)},getParents:function(a,b,c,d){var e,f=this,g=[];for(a=f.get(a),d=void 0===d,c=c||("BODY"!=f.getRoot().nodeName?f.getRoot().parentNode:null),q(b,"string"
)&&(e=b,b="*"===b?function(a){return 1==a.nodeType}:function(a){return f.is(a,e)});a&&a!=c&&a.nodeType&&9!==a.nodeType;){if(!b||b(a)){if(!d)return a;g.push(a)}a=a.parentNode}return d?g:null},get:function(a){var b;return a&&this.doc&&"string"==typeof a&&(b=a,a=this.doc.getElementById(a),a&&a.id!==b)?this.doc.getElementsByName(b)[1]:a},getNext:function(a,b){return this._findSib(a,b,"nextSibling")},getPrev:function(a,b){return this._findSib(a,b,"previousSibling")},select:function(a,b){var c=this;return d(a,c.get(b)||c.settings.root_element||c.doc,[])},is:function(a,b){var c;if(!a)return!1;if(void 0===a.length){if("*"===b)return 1==a.nodeType;if(u.test(b)){for(b=b.toLowerCase().split(/,/),a=a.nodeName.toLowerCase(),c=b.length-1;c>=0;c--)if(b[c]==a)return!0;return!1}}if(a.nodeType&&1!=a.nodeType)return!1;var e=a.nodeType?[a]:a;return d(b,e[0].ownerDocument||e[0],nu
ll,e).length>0},add:function(a,b,c,d,e){var f=this;return this.run(a,function(a){var g;return g=q(b,"string")?f.doc.createElement(b):b,f.setAttribs(g,c),d&&(d.nodeType?g.appendChild(d):f.setHTML(g,d)),e?g:a.appendChild(g)})},create:function(a,b,c){return this.add(this.doc.createElement(a),a,b,c,1)},createHTML:function(a,b,c){var d,e="";e+="<"+a;for(d in b)b.hasOwnProperty(d)&&null!==b[d]&&"undefined"!=typeof b[d]&&(e+=" "+d+'="'+this.encode(b[d])+'"');return"undefined"!=typeof c?e+">"+c+"</"+a+">":e+" />"},createFragment:function(a){var b,c,d,e=this.doc;for(d=e.createElement("div"),b=e.createDocumentFragment(),a&&(d.innerHTML=a);c=d.firstChild;)b.appendChild(c);return b},remove:function(a,b){return a=this.$$(a),b?a.each(function(){for(var a;a=this.firstChild;)3==a.nodeType&&0===a.data.length?this.rem
oveChild(a):this.parentNode.insertBefore(a,this)}).remove():a.remove(),a.length>1?a.toArray():a[0]},setStyle:function(a,b,c){a=this.$$(a).css(b,c),this.settings.update_styles&&m(this,a)},getStyle:function(a,b,c){return a=this.$$(a),c?a.css(b):(b=b.replace(/-(\D)/g,function(a,b){return b.toUpperCase()}),"float"==b&&(b=g.ie&&g.ie<12?"styleFloat":"cssFloat"),a[0]&&a[0].style?a[0].style[b]:void 0)},setStyles:function(a,b){a=this.$$(a).css(b),this.settings.update_styles&&m(this,a)},removeAllAttribs:function(a){return this.run(a,function(a){var b,c=a.attributes;for(b=c.length-1;b>=0;b--)a.removeAttributeNode(c.item(b))})},setAttrib:function(a,b,c){var d,e,f=this,g=f.settings;""===c&&(c=null),a=f.$$(a),d=a.attr(b),a.length&&(e=f.attrHooks[b],e&&e.set?e.set(a,c,b):a.attr(b,c),d!=c&&g.onSetAttrib&&g.onSetAttrib({attrElm:a,attrName:b,attrValue:c}))},setAttribs:funct
ion(a,b){var c=this;c.$$(a).each(function(a,d){p(b,function(a,b){c.setAttrib(d,b,a)})})},getAttrib:function(a,b,c){var d,e,f=this;return a=f.$$(a),a.length&&(d=f.attrHooks[b],e=d&&d.get?d.get(a,b):a.attr(b)),"undefined"==typeof e&&(e=c||""),e},getPos:function(b,c){var d,e,f=this,g=0,h=0,i=f.doc,j=i.body;if(b=f.get(b),c=c||j,b){if(c===j&&b.getBoundingClientRect&&"static"===a(j).css("position"))return e=b.getBoundingClientRect(),c=f.boxModel?i.documentElement:j,g=e.left+(i.documentElement.scrollLeft||j.scrollLeft)-c.clientLeft,h=e.top+(i.documentElement.scrollTop||j.scrollTop)-c.clientTop,{x:g,y:h};for(d=b;d&&d!=c&&d.nodeType;)g+=d.offsetLeft||0,h+=d.offsetTop||0,d=d.offsetParent;for(d=b.parentNode;d&&d!=c&&d.nodeType;)g-=d.scrollLeft||0,h-=d.scrollTop||0,d=d.parentNode}return{x:g,y:h}},parseStyle:function(a){return this.styles.parse(a)},serializeStyle:function(a,b){return t
his.styles.serialize(a,b)},addStyle:function(a){var b,c,d=this,e=d.doc;if(d!==o.DOM&&e===document){var f=o.DOM.addedStyles;if(f=f||[],f[a])return;f[a]=!0,o.DOM.addedStyles=f}c=e.getElementById("mceDefaultStyles"),c||(c=e.createElement("style"),c.id="mceDefaultStyles",c.type="text/css",b=e.getElementsByTagName("head")[0],b.firstChild?b.insertBefore(c,b.firstChild):b.appendChild(c)),c.styleSheet?c.styleSheet.cssText+=a:c.appendChild(e.createTextNode(a))},loadCSS:function(a){var b,c=this,d=c.doc;return c!==o.DOM&&d===document?void o.DOM.loadCSS(a):(a||(a=""),b=d.getElementsByTagName("head")[0],void p(a.split(","),function(a){var e;a=k._addCacheSuffix(a),c.files[a]||(c.files[a]=!0,e=c.create("link",{rel:"stylesheet",href:a}),t&&d.documentMode&&d.recalc&&(e.onload=function(){d.recalc&&d.recalc(),e.onload=null}),b.appendChild(e))}))},addClass:
function(a,b){this.$$(a).addClass(b)},removeClass:function(a,b){this.toggleClass(a,b,!1)},hasClass:function(a,b){return this.$$(a).hasClass(b)},toggleClass:function(b,c,d){this.$$(b).toggleClass(c,d).each(function(){""===this.className&&a(this).attr("class",null)})},show:function(a){this.$$(a).show()},hide:function(a){this.$$(a).hide()},isHidden:function(a){return"none"==this.$$(a).css("display")},uniqueId:function(a){return(a?a:"mce_")+this.counter++},setHTML:function(b,c){b=this.$$(b),t?b.each(function(b,d){if(d.canHaveHTML!==!1){for(;d.firstChild;)d.removeChild(d.firstChild);try{d.innerHTML="<br>"+c,d.removeChild(d.firstChild)}catch(e){a("<div></div>").html("<br>"+c).contents().slice(1).appendTo(d)}return c}}):b.html(c)},getOuterHTML:function(b){return b=this.get(b),1==b.nodeType&&"outerHTML"in b?b.outerHTML:a("<div></div>").appen
d(a(b).clone()).html()},setOuterHTML:function(b,c){var d=this;d.$$(b).each(function(){try{if("outerHTML"in this)return void(this.outerHTML=c)}catch(b){}d.remove(a(this).html(c),!0)})},decode:h.decode,encode:h.encodeAllRaw,insertAfter:function(a,b){return b=this.get(b),this.run(a,function(a){var c,d;return c=b.parentNode,d=b.nextSibling,d?c.insertBefore(a,d):c.appendChild(a),a})},replace:function(a,b,c){var d=this;return d.run(b,function(b){return q(b,"array")&&(a=a.cloneNode(!0)),c&&p(r(b.childNodes),function(b){a.appendChild(b)}),b.parentNode.replaceChild(a,b)})},rename:function(a,b){var c,d=this;return a.nodeName!=b.toUpperCase()&&(c=d.create(b),p(d.getAttribs(a),function(b){d.setAttrib(c,b.nodeName,d.getAttrib(a,b.nodeName))}),d.replace(c,a,1)),c||a},findCommonAncestor:function(a,b){for(var c,d=a;d;){for(c=b;c&&d!=c;)c=c.parentNode;if(d==c)break;d=d.parentNode}return!d&&a.ownerDocument?a.ownerDocument.documentElement:d},
toHex:function(a){return this.styles.toHex(k.trim(a))},run:function(a,b,c){var d,e=this;return"string"==typeof a&&(a=e.get(a)),!!a&&(c=c||this,a.nodeType||!a.length&&0!==a.length?b.call(c,a):(d=[],p(a,function(a,f){a&&("string"==typeof a&&(a=e.get(a)),d.push(b.call(c,a,f)))}),d))},getAttribs:function(a){var b;if(a=this.get(a),!a)return[];if(t){if(b=[],"OBJECT"==a.nodeName)return a.attributes;"OPTION"===a.nodeName&&this.getAttrib(a,"selected")&&b.push({specified:1,nodeName:"selected"});var c=/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi;return a.cloneNode(!1).outerHTML.replace(c,"").replace(/[\w:\-]+/gi,function(a){b.push({specified:1,nodeName:a})}),b}return a.attributes},isEmpty:function(a,b){var c,d,e,g,h,i,j=this,k=0;if(a=a.firstChild){h=new f(a,a.parentNode),b=b||(j.schema?j.schema.getNonEmptyElements():null),g=j.schema?j.sch
ema.getWhiteSpaceElements():{};do{if(e=a.nodeType,1===e){var l=a.getAttribute("data-mce-bogus");if(l){a=h.next("all"===l);continue}if(i=a.nodeName.toLowerCase(),b&&b[i]){if("br"===i){k++,a=h.next();continue}return!1}for(d=j.getAttribs(a),c=d.length;c--;)if(i=d[c].nodeName,"name"===i||"data-mce-bookmark"===i)return!1}if(8==e)return!1;if(3===e&&!v.test(a.nodeValue))return!1;if(3===e&&a.parentNode&&g[a.parentNode.nodeName]&&v.test(a.nodeValue))return!1;a=h.next()}while(a)}return k<=1},createRng:function(){var a=this.doc;return a.createRange?a.createRange():new c(this)},nodeIndex:n,split:function(a,b,c){function d(a){function b(a){var b=a.previousSibling&&"SPAN"==a.previousSibling.nodeName,c=a.nextSibling&&"SPAN"==a.nextSibling.nodeName;return b&&c}var c,e=a.childNodes,f=a.nodeType;if(1!=f||"bookmark"!=a.getAttribute("data-mce-type"
)){for(c=e.length-1;c>=0;c--)d(e[c]);if(9!=f){if(3==f&&a.nodeValue.length>0){var g=s(a.nodeValue).length;if(!h.isBlock(a.parentNode)||g>0||0===g&&b(a))return}else if(1==f&&(e=a.childNodes,1==e.length&&e[0]&&1==e[0].nodeType&&"bookmark"==e[0].getAttribute("data-mce-type")&&a.parentNode.insertBefore(e[0],a),e.length||/^(br|hr|input|img)$/i.test(a.nodeName)))return;h.remove(a)}return a}}var e,f,g,h=this,i=h.createRng();if(a&&b)return i.setStart(a.parentNode,h.nodeIndex(a)),i.setEnd(b.parentNode,h.nodeIndex(b)),e=i.extractContents(),i=h.createRng(),i.setStart(b.parentNode,h.nodeIndex(b)+1),i.setEnd(a.parentNode,h.nodeIndex(a)+1),f=i.extractContents(),g=a.parentNode,g.insertBefore(d(e),a),c?g.insertBefore(c,a):g.insertBefore(b,a),g.insertBefore(d(f),a),h.remove(a),c||b},bind:function(a,b,c,d){var e=this;if(k.isArray(a)){for(var f=a.length;f--;)a[f]=e.bind(a[f],b,c,d);return a}return!e.settings.co
llect||a!==e.doc&&a!==e.win||e.boundEvents.push([a,b,c,d]),e.events.bind(a,b,c,d||e)},unbind:function(a,b,c){var d,e=this;if(k.isArray(a)){for(d=a.length;d--;)a[d]=e.unbind(a[d],b,c);return a}if(e.boundEvents&&(a===e.doc||a===e.win))for(d=e.boundEvents.length;d--;){var f=e.boundEvents[d];a!=f[0]||b&&b!=f[1]||c&&c!=f[2]||this.events.unbind(f[0],f[1],f[2])}return this.events.unbind(a,b,c)},fire:function(a,b,c){return this.events.fire(a,b,c)},getContentEditable:function(a){var b;return a&&1==a.nodeType?(b=a.getAttribute("data-mce-contenteditable"),b&&"inherit"!==b?b:"inherit"!==a.contentEditable?a.contentEditable:null):null},getContentEditableParent:function(a){for(var b=this.getRoot(),c=null;a&&a!==b&&(c=this.getContentEditable(a),null===c);a=a.parentNode);return c},destroy:function(){var a=this;if(a.boundEvents){for(var b=a.boundEvents.length;b--;){var c=a.boundEvents[b];this.events.unbind(c
[0],c[1],c[2])}a.boundEvents=null}d.setDocument&&d.setDocument(),a.win=a.doc=a.root=a.events=a.frag=null},isChildOf:function(a,b){for(;a;){if(b===a)return!0;a=a.parentNode}return!1},dumpRng:function(a){return"startContainer: "+a.startContainer.nodeName+", startOffset: "+a.startOffset+", endContainer: "+a.endContainer.nodeName+", endOffset: "+a.endOffset},_findSib:function(a,b,c){var d=this,e=b;if(a)for("string"==typeof e&&(e=function(a){return d.is(a,b)}),a=a[c];a;a=a[c])if(e(a))return a;return null}},o.DOM=new o(document),o.nodeIndex=n,o}),g("tinymce.core.dom.ScriptLoader",["tinymce.core.dom.DOMUtils","tinymce.core.util.Tools"],function(a,b){function c(){function a(a,c,e){function f(){k.remove(j),i&&(i.onreadystatechange=i.onload=i=null),c()}function h(){g(e)?e():"undefined"!=typeof console&&console.log&&console.log("Failed to load script: "+a)
}var i,j,k=d;j=k.uniqueId(),i=document.createElement("script"),i.id=j,i.type="text/javascript",i.src=b._addCacheSuffix(a),"onreadystatechange"in i?i.onreadystatechange=function(){/loaded|complete/.test(i.readyState)&&f()}:i.onload=f,i.onerror=h,(document.getElementsByTagName("head")[0]||document.body).appendChild(i)}var c,h=0,i=1,j=2,k=3,l={},m=[],n={},o=[],p=0;this.isDone=function(a){return l[a]==j},this.markDone=function(a){l[a]=j},this.add=this.load=function(a,b,d,e){var f=l[a];f==c&&(m.push(a),l[a]=h),b&&(n[a]||(n[a]=[]),n[a].push({success:b,failure:e,scope:d||this}))},this.remove=function(a){delete l[a],delete n[a]},this.loadQueue=function(a,b,c){this.loadScripts(m,a,b,c)},this.loadScripts=function(b,d,h,m){function q(a,b){e(n[b],function(b){g(b[a])&&b[a].call(b.scope)}),n[b]=c}var r,s=[];o.push({success:d,failure:m,scope:h||this}),(r=function(){var c=f(b);b.length=0,e(c,function(b){return l[b]===j?void q(&
quot;success",b):l[b]===k?void q("failure",b):void(l[b]!==i&&(l[b]=i,p++,a(b,function(){l[b]=j,p--,q("success",b),r()},function(){l[b]=k,p--,s.push(b),q("failure",b),r()})))}),p||(e(o,function(a){0===s.length?g(a.success)&&a.success.call(a.scope):g(a.failure)&&a.failure.call(a.scope,s)}),o.length=0)})()}}var d=a.DOM,e=b.each,f=b.grep,g=function(a){return"function"==typeof a};return c.ScriptLoader=new c,c}),g("tinymce.core.AddOnManager",["tinymce.core.dom.ScriptLoader","tinymce.core.util.Tools"],function(a,b){function c(){var a=this;a.items=[],a.urls={},a.lookup={}}var d=b.each;return c.prototype={get:function(a){if(this.lookup[a])return this.lookup[a].instance},dependencies:function(a){var b;return this.lookup[a]&&(b=this.lookup[a].dependencies),b||[]},requireLangPack:function(b,d){var e=c.language;if(e&&c.languageLoad!==!1){if(d)if(d=","+d+",",d.ind
exOf(","+e.substr(0,2)+",")!=-1)e=e.substr(0,2);else if(d.indexOf(","+e+",")==-1)return;a.ScriptLoader.add(this.urls[b]+"/langs/"+e+".js")}},add:function(a,b,c){return this.items.push(b),this.lookup[a]={instance:b,dependencies:c},b},remove:function(a){delete this.urls[a],delete this.lookup[a]},createUrl:function(a,b){return"object"==typeof b?b:{prefix:a.prefix,resource:b,suffix:a.suffix}},addComponents:function(b,c){var e=this.urls[b];d(c,function(b){a.ScriptLoader.add(e+"/"+b)})},load:function(b,e,f,g,h){function i(){var c=j.dependencies(b);d(c,function(a){var b=j.createUrl(e,a);j.load(b.resource,b,void 0,void 0)}),f&&(g?f.call(g):f.call(a))}var j=this,k=e;j.urls[b]||("object"==typeof e&&(k=e.prefix+e.resource+e.suffix),0!==k.indexOf("/")&&k.indexOf("://")==-1&&(k=c.baseURL+"/"+k),j.urls[b]=k.substring(0,k.lastIndexOf("/")
),j.lookup[b]?i():a.ScriptLoader.add(k,i,g,h))}},c.PluginManager=new c,c.ThemeManager=new c,c}),g("ephox.katamari.api.Cell",[],function(){var a=function(b){var c=b,d=function(){return c},e=function(a){c=a},f=function(){return a(d())};return{get:d,set:e,clone:f}};return a}),g("tinymce.core.dom.NodeType",[],function(){function a(a){return function(b){return!!b&&b.nodeType==a}}function b(a){return a=a.toLowerCase().split(" "),function(b){var c,d;if(b&&b.nodeType)for(d=b.nodeName.toLowerCase(),c=0;c<a.length;c++)if(d===a[c])return!0;return!1}}function c(a,b){return b=b.toLowerCase().split(" "),function(c){var d,e;if(i(c))for(d=0;d<b.length;d++)if(e=c.ownerDocument.defaultView.getComputedStyle(c,null).getPropertyValue(a),e===b[d])return!0;return!1}}function d(a,b){return function(c){return i(c)&&c[a]===b}}function e(a,b){return function(b){return i(b)&&b.hasAttribute(a)}}function f(a,b){return function(c){retur
n i(c)&&c.getAttribute(a)===b}}function g(a){return i(a)&&a.hasAttribute("data-mce-bogus")}function h(a){return function(b){if(i(b)){if(b.contentEditable===a)return!0;if(b.getAttribute("data-mce-contenteditable")===a)return!0}return!1}}var i=a(1);return{isText:a(3),isElement:i,isComment:a(8),isBr:b("br"),isContentEditableTrue:h("true"),isContentEditableFalse:h("false"),matchNodeNames:b,hasPropValue:d,hasAttribute:e,hasAttributeValue:f,matchStyleValues:c,isBogus:g}}),g("tinymce.core.util.Fun",[],function(){function a(a){return function(){return a}}function b(a){return function(b){return!a(b)}}function c(a,b){return function(c){return a(b(c))}}function d(){var a=h.call(arguments);return function(b){for(var c=0;c<a.length;c++)if(a[c](b))return!0;return!1}}function e(){var a=h.call(arguments);return function(b){for(var c=0;c<a.length;c++)if(!a[c](b))return!1;return!0}}function f(a){var b=h.call(arguments);
return b.length-1>=a.length?a.apply(this,b.slice(1)):function(){var a=b.concat([].slice.call(arguments));return f.apply(this,a)}}function g(){}var h=[].slice;return{constant:a,negate:b,and:e,or:d,curry:f,compose:c,noop:g}}),g("tinymce.core.text.Zwsp",[],function(){var a="\ufeff",b=function(b){return b===a},c=function(b){return b.replace(new RegExp(a,"g"),"")};return{isZwsp:b,ZWSP:a,trim:c}}),g("tinymce.core.caret.CaretContainer",["tinymce.core.dom.NodeType","tinymce.core.text.Zwsp"],function(a,b){function c(a){return n(a)&&(a=a.parentNode),m(a)&&a.hasAttribute("data-mce-caret")}function d(a){return n(a)&&b.isZwsp(a.data)}function e(a){return c(a)||d(a)}function f(a,c){var d,f,g,h;if(d=a.ownerDocument,g=d.createTextNode(b.ZWSP),h=a.parentNode,c){if(f=a.previousSibling,n(f)){if(e(f))return f;if(j(f))return f.splitText(f.data.length-1)}h.insertBefore(g,a)}else{if(f=a.nextSibling,n
(f)){if(e(f))return f;if(i(f))return f.splitText(1),f}a.nextSibling?h.insertBefore(g,a.nextSibling):h.appendChild(g)}return g}function g(){var a=document.createElement("br");return a.setAttribute("data-mce-bogus","1"),a}function h(a,b,c){var d,e,f;return d=b.ownerDocument,e=d.createElement(a),e.setAttribute("data-mce-caret",c?"before":"after"),e.setAttribute("data-mce-bogus","all"),e.appendChild(g()),f=b.parentNode,c?f.insertBefore(e,b):b.nextSibling?f.insertBefore(e,b.nextSibling):f.appendChild(e),e}function i(a){return n(a)&&a.data[0]==b.ZWSP}function j(a){return n(a)&&a.data[a.data.length-1]==b.ZWSP}function k(b){var c=b.getElementsByTagName("br"),d=c[c.length-1];a.isBogus(d)&&d.parentNode.removeChild(d)}function l(a){return a&&a.hasAttribute("data-mce-caret")?(k(a),a.removeAttribute("data-mce-caret"),a.removeAttribute("data-mce-bogus&
quot;),a.removeAttribute("style"),a.removeAttribute("_moz_abspos"),a):null}var m=a.isElement,n=a.isText,o=function(b){return b.firstChild!==b.lastChild||!a.isBr(b.firstChild)},p=function(c){if(a.isText(c)){var d=c.data;return d.length>0&&d.charAt(0)!==b.ZWSP&&c.insertData(0,b.ZWSP),c}return null},q=function(c){if(a.isText(c)){var d=c.data;return d.length>0&&d.charAt(d.length-1)!==b.ZWSP&&c.insertData(d.length,b.ZWSP),c}return null},r=function(c){return c&&a.isText(c.container())&&c.container().data.charAt(c.offset())===b.ZWSP},s=function(c){return c&&a.isText(c.container())&&c.container().data.charAt(c.offset()-1)===b.ZWSP};return{isCaretContainer:e,isCaretContainerBlock:c,isCaretContainerInline:d,showCaretContainerBlock:l,insertInline:f,prependInline:p,appendInline:q,isBeforeInline:r,isAfterInline:s,insertBlock:h,hasContent:o,startsWithCaretContainer:i,endsWithCaretContainer:j}}),g("tinym
ce.core.dom.RangeUtils",["tinymce.core.util.Tools","tinymce.core.dom.TreeWalker","tinymce.core.dom.NodeType","tinymce.core.dom.Range","tinymce.core.caret.CaretContainer"],function(a,b,c,d,e){function f(a){return q(a)||r(a)}function g(a,b){var c=a.childNodes;return b--,b>c.length-1?b=c.length-1:b<0&&(b=0),c[b]||a}function h(a,b,c){for(;a&&a!==b;){if(c(a))return a;a=a.parentNode}return null}function i(a,b,c){return null!==h(a,b,c)}function j(a,b,c){return i(a,b,function(a){return a.nodeName===c})}function k(a){return"_mce_caret"===a.id}function l(a,b){return s(a)&&i(a,b,k)===!1}function m(a){this.walk=function(b,c){function d(a){var b;return b=a[0],3===b.nodeType&&b===q&&r>=b.nodeValue.length&&a.splice(0,1),
-b=a[a.length-1],0===t&&a.length>0&&b===s&&3===b.nodeType&&a.splice(a.length-1,1),a}function e(a,b,c){for(var d=[];a&&a!=c;a=a[b])d.push(a);return d}function f(a,b){do{if(a.parentNode==b)return a;a=a.parentNode}while(a)}function h(a,b,f){var g=f?"nextSibling":"previousSibling";for(l=a,m=l.parentNode;l&&l!=b;l=m)m=l.parentNode,n=e(l==a?l:l[g],g),n.length&&(f||n.reverse(),c(d(n)))}var i,j,k,l,m,n,o,q=b.startContainer,r=b.startOffset,s=b.endContainer,t=b.endOffset;if(o=a.select("td[data-mce-selected],th[data-mce-selected]"),o.length>0)return void p(o,function(a){c([a])});if(1==q.nodeType&&q.hasChildNodes()&&(q=q.childNodes[r]),1==s.nodeType&&s.hasChildNodes()&&(s=g(s,t)),q==s)return c(d([q]));for(i=a.findCommonAncestor(q,s),l=q;l;l=l.parentNode){if(l===s)return h(q,i,!0);if(l===i)break}for(l=s;l;l=l.parentNode){if(l===q)return h(s,i);if(l===i)break}j=f(q,i)||q,k=f(
s,i)||s,h(q,j,!0),n=e(j==q?j:j.nextSibling,"nextSibling",k==s?k.nextSibling:k),n.length&&c(d(n)),h(s,k)},this.split=function(a){function b(a,b){return a.splitText(b)}var c=a.startContainer,d=a.startOffset,e=a.endContainer,f=a.endOffset;return c==e&&3==c.nodeType?d>0&&d<c.nodeValue.length&&(e=b(c,d),c=e.previousSibling,f>d?(f-=d,c=e=b(e,f).previousSibling,f=e.nodeValue.length,d=0):f=0):(3==c.nodeType&&d>0&&d<c.nodeValue.length&&(c=b(c,d),d=0),3==e.nodeType&&f>0&&f<e.nodeValue.length&&(e=b(e,f).previousSibling,f=e.nodeValue.length)),{startContainer:c,startOffset:d,endContainer:e,endOffset:f}},this.normalize=function(c){function d(d){function g(a){return a&&/^(TD|TH|CAPTION)$/.test(a.nodeName)}function h(c,d){for(var e=new b(c,a.getParent(c.parentNode,a.isBlock)||w);c=e[d?"prev":"next"]();)if("BR"===c.nodeName)return!0}function i(a){for(;a
&&a!=w;){if(r(a))return!0;a=a.parentNode}return!1}function k(a,b){return a.previousSibling&&a.previousSibling.nodeName==b}function m(c,d){var g,h,i;if(d=d||n,i=a.getParent(d.parentNode,a.isBlock)||w,c&&"BR"==d.nodeName&&v&&a.isEmpty(i))return n=d.parentNode,o=a.nodeIndex(d),void(f=!0);for(g=new b(d,i);q=g[c?"prev":"next"]();){if("false"===a.getContentEditableParent(q)||l(q,a.getRoot()))return;if(3===q.nodeType&&q.nodeValue.length>0)return void(j(q,w,"A")===!1&&(n=q,o=c?q.nodeValue.length:0,f=!0));if(a.isBlock(q)||t[q.nodeName.toLowerCase()])return;h=q}e&&h&&(n=h,f=!0,o=0)}var n,o,p,q,t,u,v,w=a.getRoot();if(n=c[(d?"start":"end")+"Container"],o=c[(d?"start":"end")+"Offset"],v=1==n.nodeType&&o===n.childNodes.length,t=a.schema.getNonEmptyElements(),u=d,!s(n)){if(1==n.nodeType&&o>n.child
Nodes.length-1&&(u=!1),9===n.nodeType&&(n=a.getRoot(),o=0),n===w){if(u&&(q=n.childNodes[o>0?o-1:0])){if(s(q))return;if(t[q.nodeName]||"TABLE"==q.nodeName)return}if(n.hasChildNodes()){if(o=Math.min(!u&&o>0?o-1:o,n.childNodes.length-1),n=n.childNodes[o],o=0,!e&&n===w.lastChild&&"TABLE"===n.nodeName)return;if(i(n)||s(n))return;if(n.hasChildNodes()&&!/TABLE/.test(n.nodeName)){q=n,p=new b(n,w);do{if(r(q)||s(q)){f=!1;break}if(3===q.nodeType&&q.nodeValue.length>0){o=u?0:q.nodeValue.length,n=q,f=!0;break}if(t[q.nodeName.toLowerCase()]&&!g(q)){o=a.nodeIndex(q),n=q.parentNode,"IMG"!==q.nodeName&&"PRE"!==q.nodeName||u||o++,f=!0;break}}while(q=u?p.next():p.prev())}}}e&&(3===n.nodeType&&0===o&&m(!0),1===n.nodeType&&(q=n.childNodes[o],q||(q=n.childNodes[o-1]),!q||"BR"!==q.nodeName||k(q,"A")||h(q)||h(q,!0)||m(!0,q))),u&
amp;&!e&&3===n.nodeType&&o===n.nodeValue.length&&m(!1),f&&c["set"+(d?"Start":"End")](n,o)}}var e,f=!1;return e=c.collapsed,d(!0),e||d(),f&&e&&c.collapse(!0),f}}function n(b,c,d){var e,f,g;if(e=d.elementFromPoint(b,c),f=d.body.createTextRange(),e&&"HTML"!=e.tagName||(e=d.body),f.moveToElementText(e),g=a.toArray(f.getClientRects()),g=g.sort(function(a,b){return a=Math.abs(Math.max(a.top-c,a.bottom-c)),b=Math.abs(Math.max(b.top-c,b.bottom-c)),a-b}),g.length>0){c=(g[0].bottom+g[0].top)/2;try{return f.moveToPoint(b,c),f.collapse(!0),f}catch(h){}}return null}function o(a,b){var c=a&&a.parentElement?a.parentElement():null;return r(h(c,b,f))?null:a}var p=a.each,q=c.isContentEditableTrue,r=c.isContentEditableFalse,s=e.isCaretContainer;return m.compareRanges=function(a,b){if(a&&b){if(!a.item&&!a.duplicate)return a.startContainer==b.startContainer&&a.startOffse
t==b.startOffset;if(a.item&&b.item&&a.item(0)===b.item(0))return!0;if(a.isEqual&&b.isEqual&&b.isEqual(a))return!0}return!1},m.getCaretRangeFromPoint=function(a,b,c){var d,e;if(c.caretPositionFromPoint)e=c.caretPositionFromPoint(a,b),d=c.createRange(),d.setStart(e.offsetNode,e.offset),d.collapse(!0);else if(c.caretRangeFromPoint)d=c.caretRangeFromPoint(a,b);else if(c.body.createTextRange){d=c.body.createTextRange();try{d.moveToPoint(a,b),d.collapse(!0)}catch(f){d=n(a,b,c)}return o(d,c.body)}return d},m.getSelectedNode=function(a){var b=a.startContainer,c=a.startOffset;return b.hasChildNodes()&&a.endOffset==c+1?b.childNodes[c]:null},m.getNode=function(a,b){return 1===a.nodeType&&a.hasChildNodes()&&(b>=a.childNodes.length&&(b=a.childNodes.length-1),a=a.childNodes[b]),a},m}),g("tinymce.core.caret.CaretCandidate",["tinymce.core.dom.NodeType","tinymce.core.util.Arr","tinymce.core.caret.Ca
retContainer"],function(a,b,c){function d(a){return!p(a)&&(l(a)?!m(a.parentNode):n(a)||k(a)||o(a)||j(a))}function e(a,b){for(a=a.parentNode;a&&a!=b;a=a.parentNode){if(j(a))return!1;if(i(a))return!0}return!0}function f(a){return!!j(a)&&b.reduce(a.getElementsByTagName("*"),function(a,b){return a||i(b)},!1)!==!0}function g(a){return n(a)||f(a)}function h(a,b){return d(a)&&e(a,b)}var i=a.isContentEditableTrue,j=a.isContentEditableFalse,k=a.isBr,l=a.isText,m=a.matchNodeNames("script style textarea"),n=a.matchNodeNames("img input textarea hr iframe video audio object"),o=a.matchNodeNames("table"),p=c.isCaretContainer;return{isCaretCandidate:d,isInEditable:e,isAtomic:g,isEditableCaretCandidate:h}}),g("tinymce.core.geom.ClientRect",[],function(){function a(a){return a?{left:k(a.left),top:k(a.top),bottom:k(a.bottom),right:k(a.right),width:k(a.width),height:k(a.height)}:{left:0,top:0,bottom:0,right:0,width:
0,height:0}}function b(b,c){return b=a(b),c?b.right=b.left:(b.left=b.left+b.width,b.right=b.left),b.width=0,b}function c(a,b){return a.left===b.left&&a.top===b.top&&a.bottom===b.bottom&&a.right===b.right}function d(a,b,c){return a>=0&&a<=Math.min(b.height,c.height)/2}function e(a,b){return a.bottom-a.height/2<b.top||!(a.top>b.bottom)&&d(b.top-a.bottom,a,b)}function f(a,b){return a.top>b.bottom||!(a.bottom<b.top)&&d(b.bottom-a.top,a,b)}function g(a,b){return a.left<b.left}function h(a,b){return a.right>b.right}function i(a,b){return e(a,b)?-1:f(a,b)?1:g(a,b)?-1:h(a,b)?1:0}function j(a,b,c){return b>=a.left&&b<=a.right&&c>=a.top&&c<=a.bottom}var k=Math.round;return{clone:a,collapse:b,isEqual:c,isAbove:e,isBelow:f,isLeft:g,isRight:h,compare:i,containsXY:j}}),g("tinymce.core.text.ExtendingChar",[],function(){function a(a){return"string"==typeof a&&a.cha
rCodeAt(0)>=768&&b.test(a)}var b=new RegExp("[\u0300-\u036f\u0483-\u0487\u0488-\u0489\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e3-\u0902\u093a\u093c\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2-\u09e3\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62-\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c00\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0c81\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc-\u0ccd\u0cd5-\u0cd6\u0ce2-\u0ce3\u0d01\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62-\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u
0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1ab0-\u1abd\u1abe\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab-\u1bad\u1be6\u1be8-\u1be9\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1cf8-\u1cf9\u1dc0-\u1df5\u1dfc-\u1dff\u200c-\u200d\u20d0-\u20dc\u20dd-\u20e0\u20e1\u20e2-\u20e4\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302d\u302e-\u302f\u3099-\u309a\ua66f\ua670-\ua672\ua674-\ua67d\ua69e-\ua69f\ua6f0-\ua6f1\ua80
2\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\ua9e5\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaa7c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\uff9e-\uff9f]");return{isExtendingChar:a}}),g("tinymce.core.caret.CaretPosition",["tinymce.core.util.Fun","tinymce.core.dom.NodeType","tinymce.core.dom.DOMUtils","tinymce.core.dom.RangeUtils","tinymce.core.caret.CaretCandidate","tinymce.core.geom.ClientRect","tinymce.core.text.ExtendingChar"],function(a,b,c,d,e,f,g){function h(a){return"createRange"in a?a.createRange():c.DOM.createRng()}function i(a){return a&&/[\r\n\t ]/.test(a)}function j(a){var b,c=a.startContainer,d=a.startOffset;return!!(i(a.toString())&&r(c.parentNode)&&(b=c.data,i(b[d-1])||i(b[d+1])))}function k(a){functi
on b(a){var b,c=a.ownerDocument,d=h(c),e=c.createTextNode("\xa0"),g=a.parentNode;return g.insertBefore(e,a),d.setStart(e,0),d.setEnd(e,1),b=f.clone(d.getBoundingClientRect()),g.removeChild(e),b}function c(a){var c,d;return d=a.getClientRects(),c=d.length>0?f.clone(d[0]):f.clone(a.getBoundingClientRect()),t(a)&&0===c.left?b(a):c}function d(a,b){return a=f.collapse(a,b),a.width=1,a.right=a.left+1,a}function e(a){0!==a.height&&(n.length>0&&f.isEqual(a,n[n.length-1])||n.push(a))}function i(a,b){var f=h(a.ownerDocument);if(b<a.data.length){if(g.isExtendingChar(a.data[b]))return n;if(g.isExtendingChar(a.data[b-1])&&(f.setStart(a,b),f.setEnd(a,b+1),!j(f)))return e(d(c(f),!1)),n}b>0&&(f.setStart(a,b-1),f.setEnd(a,b),j(f)||e(d(c(f),!1))),b<a.data.length&&(f.setStart(a,b),f.setEnd(a,b+1),j(f)||e(d(c(f),!0)))}var k,l,n=[];if(s(a.container()))return i(a.container(),a.offset()),n;if(m(a.container()))if(a.isAtEnd())l=v(a.con
tainer(),a.offset()),s(l)&&i(l,l.data.length),q(l)&&!t(l)&&e(d(c(l),!1));else{if(l=v(a.container(),a.offset()),s(l)&&i(l,0),q(l)&&a.isAtEnd())return e(d(c(l),!1)),n;k=v(a.container(),a.offset()-1),q(k)&&!t(k)&&(o(k)||o(l)||!q(l))&&e(d(c(k),!1)),q(l)&&e(d(c(l),!0))}return n}function l(b,c,d){function e(){return s(b)?0===c:0===c}function f(){return s(b)?c>=b.data.length:c>=b.childNodes.length}function g(){var a;return a=h(b.ownerDocument),a.setStart(b,c),a.setEnd(b,c),a}function i(){return d||(d=k(new l(b,c))),d}function j(){return i().length>0}function m(a){return a&&b===a.container()&&c===a.offset()}function n(a){return v(b,a?c-1:c)}return{container:a.constant(b),offset:a.constant(c),toRange:g,getClientRects:i,isVisible:j,isAtStart:e,isAtEnd:f,isEqual:m,getNode:n}}var m=b.isElement,n=e.isCaretCandidate,o=b.matchStyleValues("display","block table"),p=b.matchStyleValues
("float","left right"),q=a.and(m,n,a.negate(p)),r=a.negate(b.matchStyleValues("white-space","pre pre-line pre-wrap")),s=b.isText,t=b.isBr,u=c.nodeIndex,v=d.getNode;return l.fromRangeStart=function(a){return new l(a.startContainer,a.startOffset)},l.fromRangeEnd=function(a){return new l(a.endContainer,a.endOffset)},l.after=function(a){return new l(a.parentNode,u(a)+1)},l.before=function(a){return new l(a.parentNode,u(a))},l.isAtStart=function(a){return!!a&&a.isAtStart()},l.isAtEnd=function(a){return!!a&&a.isAtEnd()},l.isTextPosition=function(a){return!!a&&b.isText(a.container())},l}),g("tinymce.core.caret.CaretBookmark",["tinymce.core.dom.NodeType","tinymce.core.dom.DOMUtils","tinymce.core.util.Fun","tinymce.core.util.Arr","tinymce.core.caret.CaretPosition"],function(a,b,c,d,e){function f(a){var b=a.parentNode;return r(b)?f(b):b}function g(a){return a?d.reduce(a.
childNodes,function(a,b){return r(b)&&"BR"!=b.nodeName?a=a.concat(g(b)):a.push(b),a},[]):[]}function h(a,b){for(;(a=a.previousSibling)&&q(a);)b+=a.data.length;return b}function i(a){return function(b){return a===b}}function j(b){var c,e,h;return c=g(f(b)),e=d.findIndex(c,i(b),b),c=c.slice(0,e+1),h=d.reduce(c,function(a,b,d){return q(b)&&q(c[d-1])&&a++,a},0),c=d.filter(c,a.matchNodeNames(b.nodeName)),e=d.findIndex(c,i(b),b),e-h}function k(a){var b;return b=q(a)?"text()":a.nodeName.toLowerCase(),b+"["+j(a)+"]"}function l(a,b,c){var d=[];for(b=b.parentNode;b!=a&&(!c||!c(b));b=b.parentNode)d.push(b);return d}function m(b,e){var f,g,i,j,m,n=[];return f=e.container(),g=e.offset(),q(f)?i=h(f,g):(j=f.childNodes,g>=j.length?(i="after",g=j.length-1):i="before",f=j[g]),n.push(k(f)),m=l(b,f),m=d.filter(m,c.negate(a.isBogus)),n=n.concat(d.map(m,function(a){return k(a)})),n.reverse().join("
/")+","+i}function n(b,c,e){var f=g(b);return f=d.filter(f,function(a,b){return!q(a)||!q(f[b-1])}),f=d.filter(f,a.matchNodeNames(c)),f[e]}function o(a,b){for(var c,d=a,f=0;q(d);){if(c=d.data.length,b>=f&&b<=f+c){a=d,b-=f;break}if(!q(d.nextSibling)){a=d,b=c;break}f+=c,d=d.nextSibling}return b>a.data.length&&(b=a.data.length),new e(a,b)}function p(a,b){var c,f,g;return b?(c=b.split(","),b=c[0].split("/"),g=c.length>1?c[1]:"before",f=d.reduce(b,function(a,b){return(b=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(b))?("text()"===b[1]&&(b[1]="#text"),n(a,b[1],parseInt(b[2],10))):null},a),f?q(f)?o(f,parseInt(g,10)):(g="after"===g?s(f)+1:s(f),new e(f.parentNode,g)):null):null}var q=a.isText,r=a.isBogus,s=b.nodeIndex;return{create:m,resolve:p}}),g("tinymce.core.dom.BookmarkManager",["tinymce.core.caret.CaretBookmark","tinymce.core.caret.CaretContainer","tinymc
e.core.caret.CaretPosition","tinymce.core.dom.NodeType","tinymce.core.dom.RangeUtils","tinymce.core.Env","tinymce.core.text.Zwsp","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g,h){function i(g){var i=g.dom;this.getBookmark=function(f,m){function n(a,b){var c=0;return h.each(i.select(a),function(a){if("all"!==a.getAttribute("data-mce-bogus"))return a!=b&&void c++}),c}function o(a){function b(b){var c,d,e,f=b?"start":"end";c=a[f+"Container"],d=a[f+"Offset"],1==c.nodeType&&"TR"==c.nodeName&&(e=c.childNodes,c=e[Math.min(b?d:d-1,e.length-1)],c&&(d=b?0:c.childNodes.length,a["set"+(b?"Start":"End")](c,d)))}return b(!0),b(),a}function p(a){function b(a,b){var d,e=a[b?"startContainer":"endContainer"],f=a[b?"startOffset":"endOffset"],g=[],h=0;for(3===e.nodeType?g.pus
h(m?k(e,f):f):(d=e.childNodes,f>=d.length&&d.length&&(h=1,f=Math.max(0,d.length-1)),g.push(i.nodeIndex(d[f],m)+h));e&&e!=c;e=e.parentNode)g.push(i.nodeIndex(e,m));return g}var c=i.getRoot(),d={};return d.start=b(a,!0),g.isCollapsed()||(d.end=b(a)),d}function q(a){function c(a,c){var f;if(d.isElement(a)&&(a=e.getNode(a,c),j(a)))return a;if(b.isCaretContainer(a)){if(d.isText(a)&&b.isCaretContainerBlock(a)&&(a=a.parentNode),f=a.previousSibling,j(f))return f;if(f=a.nextSibling,j(f))return f}}return c(a.startContainer,a.startOffset)||c(a.endContainer,a.endOffset)}var r,s,t,u,v,w,x,y="";if(2==f)return w=g.getNode(),v=w?w.nodeName:null,r=g.getRng(),j(w)||"IMG"==v?{name:v,index:n(v,w)}:g.tridentSel?g.tridentSel.getBookmark(f):(w=q(r),w?(v=w.tagName,{name:v,index:n(v,w)}):p(r));if(3==f)return r=g.getRng(),{start:a.create(i.getRoot(),c.fromRangeStart(r)),end:a.create(i.getRoot(),c.fromRangeEnd(r))};if(f)return{
rng:g.getRng()};if(r=g.getRng(),t=i.uniqueId(),u=g.isCollapsed(),x="overflow:hidden;line-height:0px",r.duplicate||r.item){if(r.item)return w=r.item(0),v=w.nodeName,{name:v,index:n(v,w)};s=r.duplicate();try{r.collapse(),r.pasteHTML('<span data-mce-type="bookmark" id="'+t+'_start" style="'+x+'">'+y+"</span>"),u||(s.collapse(!1),r.moveToElementText(s.parentElement()),0===r.compareEndPoints("StartToEnd",s)&&s.move("character",-1),s.pasteHTML('<span data-mce-type="bookmark" id="'+t+'_end" style="'+x+'">'+y+"</span>"))}catch(z){return null}}else{if(w=g.getNode(),v=w.nodeName,"IMG"==v)return{name:v,index:n(v,w)};if(s=o(r.cloneRange()),!u){s.collapse(!1);var A=i.create("span",{"data-mce-type":"bookmark",id:t+"_end",style:x},y);s.insertNode(A),l(A.nextSibling)}r=o(r),r.collapse(!0);var B=i.create("
span",{"data-mce-type":"bookmark",id:t+"_start",style:x},y);r.insertNode(B),l(B.previousSibling)}return g.moveToBookmark({id:t,keep:1}),{id:t}},this.moveToBookmark=function(b){function c(a){var c,d,e,f,g=b[a?"start":"end"];if(g){for(e=g[0],d=l,c=g.length-1;c>=1;c--){if(f=d.childNodes,g[c]>f.length-1)return;d=f[g[c]]}3===d.nodeType&&(e=Math.min(g[0],d.nodeValue.length)),1===d.nodeType&&(e=Math.min(g[0],d.childNodes.length)),a?k.setStart(d,e):k.setEnd(d,e)}return!0}function d(a){var c,d,e,g,j=i.get(b.id+"_"+a),k=b.keep;if(j&&(c=j.parentNode,"start"==a?(k?(c=j.firstChild,d=1):d=i.nodeIndex(j),m=n=c,o=p=d):(k?(c=j.firstChild,d=1):d=i.nodeIndex(j),n=c,p=d),!k)){for(g=j.previousSibling,e=j.nextSibling,h.each(h.grep(j.childNodes),function(a){3==a.nodeType&&(a.nodeValue=a.nodeValue.replace(/\uFEFF/g,""))});j=i.get(b.id+"_"+a);)i.remove(j,1);g&&e&&a
mp;g.nodeType==e.nodeType&&3==g.nodeType&&!f.opera&&(d=g.nodeValue.length,g.appendData(e.nodeValue),i.remove(e),"start"==a?(m=n=g,o=p=d):(n=g,p=d))}}function e(a){return!i.isBlock(a)||a.innerHTML||f.ie||(a.innerHTML='<br data-mce-bogus="1" />'),a}function j(){var c,d;return c=i.createRng(),d=a.resolve(i.getRoot(),b.start),c.setStart(d.container(),d.offset()),d=a.resolve(i.getRoot(),b.end),c.setEnd(d.container(),d.offset()),c}var k,l,m,n,o,p;if(b)if(h.isArray(b.start)){if(k=i.createRng(),l=i.getRoot(),g.tridentSel)return g.tridentSel.moveToBookmark(b);c(!0)&&c()&&g.setRng(k)}else"string"==typeof b.start?g.setRng(j(b)):b.id?(d("start"),d("end"),m&&(k=i.createRng(),k.setStart(e(m),o),k.setEnd(e(n),p),g.setRng(k))):b.name?g.select(i.select(b.name)[b.index]):b.rng&&g.setRng(b.rng)}}var j=d.isContentEditableFalse,k=function(a,b){var c,d;for(d=g.trim(a.data.slice(0,b)).length,c=a
.previousSibling;c&&3===c.nodeType;c=c.previousSibling)d+=g.trim(c.data).length;return d},l=function(a){d.isText(a)&&0===a.data.length&&a.parentNode.removeChild(a)};return i.isBookmarkNode=function(a){return a&&"SPAN"===a.tagName&&"bookmark"===a.getAttribute("data-mce-type")},i}),g("tinymce.core.caret.CaretUtils",["tinymce.core.util.Fun","tinymce.core.dom.TreeWalker","tinymce.core.dom.NodeType","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretCandidate"],function(a,b,c,d,e,f){function g(a){return a>0}function h(a){return a<0}function i(a,b){for(var c;c=a(b);)if(!y(c))return c;return null}function j(a,c,d,e,f){var j=new b(a,e);if(h(c)){if((v(a)||y(a))&&(a=i(j.prev,!0),d(a)))return a;for(;a=i(j.prev,f);)if(d(a))return a}if(g(c)){if((v(a)||y(a))&&(a=i(j.next,!0),d(a)))return a;for
(;a=i(j.next,f);)if(d(a))return a}return null}function k(a,b){for(a=a.parentNode;a&&a!=b;a=a.parentNode)if(u(a))return a;return b}function l(a,b){for(;a&&a!=b;){if(w(a))return a;a=a.parentNode}return null}function m(a,b,c){return l(a.container(),c)==l(b.container(),c)}function n(a,b,c){return k(a.container(),c)==k(b.container(),c)}function o(a,b){var c,d;return b?(c=b.container(),d=b.offset(),A(c)?c.childNodes[d+a]:null):null}function p(a,b){var c=b.ownerDocument.createRange();return a?(c.setStartBefore(b),c.setEndBefore(b)):(c.setStartAfter(b),c.setEndAfter(b)),c}function q(a,b,c){return l(b,a)==l(c,a)}function r(a,b,c){var d,e;for(e=a?"previousSibling":"nextSibling";c&&c!=b;){if(d=c[e],x(d)&&(d=d[e]),v(d)){if(q(b,d,c))return d;break}if(B(d))break;c=c.parentNode}return null}function s(a,b,d){var f,g,h,i,j=z(r,!0,b),k=z(r,!1,b);if(g=d.startContainer,h=d.startOffset,e.isCaretContainerBlock(g)){if(A(g)||(g=g.parentNode),i=g.getAttrib
ute("data-mce-caret"),"before"==i&&(f=g.nextSibling,v(f)))return C(f);if("after"==i&&(f=g.previousSibling,v(f)))return D(f)}if(!d.collapsed)return d;if(c.isText(g)){if(x(g)){if(1===a){if(f=k(g))return C(f);if(f=j(g))return D(f)}if(a===-1){if(f=j(g))return D(f);if(f=k(g))return C(f)}return d}if(e.endsWithCaretContainer(g)&&h>=g.data.length-1)return 1===a&&(f=k(g))?C(f):d;if(e.startsWithCaretContainer(g)&&h<=1)return a===-1&&(f=j(g))?D(f):d;if(h===g.data.length)return f=k(g),f?C(f):d;if(0===h)return f=j(g),f?D(f):d}return d}function t(a,b){return v(o(a,b))}var u=c.isContentEditableTrue,v=c.isContentEditableFalse,w=c.matchStyleValues("display","block table table-cell table-caption list-item"),x=e.isCaretContainer,y=e.isCaretContainerBlock,z=a.curry,A=c.isElement,B=f.isCaretCandidate,C=z(p,!0),D=z(p,!1);return{isForwards:g,isBackwards:h,findNode:j,getEditingHost:k,getParentBlock:l,isI
nSameBlock:m,isInSameEditingHost:n,isBeforeContentEditableFalse:z(t,0),isAfterContentEditableFalse:z(t,-1),normalizeRange:s}}),g("tinymce.core.caret.CaretWalker",["tinymce.core.dom.NodeType","tinymce.core.caret.CaretCandidate","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretUtils","tinymce.core.util.Arr","tinymce.core.util.Fun"],function(a,b,c,d,e,f){function g(a,b){for(var c=[];a&&a!=b;)c.push(a),a=a.parentNode;return c}function h(a,b){return a.hasChildNodes()&&b<a.childNodes.length?a.childNodes[b]:null}function i(a,b){if(p(a)){if(r(b.previousSibling)&&!m(b.previousSibling))return c.before(b);if(m(b))return c(b,0)}if(q(a)){if(r(b.nextSibling)&&!m(b.nextSibling))return c.after(b);if(m(b))return c(b,b.data.length)}return q(a)?o(b)?c.before(b):c.after(b):c.before(b)}function j(b,e){var f;return!!a.isBr(b)&&(f=k(1,c.after(b),e),!!f&&!d.isInSameBlock(c.bef
ore(b),c.before(f),e))}function k(a,b,u){var v,w,x,y,z,A,B;if(!n(u)||!b)return null;if(b.isEqual(c.after(u))&&u.lastChild){if(B=c.after(u.lastChild),q(a)&&r(u.lastChild)&&n(u.lastChild))return o(u.lastChild)?c.before(u.lastChild):B}else B=b;if(v=B.container(),w=B.offset(),m(v)){if(q(a)&&w>0)return c(v,--w);if(p(a)&&w<v.length)return c(v,++w);x=v}else{if(q(a)&&w>0&&(y=h(v,w-1),r(y)))return!s(y)&&(z=d.findNode(y,a,t,y))?m(z)?c(z,z.data.length):c.after(z):m(y)?c(y,y.data.length):c.before(y);if(p(a)&&w<v.childNodes.length&&(y=h(v,w),r(y)))return j(y,u)?k(a,c.after(y),u):!s(y)&&(z=d.findNode(y,a,t,y))?m(z)?c(z,0):c.before(z):m(y)?c(y,0):c.after(y);x=B.getNode()}return(p(a)&&B.isAtEnd()||q(a)&&B.isAtStart())&&(x=d.findNode(x,a,f.constant(!0),u,!0),t(x))?i(a,x):(y=d.findNode(x,a,t,u),A=e.last(e.filter(g(v,u),l)),!A||y&&A.contains(y)?y?i(a,y):null:B=p(a)?c.afte
r(A):c.before(A))}var l=a.isContentEditableFalse,m=a.isText,n=a.isElement,o=a.isBr,p=d.isForwards,q=d.isBackwards,r=b.isCaretCandidate,s=b.isAtomic,t=b.isEditableCaretCandidate;return function(a){return{next:function(b){return k(1,b,a)},prev:function(b){return k(-1,b,a)}}}}),g("tinymce.core.caret.CaretFinder",["ephox.katamari.api.Fun","ephox.katamari.api.Option","tinymce.core.caret.CaretCandidate","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretUtils","tinymce.core.caret.CaretWalker","tinymce.core.dom.NodeType"],function(a,b,c,d,e,f,g){var h=function(a,b,c){var e=a?d.before(c):d.after(c);return o(a,b,e)},i=function(a){return g.isBr(a)?d.before(a):d.after(a)},j=function(a){return d.isTextPosition(a)?0===a.offset():c.isCaretCandidate(a.getNode())},k=function(a){return d.isTextPosition(a)?a.offset()===a.container().data.length:c.isCaretCandidate(a.getNode(!0))},l=function(a,b){return!d.isTextPos
ition(a)&&!d.isTextPosition(b)&&a.getNode()===b.getNode(!0)},m=function(a){return!d.isTextPosition(a)&&g.isBr(a.getNode())},n=function(a,b,c){return a?!l(b,c)&&!m(b)&&k(b)&&j(c):!l(c,b)&&j(b)&&k(c)},o=function(a,c,d){var e=new f(c);return b.from(a?e.next(d):e.prev(d))},p=function(a,c,d){return o(a,c,d).bind(function(f){return e.isInSameBlock(d,f,c)&&n(a,d,f)?o(a,c,f):b.some(f)})},q=function(a,e){var f=a?e.firstChild:e.lastChild;return g.isText(f)?b.some(new d(f,a?0:f.data.length)):f?c.isCaretCandidate(f)?b.some(a?d.before(f):i(f)):h(a,e,f):b.none()};return{fromPosition:o,nextPosition:a.curry(o,!0),prevPosition:a.curry(o,!1),navigate:p,positionIn:q,firstPositionIn:a.curry(q,!0),lastPositionIn:a.curry(q,!1)}}),g("tinymce.core.dom.RangeNormalizer",["tinymce.core.caret.CaretFinder","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretUtils"],function(a,b,c){var d=functi
on(a,b,c,d){var e=document.createRange();return e.setStart(a,b),e.setEnd(c,d),e},e=function(e){var f=b.fromRangeStart(e),g=b.fromRangeEnd(e),h=e.commonAncestorContainer;return a.fromPosition(!1,h,g).map(function(a){return!c.isInSameBlock(f,g,h)&&c.isInSameBlock(f,a,h)?d(f.container(),f.offset(),a.container(),a.offset()):e}).getOr(e)},f=function(a){return a.collapsed?a:e(a)},g=function(a){return f(a)};return{normalize:g}}),g("global!console",[],function(){return"undefined"==typeof console&&(console={log:function(){}}),console}),h("global!document",document),g("ephox.sugar.api.node.Element",["ephox.katamari.api.Fun","global!Error","global!console","global!document"],function(a,b,c,d){var e=function(a,b){var e=b||d,f=e.createElement("div");if(f.innerHTML=a,!f.hasChildNodes()||f.childNodes.length>1)throw c.error("HTML does not have a single root node",a),"HTML must
have a single root node";return h(f.childNodes[0])},f=function(a,b){var c=b||d,e=c.createElement(a);return h(e)},g=function(a,b){var c=b||d,e=c.createTextNode(a);return h(e)},h=function(c){if(null===c||void 0===c)throw new b("Node cannot be null or undefined");return{dom:a.constant(c)}};return{fromHtml:e,fromTag:f,fromText:g,fromDom:h}}),g("ephox.katamari.api.Type",["global!Array","global!String"],function(a,b){var c=function(c){if(null===c)return"null";var d=typeof c;return"object"===d&&a.prototype.isPrototypeOf(c)?"array":"object"===d&&b.prototype.isPrototypeOf(c)?"string":d},d=function(a){return function(b){return c(b)===a}};return{isString:d("string"),isObject:d("object"),isArray:d("array"),isNull:d("null"),isBoolean:d("boolean"),isUndefined:d("undefined"),isFunction:d("function"),isNumber:d("nu
mber")}}),g("ephox.katamari.data.Immutable",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","global!Array","global!Error"],function(a,b,c,d){return function(){var e=arguments;return function(){for(var f=new c(arguments.length),g=0;g<f.length;g++)f[g]=arguments[g];if(e.length!==f.length)throw new d('Wrong number of arguments to struct. Expected "['+e.length+']", got '+f.length+" arguments");var h={};return a.each(e,function(a,c){h[a]=b.constant(f[c])}),h}}}),g("ephox.katamari.api.Obj",["ephox.katamari.api.Option","global!Object"],function(a,b){var c=function(){var a=b.keys,c=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b};return void 0===a?c:a}(),d=function(a,b){for(var d=c(a),e=0,f=d.length;e<f;e++){var g=d[e],h=a[g];b(h,g,a)}},e=function(a,b){return f(a,function(a,c,d){return{k:c,v:b(a,c,d)}})},f=function(a,b){var c={};return d(a,fun
ction(d,e){var f=b(d,e,a);c[f.k]=f.v}),c},g=function(a,b){var c={},e={};return d(a,function(a,d){var f=b(a,d)?c:e;f[d]=a}),{t:c,f:e}},h=function(a,b){var c=[];return d(a,function(a,d){c.push(b(a,d))}),c},i=function(b,d){for(var e=c(b),f=0,g=e.length;f<g;f++){var h=e[f],i=b[h];if(d(i,h,b))return a.some(i)}return a.none()},j=function(a){return h(a,function(a){return a})},k=function(a){return j(a).length};return{bifilter:g,each:d,map:e,mapToArray:h,tupleMap:f,find:i,keys:c,values:j,size:k}}),g("ephox.katamari.util.BagUtils",["ephox.katamari.api.Arr","ephox.katamari.api.Type","global!Error"],function(a,b,c){var d=function(a){return a.slice(0).sort()},e=function(a,b){throw new c("All required keys ("+d(a).join(", ")+") were not specified. Specified keys were: "+d(b).join(", ")+".")},f=function(a){throw new c("Unsupported keys for object: "+d(a).join(", "))},g=function(d,e){if(
!b.isArray(e))throw new c("The "+d+" fields must be an array. Was: "+e+".");a.each(e,function(a){if(!b.isString(a))throw new c("The value "+a+" in the "+d+" fields was not a string.")})},h=function(a,b){throw new c("All values need to be of type: "+b+". Keys ("+d(a).join(", ")+") were not.")},i=function(b){var e=d(b),f=a.find(e,function(a,b){return b<e.length-1&&a===e[b+1]});f.each(function(a){throw new c("The field: "+a+" occurs more than once in the combined fields: ["+e.join(", ")+"].")})};return{sort:d,reqMessage:e,unsuppMessage:f,validateStrArr:g,invalidTypeMessage:h,checkDupes:i}}),g("ephox.katamari.data.MixedBag",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.katamari.api.Obj","ephox.katamari.api.Option","ephox.katamari.util.BagUtils","global!Error"
;,"global!Object"],function(a,b,c,d,e,f,g){return function(h,i){var j=h.concat(i);if(0===j.length)throw new f("You must specify at least one required or optional field.");return e.validateStrArr("required",h),e.validateStrArr("optional",i),e.checkDupes(j),function(f){var k=c.keys(f),l=a.forall(h,function(b){return a.contains(k,b)});l||e.reqMessage(h,k);var m=a.filter(k,function(b){return!a.contains(j,b)});m.length>0&&e.unsuppMessage(m);var n={};return a.each(h,function(a){n[a]=b.constant(f[a])}),a.each(i,function(a){n[a]=b.constant(g.prototype.hasOwnProperty.call(f,a)?d.some(f[a]):d.none())}),n}}}),g("ephox.katamari.api.Struct",["ephox.katamari.data.Immutable","ephox.katamari.data.MixedBag"],function(a,b){return{immutable:a,immutableBag:b}}),g("ephox.sugar.alien.Recurse",[],function(){var a=function(a,b){var c=[],d=function(a){return c.push(a),b(a)},e=b(a);do e=e.bind(d);while(e.isSome());retu
rn c};return{toArray:a}}),g("ephox.katamari.api.Global",[],function(){return"undefined"!=typeof window?window:Function("return this;")()}),g("ephox.katamari.api.Resolve",["ephox.katamari.api.Global"],function(a){var b=function(b,c){for(var d=void 0!==c?c:a,e=0;e<b.length&&void 0!==d&&null!==d;++e)d=d[b[e]];return d},c=function(a,c){var d=a.split(".");return b(d,c)},d=function(a,b){return void 0!==a[b]&&null!==a[b]||(a[b]={}),a[b]},e=function(b,c){for(var e=void 0!==c?c:a,f=0;f<b.length;++f)e=d(e,b[f]);return e},f=function(a,b){var c=a.split(".");return e(c,b)};return{path:b,resolve:c,forge:e,namespace:f}}),g("ephox.sand.util.Global",["ephox.katamari.api.Resolve"],function(a){var b=function(b,c){return a.resolve(b,c)},c=function(a,c){var d=b(a,c);if(void 0===d)throw a+" not available on this browser";return d};return{getOrDie:c}}),g("ephox.sand.api.No
de",["ephox.sand.util.Global"],function(a){var b=function(){var b=a.getOrDie("Node");return b},c=function(a,b,c){return 0!==(a.compareDocumentPosition(b)&c)},d=function(a,d){return c(a,d,b().DOCUMENT_POSITION_PRECEDING)},e=function(a,d){return c(a,d,b().DOCUMENT_POSITION_CONTAINED_BY)};return{documentPositionPreceding:d,documentPositionContainedBy:e}}),g("ephox.katamari.api.Thunk",[],function(){var a=function(a){var b,c=!1;return function(){return c||(c=!0,b=a.apply(null,arguments)),b}};return{cached:a}}),h("global!Number",Number),g("ephox.sand.detect.Version",["ephox.katamari.api.Arr","global!Number","global!String"],function(a,b,c){var d=function(a,b){for(var c=0;c<a.length;c++){var d=a[c];if(d.test(b))return d}},e=function(a,c){var e=d(a,c);if(!e)return{major:0,minor:0};var f=function(a){return b(c.replace(e,"$"+a))};return h(f(1),f(2))},f=function(a,b){var d=c(b).toLowerCase();r
eturn 0===a.length?g():e(a,d)},g=function(){return h(0,0)},h=function(a,b){return{major:a,minor:b}};return{nu:h,detect:f,unknown:g}}),g("ephox.sand.core.Browser",["ephox.katamari.api.Fun","ephox.sand.detect.Version"],function(a,b){var c="Edge",d="Chrome",e="IE",f="Opera",g="Firefox",h="Safari",i=function(a,b){return function(){return b===a}},j=function(){return k({current:void 0,version:b.unknown()})},k=function(a){var b=a.current,j=a.version;return{current:b,version:j,isEdge:i(c,b),isChrome:i(d,b),isIE:i(e,b),isOpera:i(f,b),isFirefox:i(g,b),
-isSafari:i(h,b)}};return{unknown:j,nu:k,edge:a.constant(c),chrome:a.constant(d),ie:a.constant(e),opera:a.constant(f),firefox:a.constant(g),safari:a.constant(h)}}),g("ephox.sand.core.OperatingSystem",["ephox.katamari.api.Fun","ephox.sand.detect.Version"],function(a,b){var c="Windows",d="iOS",e="Android",f="Linux",g="OSX",h="Solaris",i="FreeBSD",j=function(a,b){return function(){return b===a}},k=function(){return l({current:void 0,version:b.unknown()})},l=function(a){var b=a.current,k=a.version;return{current:b,version:k,isWindows:j(c,b),isiOS:j(d,b),isAndroid:j(e,b),isOSX:j(g,b),isLinux:j(f,b),isSolaris:j(h,b),isFreeBSD:j(i,b)}};return{unknown:k,nu:l,windows:a.constant(c),ios:a.constant(d),android:a.constant(e),linux:a.constant(f),osx:a.constant(g),solaris:a.constant(h),freebsd:a.constant(i)}}),g("ephox.sand.detect.DeviceType",["ephox.katamari.api.Fun"],function(a){
return function(b,c,d){var e=b.isiOS()&&/ipad/i.test(d)===!0,f=b.isiOS()&&!e,g=b.isAndroid()&&3===b.version.major,h=b.isAndroid()&&4===b.version.major,i=e||g||h&&/mobile/i.test(d)===!0,j=b.isiOS()||b.isAndroid(),k=j&&!i,l=c.isSafari()&&b.isiOS()&&/safari/i.test(d)===!1;return{isiPad:a.constant(e),isiPhone:a.constant(f),isTablet:a.constant(i),isPhone:a.constant(k),isTouch:a.constant(j),isAndroid:b.isAndroid,isiOS:b.isiOS,isWebView:a.constant(l)}}}),g("ephox.sand.detect.UaString",["ephox.katamari.api.Arr","ephox.sand.detect.Version","global!String"],function(a,b,c){var d=function(b,d){var e=c(d).toLowerCase();return a.find(b,function(a){return a.search(e)})},e=function(a,c){return d(a,c).map(function(a){var d=b.detect(a.versionRegexes,c);return{current:a.name,version:d}})},f=function(a,c){return d(a,c).map(function(a){var d=b.detect(a.versionRegexes,c);return{current:a.name,version:
d}})};return{detectBrowser:e,detectOs:f}}),g("ephox.katamari.str.StrAppend",[],function(){var a=function(a,b){return b+a},b=function(a,b){return a+b},c=function(a,b){return a.substring(b)},d=function(a,b){return a.substring(0,a.length-b)};return{addToStart:a,addToEnd:b,removeFromStart:c,removeFromEnd:d}}),g("ephox.katamari.str.StringParts",["ephox.katamari.api.Option","global!Error"],function(a,b){var c=function(a,b){return a.substr(0,b)},d=function(a,b){return a.substr(a.length-b,a.length)},e=function(b){return""===b?a.none():a.some(b.substr(0,1))},f=function(b){return""===b?a.none():a.some(b.substring(1))};return{first:c,last:d,head:e,tail:f}}),g("ephox.katamari.api.Strings",["ephox.katamari.str.StrAppend","ephox.katamari.str.StringParts","global!Error"],function(a,b,c){var d=function(a,b,c){if(""===b)return!0;if(a.length<b.length)return!1;var d=a.substr(c,c+b.length);r
eturn d===b},e=function(a,b){var c=function(a){var b=typeof a;return"string"===b||"number"===b};return a.replace(/\${([^{}]*)}/g,function(a,d){var e=b[d];return c(e)?e:a})},f=function(b,c){return l(b,c)?a.removeFromStart(b,c.length):b},g=function(b,c){return m(b,c)?a.removeFromEnd(b,c.length):b},h=function(b,c){return l(b,c)?b:a.addToStart(b,c)},i=function(b,c){return m(b,c)?b:a.addToEnd(b,c)},j=function(a,b){return a.indexOf(b)!==-1},k=function(a){return b.head(a).bind(function(c){return b.tail(a).map(function(a){return c.toUpperCase()+a})}).getOr(a)},l=function(a,b){return d(a,b,0)},m=function(a,b){return d(a,b,a.length-b.length)},n=function(a){return a.replace(/^\s+|\s+$/g,"")},o=function(a){return a.replace(/^\s+/g,"")},p=function(a){return a.replace(/\s+$/g,"")};return{supplant:e,startsWith:l,removeLeading:f,removeTrailing:g,ensureLeading:h,ensureTrailing:i,endsWith:m,contains:j,trim:n,lTrim:o,rTrim:p,capitalize:k}}),g("eph
ox.sand.info.PlatformInfo",["ephox.katamari.api.Fun","ephox.katamari.api.Strings"],function(a,b){var c=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,d=function(a){return function(c){return b.contains(c,a)}},e=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(a){var c=b.contains(a,"edge/")&&b.contains(a,"chrome")&&b.contains(a,"safari")&&b.contains(a,"applewebkit");return c}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,c],search:function(a){return b.contains(a,"chrome")&&!b.contains(a,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(a){return b.contains(a,"msie")||b.contains(a,"trident")}},{name:"Opera",versionRegexes:[c,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:d("opera")},{name:"
Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:d("firefox")},{name:"Safari",versionRegexes:[c,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(a){return(b.contains(a,"safari")||b.contains(a,"mobile/"))&&b.contains(a,"applewebkit")}}],f=[{name:"Windows",search:d("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(a){return b.contains(a,"iphone")||b.contains(a,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:d("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:d("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:d("linux"),versionRegexes:[]},{name:"Solaris",search:d("su
nos"),versionRegexes:[]},{name:"FreeBSD",search:d("freebsd"),versionRegexes:[]}];return{browsers:a.constant(e),oses:a.constant(f)}}),g("ephox.sand.core.PlatformDetection",["ephox.sand.core.Browser","ephox.sand.core.OperatingSystem","ephox.sand.detect.DeviceType","ephox.sand.detect.UaString","ephox.sand.info.PlatformInfo"],function(a,b,c,d,e){var f=function(f){var g=e.browsers(),h=e.oses(),i=d.detectBrowser(g,f).fold(a.unknown,a.nu),j=d.detectOs(h,f).fold(b.unknown,b.nu),k=c(j,i,f);return{browser:i,os:j,deviceType:k}};return{detect:f}}),h("global!navigator",navigator),g("ephox.sand.api.PlatformDetection",["ephox.katamari.api.Thunk","ephox.sand.core.PlatformDetection","global!navigator"],function(a,b,c){var d=a.cached(function(){var a=c.userAgent;return b.detect(a)});return{detect:d}}),g("ephox.sugar.api.node.NodeTypes",[],function(){return{A
TTRIBUTE:2,CDATA_SECTION:4,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,ELEMENT:1,TEXT:3,PROCESSING_INSTRUCTION:7,ENTITY_REFERENCE:5,ENTITY:6,NOTATION:12}}),g("ephox.sugar.api.search.Selectors",["ephox.katamari.api.Arr","ephox.katamari.api.Option","ephox.sugar.api.node.Element","ephox.sugar.api.node.NodeTypes","global!Error","global!document"],function(a,b,c,d,e,f){var g=d.ELEMENT,h=d.DOCUMENT,i=function(a,b){var c=a.dom();if(c.nodeType!==g)return!1;if(void 0!==c.matches)return c.matches(b);if(void 0!==c.msMatchesSelector)return c.msMatchesSelector(b);if(void 0!==c.webkitMatchesSelector)return c.webkitMatchesSelector(b);if(void 0!==c.mozMatchesSelector)return c.mozMatchesSelector(b);throw new e("Browser lacks native selectors")},j=function(a){return a.nodeType!==g&&a.nodeType!==h||0===a.childElementCount},k=function(b,d){var e=void 0===d?f:d.dom();return j(e)?[]:a.map(e.querySelecto
rAll(b),c.fromDom)},l=function(a,d){var e=void 0===d?f:d.dom();return j(e)?b.none():b.from(e.querySelector(a)).map(c.fromDom)};return{all:k,is:i,one:l}}),g("ephox.sugar.api.dom.Compare",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.sand.api.Node","ephox.sand.api.PlatformDetection","ephox.sugar.api.search.Selectors"],function(a,b,c,d,e){var f=function(a,b){return a.dom()===b.dom()},g=function(a,b){return a.dom().isEqualNode(b.dom())},h=function(c,d){return a.exists(d,b.curry(f,c))},i=function(a,b){var c=a.dom(),d=b.dom();return c!==d&&c.contains(d)},j=function(a,b){return c.documentPositionContainedBy(a.dom(),b.dom())},k=d.detect().browser,l=k.isIE()?j:i;return{eq:f,isEqualNode:g,member:h,contains:l,is:e.is}}),g("ephox.sugar.api.search.Traverse",["ephox.katamari.api.Type","ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.katamari.api.Option","e
phox.katamari.api.Struct","ephox.sugar.alien.Recurse","ephox.sugar.api.dom.Compare","ephox.sugar.api.node.Element"],function(a,b,c,d,e,f,g,h){var i=function(a){return h.fromDom(a.dom().ownerDocument)},j=function(a){var b=i(a);return h.fromDom(b.dom().documentElement)},k=function(a){var b=a.dom(),c=b.ownerDocument.defaultView;return h.fromDom(c)},l=function(a){var b=a.dom();return d.from(b.parentNode).map(h.fromDom)},m=function(a){return l(a).bind(function(c){var d=u(c);return b.findIndex(d,function(b){return g.eq(a,b)})})},n=function(b,d){for(var e=a.isFunction(d)?d:c.constant(!1),f=b.dom(),g=[];null!==f.parentNode&&void 0!==f.parentNode;){var i=f.parentNode,j=h.fromDom(i);if(g.push(j),e(j)===!0)break;f=i}return g},o=function(a){var c=function(c){return b.filter(c,function(b){return!g.eq(a,b)})};return l(a).map(u).map(c).getOr([])},p=function(a){var b=a.dom();return d.from(b.offsetParent).map(h.fromDom)},q=function(a){var b=a.dom();return d
.from(b.previousSibling).map(h.fromDom)},r=function(a){var b=a.dom();return d.from(b.nextSibling).map(h.fromDom)},s=function(a){return b.reverse(f.toArray(a,q))},t=function(a){return f.toArray(a,r)},u=function(a){var c=a.dom();return b.map(c.childNodes,h.fromDom)},v=function(a,b){var c=a.dom().childNodes;return d.from(c[b]).map(h.fromDom)},w=function(a){return v(a,0)},x=function(a){return v(a,a.dom().childNodes.length-1)},y=e.immutable("element","offset"),z=function(a,b){var c=u(a);return c.length>0&&b<c.length?y(c[b],0):y(a,b)};return{owner:i,defaultView:k,documentElement:j,parent:l,findIndex:m,parents:n,siblings:o,prevSibling:q,offsetParent:p,prevSiblings:s,nextSibling:r,nextSiblings:t,children:u,child:v,firstChild:w,lastChild:x,leaf:z}}),g("ephox.sugar.api.dom.Insert",["ephox.sugar.api.search.Traverse"],function(a){var b=function(b,c){var d=a.parent(b);d.each(function(a){a.dom().insertBefore(c.dom(),b.dom())})},c=function(c,d)
{var f=a.nextSibling(c);f.fold(function(){var b=a.parent(c);b.each(function(a){e(a,d)})},function(a){b(a,d)})},d=function(b,c){var d=a.firstChild(b);d.fold(function(){e(b,c)},function(a){b.dom().insertBefore(c.dom(),a.dom())})},e=function(a,b){a.dom().appendChild(b.dom())},f=function(c,d,f){a.child(c,f).fold(function(){e(c,d)},function(a){b(a,d)})},g=function(a,c){b(a,c),e(c,a)};return{before:b,after:c,prepend:d,append:e,appendAt:f,wrap:g}}),g("ephox.sugar.api.dom.InsertAll",["ephox.katamari.api.Arr","ephox.sugar.api.dom.Insert"],function(a,b){var c=function(c,d){a.each(d,function(a){b.before(c,a)})},d=function(c,d){a.each(d,function(a,e){var f=0===e?c:d[e-1];b.after(f,a)})},e=function(c,d){a.each(d.slice().reverse(),function(a){b.prepend(c,a)})},f=function(c,d){a.each(d,function(a){b.append(c,a)})};return{before:c,after:d,prepend:e,append:f}}),g("ephox.sugar.api.dom.Remove",["ephox.katamari.api.Arr","ephox.sugar.api.dom.InsertA
ll","ephox.sugar.api.search.Traverse"],function(a,b,c){var d=function(b){b.dom().textContent="",a.each(c.children(b),function(a){e(a)})},e=function(a){var b=a.dom();null!==b.parentNode&&b.parentNode.removeChild(b)},f=function(a){var d=c.children(a);d.length>0&&b.before(a,d),e(a)};return{empty:d,remove:e,unwrap:f}}),g("ephox.sugar.api.node.Node",["ephox.sugar.api.node.NodeTypes"],function(a){var b=function(a){var b=a.dom().nodeName;return b.toLowerCase()},c=function(a){return a.dom().nodeType},d=function(a){return a.dom().nodeValue},e=function(a){return function(b){return c(b)===a}},f=function(d){return c(d)===a.COMMENT||"#comment"===b(d)},g=e(a.ELEMENT),h=e(a.TEXT),i=e(a.DOCUMENT);return{name:b,type:c,value:d,isElement:g,isText:h,isDocument:i,isComment:f}}),g("ephox.sugar.impl.NodeValue",["ephox.sand.api.PlatformDetection","ephox.katamari.api.Option","global!Error"],func
tion(a,b,c){return function(d,e){var f=function(a){if(!d(a))throw new c("Can only get "+e+" value of a "+e+" node");return j(a).getOr("")},g=function(a){try{return h(a)}catch(c){return b.none()}},h=function(a){return d(a)?b.from(a.dom().nodeValue):b.none()},i=a.detect().browser,j=i.isIE()&&10===i.version.major?g:h,k=function(a,b){if(!d(a))throw new c("Can only set raw "+e+" value of a "+e+" node");a.dom().nodeValue=b};return{get:f,getOption:j,set:k}}}),g("ephox.sugar.api.node.Text",["ephox.sugar.api.node.Node","ephox.sugar.impl.NodeValue"],function(a,b){var c=b(a.isText,"text"),d=function(a){return c.get(a)},e=function(a){return c.getOption(a)},f=function(a,b){c.set(a,b)};return{get:d,getOption:e,set:f}}),g("ephox.sugar.api.node.Body",["ephox.katamari.api.Thunk","ephox.sugar.api.node.Element","ephox.sugar.api.node.Node","g
lobal!document"],function(a,b,c,d){var e=function(a){var b=c.isText(a)?a.dom().parentNode:a.dom();return void 0!==b&&null!==b&&b.ownerDocument.body.contains(b)},f=a.cached(function(){return g(b.fromDom(d))}),g=function(a){var c=a.dom().body;if(null===c||void 0===c)throw"Body is not available yet";return b.fromDom(c)};return{body:f,getBody:g,inBody:e}}),g("ephox.sugar.api.search.PredicateFilter",["ephox.katamari.api.Arr","ephox.sugar.api.node.Body","ephox.sugar.api.search.Traverse"],function(a,b,c){var d=function(a){return h(b.body(),a)},e=function(b,d,e){return a.filter(c.parents(b,e),d)},f=function(b,d){return a.filter(c.siblings(b),d)},g=function(b,d){return a.filter(c.children(b),d)},h=function(b,d){var e=[];return a.each(c.children(b),function(a){d(a)&&(e=e.concat([a])),e=e.concat(h(a,d))}),e};return{all:d,ancestors:e,siblings:f,children:g,descendants:h}}),g("ephox.sugar.api.search.SelectorFilter
",["ephox.sugar.api.search.PredicateFilter","ephox.sugar.api.search.Selectors"],function(a,b){var c=function(a){return b.all(a)},d=function(c,d,e){return a.ancestors(c,function(a){return b.is(a,d)},e)},e=function(c,d){return a.siblings(c,function(a){return b.is(a,d)})},f=function(c,d){return a.children(c,function(a){return b.is(a,d)})},g=function(a,c){return b.all(c,a)};return{all:c,ancestors:d,siblings:e,children:f,descendants:g}}),g("tinymce.core.dom.ElementType",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.sugar.api.node.Node"],function(a,b,c){var d=["article","aside","details","div","dt","figcaption","footer","form","fieldset","header","hgroup","html","main","nav","section","summary","body","p","dl","multicol&q
uot;,"dd","figure","address","center","blockquote","h1","h2","h3","h4","h5","h6","listing","xmp","pre","plaintext","menu","dir","ul","ol","li","hr","table","tbody","thead","tfoot","th","tr","td","caption"],e=["area","base","basefont","br","col","frame","hr","img","input","isindex","link","meta","param","embed","source","wbr","track"],f=["td","th"],g=["thead","tbody","tfoot"],h=["h1","h2","h3","h4","h5","h6","p",&q
uot;div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"],i=["h1","h2","h3","h4","h5","h6"],j=["li","dd","dt"],k=["ul","ol","dl"],l=function(d){var e;return function(f){return e=e?e:a.mapToObject(d,b.constant(!0)),e.hasOwnProperty(c.name(f))}},m=l(i),n=l(d),o=function(a){return c.isElement(a)&&!n(a)},p=function(a){return c.isElement(a)&&"br"===c.name(a)};return{isBlock:n,isInline:o,isHeading:m,isTextBlock:l(h),isList:l(k),isListItem:l(j),isVoid:l(e),isTableSection:l(g),isTableCell:l(f),isBr:p}}),g("tinymce.core.dom.PaddingBr",["ephox.katamari.api.Arr","ephox.sugar.api.dom.Insert&q
uot;,"ephox.sugar.api.dom.Remove","ephox.sugar.api.node.Element","ephox.sugar.api.node.Node","ephox.sugar.api.node.Text","ephox.sugar.api.search.SelectorFilter","ephox.sugar.api.search.Traverse","tinymce.core.dom.ElementType"],function(a,b,c,d,e,f,g,h,i){var j=function(a){for(var b=[],c=a.dom();c;)b.push(d.fromDom(c)),c=c.lastChild;return b},k=function(b){var d=g.descendants(b,"br"),e=a.filter(j(b).slice(-1),i.isBr);d.length===e.length&&a.each(e,c.remove)},l=function(a){c.empty(a),b.append(a,d.fromHtml('<br data-mce-bogus="1">'))},m=function(a){return e.isText(a)?"\xa0"===f.get(a):i.isBr(a)},n=function(b){return 1===a.filter(h.children(b),m).length},o=function(a){h.lastChild(a).each(function(b){h.prevSibling(b).each(function(d){i.isBlock(a)&&i.isBr(b)&&i.isBlock(d)&&c.remove(b)})})};return{removeTrailingBr:k,fillWithPaddingBr:l,isPaddedElement:n,t
rimBlockTrailingBr:o}}),g("tinymce.core.fmt.FormatUtils",["tinymce.core.dom.TreeWalker"],function(a){var b=function(a){return a&&/^(IMG)$/.test(a.nodeName)},c=function(c,d,e){var f,h,i,j=e.startContainer,k=e.startOffset;if((e.startContainer!==e.endContainer||!b(e.startContainer.childNodes[e.startOffset]))&&(3===j.nodeType&&k>=j.nodeValue.length&&(k=c.nodeIndex(j),j=j.parentNode),1===j.nodeType))for(i=j.childNodes,k<i.length?(j=i[k],f=new a(j,c.getParent(j,c.isBlock))):(j=i[i.length-1],f=new a(j,c.getParent(j,c.isBlock)),f.next(!0)),h=f.current();h;h=f.next())if(3===h.nodeType&&!g(h))return e.setStart(h,0),void d.setRng(e)},d=function(a,b,c){if(a)for(b=b?"nextSibling":"previousSibling",a=c?a:a[b];a;a=a[b])if(1===a.nodeType||!g(a))return a},e=function(a,b){return b.nodeType&&(b=b.nodeName),!!a.schema.getTextBlockElements()[b.toLowerCase()]},f=function(a,b,c){return a.schema.isValidChild(b,c)}
,g=function(a){return a&&3===a.nodeType&&/^([\t \r\n]+|)$/.test(a.nodeValue)},h=function(a,b){return"string"!=typeof a?a=a(b):b&&(a=a.replace(/%(\w+)/g,function(a,c){return b[c]||a})),a},i=function(a,b){return a=a||"",b=b||"",a=""+(a.nodeName||a),b=""+(b.nodeName||b),a.toLowerCase()===b.toLowerCase()},j=function(a,b,c){return"color"!==c&&"backgroundColor"!==c||(b=a.toHex(b)),"fontWeight"===c&&700===b&&(b="bold"),"fontFamily"===c&&(b=b.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),""+b},k=function(a,b,c){return j(a,a.getStyle(b,c),c)},l=function(a,b){var c;return a.getParent(b,function(b){return c=a.getStyle(b,"text-decoration"),c&&"none"!==c}),c},m=function(a,b,c){return a.getParents(b,c,a.getRoot())};return{isInlineBlock:b,moveStart:c,getNonWhiteSpaceSibling:d,isTextBl
ock:e,isValid:f,isWhiteSpaceNode:g,replaceVars:h,isEq:i,normalizeStyleValue:j,getStyle:k,getTextDecoration:l,getParents:m}}),g("tinymce.core.fmt.ExpandRange",["tinymce.core.dom.BookmarkManager","tinymce.core.dom.TreeWalker","tinymce.core.fmt.FormatUtils"],function(a,b,c){var d=a.isBookmarkNode,e=c.getParents,f=c.isWhiteSpaceNode,g=c.isTextBlock,h=function(a,b){for("undefined"==typeof b&&(b=3===a.nodeType?a.length:a.childNodes.length);a&&a.hasChildNodes();)a=a.childNodes[b],a&&(b=3===a.nodeType?a.length:a.childNodes.length);return{node:a,offset:b}},i=function(a,b){var c=h(a,b);if(c.node){for(;c.node&&0===c.offset&&c.node.previousSibling;)c=h(c.node.previousSibling);c.node&&c.offset>0&&3===c.node.nodeType&&" "===c.node.nodeValue.charAt(c.offset-1)&&c.offset>1&&(a=c.node,a.splitText(c.offset-1))}return a},j=function(a){return"BR"===
a.nodeName&&a.getAttribute("data-mce-bogus")&&!a.nextSibling},k=function(a,h,k,l){var m,n,o=h.startContainer,p=h.startOffset,q=h.endContainer,r=h.endOffset,s=a.dom,t=function(a){var b,c,e,g,h;if(b=c=a?o:q,g=a?"previousSibling":"nextSibling",h=s.getRoot(),3===b.nodeType&&!f(b)&&(a?p>0:r<b.nodeValue.length))return b;for(;;){if(!k[0].block_expand&&s.isBlock(c))return c;for(e=c[g];e;e=e[g])if(!d(e)&&!f(e)&&!j(e))return c;if(c===h||c.parentNode===h){b=c;break}c=c.parentNode}return b};1===o.nodeType&&o.hasChildNodes()&&(m=o.childNodes.length-1,o=o.childNodes[p>m?m:p],3===o.nodeType&&(p=0)),1===q.nodeType&&q.hasChildNodes()&&(m=q.childNodes.length-1,q=q.childNodes[r>m?m:r-1],3===q.nodeType&&(r=q.nodeValue.length));var u=function(a){for(var b=a;b;){if(1===b.nodeType&&s.getContentEditable(b))return"false"===s.getContentEditable(b)
?b:a;b=b.parentNode}return a},v=function(c,d,e){var f,g,h,i,j=function(a,b){var c,d,f=a.nodeValue;return"undefined"==typeof b&&(b=e?f.length:0),e?(c=f.lastIndexOf(" ",b),d=f.lastIndexOf("\xa0",b),c=c>d?c:d,c===-1||l||c++):(c=f.indexOf(" ",b),d=f.indexOf("\xa0",b),c=c!==-1&&(d===-1||c<d)?c:d),c};if(3===c.nodeType){if(h=j(c,d),h!==-1)return{container:c,offset:h};i=c}for(f=new b(c,s.getParent(c,s.isBlock)||a.getBody());g=f[e?"prev":"next"]();)if(3===g.nodeType){if(i=g,h=j(g),h!==-1)return{container:g,offset:h}}else if(s.isBlock(g))break;if(i)return d=e?0:i.length,{container:i,offset:d}},w=function(a,b){var c,d,f,g;for(3===a.nodeType&&0===a.nodeValue.length&&a[b]&&(a=a[b]),c=e(s,a),d=0;d<c.length;d++)for(f=0;f<k.length;f++)if(g=k[f],!("collapsed"in g&&g.collapsed!==h.collapsed)&&s.is(c[d],g.selector))return c[d];return a},x=function(b,d){var
f,h=s.getRoot();if(k[0].wrapper||(f=s.getParent(b,k[0].block,h)),!f){var i=s.getParent(b,"LI,TD,TH");f=s.getParent(3===b.nodeType?b.parentNode:b,function(b){return b!==h&&g(a,b)},i)}if(f&&k[0].wrapper&&(f=e(s,f,"ul,ol").reverse()[0]||f),!f)for(f=b;f[d]&&!s.isBlock(f[d])&&(f=f[d],!c.isEq(f,"br")););return f||b};return o=u(o),q=u(q),(d(o.parentNode)||d(o))&&(o=d(o)?o:o.parentNode,o=o.nextSibling||o,3===o.nodeType&&(p=0)),(d(q.parentNode)||d(q))&&(q=d(q)?q:q.parentNode,q=q.previousSibling||q,3===q.nodeType&&(r=q.length)),k[0].inline&&(h.collapsed&&(n=v(o,p,!0),n&&(o=n.container,p=n.offset),n=v(q,r),n&&(q=n.container,r=n.offset)),q=l?q:i(q,r)),(k[0].inline||k[0].block_expand)&&(k[0].inline&&3===o.nodeType&&0!==p||(o=t(!0)),k[0].inline&&3===q.nodeType&&r!==q.nodeValue.length||(q=t())),k[0].selector&&k[0].exp
and!==!1&&!k[0].inline&&(o=w(o,"previousSibling"),q=w(q,"nextSibling")),(k[0].block||k[0].selector)&&(o=x(o,"previousSibling"),q=x(q,"nextSibling"),k[0].block&&(s.isBlock(o)||(o=t(!0)),s.isBlock(q)||(q=t()))),1===o.nodeType&&(p=s.nodeIndex(o),o=o.parentNode),1===q.nodeType&&(r=s.nodeIndex(q)+1,q=q.parentNode),{startContainer:o,startOffset:p,endContainer:q,endOffset:r}};return{expandRng:k}}),g("tinymce.core.fmt.MatchFormat",["tinymce.core.fmt.FormatUtils"],function(a){var b=a.isEq,c=function(a,b,c){var d=a.formatter.get(c);if(d)for(var e=0;e<d.length;e++)if(d[e].inherit===!1&&a.dom.is(b,d[e].selector))return!0;return!1},d=function(a,b,d,e){var f=a.dom.getRoot();return b!==f&&(b=a.dom.getParent(b,function(b){return!!c(a,b,d)||(b.parentNode===f||!!g(a,b,d,e,!0))}),g(a,b,d,e))},e=function(a,c,d){return!!b(c,d.inline)||(!!b(c,d.block)||(d.selector?1===c.nodeType&
amp;&a.is(c,d.selector):void 0))},f=function(c,d,e,f,g,h){var i,j,k,l=e[f];if(e.onmatch)return e.onmatch(d,e,f);if(l)if("undefined"==typeof l.length){for(i in l)if(l.hasOwnProperty(i)){if(j="attributes"===f?c.getAttrib(d,i):a.getStyle(c,d,i),g&&!j&&!e.exact)return;if((!g||e.exact)&&!b(j,a.normalizeStyleValue(c,a.replaceVars(l[i],h),i)))return}}else for(k=0;k<l.length;k++)if("attributes"===f?c.getAttrib(d,l[k]):a.getStyle(c,d,l[k]))return e;return e},g=function(a,b,c,d,g){var h,i,j,k,l=a.formatter.get(c),m=a.dom;if(l&&b)for(i=0;i<l.length;i++)if(h=l[i],e(a.dom,b,h)&&f(m,b,h,"attributes",g,d)&&f(m,b,h,"styles",g,d)){if(k=h.classes)for(j=0;j<k.length;j++)if(!a.dom.hasClass(b,k[j]))return;return h}},h=function(a,b,c,e){var f;return e?d(a,e,b,c):(e=a.selection.getNode(),!!d(a,e,b,c)||(f=a.selection.getStart(),!(f===e||!d(a,f,b,c))))},i=function(a,b,c){var d,e=[],f={};return d=a.
selection.getStart(),a.dom.getParent(d,function(d){var h,i;for(h=0;h<b.length;h++)i=b[h],!f[i]&&g(a,d,i,c)&&(f[i]=!0,e.push(i))},a.dom.getRoot()),e},j=function(b,c){var d,e,f,g,h,i=b.formatter.get(c),j=b.dom;if(i)for(d=b.selection.getStart(),e=a.getParents(j,d),g=i.length-1;g>=0;g--){if(h=i[g].selector,!h||i[g].defaultBlock)return!0;for(f=e.length-1;f>=0;f--)if(j.is(e[f],h))return!0}return!1};return{matchNode:g,matchName:e,match:h,matchAll:i,canApply:j,matchesUnInheritedFormatSelector:c}}),g("tinymce.core.fmt.CaretFormat",["ephox.katamari.api.Arr","ephox.sugar.api.node.Element","tinymce.core.dom.PaddingBr","tinymce.core.dom.RangeUtils","tinymce.core.dom.TreeWalker","tinymce.core.fmt.ExpandRange","tinymce.core.fmt.FormatUtils","tinymce.core.fmt.MatchFormat","tinymce.core.text.Zwsp","tinymce.core.util.Fun","tinymce.core.util.Tools"],function(
a,b,c,d,e,f,g,h,i,j,k){var l=i.ZWSP,m="_mce_caret",n=!1,o=function(a){return 1===a.nodeType&&a.id===m},p=function(a,b){for(;a;){if(3===a.nodeType&&a.nodeValue!==l||a.childNodes.length>1)return!1;b&&1===a.nodeType&&b.push(a),a=a.firstChild}return!0},q=function(a){var b;if(a)for(b=new e(a,a),a=b.current();a;a=b.next())if(3===a.nodeType)return a;return null},r=function(a,b){var c=a.create("span",{id:m,"data-mce-bogus":"1",style:n?"color:red":""});return b&&c.appendChild(a.doc.createTextNode(l)),c},s=function(a){for(;a;){if(a.id===m)return a;a=a.parentNode}},t=function(a,b){var c;c=s(b.getStart()),c&&!a.isEmpty(c)&&k.walk(c,function(b){1!==b.nodeType||b.id===m||a.isEmpty(b)||a.setAttrib(b,"data-mce-bogus",null)},"childNodes")},u=function(a){var b=q(a);return b&&b.nodeValue.charAt(0)===l&&b.deleteData(0,1),b},v=function(a,d,e,f){var g,
h,i;g=d.getRng(!0),h=a.getParent(e,a.isBlock),p(e)?(f!==!1&&(g.setStartBefore(e),g.setEndBefore(e)),a.remove(e)):(i=u(e),g.startContainer===i&&g.startOffset>0&&g.setStart(i,g.startOffset-1),g.endContainer===i&&g.endOffset>0&&g.setEnd(i,g.endOffset-1),a.remove(e,!0)),h&&a.isEmpty(h)&&c.fillWithPaddingBr(b.fromDom(h)),d.setRng(g)},w=function(a,b,c,d){if(c)v(a,b,c,d);else if(c=s(b.getStart()),!c)for(;c=a.get(m);)v(a,b,c,!1)},x=function(a,d,e){var f=a.dom,h=f.getParent(e,j.curry(g.isTextBlock,a));h&&f.isEmpty(h)?e.parentNode.replaceChild(d,e):(c.removeTrailingBr(b.fromDom(e)),f.isEmpty(e)?e.parentNode.replaceChild(d,e):f.insertAfter(d,e))},y=function(a,b){return a.appendChild(b),b},z=function(b,c){var d=a.foldr(b,function(a,b){return y(a,b.cloneNode(!1))},c);return y(d,d.ownerDocument.createTextNode(l))},A=function(a){a._hasCaretEvents||(D(a),a._hasCaretEvents=!0)},B=function(a,b,c){var e,g,h,i,j,k,m,n=a.dom,o=a.selec
tion;A(a),e=o.getRng(!0),i=e.startOffset,k=e.startContainer,m=k.nodeValue,g=s(o.getStart()),g&&(h=q(g));var p=/[^\s\u00a0\u00ad\u200b\ufeff]/;m&&i>0&&i<m.length&&p.test(m.charAt(i))&&p.test(m.charAt(i-1))?(j=o.getBookmark(),e.collapse(!0),e=f.expandRng(a,e,a.formatter.get(b)),e=new d(n).split(e),a.formatter.apply(b,c,e),o.moveToBookmark(j)):(g&&h.nodeValue===l?a.formatter.apply(b,c,g):(g=r(n,!0),h=g.firstChild,e.insertNode(g),i=1,a.formatter.apply(b,c,g)),o.setCursorLocation(h,i))},C=function(a,b,c,e){var g,i,j,k,l,m,n,o=a.dom,p=a.selection,q=p.getRng(!0),t=[];for(A(a),g=q.startContainer,i=q.startOffset,l=g,3===g.nodeType&&(i!==g.nodeValue.length&&(k=!0),l=l.parentNode);l;){if(h.matchNode(a,l,b,c,e)){m=l;break}l.nextSibling&&(k=!0),t.push(l),l=l.parentNode}if(m)if(k)j=p.getBookmark(),q.collapse(!0),q=f.expandRng(a,q,a.formatter.get(b),!0),q=new d(o).split(q),a.formatter.remove(b,c,q),p.moveToBookmark(j);el
se{n=s(m);var u=r(o,!1),w=z(t,u);n?x(a,u,n):x(a,u,m),v(o,p,n,!1),p.setCursorLocation(w,1),o.isEmpty(m)&&o.remove(m)}},D=function(a){var b=a.dom,c=a.selection;if(!a._hasCaretEvents){var d,e;a.on("BeforeGetContent",function(a){d&&"raw"!==a.format&&d()}),a.on("mouseup keydown",function(a){e&&e(a)}),d=function(){var a,d=[];if(p(s(c.getStart()),d))for(a=d.length;a--;)b.setAttrib(d[a],"data-mce-bogus","1")},e=function(a){var d=a.keyCode;w(b,c,null,!1),8===d&&c.isCollapsed()&&c.getStart().innerHTML===l&&w(b,c,s(c.getStart())),37!==d&&39!==d||w(b,c,s(c.getStart())),t(b,c)},a.on("SetContent",function(a){a.selection&&t(b,c)}),a._hasCaretEvents=!0}};return{applyCaretFormat:B,removeCaretFormat:C,isCaretNode:o}}),g("tinymce.core.fmt.Hooks",["tinymce.core.util.Arr","tinymce.core.dom.NodeType","tinymce.core.dom.DomQuery"],functi
on(a,b,c){function d(a,b){var c=f[a];c||(f[a]=c=[]),f[a].push(b)}function e(a,b){h(f[a],function(a){a(b)})}var f={},g=a.filter,h=a.each;return d("pre",function(d){function e(b){return i(b.previousSibling)&&a.indexOf(j,b.previousSibling)!==-1}function f(a,b){c(b).remove(),c(a).append("<br><br>").append(b.childNodes)}var i,j,k=d.selection.getRng();i=b.matchNodeNames("pre"),k.collapsed||(j=d.selection.getSelectedBlocks(),h(g(g(j,i),e),function(a){f(a.previousSibling,a)}))}),{postProcess:e}}),g("tinymce.core.dom.ElementUtils",["tinymce.core.dom.BookmarkManager","tinymce.core.util.Tools"],function(a,b){function c(b){this.compare=function(c,e){function f(a){var c={};return d(b.getAttribs(a),function(d){var e=d.nodeName.toLowerCase();0!==e.indexOf("_")&&"style"!==e&&0!==e.indexOf("data-")&&(c[e]=b.getAttrib(a,e))}),c}function g(a,b){var c,d;for(d in a)if(a.h
asOwnProperty(d)){if(c=b[d],"undefined"==typeof c)return!1;if(a[d]!=c)return!1;delete b[d]}for(d in b)if(b.hasOwnProperty(d))return!1;return!0}return c.nodeName==e.nodeName&&(!!g(f(c),f(e))&&(!!g(b.parseStyle(b.getAttrib(c,"style")),b.parseStyle(b.getAttrib(e,"style")))&&(!a.isBookmarkNode(c)&&!a.isBookmarkNode(e))))}}var d=b.each;return c}),g("tinymce.core.fmt.RemoveFormat",["ephox.katamari.api.Fun","tinymce.core.dom.BookmarkManager","tinymce.core.dom.RangeUtils","tinymce.core.dom.TreeWalker","tinymce.core.fmt.CaretFormat","tinymce.core.fmt.ExpandRange","tinymce.core.fmt.FormatUtils","tinymce.core.fmt.MatchFormat","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g,h,i){var j=/^(src|href|style)$/,k=i.each,l=g.isEq,m=function(a){return/^(TH|TD)$/.test(a.nodeName)},n=function(a,b,c){var e,f,g;return e=b[c?"startContainer&
quot;:"endContainer"],f=b[c?"startOffset":"endOffset"],1===e.nodeType&&(g=e.childNodes.length-1,!c&&f&&f--,e=e.childNodes[f>g?g:f]),3===e.nodeType&&c&&f>=e.nodeValue.length&&(e=new d(e,a.getBody()).next()||e),3!==e.nodeType||c||0!==f||(e=new d(e,a.getBody()).prev()||e),e},o=function(a,b,c,d){var e=a.create(c,d);return b.parentNode.insertBefore(e,b),e.appendChild(b),e},p=function(a,b,c){return!!l(b,c.inline)||(!!l(b,c.block)||(c.selector?1===b.nodeType&&a.is(b,c.selector):void 0))},q=function(a,b){return b.links&&"A"===a.tagName},r=function(a,b,c,d){return b=g.getNonWhiteSpaceSibling(b,c,d),!b||"BR"===b.nodeName||a.isBlock(b)},s=function(a,b,c){var d,e=b.parentNode,f=a.dom,h=a.settings.forced_root_block;c.block&&(h?e===f.getRoot()&&(c.list_block&&l(b,c.list_block)||k(i.grep(b.childNodes),function(b){g.isValid(a,h,b.nodeName.toLowerCase())?d?d
.appendChild(b):(d=o(f,b,h),f.setAttribs(d,a.settings.forced_root_block_attrs)):d=0})):f.isBlock(b)&&!f.isBlock(e)&&(r(f,b,!1)||r(f,b.firstChild,!0,1)||b.insertBefore(f.create("br"),b.firstChild),r(f,b,!0)||r(f,b.lastChild,!1,1)||b.appendChild(f.create("br")))),c.selector&&c.inline&&!l(c.inline,b)||f.remove(b,1)},t=function(a,b,c,d,e){var f,h,i,m=a.dom;if(!p(m,d,b)&&!q(d,b))return!1;if("all"!==b.remove)for(k(b.styles,function(a,f){a=g.normalizeStyleValue(m,g.replaceVars(a,c),f),"number"==typeof f&&(f=a,e=0),(b.remove_similar||!e||l(g.getStyle(m,e,f),a))&&m.setStyle(d,f,""),i=1}),i&&""===m.getAttrib(d,"style")&&(d.removeAttribute("style"),d.removeAttribute("data-mce-style")),k(b.attributes,function(a,b){var f;if(a=g.replaceVars(a,c),"number"==typeof b&&(b=a,e=0),!e||l(m.getAttrib(e,b),a)){if("class&quo
t;===b&&(a=m.getAttrib(d,b),a&&(f="",k(a.split(/\s+/),function(a){/mce\-\w+/.test(a)&&(f+=(f?" ":"")+a)}),f)))return void m.setAttrib(d,b,f);"class"===b&&d.removeAttribute("className"),j.test(b)&&d.removeAttribute("data-mce-"+b),d.removeAttribute(b)}}),k(b.classes,function(a){a=g.replaceVars(a,c),e&&!m.hasClass(e,a)||m.removeClass(d,a)}),h=m.getAttribs(d),f=0;f<h.length;f++){var n=h[f].nodeName;if(0!==n.indexOf("_")&&0!==n.indexOf("data-"))return!1}return"none"!==b.remove?(s(a,d,b),!0):void 0},u=function(a,b,c,d,e){var f;return k(g.getParents(a.dom,b.parentNode).reverse(),function(b){var g;f||"_start"===b.id||"_end"===b.id||(g=h.matchNode(a,b,c,d,e),g&&g.split!==!1&&(f=b))}),f},v=function(a,b,c,d,e,f,g,h){var i,j,k,l,m,n,o=a.dom;if(c){for(n=c.parentNode,i=d.parentNode;i&&i!==n;i=i.parentNode){
for(j=o.clone(i,!1),m=0;m<b.length;m++)if(t(a,b[m],h,j,j)){j=0;break}j&&(k&&j.appendChild(k),l||(l=j),k=j)}!f||g.mixed&&o.isBlock(c)||(d=o.split(c,d)),k&&(e.parentNode.insertBefore(k,e),l.appendChild(e))}return d},w=function(a,d,j,l,p){var q,r,s=a.formatter.get(d),w=s[0],x=!0,y=a.dom,z=a.selection,A=function(b){var c=u(a,b,d,j,p);return v(a,s,c,b,b,!0,w,j)},B=function(b){var c,d,e,f,g;if(1===b.nodeType&&y.getContentEditable(b)&&(f=x,x="true"===y.getContentEditable(b),g=!0),c=i.grep(b.childNodes),x&&!g)for(d=0,e=s.length;d<e&&!t(a,s[d],j,b,b);d++);if(w.deep&&c.length){for(d=0,e=c.length;d<e;d++)B(c[d]);g&&(x=f)}},C=function(a){var c=y.get(a?"_start":"_end"),d=c[a?"firstChild":"lastChild"];return b.isBookmarkNode(d)&&(d=d[a?"firstChild":"lastChild"]),
-3===d.nodeType&&0===d.data.length&&(d=a?c.previousSibling||c.nextSibling:c.nextSibling||c.previousSibling),y.remove(c,!0),d},D=function(b){var d,e,h=b.commonAncestorContainer;if(b=f.expandRng(a,b,s,!0),w.split){if(d=n(a,b,!0),e=n(a,b),d!==e){if(/^(TR|TH|TD)$/.test(d.nodeName)&&d.firstChild&&(d="TR"===d.nodeName?d.firstChild.firstChild||d:d.firstChild||d),h&&/^T(HEAD|BODY|FOOT|R)$/.test(h.nodeName)&&m(e)&&e.firstChild&&(e=e.firstChild||e),y.isChildOf(d,e)&&!y.isBlock(e)&&!m(d)&&!m(e))return d=o(y,d,"span",{id:"_start","data-mce-type":"bookmark"}),A(d),void(d=C(!0));d=o(y,d,"span",{id:"_start","data-mce-type":"bookmark"}),e=o(y,e,"span",{id:"_end","data-mce-type":"bookmark"}),A(d),A(e),d=C(!0),e=C()}else d=e=A(d);b.startContainer=d.parentNode?d.parentNode:d,b.startOffset
=y.nodeIndex(d),b.endContainer=e.parentNode?e.parentNode:e,b.endOffset=y.nodeIndex(e)+1}new c(y).walk(b,function(b){k(b,function(b){B(b),1===b.nodeType&&"underline"===a.dom.getStyle(b,"text-decoration")&&b.parentNode&&"underline"===g.getTextDecoration(y,b.parentNode)&&t(a,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:"underline"}},null,b)})})};if(l)return void(l.nodeType?(r=y.createRng(),r.setStartBefore(l),r.setEndAfter(l),D(r)):D(l));if("false"!==y.getContentEditable(z.getNode()))z.isCollapsed()&&w.inline&&!y.select("td[data-mce-selected],th[data-mce-selected]").length?e.removeCaretFormat(a,d,j,p):(q=z.getBookmark(),D(z.getRng(!0)),z.moveToBookmark(q),w.inline&&h.match(a,d,j,z.getStart())&&g.moveStart(y,z,z.getRng(!0)),a.nodeChanged());else{l=z.getNode();for(var E=0,F=s.length;E<F&&(!s[E].ceFalseOverride||!t(a,s[E],j,l,l));E++);}
};return{removeFormat:t,remove:w}}),g("tinymce.core.fmt.MergeFormats",["ephox.katamari.api.Fun","tinymce.core.dom.BookmarkManager","tinymce.core.dom.ElementUtils","tinymce.core.dom.NodeType","tinymce.core.fmt.CaretFormat","tinymce.core.fmt.FormatUtils","tinymce.core.fmt.MatchFormat","tinymce.core.fmt.RemoveFormat","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g,h,i){var j=i.each,k=function(a){return a&&1===a.nodeType&&!b.isBookmarkNode(a)&&!e.isCaretNode(a)&&!d.isBogus(a)},l=function(a,c){var d;for(d=a;d;d=d[c]){if(3===d.nodeType&&0!==d.nodeValue.length)return a;if(1===d.nodeType&&!b.isBookmarkNode(d))return d}return a},m=function(a,b,d){var e,f,g=new c(a);if(b&&d&&(b=l(b,"previousSibling"),d=l(d,"nextSibling"),g.compare(b,d))){for(e=b.nextSibling;e&&e!==d;)f=e,e=e.nextSibling,b.appendChild(f
);return a.remove(d),i.each(i.grep(d.childNodes),function(a){b.appendChild(a)}),b}return d},n=function(a,b,c){j(a.childNodes,function(a){k(a)&&(b(a)&&c(a),a.hasChildNodes()&&n(a,b,c))})},o=function(b,c){return a.curry(function(a,c){return!(!c||!f.getStyle(b,c,a))},c)},p=function(b,c,d){return a.curry(function(a,c,d){b.setStyle(d,a,c),""===d.getAttribute("style")&&d.removeAttribute("style"),q(b,d)},c,d)},q=function(a,b){"SPAN"===b.nodeName&&0===a.getAttribs(b).length&&a.remove(b,!0)},r=function(a,b){var c;1===b.nodeType&&b.parentNode&&1===b.parentNode.nodeType&&(c=f.getTextDecoration(a,b.parentNode),a.getStyle(b,"color")&&c?a.setStyle(b,"text-decoration",c):a.getStyle(b,"text-decoration")===c&&a.setStyle(b,"text-decoration",null))},s=function(b,c,d,e){(c.styles.color||c.styles.textDecoration)&&(i.walk(e,a.curry
(r,b),"childNodes"),r(b,e))},t=function(a,b,c,d){b.styles&&b.styles.backgroundColor&&n(d,o(a,"fontSize"),p(a,"backgroundColor",f.replaceVars(b.styles.backgroundColor,c)))},u=function(a,b,c,d){"sub"!==b.inline&&"sup"!==b.inline||(n(d,o(a,"fontSize"),p(a,"fontSize","")),a.remove(a.select("sup"===b.inline?"sub":"sup",d),!0))},v=function(a,b,c,d){d&&b.merge_siblings!==!1&&(d=m(a,f.getNonWhiteSpaceSibling(d),d),d=m(a,d,f.getNonWhiteSpaceSibling(d,!0)))},w=function(a,b,c){if(b.clear_child_styles){var d=b.links?"*:not(a)":"*";j(a.select(d,c),function(c){k(c)&&j(b.styles,function(b,d){a.setStyle(c,d,"")})})}},x=function(a,b,c,d){j(b,function(b){j(a.dom.select(b.inline,d),function(d){k(d)&&h.removeFormat(a,b,c,d,b.exact?d:null)}),w(a.dom,b,d)})},y=function(a,b,c,d,e){g.matchNode(a,e.parentNode,c,d)&
amp;&h.removeFormat(a,b,d,e)||b.merge_with_parents&&a.dom.getParent(e.parentNode,function(f){if(g.matchNode(a,f,c,d))return h.removeFormat(a,b,d,e),!0})};return{mergeWithChildren:x,mergeUnderlineAndColor:s,mergeBackgroundColorAndFontSize:t,mergeSubSup:u,mergeSiblings:v,mergeWithParents:y}}),g("tinymce.core.fmt.ApplyFormat",["tinymce.core.dom.BookmarkManager","tinymce.core.dom.NodeType","tinymce.core.dom.RangeNormalizer","tinymce.core.dom.RangeUtils","tinymce.core.fmt.CaretFormat","tinymce.core.fmt.ExpandRange","tinymce.core.fmt.FormatUtils","tinymce.core.fmt.Hooks","tinymce.core.fmt.MatchFormat","tinymce.core.fmt.MergeFormats","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g,h,i,j,k){var l=k.each,m=function(c){return c&&1===c.nodeType&&!a.isBookmarkNode(c)&&!e.isCaretNode(c)&&!b.isBogus(c)},n=function(b,o,p,q){var r,s,t=
b.formatter.get(o),u=t[0],v=!q&&b.selection.isCollapsed(),w=b.dom,x=b.selection,y=function(a,b){if(b=b||u,a){if(b.onformat&&b.onformat(a,b,p,q),l(b.styles,function(b,c){w.setStyle(a,c,g.replaceVars(b,p))}),b.styles){var c=w.getAttrib(a,"style");c&&a.setAttribute("data-mce-style",c)}l(b.attributes,function(b,c){w.setAttrib(a,c,g.replaceVars(b,p))}),l(b.classes,function(b){b=g.replaceVars(b,p),w.hasClass(a,b)||w.addClass(a,b)})}},z=function(a,b){var c=!1;return!!u.selector&&(l(a,function(a){if(!("collapsed"in a&&a.collapsed!==v))return w.is(b,a.selector)&&!e.isCaretNode(b)?(y(b,a),c=!0,!1):void 0}),c)},A=function(c,f,h,n){var q,r,s=[],v=!0;q=u.inline||u.block,r=c.create(q),y(r),new d(c).walk(f,function(a){var d,f=function(a){var h,j,m,w;if(w=v,h=a.nodeName.toLowerCase(),j=a.parentNode.nodeName.toLowerCase(),1===a.nodeType&&c.getContentEditable(a)&&(w=v,v="true"===c.getContentEditabl
e(a),m=!0),g.isEq(h,"br"))return d=0,void(u.block&&c.remove(a));if(u.wrapper&&i.matchNode(b,a,o,p))return void(d=0);if(v&&!m&&u.block&&!u.wrapper&&g.isTextBlock(b,h)&&g.isValid(b,j,q))return a=c.rename(a,q),y(a),s.push(a),void(d=0);if(u.selector){var x=z(t,a);if(!u.inline||x)return void(d=0)}!v||m||!g.isValid(b,q,h)||!g.isValid(b,j,q)||!n&&3===a.nodeType&&1===a.nodeValue.length&&65279===a.nodeValue.charCodeAt(0)||e.isCaretNode(a)||u.inline&&c.isBlock(a)?(d=0,l(k.grep(a.childNodes),f),m&&(v=w),d=0):(d||(d=c.clone(r,!1),a.parentNode.insertBefore(d,a),s.push(d)),d.appendChild(a))};l(a,f)}),u.links===!0&&l(s,function(a){var b=function(a){"A"===a.nodeName&&y(a,u),l(k.grep(a.childNodes),b)};b(a)}),l(s,function(d){var e,f=function(b){var c=0;return l(b.childNodes,function(b){g.isWhiteSpaceNode(b)||a.isBookmarkNode(b)||c++}),c},h=function(a){var b=!1;return l(a
.childNodes,function(a){if(m(a))return b=a,!1}),b},k=function(b){var d,e;return d=h(b),d&&!a.isBookmarkNode(d)&&i.matchName(c,d,u)&&(e=c.clone(d,!1),y(e),c.replace(e,b,!0),c.remove(d,1)),e||b};return e=f(d),(s.length>1||!c.isBlock(d))&&0===e?void c.remove(d,1):void((u.inline||u.wrapper)&&(u.exact||1!==e||(d=k(d)),j.mergeWithChildren(b,t,p,d),j.mergeWithParents(b,u,o,p,d),j.mergeBackgroundColorAndFontSize(c,u,p,d),j.mergeSubSup(c,u,p,d),j.mergeSiblings(c,u,p,d)))})};if("false"!==w.getContentEditable(x.getNode())){if(u){if(q)q.nodeType?z(t,q)||(s=w.createRng(),s.setStartBefore(q),s.setEndAfter(q),A(w,f.expandRng(b,s,t),null,!0)):A(w,q,null,!0);else if(v&&u.inline&&!w.select("td[data-mce-selected],th[data-mce-selected]").length)e.applyCaretFormat(b,o,p);else{var B=b.selection.getNode();b.settings.forced_root_block||!t[0].defaultBlock||w.getParent(B,w.isBlock)||n(b,t[0].defaultBlock),b.selection.setRng(c.norm
alize(b.selection.getRng())),r=x.getBookmark(),A(w,f.expandRng(b,x.getRng(!0),t),r),u.styles&&j.mergeUnderlineAndColor(w,u,p,B),x.moveToBookmark(r),g.moveStart(w,x,x.getRng(!0)),b.nodeChanged()}h.postProcess(o,b)}}else{q=x.getNode();for(var C=0,D=t.length;C<D;C++)if(t[C].ceFalseOverride&&w.is(q,t[C].selector))return void y(q,t[C])}};return{applyFormat:n}}),g("tinymce.core.fmt.FormatChanged",["ephox.katamari.api.Cell","tinymce.core.fmt.FormatUtils","tinymce.core.fmt.MatchFormat","tinymce.core.util.Tools"],function(a,b,c,d){var e=d.each,f=function(a,f){var g={};a.set({}),f.on("NodeChange",function(h){var i=b.getParents(f.dom,h.element),j={};i=d.grep(i,function(a){return 1===a.nodeType&&!a.getAttribute("data-mce-bogus")}),e(a.get(),function(a,b){e(i,function(d){return f.formatter.matchNode(d,b,{},a.similar)?(g[b]||(e(a,function(a){a(!0,{node:d,format:b,parents:i})}),g[b]=a),j[b]=a,!1):!c.ma
tchesUnInheritedFormatSelector(f,d,b)&&void 0})}),e(g,function(a,b){j[b]||(delete g[b],e(a,function(a){a(!1,{node:h.element,format:b,parents:i})}))})})},g=function(a,b,c,d){var f=a.get();e(b.split(","),function(a){f[a]||(f[a]=[],f[a].similar=d),f[a].push(c)}),a.set(f)},h=function(a,b,c,d,e){null===b.get()&&f(b,a),g(b,c,d,e)};return{formatChanged:h}}),g("tinymce.core.fmt.DefaultFormats",["tinymce.core.util.Tools"],function(a){var b=function(b){var c={valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure.image",collapsed:!1,classes:"align-left",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:&quo
t;left"},inherit:!1,preview:!1,defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"left"},preview:"font-family font-size"}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"center"},inherit:!1,preview:"font-family font-size",defaultBlock:"div"},{selector:"figure.image",collapsed:!1,classes:"align-center",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"img",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"},preview:"font-family font-size"}],alignright:[{selector:"figure.image",collapsed:!1,classes:"align-right",ceFalseOverride:!0,preview:"font-family font-size"},{s
elector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"right"},inherit:!1,preview:"font-family font-size",defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"right"},preview:"font-family font-size"}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"justify"},inherit:!1,defaultBlock:"div",preview:"font-family font-size"}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all&qu
ot;}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:!0},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},fontname:{inline:"span",styles:{fontFamily:"%value"},clear_child_styles:!0},fontsize:{inline:"span",styles:{fontSize:"%value"},clear_child_styles:!0},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},code:{inline:"code"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:function(){return!0},onformat:fun
ction(c,d,e){a.each(e,function(a,d){b.setAttrib(c,d,a)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]};return a.each("p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp".split(/\s/),function(a){c[a]={block:a,remove:"all"}}),c};return{get:b}}),g("tinymce.core.fmt.FormatRegistry",["tinymce.core.fmt.DefaultFormats","tinymce.core.util.Tools"],function(a,b){return function(c){var d={},e=function(a){return a?d[a]:d},f=function(a,c){a&&("string"!=typeof a?b.each(a,function(a,b){f(b,a)}):(c=c.length?c:[c],b.each(c,function(a){"undefined"==typeof a.deep
&&(a.deep=!a.selector),"undefined"==typeof a.split&&(a.split=!a.selector||a.inline),"undefined"==typeof a.remove&&a.selector&&!a.inline&&(a.remove="none"),a.selector&&a.inline&&(a.mixed=!0,a.block_expand=!0),"string"==typeof a.classes&&(a.classes=a.classes.split(/\s+/))}),d[a]=c))},g=function(a){return a&&d[a]&&delete d[a],d};return f(a.get(c.dom)),f(c.settings.formats),{get:e,register:f,unregister:g}}}),g("tinymce.core.fmt.Preview",["tinymce.core.dom.DOMUtils","tinymce.core.util.Tools","tinymce.core.html.Schema"],function(a,b,c){function d(a,d){function e(a,b){b.classes.length&&j.addClass(a,b.classes.join(" ")),j.setAttribs(a,b.attrs)}function f(a){var b;return k="string"==typeof a?{name:a,classes:[],attrs:{}}:a,b=j.create(k.name),e(b,k),b}function g(a,c){var d="string"!=typeof a?a.nodeN
ame.toLowerCase():a,e=m.getElementRule(d),f=e&&e.parentsRequired;return!(!f||!f.length)&&(c&&b.inArray(f,c)!==-1?c:f[0])}function h(a,c,d){var e,i,k,l=c.length>0&&c[0],m=l&&l.name;if(k=g(a,m))m===k?(i=c[0],c=c.slice(1)):i=k;else if(l)i=c[0],c=c.slice(1);else if(!d)return a;return i&&(e=f(i),e.appendChild(a)),d&&(e||(e=j.create("div"),e.appendChild(a)),b.each(d,function(b){var c=f(b);e.insertBefore(c,a)})),h(e,c,i&&i.siblings)}var i,k,l,m=d&&d.schema||new c({});return a&&a.length?(k=a[0],i=f(k),l=j.create("div"),l.appendChild(h(i,a.slice(1),k.siblings)),l):""}function e(a,b){return d(g(a),b)}function f(a){var c,d={classes:[],attrs:{}};return a=d.selector=b.trim(a),"*"!==a&&(c=a.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,function(a,c,e,f,g){switch(c){case"#":d.attrs.id=e;break;case".":d.classes.push(e);break;case":":b
.inArray("checked disabled enabled read-only required".split(" "),e)!==-1&&(d.attrs[e]=e)}if("["===f){var h=g.match(/([\w\-]+)(?:\=\"([^\"]+))?/);h&&(d.attrs[h[1]]=h[2])}return""})),d.name=c||"div",d}function g(a){return a&&"string"==typeof a?(a=a.split(/\s*,\s*/)[0],a=a.replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),b.map(a.split(/(?:>|\s+(?![^\[\]]+\]))/),function(a){var c=b.map(a.split(/(?:~\+|~|\+)/),f),d=c.pop();return c.length&&(d.siblings=c),d}).reverse()):[]}function h(a,b){function c(a){return a.replace(/%(\w+)/g,"")}var e,f,h,k,l,m,n="";if(m=a.settings.preview_styles,m===!1)return"";if("string"!=typeof m&&(m="font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow"),"string"==typeof b){if(b=a.formatter.get(b),!b)return
;b=b[0]}return"preview"in b&&(m=b.preview,m===!1)?"":(e=b.block||b.inline||"span",k=g(b.selector),k.length?(k[0].name||(k[0].name=e),e=b.selector,f=d(k,a)):f=d([e],a),h=j.select(e,f)[0]||f.firstChild,i(b.styles,function(a,b){a=c(a),a&&j.setStyle(h,b,a)}),i(b.attributes,function(a,b){a=c(a),a&&j.setAttrib(h,b,a)}),i(b.classes,function(a){a=c(a),j.hasClass(h,a)||j.addClass(h,a)}),a.fire("PreviewFormats"),j.setStyles(f,{position:"absolute",left:-65535}),a.getBody().appendChild(f),l=j.getStyle(a.getBody(),"fontSize",!0),l=/px$/.test(l)?parseInt(l,10):0,i(m.split(" "),function(b){var c=j.getStyle(h,b,!0);if(!("background-color"===b&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(c)&&(c=j.getStyle(a.getBody(),b,!0),"#ffffff"===j.toHex(c).toLowerCase())||"color"===b&&"#000000"===j.toHex(c).toLowerCase())){if("font-size"===b&&a
mp;/em|%$/.test(c)){if(0===l)return;c=parseFloat(c,10)/(/%$/.test(c)?100:1),c=c*l+"px"}"border"===b&&c&&(n+="padding:0 2px;"),n+=b+":"+c+";"}}),a.fire("AfterPreviewFormats"),j.remove(f),n)}var i=b.each,j=a.DOM;return{getCssText:h,parseSelector:g,selectorToHtml:e}}),g("tinymce.core.fmt.ToggleFormat",["tinymce.core.fmt.ApplyFormat","tinymce.core.fmt.MatchFormat","tinymce.core.fmt.RemoveFormat"],function(a,b,c){var d=function(d,e,f,g,h){var i=e.get(f);!b.match(d,f,g,h)||"toggle"in i[0]&&!i[0].toggle?a.applyFormat(d,f,g,h):c.remove(d,f,g,h)};return{toggle:d}}),g("tinymce.core.keyboard.FormatShortcuts",[],function(){var a=function(a){a.addShortcut("meta+b","","Bold"),a.addShortcut("meta+i","","Italic"),a.addShortcut("meta+u","","Underline");for(var b=1;b<
=6;b++)a.addShortcut("access+"+b,"",["FormatBlock",!1,"h"+b]);a.addShortcut("access+7","",["FormatBlock",!1,"p"]),a.addShortcut("access+8","",["FormatBlock",!1,"div"]),a.addShortcut("access+9","",["FormatBlock",!1,"address"])};return{setup:a}}),g("tinymce.core.api.Formatter",["ephox.katamari.api.Cell","ephox.katamari.api.Fun","tinymce.core.fmt.ApplyFormat","tinymce.core.fmt.FormatChanged","tinymce.core.fmt.FormatRegistry","tinymce.core.fmt.MatchFormat","tinymce.core.fmt.Preview","tinymce.core.fmt.RemoveFormat","tinymce.core.fmt.ToggleFormat","tinymce.core.keyboard.FormatShortcuts"],function(a,b,c,d,e,f,g,h,i,j){return function(k){var l=e(k),m=a(null);return j.setup(k),{get:l.get,register:l.register,unregister:l.unregi
ster,apply:b.curry(c.applyFormat,k),remove:b.curry(h.remove,k),toggle:b.curry(i.toggle,k,l),match:b.curry(f.match,k),matchAll:b.curry(f.matchAll,k),matchNode:b.curry(f.matchNode,k),canApply:b.curry(f.canApply,k),formatChanged:b.curry(d.formatChanged,k,m),getCssText:b.curry(g.getCssText,k)}}}),g("ephox.sugar.api.properties.Attr",["ephox.katamari.api.Type","ephox.katamari.api.Arr","ephox.katamari.api.Obj","ephox.sugar.api.node.Node","global!Error","global!console"],function(a,b,c,d,e,f){var g=function(b,c,d){if(!(a.isString(d)||a.isBoolean(d)||a.isNumber(d)))throw f.error("Invalid call to Attr.set. Key ",c,":: Value ",d,":: Element ",b),new e("Attribute value was not simple");b.setAttribute(c,d+"")},h=function(a,b,c){g(a.dom(),b,c)},i=function(a,b){var d=a.dom();c.each(b,function(a,b){g(d,b,a)})},j=function(a,b){var c=a.dom().getAttribute(b);return null===c?void 0:c}
,k=function(a,b){var c=a.dom();return!(!c||!c.hasAttribute)&&c.hasAttribute(b)},l=function(a,b){a.dom().removeAttribute(b)},m=function(a){var b=a.dom().attributes;return void 0===b||null===b||0===b.length},n=function(a){return b.foldl(a.dom().attributes,function(a,b){return a[b.name]=b.value,a},{})},o=function(a,b,c){k(a,c)&&!k(b,c)&&h(b,c,j(a,c))},p=function(a,c,e){d.isElement(a)&&d.isElement(c)&&b.each(e,function(b){o(a,c,b)})};return{clone:n,set:h,setAll:i,get:j,has:k,remove:l,hasNone:m,transfer:p}}),g("ephox.sugar.impl.Style",[],function(){var a=function(a){return void 0!==a.style};return{isSupported:a}}),h("global!window",window),g("ephox.sugar.api.properties.Css",["ephox.katamari.api.Type","ephox.katamari.api.Arr","ephox.katamari.api.Obj","ephox.katamari.api.Option","ephox.sugar.api.properties.Attr","ephox.sugar.api.node.Body","ephox.sugar.api.
node.Element","ephox.sugar.api.node.Node","ephox.sugar.impl.Style","ephox.katamari.api.Strings","global!Error","global!console","global!window"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n=function(b,c,d){if(!a.isString(d))throw l.error("Invalid call to CSS.set. Property ",c,":: Value ",d,":: Element ",b),new k("CSS value must be a string: "+d);i.isSupported(b)&&b.style.setProperty(c,d)},o=function(a,b){i.isSupported(a)&&a.style.removeProperty(b)},p=function(a,b,c){var d=a.dom();n(d,b,c)},q=function(a,b){var d=a.dom();c.each(b,function(a,b){n(d,b,a)})},r=function(a,b){var d=a.dom();c.each(b,function(a,b){a.fold(function(){o(d,b)},function(a){n(d,b,a)})})},s=function(a,b){var c=a.dom(),d=m.getComputedStyle(c),e=d.getPropertyValue(b),g=""!==e||f.inBody(a)?e:t(c,b);return null===g?void 0:g},t=function(a,b){return i.isSupported(a)?a.style.getPropertyValue(b):&
quot;"},u=function(a,b){var c=a.dom(),e=t(c,b);return d.from(e).filter(function(a){return a.length>0})},v=function(a,b,c){var d=g.fromTag(a);p(d,b,c);var e=u(d,b);return e.isSome()},w=function(a,b){var c=a.dom();o(c,b),e.has(a,"style")&&""===j.trim(e.get(a,"style"))&&e.remove(a,"style")},x=function(a,b){var c=e.get(a,"style"),d=b(a),f=void 0===c?e.remove:e.set;return f(a,"style",c),d},y=function(a,b){var c=a.dom(),d=b.dom();i.isSupported(c)&&i.isSupported(d)&&(d.style.cssText=c.style.cssText)},z=function(a){return a.dom().offsetWidth},A=function(a,b,c){u(a,c).each(function(a){u(b,c).isNone()&&p(b,c,a)})},B=function(a,c,d){h.isElement(a)&&h.isElement(c)&&b.each(d,function(b){A(a,c,b)})};return{copy:y,set:p,preserve:x,setAll:q,setOptions:r,remove:w,get:s,getRaw:u,isValidValue:v,reflow:z,transfer:B}}),g("tinymce.core.EditorView",["ephox.katamari.api
.Fun","ephox.katamari.api.Option","ephox.sugar.api.dom.Compare","ephox.sugar.api.node.Element","ephox.sugar.api.properties.Css","ephox.sugar.api.search.Traverse"],function(a,b,c,d,e,f){var g=function(a,b){var c=b.dom();return c[a]},h=function(a,b){return parseInt(e.get(b,a),10)},i=a.curry(g,"clientWidth"),j=a.curry(g,"clientHeight"),k=a.curry(h,"margin-top"),l=a.curry(h,"margin-left"),m=function(a){return a.dom().getBoundingClientRect()},n=function(a,b,c){var d=i(a),e=j(a);return b>=0&&c>=0&&b<=d&&c<=e},o=function(a,b,c,d){var e=m(b),f=a?e.left+b.dom().clientLeft+l(b):0,g=a?e.top+b.dom().clientTop+k(b):0,h=c-f,i=d-g;return{x:h,y:i}},p=function(a,b,c){var e=d.fromDom(a.getBody()),g=a.inline?e:f.documentElement(e),h=o(a.inline,g,b,c);return n(g,h.x,h.y)},q=function(a){return b.from(a).map(d.fromDom)},r=function(a){var b=a.inline?a.getBody():a.getContentAre
aContainer();return q(b).map(function(a){return c.contains(f.owner(a),a)}).getOr(!1)};return{isXYInContentArea:p,isEditorAttachedToDom:r}}),g("tinymce.core.ui.DomUtils",["tinymce.core.Env","tinymce.core.util.Tools","tinymce.core.dom.DOMUtils"],function(a,b,c){"use strict";var d=0,e={id:function(){return"mceu_"+d++},create:function(a,d,e){var f=document.createElement(a);return c.DOM.setAttribs(f,d),"string"==typeof e?f.innerHTML=e:b.each(e,function(a){a.nodeType&&f.appendChild(a)}),f},createFragment:function(a){return c.DOM.createFragment(a)},getWindowSize:function(){return c.DOM.getViewPort()},getSize:function(a){var b,c;if(a.getBoundingClientRect){var d=a.getBoundingClientRect();b=Math.max(d.width||d.right-d.left,a.offsetWidth),c=Math.max(d.height||d.bottom-d.bottom,a.offsetHeight)}else b=a.offsetWidth,c=a.offsetHeight;return{width:b,height:c}},getPos:function(a,b){return c.DOM.getPos(a,b||e.getContainer(
))},getContainer:function(){return a.container?a.container:document.body},getViewPort:function(a){return c.DOM.getViewPort(a)},get:function(a){return document.getElementById(a)},addClass:function(a,b){return c.DOM.addClass(a,b)},removeClass:function(a,b){return c.DOM.removeClass(a,b)},hasClass:function(a,b){return c.DOM.hasClass(a,b)},toggleClass:function(a,b,d){return c.DOM.toggleClass(a,b,d)},css:function(a,b,d){return c.DOM.setStyle(a,b,d)},getRuntimeStyle:function(a,b){return c.DOM.getStyle(a,b,!0)},on:function(a,b,d,e){return c.DOM.bind(a,b,d,e)},off:function(a,b,d){return c.DOM.unbind(a,b,d)},fire:function(a,b,d){return c.DOM.fire(a,b,d)},innerHtml:function(a,b){c.DOM.setHTML(a,b)}};return e}),g("tinymce.core.util.Class",["tinymce.core.util.Tools"],function(a){function b(){}var c,d,e=a.each,f=a.extend;return b.extend=c=function(a){function b(){var a,b,c,e=this;if(!d&&(e.init&&e.init.apply(e,arguments),b=e.Mixins))for(a=b.length;a--;)c=b[a],c
.init&&c.init.apply(e,arguments)}function g(){return this}function h(a,b){return function(){var c,d=this,e=d._super;return d._super=m[a],c=b.apply(d,arguments),d._super=e,c}}var i,j,k,l=this,m=l.prototype;d=!0,i=new l,d=!1,a.Mixins&&(e(a.Mixins,function(b){for(var c in b)"init"!==c&&(a[c]=b[c])}),m.Mixins&&(a.Mixins=m.Mixins.concat(a.Mixins))),a.Methods&&e(a.Methods.split(","),function(b){a[b]=g}),a.Properties&&e(a.Properties.split(","),function(b){var c="_"+b;a[b]=function(a){var b,d=this;return a!==b?(d[c]=a,d):d[c]}}),a.Statics&&e(a.Statics,function(a,c){b[c]=a}),a.Defaults&&m.Defaults&&(a.Defaults=f({},m.Defaults,a.Defaults));for(j in a)k=a[j],"function"==typeof k&&m[j]?i[j]=h(j,k):i[j]=k;return b.prototype=i,b.constructor=b,b.extend=c,b},b}),g("tinymce.core.util.EventDispatcher",["tinymce.core.util.Tools"],function(a){function b(b
){function c(){return!1}function d(){return!0}function e(a,e){var f,h,i,k;if(a=a.toLowerCase(),e=e||{},e.type=a,e.target||(e.target=j),e.preventDefault||(e.preventDefault=function(){e.isDefaultPrevented=d},e.stopPropagation=function(){e.isPropagationStopped=d},e.stopImmediatePropagation=function(){e.isImmediatePropagationStopped=d},e.isDefaultPrevented=c,e.isPropagationStopped=c,e.isImmediatePropagationStopped=c),b.beforeFire&&b.beforeFire(e),f=m[a])for(h=0,i=f.length;h<i;h++){if(k=f[h],k.once&&g(a,k.func),e.isImmediatePropagationStopped())return e.stopPropagation(),e;if(k.func.call(j,e)===!1)return e.preventDefault(),e}return e}function f(b,d,e,f){var g,h,i;if(d===!1&&(d=c),d)for(d={func:d},f&&a.extend(d,f),h=b.toLowerCase().split(" "),i=h.length;i--;)b=h[i],g=m[b],g||(g=m[b]=[],k(b,!0)),e?g.unshift(d):g.push(d);return l}function g(a,b){var c,d,e,f,g;if(a)for(f=a.toLowerCase().split(" "),c=f.length;c--;){if(a=f[c],d=m[a],!a){fo
r(e in m)k(e,!1),delete m[e];return l}if(d){if(b)for(g=d.length;g--;)d[g].func===b&&(d=d.slice(0,g).concat(d.slice(g+1)),m[a]=d);else d.length=0;d.length||(k(a,!1),delete m[a])}}else{for(a in m)k(a,!1);m={}}return l}function h(a,b,c){return f(a,b,c,{once:!0})}function i(a){return a=a.toLowerCase(),!(!m[a]||0===m[a].length)}var j,k,l=this,m={};b=b||{},j=b.scope||l,k=b.toggleEvent||c,l.fire=e,l.on=f,l.off=g,l.once=h,l.has=i}var c=a.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend"," ");return b.isNative=function(a){return!!c[a.toLowerCase()]},b}),g("tinymce.core.data.Binding",[],function(){function a(a){this.create=a.create}return a.create=functi
on(b,c){return new a({create:function(a,d){function e(b){a.set(d,b.value)}function f(a){b.set(c,a.value)}var g;return a.on("change:"+d,f),b.on("change:"+c,e),g=a._bindings,g||(g=a._bindings=[],a.on("destroy",function(){for(var a=g.length;a--;)g[a]()})),g.push(function(){b.off("change:"+c,e)}),b.get(c)}})},a}),g("tinymce.core.util.Observable",["tinymce.core.util.EventDispatcher"],function(a){function b(b){return b._eventDispatcher||(b._eventDispatcher=new a({scope:b,toggleEvent:function(c,d){a.isNative(c)&&b.toggleNativeEvent&&b.toggleNativeEvent(c,d)}})),b._eventDispatcher}return{fire:function(a,c,d){var e=this;if(e.removed&&"remove"!==a)return c;if(c=b(e).fire(a,c,d),d!==!1&&e.parent)for(var f=e.parent();f&&!c.isPropagationStopped();)f.fire(a,c,!1),f=f.parent();return c},on:function(a,c,d){return b(this).on(a,c,d)},off:function(a,c){return b(this).off(a,c)},once:function(a,
c){return b(this).once(a,c)},hasEventListeners:function(a){return b(this).has(a)}}}),g("tinymce.core.data.ObservableObject",["tinymce.core.data.Binding","tinymce.core.util.Class","tinymce.core.util.Observable","tinymce.core.util.Tools"],function(a,b,c,d){function e(a){return a.nodeType>0}function f(a,b){var c,g;if(a===b)return!0;if(null===a||null===b)return a===b;if("object"!=typeof a||"object"!=typeof b)return a===b;if(d.isArray(b)){if(a.length!==b.length)return!1;for(c=a.length;c--;)if(!f(a[c],b[c]))return!1}if(e(a)||e(b))return a===b;g={};for(c in b){if(!f(a[c],b[c]))return!1;g[c]=!0}for(c in a)if(!g[c]&&!f(a[c],b[c]))return!1;return!0}return b.extend({Mixins:[c],init:function(b){var c,d;b=b||{};for(c in b)d=b[c],d instanceof a&&(b[c]=d.create(this,c));this.data=b},set:function(b,c){var d,e,g=this.data[b];if(c instanceof a&&(c=c.create(this,b)),"object"==typeof b){for(d in b
)this.set(d,b[d]);return this}return f(g,c)||(this.data[b]=c,e={target:this,name:b,value:c,oldValue:g},this.fire("change:"+b,e),this.fire("change",e)),this},get:function(a){return this.data[a]},has:function(a){return a in this.data},bind:function(b){return a.create(this,b)},destroy:function(){this.fire("destroy")}})}),g("tinymce.core.ui.Selector",["tinymce.core.util.Class"],function(a){"use strict";function b(a){for(var b,c=[],d=a.length;d--;)b=a[d],b.__checked||(c.push(b),b.__checked=1);for(d=c.length;d--;)delete c[d].__checked;return c}var c,d=/^([\w\\*]+)?(?:#([\w\-\\]+))?(?:\.([\w\\\.]+))?(?:\[\@?([\w\\]+)([\^\$\*!~]?=)([\w\\]+)\])?(?:\:(.+))?/i,e=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,f=/^\s*|\s*$/g,g=a.extend({init:function(a){function b(a){if(a)return a=a.toLowerCase(),function(b){return"*&quo
t;===a||b.type===a}}function c(a){if(a)return function(b){return b._name===a}}function g(a){if(a)return a=a.split("."),function(b){for(var c=a.length;c--;)if(!b.classes.contains(a[c]))return!1;return!0}}function h(a,b,c){if(a)return function(d){var e=d[a]?d[a]():"";return b?"="===b?e===c:"*="===b?e.indexOf(c)>=0:"~="===b?(" "+e+" ").indexOf(" "+c+" ")>=0:"!="===b?e!=c:"^="===b?0===e.indexOf(c):"$="===b&&e.substr(e.length-c.length)===c:!!c}}function i(a){var b;if(a)return a=/(?:not\((.+)\))|(.+)/i.exec(a),a[1]?(b=k(a[1],[]),function(a){return!l(a,b)}):(a=a[2],function(b,c,d){return"first"===a?0===c:"last"===a?c===d-1:"even"===a?c%2===0:"odd"===a?c%2===1:!!b[a]&&b[a]()})}function j(a,e,j){function k(a){a&&e.push(a)}var l;return l=d.exec(a.replace(f,"")),k(b(l[1])),k(c(l[2])),k(g(l[3])),k(
h(l[4],l[5],l[6])),k(i(l[7])),e.pseudo=!!l[7],e.direct=j,e}function k(a,b){var c,d,f,g=[];do if(e.exec(""),d=e.exec(a),d&&(a=d[3],g.push(d[1]),d[2])){c=d[3];break}while(d);for(c&&k(c,b),a=[],f=0;f<g.length;f++)">"!=g[f]&&a.push(j(g[f],[],">"===g[f-1]));return b.push(a),b}var l=this.match;this._selectors=k(a,[])},match:function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;for(b=b||this._selectors,c=0,d=b.length;c<d;c++){for(g=b[c],f=g.length,o=a,n=0,e=f-1;e>=0;e--)for(j=g[e];o;){if(j.pseudo)for(m=o.parent().items(),k=l=m.length;k--&&m[k]!==o;);for(h=0,i=j.length;h<i;h++)if(!j[h](o,k,l)){h=i+1;break}if(h===i){n++;break}if(e===f-1)break;o=o.parent()}if(n===f)return!0}return!1},find:function(a){function d(a,b,c){var e,f,g,i,j,k=b[c];for(e=0,f=a.length;e<f;e++){for(j=a[e],g=0,i=k.length;g<i;g++)if(!k[g](j,e,f)){g=i+1;break}if(g===i)c==b.length-1?h.push(j):j.items&&d(j.items(),b,c+1);else if(k.direct)retur
n;j.items&&d(j.items(),b,c)}}var e,f,h=[],i=this._selectors;if(a.items){for(e=0,f=i.length;e<f;e++)d(a.items(),i[e],0);f>1&&(h=b(h))}return c||(c=g.Collection),new c(h)}});return g}),g("tinymce.core.ui.Collection",["tinymce.core.util.Tools","tinymce.core.ui.Selector","tinymce.core.util.Class"],function(a,b,c){"use strict";var d,e,f=Array.prototype.push,g=Array.prototype.slice;return e={length:0,init:function(a){a&&this.add(a)},add:function(b){var c=this;return a.isArray(b)?f.apply(c,b):b instanceof d?c.add(b.toArray()):f.call(c,b),c},set:function(a){var b,c=this,d=c.length;for(c.length=0,c.add(a),b=c.length;b<d;b++)delete c[b];return c},filter:function(a){var c,e,f,g,h=this,i=[];for("string"==typeof a?(a=new b(a),g=function(b){return a.match(b)}):g=a,c=0,e=h.length;c<e;c++)f=h[c],g(f)&&i.push(f);return new d(i)},slice:function(){return new d(g.apply(this,arguments))},eq:function(a
){return a===-1?this.slice(a):this.slice(a,+a+1)},each:function(b){return a.each(this,b),this},toArray:function(){return a.toArray(this)},indexOf:function(a){for(var b=this,c=b.length;c--&&b[c]!==a;);return c},reverse:function(){return new d(a.toArray(this).reverse())},hasClass:function(a){return!!this[0]&&this[0].classes.contains(a)},prop:function(a,b){var c,d,e=this;return b!==c?(e.each(function(c){c[a]&&c[a](b)}),e):(d=e[0],d&&d[a]?d[a]():void 0)},exec:function(b){var c=this,d=a.toArray(arguments).slice(1);return c.each(function(a){a[b]&&a[b].apply(a,d)}),c},remove:function(){for(var a=this.length;a--;)this[a].remove();return this;
-},addClass:function(a){return this.each(function(b){b.classes.add(a)})},removeClass:function(a){return this.each(function(b){b.classes.remove(a)})}},a.each("fire on off show hide append prepend before after reflow".split(" "),function(b){e[b]=function(){var c=a.toArray(arguments);return this.each(function(a){b in a&&a[b].apply(a,c)}),this}}),a.each("text name disabled active selected checked visible parent value data".split(" "),function(a){e[a]=function(b){return this.prop(a,b)}}),d=c.extend(e),b.Collection=d,d}),g("tinymce.core.ui.BoxUtils",[],function(){"use strict";return{parseBox:function(a){var b,c=10;if(a)return"number"==typeof a?(a=a||0,{top:a,left:a,bottom:a,right:a}):(a=a.split(" "),b=a.length,1===b?a[1]=a[2]=a[3]=a[0]:2===b?(a[2]=a[0],a[3]=a[1]):3===b&&(a[3]=a[1]),{top:parseInt(a[0],c)||0,right:parseInt(a[1],c)||0,bottom:parseInt(a[2],c)||0,left:parseInt(a[3],c)||0})},measureBo
x:function(a,b){function c(b){var c=document.defaultView;return c?(b=b.replace(/[A-Z]/g,function(a){return"-"+a}),c.getComputedStyle(a,null).getPropertyValue(b)):a.currentStyle[b]}function d(a){var b=parseFloat(c(a),10);return isNaN(b)?0:b}return{top:d(b+"TopWidth"),right:d(b+"RightWidth"),bottom:d(b+"BottomWidth"),left:d(b+"LeftWidth")}}}}),g("tinymce.core.ui.ClassList",["tinymce.core.util.Tools"],function(a){"use strict";function b(){}function c(a){this.cls=[],this.cls._map={},this.onchange=a||b,this.prefix=""}return a.extend(c.prototype,{add:function(a){return a&&!this.contains(a)&&(this.cls._map[a]=!0,this.cls.push(a),this._change()),this},remove:function(a){if(this.contains(a)){for(var b=0;b<this.cls.length&&this.cls[b]!==a;b++);this.cls.splice(b,1),delete this.cls._map[a],this._change()}return this},toggle:function(a,b){var c=this.contains(a);return c!==b&&a
mp;(c?this.remove(a):this.add(a),this._change()),this},contains:function(a){return!!this.cls._map[a]},_change:function(){delete this.clsValue,this.onchange.call(this)}}),c.prototype.toString=function(){var a;if(this.clsValue)return this.clsValue;a="";for(var b=0;b<this.cls.length;b++)b>0&&(a+=" "),a+=this.prefix+this.cls[b];return a},c}),g("tinymce.core.ui.ReflowQueue",["tinymce.core.util.Delay"],function(a){var b,c={};return{add:function(d){var e=d.parent();if(e){if(!e._layout||e._layout.isNative())return;c[e._id]||(c[e._id]=e),b||(b=!0,a.requestAnimationFrame(function(){var a,d;b=!1;for(a in c)d=c[a],d.state.get("rendered")&&d.reflow();c={}},document.body))}},remove:function(a){c[a._id]&&delete c[a._id]}}}),g("tinymce.core.ui.Control",["tinymce.core.util.Class","tinymce.core.util.Tools","tinymce.core.util.EventDispatcher","tinymce.core.data.ObservableObject&
quot;,"tinymce.core.ui.Collection","tinymce.core.ui.DomUtils","tinymce.core.dom.DomQuery","tinymce.core.ui.BoxUtils","tinymce.core.ui.ClassList","tinymce.core.ui.ReflowQueue"],function(a,b,c,d,e,f,g,h,i,j){"use strict";function k(a){return a._eventDispatcher||(a._eventDispatcher=new c({scope:a,toggleEvent:function(b,d){d&&c.isNative(b)&&(a._nativeEvents||(a._nativeEvents={}),a._nativeEvents[b]=!0,a.state.get("rendered")&&l(a))}})),a._eventDispatcher}function l(a){function b(b){var c=a.getParentCtrl(b.target);c&&c.fire(b.type,b)}function c(){var a=j._lastHoverCtrl;a&&(a.fire("mouseleave",{target:a.getEl()}),a.parents().each(function(a){a.fire("mouseleave",{target:a.getEl()})}),j._lastHoverCtrl=null)}function d(b){var c,d,e,f=a.getParentCtrl(b.target),g=j._lastHoverCtrl,h=0;if(f!==g){if(j._lastHoverCtrl=f,d=f.parents().toArray().reverse(),d.push(f
),g){for(e=g.parents().toArray().reverse(),e.push(g),h=0;h<e.length&&d[h]===e[h];h++);for(c=e.length-1;c>=h;c--)g=e[c],g.fire("mouseleave",{target:g.getEl()})}for(c=h;c<d.length;c++)f=d[c],f.fire("mouseenter",{target:f.getEl()})}}function e(b){b.preventDefault(),"mousewheel"==b.type?(b.deltaY=-.025*b.wheelDelta,b.wheelDeltaX&&(b.deltaX=-.025*b.wheelDeltaX)):(b.deltaX=0,b.deltaY=b.detail),b=a.fire("wheel",b)}var f,h,i,j,k,l;if(k=a._nativeEvents){for(i=a.parents().toArray(),i.unshift(a),f=0,h=i.length;!j&&f<h;f++)j=i[f]._eventsRoot;for(j||(j=i[i.length-1]||a),a._eventsRoot=j,h=f,f=0;f<h;f++)i[f]._eventsRoot=j;var m=j._delegates;m||(m=j._delegates={});for(l in k){if(!k)return!1;"wheel"!==l||o?("mouseenter"===l||"mouseleave"===l?j._hasMouseEnter||(g(j.getEl()).on("mouseleave",c).on("mouseover",d),j._hasMouseEnter=1):m[l]||(g(j.getEl()).on(l,b),m[l]=!0),k[l]=!1
):n?g(a.getEl()).on("mousewheel",e):g(a.getEl()).on("DOMMouseScroll",e)}}}var m,n="onmousewheel"in document,o=!1,p="mce-",q=0,r={Statics:{classPrefix:p},isRtl:function(){return m.rtl},classPrefix:p,init:function(a){function c(a){var b;for(a=a.split(" "),b=0;b<a.length;b++)j.classes.add(a[b])}var e,f,j=this;j.settings=a=b.extend({},j.Defaults,a),j._id=a.id||"mceu_"+q++,j._aria={role:a.role},j._elmCache={},j.$=g,j.state=new d({visible:!0,active:!1,disabled:!1,value:""}),j.data=new d(a.data),j.classes=new i(function(){j.state.get("rendered")&&(j.getEl().className=this.toString())}),j.classes.prefix=j.classPrefix,e=a.classes,e&&(j.Defaults&&(f=j.Defaults.classes,f&&e!=f&&c(f)),c(e)),b.each("title text name visible disabled active value".split(" "),function(b){b in a&&j[b](a[b])}),j.on("click",function(){if(j.disabled())return!1}
),j.settings=a,j.borderBox=h.parseBox(a.border),j.paddingBox=h.parseBox(a.padding),j.marginBox=h.parseBox(a.margin),a.hidden&&j.hide()},Properties:"parent,name",getContainerElm:function(){return f.getContainer()},getParentCtrl:function(a){for(var b,c=this.getRoot().controlIdLookup;a&&c&&!(b=c[a.id]);)a=a.parentNode;return b},initLayoutRect:function(){var a,b,c,d,e,g,i,j,k,l,m=this,n=m.settings,o=m.getEl();a=m.borderBox=m.borderBox||h.measureBox(o,"border"),m.paddingBox=m.paddingBox||h.measureBox(o,"padding"),m.marginBox=m.marginBox||h.measureBox(o,"margin"),l=f.getSize(o),j=n.minWidth,k=n.minHeight,e=j||l.width,g=k||l.height,c=n.width,d=n.height,i=n.autoResize,i="undefined"!=typeof i?i:!c&&!d,c=c||e,d=d||g;var p=a.left+a.right,q=a.top+a.bottom,r=n.maxWidth||65535,s=n.maxHeight||65535;return m._layoutRect=b={x:n.x||0,y:n.y||0,w:c,h:d,deltaW:p,deltaH:q,contentW:c-p,contentH:d-q,innerW:c-p,innerH:d-q,star
tMinWidth:j||0,startMinHeight:k||0,minW:Math.min(e,r),minH:Math.min(g,s),maxW:r,maxH:s,autoResize:i,scrollW:0},m._lastLayoutRect={},b},layoutRect:function(a){var b,c,d,e,f,g,h=this,i=h._layoutRect;return i||(i=h.initLayoutRect()),a?(d=i.deltaW,e=i.deltaH,a.x!==f&&(i.x=a.x),a.y!==f&&(i.y=a.y),a.minW!==f&&(i.minW=a.minW),a.minH!==f&&(i.minH=a.minH),c=a.w,c!==f&&(c=c<i.minW?i.minW:c,c=c>i.maxW?i.maxW:c,i.w=c,i.innerW=c-d),c=a.h,c!==f&&(c=c<i.minH?i.minH:c,c=c>i.maxH?i.maxH:c,i.h=c,i.innerH=c-e),c=a.innerW,c!==f&&(c=c<i.minW-d?i.minW-d:c,c=c>i.maxW-d?i.maxW-d:c,i.innerW=c,i.w=c+d),c=a.innerH,c!==f&&(c=c<i.minH-e?i.minH-e:c,c=c>i.maxH-e?i.maxH-e:c,i.innerH=c,i.h=c+e),a.contentW!==f&&(i.contentW=a.contentW),a.contentH!==f&&(i.contentH=a.contentH),b=h._lastLayoutRect,b.x===i.x&&b.y===i.y&&b.w===i.w&&b.h===i.h||(g=m.repaintControls,g&&g.map&&!g.map[
h._id]&&(g.push(h),g.map[h._id]=!0),b.x=i.x,b.y=i.y,b.w=i.w,b.h=i.h),h):i},repaint:function(){var a,b,c,d,e,f,g,h,i,j,k=this;i=document.createRange?function(a){return a}:Math.round,a=k.getEl().style,d=k._layoutRect,h=k._lastRepaintRect||{},e=k.borderBox,f=e.left+e.right,g=e.top+e.bottom,d.x!==h.x&&(a.left=i(d.x)+"px",h.x=d.x),d.y!==h.y&&(a.top=i(d.y)+"px",h.y=d.y),d.w!==h.w&&(j=i(d.w-f),a.width=(j>=0?j:0)+"px",h.w=d.w),d.h!==h.h&&(j=i(d.h-g),a.height=(j>=0?j:0)+"px",h.h=d.h),k._hasBody&&d.innerW!==h.innerW&&(j=i(d.innerW),c=k.getEl("body"),c&&(b=c.style,b.width=(j>=0?j:0)+"px"),h.innerW=d.innerW),k._hasBody&&d.innerH!==h.innerH&&(j=i(d.innerH),c=c||k.getEl("body"),c&&(b=b||c.style,b.height=(j>=0?j:0)+"px"),h.innerH=d.innerH),k._lastRepaintRect=h,k.fire("repaint",{},!1)},updateLayoutRect:function(
){var a=this;a.parent()._lastRect=null,f.css(a.getEl(),{width:"",height:""}),a._layoutRect=a._lastRepaintRect=a._lastLayoutRect=null,a.initLayoutRect()},on:function(a,b){function c(a){var b,c;return"string"!=typeof a?a:function(e){return b||d.parentsAndSelf().each(function(d){var e=d.settings.callbacks;if(e&&(b=e[a]))return c=d,!1}),b?b.call(c,e):(e.action=a,void this.fire("execute",e))}}var d=this;return k(d).on(a,c(b)),d},off:function(a,b){return k(this).off(a,b),this},fire:function(a,b,c){var d=this;if(b=b||{},b.control||(b.control=d),b=k(d).fire(a,b),c!==!1&&d.parent)for(var e=d.parent();e&&!b.isPropagationStopped();)e.fire(a,b,!1),e=e.parent();return b},hasEventListeners:function(a){return k(this).has(a)},parents:function(a){var b,c=this,d=new e;for(b=c.parent();b;b=b.parent())d.add(b);return a&&(d=d.filter(a)),d},parentsAndSelf:function(a){return new e(this).add(this.parents(a))},next:function(){var a=this
.parent().items();return a[a.indexOf(this)+1]},prev:function(){var a=this.parent().items();return a[a.indexOf(this)-1]},innerHtml:function(a){return this.$el.html(a),this},getEl:function(a){var b=a?this._id+"-"+a:this._id;return this._elmCache[b]||(this._elmCache[b]=g("#"+b)[0]),this._elmCache[b]},show:function(){return this.visible(!0)},hide:function(){return this.visible(!1)},focus:function(){try{this.getEl().focus()}catch(a){}return this},blur:function(){return this.getEl().blur(),this},aria:function(a,b){var c=this,d=c.getEl(c.ariaTarget);return"undefined"==typeof b?c._aria[a]:(c._aria[a]=b,c.state.get("rendered")&&d.setAttribute("role"==a?a:"aria-"+a,b),c)},encode:function(a,b){return b!==!1&&(a=this.translate(a)),(a||"").replace(/[&<>"]/g,function(a){return"&#"+a.charCodeAt(0)+";"})},translate:function(a){return m.translate?m.translate(a):a},before:funct
ion(a){var b=this,c=b.parent();return c&&c.insert(a,c.items().indexOf(b),!0),b},after:function(a){var b=this,c=b.parent();return c&&c.insert(a,c.items().indexOf(b)),b},remove:function(){var a,b,c=this,d=c.getEl(),e=c.parent();if(c.items){var f=c.items().toArray();for(b=f.length;b--;)f[b].remove()}e&&e.items&&(a=[],e.items().each(function(b){b!==c&&a.push(b)}),e.items().set(a),e._lastRect=null),c._eventsRoot&&c._eventsRoot==c&&g(d).off();var h=c.getRoot().controlIdLookup;return h&&delete h[c._id],d&&d.parentNode&&d.parentNode.removeChild(d),c.state.set("rendered",!1),c.state.destroy(),c.fire("remove"),c},renderBefore:function(a){return g(a).before(this.renderHtml()),this.postRender(),this},renderTo:function(a){return g(a||this.getContainerElm()).append(this.renderHtml()),this.postRender(),this},preRender:function(){},render:function(){},renderHtml:function(){return'<div id="'+t
his._id+'" class="'+this.classes+'"></div>'},postRender:function(){var a,b,c,d,e,f=this,h=f.settings;f.$el=g(f.getEl()),f.state.set("rendered",!0);for(d in h)0===d.indexOf("on")&&f.on(d.substr(2),h[d]);if(f._eventsRoot){for(c=f.parent();!e&&c;c=c.parent())e=c._eventsRoot;if(e)for(d in e._nativeEvents)f._nativeEvents[d]=!0}l(f),h.style&&(a=f.getEl(),a&&(a.setAttribute("style",h.style),a.style.cssText=h.style)),f.settings.border&&(b=f.borderBox,f.$el.css({"border-top-width":b.top,"border-right-width":b.right,"border-bottom-width":b.bottom,"border-left-width":b.left}));var i=f.getRoot();i.controlIdLookup||(i.controlIdLookup={}),i.controlIdLookup[f._id]=f;for(var k in f._aria)f.aria(k,f._aria[k]);f.state.get("visible")===!1&&(f.getEl().style.display="none"),f.bindStates(),f.state.on("change:visible",function(a){var b,
c=a.value;f.state.get("rendered")&&(f.getEl().style.display=c===!1?"none":"",f.getEl().getBoundingClientRect()),b=f.parent(),b&&(b._lastRect=null),f.fire(c?"show":"hide"),j.add(f)}),f.fire("postrender",{},!1)},bindStates:function(){},scrollIntoView:function(a){function b(a,b){var c,d,e=a;for(c=d=0;e&&e!=b&&e.nodeType;)c+=e.offsetLeft||0,d+=e.offsetTop||0,e=e.offsetParent;return{x:c,y:d}}var c,d,e,f,g,h,i=this.getEl(),j=i.parentNode,k=b(i,j);return c=k.x,d=k.y,e=i.offsetWidth,f=i.offsetHeight,g=j.clientWidth,h=j.clientHeight,"end"==a?(c-=g-e,d-=h-f):"center"==a&&(c-=g/2-e/2,d-=h/2-f/2),j.scrollLeft=c,j.scrollTop=d,this},getRoot:function(){for(var a,b=this,c=[];b;){if(b.rootControl){a=b.rootControl;break}c.push(b),a=b,b=b.parent()}a||(a=this);for(var d=c.length;d--;)c[d].rootControl=a;return a},reflow:function(){j.remove(this);var a=this.parent();return a&&a.
_layout&&!a._layout.isNative()&&a.reflow(),this}};return b.each("text title visible disabled active value".split(" "),function(a){r[a]=function(b){return 0===arguments.length?this.state.get(a):("undefined"!=typeof b&&this.state.set(a,b),this)}}),m=a.extend(r)}),g("tinymce.core.ui.Movable",["tinymce.core.ui.DomUtils"],function(a){"use strict";function b(b,c,d){var e,f,g,h,i,j,k,l,m,n;return m=a.getViewPort(),f=a.getPos(c),g=f.x,h=f.y,b.state.get("fixed")&&"static"==a.getRuntimeStyle(document.body,"position")&&(g-=m.x,h-=m.y),e=b.getEl(),n=a.getSize(e),i=n.width,j=n.height,n=a.getSize(c),k=n.width,l=n.height,d=(d||"").split(""),"b"===d[0]&&(h+=l),"r"===d[1]&&(g+=k),"c"===d[0]&&(h+=Math.round(l/2)),"c"===d[1]&&(g+=Math.round(k/2)),"b"===d[3]&&(h-=j),
"r"===d[4]&&(g-=i),"c"===d[3]&&(h-=Math.round(j/2)),"c"===d[4]&&(g-=Math.round(i/2)),{x:g,y:h,w:i,h:j}}return{testMoveRel:function(c,d){for(var e=a.getViewPort(),f=0;f<d.length;f++){var g=b(this,c,d[f]);if(this.state.get("fixed")){if(g.x>0&&g.x+g.w<e.w&&g.y>0&&g.y+g.h<e.h)return d[f]}else if(g.x>e.x&&g.x+g.w<e.w+e.x&&g.y>e.y&&g.y+g.h<e.h+e.y)return d[f]}return d[0]},moveRel:function(a,c){"string"!=typeof c&&(c=this.testMoveRel(a,c));var d=b(this,a,c);return this.moveTo(d.x,d.y)},moveBy:function(a,b){var c=this,d=c.layoutRect();return c.moveTo(d.x+a,d.y+b),c},moveTo:function(b,c){function d(a,b,c){return a<0?0:a+c>b?(a=b-c,a<0?0:a):a}var e=this;if(e.settings.constrainToViewport){var f=a.getViewPort(window),g=e.layoutRect();b=d(b,f.w+f.x,g.w),c=d(c,f.h+f.y,g.h)}return e.state.get("rendered")?e.layoutRect({x:b,y:
c}).repaint():(e.settings.x=b,e.settings.y=c),e.fire("move",{x:b,y:c}),e}}}),g("tinymce.core.ui.Tooltip",["tinymce.core.ui.Control","tinymce.core.ui.Movable"],function(a,b){return a.extend({Mixins:[b],Defaults:{classes:"widget tooltip tooltip-n"},renderHtml:function(){var a=this,b=a.classPrefix;return'<div id="'+a._id+'" class="'+a.classes+'" role="presentation"><div class="'+b+'tooltip-arrow"></div><div class="'+b+'tooltip-inner">'+a.encode(a.state.get("text"))+"</div></div>"},bindStates:function(){var a=this;return a.state.on("change:text",function(b){a.getEl().lastChild.innerHTML=a.encode(b.value)}),a._super()},repaint:function(){var a,b,c=this;a=c.getEl().style,b=c._layoutRect,a.left=b.x+"px",a.top=b.y+"px",a.zIndex=131070}})}),g("tinymce.core.ui.Widget",["tinymce.core.ui.Control&q
uot;,"tinymce.core.ui.Tooltip"],function(a,b){"use strict";var c,d=a.extend({init:function(a){var b=this;b._super(a),a=b.settings,b.canFocus=!0,a.tooltip&&d.tooltips!==!1&&(b.on("mouseenter",function(c){var d=b.tooltip().moveTo(-65535);if(c.control==b){var e=d.text(a.tooltip).show().testMoveRel(b.getEl(),["bc-tc","bc-tl","bc-tr"]);d.classes.toggle("tooltip-n","bc-tc"==e),d.classes.toggle("tooltip-nw","bc-tl"==e),d.classes.toggle("tooltip-ne","bc-tr"==e),d.moveRel(b.getEl(),e)}else d.hide()}),b.on("mouseleave mousedown click",function(){b.tooltip().hide()})),b.aria("label",a.ariaLabel||a.tooltip)},tooltip:function(){return c||(c=new b({type:"tooltip"}),c.renderTo()),c},postRender:function(){var a=this,b=a.settings;a._super(),a.parent()||!b.width&&!b.height||(a.initLayoutRect(),a.repaint()),b.autofocus&&a.
focus()},bindStates:function(){function a(a){c.aria("disabled",a),c.classes.toggle("disabled",a)}function b(a){c.aria("pressed",a),c.classes.toggle("active",a)}var c=this;return c.state.on("change:disabled",function(b){a(b.value)}),c.state.on("change:active",function(a){b(a.value)}),c.state.get("disabled")&&a(!0),c.state.get("active")&&b(!0),c._super()},remove:function(){this._super(),c&&(c.remove(),c=null)}});return d}),g("tinymce.core.ui.Progress",["tinymce.core.ui.Widget"],function(a){"use strict";return a.extend({Defaults:{value:0},init:function(a){var b=this;b._super(a),b.classes.add("progress"),b.settings.filter||(b.settings.filter=function(a){return Math.round(a)})},renderHtml:function(){var a=this,b=a._id,c=this.classPrefix;return'<div id="'+b+'" class="'+a.classes+'"><div class="'+c+'bar-container&q
uot;><div class="'+c+'bar"></div></div><div class="'+c+'text">0%</div></div>'},postRender:function(){var a=this;return a._super(),a.value(a.settings.value),a},bindStates:function(){function a(a){a=b.settings.filter(a),b.getEl().lastChild.innerHTML=a+"%",b.getEl().firstChild.firstChild.style.width=a+"%"}var b=this;return b.state.on("change:value",function(b){a(b.value)}),a(b.state.get("value")),b._super()}})}),g("tinymce.core.ui.Notification",["tinymce.core.ui.Control","tinymce.core.ui.Movable","tinymce.core.ui.Progress","tinymce.core.util.Delay"],function(a,b,c,d){var e=function(a,b){a.getEl().lastChild.textContent=b+(a.progressBar?" "+a.progressBar.value()+"%":"")};return a.extend({Mixins:[b],Defaults:{classes:"widget notification"},init:function(a){var b=this;b._super(a),b.maxWidth=a.maxWidth,a.
text&&b.text(a.text),a.icon&&(b.icon=a.icon),a.color&&(b.color=a.color),a.type&&b.classes.add("notification-"+a.type),a.timeout&&(a.timeout<0||a.timeout>0)&&!a.closeButton?b.closeButton=!1:(b.classes.add("has-close"),b.closeButton=!0),a.progressBar&&(b.progressBar=new c),b.on("click",function(a){a.target.className.indexOf(b.classPrefix+"close")!=-1&&b.close()})},renderHtml:function(){var a=this,b=a.classPrefix,c="",d="",e="",f="";return a.icon&&(c='<i class="'+b+"ico "+b+"i-"+a.icon+'"></i>'),f=' style="max-width: '+a.maxWidth+"px;"+(a.color?"background-color: "+a.color+';"':'"'),a.closeButton&&(d='<button type="button" class="'+b+'close" aria-hidden="true">\xd7</button>'),a.progressBar&&(e=a.pr
ogressBar.renderHtml()),'<div id="'+a._id+'" class="'+a.classes+'"'+f+' role="presentation">'+c+'<div class="'+b+'notification-inner">'+a.state.get("text")+"</div>"+e+d+'<div style="clip: rect(1px, 1px, 1px, 1px);height: 1px;overflow: hidden;position: absolute;width: 1px;" aria-live="assertive" aria-relevant="additions" aria-atomic="true"></div></div>'},postRender:function(){var a=this;return d.setTimeout(function(){a.$el.addClass(a.classPrefix+"in"),e(a,a.state.get("text"))},100),a._super()},bindStates:function(){var a=this;return a.state.on("change:text",function(b){a.getEl().firstChild.innerHTML=b.value,e(a,b.value)}),a.progressBar&&(a.progressBar.bindStates(),a.progressBar.state.on("change:value",function(b){e(a,a.state.get("text"))})),a._super()},close:function(){var a=this;return a.fire
("close").isDefaultPrevented()||a.remove(),a},repaint:function(){var a,b,c=this;a=c.getEl().style,b=c._layoutRect,a.left=b.x+"px",a.top=b.y+"px",a.zIndex=65534}})}),g("tinymce.core.ui.NotificationManagerImpl",["ephox.katamari.api.Arr","tinymce.core.ui.DomUtils","tinymce.core.ui.Notification","tinymce.core.util.Tools"],function(a,b,c,d){return function(e){var f=function(a){return a.inline?a.getElement():a.getContentAreaContainer()},g=function(){var a=f(e);return b.getSize(a).width},h=function(b){a.each(b,function(a){a.moveTo(0,0)})},i=function(b){if(b.length>0){var c=b.slice(0,1)[0],d=f(e);c.moveRel(d,"tc-tc"),a.each(b,function(a,c){c>0&&a.moveRel(b[c-1].getEl(),"bc-tc")})}},j=function(a){h(a),i(a)},k=function(a,b){var e=d.extend(a,{maxWidth:g()}),f=new c(e);return f.args=e,e.timeout>0&&(f.timer=setTimeout(function(){f.close(),b()},e.timeout)),f.on("close&
quot;,function(){b()}),f.renderTo(),f},l=function(a){a.close()},m=function(a){return a.args};return{open:k,close:l,reposition:j,getArgs:m}}}),g("tinymce.core.api.NotificationManager",["ephox.katamari.api.Arr","ephox.katamari.api.Option","tinymce.core.EditorView","tinymce.core.ui.NotificationManagerImpl","tinymce.core.util.Delay"],function(a,b,c,d,e){return function(f){var g=[],h=function(){var a=f.theme;return a&&a.getNotificationManagerImpl?a.getNotificationManagerImpl():d(f)},i=function(){return b.from(g[0])},j=function(a,b){return!(a.type!==b.type||a.text!==b.text||a.progressBar||a.timeout||b.progressBar||b.timeout)},k=function(){g.length>0&&h().reposition(g)},l=function(a){g.push(a)},m=function(b){a.findIndex(g,function(a){return a===b}).each(function(a){g.splice(a,1)})},n=function(b){if(!f.removed&&c.isEditorAttachedToDom(f))return a.find(g,function(a){return j(h().getArgs(a),b)}).getOrThunk(
function(){f.editorManager.setActive(f);var a=h().open(b,function(){m(a),k()});return l(a),k(),a})},o=function(){i().each(function(a){h().close(a),m(a),k()})},p=function(){return g},q=function(b){b.on("SkinLoaded",function(){var a=b.settings.service_message;a&&n({text:a,type:"warning",timeout:0,icon:""})}),b.on("ResizeEditor ResizeWindow",function(){e.requestAnimationFrame(k)}),b.on("remove",function(){a.each(g,function(a){h().close(a)})})};return q(f),{open:n,close:o,getNotifications:p}}}),g("tinymce.core.ui.Factory",[],function(){"use strict";var a={};return{add:function(b,c){a[b.toLowerCase()]=c},has:function(b){return!!a[b.toLowerCase()]},get:function(b){var c=b.toLowerCase(),d=a.hasOwnProperty(c)?a[c]:null;if(null===d)throw new Error("Could not find module for type: "+b);return d},create:function(b,c){var d;if("string"==typeof b?(c=c||{},c.type=b):(c=b,b=c.type),b=b.toLowerCase(),d
=a[b],!d)throw new Error("Could not find control by type: "+b);return d=new d(c),d.type=b,d}}}),g("tinymce.core.ui.KeyboardNavigation",[],function(){"use strict";var a=function(a){return!!a.getAttribute("data-mce-tabstop")};return function(b){function c(a){return a&&1===a.nodeType}function d(a){return a=a||u,c(a)?a.getAttribute("role"):null}function e(a){for(var b,c=a||u;c=c.parentNode;)if(b=d(c))return b}function f(a){var b=u;if(c(b))return b.getAttribute("aria-"+a)}function g(a){var b=a.tagName.toUpperCase();return"INPUT"==b||"TEXTAREA"==b||"SELECT"==b}function h(b){return!(!g(b)||b.hidden)||(!!a(b)||!!/^(button|menuitem|checkbox|tab|menuitemcheckbox|option|gridcell|slider)$/.test(d(b)))}function i(a){function b(a){if(1==a.nodeType&&"none"!=a.style.display&&!a.disabled){h(a)&&c.push(a);for(var d=0;d<a.childNodes.length;d++)b(a.childNodes[d])}}var c
=[];return b(a||w.getEl()),c}function j(a){var b,c;a=a||v,c=a.parents().toArray(),c.unshift(a);for(var d=0;d<c.length&&(b=c[d],!b.settings.ariaRoot);d++);return b}function k(a){var b=j(a),c=i(b.getEl());b.settings.ariaRemember&&"lastAriaIndex"in b?l(b.lastAriaIndex,c):l(0,c)}function l(a,b){return a<0?a=b.length-1:a>=b.length&&(a=0),b[a]&&b[a].focus(),a}function m(a,b){var c=-1,d=j();b=b||i(d.getEl());for(var e=0;e<b.length;e++)b[e]===u&&(c=e);c+=a,d.lastAriaIndex=l(c,b)}function n(){var a=e();"tablist"==a?m(-1,i(u.parentNode)):v.parent().submenu?s():m(-1)}function o(){var a=d(),b=e();"tablist"==b?m(1,i(u.parentNode)):"menuitem"==a&&"menu"==b&&f("haspopup")?t():m(1)}function p(){m(-1)}function q(){var a=d(),b=e();"menuitem"==a&&"menubar"==b?t():"button"==a&&f("haspopup")?t({key:"down"}):m(1)}
function r(a){var b=e();if("tablist"==b){var c=i(v.getEl("body"))[0];c&&c.focus()}else m(a.shiftKey?-1:1)}function s(){v.fire("cancel")}function t(a){a=a||{},v.fire("click",{target:u,aria:a})}var u,v,w=b.root;try{u=document.activeElement}catch(x){u=document.body}return v=w.getParentCtrl(u),w.on("keydown",function(b){function c(b,c){g(u)||a(u)||"slider"!==d(u)&&c(b)!==!1&&b.preventDefault()}if(!b.isDefaultPrevented())switch(b.keyCode){case 37:c(b,n);break;case 39:c(b,o);break;case 38:c(b,p);break;case 40:c(b,q);break;case 27:s();break;case 14:case 13:case 32:c(b,t);break;case 9:r(b)!==!1&&b.preventDefault()}}),w.on("focusin",function(a){u=a.target,v=a.control}),{focusFirst:k}}}),g("tinymce.core.ui.Container",["tinymce.core.ui.Control","tinymce.core.ui.Collection","tinymce.core.ui.Selector","tinymce.core.ui.Factory","tinymce.core.
ui.KeyboardNavigation","tinymce.core.util.Tools","tinymce.core.dom.DomQuery","tinymce.core.ui.ClassList","tinymce.core.ui.ReflowQueue"],function(a,b,c,d,e,f,g,h,i){"use strict";var j={};return a.extend({init:function(a){var c=this;c._super(a),a=c.settings,a.fixed&&c.state.set("fixed",!0),c._items=new b,c.isRtl()&&c.classes.add("rtl"),c.bodyClasses=new h(function(){c.state.get("rendered")&&(c.getEl("body").className=this.toString())}),c.bodyClasses.prefix=c.classPrefix,c.classes.add("container"),c.bodyClasses.add("container-body"),a.containerCls&&c.classes.add(a.containerCls),c._layout=d.create((a.layout||"")+"layout"),c.settings.items?c.add(c.settings.items):c.add(c.render()),c._hasBody=!0},items:function(){return this._items},find:function(a){return a=j[a]=j[a]||new c(a),a.find(this)},add:function(a){var b=this;return
b.items().add(b.create(a)).parent(b),b},focus:function(a){var b,c,d,e=this;return a&&(c=e.keyboardNav||e.parents().eq(-1)[0].keyboardNav)?void c.focusFirst(e):(d=e.find("*"),e.statusbar&&d.add(e.statusbar.items()),d.each(function(a){return a.settings.autofocus?(b=null,!1):void(a.canFocus&&(b=b||a))}),b&&b.focus(),e)},replace:function(a,b){for(var c,d=this.items(),e=d.length;e--;)if(d[e]===a){d[e]=b;break}e>=0&&(c=b.getEl(),c&&c.parentNode.removeChild(c),c=a.getEl(),c&&c.parentNode.removeChild(c)),b.parent(this)},create:function(b){var c,e=this,g=[];return f.isArray(b)||(b=[b]),f.each(b,function(b){b&&(b instanceof a||("string"==typeof b&&(b={type:b}),c=f.extend({},e.settings.defaults,b),b.type=c.type=c.type||b.type||e.settings.defaultType||(c.defaults?c.defaults.type:null),b=d.create(c)),g.push(b))}),g},renderNew:function(){var a=this;return a.items().each(function(b,c){var d;b.parent(a),
b.state.get("rendered")||(d=a.getEl("body"),d.hasChildNodes()&&c<=d.childNodes.length-1?g(d.childNodes[c]).before(b.renderHtml()):g(d).append(b.renderHtml()),b.postRender(),i.add(b))}),a._layout.applyClasses(a.items().filter(":visible")),a._lastRect=null,a},append:function(a){return this.add(a).renderNew()},prepend:function(a){var b=this;return b.items().set(b.create(a).concat(b.items().toArray())),b.renderNew()},insert:function(a,b,c){var d,e,f,g=this;return a=g.create(a),d=g.items(),!c&&b<d.length-1&&(b+=1),b>=0&&b<d.length&&(e=d.slice(0,b).toArray(),f=d.slice(b).toArray(),d.set(e.concat(a,f))),g.renderNew()},fromJSON:function(a){var b=this;for(var c in a)b.find("#"+c).value(a[c]);return b},toJSON:function(){var a=this,b={};return a.find("*").each(function(a){var c=a.name(),d=a.value();c&&"undefined"!=typeof d&&(b[c]=d)}),b},renderHtml:function(){var a=th
is,b=a._layout,c=this.settings.role;return a.preRender(),b.preRender(a),'<div id="'+a._id+'" class="'+a.classes+'"'+(c?' role="'+this.settings.role+'"':"")+'><div id="'+a._id+'-body" class="'+a.bodyClasses+'">'+(a.settings.html||"")+b.renderHtml(a)+"</div></div>"},postRender:function(){var a,b=this;return b.items().exec("postRender"),b._super(),b._layout.postRender(b),b.state.set("rendered",!0),b.settings.style&&b.$el.css(b.settings.style),b.settings.border&&(a=b.borderBox,b.$el.css({"border-top-width":a.top,"border-right-width":a.right,"border-bottom-width":a.bottom,"border-left-width":a.left})),b.parent()||(b.keyboardNav=new e({root:b})),b},initLayoutRect:function(){var a=this,b=a._super();return a._layout.recalc(a),b},recalc:function(){var a=this,b=a._layoutRect,c=a._lastRect;if(!c||c.w!=b.w||c.h!=b.h)r
eturn a._layout.recalc(a),b=a.layoutRect(),a._lastRect={x:b.x,y:b.y,w:b.w,h:b.h},!0},reflow:function(){var b;if(i.remove(this),this.visible()){for(a.repaintControls=[],a.repaintControls.map={},this.recalc(),b=a.repaintControls.length;b--;)a.repaintControls[b].repaint();"flow"!==this.settings.layout&&"stack"!==this.settings.layout&&this.repaint(),a.repaintControls=[]}return this}})}),g("tinymce.core.ui.DragHelper",["tinymce.core.dom.DomQuery"],function(a){"use strict";function b(a){var b,c,d,e,f,g,h,i,j=Math.max;return b=a.documentElement,c=a.body,d=j(b.scrollWidth,c.scrollWidth),e=j(b.clientWidth,c.clientWidth),f=j(b.offsetWidth,c.offsetWidth),g=j(b.scrollHeight,c.scrollHeight),h=j(b.clientHeight,c.clientHeight),i=j(b.offsetHeight,c.offsetHeight),{width:d<f?e:d,height:g<i?h:g}}function c(a){var b,c;if(a.changedTouches)for(b="screenX screenY pageX pageY clientX clientY".split(" "),c=0;c<b.l
ength;c++)a[b[c]]=a.changedTouches[0][b[c]]}return function(d,e){function f(){return n.getElementById(e.handle||d)}var g,h,i,j,k,l,m,n=e.document||document;e=e||{},i=function(d){var i,o,p=b(n);c(d),d.preventDefault(),h=d.button,i=f(),l=d.screenX,m=d.screenY,o=window.getComputedStyle?window.getComputedStyle(i,null).getPropertyValue("cursor"):i.runtimeStyle.cursor,g=a("<div></div>").css({position:"absolute",top:0,left:0,width:p.width,height:p.height,zIndex:2147483647,opacity:1e-4,cursor:o}).appendTo(n.body),a(n).on("mousemove touchmove",k).on("mouseup touchend",j),e.start(d)},k=function(a){return c(a),a.button!==h?j(a):(a.deltaX=a.screenX-l,a.deltaY=a.screenY-m,a.preventDefault(),void e.drag(a))},j=function(b){c(b),a(n).off("mousemove touchmove",k).off("mouseup touchend",j),g.remove(),e.stop&&e.stop(b)},this.destroy=function(){a(f()).off()},a(f()).on("mousedown touchstart",i)}}),g("
;tinymce.core.ui.Scrollable",["tinymce.core.dom.DomQuery","tinymce.core.ui.DragHelper"],function(a,b){"use strict";return{init:function(){var a=this;a.on("repaint",a.renderScroll)},renderScroll:function(){function c(){function b(b,g,h,i,j,k){var l,m,n,o,p,q,r,s,t;if(m=e.getEl("scroll"+b)){if(s=g.toLowerCase(),t=h.toLowerCase(),a(e.getEl("absend")).css(s,e.layoutRect()[i]-1),!j)return void a(m).css("display","none");a(m).css("display","block"),l=e.getEl("body"),n=e.getEl("scroll"+b+"t"),o=l["client"+h]-2*f,o-=c&&d?m["client"+k]:0,p=l["scroll"+h],q=o/p,r={},r[s]=l["offset"+g]+f,r[t]=o,a(m).css(r),r={},r[s]=l["scroll"+g]*q,r[t]=o*q,a(n).css(r)}}var c,d,g;g=e.getEl("body"),c=g.scrollWidth>g.clientWidth,d=g.scrollHeight>g.clientHeight,b("h","Left","Width&quo
t;,"contentW",c,"Height"),b("v","Top","Height","contentH",d,"Width")}function d(){function c(c,d,g,h,i){var j,k=e._id+"-scroll"+c,l=e.classPrefix;a(e.getEl()).append('<div id="'+k+'" class="'+l+"scrollbar "+l+"scrollbar-"+c+'"><div id="'+k+'t" class="'+l+'scrollbar-thumb"></div></div>'),e.draghelper=new b(k+"t",{start:function(){j=e.getEl("body")["scroll"+d],a("#"+k).addClass(l+"active")},drag:function(a){var b,k,l,m,n=e.layoutRect();k=n.contentW>n.innerW,l=n.contentH>n.innerH,m=e.getEl("body")["client"+g]-2*f,m-=k&&l?e.getEl("scroll"+c)["client"+i]:0,b=m/e.getEl("body")["scroll"+g],e.getEl("body")["scroll"+d]=j+a["delta"+h]/b},stop:function(){a("#"+k).removeCl
ass(l+"active")}})}e.classes.add("scroll"),c("v","Top","Height","Y","Width"),c("h","Left","Width","X","Height")}var e=this,f=2;e.settings.autoScroll&&(e._hasScroll||(e._hasScroll=!0,d(),e.on("wheel",function(a){var b=e.getEl("body");b.scrollLeft+=10*(a.deltaX||0),b.scrollTop+=10*a.deltaY,c()}),a(e.getEl("body")).on("scroll",c)),c())}}}),g("tinymce.core.ui.Panel",["tinymce.core.ui.Container","tinymce.core.ui.Scrollable"],function(a,b){"use strict";return a.extend({Defaults:{layout:"fit",containerCls:"panel"},Mixins:[b],renderHtml:function(){var a=this,b=a._layout,c=a.settings.html;return a.preRender(),b.preRender(a),"undefined"==typeof c?c='<div id="'+a._id+'-body" class="'+a.bodyClasses+'">'+b.renderHtml(a)+"</div&g
t;":("function"==typeof c&&(c=c.call(a)),a._hasBody=!1),'<div id="'+a._id+'" class="'+a.classes+'" hidefocus="1" tabindex="-1" role="group">'+(a._preBodyHtml||"")+c+"</div>"}})}),g("tinymce.core.ui.Resizable",["tinymce.core.ui.DomUtils"],function(a){"use strict";return{resizeToContent:function(){this._layoutRect.autoResize=!0,this._lastRect=null,this.reflow()},resizeTo:function(b,c){if(b<=1||c<=1){var d=a.getWindowSize();b=b<=1?b*d.w:b,c=c<=1?c*d.h:c}return this._layoutRect.autoResize=!1,this.layoutRect({minW:b,minH:c,w:b,h:c}).reflow()},resizeBy:function(a,b){var c=this,d=c.layoutRect();return c.resizeTo(d.w+a,d.h+b)}}}),g("tinymce.core.ui.FloatPanel",["tinymce.core.ui.Panel","tinymce.core.ui.Movable","tinymce.core.ui.Resizable","tinymce.core.ui.DomUtils","tinymce.core.dom.DomQuery&q
uot;,"tinymce.core.util.Delay"],function(a,b,c,d,e,f){"use strict";function g(a,b){for(;a;){if(a==b)return!0;a=a.parent()}}function h(a){for(var b=s.length;b--;){var c=s[b],d=c.getParentCtrl(a.target);if(c.settings.autohide){
-if(d&&(g(d,c)||c.parent()===d))continue;a=c.fire("autohide",{target:a.target}),a.isDefaultPrevented()||c.hide()}}}function i(){o||(o=function(a){2!=a.button&&h(a)},e(document).on("click touchstart",o))}function j(){p||(p=function(){var a;for(a=s.length;a--;)l(s[a])},e(window).on("scroll",p))}function k(){if(!q){var a=document.documentElement,b=a.clientWidth,c=a.clientHeight;q=function(){document.all&&b==a.clientWidth&&c==a.clientHeight||(b=a.clientWidth,c=a.clientHeight,u.hideAll())},e(window).on("resize",q)}}function l(a){function b(b,c){for(var d,e=0;e<s.length;e++)if(s[e]!=a)for(d=s[e].parent();d&&(d=d.parent());)d==a&&s[e].fixed(b).moveBy(0,c).repaint()}var c=d.getViewPort().y;a.settings.autofix&&(a.state.get("fixed")?a._autoFixY>c&&(a.fixed(!1).layoutRect({y:a._autoFixY}).repaint(),b(!1,a._autoFixY-c)):(a._autoFixY=a.layoutRect().y,a._autoFixY<c&&(a
.fixed(!0).layoutRect({y:0}).repaint(),b(!0,c-a._autoFixY))))}function m(a,b){var c,d,f=u.zIndex||65535;if(a)t.push(b);else for(c=t.length;c--;)t[c]===b&&t.splice(c,1);if(t.length)for(c=0;c<t.length;c++)t[c].modal&&(f++,d=t[c]),t[c].getEl().style.zIndex=f,t[c].zIndex=f,f++;var g=e("#"+b.classPrefix+"modal-block",b.getContainerElm())[0];d?e(g).css("z-index",d.zIndex-1):g&&(g.parentNode.removeChild(g),r=!1),u.currentZIndex=f}function n(a){var b;for(b=s.length;b--;)s[b]===a&&s.splice(b,1);for(b=t.length;b--;)t[b]===a&&t.splice(b,1)}var o,p,q,r,s=[],t=[],u=a.extend({Mixins:[b,c],init:function(a){var b=this;b._super(a),b._eventsRoot=b,b.classes.add("floatpanel"),a.autohide&&(i(),k(),s.push(b)),a.autofix&&(j(),b.on("move",function(){l(this)})),b.on("postrender show",function(a){if(a.control==b){var c,d=b.classPrefix;b.modal&&!r&&(c=e("#"+d+"
modal-block",b.getContainerElm()),c[0]||(c=e('<div id="'+d+'modal-block" class="'+d+"reset "+d+'fade"></div>').appendTo(b.getContainerElm())),f.setTimeout(function(){c.addClass(d+"in"),e(b.getEl()).addClass(d+"in")}),r=!0),m(!0,b)}}),b.on("show",function(){b.parents().each(function(a){if(a.state.get("fixed"))return b.fixed(!0),!1})}),a.popover&&(b._preBodyHtml='<div class="'+b.classPrefix+'arrow"></div>',b.classes.add("popover").add("bottom").add(b.isRtl()?"end":"start")),b.aria("label",a.ariaLabel),b.aria("labelledby",b._id),b.aria("describedby",b.describedBy||b._id+"-none")},fixed:function(a){var b=this;if(b.state.get("fixed")!=a){if(b.state.get("rendered")){var c=d.getViewPort();a?b.layoutRect().y-=c.y:b.layoutRect().y+=c.y}b.classes.toggle("fixed",a),b.sta
te.set("fixed",a)}return b},show:function(){var a,b=this,c=b._super();for(a=s.length;a--&&s[a]!==b;);return a===-1&&s.push(b),c},hide:function(){return n(this),m(!1,this),this._super()},hideAll:function(){u.hideAll()},close:function(){var a=this;return a.fire("close").isDefaultPrevented()||(a.remove(),m(!1,a)),a},remove:function(){n(this),this._super()},postRender:function(){var a=this;return a.settings.bodyRole&&this.getEl("body").setAttribute("role",a.settings.bodyRole),a._super()}});return u.hideAll=function(){for(var a=s.length;a--;){var b=s[a];b&&b.settings.autohide&&(b.hide(),s.splice(a,1))}},u}),g("tinymce.core.ui.Window",["tinymce.core.ui.FloatPanel","tinymce.core.ui.Panel","tinymce.core.ui.DomUtils","tinymce.core.dom.DomQuery","tinymce.core.ui.DragHelper","tinymce.core.ui.BoxUtils","tinymce.core.Env","tinymce.co
re.util.Delay"],function(a,b,c,d,e,f,g,h){"use strict";function i(a){var b,c="width=device-width,initial-scale=1.0,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0",e=d("meta[name=viewport]")[0];g.overrideViewPort!==!1&&(e||(e=document.createElement("meta"),e.setAttribute("name","viewport"),document.getElementsByTagName("head")[0].appendChild(e)),b=e.getAttribute("content"),b&&"undefined"!=typeof n&&(n=b),e.setAttribute("content",a?c:n))}function j(a,b){k()&&b===!1&&d([document.documentElement,document.body]).removeClass(a+"fullscreen")}function k(){for(var a=0;a<m.length;a++)if(m[a]._fullscreen)return!0;return!1}function l(){function a(){var a,b,d=c.getWindowSize();for(a=0;a<m.length;a++)b=m[a].layoutRect(),m[a].moveTo(m[a].settings.x||Math.max(0,d.w/2-b.w/2),m[a].settings.y||Math.max(0,d.h/2-b.h/2))}if(!g.desktop){var b
={w:window.innerWidth,h:window.innerHeight};h.setInterval(function(){var a=window.innerWidth,c=window.innerHeight;b.w==a&&b.h==c||(b={w:a,h:c},d(window).trigger("resize"))},100)}d(window).on("resize",a)}var m=[],n="",o=a.extend({modal:!0,Defaults:{border:1,layout:"flex",containerCls:"panel",role:"dialog",callbacks:{submit:function(){this.fire("submit",{data:this.toJSON()})},close:function(){this.close()}}},init:function(a){var d=this;d._super(a),d.isRtl()&&d.classes.add("rtl"),d.classes.add("window"),d.bodyClasses.add("window-body"),d.state.set("fixed",!0),a.buttons&&(d.statusbar=new b({layout:"flex",border:"1 0 0 0",spacing:3,padding:10,align:"center",pack:d.isRtl()?"start":"end",defaults:{type:"button"},items:a.buttons}),d.statusbar.classes.add("foot"),d.statusbar.parent(d)),d.on(
"click",function(a){var b=d.classPrefix+"close";(c.hasClass(a.target,b)||c.hasClass(a.target.parentNode,b))&&d.close()}),d.on("cancel",function(){d.close()}),d.aria("describedby",d.describedBy||d._id+"-none"),d.aria("label",a.title),d._fullscreen=!1},recalc:function(){var a,b,d,e,f=this,g=f.statusbar;f._fullscreen&&(f.layoutRect(c.getWindowSize()),f.layoutRect().contentH=f.layoutRect().innerH),f._super(),a=f.layoutRect(),f.settings.title&&!f._fullscreen&&(b=a.headerW,b>a.w&&(d=a.x-Math.max(0,b/2),f.layoutRect({w:b,x:d}),e=!0)),g&&(g.layoutRect({w:f.layoutRect().innerW}).recalc(),b=g.layoutRect().minW+a.deltaW,b>a.w&&(d=a.x-Math.max(0,b-a.w),f.layoutRect({w:b,x:d}),e=!0)),e&&f.recalc()},initLayoutRect:function(){var a,b=this,d=b._super(),e=0;if(b.settings.title&&!b._fullscreen){a=b.getEl("head");var f=c.getSize(a);d.headerW=f.width,d.head
erH=f.height,e+=d.headerH}b.statusbar&&(e+=b.statusbar.layoutRect().h),d.deltaH+=e,d.minH+=e,d.h+=e;var g=c.getWindowSize();return d.x=b.settings.x||Math.max(0,g.w/2-d.w/2),d.y=b.settings.y||Math.max(0,g.h/2-d.h/2),d},renderHtml:function(){var a=this,b=a._layout,c=a._id,d=a.classPrefix,e=a.settings,f="",g="",h=e.html;return a.preRender(),b.preRender(a),e.title&&(f='<div id="'+c+'-head" class="'+d+'window-head"><div id="'+c+'-title" class="'+d+'title">'+a.encode(e.title)+'</div><div id="'+c+'-dragh" class="'+d+'dragh"></div><button type="button" class="'+d+'close" aria-hidden="true"><i class="mce-ico mce-i-remove"></i></button></div>'),e.url&&(h='<iframe src="'+e.url+'" tabindex="-1"></iframe>'),"undefined"==typeof h&&(h=b.renderHtml(
a)),a.statusbar&&(g=a.statusbar.renderHtml()),'<div id="'+c+'" class="'+a.classes+'" hidefocus="1"><div class="'+a.classPrefix+'reset" role="application">'+f+'<div id="'+c+'-body" class="'+a.bodyClasses+'">'+h+"</div>"+g+"</div></div>"},fullscreen:function(a){var b,e,g=this,i=document.documentElement,j=g.classPrefix;if(a!=g._fullscreen)if(d(window).on("resize",function(){var a;if(g._fullscreen)if(b)g._timer||(g._timer=h.setTimeout(function(){var a=c.getWindowSize();g.moveTo(0,0).resizeTo(a.w,a.h),g._timer=0},50));else{a=(new Date).getTime();var d=c.getWindowSize();g.moveTo(0,0).resizeTo(d.w,d.h),(new Date).getTime()-a>50&&(b=!0)}}),e=g.layoutRect(),g._fullscreen=a,a){g._initial={x:e.x,y:e.y,w:e.w,h:e.h},g.borderBox=f.parseBox("0"),g.getEl("head").style.display="none",e.deltaH-=e.headerH+2,d([i,documen
t.body]).addClass(j+"fullscreen"),g.classes.add("fullscreen");var k=c.getWindowSize();g.moveTo(0,0).resizeTo(k.w,k.h)}else g.borderBox=f.parseBox(g.settings.border),g.getEl("head").style.display="",e.deltaH+=e.headerH,d([i,document.body]).removeClass(j+"fullscreen"),g.classes.remove("fullscreen"),g.moveTo(g._initial.x,g._initial.y).resizeTo(g._initial.w,g._initial.h);return g.reflow()},postRender:function(){var a,b=this;setTimeout(function(){b.classes.add("in"),b.fire("open")},0),b._super(),b.statusbar&&b.statusbar.postRender(),b.focus(),this.dragHelper=new e(b._id+"-dragh",{start:function(){a={x:b.layoutRect().x,y:b.layoutRect().y}},drag:function(c){b.moveTo(a.x+c.deltaX,a.y+c.deltaY)}}),b.on("submit",function(a){a.isDefaultPrevented()||b.close()}),m.push(b),i(!0)},submit:function(){return this.fire("submit",{data:this.toJSON()})},remove:function(){var a,b=this;for(
b.dragHelper.destroy(),b._super(),b.statusbar&&this.statusbar.remove(),j(b.classPrefix,!1),a=m.length;a--;)m[a]===b&&m.splice(a,1);i(m.length>0)},getContentWindow:function(){var a=this.getEl().getElementsByTagName("iframe")[0];return a?a.contentWindow:null}});return l(),o}),g("tinymce.core.ui.MessageBox",["tinymce.core.ui.Window"],function(a){"use strict";var b=a.extend({init:function(a){a={border:1,padding:20,layout:"flex",pack:"center",align:"center",containerCls:"panel",autoScroll:!0,buttons:{type:"button",text:"Ok",action:"ok"},items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200}},this._super(a)},Statics:{OK:1,OK_CANCEL:2,YES_NO:3,YES_NO_CANCEL:4,msgBox:function(c){function d(a,b,c){return{type:"button",text:a,subtype:c?"primary":"",onClick:function(a){a.control.parents()[1].close(),f(b)}}}var e,f=c.callb
ack||function(){};switch(c.buttons){case b.OK_CANCEL:e=[d("Ok",!0,!0),d("Cancel",!1)];break;case b.YES_NO:case b.YES_NO_CANCEL:e=[d("Yes",1,!0),d("No",0)],c.buttons==b.YES_NO_CANCEL&&e.push(d("Cancel",-1));break;default:e=[d("Ok",!0,!0)]}return new a({padding:20,x:c.x,y:c.y,minWidth:300,minHeight:100,layout:"flex",pack:"center",align:"center",buttons:e,title:c.title,role:"alertdialog",items:{type:"label",multiline:!0,maxWidth:500,maxHeight:200,text:c.text},onPostRender:function(){this.aria("describedby",this.items()[0]._id)},onClose:c.onClose,onCancel:function(){f(!1)}}).renderTo(document.body).reflow()},alert:function(a,c){return"string"==typeof a&&(a={text:a}),a.callback=c,b.msgBox(a)},confirm:function(a,c){return"string"==typeof a&&(a={text:a}),a.callback=c,a.buttons=b.OK_CANCEL,b.msgBox(a)}}});return b}),g("tinym
ce.core.ui.WindowManagerImpl",["tinymce.core.ui.Window","tinymce.core.ui.MessageBox"],function(a,b){return function(c){var d=function(b,c,d){var e;return b.title=b.title||" ",b.url=b.url||b.file,b.url&&(b.width=parseInt(b.width||320,10),b.height=parseInt(b.height||240,10)),b.body&&(b.items={defaults:b.defaults,type:b.bodyType||"form",items:b.body,data:b.data,callbacks:b.commands}),b.url||b.buttons||(b.buttons=[{text:"Ok",subtype:"primary",onclick:function(){e.find("form")[0].submit()}},{text:"Cancel",onclick:function(){e.close()}}]),e=new a(b),e.on("close",function(){d(e)}),b.data&&e.on("postRender",function(){this.find("*").each(function(a){var c=a.name();c in b.data&&a.value(b.data[c])})}),e.features=b||{},e.params=c||{},e=e.renderTo().reflow()},e=function(a,c,d){var e;return e=b.alert(a,function(){c()}),e.on("close",function(
){d(e)}),e},f=function(a,c,d){var e;return e=b.confirm(a,function(a){c(a)}),e.on("close",function(){d(e)}),e},g=function(a){a.close()},h=function(a){return a.params},i=function(a,b){a.params=b};return{open:d,alert:e,confirm:f,close:g,getParams:h,setParams:i}}}),g("tinymce.core.api.WindowManager",["ephox.katamari.api.Arr","ephox.katamari.api.Option","tinymce.core.ui.WindowManagerImpl"],function(a,b,c){return function(d){var e=[],f=function(){var a=d.theme;return a&&a.getWindowManagerImpl?a.getWindowManagerImpl():c(d)},g=function(a,b){return function(){return b?b.apply(a,arguments):void 0}},h=function(a){d.fire("OpenWindow",{win:a})},i=function(a){d.fire("CloseWindow",{win:a})},j=function(a){e.push(a),h(a)},k=function(b){a.findIndex(e,function(a){return a===b}).each(function(a){e.splice(a,1),i(b),0===e.length&&d.focus()})},l=function(){return b.from(e[e.length-1])},m=function(a,b){d.editorManager.set
Active(d),0===e.length&&d.nodeChanged();var c=f().open(a,b,k);return j(c),c},n=function(a,b,c){var d=f().alert(a,g(c?c:this,b),k);j(d)},o=function(a,b,c){var d=f().confirm(a,g(c?c:this,b),k);j(d)},p=function(){l().each(function(a){f().close(a),k(a)})},q=function(){return l().map(f().getParams).getOr(null)},r=function(a){l().each(function(b){f().setParams(b,a)})},s=function(){return e};return d.on("remove",function(){a.each(e.slice(0),function(a){f().close(a)})}),{windows:e,open:m,alert:n,confirm:o,close:p,getParams:q,setParams:r,getWindows:s}}}),g("tinymce.core.dom.RangePoint",["ephox.katamari.api.Arr","tinymce.core.geom.ClientRect"],function(a,b){var c=function(c,d,e){return!e.collapsed&&a.foldl(e.getClientRects(),function(a,e){return a||b.containsXY(e,c,d)},!1)};return{isXYWithinRange:c}}),g("tinymce.core.util.VK",["tinymce.core.Env"],function(a){return{BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,LEFT:37,RIGHT:
39,SPACEBAR:32,TAB:9,UP:38,modifierPressed:function(a){return a.shiftKey||a.ctrlKey||a.altKey||this.metaKeyPressed(a)},metaKeyPressed:function(b){return a.mac?b.metaKey:b.ctrlKey&&!b.altKey}}}),g("tinymce.core.dom.ControlSelection",["ephox.katamari.api.Fun","ephox.sugar.api.node.Element","ephox.sugar.api.search.Selectors","tinymce.core.dom.NodeType","tinymce.core.dom.RangePoint","tinymce.core.Env","tinymce.core.util.Delay","tinymce.core.util.Tools","tinymce.core.util.VK"],function(a,b,c,d,e,f,g,h,i){function j(a,b){for(;b&&b!=a;){if(l(b)||k(b))return b;b=b.parentNode}return null}var k=d.isContentEditableFalse,l=d.isContentEditableTrue,m=function(a){return a&&"IMG"===a.nodeName},n=function(a,b){return m(a.target)&&!e.isXYWithinRange(a.clientX,a.clientY,b)},o=function(a,b){var c=b.target;n(b,a.selection.getRng())&&!b.isDefaultPrevented()
&&(b.preventDefault(),a.selection.select(c))};return function(d,e){function l(a){var d=e.settings.object_resizing;return d!==!1&&!f.iOS&&("string"!=typeof d&&(d="table,img,div"),"false"!==a.getAttribute("data-mce-resize")&&(a!=e.getBody()&&c.is(b.fromDom(a),d)))}function m(a){var b,c,d,f,g;b=a.screenX-J,c=a.screenY-K,R=b*H[2]+N,S=c*H[3]+O,R=R<5?5:R,S=S<5?5:S,d="IMG"==D.nodeName&&e.settings.resize_img_proportional!==!1?!i.modifierPressed(a):i.modifierPressed(a)||"IMG"==D.nodeName&&H[2]*H[3]!==0,d&&($(b)>$(c)?(S=_(R*P),R=_(S/P)):(R=_(S/P),S=_(R*P))),V.setStyles(E,{width:R,height:S}),f=H.startPos.x+b,g=H.startPos.y+c,f=f>0?f:0,g=g>0?g:0,V.setStyles(F,{left:f,top:g,display:"block"}),F.innerHTML=R+" × "+S,H[2]<0&&E.clientWidth<=R&&V.setStyle(E,"left",L+(N-R)),H[3]<0&&E.cl
ientHeight<=S&&V.setStyle(E,"top",M+(O-S)),b=aa.scrollWidth-T,c=aa.scrollHeight-U,b+c!==0&&V.setStyles(F,{left:f-b,top:g-c}),Q||(e.fire("ObjectResizeStart",{target:D,width:N,height:O}),Q=!0)}function n(){function a(a,b){b&&(D.style[a]||!e.schema.isValid(D.nodeName.toLowerCase(),a)?V.setStyle(D,a,b):V.setAttrib(D,a,b))}Q=!1,a("width",R),a("height",S),V.unbind(X,"mousemove",m),V.unbind(X,"mouseup",n),Y!=X&&(V.unbind(Y,"mousemove",m),V.unbind(Y,"mouseup",n)),V.remove(E),V.remove(F),Z&&"TABLE"!=D.nodeName||p(D),e.fire("ObjectResized",{target:D,width:R,height:S}),V.setAttrib(D,"style",V.getAttrib(D,"style")),e.nodeChanged()}function p(a,b,c){var d,g,h,i,j;q(),z(),d=V.getPos(a,aa),L=d.x,M=d.y,j=a.getBoundingClientRect(),g=j.width||j.right-j.left,h=j.height||j.bottom-j.top,D!=a&&(y(),D=a,R=S=0),i=e.fire("ObjectSelect
ed",{target:a}),l(a)&&!i.isDefaultPrevented()?W(G,function(a,d){function e(b){J=b.screenX,K=b.screenY,N=D.clientWidth,O=D.clientHeight,P=O/N,H=a,a.startPos={x:g*a[0]+L,y:h*a[1]+M},T=aa.scrollWidth,U=aa.scrollHeight,E=D.cloneNode(!0),V.addClass(E,"mce-clonedresizable"),V.setAttrib(E,"data-mce-bogus","all"),E.contentEditable=!1,E.unSelectabe=!0,V.setStyles(E,{left:L,top:M,margin:0}),E.removeAttribute("data-mce-selected"),aa.appendChild(E),V.bind(X,"mousemove",m),V.bind(X,"mouseup",n),Y!=X&&(V.bind(Y,"mousemove",m),V.bind(Y,"mouseup",n)),F=V.add(aa,"div",{"class":"mce-resize-helper","data-mce-bogus":"all"},N+" × "+O)}var i;return b?void(d==b&&e(c)):(i=V.get("mceResizeHandle"+d),i&&V.remove(i),i=V.add(aa,"div",{id:"mceResizeHandle"+d,"data-mce-bogus":"all&quo
t;,"class":"mce-resizehandle",unselectable:!0,style:"cursor:"+d+"-resize; margin:0; padding:0"}),f.ie&&(i.contentEditable=!1),V.bind(i,"mousedown",function(a){a.stopImmediatePropagation(),a.preventDefault(),e(a)}),a.elm=i,void V.setStyles(i,{left:g*a[0]+L-i.offsetWidth/2,top:h*a[1]+M-i.offsetHeight/2}))}):q(),D.setAttribute("data-mce-selected","1")}function q(){var a,b;z(),D&&D.removeAttribute("data-mce-selected");for(a in G)b=V.get("mceResizeHandle"+a),b&&(V.unbind(b),V.remove(b))}function r(a){function b(a,b){if(a)do if(a===b)return!0;while(a=a.parentNode)}var c,f;if(!Q&&!e.removed)return W(V.select("img[data-mce-selected],hr[data-mce-selected]"),function(a){a.removeAttribute("data-mce-selected")}),f="mousedown"==a.type?a.target:d.getNode(),f=V.$(f).closest(Z?"table":"table,img,hr")[0],b(f,aa)&&(A(),c=d.
getStart(!0),b(c,f)&&b(d.getEnd(!0),f)&&(!Z||f!=c&&"IMG"!==c.nodeName))?void p(f):void q()}function s(a,b,c){a&&a.attachEvent&&a.attachEvent("on"+b,c)}function t(a,b,c){a&&a.detachEvent&&a.detachEvent("on"+b,c)}function u(a){var b,c,d,f,g,h,i,j=a.srcElement;b=j.getBoundingClientRect(),h=I.clientX-b.left,i=I.clientY-b.top;for(c in G)if(d=G[c],f=j.offsetWidth*d[0],g=j.offsetHeight*d[1],$(f-h)<8&&$(g-i)<8){H=d;break}Q=!0,e.fire("ObjectResizeStart",{target:D,width:D.clientWidth,height:D.clientHeight}),e.getDoc().selection.empty(),p(j,c,I)}function v(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function w(a){return k(j(e.getBody(),a))}function x(a){var b=a.srcElement;if(w(b))return void v(a);if(b!=D){if(e.fire("ObjectSelected",{target:b}),y(),0===b.id.indexOf("mceResizeHandle"))return void(a.returnValue=!1);"IMG"!=b.nodeName&&"
;TABLE"!=b.nodeName||(q(),D=b,s(b,"resizestart",u))}}function y(){t(D,"resizestart",u)}function z(){for(var a in G){var b=G[a];b.elm&&(V.unbind(b.elm),delete b.elm)}}function A(){try{e.getDoc().execCommand("enableObjectResizing",!1,!1)}catch(a){}}function B(a){var b;if(Z){b=X.body.createControlRange();try{return b.addElement(a),b.select(),!0}catch(c){}}}function C(){D=E=null,Z&&(y(),t(aa,"controlselect",x))}var D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V=e.dom,W=h.each,X=e.getDoc(),Y=document,Z=f.ie&&f.ie<11,$=Math.abs,_=Math.round,aa=e.getBody();G={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]};var ba=".mce-content-body";return e.contentStyles.push(ba+" div.mce-resizehandle {position: absolute;border: 1px solid black;box-sizing: box-sizing;background: #FFF;width: 7px;height: 7px;z-index: 10000}"+ba+" .mce-resizehandle:hover {background: #000}"+ba+" img[data-mce-selected],&
quot;+ba+" hr[data-mce-selected] {outline: 1px solid black;resize: none}"+ba+" .mce-clonedresizable {position: absolute;"+(f.gecko?"":"outline: 1px dashed black;")+"opacity: .5;filter: alpha(opacity=50);z-index: 10000}"+ba+" .mce-resize-helper {background: #555;background: rgba(0,0,0,0.75);border-radius: 3px;border: 1px;color: white;display: none;font-family: sans-serif;font-size: 12px;white-space: nowrap;line-height: 14px;margin: 5px 10px;padding: 5px;position: absolute;z-index: 10001}"),e.on("init",function(){Z?(e.on("ObjectResized",function(a){"TABLE"!=a.target.nodeName&&(q(),B(a.target))}),s(aa,"controlselect",x),e.on("mousedown",function(a){I=a})):(A(),f.ie>=11&&(e.on("mousedown click",function(a){var b=a.target,c=b.nodeName;Q||!/^(TABLE|IMG|HR)$/.test(c)||w(b)||(2!==a.button&&e.selection.select(b,"TABLE"==c),"mousedow
n"==a.type&&e.nodeChanged())}),e.dom.bind(aa,"mscontrolselect",function(a){function b(a){g.setEditorTimeout(e,function(){e.selection.select(a)})}return w(a.target)?(a.preventDefault(),void b(a.target)):void(/^(TABLE|IMG|HR)$/.test(a.target.nodeName)&&(a.preventDefault(),"IMG"==a.target.tagName&&b(a.target)))})));var b=g.throttle(function(a){e.composing||r(a)});e.on("nodechange ResizeEditor ResizeWindow drop",b),e.on("keyup compositionend",function(a){D&&"TABLE"==D.nodeName&&b(a)}),e.on("hide blur",q),e.on("contextmenu",a.curry(o,e))}),e.on("remove",z),{isResizable:l,showResizeRect:p,hideResizeRect:q,updateResizeRect:r,controlSelect:B,destroy:C}}}),g("tinymce.core.dom.ScrollIntoView",["tinymce.core.dom.NodeType"],function(a){var b=function(a){for(var b=0,c=0,d=a;d&&d.nodeType;)b+=d.offsetLeft||0,c+=d.offsetTop||0,d=d.offsetParent;ret
urn{x:b,y:c}},c=function(a,b,c){var d={elm:b,alignToTop:c};return a.fire("scrollIntoView",d),d.isDefaultPrevented()},d=function(d,e,f){var g,h,i,j,k=d.dom,l=k.getRoot(),m=0;if(!c(d,e,f)&&a.isElement(e)){if(f===!1&&(m=e.offsetHeight),"BODY"!==l.nodeName){var n=d.selection.getScrollContainer();if(n)return g=b(e).y-b(n).y+m,j=n.clientHeight,i=n.scrollTop,void((g<i||g+25>i+j)&&(n.scrollTop=g<i?g:g-j+25))}h=k.getViewPort(d.getWin()),g=k.getPos(e).y+m,i=h.y,j=h.h,(g<h.y||g+25>i+j)&&d.getWin().scrollTo(0,g<i?g:g-j+25)}};return{scrollIntoView:d}}),g("tinymce.core.dom.TridentSelection",[],function(){function a(a){function b(b,c){var d,e,f,g,h,i,j,k,l=0,m=-1;if(d=b.duplicate(),d.collapse(c),k=d.parentElement(),k.ownerDocument===a.dom.doc){for(;"false"===k.contentEditable;)k=k.parentNode;if(!k.hasChildNodes())return{node:k,inside:1};for(g=k.children,e=g.length-1;l<=e;)if(j=Math.floor((l+e)/2),h=g[j],d.
moveToElementText(h),m=d.compareEndPoints(c?"StartToStart":"EndToEnd",b),m>0)e=j-1;else{if(!(m<0))return{node:h};l=j+1}if(m<0)for(h?d.collapse(!1):(d.moveToElementText(k),d.collapse(!0),h=k,f=!0),i=0;0!==d.compareEndPoints(c?"StartToStart":"StartToEnd",b)&&0!==d.move("character",1)&&k==d.parentElement();)i++;else for(d.collapse(!0),i=0;0!==d.compareEndPoints(c?"StartToStart":"StartToEnd",b)&&0!==d.move("character",-1)&&k==d.parentElement();)i++;return{node:h,position:m,offset:i,inside:f}}}function c(){function c(a){var c,d,e,f,g,h=b(k,a),i=0;if(c=h.node,d=h.offset,h.inside&&!c.hasChildNodes())return void l[a?"setStart":"setEnd"](c,0);if(d===f)return void l[a?"setStartBefore":"setEndAfter"](c);if(h.position<0){if(e=h.inside?c.firstChild:c.nextSibling,!e)return void l[a?"setStartAfter":"setEndAfter&qu
ot;](c);if(!d)return void(3==e.nodeType?l[a?"setStart":"setEnd"](e,0):l[a?"setStartBefore":"setEndBefore"](e));for(;e;){if(3==e.nodeType&&(g=e.nodeValue,i+=g.length,i>=d)){c=e,i-=d,i=g.length-i;break}e=e.nextSibling}}else{if(e=c.previousSibling,!e)return l[a?"setStartBefore":"setEndBefore"](c);if(!d)return void(3==c.nodeType?l[a?"setStart":"setEnd"](e,c.nodeValue.length):l[a?"setStartAfter":"setEndAfter"](e));for(;e;){if(3==e.nodeType&&(i+=e.nodeValue.length,i>=d)){c=e,i-=d;break}e=e.previousSibling}}l[a?"setStart":"setEnd"](c,i)}var f,g,h,i,j,k=a.getRng(),l=e.createRng();if(f=k.item?k.item(0):k.parentElement(),f.ownerDocument!=e.doc)return l;if(g=a.isCollapsed(),k.item)return l.setStart(f.parentNode,e.nodeIndex(f)),l.setEnd(l.startContainer,l.startOffset+1),l;try{c(!0),g||c()}catch(m){if(m.number!=-2147024809)throw m;j=d.getBookmark(2),h=k.du
plicate(),h.collapse(!0),f=h.parentElement(),g||(h=k.duplicate(),h.collapse(!1),i=h.parentElement(),i.innerHTML=i.innerHTML),f.innerHTML=f.innerHTML,d.moveToBookmark(j),k=a.getRng(),c(!0),g||c()}return l}var d=this,e=a.dom,f=!1;this.getBookmark=function(c){function d(a){var b,c,d,f,g=[];for(b=a.parentNode,c=e.getRoot().parentNode;b!=c&&9!==b.nodeType;){for(d=b.children,f=d.length;f--;)if(a===d[f]){g.push(f);break}a=b,b=b.parentNode}return g}function f(a){var c;if(c=b(g,a))return{position:c.position,offset:c.offset,indexes:d(c.node),inside:c.inside}}var g=a.getRng(),h={};return 2===c&&(g.item?h.start={ctrl:!0,indexes:d(g.item(0))}:(h.start=f(!0),a.isCollapsed()||(h.end=f()))),h},this.moveToBookmark=function(a){function b(a){var b,c,d,f;for(b=e.getRoot(),c=a.length-1;c>=0;c--)f=b.children,d=a[c],d<=f.length-1&&(b=f[d]);return b}function c(c){var e,g,h,i,j=a[c?"start":"end"];j&&(e=j.position>0,g=f.createTextRange(),g.moveToEl
ementText(b(j.indexes)),i=j.offset,i!==h?(g.collapse(j.inside||e),g.moveStart("character",e?-i:i)):g.collapse(c),d.setEndPoint(c?"StartToStart":"EndToStart",g),c&&d.collapse(!0))}var d,f=e.doc.body;a.start&&(a.start.ctrl?(d=f.createControlRange(),d.addElement(b(a.start.indexes)),d.select()):(d=f.createTextRange(),c(!0),c(),d.select()))},this.addRange=function(b){function c(a){var b,c,g,l,m;g=e.create("a"),b=a?h:j,c=a?i:k,l=d.duplicate(),b!=o&&b!=o.documentElement||(b=p,c=0),3==b.nodeType?(b.parentNode.insertBefore(g,b),l.moveToElementText(g),l.moveStart("character",c),e.remove(g),d.setEndPoint(a?"StartToStart":"EndToEnd",l)):(m=b.childNodes,m.length?(c>=m.length?e.insertAfter(g,m[m.length-1]):b.insertBefore(g,m[c]),l.moveToElementText(g)):b.canHaveHTML&&(b.innerHTML="<span></span>",g=b.firstChild,l.moveToElementText(g),l.collapse(f)),d.setEndPoin
t(a?"StartToStart":"EndToEnd",l),e.remove(g))}var d,g,h,i,j,k,l,m,n,o=a.dom.doc,p=o.body;if(h=b.startContainer,i=b.startOffset,j=b.endContainer,k=b.endOffset,d=p.createTextRange(),h==j&&1==h.nodeType){if(i==k&&!h.hasChildNodes()){if(h.canHaveHTML)return l=h.previousSibling,l&&!l.hasChildNodes()&&e.isBlock(l)?l.innerHTML="":l=null,h.innerHTML="<span></span><span></span>",d.moveToElementText(h.lastChild),d.select(),e.doc.selection.clear(),h.innerHTML="",void(l&&(l.innerHTML=""));i=e.nodeIndex(h),h=h.parentNode}if(i==k-1)try{if(n=h.childNodes[i],g=p.createControlRange(),g.addElement(n),g.select(),m=a.getRng(),m.item&&n===m.item(0))return}catch(q){}}c(!0),c(),d.select()},this.getRangeAt=c}return a}),g("ephox.sugar.api.dom.Replication",["ephox.sugar.api.properties.Attr","ephox.sugar.api.node.Elemen
t","ephox.sugar.api.dom.Insert","ephox.sugar.api.dom.InsertAll","ephox.sugar.api.dom.Remove","ephox.sugar.api.search.Traverse"],function(a,b,c,d,e,f){var g=function(a,c){return b.fromDom(a.dom().cloneNode(c))},h=function(a){return g(a,!1)},i=function(a){return g(a,!0)},j=function(c,d){var e=b.fromTag(d),f=a.clone(c);return a.setAll(e,f),e},k=function(a,b){var c=j(a,b),e=f.children(i(a));return d.append(c,e),c},l=function(a,b){var g=j(a,b);c.before(a,g);var h=f.children(a);return d.append(g,h),e.remove(a),g};return{shallow:h,shallowAs:j,deep:i,copy:k,mutate:l}}),g("ephox.sugar.api.node.Fragment",["ephox.katamari.api.Arr","ephox.sugar.api.node.Element","global!document"],function(a,b,c){var d=function(d,e){var f=e||c,g=f.createDocumentFragment();return a.each(d,function(a){g.appendChild(a.dom())}),b.fromDom(g)};return{fromElements:d}}),g("ephox.sugar.impl.ClosestOrAncestor",["ephox.kata
mari.api.Type","ephox.katamari.api.Option"],function(a,b){return function(c,d,e,f,g){return c(e,f)?b.some(e):a.isFunction(g)&&g(e)?b.none():d(e,f,g)}}),g("ephox.sugar.api.search.PredicateFind",["ephox.katamari.api.Type","ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.katamari.api.Option","ephox.sugar.api.node.Body","ephox.sugar.api.dom.Compare","ephox.sugar.api.node.Element","ephox.sugar.impl.ClosestOrAncestor"],function(a,b,c,d,e,f,g,h){var i=function(a){return n(e.body(),a)},j=function(b,e,f){for(var h=b.dom(),i=a.isFunction(f)?f:c.constant(!1);h.parentNode;){h=h.parentNode;var j=g.fromDom(h);if(e(j))return d.some(j);if(i(j))break}return d.none()},k=function(a,b,c){var d=function(a){return b(a)};return h(d,j,a,b,c)},l=function(a,b){var c=a.dom();return c.parentNode?m(g.fromDom(c.parentNode),function(c){return!f.eq(a,c)&&b(c)}):d.none()},m=function(a,d){
var e=b.find(a.dom().childNodes,c.compose(d,g.fromDom));return e.map(g.fromDom)},n=function(a,b){var c=function(a){for(var e=0;e<a.childNodes.length;e++){if(b(g.fromDom(a.childNodes[e])))return d.some(g.fromDom(a.childNodes[e]));var f=c(a.childNodes[e]);if(f.isSome())return f}return d.none()};return c(a.dom())};return{first:i,ancestor:j,closest:k,sibling:l,child:m,descendant:n}}),g("ephox.sugar.api.search.SelectorFind",["ephox.sugar.api.search.PredicateFind","ephox.sugar.api.search.Selectors","ephox.sugar.impl.ClosestOrAncestor"],function(a,b,c){var d=function(a){return b.one(a)},e=function(c,d,e){return a.ancestor(c,function(a){return b.is(a,d)},e)},f=function(c,d){return a.sibling(c,function(a){return b.is(a,d)})},g=function(c,d){return a.child(c,function(a){return b.is(a,d)})},h=function(a,c){return b.one(c,a)},i=function(a,d,f){return c(b.is,e,a,d,f)};return{first:d,ancestor:e,sibling:f,child:g,descendant:h,closest:i}}),g("tinymce.
core.dom.Parents",["ephox.katamari.api.Fun","ephox.sugar.api.dom.Compare","ephox.sugar.api.search.Traverse"],function(a,b,c){var d=function(a){return a.slice(0,-1)},e=function(a,e,f){return b.contains(e,a)?d(c.parents(a,function(a){return f(a)||b.eq(a,e)})):[]},f=function(b,c){return e(b,c,a.constant(!1))},g=function(a,b){return[a].concat(f(a,b))};return{parentsUntil:e,parents:f,parentsAndSelf:g}}),g("ephox.katamari.api.Options",["ephox.katamari.api.Option"],function(a){var b=function(a){for(var b=[],c=function(a){b.push(a)},d=0;d<a.length;d++)a[d].each(c);return b},c=function(b,c){for(var d=0;d<b.length;d++){var e=c(b[d],d);if(e.isSome())return e}return a.none()},d=function(b,c){for(var d=[],e=0;e<b.length;e++){var f=b[e];if(!f.isSome())return a.none();d.push(f.getOrDie())}return a.some(c.apply(null,d))};return{cat:b,findMap:c,liftN:d}}),g("tinymce.core.selection.SelectionUtils",["ephox.katamari.api.Arr&
quot;,"ephox.katamari.api.Fun","ephox.katamari.api.Option","ephox.katamari.api.Options","ephox.sugar.api.dom.Compare","ephox.sugar.api.node.Element","ephox.sugar.api.node.Node","ephox.sugar.api.search.Traverse","tinymce.core.dom.NodeType"],function(a,b,c,d,e,f,g,h,i){var j=function(a){var b=a.startContainer,d=a.startOffset;return i.isText(b)?0===d?c.some(f.fromDom(b)):c.none():c.from(b.childNodes[d]).map(f.fromDom)},k=function(a){var b=a.endContainer,d=a.endOffset;return i.isText(b)?d===b.data.length?c.some(f.fromDom(b)):c.none():c.from(b.childNodes[d-1]).map(f.fromDom)},l=function(a){return h.firstChild(a).fold(b.constant([a]),function(b){return[a].concat(l(b))})},m=function(a){return h.lastChild(a).fold(b.constant([a]),function(b){return"br"===g.name(b)?h.prevSibling(b).map(function(b){return[a].concat(m(b))}).getOr([]):[a].concat(m(b))})},n=function(c,f){return d.liftN([j(f),k(f)],function(d
,f){var g=a.find(l(c),b.curry(e.eq,d)),h=a.find(m(c),b.curry(e.eq,f));return g.isSome()&&h.isSome()}).getOr(!1)};return{hasAllContentsSelected:n}}),g("tinymce.core.selection.SimpleTableModel",["ephox.katamari.api.Arr","ephox.katamari.api.Option","ephox.katamari.api.Struct","ephox.sugar.api.dom.Compare","ephox.sugar.api.dom.Insert","ephox.sugar.api.dom.InsertAll","ephox.sugar.api.dom.Replication","ephox.sugar.api.node.Element","ephox.sugar.api.properties.Attr","ephox.sugar.api.search.SelectorFilter"],function(a,b,c,d,e,f,g,h,i,j){var k=c.immutable("element","width","rows"),l=c.immutable("element","cells"),m=c.immutable("x","y"),n=function(a,b){var c=parseInt(i.get(a,b),10);return isNaN(c)?1:c},o=function(a,b,c,d,e){for(var f=n(e,"rowspan"),h=n(e,"colspan"),i=a.rows(),j=c;j<c+f
;j++){i[j]||(i[j]=l(g.deep(d),[]));for(var k=b;k<b+h;k++){var m=i[j].cells();m[k]=j==c&&k==b?e:g.shallow(e)}}},p=function(a,b,c){var d=a.rows(),e=d[c]?d[c].cells():[];return!!e[b]},q=function(a,b,c){for(;p(a,b,c);)b++;return b},r=function(b){return a.foldl(b,function(a,b){return b.cells().length>a?b.cells().length:a},0)},s=function(a,c){for(var e=a.rows(),f=0;f<e.length;f++)for(var g=e[f].cells(),h=0;h<g.length;h++)if(d.eq(g[h],c))return b.some(m(h,f));return b.none()},t=function(a,b,c,d,e){for(var f=[],g=a.rows(),h=c;h<=e;h++){var i=g[h].cells(),j=b<d?i.slice(b,d+1):i.slice(d,b+1);f.push(l(g[h].element(),j))}return f},u=function(a,b,c){var d=b.x(),e=b.y(),f=c.x(),g=c.y(),h=e<g?t(a,d,e,f,g):t(a,d,g,f,e);return k(a.element(),r(h),h)},v=function(a,b){var c=g.shallow(a.element()),d=h.fromTag("tbody");return f.append(d,b),e.append(c,d),c},w=function(b){return a.map(b.rows(),function(b){var c=a.map(b.cells(),function(a){var b=g.deep(a);return i.remo
ve(b,"colspan"),i.remove(b,"rowspan"),b}),d=g.shallow(b.element());return f.append(d,c),d})},x=function(b){var c=k(g.shallow(b),0,[]);return a.each(j.descendants(b,"tr"),function(b,d){a.each(j.descendants(b,"td,th"),function(a,e){o(c,q(c,e,d),d,b,a)})}),k(c.element(),r(c.rows()),c.rows())},y=function(a){return v(a,w(a))},z=function(a,b,c){return s(a,b).bind(function(b){return s(a,c).map(function(c){return u(a,b,c)})})};return{fromDom:x,toDom:y,subsection:z}}),g("tinymce.core.selection.MultiRange",["ephox.katamari.api.Arr","ephox.sugar.api.node.Element","tinymce.core.dom.RangeUtils"],function(a,b,c){
-var d=function(a){var b=[];if(a)for(var c=0;c<a.rangeCount;c++)b.push(a.getRangeAt(c));return b},e=function(d){return a.bind(d,function(a){var d=c.getSelectedNode(a);return d?[b.fromDom(d)]:[]})},f=function(a){return d(a).length>1};return{getRanges:d,getSelectedNodes:e,hasMultipleRanges:f}}),g("tinymce.core.selection.TableCellSelection",["ephox.katamari.api.Arr","ephox.sugar.api.node.Element","ephox.sugar.api.search.SelectorFilter","tinymce.core.dom.ElementType","tinymce.core.selection.MultiRange"],function(a,b,c,d,e){var f=function(b){return a.filter(e.getSelectedNodes(b),d.isTableCell)},g=function(a){var b=c.descendants(a,"td[data-mce-selected],th[data-mce-selected]");return b},h=function(a,b){var c=g(b),d=f(a);return c.length>0?c:d},i=function(a){return h(e.getRanges(a.selection.getSel()),b.fromDom(a.getBody()))};return{getCellsFromRanges:f,getCellsFromElement:g,getCellsFromElementOrRanges:h,getCellsFr
omEditor:i}}),g("tinymce.core.selection.FragmentReader",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.sugar.api.dom.Compare","ephox.sugar.api.dom.Insert","ephox.sugar.api.dom.Replication","ephox.sugar.api.node.Element","ephox.sugar.api.node.Fragment","ephox.sugar.api.node.Node","ephox.sugar.api.search.SelectorFind","ephox.sugar.api.search.Traverse","tinymce.core.dom.ElementType","tinymce.core.dom.Parents","tinymce.core.selection.SelectionUtils","tinymce.core.selection.SimpleTableModel","tinymce.core.selection.TableCellSelection"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){var p=function(b){return a.find(b,function(a){return"ul"===h.name(a)||"ol"===h.name(a)})},q=function(c,d){return a.find(c,function(a){return"li"===h.name(a)&&m.hasAllContentsSelected(a,d)}).fold(b.constant([]),f
unction(a){return p(c).map(function(a){return[f.fromTag("li"),f.fromTag(h.name(a))]}).getOr([])})},r=function(b,c){var e=a.foldl(c,function(a,b){return d.append(b,a),b},b);return c.length>0?g.fromElements([e]):e},s=function(a){return k.isListItem(a)?j.parent(a).filter(k.isList).fold(b.constant([]),function(b){return[a,b]}):k.isList(a)?[a]:[]},t=function(b,c){var d=f.fromDom(c.commonAncestorContainer),g=l.parentsAndSelf(d,b),h=a.filter(g,function(a){return k.isInline(a)||k.isHeading(a)}),i=q(g,c),j=h.concat(i.length?i:s(d));return a.map(j,e.shallow)},u=function(){return g.fromElements([])},v=function(a,b){return r(f.fromDom(b.cloneContents()),t(a,b))},w=function(a,d){return i.ancestor(d,"table",b.curry(c.eq,a))},x=function(a,b){return w(a,b[0]).bind(function(a){var c=b[0],d=b[b.length-1],e=n.fromDom(a);return n.subsection(e,c,d).map(function(a){return g.fromElements([n.toDom(a)])})}).getOrThunk(u)},y=function(a,b){return b.length>0&&b[0].collapsed?u(
):v(a,b[0])},z=function(a,b){var c=o.getCellsFromElementOrRanges(b,a);return c.length>0?x(a,c):y(a,b)};return{read:z}}),g("tinymce.core.dom.Selection",["ephox.katamari.api.Arr","ephox.sugar.api.dom.Compare","ephox.sugar.api.node.Element","tinymce.core.caret.CaretPosition","tinymce.core.dom.BookmarkManager","tinymce.core.dom.ControlSelection","tinymce.core.dom.NodeType","tinymce.core.dom.RangeUtils","tinymce.core.dom.ScrollIntoView","tinymce.core.dom.TreeWalker","tinymce.core.dom.TridentSelection","tinymce.core.Env","tinymce.core.selection.FragmentReader","tinymce.core.selection.MultiRange","tinymce.core.text.Zwsp","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){function q(a,b,c,d){var g=this;g.dom=a,g.win=b,g.serializer=c,g.editor=d,g.bookmarkManager=new e(g),g.controlSelection=new f(g,d),g.w
in.getSelection||(g.tridentSel=new k(g))}var r=p.each,s=p.trim,t=l.ie,u=function(a){return!(!a||!a.ownerDocument)&&b.contains(c.fromDom(a.ownerDocument),c.fromDom(a))},v=function(a){return!!a&&(!!a.select||u(a.startContainer)&&u(a.endContainer))},w=function(b,c){return a.map(c,function(a){var c=b.fire("GetSelectionRange",{range:a});return c.range!==a?c.range:a})};return q.prototype={setCursorLocation:function(a,b){var c=this,d=c.dom.createRng();a?(d.setStart(a,b),d.setEnd(a,b),c.setRng(d),c.collapse(!1)):(c._moveEndPoint(d,c.editor.getBody(),!0),c.setRng(d))},getContent:function(a){var b,d,e,f=this,g=f.getRng(),h=f.dom.create("body"),i=f.getSel(),j=w(f.editor,n.getRanges(this.getSel()));return a=a||{},b=d="",a.get=!0,a.format=a.format||"html",a.selection=!0,f.editor.fire("BeforeGetContent",a),"text"===a.format?f.isCollapsed()?"":o.trim(g.text||(i.toString?i.toString():"")):(g.clon
eContents?(e=a.contextual?m.read(c.fromDom(f.editor.getBody()),j).dom():g.cloneContents(),e&&h.appendChild(e)):void 0!==g.item||void 0!==g.htmlText?(h.innerHTML="<br>"+(g.item?g.item(0).outerHTML:g.htmlText),h.removeChild(h.firstChild)):h.innerHTML=g.toString(),/^\s/.test(h.innerHTML)&&(b=" "),/\s+$/.test(h.innerHTML)&&(d=" "),a.getInner=!0,a.content=f.isCollapsed()?"":b+f.serializer.serialize(h,a)+d,f.editor.fire("GetContent",a),a.content)},setContent:function(a,b){var c,d,e,f=this,g=f.getRng(),h=f.win.document;if(b=b||{format:"html"},b.set=!0,b.selection=!0,b.content=a,b.no_events||f.editor.fire("BeforeSetContent",b),a=b.content,g.insertNode){a+='<span id="__caret">_</span>',g.startContainer==h&&g.endContainer==h?h.body.innerHTML=a:(g.deleteContents(),0===h.body.childNodes.length?h.body.innerHTML=a:g.createContextualFragment?g.insertNode(g.createContext
ualFragment(a)):(d=h.createDocumentFragment(),e=h.createElement("div"),d.appendChild(e),e.outerHTML=a,g.insertNode(d))),c=f.dom.get("__caret"),g=h.createRange(),g.setStartBefore(c),g.setEndBefore(c),f.setRng(g),f.dom.remove("__caret");try{f.setRng(g)}catch(i){}}else g.item&&(h.execCommand("Delete",!1,null),g=f.getRng()),/^\s+/.test(a)?(g.pasteHTML('<span id="__mce_tmp">_</span>'+a),f.dom.remove("__mce_tmp")):g.pasteHTML(a);b.no_events||f.editor.fire("SetContent",b)},getStart:function(a){var b,c,d,e,f=this,g=f.getRng();if(g.duplicate||g.item){if(g.item)return g.item(0);for(d=g.duplicate(),d.collapse(1),b=d.parentElement(),b.ownerDocument!==f.dom.doc&&(b=f.dom.getRoot()),c=e=g.parentElement();e=e.parentNode;)if(e==b){b=c;break}return b}return b=g.startContainer,1==b.nodeType&&b.hasChildNodes()&&(a&&g.collapsed||(b=b.childNodes[Math.min(b.childNodes.length-1,g.start
Offset)])),b&&3==b.nodeType?b.parentNode:b},getEnd:function(a){var b,c,d=this,e=d.getRng();return e.duplicate||e.item?e.item?e.item(0):(e=e.duplicate(),e.collapse(0),b=e.parentElement(),b.ownerDocument!==d.dom.doc&&(b=d.dom.getRoot()),b&&"BODY"==b.nodeName?b.lastChild||b:b):(b=e.endContainer,c=e.endOffset,1==b.nodeType&&b.hasChildNodes()&&(a&&e.collapsed||(b=b.childNodes[c>0?c-1:c])),b&&3==b.nodeType?b.parentNode:b)},getBookmark:function(a,b){return this.bookmarkManager.getBookmark(a,b)},moveToBookmark:function(a){return this.bookmarkManager.moveToBookmark(a)},select:function(a,b){var c,d=this,e=d.dom,f=e.createRng();if(d.lastFocusBookmark=null,a){if(!b&&d.controlSelection.controlSelect(a))return;c=e.nodeIndex(a),f.setStart(a.parentNode,c),f.setEnd(a.parentNode,c+1),b&&(d._moveEndPoint(f,a,!0),d._moveEndPoint(f,a)),d.setRng(f)}return a},isCollapsed:function(){var a=this,b=a.getRng(),c=a.getSel();ret
urn!(!b||b.item)&&(b.compareEndPoints?0===b.compareEndPoints("StartToEnd",b):!c||b.collapsed)},collapse:function(a){var b,c=this,d=c.getRng();d.item&&(b=d.item(0),d=c.win.document.body.createTextRange(),d.moveToElementText(b)),d.collapse(!!a),c.setRng(d)},getSel:function(){var a=this.win;return a.getSelection?a.getSelection():a.document.selection},getRng:function(a){function b(a,b,c){try{return b.compareBoundaryPoints(a,c)}catch(d){return-1}}var c,d,e,f,g,h=this;if(!h.win)return null;if(f=h.win.document,"undefined"==typeof f||null===f)return null;if(!a&&h.lastFocusBookmark){var i=h.lastFocusBookmark;return i.startContainer?(d=f.createRange(),d.setStart(i.startContainer,i.startOffset),d.setEnd(i.endContainer,i.endOffset)):d=i,d}if(a&&h.tridentSel)return h.tridentSel.getRangeAt(0);try{(c=h.getSel())&&(d=c.rangeCount>0?c.getRangeAt(0):c.createRange?c.createRange():f.createRange())}catch(j){}if(d=w(h.editor,[d])[0],t&&am
p;d&&d.setStart&&f.selection){try{g=f.selection.createRange()}catch(j){}g&&g.item&&(e=g.item(0),d=f.createRange(),d.setStartBefore(e),d.setEndAfter(e))}return d||(d=f.createRange?f.createRange():f.body.createTextRange()),d.setStart&&9===d.startContainer.nodeType&&d.collapsed&&(e=h.dom.getRoot(),d.setStart(e,0),d.setEnd(e,0)),h.selectedRange&&h.explicitRange&&(0===b(d.START_TO_START,d,h.selectedRange)&&0===b(d.END_TO_END,d,h.selectedRange)?d=h.explicitRange:(h.selectedRange=null,h.explicitRange=null)),d},setRng:function(a,b){var c,d,e,f=this;if(v(a))if(a.select){f.explicitRange=null;try{a.select()}catch(g){}}else if(f.tridentSel){if(a.cloneRange)try{f.tridentSel.addRange(a)}catch(g){}}else{if(c=f.getSel(),e=f.editor.fire("SetSelectionRange",{range:a,forward:b}),a=e.range,c){f.explicitRange=a;try{c.removeAllRanges(),c.addRange(a)}catch(g){}b===!1&&c.extend&&(c.collapse(a.endContai
ner,a.endOffset),c.extend(a.startContainer,a.startOffset)),f.selectedRange=c.rangeCount>0?c.getRangeAt(0):null}a.collapsed||a.startContainer!==a.endContainer||!c.setBaseAndExtent||l.ie||a.endOffset-a.startOffset<2&&a.startContainer.hasChildNodes()&&(d=a.startContainer.childNodes[a.startOffset],d&&"IMG"===d.tagName&&(c.setBaseAndExtent(a.startContainer,a.startOffset,a.endContainer,a.endOffset),c.anchorNode===a.startContainer&&c.focusNode===a.endContainer||c.setBaseAndExtent(d,0,d,1))),f.editor.fire("AfterSetSelectionRange",{range:a,forward:b})}},setNode:function(a){var b=this;return b.setContent(b.dom.getOuterHTML(a)),a},getNode:function(){function a(a,b){for(var c=a;a&&3===a.nodeType&&0===a.length;)a=b?a.nextSibling:a.previousSibling;return a||c}var b,c,d,e,f,g=this,h=g.getRng(),i=g.dom.getRoot();return h?(c=h.startContainer,d=h.endContainer,e=h.startOffset,f=h.endOffset,h.setStart?(b=h.commonAncestorC
ontainer,!h.collapsed&&(c==d&&f-e<2&&c.hasChildNodes()&&(b=c.childNodes[e]),3===c.nodeType&&3===d.nodeType&&(c=c.length===e?a(c.nextSibling,!0):c.parentNode,d=0===f?a(d.previousSibling,!1):d.parentNode,c&&c===d))?c:b&&3==b.nodeType?b.parentNode:b):(b=h.item?h.item(0):h.parentElement(),b.ownerDocument!==g.win.document&&(b=i),b)):i},getSelectedBlocks:function(a,b){var c,d,e=this,f=e.dom,g=[];if(d=f.getRoot(),a=f.getParent(a||e.getStart(),f.isBlock),b=f.getParent(b||e.getEnd(),f.isBlock),a&&a!=d&&g.push(a),a&&b&&a!=b){c=a;for(var h=new j(a,d);(c=h.next())&&c!=b;)f.isBlock(c)&&g.push(c)}return b&&a!=b&&b!=d&&g.push(b),g},isForward:function(){var a,b,c=this.dom,d=this.getSel();return!(d&&d.anchorNode&&d.focusNode)||(a=c.createRng(),a.setStart(d.anchorNode,d.anchorOffset),a.collapse(!0),b=c.createRng(),b.setStart(d.focusNode,d.f
ocusOffset),b.collapse(!0),a.compareBoundaryPoints(a.START_TO_START,b)<=0)},normalize:function(){var a=this,b=a.getRng();return new h(a.dom).normalize(b)&&!n.hasMultipleRanges(a.getSel())&&a.setRng(b,a.isForward()),b},selectorChanged:function(a,b){var c,d=this;return d.selectorChangedData||(d.selectorChangedData={},c={},d.editor.on("NodeChange",function(a){var b=a.element,e=d.dom,f=e.getParents(b,null,e.getRoot()),g={};r(d.selectorChangedData,function(a,b){r(f,function(d){if(e.is(d,b))return c[b]||(r(a,function(a){a(!0,{node:d,selector:b,parents:f})}),c[b]=a),g[b]=a,!1})}),r(c,function(a,d){g[d]||(delete c[d],r(a,function(a){a(!1,{node:b,selector:d,parents:f})}))})})),d.selectorChangedData[a]||(d.selectorChangedData[a]=[]),d.selectorChangedData[a].push(b),d},getScrollContainer:function(){for(var a,b=this.dom.getRoot();b&&"BODY"!=b.nodeName;){if(b.scrollHeight>b.clientHeight){a=b;break}b=b.parentNode}return a},scrollIntoView:function(
a,b){i.scrollIntoView(this.editor,a,b)},placeCaretAt:function(a,b){this.setRng(h.getCaretRangeFromPoint(a,b,this.editor.getDoc()))},_moveEndPoint:function(a,b,c){var d=b,e=new j(b,d),f=this.dom.schema.getNonEmptyElements();do{if(3==b.nodeType&&0!==s(b.nodeValue).length)return void(c?a.setStart(b,0):a.setEnd(b,b.nodeValue.length));if(f[b.nodeName]&&!/^(TD|TH)$/.test(b.nodeName))return void(c?a.setStartBefore(b):"BR"==b.nodeName?a.setEndBefore(b):a.setEndAfter(b));if(l.ie&&l.ie<11&&this.dom.isBlock(b)&&this.dom.isEmpty(b))return void(c?a.setStart(b,0):a.setEnd(b,0))}while(b=c?e.next():e.prev());"BODY"==d.nodeName&&(c?a.setStart(d,0):a.setEnd(d,d.childNodes.length))},getBoundingClientRect:function(){var a=this.getRng();return a.collapsed?d.fromRangeStart(a).getClientRects()[0]:a.getBoundingClientRect()},destroy:function(){this.win=null,this.controlSelection.destroy()}},q}),g("tinymce.core.html.Node",[],fun
ction(){function a(a,b,c){var d,e,f=c?"lastChild":"firstChild",g=c?"prev":"next";if(a[f])return a[f];if(a!==b){if(d=a[g])return d;for(e=a.parent;e&&e!==b;e=e.parent)if(d=e[g])return d}}function b(a,b){this.name=a,this.type=b,1===b&&(this.attributes=[],this.attributes.map={})}var c=/^[ \t\r\n]*$/,d={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11};return b.prototype={replace:function(a){var b=this;return a.parent&&a.remove(),b.insert(a,b),b.remove(),b},attr:function(a,b){var c,d,e,f=this;if("string"!=typeof a){for(d in a)f.attr(d,a[d]);return f}if(c=f.attributes){if(b!==e){if(null===b){if(a in c.map)for(delete c.map[a],d=c.length;d--;)if(c[d].name===a)return c=c.splice(d,1),f;return f}if(a in c.map){for(d=c.length;d--;)if(c[d].name===a){c[d].value=b;break}}else c.push({name:a,value:b});return c.map[a]=b,f}return c.map[a]
}},clone:function(){var a,c,d,e,f,g=this,h=new b(g.name,g.type);if(d=g.attributes){for(f=[],f.map={},a=0,c=d.length;a<c;a++)e=d[a],"id"!==e.name&&(f[f.length]={name:e.name,value:e.value},f.map[e.name]=e.value);h.attributes=f}return h.value=g.value,h.shortEnded=g.shortEnded,h},wrap:function(a){var b=this;return b.parent.insert(a,b),a.append(b),b},unwrap:function(){var a,b,c=this;for(a=c.firstChild;a;)b=a.next,c.insert(a,c,!0),a=b;c.remove()},remove:function(){var a=this,b=a.parent,c=a.next,d=a.prev;return b&&(b.firstChild===a?(b.firstChild=c,c&&(c.prev=null)):d.next=c,b.lastChild===a?(b.lastChild=d,d&&(d.next=null)):c.prev=d,a.parent=a.next=a.prev=null),a},append:function(a){var b,c=this;return a.parent&&a.remove(),b=c.lastChild,b?(b.next=a,a.prev=b,c.lastChild=a):c.lastChild=c.firstChild=a,a.parent=c,a},insert:function(a,b,c){var d;return a.parent&&a.remove(),d=b.parent||this,c?(b===d.firstChild?d.firstChild=a:b.prev.next=
a,a.prev=b.prev,a.next=b,b.prev=a):(b===d.lastChild?d.lastChild=a:b.next.prev=a,a.next=b.next,a.prev=b,b.next=a),a.parent=d,a},getAll:function(b){var c,d=this,e=[];for(c=d.firstChild;c;c=a(c,d))c.name===b&&e.push(c);return e},empty:function(){var b,c,d,e=this;if(e.firstChild){for(b=[],d=e.firstChild;d;d=a(d,e))b.push(d);for(c=b.length;c--;)d=b[c],d.parent=d.firstChild=d.lastChild=d.next=d.prev=null}return e.firstChild=e.lastChild=null,e},isEmpty:function(b,d,e){var f,g,h=this,i=h.firstChild;if(d=d||{},i)do{if(1===i.type){if(i.attributes.map["data-mce-bogus"])continue;if(b[i.name])return!1;for(f=i.attributes.length;f--;)if(g=i.attributes[f].name,"name"===g||0===g.indexOf("data-mce-bookmark"))return!1}if(8===i.type)return!1;if(3===i.type&&!c.test(i.value))return!1;if(3===i.type&&i.parent&&d[i.parent.name]&&c.test(i.value))return!1;if(e&&e(i))return!1}while(i=a(i,h));return!0},walk:function(b){return a(this,n
ull,b)}},b.create=function(a,c){var e,f;if(e=new b(a,d[a]||1),c)for(f in c)e.attr(f,c[f]);return e},b}),g("tinymce.core.html.SaxParser",["tinymce.core.html.Schema","tinymce.core.html.Entities","tinymce.core.util.Tools"],function(a,b,c){function d(a,b,c){var d,e,f,g,h=1;for(g=a.getShortEndedElements(),f=/<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g,f.lastIndex=d=c;e=f.exec(b);){if(d=f.lastIndex,"/"===e[1])h--;else if(!e[1]){if(e[2]in g)continue;h++}if(0===h)break}return d}function e(e,i){function j(){}var k=this;e=e||{},k.schema=i=i||new a,e.fix_self_closing!==!1&&(e.fix_self_closing=!0),f("comment cdata text start end pi doctype".split(" "),function(a){a&&(k[a]=e[a]||j)}),k.parse=function(a){function f(a){var b,c;for(b=Q.length;b--&&Q[b].name!==a;);if(b>=0){for(c=Q.length-1;c>=b;c--)a=Q[c],a.valid&&
amp;O.end(a.name);Q.length=b}}function j(a,b,c,d,f){var h,i,j=/[\s\u0000-\u001F]+/g;if(b=b.toLowerCase(),c=b in u?b:S(c||d||f||""),w&&!r&&g(b)===!1){if(h=B[b],!h&&C){for(i=C.length;i--&&(h=C[i],!h.pattern.test(b)););i===-1&&(h=null)}if(!h)return;if(h.validValues&&!(c in h.validValues))return}if(T[b]&&!e.allow_script_urls){var k=c.replace(j,"");try{k=decodeURIComponent(k)}catch(l){k=unescape(k)}if(U.test(k))return;if(!e.allow_html_data_urls&&V.test(k)&&!/^data:image\//i.test(k))return}r&&(b in T||0===b.indexOf("on"))||(n.map[b]=c,n.push({name:b,value:c}))}var k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O=this,P=0,Q=[],R=0,S=b.decode,T=c.makeMap("src,href,data,background,formaction,poster"),U=/((java|vb)script|mhtml):/i,V=/^data:/i;for(J=new RegExp("<(?:(?:!--([\\w\\W]*?)-->)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>
;)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)>)|(?:([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/|\\s+)>))","g"),K=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g,t=i.getShortEndedElements(),I=e.self_closing_elements||i.getSelfClosingElements(),u=i.getBoolAttrs(),w=e.validate,s=e.remove_internals,N=e.fix_self_closing,L=i.getSpecialElements(),G=a+">";k=J.exec(G);){if(P<k.index&&O.text(S(a.substr(P,k.index-P))),l=k[6])l=l.toLowerCase(),":"===l.charAt(0)&&(l=l.substr(1)),f(l);else if(l=k[7]){if(k.index+k[0].length>a.length){O.text(S(a.substr(k.index))),P=k.index+k[0].length;continue}if(l=l.toLowerCase(),":"===l.charAt(0)&&(l=l.substr(1)),v=l in t,N&&I[l]&&Q.length>0&&Q[Q.length-1].name===l&&f(l),!w||(x=i.
getElementRule(l))){if(y=!0,w&&(B=x.attributes,C=x.attributePatterns),(A=k[8])?(r=A.indexOf("data-mce-type")!==-1,r&&s&&(y=!1),n=[],n.map={},A.replace(K,j)):(n=[],n.map={}),w&&!r){if(D=x.attributesRequired,E=x.attributesDefault,F=x.attributesForced,H=x.removeEmptyAttrs,H&&!n.length&&(y=!1),F)for(o=F.length;o--;)z=F[o],q=z.name,M=z.value,"{$uid}"===M&&(M="mce_"+R++),n.map[q]=M,n.push({name:q,value:M});if(E)for(o=E.length;o--;)z=E[o],q=z.name,q in n.map||(M=z.value,"{$uid}"===M&&(M="mce_"+R++),n.map[q]=M,n.push({name:q,value:M}));if(D){for(o=D.length;o--&&!(D[o]in n.map););o===-1&&(y=!1)}if(z=n.map["data-mce-bogus"]){if("all"===z){P=d(i,a,J.lastIndex),J.lastIndex=P;continue}y=!1}}y&&O.start(l,n,v)}else y=!1;if(m=L[l]){m.lastIndex=P=k.index+k[0].length,(k=m.exec(a))?(y&&(p=a.substr(P,k.index-P)),P=k.index+k[0].length):(p=a
.substr(P),P=a.length),y&&(p.length>0&&O.text(p,!0),O.end(l)),J.lastIndex=P;continue}v||(A&&A.indexOf("/")==A.length-1?y&&O.end(l):Q.push({name:l,valid:y}))}else(l=k[1])?(">"===l.charAt(0)&&(l=" "+l),e.allow_conditional_comments||"[if"!==l.substr(0,3).toLowerCase()||(l=" "+l),O.comment(l)):(l=k[2])?O.cdata(h(l)):(l=k[3])?O.doctype(l):(l=k[4])&&O.pi(l,k[5]);P=k.index+k[0].length}for(P<a.length&&O.text(S(a.substr(P))),o=Q.length-1;o>=0;o--)l=Q[o],l.valid&&O.end(l.name)}}var f=c.each,g=function(a){return 0===a.indexOf("data-")||0===a.indexOf("aria-")},h=function(a){return a.replace(/<!--|-->/g,"")};return e.findEndTag=d,e}),g("tinymce.core.html.DomParser",["tinymce.core.html.Node","tinymce.core.html.Schema","tinymce.core.html.SaxParser","tinymce.core.util.Tools"],function(a,b,c
,d){var e=d.makeMap,f=d.each,g=d.explode,h=d.extend,i=function(b,c){b.padd_empty_with_br?c.empty().append(new a("br","1")).shortEnded=!0:c.empty().append(new a("#text","3")).value="\xa0"},j=function(a,b){return a&&a.firstChild===a.lastChild&&a.firstChild.name===b},k=function(a,b){var c=a.getElementRule(b.name);return c&&c.paddEmpty},l=function(a,b,c,d){return d.isEmpty(b,c,function(b){return k(a,b)})};return function(k,m){function n(b){var c,d,f,g,h,i,k,n,p,q,r,s,t,u,v,w;for(s=e("tr,td,th,tbody,thead,tfoot,table"),q=m.getNonEmptyElements(),r=m.getWhiteSpaceElements(),t=m.getTextBlockElements(),u=m.getSpecialElements(),c=0;c<b.length;c++)if(d=b[c],d.parent&&!d.fixed)if(t[d.name]&&"li"==d.parent.name){for(v=d.next;v&&t[v.name];)v.name="li",v.fixed=!0,d.parent.insert(v,d.parent),v=v.next;d.unwrap(d)}else{for(g=[d],f=d.parent;f&&!m.isValidChild(f.nam
e,d.name)&&!s[f.name];f=f.parent)g.push(f);if(f&&g.length>1){for(g.reverse(),h=i=o.filterNode(g[0].clone()),p=0;p<g.length-1;p++){for(m.isValidChild(i.name,g[p].name)?(k=o.filterNode(g[p].clone()),i.append(k)):k=i,n=g[p].firstChild;n&&n!=g[p+1];)w=n.next,k.append(n),n=w;i=k}l(m,q,r,h)?f.insert(d,g[0],!0):(f.insert(h,g[0],!0),f.insert(d,h)),f=g[0],(l(m,q,r,f)||j(f,"br"))&&f.empty().remove()}else if(d.parent){if("li"===d.name){if(v=d.prev,v&&("ul"===v.name||"ul"===v.name)){v.append(d);continue}if(v=d.next,v&&("ul"===v.name||"ul"===v.name)){v.insert(d,v.firstChild,!0);continue}d.wrap(o.filterNode(new a("ul",1)));continue}m.isValidChild(d.parent.name,"div")&&m.isValidChild("div",d.name)?d.wrap(o.filterNode(new a("div",1))):u[d.name]?d.empty().remove():d.unwrap()}}}var o=this,p={},q=[],r={},s={};k=k||{},k.validate=!("valida
te"in k)||k.validate,k.root_name=k.root_name||"body",o.schema=m=m||new b,o.filterNode=function(a){var b,c,d;c in p&&(d=r[c],d?d.push(a):r[c]=[a]),b=q.length;for(;b--;)c=q[b].name,c in a.attributes.map&&(d=s[c],d?d.push(a):s[c]=[a]);return a},o.addNodeFilter=function(a,b){f(g(a),function(a){var c=p[a];c||(p[a]=c=[]),c.push(b)})},o.addAttributeFilter=function(a,b){f(g(a),function(a){var c;for(c=0;c<q.length;c++)if(q[c].name===a)return void q[c].callbacks.push(b);q.push({name:a,callbacks:[b]})})},o.parse=function(b,d){function f(){function a(a){a&&(d=a.firstChild,d&&3==d.type&&(d.value=d.value.replace(F,"")),d=a.lastChild,d&&3==d.type&&(d.value=d.value.replace(H,"")))}var b,c,d=u.firstChild;if(m.isValidChild(u.name,N.toLowerCase())){for(;d;)b=d.next,3==d.type||1==d.type&&"p"!==d.name&&!E[d.name]&&!d.attr("data-mce-type")?c?c.append(d):(c=g(N,1),c.att
r(k.forced_root_block_attrs),u.insert(c,d),c.append(d)):(a(c),c=null),d=b;a(c)}}function g(b,c){var d,e=new a(b,c);return b in p&&(d=r[b],d?d.push(e):r[b]=[e]),e}function j(a){var b,c,d,e,f=m.getBlockElements();for(b=a.prev;b&&3===b.type;){if(d=b.value.replace(H,""),d.length>0)return void(b.value=d);if(c=b.next){if(3==c.type&&c.value.length){b=b.prev;continue}if(!f[c.name]&&"script"!=c.name&&"style"!=c.name){b=b.prev;continue}}e=b.prev,b.remove(),b=e}}function o(a){var b,c={};for(b in a)"li"!==b&&"p"!=b&&(c[b]=a[b]);return c}var t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O=[];if(d=d||{},r={},s={},E=h(e("script,style,head,html,body,title,meta,param"),m.getBlockElements()),M=m.getNonEmptyElements(),L=m.children,D=k.validate,N="forced_root_block"in d?d.forced_root_block:k.forced_root_block,K=m.getWhiteSpaceElements(),F=/^[ \t\r\n]+/,H=/[ \t\r\n]+$/,I=/[ \t\r\n
]+/g,J=/^[ \t\r\n]+$/,t=new c({validate:D,allow_script_urls:k.allow_script_urls,allow_conditional_comments:k.allow_conditional_comments,self_closing_elements:o(m.getSelfClosingElements()),cdata:function(a){v.append(g("#cdata",4)).value=a},text:function(a,b){var c;G||(a=a.replace(I," "),v.lastChild&&E[v.lastChild.name]&&(a=a.replace(F,""))),0!==a.length&&(c=g("#text",3),c.raw=!!b,v.append(c).value=a)},comment:function(a){v.append(g("#comment",8)).value=a},pi:function(a,b){v.append(g(a,7)).value=b,j(v)},doctype:function(a){var b;b=v.append(g("#doctype",10)),b.value=a,j(v)},start:function(a,b,c){var d,e,f,h,i;if(f=D?m.getElementRule(a):{}){for(d=g(f.outputName||a,1),d.attributes=b,d.shortEnded=c,v.append(d),i=L[v.name],i&&L[d.name]&&!i[d.name]&&O.push(d),e=q.length;e--;)h=q[e].name,h in b.map&&(B=s[h],B?B.push(d):s[h]=[d]);E[a]&&j(d),c||(v=d),!G&&K[a]&
&(G=!0)}},end:function(a){var b,c,d,e,f;if(c=D?m.getElementRule(a):{}){if(E[a]&&!G){if(b=v.firstChild,b&&3===b.type)if(d=b.value.replace(F,""),d.length>0)b.value=d,b=b.next;else for(e=b.next,b.remove(),b=e;b&&3===b.type;)d=b.value,e=b.next,(0===d.length||J.test(d))&&(b.remove(),b=e),b=e;if(b=v.lastChild,b&&3===b.type)if(d=b.value.replace(H,""),d.length>0)b.value=d,b=b.prev;else for(e=b.prev,b.remove(),b=e;b&&3===b.type;)d=b.value,e=b.prev,(0===d.length||J.test(d))&&(b.remove(),b=e),b=e}if(G&&K[a]&&(G=!1),(c.removeEmpty||c.paddEmpty)&&l(m,M,K,v))if(c.paddEmpty)i(k,v);else if(!v.attributes.map.name&&!v.attributes.map.id)return f=v.parent,E[v.name]?v.empty().remove():v.unwrap(),void(v=f);v=v.parent}}},m),u=v=new a(d.context||k.root_name,11),t.parse(b),D&&O.length&&(d.context?d.invalid=!0:n(O)),N&&("body"==u.name||d.isRootContent)&&a
mp;f(),!d.invalid){for(C in r){for(B=p[C],w=r[C],z=w.length;z--;)w[z].parent||w.splice(z,1);for(x=0,y=B.length;x<y;x++)B[x](w,C,d)}for(x=0,y=q.length;x<y;x++)if(B=q[x],B.name in s){for(w=s[B.name],z=w.length;z--;)w[z].parent||w.splice(z,1);for(z=0,A=B.callbacks.length;z<A;z++)B.callbacks[z](w,B.name,d)}}return u},k.remove_trailing_brs&&o.addNodeFilter("br",function(b){var c,d,e,f,g,j,n,o,p=b.length,q=h({},m.getBlockElements()),r=m.getNonEmptyElements(),s=m.getNonEmptyElements();for(q.body=1,c=0;c<p;c++)if(d=b[c],e=d.parent,q[d.parent.name]&&d===e.lastChild){for(g=d.prev;g;){if(j=g.name,"span"!==j||"bookmark"!==g.attr("data-mce-type")){if("br"!==j)break;if("br"===j){d=null;break}}g=g.prev}d&&(d.remove(),l(m,r,s,e)&&(n=m.getElementRule(e.name),n&&(n.removeEmpty?e.remove():n.paddEmpty&&i(k,e))))}else{for(f=d;e&&e.firstChild===f&&e.lastChild===f&&am
p;(f=e,!q[e.name]);)e=e.parent;f===e&&k.padd_empty_with_br!==!0&&(o=new a("#text",3),o.value="\xa0",d.replace(o))}}),o.addAttributeFilter("href",function(a){var b,c=a.length,e=function(a){var b=a.split(" ").filter(function(a){return a.length>0});return b.concat(["noopener"]).sort().join(" ")},f=function(a){var b=a?d.trim(a):"";return/\b(noopener)\b/g.test(b)?b:e(b)};if(!k.allow_unsafe_link_target)for(;c--;)b=a[c],"a"===b.name&&"_blank"===b.attr("target")&&b.attr("rel",f(b.attr("rel")))}),k.allow_html_in_named_anchor||o.addAttributeFilter("id,name",function(a){for(var b,c,d,e,f=a.length;f--;)if(e=a[f],"a"===e.name&&e.firstChild&&!e.attr("href")){d=e.parent,b=e.lastChild;do c=b.prev,d.insert(b,e),b=c;while(b)}}),k.fix_list_elements&&o.addNodeFilter("ul,ol",function(b){f
or(var c,d,e=b.length;e--;)if(c=b[e],d=c.parent,"ul"===d.name||"ol"===d.name)if(c.prev&&"li"===c.prev.name)c.prev.append(c);else{var f=new a("li",1);f.attr("style","list-style-type: none"),c.wrap(f)}}),k.validate&&m.getValidClasses()&&o.addAttributeFilter("class",function(a){for(var b,c,d,e,f,g,h,i=a.length,j=m.getValidClasses();i--;){for(b=a[i],c=b.attr("class").split(" "),f="",d=0;d<c.length;d++)e=c[d],h=!1,g=j["*"],g&&g[e]&&(h=!0),g=j[b.name],!h&&g&&g[e]&&(h=!0),h&&(f&&(f+=" "),f+=e);f.length||(f=null),b.attr("class",f)}})}}),g("tinymce.core.html.Writer",["tinymce.core.html.Entities","tinymce.core.util.Tools"],function(a,b){var c=b.makeMap;return function(b){var d,e,f,g,h,i=[];return b=b||{},d=b.indent,e=c(b.indent_before||""),f=c(
b.indent_after||""),g=a.getEncodeFunc(b.entity_encoding||"raw",b.entities),h="html"==b.element_format,{start:function(a,b,c){var j,k,l,m;if(d&&e[a]&&i.length>0&&(m=i[i.length-1],m.length>0&&"\n"!==m&&i.push("\n")),i.push("<",a),b)for(j=0,k=b.length;j<k;j++)l=b[j],i.push(" ",l.name,'="',g(l.value,!0),'"');!c||h?i[i.length]=">":i[i.length]=" />",c&&d&&f[a]&&i.length>0&&(m=i[i.length-1],m.length>0&&"\n"!==m&&i.push("\n"))},end:function(a){var b;i.push("</",a,">"),d&&f[a]&&i.length>0&&(b=i[i.length-1],b.length>0&&"\n"!==b&&i.push("\n"))},text:function(a,b){a.length>0&&(i[i.length]=b?a:g(a))},cdata:function(a){i.push("<![CDATA[",a,"]]>&qu
ot;)},comment:function(a){i.push("<!--",a,"-->")},pi:function(a,b){b?i.push("<?",a," ",g(b),"?>"):i.push("<?",a,"?>"),d&&i.push("\n")},doctype:function(a){i.push("<!DOCTYPE",a,">",d?"\n":"")},reset:function(){i.length=0},getContent:function(){return i.join("").replace(/\n$/,"")}}}}),g("tinymce.core.html.Serializer",["tinymce.core.html.Writer","tinymce.core.html.Schema"],function(a,b){return function(c,d){var e=this,f=new a(c);c=c||{},c.validate=!("validate"in c)||c.validate,e.schema=d=d||new b,e.writer=f,e.serialize=function(a){function b(a){var c,h,i,j,k,l,m,n,o,p=e[a.type];if(p)p(a);else{if(c=a.name,h=a.shortEnded,i=a.attributes,g&&i&&i.length>1&&(l=[],l.map={},o=d.getElementRule(a.name))){for(m=0,n=o.attributesOrder.length;m<n;m++)j=o.attribu
tesOrder[m],j in i.map&&(k=i.map[j],l.map[j]=k,l.push({name:j,value:k}));for(m=0,n=i.length;m<n;m++)j=i[m].name,j in l.map||(k=i.map[j],l.map[j]=k,l.push({name:j,value:k}));i=l}if(f.start(a.name,i,h),!h){if(a=a.firstChild)do b(a);while(a=a.next);f.end(c)}}}var e,g;return g=c.validate,e={3:function(a){f.text(a.value,a.raw)},8:function(a){f.comment(a.value)},7:function(a){f.pi(a.name,a.value)},10:function(a){f.doctype(a.value)},4:function(a){f.cdata(a.value)},11:function(a){if(a=a.firstChild)do b(a);while(a=a.next)}},f.reset(),1!=a.type||c.inner?e[11](a):b(a),f.getContent()}}}),g("tinymce.core.dom.Serializer",["tinymce.core.dom.DOMUtils","tinymce.core.html.DomParser","tinymce.core.html.SaxParser","tinymce.core.html.Entities","tinymce.core.html.Serializer","tinymce.core.html.Node","tinymce.core.html.Schema","tinymce.core.Env","tinymce.core.util.Tools","tinymce.core.text.Z
wsp"],function(a,b,c,d,e,f,g,h,i,j){function k(a){function b(a){return a&&"br"===a.name}var c,d;c=a.lastChild,b(c)&&(d=c.prev,b(d)&&(c.remove(),d.remove()))}var l=i.each,m=i.trim,n=a.DOM;return function(a,f){function o(a){var b=new RegExp(["<span[^>]+data-mce-bogus[^>]+>[\u200b\ufeff]+<\\/span>","\\s?("+v.join("|")+')="[^"]+"'].join("|"),"gi");return a=j.trim(a.replace(b,""))}function p(a){var b,d,e,g,h,i=a,j=/<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g,k=f.schema;for(i=o(i),h=k.getShortEndedElements();g=j.exec(i);)d=j.lastIndex,e=g[0].length,b=h[g[1]]?d:c.findEndTag(k,i,d),i=i.substring(0,d-e)+i.substring(b),j.lastIndex=d-e;return i}function q(){return p(f.getBody().innerHTML)}function r(a){i.inArray(v,a)===-1&&(u.addAttributeFilter(a,function(a,b){for(var c=a.length;c--;)a[c].attr(b,null)}),v.push(a))}var s,t,u,v=["data
-mce-selected"];return f&&(s=f.dom,t=f.schema),s=s||n,t=t||new g(a),a.entity_encoding=a.entity_encoding||"named",a.remove_trailing_brs=!("remove_trailing_brs"in a)||a.remove_trailing_brs,u=new b(a,t),u.addAttributeFilter("data-mce-tabindex",function(a,b){for(var c,d=a.length;d--;)c=a[d],c.attr("tabindex",c.attributes.map["data-mce-tabindex"]),c.attr(b,null)}),u.addAttributeFilter("src,href,style",function(b,c){for(var d,e,f,g=b.length,h="data-mce-"+c,i=a.url_converter,j=a.url_converter_scope;g--;)d=b[g],e=d.attributes.map[h],e!==f?(d.attr(c,e.length>0?e:null),d.attr(h,null)):(e=d.attributes.map[c],"style"===c?e=s.serializeStyle(s.parseStyle(e),d.name):i&&(e=i.call(j,e,c,d.name)),d.attr(c,e.length>0?e:null))}),u.addAttributeFilter("class",function(a){for(var b,c,d=a.length;d--;)b=a[d],c=b.attr("class"),c&&(c=b.attr("class").replace(/(?:^|\s)
mce-item-\w+(?!\S)/g,""),b.attr("class",c.length>0?c:null))}),u.addAttributeFilter("data-mce-type",function(a,b,c){for(var d,e=a.length;e--;)d=a[e],"bookmark"!==d.attributes.map["data-mce-type"]||c.cleanup||d.remove()}),u.addNodeFilter("noscript",function(a){for(var b,c=a.length;c--;)b=a[c].firstChild,b&&(b.value=d.decode(b.value))}),u.addNodeFilter("script,style",function(a,b){function c(a){return a.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")}for(var d,e,f,g=a.length;g--;)d=a[g],e=d.firstChild?d.firstChild.value:"","script
"===b?(f=d.attr("type"),f&&d.attr("type","mce-no/type"==f?null:f.replace(/^mce\-/,"")),e.length>0&&(d.firstChild.value="// <![CDATA[\n"+c(e)+"\n// ]]>")):e.length>0&&(d.firstChild.value="<!--\n"+c(e)+"\n-->")}),u.addNodeFilter("#comment",function(a){for(var b,c=a.length;c--;)b=a[c],0===b.value.indexOf("[CDATA[")?(b.name="#cdata",b.type=4,b.value=b.value.replace(/^\[CDATA\[|\]\]$/g,"")):0===b.value.indexOf("mce:protected ")&&(b.name="#text",
-b.type=3,b.raw=!0,b.value=unescape(b.value).substr(14))}),u.addNodeFilter("xml:namespace,input",function(a,b){for(var c,d=a.length;d--;)c=a[d],7===c.type?c.remove():1===c.type&&("input"!==b||"type"in c.attributes.map||c.attr("type","text"))}),u.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-type,data-mce-resize",function(a,b){for(var c=a.length;c--;)a[c].attr(b,null)}),{schema:t,addNodeFilter:u.addNodeFilter,addAttributeFilter:u.addAttributeFilter,serialize:function(b,c){var d,f,g,i,n,o,p=this;return h.ie&&s.select("script,style,select,map").length>0?(n=b.innerHTML,b=b.cloneNode(!1),s.setHTML(b,n)):b=b.cloneNode(!0),d=document.implementation,d.createHTMLDocument&&(f=d.createHTMLDocument(""),l("BODY"==b.nodeName?b.childNodes:[b],function(a){f.body.appendChild(f.importNode(a,!0))}),b="BODY"!=b.nodeName
?f.body.firstChild:f.body,g=s.doc,s.doc=f),c=c||{},c.format=c.format||"html",c.selection&&(c.forced_root_block=""),c.no_events||(c.node=b,p.onPreProcess(c)),n=j.trim(m(c.getInner?b.innerHTML:s.getOuterHTML(b))),o=u.parse(n,c),k(o),i=new e(a,t),c.content=i.serialize(o),c.no_events||p.onPostProcess(c),g&&(s.doc=g),c.node=null,c.content},addRules:function(a){t.addValidElements(a)},setRules:function(a){t.setValidElements(a)},onPreProcess:function(a){f&&f.fire("PreProcess",a)},onPostProcess:function(a){f&&f.fire("PostProcess",a)},addTempAttr:r,trimHtml:o,getTrimmedContent:q,trimContent:p}}}),g("tinymce.core.delete.DeleteUtils",["ephox.katamari.api.Option","ephox.sugar.api.dom.Compare","ephox.sugar.api.node.Element","ephox.sugar.api.search.PredicateFind","tinymce.core.dom.ElementType"],function(a,b,c,d,e){var f=function(a){return function(d){return b.eq(a,c.f
romDom(d.dom().parentNode))}},g=function(c,g){return b.contains(c,g)?d.closest(g,function(a){return e.isTextBlock(a)||e.isListItem(a)},f(c)):a.none()},h=function(a){var b=a.getBody(),c=b.firstChild&&a.dom.isBlock(b.firstChild)?b.firstChild:b;a.selection.setCursorLocation(c,0)},i=function(a){a.dom.isEmpty(a.getBody())&&(a.setContent(""),h(a))};return{getParentBlock:g,paddEmptyBody:i}}),g("ephox.sugar.api.search.SelectorExists",["ephox.sugar.api.search.SelectorFind"],function(a){var b=function(b){return a.first(b).isSome()},c=function(b,c,d){return a.ancestor(b,c,d).isSome()},d=function(b,c){return a.sibling(b,c).isSome()},e=function(b,c){return a.child(b,c).isSome()},f=function(b,c){return a.descendant(b,c).isSome()},g=function(b,c,d){return a.closest(b,c,d).isSome()};return{any:b,ancestor:c,sibling:d,child:e,descendant:f,closest:g}}),g("tinymce.core.dom.Empty",["ephox.katamari.api.Fun","ephox.sugar.api.dom.Compar
e","ephox.sugar.api.node.Element","ephox.sugar.api.search.SelectorExists","tinymce.core.caret.CaretCandidate","tinymce.core.dom.NodeType","tinymce.core.dom.TreeWalker"],function(a,b,c,d,e,f,g){var h=function(e,f){var g=c.fromDom(e),h=c.fromDom(f);return d.ancestor(h,"pre,code",a.curry(b.eq,g))},i=function(a,b){return f.isText(b)&&/^[ \t\r\n]*$/.test(b.data)&&h(a,b)===!1},j=function(a){return f.isElement(a)&&"A"===a.nodeName&&a.hasAttribute("name")},k=function(a,b){return e.isCaretCandidate(b)&&i(a,b)===!1||j(b)||l(b)},l=f.hasAttribute("data-mce-bookmark"),m=f.hasAttribute("data-mce-bogus"),n=f.hasAttributeValue("data-mce-bogus","all"),o=function(a){var b,c,d=0;if(k(a,a))return!1;if(c=a.firstChild,!c)return!0;b=new g(c,a);do if(n(c))c=b.next(!0);else if(m(c))c=b.next();else if(f.isBr(c))d++,c=b.next();else{if(k(a,c))retur
n!1;c=b.next()}while(c);return d<=1},p=function(a){return o(a.dom())};return{isEmpty:p}}),g("tinymce.core.delete.BlockBoundary",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.katamari.api.Option","ephox.katamari.api.Options","ephox.katamari.api.Struct","ephox.sugar.api.dom.Compare","ephox.sugar.api.node.Element","ephox.sugar.api.node.Node","ephox.sugar.api.search.PredicateFind","ephox.sugar.api.search.Traverse","tinymce.core.caret.CaretFinder","tinymce.core.caret.CaretPosition","tinymce.core.delete.DeleteUtils","tinymce.core.dom.Empty","tinymce.core.dom.NodeType"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){var p=e.immutable("block","position"),q=e.immutable("from","to"),r=function(a,b){var c=g.fromDom(a),d=g.fromDom(b.container());return m.getParentBlock(c,d).map(function(a){
return p(a,b)})},s=function(a){return f.eq(a.from().block(),a.to().block())===!1},t=function(a){return j.parent(a.from().block()).bind(function(b){return j.parent(a.to().block()).filter(function(a){return f.eq(b,a)})}).isSome()},u=function(a){return o.isContentEditableFalse(a.from().block())===!1&&o.isContentEditableFalse(a.to().block())===!1},v=function(a,b,d){return o.isBr(d.position().getNode())&&n.isEmpty(d.block())===!1?k.positionIn(!1,d.block().dom()).bind(function(e){return e.isEqual(d.position())?k.fromPosition(b,a,e).bind(function(b){return r(a,b)}):c.some(d)}).getOr(d):d},w=function(a,b,c){var e=r(a,l.fromRangeStart(c)),f=e.bind(function(c){return k.fromPosition(b,a,c.position()).bind(function(c){return r(a,c).map(function(c){return v(a,b,c)})})});return d.liftN([e,f],q).filter(function(a){return s(a)&&t(a)&&u(a)})},x=function(a,b,d){return d.collapsed?w(a,b,d):c.none()};return{read:x}}),g("tinymce.core.delete.MergeBlocks",["e
phox.katamari.api.Arr","ephox.katamari.api.Option","ephox.sugar.api.dom.Compare","ephox.sugar.api.dom.Insert","ephox.sugar.api.dom.Remove","ephox.sugar.api.node.Element","ephox.sugar.api.search.Traverse","tinymce.core.caret.CaretFinder","tinymce.core.caret.CaretPosition","tinymce.core.dom.ElementType","tinymce.core.dom.Empty","tinymce.core.dom.NodeType","tinymce.core.dom.Parents"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n=function(b){var c=g.children(b);return a.findIndex(c,j.isBlock).fold(function(){return c},function(a){return c.slice(0,a)})},o=function(b){var c=n(b);return a.each(c,function(a){e.remove(a)}),c},p=function(a,b){h.positionIn(a,b.dom()).each(function(a){var b=a.getNode();l.isBr(b)&&e.remove(f.fromDom(b))})},q=function(b,c){var d=m.parentsAndSelf(c,b);return a.find(d.reverse(),k.isEmpty).each(e.remove)},r=function(a,d){var e=g.parents(d,
function(b){return c.eq(b,a)});return b.from(e[e.length-2])},s=function(a,d){return c.contains(d,a)?g.parent(a).bind(function(e){return c.eq(e,d)?b.some(a):r(d,a)}):b.none()},t=function(b,c,f){if(k.isEmpty(f))return e.remove(f),h.firstPositionIn(c.dom());p(!0,c),p(!1,f);var g=o(c);return s(c,f).fold(function(){q(b,c);var e=h.lastPositionIn(f.dom());return a.each(g,function(a){d.append(f,a)}),e},function(e){var j=h.prevPosition(f.dom(),i.before(e.dom()));return a.each(g,function(a){d.before(e,a)}),q(b,c),j})},u=function(a,b,c,d){return b?t(a,d,c):t(a,c,d)};return{mergeBlocks:u}}),g("tinymce.core.delete.BlockBoundaryDelete",["ephox.sugar.api.node.Element","tinymce.core.delete.BlockBoundary","tinymce.core.delete.MergeBlocks"],function(a,b,c){var d=function(d,e){var f,g=a.fromDom(d.getBody());return f=b.read(g.dom(),e,d.selection.getRng()).bind(function(a){return c.mergeBlocks(g,e,a.from().block(),a.to().block())}),f.each(function(a){d.selection.s
etRng(a.toRange())}),f.isSome()};return{backspaceDelete:d}}),g("tinymce.core.delete.BlockRangeDelete",["ephox.katamari.api.Options","ephox.sugar.api.dom.Compare","ephox.sugar.api.node.Element","tinymce.core.caret.CaretFinder","tinymce.core.caret.CaretPosition","tinymce.core.delete.DeleteUtils","tinymce.core.delete.MergeBlocks"],function(a,b,c,d,e,f,g){var h=function(d,e){var h=e.getRng();return a.liftN([f.getParentBlock(d,c.fromDom(h.startContainer)),f.getParentBlock(d,c.fromDom(h.endContainer))],function(a,c){return b.eq(a,c)===!1&&(h.deleteContents(),g.mergeBlocks(d,!0,a,c).each(function(a){e.setRng(a.toRange())}),!0)}).getOr(!1)},i=function(a,b){var c=d.prevPosition(a.dom(),e.fromRangeStart(b)).isNone(),f=d.nextPosition(a.dom(),e.fromRangeEnd(b)).isNone();return c&&f},j=function(a){return a.setContent(""),a.selection.setCursorLocation(),!0},k=function(a){var b=c.fromDom(a.get
Body()),d=a.selection.getRng();return i(b,d)?j(a):h(b,a.selection)},l=function(a,b){return!a.selection.isCollapsed()&&k(a,a.selection.getRng())};return{backspaceDelete:l}}),g("ephox.katamari.api.Adt",["ephox.katamari.api.Arr","ephox.katamari.api.Obj","ephox.katamari.api.Type","global!Array","global!Error","global!console"],function(a,b,c,d,e,f){var g=function(g){if(!c.isArray(g))throw new e("cases must be an array");if(0===g.length)throw new e("there must be at least one case");var h=[],i={};return a.each(g,function(j,k){var l=b.keys(j);if(1!==l.length)throw new e("one and only one name per case");var m=l[0],n=j[m];if(void 0!==i[m])throw new e("duplicate key detected:"+m);if("cata"===m)throw new e("cannot have a case named cata (sorry)");if(!c.isArray(n))throw new e("case arguments must be an array");h.push(m),i[m]=function(){var c=argum
ents.length;if(c!==n.length)throw new e("Wrong number of arguments to case "+m+". Expected "+n.length+" ("+n+"), got "+c);for(var i=new d(c),j=0;j<i.length;j++)i[j]=arguments[j];var l=function(c){var d=b.keys(c);if(h.length!==d.length)throw new e("Wrong number of arguments to match. Expected: "+h.join(",")+"\nActual: "+d.join(","));var f=a.forall(h,function(b){return a.contains(d,b)});if(!f)throw new e("Not all branches were specified when using match. Specified: "+d.join(", ")+"\nRequired: "+h.join(", "));return c[m].apply(null,i)};return{fold:function(){if(arguments.length!==g.length)throw new e("Wrong number of arguments to fold. Expected "+g.length+", got "+arguments.length);var a=arguments[k];return a.apply(null,i)},match:l,log:function(a){f.log(a,{constructors:h,constructor:m,params:i})}}}}),i};return{generate:g}}),g("tinymce.core.
delete.CefDeleteAction",["ephox.katamari.api.Adt","ephox.katamari.api.Option","ephox.sugar.api.node.Element","tinymce.core.caret.CaretFinder","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretUtils","tinymce.core.delete.DeleteUtils","tinymce.core.dom.Empty","tinymce.core.dom.NodeType"],function(a,b,c,d,e,f,g,h,i){var j=a.generate([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),k=function(a,b){var c=b.getNode(a===!1),d=a?"after":"before";return i.isElement(c)&&c.getAttribute("data-mce-caret")===d},l=function(a,d,e,f){var i=f.getNode(d===!1);return g.getParentBlock(c.fromDom(a),c.fromDom(e.getNode())).map(function(a){return h.isEmpty(a)?j.remove(a.dom()):j.moveToElement(i)}).orThunk(function(){return b.some(j.moveToElement(i))})},m=function(a,c,e){return d.fromPosition(c,a,e).bind(
function(d){return c&&i.isContentEditableFalse(d.getNode())?l(a,c,e,d):c===!1&&i.isContentEditableFalse(d.getNode(!0))?l(a,c,e,d):c&&f.isAfterContentEditableFalse(e)?b.some(j.moveToPosition(d)):c===!1&&f.isBeforeContentEditableFalse(e)?b.some(j.moveToPosition(d)):b.none()})},n=function(a,c){return a&&i.isContentEditableFalse(c.nextSibling)?b.some(j.moveToElement(c.nextSibling)):a===!1&&i.isContentEditableFalse(c.previousSibling)?b.some(j.moveToElement(c.previousSibling)):b.none()},o=function(a,c,d){return k(c,d)?n(c,d.getNode(c===!1)).fold(function(){return m(a,c,d)},b.some):m(a,c,d)},p=function(a,c,d){var g=f.normalizeRange(c?1:-1,a,d),h=e.fromRangeStart(g);return c===!1&&f.isAfterContentEditableFalse(h)?b.some(j.remove(h.getNode(!0))):c&&f.isBeforeContentEditableFalse(h)?b.some(j.remove(h.getNode())):o(a,c,h)};return{read:p}}),g("tinymce.core.delete.DeleteElement",["ephox.katamari.api.Fun","ep
hox.katamari.api.Option","ephox.katamari.api.Options","ephox.sugar.api.dom.Insert","ephox.sugar.api.dom.Remove","ephox.sugar.api.node.Element","ephox.sugar.api.node.Node","ephox.sugar.api.search.PredicateFind","ephox.sugar.api.search.Traverse","tinymce.core.caret.CaretCandidate","tinymce.core.caret.CaretFinder","tinymce.core.caret.CaretPosition","tinymce.core.dom.Empty","tinymce.core.dom.NodeType"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){var o=function(a,b){var c=a.container(),d=a.offset();return l.isTextPosition(a)===!1&&c===b.parentNode&&d>l.before(b).offset()},p=function(a,b){return o(b,a)?new l(b.container(),b.offset()-1):b},q=function(a){return n.isText(a)?new l(a,0):l.before(a)},r=function(a){return n.isText(a)?new l(a,a.data.length):l.after(a)},s=function(a){return j.isCaretCandidate(a.previousSibling)?b.some(r(a.previousSibling)):a.pre
viousSibling?k.lastPositionIn(a.previousSibling):b.none()},t=function(a){return j.isCaretCandidate(a.nextSibling)?b.some(q(a.nextSibling)):a.nextSibling?k.firstPositionIn(a.nextSibling):b.none()},u=function(a,c){var d=l.before(c.previousSibling?c.previousSibling:c.parentNode);return k.prevPosition(a,d).fold(function(){return k.nextPosition(a,l.after(c))},b.some)},v=function(a,c){return k.nextPosition(a,l.after(c)).fold(function(){return k.prevPosition(a,l.before(c))},b.some)},w=function(a,b){return s(b).orThunk(function(){return t(b)}).orThunk(function(){return u(a,b)})},x=function(a,b){return t(b).orThunk(function(){return s(b)}).orThunk(function(){return v(a,b)})},y=function(a,b,c){return a?x(b,c):w(b,c)},z=function(b,c,d){return y(b,c,d).map(a.curry(p,d))},A=function(a,b,c){c.fold(function(){a.focus()},function(c){a.selection.setRng(c.toRange(),b)})},B=function(a){return function(b){return b.dom()===a}},C=function(a,b){return b&&a.schema.getBlockElements().hasOwnProperty(
g.name(b))},D=function(a){if(m.isEmpty(a)){var c=f.fromHtml('<br data-mce-bogus="1">');return e.empty(a),d.append(a,c),b.some(l.before(c.dom()))}return b.none()},E=function(a,b){return c.liftN([i.prevSibling(a),i.nextSibling(a),b],function(b,c,d){var f,g=b.dom(),h=c.dom();return n.isText(g)&&n.isText(h)?(f=g.data.length,g.appendData(h.data),e.remove(c),e.remove(a),d.container()===h?new l(g,f):d):(e.remove(a),d)}).orThunk(function(){return e.remove(a),b})},F=function(c,d,e){var f=z(d,c.getBody(),e.dom()),g=h.ancestor(e,a.curry(C,c),B(c.getBody())),i=E(e,f);g.bind(D).fold(function(){A(c,d,i)},function(a){A(c,d,b.some(a))})};return{deleteElement:F}}),g("tinymce.core.delete.CefDelete",["ephox.katamari.api.Arr","ephox.sugar.api.dom.Remove","ephox.sugar.api.node.Element","ephox.sugar.api.search.SelectorFilter","tinymce.core.caret.CaretPosition","tinymce.core.delete.CefDeleteAction","tinymce.
core.delete.DeleteElement","tinymce.core.delete.DeleteUtils","tinymce.core.dom.NodeType"],function(a,b,c,d,e,f,g,h,i){var j=function(a,b){return function(d){return g.deleteElement(a,b,c.fromDom(d)),!0}},k=function(a,b){return function(c){var d=b?e.before(c):e.after(c);return a.selection.setRng(d.toRange()),!0}},l=function(a){return function(b){return a.selection.setRng(b.toRange()),!0}},m=function(a,b){var c=f.read(a.getBody(),b,a.selection.getRng()).map(function(c){return c.fold(j(a,b),k(a,b),l(a))});return c.getOr(!1)},n=function(c){a.each(d.descendants(c,".mce-offscreen-selection"),b.remove)},o=function(a,b){var d=a.selection.getNode();return!!i.isContentEditableFalse(d)&&(n(c.fromDom(a.getBody())),g.deleteElement(a,b,c.fromDom(a.selection.getNode())),h.paddEmptyBody(a),!0)},p=function(a,b){for(;b&&b!==a;){if(i.isContentEditableTrue(b)||i.isContentEditableFalse(b))return b;b=b.parentNode}return null},q=function(a){var b,c=p(a.get
Body(),a.selection.getNode());return i.isContentEditableTrue(c)&&a.dom.isBlock(c)&&a.dom.isEmpty(c)&&(b=a.dom.create("br",{"data-mce-bogus":"1"}),a.dom.setHTML(c,""),c.appendChild(b),a.selection.setRng(e.before(b).toRange())),!0},r=function(a,b){return a.selection.isCollapsed()?m(a,b):o(a,b)};return{backspaceDelete:r,paddEmptyElement:q}}),g("tinymce.core.caret.CaretContainerInline",["ephox.katamari.api.Fun","tinymce.core.dom.NodeType","tinymce.core.text.Zwsp"],function(a,b,c){var d=b.isText,e=function(a){return d(a)&&a.data[0]===c.ZWSP},f=function(a){return d(a)&&a.data[a.data.length-1]===c.ZWSP},g=function(a){return a.ownerDocument.createTextNode(c.ZWSP)},h=function(a){if(d(a.previousSibling))return f(a.previousSibling)?a.previousSibling:(a.previousSibling.appendData(c.ZWSP),a.previousSibling);if(d(a))return e(a)?a:(a.insertData(0,c.ZWSP),a);var b=g(a);return a.pa
rentNode.insertBefore(b,a),b},i=function(a){if(d(a.nextSibling))return e(a.nextSibling)?a.nextSibling:(a.nextSibling.insertData(0,c.ZWSP),a.nextSibling);if(d(a))return f(a)?a:(a.appendData(c.ZWSP),a);var b=g(a);return a.nextSibling?a.parentNode.insertBefore(b,a.nextSibling):a.parentNode.appendChild(b),b},j=function(a,b){return a?h(b):i(b)};return{insertInline:j,insertInlineBefore:a.curry(j,!0),insertInlineAfter:a.curry(j,!1)}}),g("tinymce.core.caret.CaretContainerRemove",["ephox.katamari.api.Arr","tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretPosition","tinymce.core.dom.NodeType","tinymce.core.text.Zwsp","tinymce.core.util.Tools"],function(a,b,c,d,e,f){var g=d.isElement,h=d.isText,i=function(a){var b=a.parentNode;b&&b.removeChild(a)},j=function(a){try{return a.nodeValue}catch(b){return""}},k=function(a,b){0===b.length?i(a):a.nodeValue=b},l=function(a){var b=e.trim(a);return{count:a.
length-b.length,text:b}},m=function(a,b){return s(a),b},n=function(a,b){var d=l(a.data.substr(0,b.offset())),e=l(a.data.substr(b.offset())),f=d.text+e.text;return f.length>0?(k(a,f),new c(a,b.offset()-d.count)):b},o=function(b,d){var e=d.container(),f=a.indexOf(e.childNodes,b).map(function(a){return a<d.offset()?new c(e,d.offset()-1):d}).getOr(d);return s(b),f},p=function(a,b){return b.container()===a?n(a,b):m(a,b)},q=function(a,b){return b.container()===a.parentNode?o(a,b):m(a,b)},r=function(a,b){return c.isTextPosition(b)?p(a,b):q(a,b)},s=function(a){if(g(a)&&b.isCaretContainer(a)&&(b.hasContent(a)?a.removeAttribute("data-mce-caret"):i(a)),h(a)){var c=e.trim(j(a));k(a,c)}};return{removeAndReposition:r,remove:s}}),g("tinymce.core.EditorSettings",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.katamari.api.Obj","ephox.katamari.api.Option","ephox.katamari.api.Strings","ephox.kat
amari.api.Struct","ephox.katamari.api.Type","ephox.sand.api.PlatformDetection","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g,h,i){var j=f.immutable("sections","settings"),k=h.detect(),l=k.deviceType.isTouch(),m=["lists","autolink","autosave"],n=function(a){return g.isArray(a)?a.join(" "):a},o=function(c){var d=a.map(n(c).split(" "),e.trim);return a.filter(d,b.curry(a.contains,m)).join(" ")},p=function(b,d){var e=c.bifilter(d,function(c,d){return a.contains(b,d)});return j(e.t,e.f)},q=function(a,b){var c=a.sections();return c.hasOwnProperty(b)?c[b]:{}},r=function(a,b){return a.sections().hasOwnProperty(b)},s=function(a,b,c){return{id:a,theme:"modern",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:b,add_form_submit_trigger:!0,submit_patch:!0,add_unload_trigger:!0,convert_urls:!0,relative_urls:!0,remove_script_host:
!0,object_resizing:!0,doctype:"<!DOCTYPE html>",visual:!0,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",forced_root_block:"p",hidden_input:!0,padd_empty_editor:!0,render_ui:!0,indentation:"30px",inline_styles:!0,convert_fonts_to_spans:!0,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist",entity_encoding:"named",url_converter:c.convertURL,url_converter_scope:c,ie7_compat:!0}},t=function(a,b){var c=b.external_plugins?b.exte
rnal_plugins:{};return a&&a.external_plugins?i.extend({},a.external_plugins,c):c},u=function(a,b,c){var d=p(["mobile"],c),e=d.settings().plugins,f=i.extend(a,b,d.settings(),l?q(d,"mobile"):{},{validate:!0,content_editable:d.settings().inline,external_plugins:t(b,d.settings())},l&&e&&r(d,"mobile")?{plugins:o(e)}:{});return f},v=function(a,b,c,d,e){var f=s(b,c,a);return u(f,d,e)},w=function(a,b){return d.from(a.settings[b])},x=function(a,b,c){return d.from(b.settings[c]).filter(a)};return{getEditorSettings:v,get:w,getString:b.curry(x,g.isString),filterMobilePlugins:o}}),g("tinymce.core.text.Bidi",[],function(){var a=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,b=function(b){return a.test(b)};return{hasStrongRtl:b}}),g("tinymce.core.keyboard.InlineUtils",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.katamari.api.Option","ephox.katamari.api.Options","ephox.ka
tamari.api.Type","ephox.sugar.api.node.Element","ephox.sugar.api.search.Selectors","tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretFinder","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretUtils","tinymce.core.caret.CaretWalker","tinymce.core.dom.DOMUtils","tinymce.core.dom.NodeType","tinymce.core.EditorSettings","tinymce.core.text.Bidi"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){var q=function(a,b){var c=o.getString(a,"inline_boundaries_selector").getOr("a[href],code");return g.is(f.fromDom(b),c)},r=function(a){return"rtl"===m.DOM.getStyle(a,"direction",!0)||p.hasStrongRtl(a.textContent)},s=function(b,c,d){return a.filter(m.DOM.getParents(d.container(),"*",c),b)},t=function(a,b,d){var e=s(a,b,d);return c.from(e[e.length-1])},u=function(a,b,c){var d=k.getParentBlock(b,a),e=k.getParentBlock(c,a);ret
urn d&&d===e},v=function(a){return h.isBeforeInline(a)||h.isAfterInline(a)},w=function(a,b){var c=b.container(),d=b.offset();return a?h.isCaretContainerInline(c)?n.isText(c.nextSibling)?new j(c.nextSibling,0):j.after(c):h.isBeforeInline(b)?new j(c,d+1):b:h.isCaretContainerInline(c)?n.isText(c.previousSibling)?new j(c.previousSibling,c.previousSibling.data.length):j.before(c):h.isAfterInline(b)?new j(c,d-1):b},x=b.curry(w,!0),y=b.curry(w,!1);return{isInlineTarget:q,findRootInline:t,isRtl:r,isAtZwsp:v,normalizePosition:w,normalizeForwards:x,normalizeBackwards:y,hasSameParentBlock:u}}),g("tinymce.core.keyboard.BoundaryCaret",["ephox.katamari.api.Option","tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretContainerInline","tinymce.core.caret.CaretContainerRemove","tinymce.core.caret.CaretFinder","tinymce.core.caret.CaretPosition","tinymce.core.dom.NodeType","tinymce.core.keyboard.Inline
Utils"],function(a,b,c,d,e,f,g,h){var i=function(a,b){return g.isText(a.container())?c.insertInline(b,a.container()):c.insertInline(b,a.getNode())},j=function(a,c){var d=c.get();return d&&a.container()===d&&b.isCaretContainerInline(d)},k=function(b,g){return g.fold(function(e){d.remove(b.get());var g=c.insertInlineBefore(e);return b.set(g),a.some(new f(g,g.length-1))},function(a){return e.firstPositionIn(a).map(function(a){if(j(a,b))return new f(b.get(),1);d.remove(b.get());var c=i(a,!0);return b.set(c),new f(c,1)})},function(a){return e.lastPositionIn(a).map(function(a){if(j(a,b))return new f(b.get(),b.get().length-1);d.remove(b.get());var c=i(a,!1);return b.set(c),new f(c,c.length-1)})},function(e){d.remove(b.get());var g=c.insertInlineAfter(e);return b.set(g),a.some(new f(g,1))})};return{renderCaret:k}}),g("tinymce.core.util.LazyEvaluator",["ephox.katamari.api.Option"],function(a){var b=function(b,c){for(var d=0;d<b.length;d++){var e=b[
d].apply(null,c);if(e.isSome())return e}return a.none()};return{evaluateUntil:b}}),g("tinymce.core.keyboard.BoundaryLocation",["ephox.katamari.api.Adt","ephox.katamari.api.Fun","ephox.katamari.api.Option","ephox.katamari.api.Options","tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretFinder","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretUtils","tinymce.core.dom.NodeType","tinymce.core.keyboard.InlineUtils","tinymce.core.util.LazyEvaluator"],function(a,b,c,d,e,f,g,h,i,j,k){var l=a.generate([{before:["element"]},{start:["element"]},{end:["element"]},{after:["element"]}]),m=function(a,b){var c=h.getParentBlock(b,a);return c?c:a},n=function(a,d,e){var g=j.normalizeForwards(e),h=m(d,g.container());return j.findRootInline(a,h,g).fold(function(){return f.nextPosition(h,g).bind(b.curry(j.findRootInline,a,h)).m
ap(function(a){return l.before(a)})},c.none)},o=function(a,b,d){var e=j.normalizeBackwards(d);return j.findRootInline(a,b,e).bind(function(a){var b=f.prevPosition(a,e);return b.isNone()?c.some(l.start(a)):c.none()})},p=function(a,b,d){var e=j.normalizeForwards(d);return j.findRootInline(a,b,e).bind(function(a){var b=f.nextPosition(a,e);return b.isNone()?c.some(l.end(a)):c.none()})},q=function(a,d,e){var g=j.normalizeBackwards(e),h=m(d,g.container());return j.findRootInline(a,h,g).fold(function(){return f.prevPosition(h,g).bind(b.curry(j.findRootInline,a,h)).map(function(a){return l.after(a)})},c.none)},r=function(a){return j.isRtl(t(a))===!1},s=function(a,b,c){var d=k.evaluateUntil([n,o,p,q],[a,b,c]);return d.filter(r)},t=function(a){return a.fold(b.identity,b.identity,b.identity,b.identity)},u=function(a){return a.fold(b.constant("before"),b.constant("start"),b.constant("end"),b.constant("after"))},v=function(a){return a.fold(l.before,l.befor
e,l.after,l.after)},w=function(a){return a.fold(l.start,l.start,l.end,l.end)},x=function(a,b){return u(a)===u(b)&&t(a)===t(b)},y=function(a,b,c,e,f,g){return d.liftN([j.findRootInline(b,c,e),j.findRootInline(b,c,f)],function(b,d){return b!==d&&j.hasSameParentBlock(c,b,d)?l.after(a?b:d):g}).getOr(g)},z=function(a,c){return a.fold(b.constant(!0),function(a){return!x(a,c)})},A=function(a,c,d,e,g){var h=j.normalizePosition(a,g),i=f.fromPosition(a,d,h).map(b.curry(j.normalizePosition,a)),k=i.fold(function(){return e.map(v)},function(f){return s(c,d,f).map(b.curry(y,a,c,d,h,f)).filter(b.curry(z,e))});return k.filter(r)},B=function(a,d){return a?d.fold(b.compose(c.some,l.start),c.none,b.compose(c.some,l.after),c.none):d.fold(c.none,b.compose(c.some,l.before),c.none,b.compose(c.some,l.end))},C=function(a,c,d,e){var f=j.normalizePosition(a,e),g=s(c,d,f);return s(c,d,f).bind(b.curry(B,a)).orThunk(function(){return A(a,c,d,g,e)})};return{readLocation:s,findLocation:C,prevLocati
on:b.curry(C,!1),nextLocation:b.curry(C,!0),getElement:t,outside:v,inside:w}}),g("tinymce.core.keyboard.BoundarySelection",["ephox.katamari.api.Arr","ephox.katamari.api.Cell","ephox.katamari.api.Fun","tinymce.core.caret.CaretContainerRemove","tinymce.core.caret.CaretPosition","tinymce.core.keyboard.BoundaryCaret","tinymce.core.keyboard.BoundaryLocation","tinymce.core.keyboard.InlineUtils"],function(a,b,c,d,e,f,g,h){var i=function(a,b){var c=a.dom.createRng();c.setStart(b.container(),b.offset()),c.setEnd(b.container(),b.offset()),a.selection.setRng(c)},j=function(a){return a.settings.inline_boundaries!==!1},k=function(a,b){a?b.setAttribute("data-mce-selected","1"):b.removeAttribute("data-mce-selected","1")},l=function(a,b,c){return f.renderCaret(b,c).map(function(b){return i(a,b),c})},m=function(a,b,d){var f=a.getBody(),i=e.fromRangeStart(a.selection.getRn
g()),j=c.curry(h.isInlineTarget,a),k=g.findLocation(d,j,f,i);return k.bind(function(c){return l(a,b,c)})},n=function(b,d,e){var f=a.filter(d.select("*[data-mce-selected]"),b),g=a.filter(e,b);a.each(a.difference(f,g),c.curry(k,!1)),a.each(a.difference(g,f),c.curry(k,!0))},o=function(a,b){if(a.selection.isCollapsed()&&a.composing!==!0&&b.get()){var c=e.fromRangeStart(a.selection.getRng());e.isTextPosition(c)&&h.isAtZwsp(c)===!1&&(i(a,d.removeAndReposition(b.get(),c)),b.set(null))}},p=function(b,c,d,f){if(c.selection.isCollapsed()){var h=a.filter(f,b);a.each(h,function(a){var f=e.fromRangeStart(c.selection.getRng());g.readLocation(b,c.getBody(),f).bind(function(a){return l(c,d,a)})})}},q=function(a,b,c){return function(){return!!j(a)&&m(a,b,c).isSome()}},r=function(a){var d=new b(null),e=c.curry(h.isInlineTarget,a);return a.on("NodeChange",function(b){j(a)&&(n(e,a.dom,b.parents),o(a,d),p(e,a,d,b.parents))}),d};return{m
ove:q,setupSelectedState:r,setCaretPosition:i}}),g("tinymce.core.delete.InlineBoundaryDelete",["ephox.katamari.api.Fun","ephox.katamari.api.Option","ephox.katamari.api.Options","ephox.sugar.api.node.Element","tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretFinder","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretUtils","tinymce.core.delete.DeleteElement","tinymce.core.keyboard.BoundaryCaret","tinymce.core.keyboard.BoundaryLocation","tinymce.core.keyboard.BoundarySelection","tinymce.core.keyboard.InlineUtils"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n=function(a){return a.settings.inline_boundaries!==!1},o=function(a,b){var c=document.createRange();return c.setStart(a.container(),a.offset()),c.setEnd(b.container(),b.offset()),c},p=function(a){return c.liftN([f.firstPositionIn(a),f.lastPositionIn(a)],function(b,c){var d=m.no
rmalizePosition(!0,b),e=m.normalizePosition(!1,c);return f.nextPosition(a,d).map(function(a){return a.isEqual(e)}).getOr(!0)}).getOr(!0)},q=function(a,b){return function(c){return j.renderCaret(b,c).map(function(b){return l.setCaretPosition(a,b),!0}).getOr(!1)}},r=function(b,c,d,e){var f=b.getBody(),h=a.curry(m.isInlineTarget,b);b.undoManager.ignore(function(){b.selection.setRng(o(d,e)),b.execCommand("Delete"),k.readLocation(h,f,g.fromRangeStart(b.selection.getRng())).map(k.inside).map(q(b,c))}),b.nodeChanged()},s=function(a,b){var c=h.getParentBlock(b,a);return c?c:a},t=function(c,e,g,h){var j=s(c.getBody(),h.container()),l=a.curry(m.isInlineTarget,c),n=k.readLocation(l,j,h);return n.bind(function(c){return g?c.fold(a.constant(b.some(k.inside(c))),b.none,a.constant(b.some(k.outside(c))),b.none):c.fold(b.none,a.constant(b.some(k.outside(c))),b.none,a.constant(b.some(k.inside(c))))}).map(q(c,e)).getOrThunk(function(){var a=f.navigate(g,j,h),b=a.bind(function(a){return k.rea
dLocation(l,j,a)});return n.isSome()&&b.isSome()?m.findRootInline(l,j,h).map(function(a){return!!p(a)&&(i.deleteElement(c,g,d.fromDom(a)),!0)}).getOr(!1):b.bind(function(b){return a.map(function(a){return g?r(c,e,h,a):r(c,e,a,h),!0})}).getOr(!1)})},u=function(a,b,c){if(a.selection.isCollapsed()&&n(a)){var d=g.fromRangeStart(a.selection.getRng());return t(a,b,c,d)}return!1};return{backspaceDelete:u}}),g("tinymce.core.delete.TableDeleteAction",["ephox.katamari.api.Adt","ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.katamari.api.Option","ephox.katamari.api.Options","ephox.katamari.api.Struct","ephox.sugar.api.dom.Compare","ephox.sugar.api.node.Element","ephox.sugar.api.search.SelectorFilter","ephox.sugar.api.search.SelectorFind"],function(a,b,c,d,e,f,g,h,i,j){var k=f.immutable("start","end"),l=f.immutable("rng",&qu
ot;table","cells"),m=a.generate([{removeTable:["element"]},{emptyCells:["cells"]}]),n=function(a,b){return j.closest(h.fromDom(a),"td,th",b)},o=function(a,b){return j.ancestor(a,"table",b)},p=function(a){return g.eq(a.start(),a.end())===!1},q=function(a,b){return o(a.start(),b).bind(function(c){return o(a.end(),b).bind(function(a){return g.eq(c,a)?d.some(c):d.none()})})},r=function(a,b){return e.liftN([n(a.startContainer,b),n(a.endContainer,b)],k).filter(p)},s=function(a,b){return q(a,b).bind(function(b){var c=i.descendants(b,"td,th");return l(a,b,c)})},t=function(a,b){var d=c.curry(g.eq,a);return r(b,d).map(function(a){return s(a,d)})},u=function(a,c){return b.findIndex(a,function(a){return g.eq(a,c)})},v=function(a){return e.liftN([u(a.cells(),a.rng().start()),u(a.cells(),a.rng().end())],function(b,c){return a.cells().slice(b,c+1)})},w=function(a){return v(a).bind(function(b){var c=a.cells();return b.length===c.lengt
h?m.removeTable(a.table()):m.emptyCells(b)})},x=function(a){return m.emptyCells(a)},y=function(a,b){return t(a,b).map(w)};return{getActionFromRange:y,getActionFromCells:x}}),g("tinymce.core.delete.TableDelete",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.sugar.api.node.Element","tinymce.core.delete.DeleteElement","tinymce.core.delete.TableDeleteAction","tinymce.core.dom.PaddingBr","tinymce.core.selection.TableCellSelection"],function(a,b,c,d,e,f,g){var h=function(b,c){return a.each(c,f.fillWithPaddingBr),b.selection.setCursorLocation(c[0].dom(),0),!0},i=function(a,b){return d.deleteElement(a,!1,b),!0},j=function(a,c,d){return e.getActionFromRange(c,d).map(function(c){return c.fold(b.curry(i,a),b.curry(h,a))}).getOr(!1)},k=function(a){
-var b=c.fromDom(a.getBody()),d=a.selection.getRng(),e=g.getCellsFromEditor(a);return 0!==e.length?h(a,e):j(a,b,d)},l=function(a){return!a.selection.isCollapsed()&&k(a)};return{backspaceDelete:l}}),g("tinymce.core.delete.DeleteCommands",["tinymce.core.delete.BlockBoundaryDelete","tinymce.core.delete.BlockRangeDelete","tinymce.core.delete.CefDelete","tinymce.core.delete.DeleteUtils","tinymce.core.delete.InlineBoundaryDelete","tinymce.core.delete.TableDelete"],function(a,b,c,d,e,f){var g=function(a,b){a.getDoc().execCommand(b,!1,null)},h=function(h){c.backspaceDelete(h,!1)||e.backspaceDelete(h,!1)||a.backspaceDelete(h,!1)||f.backspaceDelete(h)||b.backspaceDelete(h,!1)||(g(h,"Delete"),d.paddEmptyBody(h))},i=function(d){c.backspaceDelete(d,!0)||e.backspaceDelete(d,!0)||a.backspaceDelete(d,!0)||f.backspaceDelete(d)||b.backspaceDelete(d,!0)||g(d,"ForwardDelete")};return{deleteCommand:h,forward
DeleteCommand:i}}),g("tinymce.core.InsertList",["tinymce.core.util.Tools","tinymce.core.caret.CaretWalker","tinymce.core.caret.CaretPosition"],function(a,b,c){var d=function(a){return a.firstChild&&a.firstChild===a.lastChild},e=function(a){return"br"===a.name||"\xa0"===a.value},f=function(a,b){var c=a.getBlockElements();return c[b.name]&&d(b)&&e(b.firstChild)},g=function(a,b){var c=a.getNonEmptyElements();return b&&(b.isEmpty(c)||f(a,b))},h=function(a,b){var c=b.firstChild,d=b.lastChild;return c&&"meta"===c.name&&(c=c.next),d&&"mce_marker"===d.attr("id")&&(d=d.prev),g(a,d)&&(d=d.prev),!(!c||c!==d)&&("ul"===c.name||"ol"===c.name)},i=function(a){var b=a.firstChild,c=a.lastChild;return b&&"META"===b.nodeName&&b.parentNode.removeChild(b),c&&"mce_marker"===c
.id&&c.parentNode.removeChild(c),a},j=function(a,b,c){var d=b.serialize(c),e=a.createFragment(d);return i(e)},k=function(b){return a.grep(b.childNodes,function(a){return"LI"===a.nodeName})},l=function(a){return!a.firstChild},m=function(a){return a.length>0&&l(a[a.length-1])?a.slice(0,-1):a},n=function(a,b){var c=a.getParent(b,a.isBlock);return c&&"LI"===c.nodeName?c:null},o=function(a,b){return!!n(a,b)},p=function(a,b){var c=b.cloneRange(),d=b.cloneRange();return c.setStartBefore(a),d.setEndAfter(a),[c.cloneContents(),d.cloneContents()]},q=function(a,d){var e=c.before(a),f=new b(d),g=f.next(e);return g?g.toRange():null},r=function(a,d){var e=c.after(a),f=new b(d),g=f.prev(e);return g?g.toRange():null},s=function(b,c,d,e){var f=p(b,e),g=b.parentNode;return g.insertBefore(f[0],b),a.each(c,function(a){g.insertBefore(a,b)}),g.insertBefore(f[1],b),g.removeChild(b),r(c[c.length-1],d)},t=function(b,c,d){var e=b.parentNode;return a.each(c,funct
ion(a){e.insertBefore(a,b)}),q(b,d)},u=function(a,b,c,d){return d.insertAfter(b.reverse(),a),r(b[0],c)},v=function(a,d,e,f){var g=j(d,a,f),h=n(d,e.startContainer),i=m(k(g.firstChild)),l=1,o=2,p=d.getRoot(),q=function(a){var f=c.fromRangeStart(e),g=new b(d.getRoot()),i=a===l?g.prev(f):g.next(f);return!i||n(d,i.getNode())!==h};return q(l)?t(h,i,p):q(o)?u(h,i,p,d):s(h,i,p,e)};return{isListFragment:h,insertAtCaret:v,isParentBlockLi:o,trimListItems:m,listItems:k}}),g("tinymce.core.InsertContent",["ephox.katamari.api.Option","ephox.sugar.api.node.Element","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretWalker","tinymce.core.dom.ElementUtils","tinymce.core.dom.NodeType","tinymce.core.dom.PaddingBr","tinymce.core.dom.RangeNormalizer","tinymce.core.Env","tinymce.core.html.Serializer","tinymce.core.InsertList","tinymce.core.util.Tools"],function(a,b,c,d
,e,f,g,h,i,j,k,l){var m=f.matchNodeNames("td th"),n=function(a,b,c){if("all"===c.getAttribute("data-mce-bogus"))c.parentNode.insertBefore(a.dom.createFragment(b),c);else{var d=c.firstChild,e=c.lastChild;!d||d===e&&"BR"===d.nodeName?a.dom.setHTML(c,b):a.selection.setContent(b)}},o=function(c,d){a.from(c.getParent(d,"td,th")).map(b.fromDom).each(g.trimBlockTrailingBr)},p=function(a,b,f){function g(a){function b(a){return d[a]&&3==d[a].nodeType}var c,d,e;return c=J.getRng(!0),d=c.startContainer,e=c.startOffset,3==d.nodeType&&(e>0?a=a.replace(/^ /," "):b("previousSibling")||(a=a.replace(/^ /," ")),e<d.length?a=a.replace(/ (<br>|)$/," "):b("nextSibling")||(a=a.replace(/( | )(<br>|)$/," "))),a}function p(){var a,c,d;a=J.getRng(!0),c=a.startContainer,d=a.startOffset,3==c.nodeType&&a.colla
psed&&("\xa0"===c.data[d]?(c.deleteData(d,1),/[\u00a0| ]$/.test(b)||(b+=" ")):"\xa0"===c.data[d-1]&&(c.deleteData(d-1,1),/[\u00a0| ]$/.test(b)||(b=" "+b)))}function q(){if(H){var b=a.getBody(),c=new e(K);l.each(K.select("*[data-mce-fragment]"),function(a){for(var d=a.parentNode;d&&d!=b;d=d.parentNode)I[a.nodeName.toLowerCase()]&&c.compare(d,a)&&K.remove(a,!0)})}}function r(a){for(var b=a;b=b.walk();)1===b.type&&b.attr("data-mce-fragment","1")}function s(a){l.each(a.getElementsByTagName("*"),function(a){a.removeAttribute("data-mce-fragment")})}function t(a){return!!a.getAttribute("data-mce-fragment")}function u(b){return b&&!a.schema.getShortEndedElements()[b.nodeName]}function v(b){function e(b){for(var c=a.getBody();b&&b!==c;b=b.parentNode)if("false"===a.dom.getContentEditable(b))return b;return null}function f
(b){var e=c.fromRangeStart(b),f=new d(a.getBody());if(e=f.next(e))return e.toRange()}var g,h,j;if(b){if(J.scrollIntoView(b),g=e(b))return K.remove(b),void J.select(g);D=K.createRng(),E=b.previousSibling,E&&3==E.nodeType?(D.setStart(E,E.nodeValue.length),i.ie||(F=b.nextSibling,F&&3==F.nodeType&&(E.appendData(F.data),F.parentNode.removeChild(F)))):(D.setStartBefore(b),D.setEndBefore(b)),h=K.getParent(b,K.isBlock),K.remove(b),h&&K.isEmpty(h)&&(a.$(h).empty(),D.setStart(h,0),D.setEnd(h,0),m(h)||t(h)||!(j=f(D))?K.add(h,K.create("br",{"data-mce-bogus":"1"})):(D=j,K.remove(h))),J.setRng(D)}}var w,x,y,z,A,B,C,D,E,F,G,H,I=a.schema.getTextInlineElements(),J=a.selection,K=a.dom;/^ | $/.test(b)&&(b=g(b)),w=a.parser,H=f.merge,x=new j({validate:a.settings.validate},a.schema),G='<span id="mce_marker" data-mce-type="bookmark">​</span>',B={content:b,format:"html&q
uot;,selection:!0},a.fire("BeforeSetContent",B),b=B.content,b.indexOf("{$caret}")==-1&&(b+="{$caret}"),b=b.replace(/\{\$caret\}/,G),D=J.getRng();var L=D.startContainer||(D.parentElement?D.parentElement():null),M=a.getBody();L===M&&J.isCollapsed()&&K.isBlock(M.firstChild)&&u(M.firstChild)&&K.isEmpty(M.firstChild)&&(D=K.createRng(),D.setStart(M.firstChild,0),D.setEnd(M.firstChild,0),J.setRng(D)),J.isCollapsed()||(a.selection.setRng(h.normalize(a.selection.getRng())),a.getDoc().execCommand("Delete",!1,null),p()),y=J.getNode();var N={context:y.nodeName.toLowerCase(),data:f.data};if(A=w.parse(b,N),f.paste===!0&&k.isListFragment(a.schema,A)&&k.isParentBlockLi(K,y))return D=k.insertAtCaret(x,K,a.selection.getRng(!0),A),a.selection.setRng(D),void a.fire("SetContent",B);if(r(A),E=A.lastChild,"mce_marker"==E.attr("id"))for(C=E,E=E.prev;E;E=E.walk(!0))if(3==E.ty
pe||!K.isBlock(E.name)){a.schema.isValidChild(E.parent.name,"span")&&E.parent.insert(C,E,"br"===E.name);break}if(a._selectionOverrides.showBlockCaretContainer(y),N.invalid){for(J.setContent(G),y=J.getNode(),z=a.getBody(),9==y.nodeType?y=E=z:E=y;E!==z;)y=E,E=E.parentNode;b=y==z?z.innerHTML:K.getOuterHTML(y),b=x.serialize(w.parse(b.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i,function(){return x.serialize(A)}))),y==z?K.setHTML(z,b):K.setOuterHTML(y,b)}else b=x.serialize(A),n(a,b,y);q(),v(K.get("mce_marker")),s(a.getBody()),o(a.dom,a.selection.getStart()),a.fire("SetContent",B),a.addVisual()},q=function(a){var b;return"string"!=typeof a?(b=l.extend({paste:a.paste,data:{paste:a.paste}},a),{content:a.content,details:b}):{content:a,details:{}}},r=function(a,b){var c=q(b);p(a,c.content,c.details)};return{insertAtCaret:r}}),g("tinymce.core.EditorCommands",["tinymce.core.delete.DeleteCo
mmands","tinymce.core.dom.NodeType","tinymce.core.dom.RangeUtils","tinymce.core.dom.TreeWalker","tinymce.core.Env","tinymce.core.InsertContent","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g){var h=g.each,i=g.extend,j=g.map,k=g.inArray,l=g.explode,m=e.ie&&e.ie<11,n=!0,o=!1;return function(g){function p(a,b,c,d){var e,f,i=0;if(!g.removed){if(/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(a)||d&&d.skip_focus||g.focus(),d=g.fire("BeforeExecCommand",{command:a,ui:b,value:c}),d.isDefaultPrevented())return!1;if(f=a.toLowerCase(),e=H.exec[f])return e(f,b,c),g.fire("ExecCommand",{command:a,ui:b,value:c}),!0;if(h(g.plugins,function(d){if(d.execCommand&&d.execCommand(a,b,c))return g.fire("ExecCommand",{command:a,ui:b,value:c}),i=!0,!1}),i)return i;if(g.theme&&g.theme.execCommand&&g.theme.execCommand(a,b,c))return g.fire("Exe
cCommand",{command:a,ui:b,value:c}),!0;try{i=g.getDoc().execCommand(a,b,c)}catch(j){}return!!i&&(g.fire("ExecCommand",{command:a,ui:b,value:c}),!0)}}function q(a){var b;if(!g.quirks.isHidden()&&!g.removed){if(a=a.toLowerCase(),b=H.state[a])return b(a);try{return g.getDoc().queryCommandState(a)}catch(c){}return!1}}function r(a){var b;if(!g.quirks.isHidden()&&!g.removed){if(a=a.toLowerCase(),b=H.value[a])return b(a);try{return g.getDoc().queryCommandValue(a)}catch(c){}}}function s(a,b){b=b||"exec",h(a,function(a,c){h(c.toLowerCase().split(","),function(c){H[b][c]=a})})}function t(a,b,c){a=a.toLowerCase(),H.exec[a]=function(a,d,e,f){return b.call(c||g,d,e,f)}}function u(a){if(a=a.toLowerCase(),H.exec[a])return!0;try{return g.getDoc().queryCommandSupported(a)}catch(b){}return!1}function v(a,b,c){a=a.toLowerCase(),H.state[a]=function(){return b.call(c||g)}}function w(a,b,c){a=a.toLowerCase(),H.value[a]=function(){return b.call(c|
|g)}}function x(a){return a=a.toLowerCase(),!!H.exec[a]}function y(a,b,c){return void 0===b&&(b=o),void 0===c&&(c=null),g.getDoc().execCommand(a,b,c)}function z(a){return F.match(a)}function A(a,b){F.toggle(a,b?{value:b}:void 0),g.nodeChanged()}function B(a){G=E.getBookmark(a)}function C(){E.moveToBookmark(G)}var D,E,F,G,H={state:{},exec:{},value:{}},I=g.settings;g.on("PreInit",function(){D=g.dom,E=g.selection,I=g.settings,F=g.formatter}),i(this,{execCommand:p,queryCommandState:q,queryCommandValue:r,queryCommandSupported:u,addCommands:s,addCommand:t,addQueryStateHandler:v,addQueryValueHandler:w,hasCustomCommand:x}),s({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){g.undoManager.add()},"Cut,Copy,Paste":function(a){var b,c=g.getDoc();try{y(a)}catch(d){b=n}if("paste"!==a||c.queryCommandEnabled(a)||(b=!0),b||!c.queryCommandSupported(a)){var f=g.translate("Your browser
doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");e.mac&&(f=f.replace(/Ctrl\+/g,"\u2318+")),g.notificationManager.open({text:f,type:"error"})}},unlink:function(){if(E.isCollapsed()){var a=g.dom.getParent(g.selection.getStart(),"a");return void(a&&g.dom.remove(a,!0))}F.remove("link")},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone":function(a){var b=a.substring(7);"full"==b&&(b="justify"),h("left,center,right,justify".split(","),function(a){b!=a&&F.remove("align"+a)}),"none"!=b&&A("align"+b)},"InsertUnorderedList,InsertOrderedList":function(a){var b,c;y(a),b=D.getParent(E.getNode(),"ol,ul"),b&&(c=b.parentNode,/^(H[1-6]|P|ADDRESS|PRE)$/.test(c.nodeName)&&(B(),D.split(c,b),C()))},"Bold,Italic,Underline,Strikethro
ugh,Superscript,Subscript":function(a){A(a)},"ForeColor,HiliteColor,FontName":function(a,b,c){A(a,c)},FontSize:function(a,b,c){var d,e;c>=1&&c<=7&&(e=l(I.font_size_style_values),d=l(I.font_size_classes),c=d?d[c-1]||c:e[c-1]||c),A(a,c)},RemoveFormat:function(a){F.remove(a)},mceBlockQuote:function(){A("blockquote")},FormatBlock:function(a,b,c){return A(c||"p")},mceCleanup:function(){var a=E.getBookmark();g.setContent(g.getContent({cleanup:n}),{cleanup:n}),E.moveToBookmark(a)},mceRemoveNode:function(a,b,c){var d=c||E.getNode();d!=g.getBody()&&(B(),g.dom.remove(d,n),C())},mceSelectNodeDepth:function(a,b,c){var d=0;D.getParent(E.getNode(),function(a){if(1==a.nodeType&&d++==c)return E.select(a),o},g.getBody())},mceSelectNode:function(a,b,c){E.select(c)},mceInsertContent:function(a,b,c){f.insertAtCaret(g,c)},mceInsertRawHTML:function(a,b,c){E.setContent("tiny_mce_marker"),g.setContent(g.getContent().replace(
/tiny_mce_marker/g,function(){return c}))},mceToggleFormat:function(a,b,c){A(c)},mceSetContent:function(a,b,c){g.setContent(c)},"Indent,Outdent":function(a){var b,c,d;b=I.indentation,c=/[a-z%]+$/i.exec(b),b=parseInt(b,10),q("InsertUnorderedList")||q("InsertOrderedList")?y(a):(I.forced_root_block||D.getParent(E.getNode(),D.isBlock)||F.apply("div"),h(E.getSelectedBlocks(),function(e){if("false"!==D.getContentEditable(e)&&"LI"!==e.nodeName){var f=g.getParam("indent_use_margin",!1)?"margin":"padding";f="TABLE"===e.nodeName?"margin":f,f+="rtl"==D.getStyle(e,"direction",!0)?"Right":"Left","outdent"==a?(d=Math.max(0,parseInt(e.style[f]||0,10)-b),D.setStyle(e,f,d?d+c:"")):(d=parseInt(e.style[f]||0,10)+b+c,D.setStyle(e,f,d))}}))},mceRepaint:function(){},InsertHorizontalRule:function(){g.execCommand("mceInsertCon
tent",!1,"<hr />")},mceToggleVisualAid:function(){g.hasVisual=!g.hasVisual,g.addVisual()},mceReplaceContent:function(a,b,c){g.execCommand("mceInsertContent",!1,c.replace(/\{\$selection\}/g,E.getContent({format:"text"})))},mceInsertLink:function(a,b,c){var d;"string"==typeof c&&(c={href:c}),d=D.getParent(E.getNode(),"a"),c.href=c.href.replace(" ","%20"),d&&c.href||F.remove("link"),c.href&&F.apply("link",c,d)},selectAll:function(){var a,c=D.getRoot();if(E.getRng().setStart){var d=D.getParent(E.getStart(),b.isContentEditableTrue);d&&(a=D.createRng(),a.selectNodeContents(d),E.setRng(a))}else a=E.getRng(),a.item||(a.moveToElementText(c),a.select())},"delete":function(){a.deleteCommand(g)},forwardDelete:function(){a.forwardDeleteCommand(g)},mceNewDocument:function(){g.setContent("")},InsertLineBreak:function(a,b,e){function f(){for(var a,
b=new d(p,r),c=g.schema.getNonEmptyElements();a=b.next();)if(c[a.nodeName.toLowerCase()]||a.length>0)return!0}var h,i,j,k=e,l=E.getRng(!0);new c(D).normalize(l);var o=l.startOffset,p=l.startContainer;if(1==p.nodeType&&p.hasChildNodes()){var q=o>p.childNodes.length-1;p=p.childNodes[Math.min(o,p.childNodes.length-1)]||p,o=q&&3==p.nodeType?p.nodeValue.length:0}var r=D.getParent(p,D.isBlock),s=r?r.nodeName.toUpperCase():"",t=r?D.getParent(r.parentNode,D.isBlock):null,u=t?t.nodeName.toUpperCase():"",v=k&&k.ctrlKey;"LI"!=u||v||(r=t,s=u),p&&3==p.nodeType&&o>=p.nodeValue.length&&(m||f()||(h=D.create("br"),l.insertNode(h),l.setStartAfter(h),l.setEndAfter(h),i=!0)),h=D.create("br"),l.insertNode(h);var w=D.doc.documentMode;return m&&"PRE"==s&&(!w||w<8)&&h.parentNode.insertBefore(D.doc.createTextNode("\r"),h),j=D.create("span",{},&qu
ot; "),h.parentNode.insertBefore(j,h),E.scrollIntoView(j),D.remove(j),i?(l.setStartBefore(h),l.setEndBefore(h)):(l.setStartAfter(h),l.setEndAfter(h)),E.setRng(l),g.undoManager.add(),n}}),s({"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull":function(a){var b="align"+a.substring(7),c=E.isCollapsed()?[D.getParent(E.getNode(),D.isBlock)]:E.getSelectedBlocks(),d=j(c,function(a){return!!F.matchNode(a,b)});return k(d,n)!==-1},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(a){return z(a)},mceBlockQuote:function(){return z("blockquote")},Outdent:function(){var a;if(I.inline_styles){if((a=D.getParent(E.getStart(),D.isBlock))&&parseInt(a.style.paddingLeft,10)>0)return n;if((a=D.getParent(E.getEnd(),D.isBlock))&&parseInt(a.style.paddingLeft,10)>0)return n}return q("InsertUnorderedList")||q("InsertOrderedList")||!I.inline_styles&&!!D.getParent(E.getNode(),"BLOCKQU
OTE")},"InsertUnorderedList,InsertOrderedList":function(a){var b=D.getParent(E.getNode(),"ul,ol");return b&&("insertunorderedlist"===a&&"UL"===b.tagName||"insertorderedlist"===a&&"OL"===b.tagName)}},"state"),s({"FontSize,FontName":function(a){var b,c=0;return(b=D.getParent(E.getNode(),"span"))&&(c="fontsize"==a?b.style.fontSize:b.style.fontFamily.replace(/, /g,",").replace(/[\'\"]/g,"").toLowerCase()),c}},"value"),s({Undo:function(){g.undoManager.undo()},Redo:function(){g.undoManager.redo()}})}}),g("tinymce.core.EditorFocus",["ephox.katamari.api.Option","ephox.sugar.api.dom.Compare","ephox.sugar.api.node.Element","tinymce.core.caret.CaretFinder","tinymce.core.dom.ElementType","tinymce.core.dom.RangeUtils","tinymce.core.Env"],function(a
,b,c,d,e,f,g){var h=function(a,b){return a.dom.getParent(b,function(b){return"true"===a.dom.getContentEditable(b)})},i=function(b){return b.collapsed?a.from(f.getNode(b.startContainer,b.startOffset)).map(c.fromDom):a.none()},j=function(c,d){return i(d).bind(function(d){return e.isTableSection(d)?a.some(d):b.contains(c,d)===!1?a.some(c):a.none()})},k=function(a,b){j(c.fromDom(a.getBody()),b).bind(function(a){return d.firstPositionIn(a.dom())}).fold(function(){a.selection.normalize()},function(b){a.selection.setRng(b.toRange())})},l=function(a){if(a.setActive)try{a.setActive()}catch(b){a.focus()}else a.focus()},m=function(a){var b,c,d,e=a.selection,f=a.settings.content_editable,i=a.getDoc(),j=a.getBody();return b=e.getRng(),b.item&&(c=b.item(0)),a.quirks.refreshContentEditable(),d=h(a,e.getNode()),a.$.contains(j,d)?(l(d),k(a,b),void n(a)):(f||(g.opera||l(j),a.getWin().focus()),(g.gecko||f)&&(f&&document.activeElement!==j&&a.selection.setRng(a.
lastRng),l(j),k(a,b)),c&&c.ownerDocument===i&&(b=i.body.createControlRange(),b.addElement(c),b.select()),void n(a))},n=function(a){a.editorManager.setActive(a)},o=function(a,b){a.removed||(b?n(a):m(a))};return{focus:o}}),g("tinymce.core.EditorObservable",["tinymce.core.util.Observable","tinymce.core.dom.DOMUtils","tinymce.core.util.Tools"],function(a,b,c){function d(a,b){return"selectionchange"==b?a.getDoc():!a.inline&&/^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(b)?a.getDoc().documentElement:a.settings.event_root?(a.eventRoot||(a.eventRoot=g.select(a.settings.event_root)[0]),a.eventRoot):a.getBody()}function e(a,b){function c(a){return!a.hidden&&!a.readonly}var e,h;if(a.delegates||(a.delegates={}),!a.delegates[b]&&!a.removed)if(e=d(a,b),a.settings.event_root){if(f||(f={},a.editorManager.on("removeEditor",function(){var b;if(!a.editorManager.activeEditor&&f){for
(b in f)a.dom.unbind(d(a,b));f=null}})),f[b])return;h=function(d){for(var e=d.target,f=a.editorManager.get(),h=f.length;h--;){var i=f[h].getBody();(i===e||g.isChildOf(e,i))&&c(f[h])&&f[h].fire(b,d)}},f[b]=h,g.bind(e,b,h)}else h=function(d){c(a)&&a.fire(b,d)},g.bind(e,b,h),a.delegates[b]=h}var f,g=b.DOM,h={bindPendingEventDelegates:function(){var a=this;c.each(a._pendingNativeEvents,function(b){e(a,b)})},toggleNativeEvent:function(a,b){var c=this;"focus"!=a&&"blur"!=a&&(b?c.initialized?e(c,a):c._pendingNativeEvents?c._pendingNativeEvents.push(a):c._pendingNativeEvents=[a]:c.initialized&&(c.dom.unbind(d(c,a),a,c.delegates[a]),delete c.delegates[a]))},unbindAllNativeEvents:function(){var a,b=this;if(b.delegates){for(a in b.delegates)b.dom.unbind(d(b,a),a,b.delegates[a]);delete b.delegates}b.inline||(b.getBody().onload=null,b.dom.unbind(b.getWin()),b.dom.unbind(b.getDoc())),b.dom.unbind(b.getBody()),b.dom.unbind(b.getCo
ntainer())}};return h=c.extend({},a,h)}),g("tinymce.core.ErrorReporter",["tinymce.core.AddOnManager"],function(a){var b=a.PluginManager,c=function(a,c){for(var d in b.urls){var e=b.urls[d]+"/plugin"+c+".js";if(e===a)return d}return null},d=function(a,b){var d=c(b,a.suffix);return d?"Failed to load plugin: "+d+" from url "+b:"Failed to load plugin url: "+b},e=function(a,b){a.notificationManager.open({type:"error",text:b})},f=function(a,b){a._skinLoaded?e(a,b):a.on("SkinLoaded",function(){e(a,b)})},g=function(a,b){f(a,"Failed to upload image: "+b)},h=function(a,b){f(a,d(a,b))},i=function(a){var b=window.console;b&&!window.test&&(b.error?b.error.apply(b,arguments):b.log.apply(b,arguments))};return{pluginLoadError:h,uploadError:g,displayError:f,initError:i}}),g("tinymce.core.caret.CaretContainerInput",["ephox.katamari.api.Fun","ephox.sugar.api.node
.Element","ephox.sugar.api.search.SelectorFind","tinymce.core.caret.CaretContainer"],function(a,b,c,d){var e=function(d){return c.descendant(b.fromDom(d.getBody()),"*[data-mce-caret]").fold(a.constant(null),function(a){return a.dom()})},f=function(a){a.selection.setRng(a.selection.getRng())},g=function(a,b){b.hasAttribute("data-mce-caret")&&(d.showCaretContainerBlock(b),f(a),a.selection.scrollIntoView(b))},h=function(a,b){var c=e(a);if(c)return"compositionstart"===b.type?(b.preventDefault(),b.stopPropagation(),void g(c)):void(d.hasContent(c)&&g(a,c))},i=function(b){b.on("keyup compositionstart",a.curry(h,b))};return{setup:i}}),g("tinymce.core.file.Uploader",["tinymce.core.util.Promise","tinymce.core.util.Tools","tinymce.core.util.Fun"],function(a,b,c){return function(c,d){function e(a,b){return a?a.replace(/\/$/,"")+"/"+b.replace(/^\//,"&q
uot;):b}function f(a,b,c,f){var g,h;g=new XMLHttpRequest,g.open("POST",d.url),g.withCredentials=d.credentials,g.upload.onprogress=function(a){f(a.loaded/a.total*100)},g.onerror=function(){c("Image upload failed due to a XHR Transport error. Code: "+g.status)},g.onload=function(){var a;return g.status<200||g.status>=300?void c("HTTP Error: "+g.status):(a=JSON.parse(g.responseText),a&&"string"==typeof a.location?void b(e(d.basePath,a.location)):void c("Invalid JSON: "+g.responseText))},h=new FormData,h.append("file",a.blob(),a.filename()),g.send(h)}function g(){return new a(function(a){a([])})}function h(a,b){return{url:b,blobInfo:a,status:!0}}function i(a,b){return{url:"",blobInfo:a,status:!1,error:b}}function j(a,c){b.each(p[a],function(a){a(c)}),delete p[a]}function k(b,d,e){return c.markPending(b.blobUri()),new a(function(a){var f,g,k=function(){};try{var l=function(){f&&(f.close(),g=k)},m=
function(d){l(),c.markUploaded(b.blobUri(),d),j(b.blobUri(),h(b,d)),a(h(b,d))},n=function(d){l(),c.removeFailed(b.blobUri()),j(b.blobUri(),i(b,d)),a(i(b,d))};g=function(a){a<0||a>100||(f||(f=e()),f.progressBar.value(a))},d(b,m,n,g)}catch(o){a(i(b,o.message))}})}function l(a){return a===f}function m(b){var c=b.blobUri();return new a(function(a){p[c]=p[c]||[],p[c].push(a)})}function n(e,f){return e=b.grep(e,function(a){return!c.isUploaded(a.blobUri())}),a.all(b.map(e,function(a){return c.isPending(a.blobUri())?m(a):k(a,d.handler,f)}))}function o(a,b){return!d.url&&l(d.handler)?g():n(a,b)}var p={};return d=b.extend({credentials:!1,handler:f},d),{upload:o}}}),g("ephox.sand.api.Window",["ephox.sand.util.Global"],function(a){var b=function(b){var c=a.getOrDie("requestAnimationFrame");c(b)},c=function(b){var c=a.getOrDie("atob");return c(b)};return{atob:c,requestAnimationFrame:b}}),g("tinymce.core.file.Conversions",["epho
x.sand.api.Window","tinymce.core.util.Promise"],function(a,b){function c(a){return new b(function(b,c){var d=function(){c("Cannot convert "+a+" to Blob. Resource might not exist or is inaccessible.")};try{var e=new XMLHttpRequest;e.open("GET",a,!0),e.responseType="blob",e.onload=function(){200==this.status?b(this.response):d()},e.onerror=d,e.send()}catch(f){d()}})}function d(a){var b,c;return a=decodeURIComponent(a).split(","),c=/data:([^;]+)/.exec(a[0]),c&&(b=c[1]),{type:b,data:a[1]}}function e(c){return new b(function(b){var e,f,g;c=d(c);try{e=a.atob(c.data)}catch(h){return void b(new Blob([]))}for(f=new Uint8Array(e.length),g=0;g<f.length;g++)f[g]=e.charCodeAt(g);b(new Blob([f],{type:c.type}))})}function f(a){return 0===a.indexOf("blob:")?c(a):0===a.indexOf("data:")?e(a):null}function g(a){return new b(function(b){var c=new FileReader;c.onloadend=function(){b(c.result)},c.readAsDataURL
(a)})}return{uriToBlob:f,blobToDataUri:g,parseDataUri:d}});g("tinymce.core.file.ImageScanner",["tinymce.core.util.Promise","tinymce.core.util.Arr","tinymce.core.util.Fun","tinymce.core.file.Conversions","tinymce.core.Env"],function(a,b,c,d,e){var f=0,g=function(a){return(a||"blobid")+f++},h=function(a,b,c,e){var f,h;return 0===b.src.indexOf("blob:")?(h=a.getByUri(b.src),void(h?c({image:b,blobInfo:h}):d.uriToBlob(b.src).then(function(e){d.blobToDataUri(e).then(function(i){f=d.parseDataUri(i).data,h=a.create(g(),e,f),a.add(h),c({image:b,blobInfo:h})})},function(a){e(a)}))):(f=d.parseDataUri(b.src).data,h=a.findFirst(function(a){return a.base64()===f}),void(h?c({image:b,blobInfo:h}):d.uriToBlob(b.src).then(function(d){h=a.create(g(),d,f),a.add(h),c({image:b,blobInfo:h})},function(a){e(a)})))},i=function(a){return a?a.getElementsByTagName("img"):[]};return function(d,f){function g(g,k){var l,m;retu
rn k||(k=c.constant(!0)),l=b.filter(i(g),function(a){var b=a.src;return!!e.fileApi&&(!a.hasAttribute("data-mce-bogus")&&(!a.hasAttribute("data-mce-placeholder")&&(!(!b||b==e.transparentSrc)&&(0===b.indexOf("blob:")?!d.isUploaded(b):0===b.indexOf("data:")&&k(a)))))}),m=b.map(l,function(b){var c;return j[b.src]?new a(function(a){j[b.src].then(function(c){return"string"==typeof c?c:void a({image:b,blobInfo:c.blobInfo})})}):(c=new a(function(a,c){h(f,b,a,c)}).then(function(a){return delete j[a.image.src],a})["catch"](function(a){return delete j[b.src],a}),j[b.src]=c,c)}),a.all(m)}var j={};return{findAll:g}}});g("ephox.sand.api.URL",["ephox.sand.util.Global"],function(a){var b=function(){return a.getOrDie("URL")},c=function(a){return b().createObjectURL(a)},d=function(a){b().revokeObjectURL(a)};return{createObjectURL:c,revokeObjectURL:d}}),g("tinymce.core
.util.Uuid",[],function(){var a=0,b=function(){var a=function(){return Math.round(4294967295*Math.random()).toString(36)},b=(new Date).getTime();return"s"+b.toString(36)+a()+a()+a()},c=function(c){return c+a++ +b()};return{uuid:c}}),g("tinymce.core.file.BlobCache",["ephox.sand.api.URL","tinymce.core.util.Arr","tinymce.core.util.Fun","tinymce.core.util.Uuid"],function(a,b,c,d){return function(){function e(a){var b={"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png"};return b[a.toLowerCase()]||"dat"}function f(a,b,c,d){return g("object"==typeof a?a:{id:a,name:d,blob:b,base64:c})}function g(b){var c,f;if(!b.blob||!b.base64)throw"blob and base64 representations of the image are required for BlobInfo to be created";return c=b.id||d.uuid("blobid"),f=b.name||c,{id:o(c),name:o(f),filenam
e:o(f+"."+e(b.blob.type)),blob:o(b.blob),base64:o(b.base64),blobUri:o(b.blobUri||a.createObjectURL(b.blob)),uri:o(b.uri)}}function h(a){i(a.id())||n.push(a)}function i(a){return j(function(b){return b.id()===a})}function j(a){return b.filter(n,a)[0]}function k(a){return j(function(b){return b.blobUri()==a})}function l(c){n=b.filter(n,function(b){return b.blobUri()!==c||(a.revokeObjectURL(b.blobUri()),!1)})}function m(){b.each(n,function(b){a.revokeObjectURL(b.blobUri())}),n=[]}var n=[],o=c.constant;return{create:f,add:h,get:i,getByUri:k,findFirst:j,removeByUri:l,destroy:m}}}),g("tinymce.core.file.UploadStatus",[],function(){return function(){function a(a,b){return{status:a,resultUri:b}}function b(a){return a in l}function c(a){var b=l[a];return b?b.resultUri:null}function d(a){return!!b(a)&&l[a].status===j}function e(a){return!!b(a)&&l[a].status===k}function f(b){l[b]=a(j,null)}function g(b,c){l[b]=a(k,c)}function h(a){delete l[a]}function i(){l={
}}var j=1,k=2,l={};return{hasBlobUri:b,getResultUri:c,isPending:d,isUploaded:e,markPending:f,markUploaded:g,removeFailed:h,destroy:i}}}),g("tinymce.core.EditorUpload",["tinymce.core.util.Arr","tinymce.core.file.Uploader","tinymce.core.file.ImageScanner","tinymce.core.file.BlobCache","tinymce.core.file.UploadStatus","tinymce.core.ErrorReporter"],function(a,b,c,d,e,f){return function(g){function h(a){return function(b){return g.selection?a(b):[]}}function i(){return"?"+(new Date).getTime()}function j(a,b,c){var d=0;do d=a.indexOf(b,d),d!==-1&&(a=a.substring(0,d)+c+a.substr(d+b.length),d+=c.length-b.length+1);while(d!==-1);return a}function k(a,b,c){return a=j(a,'src="'+b+'"','src="'+c+'"'),a=j(a,'data-mce-src="'+b+'"','data-mce-src="'+c+'"')}function l(b,c){a.each(g.undoManager.data,function(d){"fragmented"===d.type?d.fragments=a.map(d.fragments,fun
ction(a){return k(a,b,c)}):d.content=k(d.content,b,c)})}function m(){return g.notificationManager.open({text:g.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0})}function n(a,b){w.removeByUri(a.src),l(a.src,b),g.$(a).attr({src:x.images_reuse_filename?b+i():b,"data-mce-src":g.convertURL(b,"src")})}function o(c){return u||(u=new b(y,{url:x.images_upload_url,basePath:x.images_upload_base_path,credentials:x.images_upload_credentials,handler:x.images_upload_handler})),r().then(h(function(b){var d;return d=a.map(b,function(a){return a.blobInfo}),u.upload(d,m).then(h(function(d){var e=a.map(d,function(a,c){var d=b[c].image;return a.status&&g.settings.images_replace_blob_uris!==!1?n(d,a.url):a.error&&f.uploadError(g,a.error),{element:d,status:a.status}});return c&&c(e),e}))}))}function p(a){if(x.automatic_uploads!==!1)return o(a)}function q(a){return!x.images_dataimg_filter||x.images_dataimg_filter(a)}funct
ion r(){return v||(v=new c(y,w)),v.findAll(g.getBody(),q).then(h(function(b){return b=a.filter(b,function(a){return"string"!=typeof a||(f.displayError(g,a),!1)}),a.each(b,function(a){l(a.image.src,a.blobInfo.blobUri()),a.image.src=a.blobInfo.blobUri(),a.image.removeAttribute("data-mce-src")}),b}))}function s(){w.destroy(),y.destroy(),v=u=null}function t(b){return b.replace(/src="(blob:[^"]+)"/g,function(b,c){var d=y.getResultUri(c);if(d)return'src="'+d+'"';var e=w.getByUri(c);return e||(e=a.reduce(g.editorManager.get(),function(a,b){return a||b.editorUpload&&b.editorUpload.blobCache.getByUri(c)},null)),e?'src="data:'+e.blob().type+";base64,"+e.base64()+'"':b})}var u,v,w=new d,x=g.settings,y=new e;return g.on("setContent",function(){g.settings.automatic_uploads!==!1?p():r()}),g.on("RawSaveContent",function(a){a.content=t(a.content)}),g.on("getContent",function(a){a.source_view||&quo
t;raw"==a.format||(a.content=t(a.content))}),g.on("PostRender",function(){g.parser.addNodeFilter("img",function(b){a.each(b,function(a){var b=a.attr("src");if(!w.getByUri(b)){var c=y.getResultUri(b);c&&a.attr("src",c)}})})}),{blobCache:w,uploadImages:o,uploadImagesAuto:p,scanForImages:r,destroy:s}}}),g("tinymce.core.ForceBlocks",["ephox.katamari.api.Fun"],function(a){var b=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n=a.settings,o=a.dom,p=a.selection,q=a.schema,r=q.getBlockElements(),s=p.getStart(),t=a.getBody(),u=-16777215;if(m=n.forced_root_block,s&&1===s.nodeType&&m){for(;s&&s!==t;){if(r[s.nodeName])return;s=s.parentNode}if(b=p.getRng(),b.setStart){c=b.startContainer,d=b.startOffset,e=b.endContainer,f=b.endOffset;try{j=a.getDoc().activeElement===t}catch(v){}}else b.item&&(s=b.item(0),b=a.getDoc().body.createTextRange(),b.moveToElementText(s)),j=b.parentElement().ownerDocument===a.
getDoc(),k=b.duplicate(),k.collapse(!0),d=k.move("character",u)*-1,k.collapsed||(k=b.duplicate(),k.collapse(!1),f=k.move("character",u)*-1-d);for(s=t.firstChild,l=t.nodeName.toLowerCase();s;)if((3===s.nodeType||1==s.nodeType&&!r[s.nodeName])&&q.isValidChild(l,m.toLowerCase())){if(3===s.nodeType&&0===s.nodeValue.length){h=s,s=s.nextSibling,o.remove(h);continue}g||(g=o.create(m,a.settings.forced_root_block_attrs),s.parentNode.insertBefore(g,s),i=!0),h=s,s=s.nextSibling,g.appendChild(h)}else g=null,s=s.nextSibling;if(i&&j){if(b.setStart)b.setStart(c,d),b.setEnd(e,f),p.setRng(b);else try{b=a.getDoc().body.createTextRange(),b.moveToElementText(t),b.collapse(!0),b.moveStart("character",d),f>0&&b.moveEnd("character",f),b.select()}catch(v){}a.nodeChanged()}}},c=function(c){c.settings.forced_root_block&&c.on("NodeChange",a.curry(b,c))};return{setup:c}}),g("tinymce.core.dom.Dimensions&quo
t;,["tinymce.core.util.Arr","tinymce.core.dom.NodeType","tinymce.core.geom.ClientRect"],function(a,b,c){function d(e){function f(b){return a.map(b,function(a){return a=c.clone(a),a.node=e,a})}if(a.isArray(e))return a.reduce(e,function(a,b){return a.concat(d(b))},[]);if(b.isElement(e))return f(e.getClientRects());if(b.isText(e)){var g=e.ownerDocument.createRange();return g.setStart(e,0),g.setEnd(e,e.data.length),f(g.getClientRects())}}return{getClientRects:d}}),g("tinymce.core.caret.LineUtils",["tinymce.core.util.Fun","tinymce.core.util.Arr","tinymce.core.dom.NodeType","tinymce.core.dom.Dimensions","tinymce.core.geom.ClientRect","tinymce.core.caret.CaretUtils","tinymce.core.caret.CaretCandidate"],function(a,b,c,d,e,f,g){
-function h(a,b){return Math.abs(a.left-b)}function i(a,b){return Math.abs(a.right-b)}function j(a,c){function d(a,b){return a>=b.left&&a<=b.right}return b.reduce(a,function(a,b){var e,f;return e=Math.min(h(a,c),i(a,c)),f=Math.min(h(b,c),i(b,c)),d(c,b)?b:d(c,a)?a:f==e&&p(b.node)?b:f<e?b:a})}function k(a,b,c,d){for(;d=q(d,a,g.isEditableCaretCandidate,b);)if(c(d))return}function l(a,c){function f(a,e){var f;return f=b.filter(d.getClientRects(e),function(b){return!a(b,c)}),g=g.concat(f),0===f.length}var g=[];return g.push(c),k(-1,a,r(f,e.isAbove),c.node),k(1,a,r(f,e.isBelow),c.node),g}function m(a){return b.filter(b.toArray(a.getElementsByTagName("*")),p)}function n(a,b){return{node:a.node,before:h(a,b)<i(a,b)}}function o(a,c,e){var f,g;return f=d.getClientRects(m(a)),f=b.filter(f,function(a){return e>=a.top&&e<=a.bottom}),g=j(f,c),g&&(g=j(l(a,g),c),g&&p(g.node))?n(g,c):null}var p=c.isContentEditableFalse,q=f.findNode,r
=a.curry;return{findClosestClientRect:j,findLineNodeRects:l,closestCaret:o}}),g("tinymce.core.caret.LineWalker",["tinymce.core.util.Fun","tinymce.core.util.Arr","tinymce.core.dom.Dimensions","tinymce.core.caret.CaretCandidate","tinymce.core.caret.CaretUtils","tinymce.core.caret.CaretWalker","tinymce.core.caret.CaretPosition","tinymce.core.geom.ClientRect"],function(a,b,c,d,e,f,g,h){function i(a,b,c,f){for(;f=e.findNode(f,a,d.isEditableCaretCandidate,b);)if(c(f))return}function j(a,d,e,f,g,h){function j(f){var h,i,j;for(j=c.getClientRects(f),a==-1&&(j=j.reverse()),h=0;h<j.length;h++)if(i=j[h],!e(i,l)){if(n.length>0&&d(i,b.last(n))&&m++,i.line=m,g(i))return!0;n.push(i)}}var k,l,m=0,n=[];return(l=b.last(h.getClientRects()))?(k=h.getNode(),j(k),i(a,f,j,k),n):n}function k(a,b){return b.line>a}function l(a,b){return b.line===a}function m(a,c,d,e){function i(c){return
1==a?b.last(c.getClientRects()):b.last(c.getClientRects())}var j,k,l,m,n,o,p=new f(c),q=[],r=0;1==a?(j=p.next,k=h.isBelow,l=h.isAbove,m=g.after(e)):(j=p.prev,k=h.isAbove,l=h.isBelow,m=g.before(e)),o=i(m);do if(m.isVisible()&&(n=i(m),!l(n,o))){if(q.length>0&&k(n,b.last(q))&&r++,n=h.clone(n),n.position=m,n.line=r,d(n))return q;q.push(n)}while(m=j(m));return q}var n=a.curry,o=n(j,-1,h.isAbove,h.isBelow),p=n(j,1,h.isBelow,h.isAbove);return{upUntil:o,downUntil:p,positionsUntil:m,isAboveLine:n(k),isLine:n(l)}}),g("tinymce.core.keyboard.CefUtils",["tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretUtils","tinymce.core.dom.NodeType","tinymce.core.util.Fun"],function(a,b,c,d){var e=c.isContentEditableTrue,f=c.isContentEditableFalse,g=function(a,b,c,d){return b._selectionOverrides.showCaret(a,c,d)},h=function(a){var b=a.ownerDocument.createRange();return b.selectNode(a),b},i=function(a,b){var c;return c=a.fi
re("BeforeObjectSelected",{target:b}),c.isDefaultPrevented()?null:h(b)},j=function(c,h){var i,j;return h=b.normalizeRange(1,c.getBody(),h),i=a.fromRangeStart(h),f(i.getNode())?g(1,c,i.getNode(),!i.isAtEnd()):f(i.getNode(!0))?g(1,c,i.getNode(!0),!1):(j=c.dom.getParent(i.getNode(),d.or(f,e)),f(j)?g(1,c,j,!1):null)},k=function(a,b){var c;return b&&b.collapsed?(c=j(a,b),c?c:b):b};return{showCaret:g,selectNode:i,renderCaretAtRange:j,renderRangeCaret:k}}),g("tinymce.core.keyboard.CefNavigation",["tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretUtils","tinymce.core.caret.CaretWalker","tinymce.core.caret.LineUtils","tinymce.core.caret.LineWalker","tinymce.core.dom.NodeType","tinymce.core.dom.RangeUtils","tinymce.core.Env","tinymce.core.keyboard.CefUtils","tinymce.core.util.Arr","tinymce.core.util.Fun&quo
t;],function(a,b,c,d,e,f,g,h,i,j,k,l){var m=g.isContentEditableFalse,n=h.getSelectedNode,o=c.isAfterContentEditableFalse,p=c.isBeforeContentEditableFalse,q=function(a,b){for(;b=a(b);)if(b.isVisible())return b;return b},r=function(a,b){var d=c.isInSameBlock(a,b);return!(d||!g.isBr(a.getNode()))||d},s=function(b){return a.isCaretContainerBlock(b.startContainer)},t=function(a,d,e){return e=c.normalizeRange(a,d,e),a===-1?b.fromRangeStart(e):b.fromRangeEnd(e)},u=function(a,b,c,d,e){var f,g,h,i;return!e.collapsed&&(f=n(e),m(f))?j.showCaret(a,b,f,a===-1):(i=s(e),g=t(a,b.getBody(),e),d(g)?j.selectNode(b,g.getNode(a===-1)):(g=c(g))?d(g)?j.showCaret(a,b,g.getNode(a===-1),1===a):(h=c(g),d(h)&&r(g,h)?j.showCaret(a,b,h.getNode(a===-1),1===a):i?j.renderRangeCaret(b,g.toRange()):null):i?e:null)},v=function(a,b,c,d){var g,h,i,l,q,r,s,u,v;if(v=n(d),g=t(a,b.getBody(),d),h=c(b.getBody(),f.isAboveLine(1),g),i=k.filter(h,f.isLine(1)),q=k.last(g.getClientRects()),p(g)&&(v=g.getNod
e()),o(g)&&(v=g.getNode(!0)),!q)return null;if(r=q.left,l=e.findClosestClientRect(i,r),l&&m(l.node))return s=Math.abs(r-l.left),u=Math.abs(r-l.right),j.showCaret(a,b,l.node,s<u);if(v){var w=f.positionsUntil(a,b.getBody(),f.isAboveLine(1),v);if(l=e.findClosestClientRect(k.filter(w,f.isLine(1)),r))return j.renderRangeCaret(b,l.position.toRange());if(l=k.last(k.filter(w,f.isLine(0))))return j.renderRangeCaret(b,l.position.toRange())}},w=function(a){var b=a.dom.create(a.settings.forced_root_block);return(!i.ie||i.ie>=11)&&(b.innerHTML='<br data-mce-bogus="1">'),b},x=function(a,c,e){var f,g,h,i=new d(a.getBody()),j=l.curry(q,i.next),k=l.curry(q,i.prev);if(e.collapsed&&a.settings.forced_root_block){if(f=a.dom.getParent(e.startContainer,"PRE"),!f)return;g=1===c?j(b.fromRangeStart(e)):k(b.fromRangeStart(e)),g||(h=w(a),1===c?a.$(f).after(h):a.$(f).before(h),a.selection.select(h,!0),a.selection.collapse())}},y=function(a,b){var c
,e=new d(a.getBody()),f=l.curry(q,e.next),g=l.curry(q,e.prev),h=b?1:-1,i=b?f:g,j=b?p:o,k=a.selection.getRng();return(c=u(h,a,i,j,k))?c:(c=x(a,h,k),c?c:null)},z=function(a,b){var c,d=b?1:-1,e=b?f.downUntil:f.upUntil,g=a.selection.getRng();return(c=v(d,a,e,g))?c:(c=x(a,d,g),c?c:null)},A=function(a,b){return function(){var c=y(a,b);return!!c&&(a.selection.setRng(c),!0)}},B=function(a,b){return function(){var c=z(a,b);return!!c&&(a.selection.setRng(c),!0)}};return{moveH:A,moveV:B}}),g("ephox.katamari.api.Merger",["ephox.katamari.api.Type","global!Array","global!Error"],function(a,b,c){var d=function(a,b){return b},e=function(b,c){var d=a.isObject(b)&&a.isObject(c);return d?g(b,c):c},f=function(a){return function(){for(var d=new b(arguments.length),e=0;e<d.length;e++)d[e]=arguments[e];if(0===d.length)throw new c("Can't merge zero objects");for(var f={},g=0;g<d.length;g++){var h=d[g];for(var i in h)h.hasOwnPro
perty(i)&&(f[i]=a(f[i],h[i]))}return f}},g=f(e),h=f(d);return{deepMerge:g,merge:h}}),g("tinymce.core.keyboard.MatchKeys",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.katamari.api.Merger"],function(a,b,c){var d=function(d){return a.map(d,function(a){return c.merge({shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0,action:b.noop},a)})},e=function(a,b){return b.keyCode===a.keyCode&&b.shiftKey===a.shiftKey&&b.altKey===a.altKey&&b.ctrlKey===a.ctrlKey&&b.metaKey===a.metaKey},f=function(b,c){return a.bind(d(b),function(a){return e(a,c)?[a]:[]})},g=function(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}},h=function(b,c){return a.find(f(b,c),function(a){return a.action()})};return{match:f,action:g,execute:h}}),g("tinymce.core.keyboard.ArrowKeys",["tinymce.core.keyboard.BoundarySelection","tinymce.core.keyboard.CefNavigation"
;,"tinymce.core.keyboard.MatchKeys","tinymce.core.util.VK"],function(a,b,c,d){var e=function(e,f,g){c.execute([{keyCode:d.RIGHT,action:b.moveH(e,!0)},{keyCode:d.LEFT,action:b.moveH(e,!1)},{keyCode:d.UP,action:b.moveV(e,!1)},{keyCode:d.DOWN,action:b.moveV(e,!0)},{keyCode:d.RIGHT,action:a.move(e,f,!0)},{keyCode:d.LEFT,action:a.move(e,f,!1)}],g).each(function(a){g.preventDefault()})},f=function(a,b){a.on("keydown",function(c){c.isDefaultPrevented()===!1&&e(a,b,c)})};return{setup:f}}),g("tinymce.core.keyboard.DeleteBackspaceKeys",["tinymce.core.delete.BlockBoundaryDelete","tinymce.core.delete.BlockRangeDelete","tinymce.core.delete.CefDelete","tinymce.core.delete.InlineBoundaryDelete","tinymce.core.keyboard.MatchKeys","tinymce.core.util.VK"],function(a,b,c,d,e,f){var g=function(g,h,i){e.execute([{keyCode:f.BACKSPACE,action:e.action(c.backspaceDelete,g,!1)},{keyCode:f.DELETE,action:
e.action(c.backspaceDelete,g,!0)},{keyCode:f.BACKSPACE,action:e.action(d.backspaceDelete,g,h,!1)},{keyCode:f.DELETE,action:e.action(d.backspaceDelete,g,h,!0)},{keyCode:f.BACKSPACE,action:e.action(b.backspaceDelete,g,!1)},{keyCode:f.DELETE,action:e.action(b.backspaceDelete,g,!0)},{keyCode:f.BACKSPACE,action:e.action(a.backspaceDelete,g,!1)},{keyCode:f.DELETE,action:e.action(a.backspaceDelete,g,!0)}],i).each(function(a){i.preventDefault()})},h=function(a,b){e.execute([{keyCode:f.BACKSPACE,action:e.action(c.paddEmptyElement,a)},{keyCode:f.DELETE,action:e.action(c.paddEmptyElement,a)}],b)},i=function(a,b){a.on("keydown",function(c){c.isDefaultPrevented()===!1&&g(a,b,c)}),a.on("keyup",function(b){b.isDefaultPrevented()===!1&&h(a,b)})};return{setup:i}}),g("tinymce.core.keyboard.InsertNewLine",["tinymce.core.caret.CaretContainer","tinymce.core.dom.NodeType","tinymce.core.dom.RangeUtils","tinymce.core.dom.TreeW
alker","tinymce.core.text.Zwsp","tinymce.core.util.Tools"],function(a,b,c,d,e,f){var g=function(a){return a&&"A"===a.nodeName&&0===f.trim(e.trim(a.innerText||a.textContent)).length},h=function(a){return a&&/^(TD|TH|CAPTION)$/.test(a.nodeName)},i=function(a,b){return a.firstChild&&a.firstChild.nodeName==b},j=function(a,b){return a&&a.parentNode&&a.parentNode.nodeName===b},k=function(a){a.innerHTML='<br data-mce-bogus="1">'},l=function(a,b){return a.nodeName===b||a.previousSibling&&a.previousSibling.nodeName===b},m=function(a){return a&&/^(OL|UL|LI)$/.test(a.nodeName)},n=function(a){return m(a)&&m(a.parentNode)},o=function(a,b){return b&&a.isBlock(b)&&!/^(TD|TH|CAPTION|FORM)$/.test(b.nodeName)&&!/^(fixed|absolute)/i.test(b.style.position)&&"true"!==a.getContentEditable(b)},p=function(a,b,c){var d,e=c,f=[];if(e){for(;e=e.fi
rstChild;){if(a.isBlock(e))return;1!=e.nodeType||b[e.nodeName.toLowerCase()]||f.push(e)}for(d=f.length;d--;)e=f[d],!e.hasChildNodes()||e.firstChild==e.lastChild&&""===e.firstChild.nodeValue?a.remove(e):g(e)&&a.remove(e)}},q=function(a,c,d){return b.isText(c)===!1?d:a?1===d&&c.data.charAt(d-1)===e.ZWSP?0:d:d===c.data.length-1&&c.data.charAt(d)===e.ZWSP?c.data.length:d},r=function(a){var b=a.cloneRange();return b.setStart(a.startContainer,q(!0,a.startContainer,a.startOffset)),b.setEnd(a.endContainer,q(!1,a.endContainer,a.endOffset)),b},s=function(a){for(;a;){if(1===a.nodeType||3===a.nodeType&&a.data&&/[\r\n\s]/.test(a.data))return a;a=a.nextSibling}},t=function(a,b){a.execCommand("InsertLineBreak",!1,b)},u=function(a){do 3===a.nodeType&&(a.nodeValue=a.nodeValue.replace(/^[\r\n]+/,"")),a=a.firstChild;while(a)},v=function(a,b){var c,d,e=a.getRoot();for(c=b;c!==e&&"false"!==a.getConten
tEditable(c);)"true"===a.getContentEditable(c)&&(d=c),c=c.parentNode;return c!==e?d:e},w=function(a,b){var c=a.settings.forced_root_block;c&&c.toLowerCase()===b.tagName.toLowerCase()&&a.dom.setAttribs(b,a.settings.forced_root_block_attrs)},x=function(a,b,c,d,e){var f,g,i,j,k,l,m=b||"P",n=a.dom,p=v(n,d);if(g=n.getParent(d,n.isBlock),!g||!o(n,g)){if(g=g||p,l=g==a.getBody()||h(g)?g.nodeName.toLowerCase():g.parentNode.nodeName.toLowerCase(),!g.hasChildNodes())return f=n.create(m),w(a,f),g.appendChild(f),c.setStart(f,0),c.setEnd(f,0),f;for(j=d;j.parentNode!=g;)j=j.parentNode;for(;j&&!n.isBlock(j);)i=j,j=j.previousSibling;if(i&&a.schema.isValidChild(l,m.toLowerCase())){for(f=n.create(m),w(a,f),i.parentNode.insertBefore(f,i),j=i;j&&!n.isBlock(j);)k=j.nextSibling,f.appendChild(j),j=k;c.setStart(d,e),c.setEnd(d,e)}}return d},y=function(a,b){var c;b.normalize(),c=b.lastChild,c&&!/^(left|right)$/gi.test(a.getStyle(c,&q
uot;float",!0))||a.add(b,"br")},z=function(a){var b=a.parentNode;return/^(LI|DT|DD)$/.test(b.nodeName)?b:a},A=function(a,b,c){for(var d=a[c?"firstChild":"lastChild"];d&&1!=d.nodeType;)d=d[c?"nextSibling":"previousSibling"];return d===b},B=function(b,e){function f(a){var b,c,e,f,g=a,h=S.getMoveCaretBeforeOnEnterElements();if(a){if(/^(LI|DT|DD)$/.test(a.nodeName)){var i=s(a.firstChild);i&&/^(UL|OL|DL)$/.test(i.nodeName)&&a.insertBefore(P.doc.createTextNode("\xa0"),a.firstChild)}if(e=P.createRng(),a.normalize(),a.hasChildNodes()){for(b=new d(a,a);c=b.current();){if(3==c.nodeType){e.setStart(c,0),e.setEnd(c,0);break}if(h[c.nodeName.toLowerCase()]){e.setStartBefore(c),e.setEndBefore(c);break}g=c,c=b.next()}c||(e.setStart(g,0),e.setEnd(g,0))}else"BR"==a.nodeName?a.nextSibling&&P.isBlock(a.nextSibling)?(e.setStartBefore(a),e.setEndBefore(a)):(e.setStartAfter(a),e.setEndAfter(a)):(e.se
tStart(a,0),e.setEnd(a,0));Q.setRng(e),P.remove(f),Q.scrollIntoView(a)}}function g(a){var c,d,e,f=E,g=S.getTextInlineElements();if(a||"TABLE"==L||"HR"==L?(c=P.create(a||N),w(b,c)):c=G.cloneNode(!1),e=c,R.keep_styles===!1)P.setAttrib(c,"style",null),P.setAttrib(c,"class",null);else do if(g[f.nodeName]){if("_mce_caret"==f.id)continue;d=f.cloneNode(!1),P.setAttrib(d,"id",""),c.hasChildNodes()?(d.appendChild(c.firstChild),c.appendChild(d)):(e=d,c.appendChild(d))}while((f=f.parentNode)&&f!=D);return k(e),c}function h(a){var b,c,e,f;if(f=q(a,E,F),3==E.nodeType&&(a?f>0:f<E.nodeValue.length))return!1;if(E.parentNode==G&&O&&!a)return!0;if(a&&1==E.nodeType&&E==G.firstChild)return!0;if(l(E,"TABLE")||l(E,"HR"))return O&&!a||!O&&a;for(b=new d(E,G),3==E.nodeType&&(a&&0===f?b.prev():a||f!=E.nodeValue.length||b.next());c=b.cu
rrent();){if(1===c.nodeType){if(!c.getAttribute("data-mce-bogus")&&(e=c.nodeName.toLowerCase(),T[e]&&"br"!==e))return!1}else if(3===c.nodeType&&!/^[ \t\r\n]*$/.test(c.nodeValue))return!1;a?b.prev():b.next()}return!0}function m(){K!=b.getBody()&&(n(K)&&(N="LI"),I=N?g(N):P.create("BR"),A(K,G,!0)&&A(K,G,!1)?j(K,"LI")?P.insertAfter(I,z(K)):P.replace(I,K):A(K,G,!0)?j(K,"LI")?(P.insertAfter(I,z(K)),I.appendChild(P.doc.createTextNode(" ")),I.appendChild(K)):K.parentNode.insertBefore(I,K):A(K,G,!1)?P.insertAfter(I,z(K)):(K=z(K),C=U.cloneRange(),C.setStartAfter(G),C.setEndAfter(K),J=C.extractContents(),"LI"===N&&i(J,"LI")?(I=J.firstChild,P.insertAfter(J,K)):(P.insertAfter(J,K),P.insertAfter(I,K))),P.remove(G),f(I))}function B(){I=/^(H[1-6]|PRE|FIGURE)$/.test(L)&&"HGROUP"!=M?g(N):g(),R.end_container_on_empty_block&&o(P,K)&a
mp;&P.isEmpty(G)?I=P.split(K,G):P.insertAfter(I,G),f(I)}var C,D,E,F,G,H,I,J,K,L,M,N,O,P=b.dom,Q=b.selection,R=b.settings,S=b.schema,T=S.getNonEmptyElements(),U=b.selection.getRng();if(new c(P).normalize(U),E=U.startContainer,F=U.startOffset,N=(R.force_p_newlines?"p":"")||R.forced_root_block,N=N?N.toUpperCase():"",H=e.shiftKey,1==E.nodeType&&E.hasChildNodes()&&(O=F>E.childNodes.length-1,E=E.childNodes[Math.min(F,E.childNodes.length-1)]||E,F=O&&3==E.nodeType?E.nodeValue.length:0),D=v(P,E)){if(!P.isBlock(D)&&D!=P.getRoot())return void(N&&!H||t(b,e));if((N&&!H||!N&&H)&&(E=x(b,N,U,E,F)),G=P.getParent(E,P.isBlock),K=G?P.getParent(G.parentNode,P.isBlock):null,L=G?G.nodeName.toUpperCase():"",M=K?K.nodeName.toUpperCase():"","LI"!=M||e.ctrlKey||(G=K,K=K.parentNode,L=M),/^(LI|DT|DD)$/.test(L)){if(!N&&H)return void t(b,e);if(P.isEmpty(G))return void m()}if(&
quot;PRE"==L&&R.br_in_pre!==!1){if(!H)return void t(b,e)}else if(!N&&!H&&"LI"!=L||N&&H)return void t(b,e);N&&G===b.getBody()||(N=N||"P",a.isCaretContainerBlock(G)?(I=a.showCaretContainerBlock(G),P.isEmpty(G)&&k(G),f(I)):h()?B():h(!0)?(I=G.parentNode.insertBefore(g(),G),f(l(G,"HR")?I:G)):(C=r(U).cloneRange(),C.setEndAfter(G),J=C.extractContents(),u(J),I=J.firstChild,P.insertAfter(J,G),p(P,T,I),y(P,G),P.isEmpty(G)&&k(G),I.normalize(),P.isEmpty(I)?(P.remove(I),B()):f(I)),P.setAttrib(I,"id",""),b.fire("NewBlock",{newBlock:I}))}};return{insert:B}}),g("tinymce.core.keyboard.EnterKey",["tinymce.core.keyboard.InsertNewLine","tinymce.core.util.VK"],function(a,b){var c=function(a){a.typing&&(a.typing=!1,a.add())},d=function(b,d){d.isDefaultPrevented()||(d.preventDefault(),c(b.undoManager),b.undoManager.transact(function(){b.selection.is
Collapsed()===!1&&b.execCommand("Delete"),a.insert(b,d)}))},e=function(a){a.on("keydown",function(c){c.keyCode===b.ENTER&&d(a,c)})};return{setup:e}}),g("tinymce.core.keyboard.InsertSpace",["ephox.katamari.api.Fun","tinymce.core.caret.CaretPosition","tinymce.core.dom.NodeType","tinymce.core.keyboard.BoundaryLocation","tinymce.core.keyboard.InlineUtils"],function(a,b,c,d,e){var f=function(a,b){return j(a)&&c.isText(b.container())},g=function(a,b){var c=b.container(),d=b.offset();c.insertData(d,"\xa0"),a.selection.setCursorLocation(c,d+1)},h=function(a,b,c){return!!f(c,b)&&(g(a,b),!0)},i=function(c){var f=a.curry(e.isInlineTarget,c),g=b.fromRangeStart(c.selection.getRng()),i=d.readLocation(f,c.getBody(),g);return i.map(a.curry(h,c,g)).getOr(!1)},j=function(b){return b.fold(a.constant(!1),a.constant(!0),a.constant(!0),a.constant(!1))},k=function(a){return!!a.selectio
n.isCollapsed()&&i(a)};return{insertAtSelection:k}}),g("tinymce.core.keyboard.SpaceKey",["tinymce.core.keyboard.InsertSpace","tinymce.core.keyboard.MatchKeys","tinymce.core.util.VK"],function(a,b,c){var d=function(d,e){b.execute([{keyCode:c.SPACEBAR,action:b.action(a.insertAtSelection,d)}],e).each(function(a){e.preventDefault()})},e=function(a){a.on("keydown",function(b){b.isDefaultPrevented()===!1&&d(a,b)})};return{setup:e}}),g("tinymce.core.keyboard.KeyboardOverrides",["tinymce.core.keyboard.ArrowKeys","tinymce.core.keyboard.BoundarySelection","tinymce.core.keyboard.DeleteBackspaceKeys","tinymce.core.keyboard.EnterKey","tinymce.core.keyboard.SpaceKey"],function(a,b,c,d,e){var f=function(f){var g=b.setupSelectedState(f);a.setup(f,g),c.setup(f,g),d.setup(f),e.setup(f)};return{setup:f}}),g("tinymce.core.NodeChange",["tinymce.core.dom.RangeUtils&
quot;,"tinymce.core.Env","tinymce.core.util.Delay"],function(a,b,c){return function(d){function e(a){var b,c;if(c=d.$(a).parentsUntil(d.getBody()).add(a),c.length===g.length){for(b=c.length;b>=0&&c[b]===g[b];b--);if(b===-1)return g=c,!0}return g=c,!1}var f,g=[];"onselectionchange"in d.getDoc()||d.on("NodeChange Click MouseUp KeyUp Focus",function(b){var c,e;c=d.selection.getRng(),e={startContainer:c.startContainer,startOffset:c.startOffset,endContainer:c.endContainer,endOffset:c.endOffset},"nodechange"!=b.type&&a.compareRanges(e,f)||d.fire("SelectionChange"),f=e}),d.on("contextmenu",function(){d.fire("SelectionChange")}),d.on("SelectionChange",function(){var a=d.selection.getStart(!0);!a||!b.range&&d.selection.isCollapsed()||!e(a)&&d.dom.isChildOf(a,d.getBody())&&d.nodeChanged({selectionChange:!0})}),d.on("MouseUp",function(a){a.isDefaultPrev
ented()||("IMG"==d.selection.getNode().nodeName?c.setEditorTimeout(d,function(){d.nodeChanged()}):d.nodeChanged())}),this.nodeChanged=function(a){var b,c,e,f=d.selection;d.initialized&&f&&!d.settings.disable_nodechange&&!d.readonly&&(e=d.getBody(),b=f.getStart(!0)||e,b.ownerDocument==d.getDoc()&&d.dom.isChildOf(b,e)||(b=e),c=[],d.dom.getParent(b,function(a){return a===e||void c.push(a)}),a=a||{},a.element=b,a.parents=c,d.fire("NodeChange",a))}}}),g("tinymce.core.dom.MousePosition",[],function(){var a=function(a){var b,c,d,e;return e=a.getBoundingClientRect(),b=a.ownerDocument,c=b.documentElement,d=b.defaultView,{top:e.top+d.pageYOffset-c.clientTop,left:e.left+d.pageXOffset-c.clientLeft}},b=function(b){return b.inline?a(b.getBody()):{left:0,top:0}},c=function(a){var b=a.getBody();return a.inline?{left:b.scrollLeft,top:b.scrollTop}:{left:0,top:0}},d=function(a){var b=a.getBody(),c=a.getDoc().documentElement,d={left:
b.scrollLeft,top:b.scrollTop},e={left:b.scrollLeft||c.scrollLeft,top:b.scrollTop||c.scrollTop};return a.inline?d:e},e=function(b,c){if(c.target.ownerDocument!==b.getDoc()){var e=a(b.getContentAreaContainer()),f=d(b);return{left:c.pageX-e.left+f.left,top:c.pageY-e.top+f.top}}return{left:c.pageX,top:c.pageY}},f=function(a,b,c){return{pageX:c.left-a.left+b.left,pageY:c.top-a.top+b.top}},g=function(a,d){return f(b(a),c(a),e(a,d))};return{calc:g}}),g("tinymce.core.DragDropOverrides",["tinymce.core.dom.NodeType","tinymce.core.util.Arr","tinymce.core.util.Fun","tinymce.core.util.Delay","tinymce.core.dom.DOMUtils","tinymce.core.dom.MousePosition"],function(a,b,c,d,e,f){var g=a.isContentEditableFalse,h=a.isContentEditableTrue,i=function(a,b){return g(b)&&b!==a},j=function(a,b,c){return b!==c&&!a.dom.isChildOf(b,c)&&!g(b)},k=function(a){var b=a.cloneNode(!0);return b.removeAttribute("data-mce-se
lected"),b},l=function(a,b,c,d){var e=b.cloneNode(!0);a.dom.setStyles(e,{width:c,height:d}),a.dom.setAttrib(e,"data-mce-selected",null);var f=a.dom.create("div",{"class":"mce-drag-container","data-mce-bogus":"all",unselectable:"on",contenteditable:"false"});return a.dom.setStyles(f,{position:"absolute",opacity:.5,overflow:"hidden",border:0,padding:0,margin:0,width:c,height:d}),a.dom.setStyles(e,{margin:0,boxSizing:"border-box"}),f.appendChild(e),f},m=function(a,b){a.parentNode!==b&&b.appendChild(a)},n=function(a,b,c,d,e,f){var g=0,h=0;a.style.left=b.pageX+"px",a.style.top=b.pageY+"px",b.pageX+c>e&&(g=b.pageX+c-e),b.pageY+d>f&&(h=b.pageY+d-f),a.style.width=c-g+"px",a.style.height=d-h+"px"},o=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)},p=function(a){return 0===a.button},q=f
unction(a){return a.element},r=function(a,b){return{pageX:b.pageX-a.relX,pageY:b.pageY+5}},s=function(a,d){return function(e){if(p(e)){var f=b.find(d.dom.getParents(e.target),c.or(g,h));if(i(d.getBody(),f)){var j=d.dom.getPos(f),k=d.getBody(),m=d.getDoc().documentElement;a.element=f,a.screenX=e.screenX,a.screenY=e.screenY,a.maxX=(d.inline?k.scrollWidth:m.offsetWidth)-2,a.maxY=(d.inline?k.scrollHeight:m.offsetHeight)-2,a.relX=e.pageX-j.x,a.relY=e.pageY-j.y,a.width=f.offsetWidth,a.height=f.offsetHeight,a.ghost=l(d,f,a.width,a.height)}}}},t=function(a,b){var c=d.throttle(function(a,c){b._selectionOverrides.hideFakeCaret(),b.selection.placeCaretAt(a,c)},0);return function(d){var e=Math.max(Math.abs(d.screenX-a.screenX),Math.abs(d.screenY-a.screenY));if(q(a)&&!a.dragging&&e>10){var g=b.fire("dragstart",{target:a.element});if(g.isDefaultPrevented())return;a.dragging=!0,b.focus()}if(a.dragging){var h=r(a,f.calc(b,d));m(a.ghost,b.getBody()),n(a.ghost,h,a.width,a
.height,a.maxX,a.maxY),c(d.clientX,d.clientY)}}},u=function(a){var b=a.getSel().getRangeAt(0),c=b.startContainer;return 3===c.nodeType?c.parentNode:c},v=function(a,b){return function(c){if(a.dragging&&j(b,u(b.selection),a.element)){var d=k(a.element),e=b.fire("drop",{targetClone:d,clientX:c.clientX,clientY:c.clientY});e.isDefaultPrevented()||(d=e.targetClone,b.undoManager.transact(function(){o(a.element),b.insertContent(b.dom.getOuterHTML(d)),b._selectionOverrides.hideFakeCaret()}))}x(a)}},w=function(a,b){return function(){x(a),a.dragging&&b.fire("dragend")}},x=function(a){a.dragging=!1,a.element=null,o(a.ghost)},y=function(a){var b,c,d,f,g,h,i={};b=e.DOM,h=document,c=s(i,a),d=t(i,a),f=v(i,a),g=w(i,a),a.on("mousedown",c),a.on("mousemove",d),a.on("mouseup",f),b.bind(h,"mousemove",d),b.bind(h,"mouseup",g),a.on("remove",function(){b.unbind(h,"mousemove",d),b.unbind(h,"mouseup&
quot;,g)})},z=function(a){a.on("drop",function(b){var c="undefined"!=typeof b.clientX?a.getDoc().elementFromPoint(b.clientX,b.clientY):null;(g(c)||g(a.dom.getContentEditableParent(c)))&&b.preventDefault()})},A=function(a){y(a),z(a)};return{init:A}}),g("tinymce.core.caret.FakeCaret",["tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretContainerRemove","tinymce.core.caret.CaretPosition","tinymce.core.dom.DomQuery","tinymce.core.dom.NodeType","tinymce.core.dom.RangeUtils","tinymce.core.geom.ClientRect","tinymce.core.util.Delay"],function(a,b,c,d,e,f,g,h){var i=e.isContentEditableFalse,j=function(a){return a&&/^(TD|TH)$/i.test(a.nodeName)};return function(c,e){function f(a,b){var d,e,f,h,i,j=g.collapse(a.getBoundingClientRect(),b);return"BODY"==c.tagName?(d=c.ownerDocument.documentElement,e=c.scrollLeft||d.scrollLeft,f=c.scrollTop||d.scrollTop)
:(i=c.getBoundingClientRect(),e=c.scrollLeft-i.left,f=c.scrollTop-i.top),j.left+=e,j.right+=e,j.top+=f,j.bottom+=f,j.width=1,h=a.offsetWidth-a.clientWidth,h>0&&(b&&(h*=-1),j.left+=h,j.right+=h),j}function k(){var b,e,f,g,h;for(b=d("*[contentEditable=false]",c),g=0;g<b.length;g++)e=b[g],f=e.previousSibling,a.endsWithCaretContainer(f)&&(h=f.data,1==h.length?f.parentNode.removeChild(f):f.deleteData(h.length-1,1)),f=e.nextSibling,a.startsWithCaretContainer(f)&&(h=f.data,1==h.length?f.parentNode.removeChild(f):f.deleteData(0,1));return null}function l(b,g){var h,k;return m(),j(g)?null:e(g)?(s=a.insertBlock("p",g,b),h=f(g,b),d(s).css("top",h.top),r=d('<div class="mce-visual-caret" data-mce-bogus="all"></div>').css(h).appendTo(c),b&&r.addClass("mce-visual-caret-before"),n(),k=g.ownerDocument.createRange(),k.setStart(s,0),k.setEnd(s,0),k):(s=a.insertInline(g,b),k=g.ownerDocu
ment.createRange(),i(s.nextSibling)?(k.setStart(s,0),k.setEnd(s,0)):(k.setStart(s,1),k.setEnd(s,1)),k)}function m(){k(),s&&(b.remove(s),s=null),r&&(r.remove(),r=null),clearInterval(q)}function n(){q=h.setInterval(function(){d("div.mce-visual-caret",c).toggleClass("mce-visual-caret-hidden")},500)}function o(){h.clearInterval(q)}function p(){return".mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}"}var q,r,s;return{show:l,hide:m,getCss:p,destroy:o}}}),g("tinymce.core.SelectionOverrides",["ephox.katamari.api.Arr","ephox.sugar.api.dom.Remove","ephox.sugar.api.node.Element","ephox.sugar.api.properties.Attr","ephox.sugar.api.search.SelectorFilter","ephox.sugar.api.search.SelectorFind","tinymce.
core.DragDropOverrides","tinymce.core.EditorView","tinymce.core.Env","tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretUtils","tinymce.core.caret.CaretWalker","tinymce.core.caret.FakeCaret","tinymce.core.caret.LineUtils","tinymce.core.dom.ElementType","tinymce.core.dom.NodeType","tinymce.core.dom.RangePoint","tinymce.core.keyboard.CefUtils","tinymce.core.util.Delay","tinymce.core.util.VK"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u){function v(q){function v(a){return q.dom.hasClass(a,"mce-offscreen-selection")}function A(){var a=q.dom.get(T);return a?a.getElementsByTagName("*")[0]:a}function B(a){return q.dom.isBlock(a)}function C(a){a&&q.selection.setRng(a)}function D(){return q.selection.getRng()}function E(a,b){q.selection.scrollIntoView(a,b)}function F(a,b
,c){var d;return d=q.fire("ShowCaret",{target:b,direction:a,before:c}),d.isDefaultPrevented()?null:(E(b,a===-1),S.show(c,b))}function G(a,b){return b=l.normalizeRange(a,R,b),a==-1?k.fromRangeStart(b):k.fromRangeEnd(b)}function H(a){a.hasAttribute("data-mce-caret")&&(j.showCaretContainerBlock(a),C(D()),E(a[0]))}function I(){function a(a){for(var b=q.getBody();a&&a!=b;){if(w(a)||x(a))return a;a=a.parentNode}return null}function b(b){var c=!1;b.on("touchstart",function(){c=!1}),b.on("touchmove",function(){c=!0}),b.on("touchend",function(d){var e=a(d.target);x(e)&&(c||(d.preventDefault(),M(s.selectNode(b,e))))})}q.on("mouseup",function(a){var b=D();b.collapsed&&h.isXYInContentArea(q,a.clientX,a.clientY)&&C(s.renderCaretAtRange(q,b))}),q.on("click",function(b){var c;c=a(b.target),c&&(x(c)&&(b.preventDefault(),q.focus()),w(c)&&q.dom.isChildOf(c,q.selection.
getNode())&&N())}),q.on("blur NewBlock",function(){N(),P()});var d=function(a){var b=new m(a);if(!a.firstChild)return!1;var c=k.before(a.firstChild),d=b.next(c);return d&&!z(d)&&!y(d)},e=function(a,b){var c=q.dom.getParent(a,q.dom.isBlock),d=q.dom.getParent(b,q.dom.isBlock);return c===d},f=function(a,b){var c=q.dom.getParent(a,q.dom.isBlock),f=q.dom.getParent(b,q.dom.isBlock);return c&&!e(c,f)&&d(c)};b(q),q.on("mousedown",function(b){var d;if(h.isXYInContentArea(q,b.clientX,b.clientY)!==!1)if(d=a(b.target))x(d)?(b.preventDefault(),M(s.selectNode(q,d))):(N(),w(d)&&b.shiftKey||r.isXYWithinRange(b.clientX,b.clientY,q.selection.getRng())||(p.isVoid(c.fromDom(b.target))?q.selection.select(b.target):q.selection.placeCaretAt(b.clientX,b.clientY)));else{N(),P();var e=o.closestCaret(R,b.clientX,b.clientY);e&&(f(b.target,e.node)||(b.preventDefault(),q.getBody().focus(),C(F(1,e.node,e.before))))}}),q.on("keypress&
quot;,function(a){if(!u.modifierPressed(a))switch(a.keyCode){default:x(q.selection.getNode())&&a.preventDefault()}}),q.on("getSelectionRange",function(a){var b=a.range;if(Q){if(!Q.parentNode)return void(Q=null);b=b.cloneRange(),b.selectNode(Q),a.range=b}}),q.on("setSelectionRange",function(a){var b;b=M(a.range,a.forward),b&&(a.range=b)}),q.on("AfterSetSelectionRange",function(a){var b=a.range;L(b)||P(),v(b.startContainer.parentNode)||N()}),q.on("focus",function(){t.setEditorTimeout(q,function(){q.selection.setRng(s.renderRangeCaret(q,q.selection.getRng()))},0)}),q.on("copy",function(a){var b=a.clipboardData;if(!a.isDefaultPrevented()&&a.clipboardData&&!i.ie){var c=A();c&&(a.preventDefault(),b.clearData(),b.setData("text/html",c.outerHTML),b.setData("text/plain",c.outerText))}}),g.init(q)}function J(){var a=q.contentStyles,b=".mce-content-body";a.push(S.getCss()),a.
push(b+" .mce-offscreen-selection {position: absolute;left: -9999999999px;max-width: 1000000px;}"+b+" *[contentEditable=false] {cursor: default;}"+b+" *[contentEditable=true] {cursor: text;}")}function K(a){return j.isCaretContainer(a)||j.startsWithCaretContainer(a)||j.endsWithCaretContainer(a)}function L(a){return K(a.startContainer)||K(a.endContainer)}function M(b,g){var h,j,k,l,m,n,o,p,r,s,t=q.$,u=q.dom;if(!b)return null;if(b.collapsed){if(!L(b))if(g===!1){if(p=G(-1,b),x(p.getNode(!0)))return F(-1,p.getNode(!0),!1);if(x(p.getNode()))return F(-1,p.getNode(),!p.isAtEnd())}else{if(p=G(1,b),x(p.getNode()))return F(1,p.getNode(),!p.isAtEnd());if(x(p.getNode(!0)))return F(1,p.getNode(!0),!1)}return null}return l=b.startContainer,m=b.startOffset,n=b.endOffset,3==l.nodeType&&0==m&&x(l.parentNode)&&(l=l.parentNode,m=u.nodeIndex(l),l=l.parentNode),1!=l.nodeType?null:(n==m+1&&(h=l.childNodes[m]),x(h)?(r=s=h.cloneNode(!0),o=q.fire
("ObjectSelected",{target:h,targetClone:r}),o.isDefaultPrevented()?null:(j=f.descendant(c.fromDom(q.getBody()),"#"+T).fold(function(){return t([])},function(a){return t([a.dom()])}),r=o.targetClone,0===j.length&&(j=t('<div data-mce-bogus="all" class="mce-offscreen-selection"></div>').attr("id",T),j.appendTo(q.getBody())),b=q.dom.createRng(),r===s&&i.ie?(j.empty().append('<p style="font-size: 0" data-mce-bogus="all">\xa0</p>').append(r),b.setStartAfter(j[0].firstChild.firstChild),b.setEndAfter(r)):(j.empty().append("\xa0").append(r).append("\xa0"),b.setStart(j[0].firstChild,1),b.setEnd(j[0].lastChild,0)),j.css({top:u.getPos(h,q.getBody()).y}),j[0].focus(),k=q.selection.getSel(),k.removeAllRanges(),k.addRange(b),a.each(e.descendants(c.fromDom(q.getBody()),"*[data-mce-selected]"),function(a){d.remove(a,"data-mce-selected")}),h.setAttribut
e("data-mce-selected",1),Q=h,P(),b)):null)}function N(){Q&&(Q.removeAttribute("data-mce-selected"),f.descendant(c.fromDom(q.getBody()),"#"+T).each(b.remove),Q=null)}function O(){S.destroy(),Q=null}function P(){S.hide()}var Q,R=q.getBody(),S=new n(q.getBody(),B),T="sel-"+q.dom.uniqueId();return i.ceFalse&&(I(),J()),{showCaret:F,showBlockCaretContainer:H,hideFakeCaret:P,destroy:O}}var w=q.isContentEditableTrue,x=q.isContentEditableFalse,y=l.isAfterContentEditableFalse,z=l.isBeforeContentEditableFalse;return v}),g("tinymce.core.undo.Diff",[],function(){var a=0,b=1,c=2,d=function(d,e){var f=d.length+e.length+2,g=new Array(f),h=new Array(f),i=function(a,b,c){return{start:a,end:b,diag:c}},j=function(f,g,h,i,k){var m=l(f,g,h,i);if(null===m||m.start===g&&m.diag===g-i||m.end===f&&m.diag===f-h)for(var n=f,o=h;n<g||o<i;)n<g&&o<i&&d[n]===e[o]?(k.push([a,d[n]]),++n,++o):g-f>i-h?(k.pus
h([c,d[n]]),++n):(k.push([b,e[o]]),++o);else{j(f,m.start,h,m.start-m.diag,k);for(var p=m.start;p<m.end;++p)k.push([a,d[p]]);j(m.end,g,m.end-m.diag,i,k)}},k=function(a,b,c,f){for(var g=a;g-b<f&&g<c&&d[g]===e[g-b];)++g;return i(a,g,b)},l=function(a,b,c,f){
-var i=b-a,j=f-c;if(0===i||0===j)return null;var l=i-j,m=j+i,n=(m%2===0?m:m+1)/2;g[1+n]=a,h[1+n]=b+1;for(var o=0;o<=n;++o){for(var p=-o;p<=o;p+=2){var q=p+n;p===-o||p!=o&&g[q-1]<g[q+1]?g[q]=g[q+1]:g[q]=g[q-1]+1;for(var r=g[q],s=r-a+c-p;r<b&&s<f&&d[r]===e[s];)g[q]=++r,++s;if(l%2!=0&&l-o<=p&&p<=l+o&&h[q-l]<=g[q])return k(h[q-l],p+a-c,b,f)}for(p=l-o;p<=l+o;p+=2){for(q=p+n-l,p===l-o||p!=l+o&&h[q+1]<=h[q-1]?h[q]=h[q+1]-1:h[q]=h[q-1],r=h[q]-1,s=r-a+c-p;r>=a&&s>=c&&d[r]===e[s];)h[q]=r--,s--;if(l%2===0&&-o<=p&&p<=o&&h[q]<=g[q+l])return k(h[q],p+a-c,b,f)}}},m=[];return j(0,d.length,0,e.length,m),m};return{KEEP:a,DELETE:c,INSERT:b,diff:d}}),g("tinymce.core.undo.Fragments",["tinymce.core.util.Arr","tinymce.core.html.Entities","tinymce.core.undo.Diff"],function(a,b,c){var d=function(a){return 1===a.nodeType?a.outerHTM
L:3===a.nodeType?b.encodeRaw(a.data,!1):8===a.nodeType?"<!--"+a.data+"-->":""},e=function(a){var b,c,d;for(d=document.createElement("div"),b=document.createDocumentFragment(),a&&(d.innerHTML=a);c=d.firstChild;)b.appendChild(c);return b},f=function(a,b,c){var d=e(b);if(a.hasChildNodes()&&c<a.childNodes.length){var f=a.childNodes[c];f.parentNode.insertBefore(d,f)}else a.appendChild(d)},g=function(a,b){if(a.hasChildNodes()&&b<a.childNodes.length){var c=a.childNodes[b];c.parentNode.removeChild(c)}},h=function(b,d){var e=0;a.each(b,function(a){a[0]===c.KEEP?e++:a[0]===c.INSERT?(f(d,a[1],e),e++):a[0]===c.DELETE&&g(d,e)})},i=function(b){return a.filter(a.map(b.childNodes,d),function(a){return a.length>0})},j=function(b,e){var f=a.map(e.childNodes,d);return h(c.diff(f,b),e),e};return{read:i,write:j}}),g("tinymce.core.undo.Levels",["tinymce.core.util.Arr","tinymce.core.undo.Fragmen
ts"],function(a,b){var c=function(a){return a.indexOf("</iframe>")!==-1},d=function(a){return{type:"fragmented",fragments:a,content:"",bookmark:null,beforeBookmark:null}},e=function(a){return{type:"complete",fragments:null,content:a,bookmark:null,beforeBookmark:null}},f=function(f){var g,h,i;return g=b.read(f.getBody()),i=a.map(g,function(a){return f.serializer.trimContent(a)}),h=i.join(""),c(h)?d(i):e(h)},g=function(a,c,d){"fragmented"===c.type?b.write(c.fragments,a.getBody()):a.setContent(c.content,{format:"raw"}),a.selection.moveToBookmark(d?c.beforeBookmark:c.bookmark)},h=function(a){return"fragmented"===a.type?a.fragments.join(""):a.content},i=function(a,b){return!!a&&!!b&&h(a)===h(b)};return{createFragmentedLevel:d,createCompleteLevel:e,createFromEditor:f,applyToEditor:g,isEq:i}}),g("tinymce.core.UndoManager",["tinymce.core.util.VK","tin
ymce.core.util.Tools","tinymce.core.undo.Levels"],function(a,b,c){return function(a){function d(b){a.setDirty(b)}function e(a){n(!1),i.add({},a)}function f(){i.typing&&(n(!1),i.add())}var g,h,i=this,j=0,k=[],l=0,m=function(){return 0===l},n=function(a){m()&&(i.typing=a)};return a.on("init",function(){i.add()}),a.on("BeforeExecCommand",function(a){var b=a.command;"Undo"!==b&&"Redo"!==b&&"mceRepaint"!==b&&(f(),i.beforeChange())}),a.on("ExecCommand",function(a){var b=a.command;"Undo"!==b&&"Redo"!==b&&"mceRepaint"!==b&&e(a)}),a.on("ObjectResizeStart Cut",function(){i.beforeChange()}),a.on("SaveContent ObjectResized blur",e),a.on("DragEnd",e),a.on("KeyUp",function(b){var f=b.keyCode;b.isDefaultPrevented()||((f>=33&&f<=36||f>=37&&f<=40||45===f||b.ctrlKey)&
amp;&(e(),a.nodeChanged()),46!==f&&8!==f||a.nodeChanged(),h&&i.typing&&c.isEq(c.createFromEditor(a),k[0])===!1&&(a.isDirty()===!1&&(d(!0),a.fire("change",{level:k[0],lastLevel:null})),a.fire("TypingUndo"),h=!1,a.nodeChanged()))}),a.on("KeyDown",function(a){var b=a.keyCode;if(!a.isDefaultPrevented()){if(b>=33&&b<=36||b>=37&&b<=40||45===b)return void(i.typing&&e(a));var c=a.ctrlKey&&!a.altKey||a.metaKey;!(b<16||b>20)||224===b||91===b||i.typing||c||(i.beforeChange(),n(!0),i.add({},a),h=!0)}}),a.on("MouseDown",function(a){i.typing&&e(a)}),a.addShortcut("meta+z","","Undo"),a.addShortcut("meta+y,meta+shift+z","","Redo"),a.on("AddUndo Undo Redo ClearUndos",function(b){b.isDefaultPrevented()||a.nodeChanged()}),i={data:k,typing:!1,beforeChange:function(){m()&&(g=a.selection.g
etBookmark(2,!0))},add:function(e,f){var h,i,l,n=a.settings;if(l=c.createFromEditor(a),e=e||{},e=b.extend(e,l),m()===!1||a.removed)return null;if(i=k[j],a.fire("BeforeAddUndo",{level:e,lastLevel:i,originalEvent:f}).isDefaultPrevented())return null;if(i&&c.isEq(i,e))return null;if(k[j]&&(k[j].beforeBookmark=g),n.custom_undo_redo_levels&&k.length>n.custom_undo_redo_levels){for(h=0;h<k.length-1;h++)k[h]=k[h+1];k.length--,j=k.length}e.bookmark=a.selection.getBookmark(2,!0),j<k.length-1&&(k.length=j+1),k.push(e),j=k.length-1;var o={level:e,lastLevel:i,originalEvent:f};return a.fire("AddUndo",o),j>0&&(d(!0),a.fire("change",o)),e},undo:function(){var b;return i.typing&&(i.add(),i.typing=!1,n(!1)),j>0&&(b=k[--j],c.applyToEditor(a,b,!0),d(!0),a.fire("undo",{level:b})),b},redo:function(){var b;return j<k.length-1&&(b=k[++j],c.applyToEditor(a,b,!1),d(!0),a.fire("redo&q
uot;,{level:b})),b},clear:function(){k=[],j=0,i.typing=!1,i.data=k,a.fire("ClearUndos")},hasUndo:function(){return j>0||i.typing&&k[0]&&!c.isEq(c.createFromEditor(a),k[0])},hasRedo:function(){return j<k.length-1&&!i.typing},transact:function(a){return f(),i.beforeChange(),i.ignore(a),i.add()},ignore:function(a){try{l++,a()}finally{l--}},extra:function(b,d){var e,f;i.transact(b)&&(f=k[j].bookmark,e=k[j-1],c.applyToEditor(a,e,!0),i.transact(d)&&(k[j-1].beforeBookmark=f))}}}}),g("tinymce.core.dom.NodePath",["tinymce.core.dom.DOMUtils"],function(a){function b(b,c,d){for(var e=[];c&&c!=b;c=c.parentNode)e.push(a.nodeIndex(c,d));return e}function c(a,b){var c,d,e;for(d=a,c=b.length-1;c>=0;c--){if(e=d.childNodes,b[c]>e.length-1)return null;d=e[b[c]]}return d}return{create:b,resolve:c}}),g("tinymce.core.util.Quirks",["tinymce.core.util.VK","tinymce.core.dom.RangeUtils",&quo
t;tinymce.core.dom.TreeWalker","tinymce.core.dom.NodePath","tinymce.core.html.Node","tinymce.core.html.Entities","tinymce.core.Env","tinymce.core.util.Tools","tinymce.core.util.Delay","tinymce.core.caret.CaretContainer","tinymce.core.caret.CaretPosition","tinymce.core.caret.CaretWalker"],function(a,b,c,d,e,f,g,h,i,j,k,l){return function(c){function d(a,b){try{c.getDoc().execCommand(a,!1,b)}catch(d){}}function k(){var a=c.getDoc().documentMode;return a?a:6}function l(a){return a.isDefaultPrevented()}function m(a){var b,d;a.dataTransfer&&(c.selection.isCollapsed()&&"IMG"==a.target.tagName&&Y.select(a.target),b=c.selection.getContent(),b.length>0&&(d=da+escape(c.id)+","+escape(b),a.dataTransfer.setData(ea,d)))}function n(a){var b;return a.dataTransfer&&(b=a.dataTransfer.getData(ea),b&&b.indexOf(da)>=0)?(b=b.substr(da.le
ngth).split(","),{id:unescape(b[0]),html:unescape(b[1])}):null}function o(a,b){c.queryCommandSupported("mceInsertClipboardContent")?c.execCommand("mceInsertClipboardContent",!1,{content:a,internal:b}):c.execCommand("mceInsertContent",!1,a)}function p(){function a(a){var b=X.create("body"),c=a.cloneContents();return b.appendChild(c),Y.serializer.serialize(b,{format:"html"})}function d(d){if(!d.setStart){if(d.item)return!1;var e=d.duplicate();return e.moveToElementText(c.getBody()),b.compareRanges(d,e)}var f=a(d),g=X.createRng();g.selectNode(c.getBody());var h=a(g);return f===h}c.on("keydown",function(a){var b,e,f=a.keyCode;if(!l(a)&&(f==W||f==V)){if(b=c.selection.isCollapsed(),e=c.getBody(),b&&!X.isEmpty(e))return;if(!b&&!d(c.selection.getRng()))return;a.preventDefault(),c.setContent(""),e.firstChild&&X.isBlock(e.firstChild)?c.selection.setCursorLocation(e.firstChild,0):c.s
election.setCursorLocation(e,0),c.nodeChanged()}})}function q(){c.shortcuts.add("meta+a",null,"SelectAll")}function r(){c.settings.content_editable||X.bind(c.getDoc(),"mousedown mouseup",function(a){var b;if(a.target==c.getDoc().documentElement)if(b=Y.getRng(),c.getBody().focus(),"mousedown"==a.type){if(j.isCaretContainer(b.startContainer))return;Y.placeCaretAt(a.clientX,a.clientY)}else Y.setRng(b)})}function s(){c.on("keydown",function(a){if(!l(a)&&a.keyCode===V){if(!c.getBody().getElementsByTagName("hr").length)return;if(Y.isCollapsed()&&0===Y.getRng(!0).startOffset){var b=Y.getNode(),d=b.previousSibling;if("HR"==b.nodeName)return X.remove(b),void a.preventDefault();d&&d.nodeName&&"hr"===d.nodeName.toLowerCase()&&(X.remove(d),a.preventDefault())}}})}function t(){window.Range.prototype.getClientRects||c.on("mousedown",function(a){if(!l(a)&&"
HTML"===a.target.nodeName){var b=c.getBody();b.blur(),i.setEditorTimeout(c,function(){b.focus()})}})}function u(){c.on("click",function(a){var b=a.target;/^(IMG|HR)$/.test(b.nodeName)&&"false"!==X.getContentEditableParent(b)&&(a.preventDefault(),c.selection.select(b),c.nodeChanged()),"A"==b.nodeName&&X.hasClass(b,"mce-item-anchor")&&(a.preventDefault(),Y.select(b))})}function v(){function a(){var a=X.getAttribs(Y.getStart().cloneNode(!1));return function(){var b=Y.getStart();b!==c.getBody()&&(X.setAttrib(b,"style",null),U(a,function(a){b.setAttributeNode(a.cloneNode(!0))}))}}function b(){return!Y.isCollapsed()&&X.getParent(Y.getStart(),X.isBlock)!=X.getParent(Y.getEnd(),X.isBlock)}c.on("keypress",function(d){var e;if(!l(d)&&(8==d.keyCode||46==d.keyCode)&&b())return e=a(),c.getDoc().execCommand("delete",!1,null),e(),d.preventDefault(),!1}),X.bind(
c.getDoc(),"cut",function(d){var e;!l(d)&&b()&&(e=a(),i.setEditorTimeout(c,function(){e()}))})}function w(){document.body.setAttribute("role","application")}function x(){c.on("keydown",function(a){if(!l(a)&&a.keyCode===V&&Y.isCollapsed()&&0===Y.getRng(!0).startOffset){var b=Y.getNode().previousSibling;if(b&&b.nodeName&&"table"===b.nodeName.toLowerCase())return a.preventDefault(),!1}})}function y(){k()>7||(d("RespectVisibilityInDesign",!0),c.contentStyles.push(".mceHideBrInPre pre br {display: none}"),X.addClass(c.getBody(),"mceHideBrInPre"),$.addNodeFilter("pre",function(a){for(var b,c,d,f,g=a.length;g--;)for(b=a[g].getAll("br"),c=b.length;c--;)d=b[c],f=d.prev,f&&3===f.type&&"\n"!=f.value.charAt(f.value-1)?f.value+="\n":d.parent.insert(new e("#text",3),d,!0).value="\n"}),
_.addNodeFilter("pre",function(a){for(var b,c,d,e,f=a.length;f--;)for(b=a[f].getAll("br"),c=b.length;c--;)d=b[c],e=d.prev,e&&3==e.type&&(e.value=e.value.replace(/\r?\n$/,""))}))}function z(){X.bind(c.getBody(),"mouseup",function(){var a,b=Y.getNode();"IMG"==b.nodeName&&((a=X.getStyle(b,"width"))&&(X.setAttrib(b,"width",a.replace(/[^0-9%]+/g,"")),X.setStyle(b,"width","")),(a=X.getStyle(b,"height"))&&(X.setAttrib(b,"height",a.replace(/[^0-9%]+/g,"")),X.setStyle(b,"height","")))})}function A(){c.on("keydown",function(b){var d,e,f,g,h;if(!l(b)&&b.keyCode==a.BACKSPACE&&(d=Y.getRng(),e=d.startContainer,f=d.startOffset,g=X.getRoot(),h=e,d.collapsed&&0===f)){for(;h&&h.parentNode&&h.parentNode.firstChild==h&&h.parentNode!=g;)h=h.parentNode;"BL
OCKQUOTE"===h.tagName&&(c.formatter.toggle("blockquote",null,h),d=X.createRng(),d.setStart(e,0),d.setEnd(e,0),Y.setRng(d))}})}function B(){function a(){S(),d("StyleWithCSS",!1),d("enableInlineTableEditing",!1),Z.object_resizing||d("enableObjectResizing",!1)}Z.readonly||c.on("BeforeExecCommand MouseDown",a)}function C(){function a(){U(X.select("a"),function(a){var b=a.parentNode,c=X.getRoot();if(b.lastChild===a){for(;b&&!X.isBlock(b);){if(b.parentNode.lastChild!==b||b===c)return;b=b.parentNode}X.add(b,"br",{"data-mce-bogus":1})}})}c.on("SetContent ExecCommand",function(b){"setcontent"!=b.type&&"mceInsertLink"!==b.command||a()})}function D(){Z.forced_root_block&&c.on("init",function(){d("DefaultParagraphSeparator",Z.forced_root_block)})}function E(){c.on("keydown",function(a){var b;l(a)||a.keyCode!=V||(b=c.getD
oc().selection.createRange(),b&&b.item&&(a.preventDefault(),c.undoManager.beforeChange(),X.remove(b.item(0)),c.undoManager.add()))})}function F(){var a;k()>=10&&(a="",U("p div h1 h2 h3 h4 h5 h6".split(" "),function(b,c){a+=(c>0?",":"")+b+":empty"}),c.contentStyles.push(a+"{padding-right: 1px !important}"))}function G(){k()<9&&($.addNodeFilter("noscript",function(a){for(var b,c,d=a.length;d--;)b=a[d],c=b.firstChild,c&&b.attr("data-mce-innertext",c.value)}),_.addNodeFilter("noscript",function(a){for(var b,c,d,g=a.length;g--;)b=a[g],c=a[g].firstChild,c?c.value=f.decode(c.value):(d=b.attributes.map["data-mce-innertext"],d&&(b.attr("data-mce-innertext",null),c=new e("#text",3),c.value=d,c.raw=!0,b.append(c)))}))}function H(){function a(a,b){var c=h.createTextRange();try{c.moveToPoint(a,b)}catch(d){c=null
}return c}function b(b){var d;b.button?(d=a(b.x,b.y),d&&(d.compareEndPoints("StartToStart",e)>0?d.setEndPoint("StartToStart",e):d.setEndPoint("EndToEnd",e),d.select())):c()}function c(){var a=g.selection.createRange();e&&!a.item&&0===a.compareEndPoints("StartToEnd",a)&&e.select(),X.unbind(g,"mouseup",c),X.unbind(g,"mousemove",b),e=d=0}var d,e,f,g=X.doc,h=g.body;g.documentElement.unselectable=!0,X.bind(g,"mousedown contextmenu",function(h){if("HTML"===h.target.nodeName){if(d&&c(),f=g.documentElement,f.scrollHeight>f.clientHeight)return;d=1,e=a(h.x,h.y),e&&(X.bind(g,"mouseup",c),X.bind(g,"mousemove",b),X.getRoot().focus(),e.select())}})}function I(){c.on("keyup focusin mouseup",function(b){65==b.keyCode&&a.metaKeyPressed(b)||("keyup"!==b.type||c.selection.isCollapsed())&&Y.normalize()},!0)}function
J(){c.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")}function K(){c.inline||c.on("keydown",function(){document.activeElement==document.body&&c.getWin().focus()})}function L(){c.inline||(c.contentStyles.push("body {min-height: 150px}"),c.on("click",function(a){var b;if("HTML"==a.target.nodeName){if(g.ie>11)return void c.getBody().focus();b=c.selection.getRng(),c.getBody().focus(),c.selection.setRng(b),c.selection.normalize(),c.nodeChanged()}}))}function M(){g.mac&&c.on("keydown",function(b){!a.metaKeyPressed(b)||b.shiftKey||37!=b.keyCode&&39!=b.keyCode||(b.preventDefault(),c.selection.getSel().modify("move",37==b.keyCode?"backward":"forward","lineboundary"))})}function N(){d("AutoUrlDetect",!1)}function O(){c.on("click",function(a){var b=a.target;do if("A"===b.tagName)return
void a.preventDefault();while(b=b.parentNode)}),c.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")}function P(){c.on("init",function(){c.dom.bind(c.getBody(),"submit",function(a){a.preventDefault()})})}function Q(){$.addNodeFilter("br",function(a){for(var b=a.length;b--;)"Apple-interchange-newline"==a[b].attr("class")&&a[b].remove()})}function R(){c.on("dragstart",function(a){m(a)}),c.on("drop",function(a){if(!l(a)){var d=n(a);if(d&&d.id!=c.id){a.preventDefault();var e=b.getCaretRangeFromPoint(a.x,a.y,c.getDoc());Y.setRng(e),o(d.html,!0)}}})}function S(){}function T(){var a;return!aa||c.removed?0:(a=c.selection.getSel(),!a||!a.rangeCount||0===a.rangeCount)}var U=h.each,V=a.BACKSPACE,W=a.DELETE,X=c.dom,Y=c.selection,Z=c.settings,$=c.parser,_=c.serializer,aa=g.gecko,ba=g.ie,ca=g.webkit,da="data:text/mce-internal,",ea=ba?"Text":"URL";return
A(),p(),g.windowsPhone||I(),ca&&(r(),u(),D(),P(),x(),Q(),g.iOS?(K(),L(),O()):q()),ba&&g.ie<11&&(s(),w(),y(),z(),E(),F(),G(),H()),g.ie>=11&&(L(),x()),g.ie&&(q(),N(),R()),aa&&(s(),t(),v(),B(),C(),J(),M(),x()),{refreshContentEditable:S,isHidden:T}}}),g("tinymce.core.init.InitContentBody",["ephox.sugar.api.dom.Insert","ephox.sugar.api.node.Element","ephox.sugar.api.properties.Attr","global!document","global!window","tinymce.core.api.Formatter","tinymce.core.caret.CaretContainerInput","tinymce.core.dom.DOMUtils","tinymce.core.dom.Selection","tinymce.core.dom.Serializer","tinymce.core.EditorUpload","tinymce.core.ErrorReporter","tinymce.core.ForceBlocks","tinymce.core.html.DomParser","tinymce.core.html.Node","tinymce.core.html.Schema","tinymce.core.keyboard.Keyboa
rdOverrides","tinymce.core.NodeChange","tinymce.core.SelectionOverrides","tinymce.core.UndoManager","tinymce.core.util.Delay","tinymce.core.util.Quirks","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w){var x=h.DOM,y=function(d,e){var f=b.fromDom(d.getDoc().head),g=b.fromTag("style");c.set(g,"type","text/css"),a.append(g,b.fromText(e)),a.append(f,g)},z=function(a){var b=new n(a.settings,a.schema);return b.addAttributeFilter("src,href,style,tabindex",function(b,c){for(var d,e,f,g=b.length,h=a.dom;g--;)if(d=b[g],e=d.attr(c),f="data-mce-"+c,!d.attributes.map[f]){if(0===e.indexOf("data:")||0===e.indexOf("blob:"))continue;"style"===c?(e=h.serializeStyle(h.parseStyle(e),d.name),e.length||(e=null),d.attr(f,e),d.attr(c,e)):"tabindex"===c?(d.attr(f,e),d.attr(c,null)):d.attr(f,a.convertURL(e,c,d.name))}}),b.
addNodeFilter("script",function(a){for(var b,c,d=a.length;d--;)b=a[d],c=b.attr("type")||"no/type",0!==c.indexOf("mce-")&&b.attr("type","mce-"+c)}),b.addNodeFilter("#cdata",function(a){for(var b,c=a.length;c--;)b=a[c],b.type=8,b.name="#comment",b.value="[CDATA["+b.value+"]]"}),b.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(b){for(var c,d=b.length,e=a.schema.getNonEmptyElements();d--;)c=b[d],c.isEmpty(e)&&0===c.getAll("br").length&&(c.append(new o("br",1)).shortEnded=!0)}),b},A=function(a){a.settings.auto_focus&&u.setEditorTimeout(a,function(){var b;b=a.settings.auto_focus===!0?a:a.editorManager.get(a.settings.auto_focus),b.destroyed||b.focus()},100)},B=function(a){a.bindPendingEventDelegates(),a.initialized=!0,a.fire("init"),a.focus(!0),a.nodeChanged({initial:!0}),a.execCallback("init_instance_callback&quo
t;,a),A(a)},C=function(a){return a.inline?x.styleSheetLoader:a.dom.styleSheetLoader},D=function(a,b){var c,l,n=a.settings,o=a.getElement(),u=a.getDoc();n.inline||(a.getElement().style.visibility=a.orgVisibility),b||n.content_editable||(u.open(),u.write(a.iframeHTML),u.close()),n.content_editable&&(a.on("remove",function(){var a=this.getBody();x.removeClass(a,"mce-content-body"),x.removeClass(a,"mce-edit-focus"),x.setAttrib(a,"contentEditable",null)}),x.addClass(o,"mce-content-body"),a.contentDocument=u=n.content_document||d,a.contentWindow=n.content_window||e,a.bodyElement=o,n.content_document=n.content_window=null,n.root_name=o.nodeName.toLowerCase()),c=a.getBody(),c.disabled=!0,a.readonly=n.readonly,a.readonly||(a.inline&&"static"===x.getStyle(c,"position",!0)&&(c.style.position="relative"),c.contentEditable=a.getParam("content_editable_state",!0)),c.disabled=!1,a.edit
orUpload=new k(a),a.schema=new p(n),a.dom=new h(u,{keep_values:!0,url_converter:a.convertURL,url_converter_scope:a,hex_colors:n.force_hex_style_colors,class_filter:n.class_filter,update_styles:!0,root_element:a.inline?a.getBody():null,collect:n.content_editable,schema:a.schema,onSetAttrib:function(b){a.fire("SetAttrib",b)}}),a.parser=z(a),a.serializer=new j(n,a),a.selection=new i(a.dom,a.getWin(),a.serializer,a),a.formatter=new f(a),a.undoManager=new t(a),a._nodeChangeDispatcher=new r(a),a._selectionOverrides=new s(a),g.setup(a),q.setup(a),m.setup(a),a.fire("PreInit"),n.browser_spellcheck||n.gecko_spellcheck||(u.body.spellcheck=!1,x.setAttrib(c,"spellcheck","false")),a.quirks=new v(a),a.fire("PostRender"),n.directionality&&(c.dir=n.directionality),n.nowrap&&(c.style.whiteSpace="nowrap"),n.protect&&a.on("BeforeSetContent",function(a){w.each(n.protect,function(b){a.content=a.content.replace(b
,function(a){return"<!--mce:protected "+escape(a)+"-->"})})}),a.on("SetContent",function(){a.addVisual(a.getBody())}),n.padd_empty_editor&&a.on("PostProcess",function(a){a.content=a.content.replace(/^(<p[^>]*>( | |\s|\u00a0|<br \/>|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/,"")}),a.load({initial:!0,format:"html"}),a.startContent=a.getContent({format:"raw"}),a.on("compositionstart compositionend",function(b){a.composing="compositionstart"===b.type}),a.contentStyles.length>0&&(l="",w.each(a.contentStyles,function(a){l+=a+"\r\n"}),a.dom.addStyle(l)),C(a).loadAll(a.contentCSS,function(b){B(a)},function(b){B(a)}),n.content_style&&y(a,n.content_style)};return{initContentBody:D}}),g("tinymce.core.PluginManager",["tinymce.core.AddOnManager"],function(a){return a.PluginManager}),g("tinymce.cor
e.ThemeManager",["tinymce.core.AddOnManager"],function(a){return a.ThemeManager}),g("tinymce.core.init.Init",["global!document","global!window","tinymce.core.dom.DOMUtils","tinymce.core.Env","tinymce.core.init.InitContentBody","tinymce.core.PluginManager","tinymce.core.ThemeManager","tinymce.core.util.Tools","tinymce.core.util.Uuid"],function(a,b,c,d,e,f,g,h,i){var j=c.DOM,k=function(a,b,c){var d,e,g=f.get(c);if(d=f.urls[c]||a.documentBaseUrl.replace(/\/$/,""),c=h.trim(c),g&&h.inArray(b,c)===-1){if(h.each(f.dependencies(c),function(c){k(a,b,c)}),a.plugins[c])return;e=new g(a,d,a.$),a.plugins[c]=e,e.init&&(e.init(a,d),b.push(c))}},l=function(a){return a.replace(/^\-/,"")},m=function(a){var b=[];h.each(a.settings.plugins.split(/[ ,]/),function(c){k(a,b,l(c))})},n=function(a){var b,c=a.settings;c.theme&&("function"!=typ
eof c.theme?(c.theme=l(c.theme),b=g.get(c.theme),a.theme=new b(a,g.urls[c.theme]),a.theme.init&&a.theme.init(a,g.urls[c.theme]||a.documentBaseUrl.replace(/\/$/,""),a.$)):a.theme=c.theme)},o=function(a){var b,c,d,e,f,g=a.settings,h=a.getElement();return g.render_ui&&a.theme&&(a.orgDisplay=h.style.display,"function"!=typeof g.theme?(b=g.width||j.getStyle(h,"width")||"100%",c=g.height||j.getStyle(h,"height")||h.offsetHeight,d=g.min_height||100,e=/^[0-9\.]+(|px)$/i,e.test(""+b)&&(b=Math.max(parseInt(b,10),100)),e.test(""+c)&&(c=Math.max(parseInt(c,10),d)),f=a.theme.renderUI({targetNode:h,width:b,height:c,deltaWidth:g.delta_width,deltaHeight:g.delta_height}),g.content_editable||(c=(f.iframeHeight||c)+("number"==typeof c?f.deltaHeight||0:""),c<d&&(c=d))):(f=g.theme(a,h),f.editorContainer.nodeType&&(f.editorContainer.id=f.editorContainer.id||a
.id+"_parent"),f.iframeContainer.nodeType&&(f.iframeContainer.id=f.iframeContainer.id||a.id+"_iframecontainer"),c=f.iframeHeight||h.offsetHeight),a.editorContainer=f.editorContainer,f.height=c),f},p=function(c,f){if(a.domain!==b.location.hostname&&d.ie&&d.ie<12){var g=i.uuid("mce");c[g]=function(){e.initContentBody(c)};var h='javascript:(function(){document.open();document.domain="'+a.domain+'";var ed = window.parent.tinymce.get("'+c.id+'");document.write(ed.iframeHTML);document.close();ed.'+g+"(true);})()";return j.setAttrib(f,"src",h),!0}return!1},q=function(a,b){var c,e,f=a.settings;a.iframeHTML=f.doctype+"<html><head>",f.document_base_url!=a.documentBaseUrl&&(a.iframeHTML+='<base href="'+a.documentBaseURI.getURI()+'" />'),!d.caretAfter&&f.ie7_compat&&(a.iframeHTML+='<meta http-equiv="X-UA-Compatible" content=&
quot;IE=7" />'),a.iframeHTML+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />',c=f.body_id||"tinymce",c.indexOf("=")!=-1&&(c=a.getParam("body_id","","hash"),c=c[a.id]||c),e=f.body_class||"",e.indexOf("=")!=-1&&(e=a.getParam("body_class","","hash"),e=e[a.id]||""),f.content_security_policy&&(a.iframeHTML+='<meta http-equiv="Content-Security-Policy" content="'+f.content_security_policy+'" />'),a.iframeHTML+='</head><body id="'+c+'" class="mce-content-body '+e+'" data-id="'+a.id+'"><br></body></html>';var g=j.create("iframe",{id:a.id+"_ifr",frameBorder:"0",allowTransparency:"true",title:a.editorManager.translate("Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for t
oolbar. Press ALT-0 for help"),style:{width:"100%",height:b.height,display:"block"}});g.onload=function(){g.onload=null,a.fire("load")};var h=p(a,g);return a.contentAreaContainer=b.iframeContainer,a.iframeElement=g,j.add(b.iframeContainer,g),h},r=function(a){var b,c=a.settings,d=a.getElement();if(a.rtl=c.rtl_ui||a.editorManager.i18n.rtl,a.editorManager.i18n.setCode(c.language),c.aria_label=c.aria_label||j.getAttrib(d,"aria-label",a.getLang("aria.rich_text_area")),a.fire("ScriptsLoaded"),n(a),m(a),b=o(a),c.content_css&&h.each(h.explode(c.content_css),function(b){a.contentCSS.push(a.documentBaseURI.toAbsolute(b))}),c.content_editable)return e.initContentBody(a);var f=q(a,b);b.editorContainer&&(j.get(b.editorContainer).style.display=a.orgDisplay,a.hidden=j.isHidden(b.editorContainer)),a.getElement().style.display="none",j.setAttrib(a.id,"aria-hidden",!0),f||e.initContentBody(a)};return{
init:r}}),g("tinymce.core.init.Render",["global!window","tinymce.core.api.NotificationManager","tinymce.core.api.WindowManager","tinymce.core.dom.DOMUtils","tinymce.core.dom.EventUtils","tinymce.core.dom.ScriptLoader","tinymce.core.Env","tinymce.core.ErrorReporter","tinymce.core.init.Init","tinymce.core.PluginManager","tinymce.core.ThemeManager","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g,h,i,j,k,l){var m=d.DOM,n=function(a,b){var c=a.settings,d=f.ScriptLoader;if(c.language&&"en"!=c.language&&!c.language_url&&(c.language_url=a.editorManager.baseURL+"/langs/"+c.language+".js"),c.language_url&&d.add(c.language_url),c.theme&&"function"!=typeof c.theme&&"-"!=c.theme.charAt(0)&&!k.urls[c.theme]){var e=c.theme_url;e=e?a.documentBaseURI.toAbsolute(e):&
quot;themes/"+c.theme+"/theme"+b+".js",k.load(c.theme,e)}l.isArray(c.plugins)&&(c.plugins=c.plugins.join(" ")),l.each(c.external_plugins,function(a,b){j.load(b,a),c.plugins+=" "+b}),l.each(c.plugins.split(/[ ,]/),function(a){if(a=l.trim(a),a&&!j.urls[a])if("-"===a.charAt(0)){a=a.substr(1,a.length);var c=j.dependencies(a);l.each(c,function(a){var c={prefix:"plugins/",resource:a,suffix:"/plugin"+b+".js"};a=j.createUrl(c,a),j.load(a.resource,a)})}else j.load(a,{prefix:"plugins/",resource:a,suffix:"/plugin"+b+".js"})}),d.loadQueue(function(){a.removed||i.init(a)},a,function(b){h.pluginLoadError(a,b[0]),a.removed||i.init(a)})},o=function(d){function f(){m.unbind(a,"ready",f),d.render()}var h=d.settings,i=d.id;if(!e.Event.domLoaded)return void m.bind(a,"ready",f);if(d.getElement()&&g.contentEditable){h.inline?d.inline=!0:(d.orgVisib
ility=d.getElement().style.visibility,d.getElement().style.visibility="hidden");var j=d.getElement().form||m.getParent(i,"form");j&&(d.formElement=j,h.hidden_input&&!/TEXTAREA|INPUT/i.test(d.getElement().nodeName)&&(m.insertAfter(m.create("input",{type:"hidden",name:i}),i),d.hasHiddenInput=!0),d.formEventDelegate=function(a){d.fire(a.type,a)},m.bind(j,"submit reset",d.formEventDelegate),d.on("reset",function(){d.setContent(d.startContent,{format:"raw"})}),!h.submit_patch||j.submit.nodeType||j.submit.length||j._mceOldSubmit||(j._mceOldSubmit=j.submit,j.submit=function(){return d.editorManager.triggerSave(),d.setDirty(!1),j._mceOldSubmit(j)})),d.windowManager=new c(d),d.notificationManager=new b(d),"xml"===h.encoding&&d.on("GetContent",function(a){a.save&&(a.content=m.encode(a.content))}),h.add_form_submit_trigger&&d.on("submit",function()
{d.initialized&&d.save()}),h.add_unload_trigger&&(d._beforeUnload=function(){!d.initialized||d.destroyed||d.isHidden()||d.save({format:"raw",no_events:!0,set_dirty:!1})},d.editorManager.on("BeforeUnload",d._beforeUnload)),d.editorManager.add(d),n(d,d.suffix)}};return{render:o}}),g("tinymce.core.Mode",[],function(){function a(a,b,c){try{a.getDoc().execCommand(b,!1,c)}catch(d){}}function b(a){var b,c;return b=a.getBody(),c=function(b){a.dom.getParents(b.target,"a").length>0&&b.preventDefault()},a.dom.bind(b,"click",c),{unbind:function(){a.dom.unbind(b,"click",c)}}}function c(c,d){c._clickBlocker&&(c._clickBlocker.unbind(),c._clickBlocker=null),d?(c._clickBlocker=b(c),c.selection.controlSelection.hideResizeRect(),c.readonly=!0,c.getBody().contentEditable=!1):(c.readonly=!1,c.getBody().contentEditable=!0,a(c,"StyleWithCSS",!1),a(c,"enableInlineTableEditing",!1),a(c,"en
ableObjectResizing",!1),c.focus(),c.nodeChanged())}function d(a,b){var d=a.readonly?"readonly":"design";b!=d&&(a.initialized?c(a,"readonly"==b):a.on("init",function(){c(a,"readonly"==b)}),a.fire("SwitchMode",{mode:b}))}return{setMode:d}}),g("tinymce.core.Shortcuts",["tinymce.core.util.Tools","tinymce.core.Env"],function(a,b){var c=a.each,d=a.explode,e={f9:120,f10:121,f11:122},f=a.makeMap("alt,ctrl,shift,meta,access");return function(g){function h(a){var g,h,i={};c(d(a,"+"),function(a){a in f?i[a]=!0:/^[0-9]{2,}$/.test(a)?i.keyCode=parseInt(a,10):(i.charCode=a.charCodeAt(0),i.keyCode=e[a]||a.toUpperCase().charCodeAt(0))}),g=[i.keyCode];for(h in f)i[h]?g.push(h):i[h]=!1;return i.id=g.join(","),i.access&&(i.alt=!0,b.mac?i.ctrl=!0:i.shift=!0),i.meta&&(b.mac?i.meta=!0:(i.ctrl=!0,i.meta=!1)),i}function i(b,c,e,f){var i;return i=a.map(d(b,&quo
t;>"),h),i[i.length-1]=a.extend(i[i.length-1],{func:e,scope:f||g}),a.extend(i[0],{desc:g.translate(c),subpatterns:i.slice(1)})}function j(a){return a.altKey||a.ctrlKey||a.metaKey}function k(a){return"keydown"===a.type&&a.keyCode>=112&&a.keyCode<=123}function l(a,b){return!!b&&(b.ctrl==a.ctrlKey&&b.meta==a.metaKey&&(b.alt==a.altKey&&b.shift==a.shiftKey&&(!!(a.keyCode==b.keyCode||a.charCode&&a.charCode==b.charCode)&&(a.preventDefault(),!0))))}function m(a){return a.func?a.func.call(a.scope):null}var n=this,o={},p=[];g.on("keyup keypress keydown",function(a){!j(a)&&!k(a)||a.isDefaultPrevented()||(c(o,function(b){if(l(a,b))return p=b.subpatterns.slice(0),"keydown"==a.type&&m(b),!0}),l(a,p[0])&&(1===p.length&&"keydown"==a.type&&m(p[0]),p.shift()))}),n.add=function(b,e,f,h){var j;return j=f,"string"==typeof f?f=func
tion(){g.execCommand(j,!1,null)}:a.isArray(j)&&(f=function(){g.execCommand(j[0],j[1],j[2])}),c(d(a.trim(b.toLowerCase())),function(a){var b=i(a,e,f,h);o[b.id]=b}),!0},n.remove=function(a){var b=i(a);return!!o[b.id]&&(delete o[b.id],!0)}}}),g("tinymce.core.ui.Sidebar",[],function(){var a=function(a,b,c){var d=a.sidebars?a.sidebars:[];d.push({name:b,settings:c}),a.sidebars=d};return{add:a}}),g("tinymce.core.util.URI",["global!document","tinymce.core.util.Tools"],function(a,b){function c(b,g){var h,i,j=this;if(b=e(b),g=j.settings=g||{},h=g.base_uri,/^([\w\-]+):([^\/]{2})/i.test(b)||/^\s*#/.test(b))return void(j.source=b);var k=0===b.indexOf("//");0!==b.indexOf("/")||k||(b=(h?h.protocol||"http":"http")+"://mce_host"+b),/^[\w\-]*:?\/\//.test(b)||(i=g.base_uri?g.base_uri.path:new c(a.location.href).directory,""===g.base_uri.protocol?b="//mce_host"+j.toAbsPath(i,b):
(b=/([^#?]*)([#?]?.*)/.exec(b),b=(h&&h.protocol||"http")+"://mce_host"+j.toAbsPath(i,b[1])+b[2])),b=b.replace(/@@/g,"(mce_at)"),b=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(b),d(f,function(a,c){var d=b[c];d&&(d=d.replace(/\(mce_at\)/g,"@@")),j[a]=d}),h&&(j.protocol||(j.protocol=h.protocol),j.userInfo||(j.userInfo=h.userInfo),j.port||"mce_host"!==j.host||(j.port=h.port),j.host&&"mce_host"!==j.host||(j.host=h.host),j.source=""),k&&(j.protocol="")}var d=b.each,e=b.trim,f="source protocol authority userInfo user password host port relative path directory file query anchor".split(" "),g={ftp:21,http:80,https:443,mailto:25};return c.prototype={setPath:function(a){var b=this;a=/^(.*?)\/?(\w+)?$/.ex
ec(a),b.path=a[0],b.directory=a[1],b.file=a[2],b.source="",b.getURI()},toRelative:function(a){var b,d=this;if("./"===a)return a;if(a=new c(a,{base_uri:d}),"mce_host"!=a.host&&d.host!=a.host&&a.host||d.port!=a.port||d.protocol!=a.protocol&&""!==a.protocol)return a.getURI();var e=d.getURI(),f=a.getURI();return e==f||"/"==e.charAt(e.length-1)&&e.substr(0,e.length-1)==f?e:(b=d.toRelPath(d.path,a.path),a.query&&(b+="?"+a.query),a.anchor&&(b+="#"+a.anchor),b)},toAbsolute:function(a,b){return a=new c(a,{base_uri:this}),a.getURI(b&&this.isSameOrigin(a))},isSameOrigin:function(a){if(this.host==a.host&&this.protocol==a.protocol){if(this.port==a.port)return!0;var b=g[this.protocol];if(b&&(this.port||b)==(a.port||b))return!0}return!1},toRelPath:function(a,b){var c,d,e,f=0,g="";if(a=a.substring(0,a.lastIndexOf("/")),a=a.split("/&qu
ot;),c=b.split("/"),a.length>=c.length)for(d=0,e=a.length;d<e;d++)if(d>=c.length||a[d]!=c[d]){f=d+1;break}if(a.length<c.length)for(d=0,e=c.length;d<e;d++)if(d>=a.length||a[d]!=c[d]){f=d+1;break}if(1===f)return b;for(d=0,e=a.length-(f-1);d<e;d++)g+="../";for(d=f-1,e=c.length;d<e;d++)g+=d!=f-1?"/"+c[d]:c[d];return g},toAbsPath:function(a,b){var c,e,f,g=0,h=[];for(e=/\/$/.test(b)?"/":"",a=a.split("/"),b=b.split("/"),d(a,function(a){a&&h.push(a);
-}),a=h,c=b.length-1,h=[];c>=0;c--)0!==b[c].length&&"."!==b[c]&&(".."!==b[c]?g>0?g--:h.push(b[c]):g++);return c=a.length-g,f=c<=0?h.reverse().join("/"):a.slice(0,c).join("/")+"/"+h.reverse().join("/"),0!==f.indexOf("/")&&(f="/"+f),e&&f.lastIndexOf("/")!==f.length-1&&(f+=e),f},getURI:function(a){var b,c=this;return c.source&&!a||(b="",a||(b+=c.protocol?c.protocol+"://":"//",c.userInfo&&(b+=c.userInfo+"@"),c.host&&(b+=c.host),c.port&&(b+=":"+c.port)),c.path&&(b+=c.path),c.query&&(b+="?"+c.query),c.anchor&&(b+="#"+c.anchor),c.source=b),c.source}},c.parseDataUri=function(a){var b,c;return a=decodeURIComponent(a).split(","),c=/data:([^;]+)/.exec(a[0]),c&&(b=c[1]),{type:b,data:a[1]}},c.getDocumentBaseUrl=functio
n(a){var b;return b=0!==a.protocol.indexOf("http")&&"file:"!==a.protocol?a.href:a.protocol+"//"+a.host+a.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(b)&&(b=b.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(b)||(b+="/")),b},c}),g("tinymce.core.Editor",["tinymce.core.AddOnManager","tinymce.core.dom.DomQuery","tinymce.core.dom.DOMUtils","tinymce.core.EditorCommands","tinymce.core.EditorFocus","tinymce.core.EditorObservable","tinymce.core.EditorSettings","tinymce.core.Env","tinymce.core.html.Serializer","tinymce.core.init.Render","tinymce.core.Mode","tinymce.core.Shortcuts","tinymce.core.ui.Sidebar","tinymce.core.util.Tools","tinymce.core.util.URI","tinymce.core.util.Uuid"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){function q(c,e,f)
{var i,j,k=this;i=k.documentBaseUrl=f.documentBaseURL,j=f.baseURI,e=g.getEditorSettings(k,c,i,f.defaultSettings,e),k.settings=e,a.language=e.language||"en",a.languageLoad=e.language_load,a.baseURL=f.baseURL,k.id=c,k.setDirty(!1),k.plugins={},k.documentBaseURI=new o(e.document_base_url,{base_uri:j}),k.baseURI=j,k.contentCSS=[],k.contentStyles=[],k.shortcuts=new l(k),k.loadedCSS={},k.editorCommands=new d(k),k.suffix=f.suffix,k.editorManager=f,k.inline=e.inline,e.cache_suffix&&(h.cacheSuffix=e.cache_suffix.replace(/^[\?\&]+/,"")),e.override_viewport===!1&&(h.overrideViewPort=!1),f.fire("SetupEditor",k),k.execCallback("setup",k),k.$=b.overrideDefaults(function(){return{context:k.inline?k.getBody():k.getDoc(),element:k.getBody()}})}var r=c.DOM,s=n.extend,t=n.each,u=n.trim,v=n.resolve,w=h.ie;return q.prototype={render:function(){j.render(this)},focus:function(a){e.focus(this,a)},execCallback:function(a){var b,c=this,d=c.settings[
a];if(d)return c.callbackLookup&&(b=c.callbackLookup[a])&&(d=b.func,b=b.scope),"string"==typeof d&&(b=d.replace(/\.\w+$/,""),b=b?v(b):0,d=v(d),c.callbackLookup=c.callbackLookup||{},c.callbackLookup[a]={func:d,scope:b}),d.apply(b||c,Array.prototype.slice.call(arguments,1))},translate:function(a){if(a&&n.is(a,"string")){var b=this.settings.language||"en",c=this.editorManager.i18n;a=c.data[b+"."+a]||a.replace(/\{\#([^\}]+)\}/g,function(a,d){return c.data[b+"."+d]||"{#"+d+"}"})}return this.editorManager.translate(a)},getLang:function(a,b){return this.editorManager.i18n.data[(this.settings.language||"en")+"."+a]||(void 0!==b?b:"{#"+a+"}")},getParam:function(a,b,c){var d,e=a in this.settings?this.settings[a]:b;return"hash"===c?(d={},"string"==typeof e?t(e.indexOf("=")>0?e.split(/[;,](?![^=;,]*(?:[;,]|$))/):
e.split(","),function(a){a=a.split("="),a.length>1?d[u(a[0])]=u(a[1]):d[u(a[0])]=u(a)}):d=e,d):e},nodeChanged:function(a){this._nodeChangeDispatcher.nodeChanged(a)},addButton:function(a,b){var c=this;b.cmd&&(b.onclick=function(){c.execCommand(b.cmd)}),b.text||b.icon||(b.icon=a),c.buttons=c.buttons||{},b.tooltip=b.tooltip||b.title,c.buttons[a]=b},addSidebar:function(a,b){return m.add(this,a,b)},addMenuItem:function(a,b){var c=this;b.cmd&&(b.onclick=function(){c.execCommand(b.cmd)}),c.menuItems=c.menuItems||{},c.menuItems[a]=b},addContextToolbar:function(a,b){var c,d=this;d.contextToolbars=d.contextToolbars||[],"string"==typeof a&&(c=a,a=function(a){return d.dom.is(a,c)}),d.contextToolbars.push({id:p.uuid("mcet"),predicate:a,items:b})},addCommand:function(a,b,c){this.editorCommands.addCommand(a,b,c)},addQueryStateHandler:function(a,b,c){this.editorCommands.addQueryStateHandler(a,b,c)},addQueryValueHandler:function(a,b,
c){this.editorCommands.addQueryValueHandler(a,b,c)},addShortcut:function(a,b,c,d){this.shortcuts.add(a,b,c,d)},execCommand:function(a,b,c,d){return this.editorCommands.execCommand(a,b,c,d)},queryCommandState:function(a){return this.editorCommands.queryCommandState(a)},queryCommandValue:function(a){return this.editorCommands.queryCommandValue(a)},queryCommandSupported:function(a){return this.editorCommands.queryCommandSupported(a)},show:function(){var a=this;a.hidden&&(a.hidden=!1,a.inline?a.getBody().contentEditable=!0:(r.show(a.getContainer()),r.hide(a.id)),a.load(),a.fire("show"))},hide:function(){var a=this,b=a.getDoc();a.hidden||(w&&b&&!a.inline&&b.execCommand("SelectAll"),a.save(),a.inline?(a.getBody().contentEditable=!1,a==a.editorManager.focusedEditor&&(a.editorManager.focusedEditor=null)):(r.hide(a.getContainer()),r.setStyle(a.id,"display",a.orgDisplay)),a.hidden=!0,a.fire("hide"))},isHidden:func
tion(){return!!this.hidden},setProgressState:function(a,b){this.fire("ProgressState",{state:a,time:b})},load:function(a){var b,c=this,d=c.getElement();return c.removed?"":d?(a=a||{},a.load=!0,b=c.setContent(void 0!==d.value?d.value:d.innerHTML,a),a.element=d,a.no_events||c.fire("LoadContent",a),a.element=d=null,b):void 0},save:function(a){var b,c,d=this,e=d.getElement();if(e&&d.initialized&&!d.removed)return a=a||{},a.save=!0,a.element=e,b=a.content=d.getContent(a),a.no_events||d.fire("SaveContent",a),"raw"==a.format&&d.fire("RawSaveContent",a),b=a.content,/TEXTAREA|INPUT/i.test(e.nodeName)?e.value=b:(d.inline||(e.innerHTML=b),(c=r.getParent(d.id,"form"))&&t(c.elements,function(a){if(a.name==d.id)return a.value=b,!1})),a.element=e=null,a.set_dirty!==!1&&d.setDirty(!1),b},setContent:function(a,b){var c,d,e=this,f=e.getBody();return b=b||{},b.format=b.format||"html",
b.set=!0,b.content=a,b.no_events||e.fire("BeforeSetContent",b),a=b.content,0===a.length||/^\s+$/.test(a)?(d=w&&w<11?"":'<br data-mce-bogus="1">',"TABLE"==f.nodeName?a="<tr><td>"+d+"</td></tr>":/^(UL|OL)$/.test(f.nodeName)&&(a="<li>"+d+"</li>"),c=e.settings.forced_root_block,c&&e.schema.isValidChild(f.nodeName.toLowerCase(),c.toLowerCase())?(a=d,a=e.dom.createHTML(c,e.settings.forced_root_block_attrs,a)):w||a||(a='<br data-mce-bogus="1">'),e.dom.setHTML(f,a),e.fire("SetContent",b)):("raw"!==b.format&&(a=new i({validate:e.validate},e.schema).serialize(e.parser.parse(a,{isRootContent:!0}))),b.content=u(a),e.dom.setHTML(f,b.content),b.no_events||e.fire("SetContent",b)),b.content},getContent:function(a){var b,c=this,d=c.getBody();return c.removed?"":(a=a||{},a.format=a.format||&
quot;html",a.get=!0,a.getInner=!0,a.no_events||c.fire("BeforeGetContent",a),b="raw"==a.format?n.trim(c.serializer.getTrimmedContent()):"text"==a.format?d.innerText||d.textContent:c.serializer.serialize(d,a),"text"!=a.format?a.content=u(b):a.content=b,a.no_events||c.fire("GetContent",a),a.content)},insertContent:function(a,b){b&&(a=s({content:a},b)),this.execCommand("mceInsertContent",!1,a)},isDirty:function(){return!this.isNotDirty},setDirty:function(a){var b=!this.isNotDirty;this.isNotDirty=!a,a&&a!=b&&this.fire("dirty")},setMode:function(a){k.setMode(this,a)},getContainer:function(){var a=this;return a.container||(a.container=r.get(a.editorContainer||a.id+"_parent")),a.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return this.targetElm||(this.targetElm=r.get(this.id)),this.targetElm},getWin:function(){var a,b=this;retu
rn b.contentWindow||(a=b.iframeElement,a&&(b.contentWindow=a.contentWindow)),b.contentWindow},getDoc:function(){var a,b=this;return b.contentDocument||(a=b.getWin(),a&&(b.contentDocument=a.document)),b.contentDocument},getBody:function(){var a=this.getDoc();return this.bodyElement||(a?a.body:null)},convertURL:function(a,b,c){var d=this,e=d.settings;return e.urlconverter_callback?d.execCallback("urlconverter_callback",a,c,!0,b):!e.convert_urls||c&&"LINK"==c.nodeName||0===a.indexOf("file:")||0===a.length?a:e.relative_urls?d.documentBaseURI.toRelative(a):a=d.documentBaseURI.toAbsolute(a,e.remove_script_host)},addVisual:function(a){var b,c=this,d=c.settings,e=c.dom;a=a||c.getBody(),void 0===c.hasVisual&&(c.hasVisual=d.visual),t(e.select("table,a",a),function(a){var f;switch(a.nodeName){case"TABLE":return b=d.visual_table_class||"mce-item-table",f=e.getAttrib(a,"border"),void(f&&
"0"!=f||!c.hasVisual?e.removeClass(a,b):e.addClass(a,b));case"A":return void(e.getAttrib(a,"href",!1)||(f=e.getAttrib(a,"name")||a.id,b=d.visual_anchor_class||"mce-item-anchor",f&&c.hasVisual?e.addClass(a,b):e.removeClass(a,b)))}}),c.fire("VisualAid",{element:a,hasVisual:c.hasVisual})},remove:function(){var a=this;a.removed||(a.save(),a.removed=1,a.unbindAllNativeEvents(),a.hasHiddenInput&&r.remove(a.getElement().nextSibling),a.inline||(w&&w<10&&a.getDoc().execCommand("SelectAll",!1,null),r.setStyle(a.id,"display",a.orgDisplay),a.getBody().onload=null),a.fire("remove"),a.editorManager.remove(a),r.remove(a.getContainer()),a._selectionOverrides.destroy(),a.editorUpload.destroy(),a.destroy())},destroy:function(a){var b,c=this;if(!c.destroyed){if(!a&&!c.removed)return void c.remove();a||(c.editorManager.off("beforeunload",c._beforeUnload),c.theme
&&c.theme.destroy&&c.theme.destroy(),c.selection.destroy(),c.dom.destroy()),b=c.formElement,b&&(b._mceOldSubmit&&(b.submit=b._mceOldSubmit,b._mceOldSubmit=null),r.unbind(b,"submit reset",c.formEventDelegate)),c.contentAreaContainer=c.formElement=c.container=c.editorContainer=null,c.bodyElement=c.contentDocument=c.contentWindow=null,c.iframeElement=c.targetElm=null,c.selection&&(c.selection=c.selection.win=c.selection.dom=c.selection.dom.doc=null),c.destroyed=1}},uploadImages:function(a){return this.editorUpload.uploadImages(a)},_scanForImages:function(){return this.editorUpload.scanForImages()}},s(q.prototype,f),q}),g("tinymce.core.FocusManager",["tinymce.core.dom.DOMUtils","tinymce.core.util.Delay","tinymce.core.Env"],function(a,b,c){function d(a){function d(){try{return document.activeElement}catch(a){return document.body}}function j(a,b){if(b&&b.startContainer){if(!a.isChildOf(b.star
tContainer,a.getRoot())||!a.isChildOf(b.endContainer,a.getRoot()))return;return{startContainer:b.startContainer,startOffset:b.startOffset,endContainer:b.endContainer,endOffset:b.endOffset}}return b}function l(a,b){var c;return b.startContainer?(c=a.getDoc().createRange(),c.setStart(b.startContainer,b.startOffset),c.setEnd(b.endContainer,b.endOffset)):c=b,c}function m(e){var m=e.editor;m.on("init",function(){(m.inline||c.ie)&&("onbeforedeactivate"in document&&c.ie<9?m.dom.bind(m.getBody(),"beforedeactivate",function(a){if(a.target==m.getBody())try{m.lastRng=m.selection.getRng()}catch(b){}}):m.on("nodechange mouseup keyup",function(a){var b=d();"nodechange"==a.type&&a.selectionChange||(b&&b.id==m.id+"_ifr"&&(b=m.getBody()),m.dom.isChildOf(b,m.getBody())&&(m.lastRng=m.selection.getRng()))}))}),m.on("setcontent",function(){m.lastRng=null}),m.on("mousedown",f
unction(){m.selection.lastFocusBookmark=null}),m.on("focusin",function(){var b,c=a.focusedEditor;m.selection.lastFocusBookmark&&(b=l(m,m.selection.lastFocusBookmark),m.selection.lastFocusBookmark=null,m.selection.setRng(b)),c!=m&&(c&&c.fire("blur",{focusedEditor:m}),a.setActive(m),a.focusedEditor=m,m.fire("focus",{blurredEditor:c}),m.focus(!0)),m.lastRng=null}),m.on("focusout",function(){b.setEditorTimeout(m,function(){var b=a.focusedEditor;i(m,d())||b!=m||(m.fire("blur",{focusedEditor:null}),a.focusedEditor=null,m.selection&&(m.selection.lastFocusBookmark=null))})}),f||(f=function(b){var c,d=a.activeEditor;c=b.target,d&&c.ownerDocument===document&&(d.selection&&c!==d.getBody()&&k(m,c)&&(d.selection.lastFocusBookmark=j(d.dom,d.lastRng)),c===document.body||i(d,c)||a.focusedEditor!==d||(d.fire("blur",{focusedEditor:null}),a.focusedEditor=null))},h.bind(do
cument,"focusin",f)),m.inline&&!g&&(g=function(b){var c=a.activeEditor,d=c.dom;if(c.inline&&d&&!d.isChildOf(b.target,c.getBody())){var e=c.selection.getRng();e.collapsed||(c.lastRng=e)}},h.bind(document,"mouseup",g))}function n(b){a.focusedEditor==b.editor&&(a.focusedEditor=null),a.activeEditor||(h.unbind(document,"selectionchange",e),h.unbind(document,"focusin",f),h.unbind(document,"mouseup",g),e=f=g=null)}a.on("AddEditor",m),a.on("RemoveEditor",n)}var e,f,g,h=a.DOM,i=function(a,b){var c=a?a.settings.custom_ui_selector:"",e=h.getParent(b,function(b){return d.isEditorUIElement(b)||!!c&&a.dom.is(b,c)});return null!==e},j=function(a){return a.inline===!0},k=function(a,b){return j(a)===!1||a.dom.isChildOf(b,a.getBody())===!1};return d.isEditorUIElement=function(a){return a.className.toString().indexOf("mce-")!==-1},d._isUIElement=i,d}),g("tinymc
e.core.LegacyInput",["tinymce.core.util.Tools"],function(a){var b=a.each,c=a.explode,d=function(a){a.on("AddEditor",function(a){var d=a.editor;d.on("preInit",function(){function a(a,c){b(c,function(b,c){b&&h.setStyle(a,c,b)}),h.rename(a,"span")}function e(a){h=d.dom,i.convert_fonts_to_spans&&b(h.select("font,u,strike",a.node),function(a){f[a.nodeName.toLowerCase()](h,a)})}var f,g,h,i=d.settings;i.inline_styles&&(g=c(i.font_size_legacy_values),f={font:function(b,c){a(c,{backgroundColor:c.style.backgroundColor,color:c.color,fontFamily:c.face,fontSize:g[parseInt(c.size,10)-1]})},u:function(b,c){"html4"===d.settings.schema&&a(c,{textDecoration:"underline"})},strike:function(b,c){a(c,{textDecoration:"line-through"})}},d.on("PreProcess SetContent",e))})})};return{register:d}}),g("tinymce.core.util.I18n",["tinymce.core.util.Tools"],function(a){&
quot;use strict";var b={},c="en";return{setCode:function(a){a&&(c=a,this.rtl=!!this.data[a]&&"rtl"===this.data[a]._dir)},getCode:function(){return c},rtl:!1,add:function(a,c){var d=b[a];d||(b[a]=d={});for(var e in c)d[e]=c[e];this.setCode(a)},translate:function(d){function e(b){return a.is(b,"function")?Object.prototype.toString.call(b):f(b)?"":""+b}function f(b){return""===b||null===b||a.is(b,"undefined")}function g(b){return b=e(b),a.hasOwn(h,b)?e(h[b]):b}var h=b[c]||{};if(f(d))return"";if(a.is(d,"object")&&a.hasOwn(d,"raw"))return e(d.raw);if(a.is(d,"array")){var i=d.slice(1);d=g(d[0]).replace(/\{([0-9]+)\}/g,function(b,c){return a.hasOwn(i,c)?e(i[c]):b})}return g(d).replace(/{context:\w+}$/,"")},data:b}}),g("tinymce.core.EditorManager",["ephox.katamari.api.Arr","ephox.katamari.api.Type","tinymce.co
re.AddOnManager","tinymce.core.dom.DomQuery","tinymce.core.dom.DOMUtils","tinymce.core.Editor","tinymce.core.Env","tinymce.core.ErrorReporter","tinymce.core.FocusManager","tinymce.core.LegacyInput","tinymce.core.util.I18n","tinymce.core.util.Observable","tinymce.core.util.Promise","tinymce.core.util.Tools","tinymce.core.util.URI"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){function p(a){x(u.get(),function(b){"scroll"===a.type?b.fire("ScrollWindow",a):b.fire("ResizeWindow",a)})}function q(a){a!==A&&(a?d(window).on("resize scroll",p):d(window).off("resize scroll",p),A=a)}function r(b){var c=C;delete B[b.id];for(var d=0;d<B.length;d++)if(B[d]===b){B.splice(d,1);break}return C=a.filter(C,function(a){return b!==a}),u.activeEditor===b&&(u.activeEditor=C.length>0?C[0]:null),u.focusedEditor===b&&
amp;(u.focusedEditor=null),c.length!==C.length}function s(a){return a&&a.initialized&&!(a.getContainer()||a.getBody()).parentNode&&(r(a),a.unbindAllNativeEvents(),a.destroy(!0),a.removed=!0,a=null),a}var t,u,v=e.DOM,w=n.explode,x=n.each,y=n.extend,z=0,A=!1,B=[],C=[],D=function(a){return"length"!==a};return u={$:d,majorVersion:"4",minorVersion:"6.7",releaseDate:"2017-09-18",editors:B,i18n:k,activeEditor:null,settings:{},setup:function(){var a,b,c,d,e=this,f="";if(b=o.getDocumentBaseUrl(document.location),/^[^:]+:\/\/\/?[^\/]+\//.test(b)&&(b=b.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(b)||(b+="/")),c=window.tinymce||window.tinyMCEPreInit)a=c.base||c.baseURL,f=c.suffix;else{for(var g=document.getElementsByTagName("script"),h=0;h<g.length;h++){d=g[h].src;var j=d.substring(d.lastIndexOf("/"));if(/tinymce(\.full|\.jquery|)(\.min|\.d
ev|)\.js/.test(d)){j.indexOf(".min")!=-1&&(f=".min"),a=d.substring(0,d.lastIndexOf("/"));break}}!a&&document.currentScript&&(d=document.currentScript.src,d.indexOf(".min")!=-1&&(f=".min"),a=d.substring(0,d.lastIndexOf("/")))}e.baseURL=new o(b).toAbsolute(a),e.documentBaseURL=b,e.baseURI=new o(e.baseURL),e.suffix=f,e.focusManager=new i(e)},overrideDefaults:function(a){var b,d;b=a.base_url,b&&(this.baseURL=new o(this.documentBaseURL).toAbsolute(b.replace(/\/+$/,"")),this.baseURI=new o(this.baseURL)),d=a.suffix,a.suffix&&(this.suffix=d),this.defaultSettings=a;var e=a.plugin_base_urls;for(var f in e)c.PluginManager.urls[f]=e[f]},init:function(a){function b(a,b){return a.inline&&b.tagName.toLowerCase()in o}function c(a){var b=a.id;return b||(b=a.name,b=b&&!v.get(b)?a.name:v.uniqueId(),a.setAttribute("id",b)),b}function e(b){var c=a[b];if(c)return
c.apply(p,Array.prototype.slice.call(arguments,2))}function i(a,b){return b.constructor===RegExp?b.test(a.className):v.hasClass(a,b)}function j(a){var b,c=[];if(g.ie&&g.ie<11)return h.initError("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/"),[];if(a.types)return x(a.types,function(a){c=c.concat(v.select(a.selector))}),c;if(a.selector)return v.select(a.selector);if(a.target)return[a.target];switch(a.mode){case"exact":b=a.elements||"",b.length>0&&x(w(b),function(a){var b;(b=v.get(a))?c.push(b):x(document.forms,function(b){x(b.elements,function(b){b.name===a&&(a="mce_editor_"+z++,v.setAttrib(b,"id",a),c.push(b))})})});break;case"textareas":case"specific_textareas":x(v.select("textarea"),function(b){a.editor_deselector&&i(b,a.editor_deselector)||a.editor_sel
ector&&!i(b,a.editor_selector)||c.push(b)})}return c}function k(){function g(a,b,c){var d=new f(a,b,p);m.push(d),d.on("init",function(){++l===i.length&&q(m)}),d.targetElm=d.targetElm||c,d.render()}var i,l=0,m=[];return v.unbind(window,"ready",k),e("onpageload"),i=d.unique(j(a)),a.types?void x(a.types,function(b){n.each(i,function(d){return!v.is(d,b.selector)||(g(c(d),y({},a,b),d),!1)})}):(n.each(i,function(a){s(p.get(a.id))}),i=n.grep(i,function(a){return!p.get(a.id)}),void(0===i.length?q([]):x(i,function(d){b(a,d)?h.initError("Could not initialize inline editor on invalid inline target element",d):g(c(d),a,d)})))}var l,o,p=this;o=n.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option tbody tfoot thead tr script noscript style textarea video audio iframe object menu"," ");var q=function(a){l=a};return p.settings=a,v.bind(window,"ready"
,k),new m(function(a){l?a(l):q=function(b){a(b)}})},get:function(c){return 0===arguments.length?C.slice(0):b.isString(c)?a.find(C,function(a){return a.id===c}).getOr(null):b.isNumber(c)&&C[c]?C[c]:null},add:function(a){var b,c=this;return b=B[a.id],b===a?a:(null===c.get(a.id)&&(D(a.id)&&(B[a.id]=a),B.push(a),C.push(a)),q(!0),c.activeEditor=a,c.fire("AddEditor",{editor:a}),t||(t=function(){c.fire("BeforeUnload")},v.bind(window,"beforeunload",t)),a)},createEditor:function(a,b){return this.add(new f(a,b,this))},remove:function(a){var c,d,e=this;{if(a)return b.isString(a)?(a=a.selector||a,void x(v.select(a),function(a){d=e.get(a.id),d&&e.remove(d)})):(d=a,b.isNull(e.get(d.id))?null:(r(d)&&e.fire("RemoveEditor",{editor:d}),0===C.length&&v.unbind(window,"beforeunload",t),d.remove(),q(C.length>0),d));for(c=C.length-1;c>=0;c--)e.remove(C[c])}},execCommand:function(a,b,c){var d=this,e=d.ge
t(c);switch(a){case"mceAddEditor":return d.get(c)||new f(c,d.settings,d).render(),!0;case"mceRemoveEditor":return e&&e.remove(),!0;case"mceToggleEditor":return e?(e.isHidden()?e.show():e.hide(),!0):(d.execCommand("mceAddEditor",0,c),!0)}return!!d.activeEditor&&d.activeEditor.execCommand(a,b,c)},triggerSave:function(){x(C,function(a){a.save()})},addI18n:function(a,b){k.add(a,b)},translate:function(a){return k.translate(a)},setActive:function(a){var b=this.activeEditor;this.activeEditor!=a&&(b&&b.fire("deactivate",{relatedTarget:a}),a.fire("activate",{relatedTarget:b})),this.activeEditor=a}},y(u,l),u.setup(),j.register(u),u}),g("tinymce.core.geom.Rect",[],function(){"use strict";function a(a,b,c){var d,e,g,h,i,k;return d=b.x,e=b.y,g=a.w,h=a.h,i=b.w,k=b.h,c=(c||"").split(""),"b"===c[0]&&(e+=k),"r"===c[1]&&(d+=i),"c&
quot;===c[0]&&(e+=j(k/2)),"c"===c[1]&&(d+=j(i/2)),"b"===c[3]&&(e-=h),"r"===c[4]&&(d-=g),"c"===c[3]&&(e-=j(h/2)),"c"===c[4]&&(d-=j(g/2)),f(d,e,g,h)}function b(b,c,d,e){var f,g;for(g=0;g<e.length;g++)if(f=a(b,c,e[g]),f.x>=d.x&&f.x+f.w<=d.w+d.x&&f.y>=d.y&&f.y+f.h<=d.h+d.y)return e[g];return null}function c(a,b,c){return f(a.x-b,a.y-c,a.w+2*b,a.h+2*c)}function d(a,b){var c,d,e,g;return c=i(a.x,b.x),d=i(a.y,b.y),e=h(a.x+a.w,b.x+b.w),g=h(a.y+a.h,b.y+b.h),e-c<0||g-d<0?null:f(c,d,e-c,g-d)}function e(a,b,c){var d,e,g,h,j,k,l,m,n,o;return j=a.x,k=a.y,l=a.x+a.w,m=a.y+a.h,n=b.x+b.w,o=b.y+b.h,d=i(0,b.x-j),e=i(0,b.y-k),g=i(0,l-n),h=i(0,m-o),j+=d,k+=e,c&&(l+=d,m+=e,j-=g,k-=h),l-=g,m-=h,f(j,k,l-j,m-k)}function f(a,b,c,d){return{x:a,y:b,w:c,h:d}}function g(a){return f(a.left,a.top,a.width,a.height)}var h=Math.min,i=Math.max,j=Math.round;return{inflate
:c,relativePosition:a,findBestRelativePosition:b,intersect:d,clamp:e,create:f,fromClientRect:g}}),g("tinymce.core.ui.Layout",["tinymce.core.util.Class","tinymce.core.util.Tools"],function(a,b){"use strict";return a.extend({Defaults:{firstControlClass:"first",lastControlClass:"last"},init:function(a){this.settings=b.extend({},this.Defaults,a)},preRender:function(a){a.bodyClasses.add(this.settings.containerClass)},applyClasses:function(a){var b,c,d,e,f=this,g=f.settings;b=g.firstControlClass,c=g.lastControlClass,a.each(function(a){a.classes.remove(b).remove(c).add(g.controlClass),a.visible()&&(d||(d=a),e=a)}),d&&d.classes.add(b),e&&e.classes.add(c)},renderHtml:function(a){var b=this,c="";return b.applyClasses(a.items()),a.items().each(function(a){c+=a.renderHtml()}),c},recalc:function(){},postRender:function(){},isNative:function(){return!1}})}),g("tinymce.core.ui.AbsoluteLayout",[&
quot;tinymce.core.ui.Layout"],function(a){"use strict";return a.extend({Defaults:{containerClass:"abs-layout",controlClass:"abs-layout-item"},recalc:function(a){a.items().filter(":visible").each(function(a){var b=a.settings;a.layoutRect({x:b.x,y:b.y,w:b.w,h:b.h}),a.recalc&&a.recalc()})},renderHtml:function(a){return'<div id="'+a._id+'-absend" class="'+a.classPrefix+'abs-end"></div>'+this._super(a)}})}),g("tinymce.core.ui.Button",["tinymce.core.ui.Widget"],function(a){"use strict";return a.extend({Defaults:{classes:"widget btn",role:"button"},init:function(a){var b,c=this;c._super(a),a=c.settings,b=c.settings.size,c.on("click mousedown",function(a){a.preventDefault()}),c.on("touchstart",function(a){c.fire("click",a),a.preventDefault()}),a.subtype&&c.classes.add(a.subtype),b&&c.classes.add("btn-"+
b),a.icon&&c.icon(a.icon)},icon:function(a){return arguments.length?(this.state.set("icon",a),this):this.state.get("icon")},repaint:function(){var a,b=this.getEl().firstChild;b&&(a=b.style,a.width=a.height="100%"),this._super()},renderHtml:function(){var a,b=this,c=b._id,d=b.classPrefix,e=b.state.get("icon"),f=b.state.get("text"),g="";return a=b.settings.image,a?(e="none","string"!=typeof a&&(a=window.getSelection?a[0]:a[1]),a=" style=\"background-image: url('"+a+"')\""):a="",f&&(b.classes.add("btn-has-text"),g='<span class="'+d+'txt">'+b.encode(f)+"</span>"),e=e?d+"ico "+d+"i-"+e:"",'<div id="'+c+'" class="'+b.classes+'" tabindex="-1"><button id="'+c+'-button" role="presentation" type="button"
tabindex="-1">'+(e?'<i class="'+e+'"'+a+"></i>":"")+g+"</button></div>"},bindStates:function(){function a(a){var e=c("span."+d,b.getEl());a?(e[0]||(c("button:first",b.getEl()).append('<span class="'+d+'"></span>'),e=c("span."+d,b.getEl())),e.html(b.encode(a))):e.remove(),b.classes.toggle("btn-has-text",!!a)}var b=this,c=b.$,d=b.classPrefix+"txt";return b.state.on("change:text",function(b){a(b.value)}),b.state.on("change:icon",function(c){var d=c.value,e=b.classPrefix;b.settings.icon=d,d=d?e+"ico "+e+"i-"+b.settings.icon:"";var f=b.getEl().firstChild,g=f.getElementsByTagName("i")[0];d?(g&&g==f.firstChild||(g=document.createElement("i"),f.insertBefore(g,f.firstChild)),g.className=d):g&&f.removeChild(g),a(b.state.get("text"))}),b._super()}})}),g
("tinymce.core.ui.ButtonGroup",["tinymce.core.ui.Container"],function(a){"use strict";return a.extend({Defaults:{defaultType:"button",role:"group"},renderHtml:function(){var a=this,b=a._layout;return a.classes.add("btn-group"),a.preRender(),b.preRender(a),'<div id="'+a._id+'" class="'+a.classes+'"><div id="'+a._id+'-body">'+(a.settings.html||"")+b.renderHtml(a)+"</div></div>"}})}),g("tinymce.core.ui.Checkbox",["tinymce.core.ui.Widget"],function(a){"use strict";return a.extend({Defaults:{classes:"checkbox",role:"checkbox",checked:!1},init:function(a){var b=this;b._super(a),b.on("click mousedown",function(a){a.preventDefault()}),b.on("click",function(a){a.preventDefault(),b.disabled()||b.checked(!b.checked())}),b.checked(b.settings.checked)},checked:function(a){return arguments.length
?(this.state.set("checked",a),this):this.state.get("checked")},value:function(a){return arguments.length?this.checked(a):this.checked()},renderHtml:function(){var a=this,b=a._id,c=a.classPrefix;return'<div id="'+b+'" class="'+a.classes+'" unselectable="on" aria-labelledby="'+b+'-al" tabindex="-1"><i class="'+c+"ico "+c+'i-checkbox"></i><span id="'+b+'-al" class="'+c+'label">'+a.encode(a.state.get("text"))+"</span></div>"},bindStates:function(){function a(a){b.classes.toggle("checked",a),b.aria("checked",a)}var b=this;return b.state.on("change:text",function(a){b.getEl("al").firstChild.data=b.translate(a.value)}),b.state.on("change:checked change:value",function(c){b.fire("change"),a(c.value)}),b.state.on("change:icon",function(a){var c=a.value,d=b.cla
ssPrefix;if("undefined"==typeof c)return b.settings.icon;b.settings.icon=c,c=c?d+"ico "+d+"i-"+b.settings.icon:"";var e=b.getEl().firstChild,f=e.getElementsByTagName("i")[0];c?(f&&f==e.firstChild||(f=document.createElement("i"),e.insertBefore(f,e.firstChild)),f.className=c):f&&e.removeChild(f)}),b.state.get("checked")&&a(!0),b._super()}})}),g("tinymce.core.ui.ComboBox",["tinymce.core.ui.Widget","tinymce.core.ui.Factory","tinymce.core.ui.DomUtils","tinymce.core.dom.DomQuery","tinymce.core.util.VK","tinymce.core.util.Tools"],function(a,b,c,d,e,f){"use strict";return a.extend({init:function(a){var b=this;b._super(a),a=b.settings,b.classes.add("combobox"),b.subinput=!0,b.ariaTarget="inp",a.menu=a.menu||a.values,a.menu&&(a.icon="caret"),b.on("click",function(c){var e=c.
target,f=b.getEl();if(d.contains(f,e)||e==f)for(;e&&e!=f;)e.id&&e.id.indexOf("-open")!=-1&&(b.fire("action"),a.menu&&(b.showMenu(),c.aria&&b.menu.items()[0].focus())),e=e.parentNode}),b.on("keydown",function(a){var c;13==a.keyCode&&"INPUT"===a.target.nodeName&&(a.preventDefault(),b.parents().reverse().each(function(a){if(a.toJSON)return c=a,!1}),b.fire("submit",{data:c.toJSON()}))}),b.on("keyup",function(a){if("INPUT"==a.target.nodeName){var c=b.state.get("value"),d=a.target.value;d!==c&&(b.state.set("value",d),b.fire("autocomplete",a))}}),b.on("mouseover",function(a){var c=b.tooltip().moveTo(-65535);if(b.statusLevel()&&a.target.className.indexOf(b.classPrefix+"status")!==-1){var d=b.statusMessage()||"Ok",e=c.text(d).show().testMoveRel(a.target,["bc-tc","bc-tl",&qu
ot;bc-tr"]);c.classes.toggle("tooltip-n","bc-tc"==e),c.classes.toggle("tooltip-nw","bc-tl"==e),c.classes.toggle("tooltip-ne","bc-tr"==e),c.moveRel(a.target,e)}})},statusLevel:function(a){return arguments.length>0&&this.state.set("statusLevel",a),this.state.get("statusLevel")},statusMessage:function(a){return arguments.length>0&&this.state.set("statusMessage",a),this.state.get("statusMessage")},showMenu:function(){var a,c=this,d=c.settings;c.menu||(a=d.menu||[],a.length?a={type:"menu",items:a}:a.type=a.type||"menu",c.menu=b.create(a).parent(c).renderTo(c.getContainerElm()),c.fire("createmenu"),c.menu.reflow(),c.menu.on("cancel",function(a){a.control===c.menu&&c.focus()}),c.menu.on("show hide",function(a){a.control.items().each(function(a){a.active(a.value()==c.value())})}).fire("show"),c.menu
.on("select",function(a){c.value(a.control.value())}),c.on("focusin",function(a){"INPUT"==a.target.tagName.toUpperCase()&&c.menu.hide()}),c.aria("expanded",!0)),c.menu.show(),c.menu.layoutRect({w:c.layoutRect().w}),c.menu.moveRel(c.getEl(),c.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},focus:function(){this.getEl("inp").focus()},repaint:function(){var a,b,e=this,f=e.getEl(),g=e.getEl("open"),h=e.layoutRect(),i=0,j=f.firstChild;e.statusLevel()&&"none"!==e.statusLevel()&&(i=parseInt(c.getRuntimeStyle(j,"padding-right"),10)-parseInt(c.getRuntimeStyle(j,"padding-left"),10)),a=g?h.w-c.getSize(g).width-10:h.w-10;var k=document;return k.all&&(!k.documentMode||k.documentMode<=8)&&(b=e.layoutRect().h-2+"px"),d(j).css({width:a-i,lineHeight:b}),e._super(),e},postRender:function(){var a=this;return d(this.getEl(&q
uot;inp")).on("change",function(b){a.state.set("value",b.target.value),a.fire("change",b)}),a._super()},renderHtml:function(){var a,b,c=this,d=c._id,e=c.settings,f=c.classPrefix,g=c.state.get("value")||"",h="",i="",j="";return"spellcheck"in e&&(i+=' spellcheck="'+e.spellcheck+'"'),e.maxLength&&(i+=' maxlength="'+e.maxLength+'"'),e.size&&(i+=' size="'+e.size+'"'),e.subtype&&(i+=' type="'+e.subtype+'"'),j='<i id="'+d+'-status" class="mce-status mce-ico" style="display: none"></i>',c.disabled()&&(i+=' disabled="disabled"'),a=e.icon,a&&"caret"!=a&&(a=f+"ico "+f+"i-"+e.icon),b=c.state.get("text"),(a||b)&&(h='<div id="'+d+'-open" class="'+f+"btn "+f+'open" tabIndex="
;-1" role="button"><button id="'+d+'-action" type="button" hidefocus="1" tabindex="-1">'+("caret"!=a?'<i class="'+a+'"></i>':'<i class="'+f+'caret"></i>')+(b?(a?" ":"")+b:"")+"</button></div>",c.classes.add("has-open")),'<div id="'+d+'" class="'+c.classes+'"><input id="'+d+'-inp" class="'+f+'textbox" value="'+c.encode(g,!1)+'" hidefocus="1"'+i+' placeholder="'+c.encode(e.placeholder)+'" />'+j+h+"</div>"},value:function(a){return arguments.length?(this.state.set("value",a),this):(this.state.get("rendered")&&this.state.set("value",this.getEl("inp").value),this.state.get("value"))},showAutoComplete:function(a,c){var d=this;if(0===a.length)return void d.hid
eMenu();var e=function(a,b){return function(){d.fire("selectitem",{title:b,value:a})}};d.menu?d.menu.items().remove():d.menu=b.create({type:"menu",classes:"combobox-menu",layout:"flow"}).parent(d).renderTo(),f.each(a,function(a){d.menu.add({text:a.title,url:a.previewUrl,match:c,classes:"menu-item-ellipsis",onclick:e(a.value,a.title)})}),d.menu.renderNew(),d.hideMenu(),d.menu.on("cancel",function(a){a.control.parent()===d.menu&&(a.stopPropagation(),d.focus(),d.hideMenu())}),d.menu.on("select",function(){d.focus()});var g=d.layoutRect().w;d.menu.layoutRect({w:g,minW:0,maxW:g}),d.menu.reflow(),d.menu.show(),d.menu.moveRel(d.getEl(),d.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"])},hideMenu:function(){this.menu&&this.menu.hide()},bindStates:function(){var a=this;a.state.on("change:value",function(b){a.getEl("inp").value!=b.value&&(a.getE
l("inp").value=b.value)}),a.state.on("change:disabled",function(b){a.getEl("inp").disabled=b.value}),a.state.on("change:statusLevel",function(b){var d=a.getEl("status"),e=a.classPrefix,f=b.value;c.css(d,"display","none"===f?"none":""),c.toggleClass(d,e+"i-checkmark","ok"===f),c.toggleClass(d,e+"i-warning","warn"===f),c.toggleClass(d,e+"i-error","error"===f),a.classes.toggle("has-status","none"!==f),a.repaint()}),c.on(a.getEl("status"),"mouseleave",function(){a.tooltip().hide()}),a.on("cancel",function(b){a.menu&&a.menu.visible()&&(b.stopPropagation(),a.hideMenu())});var b=function(a,b){b&&b.items().length>0&&b.items().eq(a)[0].focus();
-};return a.on("keydown",function(c){var d=c.keyCode;"INPUT"===c.target.nodeName&&(d===e.DOWN?(c.preventDefault(),a.fire("autocomplete"),b(0,a.menu)):d===e.UP&&(c.preventDefault(),b(-1,a.menu)))}),a._super()},remove:function(){d(this.getEl("inp")).off(),this.menu&&this.menu.remove(),this._super()}})}),g("tinymce.core.ui.ColorBox",["tinymce.core.ui.ComboBox"],function(a){"use strict";return a.extend({init:function(a){var b=this;a.spellcheck=!1,a.onaction&&(a.icon="none"),b._super(a),b.classes.add("colorbox"),b.on("change keyup postrender",function(){b.repaintColor(b.value())})},repaintColor:function(a){var b=this.getEl("open"),c=b?b.getElementsByTagName("i")[0]:null;if(c)try{c.style.background=a}catch(d){}},bindStates:function(){var a=this;return a.state.on("change:value",function(b){a.state.get("rendered")&&
;a.repaintColor(b.value)}),a._super()}})}),g("tinymce.core.ui.PanelButton",["tinymce.core.ui.Button","tinymce.core.ui.FloatPanel"],function(a,b){"use strict";return a.extend({showPanel:function(){var a=this,c=a.settings;if(a.active(!0),a.panel)a.panel.show();else{var d=c.panel;d.type&&(d={layout:"grid",items:d}),d.role=d.role||"dialog",d.popover=!0,d.autohide=!0,d.ariaRoot=!0,a.panel=new b(d).on("hide",function(){a.active(!1)}).on("cancel",function(b){b.stopPropagation(),a.focus(),a.hidePanel()}).parent(a).renderTo(a.getContainerElm()),a.panel.fire("show"),a.panel.reflow()}var e=a.panel.testMoveRel(a.getEl(),c.popoverAlign||(a.isRtl()?["bc-tc","bc-tl","bc-tr"]:["bc-tc","bc-tr","bc-tl"]));a.panel.classes.toggle("start","bc-tl"===e),a.panel.classes.toggle("end","bc-tr"===e),a.panel.moveRel(
a.getEl(),e)},hidePanel:function(){var a=this;a.panel&&a.panel.hide()},postRender:function(){var a=this;return a.aria("haspopup",!0),a.on("click",function(b){b.control===a&&(a.panel&&a.panel.visible()?a.hidePanel():(a.showPanel(),a.panel.focus(!!b.aria)))}),a._super()},remove:function(){return this.panel&&(this.panel.remove(),this.panel=null),this._super()}})}),g("tinymce.core.ui.ColorButton",["tinymce.core.ui.PanelButton","tinymce.core.dom.DOMUtils"],function(a,b){"use strict";var c=b.DOM;return a.extend({init:function(a){this._super(a),this.classes.add("colorbutton")},color:function(a){return a?(this._color=a,this.getEl("preview").style.backgroundColor=a,this):this._color},resetColor:function(){return this._color=null,this.getEl("preview").style.backgroundColor=null,this},renderHtml:function(){var a=this,b=a._id,c=a.classPrefix,d=a.state.get("text"),e
=a.settings.icon?c+"ico "+c+"i-"+a.settings.icon:"",f=a.settings.image?" style=\"background-image: url('"+a.settings.image+"')\"":"",g="";return d&&(a.classes.add("btn-has-text"),g='<span class="'+c+'txt">'+a.encode(d)+"</span>"),'<div id="'+b+'" class="'+a.classes+'" role="button" tabindex="-1" aria-haspopup="true"><button role="presentation" hidefocus="1" type="button" tabindex="-1">'+(e?'<i class="'+e+'"'+f+"></i>":"")+'<span id="'+b+'-preview" class="'+c+'preview"></span>'+g+'</button><button type="button" class="'+c+'open" hidefocus="1" tabindex="-1"> <i class="'+c+'caret"></i></button></div>'
},postRender:function(){var a=this,b=a.settings.onclick;return a.on("click",function(d){d.aria&&"down"==d.aria.key||d.control!=a||c.getParent(d.target,"."+a.classPrefix+"open")||(d.stopImmediatePropagation(),b.call(a,d))}),delete a.settings.onclick,a._super()}})}),g("tinymce.core.util.Color",[],function(){function a(a){function e(a,e,f){var g,h,i,j,k,l;return g=0,h=0,i=0,a/=255,e/=255,f/=255,k=b(a,b(e,f)),l=c(a,c(e,f)),k==l?(i=k,{h:0,s:0,v:100*i}):(j=a==k?e-f:f==k?a-e:f-a,g=a==k?3:f==k?1:5,g=60*(g-j/(l-k)),h=(l-k)/l,i=l,{h:d(g),s:d(100*h),v:d(100*i)})}function f(a,e,f){var g,h,i,j;if(a=(parseInt(a,10)||0)%360,e=parseInt(e,10)/100,f=parseInt(f,10)/100,e=c(0,b(e,1)),f=c(0,b(f,1)),0===e)return void(l=m=n=d(255*f));switch(g=a/60,h=f*e,i=h*(1-Math.abs(g%2-1)),j=f-h,Math.floor(g)){case 0:l=h,m=i,n=0;break;case 1:l=i,m=h,n=0;break;case 2:l=0,m=h,n=i;break;case 3:l=0,m=i,n=h;break;case 4:l=i,m=0,n=h;break;case 5:l=h,m=0,n=i;break;def
ault:l=m=n=0}l=d(255*(l+j)),m=d(255*(m+j)),n=d(255*(n+j))}function g(){function a(a){return a=parseInt(a,10).toString(16),a.length>1?a:"0"+a}return"#"+a(l)+a(m)+a(n)}function h(){return{r:l,g:m,b:n}}function i(){return e(l,m,n)}function j(a){var b;return"object"==typeof a?"r"in a?(l=a.r,m=a.g,n=a.b):"v"in a&&f(a.h,a.s,a.v):(b=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(a))?(l=parseInt(b[1],10),m=parseInt(b[2],10),n=parseInt(b[3],10)):(b=/#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(a))?(l=parseInt(b[1],16),m=parseInt(b[2],16),n=parseInt(b[3],16)):(b=/#([0-F])([0-F])([0-F])/gi.exec(a))&&(l=parseInt(b[1]+b[1],16),m=parseInt(b[2]+b[2],16),n=parseInt(b[3]+b[3],16)),l=l<0?0:l>255?255:l,m=m<0?0:m>255?255:m,n=n<0?0:n>255?255:n,k}var k=this,l=0,m=0,n=0;a&&j(a),k.toRgb=h,k.toHsv=i,k.toHex=g,k.parse=j}var b=Math.min,c=Math.max,d=Math.round;return a}),g("tinymce.core.ui.ColorPi
cker",["tinymce.core.ui.Widget","tinymce.core.ui.DragHelper","tinymce.core.ui.DomUtils","tinymce.core.util.Color"],function(a,b,c,d){"use strict";return a.extend({Defaults:{classes:"widget colorpicker"},init:function(a){this._super(a)},postRender:function(){function a(a,b){var d,e,f=c.getPos(a);return d=b.pageX-f.x,e=b.pageY-f.y,d=Math.max(0,Math.min(d/a.clientWidth,1)),e=Math.max(0,Math.min(e/a.clientHeight,1)),{x:d,y:e}}function e(a,b){var e=(360-a.h)/360;c.css(j,{top:100*e+"%"}),b||c.css(l,{left:a.s+"%",top:100-a.v+"%"}),k.style.background=new d({s:100,v:100,h:a.h}).toHex(),m.color().parse({s:a.s,v:a.v,h:a.h})}function f(b){var c;c=a(k,b),h.s=100*c.x,h.v=100*(1-c.y),e(h),m.fire("change")}function g(b){var c;c=a(i,b),h=n.toHsv(),h.h=360*(1-c.y),e(h,!0),m.fire("change")}var h,i,j,k,l,m=this,n=m.color();i=m.getEl("h"),j=m.getEl("hp"),k=m.getEl("
sv"),l=m.getEl("svp"),m._repaint=function(){h=n.toHsv(),e(h)},m._super(),m._svdraghelper=new b(m._id+"-sv",{start:f,drag:f}),m._hdraghelper=new b(m._id+"-h",{start:g,drag:g}),m._repaint()},rgb:function(){return this.color().toRgb()},value:function(a){var b=this;return arguments.length?(b.color().parse(a),void(b._rendered&&b._repaint())):b.color().toHex()},color:function(){return this._color||(this._color=new d),this._color},renderHtml:function(){function a(){var a,b,c,d,g="";for(c="filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=",d=f.split(","),a=0,b=d.length-1;a<b;a++)g+='<div class="'+e+'colorpicker-h-chunk" style="height:'+100/b+"%;"+c+d[a]+",endColorstr="+d[a+1]+");-ms-"+c+d[a]+",endColorstr="+d[a+1]+')"></div>';return g}var b,c=this,d=c._id,e=c.classPrefix,f="#ff0000,#ff0080,#ff00ff,#8000ff,#0000
ff,#0080ff,#00ffff,#00ff80,#00ff00,#80ff00,#ffff00,#ff8000,#ff0000",g="background: -ms-linear-gradient(top,"+f+");background: linear-gradient(to bottom,"+f+");";return b='<div id="'+d+'-h" class="'+e+'colorpicker-h" style="'+g+'">'+a()+'<div id="'+d+'-hp" class="'+e+'colorpicker-h-marker"></div></div>','<div id="'+d+'" class="'+c.classes+'"><div id="'+d+'-sv" class="'+e+'colorpicker-sv"><div class="'+e+'colorpicker-overlay1"><div class="'+e+'colorpicker-overlay2"><div id="'+d+'-svp" class="'+e+'colorpicker-selector1"><div class="'+e+'colorpicker-selector2"></div></div></div></div></div>'+b+"</div>"}})}),g("tinymce.core.ui.Path",["tinymce.core.ui.Widget"],function(a){"use strict"
;;return a.extend({init:function(a){var b=this;a.delimiter||(a.delimiter="\xbb"),b._super(a),b.classes.add("path"),b.canFocus=!0,b.on("click",function(a){var c,d=a.target;(c=d.getAttribute("data-index"))&&b.fire("select",{value:b.row()[c],index:c})}),b.row(b.settings.row)},focus:function(){var a=this;return a.getEl().firstChild.focus(),a},row:function(a){return arguments.length?(this.state.set("row",a),this):this.state.get("row")},renderHtml:function(){var a=this;return'<div id="'+a._id+'" class="'+a.classes+'">'+a._getDataPathHtml(a.state.get("row"))+"</div>"},bindStates:function(){var a=this;return a.state.on("change:row",function(b){a.innerHtml(a._getDataPathHtml(b.value))}),a._super()},_getDataPathHtml:function(a){var b,c,d=this,e=a||[],f="",g=d.classPrefix;for(b=0,c=e.length;b<c;b++)f+=(b>0?'<div class="'+g+'divider&
quot; aria-hidden="true"> '+d.settings.delimiter+" </div>":"")+'<div role="button" class="'+g+"path-item"+(b==c-1?" "+g+"last":"")+'" data-index="'+b+'" tabindex="-1" id="'+d._id+"-"+b+'" aria-level="'+(b+1)+'">'+e[b].name+"</div>";return f||(f='<div class="'+g+'path-item">\xa0</div>'),f}})}),g("tinymce.core.ui.ElementPath",["tinymce.core.ui.Path"],function(a){return a.extend({postRender:function(){function a(a){if(1===a.nodeType){if("BR"==a.nodeName||a.getAttribute("data-mce-bogus"))return!0;if("bookmark"===a.getAttribute("data-mce-type"))return!0}return!1}var b=this,c=b.settings.editor;return c.settings.elementpath!==!1&&(b.on("select",function(a){c.focus(),c.selection.select(this.row()[a.index].element),c.nodeChan
ged()}),c.on("nodeChange",function(d){for(var e=[],f=d.parents,g=f.length;g--;)if(1==f[g].nodeType&&!a(f[g])){var h=c.fire("ResolveName",{name:f[g].nodeName.toLowerCase(),target:f[g]});if(h.isDefaultPrevented()||e.push({name:h.name,element:f[g]}),h.isPropagationStopped())break}b.row(e)})),b._super()}})}),g("tinymce.core.ui.FormItem",["tinymce.core.ui.Container"],function(a){"use strict";return a.extend({Defaults:{layout:"flex",align:"center",defaults:{flex:1}},renderHtml:function(){var a=this,b=a._layout,c=a.classPrefix;return a.classes.add("formitem"),b.preRender(a),'<div id="'+a._id+'" class="'+a.classes+'" hidefocus="1" tabindex="-1">'+(a.settings.title?'<div id="'+a._id+'-title" class="'+c+'title">'+a.settings.title+"</div>":"")+'<div id="'+a._id+'-body" class="'+a.bodyClasses+'
">'+(a.settings.html||"")+b.renderHtml(a)+"</div></div>"}})}),g("tinymce.core.ui.Form",["tinymce.core.ui.Container","tinymce.core.ui.FormItem","tinymce.core.util.Tools"],function(a,b,c){"use strict";return a.extend({Defaults:{containerCls:"form",layout:"flex",direction:"column",align:"stretch",flex:1,padding:20,labelGap:30,spacing:10,callbacks:{submit:function(){this.submit()}}},preRender:function(){var a=this,d=a.items();a.settings.formItemDefaults||(a.settings.formItemDefaults={layout:"flex",autoResize:"overflow",defaults:{flex:1}}),d.each(function(d){var e,f=d.settings.label;f&&(e=new b(c.extend({items:{type:"label",id:d._id+"-l",text:f,flex:0,forId:d._id,disabled:d.disabled()}},a.settings.formItemDefaults)),e.type="formitem",d.aria("labelledby",d._id+"-l"),"undefined&qu
ot;==typeof d.settings.flex&&(d.settings.flex=1),a.replace(d,e),e.add(d))})},submit:function(){return this.fire("submit",{data:this.toJSON()})},postRender:function(){var a=this;a._super(),a.fromJSON(a.settings.data)},bindStates:function(){function a(){var a,c,d,e=0,f=[];if(b.settings.labelGapCalc!==!1)for(d="children"==b.settings.labelGapCalc?b.find("formitem"):b.items(),d.filter("formitem").each(function(a){var b=a.items()[0],c=b.getEl().clientWidth;e=c>e?c:e,f.push(b)}),c=b.settings.labelGap||0,a=f.length;a--;)f[a].settings.minWidth=e+c}var b=this;b._super(),b.on("show",a),a()}})}),g("tinymce.core.ui.FieldSet",["tinymce.core.ui.Form"],function(a){"use strict";return a.extend({Defaults:{containerCls:"fieldset",layout:"flex",direction:"column",align:"stretch",flex:1,padding:"25 15 5 15",labelGap:30,spacing:10,border:1},renderHtml:function(){var
a=this,b=a._layout,c=a.classPrefix;return a.preRender(),b.preRender(a),'<fieldset id="'+a._id+'" class="'+a.classes+'" hidefocus="1" tabindex="-1">'+(a.settings.title?'<legend id="'+a._id+'-title" class="'+c+'fieldset-title">'+a.settings.title+"</legend>":"")+'<div id="'+a._id+'-body" class="'+a.bodyClasses+'">'+(a.settings.html||"")+b.renderHtml(a)+"</div></fieldset>"}})}),g("tinymce.core.content.LinkTargets",["ephox.sugar.api.node.Element","ephox.sugar.api.search.SelectorFilter","tinymce.core.dom.DOMUtils","tinymce.core.dom.NodeType","tinymce.core.util.Arr","tinymce.core.util.Fun","tinymce.core.util.Tools","tinymce.core.util.Uuid"],function(a,b,c,d,e,f,g,h){var i=g.trim,j=function(a,b,c,d,e){return{type:a,title:b,url:c,level:d,attach:e}},
k=function(a){for(;a=a.parentNode;){var b=a.contentEditable;if(b&&"inherit"!==b)return d.isContentEditableTrue(a)}return!1},l=function(c,d){return e.map(b.descendants(a.fromDom(d),c),function(a){return a.dom()})},m=function(a){return a.innerText||a.textContent},n=function(a){return a.id?a.id:h.uuid("h")},o=function(a){return a&&"A"===a.nodeName&&(a.id||a.name)},p=function(a){return o(a)&&r(a)},q=function(a){return a&&/^(H[1-6])$/.test(a.nodeName)},r=function(a){return k(a)&&!d.isContentEditableFalse(a)},s=function(a){return q(a)&&r(a)},t=function(a){return q(a)?parseInt(a.nodeName.substr(1),10):0},u=function(a){var b=n(a),c=function(){a.id=b};return j("header",m(a),"#"+b,t(a),c)},v=function(a){var b=a.id||a.name,c=m(a);return j("anchor",c?c:"#"+b,"#"+b,0,f.noop)},w=function(a){return e.map(e.filter(a,s),u)},x=function(a){return e.map(e.filter(a,p),v
)},y=function(a){var b=l("h1,h2,h3,h4,h5,h6,a:not([href])",a);return b},z=function(a){return i(a.title).length>0},A=function(a){var b=y(a);return e.filter(w(b).concat(x(b)),z)};return{find:A}}),g("tinymce.core.ui.FilePicker",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","global!window","tinymce.core.content.LinkTargets","tinymce.core.EditorManager","tinymce.core.ui.ComboBox","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g){"use strict";var h=function(){return c.tinymce?c.tinymce.activeEditor:e.activeEditor},i={},j=5,k=function(a){return{title:a.title,value:{title:{raw:a.title},url:a.url,attach:a.attach}}},l=function(a){return g.map(a,k)},m=function(a,c){return{title:a,value:{title:a,url:c,attach:b.noop}}},n=function(b,c){var d=a.exists(c,function(a){return a.url===b});return!d},o=function(a,b,c){var d=b in a?a[b]:c;return d===!1?null:d},p=function(c,d,e,f){var h={title:"
;-"},j=function(c){var f=c.hasOwnProperty(e)?c[e]:[],h=a.filter(f,function(a){return n(a,d)});return g.map(h,function(a){return{title:a,value:{title:a,url:a,attach:b.noop}}})},k=function(b){var c=a.filter(d,function(a){return a.type===b});return l(c)},p=function(){var a=k("anchor"),b=o(f,"anchor_top","#top"),c=o(f,"anchor_bottom","#bottom");return null!==b&&a.unshift(m("<top>",b)),null!==c&&a.push(m("<bottom>",c)),a},q=function(b){return a.foldl(b,function(a,b){var c=0===a.length||0===b.length;return c?a.concat(b):a.concat(h,b)},[])};return f.typeahead_urls===!1?[]:"file"===e?q([r(c,j(i)),r(c,k("header")),r(c,p())]):r(c,j(i))},q=function(b,c){var d=i[c];/^https?/.test(b)&&(d?a.indexOf(d,b)===-1&&(i[c]=d.slice(0,j).concat(b)):i[c]=[b])},r=function(a,b){var c=a.toLowerCase(),d=g.grep(b,function(a){return a.title.toLowerCase().indexOf(c)!==-1});retu
rn 1===d.length&&d[0].title===a?[]:d},s=function(a){var b=a.title;return b.raw?b.raw:b},t=function(a,b,c,e){var f=function(f){var g=d.find(c),h=p(f,g,e,b);a.showAutoComplete(h,f)};a.on("autocomplete",function(){f(a.value())}),a.on("selectitem",function(b){var c=b.value;a.value(c.url);var d=s(c);"image"===e?a.fire("change",{meta:{alt:d,attach:c.attach}}):a.fire("change",{meta:{text:d,attach:c.attach}}),a.focus()}),a.on("click",function(b){0===a.value().length&&"INPUT"===b.target.nodeName&&f("")}),a.on("PostRender",function(){a.getRoot().on("submit",function(b){b.isDefaultPrevented()||q(a.value(),e)})})},u=function(a){var b=a.status,c=a.message;return"valid"===b?{status:"ok",message:c}:"unknown"===b?{status:"warn",message:c}:"invalid"===b?{status:"warn",message:c}:{status:"none",message:"&
quot;}},v=function(a,b,c){var d=b.filepicker_validator_handler;if(d){var e=function(b){return 0===b.length?void a.statusLevel("none"):void d({url:b,type:c},function(b){var c=u(b);a.statusMessage(c.message),a.statusLevel(c.status)})};a.state.on("change:value",function(a){e(a.value)})}};return f.extend({init:function(a){var b,d,e,f=this,i=h(),j=i.settings,k=a.filetype;a.spellcheck=!1,e=j.file_picker_types||j.file_browser_callback_types,e&&(e=g.makeMap(e,/[, ]/)),e&&!e[k]||(d=j.file_picker_callback,!d||e&&!e[k]?(d=j.file_browser_callback,!d||e&&!e[k]||(b=function(){d(f.getEl("inp").id,f.value(),k,c)})):b=function(){var a=f.fire("beforecall").meta;a=g.extend({filetype:k},a),d.call(i,function(a,b){f.value(a).fire("change",{meta:b})},f.value(),a)}),b&&(a.icon="browse",a.onaction=b),f._super(a),t(f,j,i.getBody(),k),v(f,j,k)}})}),g("tinymce.core.ui.FitLayout",["tinymce.core.ui.
AbsoluteLayout"],function(a){"use strict";return a.extend({recalc:function(a){var b=a.layoutRect(),c=a.paddingBox;a.items().filter(":visible").each(function(a){a.layoutRect({x:c.left,y:c.top,w:b.innerW-c.right-c.left,h:b.innerH-c.top-c.bottom}),a.recalc&&a.recalc()})}})}),g("tinymce.core.ui.FlexLayout",["tinymce.core.ui.AbsoluteLayout"],function(a){"use strict";return a.extend({recalc:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N=[],O=Math.max,P=Math.min;for(d=a.items().filter(":visible"),e=a.layoutRect(),f=a.paddingBox,g=a.settings,m=a.isRtl()?g.direction||"row-reversed":g.direction,h=g.align,i=a.isRtl()?g.pack||"end":g.pack,j=g.spacing||0,"row-reversed"!=m&&"column-reverse"!=m||(d=d.set(d.toArray().reverse()),m=m.split("-")[0]),"column"==m?(z="y",x="h",y="minH",A=&q
uot;maxH",C="innerH",B="top",D="deltaH",E="contentH",J="left",H="w",F="x",G="innerW",I="minW",K="right",L="deltaW",M="contentW"):(z="x",x="w",y="minW",A="maxW",C="innerW",B="left",D="deltaW",E="contentW",J="top",H="h",F="y",G="innerH",I="minH",K="bottom",L="deltaH",M="contentH"),l=e[C]-f[B]-f[B],w=k=0,b=0,c=d.length;b<c;b++)n=d[b],o=n.layoutRect(),p=n.settings,q=p.flex,l-=b<c-1?j:0,q>0&&(k+=q,o[A]&&N.push(n),o.flex=q),l-=o[y],r=f[J]+o[I]+f[K],r>w&&(w=r);if(u={},l<0?u[y]=e[y]-l+e[D]:u[y]=e[C]-l+e[D],u[I]=w+e[L],u[E]=e[C]-l,u[M]=w,u.minW=P(u.minW,e.maxW),u.minH=P(u.minH,e.maxH),u.minW=O(u.minW,e.startMinWidth),u.minH=O(u.minH,e.startMinHeight),!e.autoResize||u.minW==
e.minW&&u.minH==e.minH){for(t=l/k,b=0,c=N.length;b<c;b++)n=N[b],o=n.layoutRect(),s=o[A],r=o[y]+o.flex*t,r>s?(l-=o[A]-o[y],k-=o.flex,o.flex=0,o.maxFlexSize=s):o.maxFlexSize=0;for(t=l/k,v=f[B],u={},0===k&&("end"==i?v=l+f[B]:"center"==i?(v=Math.round(e[C]/2-(e[C]-l)/2)+f[B],v<0&&(v=f[B])):"justify"==i&&(v=f[B],j=Math.floor(l/(d.length-1)))),u[F]=f[J],b=0,c=d.length;b<c;b++)n=d[b],o=n.layoutRect(),r=o.maxFlexSize||o[y],"center"===h?u[F]=Math.round(e[G]/2-o[H]/2):"stretch"===h?(u[H]=O(o[I]||0,e[G]-f[J]-f[K]),u[F]=f[J]):"end"===h&&(u[F]=e[G]-o[H]-f.top),o.flex>0&&(r+=o.flex*t),u[x]=r,u[z]=v,n.layoutRect(u),n.recalc&&n.recalc(),v+=r+j}else if(u.w=u.minW,u.h=u.minH,a.layoutRect(u),this.recalc(a),null===a._lastRect){var Q=a.parent();Q&&(Q._lastRect=null,Q.recalc())}}})}),g("tinymce.core.ui.FlowLayout",["tinymce.core.ui.Layout"],functio
n(a){return a.extend({Defaults:{containerClass:"flow-layout",controlClass:"flow-layout-item",endClass:"break"},recalc:function(a){a.items().filter(":visible").each(function(a){a.recalc&&a.recalc()})},isNative:function(){return!0}})}),g("tinymce.core.fmt.FontInfo",["ephox.katamari.api.Fun","ephox.katamari.api.Option","ephox.sugar.api.node.Element","ephox.sugar.api.node.Node","tinymce.core.dom.DOMUtils"],function(a,b,c,d,e){var f=function(a,c,d){for(;d!==c;){if(d.style[a]){var e=d.style[a];return""!==e?b.some(e):b.none()}d=d.parentNode}return b.none()},g=function(a){return/[0-9.]+px$/.test(a)?Math.round(72*parseInt(a,10)/96)+"pt":a},h=function(a){return a.replace(/[\'\"]/g,"").replace(/,\s+/g,",")},i=function(a,c){return b.from(e.DOM.getStyle(c,a,!0))},j=function(a){return function(e,g){return b.from(g).map(c.fromDom).filter(d.isEleme
nt).bind(function(b){return f(a,e,b.dom()).or(i(a,b.dom()))}).getOr("")}};return{getFontSize:j("fontSize"),getFontFamily:a.compose(h,j("fontFamily")),toPt:g}}),g("tinymce.core.ui.FormatControls",["ephox.katamari.api.Arr","ephox.katamari.api.Fun","ephox.sugar.api.node.Element","ephox.sugar.api.search.SelectorFind","tinymce.core.dom.DOMUtils","tinymce.core.EditorManager","tinymce.core.Env","tinymce.core.fmt.FontInfo","tinymce.core.ui.Control","tinymce.core.ui.FloatPanel","tinymce.core.ui.Widget","tinymce.core.util.Tools"],function(a,b,c,d,e,f,g,h,i,j,k,l){function m(a){a.settings.ui_container&&(g.container=d.descendant(c.fromDom(document.body),a.settings.ui_container).fold(b.constant(null),function(a){return a.dom()}))}function n(a){a.on("ScriptsLoaded",function(){a.rtl&&(i.rtl=!0)})}function o(a){func
tion b(b,c){return function(){var d=this;a.on("nodeChange",function(e){var f=a.formatter,g=null;p(e.parents,function(a){if(p(b,function(b){if(c?f.matchNode(a,c,{value:b.value})&&(g=b.value):f.matchNode(a,b.value)&&(g=b.value),g)return!1}),g)return!1}),d.value(g)})}}function c(b){return function(){var c=this,d=function(a){return a?a.split(",")[0]:""};a.on("init nodeChange",function(e){var f,g=null;f=h.getFontFamily(a.getBody(),e.element),p(b,function(a){a.value.toLowerCase()===f.toLowerCase()&&(g=a.value)}),p(b,function(a){g||d(a.value).toLowerCase()!==d(f).toLowerCase()||(g=a.value)}),c.value(g),!g&&f&&c.text(d(f))})}}function d(b){return function(){var c=this;a.on("init nodeChange",function(d){var e,f,g=null;e=h.getFontSize(a.getBody(),d.element),f=h.toPt(e),p(b,function(a){a.value===e?g=e:a.value===f&&(g=f)}),c.value(g),g||c.text(f)})}}function e(a){a=a.replace(/;$/,"").spli
t(";");for(var b=a.length;b--;)a[b]=a[b].split("=");return a}function f(){function b(a){var c=[];if(a)return p(a,function(a){var f={text:a.title,icon:a.icon};if(a.items)f.menu=b(a.items);else{var g=a.format||"custom"+d++;a.format||(a.name=g,e.push(a)),f.format=g,f.cmd=a.cmd}c.push(f)}),c}function c(){var c;return c=b(a.settings.style_formats_merge?a.settings.style_formats?f.concat(a.settings.style_formats):f:a.settings.style_formats||f)}var d=0,e=[],f=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",icon:"bold",format:"bold"},{title:"Italic",icon:"italic",format:
"italic"},{title:"Underline",icon:"underline",format:"underline"},{title:"Strikethrough",icon:"strikethrough",format:"strikethrough"},{title:"Superscript",icon:"superscript",format:"superscript"},{title:"Subscript",icon:"subscript",format:"subscript"},{title:"Code",icon:"code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Alignment",items:[{title:"Left",icon:"alignleft",format:"alignleft"},{title:"Center",icon:"aligncenter",format:"aligncenter"},{title:"Right",icon:"alignright",format:"alignright"},{title:"
Justify",icon:"alignjustify",format:"alignjustify"}]}];return a.on("init",function(){p(e,function(b){a.formatter.register(b.name,b)})}),{type:"menu",items:c(),onPostRender:function(b){a.fire("renderFormatsMenu",{control:b.control})},itemDefaults:{preview:!0,textStyle:function(){if(this.settings.format)return a.formatter.getCssText(this.settings.format)},onPostRender:function(){var b=this;b.parent().on("show",function(){var c,d;c=b.settings.format,c&&(b.disabled(!a.formatter.canApply(c)),b.active(a.formatter.match(c))),d=b.settings.cmd,d&&b.active(a.queryCommandState(d))})},onclick:function(){this.settings.format&&m(this.settings.format),this.settings.cmd&&a.execCommand(this.settings.cmd)}}}}function g(b){return function(){var c=this;a.formatter?a.formatter.formatChanged(b,function(a){c.active(a)}):a.on("init",function(){a.formatter.formatChanged(b,function(a){c.active(a)})})}}f
unction i(b){return function(){function c(){var c="redo"==b?"hasRedo":"hasUndo";return!!a.undoManager&&a.undoManager[c]()}var d=this;d.disabled(!c()),a.on("Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",function(){d.disabled(a.readonly||!c())})}}function k(){var b=this;a.on("VisualAid",function(a){b.active(a.hasVisual)}),b.active(a.hasVisual)}function m(b){b.control&&(b=b.control.value()),b&&a.execCommand("mceToggleFormat",!1,b)}function n(b){var c=b.length;return l.each(b,function(b){b.menu&&(b.hidden=0===n(b.menu));var d=b.format;d&&(b.hidden=!a.formatter.canApply(d)),b.hidden&&c--}),c}function o(b){var c=b.items().length;return b.items().each(function(b){b.menu&&b.visible(o(b.menu)>0),!b.menu&&b.settings.menu&&b.visible(n(b.settings.menu)>0);var d=b.settings.format;d&&b.visible(a.formatter.canApply(d)),b.visible()||c--}),c}var r;r=
f(),p({bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript"},function(b,c){a.addButton(c,{tooltip:b,onPostRender:g(c),onclick:function(){m(c)}})}),p({outdent:["Decrease indent","Outdent"],indent:["Increase indent","Indent"],cut:["Cut","Cut"],copy:["Copy","Copy"],paste:["Paste","Paste"],help:["Help","mceHelp"],selectall:["Select all","SelectAll"],removeformat:["Clear formatting","RemoveFormat"],visualaid:["Visual aids","mceToggleVisualAid"],newdocument:["New document","mceNewDocument"]},function(b,c){a.addButton(c,{tooltip:b[0],cmd:b[1]})}),p({blockquote:["Blockquote","mceBlockQuote"],subscript:["Subscript","Subscript&qu
ot;],superscript:["Superscript","Superscript"],alignleft:["Align left","JustifyLeft"],aligncenter:["Align center","JustifyCenter"],alignright:["Align right","JustifyRight"],alignjustify:["Justify","JustifyFull"],alignnone:["No alignment","JustifyNone"]},function(b,c){a.addButton(c,{tooltip:b[0],cmd:b[1],onPostRender:g(c)})});var s=function(a){var b=a;return b.length>0&&"-"===b[0].text&&(b=b.slice(1)),b.length>0&&"-"===b[b.length-1].text&&(b=b.slice(0,b.length-1)),b},t=function(b){var c,d;if("string"==typeof b)d=b.split(" ");else if(l.isArray(b))return q(l.map(b,t));return c=l.grep(d,function(b){return"|"===b||b in a.menuItems}),l.map(c,function(b){return"|"===b?{text:"-"}:a.menuItems[b]})},u=function(b){var c=[{text:"-"}],d=l.grep(a.menuItems,functi
on(a){return a.context===b});return l.each(d,function(a){"before"==a.separator&&c.push({text:"|"}),a.prependToContext?c.unshift(a):c.push(a),"after"==a.separator&&c.push({text:"|"})}),c},v=function(a){return s(a.insert_button_items?t(a.insert_button_items):u("insert"))};a.addButton("undo",{tooltip:"Undo",onPostRender:i("undo"),cmd:"undo"}),a.addButton("redo",{tooltip:"Redo",onPostRender:i("redo"),cmd:"redo"}),a.addMenuItem("newdocument",{text:"New document",icon:"newdocument",cmd:"mceNewDocument"}),a.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onPostRender:i("undo"),cmd:"undo"}),a.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onPostRender:i("redo"),cmd:"
redo"}),a.addMenuItem("visualaid",{text:"Visual aids",selectable:!0,onPostRender:k,cmd:"mceToggleVisualAid"}),a.addButton("remove",{tooltip:"Remove",icon:"remove",cmd:"Delete"}),a.addButton("insert",{type:"menubutton",icon:"insert",menu:[],oncreatemenu:function(){this.menu.add(v(a.settings)),this.menu.renderNew()}}),p({cut:["Cut","Cut","Meta+X"],copy:["Copy","Copy","Meta+C"],paste:["Paste","Paste","Meta+V"],selectall:["Select all","SelectAll","Meta+A"],bold:["Bold","Bold","Meta+B"],italic:["Italic","Italic","Meta+I"],underline:["Underline","Underline","Meta+U"],strikethrough:["Strikethrough","Strikethrough"],subscript:["Subscript","Subscri
pt"],superscript:["Superscript","Superscript"],removeformat:["Clear formatting","RemoveFormat"]},function(b,c){a.addMenuItem(c,{text:b[0],icon:c,shortcut:b[2],cmd:b[1]})}),a.on("mousedown",function(){j.hideAll()}),a.addButton("styleselect",{type:"menubutton",text:"Formats",menu:r,onShowMenu:function(){a.settings.style_formats_autohide&&o(this.menu)}}),a.addButton("formatselect",function(){var c=[],d=e(a.settings.block_formats||"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre");return p(d,function(b){c.push({text:b[0],value:b[1],textStyle:function(){return a.formatter.getCssText(b[1])}})}),{type:"listbox",text:d[0][0],values:c,fixedWidth:!0,onselect:m,onPostRender:b(c)}}),a.addButton("fontselect",function(){var b="Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Blac
k=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats",d=[],f=e(a.settings.font_formats||b);return p(f,function(a){d.push({text:{raw:a[0]},value:a[1],textStyle:a[1].indexOf("dings")==-1?"font-family:"+a[1]:""})}),{type:"listbox",text:"Font Family",tooltip:"Font Family",values:d,fixedWidth:!0,onPostRender:c(d),onselect:function(b){b.control.settings.value&&a.execCommand("FontName",!1,b.control.settings.value)}}}),a.addButton("fontsizeselect",function(
){var b=[],c="8pt 10pt 12pt 14pt 18pt 24pt 36pt",e=a.settings.fontsize_formats||c;return p(e.split(" "),function(a){var c=a,d=a,e=a.split("=");e.length>1&&(c=e[0],d=e[1]),b.push({text:c,value:d})}),{type:"listbox",text:"Font Sizes",tooltip:"Font Sizes",values:b,fixedWidth:!0,onPostRender:d(b),onclick:function(b){b.control.settings.value&&a.execCommand("FontSize",!1,b.control.settings.value)}}}),a.addMenuItem("formats",{text:"Formats",menu:r})}var p=l.each,q=function(b){return a.foldl(b,function(a,b){return a.concat(b)},[])};return f.on("AddEditor",function(a){var b=a.editor;n(b),o(b),m(b)}),i.translate=function(a){return f.translate(a)},k.tooltips=!g.iOS,{}}),g("tinymce.core.ui.GridLayout",["tinymce.core.ui.AbsoluteLayout"],function(a){"use strict";return a.extend({recalc:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
,A,B,C,D,E=[],F=[];b=a.settings,e=a.items().filter(":visible"),f=a.layoutRect(),d=b.columns||Math.ceil(Math.sqrt(e.length)),c=Math.ceil(e.length/d),s=b.spacingH||b.spacing||0,t=b.spacingV||b.spacing||0,u=b.alignH||b.align,v=b.alignV||b.align,q=a.paddingBox,C="reverseRows"in b?b.reverseRows:a.isRtl(),u&&"string"==typeof u&&(u=[u]),v&&"string"==typeof v&&(v=[v]);for(l=0;l<d;l++)E.push(0);for(m=0;m<c;m++)F.push(0);for(m=0;m<c;m++)for(l=0;l<d&&(k=e[m*d+l],k);l++)j=k.layoutRect(),y=j.minW,z=j.minH,E[l]=y>E[l]?y:E[l],F[m]=z>F[m]?z:F[m];for(A=f.innerW-q.left-q.right,w=0,l=0;l<d;l++)w+=E[l]+(l>0?s:0),A-=(l>0?s:0)+E[l];for(B=f.innerH-q.top-q.bottom,x=0,m=0;m<c;m++)x+=F[m]+(m>0?t:0),B-=(m>0?t:0)+F[m];if(w+=q.left+q.right,x+=q.top+q.bottom,i={},i.minW=w+(f.w-f.innerW),i.minH=x+(f.h-f.innerH),i.contentW=i.minW-f.deltaW,i.contentH=i.minH-f.deltaH,i.minW=Math.min(i.minW,f.maxW),i.mi
nH=Math.min(i.minH,f.maxH),i.minW=Math.max(i.minW,f.startMinWidth),i.minH=Math.max(i.minH,f.startMinHeight),!f.autoResize||i.minW==f.minW&&i.minH==f.minH){f.autoResize&&(i=a.layoutRect(i),i.contentW=i.minW-f.deltaW,i.contentH=i.minH-f.deltaH);var G;G="start"==b.packV?0:B>0?Math.floor(B/c):0;var H=0,I=b.flexWidths;if(I)for(l=0;l<I.length;l++)H+=I[l];else H=d;var J=A/H;for(l=0;l<d;l++)E[l]+=I?I[l]*J:J;for(o=q.top,m=0;m<c;m++){for(n=q.left,h=F[m]+G,l=0;l<d&&(D=C?m*d+d-1-l:m*d+l,k=e[D],k);l++)p=k.settings,j=k.layoutRect(),g=Math.max(E[l],j.startMinWidth),j.x=n,j.y=o,r=p.alignH||(u?u[l]||u[0]:null),"center"==r?j.x=n+g/2-j.w/2:"right"==r?j.x=n+g-j.w:"stretch"==r&&(j.w=g),r=p.alignV||(v?v[l]||v[0]:null),"center"==r?j.y=o+h/2-j.h/2:"bottom"==r?j.y=o+h-j.h:"stretch"==r&&(j.h=h),k.layoutRect(j),n+=g+s,k.recalc&&k.recalc();o+=h+t}}else if(i.w=i.minW,i.h=i.minH,a.
layoutRect(i),this.recalc(a),null===a._lastRect){var K=a.parent();K&&(K._lastRect=null,K.recalc())}}})}),g("tinymce.core.ui.Iframe",["tinymce.core.ui.Widget","tinymce.core.util.Delay"],function(a,b){"use strict";return a.extend({renderHtml:function(){var a=this;return a.classes.add("iframe"),a.canFocus=!1,'<iframe id="'+a._id+'" class="'+a.classes+'" tabindex="-1" src="'+(a.settings.url||"javascript:''")+'" frameborder="0"></iframe>'},src:function(a){this.getEl().src=a},html:function(a,c){
-var d=this,e=this.getEl().contentWindow.document.body;return e?(e.innerHTML=a,c&&c()):b.setTimeout(function(){d.html(a)}),this}})}),g("tinymce.core.ui.InfoBox",["tinymce.core.ui.Widget"],function(a){"use strict";return a.extend({init:function(a){var b=this;b._super(a),b.classes.add("widget").add("infobox"),b.canFocus=!1},severity:function(a){this.classes.remove("error"),this.classes.remove("warning"),this.classes.remove("success"),this.classes.add(a)},help:function(a){this.state.set("help",a)},renderHtml:function(){var a=this,b=a.classPrefix;return'<div id="'+a._id+'" class="'+a.classes+'"><div id="'+a._id+'-body">'+a.encode(a.state.get("text"))+'<button role="button" tabindex="-1"><i class="'+b+"ico "+b+'i-help"></i></button></div></div>'},bindStates:function(
){var a=this;return a.state.on("change:text",function(b){a.getEl("body").firstChild.data=a.encode(b.value),a.state.get("rendered")&&a.updateLayoutRect()}),a.state.on("change:help",function(b){a.classes.toggle("has-help",b.value),a.state.get("rendered")&&a.updateLayoutRect()}),a._super()}})}),g("tinymce.core.ui.Label",["tinymce.core.ui.Widget","tinymce.core.ui.DomUtils"],function(a,b){"use strict";return a.extend({init:function(a){var b=this;b._super(a),b.classes.add("widget").add("label"),b.canFocus=!1,a.multiline&&b.classes.add("autoscroll"),a.strong&&b.classes.add("strong")},initLayoutRect:function(){var a=this,c=a._super();if(a.settings.multiline){var d=b.getSize(a.getEl());d.width>c.maxW&&(c.minW=c.maxW,a.classes.add("multiline")),a.getEl().style.width=c.minW+"px",c.startMinH=c.h
=c.minH=Math.min(c.maxH,b.getSize(a.getEl()).height)}return c},repaint:function(){var a=this;return a.settings.multiline||(a.getEl().style.lineHeight=a.layoutRect().h+"px"),a._super()},severity:function(a){this.classes.remove("error"),this.classes.remove("warning"),this.classes.remove("success"),this.classes.add(a)},renderHtml:function(){var a,b,c=this,d=c.settings.forId,e=c.settings.html?c.settings.html:c.encode(c.state.get("text"));return!d&&(b=c.settings.forName)&&(a=c.getRoot().find("#"+b)[0],a&&(d=a._id)),d?'<label id="'+c._id+'" class="'+c.classes+'"'+(d?' for="'+d+'"':"")+">"+e+"</label>":'<span id="'+c._id+'" class="'+c.classes+'">'+e+"</span>"},bindStates:function(){var a=this;return a.state.on("change:text",function(b){a.innerHtml(a.encode(b.value)),a.state.get("r
endered")&&a.updateLayoutRect()}),a._super()}})}),g("tinymce.core.ui.Toolbar",["tinymce.core.ui.Container"],function(a){"use strict";return a.extend({Defaults:{role:"toolbar",layout:"flow"},init:function(a){var b=this;b._super(a),b.classes.add("toolbar")},postRender:function(){var a=this;return a.items().each(function(a){a.classes.add("toolbar-item")}),a._super()}})}),g("tinymce.core.ui.MenuBar",["tinymce.core.ui.Toolbar"],function(a){"use strict";return a.extend({Defaults:{role:"menubar",containerCls:"menubar",ariaRoot:!0,defaults:{type:"menubutton"}}})}),g("tinymce.core.ui.MenuButton",["tinymce.core.ui.Button","tinymce.core.ui.Factory","tinymce.core.ui.MenuBar"],function(a,b,c){"use strict";function d(a,b){for(;a;){if(b===a)return!0;a=a.parentNode}return!1}var e=a.extend({init:function(a){va
r b=this;b._renderOpen=!0,b._super(a),a=b.settings,b.classes.add("menubtn"),a.fixedWidth&&b.classes.add("fixed-width"),b.aria("haspopup",!0),b.state.set("menu",a.menu||b.render())},showMenu:function(a){var c,d=this;return d.menu&&d.menu.visible()&&a!==!1?d.hideMenu():(d.menu||(c=d.state.get("menu")||[],c.length?c={type:"menu",items:c}:c.type=c.type||"menu",c.renderTo?d.menu=c.parent(d).show().renderTo():d.menu=b.create(c).parent(d).renderTo(),d.fire("createmenu"),d.menu.reflow(),d.menu.on("cancel",function(a){a.control.parent()===d.menu&&(a.stopPropagation(),d.focus(),d.hideMenu())}),d.menu.on("select",function(){d.focus()}),d.menu.on("show hide",function(a){a.control==d.menu&&d.activeMenu("show"==a.type),d.aria("expanded","show"==a.type)}).fire("show")),d.menu.show(),d.menu.layoutRect({w:d.layou
tRect().w}),d.menu.moveRel(d.getEl(),d.isRtl()?["br-tr","tr-br"]:["bl-tl","tl-bl"]),void d.fire("showmenu"))},hideMenu:function(){var a=this;a.menu&&(a.menu.items().each(function(a){a.hideMenu&&a.hideMenu()}),a.menu.hide())},activeMenu:function(a){this.classes.toggle("active",a)},renderHtml:function(){var a,b=this,d=b._id,e=b.classPrefix,f=b.settings.icon,g=b.state.get("text"),h="";return a=b.settings.image,a?(f="none","string"!=typeof a&&(a=window.getSelection?a[0]:a[1]),a=" style=\"background-image: url('"+a+"')\""):a="",g&&(b.classes.add("btn-has-text"),h='<span class="'+e+'txt">'+b.encode(g)+"</span>"),f=b.settings.icon?e+"ico "+e+"i-"+f:"",b.aria("role",b.parent()instanceof c?"menuitem":"button"),'<div id=
"'+d+'" class="'+b.classes+'" tabindex="-1" aria-labelledby="'+d+'"><button id="'+d+'-open" role="presentation" type="button" tabindex="-1">'+(f?'<i class="'+f+'"'+a+"></i>":"")+h+' <i class="'+e+'caret"></i></button></div>'},postRender:function(){var a=this;return a.on("click",function(b){b.control===a&&d(b.target,a.getEl())&&(a.focus(),a.showMenu(!b.aria),b.aria&&a.menu.items().filter(":visible")[0].focus())}),a.on("mouseenter",function(b){var c,d=b.control,f=a.parent();d&&f&&d instanceof e&&d.parent()==f&&(f.items().filter("MenuButton").each(function(a){a.hideMenu&&a!=d&&(a.menu&&a.menu.visible()&&(c=!0),a.hideMenu())}),c&&(d.focus(),d.showMenu()))}),a._super()},bindStates:function(){
var a=this;return a.state.on("change:menu",function(){a.menu&&a.menu.remove(),a.menu=null}),a._super()},remove:function(){this._super(),this.menu&&this.menu.remove()}});return e}),g("tinymce.core.ui.MenuItem",["tinymce.core.ui.Widget","tinymce.core.ui.Factory","tinymce.core.Env","tinymce.core.util.Delay"],function(a,b,c,d){"use strict";return a.extend({Defaults:{border:0,role:"menuitem"},init:function(a){var b,c=this;c._super(a),a=c.settings,c.classes.add("menu-item"),a.menu&&c.classes.add("menu-item-expand"),a.preview&&c.classes.add("menu-item-preview"),b=c.state.get("text"),"-"!==b&&"|"!==b||(c.classes.add("menu-item-sep"),c.aria("role","separator"),c.state.set("text","-")),a.selectable&&(c.aria("role","menuitemcheckbox"),c.cla
sses.add("menu-item-checkbox"),a.icon="selected"),a.preview||a.selectable||c.classes.add("menu-item-normal"),c.on("mousedown",function(a){a.preventDefault()}),a.menu&&!a.ariaHideMenu&&c.aria("haspopup",!0)},hasMenus:function(){return!!this.settings.menu},showMenu:function(){var a,c=this,d=c.settings,e=c.parent();if(e.items().each(function(a){a!==c&&a.hideMenu()}),d.menu){a=c.menu,a?a.show():(a=d.menu,a.length?a={type:"menu",items:a}:a.type=a.type||"menu",e.settings.itemDefaults&&(a.itemDefaults=e.settings.itemDefaults),a=c.menu=b.create(a).parent(c).renderTo(),a.reflow(),a.on("cancel",function(b){b.stopPropagation(),c.focus(),a.hide()}),a.on("show hide",function(a){a.control.items&&a.control.items().each(function(a){a.active(a.settings.selected)})}).fire("show"),a.on("hide",function(b){b.control===a&&c.classes.remove("sele
cted")}),a.submenu=!0),a._parentMenu=e,a.classes.add("menu-sub");var f=a.testMoveRel(c.getEl(),c.isRtl()?["tl-tr","bl-br","tr-tl","br-bl"]:["tr-tl","br-bl","tl-tr","bl-br"]);a.moveRel(c.getEl(),f),a.rel=f,f="menu-sub-"+f,a.classes.remove(a._lastRel).add(f),a._lastRel=f,c.classes.add("selected"),c.aria("expanded",!0)}},hideMenu:function(){var a=this;return a.menu&&(a.menu.items().each(function(a){a.hideMenu&&a.hideMenu()}),a.menu.hide(),a.aria("expanded",!1)),a},renderHtml:function(){function a(a){var b,d,e={};for(e=c.mac?{alt:"⌥",ctrl:"⌘",shift:"⇧",meta:"⌘"}:{meta:"Ctrl"},a=a.split("+"),b=0;b<a.length;b++)d=e[a[b].toLowerCase()],d&&(a[b]=d);return a.join("+")}function b(a){return a.replace(/[.*+?^${}()|[\]\\]/g,
"\\$&")}function d(a){var c=h.match||"";return c?a.replace(new RegExp(b(c),"gi"),function(a){return"!mce~match["+a+"]mce~match!"}):a}function e(a){return a.replace(new RegExp(b("!mce~match["),"g"),"<b>").replace(new RegExp(b("]mce~match!"),"g"),"</b>")}var f=this,g=f._id,h=f.settings,i=f.classPrefix,j=f.state.get("text"),k=f.settings.icon,l="",m=h.shortcut,n=f.encode(h.url),o="";return k&&f.parent().classes.add("menu-has-icons"),h.image&&(l=" style=\"background-image: url('"+h.image+"')\""),m&&(m=a(m)),k=i+"ico "+i+"i-"+(f.settings.icon||"none"),o="-"!==j?'<i class="'+k+'"'+l+"></i>\xa0":"",j=e(f.encode(d(j))),n=e(f.encode(d(n))),'<div id="'+g+'" class="'+f.classes+'&q
uot; tabindex="-1">'+o+("-"!==j?'<span id="'+g+'-text" class="'+i+'text">'+j+"</span>":"")+(m?'<div id="'+g+'-shortcut" class="'+i+'menu-shortcut">'+m+"</div>":"")+(h.menu?'<div class="'+i+'caret"></div>':"")+(n?'<div class="'+i+'menu-item-link">'+n+"</div>":"")+"</div>"},postRender:function(){var a=this,b=a.settings,c=b.textStyle;if("function"==typeof c&&(c=c.call(this)),c){var e=a.getEl("text");e&&e.setAttribute("style",c)}return a.on("mouseenter click",function(c){c.control===a&&(b.menu||"click"!==c.type?(a.showMenu(),c.aria&&a.menu.focus(!0)):(a.fire("select"),d.requestAnimationFrame(function(){a.parent().hideAll()})))}),a._super(),a},hover:function(){var a=this;return a.pare
nt().items().each(function(a){a.classes.remove("selected")}),a.classes.toggle("selected",!0),a},active:function(a){return"undefined"!=typeof a&&this.aria("checked",a),this._super(a)},remove:function(){this._super(),this.menu&&this.menu.remove()}})}),g("tinymce.core.ui.Throbber",["tinymce.core.dom.DomQuery","tinymce.core.ui.Control","tinymce.core.util.Delay"],function(a,b,c){"use strict";return function(d,e){var f,g,h=this,i=b.classPrefix;h.show=function(b,j){function k(){f&&(a(d).append('<div class="'+i+"throbber"+(e?" "+i+"throbber-inline":"")+'"></div>'),j&&j())}return h.hide(),f=!0,b?g=c.setTimeout(k,b):k(),h},h.hide=function(){var a=d.lastChild;return c.clearTimeout(g),a&&a.className.indexOf("throbber")!=-1&&a.parentNode.removeChild(a),f=!1,h}}}),g("tinymce.core.ui.Me
nu",["tinymce.core.ui.FloatPanel","tinymce.core.ui.MenuItem","tinymce.core.ui.Throbber","tinymce.core.util.Tools"],function(a,b,c,d){"use strict";return a.extend({Defaults:{defaultType:"menuitem",border:1,layout:"stack",role:"application",bodyRole:"menu",ariaRoot:!0},init:function(a){var b=this;if(a.autohide=!0,a.constrainToViewport=!0,"function"==typeof a.items&&(a.itemsFactory=a.items,a.items=[]),a.itemDefaults)for(var c=a.items,e=c.length;e--;)c[e]=d.extend({},a.itemDefaults,c[e]);b._super(a),b.classes.add("menu")},repaint:function(){return this.classes.toggle("menu-align",!0),this._super(),this.getEl().style.height="",this.getEl("body").style.height="",this},cancel:function(){var a=this;a.hideAll(),a.fire("select")},load:function(){function a(){e.throbber&&(e.throbber.hide(),e.throbber=null)}var b,d,e
=this;d=e.settings.itemsFactory,d&&(e.throbber||(e.throbber=new c(e.getEl("body"),!0),0===e.items().length?(e.throbber.show(),e.fire("loading")):e.throbber.show(100,function(){e.items().remove(),e.fire("loading")}),e.on("hide close",a)),e.requestTime=b=(new Date).getTime(),e.settings.itemsFactory(function(c){return 0===c.length?void e.hide():void(e.requestTime===b&&(e.getEl().style.width="",e.getEl("body").style.width="",a(),e.items().remove(),e.getEl("body").innerHTML="",e.add(c),e.renderNew(),e.fire("loaded")))}))},hideAll:function(){var a=this;return this.find("menuitem").exec("hideMenu"),a._super()},preRender:function(){var a=this;return a.items().each(function(b){var c=b.settings;if(c.icon||c.image||c.selectable)return a._hasIcons=!0,!1}),a.settings.itemsFactory&&a.on("postrender",function(){a.settings.itemsFactory&&a.
load()}),a._super()}})}),g("tinymce.core.ui.ListBox",["tinymce.core.ui.MenuButton","tinymce.core.ui.Menu"],function(a,b){"use strict";return a.extend({init:function(a){function b(c){for(var f=0;f<c.length;f++){if(d=c[f].selected||a.value===c[f].value)return e=e||c[f].text,g.state.set("value",c[f].value),!0;if(c[f].menu&&b(c[f].menu))return!0}}var c,d,e,f,g=this;g._super(a),a=g.settings,g._values=c=a.values,c&&("undefined"!=typeof a.value&&b(c),!d&&c.length>0&&(e=c[0].text,g.state.set("value",c[0].value)),g.state.set("menu",c)),g.state.set("text",a.text||e),g.classes.add("listbox"),g.on("select",function(b){var c=b.control;f&&(b.lastControl=f),a.multiple?c.active(!c.active()):g.value(b.control.value()),f=c})},bindStates:function(){function a(a,c){a instanceof b&&a.items().each(function(a){a.hasMenus()||a.active(a.v
alue()===c)})}function c(a,b){var d;if(a)for(var e=0;e<a.length;e++){if(a[e].value===b)return a[e];if(a[e].menu&&(d=c(a[e].menu,b)))return d}}var d=this;return d.on("show",function(b){a(b.control,d.value())}),d.state.on("change:value",function(a){var b=c(d.state.get("menu"),a.value);b?d.text(b.text):d.text(d.settings.text)}),d._super()}})}),g("tinymce.core.ui.Radio",["tinymce.core.ui.Checkbox"],function(a){"use strict";return a.extend({Defaults:{classes:"radio",role:"radio"}})}),g("tinymce.core.ui.ResizeHandle",["tinymce.core.ui.Widget","tinymce.core.ui.DragHelper"],function(a,b){"use strict";return a.extend({renderHtml:function(){var a=this,b=a.classPrefix;return a.classes.add("resizehandle"),"both"==a.settings.direction&&a.classes.add("resizehandle-both"),a.canFocus=!1,'<div id="'+a._id+'" class="
'+a.classes+'"><i class="'+b+"ico "+b+'i-resize"></i></div>'},postRender:function(){var a=this;a._super(),a.resizeDragHelper=new b(this._id,{start:function(){a.fire("ResizeStart")},drag:function(b){"both"!=a.settings.direction&&(b.deltaX=0),a.fire("Resize",b)},stop:function(){a.fire("ResizeEnd")}})},remove:function(){return this.resizeDragHelper&&this.resizeDragHelper.destroy(),this._super()}})}),g("tinymce.core.ui.SelectBox",["tinymce.core.ui.Widget"],function(a){"use strict";function b(a){var b="";if(a)for(var c=0;c<a.length;c++)b+='<option value="'+a[c]+'">'+a[c]+"</option>";return b}return a.extend({Defaults:{classes:"selectbox",role:"selectbox",options:[]},init:function(a){var b=this;b._super(a),b.settings.size&&(b.size=b.settings.size),b.settings.options&&(b._options=
b.settings.options),b.on("keydown",function(a){var c;13==a.keyCode&&(a.preventDefault(),b.parents().reverse().each(function(a){if(a.toJSON)return c=a,!1}),b.fire("submit",{data:c.toJSON()}))})},options:function(a){return arguments.length?(this.state.set("options",a),this):this.state.get("options")},renderHtml:function(){var a,c=this,d="";return a=b(c._options),c.size&&(d=' size = "'+c.size+'"'),'<select id="'+c._id+'" class="'+c.classes+'"'+d+">"+a+"</select>"},bindStates:function(){var a=this;return a.state.on("change:options",function(c){a.getEl().innerHTML=b(c.value)}),a._super()}})}),g("tinymce.core.ui.Slider",["tinymce.core.ui.Widget","tinymce.core.ui.DragHelper","tinymce.core.ui.DomUtils"],function(a,b,c){"use strict";function d(a,b,c){return a<b&&(a=b),a>c&&(a=c),a}func
tion e(a,b,c){a.setAttribute("aria-"+b,c)}function f(a,b){var d,f,g,h,i,j;"v"==a.settings.orientation?(h="top",g="height",f="h"):(h="left",g="width",f="w"),j=a.getEl("handle"),d=(a.layoutRect()[f]||100)-c.getSize(j)[g],i=d*((b-a._minValue)/(a._maxValue-a._minValue))+"px",j.style[h]=i,j.style.height=a.layoutRect().h+"px",e(j,"valuenow",b),e(j,"valuetext",""+a.settings.previewFilter(b)),e(j,"valuemin",a._minValue),e(j,"valuemax",a._maxValue)}return a.extend({init:function(a){var b=this;a.previewFilter||(a.previewFilter=function(a){return Math.round(100*a)/100}),b._super(a),b.classes.add("slider"),"v"==a.orientation&&b.classes.add("vertical"),b._minValue=a.minValue||0,b._maxValue=a.maxValue||100,b._initValue=b.state.get("value")},renderHtml:function(){var a=this,b=a._id,c=a.classPr
efix;return'<div id="'+b+'" class="'+a.classes+'"><div id="'+b+'-handle" class="'+c+'slider-handle" role="slider" tabindex="-1"></div></div>'},reset:function(){this.value(this._initValue).repaint()},postRender:function(){function a(a,b,c){return(c+a)/(b-a)}function e(a,b,c){return c*(b-a)-a}function f(b,c){function f(f){var g;g=n.value(),g=e(b,c,a(b,c,g)+.05*f),g=d(g,b,c),n.value(g),n.fire("dragstart",{value:g}),n.fire("drag",{value:g}),n.fire("dragend",{value:g})}n.on("keydown",function(a){switch(a.keyCode){case 37:case 38:f(-1);break;case 39:case 40:f(1)}})}function g(a,e,f){var g,h,i,o,p;n._dragHelper=new b(n._id,{handle:n._id+"-handle",start:function(a){g=a[j],h=parseInt(n.getEl("handle").style[k],10),i=(n.layoutRect()[m]||100)-c.getSize(f)[l],n.fire("dragstart",{value:p})},drag:function(b){var c=b[j]-g;o=d(h+c,0,i),f.style[k]=
o+"px",p=a+o/i*(e-a),n.value(p),n.tooltip().text(""+n.settings.previewFilter(p)).show().moveRel(f,"bc tc"),n.fire("drag",{value:p})},stop:function(){n.tooltip().hide(),n.fire("dragend",{value:p})}})}var h,i,j,k,l,m,n=this;h=n._minValue,i=n._maxValue,"v"==n.settings.orientation?(j="screenY",k="top",l="height",m="h"):(j="screenX",k="left",l="width",m="w"),n._super(),f(h,i,n.getEl("handle")),g(h,i,n.getEl("handle"))},repaint:function(){this._super(),f(this,this.value())},bindStates:function(){var a=this;return a.state.on("change:value",function(b){f(a,b.value)}),a._super()}})}),g("tinymce.core.ui.Spacer",["tinymce.core.ui.Widget"],function(a){"use strict";return a.extend({renderHtml:function(){var a=this;return a.classes.add("spacer"),a.canFocus=!1,'<div id="'+a._id+'&quo
t; class="'+a.classes+'"></div>'}})}),g("tinymce.core.ui.SplitButton",["tinymce.core.ui.MenuButton","tinymce.core.ui.DomUtils","tinymce.core.dom.DomQuery"],function(a,b,c){return a.extend({Defaults:{classes:"widget btn splitbtn",role:"button"},repaint:function(){var a,d,e=this,f=e.getEl(),g=e.layoutRect();return e._super(),a=f.firstChild,d=f.lastChild,c(a).css({width:g.w-b.getSize(d).width,height:g.h-2}),c(d).css({height:g.h-2}),e},activeMenu:function(a){var b=this;c(b.getEl().lastChild).toggleClass(b.classPrefix+"active",a)},renderHtml:function(){var a,b=this,c=b._id,d=b.classPrefix,e=b.state.get("icon"),f=b.state.get("text"),g="";return a=b.settings.image,a?(e="none","string"!=typeof a&&(a=window.getSelection?a[0]:a[1]),a=" style=\"background-image: url('"+a+"')\""):a="",e=b.settings.icon?d+"
ico "+d+"i-"+e:"",f&&(b.classes.add("btn-has-text"),g='<span class="'+d+'txt">'+b.encode(f)+"</span>"),'<div id="'+c+'" class="'+b.classes+'" role="button" tabindex="-1"><button type="button" hidefocus="1" tabindex="-1">'+(e?'<i class="'+e+'"'+a+"></i>":"")+g+'</button><button type="button" class="'+d+'open" hidefocus="1" tabindex="-1">'+(b._menuBtnText?(e?"\xa0":"")+b._menuBtnText:"")+' <i class="'+d+'caret"></i></button></div>'},postRender:function(){var a=this,b=a.settings.onclick;return a.on("click",function(a){var c=a.target;if(a.control==this)for(;c;){if(a.aria&&"down"!=a.aria.key||"BUTTON"==c.nodeName&&c.className.indexOf
("open")==-1)return a.stopImmediatePropagation(),void(b&&b.call(this,a));c=c.parentNode}}),delete a.settings.onclick,a._super()}})}),g("tinymce.core.ui.StackLayout",["tinymce.core.ui.FlowLayout"],function(a){"use strict";return a.extend({Defaults:{containerClass:"stack-layout",controlClass:"stack-layout-item",endClass:"break"},isNative:function(){return!0}})}),g("tinymce.core.ui.TabPanel",["tinymce.core.ui.Panel","tinymce.core.dom.DomQuery","tinymce.core.ui.DomUtils"],function(a,b,c){"use strict";return a.extend({Defaults:{layout:"absolute",defaults:{type:"panel"}},activateTab:function(a){var c;this.activeTabId&&(c=this.getEl(this.activeTabId),b(c).removeClass(this.classPrefix+"active"),c.setAttribute("aria-selected","false")),this.activeTabId="t"+a,c=this.getEl("t"+a),c.setAttrib
ute("aria-selected","true"),b(c).addClass(this.classPrefix+"active"),this.items()[a].show().fire("showtab"),this.reflow(),this.items().each(function(b,c){a!=c&&b.hide()})},renderHtml:function(){var a=this,b=a._layout,c="",d=a.classPrefix;return a.preRender(),b.preRender(a),a.items().each(function(b,e){var f=a._id+"-t"+e;b.aria("role","tabpanel"),b.aria("labelledby",f),c+='<div id="'+f+'" class="'+d+'tab" unselectable="on" role="tab" aria-controls="'+b._id+'" aria-selected="false" tabIndex="-1">'+a.encode(b.settings.title)+"</div>"}),'<div id="'+a._id+'" class="'+a.classes+'" hidefocus="1" tabindex="-1"><div id="'+a._id+'-head" class="'+d+'tabs" role="tablist">'+c+'</div><div id="'+a._id+'-body" cl
ass="'+a.bodyClasses+'">'+b.renderHtml(a)+"</div></div>"},postRender:function(){var a=this;a._super(),a.settings.activeTab=a.settings.activeTab||0,a.activateTab(a.settings.activeTab),this.on("click",function(b){var c=b.target.parentNode;if(c&&c.id==a._id+"-head")for(var d=c.childNodes.length;d--;)c.childNodes[d]==b.target&&a.activateTab(d)})},initLayoutRect:function(){var a,b,d,e=this;b=c.getSize(e.getEl("head")).width,b=b<0?0:b,d=0,e.items().each(function(a){b=Math.max(b,a.layoutRect().minW),d=Math.max(d,a.layoutRect().minH)}),e.items().each(function(a){a.settings.x=0,a.settings.y=0,a.settings.w=b,a.settings.h=d,a.layoutRect({x:0,y:0,w:b,h:d})});var f=c.getSize(e.getEl("head")).height;return e.settings.minWidth=b,e.settings.minHeight=d+f,a=e._super(),a.deltaH+=f,a.innerH=a.h-a.deltaH,a}})}),g("tinymce.core.ui.TextBox",["tinymce.core.ui.Widget","tinymce.core.util.To
ols","tinymce.core.ui.DomUtils"],function(a,b,c){return a.extend({init:function(a){var b=this;b._super(a),b.classes.add("textbox"),a.multiline?b.classes.add("multiline"):(b.on("keydown",function(a){var c;13==a.keyCode&&(a.preventDefault(),b.parents().reverse().each(function(a){if(a.toJSON)return c=a,!1}),b.fire("submit",{data:c.toJSON()}))}),b.on("keyup",function(a){b.state.set("value",a.target.value)}))},repaint:function(){var a,b,c,d,e,f=this,g=0;a=f.getEl().style,b=f._layoutRect,e=f._lastRepaintRect||{};var h=document;return!f.settings.multiline&&h.all&&(!h.documentMode||h.documentMode<=8)&&(a.lineHeight=b.h-g+"px"),c=f.borderBox,d=c.left+c.right+8,g=c.top+c.bottom+(f.settings.multiline?8:0),b.x!==e.x&&(a.left=b.x+"px",e.x=b.x),b.y!==e.y&&(a.top=b.y+"px",e.y=b.y),b.w!==e.w&&(a.width=b.w-d+"px",e.w=b.w),b.h!==
e.h&&(a.height=b.h-g+"px",e.h=b.h),f._lastRepaintRect=e,f.fire("repaint",{},!1),f},renderHtml:function(){var a,d,e=this,f=e.settings;return a={id:e._id,hidefocus:"1"},b.each(["rows","spellcheck","maxLength","size","readonly","min","max","step","list","pattern","placeholder","required","multiple"],function(b){a[b]=f[b]}),e.disabled()&&(a.disabled="disabled"),f.subtype&&(a.type=f.subtype),d=c.create(f.multiline?"textarea":"input",a),d.value=e.state.get("value"),d.className=e.classes,d.outerHTML},value:function(a){return arguments.length?(this.state.set("value",a),this):(this.state.get("rendered")&&this.state.set("value",this.getEl().value),this.state.get("value"))},postRender:function(){var a=this;a.getEl().value=a.st
ate.get("value"),a._super(),a.$el.on("change",function(b){a.state.set("value",b.target.value),a.fire("change",b)})},bindStates:function(){var a=this;return a.state.on("change:value",function(b){a.getEl().value!=b.value&&(a.getEl().value=b.value)}),a.state.on("change:disabled",function(b){a.getEl().disabled=b.value}),a._super()},remove:function(){this.$el.off(),this._super()}})}),h("global!RegExp",RegExp),g("tinymce.core.ui.DropZone",["tinymce.core.ui.Widget","tinymce.core.util.Tools","tinymce.core.ui.DomUtils","global!RegExp"],function(a,b,c,d){return a.extend({init:function(a){var c=this;a=b.extend({height:100,text:"Drop an image here",multiple:!1,accept:null},a),c._super(a),c.classes.add("dropzone"),a.multiple&&c.classes.add("multiple")},renderHtml:function(){var a,b,d=this,e=d.settings;return a={id:d._id,hidefocus:&q
uot;1"},b=c.create("div",a,"<span>"+this.translate(e.text)+"</span>"),e.height&&c.css(b,"height",e.height+"px"),e.width&&c.css(b,"width",e.width+"px"),b.className=d.classes,b.outerHTML},postRender:function(){var a=this,c=function(b){b.preventDefault(),a.classes.toggle("dragenter"),a.getEl().className=a.classes},e=function(c){var e=a.settings.accept;if("string"!=typeof e)return c;var f=new d("("+e.split(/\s*,\s*/).join("|")+")$","i");return b.grep(c,function(a){return f.test(a.name)})};a._super(),a.$el.on("dragover",function(a){a.preventDefault()}),a.$el.on("dragenter",c),a.$el.on("dragleave",c),a.$el.on("drop",function(b){if(b.preventDefault(),!a.state.get("disabled")){var c=e(b.dataTransfer.files);a.value=function(){return c.length?a.settings.multiple?c:c[0]:null},c.length
&&a.fire("change",b)}})},remove:function(){this.$el.off(),this._super()}})}),g("tinymce.core.ui.BrowseButton",["tinymce.core.ui.Button","tinymce.core.util.Tools","tinymce.core.ui.DomUtils","tinymce.core.dom.DomQuery","global!RegExp"],function(a,b,c,d,e){return a.extend({init:function(a){var c=this;a=b.extend({text:"Browse...",multiple:!1,accept:null},a),c._super(a),c.classes.add("browsebutton"),a.multiple&&c.classes.add("multiple")},postRender:function(){var a=this,b=c.create("input",{type:"file",id:a._id+"-browse",accept:a.settings.accept});a._super(),d(b).on("change",function(b){var c=b.target.files;a.value=function(){return c.length?a.settings.multiple?c:c[0]:null},b.preventDefault(),c.length&&a.fire("change",b)}),d(b).on("click",function(a){a.stopPropagation()}),d(a.getEl("button")).on(&q
uot;click",function(a){a.stopPropagation(),b.click()}),a.getEl().appendChild(b)},remove:function(){d(this.getEl("button")).off(),d(this.getEl("input")).off(),this._super()}})}),g("tinymce.core.ui.Api",["tinymce.core.ui.Selector","tinymce.core.ui.Collection","tinymce.core.ui.ReflowQueue","tinymce.core.ui.Control","tinymce.core.ui.Factory","tinymce.core.ui.KeyboardNavigation","tinymce.core.ui.Container","tinymce.core.ui.DragHelper","tinymce.core.ui.Scrollable","tinymce.core.ui.Panel","tinymce.core.ui.Movable","tinymce.core.ui.Resizable","tinymce.core.ui.FloatPanel","tinymce.core.ui.Window","tinymce.core.ui.MessageBox","tinymce.core.ui.Tooltip","tinymce.core.ui.Widget","tinymce.core.ui.Progress","tinymce.core.ui.Notification","tinymce.core.ui.Layout",&quo
t;tinymce.core.ui.AbsoluteLayout","tinymce.core.ui.Button","tinymce.core.ui.ButtonGroup","tinymce.core.ui.Checkbox","tinymce.core.ui.ComboBox","tinymce.core.ui.ColorBox","tinymce.core.ui.PanelButton","tinymce.core.ui.ColorButton","tinymce.core.ui.ColorPicker","tinymce.core.ui.Path","tinymce.core.ui.ElementPath","tinymce.core.ui.FormItem","tinymce.core.ui.Form","tinymce.core.ui.FieldSet","tinymce.core.ui.FilePicker","tinymce.core.ui.FitLayout","tinymce.core.ui.FlexLayout","tinymce.core.ui.FlowLayout","tinymce.core.ui.FormatControls","tinymce.core.ui.GridLayout","tinymce.core.ui.Iframe","tinymce.core.ui.InfoBox","tinymce.core.ui.Label","tinymce.core.ui.Toolbar","tinymce.core.ui.MenuBar","tinymce.core.ui.MenuButton","tinymce.core.
ui.MenuItem","tinymce.core.ui.Throbber","tinymce.core.ui.Menu","tinymce.core.ui.ListBox","tinymce.core.ui.Radio","tinymce.core.ui.ResizeHandle","tinymce.core.ui.SelectBox","tinymce.core.ui.Slider","tinymce.core.ui.Spacer","tinymce.core.ui.SplitButton","tinymce.core.ui.StackLayout","tinymce.core.ui.TabPanel","tinymce.core.ui.TextBox","tinymce.core.ui.DropZone","tinymce.core.ui.BrowseButton"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga){"use strict";var ha=function(a,b){e.add(a.split(".").pop(),b)},ia=function(a,b,c){var d,e;for(e=b.split(/[.\/]/),d=0;d<e.length-1;++d)void 0===a[e[d]]&&(a[e[d]]={}),a=a[e[d]];a[e[e.length-1]]=c,ha(b,c)},ja=function(ha){ia(ha,"ui.Selector",a),ia(ha,"ui.Collection",b),i
a(ha,"ui.ReflowQueue",c),ia(ha,"ui.Control",d),ia(ha,"ui.Factory",e),ia(ha,"ui.KeyboardNavigation",f),ia(ha,"ui.Container",g),ia(ha,"ui.DragHelper",h),ia(ha,"ui.Scrollable",i),ia(ha,"ui.Panel",j),ia(ha,"ui.Movable",k),ia(ha,"ui.Resizable",l),ia(ha,"ui.FloatPanel",m),ia(ha,"ui.Window",n),ia(ha,"ui.MessageBox",o),ia(ha,"ui.Tooltip",p),ia(ha,"ui.Widget",q),ia(ha,"ui.Progress",r),ia(ha,"ui.Notification",s),ia(ha,"ui.Layout",t),ia(ha,"ui.AbsoluteLayout",u),ia(ha,"ui.Button",v),ia(ha,"ui.ButtonGroup",w),ia(ha,"ui.Checkbox",x),ia(ha,"ui.ComboBox",y),ia(ha,"ui.ColorBox",z),ia(ha,"ui.PanelButton",A),ia(ha,"ui.ColorButton",B),ia(ha,"ui.ColorPicker",C),ia(ha,"ui.Path",D),ia(ha,"ui.ElementPath",E),ia(ha,"
ui.FormItem",F),ia(ha,"ui.Form",G),ia(ha,"ui.FieldSet",H),ia(ha,"ui.FilePicker",I),ia(ha,"ui.FitLayout",J),ia(ha,"ui.FlexLayout",K),ia(ha,"ui.FlowLayout",L),ia(ha,"ui.FormatControls",M),ia(ha,"ui.GridLayout",N),ia(ha,"ui.Iframe",O),ia(ha,"ui.InfoBox",P),ia(ha,"ui.Label",Q),ia(ha,"ui.Toolbar",R),ia(ha,"ui.MenuBar",S),ia(ha,"ui.MenuButton",T),ia(ha,"ui.MenuItem",U),ia(ha,"ui.Throbber",V),ia(ha,"ui.Menu",W),ia(ha,"ui.ListBox",X),ia(ha,"ui.Radio",Y),ia(ha,"ui.ResizeHandle",Z),ia(ha,"ui.SelectBox",$),ia(ha,"ui.Slider",_),ia(ha,"ui.Spacer",aa),ia(ha,"ui.SplitButton",ba),ia(ha,"ui.StackLayout",ca),ia(ha,"ui.TabPanel",da),ia(ha,"ui.TextBox",ea),ia(ha,"ui.DropZone",fa),ia(ha,"ui.BrowseButton",ga),ia(ha
,"ui.Api",ka)},ka={appendTo:ja};return ka}),g("tinymce.core.util.JSON",[],function(){function a(b,c){var d,e,f,g;if(c=c||'"',null===b)return"null";if(f=typeof b,"string"==f)return e="\bb\tt\nn\ff\rr\"\"''\\\\",c+b.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(a,b){return'"'===c&&"'"===a?a:(d=e.indexOf(b),d+1?"\\"+e.charAt(d+1):(a=b.charCodeAt().toString(16),"\\u"+"0000".substring(a.length)+a))})+c;if("object"==f){if(b.hasOwnProperty&&"[object Array]"===Object.prototype.toString.call(b)){for(d=0,e="[";d<b.length;d++)e+=(d>0?",":"")+a(b[d],c);return e+"]"}e="{";for(g in b)b.hasOwnProperty(g)&&(e+="function"!=typeof b[g]?(e.length>1?","+c:c)+g+c+":"+a(b[g],c):"");return e+"}"}return""+b}return{serialize:a,
parse:function(a){try{return window[String.fromCharCode(101)+"val"]("("+a+")")}catch(b){}}}}),g("tinymce.core.util.JSONP",["tinymce.core.dom.DOMUtils"],function(a){return{callbacks:{},count:0,send:function(b){var c=this,d=a.DOM,e=void 0!==b.count?b.count:c.count,f="tinymce_jsonp_"+e;c.callbacks[e]=function(a){d.remove(f),delete c.callbacks[e],b.callback(a)},d.add(d.doc.body,"script",{id:f,src:b.url,type:"text/javascript"}),c.count++}}}),g("tinymce.core.util.XHR",["tinymce.core.util.Observable","tinymce.core.util.Tools"],function(a,b){var c={send:function(a){function d(){!a.async||4==e.readyState||f++>1e4?(a.success&&f<1e4&&200==e.status?a.success.call(a.success_scope,""+e.responseText,e,a):a.error&&a.error.call(a.error_scope,f>1e4?"TIMED_OUT":"GENERAL",e,a),e=null):setTimeout(d,10)}var e,f=0;if(a.scope=a.scope||t
his,a.success_scope=a.success_scope||a.scope,a.error_scope=a.error_scope||a.scope,a.async=a.async!==!1,a.data=a.data||"",c.fire("beforeInitialize",{settings:a}),e=new XMLHttpRequest){if(e.overrideMimeType&&e.overrideMimeType(a.content_type),e.open(a.type||(a.data?"POST":"GET"),a.url,a.async),a.crossDomain&&(e.withCredentials=!0),a.content_type&&e.setRequestHeader("Content-Type",a.content_type),a.requestheaders&&b.each(a.requestheaders,function(a){e.setRequestHeader(a.key,a.value)}),e.setRequestHeader("X-Requested-With","XMLHttpRequest"),e=c.fire("beforeSend",{xhr:e,settings:a}).xhr,e.send(a.data),!a.async)return d();setTimeout(d,10)}}};return b.extend(c,a),c}),g("tinymce.core.util.JSONRequest",["tinymce.core.util.JSON","tinymce.core.util.XHR","tinymce.core.util.Tools"],function(a,b,c){function d(a){this.settings=e({},a),this.count=0}
var e=c.extend;return d.sendRPC=function(a){return(new d).send(a)},d.prototype={send:function(c){var d=c.error,f=c.success;c=e(this.settings,c),c.success=function(b,e){b=a.parse(b),"undefined"==typeof b&&(b={error:"JSON Parse error."}),b.error?d.call(c.error_scope||c.scope,b.error,e):f.call(c.success_scope||c.scope,b.result)},c.error=function(a,b){d&&d.call(c.error_scope||c.scope,a,b)},c.data=a.serialize({id:c.id||"c"+this.count++,method:c.method,params:c.params}),c.content_type="application/json",b.send(c)}},d}),g("tinymce.core.util.LocalStorage",[],function(){function a(){g=[];for(var a in f)g.push(a);d.length=g.length}function b(){function b(a){var b,c;return c=void 0!==a?j+a:d.indexOf(",",j),c===-1||c>d.length?null:(b=d.substring(j,c),j=c+1,b)}var c,d,g,j=0;if(f={},i){e.load(h),d=e.getAttribute(h)||"";do{var k=b();if(null===k)break;if(c=b(parseInt(k,32)||0),null!==c){if(k=b(),null===k)break;
g=b(parseInt(k,32)||0),c&&(f[c]=g)}}while(null!==c);a()}}function c(){var b,c="";if(i){for(var d in f)b=f[d],c+=(c?",":"")+d.length.toString(32)+","+d+","+b.length.toString(32)+","+b;
-e.setAttribute(h,c);try{e.save(h)}catch(g){}a()}}var d,e,f,g,h,i;try{if(window.localStorage)return localStorage}catch(j){}return h="tinymce",e=document.documentElement,i=!!e.addBehavior,i&&e.addBehavior("#default#userData"),d={key:function(a){return g[a]},getItem:function(a){return a in f?f[a]:null},setItem:function(a,b){f[a]=""+b,c()},removeItem:function(a){delete f[a],c()},clear:function(){f={},c()}},b(),d}),g("tinymce.core.api.Tinymce",["tinymce.core.AddOnManager","tinymce.core.api.Formatter","tinymce.core.api.NotificationManager","tinymce.core.api.WindowManager","tinymce.core.dom.BookmarkManager","tinymce.core.dom.ControlSelection","tinymce.core.dom.DomQuery","tinymce.core.dom.DOMUtils","tinymce.core.dom.EventUtils","tinymce.core.dom.RangeUtils","tinymce.core.dom.ScriptLoader","tinymce.core.dom.Selection","ti
nymce.core.dom.Serializer","tinymce.core.dom.Sizzle","tinymce.core.dom.TreeWalker","tinymce.core.Editor","tinymce.core.EditorCommands","tinymce.core.EditorManager","tinymce.core.EditorObservable","tinymce.core.Env","tinymce.core.FocusManager","tinymce.core.geom.Rect","tinymce.core.html.DomParser","tinymce.core.html.Entities","tinymce.core.html.Node","tinymce.core.html.SaxParser","tinymce.core.html.Schema","tinymce.core.html.Serializer","tinymce.core.html.Styles","tinymce.core.html.Writer","tinymce.core.Shortcuts","tinymce.core.ui.Api","tinymce.core.UndoManager","tinymce.core.util.Class","tinymce.core.util.Color","tinymce.core.util.Delay","tinymce.core.util.EventDispatcher","tinymce.core.util.I18n","tinymce.core.util.JSON",
"tinymce.core.util.JSONP","tinymce.core.util.JSONRequest","tinymce.core.util.LocalStorage","tinymce.core.util.Observable","tinymce.core.util.Promise","tinymce.core.util.Tools","tinymce.core.util.URI","tinymce.core.util.VK","tinymce.core.util.XHR"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V){var W=r,X={geom:{Rect:v},util:{Promise:R,Delay:J,Tools:S,VK:U,URI:T,Class:H,EventDispatcher:K,Observable:Q,I18n:L,XHR:V,JSON:M,JSONRequest:O,JSONP:N,LocalStorage:P,Color:I},dom:{EventUtils:i,Sizzle:n,DomQuery:g,TreeWalker:o,DOMUtils:h,ScriptLoader:k,RangeUtils:j,Serializer:m,ControlSelection:f,BookmarkManager:e,Selection:l,Event:i.Event},html:{Styles:C,Entities:x,Node:y,Schema:A,SaxParser:z,DomParser:w,Writer:D,Serializer:B},Env:t,AddOnManager:a,Formatter:b,UndoManager:G,EditorCommands:q,WindowManager:d,NotificationManager:c,EditorObservable:s,Sho
rtcuts:E,Editor:p,FocusManager:u,EditorManager:r,DOM:h.DOM,ScriptLoader:k.ScriptLoader,PluginManager:a.PluginManager,ThemeManager:a.ThemeManager,trim:S.trim,isArray:S.isArray,is:S.is,toArray:S.toArray,makeMap:S.makeMap,each:S.each,map:S.map,grep:S.grep,inArray:S.inArray,extend:S.extend,create:S.create,walk:S.walk,createNS:S.createNS,resolve:S.resolve,explode:S.explode,_addCacheSuffix:S._addCacheSuffix,isOpera:t.opera,isWebKit:t.webkit,isIE:t.ie,isGecko:t.gecko,isMac:t.mac};return W=S.extend(W,X),F.appendTo(W),W}),g("tinymce.core.api.Main",["ephox.katamari.api.Fun","tinymce.core.api.Tinymce"],function(a,b){var c=this||window,d=function(b){"function"!=typeof c.define||c.define.amd||(c.define("ephox/tinymce",[],a.constant(b)),c.define("tinymce.core.EditorManager",[],a.constant(b))),"object"==typeof module&&(module.exports=b)},e=function(a){window.tinymce=a,window.tinyMCE=a};return function(){return e(b),d(b),
b}}),d("tinymce.core.api.Main")()}();
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+// 4.7.11 (2018-04-11)
+!function(){"use strict";var e,t,n,r,o,i,a,u,s,c,l,f,d,m,p,g,h,v=function(e){return function(){return e}},V={noop:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},noarg:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n()}},compose:function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,arguments))}},constant:v,identity:function(e){return e},tripleEquals:function(e,t){return e===t},curry:function(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var a=new Array(arguments.length-1),n=1;n<arguments.length;n++)a[n-1]=arguments[n];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var o=a.concat(n);return i.apply(null,o)}},not:function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];retu
rn!n.apply(null,arguments)}},die:function(e){return function(){throw new Error(e)}},apply:function(e){return e()},call:function(e){e()},never:v(!1),always:v(!0)},y=V.never,b=V.always,C=function(){return x},x=(r={fold:function(e,t){return e()},is:y,isSome:y,isNone:b,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},or:n,orThunk:t,map:C,ap:C,each:function(){},bind:C,flatten:C,exists:y,forall:b,filter:C,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:V.constant("none()")},Object.freeze&&Object.freeze(r),r),w=function(n){var e=function(){return n},t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:b,isNone:y,getOr:e,getOrThunk:e,getOrDie:e,or:t,orThunk:t,map:function(e){return w(e(n))},ap:function(e){return e.fold(C,function(e){return w(e(n))})},each:function(
e){e(n)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(n)?o:x},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(y,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},A={some:w,none:C,from:function(e){return null===e||e===undefined?x:w(e)}},N=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(e)===t}},E={isString:N("string"),isObject:N("object"),isArray:N("array"),isNull:N("null"),isBoolean:N("boolean"),isUndefined:N("undefined"),isFunction:N("function"),isNumber:N("number")},S=(o=Array.prototype.indexOf)===undefined?function(e,t){return O(e,t)}:function(e,t){return o
.call(e,t)},k=function(e,t){return-1<S(e,t)},T=function(e,t){for(var n=e.length,r=new Array(n),o=0;o<n;o++){var i=e[o];r[o]=t(i,o,e)}return r},R=function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)},B=function(e,t){for(var n=e.length-1;0<=n;n--)t(e[n],n,e)},_=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++){var i=e[r];t(i,r,e)&&n.push(i)}return n},D=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n,e))return A.some(n);return A.none()},O=function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1},P=Array.prototype.push,L=function(e){for(var t=[],n=0,r=e.length;n<r;++n){if(!Array.prototype.isPrototypeOf(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);P.apply(t,e[n])}return t},I=function(e,t){for(var n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n,e))return!1;return!0},M=Array.prototype.slice,F=E.isFunction(Array.from)?Array.from:function(e){return M.call(e)},H={map:T,each:R,eachr:B,
partition:function(e,t){for(var n=[],r=[],o=0,i=e.length;o<i;o++){var a=e[o];(t(a,o,e)?n:r).push(a)}return{pass:n,fail:r}},filter:_,groupBy:function(e,t){if(0===e.length)return[];for(var n=t(e[0]),r=[],o=[],i=0,a=e.length;i<a;i++){var u=e[i],s=t(u);s!==n&&(r.push(o),o=[]),n=s,o.push(u)}return 0!==o.length&&r.push(o),r},indexOf:function(e,t){var n=S(e,t);return-1===n?A.none():A.some(n)},foldr:function(e,t,n){return B(e,function(e){n=t(n,e)}),n},foldl:function(e,t,n){return R(e,function(e){n=t(n,e)}),n},find:function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n,e))return A.some(o)}return A.none()},findIndex:D,flatten:L,bind:function(e,t){var n=T(e,t);return L(n)},forall:I,exists:function(e,t){return D(e,t).isSome()},contains:k,equal:function(e,n){return e.length===n.length&&I(e,function(e,t){return e===n[t]})},reverse:function(e){var t=M.call(e,0);return t.reverse(),t},chunk:function(e,t){for(var n=[],r=0;r<e.length;r+=t){var o=e.slice(r
,r+t);n.push(o)}return n},difference:function(e,t){return _(e,function(e){return!k(t,e)})},mapToObject:function(e,t){for(var n={},r=0,o=e.length;r<o;r++){var i=e[r];n[String(i)]=t(i,r)}return n},pure:function(e){return[e]},sort:function(e,t){var n=M.call(e,0);return n.sort(t),n},range:function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n},head:function(e){return 0===e.length?A.none():A.some(e[0])},last:function(e){return 0===e.length?A.none():A.some(e[e.length-1])},from:F},z="undefined"!=typeof window?window:Function("return this;")(),U=function(e,t){for(var n=t!==undefined&&null!==t?t:z,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n},q=function(e,t){var n=e.split(".");return U(n,t)},j={getOrDie:function(e,t){var n=q(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n}},$=function(){return j.getOrDie("URL")},W={createObjectURL:function(e){return $()
.createObjectURL(e)},revokeObjectURL:function(e){$().revokeObjectURL(e)}},K=navigator,X=K.userAgent,Y=function(e){return"matchMedia"in window&&matchMedia(e).matches};d=/Android/.test(X),a=(a=!(i=/WebKit/.test(X))&&/MSIE/gi.test(X)&&/Explorer/gi.test(K.appName))&&/MSIE (\w+)\./.exec(X)[1],u=-1!==X.indexOf("Trident/")&&(-1!==X.indexOf("rv:")||-1!==K.appName.indexOf("Netscape"))&&11,s=-1!==X.indexOf("Edge/")&&!a&&!u&&12,a=a||u||s,c=!i&&!u&&/Gecko/.test(X),l=-1!==X.indexOf("Mac"),f=/(iPad|iPhone)/.test(X),m="FormData"in window&&"FileReader"in window&&"URL"in window&&!!W.createObjectURL,p=Y("only screen and (max-device-width: 480px)")&&(d||f),g=Y("only screen and (min-width: 800px)")&&(d||f),h=-1!==X.indexOf("Windows Phone"),s&&(i=!1);v
ar G,J,Q,Z,ee,te,ne,re,oe,ie,ae,ue,se,ce,le,fe,de,me,pe,ge={opera:!1,webkit:i,ie:a,gecko:c,mac:l,iOS:f,android:d,contentEditable:!f||m||534<=parseInt(X.match(/AppleWebKit\/(\d*)/)[1],10),transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",caretAfter:8!==a,range:window.getSelection&&"Range"in window,documentMode:a&&!s?document.documentMode||7:10,fileApi:m,ceFalse:!1===a||8<a,cacheSuffix:null,container:null,overrideViewPort:null,experimentalShadowDom:!1,canHaveCSP:!1===a||11<a,desktop:!p&&!g,windowsPhone:h},he=window.Promise?window.Promise:function(){function r(e,t){return function(){e.apply(t,arguments)}}var e=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=function(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a f
unction");this._state=null,this._value=null,this._deferreds=[],l(e,r(o,this),r(u,this))},t=i.immediateFn||"function"==typeof setImmediate&&setImmediate||function(e){setTimeout(e,1)};function a(r){var o=this;null!==this._state?t(function(){var e=o._state?r.onFulfilled:r.onRejected;if(null!==e){var t;try{t=e(o._value)}catch(n){return void r.reject(n)}r.resolve(t)}else(o._state?r.resolve:r.reject)(o._value)}):this._deferreds.push(r)}function o(e){try{if(e===this)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var t=e.then;if("function"==typeof t)return void l(r(t,e),r(o,this),r(u,this))}this._state=!0,this._value=e,s.call(this)}catch(n){u.call(this,n)}}function u(e){this._state=!1,this._value=e,s.call(this)}function s(){for(var e=0,t=this._deferreds.length;e<t;e++)a.call(this,this._deferreds[e]);this._deferreds=null}function c(e,t,n,r){this.onFulf
illed="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r}function l(e,t,n){var r=!1;try{e(function(e){r||(r=!0,t(e))},function(e){r||(r=!0,n(e))})}catch(o){if(r)return;r=!0,n(o)}}return i.prototype["catch"]=function(e){return this.then(null,e)},i.prototype.then=function(n,r){var o=this;return new i(function(e,t){a.call(o,new c(n,r,e,t))})},i.all=function(){var s=Array.prototype.slice.call(1===arguments.length&&e(arguments[0])?arguments[0]:arguments);return new i(function(o,i){if(0===s.length)return o([]);var a=s.length;function u(t,e){try{if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if("function"==typeof n)return void n.call(e,function(e){u(t,e)},i)}s[t]=e,0==--a&&o(s)}catch(r){i(r)}}for(var e=0;e<s.length;e++)u(e,s[e])})},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i(funct
ion(e){e(t)})},i.reject=function(n){return new i(function(e,t){t(n)})},i.race=function(o){return new i(function(e,t){for(var n=0,r=o.length;n<r;n++)o[n].then(e,t)})},i}(),ve=function(e,t){return"number"!=typeof t&&(t=0),setTimeout(e,t)},ye=function(e,t){return"number"!=typeof t&&(t=1),setInterval(e,t)},be=function(t,n){var r,e;return(e=function(){var e=arguments;clearTimeout(r),r=ve(function(){t.apply(this,e)},n)}).stop=function(){clearTimeout(r)},e},Ce={requestAnimationFrame:function(e,t){G?G.then(e):G=new he(function(e){t||(t=document.body),function(e,t){var n,r=window.requestAnimationFrame,o=["ms","moz","webkit"];for(n=0;n<o.length&&!r;n++)r=window[o[n]+"RequestAnimationFrame"];r||(r=function(e){window.setTimeout(e,0)}),r(e,t)}(e,t)}).then(e)},setTimeout:ve,setInterval:ye,setEditorTimeout:function(e,t,n){return ve(function(){e.removed||t()},n)},setEditorInterval:function(e,t,n){var r;return
r=ye(function(){e.removed?clearInterval(r):t()},n)},debounce:be,throttle:be,clearInterval:function(e){return clearInterval(e)},clearTimeout:function(e){return clearTimeout(e)}},xe=/^(?:mouse|contextmenu)|click/,we={keyLocation:1,layerX:1,layerY:1,returnValue:1,webkitMovementX:1,webkitMovementY:1,keyIdentifier:1},Ne=function(){return!1},Ee=function(){return!0},Se=function(e,t,n,r){e.addEventListener?e.addEventListener(t,n,r||!1):e.attachEvent&&e.attachEvent("on"+t,n)},ke=function(e,t,n,r){e.removeEventListener?e.removeEventListener(t,n,r||!1):e.detachEvent&&e.detachEvent("on"+t,n)},Te=function(e,t){var n,r,o,i,a,u,s=t||{};for(n in e)we[n]||(s[n]=e[n]);if(s.target||(s.target=s.srcElement||document),ge.experimentalShadowDom&&(s.target=(r=e,o=s.target,a=o,(i=r.path)&&0<i.length&&(a=i[0]),r.composedPath&&(i=r.composedPath())&&0<i.length&&(a=i[0]),a)),e&&xe.test(e.type)&&e.pageX===und
efined&&e.clientX!==undefined){var c=s.target.ownerDocument||document,l=c.documentElement,f=c.body;s.pageX=e.clientX+(l&&l.scrollLeft||f&&f.scrollLeft||0)-(l&&l.clientLeft||f&&f.clientLeft||0),s.pageY=e.clientY+(l&&l.scrollTop||f&&f.scrollTop||0)-(l&&l.clientTop||f&&f.clientTop||0)}return s.preventDefault=function(){s.isDefaultPrevented=Ee,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},s.stopPropagation=function(){s.isPropagationStopped=Ee,e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0)},!(s.stopImmediatePropagation=function(){s.isImmediatePropagationStopped=Ee,s.stopPropagation()})==((u=s).isDefaultPrevented===Ee||u.isDefaultPrevented===Ne)&&(s.isDefaultPrevented=Ne,s.isPropagationStopped=Ne,s.isImmediatePropagationStopped=Ne),"undefined"==typeof s.metaKey&&(s.metaKey=!1),s},Ae=function(e,t,n){var r=e.document,o={type:"ready"};if(n.dom
Loaded)t(o);else{var i=function(){return"complete"===r.readyState||"interactive"===r.readyState&&r.body},a=function(){n.domLoaded||(n.domLoaded=!0,t(o))},u=function(){i()&&(ke(r,"readystatechange",u),a())},s=function(){try{r.documentElement.doScroll("left")}catch(e){return void Ce.setTimeout(s)}a()};!r.addEventListener||ge.ie&&ge.ie<11?(Se(r,"readystatechange",u),r.documentElement.doScroll&&e.self===e.top&&s()):i()?a():Se(e,"DOMContentLoaded",a),Se(e,"load",a)}},Re=function(){var m,p,g,h,v,y=this,b={};p="mce-data-"+(+new Date).toString(32),h="onmouseenter"in document.documentElement,g="onfocusin"in document.documentElement,v={mouseenter:"mouseover",mouseleave:"mouseout"},m=1,y.domLoaded=!1,y.events=b;var C=function(e,t){var n,r,o,i,a=b[t];if(n=a&&a[e.type])for(r=0,o=n.length;r<o;r++)if((i=n[r])&&!1===i.f
unc.call(i.scope,e)&&e.preventDefault(),e.isImmediatePropagationStopped())return};y.bind=function(e,t,n,r){var o,i,a,u,s,c,l,f=window,d=function(e){C(Te(e||f.event),o)};if(e&&3!==e.nodeType&&8!==e.nodeType){for(e[p]?o=e[p]:(o=m++,e[p]=o,b[o]={}),r=r||e,a=(t=t.split(" ")).length;a--;)c=d,s=l=!1,"DOMContentLoaded"===(u=t[a])&&(u="ready"),y.domLoaded&&"ready"===u&&"complete"===e.readyState?n.call(r,Te({type:u})):(h||(s=v[u])&&(c=function(e){var t,n;if(t=e.currentTarget,(n=e.relatedTarget)&&t.contains)n=t.contains(n);else for(;n&&n!==t;)n=n.parentNode;n||((e=Te(e||f.event)).type="mouseout"===e.type?"mouseleave":"mouseenter",e.target=t,C(e,o))}),g||"focusin"!==u&&"focusout"!==u||(l=!0,s="focusin"===u?"focus":"blur",c=function(e){(e=Te(e||f.event)).type="focus"===e.type?&q
uot;focusin":"focusout",C(e,o)}),(i=b[o][u])?"ready"===u&&y.domLoaded?n({type:u}):i.push({func:n,scope:r}):(b[o][u]=i=[{func:n,scope:r}],i.fakeName=s,i.capture=l,i.nativeHandler=c,"ready"===u?Ae(e,c,y):Se(e,s||u,c,l)));return e=i=0,n}},y.unbind=function(e,t,n){var r,o,i,a,u,s;if(!e||3===e.nodeType||8===e.nodeType)return y;if(r=e[p]){if(s=b[r],t){for(i=(t=t.split(" ")).length;i--;)if(o=s[u=t[i]]){if(n)for(a=o.length;a--;)if(o[a].func===n){var c=o.nativeHandler,l=o.fakeName,f=o.capture;(o=o.slice(0,a).concat(o.slice(a+1))).nativeHandler=c,o.fakeName=l,o.capture=f,s[u]=o}n&&0!==o.length||(delete s[u],ke(e,o.fakeName||u,o.nativeHandler,o.capture))}}else{for(u in s)o=s[u],ke(e,o.fakeName||u,o.nativeHandler,o.capture);s={}}for(u in s)return y;delete b[r];try{delete e[p]}catch(d){e[p]=null}}return y},y.fire=function(e,t,n){var r;if(!e||3===e.nodeType||8===e.nodeType)return y;for((n=Te(null,n)).type=t,n.target=e;(r=e[p])&&
C(n,r),(e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow)&&!n.isPropagationStopped(););return y},y.clean=function(e){var t,n,r=y.unbind;if(!e||3===e.nodeType||8===e.nodeType)return y;if(e[p]&&r(e),e.getElementsByTagName||(e=e.document),e&&e.getElementsByTagName)for(r(e),t=(n=e.getElementsByTagName("*")).length;t--;)(e=n[t])[p]&&r(e);return y},y.destroy=function(){b={}},y.cancel=function(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}};Re.Event=new Re,Re.Event.bind(window,"ready",function(){});var Be="sizzle"+-new Date,_e=window.document,De=0,Oe=0,Pe=mt(),Le=mt(),Ie=mt(),Me=function(e,t){return e===t&&(ue=!0),0},Fe=typeof undefined,ze=1<<31,Ue={}.hasOwnProperty,qe=[],Ve=qe.pop,He=qe.push,je=qe.push,$e=qe.slice,We=qe.indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(this[t]===e)return t;return-1},Ke="[\\x20\\t\\r\\n\\f]",Xe="(?:\\\\.|[\\w-]|[^\
\x00-\\xa0])+",Ye="\\["+Ke+"*("+Xe+")(?:"+Ke+"*([*^$|!~]?=)"+Ke+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+Xe+"))|)"+Ke+"*\\]",Ge=":("+Xe+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+Ye+")*)|.*)\\)|)",Je=new RegExp("^"+Ke+"+|((?:^|[^\\\\])(?:\\\\.)*)"+Ke+"+$","g"),Qe=new RegExp("^"+Ke+"*,"+Ke+"*"),Ze=new RegExp("^"+Ke+"*([>+~]|"+Ke+")"+Ke+"*"),et=new RegExp("="+Ke+"*([^\\]'\"]*?)"+Ke+"*\\]","g"),tt=new RegExp(Ge),nt=new RegExp("^"+Xe+"$"),rt={ID:new RegExp("^#("+Xe+")"),CLASS:new RegExp("^\\.("+Xe+")"),TAG:new RegExp("^("+Xe+"|[*])"),ATTR:new RegExp("^&q
uot;+Ye),PSEUDO:new RegExp("^"+Ge),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+Ke+"*(even|odd|(([+-]|)(\\d*)n|)"+Ke+"*(?:([+-]|)"+Ke+"*(\\d+)|))"+Ke+"*\\)|)","i"),bool:new RegExp("^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$","i"),needsContext:new RegExp("^"+Ke+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+Ke+"*((?:-\\d)?\\d*)"+Ke+"*\\)|)(?=[^-]|$)","i")},ot=/^(?:input|select|textarea|button)$/i,it=/^h\d$/i,at=/^[^{]+\{\s*\[native \w/,ut=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,st=/[+~]/,ct=/'|\\/g,lt=new RegExp("\\\\([\\da-f]{1,6}"+Ke+"?|("+Ke+")|.)","ig"),ft=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|5529
6,1023&r|56320)};try{je.apply(qe=$e.call(_e.childNodes),_e.childNodes),qe[_e.childNodes.length].nodeType}catch(Zx){je={apply:qe.length?function(e,t){He.apply(e,$e.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}var dt=function(e,t,n,r){var o,i,a,u,s,c,l,f,d,m;if((t?t.ownerDocument||t:_e)!==ce&&se(t),n=n||[],!e||"string"!=typeof e)return n;if(1!==(u=(t=t||ce).nodeType)&&9!==u)return[];if(fe&&!r){if(o=ut.exec(e))if(a=o[1]){if(9===u){if(!(i=t.getElementById(a))||!i.parentNode)return n;if(i.id===a)return n.push(i),n}else if(t.ownerDocument&&(i=t.ownerDocument.getElementById(a))&&pe(t,i)&&i.id===a)return n.push(i),n}else{if(o[2])return je.apply(n,t.getElementsByTagName(e)),n;if((a=o[3])&&Q.getElementsByClassName)return je.apply(n,t.getElementsByClassName(a)),n}if(Q.qsa&&(!de||!de.test(e))){if(f=l=Be,d=t,m=9===u&&e,1===u&&"object"!==t.nodeName.toLowerCase()
){for(c=ne(e),(l=t.getAttribute("id"))?f=l.replace(ct,"\\$&"):t.setAttribute("id",f),f="[id='"+f+"'] ",s=c.length;s--;)c[s]=f+xt(c[s]);d=st.test(e)&&bt(t.parentNode)||t,m=c.join(",")}if(m)try{return je.apply(n,d.querySelectorAll(m)),n}catch(p){}finally{l||t.removeAttribute("id")}}}return oe(e.replace(Je,"$1"),t,n,r)};function mt(){var r=[];return function e(t,n){return r.push(t+" ")>Z.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function pt(e){return e[Be]=!0,e}function gt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||ze)-(~e.sourceIndex||ze);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function ht(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function vt(n){return function(e){var t=e.nodeName.toLowerCase();return("input"=
==t||"button"===t)&&e.type===n}}function yt(a){return pt(function(i){return i=+i,pt(function(e,t){for(var n,r=a([],e.length,i),o=r.length;o--;)e[n=r[o]]&&(e[n]=!(t[n]=e[n]))})})}function bt(e){return e&&typeof e.getElementsByTagName!==Fe&&e}for(J in Q=dt.support={},te=dt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},se=dt.setDocument=function(e){var t,s=e?e.ownerDocument||e:_e,n=s.defaultView;return s!==ce&&9===s.nodeType&&s.documentElement?(le=(ce=s).documentElement,fe=!te(s),n&&n!==function(e){try{return e.top}catch(t){}return null}(n)&&(n.addEventListener?n.addEventListener("unload",function(){se()},!1):n.attachEvent&&n.attachEvent("onunload",function(){se()})),Q.attributes=!0,Q.getElementsByTagName=!0,Q.getElementsByClassName=at.test(s.getElementsByClassName),Q.getById=!0,Z.find.ID=function(e,t){if(typeo
f t.getElementById!==Fe&&fe){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},Z.filter.ID=function(e){var t=e.replace(lt,ft);return function(e){return e.getAttribute("id")===t}},Z.find.TAG=Q.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!==Fe)return t.getElementsByTagName(e)}:function(e,t){var n,r=[],o=0,i=t.getElementsByTagName(e);if("*"===e){for(;n=i[o++];)1===n.nodeType&&r.push(n);return r}return i},Z.find.CLASS=Q.getElementsByClassName&&function(e,t){if(fe)return t.getElementsByClassName(e)},me=[],de=[],Q.disconnectedMatch=!0,de=de.length&&new RegExp(de.join("|")),me=me.length&&new RegExp(me.join("|")),t=at.test(le.compareDocumentPosition),pe=t||at.test(le.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocum
entPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},Me=t?function(e,t){if(e===t)return ue=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!Q.sortDetached&&t.compareDocumentPosition(e)===n?e===s||e.ownerDocument===_e&&pe(_e,e)?-1:t===s||t.ownerDocument===_e&&pe(_e,t)?1:ae?We.call(ae,e)-We.call(ae,t):0:4&n?-1:1)}:function(e,t){if(e===t)return ue=!0,0;var n,r=0,o=e.parentNode,i=t.parentNode,a=[e],u=[t];if(!o||!i)return e===s?-1:t===s?1:o?-1:i?1:ae?We.call(ae,e)-We.call(ae,t):0;if(o===i)return gt(e,t);for(n=e;n=n.parentNode;)a.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;a[r]===u[r];)r++;return r?gt(a[r],u[r]):a[r]===_e?-1:u[r]===_e?1:0},s):ce},dt.matches=function(e,t){return dt(e,null,null,t)},dt.matchesSelector=function(e,t){if((e.ownerDocument||e)!==ce&&se(e),t=t.replace(et,"='$1']"),Q
.matchesSelector&&fe&&(!me||!me.test(t))&&(!de||!de.test(t)))try{var n=(void 0).call(e,t);if(n||Q.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(Zx){}return 0<dt(t,ce,null,[e]).length},dt.contains=function(e,t){return(e.ownerDocument||e)!==ce&&se(e),pe(e,t)},dt.attr=function(e,t){(e.ownerDocument||e)!==ce&&se(e);var n=Z.attrHandle[t.toLowerCase()],r=n&&Ue.call(Z.attrHandle,t.toLowerCase())?n(e,t,!fe):undefined;return r!==undefined?r:Q.attributes||!fe?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},dt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},dt.uniqueSort=function(e){var t,n=[],r=0,o=0;if(ue=!Q.detectDuplicates,ae=!Q.sortStable&&e.slice(0),e.sort(Me),ue){for(;t=e[o++];)t===e[o]&&(r=n.push(o));for(;r--;)e.splice(n[r],1)}return ae=null,e},ee=dt.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if
(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=ee(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r++];)n+=ee(t);return n},(Z=dt.selectors={cacheLength:50,createPseudo:pt,match:rt,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(lt,ft),e[3]=(e[3]||e[4]||e[5]||"").replace(lt,ft),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||dt.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&dt.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&
amp;&e[2];return rt.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&tt.test(n)&&(t=ne(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(lt,ft).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=Pe[e+" "];return t||(t=new RegExp("(^|"+Ke+")"+e+"("+Ke+"|$)"))&&Pe(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==Fe&&e.getAttribute("class")||"")})},ATTR:function(n,r,o){return function(e){var t=dt.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===o:"!="===r?t!==o:"^="===r?o&&0===t.indexOf(o):"*="===r?o&&-1&l
t;t.indexOf(o):"$="===r?o&&t.slice(-o.length)===o:"~="===r?-1<(" "+t+" ").indexOf(o):"|="===r&&(t===o||t.slice(0,o.length+1)===o+"-"))}},CHILD:function(m,e,t,p,g){var h="nth"!==m.slice(0,3),v="last"!==m.slice(-4),y="of-type"===e;return 1===p&&0===g?function(e){return!!e.parentNode}:function(e,t,n){var r,o,i,a,u,s,c=h!==v?"nextSibling":"previousSibling",l=e.parentNode,f=y&&e.nodeName.toLowerCase(),d=!n&&!y;if(l){if(h){for(;c;){for(i=e;i=i[c];)if(y?i.nodeName.toLowerCase()===f:1===i.nodeType)return!1;s=c="only"===m&&!s&&"nextSibling"}return!0}if(s=[v?l.firstChild:l.lastChild],v&&d){for(u=(r=(o=l[Be]||(l[Be]={}))[m]||[])[0]===De&&r[1],a=r[0]===De&&r[2],i=u&&l.childNodes[u];i=++u&&i&&i[c]||(a=u=0)||s.pop();)if(1===i.nodeType&&++a&&i===e){
o[m]=[De,u,a];break}}else if(d&&(r=(e[Be]||(e[Be]={}))[m])&&r[0]===De)a=r[1];else for(;(i=++u&&i&&i[c]||(a=u=0)||s.pop())&&((y?i.nodeName.toLowerCase()!==f:1!==i.nodeType)||!++a||(d&&((i[Be]||(i[Be]={}))[m]=[De,a]),i!==e)););return(a-=g)===p||a%p==0&&0<=a/p}}},PSEUDO:function(e,i){var t,a=Z.pseudos[e]||Z.setFilters[e.toLowerCase()]||dt.error("unsupported pseudo: "+e);return a[Be]?a(i):1<a.length?(t=[e,e,"",i],Z.setFilters.hasOwnProperty(e.toLowerCase())?pt(function(e,t){for(var n,r=a(e,i),o=r.length;o--;)e[n=We.call(e,r[o])]=!(t[n]=r[o])}):function(e){return a(e,0,t)}):a}},pseudos:{not:pt(function(e){var r=[],o=[],u=re(e.replace(Je,"$1"));return u[Be]?pt(function(e,t,n,r){for(var o,i=u(e,null,r,[]),a=e.length;a--;)(o=i[a])&&(e[a]=!(t[a]=o))}):function(e,t,n){return r[0]=e,u(r,null,n,o),!o.pop()}}),has:pt(function(t){return function(e){return 0<dt(t,e).length}}),contains:pt(function
(t){return t=t.replace(lt,ft),function(e){return-1<(e.textContent||e.innerText||ee(e)).indexOf(t)}}),lang:pt(function(n){return nt.test(n||"")||dt.error("unsupported lang: "+n),n=n.replace(lt,ft).toLowerCase(),function(e){var t;do{if(t=fe?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=window.location&&window.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===le},focus:function(e){return e===ce.activeElement&&(!ce.hasFocus||ce.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return!1===e.disabled},disabled:function(e){return!0===e.disabled},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.pare
ntNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!Z.pseudos.empty(e)},header:function(e){return it.test(e.nodeName)},input:function(e){return ot.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:yt(function(){return[0]}),last:yt(function(e,t){return[t-1]}),eq:yt(function(e,t,n){return[n<0?n+t:n]}),even:yt(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:yt(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:yt(function(e,t,n){for(var r=n<0?n+t:n;0<=--r;)e.push(r);return e}),gt:yt(function(e,t,n){for(var r=n<0?n+t
:n;++r<t;)e.push(r);return e})}}).pseudos.nth=Z.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})Z.pseudos[J]=ht(J);for(J in{submit:!0,reset:!0})Z.pseudos[J]=vt(J);function Ct(){}function xt(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function wt(a,e,t){var u=e.dir,s=t&&"parentNode"===u,c=Oe++;return e.first?function(e,t,n){for(;e=e[u];)if(1===e.nodeType||s)return a(e,t,n)}:function(e,t,n){var r,o,i=[De,c];if(n){for(;e=e[u];)if((1===e.nodeType||s)&&a(e,t,n))return!0}else for(;e=e[u];)if(1===e.nodeType||s){if((r=(o=e[Be]||(e[Be]={}))[u])&&r[0]===De&&r[1]===c)return i[2]=r[2];if((o[u]=i)[2]=a(e,t,n))return!0}}}function Nt(o){return 1<o.length?function(e,t,n){for(var r=o.length;r--;)if(!o[r](e,t,n))return!1;return!0}:o[0]}function Et(e,t,n,r,o){for(var i,a=[],u=0,s=e.length,c=null!=t;u<s;u++)(i=e[u])&&(n&&!n(i,r,o)||(a.push(i),c&&t.push(u)));return a}function St(m,p,g
,h,v,e){return h&&!h[Be]&&(h=St(h)),v&&!v[Be]&&(v=St(v,e)),pt(function(e,t,n,r){var o,i,a,u=[],s=[],c=t.length,l=e||function(e,t,n){for(var r=0,o=t.length;r<o;r++)dt(e,t[r],n);return n}(p||"*",n.nodeType?[n]:n,[]),f=!m||!e&&p?l:Et(l,u,m,n,r),d=g?v||(e?m:c||h)?[]:t:f;if(g&&g(f,d,n,r),h)for(o=Et(d,s),h(o,[],n,r),i=o.length;i--;)(a=o[i])&&(d[s[i]]=!(f[s[i]]=a));if(e){if(v||m){if(v){for(o=[],i=d.length;i--;)(a=d[i])&&o.push(f[i]=a);v(null,d=[],o,r)}for(i=d.length;i--;)(a=d[i])&&-1<(o=v?We.call(e,a):u[i])&&(e[o]=!(t[o]=a))}}else d=Et(d===t?d.splice(c,d.length):d),v?v(null,t,d,r):je.apply(t,d)})}function kt(e){for(var r,t,n,o=e.length,i=Z.relative[e[0].type],a=i||Z.relative[" "],u=i?1:0,s=wt(function(e){return e===r},a,!0),c=wt(function(e){return-1<We.call(r,e)},a,!0),l=[function(e,t,n){return!i&&(n||t!==ie)||((r=t).nodeType?s(e,t,n):c(e,t,n))}];u<o;u++)if(t=Z.relative[e
[u].type])l=[wt(Nt(l),t)];else{if((t=Z.filter[e[u].type].apply(null,e[u].matches))[Be]){for(n=++u;n<o&&!Z.relative[e[n].type];n++);return St(1<u&&Nt(l),1<u&&xt(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(Je,"$1"),t,u<n&&kt(e.slice(u,n)),n<o&&kt(e=e.slice(n)),n<o&&xt(e))}l.push(t)}return Nt(l)}Ct.prototype=Z.filters=Z.pseudos,Z.setFilters=new Ct,ne=dt.tokenize=function(e,t){var n,r,o,i,a,u,s,c=Le[e+" "];if(c)return t?0:c.slice(0);for(a=e,u=[],s=Z.preFilter;a;){for(i in n&&!(r=Qe.exec(a))||(r&&(a=a.slice(r[0].length)||a),u.push(o=[])),n=!1,(r=Ze.exec(a))&&(n=r.shift(),o.push({value:n,type:r[0].replace(Je," ")}),a=a.slice(n.length)),Z.filter)!(r=rt[i].exec(a))||s[i]&&!(r=s[i](r))||(n=r.shift(),o.push({value:n,type:i,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?dt.error(e):Le(e,u).slice(0)},
re=dt.compile=function(e,t){var n,h,v,y,b,r,o=[],i=[],a=Ie[e+" "];if(!a){for(t||(t=ne(e)),n=t.length;n--;)(a=kt(t[n]))[Be]?o.push(a):i.push(a);(a=Ie(e,(h=i,y=0<(v=o).length,b=0<h.length,r=function(e,t,n,r,o){var i,a,u,s=0,c="0",l=e&&[],f=[],d=ie,m=e||b&&Z.find.TAG("*",o),p=De+=null==d?1:Math.random()||.1,g=m.length;for(o&&(ie=t!==ce&&t);c!==g&&null!=(i=m[c]);c++){if(b&&i){for(a=0;u=h[a++];)if(u(i,t,n)){r.push(i);break}o&&(De=p)}y&&((i=!u&&i)&&s--,e&&l.push(i))}if(s+=c,y&&c!==s){for(a=0;u=v[a++];)u(l,f,t,n);if(e){if(0<s)for(;c--;)l[c]||f[c]||(f[c]=Ve.call(r));f=Et(f)}je.apply(r,f),o&&!e&&0<f.length&&1<s+v.length&&dt.uniqueSort(r)}return o&&(De=p,ie=d),l},y?pt(r):r))).selector=e}return a},oe=dt.select=function(e,t,n,r){var o,i,a,u,s,c="function"==typeof e&&e,l=!r&&ne(e=c.selector||
e);if(n=n||[],1===l.length){if(2<(i=l[0]=l[0].slice(0)).length&&"ID"===(a=i[0]).type&&Q.getById&&9===t.nodeType&&fe&&Z.relative[i[1].type]){if(!(t=(Z.find.ID(a.matches[0].replace(lt,ft),t)||[])[0]))return n;c&&(t=t.parentNode),e=e.slice(i.shift().value.length)}for(o=rt.needsContext.test(e)?0:i.length;o--&&(a=i[o],!Z.relative[u=a.type]);)if((s=Z.find[u])&&(r=s(a.matches[0].replace(lt,ft),st.test(i[0].type)&&bt(t.parentNode)||t))){if(i.splice(o,1),!(e=r.length&&xt(i)))return je.apply(n,r),n;break}}return(c||re(e,l))(r,t,!fe,n,st.test(e)&&bt(t.parentNode)||t),n},Q.sortStable=Be.split("").sort(Me).join("")===Be,Q.detectDuplicates=!!ue,se(),Q.sortDetached=!0;var Tt=Array.isArray,At=function(e,t,n){var r,o;if(!e)return 0;if(n=n||e,e.length!==undefined){for(r=0,o=e.length;r<o;r++)if(!1===t.call(n,e[r],r,e))return 0}else for(r in e)if(e.hasOwnProperty(r)&&!1===
t.call(n,e[r],r,e))return 0;return 1},Rt=function(e,t,n){var r,o;for(r=0,o=e.length;r<o;r++)if(t.call(n,e[r],r,e))return r;return-1},Bt={isArray:Tt,toArray:function(e){var t,n,r=e;if(!Tt(e))for(r=[],t=0,n=e.length;t<n;t++)r[t]=e[t];return r},each:At,map:function(n,r){var o=[];return At(n,function(e,t){o.push(r(e,t,n))}),o},filter:function(n,r){var o=[];return At(n,function(e,t){r&&!r(e,t,n)||o.push(e)}),o},indexOf:function(e,t){var n,r;if(e)for(n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},reduce:function(e,t,n,r){var o=0;for(arguments.length<3&&(n=e[0]);o<e.length;o++)n=t.call(r,n,e[o],o);return n},findIndex:Rt,find:function(e,t,n){var r=Rt(e,t,n);return-1!==r?e[r]:undefined},last:function(e){return e[e.length-1]}},_t=/^\s*|\s*$/g,Dt=function(e){return null===e||e===undefined?"":(""+e).replace(_t,"")},Ot=function(e,t){return t?!("array"!==t||!Bt.isArray(e))||typeof e===t:e!==undefined},Pt=function(e,n,r,
o){o=o||this,e&&(r&&(e=e[r]),Bt.each(e,function(e,t){if(!1===n.call(o,e,t,r))return!1;Pt(e,n,r,o)}))},Lt={trim:Dt,isArray:Bt.isArray,is:Ot,toArray:Bt.toArray,makeMap:function(e,t,n){var r;for(t=t||",","string"==typeof(e=e||[])&&(e=e.split(t)),n=n||{},r=e.length;r--;)n[e[r]]={};return n},each:Bt.each,map:Bt.map,grep:Bt.filter,inArray:Bt.indexOf,hasOwn:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},extend:function(e,t){for(var n,r,o,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];var u,s=arguments;for(n=1,r=s.length;n<r;n++)for(o in t=s[n])t.hasOwnProperty(o)&&(u=t[o])!==undefined&&(e[o]=u);return e},create:function(e,t,n){var r,o,i,a,u,s=this,c=0;if(e=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(e),i=e[3].match(/(^|\.)(\w+)$/i)[2],!(o=s.createNS(e[3].replace(/\.\w+$/,""),n))[i]){if("static"===e[2])return o[i]=t,void(this.onCreate&&this.onCreate(e[2],e[3],o[i]));t[i]||(t[i]=f
unction(){},c=1),o[i]=t[i],s.extend(o[i].prototype,t),e[5]&&(r=s.resolve(e[5]).prototype,a=e[5].match(/\.(\w+)$/i)[1],u=o[i],o[i]=c?function(){return r[a].apply(this,arguments)}:function(){return this.parent=r[a],u.apply(this,arguments)},o[i].prototype[i]=o[i],s.each(r,function(e,t){o[i].prototype[t]=r[t]}),s.each(t,function(e,t){r[t]?o[i].prototype[t]=function(){return this.parent=r[t],e.apply(this,arguments)}:t!==i&&(o[i].prototype[t]=e)})),s.each(t["static"],function(e,t){o[i][t]=e})}},walk:Pt,createNS:function(e,t){var n,r;for(t=t||window,e=e.split("."),n=0;n<e.length;n++)t[r=e[n]]||(t[r]={}),t=t[r];return t},resolve:function(e,t){var n,r;for(t=t||window,n=0,r=(e=e.split(".")).length;n<r&&(t=t[e[n]]);n++);return t},explode:function(e,t){return!e||Ot(e,"array")?e:Bt.map(e.split(t||","),Dt)},_addCacheSuffix:function(e){var t=ge.cacheSuffix;return t&&(e+=(-1===e.indexOf("?")?"?&qu
ot;:"&")+t),e}},It=document,Mt=Array.prototype.push,Ft=Array.prototype.slice,zt=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,Ut=Re.Event,qt=Lt.makeMap("children,contents,next,prev"),Vt=function(e){return void 0!==e},Ht=function(e){return"string"==typeof e},jt=function(e,t){var n,r,o;for(o=(t=t||It).createElement("div"),n=t.createDocumentFragment(),o.innerHTML=e;r=o.firstChild;)n.appendChild(r);return n},$t=function(e,t,n,r){var o;if(Ht(t))t=jt(t,an(e[0]));else if(t.length&&!t.nodeType){if(t=en.makeArray(t),r)for(o=t.length-1;0<=o;o--)$t(e,t[o],n,r);else for(o=0;o<t.length;o++)$t(e,t[o],n,r);return e}if(t.nodeType)for(o=e.length;o--;)n.call(e[o],t);return e},Wt=function(e,t){return e&&t&&-1!==(" "+e.className+" ").indexOf(" "+t+" ")},Kt=function(e,t,n){var r,o;return t=en(t)[0],e.each(function(){var e=this;n&&r===e.parentNode||(r=e.parentNode,o=t.cloneNo
de(!1),e.parentNode.insertBefore(o,e)),o.appendChild(e)}),e},Xt=Lt.makeMap("fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom"," "),Yt=Lt.makeMap("checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected"," "),Gt={"for":"htmlFor","class":"className",readonly:"readOnly"},Jt={"float":"cssFloat"},Qt={},Zt={},en=function(e,t){return new en.fn.init(e,t)},tn=/^\s*|\s*$/g,nn=function(e){return null===e||e===undefined?"":(""+e).replace(tn,"")},rn=function(e,t){var n,r,o,i;if(e)if((n=e.length)===undefined){for(r in e)if(e.hasOwnProperty(r)&&(i=e[r],!1===t.call(i,r,i)))break}else for(o=0;o<n&&(i=e[o],!1!==t.call(i,o,i));o++);return e},on=function(e,n){var r=[];return rn(e,function(e,t){n(t,e)&&r.push(t)}),r},an=function(e){return e?9===e.nodeType?e:e.ownerDocument:It};en.fn
=en.prototype={constructor:en,selector:"",context:null,length:0,init:function(e,t){var n,r,o=this;if(!e)return o;if(e.nodeType)return o.context=o[0]=e,o.length=1,o;if(t&&t.nodeType)o.context=t;else{if(t)return en(e).attr(t);o.context=t=document}if(Ht(e)){if(!(n="<"===(o.selector=e).charAt(0)&&">"===e.charAt(e.length-1)&&3<=e.length?[null,e,null]:zt.exec(e)))return en(t).find(e);if(n[1])for(r=jt(e,an(t)).firstChild;r;)Mt.call(o,r),r=r.nextSibling;else{if(!(r=an(t).getElementById(n[2])))return o;if(r.id!==n[2])return o.find(e);o.length=1,o[0]=r}}else this.add(e,!1);return o},toArray:function(){return Lt.toArray(this)},add:function(e,t){var n,r,o=this;if(Ht(e))return o.add(en(e));if(!1!==t)for(n=en.unique(o.toArray().concat(en.makeArray(e))),o.length=n.length,r=0;r<n.length;r++)o[r]=n[r];else Mt.apply(o,en.makeArray(e));return o},attr:function(t,n){var e,r=this;if("object"==typeof t)rn(t,function(e,t){r.attr(e,
t)});else{if(!Vt(n)){if(r[0]&&1===r[0].nodeType){if((e=Qt[t])&&e.get)return e.get(r[0],t);if(Yt[t])return r.prop(t)?t:undefined;null===(n=r[0].getAttribute(t,2))&&(n=undefined)}return n}this.each(function(){var e;if(1===this.nodeType){if((e=Qt[t])&&e.set)return void e.set(this,n);null===n?this.removeAttribute(t,2):this.setAttribute(t,n,2)}})}return r},removeAttr:function(e){return this.attr(e,null)},prop:function(e,t){var n=this;if("object"==typeof(e=Gt[e]||e))rn(e,function(e,t){n.prop(e,t)});else{if(!Vt(t))return n[0]&&n[0].nodeType&&e in n[0]?n[0][e]:t;this.each(function(){1===this.nodeType&&(this[e]=t)})}return n},css:function(n,r){var e,o,i=this,t=function(e){return e.replace(/-(\D)/g,function(e,t){return t.toUpperCase()})},a=function(e){return e.replace(/[A-Z]/g,function(e){return"-"+e})};if("object"==typeof n)rn(n,function(e,t){i.css(e,t)});else if(Vt(r))n=t(n),"number"!=typeof r||X
t[n]||(r=r.toString()+"px"),i.each(function(){var e=this.style;if((o=Zt[n])&&o.set)o.set(this,r);else{try{this.style[Jt[n]||n]=r}catch(t){}null!==r&&""!==r||(e.removeProperty?e.removeProperty(a(n)):e.removeAttribute(n))}});else{if(e=i[0],(o=Zt[n])&&o.get)return o.get(e);if(!e.ownerDocument.defaultView)return e.currentStyle?e.currentStyle[t(n)]:"";try{return e.ownerDocument.defaultView.getComputedStyle(e,null).getPropertyValue(a(n))}catch(u){return undefined}}return i},remove:function(){for(var e,t=this.length;t--;)e=this[t],Ut.clean(e),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var e,t=this.length;t--;)for(e=this[t];e.firstChild;)e.removeChild(e.firstChild);return this},html:function(e){var t,n=this;if(Vt(e)){t=n.length;try{for(;t--;)n[t].innerHTML=e}catch(r){en(n[t]).empty().append(e)}return n}return n[0]?n[0].innerHTML:""},text:function(e){var t,n=this;if(Vt(e)){for(t=n.length;
t--;)"innerText"in n[t]?n[t].innerText=e:n[0].textContent=e;return n}return n[0]?n[0].innerText||n[0].textContent:""},append:function(){return $t(this,arguments,function(e){(1===this.nodeType||this.host&&1===this.host.nodeType)&&this.appendChild(e)})},prepend:function(){return $t(this,arguments,function(e){(1===this.nodeType||this.host&&1===this.host.nodeType)&&this.insertBefore(e,this.firstChild)},!0)},before:function(){return this[0]&&this[0].parentNode?$t(this,arguments,function(e){this.parentNode.insertBefore(e,this)}):this},after:function(){return this[0]&&this[0].parentNode?$t(this,arguments,function(e){this.parentNode.insertBefore(e,this.nextSibling)},!0):this},appendTo:function(e){return en(e).append(this),this},prependTo:function(e){return en(e).prepend(this),this},replaceWith:function(e){return this.before(e).remove()},wrap:function(e){return Kt(this,e)},wrapAll:function(e){return Kt(this,e,!0)},wrapInner:
function(e){return this.each(function(){en(this).contents().wrapAll(e)}),this},unwrap:function(){return this.parent().each(function(){en(this).replaceWith(this.childNodes)})},clone:function(){var e=[];return this.each(function(){e.push(this.cloneNode(!0))}),en(e)},addClass:function(e){return this.toggleClass(e,!0)},removeClass:function(e){return this.toggleClass(e,!1)},toggleClass:function(o,i){var e=this;return"string"!=typeof o||(-1!==o.indexOf(" ")?rn(o.split(" "),function(){e.toggleClass(this,i)}):e.each(function(e,t){var n,r;(r=Wt(t,o))!==i&&(n=t.className,r?t.className=nn((" "+n+" ").replace(" "+o+" "," ")):t.className+=n?" "+o:o)})),e},hasClass:function(e){return Wt(this[0],e)},each:function(e){return rn(this,e)},on:function(e,t){return this.each(function(){Ut.bind(this,e,t)})},off:function(e,t){return this.each(function(){Ut.unbind(this,e,t)})},trigger:function(e){return this.ea
ch(function(){"object"==typeof e?Ut.fire(this,e.type,e):Ut.fire(this,e)})},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},slice:function(){return new en(Ft.apply(this,arguments))},eq:function(e){return-1===e?this.slice(e):this.slice(e,+e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},find:function(e){var t,n,r=[];for(t=0,n=this.length;t<n;t++)en.find(e,this[t],r);return en(r)},filter:function(n){return en("function"==typeof n?on(this.toArray(),function(e,t){return n(t,e)}):en.filter(n,this.toArray()))},closest:function(n){var r=[];return n instanceof en&&(n=n[0]),this.each(function(e,t){for(;t;){if("string"==typeof n&&en(t).is(n)){r.push(t);break}if(t===n){r.push(t);break}t=t.parentNode}}),en(r)},offset:function(e){var t,n,r,o,i=0,a=0;return e?this.css(e):((t=this[0])&&(r=(n=t.ownerDocument).documentElement,t
.getBoundingClientRect&&(i=(o=t.getBoundingClientRect()).left+(r.scrollLeft||n.body.scrollLeft)-r.clientLeft,a=o.top+(r.scrollTop||n.body.scrollTop)-r.clientTop)),{left:i,top:a})},push:Mt,sort:[].sort,splice:[].splice},Lt.extend(en,{extend:Lt.extend,makeArray:function(e){return(t=e)&&t===t.window||e.nodeType?[e]:Lt.toArray(e);var t},inArray:function(e,t){var n;if(t.indexOf)return t.indexOf(e);for(n=t.length;n--;)if(t[n]===e)return n;return-1},isArray:Lt.isArray,each:rn,trim:nn,grep:on,find:dt,expr:dt.selectors,unique:dt.uniqueSort,text:dt.getText,contains:dt.contains,filter:function(e,t,n){var r=t.length;for(n&&(e=":not("+e+")");r--;)1!==t[r].nodeType&&t.splice(r,1);return t=1===t.length?en.find.matchesSelector(t[0],e)?[t[0]]:[]:en.find.matches(e,t)}});var un=function(e,t,n){var r=[],o=e[t];for("string"!=typeof n&&n instanceof en&&(n=n[0]);o&&9!==o.nodeType;){if(n!==undefined){if(o===n)break;if(&qu
ot;string"==typeof n&&en(o).is(n))break}1===o.nodeType&&r.push(o),o=o[t]}return r},sn=function(e,t,n,r){var o=[];for(r instanceof en&&(r=r[0]);e;e=e[t])if(!n||e.nodeType===n){if(r!==undefined){if(e===r)break;if("string"==typeof r&&en(e).is(r))break}o.push(e)}return o},cn=function(e,t,n){for(e=e[t];e;e=e[t])if(e.nodeType===n)return e;return null};rn({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return un(e,"parentNode")},next:function(e){return cn(e,"nextSibling",1)},prev:function(e){return cn(e,"previousSibling",1)},children:function(e){return sn(e.firstChild,"nextSibling",1)},contents:function(e){return Lt.toArray(("iframe"===e.nodeName?e.contentDocument||e.contentWindow.document:e).childNodes)}},function(e,r){en.fn[e]=function(t){var n=[];return this.each(function(){var e=r.call(n,this,t,n);e&&(en.isArray(e)?n.push.apply(n,
e):n.push(e))}),1<this.length&&(qt[e]||(n=en.unique(n)),0===e.indexOf("parents")&&(n=n.reverse())),n=en(n),t?n.filter(t):n}}),rn({parentsUntil:function(e,t){return un(e,"parentNode",t)},nextUntil:function(e,t){return sn(e,"nextSibling",1,t).slice(1)},prevUntil:function(e,t){return sn(e,"previousSibling",1,t).slice(1)}},function(r,o){en.fn[r]=function(t,e){var n=[];return this.each(function(){var e=o.call(n,this,t,n);e&&(en.isArray(e)?n.push.apply(n,e):n.push(e))}),1<this.length&&(n=en.unique(n),0!==r.indexOf("parents")&&"prevUntil"!==r||(n=n.reverse())),n=en(n),e?n.filter(e):n}}),en.fn.is=function(e){return!!e&&0<this.filter(e).length},en.fn.init.prototype=en.fn,en.overrideDefaults=function(n){var r,o=function(e,t){return r=r||n(),0===arguments.length&&(e=r.element),t||(t=r.context),new o.fn.init(e,t)};return en.extend(o,this),o};var ln=function(n,r,e){rn(e,fu
nction(e,t){n[e]=n[e]||{},n[e][r]=t})};ge.ie&&ge.ie<8&&(ln(Qt,"get",{maxlength:function(e){var t=e.maxLength;return 2147483647===t?undefined:t},size:function(e){var t=e.size;return 20===t?undefined:t},"class":function(e){return e.className},style:function(e){var t=e.style.cssText;return 0===t.length?undefined:t}}),ln(Qt,"set",{"class":function(e,t){e.className=t},style:function(e,t){e.style.cssText=t}})),ge.ie&&ge.ie<9&&(Jt["float"]="styleFloat",ln(Zt,"set",{opacity:function(e,t){var n=e.style;null===t||""===t?n.removeAttribute("filter"):(n.zoom=1,n.filter="alpha(opacity="+100*t+")")}})),en.attrHooks=Qt,en.cssHooks=Zt;var fn,dn=function(e){var t,n=!1;return function(){return n||(n=!0,t=e.apply(null,arguments)),t}},mn=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.test(t))return r}return undefined}(e,t);i
f(!n)return{major:0,minor:0};var r=function(e){return Number(t.replace(n,"$"+e))};return gn(r(1),r(2))},pn=function(){return gn(0,0)},gn=function(e,t){return{major:e,minor:t}},hn={nu:gn,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?pn():mn(e,n)},unknown:pn},vn="Firefox",yn=function(e,t){return function(){return t===e}},bn=function(e){var t=e.current;return{current:t,version:e.version,isEdge:yn("Edge",t),isChrome:yn("Chrome",t),isIE:yn("IE",t),isOpera:yn("Opera",t),isFirefox:yn(vn,t),isSafari:yn("Safari",t)}},Cn={unknown:function(){return bn({current:undefined,version:hn.unknown()})},nu:bn,edge:V.constant("Edge"),chrome:V.constant("Chrome"),ie:V.constant("IE"),opera:V.constant("Opera"),firefox:V.constant(vn),safari:V.constant("Safari")},xn="Windows",wn="Android",Nn="Solaris",En="FreeBSD",Sn=function(e,
t){return function(){return t===e}},kn=function(e){var t=e.current;return{current:t,version:e.version,isWindows:Sn(xn,t),isiOS:Sn("iOS",t),isAndroid:Sn(wn,t),isOSX:Sn("OSX",t),isLinux:Sn("Linux",t),isSolaris:Sn(Nn,t),isFreeBSD:Sn(En,t)}},Tn={unknown:function(){return kn({current:undefined,version:hn.unknown()})},nu:kn,windows:V.constant(xn),ios:V.constant("iOS"),android:V.constant(wn),linux:V.constant("Linux"),osx:V.constant("OSX"),solaris:V.constant(Nn),freebsd:V.constant(En)},An=function(e,t){var n=String(t).toLowerCase();return H.find(e,function(e){return e.search(n)})},Rn=function(e,n){return An(e,n).map(function(e){var t=hn.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Bn=function(e,n){return An(e,n).map(function(e){var t=hn.detect(e.versionRegexes,n);return{current:e.name,version:t}})},_n=function(e,t){return-1!==e.indexOf(t)},Dn=function(e){return e.replace(/^\s+|\s+$/g,"")},On=/.*?version\
/\ ?([0-9]+)\.([0-9]+).*/,Pn=function(t){return function(e){return _n(e,t)}},Ln=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return _n(e,"edge/")&&_n(e,"chrome")&&_n(e,"safari")&&_n(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,On],search:function(e){return _n(e,"chrome")&&!_n(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return _n(e,"msie")||_n(e,"trident")}},{name:"Opera",versionRegexes:[On,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Pn("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Pn("firefox")},{name:"Safari",versionRegexes:[On,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(_n(e,"
safari")||_n(e,"mobile/"))&&_n(e,"applewebkit")}}],In=[{name:"Windows",search:Pn("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return _n(e,"iphone")||_n(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Pn("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Pn("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Pn("linux"),versionRegexes:[]},{name:"Solaris",search:Pn("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Pn("freebsd"),versionRegexes:[]}],Mn={browsers:V.constant(Ln),oses:V.constant(In)},Fn=function(e){var t,n,r,o,i,a,u,s,c,l,f,d=Mn.browsers(),m=Mn.oses(),p=Rn(d,e).fold(Cn.unkn
own,Cn.nu),g=Bn(m,e).fold(Tn.unknown,Tn.nu);return{browser:p,os:g,deviceType:(n=p,r=e,o=(t=g).isiOS()&&!0===/ipad/i.test(r),i=t.isiOS()&&!o,a=t.isAndroid()&&3===t.version.major,u=t.isAndroid()&&4===t.version.major,s=o||a||u&&!0===/mobile/i.test(r),c=t.isiOS()||t.isAndroid(),l=c&&!s,f=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(r),{isiPad:V.constant(o),isiPhone:V.constant(i),isTablet:V.constant(s),isPhone:V.constant(l),isTouch:V.constant(c),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:V.constant(f)})}},zn={detect:dn(function(){var e=navigator.userAgent;return Fn(e)})},Un=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:V.constant(e)}},qn={fromHtml:function(e,t){var n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||1<n.childNodes.length)throw console.error("HTML does not have a single root node",e),"HTML mu
st have a single root node";return Un(n.childNodes[0])},fromTag:function(e,t){var n=(t||document).createElement(e);return Un(n)},fromText:function(e,t){var n=(t||document).createTextNode(e);return Un(n)},fromDom:Un,fromPoint:function(e,t,n){return A.from(e.dom().elementFromPoint(t,n)).map(Un)}},Vn=8,Hn=9,jn=1,$n=3,Wn=function(e){return e.dom().nodeName.toLowerCase()},Kn=function(e){return e.dom().nodeType},Xn=function(t){return function(e){return Kn(e)===t}},Yn=Xn(jn),Gn=Xn($n),Jn=Xn(Hn),Qn={name:Wn,type:Kn,value:function(e){return e.dom().nodeValue},isElement:Yn,isText:Gn,isDocument:Jn,isComment:function(e){return Kn(e)===Vn||"#comment"===Wn(e)}},Zn=(fn=Object.keys)===undefined?function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}:fn,er=function(e,t){for(var n=Zn(e),r=0,o=n.length;r<o;r++){var i=n[r];t(e[i],i,e)}},tr=function(r,o){var i={};return er(r,function(e,t){var n=o(e,t,r);i[n.k]=n.v}),i},nr=function(e,n){var r=[];return er(e,
function(e,t){r.push(n(e,t))}),r},rr=function(e){return nr(e,function(e){return e})},or={bifilter:function(e,n){var r={},o={};return er(e,function(e,t){(n(e,t)?r:o)[t]=e}),{t:r,f:o}},each:er,map:function(e,r){return tr(e,function(e,t,n){return{k:t,v:r(e,t,n)}})},mapToArray:nr,tupleMap:tr,find:function(e,t){for(var n=Zn(e),r=0,o=n.length;r<o;r++){var i=n[r],a=e[i];if(t(a,i,e))return A.some(a)}return A.none()},keys:Zn,values:rr,size:function(e){return rr(e).length}},ir=function(e,t,n){if(!(E.isString(n)||E.isBoolean(n)||E.isNumber(n)))throw console.error("Invalid call to Attr.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},ar=function(e,t,n){ir(e.dom(),t,n)},ur=function(e,t){var n=e.dom().getAttribute(t);return null===n?undefined:n},sr=function(e,t){var n=e.dom();return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},cr={clone:function(e){return H.foldl(e.dom().attrib
utes,function(e,t){return e[t.name]=t.value,e},{})},set:ar,setAll:function(e,t){var n=e.dom();or.each(t,function(e,t){ir(n,t,e)})},get:ur,has:sr,remove:function(e,t){e.dom().removeAttribute(t)},hasNone:function(e){var t=e.dom().attributes;return t===undefined||null===t||0===t.length},transfer:function(o,i,e){Qn.isElement(o)&&Qn.isElement(i)&&H.each(e,function(e){var t,n,r;n=i,sr(t=o,r=e)&&!sr(n,r)&&ar(n,r,ur(t,r))})}},lr=dn(function(){return fr(qn.fromDom(document))}),fr=function(e){var t=e.dom().body;if(null===t||t===undefined)throw"Body is not available yet";return qn.fromDom(t)},dr={body:lr,getBody:fr,inBody:function(e){var t=Qn.isText(e)?e.dom().parentNode:e.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)}},mr=function(e){return e.style!==undefined},pr=function(e,t,n){if(!E.isString(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element "
;,e),new Error("CSS value must be a string: "+n);mr(e)&&e.style.setProperty(t,n)},gr=function(e,t){return mr(e)?e.style.getPropertyValue(t):""},hr=function(e,t){var n=e.dom(),r=gr(n,t);return A.from(r).filter(function(e){return 0<e.length})},vr=function(e,t){var n=e.dom();or.each(t,function(e,t){pr(n,t,e)})},yr=function(e,t){var n=e.dom(),r=window.getComputedStyle(n).getPropertyValue(t),o=""!==r||dr.inBody(e)?r:gr(n,t);return null===o?undefined:o},br=hr,Cr=function(e){return e.slice(0).sort()},xr={sort:Cr,reqMessage:function(e,t){throw new Error("All required keys ("+Cr(e).join(", ")+") were not specified. Specified keys were: "+Cr(t).join(", ")+".")},unsuppMessage:function(e){throw new Error("Unsupported keys for object: "+Cr(e).join(", "))},validateStrArr:function(t,e){if(!E.isArray(e))throw new Error("The "+t+" fields must be an array. Was: "+e+"
.");H.each(e,function(e){if(!E.isString(e))throw new Error("The value "+e+" in the "+t+" fields was not a string.")})},invalidTypeMessage:function(e,t){throw new Error("All values need to be of type: "+t+". Keys ("+Cr(e).join(", ")+") were not.")},checkDupes:function(e){var n=Cr(e);H.find(n,function(e,t){return t<n.length-1&&e===n[t+1]}).each(function(e){throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+n.join(", ")+"].")})}},wr={immutable:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(t.length!==n.length)throw new Error('Wrong number of arguments to struct. Expected "['+t.length+']", got '+n.length+" arguments");var r={};return H.each(t,function(e,t){r[e]=V.constant(n[t])}),r}},immutableBag:function(o
,i){var a=o.concat(i);if(0===a.length)throw new Error("You must specify at least one required or optional field.");return xr.validateStrArr("required",o),xr.validateStrArr("optional",i),xr.checkDupes(a),function(t){var n=or.keys(t);H.forall(o,function(e){return H.contains(n,e)})||xr.reqMessage(o,n);var e=H.filter(n,function(e){return!H.contains(a,e)});0<e.length&&xr.unsuppMessage(e);var r={};return H.each(o,function(e){r[e]=V.constant(t[e])}),H.each(i,function(e){r[e]=V.constant(Object.prototype.hasOwnProperty.call(t,e)?A.some(t[e]):A.none())}),r}}},Nr=function(e,t){for(var n=[],r=function(e){return n.push(e),t(e)},o=t(e);(o=o.bind(r)).isSome(););return n},Er=function(){return j.getOrDie("Node")},Sr=function(e,t,n){return 0!=(e.compareDocumentPosition(t)&n)},kr=function(e,t){return Sr(e,t,Er().DOCUMENT_POSITION_CONTAINED_BY)},Tr=jn,Ar=Hn,Rr=function(e){return e.nodeType!==Tr&&e.nodeType!==Ar||0===e.childElementCount},Br=
{all:function(e,t){var n=t===undefined?document:t.dom();return Rr(n)?[]:H.map(n.querySelectorAll(e),qn.fromDom)},is:function(e,t){var n=e.dom();if(n.nodeType!==Tr)return!1;if(n.matches!==undefined)return n.matches(t);if(n.msMatchesSelector!==undefined)return n.msMatchesSelector(t);if(n.webkitMatchesSelector!==undefined)return n.webkitMatchesSelector(t);if(n.mozMatchesSelector!==undefined)return n.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},one:function(e,t){var n=t===undefined?document:t.dom();return Rr(n)?A.none():A.from(n.querySelector(e)).map(qn.fromDom)}},_r=function(e,t){return e.dom()===t.dom()},Dr=zn.detect().browser.isIE()?function(e,t){return kr(e.dom(),t.dom())}:function(e,t){var n=e.dom(),r=t.dom();return n!==r&&n.contains(r)},Or={eq:_r,isEqualNode:function(e,t){return e.dom().isEqualNode(t.dom())},member:function(e,t){return H.exists(t,V.curry(_r,e))},contains:Dr,is:Br.is},Pr=function(e){return qn.fromDom(e.dom().ownerDocume
nt)},Lr=function(e){var t=e.dom();return A.from(t.parentNode).map(qn.fromDom)},Ir=function(e){var t=e.dom();return A.from(t.previousSibling).map(qn.fromDom)},Mr=function(e){var t=e.dom();return A.from(t.nextSibling).map(qn.fromDom)},Fr=function(e){var t=e.dom();return H.map(t.childNodes,qn.fromDom)},zr=function(e,t){var n=e.dom().childNodes;return A.from(n[t]).map(qn.fromDom)},Ur=wr.immutable("element","offset"),qr={owner:Pr,defaultView:function(e){var t=e.dom().ownerDocument.defaultView;return qn.fromDom(t)},documentElement:function(e){var t=Pr(e);return qn.fromDom(t.dom().documentElement)},parent:Lr,findIndex:function(n){return Lr(n).bind(function(e){var t=Fr(e);return H.findIndex(t,function(e){return Or.eq(n,e)})})},parents:function(e,t){for(var n=E.isFunction(t)?t:V.constant(!1),r=e.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,a=qn.fromDom(i);if(o.push(a),!0===n(a))break;r=i}return o},siblings:function(t){return Lr(t).
map(Fr).map(function(e){return H.filter(e,function(e){return!Or.eq(t,e)})}).getOr([])},prevSibling:Ir,offsetParent:function(e){var t=e.dom();return A.from(t.offsetParent).map(qn.fromDom)},prevSiblings:function(e){return H.reverse(Nr(e,Ir))},nextSibling:Mr,nextSiblings:function(e){return Nr(e,Mr)},children:Fr,child:zr,firstChild:function(e){return zr(e,0)},lastChild:function(e){return zr(e,e.dom().childNodes.length-1)},childNodesCount:function(e){return e.dom().childNodes.length},hasChildNodes:function(e){return e.dom().hasChildNodes()},leaf:function(e,t){var n=Fr(e);return 0<n.length&&t<n.length?Ur(n[t],0):Ur(e,t)}},Vr=zn.detect().browser,Hr=function(e){return H.find(e,Qn.isElement)},jr={getPos:function(e,t,n){var r,o,i,a=0,u=0,s=e.ownerDocument;if(n=n||e,t){if(n===e&&t.getBoundingClientRect&&"static"===yr(qn.fromDom(e),"position"))return{x:a=(o=t.getBoundingClientRect()).left+(s.documentElement.scrollLeft||e.scrollLeft)-s.documentEl
ement.clientLeft,y:u=o.top+(s.documentElement.scrollTop||e.scrollTop)-s.documentElement.clientTop};for(r=t;r&&r!==n&&r.nodeType;)a+=r.offsetLeft||0,u+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!==n&&r.nodeType;)a-=r.scrollLeft||0,u-=r.scrollTop||0,r=r.parentNode;u+=(i=qn.fromDom(t),Vr.isFirefox()&&"table"===Qn.name(i)?Hr(qr.children(i)).filter(function(e){return"caption"===Qn.name(e)}).bind(function(o){return Hr(qr.nextSiblings(o)).map(function(e){var t=e.dom().offsetTop,n=o.dom().offsetTop,r=o.dom().offsetHeight;return t<=n?-r:0})}).getOr(0):0)}return{x:a,y:u}}},$r=function(e){var n=A.none(),t=[],r=function(e){o()?a(e):t.push(e)},o=function(){return n.isSome()},i=function(e){H.each(e,a)},a=function(t){n.each(function(e){setTimeout(function(){t(e)},0)})};return e(function(e){n=A.some(e),i(t),t=[]}),{get:r,map:function(n){return $r(function(t){r(function(e){t(n(e))})})},isReady:o}},Wr={nu:$r,pure:function(t){
return $r(function(e){e(t)})}},Kr=function(n){return function(){var e=Array.prototype.slice.call(arguments),t=this;setTimeout(function(){n.apply(t,e)},0)}},Xr=function(t){var e=function(e){t(Kr(e))};return{map:function(r){return Xr(function(n){e(function(e){var t=r(e);n(t)})})},bind:function(n){return Xr(function(t){e(function(e){n(e).get(t)})})},anonBind:function(n){return Xr(function(t){e(function(e){n.get(t)})})},toLazy:function(){return Wr.nu(e)},get:e}},Yr={nu:Xr,pure:function(t){return Xr(function(e){e(t)})}},Gr=function(a,e){return e(function(r){var o=[],i=0;0===a.length?r([]):H.each(a,function(e,t){var n;e.get((n=t,function(e){o[n]=e,++i>=a.length&&r(o)}))})})},Jr=function(e){return Gr(e,Yr.nu)},Qr={par:Jr,mapM:function(e,t){var n=H.map(e,t);return Jr(n)},compose:function(t,n){return function(e){return n(e).bind(t)}}},Zr=function(n){return{is:function(e){return n===e},isValue:V.always,isError:V.never,getOr:V.constant(n),getOrThunk:V.constant(n),getOrDie:V.constant
(n),or:function(e){return Zr(n)},orThunk:function(e){return Zr(n)},fold:function(e,t){return t(n)},map:function(e){return Zr(e(n))},each:function(e){e(n)},bind:function(e){return e(n)},exists:function(e){return e(n)},forall:function(e){return e(n)},toOption:function(){return A.some(n)}}},eo=function(n){return{is:V.never,isValue:V.never,isError:V.always,getOr:V.identity,getOrThunk:function(e){return e()},getOrDie:function(){return V.die(String(n))()},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return eo(n)},each:V.noop,bind:function(e){return eo(n)},exists:V.never,forall:V.always,toOption:A.none}},to={value:Zr,error:eo};function no(e,u){var t=e,n=function(e,t,n,r){var o,i;if(e){if(!r&&e[t])return e[t];if(e!==u){if(o=e[n])return o;for(i=e.parentNode;i&&i!==u;i=i.parentNode)if(o=i[n])return o}}};this.current=function(){return t},this.next=function(e){return t=n(t,"firstChild","nextSibling",
e)},this.prev=function(e){return t=n(t,"lastChild","previousSibling",e)},this.prev2=function(e){return t=function(e,t,n,r){var o,i,a;if(e){if(o=e[n],u&&o===u)return;if(o){if(!r)for(a=o[t];a;a=a[t])if(!a[t])return a;return o}if((i=e.parentNode)&&i!==u)return i}}(t,"lastChild","previousSibling",e)}}var ro,oo,io,ao=function(t){var n;return function(e){return(n=n||H.mapToObject(t,V.constant(!0))).hasOwnProperty(Qn.name(e))}},uo=ao(["h1","h2","h3","h4","h5","h6"]),so=ao(["article","aside","details","div","dt","figcaption","footer","form","fieldset","header","hgroup","html","main","nav","section","summary","body","p","dl","multicol","dd","figure","addres
s","center","blockquote","h1","h2","h3","h4","h5","h6","listing","xmp","pre","plaintext","menu","dir","ul","ol","li","hr","table","tbody","thead","tfoot","th","tr","td","caption"]),co=function(e){return Qn.isElement(e)&&!so(e)},lo=function(e){return Qn.isElement(e)&&"br"===Qn.name(e)},fo=ao(["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"]),mo=ao([&q
uot;ul","ol","dl"]),po=ao(["li","dd","dt"]),go=ao(["area","base","basefont","br","col","frame","hr","img","input","isindex","link","meta","param","embed","source","wbr","track"]),ho=ao(["thead","tbody","tfoot"]),vo=ao(["td","th"]),yo=function(t){return function(e){return!!e&&e.nodeType===t}},bo=yo(1),Co=function(e){var r=e.toLowerCase().split(" ");return function(e){var t,n;if(e&&e.nodeType)for(n=e.nodeName.toLowerCase(),t=0;t<r.length;t++)if(n===r[t])return!0;return!1}},xo=function(t){return function(e){if(bo(e)){if(e.contentEditable===t)return!0;if(e.getAttribute("data-mce-contenteditable")===t)return!0}return!1}},wo=yo(3),No=yo(8),Eo=yo(9),So=Co("br"),ko=xo(&quo
t;true"),To=xo("false"),Ao={isText:wo,isElement:bo,isComment:No,isDocument:Eo,isBr:So,isContentEditableTrue:ko,isContentEditableFalse:To,matchNodeNames:Co,hasPropValue:function(t,n){return function(e){return bo(e)&&e[t]===n}},hasAttribute:function(t,e){return function(e){return bo(e)&&e.hasAttribute(t)}},hasAttributeValue:function(t,n){return function(e){return bo(e)&&e.getAttribute(t)===n}},matchStyleValues:function(r,e){var o=e.toLowerCase().split(" ");return function(e){var t;if(bo(e))for(t=0;t<o.length;t++){var n=e.ownerDocument.defaultView.getComputedStyle(e,null);if((n?n.getPropertyValue(r):null)===o[t])return!0}return!1}},isBogus:function(e){return bo(e)&&e.hasAttribute("data-mce-bogus")},isBogusAll:function(e){return bo(e)&&"all"===e.getAttribute("data-mce-bogus")},isTable:function(e){return bo(e)&&"TABLE"===e.tagName}},Ro=function(e){return e&&"SP
AN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type")},Bo=function(e,t){var n,r=t.childNodes;if(!Ao.isElement(t)||!Ro(t)){for(n=r.length-1;0<=n;n--)Bo(e,r[n]);if(!1===Ao.isDocument(t)){if(Ao.isText(t)&&0<t.nodeValue.length){var o=Lt.trim(t.nodeValue).length;if(e.isBlock(t.parentNode)||0<o)return;if(0===o&&(a=(i=t).previousSibling&&"SPAN"===i.previousSibling.nodeName,u=i.nextSibling&&"SPAN"===i.nextSibling.nodeName,a&&u))return}else if(Ao.isElement(t)&&(1===(r=t.childNodes).length&&Ro(r[0])&&t.parentNode.insertBefore(r[0],t),r.length||go(qn.fromDom(t))))return;e.remove(t)}var i,a,u;return t}},_o={trimNode:Bo},Do=Lt.makeMap,Oo=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Po=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Lo=/[<>&\"\']/g,Io=/&#([a-z0-9]+);?|&([
a-z0-9]+);/gi,Mo={128:"\u20ac",130:"\u201a",131:"\u0192",132:"\u201e",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02c6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017d",145:"\u2018",146:"\u2019",147:"\u201c",148:"\u201d",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02dc",153:"\u2122",154:"\u0161",155:"\u203a",156:"\u0153",158:"\u017e",159:"\u0178"};oo={'"':""","'":"'","<":"<",">":">","&":"&","`":"`"},io={"<":"<",">":">","&":"&","&q
uot;":'"',"'":"'"};var Fo=function(e,t){var n,r,o,i={};if(e){for(e=e.split(","),t=t||10,n=0;n<e.length;n+=2)r=String.fromCharCode(parseInt(e[n],t)),oo[r]||(o="&"+e[n+1]+";",i[r]=o,i[o]=r);return i}};ro=Fo("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc
,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,
8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32);var zo=function(e,t){return e.replace(t?Oo:Po,function(e){return oo[e]||e})},Uo=function(e,t){return e.replace(t?Oo:Po,function(e){return 1<e.length?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":oo[e]||"&#"+e.charCodeAt(0)+";"})},qo=function(e,t,n){return n=n||ro,e.replace(t?Oo:Po,function(e){return oo[e]||n[e]||e})},Vo={encodeRaw:zo,encodeAllRaw:function(e){return(""+e
).replace(Lo,function(e){return oo[e]||e})},encodeNumeric:Uo,encodeNamed:qo,getEncodeFunc:function(e,t){var n=Fo(t)||ro,r=Do(e.replace(/\+/g,","));return r.named&&r.numeric?function(e,t){return e.replace(t?Oo:Po,function(e){return oo[e]!==undefined?oo[e]:n[e]!==undefined?n[e]:1<e.length?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":"&#"+e.charCodeAt(0)+";"})}:r.named?t?function(e,t){return qo(e,t,n)}:qo:r.numeric?Uo:zo},decode:function(e){return e.replace(Io,function(e,t){return t?65535<(t="x"===t.charAt(0).toLowerCase()?parseInt(t.substr(1),16):parseInt(t,10))?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):Mo[t]||String.fromCharCode(t):io[e]||ro[e]||(n=e,(r=qn.fromTag("div").dom()).innerHTML=n,r.textContent||r.innerText||n);var n,r})}},Ho={},jo={},$o=Lt.makeMap,Wo=Lt.each,Ko=Lt.extend,Xo=Lt.explode,Yo=Lt.inArray,Go=function(e,t){return(e=Lt.tri
m(e))?e.split(t||" "):[]},Jo=function(e){var u,t,n,r,o,i,s={},a=function(e,t,n){var r,o,i,a=function(e,t){var n,r,o={};for(n=0,r=e.length;n<r;n++)o[e[n]]=t||{};return o};for(t=t||"","string"==typeof(n=n||[])&&(n=Go(n)),r=(e=Go(e)).length;r--;)i={attributes:a(o=Go([u,t].join(" "))),attributesOrder:o,children:a(n,jo)},s[e[r]]=i},c=function(e,t){var n,r,o,i;for(n=(e=Go(e)).length,t=Go(t);n--;)for(r=s[e[n]],o=0,i=t.length;o<i;o++)r.attributes[t[o]]={},r.attributesOrder.push(t[o])};return Ho[e]?Ho[e]:(u="id accesskey class dir lang style tabindex title role",t="address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul",n="a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment","html4"!==e&&(u+=" contenteditable contextmenu draggable
dropzone hidden spellcheck translate",t+=" article aside details dialog figure header footer hgroup section nav",n+=" audio canvas command datalist mark meter output picture progress time wbr video ruby bdi keygen"),"html5-strict"!==e&&(u+=" xml:lang",n=[n,i="acronym applet basefont big font strike tt"].join(" "),Wo(Go(i),function(e){a(e,"",n)}),t=[t,o="center dir isindex noframes"].join(" "),r=[t,n].join(" "),Wo(Go(o),function(e){a(e,"",r)})),r=r||[t,n].join(" "),a("html","manifest","head body"),a("head","","base command link meta noscript script style title"),a("title hr noscript br"),a("base","href target"),a("link","href rel media hreflang type sizes hreflang"),a("meta","name http-equiv content charset"),a("style&q
uot;,"media type scoped"),a("script","src async defer type charset"),a("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",r),a("address dt dd div caption","",r),a("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",n),a("blockquote","cite",r),a("ol","reversed start type","li"),a("ul","","li"),a("li","value",r),a("dl","","dt dd"),a("a","href target rel media hreflang type",n),a("q","cite",n),a("ins del","cite datetime",r),a("img","src sizes srcset alt usemap ismap width height"),a("iframe&
quot;,"src name width height",r),a("embed","src type width height"),a("object","data type typemustmatch name usemap form width height",[r,"param"].join(" ")),a("param","name value"),a("map","name",[r,"area"].join(" ")),a("area","alt coords shape href target rel media hreflang type"),a("table","border","caption colgroup thead tfoot tbody tr"+("html4"===e?" col":"")),a("colgroup","span","col"),a("col","span"),a("tbody thead tfoot","","tr"),a("tr","","td th"),a("td","colspan rowspan headers",r),a("th","colspan rowspan headers scope abbr",r),a("form","accept-charset action autocomplete enctype method name novalidate ta
rget",r),a("fieldset","disabled form name",[r,"legend"].join(" ")),a("label","form for",n),a("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),a("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"===e?r:n),a("select","disabled form multiple name required size","option optgroup"),a("optgroup","disabled label","option"),a("option","disabled label selected value"),a("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),a("menu","type label",[r,"li"].join(" ")),a("noscript&
quot;,"",r),"html4"!==e&&(a("wbr"),a("ruby","",[n,"rt rp"].join(" ")),a("figcaption","",r),a("mark rt rp summary bdi","",n),a("canvas","width height",r),a("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[r,"track source"].join(" ")),a("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",[r,"track source"].join(" ")),a("picture","","img source"),a("source","src srcset type media sizes"),a("track","kind src srclang label default"),a("datalist","",[n,"option"].join(" ")),a("article section nav aside header footer","",r),a("hgroup","",
"h1 h2 h3 h4 h5 h6"),a("figure","",[r,"figcaption"].join(" ")),a("time","datetime",n),a("dialog","open",r),a("command","type label icon disabled checked radiogroup command"),a("output","for form name",n),a("progress","value max",n),a("meter","value min max low high optimum",n),a("details","open",[r,"summary"].join(" ")),a("keygen","autofocus challenge disabled form keytype name")),"html5-strict"!==e&&(c("script","language xml:space"),c("style","xml:space"),c("object","declare classid code codebase codetype archive standby align border hspace vspace"),c("embed","align name hspace vspace"),c("param","valuetype type"),c("a","char
set name rev shape coords"),c("br","clear"),c("applet","codebase archive code object alt name width height align hspace vspace"),c("img","name longdesc align border hspace vspace"),c("iframe","longdesc frameborder marginwidth marginheight scrolling align"),c("font basefont","size color face"),c("input","usemap align"),c("select","onchange"),c("textarea"),c("h1 h2 h3 h4 h5 h6 div p legend caption","align"),c("ul","type compact"),c("li","type"),c("ol dl menu dir","compact"),c("pre","width xml:space"),c("hr","align noshade size width"),c("isindex","prompt"),c("table","summary width frame rules cellspacing cellpadding align bgcolor"),c("col","width align char cha
roff valign"),c("colgroup","width align char charoff valign"),c("thead","align char charoff valign"),c("tr","align char charoff valign bgcolor"),c("th","axis align char charoff valign nowrap bgcolor width height"),c("form","accept"),c("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),c("tfoot","align char charoff valign"),c("tbody","align char charoff valign"),c("area","nohref"),c("body","background bgcolor text link vlink alink")),"html4"!==e&&(c("input button select textarea","autofocus"),c("input textarea","placeholder"),c("a","download"),c("link script img","crossorigin"),c("iframe","sandbox seamless allowfullscreen")),Wo(Go("a f
orm meter progress dfn"),function(e){s[e]&&delete s[e].children[e]}),delete s.caption.children.table,delete s.script,Ho[e]=s)},Qo=function(e,n){var r;return e&&(r={},"string"==typeof e&&(e={"*":e}),Wo(e,function(e,t){r[t]=r[t.toUpperCase()]="map"===n?$o(e,/[, ]/):Xo(e,/[, ]/)})),r};function Zo(i){var e,t,n,r,o,a,u,s,c,l,f,d,m,N={},p={},E=[],g={},h={},v=function(e,t,n){var r=i[e];return r?r=$o(r,/[, ]/,$o(r.toUpperCase(),/[, ]/)):(r=Ho[e])||(r=$o(t," ",$o(t.toUpperCase()," ")),r=Ko(r,n),Ho[e]=r),r};n=Jo((i=i||{}).schema),!1===i.verify_html&&(i.valid_elements="*[*]"),e=Qo(i.valid_styles),t=Qo(i.invalid_styles,"map"),s=Qo(i.valid_classes,"map"),r=v("whitespace_elements","pre script noscript style textarea video audio iframe object code"),o=v("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),a=v("short_
ended_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),u=v("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls"),l=v("non_empty_elements","td th iframe video audio object script pre code",a),f=v("move_caret_before_on_enter_elements","table",l),d=v("text_block_elements","h1 h2 h3 h4 h5 h6 p div address pre form blockquote center dir fieldset header footer article section hgroup aside nav figure"),c=v("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption",d),m=v("text_inline_elements","span strong b em i font strike u var cite dfn code mark q sup sub samp"),Wo((i.special||"script noscript noframes noembed tit
le style textarea xmp").split(" "),function(e){h[e]=new RegExp("</"+e+"[^>]*>","gi")});var S=function(e){return new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$")},y=function(e){var t,n,r,o,i,a,u,s,c,l,f,d,m,p,g,h,v,y,b,C=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)\])?$/,x=/^([!\-])?(\w+[\\:]:\w+|[^=:<]+)?(?:([=:<])(.*))?$/,w=/[*?+]/;if(e)for(e=Go(e,","),N["@"]&&(h=N["@"].attributes,v=N["@"].attributesOrder),t=0,n=e.length;t<n;t++)if(i=C.exec(e[t])){if(p=i[1],c=i[2],g=i[3],s=i[5],a={attributes:d={},attributesOrder:m=[]},"#"===p&&(a.paddEmpty=!0),"-"===p&&(a.removeEmpty=!0),"!"===i[4]&&(a.removeEmptyAttrs=!0),h){for(y in h)d[y]=h[y];m.push.apply(m,v)}if(s)for(r=0,o=(s=Go(s,"|")).length;r<o;r++)if(i=x.exec(s[r])){if(u={},f=i[1],l=i[2].replace(/[\\:]:/g,":"),p=i[
3],b=i[4],"!"===f&&(a.attributesRequired=a.attributesRequired||[],a.attributesRequired.push(l),u.required=!0),"-"===f){delete d[l],m.splice(Yo(m,l),1);continue}p&&("="===p&&(a.attributesDefault=a.attributesDefault||[],a.attributesDefault.push({name:l,value:b}),u.defaultValue=b),":"===p&&(a.attributesForced=a.attributesForced||[],a.attributesForced.push({name:l,value:b}),u.forcedValue=b),"<"===p&&(u.validValues=$o(b,"?"))),w.test(l)?(a.attributePatterns=a.attributePatterns||[],u.pattern=S(l),a.attributePatterns.push(u)):(d[l]||m.push(l),d[l]=u)}h||"@"!==c||(h=d,v=m),g&&(a.outputName=c,N[g]=a),w.test(c)?(a.pattern=S(c),E.push(a)):N[c]=a}},b=function(e){N={},E=[],y(e),Wo(n,function(e,t){p[t]=e.children})},C=function(e){var a=/^(~)?(.+)$/;e&&(Ho.text_block_elements=Ho.block_elements=null,Wo(Go(e,","),function(e){var t=a.exec(e),n="~"===t[1]
,r=n?"span":"div",o=t[2];if(p[o]=p[r],g[o]=r,n||(c[o.toUpperCase()]={},c[o]={}),!N[o]){var i=N[r];delete(i=Ko({},i)).removeEmptyAttrs,delete i.removeEmpty,N[o]=i}Wo(p,function(e,t){e[r]&&(p[t]=e=Ko({},p[t]),e[o]=e[r])})}))},x=function(e){var o=/^([+\-]?)(\w+)\[([^\]]+)\]$/;Ho[i.schema]=null,e&&Wo(Go(e,","),function(e){var t,n,r=o.exec(e);r&&(n=r[1],t=n?p[r[2]]:p[r[2]]={"#comment":{}},t=p[r[2]],Wo(Go(r[3],"|"),function(e){"-"===n?delete t[e]:t[e]={}}))})},w=function(e){var t,n=N[e];if(n)return n;for(t=E.length;t--;)if((n=E[t]).pattern.test(e))return n};return i.valid_elements?b(i.valid_elements):(Wo(n,function(e,t){N[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},p[t]=e.children}),"html5"!==i.schema&&Wo(Go("strong/b em/i"),function(e){e=Go(e,"/"),N[e[1]].outputName=e[0]}),Wo(Go("ol ul sub sup blockquote span font a table tbody tr strong em b i
"),function(e){N[e]&&(N[e].removeEmpty=!0)}),Wo(Go("p h1 h2 h3 h4 h5 h6 th td pre div address caption li"),function(e){N[e].paddEmpty=!0}),Wo(Go("span"),function(e){N[e].removeEmptyAttrs=!0})),C(i.custom_elements),x(i.valid_children),y(i.extended_valid_elements),x("+ol[ul|ol],+ul[ul|ol]"),Wo({dd:"dl",dt:"dl",li:"ul ol",td:"tr",th:"tr",tr:"tbody thead tfoot",tbody:"table",thead:"table",tfoot:"table",legend:"fieldset",area:"map",param:"video audio object"},function(e,t){N[t]&&(N[t].parentsRequired=Go(e))}),i.invalid_elements&&Wo(Xo(i.invalid_elements),function(e){N[e]&&delete N[e]}),w("span")||y("span[!data-mce-type|*]"),{children:p,elements:N,getValidStyles:function(){return e},getValidClasses:function(){return s},getBlockElements:function(){return c},getInvalidStyles:function(){r
eturn t},getShortEndedElements:function(){return a},getTextBlockElements:function(){return d},getTextInlineElements:function(){return m},getBoolAttrs:function(){return u},getElementRule:w,getSelfClosingElements:function(){return o},getNonEmptyElements:function(){return l},getMoveCaretBeforeOnEnterElements:function(){return f},getWhiteSpaceElements:function(){return r},getSpecialElements:function(){return h},isValidChild:function(e,t){var n=p[e.toLowerCase()];return!(!n||!n[t.toLowerCase()])},isValid:function(e,t){var n,r,o=w(e);if(o){if(!t)return!0;if(o.attributes[t])return!0;if(n=o.attributePatterns)for(r=n.length;r--;)if(n[r].pattern.test(e))return!0}return!1},getCustomElements:function(){return g},addValidElements:y,setValidElements:b,addCustomElements:C,addValidChildren:x}}var ei=function(e,t,n,r){var o=function(e){return 1<(e=parseInt(e,10).toString(16)).length?e:"0"+e};return"#"+o(t)+o(n)+o(r)};function ti(b,e){var C,t,c,l,x=/rgb\s*\(\s*([0-9]+)\s*,\s*([
0-9]+)\s*,\s*([0-9]+)\s*\)/gi,w=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,N=/\s*([^:]+):\s*([^;]+);?/g,E=/\s+$/,S={},k="\ufeff";for(b=b||{},e&&(c=e.getValidStyles(),l=e.getInvalidStyles()),t=("\\\" \\' \\; \\: ; : "+k).split(" "),C=0;C<t.length;C++)S[t[C]]=k+C,S[k+C]=t[C];return{toHex:function(e){return e.replace(x,ei)},parse:function(e){var t,n,r,o,i,a,u,s,c={},l=b.url_converter,f=b.url_converter_scope||this,d=function(e,t,n){var r,o,i,a;if((r=c[e+"-top"+t])&&(o=c[e+"-right"+t])&&(i=c[e+"-bottom"+t])&&(a=c[e+"-left"+t])){var u=[r,o,i,a];for(C=u.length-1;C--&&u[C]===u[C+1];);-1<C&&n||(c[e+t]=-1===C?u[0]:u.join(" "),delete c[e+"-top"+t],delete c[e+"-right"+t],delete c[e+"-bottom"+t],delete c[e+"-left
"+t])}},m=function(e){var t,n=c[e];if(n){for(t=(n=n.split(" ")).length;t--;)if(n[t]!==n[0])return!1;return c[e]=n[0],!0}},p=function(e){return o=!0,S[e]},g=function(e,t){return o&&(e=e.replace(/\uFEFF[0-9]/g,function(e){return S[e]})),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e},h=function(e){return String.fromCharCode(parseInt(e.slice(1),16))},v=function(e){return e.replace(/\\[0-9a-f]+/gi,h)},y=function(e,t,n,r,o,i){if(o=o||i)return"'"+(o=g(o)).replace(/\'/g,"\\'")+"'";if(t=g(t||n||r),!b.allow_script_urls){var a=t.replace(/[\s\r\n]+/g,"");if(/(java|vb)script:/i.test(a))return"";if(!b.allow_svg_data_urls&&/^data:image\/svg/i.test(a))return""}return l&&(t=l.call(f,t,"style")),"url('"+t.replace(/\'/g,"\\'")+"')"};if(e){for(e=(e=e.replace(/[\u0000-\u001F]/g,"")).replace(/\\[\"\';:\uFEFF]/g,p).replace(/\"[^\"]+\&
quot;|\'[^\']+\'/g,function(e){return e.replace(/[;:]/g,p)});t=N.exec(e);)if(N.lastIndex=t.index+t[0].length,n=t[1].replace(E,"").toLowerCase(),r=t[2].replace(E,""),n&&r){if(n=v(n),r=v(r),-1!==n.indexOf(k)||-1!==n.indexOf('"'))continue;if(!b.allow_script_urls&&("behavior"===n||/expression\s*\(|\/\*|\*\//.test(r)))continue;"font-weight"===n&&"700"===r?r="bold":"color"!==n&&"background-color"!==n||(r=r.toLowerCase()),r=(r=r.replace(x,ei)).replace(w,y),c[n]=o?g(r,!0):r}d("border","",!0),d("border","-width"),d("border","-color"),d("border","-style"),d("padding",""),d("margin",""),i="border",u="border-style",s="border-color",m(a="border-width")&&m(u)&&m(s)&&(c[i]=c[a]+" "+c[u]+"
; "+c[s],delete c[a],delete c[u],delete c[s]),"medium none"===c.border&&delete c.border,"none"===c["border-image"]&&delete c["border-image"]}return c},serialize:function(i,e){var t,n,r,o,a,u="",s=function(e){var t,n,r,o;if(t=c[e])for(n=0,r=t.length;n<r;n++)e=t[n],(o=i[e])&&(u+=(0<u.length?" ":"")+e+": "+o+";")};if(e&&c)s("*"),s(e);else for(t in i)!(n=i[t])||l&&(r=t,o=e,a=void 0,(a=l["*"])&&a[r]||(a=l[o])&&a[r])||(u+=(0<u.length?" ":"")+t+": "+n+";");return u}}}var ni,ri=Lt.each,oi=Lt.grep,ii=ge.ie,ai=/^([a-z0-9],?)+$/i,ui=/^[ \t\r\n]*$/,si=function(n,r,o){var e={},i=r.keep_values,t={set:function(e,t,n){r.url_converter&&(t=r.url_converter.call(r.url_converter_scope||o(),t,n,e[0])),e.attr("data-mce-"+n,t).attr(n,t)},get:function(e,t){return e.attr(&qu
ot;data-mce-"+t)||e.attr(t)}};return e={style:{set:function(e,t){null===t||"object"!=typeof t?(i&&e.attr("data-mce-style",t),e.attr("style",t)):e.css(t)},get:function(e){var t=e.attr("data-mce-style")||e.attr("style");return t=n.serialize(n.parse(t),e[0].nodeName)}}},i&&(e.href=e.src=t),e},ci=function(e,t){var n=t.attr("style"),r=e.serialize(e.parse(n),t[0].nodeName);r||(r=null),t.attr("data-mce-style",r)},li=function(e,t){var n,r,o=0;if(e)for(n=e.nodeType,e=e.previousSibling;e;e=e.previousSibling)r=e.nodeType,(!t||3!==r||r!==n&&e.nodeValue.length)&&(o++,n=r);return o};function fi(a,u){var s,c=this;void 0===u&&(u={});var r={},i=window,o={},t=0,e=function(m,e){var p,g=0,h={};p=(e=e||{}).maxLoadTime||5e3;var v=function(e){m.getElementsByTagName("head")[0].appendChild(e)},n=function(e,t,n){var o,r,i,a,u=function(){for(var e=a.passed,t=e.length;t--;)e[t]();a.statu
s=2,a.passed=[],a.failed=[]},s=function(){for(var e=a.failed,t=e.length;t--;)e[t]();a.status=3,a.passed=[],a.failed=[]},c=function(e,t){e()||((new Date).getTime()-i<p?Ce.setTimeout(t):s())},l=function(){c(function(){for(var e,t,n=m.styleSheets,r=n.length;r--;)if((t=(e=n[r]).ownerNode?e.ownerNode:e.owningElement)&&t.id===o.id)return u(),!0},l)},f=function(){c(function(){try{var e=r.sheet.cssRules;return u(),!!e}catch(t){}},f)};if(e=Lt._addCacheSuffix(e),h[e]?a=h[e]:(a={passed:[],failed:[]},h[e]=a),t&&a.passed.push(t),n&&a.failed.push(n),1!==a.status)if(2!==a.status)if(3!==a.status){if(a.status=1,(o=m.createElement("link")).rel="stylesheet",o.type="text/css",o.id="u"+g++,o.async=!1,o.defer=!1,i=(new Date).getTime(),"onload"in o&&!((d=navigator.userAgent.match(/WebKit\/(\d*)/))&&parseInt(d[1],10)<536))o.onload=l,o.onerror=s;else{if(0<navigator.userAgent.indexOf("Firefox"))return
(r=m.createElement("style")).textContent='@import "'+e+'"',f(),void v(r);l()}var d;v(o),o.href=e}else s();else u()},t=function(t){return Yr.nu(function(e){n(t,V.compose(e,V.constant(to.value(t))),V.compose(e,V.constant(to.error(t))))})},o=function(e){return e.fold(V.identity,V.identity)};return{load:n,loadAll:function(e,n,r){Qr.par(H.map(e,t)).get(function(e){var t=H.partition(e,function(e){return e.isValue()});0<t.fail.length?r(t.fail.map(o)):n(t.pass.map(o))})}}}(a),l=[],f=u.schema?u.schema:Zo({}),d=ti({url_converter:u.url_converter,url_converter_scope:u.url_converter_scope},u.schema),m=u.ownEvents?new Re(u.proxy):Re.Event,n=f.getBlockElements(),p=en.overrideDefaults(function(){return{context:a,element:q.getRoot()}}),g=function(e){if(e&&a&&"string"==typeof e){var t=a.getElementById(e);return t&&t.id!==e?a.getElementsByName(e)[1]:t}return e},h=function(e){return"string"==typeof e&&(e=g(e)),p(e)},v=function(e
,t,n){var r,o,i=h(e);return i.length&&(o=(r=s[t])&&r.get?r.get(i,t):i.attr(t)),void 0===o&&(o=n||""),o},y=function(e){var t=g(e);return t?t.attributes:[]},b=function(e,t,n){var r,o;""===n&&(n=null);var i=h(e);r=i.attr(t),i.length&&((o=s[t])&&o.set?o.set(i,n,t):i.attr(t,n),r!==n&&u.onSetAttrib&&u.onSetAttrib({attrElm:i,attrName:t,attrValue:n}))},C=function(){return u.root_element||a.body},x=function(e,t){return jr.getPos(a.body,g(e),t)},w=function(e,t,n){var r=h(e);return n?r.css(t):("float"===(t=t.replace(/-(\D)/g,function(e,t){return t.toUpperCase()}))&&(t=ge.ie&&ge.ie<12?"styleFloat":"cssFloat"),r[0]&&r[0].style?r[0].style[t]:undefined)},N=function(e){var t,n;return e=g(e),t=w(e,"width"),n=w(e,"height"),-1===t.indexOf("px")&&(t=0),-1===n.indexOf("px")&&(n=0),{w:parseInt(t,10)||e.offsetWi
dth||e.clientWidth,h:parseInt(n,10)||e.offsetHeight||e.clientHeight}},E=function(e,t){var n;if(!e)return!1;if(!Array.isArray(e)){if("*"===t)return 1===e.nodeType;if(ai.test(t)){var r=t.toLowerCase().split(/,/),o=e.nodeName.toLowerCase();for(n=r.length-1;0<=n;n--)if(r[n]===o)return!0;return!1}if(e.nodeType&&1!==e.nodeType)return!1}var i=Array.isArray(e)?e:[e];return 0<dt(t,i[0].ownerDocument||i[0],null,i).length},S=function(e,t,n,r){var o,i=[],a=g(e);for(r=r===undefined,n=n||("BODY"!==C().nodeName?C().parentNode:null),Lt.is(t,"string")&&(t="*"===(o=t)?function(e){return 1===e.nodeType}:function(e){return E(e,o)});a&&a!==n&&a.nodeType&&9!==a.nodeType;){if(!t||"function"==typeof t&&t(a)){if(!r)return[a];i.push(a)}a=a.parentNode}return r?i:null},k=function(e,t,n){var r=t;if(e)for("string"==typeof t&&(r=function(e){return E(e,t)}),e=e[n];e;e=e[n])if("function&quo
t;==typeof r&&r(e))return e;return null},T=function(e,n,r){var o,t="string"==typeof e?g(e):e;if(!t)return!1;if(Lt.isArray(t)&&(t.length||0===t.length))return o=[],ri(t,function(e,t){e&&("string"==typeof e&&(e=g(e)),o.push(n.call(r,e,t)))}),o;var i=r||c;return n.call(i,t)},A=function(e,t){h(e).each(function(e,n){ri(t,function(e,t){b(n,t,e)})})},R=function(e,r){var t=h(e);ii?t.each(function(e,t){if(!1!==t.canHaveHTML){for(;t.firstChild;)t.removeChild(t.firstChild);try{t.innerHTML="<br>"+r,t.removeChild(t.firstChild)}catch(n){en("<div></div>").html("<br>"+r).contents().slice(1).appendTo(t)}return r}}):t.html(r)},B=function(e,n,r,o,i){return T(e,function(e){var t="string"==typeof n?a.createElement(n):n;return A(t,r),o&&("string"!=typeof o&&o.nodeType?t.appendChild(o):"string"==typeof o&&R(t,o)),i?t:e.appendChild(t)})},_=function(
e,t,n){return B(a.createElement(e),e,t,n,!0)},D=Vo.decode,O=Vo.encodeAllRaw,P=function(e,t){var n=h(e);return t?n.each(function(){for(var e;e=this.firstChild;)3===e.nodeType&&0===e.data.length?this.removeChild(e):this.parentNode.insertBefore(e,this)}).remove():n.remove(),1<n.length?n.toArray():n[0]},L=function(e,t,n){h(e).toggleClass(t,n).each(function(){""===this.className&&en(this).attr("class",null)})},I=function(t,e,n){return T(e,function(e){return Lt.is(e,"array")&&(t=t.cloneNode(!0)),n&&ri(oi(e.childNodes),function(e){t.appendChild(e)}),e.parentNode.replaceChild(t,e)})},M=function(){return a.createRange()},F=function(e,t,n,r){if(Lt.isArray(e)){for(var o=e.length;o--;)e[o]=F(e[o],t,n,r);return e}return!u.collect||e!==a&&e!==i||l.push([e,t,n,r]),m.bind(e,t,n,r||q)},z=function(e,t,n){var r;if(Lt.isArray(e)){for(r=e.length;r--;)e[r]=z(e[r],t,n);return e}if(l&&(e===a||e===i))for(r=l.length;r--;){var o=
l[r];e!==o[0]||t&&t!==o[1]||n&&n!==o[2]||m.unbind(o[0],o[1],o[2])}return m.unbind(e,t,n)},U=function(e){if(e&&Ao.isElement(e)){var t=e.getAttribute("data-mce-contenteditable");return t&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null}return null},q={doc:a,settings:u,win:i,files:o,stdMode:!0,boxModel:!0,styleSheetLoader:e,boundEvents:l,styles:d,schema:f,events:m,isBlock:function(e){if("string"==typeof e)return!!n[e];if(e){var t=e.nodeType;if(t)return!(1!==t||!n[e.nodeName])}return!1},$:p,$$:h,root:null,clone:function(t,e){if(!ii||1!==t.nodeType||e)return t.cloneNode(e);if(!e){var n=a.createElement(t.nodeName);return ri(y(t),function(e){b(n,e.nodeName,v(t,e.nodeName))}),n}return null},getRoot:C,getViewPort:function(e){var t=e||i,n=t.document,r=n.documentElement;return{x:t.pageXOffset||r.scrollLeft,y:t.pageYOffset||r.scrollTop,w:t.innerWidth||r.clientWidth,h:t.innerHeight||r.clientHeight}},getR
ect:function(e){var t,n;return e=g(e),t=x(e),n=N(e),{x:t.x,y:t.y,w:n.w,h:n.h}},getSize:N,getParent:function(e,t,n){var r=S(e,t,n,!1);return r&&0<r.length?r[0]:null},getParents:S,get:g,getNext:function(e,t){return k(e,t,"nextSibling")},getPrev:function(e,t){return k(e,t,"previousSibling")},select:function(e,t){return dt(e,g(t)||u.root_element||a,[])},is:E,add:B,create:_,createHTML:function(e,t,n){var r,o="";for(r in o+="<"+e,t)t.hasOwnProperty(r)&&null!==t[r]&&"undefined"!=typeof t[r]&&(o+=" "+r+'="'+O(t[r])+'"');return void 0!==n?o+">"+n+"</"+e+">":o+" />"},createFragment:function(e){var t,n=a.createElement("div"),r=a.createDocumentFragment();for(e&&(n.innerHTML=e);t=n.firstChild;)r.appendChild(t);return r},remove:P,setStyle:function(e,t,n){var r=h(e).css(t,n);u.update_styles&&ci(d,r)},getStyle:w,set
Styles:function(e,t){var n=h(e).css(t);u.update_styles&&ci(d,n)},removeAllAttribs:function(e){return T(e,function(e){var t,n=e.attributes;for(t=n.length-1;0<=t;t--)e.removeAttributeNode(n.item(t))})},setAttrib:b,setAttribs:A,getAttrib:v,getPos:x,parseStyle:function(e){return d.parse(e)},serializeStyle:function(e,t){return d.serialize(e,t)},addStyle:function(e){var t,n;if(q!==fi.DOM&&a===document){if(r[e])return;r[e]=!0}(n=a.getElementById("mceDefaultStyles"))||((n=a.createElement("style")).id="mceDefaultStyles",n.type="text/css",(t=a.getElementsByTagName("head")[0]).firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(a.createTextNode(e))},loadCSS:function(e){var n;q===fi.DOM||a!==document?(e||(e=""),n=a.getElementsByTagName("head")[0],ri(e.split(","),function(e){var t;e=Lt._addCacheSuffix(e),o[e]||(o[e]=!0,t=_("link",
{rel:"stylesheet",href:e}),n.appendChild(t))})):fi.DOM.loadCSS(e)},addClass:function(e,t){h(e).addClass(t)},removeClass:function(e,t){L(e,t,!1)},hasClass:function(e,t){return h(e).hasClass(t)},toggleClass:L,show:function(e){h(e).show()},hide:function(e){h(e).hide()},isHidden:function(e){return"none"===h(e).css("display")},uniqueId:function(e){return(e||"mce_")+t++},setHTML:R,getOuterHTML:function(e){var t="string"==typeof e?g(e):e;return Ao.isElement(t)?t.outerHTML:en("<div></div>").append(en(t).clone()).html()},setOuterHTML:function(e,t){h(e).each(function(){try{if("outerHTML"in this)return void(this.outerHTML=t)}catch(e){}P(en(this).html(t),!0)})},decode:D,encode:O,insertAfter:function(e,t){var r=g(t);return T(e,function(e){var t,n;return t=r.parentNode,(n=r.nextSibling)?t.insertBefore(e,n):t.appendChild(e),e})},replace:I,rename:function(t,e){var n;return t.nodeName!==e.toUpperCase()&&(n=_(e)
,ri(y(t),function(e){b(n,e.nodeName,v(t,e.nodeName))}),I(n,t,!0)),n||t},findCommonAncestor:function(e,t){for(var n,r=e;r;){for(n=t;n&&r!==n;)n=n.parentNode;if(r===n)break;r=r.parentNode}return!r&&e.ownerDocument?e.ownerDocument.documentElement:r},toHex:function(e){return d.toHex(Lt.trim(e))},run:T,getAttribs:y,isEmpty:function(e,t){var n,r,o,i,a,u,s=0;if(e=e.firstChild){a=new no(e,e.parentNode),t=t||(f?f.getNonEmptyElements():null),i=f?f.getWhiteSpaceElements():{};do{if(o=e.nodeType,Ao.isElement(e)){var c=e.getAttribute("data-mce-bogus");if(c){e=a.next("all"===c);continue}if(u=e.nodeName.toLowerCase(),t&&t[u]){if("br"===u){s++,e=a.next();continue}return!1}for(n=(r=y(e)).length;n--;)if("name"===(u=r[n].nodeName)||"data-mce-bookmark"===u)return!1}if(8===o)return!1;if(3===o&&!ui.test(e.nodeValue))return!1;if(3===o&&e.parentNode&&i[e.parentNode.nodeName]&&ui.test(e.nodeValue))return
!1;e=a.next()}while(e)}return s<=1},createRng:M,nodeIndex:li,split:function(e,t,n){var r,o,i,a=M();if(e&&t)return a.setStart(e.parentNode,li(e)),a.setEnd(t.parentNode,li(t)),r=a.extractContents(),(a=M()).setStart(t.parentNode,li(t)+1),a.setEnd(e.parentNode,li(e)+1),o=a.extractContents(),(i=e.parentNode).insertBefore(_o.trimNode(q,r),e),n?i.insertBefore(n,e):i.insertBefore(t,e),i.insertBefore(_o.trimNode(q,o),e),P(e),n||t},bind:F,unbind:z,fire:function(e,t,n){return m.fire(e,t,n)},getContentEditable:U,getContentEditableParent:function(e){for(var t=C(),n=null;e&&e!==t&&null===(n=U(e));e=e.parentNode);return n},destroy:function(){if(l)for(var e=l.length;e--;){var t=l[e];m.unbind(t[0],t[1],t[2])}dt.setDocument&&dt.setDocument()},isChildOf:function(e,t){for(;e;){if(t===e)return!0;e=e.parentNode}return!1},dumpRng:function(e){return"startContainer: "+e.startContainer.nodeName+", startOffset: "+e.startOffset+", endContainer: "
+e.endContainer.nodeName+", endOffset: "+e.endOffset}};return s=si(d,u,function(){return q}),q}(ni=fi||(fi={})).DOM=ni(document),ni.nodeIndex=li;var di=fi,mi=di.DOM,pi=Lt.each,gi=Lt.grep,hi=function(e){return"function"==typeof e},vi=function(){var f={},o=[],i={},a=[],d=0;this.isDone=function(e){return 2===f[e]},this.markDone=function(e){f[e]=2},this.add=this.load=function(e,t,n,r){f[e]===undefined&&(o.push(e),f[e]=0),t&&(i[e]||(i[e]=[]),i[e].push({success:t,failure:r,scope:n||this}))},this.remove=function(e){delete f[e],delete i[e]},this.loadQueue=function(e,t,n){this.loadScripts(o,e,t,n)},this.loadScripts=function(n,e,t,r){var s,c=[],l=function(t,e){pi(i[e],function(e){hi(e[t])&&e[t].call(e.scope)}),i[e]=undefined};a.push({success:e,failure:r,scope:t||this}),(s=function(){var e=gi(n);if(n.length=0,pi(e,function(e){var t,n,r,o,i,a,u;2!==f[e]?3!==f[e]?1!==f[e]&&(f[e]=1,d++,t=e,n=function(){f[e]=2,d--,l("success",e),s()},r=
function(){f[e]=3,d--,c.push(e),l("failure",e),s()},u=function(){a.remove(i),o&&(o.onreadystatechange=o.onload=o=null),n()},i=(a=mi).uniqueId(),(o=document.createElement("script")).id=i,o.type="text/javascript",o.src=Lt._addCacheSuffix(t),"onreadystatechange"in o?o.onreadystatechange=function(){/loaded|complete/.test(o.readyState)&&u()}:o.onload=u,o.onerror=function(){hi(r)?r():"undefined"!=typeof console&&console.log&&console.log("Failed to load script: "+t)},(document.getElementsByTagName("head")[0]||document.body).appendChild(o)):l("failure",e):l("success",e)}),!d){var t=a.slice(0);a.length=0,pi(t,function(e){0===c.length?hi(e.success)&&e.success.call(e.scope):hi(e.failure)&&e.failure.call(e.scope,c)})}})()}};vi.ScriptLoader=new vi;var yi,bi=Lt.each;function Ci(){var r=this,o=[],a={},u={},i=[],s=function(e){var t;return u[e]&&(t=u[e].de
pendencies),t||[]},c=function(e,t){return"object"==typeof t?t:"string"==typeof e?{prefix:"",resource:t,suffix:""}:{prefix:e.prefix,resource:t,suffix:e.suffix}},l=function(n,e,t){var r=s(name);bi(r,function(e){var t=c(n,e);f(t.resource,t,undefined,undefined)}),e&&(t?e.call(t):e.call(vi))},f=function(e,t,n,r,o){if(!a[e]){var i="string"==typeof t?t:t.prefix+t.resource+t.suffix;0!==i.indexOf("/")&&-1===i.indexOf("://")&&(i=Ci.baseURL+"/"+i),a[e]=i.substring(0,i.lastIndexOf("/")),u[e]?l(t,n,r):vi.ScriptLoader.add(i,function(){return l(t,n,r)},r,o)}};return{items:o,urls:a,lookup:u,_listeners:i,get:function(e){return u[e]?u[e].instance:undefined},dependencies:s,requireLangPack:function(e,t){var n=Ci.language;if(n&&!1!==Ci.languageLoad){if(t)if(-1!==(t=","+t+",").indexOf(","+n.substr(0,2)+","))n=n.substr(0,2);else if(-1===t.indexOf
(","+n+","))return;vi.ScriptLoader.add(a[e]+"/langs/"+n+".js")}},add:function(t,e,n){o.push(e),u[t]={instance:e,dependencies:n};var r=H.partition(i,function(e){return e.name===t});return i=r.fail,bi(r.pass,function(e){e.callback()}),e},remove:function(e){delete a[e],delete u[e]},createUrl:c,addComponents:function(e,t){var n=r.urls[e];bi(t,function(e){vi.ScriptLoader.add(n+"/"+e)})},load:f,waitFor:function(e,t){u.hasOwnProperty(e)?t():i.push({name:e,callback:t})}}}(yi=Ci||(Ci={})).PluginManager=yi(),yi.ThemeManager=yi();var xi,wi="\ufeff",Ni=function(e){return e===wi},Ei=wi,Si=function(e){return e.replace(new RegExp(wi,"g"),"")},ki=Ao.isElement,Ti=Ao.isText,Ai=function(e){return Ti(e)&&(e=e.parentNode),ki(e)&&e.hasAttribute("data-mce-caret")},Ri=function(e){return Ti(e)&&Ni(e.data)},Bi=function(e){return Ai(e)||Ri(e)},_i=function(e){return e.firstChild!==e.lastChild||!Ao.
isBr(e.firstChild)},Di=function(e){var t=e.container();return e&&Ao.isText(t)&&t.data.charAt(e.offset())===Ei},Oi=function(e){var t=e.container();return e&&Ao.isText(t)&&t.data.charAt(e.offset()-1)===Ei},Pi=function(e,t,n){var r,o,i;return(r=t.ownerDocument.createElement(e)).setAttribute("data-mce-caret",n?"before":"after"),r.setAttribute("data-mce-bogus","all"),r.appendChild(((i=document.createElement("br")).setAttribute("data-mce-bogus","1"),i)),o=t.parentNode,n?o.insertBefore(r,t):t.nextSibling?o.insertBefore(r,t.nextSibling):o.appendChild(r),r},Li=function(e){return Ti(e)&&e.data[0]===Ei},Ii=function(e){return Ti(e)&&e.data[e.data.length-1]===Ei},Mi=function(e){return e&&e.hasAttribute("data-mce-caret")?(t=e.getElementsByTagName("br"),n=t[t.length-1],Ao.isBogus(n)&&n.parentNode.removeChild(n),e.removeAttribute("d
ata-mce-caret"),e.removeAttribute("data-mce-bogus"),e.removeAttribute("style"),e.removeAttribute("_moz_abspos"),e):null;var t,n},Fi=Ao.isContentEditableTrue,zi=Ao.isContentEditableFalse,Ui=Ao.isBr,qi=Ao.isText,Vi=Ao.matchNodeNames("script style textarea"),Hi=Ao.matchNodeNames("img input textarea hr iframe video audio object"),ji=Ao.matchNodeNames("table"),$i=Bi,Wi=function(e){return!$i(e)&&(qi(e)?!Vi(e.parentNode):Hi(e)||Ui(e)||ji(e)||Ki(e))},Ki=function(e){return!1===(t=e,Ao.isElement(t)&&"true"===t.getAttribute("unselectable"))&&zi(e);var t},Xi=function(e,t){return Wi(e)&&function(e,t){for(e=e.parentNode;e&&e!==t;e=e.parentNode){if(Ki(e))return!1;if(Fi(e))return!0}return!0}(e,t)},Yi=Math.round,Gi=function(e){return e?{left:Yi(e.left),top:Yi(e.top),bottom:Yi(e.bottom),right:Yi(e.right),width:Yi(e.width),height:Yi(e.height)}:{left:0,top:0,bottom:0,right:0,widt
h:0,height:0}},Ji=function(e,t){return e=Gi(e),t||(e.left=e.left+e.width),e.right=e.left,e.width=0,e},Qi=function(e,t,n){return 0<=e&&e<=Math.min(t.height,n.height)/2},Zi=function(e,t){return e.bottom-e.height/2<t.top||!(e.top>t.bottom)&&Qi(t.top-e.bottom,e,t)},ea=function(e,t){return e.top>t.bottom||!(e.bottom<t.top)&&Qi(t.bottom-e.top,e,t)},ta=function(e){var t=e.startContainer,n=e.startOffset;return t.hasChildNodes()&&e.endOffset===n+1?t.childNodes[n]:null},na=function(e,t){return 1===e.nodeType&&e.hasChildNodes()&&(t>=e.childNodes.length&&(t=e.childNodes.length-1),e=e.childNodes[t]),e},ra=new RegExp("[\u0300-\u036f\u0483-\u0487\u0488-\u0489\u0591-\u05bd\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05c7\u0610-\u061a\u064b-\u065f\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7-\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e3-\u0902\u093
a\u093c\u0941-\u0948\u094d\u0951-\u0957\u0962-\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2-\u09e3\u0a01-\u0a02\u0a3c\u0a41-\u0a42\u0a47-\u0a48\u0a4b-\u0a4d\u0a51\u0a70-\u0a71\u0a75\u0a81-\u0a82\u0abc\u0ac1-\u0ac5\u0ac7-\u0ac8\u0acd\u0ae2-\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62-\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c00\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55-\u0c56\u0c62-\u0c63\u0c81\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc-\u0ccd\u0cd5-\u0cd6\u0ce2-\u0ce3\u0d01\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62-\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb-\u0ebc\u0ec8-\u0ecd\u0f18-\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86-\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039-\u103a\u103d-\u103e\u1058-\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085-\u1086\u108d\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752-\u1753\u1772-\u1773\u17b4-\u17b5\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd
\u180b-\u180d\u18a9\u1920-\u1922\u1927-\u1928\u1932\u1939-\u193b\u1a17-\u1a18\u1a1b\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1ab0-\u1abd\u1abe\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80-\u1b81\u1ba2-\u1ba5\u1ba8-\u1ba9\u1bab-\u1bad\u1be6\u1be8-\u1be9\u1bed\u1bef-\u1bf1\u1c2c-\u1c33\u1c36-\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1cf4\u1cf8-\u1cf9\u1dc0-\u1df5\u1dfc-\u1dff\u200c-\u200d\u20d0-\u20dc\u20dd-\u20e0\u20e1\u20e2-\u20e4\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302d\u302e-\u302f\u3099-\u309a\ua66f\ua670-\ua672\ua674-\ua67d\ua69e-\ua69f\ua6f0-\ua6f1\ua802\ua806\ua80b\ua825-\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\ua9e5\uaa29-\uaa2e\uaa31-\uaa32\uaa35-\uaa36\uaa43\uaa4c\uaa7c\uaab0\uaab2-\uaab4\uaab7-\uaab8\uaabe-\uaabf\uaac1\uaaec-\uaaed\uaaf6\uabe5\uabe8\uabed\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\uff9e-\uff9f]"),oa=function(e){return"string"==typeof e&
amp;&768<=e.charCodeAt(0)&&ra.test(e)},ia=[].slice,aa=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=ia.call(arguments);return r.length-1>=e.length?e.apply(this,r.slice(1)):function(){var e=r.concat([].slice.call(arguments));return aa.apply(this,e)}},ua={constant:function(e){return function(){return e}},negate:function(t){return function(e){return!t(e)}},and:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=ia.call(arguments);return function(e){for(var t=0;t<n.length;t++)if(!n[t](e))return!1;return!0}},or:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=ia.call(arguments);return function(e){for(var t=0;t<n.length;t++)if(n[t](e))return!0;return!1}},curry:aa,compose:function(t,n){return function(e){return t(n(e))}},noop:function(){}},sa=function(e,t){for(var n=[],r=0;r<e.length;r++){var o=e[r];if(!o.isSome())return A.none();n.push(o.getOrDie())}return A.some(t.apply(nu
ll,n))},ca=Ao.isElement,la=Wi,fa=Ao.matchStyleValues("display","block table"),da=Ao.matchStyleValues("float","left right"),ma=ua.and(ca,la,ua.negate(da)),pa=ua.negate(Ao.matchStyleValues("white-space","pre pre-line pre-wrap")),ga=Ao.isText,ha=Ao.isBr,va=di.nodeIndex,ya=na,ba=function(e){return"createRange"in e?e.createRange():di.DOM.createRng()},Ca=function(e){return e&&/[\r\n\t ]/.test(e)},xa=function(e){return!!e.setStart&&!!e.setEnd},wa=function(e){var t,n=e.startContainer,r=e.startOffset;return!!(Ca(e.toString())&&pa(n.parentNode)&&Ao.isText(n)&&(t=n.data,Ca(t[r-1])||Ca(t[r+1])))},Na=function(e){return 0===e.left&&0===e.right&&0===e.top&&0===e.bottom},Ea=function(e){var t,n,r,o,i,a,u,s;return t=0<(n=e.getClientRects()).length?Gi(n[0]):Gi(e.getBoundingClientRect()),!xa(e)&&ha(e)&&Na(t)?(i=(r=e).ownerDocument,a=ba(i),u=i.createTex
tNode("\xa0"),(s=r.parentNode).insertBefore(u,r),a.setStart(u,0),a.setEnd(u,1),o=Gi(a.getBoundingClientRect()),s.removeChild(u),o):Na(t)&&xa(e)?function(e){var t=e.startContainer,n=e.endContainer,r=e.startOffset,o=e.endOffset;if(t===n&&Ao.isText(n)&&0===r&&1===o){var i=e.cloneRange();return i.setEndAfter(n),Ea(i)}return null}(e):t},Sa=function(e,t){var n=Ji(e,t);return n.width=1,n.right=n.left+1,n},ka=function(e){var t,n,r=[],o=function(e){var t,n;0!==e.height&&(0<r.length&&(t=e,n=r[r.length-1],t.left===n.left&&t.top===n.top&&t.bottom===n.bottom&&t.right===n.right)||r.push(e))},i=function(e,t){var n=ba(e.ownerDocument);if(t<e.data.length){if(oa(e.data[t]))return r;if(oa(e.data[t-1])&&(n.setStart(e,t),n.setEnd(e,t+1),!wa(n)))return o(Sa(Ea(n),!1)),r}0<t&&(n.setStart(e,t-1),n.setEnd(e,t),wa(n)||o(Sa(Ea(n),!1))),t<e.data.length&&(n.setStart(e,t),n.setEnd(e,t+1),wa(n)||o
(Sa(Ea(n),!0)))};if(ga(e.container()))return i(e.container(),e.offset()),r;if(ca(e.container()))if(e.isAtEnd())n=ya(e.container(),e.offset()),ga(n)&&i(n,n.data.length),ma(n)&&!ha(n)&&o(Sa(Ea(n),!1));else{if(n=ya(e.container(),e.offset()),ga(n)&&i(n,0),ma(n)&&e.isAtEnd())return o(Sa(Ea(n),!1)),r;t=ya(e.container(),e.offset()-1),ma(t)&&!ha(t)&&(fa(t)||fa(n)||!ma(n))&&o(Sa(Ea(t),!1)),ma(n)&&o(Sa(Ea(n),!0))}return r};function Ta(t,n,e){var r=function(){return e||(e=ka(Ta(t,n))),e};return{container:ua.constant(t),offset:ua.constant(n),toRange:function(){var e;return(e=ba(t.ownerDocument)).setStart(t,n),e.setEnd(t,n),e},getClientRects:r,isVisible:function(){return 0<r().length},isAtStart:function(){return ga(t),0===n},isAtEnd:function(){return ga(t)?n>=t.data.length:n>=t.childNodes.length},isEqual:function(e){return e&&t===e.container()&&n===e.offset()},getNode:function(e){return ya(t,e?n-1:n)
}}}(xi=Ta||(Ta={})).fromRangeStart=function(e){return xi(e.startContainer,e.startOffset)},xi.fromRangeEnd=function(e){return xi(e.endContainer,e.endOffset)},xi.after=function(e){return xi(e.parentNode,va(e)+1)},xi.before=function(e){return xi(e.parentNode,va(e))},xi.isAbove=function(e,t){return sa([H.head(t.getClientRects()),H.last(e.getClientRects())],Zi).getOr(!1)},xi.isBelow=function(e,t){return sa([H.last(t.getClientRects()),H.head(e.getClientRects())],ea).getOr(!1)},xi.isAtStart=function(e){return!!e&&e.isAtStart()},xi.isAtEnd=function(e){return!!e&&e.isAtEnd()},xi.isTextPosition=function(e){return!!e&&Ao.isText(e.container())},xi.isElementPosition=function(e){return!1===xi.isTextPosition(e)};var Aa,Ra,Ba=Ta,_a=Ao.isElement,Da=Ao.isText,Oa=function(e){var t=e.parentNode;t&&t.removeChild(e)},Pa=function(e,t){0===t.length?Oa(e):e.nodeValue=t},La=function(e){var t=Si(e);return{count:e.length-t.length,text:t}},Ia=function(e,t){return za(e),t},Ma=func
tion(e,t){return Da(e)&&t.container()===e?(r=t,o=La((n=e).data.substr(0,r.offset())),i=La(n.data.substr(r.offset())),0<(a=o.text+i.text).length?(Pa(n,a),Ba(n,r.offset()-o.count)):r):Ia(e,t);var n,r,o,i,a},Fa=function(e,t){return t.container()===e.parentNode?(n=e,o=(r=t).container(),i=H.indexOf(H.from(o.childNodes),n).map(function(e){return e<r.offset()?Ba(o,r.offset()-1):r}).getOr(r),za(n),i):Ia(e,t);var n,r,o,i},za=function(e){if(_a(e)&&Bi(e)&&(_i(e)?e.removeAttribute("data-mce-caret"):Oa(e)),Da(e)){var t=Si(function(e){try{return e.nodeValue}catch(t){return""}}(e));Pa(e,t)}},Ua={removeAndReposition:function(e,t){return Ba.isTextPosition(t)?Ma(e,t):Fa(e,t)},remove:za},qa=function(e){return Ba.isTextPosition(e)?0===e.offset():Wi(e.getNode())},Va=function(e){if(Ba.isTextPosition(e)){var t=e.container();return e.offset()===t.data.length}return Wi(e.getNode(!0))},Ha=function(e,t){return!Ba.isTextPosition(e)&&!Ba.isTextPosition(t
)&&e.getNode()===t.getNode(!0)},ja=function(e,t,n){return e?!Ha(t,n)&&(r=t,!(!Ba.isTextPosition(r)&&Ao.isBr(r.getNode())))&&Va(t)&&qa(n):!Ha(n,t)&&qa(t)&&Va(n);var r},$a=function(e,t,n){var r=js(t);return A.from(e?r.next(n):r.prev(n))},Wa=function(e,t){var n,r,o,i,a,u=e?t.firstChild:t.lastChild;return Ao.isText(u)?A.some(Ba(u,e?0:u.data.length)):u?Wi(u)?A.some(e?Ba.before(u):(a=u,Ao.isBr(a)?Ba.before(a):Ba.after(a))):(r=t,o=u,i=(n=e)?Ba.before(o):Ba.after(o),$a(n,r,i)):A.none()},Ka={fromPosition:$a,nextPosition:V.curry($a,!0),prevPosition:V.curry($a,!1),navigate:function(t,n,r){return $a(t,n,r).bind(function(e){return ps(r,e,n)&&ja(t,r,e)?$a(t,n,e):A.some(e)})},positionIn:Wa,firstPositionIn:V.curry(Wa,!0),lastPositionIn:V.curry(Wa,!1)},Xa=Ao.isContentEditableTrue,Ya=Ao.isContentEditableFalse,Ga=function(e,t,n,r,o){return t._selectionOverrides.showCaret(e,n,r,o)},Ja=function(e,t){var n,r;return e.fire("BeforeObjectS
elected",{target:t}).isDefaultPrevented()?null:((r=(n=t).ownerDocument.createRange()).selectNode(n),r)},Qa=function(e,t,n){var r=Cs(1,e.getBody(),t),o=Ba.fromRangeStart(r),i=o.getNode();if(Ya(i))return Ga(1,e,i,!o.isAtEnd(),!1);var a=o.getNode(!0);if(Ya(a))return Ga(1,e,a,!1,!1);var u=e.dom.getParent(o.getNode(),function(e){return Ya(e)||Xa(e)});return Ya(u)?Ga(1,e,u,!1,n):null},Za=function(e,t,n){if(!t||!t.collapsed)return t;var r=Qa(e,t,n);return r||t};(Ra=Aa||(Aa={}))[Ra.Br=0]="Br",Ra[Ra.Block=1]="Block",Ra[Ra.Wrap=2]="Wrap",Ra[Ra.Eol=3]="Eol";var eu,tu,nu=function(e,t){return e===eu.Backwards?t.reverse():t},ru=function(e,t,n,r){for(var o,i,a,u,s,c,l=js(n),f=r,d=[];f&&(s=l,c=f,o=t===eu.Forwards?s.next(c):s.prev(c));){if(Ao.isBr(o.getNode(!1)))return t===eu.Forwards?{positions:nu(t,d).concat([o]),breakType:Aa.Br,breakAt:A.some(o)}:{positions:nu(t,d),breakType:Aa.Br,breakAt:A.some(o)};if(o.isVisible()){if(e(f,o)){var m=(i=t,a=f,u
=o,Ao.isBr(u.getNode(i===eu.Forwards))?Aa.Br:!1===ps(a,u)?Aa.Block:Aa.Wrap);return{positions:nu(t,d),breakType:m,breakAt:A.some(o)}}d.push(o),f=o}else f=o}return{positions:nu(t,d),breakType:Aa.Eol,breakAt:A.none()}},ou=function(n,r,o,e){return r(o,e).breakAt.map(function(e){var t=r(o,e).positions;return n===eu.Backwards?t.concat(e):[e].concat(t)}).getOr([])},iu=function(e,i){return H.foldl(e,function(e,o){return e.fold(function(){return A.some(o)},function(r){return sa([H.head(r.getClientRects()),H.head(o.getClientRects())],function(e,t){var n=Math.abs(i-e.left);return Math.abs(i-t.left)<=n?o:r}).or(e)})},A.none())},au=function(t,e){return H.head(e.getClientRects()).bind(function(e){return iu(t,e.left)})},uu=V.curry(ru,Ta.isAbove,-1),su=V.curry(ru,Ta.isBelow,1),cu=V.curry(ou,-1,uu),lu=V.curry(ou,1,su),fu=function(e,t){return Br.all(t,e)},du=function(e,t,n,r,o){var i,a,u,s,c,l=fu(qn.fromDom(n),"td,th").map(function(e){return e.dom()}),f=H.filter((i=e,a=l,H.bind(a,functio
n(e){var t,n,r=(t=e.getBoundingClientRect(),n=-1,{left:t.left-n,top:t.top-n,right:t.right+2*n,bottom:t.bottom+2*n,width:t.width+n,height:t.height+n});return[{x:r.left,y:i(r),cell:e},{x:r.right,y:i(r),cell:e}]})),function(e){return t(e,o)});return(u=f,s=r,c=o,H.foldl(u,function(e,r){return e.fold(function(){return A.some(r)},function(e){var t=Math.sqrt(Math.abs(e.x-s)+Math.abs(e.y-c)),n=Math.sqrt(Math.abs(r.x-s)+Math.abs(r.y-c));return A.some(n<t?r:e)})},A.none())).map(function(e){return e.cell})},mu=V.curry(du,function(e){return e.bottom},function(e,t){return e.y<t}),pu=V.curry(du,function(e){return e.top},function(e,t){return e.y>t}),gu=function(t,n){return H.head(n.getClientRects()).bind(function(e){return mu(t,e.left,e.top)}).bind(function(e){return au((t=e,Ka.lastPositionIn(t).map(function(e){return uu(t,e).positions.concat(e)}).getOr([])),n);var t})},hu=function(t,n){return H.last(n.getClientRects()).bind(function(e){return pu(t,e.left,e.top)}).bind(function(e){return
au((t=e,Ka.firstPositionIn(t).map(function(e){return[e].concat(su(t,e).positions)}).getOr([])),n);var t})},vu=function(e){for(var t=0,n=0,r=e;r&&r.nodeType;)t+=r.offsetLeft||0,n+=r.offsetTop||0,r=r.offsetParent;return{x:t,y:n}},yu=function(e,t,n){var r,o,i,a,u,s=e.dom,c=s.getRoot(),l=0;if(u={elm:t,alignToTop:n},e.fire("scrollIntoView",u),!u.isDefaultPrevented()&&Ao.isElement(t)){if(!1===n&&(l=t.offsetHeight),"BODY"!==c.nodeName){var f=e.selection.getScrollContainer();if(f)return r=vu(t).y-vu(f).y+l,a=f.clientHeight,void((r<(i=f.scrollTop)||i+a<r+25)&&(f.scrollTop=r<i?r:r-a+25))}o=s.getViewPort(e.getWin()),r=s.getPos(t).y+l,i=o.y,a=o.h,(r<o.y||i+a<r+25)&&e.getWin().scrollTo(0,r<i?r:r-a+25)}},bu=function(d,e){H.head(Ta.fromRangeStart(e).getClientRects()).each(function(e){var t,n,r,o,i,a,u,s,c,l=function(e){if(e.inline)return e.getBody().getBoundingClientRect();var t=e.getWin();return{left:0,right:t.innerWidt
h,top:0,bottom:t.innerHeight,width:t.innerWidth,height:t.innerHeight}}(d),f={x:(i=t=l,a=n=e,a.left>i.left&&a.right<i.right?0:a.left<i.left?a.left-i.left:a.right-i.right),y:(r=t,o=n,o.top>r.top&&o.bottom<r.bottom?0:o.top<r.top?o.top-r.top:o.bottom-r.bottom)};s=0!==f.x?0<f.x?f.x+4:f.x-4:0,c=0!==f.y?0<f.y?f.y+4:f.y-4:0,(u=d).inline?(u.getBody().scrollLeft+=s,u.getBody().scrollTop+=c):u.getWin().scrollBy(s,c)})},Cu=function(e,t,n){var r=e.getParam(t,n);if(-1!==r.indexOf("=")){var o=e.getParam(t,"","hash");return o.hasOwnProperty(e.id)?o[e.id]:n}return r},xu=function(e){return e.getParam("iframe_attrs",{})},wu=function(e){return e.getParam("doctype","<!DOCTYPE html>")},Nu=function(e){return e.getParam("document_base_url","")},Eu=function(e){return Cu(e,"body_id","tinymce")},Su=function(e){return Cu(e,"body_class","")},ku=fun
ction(e){return e.getParam("content_security_policy","")},Tu=function(e){return e.getParam("br_in_pre",!0)},Au=function(e){if(e.getParam("force_p_newlines",!1))return"p";var t=e.getParam("forced_root_block","p");return!1===t?"":t},Ru=function(e){return e.getParam("forced_root_block_attrs",{})},Bu=function(e){return e.getParam("br_newline_selector",".mce-toc h2,figcaption,caption")},_u=function(e){return e.getParam("no_newline_selector","")},Du=function(e){return e.getParam("keep_styles",!0)},Ou=function(e){return e.getParam("end_container_on_empty_block",!1)},Pu=function(e){return Lt.explode(e.getParam("font_size_style_values",""))},Lu=function(e){return Lt.explode(e.getParam("font_size_classes",""))},Iu=function(t,n){qr.parent(t).each(function(e){e.dom().insertBefore(n.dom(),t.dom())})},Mu=funct
ion(e,t){e.dom().appendChild(t.dom())},Fu={before:Iu,after:function(e,t){qr.nextSibling(e).fold(function(){qr.parent(e).each(function(e){Mu(e,t)})},function(e){Iu(e,t)})},prepend:function(t,n){qr.firstChild(t).fold(function(){Mu(t,n)},function(e){t.dom().insertBefore(n.dom(),e.dom())})},append:Mu,appendAt:function(e,t,n){qr.child(e,n).fold(function(){Mu(e,t)},function(e){Iu(e,t)})},wrap:function(e,t){Iu(e,t),Mu(t,e)}},zu=zn.detect().browser,Uu=function(){return zu.isIE()||zu.isEdge()||zu.isFirefox()},qu=function(e,t){e.selection.setRng(t),bu(e,t)},Vu=function(t,n,e){var r=t(n,e);return r.breakType===Aa.Wrap&&0===r.positions.length?r.breakAt.map(function(e){return t(n,e).breakAt.isNone()}).getOr(!0):r.breakAt.isNone()},Hu=ua.curry(Vu,uu),ju=ua.curry(Vu,su),$u=function(e,t,n,r){var o,i,a,u,s=e.selection.getRng(),c=t?1:-1;if(Uu()&&(o=t,i=s,a=n,u=Ba.fromRangeStart(i),Ka.positionIn(!o,a).map(function(e){return e.isEqual(u)}).getOr(!1))){var l=Ga(c,e,n,!t,!0);return qu(e,l
),!0}return!1},Wu=function(e,t){var n=t.getNode(e);return Ao.isElement(n)&&"TABLE"===n.nodeName?A.some(n):A.none()},Ku=function(u,s,c){var e=Wu(!!s,c),t=!1===s;e.fold(function(){return qu(u,c.toRange())},function(a){return Ka.positionIn(t,u.getBody()).filter(function(e){return e.isEqual(c)}).fold(function(){return qu(u,c.toRange())},function(e){return n=s,o=a,t=c,void((i=Au(r=u))?r.undoManager.transact(function(){var e=qn.fromTag(i);cr.setAll(e,Ru(r)),Fu.append(e,qn.fromTag("br")),n?Fu.after(qn.fromDom(o),e):Fu.before(qn.fromDom(o),e);var t=r.dom.createRng();t.setStart(e.dom(),0),t.setEnd(e.dom(),0),qu(r,t)}):qu(r,t.toRange()));var n,r,o,t,i})})},Xu=function(e,t,n,r){var o,i,a,u,s,c,l=e.selection.getRng(),f=Ba.fromRangeStart(l),d=e.getBody();if(!t&&Hu(r,f)){var m=(u=d,gu(s=n,c=f).orThunk(function(){return H.head(c.getClientRects()).bind(function(e){return iu(cu(u,Ba.before(s)),e.left)})}).getOr(Ba.before(s)));return Ku(e,t,m),!0}return!(!t||!ju(r,
f))&&(o=d,m=hu(i=n,a=f).orThunk(function(){return H.head(a.getClientRects()).bind(function(e){return iu(lu(o,Ba.after(i)),e.left)})}).getOr(Ba.after(i)),Ku(e,t,m),!0)},Yu=function(t,n){return function(){return A.from(t.dom.getParent(t.selection.getNode(),"td,th")).bind(function(e){return A.from(t.dom.getParent(e,"table")).map(function(e){return $u(t,n,e)})}).getOr(!1)}},Gu=function(n,r){return function(){return A.from(n.dom.getParent(n.selection.getNode(),"td,th")).bind(function(t){return A.from(n.dom.getParent(t,"table")).map(function(e){return Xu(n,r,e,t)})}).getOr(!1)}},Ju=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return Ju(n())}}},Qu=Ao.isContentEditableFalse,Zu=function(e,t,n){var r,o,i,a,u,s=Ji(t.getBoundingClientRect(),n);return"BODY"===e.tagName?(r=e.ownerDocument.documentElement,o=e.scrollLeft||r.scrollLeft,i=e.scrollTop||r.scrollTop):(u=e.getBoundingClientRect(),o=
e.scrollLeft-u.left,i=e.scrollTop-u.top),s.left+=o,s.right+=o,s.top+=i,s.bottom+=i,s.width=1,0<(a=t.offsetWidth-t.clientWidth)&&(n&&(a*=-1),s.left+=a,s.right+=a),s},es=function(a,u,e){var t,s,c=Ju(A.none()),l=function(){!function(e){var t,n,r,o,i;for(t=en("*[contentEditable=false]",e),o=0;o<t.length;o++)r=(n=t[o]).previousSibling,Ii(r)&&(1===(i=r.data).length?r.parentNode.removeChild(r):r.deleteData(i.length-1,1)),r=n.nextSibling,Li(r)&&(1===(i=r.data).length?r.parentNode.removeChild(r):r.deleteData(0,1))}(a),s&&(Ua.remove(s),s=null),c.get().each(function(e){en(e.caret).remove(),c.set(A.none())}),clearInterval(t)},f=function(){t=Ce.setInterval(function(){e()?en("div.mce-visual-caret",a).toggleClass("mce-visual-caret-hidden"):en("div.mce-visual-caret",a).addClass("mce-visual-caret-hidden")},500)};return{show:function(t,e){var n,r,o;if(l(),o=e,Ao.isElement(o)&&/^(TD|TH)$/i.test(o.ta
gName))return null;if(!u(e))return s=function(e,t){var n,r,o;if(r=e.ownerDocument.createTextNode(Ei),o=e.parentNode,t){if(n=e.previousSibling,Ti(n)){if(Bi(n))return n;if(Ii(n))return n.splitText(n.data.length-1)}o.insertBefore(r,e)}else{if(n=e.nextSibling,Ti(n)){if(Bi(n))return n;if(Li(n))return n.splitText(1),n}e.nextSibling?o.insertBefore(r,e.nextSibling):o.appendChild(r)}return r}(e,t),r=e.ownerDocument.createRange(),Qu(s.nextSibling)?(r.setStart(s,0),r.setEnd(s,0)):(r.setStart(s,1),r.setEnd(s,1)),r;s=Pi("p",e,t),n=Zu(a,e,t),en(s).css("top",n.top);var i=en('<div class="mce-visual-caret" data-mce-bogus="all"></div>').css(n).appendTo(a)[0];return c.set(A.some({caret:i,element:e,before:t})),c.get().each(function(e){t&&en(e.caret).addClass("mce-visual-caret-before")}),f(),(r=e.ownerDocument.createRange()).setStart(s,0),r.setEnd(s,0),r},hide:l,getCss:function(){return".mce-visual-caret {position: absolute;backg
round-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}"},reposition:function(){c.get().each(function(e){var t=Zu(a,e.element,e.before);en(e.caret).css(t)})},destroy:function(){return Ce.clearInterval(t)}}},ts=function(e){return Qu(e)||Ao.isTable(e)&&Uu()},ns=Ao.isContentEditableFalse,rs=Ao.matchStyleValues("display","block table table-cell table-caption list-item"),os=Bi,is=Ai,as=ua.curry,us=Ao.isElement,ss=Wi,cs=function(e){return 0<e},ls=function(e){return e<0},fs=function(e,t){for(var n;n=e(t);)if(!is(n))return n;return null},ds=function(e,t,n,r,o){var i=new no(e,r);if(ls(t)){if((ns(e)||is(e))&&n(e=fs(i.prev,!0)))return e;for(;e=fs(i.prev,o);)if(n(e))return e}if(cs(t)){if((ns(e)||is(e))&&n(e=fs(i.next,!0)))return e;for(;e=fs(i.next,o);)if(n(e))return e}return null},ms=function(e,t){for(;e&&
;e!==t;){if(rs(e))return e;e=e.parentNode}return null},ps=function(e,t,n){return ms(e.container(),n)===ms(t.container(),n)},gs=function(e,t){var n,r;return t?(n=t.container(),r=t.offset(),us(n)?n.childNodes[r+e]:null):null},hs=function(e,t){var n=t.ownerDocument.createRange();return e?(n.setStartBefore(t),n.setEndBefore(t)):(n.setStartAfter(t),n.setEndAfter(t)),n},vs=function(e,t,n){var r,o,i,a;for(o=e?"previousSibling":"nextSibling";n&&n!==t;){if(r=n[o],os(r)&&(r=r[o]),ns(r)){if(a=n,ms(r,i=t)===ms(a,i))return r;break}if(ss(r))break;n=n.parentNode}return null},ys=as(hs,!0),bs=as(hs,!1),Cs=function(e,t,n){var r,o,i,a,u=as(vs,!0,t),s=as(vs,!1,t);if(o=n.startContainer,i=n.startOffset,Ai(o)){if(us(o)||(o=o.parentNode),"before"===(a=o.getAttribute("data-mce-caret"))&&(r=o.nextSibling,ts(r)))return ys(r);if("after"===a&&(r=o.previousSibling,ts(r)))return bs(r)}if(!n.collapsed)return n;if(Ao.isText(o)){if(os(
o)){if(1===e){if(r=s(o))return ys(r);if(r=u(o))return bs(r)}if(-1===e){if(r=u(o))return bs(r);if(r=s(o))return ys(r)}return n}if(Ii(o)&&i>=o.data.length-1)return 1===e&&(r=s(o))?ys(r):n;if(Li(o)&&i<=1)return-1===e&&(r=u(o))?bs(r):n;if(i===o.data.length)return(r=s(o))?ys(r):n;if(0===i)return(r=u(o))?bs(r):n}return n},xs=function(e,t){var n=gs(e,t);return ns(n)&&!Ao.isBogusAll(n)},ws=function(e,t){return Ao.isTable(gs(e,t))},Ns=function(e,t){return A.from(gs(e?0:-1,t)).filter(ns)},Es=function(e,t,n){var r=Cs(e,t,n);return-1===e?Ta.fromRangeStart(r):Ta.fromRangeEnd(r)},Ss=as(xs,0),ks=as(xs,-1),Ts=as(ws,0),As=as(ws,-1);(tu=eu||(eu={}))[tu.Backwards=-1]="Backwards",tu[tu.Forwards=1]="Forwards";var Rs,Bs,_s,Ds,Os,Ps=Ao.isContentEditableFalse,Ls=Ao.isText,Is=Ao.isElement,Ms=Ao.isBr,Fs=Wi,zs=function(e){return Hi(e)||!!Ki(t=e)&&!0!==Bt.reduce(t.getElementsByTagName("*"),function(e,t){return e||Fi(t)},!1);var
t},Us=Xi,qs=function(e,t){return e.hasChildNodes()&&t<e.childNodes.length?e.childNodes[t]:null},Vs=function(e,t){if(cs(e)){if(Fs(t.previousSibling)&&!Ls(t.previousSibling))return Ba.before(t);if(Ls(t))return Ba(t,0)}if(ls(e)){if(Fs(t.nextSibling)&&!Ls(t.nextSibling))return Ba.after(t);if(Ls(t))return Ba(t,t.data.length)}return ls(e)?Ms(t)?Ba.before(t):Ba.after(t):Ba.before(t)},Hs=function(e,t,n){var r,o,i,a,u;if(!Is(n)||!t)return null;if(t.isEqual(Ba.after(n))&&n.lastChild){if(u=Ba.after(n.lastChild),ls(e)&&Fs(n.lastChild)&&Is(n.lastChild))return Ms(n.lastChild)?Ba.before(n.lastChild):u}else u=t;var s,c,l,f=u.container(),d=u.offset();if(Ls(f)){if(ls(e)&&0<d)return Ba(f,--d);if(cs(e)&&d<f.length)return Ba(f,++d);r=f}else{if(ls(e)&&0<d&&(o=qs(f,d-1),Fs(o)))return!zs(o)&&(i=ds(o,e,Us,o))?Ls(i)?Ba(i,i.data.length):Ba.after(i):Ls(o)?Ba(o,o.data.length):Ba.before(o);if(cs(e)&&d<
f.childNodes.length&&(o=qs(f,d),Fs(o)))return Ms(o)&&n.lastChild===o?null:(s=o,c=n,Ao.isBr(s)&&(l=Hs(1,Ba.after(s),c))&&!ps(Ba.before(s),Ba.before(l),c)?Hs(e,Ba.after(o),n):!zs(o)&&(i=ds(o,e,Us,o))?Ls(i)?Ba(i,0):Ba.before(i):Ls(o)?Ba(o,0):Ba.after(o));r=o||u.getNode()}return(cs(e)&&u.isAtEnd()||ls(e)&&u.isAtStart())&&(r=ds(r,e,ua.constant(!0),n,!0),Us(r,n))?Vs(e,r):(o=ds(r,e,Us,n),!(a=Bt.last(Bt.filter(function(e,t){for(var n=[];e&&e!==t;)n.push(e),e=e.parentNode;return n}(f,n),Ps)))||o&&a.contains(o)?o?Vs(e,o):null:u=cs(e)?Ba.after(a):Ba.before(a))},js=function(t){return{next:function(e){return Hs(eu.Forwards,e,t)},prev:function(e){return Hs(eu.Backwards,e,t)}}},$s=function(e){return Lt.grep(e.childNodes,function(e){return"LI"===e.nodeName})},Ws=function(e){return e&&e.firstChild&&e.firstChild===e.lastChild&&("\xa0"===(t=e.firstChild).data||Ao.isBr(t));var t},
Ks=function(e){return 0<e.length&&(!(t=e[e.length-1]).firstChild||Ws(t))?e.slice(0,-1):e;var t},Xs=function(e,t){var n=e.getParent(t,e.isBlock);return n&&"LI"===n.nodeName?n:null},Ys=function(e,t){var n=Ba.after(e),r=js(t).prev(n);return r?r.toRange():null},Gs=function(t,e,n){var r,o,i,a,u=t.parentNode;return Lt.each(e,function(e){u.insertBefore(e,t)}),r=t,o=n,i=Ba.before(r),(a=js(o).next(i))?a.toRange():null},Js=function(e,t){var n,r,o,i,a,u,s=t.firstChild,c=t.lastChild;return s&&"meta"===s.name&&(s=s.next),c&&"mce_marker"===c.attr("id")&&(c=c.prev),r=c,u=(n=e).getNonEmptyElements(),r&&(r.isEmpty(u)||(o=r,n.getBlockElements()[o.name]&&(a=o).firstChild&&a.firstChild===a.lastChild&&("br"===(i=o.firstChild).name||"\xa0"===i.value)))&&(c=c.prev),!(!s||s!==c||"ul"!==s.name&&"ol"!==s.name)},Qs=function(e,o,i,t){
var n,r,a,u,s,c,l,f,d,m,p,g,h,v,y,b,C,x,w,N=(n=o,r=t,c=e.serialize(r),l=n.createFragment(c),u=(a=l).firstChild,s=a.lastChild,u&&"META"===u.nodeName&&u.parentNode.removeChild(u),s&&"mce_marker"===s.id&&s.parentNode.removeChild(s),a),E=Xs(o,i.startContainer),S=Ks($s(N.firstChild)),k=o.getRoot(),T=function(e){var t=Ba.fromRangeStart(i),n=js(o.getRoot()),r=1===e?n.prev(t):n.next(t);return!r||Xs(o,r.getNode())!==E};return T(1)?Gs(E,S,k):T(2)?(f=E,d=S,m=k,o.insertAfter(d.reverse(),f),Ys(d[0],m)):(g=S,h=k,v=p=E,b=(y=i).cloneRange(),C=y.cloneRange(),b.setStartBefore(v),C.setEndAfter(v),x=[b.cloneContents(),C.cloneContents()],(w=p.parentNode).insertBefore(x[0],p),Lt.each(g,function(e){w.insertBefore(e,p)}),w.insertBefore(x[1],p),w.removeChild(p),Ys(g[g.length-1],h))},Zs=function(e,t){return!!Xs(e,t)},ec=Ao.isText,tc=Ao.isBogus,nc=di.nodeIndex,rc=function(e){var t=e.parentNode;return tc(t)?rc(t):t},oc=function(e){return e?Bt.reduce(e.childNo
des,function(e,t){return tc(t)&&"BR"!==t.nodeName?e=e.concat(oc(t)):e.push(t),e},[]):[]},ic=function(t){return function(e){return t===e}},ac=function(e){var t,r,n,o;return(ec(e)?"text()":e.nodeName.toLowerCase())+"["+(r=oc(rc(t=e)),n=Bt.findIndex(r,ic(t),t),r=r.slice(0,n+1),o=Bt.reduce(r,function(e,t,n){return ec(t)&&ec(r[n-1])&&e++,e},0),r=Bt.filter(r,Ao.matchNodeNames(t.nodeName)),(n=Bt.findIndex(r,ic(t),t))-o)+"]"},uc=function(e,t){var n,r,o,i,a,u=[];return n=t.container(),r=t.offset(),ec(n)?o=function(e,t){for(;(e=e.previousSibling)&&ec(e);)t+=e.data.length;return t}(n,r):(r>=(i=n.childNodes).length?(o="after",r=i.length-1):o="before",n=i[r]),u.push(ac(n)),a=function(e,t,n){var r=[];for(t=t.parentNode;!(t===e||n&&n(t));t=t.parentNode)r.push(t);return r}(e,n),a=Bt.filter(a,ua.negate(Ao.isBogus)),(u=u.concat(Bt.map(a,function(e){return ac(e)}))).reverse().join("/")+&quo
t;,"+o},sc=function(e,t){var n,r,o;return t?(t=(n=t.split(","))[0].split("/"),o=1<n.length?n[1]:"before",(r=Bt.reduce(t,function(e,t){return(t=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(t))?("text()"===t[1]&&(t[1]="#text"),n=e,r=t[1],o=parseInt(t[2],10),i=oc(n),i=Bt.filter(i,function(e,t){return!ec(e)||!ec(i[t-1])}),(i=Bt.filter(i,Ao.matchNodeNames(r)))[o]):null;var n,r,o,i},e))?ec(r)?function(e,t){for(var n,r=e,o=0;ec(r);){if(n=r.data.length,o<=t&&t<=o+n){e=r,t-=o;break}if(!ec(r.nextSibling)){e=r,t=n;break}o+=n,r=r.nextSibling}return ec(e)&&t>e.data.length&&(t=e.data.length),Ba(e,t)}(r,parseInt(o,10)):(o="after"===o?nc(r)+1:nc(r),Ba(r.parentNode,o)):null):null},cc=Ao.isContentEditableFalse,lc=function(e,t,n,r,o){var i,a=r[o?"startContainer":"endContainer"],u=r[o?"startOffset":"endOffset"],s=[],c=0,l=e.getRoot();for(Ao.isText(a)?s.push(n?function
(e,t,n){var r,o;for(o=e(t.data.slice(0,n)).length,r=t.previousSibling;r&&Ao.isText(r);r=r.previousSibling)o+=e(r.data).length;return o}(t,a,u):u):(u>=(i=a.childNodes).length&&i.length&&(c=1,u=Math.max(0,i.length-1)),s.push(e.nodeIndex(i[u],n)+c));a&&a!==l;a=a.parentNode)s.push(e.nodeIndex(a,n));return s},fc=function(e){Ao.isText(e)&&0===e.data.length&&e.parentNode.removeChild(e)},dc=function(e,t,n){var r=0;return Lt.each(e.select(t),function(e){if("all"!==e.getAttribute("data-mce-bogus"))return e!==n&&void r++}),r},mc=function(e,t){var n,r,o,i=t?"start":"end";n=e[i+"Container"],r=e[i+"Offset"],Ao.isElement(n)&&"TR"===n.nodeName&&(n=(o=n.childNodes)[Math.min(t?r:r-1,o.length-1)])&&(r=t?0:n.childNodes.length,e["set"+(t?"Start":"End")](n,r))},pc=function(e){return mc(e,!0),mc(e,!1),e},gc=function(e,t){var
n;if(Ao.isElement(e)&&(e=na(e,t),cc(e)))return e;if(Bi(e)){if(Ao.isText(e)&&Ai(e)&&(e=e.parentNode),n=e.previousSibling,cc(n))return n;if(n=e.nextSibling,cc(n))return n}},hc=function(e,t,n){var r=n.getNode(),o=r?r.nodeName:null,i=n.getRng();if(cc(r)||"IMG"===o)return{name:o,index:dc(n.dom,o,r)};var a,u,s,c,l,f,d,m=gc((a=i).startContainer,a.startOffset)||gc(a.endContainer,a.endOffset);return m?{name:o=m.tagName,index:dc(n.dom,o,m)}:(u=e,c=t,l=i,f=(s=n).dom,(d={}).start=lc(f,u,c,l,!0),s.isCollapsed()||(d.end=lc(f,u,c,l,!1)),d)},vc=function(e,t,n){var r={"data-mce-type":"bookmark",id:t,style:"overflow:hidden;line-height:0px"};return n?e.create("span",r,""):e.create("span",r)},yc=function(e,t){var n=e.dom,r=e.getRng(),o=n.uniqueId(),i=e.isCollapsed(),a=e.getNode(),u=a.nodeName;if("IMG"===u)return{name:u,index:dc(n,u,a)};var s=pc(r.cloneRange());if(!i){s.collapse(!1);var c=
vc(n,o+"_end",t);s.insertNode(c),fc(c.nextSibling)}(r=pc(r)).collapse(!0);var l=vc(n,o+"_start",t);return r.insertNode(l),fc(l.previousSibling),e.moveToBookmark({id:o,keep:1}),{id:o}},bc={getBookmark:function(e,t,n){return 2===t?hc(Si,n,e):3===t?(o=(r=e).getRng(),{start:uc(r.dom.getRoot(),Ba.fromRangeStart(o)),end:uc(r.dom.getRoot(),Ba.fromRangeEnd(o))}):t?{rng:e.getRng()}:yc(e,!1);var r,o},getUndoBookmark:V.curry(hc,V.identity,!0),getPersistentBookmark:yc},Cc="_mce_caret",xc=function(e){return Ao.isElement(e)&&e.id===Cc},wc=function(e,t){for(;t&&t!==e;){if(t.id===Cc)return t;t=t.parentNode}return null},Nc=function(e,t){return!e.isBlock(t)||t.innerHTML||ge.ie||(t.innerHTML='<br data-mce-bogus="1" />'),t},Ec=function(e,t){return Ka.lastPositionIn(e).fold(function(){return!1},function(e){return t.setStart(e.container(),e.offset()),t.setEnd(e.container(),e.offset()),!0})},Sc=function(e,t,n){return!(!1!==t.hasChildNodes()||!w
c(e,t)||(o=n,i=(r=t).ownerDocument.createTextNode(Ei),r.appendChild(i),o.setStart(i,0),o.setEnd(i,0),0));var r,o,i},kc=function(e,t,n,r){var o,i,a,u,s=n[t?"start":"end"],c=e.getRoot();if(s){for(a=s[0],i=c,o=s.length-1;1<=o;o--){if(u=i.childNodes,Sc(c,i,r))return!0;if(s[o]>u.length-1)return!!Sc(c,i,r)||Ec(i,r);i=u[s[o]]}3===i.nodeType&&(a=Math.min(s[0],i.nodeValue.length)),1===i.nodeType&&(a=Math.min(s[0],i.childNodes.length)),t?r.setStart(i,a):r.setEnd(i,a)}return!0},Tc=function(e){return Ao.isText(e)&&0<e.data.length},Ac=function(e,t,n){var r,o,i,a,u,s,c=e.get(n.id+"_"+t),l=n.keep;if(c){if(r=c.parentNode,"start"===t?l?c.hasChildNodes()?(r=c.firstChild,o=1):Tc(c.nextSibling)?(r=c.nextSibling,o=0):Tc(c.previousSibling)?(r=c.previousSibling,o=c.previousSibling.data.length):(r=c.parentNode,o=e.nodeIndex(c)+1):o=e.nodeIndex(c):l?c.hasChildNodes()?(r=c.firstChild,o=1):Tc(c.previousSibling)?(r=c.previousSibling,o=c.p
reviousSibling.data.length):(r=c.parentNode,o=e.nodeIndex(c)):o=e.nodeIndex(c),u=r,s=o,!l){for(a=c.previousSibling,i=c.nextSibling,Lt.each(Lt.grep(c.childNodes),function(e){Ao.isText(e)&&(e.nodeValue=e.nodeValue.replace(/\uFEFF/g,""))});c=e.get(n.id+"_"+t);)e.remove(c,!0);a&&i&&a.nodeType===i.nodeType&&Ao.isText(a)&&!ge.opera&&(o=a.nodeValue.length,a.appendData(i.nodeValue),e.remove(i),u=a,s=o)}return A.some(Ba(u,s))}return A.none()},Rc=function(e,t){var n,r,o,i,a,u,s,c,l,f,d,m,p,g,h,v,y=e.dom;if(t){if(v=t,Lt.isArray(v.start))return g=t,h=(p=y).createRng(),kc(p,!0,g,h)&&kc(p,!1,g,h)?A.some(h):A.none();if("string"==typeof t.start)return A.some((f=t,d=(l=y).createRng(),m=sc(l.getRoot(),f.start),d.setStart(m.container(),m.offset()),m=sc(l.getRoot(),f.end),d.setEnd(m.container(),m.offset()),d));if(t.hasOwnProperty("id"))return s=Ac(o=y,"start",i=t),c=Ac(o,"end",i),sa([s,(a
=c,u=s,a.isSome()?a:u)],function(e,t){var n=o.createRng();return n.setStart(Nc(o,e.container()),e.offset()),n.setEnd(Nc(o,t.container()),t.offset()),n});if(t.hasOwnProperty("name"))return n=y,r=t,A.from(n.select(r.name)[r.index]).map(function(e){var t=n.createRng();return t.selectNode(e),t});if(t.hasOwnProperty("rng"))return A.some(t.rng)}return A.none()},Bc={getBookmark:function(e,t,n){return bc.getBookmark(e,t,n)},moveToBookmark:function(t,e){Rc(t,e).each(function(e){t.setRng(e)})},isBookmarkNode:function(e){return Ao.isElement(e)&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type")}},_c=Lt.each,Dc=function(o){this.compare=function(e,t){if(e.nodeName!==t.nodeName)return!1;var n=function(n){var r={};return _c(o.getAttribs(n),function(e){var t=e.nodeName.toLowerCase();0!==t.indexOf("_")&&"style"!==t&&0!==t.indexOf("data-")&&(r[t]=o.getAttrib(n,t))}),r}
,r=function(e,t){var n,r;for(r in e)if(e.hasOwnProperty(r)){if(void 0===(n=t[r]))return!1;if(e[r]!==n)return!1;delete t[r]}for(r in t)if(t.hasOwnProperty(r))return!1;return!0};return!(!r(n(e),n(t))||!r(o.parseStyle(o.getAttrib(e,"style")),o.parseStyle(o.getAttrib(t,"style")))||Bc.isBookmarkNode(e)||Bc.isBookmarkNode(t))}},Oc=function(t,e){H.each(e,function(e){Fu.before(t,e)})},Pc=function(t,e){H.each(e,function(e){Fu.append(t,e)})},Lc=function(e){var t=e.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},Ic={empty:function(e){e.dom().textContent="",H.each(qr.children(e),function(e){Lc(e)})},remove:Lc,unwrap:function(e){var t=qr.children(e);0<t.length&&Oc(e,t),Lc(e)}},Mc=(Rs=Qn.isText,Bs="text",_s=function(e){return Rs(e)?A.from(e.dom().nodeValue):A.none()},Ds=zn.detect().browser,{get:function(e){if(!Rs(e))throw new Error("Can only get "+Bs+" value of a "+Bs+" node");return Os(e).getOr("
;")},getOption:Os=Ds.isIE()&&10===Ds.version.major?function(e){try{return _s(e)}catch(Zx){return A.none()}}:_s,set:function(e,t){if(!Rs(e))throw new Error("Can only set raw "+Bs+" value of a "+Bs+" node");e.dom().nodeValue=t}}),Fc=function(e){return Mc.get(e)},zc=function(e){var t=fu(e,"br"),n=H.filter(function(e){for(var t=[],n=e.dom();n;)t.push(qn.fromDom(n)),n=n.lastChild;return t}(e).slice(-1),lo);t.length===n.length&&H.each(n,Ic.remove)},Uc=function(e){Ic.empty(e),Fu.append(e,qn.fromHtml('<br data-mce-bogus="1">'))},qc=function(n){qr.lastChild(n).each(function(t){qr.prevSibling(t).each(function(e){so(n)&&lo(t)&&so(e)&&Ic.remove(t)})})},Vc=Lt.makeMap;function Hc(e){var u,s,c,l,f,d=[];return u=(e=e||{}).indent,s=Vc(e.indent_before||""),c=Vc(e.indent_after||""),l=Vo.getEncodeFunc(e.entity_encoding||"raw",e.entities),f="html"===e.element_forma
t,{start:function(e,t,n){var r,o,i,a;if(u&&s[e]&&0<d.length&&0<(a=d[d.length-1]).length&&"\n"!==a&&d.push("\n"),d.push("<",e),t)for(r=0,o=t.length;r<o;r++)i=t[r],d.push(" ",i.name,'="',l(i.value,!0),'"');d[d.length]=!n||f?">":" />",n&&u&&c[e]&&0<d.length&&0<(a=d[d.length-1]).length&&"\n"!==a&&d.push("\n")},end:function(e){var t;d.push("</",e,">"),u&&c[e]&&0<d.length&&0<(t=d[d.length-1]).length&&"\n"!==t&&d.push("\n")},text:function(e,t){0<e.length&&(d[d.length]=t?e:l(e))},cdata:function(e){d.push("<![CDATA[",e,"]]>")},comment:function(e){d.push("\x3c!--",e,"--\x3e")},pi:function(e,t){t?d.push("<?",e," ",l(t),"?
>"):d.push("<?",e,"?>"),u&&d.push("\n")},doctype:function(e){d.push("<!DOCTYPE",e,">",u?"\n":"")},reset:function(){d.length=0},getContent:function(){return d.join("").replace(/\n$/,"")}}}function jc(t,p){void 0===p&&(p=Zo());var g=Hc(t);return(t=t||{}).validate=!("validate"in t)||t.validate,{serialize:function(e){var f,d;d=t.validate,f={3:function(e){g.text(e.value,e.raw)},8:function(e){g.comment(e.value)},7:function(e){g.pi(e.name,e.value)},10:function(e){g.doctype(e.value)},4:function(e){g.cdata(e.value)},11:function(e){if(e=e.firstChild)for(;m(e),e=e.next;);}},g.reset();var m=function(e){var t,n,r,o,i,a,u,s,c,l=f[e.type];if(l)l(e);else{if(t=e.name,n=e.shortEnded,r=e.attributes,d&&r&&1<r.length&&((a=[]).map={},c=p.getElementRule(e.name))){for(u=0,s=c.attributesOrder.length;u<s;u++)(o=c.attributesOrder[u])in r.map&
&(i=r.map[o],a.map[o]=i,a.push({name:o,value:i}));for(u=0,s=r.length;u<s;u++)(o=r[u].name)in a.map||(i=r.map[o],a.map[o]=i,a.push({name:o,value:i}));r=a}if(g.start(e.name,r,n),!n){if(e=e.firstChild)for(;m(e),e=e.next;);g.end(t)}}};return 1!==e.type||t.inner?f[11](e):m(e),g.getContent()}}}var $c=function(a){var u=Ba.fromRangeStart(a),s=Ba.fromRangeEnd(a),c=a.commonAncestorContainer;return Ka.fromPosition(!1,c,s).map(function(e){return!ps(u,s,c)&&ps(u,e,c)?(t=u.container(),n=u.offset(),r=e.container(),o=e.offset(),(i=document.createRange()).setStart(t,n),i.setEnd(r,o),i):a;var t,n,r,o,i}).getOr(a)},Wc=function(e){return e.collapsed?e:$c(e)},Kc=Ao.matchNodeNames("td th"),Xc=function(o,e,t){var n,r,i,a,u,s,c,l,f,d,m,p,g=o.schema.getTextInlineElements(),h=o.selection,v=o.dom;if(/^ | $/.test(e)&&(e=function(e){var t,n,r;t=h.getRng(),n=t.startContainer,r=t.startOffset;var o=function(e){return n[e]&&3===n[e].nodeType};return 3===n.nodeType&&(
0<r?e=e.replace(/^ /," "):o("previousSibling")||(e=e.replace(/^ /," ")),r<n.length?e=e.replace(/ (<br>|)$/," "):o("nextSibling")||(e=e.replace(/( | )(<br>|)$/," "))),e}(e)),n=o.parser,p=t.merge,r=jc({validate:o.settings.validate},o.schema),m='<span id="mce_marker" data-mce-type="bookmark">​</span>',s={content:e,format:"html",selection:!0,paste:t.paste},(s=o.fire("BeforeSetContent",s)).isDefaultPrevented())o.fire("SetContent",{content:s.content,format:"html",selection:!0,paste:t.paste});else{-1===(e=s.content).indexOf("{$caret}")&&(e+="{$caret}"),e=e.replace(/\{\$caret\}/,m);var y,b,C,x,w=(l=h.getRng()).startContainer||(l.parentElement?l.parentElement():null),N=o.getBody();w===N&&h.isCollapsed()&&v.isBlock(N.firstChild)&&a
mp;(y=N.firstChild)&&!o.schema.getShortEndedElements()[y.nodeName]&&v.isEmpty(N.firstChild)&&((l=v.createRng()).setStart(N.firstChild,0),l.setEnd(N.firstChild,0),h.setRng(l)),h.isCollapsed()||(o.selection.setRng(Wc(o.selection.getRng())),o.getDoc().execCommand("Delete",!1,null),C=(b=h.getRng()).startContainer,x=b.startOffset,3===C.nodeType&&b.collapsed&&("\xa0"===C.data[x]?(C.deleteData(x,1),/[\u00a0| ]$/.test(e)||(e+=" ")):"\xa0"===C.data[x-1]&&(C.deleteData(x-1,1),/[\u00a0| ]$/.test(e)||(e=" "+e))));var E,S,k,T={context:(i=h.getNode()).nodeName.toLowerCase(),data:t.data,insert:!0};if(u=n.parse(e,T),!0===t.paste&&Js(o.schema,u)&&Zs(v,i))return l=Qs(r,v,o.selection.getRng(),u),o.selection.setRng(l),void o.fire("SetContent",s);if(function(e){for(var t=e;t=t.walk();)1===t.type&&t.attr("data-mce-fragment","1")}(u),"mce_marker"
===(f=u.lastChild).attr("id"))for(f=(c=f).prev;f;f=f.walk(!0))if(3===f.type||!v.isBlock(f.name)){o.schema.isValidChild(f.parent.name,"span")&&f.parent.insert(c,f,"br"===f.name);break}if(o._selectionOverrides.showBlockCaretContainer(i),T.invalid){for(h.setContent(m),i=h.getNode(),a=o.getBody(),9===i.nodeType?i=f=a:f=i;f!==a;)f=(i=f).parentNode;e=i===a?a.innerHTML:v.getOuterHTML(i),e=r.serialize(n.parse(e.replace(/<span (id="mce_marker"|id=mce_marker).+?<\/span>/i,function(){return r.serialize(u)}))),i===a?v.setHTML(a,e):v.setOuterHTML(i,e)}else e=r.serialize(u),function(e,t,n){if("all"===n.getAttribute("data-mce-bogus"))n.parentNode.insertBefore(e.dom.createFragment(t),n);else{var r=n.firstChild,o=n.lastChild;!r||r===o&&"BR"===r.nodeName?e.dom.setHTML(n,t):e.selection.setContent(t)}}(o,e,i);!function(){if(p){var n=o.getBody(),r=new Dc(v);Lt.each(v.select("*[data-mce-fragment]"),fu
nction(e){for(var t=e.parentNode;t&&t!==n;t=t.parentNode)g[e.nodeName.toLowerCase()]&&r.compare(t,e)&&v.remove(e,!0)})}}(),function(e){var t,n,r;if(e){if(h.scrollIntoView(e),t=function(e){for(var t=o.getBody();e&&e!==t;e=e.parentNode)if("false"===o.dom.getContentEditable(e))return e;return null}(e))return v.remove(e),h.select(t);l=v.createRng(),(f=e.previousSibling)&&3===f.nodeType?(l.setStart(f,f.nodeValue.length),ge.ie||(d=e.nextSibling)&&3===d.nodeType&&(f.appendData(d.data),d.parentNode.removeChild(d))):(l.setStartBefore(e),l.setEndBefore(e)),n=v.getParent(e,v.isBlock),v.remove(e),n&&v.isEmpty(n)&&(o.$(n).empty(),l.setStart(n,0),l.setEnd(n,0),Kc(n)||n.getAttribute("data-mce-fragment")||!(r=function(e){var t=Ba.fromRangeStart(e);if(t=js(o.getBody()).next(t))return t.toRange()}(l))?v.add(n,v.create("br",{"data-mce-bogus":"1"})):(l=r,v.remove(n))),h.setRng(l)}}(
v.get("mce_marker")),E=o.getBody(),Lt.each(E.getElementsByTagName("*"),function(e){e.removeAttribute("data-mce-fragment")}),S=o.dom,k=o.selection.getStart(),A.from(S.getParent(k,"td,th")).map(qn.fromDom).each(qc),o.fire("SetContent",s),o.addVisual()}},Yc={insertAtCaret:function(e,t){var n,r,o="string"!=typeof(n=t)?(r=Lt.extend({paste:n.paste,data:{paste:n.paste}},n),{content:n.content,details:r}):{content:n,details:{}};Xc(e,o.content,o.details)}};function Gc(e,t,n,r,o){return e(n,r)?A.some(n):E.isFunction(o)&&o(n)?A.none():t(n,r,o)}var Jc=function(e,t,n){for(var r=e.dom(),o=E.isFunction(n)?n:V.constant(!1);r.parentNode;){r=r.parentNode;var i=qn.fromDom(r);if(t(i))return A.some(i);if(o(i))break}return A.none()},Qc=function(e,t){return H.find(e.dom().childNodes,V.compose(t,qn.fromDom)).map(qn.fromDom)},Zc=function(e,r){var o=function(e){for(var t=0;t<e.childNodes.length;t++){if(r(qn.fromDom(e.childNodes[t])))return
A.some(qn.fromDom(e.childNodes[t]));var n=o(e.childNodes[t]);if(n.isSome())return n}return A.none()};return o(e.dom())},el={first:function(e){return Zc(dr.body(),e)},ancestor:Jc,closest:function(e,t,n){return Gc(function(e){return t(e)},Jc,e,t,n)},sibling:function(t,n){var e=t.dom();return e.parentNode?Qc(qn.fromDom(e.parentNode),function(e){return!Or.eq(t,e)&&n(e)}):A.none()},child:Qc,descendant:Zc},tl=wr.immutable("sections","settings"),nl=zn.detect().deviceType.isTouch(),rl=["lists","autolink","autosave"],ol={theme:"mobile"},il=function(e){var t=E.isArray(e)?e.join(" "):e,n=H.map(E.isString(t)?t.split(" "):[],Dn);return H.filter(n,function(e){return 0<e.length})},al=function(e,t){return e.sections().hasOwnProperty(t)},ul=function(e,t,n,r){var o,i,a=il(n.forced_plugins),u=il(r.plugins),s=e&&al(t,"mobile")?(o=u,H.filter(o,V.curry(H.contains,rl))):u,c=(i=s,[].concat(il(a)).c
oncat(il(i)));return Lt.extend(r,{plugins:c.join(" ")})},sl=function(e,t,n,r){var o,i,a,u,s,c,l,f,d,m,p,g,h,v=(o=["mobile"],i=r,a=or.bifilter(i,function(e,t){return H.contains(o,t)}),tl(a.t,a.f)),y=Lt.extend(t,n,v.settings(),(p=e,h=(g=v).settings().inline,p&&al(g,"mobile")&&!h?(l="mobile",f=ol,d=v.sections(),m=d.hasOwnProperty(l)?d[l]:{},Lt.extend({},f,m)):{}),{validate:!0,content_editable:v.settings().inline,external_plugins:(u=n,s=v.settings(),c=s.external_plugins?s.external_plugins:{},u&&u.external_plugins?Lt.extend({},u.external_plugins,c):c)});return ul(e,v,n,y)},cl=function(e,t,n){return A.from(t.settings[n]).filter(e)},ll=V.curry(cl,E.isString),fl=function(e,t,n,r){var o,i,a,u=t in e.settings?e.settings[t]:n;return"hash"===r?(a={},"string"==typeof(i=u)?H.each(0<i.indexOf("=")?i.split(/[;,](?![^=;,]*(?:[;,]|$))/):i.split(","),function(e){var t=e.split("=");1<
t.length?a[Lt.trim(t[0])]=Lt.trim(t[1]):a[Lt.trim(t[0])]=Lt.trim(t)}):a=i,a):"string"===r?cl(E.isString,e,t).getOr(n):"number"===r?cl(E.isNumber,e,t).getOr(n):"boolean"===r?cl(E.isBoolean,e,t).getOr(n):"object"===r?cl(E.isObject,e,t).getOr(n):"array"===r?cl(E.isArray,e,t).getOr(n):"string[]"===r?cl((o=E.isString,function(e){return E.isArray(e)&&H.forall(e,o)}),e,t).getOr(n):"function"===r?cl(E.isFunction,e,t).getOr(n):u},dl=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,ml=function(e,t){var n=t.container(),r=t.offset();return e?Ri(n)?Ao.isText(n.nextSibling)?Ba(n.nextSibling,0):Ba.after(n):Di(t)?Ba(n,r+1):t:Ri(n)?Ao.isText(n.previousSibling)?Ba(n.previousSibling,n.previousSibling.data.length):Ba.before(n):Oi(t)?Ba(n,r-1):t},pl={isInlineTarget:function(e,t){var n=ll(e,"inline_boundaries_selector").getOr("a[href],code");return Br.is(qn.fromDom(t),n)},findRootInline:function(e,t,n){var r,o,i,
a=(r=e,o=t,i=n,H.filter(di.DOM.getParents(i.container(),"*",o),r));return A.from(a[a.length-1])},isRtl:function(e){return"rtl"===di.DOM.getStyle(e,"direction",!0)||(t=e.textContent,dl.test(t));var t},isAtZwsp:function(e){return Di(e)||Oi(e)},normalizePosition:ml,normalizeForwards:V.curry(ml,!0),normalizeBackwards:V.curry(ml,!1),hasSameParentBlock:function(e,t,n){var r=ms(t,e),o=ms(n,e);return r&&r===o}},gl=function(e,t){return Or.contains(e,t)?el.closest(t,function(e){return fo(e)||po(e)},(n=e,function(e){return Or.eq(n,qn.fromDom(e.dom().parentNode))})):A.none();var n},hl=function(e){var t,n,r;e.dom.isEmpty(e.getBody())&&(e.setContent(""),n=(t=e).getBody(),r=n.firstChild&&t.dom.isBlock(n.firstChild)?n.firstChild:n,t.selection.setCursorLocation(r,0))},vl=function(i,a,u){return sa([Ka.firstPositionIn(u),Ka.lastPositionIn(u)],function(e,t){var n=pl.normalizePosition(!0,e),r=pl.normalizePosition(!1,t),o=pl.normalizePositio
n(!1,a);return i?Ka.nextPosition(u,o).map(function(e){return e.isEqual(r)&&a.isEqual(n)}).getOr(!1):Ka.prevPosition(u,o).map(function(e){return e.isEqual(n)&&a.isEqual(r)}).getOr(!1)}).getOr(!0)},yl=function(e,t,n){return el.ancestor(e,function(e){return Br.is(e,t)},n)},bl=yl,Cl=function(e,t){return Br.one(t,e)},xl=function(e,t,n){return Gc(Br.is,yl,e,t,n)},wl=function(e,t,n){return bl(e,t,n).isSome()},Nl=function(e,t){return Ao.isText(t)&&/^[ \t\r\n]*$/.test(t.data)&&!1===(n=e,r=t,o=qn.fromDom(n),i=qn.fromDom(r),wl(i,"pre,code",V.curry(Or.eq,o)));var n,r,o,i},El=function(e,t){return Wi(t)&&!1===Nl(e,t)||(n=t,Ao.isElement(n)&&"A"===n.nodeName&&n.hasAttribute("name"))||Sl(t);var n},Sl=Ao.hasAttribute("data-mce-bookmark"),kl=Ao.hasAttribute("data-mce-bogus"),Tl=Ao.hasAttributeValue("data-mce-bogus","all"),Al=function(e){return function(e){var t,n,r=0;if(El(e,e)
)return!1;if(!(n=e.firstChild))return!0;t=new no(n,e);do{if(Tl(n))n=t.next(!0);else if(kl(n))n=t.next();else if(Ao.isBr(n))r++,n=t.next();else{if(El(e,n))return!1;n=t.next()}}while(n);return r<=1}(e.dom())},Rl=wr.immutable("block","position"),Bl=wr.immutable("from","to"),_l=function(e,t){var n=qn.fromDom(e),r=qn.fromDom(t.container());return gl(n,r).map(function(e){return Rl(e,t)})},Dl=function(o,i,e){var t=_l(o,Ba.fromRangeStart(e)),n=t.bind(function(e){return Ka.fromPosition(i,o,e.position()).bind(function(e){return _l(o,e).map(function(e){return t=o,n=i,r=e,Ao.isBr(r.position().getNode())&&!1===Al(r.block())?Ka.positionIn(!1,r.block().dom()).bind(function(e){return e.isEqual(r.position())?Ka.fromPosition(n,t,e).bind(function(e){return _l(t,e)}):A.some(r)}).getOr(r):r;var t,n,r})})});return sa([t,n],Bl).filter(function(e){return r=e,!1===Or.eq(r.from().block(),r.to().block())&&(n=e,qr.parent(n.from().block()).bind(function
(t){return qr.parent(n.to().block()).filter(function(e){return Or.eq(t,e)})}).isSome())&&(t=e,!1===Ao.isContentEditableFalse(t.from().block())&&!1===Ao.isContentEditableFalse(t.to().block()));var t,n,r})},Ol=function(e,t,n){return n.collapsed?Dl(e,t,n):A.none()},Pl=function(e,t,n){return Or.contains(t,e)?qr.parents(e,function(e){return n(e)||Or.eq(e,t)}).slice(0,-1):[]},Ll=function(e,t){return Pl(e,t,V.constant(!1))},Il=Ll,Ml=function(e,t){return[e].concat(Ll(e,t))},Fl=function(e){var t,n,r=(t=e,n=qr.children(t),H.findIndex(n,so).fold(function(){return n},function(e){return n.slice(0,e)}));return H.each(r,function(e){Ic.remove(e)}),r},zl=function(e,t){Ka.positionIn(e,t.dom()).each(function(e){var t=e.getNode();Ao.isBr(t)&&Ic.remove(qn.fromDom(t))})},Ul=function(e,t){var n=Ml(t,e);return H.find(n.reverse(),Al).each(Ic.remove)},ql=function(o,i){return Or.contains(i,o)?qr.parent(o).bind(function(e){return Or.eq(e,i)?A.some(o):(t=i,n=o,r=qr.parents(n,function(e){
return Or.eq(e,t)}),A.from(r[r.length-2]));var t,n,r}):A.none()},Vl=function(n,r,o){if(Al(o))return Ic.remove(o),Al(r)&&Uc(r),Ka.firstPositionIn(r.dom());zl(!0,r),zl(!1,o);var i=Fl(r);return ql(r,o).fold(function(){Ul(n,r);var e=Ka.lastPositionIn(o.dom());return H.each(i,function(e){Fu.append(o,e)}),e},function(t){var e=Ka.prevPosition(o.dom(),Ba.before(t.dom()));return H.each(i,function(e){Fu.before(t,e)}),Ul(n,r),e})},Hl=function(e,t,n,r){return t?Vl(e,r,n):Vl(e,n,r)},jl=function(t,n){var e,r=qn.fromDom(t.getBody());return(e=Ol(r.dom(),n,t.selection.getRng()).bind(function(e){return Hl(r,n,e.from().block(),e.to().block())})).each(function(e){t.selection.setRng(e.toRange())}),e.isSome()},$l=function(e,t){var n=qn.fromDom(t),r=V.curry(Or.eq,e);return el.ancestor(n,vo,r).isSome()},Wl=function(e,t){var n,r,o=Ka.prevPosition(e.dom(),Ba.fromRangeStart(t)).isNone(),i=Ka.nextPosition(e.dom(),Ba.fromRangeEnd(t)).isNone();return!($l(n=e,(r=t).startContainer)||$l(n,r.endContainer))&a
mp;&o&&i},Kl=function(e){var n,r,o,t,i=qn.fromDom(e.getBody()),a=e.selection.getRng();return Wl(i,a)?((t=e).setContent(""),t.selection.setCursorLocation(),!0):(n=i,r=e.selection,o=r.getRng(),sa([gl(n,qn.fromDom(o.startContainer)),gl(n,qn.fromDom(o.endContainer))],function(e,t){return!1===Or.eq(e,t)&&(o.deleteContents(),Hl(n,!0,e,t).each(function(e){r.setRng(e.toRange())}),!0)}).getOr(!1))},Xl=function(e,t){return!e.selection.isCollapsed()&&Kl(e)},Yl=function(a){if(!E.isArray(a))throw new Error("cases must be an array");if(0===a.length)throw new Error("there must be at least one case");var u=[],n={};return H.each(a,function(e,r){var t=or.keys(e);if(1!==t.length)throw new Error("one and only one name per case");var o=t[0],i=e[o];if(n[o]!==undefined)throw new Error("duplicate key detected:"+o);if("cata"===o)throw new Error("cannot have a case named cata (sorry)");if(!E.isArray(i))throw new
Error("case arguments must be an array");u.push(o),n[o]=function(){var e=arguments.length;if(e!==i.length)throw new Error("Wrong number of arguments to case "+o+". Expected "+i.length+" ("+i+"), got "+e);for(var n=new Array(e),t=0;t<n.length;t++)n[t]=arguments[t];return{fold:function(){if(arguments.length!==a.length)throw new Error("Wrong number of arguments to fold. Expected "+a.length+", got "+arguments.length);return arguments[r].apply(null,n)},match:function(e){var t=or.keys(e);if(u.length!==t.length)throw new Error("Wrong number of arguments to match. Expected: "+u.join(",")+"\nActual: "+t.join(","));if(!H.forall(u,function(e){return H.contains(t,e)}))throw new Error("Not all branches were specified when using match. Specified: "+t.join(", ")+"\nRequired: "+u.join(", "));return e[o].apply(null,n)},log:function(e){console.log(e
,{constructors:u,constructor:o,params:n})}}}}),n},Gl=Yl([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),Jl=function(e,t,n,r){var o=r.getNode(!1===t);return gl(qn.fromDom(e),qn.fromDom(n.getNode())).map(function(e){return Al(e)?Gl.remove(e.dom()):Gl.moveToElement(o)}).orThunk(function(){return A.some(Gl.moveToElement(o))})},Ql=function(u,s,c){return Ka.fromPosition(s,u,c).bind(function(e){return a=e.getNode(),vo(qn.fromDom(a))||po(qn.fromDom(a))?A.none():(t=u,o=e,i=function(e){return co(qn.fromDom(e))&&!ps(r,o,t)},Ns(!(n=s),r=c).fold(function(){return Ns(n,o).fold(V.constant(!1),i)},i)?A.none():s&&Ao.isContentEditableFalse(e.getNode())?Jl(u,s,c,e):!1===s&&Ao.isContentEditableFalse(e.getNode(!0))?Jl(u,s,c,e):s&&ks(c)?A.some(Gl.moveToPosition(e)):!1===s&&Ss(c)?A.some(Gl.moveToPosition(e)):A.none());var t,n,r,o,i,a})},Zl=function(r,e,o){return i=e,a=o.getNode(!1===i),u=i?"after&q
uot;:"before",Ao.isElement(a)&&a.getAttribute("data-mce-caret")===u?(t=e,n=o.getNode(!1===e),t&&Ao.isContentEditableFalse(n.nextSibling)?A.some(Gl.moveToElement(n.nextSibling)):!1===t&&Ao.isContentEditableFalse(n.previousSibling)?A.some(Gl.moveToElement(n.previousSibling)):A.none()).fold(function(){return Ql(r,e,o)},A.some):Ql(r,e,o).bind(function(e){return t=r,n=o,e.fold(function(e){return A.some(Gl.remove(e))},function(e){return A.some(Gl.moveToElement(e))},function(e){return ps(n,e,t)?A.none():A.some(Gl.moveToPosition(e))});var t,n});var t,n,i,a,u},ef=function(e,t){return r=e,o=(n=t).container(),i=n.offset(),!1===Ba.isTextPosition(n)&&o===r.parentNode&&i>Ba.before(r).offset()?Ba(t.container(),t.offset()-1):t;var n,r,o,i},tf=function(e){return Wi(e.previousSibling)?A.some((t=e.previousSibling,Ao.isText(t)?Ba(t,t.data.length):Ba.after(t))):e.previousSibling?Ka.lastPositionIn(e.previousSibling):A.none();var t},nf=functio
n(e){return Wi(e.nextSibling)?A.some((t=e.nextSibling,Ao.isText(t)?Ba(t,0):Ba.before(t))):e.nextSibling?Ka.firstPositionIn(e.nextSibling):A.none();var t},rf=function(r,o){return tf(o).orThunk(function(){return nf(o)}).orThunk(function(){return e=r,t=o,n=Ba.before(t.previousSibling?t.previousSibling:t.parentNode),Ka.prevPosition(e,n).fold(function(){return Ka.nextPosition(e,Ba.after(t))},A.some);var e,t,n})},of=function(n,r){return nf(r).orThunk(function(){return tf(r)}).orThunk(function(){return e=n,t=r,Ka.nextPosition(e,Ba.after(t)).fold(function(){return Ka.prevPosition(e,Ba.before(t))},A.some);var e,t})},af=function(e,t,n){return(r=e,o=t,i=n,r?of(o,i):rf(o,i)).map(V.curry(ef,n));var r,o,i},uf=function(t,n,e){e.fold(function(){t.focus()},function(e){t.selection.setRng(e.toRange(),n)})},sf=function(e,t){return t&&e.schema.getBlockElements().hasOwnProperty(Qn.name(t))},cf=function(e){if(Al(e)){var t=qn.fromHtml('<br data-mce-bogus="1">');return Ic.empty(e),Fu
.append(e,t),A.some(Ba.before(t.dom()))}return A.none()},lf=function(t,n,e){var r,a,o,i=af(n,t.getBody(),e.dom()),u=el.ancestor(e,V.curry(sf,t),(r=t.getBody(),function(e){return e.dom()===r})),s=(a=e,o=i,sa([qr.prevSibling(a),qr.nextSibling(a),o],function(e,t,n){var r,o=e.dom(),i=t.dom();return Ao.isText(o)&&Ao.isText(i)?(r=o.data.length,o.appendData(i.data),Ic.remove(t),Ic.remove(a),n.container()===i?Ba(o,r):n):(Ic.remove(a),n)}).orThunk(function(){return Ic.remove(a),o}));t.dom.isEmpty(t.getBody())?(t.setContent(""),t.selection.setCursorLocation()):u.bind(cf).fold(function(){uf(t,n,s)},function(e){uf(t,n,A.some(e))})},ff=function(a,u){var e,t,n,r,o;return(e=a.getBody(),t=u,n=a.selection.getRng(),r=Cs(t?1:-1,e,n),o=Ba.fromRangeStart(r),!1===t&&ks(o)?A.some(Gl.remove(o.getNode(!0))):t&&Ss(o)?A.some(Gl.remove(o.getNode())):Zl(e,t,o)).map(function(e){return e.fold((o=a,i=u,function(e){return o._selectionOverrides.hideFakeCaret(),lf(o,i,qn.fromDom(e)),
!0}),(n=a,r=u,function(e){var t=r?Ba.before(e):Ba.after(e);return n.selection.setRng(t.toRange()),!0}),(t=a,function(e){return t.selection.setRng(e.toRange()),!0}));var t,n,r,o,i}).getOr(!1)},df=function(e,t){var n,r=e.selection.getNode();return!!Ao.isContentEditableFalse(r)&&(n=qn.fromDom(e.getBody()),H.each(fu(n,".mce-offscreen-selection"),Ic.remove),lf(e,t,qn.fromDom(e.selection.getNode())),hl(e),!0)},mf=function(e,t){return e.selection.isCollapsed()?ff(e,t):df(e,t)},pf=function(e){var t,n=function(e,t){for(;t&&t!==e;){if(Ao.isContentEditableTrue(t)||Ao.isContentEditableFalse(t))return t;t=t.parentNode}return null}(e.getBody(),e.selection.getNode());return Ao.isContentEditableTrue(n)&&e.dom.isBlock(n)&&e.dom.isEmpty(n)&&(t=e.dom.create("br",{"data-mce-bogus":"1"}),e.dom.setHTML(n,""),n.appendChild(t),e.selection.setRng(Ba.before(t).toRange())),!0},gf=Ao.isText,hf=function(e){return gf(e)&
;&e.data[0]===Ei},vf=function(e){return gf(e)&&e.data[e.data.length-1]===Ei},yf=function(e){return e.ownerDocument.createTextNode(Ei)},bf=function(e,t){return e?function(e){if(gf(e.previousSibling))return vf(e.previousSibling)||e.previousSibling.appendData(Ei),e.previousSibling;if(gf(e))return hf(e)||e.insertData(0,Ei),e;var t=yf(e);return e.parentNode.insertBefore(t,e),t}(t):function(e){if(gf(e.nextSibling))return hf(e.nextSibling)||e.nextSibling.insertData(0,Ei),e.nextSibling;if(gf(e))return vf(e)||e.appendData(Ei),e;var t=yf(e);return e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t}(t)},Cf=V.curry(bf,!0),xf=V.curry(bf,!1),wf=function(e,t){return Ao.isText(e.container())?bf(t,e.container()):bf(t,e.getNode())},Nf=function(e,t){var n=t.get();return n&&e.container()===n&&Ri(n)},Ef=function(n,e){return e.fold(function(e){Ua.remove(n.get());var t=Cf(e);return n.set(t),A.some(Ba(t,t.length-1))},function(e){return Ka.firs
tPositionIn(e).map(function(e){if(Nf(e,n))return Ba(n.get(),1);Ua.remove(n.get());var t=wf(e,!0);return n.set(t),Ba(t,1)})},function(e){return Ka.lastPositionIn(e).map(function(e){if(Nf(e,n))return Ba(n.get(),n.get().length-1);Ua.remove(n.get());var t=wf(e,!1);return n.set(t),Ba(t,t.length-1)})},function(e){Ua.remove(n.get());var t=xf(e);return n.set(t),A.some(Ba(t,1))})},Sf=function(e,t){for(var n=0;n<e.length;n++){var r=e[n].apply(null,t);if(r.isSome())return r}return A.none()},kf=Yl([{before:["element"]},{start:["element"]},{end:["element"]},{after:["element"]}]),Tf=function(e,t){var n=ms(t,e);return n||e},Af=function(e,t,n){var r=pl.normalizeForwards(n),o=Tf(t,r.container());return pl.findRootInline(e,o,r).fold(function(){return Ka.nextPosition(o,r).bind(V.curry(pl.findRootInline,e,o)).map(function(e){return kf.before(e)})},A.none)},Rf=function(e,t){return null===wc(e,t)},Bf=function(e,t,n){return pl.findRootInline(e,t,n).filter(V.curry
(Rf,t))},_f=function(e,t,n){var r=pl.normalizeBackwards(n);return Bf(e,t,r).bind(function(e){return Ka.prevPosition(e,r).isNone()?A.some(kf.start(e)):A.none()})},Df=function(e,t,n){var r=pl.normalizeForwards(n);return Bf(e,t,r).bind(function(e){return Ka.nextPosition(e,r).isNone()?A.some(kf.end(e)):A.none()})},Of=function(e,t,n){var r=pl.normalizeBackwards(n),o=Tf(t,r.container());return pl.findRootInline(e,o,r).fold(function(){return Ka.prevPosition(o,r).bind(V.curry(pl.findRootInline,e,o)).map(function(e){return kf.after(e)})},A.none)},Pf=function(e){return!1===pl.isRtl(If(e))},Lf=function(e,t,n){return Sf([Af,_f,Df,Of],[e,t,n]).filter(Pf)},If=function(e){return e.fold(V.identity,V.identity,V.identity,V.identity)},Mf=function(e){return e.fold(V.constant("before"),V.constant("start"),V.constant("end"),V.constant("after"))},Ff=function(e){return e.fold(kf.before,kf.before,kf.after,kf.after)},zf=function(n,e,r,t,o,i){return sa([pl.findRootInlin
e(e,r,t),pl.findRootInline(e,r,o)],function(e,t){return e!==t&&pl.hasSameParentBlock(r,e,t)?kf.after(n?e:t):i}).getOr(i)},Uf=function(e,r){return e.fold(V.constant(!0),function(e){return n=r,!(Mf(t=e)===Mf(n)&&If(t)===If(n));var t,n})},qf=function(e,t){return e?t.fold(V.compose(A.some,kf.start),A.none,V.compose(A.some,kf.after),A.none):t.fold(A.none,V.compose(A.some,kf.before),A.none,V.compose(A.some,kf.end))},Vf=function(a,u,s,c){var e=pl.normalizePosition(a,c),l=Lf(u,s,e);return Lf(u,s,e).bind(V.curry(qf,a)).orThunk(function(){return t=a,n=u,r=s,o=l,e=c,i=pl.normalizePosition(t,e),Ka.fromPosition(t,r,i).map(V.curry(pl.normalizePosition,t)).fold(function(){return o.map(Ff)},function(e){return Lf(n,r,e).map(V.curry(zf,t,n,r,i,e)).filter(V.curry(Uf,o))}).filter(Pf);var t,n,r,o,e,i})},Hf=Lf,jf=Vf,$f=(V.curry(Vf,!1),V.curry(Vf,!0),Ff),Wf=function(e){return e.fold(kf.start,kf.start,kf.end,kf.end)},Kf=function(e){return E.isFunction(e.selection.getSel().modify)},Xf=functi
on(e,t,n){var r=e?1:-1;return t.setRng(Ba(n.container(),n.offset()+r).toRange()),t.getSel().modify("move",e?"forward":"backward","word"),!0},Yf=function(e,t){var n=t.selection.getRng(),r=e?Ba.fromRangeEnd(n):Ba.fromRangeStart(n);return!!Kf(t)&&(e&&Di(r)?Xf(!0,t.selection,r):!(e||!Oi(r))&&Xf(!1,t.selection,r))},Gf=function(e,t){var n=e.dom.createRng();n.setStart(t.container(),t.offset()),n.setEnd(t.container(),t.offset()),e.selection.setRng(n)},Jf=function(e){return!1!==e.settings.inline_boundaries},Qf=function(e,t){e?t.setAttribute("data-mce-selected","inline-boundary"):t.removeAttribute("data-mce-selected")},Zf=function(t,e,n){return Ef(e,n).map(function(e){return Gf(t,e),n})},ed=function(e,t,n){return function(){return!!Jf(t)&&Yf(e,t)}},td={move:function(a,u,s){return function(){return!!Jf(a)&&(t=a,n=u,e=s,r=t.getBody(),o=Ba.fromRangeStart(t.selection.getRng()),i=V.curry(p
l.isInlineTarget,t),jf(e,i,r,o).bind(function(e){return Zf(t,n,e)})).isSome();var t,n,e,r,o,i}},moveNextWord:V.curry(ed,!0),movePrevWord:V.curry(ed,!1),setupSelectedState:function(a){var u=Ju(null),s=V.curry(pl.isInlineTarget,a);return a.on("NodeChange",function(e){var t,n,r,o,i;Jf(a)&&(t=s,n=a.dom,r=e.parents,o=H.filter(n.select('*[data-mce-selected="inline-boundary"]'),t),i=H.filter(r,t),H.each(H.difference(o,i),V.curry(Qf,!1)),H.each(H.difference(i,o),V.curry(Qf,!0)),function(e,t){if(e.selection.isCollapsed()&&!0!==e.composing&&t.get()){var n=Ba.fromRangeStart(e.selection.getRng());Ba.isTextPosition(n)&&!1===pl.isAtZwsp(n)&&(Gf(e,Ua.removeAndReposition(t.get(),n)),t.set(null))}}(a,u),function(n,r,o,e){if(r.selection.isCollapsed()){var t=H.filter(e,n);H.each(t,function(e){var t=Ba.fromRangeStart(r.selection.getRng());Hf(n,r.getBody(),t).bind(function(e){return Zf(r,o,e)})})}}(s,a,u,e.parents))}),u},setCaretPosition:Gf},nd
=function(t,n){return function(e){return Ef(n,e).map(function(e){return td.setCaretPosition(t,e),!0}).getOr(!1)}},rd=function(r,o,i,a){var u=r.getBody(),s=V.curry(pl.isInlineTarget,r);r.undoManager.ignore(function(){var e,t,n;r.selection.setRng((e=i,t=a,(n=document.createRange()).setStart(e.container(),e.offset()),n.setEnd(t.container(),t.offset()),n)),r.execCommand("Delete"),Hf(s,u,Ba.fromRangeStart(r.selection.getRng())).map(Wf).map(nd(r,o))}),r.nodeChanged()},od=function(n,r,i,o){var e,t,a=(e=n.getBody(),t=o.container(),ms(t,e)||e),u=V.curry(pl.isInlineTarget,n),s=Hf(u,a,o);return s.bind(function(e){return i?e.fold(V.constant(A.some(Wf(e))),A.none,V.constant(A.some($f(e))),A.none):e.fold(A.none,V.constant(A.some($f(e))),A.none,V.constant(A.some(Wf(e))))}).map(nd(n,r)).getOrThunk(function(){var t=Ka.navigate(i,a,o),e=t.bind(function(e){return Hf(u,a,e)});return s.isSome()&&e.isSome()?pl.findRootInline(u,a,o).map(function(e){return o=e,!!sa([Ka.firstPositionIn(o),
Ka.lastPositionIn(o)],function(e,t){var n=pl.normalizePosition(!0,e),r=pl.normalizePosition(!1,t);return Ka.nextPosition(o,n).map(function(e){return e.isEqual(r)}).getOr(!0)}).getOr(!0)&&(lf(n,i,qn.fromDom(e)),!0);var o}).getOr(!1):e.bind(function(e){return t.map(function(e){return i?rd(n,r,o,e):rd(n,r,e,o),!0})}).getOr(!1)})},id=function(e,t,n){if(e.selection.isCollapsed()&&!1!==e.settings.inline_boundaries){var r=Ba.fromRangeStart(e.selection.getRng());return od(e,t,n,r)}return!1},ad=wr.immutable("start","end"),ud=wr.immutable("rng","table","cells"),sd=Yl([{removeTable:["element"]},{emptyCells:["cells"]}]),cd=function(e,t){return xl(qn.fromDom(e),"td,th",t)},ld=function(e,t){return bl(e,"table",t)},fd=function(e){return!1===Or.eq(e.start(),e.end())},dd=function(e,n){return ld(e.start(),n).bind(function(t){return ld(e.end(),n).bind(function(e){return Or.eq(t,e)?A.some(t):A.none
()})})},md=function(e){return fu(e,"td,th")},pd=function(r,e){var t=cd(e.startContainer,r),n=cd(e.endContainer,r);return e.collapsed?A.none():sa([t,n],ad).fold(function(){return t.fold(function(){return n.bind(function(t){return ld(t,r).bind(function(e){return H.head(md(e)).map(function(e){return ad(e,t)})})})},function(t){return ld(t,r).bind(function(e){return H.last(md(e)).map(function(e){return ad(t,e)})})})},function(e){return gd(r,e)?A.none():(n=r,ld((t=e).start(),n).bind(function(e){return H.last(md(e)).map(function(e){return ad(t.start(),e)})}));var t,n})},gd=function(e,t){return dd(t,e).isSome()},hd=function(e,t){var n,r,o,i,a,u=(n=e,V.curry(Or.eq,n));return(r=t,o=u,i=cd(r.startContainer,o),a=cd(r.endContainer,o),sa([i,a],ad).filter(fd).filter(function(e){return gd(o,e)}).orThunk(function(){return pd(o,r)})).bind(function(e){return dd(t=e,u).map(function(e){return ud(t,e,md(e))});var t})},vd=function(e,t){return H.findIndex(e,function(e){return Or.eq(e,t)})},yd=fun
ction(n){return(r=n,sa([vd(r.cells(),r.rng().start()),vd(r.cells(),r.rng().end())],function(e,t){return r.cells().slice(e,t+1)})).map(function(e){var t=n.cells();return e.length===t.length?sd.removeTable(n.table()):sd.emptyCells(e)});var r},bd=function(e,t){return hd(e,t).bind(yd)},Cd=function(e){var t=[];if(e)for(var n=0;n<e.rangeCount;n++)t.push(e.getRangeAt(n));return t},xd=Cd,wd=function(e){return H.bind(e,function(e){var t=ta(e);return t?[qn.fromDom(t)]:[]})},Nd=function(e){return 1<Cd(e).length},Ed=function(e){return H.filter(wd(e),vo)},Sd=function(e){return fu(e,"td[data-mce-selected],th[data-mce-selected]")},kd=function(e,t){var n=Sd(t),r=Ed(e);return 0<n.length?n:r},Td=kd,Ad=function(e){return kd(xd(e.selection.getSel()),qn.fromDom(e.getBody()))},Rd=function(e,t){return H.each(t,Uc),e.selection.setCursorLocation(t[0].dom(),0),!0},Bd=function(e,t){return lf(e,!1,t),!0},_d=function(n,e,r,t){return Od(e,t).fold(function(){return t=n,bd(e,r).map(function(e){r
eturn e.fold(V.curry(Bd,t),V.curry(Rd,t))});var t},function(e){return Pd(n,e)}).getOr(!1)},Dd=function(e,t){return H.find(Ml(t,e),vo)},Od=function(e,t){return H.find(Ml(t,e),function(e){return"caption"===Qn.name(e)})},Pd=function(e,t){return Uc(t),e.selection.setCursorLocation(t.dom(),0),A.some(!0)},Ld=function(u,s,c,l,f){return Ka.navigate(c,u.getBody(),f).bind(function(e){return r=l,o=c,i=f,a=e,Ka.firstPositionIn(r.dom()).bind(function(t){return Ka.lastPositionIn(r.dom()).map(function(e){return o?i.isEqual(t)&&a.isEqual(e):i.isEqual(e)&&a.isEqual(t)})}).getOr(!0)?Pd(u,l):(t=l,n=e,Od(s,qn.fromDom(n.getNode())).map(function(e){return!1===Or.eq(e,t)}));var t,n,r,o,i,a}).or(A.some(!0))},Id=function(a,u,s,e){var c=Ba.fromRangeStart(a.selection.getRng());return Dd(s,e).bind(function(e){return Al(e)?Pd(a,e):(t=a,n=s,r=u,o=e,i=c,Ka.navigate(r,t.getBody(),i).bind(function(e){return Dd(n,qn.fromDom(e.getNode())).map(function(e){return!1===Or.eq(e,o)})}));var t,n,r,
o,i})},Md=function(a,u,e){var s=qn.fromDom(a.getBody());return Od(s,e).fold(function(){return Id(a,u,s,e)},function(e){return t=a,n=u,r=s,o=e,i=Ba.fromRangeStart(t.selection.getRng()),Al(o)?Pd(t,o):Ld(t,r,n,o,i);var t,n,r,o,i}).getOr(!1)},Fd=function(e,t){var n,r,o,i,a,u=qn.fromDom(e.selection.getStart(!0)),s=Ad(e);return e.selection.isCollapsed()&&0===s.length?Md(e,t,u):(n=e,r=u,o=qn.fromDom(n.getBody()),i=n.selection.getRng(),0!==(a=Ad(n)).length?Rd(n,a):_d(n,o,i,r))},zd=function(e,t){e.getDoc().execCommand(t,!1,null)},Ud={deleteCommand:function(e){mf(e,!1)||id(e,!1)||jl(e,!1)||Fd(e)||Xl(e,!1)||(zd(e,"Delete"),hl(e))},forwardDeleteCommand:function(e){mf(e,!0)||id(e,!0)||jl(e,!0)||Fd(e)||Xl(e,!0)||zd(e,"ForwardDelete")}},qd=function(s){return function(u,e){return A.from(e).map(qn.fromDom).filter(Qn.isElement).bind(function(e){return(r=s,o=u,i=e.dom(),a=function(e){return br(e,r)},el.closest(qn.fromDom(i),function(e){return a(e).isSome()},function(e){retu
rn Or.eq(qn.fromDom(o),e)}).bind(a)).or((t=s,n=e.dom(),A.from(di.DOM.getStyle(n,t,!0))));var t,n,r,o,i,a}).getOr("")}},Vd={getFontSize:qd("font-size"),getFontFamily:V.compose(function(e){return e.replace(/[\'\"\\]/g,"").replace(/,\s+/g,",")},qd("font-family")),toPt:function(e,t){return/[0-9.]+px$/.test(e)?(n=72*parseInt(e,10)/96,r=t||0,o=Math.pow(10,r),Math.round(n*o)/o+"pt"):e;var n,r,o}},Hd=function(e){return Ka.firstPositionIn(e.getBody()).map(function(e){var t=e.container();return Ao.isText(t)?t.parentNode:t})},jd=function(o){return A.from(o.selection.getRng()).bind(function(e){var t,n,r=o.getBody();return n=r,(t=e).startContainer===n&&0===t.startOffset?A.none():A.from(o.selection.getStart(!0))})},$d=function(e,t){var n=parseInt(t,10);if(1<=n&&n<=7){var r=Pu(e),o=Lu(e);return o?o[n-1]||t:r[n-1]||t}return t},Wd=function(e,t){e.formatter.toggle("fontname",{value:$d(e,t)}),e.nodeChanged
()},Kd=function(t){return jd(t).fold(function(){return Hd(t).map(function(e){return Vd.getFontFamily(t.getBody(),e)}).getOr("")},function(e){return Vd.getFontFamily(t.getBody(),e)})},Xd=function(e,t){e.formatter.toggle("fontsize",{value:$d(e,t)}),e.nodeChanged()},Yd=function(t){return jd(t).fold(function(){return Hd(t).map(function(e){return Vd.getFontSize(t.getBody(),e)}).getOr("")},function(e){return Vd.getFontSize(t.getBody(),e)})},Gd={isEq:function(e,t){return e&&t&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}},Jd=function(e,t,n){return null!==function(e,t,n){for(;e&&e!==t;){if(n(e))return e;e=e.parentNode}return null}(e,t,n)},Qd=function(e,t,n){return Jd(e,t,function(e){return e.nodeName===n})},Zd=function(e){return e&&"TABLE"===e.nodeName},em=function(e,t,n){for(var r=new no(t,e.getParent(t.parentNode
,e.isBlock)||e.getRoot());t=r[n?"prev":"next"]();)if(Ao.isBr(t))return!0},tm=function(e,t,n,r,o){var i,a,u,s,c,l,f=e.getRoot(),d=e.schema.getNonEmptyElements();if(u=e.getParent(o.parentNode,e.isBlock)||f,r&&Ao.isBr(o)&&t&&e.isEmpty(u))return A.some(Ta(o.parentNode,e.nodeIndex(o)));for(i=new no(o,u);s=i[r?"prev":"next"]();){if("false"===e.getContentEditableParent(s)||(l=f,Bi(c=s)&&!1===Jd(c,l,xc)))return A.none();if(Ao.isText(s)&&0<s.nodeValue.length)return!1===Qd(s,f,"A")?A.some(Ta(s,r?s.nodeValue.length:0)):A.none();if(e.isBlock(s)||d[s.nodeName.toLowerCase()])return A.none();a=s}return n&&a?A.some(Ta(a,0)):A.none()},nm=function(e,t,n,r){var o,i,a,u,s,c,l,f,d,m,p=e.getRoot(),g=!1;if(o=r[(n?"start":"end")+"Container"],i=r[(n?"start":"end")+"Offset"],l=Ao.isElement(o)&&i===o.childNodes.length,s=e.schema.getN
onEmptyElements(),c=n,Bi(o))return A.none();if(Ao.isElement(o)&&i>o.childNodes.length-1&&(c=!1),Ao.isDocument(o)&&(o=p,i=0),o===p){if(c&&(u=o.childNodes[0<i?i-1:0])){if(Bi(u))return A.none();if(s[u.nodeName]||Zd(u))return A.none()}if(o.hasChildNodes()){if(i=Math.min(!c&&0<i?i-1:i,o.childNodes.length-1),o=o.childNodes[i],i=Ao.isText(o)&&l?o.data.length:0,!t&&o===p.lastChild&&Zd(o))return A.none();if(function(e,t){for(;t&&t!==e;){if(Ao.isContentEditableFalse(t))return!0;t=t.parentNode}return!1}(p,o)||Bi(o))return A.none();if(o.hasChildNodes()&&!1===Zd(o)){a=new no(u=o,p);do{if(Ao.isContentEditableFalse(u)||Bi(u)){g=!1;break}if(Ao.isText(u)&&0<u.nodeValue.length){i=c?0:u.nodeValue.length,o=u,g=!0;break}if(s[u.nodeName.toLowerCase()]&&(!(f=u)||!/^(TD|TH|CAPTION)$/.test(f.nodeName))){i=e.nodeIndex(u),o=u.parentNode,c||i++,g=!0;break}}while(u=c?a.next():a.prev())}}}return t&&
;(Ao.isText(o)&&0===i&&tm(e,l,t,!0,o).each(function(e){o=e.container(),i=e.offset(),g=!0}),Ao.isElement(o)&&((u=o.childNodes[i])||(u=o.childNodes[i-1]),!u||!Ao.isBr(u)||(m="A",(d=u).previousSibling&&d.previousSibling.nodeName===m)||em(e,u,!1)||em(e,u,!0)||tm(e,l,t,!0,u).each(function(e){o=e.container(),i=e.offset(),g=!0}))),c&&!t&&Ao.isText(o)&&i===o.nodeValue.length&&tm(e,l,t,!1,o).each(function(e){o=e.container(),i=e.offset(),g=!0}),g?A.some(Ta(o,i)):A.none()},rm={normalize:function(e,t){var n=t.collapsed,r=t.cloneRange(),o=Ta.fromRangeStart(t);return nm(e,n,!0,r).each(function(e){n&&Ta.isAbove(o,e)||r.setStart(e.container(),e.offset())}),n||nm(e,n,!1,r).each(function(e){r.setEnd(e.container(),e.offset())}),n&&r.collapse(!0),Gd.isEq(t,r)?A.none():A.some(r)}},om=function(e,t,n){var r=e.create("span",{}," ");n.parentNode.insertBefore(r,n),t.scrollIntoView(r),e.remov
e(r)},im=function(e,t,n,r){var o=e.createRng();r?(o.setStartBefore(n),o.setEndBefore(n)):(o.setStartAfter(n),o.setEndAfter(n)),t.setRng(o)},am=function(e,t){var n,r,o=e.selection,i=e.dom,a=o.getRng();rm.normalize(i,a).each(function(e){a.setStart(e.startContainer,e.startOffset),a.setEnd(e.endContainer,e.endOffset)});var u=a.startOffset,s=a.startContainer;if(1===s.nodeType&&s.hasChildNodes()){var c=u>s.childNodes.length-1;s=s.childNodes[Math.min(u,s.childNodes.length-1)]||s,u=c&&3===s.nodeType?s.nodeValue.length:0}var l=i.getParent(s,i.isBlock),f=l?i.getParent(l.parentNode,i.isBlock):null,d=f?f.nodeName.toUpperCase():"",m=t&&t.ctrlKey;"LI"!==d||m||(l=f),s&&3===s.nodeType&&u>=s.nodeValue.length&&(function(e,t,n){for(var r,o=new no(t,n),i=e.getNonEmptyElements();r=o.next();)if(i[r.nodeName.toLowerCase()]||0<r.length)return!0}(e.schema,s,l)||(n=i.create("br"),a.insertNode(n),a.setStartAfter(n),a.setEnd
After(n),r=!0)),n=i.create("br"),a.insertNode(n),om(i,o,n),im(i,o,n,r),e.undoManager.add()},um=function(e,t){var n=qn.fromTag("br");Fu.before(qn.fromDom(t),n),e.undoManager.add()},sm=function(e,t){cm(e.getBody(),t)||Fu.after(qn.fromDom(t),qn.fromTag("br"));var n=qn.fromTag("br");Fu.after(qn.fromDom(t),n),om(e.dom,e.selection,n.dom()),im(e.dom,e.selection,n.dom(),!1),e.undoManager.add()},cm=function(e,t){return n=Ba.after(t),!!Ao.isBr(n.getNode())||Ka.nextPosition(e,Ba.after(t)).map(function(e){return Ao.isBr(e.getNode())}).getOr(!1);var n},lm=function(e){return e&&"A"===e.nodeName&&"href"in e},fm=function(e){return e.fold(V.constant(!1),lm,lm,V.constant(!1))},dm=function(e,t){t.fold(V.noop,V.curry(um,e),V.curry(sm,e),V.noop)},mm={insert:function(e,t){var n,r,o,i=(n=e,r=V.curry(pl.isInlineTarget,n),o=Ba.fromRangeStart(n.selection.getRng()),Hf(r,n.getBody(),o).filter(fm));i.isSome()?i.each(V.curry(dm,e)):am(e,
t)}},pm=Yl([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),gm=(pm.before,pm.on,pm.after,function(e){return e.fold(V.identity,V.identity,V.identity)}),hm=Yl([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),vm=wr.immutable("start","soffset","finish","foffset"),ym={domRange:hm.domRange,relative:hm.relative,exact:hm.exact,exactFromRange:function(e){return hm.exact(e.start(),e.soffset(),e.finish(),e.foffset())},range:vm,getWin:function(e){var t=e.match({domRange:function(e){return qn.fromDom(e.startContainer)},relative:function(e,t){return gm(e)},exact:function(e,t,n,r){return e}});return qr.defaultView(t)}},bm=zn.detect().browser,Cm=function(e,t){var n=Qn.isText(t)?Fc(t).length:qr.children(t).length+1;return n<e?n:e<0?0:e},xm=function(e){return ym.range(e
.start(),Cm(e.soffset(),e.start()),e.finish(),Cm(e.foffset(),e.finish()))},wm=function(e,t){return Or.contains(e,t)||Or.eq(e,t)},Nm=function(t){return function(e){return wm(t,e.start())&&wm(t,e.finish())}},Em=function(e){return!0===e.inline||bm.isIE()},Sm=function(e){return ym.range(qn.fromDom(e.startContainer),e.startOffset,qn.fromDom(e.endContainer),e.endOffset)},km=function(e){var t=e.getSelection();return(t&&0!==t.rangeCount?A.from(t.getRangeAt(0)):A.none()).map(Sm)},Tm=function(e){var t=qr.defaultView(e);return km(t.dom()).filter(Nm(e))},Am=function(e,t){return A.from(t).filter(Nm(e)).map(xm)},Rm=function(e){var t=document.createRange();try{return t.setStart(e.start().dom(),e.soffset()),t.setEnd(e.finish().dom(),e.foffset()),A.some(t)}catch(n){return A.none()}},Bm=function(e){return(e.bookmark?e.bookmark:A.none()).bind(V.curry(Am,qn.fromDom(e.getBody()))).bind(Rm)},_m={store:function(e){var t=Em(e)?Tm(qn.fromDom(e.getBody())):A.none();e.bookmark=t.isSome()?t:e.b
ookmark},storeNative:function(e,t){var n=qn.fromDom(e.getBody()),r=(Em(e)?A.from(t):A.none()).map(Sm).filter(Nm(n));e.bookmark=r.isSome()?r:e.bookmark},readRange:km,restore:function(t){Bm(t).each(function(e){t.selection.setRng(e)})},getRng:Bm,getBookmark:Tm,validate:Am},Dm=function(e,t){var n=e.settings,r=e.dom,o=e.selection,i=e.formatter,a=/[a-z%]+$/i.exec(n.indentation)[0],u=parseInt(n.indentation,10),s=e.getParam("indent_use_margin",!1);e.queryCommandState("InsertUnorderedList")||e.queryCommandState("InsertOrderedList")||(n.forced_root_block||r.getParent(o.getNode(),r.isBlock)||i.apply("div"),H.each(o.getSelectedBlocks(),function(e){return function(e,t,n,r,o,i){if("false"!==e.getContentEditable(i)&&"LI"!==i.nodeName){var a=n?"margin":"padding";if(a="TABLE"===i.nodeName?"margin":a,a+="rtl"===e.getStyle(i,"direction",!0)?"Right":"Left",
"outdent"===t){var u=Math.max(0,parseInt(i.style[a]||0,10)-r);e.setStyle(i,a,u?u+o:"")}else u=parseInt(i.style[a]||0,10)+r+o,e.setStyle(i,a,u)}}(r,t,s,u,a,e)}))},Om=Lt.each,Pm=Lt.extend,Lm=Lt.map,Im=Lt.inArray;function Mm(s){var o,i,a,t,c={state:{},exec:{},value:{}},n=s.settings;s.on("PreInit",function(){o=s.dom,i=s.selection,n=s.settings,a=s.formatter});var r=function(e){var t;if(!s.quirks.isHidden()&&!s.removed){if(e=e.toLowerCase(),t=c.state[e])return t(e);try{return s.getDoc().queryCommandState(e)}catch(n){}return!1}},e=function(e,n){n=n||"exec",Om(e,function(t,e){Om(e.toLowerCase().split(","),function(e){c[n][e]=t})})},u=function(e,t,n){e=e.toLowerCase(),c.value[e]=function(){return t.call(n||s)}};Pm(this,{execCommand:function(t,n,r,e){var o,i,a=!1;if(!s.removed){if(/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(t)||e&&e.skip_focus?_m.restore(s):s.focus(),(e=s.fire("BeforeExecCommand
",{command:t,ui:n,value:r})).isDefaultPrevented())return!1;if(i=t.toLowerCase(),o=c.exec[i])return o(i,n,r),s.fire("ExecCommand",{command:t,ui:n,value:r}),!0;if(Om(s.plugins,function(e){if(e.execCommand&&e.execCommand(t,n,r))return s.fire("ExecCommand",{command:t,ui:n,value:r}),!(a=!0)}),a)return a;if(s.theme&&s.theme.execCommand&&s.theme.execCommand(t,n,r))return s.fire("ExecCommand",{command:t,ui:n,value:r}),!0;try{a=s.getDoc().execCommand(t,n,r)}catch(u){}return!!a&&(s.fire("ExecCommand",{command:t,ui:n,value:r}),!0)}},queryCommandState:r,queryCommandValue:function(e){var t;if(!s.quirks.isHidden()&&!s.removed){if(e=e.toLowerCase(),t=c.value[e])return t(e);try{return s.getDoc().queryCommandValue(e)}catch(n){}}},queryCommandSupported:function(e){if(e=e.toLowerCase(),c.exec[e])return!0;try{return s.getDoc().queryCommandSupported(e)}catch(t){}return!1},addCommands:e,addCommand:function(e,o,i){e=e.toL
owerCase(),c.exec[e]=function(e,t,n,r){return o.call(i||s,t,n,r)}},addQueryStateHandler:function(e,t,n){e=e.toLowerCase(),c.state[e]=function(){return t.call(n||s)}},addQueryValueHandler:u,hasCustomCommand:function(e){return e=e.toLowerCase(),!!c.exec[e]}});var l=function(e,t,n){return t===undefined&&(t=!1),n===undefined&&(n=null),s.getDoc().execCommand(e,t,n)},f=function(e){return a.match(e)},d=function(e,t){a.toggle(e,t?{value:t}:undefined),s.nodeChanged()},m=function(e){t=i.getBookmark(e)},p=function(){i.moveToBookmark(t)};e({"mceResetDesignMode,mceBeginUndoLevel":function(){},"mceEndUndoLevel,mceAddUndoLevel":function(){s.undoManager.add()},"Cut,Copy,Paste":function(e){var t,n=s.getDoc();try{l(e)}catch(o){t=!0}if("paste"!==e||n.queryCommandEnabled(e)||(t=!0),t||!n.queryCommandSupported(e)){var r=s.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instea
d.");ge.mac&&(r=r.replace(/Ctrl\+/g,"\u2318+")),s.notificationManager.open({text:r,type:"error"})}},unlink:function(){if(i.isCollapsed()){var e=s.dom.getParent(s.selection.getStart(),"a");e&&s.dom.remove(e,!0)}else a.remove("link")},"JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone":function(e){var t=e.substring(7);"full"===t&&(t="justify"),Om("left,center,right,justify".split(","),function(e){t!==e&&a.remove("align"+e)}),"none"!==t&&d("align"+t)},"InsertUnorderedList,InsertOrderedList":function(e){var t,n;l(e),(t=o.getParent(i.getNode(),"ol,ul"))&&(n=t.parentNode,/^(H[1-6]|P|ADDRESS|PRE)$/.test(n.nodeName)&&(m(),o.split(n,t),p()))},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){d(e)},"ForeColor,HiliteColor":function(e,t,n){d(e
,n)},FontName:function(e,t,n){Wd(s,n)},FontSize:function(e,t,n){Xd(s,n)},RemoveFormat:function(e){a.remove(e)},mceBlockQuote:function(){d("blockquote")},FormatBlock:function(e,t,n){return d(n||"p")},mceCleanup:function(){var e=i.getBookmark();s.setContent(s.getContent()),i.moveToBookmark(e)},mceRemoveNode:function(e,t,n){var r=n||i.getNode();r!==s.getBody()&&(m(),s.dom.remove(r,!0),p())},mceSelectNodeDepth:function(e,t,n){var r=0;o.getParent(i.getNode(),function(e){if(1===e.nodeType&&r++===n)return i.select(e),!1},s.getBody())},mceSelectNode:function(e,t,n){i.select(n)},mceInsertContent:function(e,t,n){Yc.insertAtCaret(s,n)},mceInsertRawHTML:function(e,t,n){var r=s.getContent();i.setContent("tiny_mce_marker"),s.setContent(r.replace(/tiny_mce_marker/g,function(){return n}))},mceToggleFormat:function(e,t,n){d(n)},mceSetContent:function(e,t,n){s.setContent(n)},"Indent,Outdent":function(e){Dm(s,e)},mceRepaint:function(){},InsertHor
izontalRule:function(){s.execCommand("mceInsertContent",!1,"<hr />")},mceToggleVisualAid:function(){s.hasVisual=!s.hasVisual,s.addVisual()},mceReplaceContent:function(e,t,n){s.execCommand("mceInsertContent",!1,n.replace(/\{\$selection\}/g,i.getContent({format:"text"})))},mceInsertLink:function(e,t,n){var r;"string"==typeof n&&(n={href:n}),r=o.getParent(i.getNode(),"a"),n.href=n.href.replace(" ","%20"),r&&n.href||a.remove("link"),n.href&&a.apply("link",n,r)},selectAll:function(){var e=o.getParent(i.getStart(),Ao.isContentEditableTrue);if(e){var t=o.createRng();t.selectNodeContents(e),i.setRng(t)}},"delete":function(){Ud.deleteCommand(s)},forwardDelete:function(){Ud.forwardDeleteCommand(s)},mceNewDocument:function(){s.setContent("")},InsertLineBreak:function(e,t,n){return mm.insert(s,n),!0}}),e({"JustifyLeft,JustifyCenter,JustifyRig
ht,JustifyFull":function(e){var t="align"+e.substring(7),n=i.isCollapsed()?[o.getParent(i.getNode(),o.isBlock)]:i.getSelectedBlocks(),r=Lm(n,function(e){return!!a.matchNode(e,t)});return-1!==Im(r,!0)},"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":function(e){return f(e)},mceBlockQuote:function(){return f("blockquote")},Outdent:function(){var e;if(n.inline_styles){if((e=o.getParent(i.getStart(),o.isBlock))&&0<parseInt(e.style.paddingLeft,10))return!0;if((e=o.getParent(i.getEnd(),o.isBlock))&&0<parseInt(e.style.paddingLeft,10))return!0}return r("InsertUnorderedList")||r("InsertOrderedList")||!n.inline_styles&&!!o.getParent(i.getNode(),"BLOCKQUOTE")},"InsertUnorderedList,InsertOrderedList":function(e){var t=o.getParent(i.getNode(),"ul,ol");return t&&("insertunorderedlist"===e&&"UL"===t.tagName||"insertorderedlist"
===e&&"OL"===t.tagName)}},"state"),e({Undo:function(){s.undoManager.undo()},Redo:function(){s.undoManager.redo()}}),u("FontName",function(){return Kd(s)},this),u("FontSize",function(){return Yd(s)},this)}var Fm=Lt.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend"," "),zm=function(a){var u,s,c=this,l={},f=function(){return!1},d=function(){return!0};u=(a=a||{}).scope||c,s=a.toggleEvent||f;var r=function(e,t,n,r){var o,i,a;if(!1===t&&(t=f),t)for(t={func:t},r&&Lt.extend(t,r),a=(i=e.toLowerCase().split(" ")).length;a--;)e=i[a],(o=l[e])||(o=l[e]=[],s(e,!0)),n?o.unshift(t):o.push(t);return c},m=f
unction(e,t){var n,r,o,i,a;if(e)for(n=(i=e.toLowerCase().split(" ")).length;n--;){if(e=i[n],r=l[e],!e){for(o in l)s(o,!1),delete l[o];return c}if(r){if(t)for(a=r.length;a--;)r[a].func===t&&(r=r.slice(0,a).concat(r.slice(a+1)),l[e]=r);else r.length=0;r.length||(s(e,!1),delete l[e])}}else{for(e in l)s(e,!1);l={}}return c};c.fire=function(e,t){var n,r,o,i;if(e=e.toLowerCase(),(t=t||{}).type=e,t.target||(t.target=u),t.preventDefault||(t.preventDefault=function(){t.isDefaultPrevented=d},t.stopPropagation=function(){t.isPropagationStopped=d},t.stopImmediatePropagation=function(){t.isImmediatePropagationStopped=d},t.isDefaultPrevented=f,t.isPropagationStopped=f,t.isImmediatePropagationStopped=f),a.beforeFire&&a.beforeFire(t),n=l[e])for(r=0,o=n.length;r<o;r++){if((i=n[r]).once&&m(e,i.func),t.isImmediatePropagationStopped())return t.stopPropagation(),t;if(!1===i.func.call(u,t))return t.preventDefault(),t}return t},c.on=r,c.off=m,c.once=function(e,t,n){ret
urn r(e,t,n,{once:!0})},c.has=function(e){return e=e.toLowerCase(),!(!l[e]||0===l[e].length)}};zm.isNative=function(e){return!!Fm[e.toLowerCase()]};var Um,qm=function(n){return n._eventDispatcher||(n._eventDispatcher=new zm({scope:n,toggleEvent:function(e,t){zm.isNative(e)&&n.toggleNativeEvent&&n.toggleNativeEvent(e,t)}})),n._eventDispatcher},Vm={fire:function(e,t,n){if(this.removed&&"remove"!==e)return t;if(t=qm(this).fire(e,t,n),!1!==n&&this.parent)for(var r=this.parent();r&&!t.isPropagationStopped();)r.fire(e,t,!1),r=r.parent();return t},on:function(e,t,n){return qm(this).on(e,t,n)},off:function(e,t){return qm(this).off(e,t)},once:function(e,t){return qm(this).once(e,t)},hasEventListeners:function(e){return qm(this).has(e)}},Hm=di.DOM,jm=function(e,t){return"selectionchange"===t?e.getDoc():!e.inline&&/^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(t)?e.getDoc().documentElement:e.settings.event_root?(e
.eventRoot||(e.eventRoot=Hm.select(e.settings.event_root)[0]),e.eventRoot):e.getBody()},$m=function(i,a){var e,t,u=function(e){return!e.hidden&&!e.readonly};if(i.delegates||(i.delegates={}),!i.delegates[a]&&!i.removed)if(e=jm(i,a),i.settings.event_root){if(Um||(Um={},i.editorManager.on("removeEditor",function(){var e;if(!i.editorManager.activeEditor&&Um){for(e in Um)i.dom.unbind(jm(i,e));Um=null}})),Um[a])return;t=function(e){for(var t=e.target,n=i.editorManager.get(),r=n.length;r--;){var o=n[r].getBody();(o===t||Hm.isChildOf(t,o))&&u(n[r])&&n[r].fire(a,e)}},Um[a]=t,Hm.bind(e,a,t)}else t=function(e){u(i)&&i.fire(a,e)},Hm.bind(e,a,t),i.delegates[a]=t},Wm={bindPendingEventDelegates:function(){var t=this;Lt.each(t._pendingNativeEvents,function(e){$m(t,e)})},toggleNativeEvent:function(e,t){var n=this;"focus"!==e&&"blur"!==e&&(t?n.initialized?$m(n,e):n._pendingNativeEvents?n._pendingNativeEvents
.push(e):n._pendingNativeEvents=[e]:n.initialized&&(n.dom.unbind(jm(n,e),e,n.delegates[e]),delete n.delegates[e]))},unbindAllNativeEvents:function(){var e,t=this,n=t.getBody(),r=t.dom;if(t.delegates){for(e in t.delegates)t.dom.unbind(jm(t,e),e,t.delegates[e]);delete t.delegates}!t.inline&&n&&r&&(n.onload=null,r.unbind(t.getWin()),r.unbind(t.getDoc())),r&&(r.unbind(n),r.unbind(t.getContainer()))}},Km=Wm=Lt.extend({},Vm,Wm),Xm=function(e,t,n){try{e.getDoc().execCommand(t,!1,n)}catch(r){}},Ym=function(e,t){var n,r,o;e._clickBlocker&&(e._clickBlocker.unbind(),e._clickBlocker=null),t?(e._clickBlocker=(r=(n=e).getBody(),o=function(e){0<n.dom.getParents(e.target,"a").length&&e.preventDefault()},n.dom.bind(r,"click",o),{unbind:function(){n.dom.unbind(r,"click",o)}}),e.selection.controlSelection.hideResizeRect(),e.readonly=!0,e.getBody().contentEditable=!1):(e.readonly=!1,e.getBody().contentEditable=!0,X
m(e,"StyleWithCSS",!1),Xm(e,"enableInlineTableEditing",!1),Xm(e,"enableObjectResizing",!1),e.focus(),e.nodeChanged())},Gm=function(e,t){var n=e.readonly?"readonly":"design";t!==n&&(e.initialized?Ym(e,"readonly"===t):e.on("init",function(){Ym(e,"readonly"===t)}),e.fire("SwitchMode",{mode:t}))},Jm=Lt.each,Qm=Lt.explode,Zm={f9:120,f10:121,f11:122},ep=Lt.makeMap("alt,ctrl,shift,meta,access");function tp(i){var a={},r=[],u=function(e){var t,n,r={};for(n in Jm(Qm(e,"+"),function(e){e in ep?r[e]=!0:/^[0-9]{2,}$/.test(e)?r.keyCode=parseInt(e,10):(r.charCode=e.charCodeAt(0),r.keyCode=Zm[e]||e.toUpperCase().charCodeAt(0))}),t=[r.keyCode],ep)r[n]?t.push(n):r[n]=!1;return r.id=t.join(","),r.access&&(r.alt=!0,ge.mac?r.ctrl=!0:r.shift=!0),r.meta&&(ge.mac?r.meta=!0:(r.ctrl=!0,r.meta=!1)),r},s=function(e,t,n,r){var o;return(o=Lt.map(Qm(e,">"),u
))[o.length-1]=Lt.extend(o[o.length-1],{func:n,scope:r||i}),Lt.extend(o[0],{desc:i.translate(t),subpatterns:o.slice(1)})},o=function(e,t){return!!t&&t.ctrl===e.ctrlKey&&t.meta===e.metaKey&&t.alt===e.altKey&&t.shift===e.shiftKey&&!!(e.keyCode===t.keyCode||e.charCode&&e.charCode===t.charCode)&&(e.preventDefault(),!0)},c=function(e){return e.func?e.func.call(e.scope):null};i.on("keyup keypress keydown",function(t){var e,n;((n=t).altKey||n.ctrlKey||n.metaKey||"keydown"===(e=t).type&&112<=e.keyCode&&e.keyCode<=123)&&!t.isDefaultPrevented()&&(Jm(a,function(e){if(o(t,e))return r=e.subpatterns.slice(0),"keydown"===t.type&&c(e),!0}),o(t,r[0])&&(1===r.length&&"keydown"===t.type&&c(r[0]),r.shift()))}),this.add=function(e,n,r,o){var t;return"string"==typeof(t=r)?r=function(){i.execCommand(t,!1,null)}:Lt.isArray(t)&&am
p;(r=function(){i.execCommand(t[0],t[1],t[2])}),Jm(Qm(Lt.trim(e.toLowerCase())),function(e){var t=s(e,n,r,o);a[t.id]=t}),!0},this.remove=function(e){var t=s(e);return!!a[t.id]&&(delete a[t.id],!0)}}var np=function(e){var t=e!==undefined?e.dom():document;return A.from(t.activeElement).map(qn.fromDom)},rp=function(e){var t=qr.owner(e).dom();return e.dom()===t.activeElement},op=function(t){return np(qr.owner(t)).filter(function(e){return t.dom().contains(e.dom())})},ip=function(t,e){return(n=e,n.collapsed?A.from(na(n.startContainer,n.startOffset)).map(qn.fromDom):A.none()).bind(function(e){return ho(e)?A.some(e):!1===Or.contains(t,e)?A.some(t):A.none()});var n},ap=function(t,e){ip(qn.fromDom(t.getBody()),e).bind(function(e){return Ka.firstPositionIn(e.dom())}).fold(function(){t.selection.normalize()},function(e){return t.selection.setRng(e.toRange())})},up=function(e){if(e.setActive)try{e.setActive()}catch(t){e.focus()}else e.focus()},sp=function(e){var t,n=e.getBody();return n
&&(t=qn.fromDom(n),rp(t)||op(t).isSome())},cp=function(e){return e.inline?sp(e):(t=e).iframeElement&&rp(qn.fromDom(t.iframeElement));var t},lp=function(e){return e.editorManager.setActive(e)},fp=function(e,t){e.removed||(t?lp(e):function(t){var e=t.selection,n=t.settings.content_editable,r=t.getBody(),o=e.getRng();t.quirks.refreshContentEditable();var i,a,u=(i=t,a=e.getNode(),i.dom.getParent(a,function(e){return"true"===i.dom.getContentEditable(e)}));if(t.$.contains(r,u))return up(u),ap(t,o),lp(t);t.bookmark!==undefined&&!1===cp(t)&&_m.getRng(t).each(function(e){t.selection.setRng(e),o=e}),n||(ge.opera||up(r),t.getWin().focus()),(ge.gecko||n)&&(up(r),ap(t,o)),lp(t)}(e))},dp=cp,mp=function(e,t){return t.dom()[e]},pp=function(e,t){return parseInt(yr(t,e),10)},gp=V.curry(mp,"clientWidth"),hp=V.curry(mp,"clientHeight"),vp=V.curry(pp,"margin-top"),yp=V.curry(pp,"margin-left"),bp={isXYInContentArea:f
unction(e,t,n){var r,o,i,a,u,s,c,l,f,d,m=qn.fromDom(e.getBody()),p=e.inline?m:qr.documentElement(m),g=(r=e.inline,i=t,a=n,u=(o=p).dom().getBoundingClientRect(),{x:i-(r?u.left+o.dom().clientLeft+yp(o):0),y:a-(r?u.top+o.dom().clientTop+vp(o):0)});return c=g.x,l=g.y,f=gp(s=p),d=hp(s),0<=c&&0<=l&&c<=f&&l<=d},isEditorAttachedToDom:function(e){var t,n=e.inline?e.getBody():e.getContentAreaContainer();return(t=n,A.from(t).map(qn.fromDom)).map(function(e){return Or.contains(qr.owner(e),e)}).getOr(!1)}};function Cp(n){var t,o=[],i=function(){var e,t=n.theme;return t&&t.getNotificationManagerImpl?t.getNotificationManagerImpl():{open:e=function(){throw new Error("Theme did not provide a NotificationManager implementation.")},close:e,reposition:e,getArgs:e}},a=function(){0<o.length&&i().reposition(o)},u=function(t){H.findIndex(o,function(e){return e===t}).each(function(e){o.splice(e,1)})},r=function(r){if(!n.removed&&bp.isE
ditorAttachedToDom(n))return H.find(o,function(e){return t=i().getArgs(e),n=r,!(t.type!==n.type||t.text!==n.text||t.progressBar||t.timeout||n.progressBar||n.timeout);var t,n}).getOrThunk(function(){n.editorManager.setActive(n);var e,t=i().open(r,function(){u(t),a()});return e=t,o.push(e),a(),t})};return(t=n).on("SkinLoaded",function(){var e=t.settings.service_message;e&&r({text:e,type:"warning",timeout:0,icon:""})}),t.on("ResizeEditor ResizeWindow",function(){Ce.requestAnimationFrame(a)}),t.on("remove",function(){H.each(o,function(e){i().close(e)})}),{open:r,close:function(){A.from(o[0]).each(function(e){i().close(e),u(e),a()})},getNotifications:function(){return o}}}function xp(r){var o=[],i=function(){var e,t=r.theme;return t&&t.getWindowManagerImpl?t.getWindowManagerImpl():{open:e=function(){throw new Error("Theme did not provide a WindowManager implementation.")},alert:e,confirm:e,close:e,getParams:e,set
Params:e}},a=function(e,t){return function(){return t?t.apply(e,arguments):undefined}},u=function(e){var t;o.push(e),t=e,r.fire("OpenWindow",{win:t})},s=function(n){H.findIndex(o,function(e){return e===n}).each(function(e){var t;o.splice(e,1),t=n,r.fire("CloseWindow",{win:t}),0===o.length&&r.focus()})},e=function(){return A.from(o[o.length-1])};return r.on("remove",function(){H.each(o.slice(0),function(e){i().close(e)})}),{windows:o,open:function(e,t){r.editorManager.setActive(r),_m.store(r);var n=i().open(e,t,s);return u(n),n},alert:function(e,t,n){var r=i().alert(e,a(n||this,t),s);u(r)},confirm:function(e,t,n){var r=i().confirm(e,a(n||this,t),s);u(r)},close:function(){e().each(function(e){i().close(e),s(e)})},getParams:function(){return e().map(i().getParams).getOr(null)},setParams:function(t){e().each(function(e){i().setParams(e,t)})},getWindows:function(){return o}}}var wp=Ci.PluginManager,Np=function(e,t){var n=function(e,t){for(var n in wp
.urls)if(wp.urls[n]+"/plugin"+t+".js"===e)return n;return null}(t,e.suffix);return n?"Failed to load plugin: "+n+" from url "+t:"Failed to load plugin url: "+t},Ep=function(e,t){e.notificationManager.open({type:"error",text:t})},Sp=function(e,t){e._skinLoaded?Ep(e,t):e.on("SkinLoaded",function(){Ep(e,t)})},kp={pluginLoadError:function(e,t){Sp(e,Np(e,t))},uploadError:function(e,t){Sp(e,"Failed to upload image: "+t)},displayError:Sp,initError:function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=window.console;r&&(r.error?r.error.apply(r,arguments):r.log.apply(r,arguments))}},Tp=Ci.PluginManager,Ap=Ci.ThemeManager;function Rp(){return new(j.getOrDie("XMLHttpRequest"))}function Bp(u,s){var r={},n=function(e,r,o,t){var i,n;(i=new Rp).open("POST",s.url),i.withCredentials=s.credentials,i.upload.onprogress=function(e){t(e.loaded/e.total*100)},i.onerror=func
tion(){o("Image upload failed due to a XHR Transport error. Code: "+i.status)},i.onload=function(){var e,t,n;i.status<200||300<=i.status?o("HTTP Error: "+i.status):(e=JSON.parse(i.responseText))&&"string"==typeof e.location?r((t=s.basePath,n=e.location,t?t.replace(/\/$/,"")+"/"+n.replace(/^\//,""):n)):o("Invalid JSON: "+i.responseText)},(n=new FormData).append("file",e.blob(),e.filename()),i.send(n)},c=function(e,t){return{url:t,blobInfo:e,status:!0}},l=function(e,t){return{url:"",blobInfo:e,status:!1,error:t}},f=function(e,t){Lt.each(r[e],function(e){e(t)}),delete r[e]},o=function(e,n){return e=Lt.grep(e,function(e){return!u.isUploaded(e.blobUri())}),he.all(Lt.map(e,function(e){return u.isPending(e.blobUri())?(t=e.blobUri(),new he(function(e){r[t]=r[t]||[],r[t].push(e)})):(o=e,i=s.handler,a=n,u.markPending(o.blobUri()),new he(function(t){var n;try{var r=function(){n&&n.cl
ose()};i(o,function(e){r(),u.markUploaded(o.blobUri(),e),f(o.blobUri(),c(o,e)),t(c(o,e))},function(e){r(),u.removeFailed(o.blobUri()),f(o.blobUri(),l(o,e)),t(l(o,e))},function(e){e<0||100<e||(n||(n=a()),n.progressBar.value(e))})}catch(e){t(l(o,e.message))}}));var o,i,a,t}))};return s=Lt.extend({credentials:!1,handler:n},s),{upload:function(e,t){return s.url||s.handler!==n?o(e,t):new he(function(e){e([])})}}}function _p(e,t){return new(j.getOrDie("Blob"))(e,t)}function Dp(){return new(j.getOrDie("FileReader"))}function Op(e){return new(j.getOrDie("Uint8Array"))(e)}var Pp=function(e){return j.getOrDie("atob")(e)},Lp=function(e){var t,n;return e=decodeURIComponent(e).split(","),(n=/data:([^;]+)/.exec(e[0]))&&(t=n[1]),{type:t,data:e[1]}},Ip=function(e){return 0===e.indexOf("blob:")?(i=e,new he(function(e,t){var n=function(){t("Cannot convert "+i+" to Blob. Resource might not exist or is inaccessible
.")};try{var r=new Rp;r.open("GET",i,!0),r.responseType="blob",r.onload=function(){200===this.status?e(this.response):n()},r.onerror=n,r.send()}catch(o){n()}})):0===e.indexOf("data:")?(o=e,new he(function(e){var t,n,r;o=Lp(o);try{t=Pp(o.data)}catch(Zx){return void e(new _p([]))}for(n=new Op(t.length),r=0;r<n.length;r++)n[r]=t.charCodeAt(r);e(new _p([n],{type:o.type}))})):null;var i,o},Mp=function(n){return new he(function(e){var t=new Dp;t.onloadend=function(){e(t.result)},t.readAsDataURL(n)})},Fp=Lp,zp=0,Up=function(e){return(e||"blobid")+zp++},qp=function(n,r,o,t){var i,a;0!==r.src.indexOf("blob:")?(i=Fp(r.src).data,(a=n.findFirst(function(e){return e.base64()===i}))?o({image:r,blobInfo:a}):Ip(r.src).then(function(e){a=n.create(Up(),e,i),n.add(a),o({image:r,blobInfo:a})},function(e){t(e)})):(a=n.getByUri(r.src))?o({image:r,blobInfo:a}):Ip(r.src).then(function(t){Mp(t).then(function(e){i=Fp(e).data,a=n.create(Up(),t,i),n.add
(a),o({image:r,blobInfo:a})})},function(e){t(e)})},Vp=function(e){return e?e.getElementsByTagName("img"):[]},Hp=0,jp={uuid:function(e){return e+Hp+++(t=function(){return Math.round(4294967295*Math.random()).toString(36)},"s"+(new Date).getTime().toString(36)+t()+t()+t());var t}};function $p(u){var n,o,i,t,e,a,r,s,c,l,f=(n=[],o=ua.constant,i=function(e){var t,n,r;if(!e.blob||!e.base64)throw new Error("blob and base64 representations of the image are required for BlobInfo to be created");return t=e.id||jp.uuid("blobid"),n=e.name||t,{id:o(t),name:o(n),filename:o(n+"."+(r=e.blob.type,{"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png"}[r.toLowerCase()]||"dat")),blob:o(e.blob),base64:o(e.base64),blobUri:o(e.blobUri||W.createObjectURL(e.blob)),uri:o(e.uri)}},{create:function(e,t,n,r){return i("object"==typeof e?e:{id:e,
name:r,blob:t,base64:n})},add:function(e){t(e.id())||n.push(e)},get:t=function(t){return e(function(e){return e.id()===t})},getByUri:function(t){return e(function(e){return e.blobUri()===t})},findFirst:e=function(e){return Bt.filter(n,e)[0]},removeByUri:function(t){n=Bt.filter(n,function(e){return e.blobUri()!==t||(W.revokeObjectURL(e.blobUri()),!1)})},destroy:function(){Bt.each(n,function(e){W.revokeObjectURL(e.blobUri())}),n=[]}}),d=u.settings,m=(s={},c=function(e,t){return{status:e,resultUri:t}},{hasBlobUri:l=function(e){return e in s},getResultUri:function(e){var t=s[e];return t?t.resultUri:null},isPending:function(e){return!!l(e)&&1===s[e].status},isUploaded:function(e){return!!l(e)&&2===s[e].status},markPending:function(e){s[e]=c(1,null)},markUploaded:function(e,t){s[e]=c(2,t)},removeFailed:function(e){delete s[e]},destroy:function(){s={}}}),p=function(t){return function(e){return u.selection?t(e):[]}},g=function(e,t,n){for(var r=0;-1!==(r=e.indexOf(t,r))&&
amp;(e=e.substring(0,r)+n+e.substr(r+t.length),r+=n.length-t.length+1),-1!==r;);return e},h=function(e,t,n){return e=g(e,'src="'+t+'"','src="'+n+'"'),e=g(e,'data-mce-src="'+t+'"','data-mce-src="'+n+'"')},v=function(t,n){Bt.each(u.undoManager.data,function(e){"fragmented"===e.type?e.fragments=Bt.map(e.fragments,function(e){return h(e,t,n)}):e.content=h(e.content,t,n)})},y=function(){return u.notificationManager.open({text:u.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0})},b=function(e,t){f.removeByUri(e.src),v(e.src,t),u.$(e).attr({src:d.images_reuse_filename?t+"?"+(new Date).getTime():t,"data-mce-src":u.convertURL(t,"src")})},C=function(n){return a||(a=Bp(m,{url:d.images_upload_url,basePath:d.images_upload_base_path,credentials:d.images_upload_credentials,handler:d.images_upload_handler})),N().then(p(function(r){var e;return e=Bt.map(r,function(e){return e.blob
Info}),a.upload(e,y).then(p(function(e){var t=Bt.map(e,function(e,t){var n=r[t].image;return e.status&&!1!==u.settings.images_replace_blob_uris?b(n,e.url):e.error&&kp.uploadError(u,e.error),{element:n,status:e.status}});return n&&n(t),t}))}))},x=function(e){if(!1!==d.automatic_uploads)return C(e)},w=function(e){return!d.images_dataimg_filter||d.images_dataimg_filter(e)},N=function(){var o,i,a;return r||(o=m,i=f,a={},r={findAll:function(e,n){var t;n||(n=ua.constant(!0)),t=Bt.filter(Vp(e),function(e){var t=e.src;return!!ge.fileApi&&!e.hasAttribute("data-mce-bogus")&&!e.hasAttribute("data-mce-placeholder")&&!(!t||t===ge.transparentSrc)&&(0===t.indexOf("blob:")?!o.isUploaded(t):0===t.indexOf("data:")&&n(e))});var r=Bt.map(t,function(n){if(a[n.src])return new he(function(t){a[n.src].then(function(e){if("string"==typeof e)return e;t({image:n,blobInfo:e.blobInfo})})});var e=new
he(function(e,t){qp(i,n,e,t)}).then(function(e){return delete a[e.image.src],e})["catch"](function(e){return delete a[n.src],e});return a[n.src]=e});return he.all(r)}}),r.findAll(u.getBody(),w).then(p(function(e){return e=Bt.filter(e,function(e){return"string"!=typeof e||(kp.displayError(u,e),!1)}),Bt.each(e,function(e){v(e.image.src,e.blobInfo.blobUri()),e.image.src=e.blobInfo.blobUri(),e.image.removeAttribute("data-mce-src")}),e}))},E=function(e){return e.replace(/src="(blob:[^"]+)"/g,function(e,n){var t=m.getResultUri(n);if(t)return'src="'+t+'"';var r=f.getByUri(n);return r||(r=Bt.reduce(u.editorManager.get(),function(e,t){return e||t.editorUpload&&t.editorUpload.blobCache.getByUri(n)},null)),r?'src="data:'+r.blob().type+";base64,"+r.base64()+'"':e})};return u.on("setContent",function(){!1!==u.settings.automatic_uploads?x():N()}),u.on("RawSaveContent",function(e){e.content=E(e.
content)}),u.on("getContent",function(e){e.source_view||"raw"===e.format||(e.content=E(e.content))}),u.on("PostRender",function(){u.parser.addNodeFilter("img",function(e){Bt.each(e,function(e){var t=e.attr("src");if(!f.getByUri(t)){var n=m.getResultUri(t);n&&e.attr("src",n)}})})}),{blobCache:f,uploadImages:C,uploadImagesAuto:x,scanForImages:N,destroy:function(){f.destroy(),m.destroy(),r=a=null}}}var Wp=function(e,t){return e.hasOwnProperty(t.nodeName)},Kp=function(e,t){if(Ao.isText(t)){if(0===t.nodeValue.length)return!0;if(/^\s+$/.test(t.nodeValue)&&(!t.nextSibling||Wp(e,t.nextSibling)))return!0}return!1},Xp=function(e){var t,n,r,o,i,a,u,s,c,l,f,d=e.settings,m=e.dom,p=e.selection,g=e.schema,h=g.getBlockElements(),v=p.getStart(),y=e.getBody();if(f=d.forced_root_block,v&&Ao.isElement(v)&&f&&(l=y.nodeName.toLowerCase(),g.isValidChild(l,f.toLowerCase())&&(b=h,C=y,x=v,!H.exists(Il(
qn.fromDom(x),qn.fromDom(C)),function(e){return Wp(b,e.dom())})))){var b,C,x,w,N;for(n=(t=p.getRng()).startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,c=dp(e),v=y.firstChild;v;)if(w=h,N=v,Ao.isText(N)||Ao.isElement(N)&&!Wp(w,N)&&!Bc.isBookmarkNode(N)){if(Kp(h,v)){v=(u=v).nextSibling,m.remove(u);continue}a||(a=m.create(f,e.settings.forced_root_block_attrs),v.parentNode.insertBefore(a,v),s=!0),v=(u=v).nextSibling,a.appendChild(u)}else a=null,v=v.nextSibling;s&&c&&(t.setStart(n,r),t.setEnd(o,i),p.setRng(t),e.nodeChanged())}},Yp=function(e){e.settings.forced_root_block&&e.on("NodeChange",V.curry(Xp,e))};function Gp(i){var r,o=[];"onselectionchange"in i.getDoc()||i.on("NodeChange Click MouseUp KeyUp Focus",function(e){var t,n;n={startContainer:(t=i.selection.getRng()).startContainer,startOffset:t.startOffset,endContainer:t.endContainer,endOffset:t.endOffset},"nodechange"!==e.type&&Gd.isEq
(n,r)||i.fire("SelectionChange"),r=n}),i.on("contextmenu",function(){i.fire("SelectionChange")}),i.on("SelectionChange",function(){var e=i.selection.getStart(!0);!e||!ge.range&&i.selection.isCollapsed()||!function(e){var t,n;if((n=i.$(e).parentsUntil(i.getBody()).add(e)).length===o.length){for(t=n.length;0<=t&&n[t]===o[t];t--);if(-1===t)return o=n,!0}return o=n,!1}(e)&&i.dom.isChildOf(e,i.getBody())&&i.nodeChanged({selectionChange:!0})}),i.on("MouseUp",function(e){e.isDefaultPrevented()||("IMG"===i.selection.getNode().nodeName?Ce.setEditorTimeout(i,function(){i.nodeChanged()}):i.nodeChanged())}),this.nodeChanged=function(e){var t,n,r,o=i.selection;i.initialized&&o&&!i.settings.disable_nodechange&&!i.readonly&&(r=i.getBody(),(t=o.getStart(!0)||r).ownerDocument===i.getDoc()&&i.dom.isChildOf(t,r)||(t=r),n=[],i.dom.getParent(t,function(e){if(e===r)return
!0;n.push(e)}),(e=e||{}).element=t,e.parents=n,i.fire("NodeChange",e))}}var Jp,Qp,Zp=function(e){var t,n,r,o;return o=e.getBoundingClientRect(),n=(t=e.ownerDocument).documentElement,r=t.defaultView,{top:o.top+r.pageYOffset-n.clientTop,left:o.left+r.pageXOffset-n.clientLeft}},eg=function(e,t){return n=(u=e).inline?Zp(u.getBody()):{left:0,top:0},a=(i=e).getBody(),r=i.inline?{left:a.scrollLeft,top:a.scrollTop}:{left:0,top:0},{pageX:(o=function(e,t){if(t.target.ownerDocument!==e.getDoc()){var n=Zp(e.getContentAreaContainer()),r=(i=(o=e).getBody(),a=o.getDoc().documentElement,u={left:i.scrollLeft,top:i.scrollTop},s={left:i.scrollLeft||a.scrollLeft,top:i.scrollTop||a.scrollTop},o.inline?u:s);return{left:t.pageX-n.left+r.left,top:t.pageY-n.top+r.top}}var o,i,a,u,s;return{left:t.pageX,top:t.pageY}}(e,t)).left-n.left+r.left,pageY:o.top-n.top+r.top};var n,r,o,i,a,u},tg=Ao.isContentEditableFalse,ng=Ao.isContentEditableTrue,rg=function(e){e&&e.parentNode&&e.parentNode.
removeChild(e)},og=function(u,s){return function(e){if(0===e.button){var t=Bt.find(s.dom.getParents(e.target),ua.or(tg,ng));if(i=s.getBody(),tg(a=t)&&a!==i){var n=s.dom.getPos(t),r=s.getBody(),o=s.getDoc().documentElement;u.element=t,u.screenX=e.screenX,u.screenY=e.screenY,u.maxX=(s.inline?r.scrollWidth:o.offsetWidth)-2,u.maxY=(s.inline?r.scrollHeight:o.offsetHeight)-2,u.relX=e.pageX-n.x,u.relY=e.pageY-n.y,u.width=t.offsetWidth,u.height=t.offsetHeight,u.ghost=function(e,t,n,r){var o=t.cloneNode(!0);e.dom.setStyles(o,{width:n,height:r}),e.dom.setAttrib(o,"data-mce-selected",null);var i=e.dom.create("div",{"class":"mce-drag-container","data-mce-bogus":"all",unselectable:"on",contenteditable:"false"});return e.dom.setStyles(i,{position:"absolute",opacity:.5,overflow:"hidden",border:0,padding:0,margin:0,width:n,height:r}),e.dom.setStyles(o,{margin:0,boxSizing:"border-box"
;}),i.appendChild(o),i}(s,t,u.width,u.height)}}var i,a}},ig=function(l,f){return function(e){if(l.dragging&&(s=(i=f).selection,c=s.getSel().getRangeAt(0).startContainer,a=3===c.nodeType?c.parentNode:c,u=l.element,a!==u&&!i.dom.isChildOf(a,u)&&!tg(a))){var t=(r=l.element,(o=r.cloneNode(!0)).removeAttribute("data-mce-selected"),o),n=f.fire("drop",{targetClone:t,clientX:e.clientX,clientY:e.clientY});n.isDefaultPrevented()||(t=n.targetClone,f.undoManager.transact(function(){rg(l.element),f.insertContent(f.dom.getOuterHTML(t)),f._selectionOverrides.hideFakeCaret()}))}var r,o,i,a,u,s,c;ag(l)}},ag=function(e){e.dragging=!1,e.element=null,rg(e.ghost)},ug=function(e){var t,n,r,o,i,a,g,h,v,u,s,c={};t=di.DOM,a=document,n=og(c,e),g=c,h=e,v=Ce.throttle(function(e,t){h._selectionOverrides.hideFakeCaret(),h.selection.placeCaretAt(e,t)},0),r=function(e){var t,n,r,o,i,a,u,s,c,l,f,d,m=Math.max(Math.abs(e.screenX-g.screenX),Math.abs(e.screenY-g.screenY));if(
g.element&&!g.dragging&&10<m){if(h.fire("dragstart",{target:g.element}).isDefaultPrevented())return;g.dragging=!0,h.focus()}if(g.dragging){var p=(f=g,{pageX:(d=eg(h,e)).pageX-f.relX,pageY:d.pageY+5});c=g.ghost,l=h.getBody(),c.parentNode!==l&&l.appendChild(c),t=g.ghost,n=p,r=g.width,o=g.height,i=g.maxX,a=g.maxY,s=u=0,t.style.left=n.pageX+"px",t.style.top=n.pageY+"px",n.pageX+r>i&&(u=n.pageX+r-i),n.pageY+o>a&&(s=n.pageY+o-a),t.style.width=r-u+"px",t.style.height=o-s+"px",v(e.clientX,e.clientY)}},o=ig(c,e),u=c,i=function(){ag(u),u.dragging&&s.fire("dragend")},(s=e).on("mousedown",n),e.on("mousemove",r),e.on("mouseup",o),t.bind(a,"mousemove",r),t.bind(a,"mouseup",i),e.on("remove",function(){t.unbind(a,"mousemove",r),t.unbind(a,"mouseup",i)})},sg=function(e){var n;ug(e),(n=e).on("drop"
;,function(e){var t="undefined"!=typeof e.clientX?n.getDoc().elementFromPoint(e.clientX,e.clientY):null;(tg(t)||tg(n.dom.getContentEditableParent(t)))&&e.preventDefault()})},cg=function(e){return Bt.reduce(e,function(e,t){return e.concat(function(t){var e=function(e){return Bt.map(e,function(e){return(e=Gi(e)).node=t,e})};if(Ao.isElement(t))return e(t.getClientRects());if(Ao.isText(t)){var n=t.ownerDocument.createRange();return n.setStart(t,0),n.setEnd(t,t.data.length),e(n.getClientRects())}}(t))},[])};(Qp=Jp||(Jp={}))[Qp.Up=-1]="Up",Qp[Qp.Down=1]="Down";var lg=function(o,i,a,e,u,t){var n,s,c=0,l=[],r=function(e){var t,n,r;for(r=cg([e]),-1===o&&(r=r.reverse()),t=0;t<r.length;t++)if(n=r[t],!a(n,s)){if(0<l.length&&i(n,Bt.last(l))&&c++,n.line=c,u(n))return!0;l.push(n)}};return(s=Bt.last(t.getClientRects()))&&(r(n=t.getNode()),function(e,t,n,r){for(;r=ds(r,e,Xi,t);)if(n(r))return}(o,e,r,n)),l},fg=V.curry(lg,Jp.U
p,Zi,ea),dg=V.curry(lg,Jp.Down,ea,Zi),mg=function(n){return function(e){return t=n,e.line>t;var t}},pg=function(n){return function(e){return t=n,e.line===t;var t}},gg=Ao.isContentEditableFalse,hg=ds,vg=function(e,t){return Math.abs(e.left-t)},yg=function(e,t){return Math.abs(e.right-t)},bg=function(e,t){return e>=t.left&&e<=t.right},Cg=function(e,o){return Bt.reduce(e,function(e,t){var n,r;return n=Math.min(vg(e,o),yg(e,o)),r=Math.min(vg(t,o),yg(t,o)),bg(o,t)?t:bg(o,e)?e:r===n&&gg(t.node)?t:r<n?t:e})},xg=function(e,t,n,r){for(;r=hg(r,e,Xi,t);)if(n(r))return},wg=function(e,t,n){var r,o,i,a,u,s,c,l,f=cg((o=e,Bt.filter(Bt.toArray(o.getElementsByTagName("*")),ts))),d=Bt.filter(f,function(e){return n>=e.top&&n<=e.bottom});return(r=Cg(d,t))&&(r=Cg((u=e,l=function(t,e){var n;return n=Bt.filter(cg([e]),function(e){return!t(e,s)}),c=c.concat(n),0===n.length},(c=[]).push(s=r),xg(Jp.Up,u,V.curry(l,Zi),s.node),xg(Jp.Down,u,V.curry(l,ea
),s.node),c),t))&&ts(r.node)?(a=t,{node:(i=r).node,before:vg(i,a)<yg(i,a)}):null},Ng=function(i,a,e){return!e.collapsed&&H.foldl(e.getClientRects(),function(e,t){return e||(o=a,(r=i)>=(n=t).left&&r<=n.right&&o>=n.top&&o<=n.bottom);var n,r,o},!1)},Eg=function(t,n){var r=null;return{cancel:function(){null!==r&&(clearTimeout(r),r=null)},throttle:function(){var e=arguments;null===r&&(r=setTimeout(function(){t.apply(null,e),e=r=null},n))}}},Sg=function(t){var e=Eg(function(){if(!t.removed&&t.selection.getRng().collapsed){var e=Za(t,t.selection.getRng(),!1);t.selection.setRng(e)}},0);t.on("focus",function(){e.throttle()}),t.on("blur",function(){e.cancel()})},kg={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,modifierPressed:function(e){return e.shiftKey||e.ctrlKey||e.altKey||this.metaKeyPressed(e)},metaKeyPressed:function(e){return ge.mac?e.metaKey:e.ctrlKey&
amp;&!e.altKey}},Tg=Ao.isContentEditableTrue,Ag=Ao.isContentEditableFalse,Rg=ks,Bg=Ss,_g=function(e,t){for(var n=e.getBody();t&&t!==n;){if(Tg(t)||Ag(t))return t;t=t.parentNode}return null},Dg=function(p){var g,e,t,a=p.getBody(),o=es(p.getBody(),function(e){return p.dom.isBlock(e)},function(){return dp(p)}),h="sel-"+p.dom.uniqueId(),u=function(e){e&&p.selection.setRng(e)},s=function(){return p.selection.getRng()},v=function(e,t,n,r){return void 0===r&&(r=!0),p.fire("ShowCaret",{target:t,direction:e,before:n}).isDefaultPrevented()?null:(r&&p.selection.scrollIntoView(t,-1===e),o.show(n,t))},y=function(e,t){return t=Cs(e,a,t),-1===e?Ba.fromRangeStart(t):Ba.fromRangeEnd(t)},n=function(e){return Bi(e)||Li(e)||Ii(e)},b=function(e){return n(e.startContainer)||n(e.endContainer)},c=function(e,t){var n,r,o,i,a,u,s,c,l,f,d=p.$,m=p.dom;if(!e)return null;if(e.collapsed){if(!b(e))if(!1===t){if(c=y(-1,e),ts(c.getNode(!0)))return v(-1,c.getNode
(!0),!1,!1);if(ts(c.getNode()))return v(-1,c.getNode(),!c.isAtEnd(),!1)}else{if(c=y(1,e),ts(c.getNode()))return v(1,c.getNode(),!c.isAtEnd(),!1);if(ts(c.getNode(!0)))return v(1,c.getNode(!0),!1,!1)}return null}return i=e.startContainer,a=e.startOffset,u=e.endOffset,3===i.nodeType&&0===a&&Ag(i.parentNode)&&(i=i.parentNode,a=m.nodeIndex(i),i=i.parentNode),1!==i.nodeType?null:(u===a+1&&(n=i.childNodes[a]),Ag(n)?(l=f=n.cloneNode(!0),(s=p.fire("ObjectSelected",{target:n,targetClone:l})).isDefaultPrevented()?null:(r=Cl(qn.fromDom(p.getBody()),"#"+h).fold(function(){return d([])},function(e){return d([e.dom()])}),l=s.targetClone,0===r.length&&(r=d('<div data-mce-bogus="all" class="mce-offscreen-selection"></div>').attr("id",h)).appendTo(p.getBody()),e=p.dom.createRng(),l===f&&ge.ie?(r.empty().append('<p style="font-size: 0" data-mce-bogus="all">\xa0</p&
gt;').append(l),e.setStartAfter(r[0].firstChild.firstChild),e.setEndAfter(l)):(r.empty().append("\xa0").append(l).append("\xa0"),e.setStart(r[0].firstChild,1),e.setEnd(r[0].lastChild,0)),r.css({top:m.getPos(n,p.getBody()).y}),r[0].focus(),(o=p.selection.getSel()).removeAllRanges(),o.addRange(e),H.each(fu(qn.fromDom(p.getBody()),"*[data-mce-selected]"),function(e){cr.remove(e,"data-mce-selected")}),n.setAttribute("data-mce-selected","1"),g=n,C(),e)):null)},l=function(){g&&(g.removeAttribute("data-mce-selected"),Cl(qn.fromDom(p.getBody()),"#"+h).each(Ic.remove),g=null)},C=function(){o.hide()};return ge.ceFalse&&(function(){p.on("mouseup",function(e){var t=s();t.collapsed&&bp.isXYInContentArea(p,e.clientX,e.clientY)&&u(Qa(p,t,!1))}),p.on("click",function(e){var t;(t=_g(p,e.target))&&(Ag(t)&&(e.preventDefault(),p.focus()),Tg(t)&&p.do
m.isChildOf(t,p.selection.getNode())&&l())}),p.on("blur NewBlock",function(){l()}),p.on("ResizeWindow FullscreenStateChanged",function(){return o.reposition()});var n,r,i=function(e,t){var n,r,o=p.dom.getParent(e,p.dom.isBlock),i=p.dom.getParent(t,p.dom.isBlock);return!(!o||!p.dom.isChildOf(o,i)||!1!==Ag(_g(p,o)))||o&&(n=o,r=i,!(p.dom.getParent(n,p.dom.isBlock)===p.dom.getParent(r,p.dom.isBlock)))&&function(e){var t=js(e);if(!e.firstChild)return!1;var n=Ba.before(e.firstChild),r=t.next(n);return r&&!Bg(r)&&!Rg(r)}(o)};r=!1,(n=p).on("touchstart",function(){r=!1}),n.on("touchmove",function(){r=!0}),n.on("touchend",function(e){var t=_g(n,e.target);Ag(t)&&(r||(e.preventDefault(),c(Ja(n,t))))}),p.on("mousedown",function(e){var t,n=e.target;if((n===a||"HTML"===n.nodeName||p.dom.isChildOf(n,a))&&!1!==bp.isXYInContentArea(p,e.clientX,e.clientY))if(t=_g(p,n))Ag(t)?(e.
preventDefault(),c(Ja(p,t))):(l(),Tg(t)&&e.shiftKey||Ng(e.clientX,e.clientY,p.selection.getRng())||p.selection.placeCaretAt(e.clientX,e.clientY));else if(!1===ts(n)){l(),C();var r=wg(a,e.clientX,e.clientY);if(r&&!i(e.target,r.node)){e.preventDefault();var o=v(1,r.node,r.before,!1);p.getBody().focus(),u(o)}}}),p.on("keypress",function(e){kg.modifierPressed(e)||(e.keyCode,Ag(p.selection.getNode())&&e.preventDefault())}),p.on("getSelectionRange",function(e){var t=e.range;if(g){if(!g.parentNode)return void(g=null);(t=t.cloneRange()).selectNode(g),e.range=t}}),p.on("setSelectionRange",function(e){var t;(t=c(e.range,e.forward))&&(e.range=t)}),p.on("AfterSetSelectionRange",function(e){var t,n=e.range;b(n)||C(),t=n.startContainer.parentNode,p.dom.hasClass(t,"mce-offscreen-selection")||l()}),p.on("copy",function(e){var t,n=e.clipboardData;if(!e.isDefaultPrevented()&&e.clipboardData&&!g
e.ie){var r=(t=p.dom.get(h))?t.getElementsByTagName("*")[0]:t;r&&(e.preventDefault(),n.clearData(),n.setData("text/html",r.outerHTML),n.setData("text/plain",r.outerText))}}),sg(p),Sg(p)}(),e=p.contentStyles,t=".mce-content-body",e.push(o.getCss()),e.push(t+" .mce-offscreen-selection {position: absolute;left: -9999999999px;max-width: 1000000px;}"+t+" *[contentEditable=false] {cursor: default;}"+t+" *[contentEditable=true] {cursor: text;}")),{showCaret:v,showBlockCaretContainer:function(e){e.hasAttribute("data-mce-caret")&&(Mi(e),u(s()),p.selection.scrollIntoView(e[0]))},hideFakeCaret:C,destroy:function(){o.destroy(),g=null}}},Og=Lt.each,Pg=function(e){return 0===e.indexOf("data-")||0===e.indexOf("aria-")},Lg=function(e){return e.replace(/<!--|-->/g,"")},Ig=function(e,t,n){var r,o,i,a,u=1;for(a=e.getShortEndedElements(),(i=/<([!?\/])?([A-Za-z0-9\-_\:\.
]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g).lastIndex=r=n;o=i.exec(t);){if(r=i.lastIndex,"/"===o[1])u--;else if(!o[1]){if(o[2]in a)continue;u++}if(0===u)break}return r};function Mg(z,U){void 0===U&&(U=Zo());var t=function(){};!1!==(z=z||{}).fix_self_closing&&(z.fix_self_closing=!0),Og("comment cdata text start end pi doctype".split(" "),function(e){e&&(self[e]=z[e]||t)});var q=z.comment?z.comment:t,V=z.cdata?z.cdata:t,H=z.text?z.text:t,j=z.start?z.start:t,$=z.end?z.end:t,W=z.pi?z.pi:t,K=z.doctype?z.doctype:t;return{parse:function(e){var t,n,r,c,o,i,a,l,u,s,f,d,m,p,g,h,v,y,b,C,x,w,N,E,S,k,T,A,R,B=0,_=[],D=0,O=Vo.decode,P=Lt.makeMap("src,href,data,background,formaction,poster"),L=/((java|vb)script|mhtml):/i,I=/^data:/i,M=function(e){var t,n;for(t=_.length;t--&&_[t].name!==e;);if(0<=t){for(n=_.length-1;t<=n;n--)(e=_[n]).valid&&$(e.name);_.length=t}
},F=function(e,t,n,r,o){var i,a;if(n=(t=t.toLowerCase())in f?t:O(n||r||o||""),m&&!l&&!1===Pg(t)){if(!(i=y[t])&&b){for(a=b.length;a--&&!(i=b[a]).pattern.test(t););-1===a&&(i=null)}if(!i)return;if(i.validValues&&!(n in i.validValues))return}if(P[t]&&!z.allow_script_urls){var u=n.replace(/[\s\u0000-\u001F]+/g,"");try{u=decodeURIComponent(u)}catch(s){u=unescape(u)}if(L.test(u))return;if(!z.allow_html_data_urls&&I.test(u)&&!/^data:image\//i.test(u))return}l&&(t in P||0===t.indexOf("on"))||(c.map[t]=n,c.push({name:t,value:n}))};for(S=new RegExp("<(?:(?:!--([\\w\\W]*?)--\x3e)|(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|(?:!DOCTYPE([\\w\\W]*?)>)|(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|(?:\\/([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)>)|(?:([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)((?:\\s+[^\"'>]+(?:(?:\"[^\"]*\")|(?:'[^']*')|[^>]*))*|\\/|\\s+)>))",&qu
ot;g"),k=/([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g,s=U.getShortEndedElements(),E=z.self_closing_elements||U.getSelfClosingElements(),f=U.getBoolAttrs(),m=z.validate,u=z.remove_internals,R=z.fix_self_closing,T=U.getSpecialElements(),N=e+">";t=S.exec(N);){if(B<t.index&&H(O(e.substr(B,t.index-B))),n=t[6])":"===(n=n.toLowerCase()).charAt(0)&&(n=n.substr(1)),M(n);else if(n=t[7]){if(t.index+t[0].length>e.length){H(O(e.substr(t.index))),B=t.index+t[0].length;continue}if(":"===(n=n.toLowerCase()).charAt(0)&&(n=n.substr(1)),d=n in s,R&&E[n]&&0<_.length&&_[_.length-1].name===n&&M(n),!m||(p=U.getElementRule(n))){if(g=!0,m&&(y=p.attributes,b=p.attributePatterns),(v=t[8])?((l=-1!==v.indexOf("data-mce-type"))&&u&&(g=!1),(c=[]).map={},v.replace(k,F)):(c=[]).map={},m&&!l){if(C=p.attributesRequired,x=
p.attributesDefault,w=p.attributesForced,p.removeEmptyAttrs&&!c.length&&(g=!1),w)for(o=w.length;o--;)a=(h=w[o]).name,"{$uid}"===(A=h.value)&&(A="mce_"+D++),c.map[a]=A,c.push({name:a,value:A});if(x)for(o=x.length;o--;)(a=(h=x[o]).name)in c.map||("{$uid}"===(A=h.value)&&(A="mce_"+D++),c.map[a]=A,c.push({name:a,value:A}));if(C){for(o=C.length;o--&&!(C[o]in c.map););-1===o&&(g=!1)}if(h=c.map["data-mce-bogus"]){if("all"===h){B=Ig(U,e,S.lastIndex),S.lastIndex=B;continue}g=!1}}g&&j(n,c,d)}else g=!1;if(r=T[n]){r.lastIndex=B=t.index+t[0].length,(t=r.exec(e))?(g&&(i=e.substr(B,t.index-B)),B=t.index+t[0].length):(i=e.substr(B),B=e.length),g&&(0<i.length&&H(i,!0),$(n)),S.lastIndex=B;continue}d||(v&&v.indexOf("/")===v.length-1?g&&$(n):_.push({name:n,valid:g}))}else(n=t[1])?(">"===n.charAt(0)&&(n=" "
+n),z.allow_conditional_comments||"[if"!==n.substr(0,3).toLowerCase()||(n=" "+n),q(n)):(n=t[2])?V(Lg(n)):(n=t[3])?K(n):(n=t[4])&&W(n,t[5]);B=t.index+t[0].length}for(B<e.length&&H(O(e.substr(B))),o=_.length-1;0<=o;o--)(n=_[o]).valid&&$(n.name)}}}(Mg||(Mg={})).findEndTag=Ig;var Fg=Mg,zg=function(e,t){var n,r,o,i,a,u,s,c,l=t,f=/<(\w+) [^>]*data-mce-bogus="all"[^>]*>/g,d=e.schema;for(u=e.getTempAttrs(),s=l,c=new RegExp(["\\s?("+u.join("|")+')="[^"]+"'].join("|"),"gi"),l=s.replace(c,""),a=d.getShortEndedElements();i=f.exec(l);)r=f.lastIndex,o=i[0].length,n=a[i[1]]?r:Fg.findEndTag(d,l,r),l=l.substring(0,r-o)+l.substring(n),f.lastIndex=r-o;return Si(l)},Ug={trimExternal:zg,trimInternal:zg},qg=0,Vg=2,Hg=1,jg=function(p,g){var e=p.length+g.length+2,h=new Array(e),v=new Array(e),c=function(e,t,n,r,o){var i=l(e,t,n,r);if(null===i||i.start===t&&i.diag=
==t-r||i.end===e&&i.diag===e-n)for(var a=e,u=n;a<t||u<r;)a<t&&u<r&&p[a]===g[u]?(o.push([0,p[a]]),++a,++u):r-n<t-e?(o.push([2,p[a]]),++a):(o.push([1,g[u]]),++u);else{c(e,i.start,n,i.start-i.diag,o);for(var s=i.start;s<i.end;++s)o.push([0,p[s]]);c(i.end,t,i.end-i.diag,r,o)}},y=function(e,t,n,r){for(var o=e;o-t<r&&o<n&&p[o]===g[o-t];)++o;return{start:e,end:o,diag:t}},l=function(e,t,n,r){var o=t-e,i=r-n;if(0===o||0===i)return null;var a,u,s,c,l,f=o-i,d=i+o,m=(d%2==0?d:d+1)/2;for(h[1+m]=e,v[1+m]=t+1,a=0;a<=m;++a){for(u=-a;u<=a;u+=2){for(s=u+m,u===-a||u!==a&&h[s-1]<h[s+1]?h[s]=h[s+1]:h[s]=h[s-1]+1,l=(c=h[s])-e+n-u;c<t&&l<r&&p[c]===g[l];)h[s]=++c,++l;if(f%2!=0&&f-a<=u&&u<=f+a&&v[s-f]<=h[s])return y(v[s-f],u+e-n,t,r)}for(u=f-a;u<=f+a;u+=2){for(s=u+m-f,u===f-a||u!==f+a&&v[s+1]<=v[s-1]?v[s]=v[s+1]-1:v[s]=v[s-1],l=(c=v[s]-1)-e+n-u;e<=c&&am
p;n<=l&&p[c]===g[l];)v[s]=c--,l--;if(f%2==0&&-a<=u&&u<=a&&v[s]<=h[s+f])return y(v[s],u+e-n,t,r)}}},t=[];return c(0,p.length,0,g.length,t),t},$g=function(e){return Ao.isElement(e)?e.outerHTML:Ao.isText(e)?Vo.encodeRaw(e.data,!1):Ao.isComment(e)?"\x3c!--"+e.data+"--\x3e":""},Wg=function(e,t,n){var r=function(e){var t,n,r;for(r=document.createElement("div"),t=document.createDocumentFragment(),e&&(r.innerHTML=e);n=r.firstChild;)t.appendChild(n);return t}(t);if(e.hasChildNodes()&&n<e.childNodes.length){var o=e.childNodes[n];o.parentNode.insertBefore(r,o)}else e.appendChild(r)},Kg=function(e){return Bt.filter(Bt.map(e.childNodes,$g),function(e){return 0<e.length})},Xg=function(e,t){var n,r,o,i=Bt.map(t.childNodes,$g);return n=jg(i,e),r=t,o=0,Bt.each(n,function(e){e[0]===qg?o++:e[0]===Hg?(Wg(r,e[1],o),o++):e[0]===Vg&&function(e,t){if(e.hasChildNodes()&&t<e.childNodes
.length){var n=e.childNodes[t];n.parentNode.removeChild(n)}}(r,o)}),t},Yg=function(e,t){var n=(t||document).createElement("div");return n.innerHTML=e,qr.children(qn.fromDom(n))},Gg=function(e){return e.dom().innerHTML},Jg=Gg,Qg=function(e,t){var n=qr.owner(e).dom(),r=qn.fromDom(n.createDocumentFragment()),o=Yg(t,n);Pc(r,o),Ic.empty(e),Fu.append(e,r)},Zg=function(e){return{type:"fragmented",fragments:e,content:"",bookmark:null,beforeBookmark:null}},eh=function(e){return{type:"complete",fragments:null,content:e,bookmark:null,beforeBookmark:null}},th=function(e){return"fragmented"===e.type?e.fragments.join(""):e.content},nh=function(e){var t=qn.fromTag("body");return Qg(t,th(e)),H.each(fu(t,"*[data-mce-bogus]"),Ic.unwrap),Jg(t)},rh={createFragmentedLevel:Zg,createCompleteLevel:eh,createFromEditor:function(n){var e,t,r;return e=Kg(n.getBody()),-1!==(t=(r=H.bind(e,function(e){var t=Ug.trimInternal(n.serialize
r,e);return 0<t.length?[t]:[]})).join("")).indexOf("</iframe>")?Zg(r):eh(t)},applyToEditor:function(e,t,n){"fragmented"===t.type?Xg(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw"}),e.selection.moveToBookmark(n?t.beforeBookmark:t.bookmark)},isEq:function(e,t){return!(!e||!t)&&(r=t,th(e)===th(r)||(n=t,nh(e)===nh(n)));var n,r}};function oh(u){var s,r,o=this,c=0,l=[],t=0,f=function(){return 0===t},i=function(e){f()&&(o.typing=e)},d=function(e){u.setDirty(e)},a=function(e){i(!1),o.add({},e)},n=function(){o.typing&&(i(!1),o.add())};return u.on("init",function(){o.add()}),u.on("BeforeExecCommand",function(e){var t=e.command;"Undo"!==t&&"Redo"!==t&&"mceRepaint"!==t&&(n(),o.beforeChange())}),u.on("ExecCommand",function(e){var t=e.command;"Undo"!==t&&"Redo"!==t&&"mceRepaint"!==t
&&a(e)}),u.on("ObjectResizeStart Cut",function(){o.beforeChange()}),u.on("SaveContent ObjectResized blur",a),u.on("DragEnd",a),u.on("KeyUp",function(e){var t=e.keyCode;e.isDefaultPrevented()||((33<=t&&t<=36||37<=t&&t<=40||45===t||e.ctrlKey)&&(a(),u.nodeChanged()),46!==t&&8!==t||u.nodeChanged(),r&&o.typing&&!1===rh.isEq(rh.createFromEditor(u),l[0])&&(!1===u.isDirty()&&(d(!0),u.fire("change",{level:l[0],lastLevel:null})),u.fire("TypingUndo"),r=!1,u.nodeChanged()))}),u.on("KeyDown",function(e){var t=e.keyCode;if(!e.isDefaultPrevented())if(33<=t&&t<=36||37<=t&&t<=40||45===t)o.typing&&a(e);else{var n=e.ctrlKey&&!e.altKey||e.metaKey;!(t<16||20<t)||224===t||91===t||o.typing||n||(o.beforeChange(),i(!0),o.add({},e),r=!0)}}),u.on("MouseDown",function(e){o.typing&&a(e)}),u.on
("input",function(e){var t;e.inputType&&("insertReplacementText"===e.inputType||"insertText"===(t=e).inputType&&null===t.data)&&a(e)}),u.addShortcut("meta+z","","Undo"),u.addShortcut("meta+y,meta+shift+z","","Redo"),u.on("AddUndo Undo Redo ClearUndos",function(e){e.isDefaultPrevented()||u.nodeChanged()}),o={data:l,typing:!1,beforeChange:function(){f()&&(s=bc.getUndoBookmark(u.selection))},add:function(e,t){var n,r,o,i=u.settings;if(o=rh.createFromEditor(u),e=e||{},e=Lt.extend(e,o),!1===f()||u.removed)return null;if(r=l[c],u.fire("BeforeAddUndo",{level:e,lastLevel:r,originalEvent:t}).isDefaultPrevented())return null;if(r&&rh.isEq(r,e))return null;if(l[c]&&(l[c].beforeBookmark=s),i.custom_undo_redo_levels&&l.length>i.custom_undo_redo_levels){for(n=0;n<l.length-1;n++)l[n]=l[n+1];l.length--,c=l.length}e.bookmark=bc.ge
tUndoBookmark(u.selection),c<l.length-1&&(l.length=c+1),l.push(e),c=l.length-1;var a={level:e,lastLevel:r,originalEvent:t};return u.fire("AddUndo",a),0<c&&(d(!0),u.fire("change",a)),e},undo:function(){var e;return o.typing&&(o.add(),o.typing=!1,i(!1)),0<c&&(e=l[--c],rh.applyToEditor(u,e,!0),d(!0),u.fire("undo",{level:e})),e},redo:function(){var e;return c<l.length-1&&(e=l[++c],rh.applyToEditor(u,e,!1),d(!0),u.fire("redo",{level:e})),e},clear:function(){l=[],c=0,o.typing=!1,o.data=l,u.fire("ClearUndos")},hasUndo:function(){return 0<c||o.typing&&l[0]&&!rh.isEq(rh.createFromEditor(u),l[0])},hasRedo:function(){return c<l.length-1&&!o.typing},transact:function(e){return n(),o.beforeChange(),o.ignore(e),o.add()},ignore:function(e){try{t++,e()}finally{t--}},extra:function(e,t){var n,r;o.transact(e)&&(r=l[c].bookmark,n=l[c-1],rh.applyToEditor(u,n,!0),o.
transact(t)&&(l[c-1].beforeBookmark=r))}}}var ih,ah,uh=function(e){return e&&/^(IMG)$/.test(e.nodeName)},sh=function(e){return e&&3===e.nodeType&&/^([\t \r\n]+|)$/.test(e.nodeValue)},ch=function(e,t,n){return"color"!==n&&"backgroundColor"!==n||(t=e.toHex(t)),"fontWeight"===n&&700===t&&(t="bold"),"fontFamily"===n&&(t=t.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),""+t},lh={isInlineBlock:uh,moveStart:function(e,t,n){var r,o,i,a=n.startOffset,u=n.startContainer;if((n.startContainer!==n.endContainer||!uh(n.startContainer.childNodes[n.startOffset]))&&1===u.nodeType)for(a<(i=u.childNodes).length?r=new no(u=i[a],e.getParent(u,e.isBlock)):(r=new no(u=i[i.length-1],e.getParent(u,e.isBlock))).next(!0),o=r.current();o;o=r.next())if(3===o.nodeType&&!sh(o))return n.setStart(o,0),void t.setRng(n)},getNonWhiteSpaceSibling:function(e,
t,n){if(e)for(t=t?"nextSibling":"previousSibling",e=n?e:e[t];e;e=e[t])if(1===e.nodeType||!sh(e))return e},isTextBlock:function(e,t){return t.nodeType&&(t=t.nodeName),!!e.schema.getTextBlockElements()[t.toLowerCase()]},isValid:function(e,t,n){return e.schema.isValidChild(t,n)},isWhiteSpaceNode:sh,replaceVars:function(e,n){return"string"!=typeof e?e=e(n):n&&(e=e.replace(/%(\w+)/g,function(e,t){return n[t]||e})),e},isEq:function(e,t){return t=t||"",e=""+((e=e||"").nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()===t.toLowerCase()},normalizeStyleValue:ch,getStyle:function(e,t,n){return ch(e,e.getStyle(t,n),n)},getTextDecoration:function(t,e){var n;return t.getParent(e,function(e){return(n=t.getStyle(e,"text-decoration"))&&"none"!==n}),n},getParents:function(e,t,n){return e.getParents(t,n,e.getRoot())}},fh=Bc.isBookmarkNode,dh=lh.getParents,mh=lh.isWhiteSpaceNode,ph=lh.isTex
tBlock,gh=function(e,t){for(void 0===t&&(t=3===e.nodeType?e.length:e.childNodes.length);e&&e.hasChildNodes();)(e=e.childNodes[t])&&(t=3===e.nodeType?e.length:e.childNodes.length);return{node:e,offset:t}},hh=function(e,t){for(var n=t;n;){if(1===n.nodeType&&e.getContentEditable(n))return"false"===e.getContentEditable(n)?n:t;n=n.parentNode}return t},vh=function(e,t,n,r){var o,i,a=n.nodeValue;return void 0===r&&(r=e?a.length:0),e?(o=a.lastIndexOf(" ",r),-1===(o=(i=a.lastIndexOf("\xa0",r))<o?o:i)||t||o++):(o=a.indexOf(" ",r),i=a.indexOf("\xa0",r),o=-1!==o&&(-1===i||o<i)?o:i),o},yh=function(e,t,n,r,o,i){var a,u,s,c;if(3===n.nodeType){if(-1!==(s=vh(o,i,n,r)))return{container:n,offset:s};c=n}for(a=new no(n,e.getParent(n,e.isBlock)||t);u=a[o?"prev":"next"]();)if(3===u.nodeType){if(-1!==(s=vh(o,i,c=u)))return{container:u,offset:s}}else if(e.isBlock(u))break;if(c)return{c
ontainer:c,offset:r=o?0:c.length}},bh=function(e,t,n,r,o){var i,a,u,s;for(3===r.nodeType&&0===r.nodeValue.length&&r[o]&&(r=r[o]),i=dh(e,r),a=0;a<i.length;a++)for(u=0;u<t.length;u++)if(!("collapsed"in(s=t[u])&&s.collapsed!==n.collapsed)&&e.is(i[a],s.selector))return i[a];return r},Ch=function(t,e,n,r){var o,i=t.dom,a=i.getRoot();if(e[0].wrapper||(o=i.getParent(n,e[0].block,a)),!o){var u=i.getParent(n,"LI,TD,TH");o=i.getParent(3===n.nodeType?n.parentNode:n,function(e){return e!==a&&ph(t,e)},u)}if(o&&e[0].wrapper&&(o=dh(i,o,"ul,ol").reverse()[0]||o),!o)for(o=n;o[r]&&!i.isBlock(o[r])&&(o=o[r],!lh.isEq(o,"br")););return o||n},xh=function(e,t,n,r,o,i,a){var u,s,c,l,f,d;if(u=s=a?n:o,l=a?"previousSibling":"nextSibling",f=e.getRoot(),3===u.nodeType&&!mh(u)&&(a?0<r:i<u.nodeValue.length))return u;for(;;){if(!t[0].block_expand&am
p;&e.isBlock(s))return s;for(c=s[l];c;c=c[l])if(!fh(c)&&!mh(c)&&("BR"!==(d=c).nodeName||!d.getAttribute("data-mce-bogus")||d.nextSibling))return s;if(s===f||s.parentNode===f){u=s;break}s=s.parentNode}return u},wh=function(e,t,n,r){var o,i=t.startContainer,a=t.startOffset,u=t.endContainer,s=t.endOffset,c=e.dom;return 1===i.nodeType&&i.hasChildNodes()&&3===(i=na(i,a)).nodeType&&(a=0),1===u.nodeType&&u.hasChildNodes()&&3===(u=na(u,t.collapsed?s:s-1)).nodeType&&(s=u.nodeValue.length),i=hh(c,i),u=hh(c,u),(fh(i.parentNode)||fh(i))&&3===(i=(i=fh(i)?i:i.parentNode).nextSibling||i).nodeType&&(a=0),(fh(u.parentNode)||fh(u))&&3===(u=(u=fh(u)?u:u.parentNode).previousSibling||u).nodeType&&(s=u.length),n[0].inline&&(t.collapsed&&((o=yh(c,e.getBody(),i,a,!0,r))&&(i=o.container,a=o.offset),(o=yh(c,e.getBody(),u,s,!1,r))&&(u=o.container,s=o.offset)),
u=r?u:function(e,t){var n=gh(e,t);if(n.node){for(;n.node&&0===n.offset&&n.node.previousSibling;)n=gh(n.node.previousSibling);n.node&&0<n.offset&&3===n.node.nodeType&&" "===n.node.nodeValue.charAt(n.offset-1)&&1<n.offset&&(e=n.node).splitText(n.offset-1)}return e}(u,s)),(n[0].inline||n[0].block_expand)&&(n[0].inline&&3===i.nodeType&&0!==a||(i=xh(c,n,i,a,u,s,!0)),n[0].inline&&3===u.nodeType&&s!==u.nodeValue.length||(u=xh(c,n,i,a,u,s,!1))),n[0].selector&&!1!==n[0].expand&&!n[0].inline&&(i=bh(c,n,t,i,"previousSibling"),u=bh(c,n,t,u,"nextSibling")),(n[0].block||n[0].selector)&&(i=Ch(e,n,i,"previousSibling"),u=Ch(e,n,u,"nextSibling"),n[0].block&&(c.isBlock(i)||(i=xh(c,n,i,a,u,s,!0)),c.isBlock(u)||(u=xh(c,n,i,a,u,s,!1)))),1===i.nodeType&&(a=c.nodeIndex(i),i=i.parentNode),1===u.nodeType&&am
p;(s=c.nodeIndex(u)+1,u=u.parentNode),{startContainer:i,startOffset:a,endContainer:u,endOffset:s}},Nh=lh.isEq,Eh=function(e,t,n){var r=e.formatter.get(n);if(r)for(var o=0;o<r.length;o++)if(!1===r[o].inherit&&e.dom.is(t,r[o].selector))return!0;return!1},Sh=function(t,e,n,r){var o=t.dom.getRoot();return e!==o&&(e=t.dom.getParent(e,function(e){return!!Eh(t,e,n)||e.parentNode===o||!!Ah(t,e,n,r,!0)}),Ah(t,e,n,r))},kh=function(e,t,n){return!!Nh(t,n.inline)||!!Nh(t,n.block)||(n.selector?1===t.nodeType&&e.is(t,n.selector):void 0)},Th=function(e,t,n,r,o,i){var a,u,s,c=n[r];if(n.onmatch)return n.onmatch(t,n,r);if(c)if("undefined"==typeof c.length){for(a in c)if(c.hasOwnProperty(a)){if(u="attributes"===r?e.getAttrib(t,a):lh.getStyle(e,t,a),o&&!u&&!n.exact)return;if((!o||n.exact)&&!Nh(u,lh.normalizeStyleValue(e,lh.replaceVars(c[a],i),a)))return}}else for(s=0;s<c.length;s++)if("attributes"===r?e.getAttrib(t,c[s])
:lh.getStyle(e,t,c[s]))return n;return n},Ah=function(e,t,n,r,o){var i,a,u,s,c=e.formatter.get(n),l=e.dom;if(c&&t)for(a=0;a<c.length;a++)if(i=c[a],kh(e.dom,t,i)&&Th(l,t,i,"attributes",o,r)&&Th(l,t,i,"styles",o,r)){if(s=i.classes)for(u=0;u<s.length;u++)if(!e.dom.hasClass(t,s[u]))return;return i}},Rh={matchNode:Ah,matchName:kh,match:function(e,t,n,r){var o;return r?Sh(e,r,t,n):(r=e.selection.getNode(),!!Sh(e,r,t,n)||!((o=e.selection.getStart())===r||!Sh(e,o,t,n)))},matchAll:function(r,o,i){var e,a=[],u={};return e=r.selection.getStart(),r.dom.getParent(e,function(e){var t,n;for(t=0;t<o.length;t++)n=o[t],!u[n]&&Ah(r,e,n,i)&&(u[n]=!0,a.push(n))},r.dom.getRoot()),a},canApply:function(e,t){var n,r,o,i,a,u=e.formatter.get(t),s=e.dom;if(u)for(n=e.selection.getStart(),r=lh.getParents(s,n),i=u.length-1;0<=i;i--){if(!(a=u[i].selector)||u[i].defaultBlock)return!0;for(o=r.length-1;0<=o;o--)if(s.is(r[o],a))return!0}return!
1},matchesUnInheritedFormatSelector:Eh},Bh=function(e,t){return e.splitText(t)},_h={split:function(e){var t=e.startContainer,n=e.startOffset,r=e.endContainer,o=e.endOffset;return t===r&&Ao.isText(t)?0<n&&n<t.nodeValue.length&&(t=(r=Bh(t,n)).previousSibling,n<o?(t=r=Bh(r,o-=n).previousSibling,o=r.nodeValue.length,n=0):o=0):(Ao.isText(t)&&0<n&&n<t.nodeValue.length&&(t=Bh(t,n),n=0),Ao.isText(r)&&0<o&&o<r.nodeValue.length&&(o=(r=Bh(r,o).previousSibling).nodeValue.length)),{startContainer:t,startOffset:n,endContainer:r,endOffset:o}}},Dh=Ei,Oh="_mce_caret",Ph=function(e){return 0<function(e){for(var t=[];e;){if(3===e.nodeType&&e.nodeValue!==Dh||1<e.childNodes.length)return[];1===e.nodeType&&t.push(e),e=e.firstChild}return t}(e).length},Lh=function(e){var t;if(e)for(e=(t=new no(e,e)).current();e;e=t.next())if(3===e.nodeType)return e;return null},Ih=function(e){var t=
qn.fromTag("span");return cr.setAll(t,{id:Oh,"data-mce-bogus":"1","data-mce-type":"format-caret"}),e&&Fu.append(t,qn.fromText(Dh)),t},Mh=function(e,t,n,r){var o,i,a,u;o=t.getRng(!0),i=e.getParent(n,e.isBlock),Ph(n)?(!1!==r&&(o.setStartBefore(n),o.setEndBefore(n)),e.remove(n)):((u=Lh(n))&&u.nodeValue.charAt(0)===Dh&&u.deleteData(0,1),a=u,o.startContainer===a&&0<o.startOffset&&o.setStart(a,o.startOffset-1),o.endContainer===a&&0<o.endOffset&&o.setEnd(a,o.endOffset-1),e.remove(n,!0)),i&&e.isEmpty(i)&&Uc(qn.fromDom(i)),t.setRng(o)},Fh=function(e,t,n,r,o){if(r)Mh(t,n,r,o);else if(!(r=wc(e,n.getStart())))for(;r=t.get(Oh);)Mh(t,n,r,!1)},zh=function(e,t,n){var r=e.dom,o=r.getParent(n,ua.curry(lh.isTextBlock,e));o&&r.isEmpty(o)?n.parentNode.replaceChild(t,n):(zc(qn.fromDom(n)),r.isEmpty(n)?n.parentNode.replaceChild(t,n):r.insertAfter(t,n))},Uh=functio
n(e,t){return e.appendChild(t),t},qh=function(e,t){var n=H.foldr(e,function(e,t){return Uh(e,t.cloneNode(!1))},t);return Uh(n,n.ownerDocument.createTextNode(Dh))},Vh=function(e){var i=e.dom,a=e.selection,u=e.getBody();e.on("mouseup keydown",function(e){var t,n,r,o;t=u,n=i,r=a,o=e.keyCode,Fh(t,n,r,null,!1),8===o&&r.isCollapsed()&&r.getStart().innerHTML===Dh&&Fh(t,n,r,wc(t,r.getStart())),37!==o&&39!==o||Fh(t,n,r,wc(t,r.getStart()))})},Hh=function(e,t){return e.schema.getTextInlineElements().hasOwnProperty(Qn.name(t))&&!xc(t.dom())&&!Ao.isBogus(t.dom())},jh={},$h=Bt.filter,Wh=Bt.each;ah=function(e){var t,n,r=e.selection.getRng();t=Ao.matchNodeNames("pre"),r.collapsed||(n=e.selection.getSelectedBlocks(),Wh($h($h(n,t),function(e){return t(e.previousSibling)&&-1!==Bt.indexOf(n,e.previousSibling)}),function(e){var t,n;t=e.previousSibling,en(n=e).remove(),en(t).append("<br><br>").append(n.child
Nodes)}))},jh[ih="pre"]||(jh[ih]=[]),jh[ih].push(ah);var Kh=function(e,t){Wh(jh[e],function(e){e(t)})},Xh=Lt.each,Yh={walk:function(e,t,o){var n,r,i,a,u,s,c,l=t.startContainer,f=t.startOffset,d=t.endContainer,m=t.endOffset;if(0<(c=e.select("td[data-mce-selected],th[data-mce-selected]")).length)Xh(c,function(e){o([e])});else{var p,g,h,v=function(e){var t;return 3===(t=e[0]).nodeType&&t===l&&f>=t.nodeValue.length&&e.splice(0,1),t=e[e.length-1],0===m&&0<e.length&&t===d&&3===t.nodeType&&e.splice(e.length-1,1),e},y=function(e,t,n){for(var r=[];e&&e!==n;e=e[t])r.push(e);return r},b=function(e,t){do{if(e.parentNode===t)return e;e=e.parentNode}while(e)},C=function(e,t,n){var r=n?"nextSibling":"previousSibling";for(u=(a=e).parentNode;a&&a!==t;a=u)u=a.parentNode,(s=y(a===e?a:a[r],r)).length&&(n||s.reverse(),o(v(s)))};if(1===l.nodeType&&l.hasChildNodes()&
&(l=l.childNodes[f]),1===d.nodeType&&d.hasChildNodes()&&(g=m,h=(p=d).childNodes,--g>h.length-1?g=h.length-1:g<0&&(g=0),d=h[g]||p),l===d)return o(v([l]));for(n=e.findCommonAncestor(l,d),a=l;a;a=a.parentNode){if(a===d)return C(l,n,!0);if(a===n)break}for(a=d;a;a=a.parentNode){if(a===l)return C(d,n);if(a===n)break}r=b(l,n)||l,i=b(d,n)||d,C(l,r,!0),(s=y(r===l?r:r.nextSibling,"nextSibling",i===d?i.nextSibling:i)).length&&o(v(s)),C(d,i)}}},Gh=/^(src|href|style)$/,Jh=Lt.each,Qh=lh.isEq,Zh=function(e){return/^(TH|TD)$/.test(e.nodeName)},ev=function(e,t,n){var r,o,i;return r=t[n?"startContainer":"endContainer"],o=t[n?"startOffset":"endOffset"],Ao.isElement(r)&&(i=r.childNodes.length-1,!n&&o&&o--,r=r.childNodes[i<o?i:o]),Ao.isText(r)&&n&&o>=r.nodeValue.length&&(r=new no(r,e.getBody()).next()||r),Ao.isText(r)&&!n&&0===o&&(r=new
no(r,e.getBody()).prev()||r),r},tv=function(e,t,n,r){var o=e.create(n,r);return t.parentNode.insertBefore(o,t),o.appendChild(t),o},nv=function(e,t,n,r){return!(t=lh.getNonWhiteSpaceSibling(t,n,r))||"BR"===t.nodeName||e.isBlock(t)},rv=function(e,n,r,o,i){var t,a,u,s,c,l,f,d,m,p,g,h,v,y,b=e.dom;if(c=b,!(Qh(l=o,(f=n).inline)||Qh(l,f.block)||(f.selector?Ao.isElement(l)&&c.is(l,f.selector):void 0)||(s=o,n.links&&"A"===s.tagName)))return!1;if("all"!==n.remove)for(Jh(n.styles,function(e,t){e=lh.normalizeStyleValue(b,lh.replaceVars(e,r),t),"number"==typeof t&&(t=e,i=0),(n.remove_similar||!i||Qh(lh.getStyle(b,i,t),e))&&b.setStyle(o,t,""),u=1}),u&&""===b.getAttrib(o,"style")&&(o.removeAttribute("style"),o.removeAttribute("data-mce-style")),Jh(n.attributes,function(e,t){var n;if(e=lh.replaceVars(e,r),"number"==typeof t&&(t=e,i=0),!i||Qh(b.
getAttrib(i,t),e)){if("class"===t&&(e=b.getAttrib(o,t))&&(n="",Jh(e.split(/\s+/),function(e){/mce\-\w+/.test(e)&&(n+=(n?" ":"")+e)}),n))return void b.setAttrib(o,t,n);"class"===t&&o.removeAttribute("className"),Gh.test(t)&&o.removeAttribute("data-mce-"+t),o.removeAttribute(t)}}),Jh(n.classes,function(e){e=lh.replaceVars(e,r),i&&!b.hasClass(i,e)||b.removeClass(o,e)}),a=b.getAttribs(o),t=0;t<a.length;t++){var C=a[t].nodeName;if(0!==C.indexOf("_")&&0!==C.indexOf("data-"))return!1}return"none"!==n.remove?(d=e,p=n,h=(m=o).parentNode,v=d.dom,y=d.settings.forced_root_block,p.block&&(y?h===v.getRoot()&&(p.list_block&&Qh(m,p.list_block)||Jh(Lt.grep(m.childNodes),function(e){lh.isValid(d,y,e.nodeName.toLowerCase())?g?g.appendChild(e):(g=tv(v,e,y),v.setAttribs(g,d.settings.forced_root_block_attrs)):g=0})):v.isBloc
k(m)&&!v.isBlock(h)&&(nv(v,m,!1)||nv(v,m.firstChild,!0,1)||m.insertBefore(v.create("br"),m.firstChild),nv(v,m,!0)||nv(v,m.lastChild,!1,1)||m.appendChild(v.create("br")))),p.selector&&p.inline&&!Qh(p.inline,m)||v.remove(m,1),!0):void 0},ov={removeFormat:rv,remove:function(s,c,l,e,f){var t,n,d=s.formatter.get(c),m=d[0],a=!0,u=s.dom,r=s.selection,o=function(e){var n,t,r,o,i,a,u=(n=s,t=e,r=c,o=l,i=f,Jh(lh.getParents(n.dom,t.parentNode).reverse(),function(e){var t;a||"_start"===e.id||"_end"===e.id||(t=Rh.matchNode(n,e,r,o,i))&&!1!==t.split&&(a=e)}),a);return function(e,t,n,r,o,i,a,u){var s,c,l,f,d,m,p=e.dom;if(n){for(m=n.parentNode,s=r.parentNode;s&&s!==m;s=s.parentNode){for(c=p.clone(s,!1),d=0;d<t.length;d++)if(rv(e,t[d],u,c,c)){c=0;break}c&&(l&&c.appendChild(l),f||(f=c),l=c)}!i||a.mixed&&p.isBlock(n)||(r=p.split(n,r)),l&&(o.parentNode.insertBefore(l,o),f.ap
pendChild(o))}return r}(s,d,u,e,e,!0,m,l)},p=function(e){var t,n,r,o,i;if(Ao.isElement(e)&&u.getContentEditable(e)&&(o=a,a="true"===u.getContentEditable(e),i=!0),t=Lt.grep(e.childNodes),a&&!i)for(n=0,r=d.length;n<r&&!rv(s,d[n],l,e,e);n++);if(m.deep&&t.length){for(n=0,r=t.length;n<r;n++)p(t[n]);i&&(a=o)}},i=function(e){var t=u.get(e?"_start":"_end"),n=t[e?"firstChild":"lastChild"];return Bc.isBookmarkNode(n)&&(n=n[e?"firstChild":"lastChild"]),Ao.isText(n)&&0===n.data.length&&(n=e?t.previousSibling||t.nextSibling:t.nextSibling||t.previousSibling),u.remove(t,!0),n},g=function(e){var t,n,r=e.commonAncestorContainer;if(e=wh(s,e,d,!0),m.split){if((t=ev(s,e,!0))!==(n=ev(s,e))){if(/^(TR|TH|TD)$/.test(t.nodeName)&&t.firstChild&&(t="TR"===t.nodeName?t.firstChild.firstChild||t:t.firstChild||t),r&&/^T(HEAD|BODY|FOOT
|R)$/.test(r.nodeName)&&Zh(n)&&n.firstChild&&(n=n.firstChild||n),u.isChildOf(t,n)&&t!==n&&!u.isBlock(n)&&!Zh(t)&&!Zh(n))return t=tv(u,t,"span",{id:"_start","data-mce-type":"bookmark"}),o(t),void(t=i(!0));t=tv(u,t,"span",{id:"_start","data-mce-type":"bookmark"}),n=tv(u,n,"span",{id:"_end","data-mce-type":"bookmark"}),o(t),o(n),t=i(!0),n=i()}else t=n=o(t);e.startContainer=t.parentNode?t.parentNode:t,e.startOffset=u.nodeIndex(t),e.endContainer=n.parentNode?n.parentNode:n,e.endOffset=u.nodeIndex(n)+1}Yh.walk(u,e,function(e){Jh(e,function(e){p(e),Ao.isElement(e)&&"underline"===s.dom.getStyle(e,"text-decoration")&&e.parentNode&&"underline"===lh.getTextDecoration(u,e.parentNode)&&rv(s,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:"u
nderline"}},null,e)})})};if(e)e.nodeType?((n=u.createRng()).setStartBefore(e),n.setEndAfter(e),g(n)):g(e);else if("false"!==u.getContentEditable(r.getNode()))r.isCollapsed()&&m.inline&&!u.select("td[data-mce-selected],th[data-mce-selected]").length?function(e,t,n,r){var o,i,a,u,s,c,l,f=e.dom,d=e.selection,m=[],p=d.getRng();for(o=p.startContainer,i=p.startOffset,3===(s=o).nodeType&&(i!==o.nodeValue.length&&(u=!0),s=s.parentNode);s;){if(Rh.matchNode(e,s,t,n,r)){c=s;break}s.nextSibling&&(u=!0),m.push(s),s=s.parentNode}if(c)if(u){a=d.getBookmark(),p.collapse(!0);var g=wh(e,p,e.formatter.get(t),!0);g=_h.split(g),e.formatter.remove(t,n,g),d.moveToBookmark(a)}else{l=wc(e.getBody(),c);var h=Ih(!1).dom(),v=qh(m,h);zh(e,h,l||c),Mh(f,d,l,!1),d.setCursorLocation(v,1),f.isEmpty(c)&&f.remove(c)}}(s,c,l,f):(t=bc.getPersistentBookmark(s.selection,!0),g(r.getRng()),r.moveToBookmark(t),m.inline&&Rh.match(s,c,l,r.getStart
())&&lh.moveStart(u,r,r.getRng()),s.nodeChanged());else{e=r.getNode();for(var h=0,v=d.length;h<v&&(!d[h].ceFalseOverride||!rv(s,d[h],l,e,e));h++);}}},iv=Lt.each,av=function(e){return e&&1===e.nodeType&&!Bc.isBookmarkNode(e)&&!xc(e)&&!Ao.isBogus(e)},uv=function(e,t){var n;for(n=e;n;n=n[t]){if(3===n.nodeType&&0!==n.nodeValue.length)return e;if(1===n.nodeType&&!Bc.isBookmarkNode(n))return n}return e},sv=function(e,t,n){var r,o,i=new Dc(e);if(t&&n&&(t=uv(t,"previousSibling"),n=uv(n,"nextSibling"),i.compare(t,n))){for(r=t.nextSibling;r&&r!==n;)r=(o=r).nextSibling,t.appendChild(o);return e.remove(n),Lt.each(Lt.grep(n.childNodes),function(e){t.appendChild(e)}),t}return n},cv=function(e,t,n){iv(e.childNodes,function(e){av(e)&&(t(e)&&n(e),e.hasChildNodes()&&cv(e,t,n))})},lv=function(n,e){return V.curry(function(e,t){return!(!t||!lh.getStyle(n,t,e))},e)},fv=fu
nction(r,e,t){return V.curry(function(e,t,n){r.setStyle(n,e,t),""===n.getAttribute("style")&&n.removeAttribute("style"),dv(r,n)},e,t)},dv=function(e,t){"SPAN"===t.nodeName&&0===e.getAttribs(t).length&&e.remove(t,!0)},mv=function(e,t){var n;1===t.nodeType&&t.parentNode&&1===t.parentNode.nodeType&&(n=lh.getTextDecoration(e,t.parentNode),e.getStyle(t,"color")&&n?e.setStyle(t,"text-decoration",n):e.getStyle(t,"text-decoration")===n&&e.setStyle(t,"text-decoration",null))},pv=function(n,e,r,o){iv(e,function(t){iv(n.dom.select(t.inline,o),function(e){av(e)&&ov.removeFormat(n,t,r,e,t.exact?e:null)}),function(r,e,t){if(e.clear_child_styles){var n=e.links?"*:not(a)":"*";iv(r.select(n,t),function(n){av(n)&&iv(e.styles,function(e,t){r.setStyle(n,t,"")})})}}(n.dom,t,o)})},gv=function(e,t,n,r){(t.styles.color|
|t.styles.textDecoration)&&(Lt.walk(r,V.curry(mv,e),"childNodes"),mv(e,r))},hv=function(e,t,n,r){t.styles&&t.styles.backgroundColor&&cv(r,lv(e,"fontSize"),fv(e,"backgroundColor",lh.replaceVars(t.styles.backgroundColor,n)))},vv=function(e,t,n,r){"sub"!==t.inline&&"sup"!==t.inline||(cv(r,lv(e,"fontSize"),fv(e,"fontSize","")),e.remove(e.select("sup"===t.inline?"sub":"sup",r),!0))},yv=function(e,t,n,r){r&&!1!==t.merge_siblings&&(r=sv(e,lh.getNonWhiteSpaceSibling(r),r),r=sv(e,r,lh.getNonWhiteSpaceSibling(r,!0)))},bv=function(t,n,r,o,i){Rh.matchNode(t,i.parentNode,r,o)&&ov.removeFormat(t,n,o,i)||n.merge_with_parents&&t.dom.getParent(i.parentNode,function(e){if(Rh.matchNode(t,e,r,o))return ov.removeFormat(t,n,o,i),!0})},Cv=Lt.each,xv=function(p,g,h,r){var e,t,v=p.formatter.get(g),y=v[0],o=!r&&p.selection.isColl
apsed(),i=p.dom,n=p.selection,b=function(n,e){if(e=e||y,n){if(e.onformat&&e.onformat(n,e,h,r),Cv(e.styles,function(e,t){i.setStyle(n,t,lh.replaceVars(e,h))}),e.styles){var t=i.getAttrib(n,"style");t&&n.setAttribute("data-mce-style",t)}Cv(e.attributes,function(e,t){i.setAttrib(n,t,lh.replaceVars(e,h))}),Cv(e.classes,function(e){e=lh.replaceVars(e,h),i.hasClass(n,e)||i.addClass(n,e)})}},C=function(e,t){var n=!1;return!!y.selector&&(Cv(e,function(e){if(!("collapsed"in e&&e.collapsed!==o))return i.is(t,e.selector)&&!xc(t)?(b(t,e),!(n=!0)):void 0}),n)},a=function(s,e,t,c){var l,f,d=[],m=!0;l=y.inline||y.block,f=s.create(l),b(f),Yh.walk(s,e,function(e){var a,u=function(e){var t,n,r,o;if(o=m,t=e.nodeName.toLowerCase(),n=e.parentNode.nodeName.toLowerCase(),1===e.nodeType&&s.getContentEditable(e)&&(o=m,m="true"===s.getContentEditable(e),r=!0),lh.isEq(t,"br"))return a=0,void(y.block&&
amp;s.remove(e));if(y.wrapper&&Rh.matchNode(p,e,g,h))a=0;else{if(m&&!r&&y.block&&!y.wrapper&&lh.isTextBlock(p,t)&&lh.isValid(p,n,l))return e=s.rename(e,l),b(e),d.push(e),void(a=0);if(y.selector){var i=C(v,e);if(!y.inline||i)return void(a=0)}!m||r||!lh.isValid(p,l,t)||!lh.isValid(p,n,l)||!c&&3===e.nodeType&&1===e.nodeValue.length&&65279===e.nodeValue.charCodeAt(0)||xc(e)||y.inline&&s.isBlock(e)?(a=0,Cv(Lt.grep(e.childNodes),u),r&&(m=o),a=0):(a||(a=s.clone(f,!1),e.parentNode.insertBefore(a,e),d.push(a)),a.appendChild(e))}};Cv(e,u)}),!0===y.links&&Cv(d,function(e){var t=function(e){"A"===e.nodeName&&b(e,y),Cv(Lt.grep(e.childNodes),t)};t(e)}),Cv(d,function(e){var t,n,r,o,i,a=function(e){var n=!1;return Cv(e.childNodes,function(e){if((t=e)&&1===t.nodeType&&!Bc.isBookmarkNode(t)&&!xc(t)&&!Ao.isBogus(t))return n=e,!1;var t}),n};n=0,Cv(e.childNode
s,function(e){lh.isWhiteSpaceNode(e)||Bc.isBookmarkNode(e)||n++}),t=n,!(1<d.length)&&s.isBlock(e)||0!==t?(y.inline||y.wrapper)&&(y.exact||1!==t||((o=a(r=e))&&!Bc.isBookmarkNode(o)&&Rh.matchName(s,o,y)&&(i=s.clone(o,!1),b(i),s.replace(i,r,!0),s.remove(o,1)),e=i||r),pv(p,v,h,e),bv(p,y,g,h,e),hv(s,y,h,e),vv(s,y,h,e),yv(s,y,h,e)):s.remove(e,1)})};if("false"!==i.getContentEditable(n.getNode())){if(y){if(r)r.nodeType?C(v,r)||((t=i.createRng()).setStartBefore(r),t.setEndAfter(r),a(i,wh(p,t,v),0,!0)):a(i,r,0,!0);else if(o&&y.inline&&!i.select("td[data-mce-selected],th[data-mce-selected]").length)!function(e,t,n){var r,o,i,a,u,s,c=e.selection;a=(r=c.getRng(!0)).startOffset,s=r.startContainer.nodeValue,(o=wc(e.getBody(),c.getStart()))&&(i=Lh(o));var l,f,d=/[^\s\u00a0\u00ad\u200b\ufeff]/;s&&0<a&&a<s.length&&d.test(s.charAt(a))&&d.test(s.charAt(a-1))?(u=c.getBookmark(),r.
collapse(!0),r=wh(e,r,e.formatter.get(t)),r=_h.split(r),e.formatter.apply(t,n,r),c.moveToBookmark(u)):(o&&i.nodeValue===Dh||(l=e.getDoc(),f=Ih(!0).dom(),i=(o=l.importNode(f,!0)).firstChild,r.insertNode(o),a=1),e.formatter.apply(t,n,o),c.setCursorLocation(i,a))}(p,g,h);else{var u=p.selection.getNode();p.settings.forced_root_block||!v[0].defaultBlock||i.getParent(u,i.isBlock)||xv(p,v[0].defaultBlock),p.selection.setRng(Wc(p.selection.getRng())),e=bc.getPersistentBookmark(p.selection,!0),a(i,wh(p,n.getRng(),v)),y.styles&&gv(i,y,h,u),n.moveToBookmark(e),lh.moveStart(i,n,n.getRng()),p.nodeChanged()}Kh(g,p)}}else{r=n.getNode();for(var s=0,c=v.length;s<c;s++)if(v[s].ceFalseOverride&&i.is(r,v[s].selector))return void b(r,v[s])}},wv={applyFormat:xv},Nv=Lt.each,Ev={formatChanged:function(e,t,n,r,o){var i,a,u,s,c,l,f,d;null===t.get()&&(a=e,u={},(i=t).set({}),a.on("NodeChange",function(n){var r=lh.getParents(a.dom,n.element),o={};r=Lt.grep(r,function
(e){return 1===e.nodeType&&!e.getAttribute("data-mce-bogus")}),Nv(i.get(),function(e,n){Nv(r,function(t){return a.formatter.matchNode(t,n,{},e.similar)?(u[n]||(Nv(e,function(e){e(!0,{node:t,format:n,parents:r})}),u[n]=e),o[n]=e,!1):!Rh.matchesUnInheritedFormatSelector(a,t,n)&&void 0})}),Nv(u,function(e,t){o[t]||(delete u[t],Nv(e,function(e){e(!1,{node:n.element,format:t,parents:r})}))})})),c=n,l=r,f=o,d=(s=t).get(),Nv(c.split(","),function(e){d[e]||(d[e]=[],d[e].similar=f),d[e].push(l)}),s.set(d)}},Sv={get:function(r){var t={valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure.image",collapsed:!1,classes:"align-left",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h
1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"left"},inherit:!1,preview:!1,defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"left"},preview:"font-family font-size"}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"center"},inherit:!1,preview:"font-family font-size",defaultBlock:"div"},{selector:"figure.image",collapsed:!1,classes:"align-center",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"img",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"},preview:"font-family font-size"}],alignright:[{selector:"figure.image",collapsed:!1,classes:"align-right&quo
t;,ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"right"},inherit:!1,preview:"font-family font-size",defaultBlock:"div"},{selector:"img,table",collapsed:!1,styles:{"float":"right"},preview:"font-family font-size"}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li",styles:{textAlign:"justify"},inherit:!1,defaultBlock:"div",preview:"font-family font-size"}],bold:[{inline:"strong",remove:"all"},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all"}],italic:[{inline:"em",remove:"all"},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all"}],underline:[{inline:"span",styles:{textDecoration:"u
nderline"},exact:!0},{inline:"u",remove:"all"}],strikethrough:[{inline:"span",styles:{textDecoration:"line-through"},exact:!0},{inline:"strike",remove:"all"}],forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},fontname:{inline:"span",toggle:!1,styles:{fontFamily:"%value"},clear_child_styles:!0},fontsize:{inline:"span",toggle:!1,styles:{fontSize:"%value"},clear_child_styles:!0},fontsize_class:{inline:"span",attributes:{"class":"%value"}},blockquote:{block:"blockquote",wrapper:1,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},code:{inline:"code"},link:{inline:"a",selector:"a&
quot;,remove:"all",split:!0,deep:!0,onmatch:function(){return!0},onformat:function(n,e,t){Lt.each(t,function(e,t){r.setAttrib(n,t,e)})}},removeformat:[{selector:"b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]};return Lt.each("p h1 h2 h3 h4 h5 h6 div address pre div dt dd samp".split(/\s/),function(e){t[e]={block:e,remove:"all"}}),t}},kv=Lt.each,Tv=di.DOM,Av=function(e,t){var n,o,r,m=t&&t.schema||Zo({}),p=function(e){var t,n,r;return o="string"==typeof e?{name:e,classes:[],attrs:{}}:e,t=Tv.create(o.name),n=t,(r=o).classes.length&&Tv.addClass(n,r.classes.join(" ")),Tv.setAttribs(n,r.att
rs),t},g=function(n,e,t){var r,o,i,a,u,s,c,l,f=0<e.length&&e[0],d=f&&f.name;if(u=d,s="string"!=typeof(a=n)?a.nodeName.toLowerCase():a,c=m.getElementRule(s),i=!(!(l=c&&c.parentsRequired)||!l.length)&&(u&&-1!==Lt.inArray(l,u)?u:l[0]))d===i?(o=e[0],e=e.slice(1)):o=i;else if(f)o=e[0],e=e.slice(1);else if(!t)return n;return o&&(r=p(o)).appendChild(n),t&&(r||(r=Tv.create("div")).appendChild(n),Lt.each(t,function(e){var t=p(e);r.insertBefore(t,n)})),g(r,e,o&&o.siblings)};return e&&e.length?(o=e[0],n=p(o),(r=Tv.create("div")).appendChild(g(n,e.slice(1),o.siblings)),r):""},Rv=function(e){var t,a={classes:[],attrs:{}};return"*"!==(e=a.selector=Lt.trim(e))&&(t=e.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,function(e,t,n,r,o){switch(t){case"#":a.attrs.id=n;break;case".":a.classes.push(n);break;case":":-1!==Lt.inArray("che
cked disabled enabled read-only required".split(" "),n)&&(a.attrs[n]=n)}if("["===r){var i=o.match(/([\w\-]+)(?:\=\"([^\"]+))?/);i&&(a.attrs[i[1]]=i[2])}return""})),a.name=t||"div",a},Bv=function(e){return e&&"string"==typeof e?(e=(e=e.split(/\s*,\s*/)[0]).replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),Lt.map(e.split(/(?:>|\s+(?![^\[\]]+\]))/),function(e){var t=Lt.map(e.split(/(?:~\+|~|\+)/),Rv),n=t.pop();return t.length&&(n.siblings=t),n}).reverse()):[]},_v={getCssText:function(n,e){var t,r,o,i,a,u,s="";if(!1===(u=n.settings.preview_styles))return"";"string"!=typeof u&&(u="font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow");var c=function(e){return e.replace(/%(\w+)/g,"")};if("string"==typeof e){if(!(e=n.formatter.get(e)))retur
n;e=e[0]}return"preview"in e&&!1===(u=e.preview)?"":(t=e.block||e.inline||"span",(i=Bv(e.selector)).length?(i[0].name||(i[0].name=t),t=e.selector,r=Av(i,n)):r=Av([t],n),o=Tv.select(t,r)[0]||r.firstChild,kv(e.styles,function(e,t){(e=c(e))&&Tv.setStyle(o,t,e)}),kv(e.attributes,function(e,t){(e=c(e))&&Tv.setAttrib(o,t,e)}),kv(e.classes,function(e){e=c(e),Tv.hasClass(o,e)||Tv.addClass(o,e)}),n.fire("PreviewFormats"),Tv.setStyles(r,{position:"absolute",left:-65535}),n.getBody().appendChild(r),a=Tv.getStyle(n.getBody(),"fontSize",!0),a=/px$/.test(a)?parseInt(a,10):0,kv(u.split(" "),function(e){var t=Tv.getStyle(o,e,!0);if(!("background-color"===e&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)&&(t=Tv.getStyle(n.getBody(),e,!0),"#ffffff"===Tv.toHex(t).toLowerCase())||"color"===e&&"#000000"===Tv.toHex(t).toLowerCase())){if("font-size
"===e&&/em|%$/.test(t)){if(0===a)return;t=parseFloat(t)/(/%$/.test(t)?100:1)*a+"px"}"border"===e&&t&&(s+="padding:0 2px;"),s+=e+":"+t+";"}}),n.fire("AfterPreviewFormats"),Tv.remove(r),s)},parseSelector:Bv,selectorToHtml:function(e,t){return Av(Bv(e),t)}},Dv={toggle:function(e,t,n,r,o){var i=t.get(n);!Rh.match(e,n,r,o)||"toggle"in i[0]&&!i[0].toggle?wv.applyFormat(e,n,r,o):ov.remove(e,n,r,o)}},Ov={setup:function(e){e.addShortcut("meta+b","","Bold"),e.addShortcut("meta+i","","Italic"),e.addShortcut("meta+u","","Underline");for(var t=1;t<=6;t++)e.addShortcut("access+"+t,"",["FormatBlock",!1,"h"+t]);e.addShortcut("access+7","",["FormatBlock",!1,"p"]),e.addShortcut("access+8","",["FormatB
lock",!1,"div"]),e.addShortcut("access+9","",["FormatBlock",!1,"address"])}};function Pv(e){var t,n,r,o=(t=e,n={},(r=function(e,t){e&&("string"!=typeof e?Lt.each(e,function(e,t){r(t,e)}):(t=t.length?t:[t],Lt.each(t,function(e){"undefined"==typeof e.deep&&(e.deep=!e.selector),"undefined"==typeof e.split&&(e.split=!e.selector||e.inline),"undefined"==typeof e.remove&&e.selector&&!e.inline&&(e.remove="none"),e.selector&&e.inline&&(e.mixed=!0,e.block_expand=!0),"string"==typeof e.classes&&(e.classes=e.classes.split(/\s+/))}),n[e]=t))})(Sv.get(t.dom)),r(t.settings.formats),{get:function(e){return e?n[e]:n},register:r,unregister:function(e){return e&&n[e]&&delete n[e],n}}),i=Ju(null);return Ov.setup(e),Vh(e),{get:o.get,register:o.register,unregister:o.unregister,apply:V.curry(wv.applyFormat
,e),remove:V.curry(ov.remove,e),toggle:V.curry(Dv.toggle,e,o),match:V.curry(Rh.match,e),matchAll:V.curry(Rh.matchAll,e),matchNode:V.curry(Rh.matchNode,e),canApply:V.curry(Rh.canApply,e),formatChanged:V.curry(Ev.formatChanged,e,i),getCssText:V.curry(_v.getCssText,e)}}var Lv=function(a){return function(){for(var e=new Array(arguments.length),t=0;t<e.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("Can't merge zero objects");for(var n={},r=0;r<e.length;r++){var o=e[r];for(var i in o)o.hasOwnProperty(i)&&(n[i]=a(n[i],o[i]))}return n}},Iv=Lv(function(e,t){return E.isObject(e)&&E.isObject(t)?Iv(e,t):t}),Mv=Lv(function(e,t){return t}),Fv={deepMerge:Iv,merge:Mv},zv=function(e,t){return e.fire("PreProcess",t)},Uv=function(e,t){return e.fire("PostProcess",t)},qv=function(e){return e.fire("remove")},Vv={register:function(t,s,c){t.addAttributeFilter("data-mce-tabindex",function(e,t){for(var n,r=e.length;r--;)(n
=e[r]).attr("tabindex",n.attributes.map["data-mce-tabindex"]),n.attr(t,null)}),t.addAttributeFilter("src,href,style",function(e,t){for(var n,r,o=e.length,i="data-mce-"+t,a=s.url_converter,u=s.url_converter_scope;o--;)(r=(n=e[o]).attributes.map[i])!==undefined?(n.attr(t,0<r.length?r:null),n.attr(i,null)):(r=n.attributes.map[t],"style"===t?r=c.serializeStyle(c.parseStyle(r),n.name):a&&(r=a.call(u,r,t,n.name)),n.attr(t,0<r.length?r:null))}),t.addAttributeFilter("class",function(e){for(var t,n,r=e.length;r--;)(n=(t=e[r]).attr("class"))&&(n=t.attr("class").replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),t.attr("class",0<n.length?n:null))}),t.addAttributeFilter("data-mce-type",function(e,t,n){for(var r,o=e.length;o--;)"bookmark"!==(r=e[o]).attributes.map["data-mce-type"]||n.cleanup||r.remove()}),t.addNodeFilter("noscript",function(e
){for(var t,n=e.length;n--;)(t=e[n].firstChild)&&(t.value=Vo.decode(t.value))}),t.addNodeFilter("script,style",function(e,t){for(var n,r,o,i=e.length,a=function(e){return e.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"")};i--;)r=(n=e[i]).firstChild?n.firstChild.value:"","script"===t?((o=n.attr("type"))&&n.attr("type","mce-no/type"===o?null:o.replace(/^mce\-/,"")),"xhtml"===s.element_format&&0<r.length&&(n.firstChild.value="// <![CDATA[\n"+a(r)+"\n// ]]>")):"xhtml"===s.eleme
nt_format&&0<r.length&&(n.firstChild.value="\x3c!--\n"+a(r)+"\n--\x3e")}),t.addNodeFilter("#comment",function(e){for(var t,n=e.length;n--;)0===(t=e[n]).value.indexOf("[CDATA[")?(t.name="#cdata",t.type=4,t.value=t.value.replace(/^\[CDATA\[|\]\]$/g,"")):0===t.value.indexOf("mce:protected ")&&(t.name="#text",t.type=3,t.raw=!0,t.value=unescape(t.value).substr(14))}),t.addNodeFilter("xml:namespace,input",function(e,t){for(var n,r=e.length;r--;)7===(n=e[r]).type?n.remove():1===n.type&&("input"!==t||"type"in n.attributes.map||n.attr("type","text"))}),t.addAttributeFilter("data-mce-type",function(e){H.each(e,function(e){"format-caret"===e.attr("data-mce-type")&&(e.isEmpty(t.schema.getNonEmptyElements())?e.remove():e.unwrap())})}),t.addAttributeFilter("data-mce-src,data-mce-href,data-mce
-style,data-mce-selected,data-mce-expando,data-mce-type,data-mce-resize",function(e,t){for(var n=e.length;n--;)e[n].attr(t,null)})},trimTrailingBr:function(e){var t,n,r=function(e){return e&&"br"===e.name};r(t=e.lastChild)&&r(n=t.prev)&&(t.remove(),n.remove())}},Hv={process:function(e,t,n){return f=n,(l=e)&&l.hasEventListeners("PreProcess")&&!f.no_events?(o=t,i=n,c=(r=e).dom,o=o.cloneNode(!0),(a=document.implementation).createHTMLDocument&&(u=a.createHTMLDocument(""),Lt.each("BODY"===o.nodeName?o.childNodes:[o],function(e){u.body.appendChild(u.importNode(e,!0))}),o="BODY"!==o.nodeName?u.body.firstChild:u.body,s=c.doc,c.doc=u),zv(r,Fv.merge(i,{node:o})),s&&(c.doc=s),o):t;var r,o,i,a,u,s,c,l,f}},jv=function(e,u,s){e.addNodeFilter("font",function(e){H.each(e,function(e){var t,n,r=u.parse(e.attr("style")),o=e.attr("color"),i=e.attr("face"
),a=e.attr("size");o&&(r.color=o),i&&(r["font-family"]=i),a&&(r["font-size"]=s[parseInt(e.attr("size"),10)-1]),e.name="span",e.attr("style",u.serialize(r)),t=e,n=["color","face","size"],H.each(n,function(e){t.attr(e,null)})})})},$v=function(e,t){var n,r=ti();t.convert_fonts_to_spans&&jv(e,r,Lt.explode(t.font_size_legacy_values)),n=r,e.addNodeFilter("strike",function(e){H.each(e,function(e){var t=n.parse(e.attr("style"));t["text-decoration"]="line-through",e.name="span",e.attr("style",n.serialize(t))})})},Wv={register:function(e,t){t.inline_styles&&$v(e,t)}},Kv=/^[ \t\r\n]*$/,Xv={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11},Yv=function(e,t,n){var r,o,i=n?"lastChild":"firstChild",a=n?
"prev":"next";if(e[i])return e[i];if(e!==t){if(r=e[a])return r;for(o=e.parent;o&&o!==t;o=o.parent)if(r=o[a])return r}},Gv=function(){function a(e,t){this.name=e,1===(this.type=t)&&(this.attributes=[],this.attributes.map={})}return a.create=function(e,t){var n,r;if(n=new a(e,Xv[e]||1),t)for(r in t)n.attr(r,t[r]);return n},a.prototype.replace=function(e){return e.parent&&e.remove(),this.insert(e,this),this.remove(),this},a.prototype.attr=function(e,t){var n,r;if("string"!=typeof e){for(r in e)this.attr(r,e[r]);return this}if(n=this.attributes){if(t!==undefined){if(null===t){if(e in n.map)for(delete n.map[e],r=n.length;r--;)if(n[r].name===e)return n=n.splice(r,1),this;return this}if(e in n.map){for(r=n.length;r--;)if(n[r].name===e){n[r].value=t;break}}else n.push({name:e,value:t});return n.map[e]=t,this}return n.map[e]}},a.prototype.clone=function(){var e,t,n,r,o,i=new a(this.name,this.type);if(n=this.attributes){for((o=[]).map={},e
=0,t=n.length;e<t;e++)"id"!==(r=n[e]).name&&(o[o.length]={name:r.name,value:r.value},o.map[r.name]=r.value);i.attributes=o}return i.value=this.value,i.shortEnded=this.shortEnded,i},a.prototype.wrap=function(e){return this.parent.insert(e,this),e.append(this),this},a.prototype.unwrap=function(){var e,t;for(e=this.firstChild;e;)t=e.next,this.insert(e,this,!0),e=t;this.remove()},a.prototype.remove=function(){var e=this.parent,t=this.next,n=this.prev;return e&&(e.firstChild===this?(e.firstChild=t)&&(t.prev=null):n.next=t,e.lastChild===this?(e.lastChild=n)&&(n.next=null):t.prev=n,this.parent=this.next=this.prev=null),this},a.prototype.append=function(e){var t;return e.parent&&e.remove(),(t=this.lastChild)?((t.next=e).prev=t,this.lastChild=e):this.lastChild=this.firstChild=e,e.parent=this,e},a.prototype.insert=function(e,t,n){var r;return e.parent&&e.remove(),r=t.parent||this,n?(t===r.firstChild?r.firstChild=e:t.prev.next=e,e.pr
ev=t.prev,(e.next=t).prev=e):(t===r.lastChild?r.lastChild=e:t.next.prev=e,e.next=t.next,(e.prev=t).next=e),e.parent=r,e},a.prototype.getAll=function(e){var t,n=[];for(t=this.firstChild;t;t=Yv(t,this))t.name===e&&n.push(t);return n},a.prototype.empty=function(){var e,t,n;if(this.firstChild){for(e=[],n=this.firstChild;n;n=Yv(n,this))e.push(n);for(t=e.length;t--;)(n=e[t]).parent=n.firstChild=n.lastChild=n.next=n.prev=null}return this.firstChild=this.lastChild=null,this},a.prototype.isEmpty=function(e,t,n){var r,o,i=this.firstChild;if(t=t||{},i)do{if(1===i.type){if(i.attributes.map["data-mce-bogus"])continue;if(e[i.name])return!1;for(r=i.attributes.length;r--;)if("name"===(o=i.attributes[r].name)||0===o.indexOf("data-mce-bookmark"))return!1}if(8===i.type)return!1;if(3===i.type&&!Kv.test(i.value))return!1;if(3===i.type&&i.parent&&t[i.parent.name]&&Kv.test(i.value))return!1;if(n&&n(i))return!1}while(i=Yv(i,this)
);return!0},a.prototype.walk=function(e){return Yv(this,null,e)},a}(),Jv=function(e,t,n,r){(e.padd_empty_with_br||t.insert)&&n[r.name]?r.empty().append(new Gv("br",1)).shortEnded=!0:r.empty().append(new Gv("#text",3)).value="\xa0"},Qv=function(e){return Zv(e,"#text")&&"\xa0"===e.firstChild.value},Zv=function(e,t){return e&&e.firstChild&&e.firstChild===e.lastChild&&e.firstChild.name===t},ey=function(r,e,t,n){return n.isEmpty(e,t,function(e){return t=e,(n=r.getElementRule(t.name))&&n.paddEmpty;var t,n})},ty=function(e,t){return e&&(t[e.name]||"br"===e.name)},ny=function(e,g){var h=e.schema;g.remove_trailing_brs&&e.addNodeFilter("br",function(e,t,n){var r,o,i,a,u,s,c,l,f=e.length,d=Lt.extend({},h.getBlockElements()),m=h.getNonEmptyElements(),p=h.getNonEmptyElements();for(d.body=1,r=0;r<f;r++)if(i=(o=e[r]).parent,d[o.parent.name]&&o===i.lastChi
ld){for(u=o.prev;u;){if("span"!==(s=u.name)||"bookmark"!==u.attr("data-mce-type")){if("br"!==s)break;if("br"===s){o=null;break}}u=u.prev}o&&(o.remove(),ey(h,m,p,i)&&(c=h.getElementRule(i.name))&&(c.removeEmpty?i.remove():c.paddEmpty&&Jv(g,n,d,i)))}else{for(a=o;i&&i.firstChild===a&&i.lastChild===a&&!d[(a=i).name];)i=i.parent;a===i&&!0!==g.padd_empty_with_br&&((l=new Gv("#text",3)).value="\xa0",o.replace(l))}}),e.addAttributeFilter("href",function(e){var t,n,r,o=e.length;if(!g.allow_unsafe_link_target)for(;o--;)"a"===(t=e[o]).name&&"_blank"===t.attr("target")&&t.attr("rel",(n=t.attr("rel"),r=n?Lt.trim(n):"",/\b(noopener)\b/g.test(r)?r:r.split(" ").filter(function(e){return 0<e.length}).concat(["noopener"]).sort().join(" ")))}),g
.allow_html_in_named_anchor||e.addAttributeFilter("id,name",function(e){for(var t,n,r,o,i=e.length;i--;)if("a"===(o=e[i]).name&&o.firstChild&&!o.attr("href"))for(r=o.parent,t=o.lastChild;n=t.prev,r.insert(t,o),t=n;);}),g.fix_list_elements&&e.addNodeFilter("ul,ol",function(e){for(var t,n,r=e.length;r--;)if("ul"===(n=(t=e[r]).parent).name||"ol"===n.name)if(t.prev&&"li"===t.prev.name)t.prev.append(t);else{var o=new Gv("li",1);o.attr("style","list-style-type: none"),t.wrap(o)}}),g.validate&&h.getValidClasses()&&e.addAttributeFilter("class",function(e){for(var t,n,r,o,i,a,u,s=e.length,c=h.getValidClasses();s--;){for(n=(t=e[s]).attr("class").split(" "),i="",r=0;r<n.length;r++)o=n[r],u=!1,(a=c["*"])&&a[o]&&(u=!0),a=c[t.name],!u&&a&&a[o]&&(u=!0),u&&a
mp;(i&&(i+=" "),i+=o);i.length||(i=null),t.attr("class",i)}})},ry=Lt.makeMap,oy=Lt.each,iy=Lt.explode,ay=Lt.extend;function uy(k,T){void 0===T&&(T=Zo());var A={},R=[],B={},_={};(k=k||{}).validate=!("validate"in k)||k.validate,k.root_name=k.root_name||"body";var D=function(e){var t,n,r;n in A&&((r=B[n])?r.push(e):B[n]=[e]),t=R.length;for(;t--;)(n=R[t].name)in e.attributes.map&&((r=_[n])?r.push(e):_[n]=[e]);return e},e={schema:T,addAttributeFilter:function(e,n){oy(iy(e),function(e){var t;for(t=0;t<R.length;t++)if(R[t].name===e)return void R[t].callbacks.push(n);R.push({name:e,callbacks:[n]})})},getAttributeFilters:function(){return[].concat(R)},addNodeFilter:function(e,n){oy(iy(e),function(e){var t=A[e];t||(A[e]=t=[]),t.push(n)})},getNodeFilters:function(){var e=[];for(var t in A)A.hasOwnProperty(t)&&e.push({name:t,callbacks:A[t]});return e},filterNode:D,parse:function(e,a){var t,n,r,o,i,u,s,c,l,f,d,m=[
];a=a||{},B={},_={},l=ay(ry("script,style,head,html,body,title,meta,param"),T.getBlockElements());var p=T.getNonEmptyElements(),g=T.children,h=k.validate,v="forced_root_block"in a?a.forced_root_block:k.forced_root_block,y=T.getWhiteSpaceElements(),b=/^[ \t\r\n]+/,C=/[ \t\r\n]+$/,x=/[ \t\r\n]+/g,w=/^[ \t\r\n]+$/,N=function(e,t){var n,r=new Gv(e,t);return e in A&&((n=B[e])?n.push(r):B[e]=[r]),r},E=function(e){var t,n,r,o,i=T.getBlockElements();for(t=e.prev;t&&3===t.type;){if(0<(r=t.value.replace(C,"")).length)return void(t.value=r);if(n=t.next){if(3===n.type&&n.value.length){t=t.prev;continue}if(!i[n.name]&&"script"!==n.name&&"style"!==n.name){t=t.prev;continue}}o=t.prev,t.remove(),t=o}};t=Fg({validate:h,allow_script_urls:k.allow_script_urls,allow_conditional_comments:k.allow_conditional_comments,self_closing_elements:function(e){var t,n={};for(t in e)"li"!==t&&"p"!
==t&&(n[t]=e[t]);return n}(T.getSelfClosingElements()),cdata:function(e){d.append(N("#cdata",4)).value=e},text:function(e,t){var n;f||(e=e.replace(x," "),ty(d.lastChild,l)&&(e=e.replace(b,""))),0!==e.length&&((n=N("#text",3)).raw=!!t,d.append(n).value=e)},comment:function(e){d.append(N("#comment",8)).value=e},pi:function(e,t){d.append(N(e,7)).value=t,E(d)},doctype:function(e){d.append(N("#doctype",10)).value=e,E(d)},start:function(e,t,n){var r,o,i,a,u;if(i=h?T.getElementRule(e):{}){for((r=N(i.outputName||e,1)).attributes=t,r.shortEnded=n,d.append(r),(u=g[d.name])&&g[r.name]&&!u[r.name]&&m.push(r),o=R.length;o--;)(a=R[o].name)in t.map&&((s=_[a])?s.push(r):_[a]=[r]);l[e]&&E(r),n||(d=r),!f&&y[e]&&(f=!0)}},end:function(e){var t,n,r,o,i;if(n=h?T.getElementRule(e):{}){if(l[e]&&!f){if((t=d.firstChild)&&3===t.type)if(0<(r=t.value.repl
ace(b,"")).length)t.value=r,t=t.next;else for(o=t.next,t.remove(),t=o;t&&3===t.type;)r=t.value,o=t.next,(0===r.length||w.test(r))&&(t.remove(),t=o),t=o;if((t=d.lastChild)&&3===t.type)if(0<(r=t.value.replace(C,"")).length)t.value=r,t=t.prev;else for(o=t.prev,t.remove(),t=o;t&&3===t.type;)r=t.value,o=t.prev,(0===r.length||w.test(r))&&(t.remove(),t=o),t=o}if(f&&y[e]&&(f=!1),n.removeEmpty&&ey(T,p,y,d)&&!d.attributes.map.name&&!d.attr("id"))return i=d.parent,l[d.name]?d.empty().remove():d.unwrap(),void(d=i);n.paddEmpty&&(Qv(d)||ey(T,p,y,d))&&Jv(k,a,l,d),d=d.parent}}},T);var S=d=new Gv(a.context||k.root_name,11);if(t.parse(e),h&&m.length&&(a.context?a.invalid=!0:function(e){var t,n,r,o,i,a,u,s,c,l,f,d,m,p,g,h;for(d=ry("tr,td,th,tbody,thead,tfoot,table"),l=T.getNonEmptyElements(),f=T.getWhiteSpaceElements(),m=T.getTextBlockElements(),p=T
.getSpecialElements(),t=0;t<e.length;t++)if((n=e[t]).parent&&!n.fixed)if(m[n.name]&&"li"===n.parent.name){for(g=n.next;g&&m[g.name];)g.name="li",g.fixed=!0,n.parent.insert(g,n.parent),g=g.next;n.unwrap(n)}else{for(o=[n],r=n.parent;r&&!T.isValidChild(r.name,n.name)&&!d[r.name];r=r.parent)o.push(r);if(r&&1<o.length){for(o.reverse(),i=a=D(o[0].clone()),c=0;c<o.length-1;c++){for(T.isValidChild(a.name,o[c].name)?(u=D(o[c].clone()),a.append(u)):u=a,s=o[c].firstChild;s&&s!==o[c+1];)h=s.next,u.append(s),s=h;a=u}ey(T,l,f,i)?r.insert(n,o[0],!0):(r.insert(i,o[0],!0),r.insert(n,i)),r=o[0],(ey(T,l,f,r)||Zv(r,"br"))&&r.empty().remove()}else if(n.parent){if("li"===n.name){if((g=n.prev)&&("ul"===g.name||"ul"===g.name)){g.append(n);continue}if((g=n.next)&&("ul"===g.name||"ul"===g.name)){g.insert(n,g.firstChild,!0);continue}n.wrap(D(n
ew Gv("ul",1)));continue}T.isValidChild(n.parent.name,"div")&&T.isValidChild("div",n.name)?n.wrap(D(new Gv("div",1))):p[n.name]?n.empty().remove():n.unwrap()}}}(m)),v&&("body"===S.name||a.isRootContent)&&function(){var e,t,n=S.firstChild,r=function(e){e&&((n=e.firstChild)&&3===n.type&&(n.value=n.value.replace(b,"")),(n=e.lastChild)&&3===n.type&&(n.value=n.value.replace(C,"")))};if(T.isValidChild(S.name,v.toLowerCase())){for(;n;)e=n.next,3===n.type||1===n.type&&"p"!==n.name&&!l[n.name]&&!n.attr("data-mce-type")?(t||((t=N(v,1)).attr(k.forced_root_block_attrs),S.insert(t,n)),t.append(n)):(r(t),t=null),n=e;r(t)}}(),!a.invalid){for(c in B){for(s=A[c],i=(n=B[c]).length;i--;)n[i].parent||n.splice(i,1);for(r=0,o=s.length;r<o;r++)s[r](n,c,a)}for(r=0,o=R.length;r<o;r++)if((s=R[r]).name in _){for(i=(n=_[s.name]).
length;i--;)n[i].parent||n.splice(i,1);for(i=0,u=s.callbacks.length;i<u;i++)s.callbacks[i](n,s.name,a)}}return S}};return ny(e,k),Wv.register(e,k),e}var sy=function(e,t,n){-1===Lt.inArray(t,n)&&(e.addAttributeFilter(n,function(e,t){for(var n=e.length;n--;)e[n].attr(t,null)}),t.push(n))},cy=function(e,t,n){var r=Si(n.getInner?t.innerHTML:e.getOuterHTML(t));return n.selection?r:Lt.trim(r)},ly=function(e,t,n,r){var o=r.selection?Fv.merge({forced_root_block:!1},r):r,i=e.parse(n,o);return Vv.trimTrailingBr(i),i},fy=function(e,t,n,r,o){var i,a,u,s,c=(i=r,jc(t,n).serialize(i));return a=e,s=c,!(u=o).no_events&&a?Uv(a,Fv.merge(u,{content:s})).content:s};function dy(e,t){var a,u,s,c,l,n,r=(a=e,n=["data-mce-selected"],s=(u=t)&&u.dom?u.dom:di.DOM,c=u&&u.schema?u.schema:Zo(a),a.entity_encoding=a.entity_encoding||"named",a.remove_trailing_brs=!("remove_trailing_brs"in a)||a.remove_trailing_brs,l=uy(a,c),Vv.register(l,a,s),{schema:c,
addNodeFilter:l.addNodeFilter,addAttributeFilter:l.addAttributeFilter,serialize:function(e,t){var n=Fv.merge({format:"html"},t||{}),r=Hv.process(u,e,n),o=cy(s,r,n),i=ly(l,s,o,n);return"tree"===n.format?i:fy(u,a,c,i,n)},addRules:function(e){c.addValidElements(e)},setRules:function(e){c.setValidElements(e)},addTempAttr:V.curry(sy,l,n),getTempAttrs:function(){return n}});return{schema:r.schema,addNodeFilter:r.addNodeFilter,addAttributeFilter:r.addAttributeFilter,serialize:r.serialize,addRules:r.addRules,setRules:r.setRules,addTempAttr:r.addTempAttr,getTempAttrs:r.getTempAttrs}}function my(e){return{getBookmark:V.curry(Bc.getBookmark,e),moveToBookmark:V.curry(Bc.moveToBookmark,e)}}(my||(my={})).isBookmarkNode=Bc.isBookmarkNode;var py=my,gy=Ao.isContentEditableFalse,hy=Ao.isContentEditableTrue,vy=function(r,a){var u,s,c,l,f,d,m,p,g,h,v,y,i,b,C,x,w,N=a.dom,E=Lt.each,S=a.getDoc(),k=document,T=Math.abs,A=Math.round,R=a.getBody();l={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,
1],sw:[0,1,-1,1]};var e=".mce-content-body";a.contentStyles.push(e+" div.mce-resizehandle {position: absolute;border: 1px solid black;box-sizing: content-box;background: #FFF;width: 7px;height: 7px;z-index: 10000}"+e+" .mce-resizehandle:hover {background: #000}"+e+" img[data-mce-selected],"+e+" hr[data-mce-selected] {outline: 1px solid black;resize: none}"+e+" .mce-clonedresizable {position: absolute;"+(ge.gecko?"":"outline: 1px dashed black;")+"opacity: .5;filter: alpha(opacity=50);z-index: 10000}"+e+" .mce-resize-helper {background: #555;background: rgba(0,0,0,0.75);border-radius: 3px;border: 1px;color: white;display: none;font-family: sans-serif;font-size: 12px;white-space: nowrap;line-height: 14px;margin: 5px 10px;padding: 5px;position: absolute;z-index: 10001}");var B=function(e){return e&&("IMG"===e.nodeName||a.dom.is(e,"figure.image"))},n=function(e)
{var t,n,r=e.target;t=e,n=a.selection.getRng(),!B(t.target)||Ng(t.clientX,t.clientY,n)||e.isDefaultPrevented()||(e.preventDefault(),a.selection.select(r))},_=function(e){return a.dom.is(e,"figure.image")?e.querySelector("img"):e},D=function(e){var t=a.settings.object_resizing;return!1!==t&&!ge.iOS&&("string"!=typeof t&&(t="table,img,figure.image,div"),"false"!==e.getAttribute("data-mce-resize")&&e!==a.getBody()&&Br.is(qn.fromDom(e),t))},O=function(e){var t,n,r,o;t=e.screenX-d,n=e.screenY-m,b=t*f[2]+h,C=n*f[3]+v,b=b<5?5:b,C=C<5?5:C,(B(u)&&!1!==a.settings.resize_img_proportional?!kg.modifierPressed(e):kg.modifierPressed(e)||B(u)&&f[2]*f[3]!=0)&&(T(t)>T(n)?(C=A(b*y),b=A(C/y)):(b=A(C/y),C=A(b*y))),N.setStyles(_(s),{width:b,height:C}),r=0<(r=f.startPos.x+t)?r:0,o=0<(o=f.startPos.y+n)?o:0,N.setStyles(c,{left:r,top:o,display:"block"}),c.innerH
TML=b+" × "+C,f[2]<0&&s.clientWidth<=b&&N.setStyle(s,"left",p+(h-b)),f[3]<0&&s.clientHeight<=C&&N.setStyle(s,"top",g+(v-C)),(t=R.scrollWidth-x)+(n=R.scrollHeight-w)!=0&&N.setStyles(c,{left:r-t,top:o-n}),i||(a.fire("ObjectResizeStart",{target:u,width:h,height:v}),i=!0)},P=function(){i=!1;var e=function(e,t){t&&(u.style[e]||!a.schema.isValid(u.nodeName.toLowerCase(),e)?N.setStyle(_(u),e,t):N.setAttrib(_(u),e,t))};e("width",b),e("height",C),N.unbind(S,"mousemove",O),N.unbind(S,"mouseup",P),k!==S&&(N.unbind(k,"mousemove",O),N.unbind(k,"mouseup",P)),N.remove(s),N.remove(c),o(u),a.fire("ObjectResized",{target:u,width:b,height:C}),N.setAttrib(u,"style",N.getAttrib(u,"style")),a.nodeChanged()},o=function(e){var t,r,o,n,i;L(),F(),t=N.getPos(e,R),p=t.x,g=t.y,i=e.getBoundingClientRect(),r=
i.width||i.right-i.left,o=i.height||i.bottom-i.top,u!==e&&(u=e,b=C=0),n=a.fire("ObjectSelected",{target:e}),D(e)&&!n.isDefaultPrevented()?E(l,function(n,e){var t;(t=N.get("mceResizeHandle"+e))&&N.remove(t),t=N.add(R,"div",{id:"mceResizeHandle"+e,"data-mce-bogus":"all","class":"mce-resizehandle",unselectable:!0,style:"cursor:"+e+"-resize; margin:0; padding:0"}),ge.ie&&(t.contentEditable=!1),N.bind(t,"mousedown",function(e){var t;e.stopImmediatePropagation(),e.preventDefault(),d=(t=e).screenX,m=t.screenY,h=_(u).clientWidth,v=_(u).clientHeight,y=v/h,(f=n).startPos={x:r*n[0]+p,y:o*n[1]+g},x=R.scrollWidth,w=R.scrollHeight,s=u.cloneNode(!0),N.addClass(s,"mce-clonedresizable"),N.setAttrib(s,"data-mce-bogus","all"),s.contentEditable=!1,s.unSelectabe=!0,N.setStyles(s,{left:p,top:g,margin:0}),s.removeAttribute("data-mc
e-selected"),R.appendChild(s),N.bind(S,"mousemove",O),N.bind(S,"mouseup",P),k!==S&&(N.bind(k,"mousemove",O),N.bind(k,"mouseup",P)),c=N.add(R,"div",{"class":"mce-resize-helper","data-mce-bogus":"all"},h+" × "+v)}),n.elm=t,N.setStyles(t,{left:r*n[0]+p-t.offsetWidth/2,top:o*n[1]+g-t.offsetHeight/2})}):L(),u.setAttribute("data-mce-selected","1")},L=function(){var e,t;for(e in F(),u&&u.removeAttribute("data-mce-selected"),l)(t=N.get("mceResizeHandle"+e))&&(N.unbind(t),N.remove(t))},I=function(e){var t,n=function(e,t){if(e)do{if(e===t)return!0}while(e=e.parentNode)};i||a.removed||(E(N.select("img[data-mce-selected],hr[data-mce-selected]"),function(e){e.removeAttribute("data-mce-selected")}),t="mousedown"===e.type?e.target:r.getNode(),n(t=N.$(t).closest("table,img,figure.image,hr
")[0],R)&&(z(),n(r.getStart(!0),t)&&n(r.getEnd(!0),t))?o(t):L())},M=function(e){return gy(function(e,t){for(;t&&t!==e;){if(hy(t)||gy(t))return t;t=t.parentNode}return null}(a.getBody(),e))},F=function(){for(var e in l){var t=l[e];t.elm&&(N.unbind(t.elm),delete t.elm)}},z=function(){try{a.getDoc().execCommand("enableObjectResizing",!1,!1)}catch(e){}};return a.on("init",function(){z(),ge.ie&&11<=ge.ie&&(a.on("mousedown click",function(e){var t=e.target,n=t.nodeName;i||!/^(TABLE|IMG|HR)$/.test(n)||M(t)||(2!==e.button&&a.selection.select(t,"TABLE"===n),"mousedown"===e.type&&a.nodeChanged())}),a.dom.bind(R,"mscontrolselect",function(e){var t=function(e){Ce.setEditorTimeout(a,function(){a.selection.select(e)})};if(M(e.target))return e.preventDefault(),void t(e.target);/^(TABLE|IMG|HR)$/.test(e.target.nodeName)&&(e.preventDefault(),"IMG"===e.
target.tagName&&t(e.target))}));var t=Ce.throttle(function(e){a.composing||I(e)});a.on("nodechange ResizeEditor ResizeWindow drop FullscreenStateChanged",t),a.on("keyup compositionend",function(e){u&&"TABLE"===u.nodeName&&t(e)}),a.on("hide blur",L),a.on("contextmenu",n)}),a.on("remove",F),{isResizable:D,showResizeRect:o,hideResizeRect:L,updateResizeRect:I,destroy:function(){u=s=null}}},yy=function(e){return Ao.isContentEditableTrue(e)||Ao.isContentEditableFalse(e)},by={fromPoint:function(e,t,n){var r,o,i,a,u,s=n;if(s.caretPositionFromPoint)(o=s.caretPositionFromPoint(e,t))&&((r=n.createRange()).setStart(o.offsetNode,o.offset),r.collapse(!0));else if(n.caretRangeFromPoint)r=n.caretRangeFromPoint(e,t);else if(s.body.createTextRange){r=s.body.createTextRange();try{r.moveToPoint(e,t),r.collapse(!0)}catch(c){r=function(e,n,t){var r,o,i;if(r=t.elementFromPoint(e,n),o=t.body.createTextRange(),r&
&"HTML"!==r.tagName||(r=t.body),o.moveToElementText(r),0<(i=(i=Lt.toArray(o.getClientRects())).sort(function(e,t){return(e=Math.abs(Math.max(e.top-n,e.bottom-n)))-(t=Math.abs(Math.max(t.top-n,t.bottom-n)))})).length){n=(i[0].bottom+i[0].top)/2;try{return o.moveToPoint(e,n),o.collapse(!0),o}catch(a){}}return null}(e,t,n)}return i=r,a=n.body,u=i&&i.parentElement?i.parentElement():null,Ao.isContentEditableFalse(function(e,t,n){for(;e&&e!==t;){if(n(e))return e;e=e.parentNode}return null}(u,a,yy))?null:i}return r}},Cy=function(n,e){return H.map(e,function(e){var t=n.fire("GetSelectionRange",{range:e});return t.range!==e?t.range:e})},xy=function(e,t){return qn.fromDom(e.dom().cloneNode(t))},wy=function(e){return xy(e,!0)},Ny=function(e){return xy(e,!1)},Ey=wy,Sy=function(e,t){var n=(t||document).createDocumentFragment();return H.each(e,function(e){n.appendChild(e.dom())}),qn.fromDom(n)},ky=function(t){return qr.firstChild(t).fold(V.constant([t]),
function(e){return[t].concat(ky(e))})},Ty=function(t){return qr.lastChild(t).fold(V.constant([t]),function(e){return"br"===Qn.name(e)?qr.prevSibling(e).map(function(e){return[t].concat(Ty(e))}).getOr([]):[t].concat(Ty(e))})},Ay=function(o,e){return sa([(i=e,a=i.startContainer,u=i.startOffset,Ao.isText(a)?0===u?A.some(qn.fromDom(a)):A.none():A.from(a.childNodes[u]).map(qn.fromDom)),(t=e,n=t.endContainer,r=t.endOffset,Ao.isText(n)?r===n.data.length?A.some(qn.fromDom(n)):A.none():A.from(n.childNodes[r-1]).map(qn.fromDom))],function(e,t){var n=H.find(ky(o),V.curry(Or.eq,e)),r=H.find(Ty(o),V.curry(Or.eq,t));return n.isSome()&&r.isSome()}).getOr(!1);var t,n,r,i,a,u},Ry=function(e,t,n,r){var o=n,i=new no(n,o),a=e.schema.getNonEmptyElements();do{if(3===n.nodeType&&0!==Lt.trim(n.nodeValue).length)return void(r?t.setStart(n,0):t.setEnd(n,n.nodeValue.length));if(a[n.nodeName]&&!/^(TD|TH)$/.test(n.nodeName))return void(r?t.setStartBefore(n):"BR"===n.n
odeName?t.setEndBefore(n):t.setEndAfter(n));if(ge.ie&&ge.ie<11&&e.isBlock(n)&&e.isEmpty(n))return void(r?t.setStart(n,0):t.setEnd(n,0))}while(n=r?i.next():i.prev());"BODY"===o.nodeName&&(r?t.setStart(o,0):t.setEnd(o,o.childNodes.length))},By=wr.immutable("element","width","rows"),_y=wr.immutable("element","cells"),Dy=wr.immutable("x","y"),Oy=function(e,t){var n=parseInt(cr.get(e,t),10);return isNaN(n)?1:n},Py=function(e){return H.foldl(e,function(e,t){return t.cells().length>e?t.cells().length:e},0)},Ly=function(e,t){for(var n=e.rows(),r=0;r<n.length;r++)for(var o=n[r].cells(),i=0;i<o.length;i++)if(Or.eq(o[i],t))return A.some(Dy(i,r));return A.none()},Iy=function(e,t,n,r,o){for(var i=[],a=e.rows(),u=n;u<=o;u++){var s=a[u].cells(),c=t<r?s.slice(t,r+1):s.slice(r,t+1);i.push(_y(a[u].element(),c))}return i},My=function(e){var o=By(Ny(e),0,[]);return H.each(fu
(e,"tr"),function(n,r){H.each(fu(n,"td,th"),function(e,t){!function(e,t,n,r,o){for(var i=Oy(o,"rowspan"),a=Oy(o,"colspan"),u=e.rows(),s=n;s<n+i;s++){u[s]||(u[s]=_y(Ey(r),[]));for(var c=t;c<t+a;c++)u[s].cells()[c]=s===n&&c===t?o:Ny(o)}}(o,function(e,t,n){for(;r=t,o=n,i=void 0,((i=e.rows())[o]?i[o].cells():[])[r];)t++;var r,o,i;return t}(o,t,r),r,n,e)})}),By(o.element(),Py(o.rows()),o.rows())},Fy=function(e){return i=t=e,n=H.map(i.rows(),function(e){var t=H.map(e.cells(),function(e){var t=Ey(e);return cr.remove(t,"colspan"),cr.remove(t,"rowspan"),t}),n=Ny(e.element());return Pc(n,t),n}),r=Ny(t.element()),o=qn.fromTag("tbody"),Pc(o,n),Fu.append(r,o),r;var t,n,r,o,i},zy=function(l,e,t){return Ly(l,e).bind(function(c){return Ly(l,t).map(function(e){return t=l,r=e,o=(n=c).x(),i=n.y(),a=r.x(),u=r.y(),s=i<u?Iy(t,o,i,a,u):Iy(t,o,u,a,i),By(t.element(),Py(s),s);var t,n,r,o,i,a,u,s})})},Uy=function(n,t){retur
n H.find(n,function(e){return"li"===Qn.name(e)&&Ay(e,t)}).fold(V.constant([]),function(e){return(t=n,H.find(t,function(e){return"ul"===Qn.name(e)||"ol"===Qn.name(e)})).map(function(e){return[qn.fromTag("li"),qn.fromTag(Qn.name(e))]}).getOr([]);var t})},qy=function(e,t){var n,r=qn.fromDom(t.commonAncestorContainer),o=Ml(r,e),i=H.filter(o,function(e){return co(e)||uo(e)}),a=Uy(o,t),u=i.concat(a.length?a:po(n=r)?qr.parent(n).filter(mo).fold(V.constant([]),function(e){return[n,e]}):mo(n)?[n]:[]);return H.map(u,Ny)},Vy=function(){return Sy([])},Hy=function(e,t){return n=qn.fromDom(t.cloneContents()),r=qy(e,t),o=H.foldl(r,function(e,t){return Fu.append(t,e),t},n),0<r.length?Sy([o]):o;var n,r,o},jy=function(e,o){return(t=e,n=o[0],bl(n,"table",V.curry(Or.eq,t))).bind(function(e){var t=o[0],n=o[o.length-1],r=My(e);return zy(r,t,n).map(function(e){return Sy([Fy(e)])})}).getOrThunk(Vy);var t,n},$y=function(e,t){var n,r,o=Td(t,e);retu
rn 0<o.length?jy(e,o):(n=e,0<(r=t).length&&r[0].collapsed?Vy():Hy(n,r[0]))},Wy=function(e,t){var n,r=e.selection.getRng(),o=e.dom.create("body"),i=e.selection.getSel(),a=Cy(e,xd(i));if((t=t||{}).get=!0,t.format=t.format||"html",t.selection=!0,(t=e.fire("BeforeGetContent",t)).isDefaultPrevented())return e.fire("GetContent",t),t.content;if("text"===t.format)return e.selection.isCollapsed()?"":Si(r.text||(i.toString?i.toString():""));r.cloneContents?(n=t.contextual?$y(qn.fromDom(e.getBody()),a).dom():r.cloneContents())&&o.appendChild(n):r.item!==undefined||r.htmlText!==undefined?(o.innerHTML="<br>"+(r.item?r.item(0).outerHTML:r.htmlText),o.removeChild(o.firstChild)):o.innerHTML=r.toString(),t.getInner=!0;var u=e.selection.serializer.serialize(o,t);return"tree"===t.format?u:(t.content=e.selection.isCollapsed()?"":u,e.fire("GetContent",t),t.content)},K
y=function(e,t,n){var r,o,i,a=e.selection.getRng(),u=e.getDoc();if((n=n||{format:"html"}).set=!0,n.selection=!0,n.content=t,n.no_events||!(n=e.fire("BeforeSetContent",n)).isDefaultPrevented()){if(t=n.content,a.insertNode){t+='<span id="__caret">_</span>',a.startContainer===u&&a.endContainer===u?u.body.innerHTML=t:(a.deleteContents(),0===u.body.childNodes.length?u.body.innerHTML=t:a.createContextualFragment?a.insertNode(a.createContextualFragment(t)):(o=u.createDocumentFragment(),i=u.createElement("div"),o.appendChild(i),i.outerHTML=t,a.insertNode(o))),r=e.dom.get("__caret"),(a=u.createRange()).setStartBefore(r),a.setEndBefore(r),e.selection.setRng(a),e.dom.remove("__caret");try{e.selection.setRng(a)}catch(s){}}else a.item&&(u.execCommand("Delete",!1,null),a=e.getRng()),/^\s+/.test(t)?(a.pasteHTML('<span id="__mce_tmp">_</span>'+t),e.dom.remove("__mce_tmp"
)):a.pasteHTML(t);n.no_events||e.fire("SetContent",n)}else e.fire("SetContent",n)},Xy=function(e,t,n,r,o){var i=n?t.startContainer:t.endContainer,a=n?t.startOffset:t.endOffset;return A.from(i).map(qn.fromDom).map(function(e){return r&&t.collapsed?e:qr.child(e,o(e,a)).getOr(e)}).bind(function(e){return Qn.isElement(e)?A.some(e):qr.parent(e)}).map(function(e){return e.dom()}).getOr(e)},Yy=function(e,t,n){return Xy(e,t,!0,n,function(e,t){return Math.min(qr.childNodesCount(e),t)})},Gy=function(e,t,n){return Xy(e,t,!1,n,function(e,t){return 0<t?t-1:t})},Jy=function(e,t){for(var n=e;e&&Ao.isText(e)&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||n},Qy=Lt.each,Zy=function(e){return!!e.select},eb=function(e){return!(!e||!e.ownerDocument)&&Or.contains(qn.fromDom(e.ownerDocument),qn.fromDom(e))},tb=function(u,s,e,c){var n,t,l,f,a,r=function(e,t){return Ky(c,e,t)},o=function(e){var t=m();t.collapse(!!e),i(t)},d=function(){retu
rn s.getSelection?s.getSelection():s.document.selection},m=function(){var e,t,n,r,o=function(e,t,n){try{return t.compareBoundaryPoints(e,n)}catch(r){return-1}};if(!s)return null;if(null==(r=s.document))return null;if(c.bookmark!==undefined&&!1===dp(c)){var i=_m.getRng(c);if(i.isSome())return i.map(function(e){return Cy(c,[e])[0]}).getOr(r.createRange())}try{(e=d())&&(t=0<e.rangeCount?e.getRangeAt(0):e.createRange?e.createRange():r.createRange())}catch(a){}return(t=Cy(c,[t])[0])||(t=r.createRange?r.createRange():r.body.createTextRange()),t.setStart&&9===t.startContainer.nodeType&&t.collapsed&&(n=u.getRoot(),t.setStart(n,0),t.setEnd(n,0)),l&&f&&(0===o(t.START_TO_START,t,l)&&0===o(t.END_TO_END,t,l)?t=f:f=l=null),t},i=function(e,t){var n,r;if((o=e)&&(Zy(o)||eb(o.startContainer)&&eb(o.endContainer))){var o,i=Zy(e)?e:null;if(i){f=null;try{i.select()}catch(a){}}else{if(n=d(),e=c.fire("SetSelectionRange&
quot;,{range:e,forward:t}).range,n){f=e;try{n.removeAllRanges(),n.addRange(e)}catch(a){}!1===t&&n.extend&&(n.collapse(e.endContainer,e.endOffset),n.extend(e.startContainer,e.startOffset)),l=0<n.rangeCount?n.getRangeAt(0):null}e.collapsed||e.startContainer!==e.endContainer||!n.setBaseAndExtent||ge.ie||e.endOffset-e.startOffset<2&&e.startContainer.hasChildNodes()&&(r=e.startContainer.childNodes[e.startOffset])&&"IMG"===r.tagName&&(n.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),n.anchorNode===e.startContainer&&n.focusNode===e.endContainer||n.setBaseAndExtent(r,0,r,1)),c.fire("AfterSetSelectionRange",{range:e,forward:t})}}},p=function(){var e,t,n=d();return!(n&&n.anchorNode&&n.focusNode)||((e=u.createRng()).setStart(n.anchorNode,n.anchorOffset),e.collapse(!0),(t=u.createRng()).setStart(n.focusNode,n.focusOffset),t.collapse(!0),e.compareBoundaryPoints(e.START_T
O_START,t)<=0)},g={bookmarkManager:null,controlSelection:null,dom:u,win:s,serializer:e,editor:c,collapse:o,setCursorLocation:function(e,t){var n=u.createRng();e?(n.setStart(e,t),n.setEnd(e,t),i(n),o(!1)):(Ry(u,n,c.getBody(),!0),i(n))},getContent:function(e){return Wy(c,e)},setContent:r,getBookmark:function(e,t){return n.getBookmark(e,t)},moveToBookmark:function(e){return n.moveToBookmark(e)},select:function(e,t){var r,n,o;return(r=u,n=e,o=t,A.from(n).map(function(e){var t=r.nodeIndex(e),n=r.createRng();return n.setStart(e.parentNode,t),n.setEnd(e.parentNode,t+1),o&&(Ry(r,n,e,!0),Ry(r,n,e,!1)),n})).each(i),e},isCollapsed:function(){var e=m(),t=d();return!(!e||e.item)&&(e.compareEndPoints?0===e.compareEndPoints("StartToEnd",e):!t||e.collapsed)},isForward:p,setNode:function(e){return r(u.getOuterHTML(e)),e},getNode:function(){return e=c.getBody(),(t=m())?(r=t.startContainer,o=t.endContainer,i=t.startOffset,a=t.endOffset,n=t.commonAncestorContainer,!t.collap
sed&&(r===o&&a-i<2&&r.hasChildNodes()&&(n=r.childNodes[i]),3===r.nodeType&&3===o.nodeType&&(r=r.length===i?Jy(r.nextSibling,!0):r.parentNode,o=0===a?Jy(o.previousSibling,!1):o.parentNode,r&&r===o))?r:n&&3===n.nodeType?n.parentNode:n):e;var e,t,n,r,o,i,a},getSel:d,setRng:i,getRng:m,getStart:function(e){return Yy(c.getBody(),m(),e)},getEnd:function(e){return Gy(c.getBody(),m(),e)},getSelectedBlocks:function(e,t){return function(e,t,n,r){var o,i,a=[];if(i=e.getRoot(),n=e.getParent(n||Yy(i,t,!1),e.isBlock),r=e.getParent(r||Gy(i,t,!1),e.isBlock),n&&n!==i&&a.push(n),n&&r&&n!==r)for(var u=new no(o=n,i);(o=u.next())&&o!==r;)e.isBlock(o)&&a.push(o);return r&&n!==r&&r!==i&&a.push(r),a}(u,m(),e,t)},normalize:function(){var e=m();if(!Nd(d())){var t=rm.normalize(u,e);return t.each(function(e){i(e,p())}),t.getOr(e)}return e},selectorChanged:function(e,t){var i
;return a||(a={},i={},c.on("NodeChange",function(e){var n=e.element,r=u.getParents(n,null,u.getRoot()),o={};Qy(a,function(e,n){Qy(r,function(t){if(u.is(t,n))return i[n]||(Qy(e,function(e){e(!0,{node:t,selector:n,parents:r})}),i[n]=e),o[n]=e,!1})}),Qy(i,function(e,t){o[t]||(delete i[t],Qy(e,function(e){e(!1,{node:n,selector:t,parents:r})}))})})),a[e]||(a[e]=[]),a[e].push(t),g},getScrollContainer:function(){for(var e,t=u.getRoot();t&&"BODY"!==t.nodeName;){if(t.scrollHeight>t.clientHeight){e=t;break}t=t.parentNode}return e},scrollIntoView:function(e,t){return yu(c,e,t)},placeCaretAt:function(e,t){return i(by.fromPoint(e,t,c.getDoc()))},getBoundingClientRect:function(){var e=m();return e.collapsed?Ba.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:function(){s=l=f=null,t.destroy()}};return n=py(g),t=vy(g,c),g.bookmarkManager=n,g.controlSelection=t,g},nb=Ao.isContentEditableFalse,rb=ta,ob=ks,ib=Ss,ab=function(e,t){for(;t=e(t);)if(t.
isVisible())return t;return t},ub=function(e,t,n,r){var o,i,a,u,s,c,l=e===eu.Forwards,f=l?ib:ob;return!r.collapsed&&(o=rb(r),nb(o))?Ga(e,t,o,e===eu.Backwards,!0):(u=Ai(r.startContainer),f(i=Es(e,t.getBody(),r))?Ja(t,i.getNode(!l)):(i=n(i))?f(i)?Ga(e,t,i.getNode(!l),l,!0):f(a=n(i))&&(!(c=ps(s=i,a))&&Ao.isBr(s.getNode())||c)?Ga(e,t,a.getNode(!l),l,!0):u?Za(t,i.toRange(),!0):null:u?r:null)},sb=function(e,t,n,r){var o,i,a,u,s,c,l,f,d;if(d=rb(r),o=Es(e,t.getBody(),r),i=n(t.getBody(),mg(1),o),a=Bt.filter(i,pg(1)),s=Bt.last(o.getClientRects()),(ib(o)||Ts(o))&&(d=o.getNode()),(ob(o)||As(o))&&(d=o.getNode(!0)),!s)return null;if(c=s.left,(u=Cg(a,c))&&nb(u.node))return l=Math.abs(c-u.left),f=Math.abs(c-u.right),Ga(e,t,u.node,l<f,!0);if(d){var m=function(e,t,n,r){var o,i,a,u,s,c,l=js(t),f=[],d=0,m=function(e){return Bt.last(e.getClientRects())};1===e?(o=l.next,i=ea,a=Zi,u=Ba.after(r)):(o=l.prev,i=Zi,a=ea,u=Ba.before(r)),c=m(u);do{if(u.isVisible
()&&!a(s=m(u),c)){if(0<f.length&&i(s,Bt.last(f))&&d++,(s=Gi(s)).position=u,s.line=d,n(s))return f;f.push(s)}}while(u=o(u));return f}(e,t.getBody(),mg(1),d);if(u=Cg(Bt.filter(m,pg(1)),c))return Za(t,u.position.toRange(),!0);if(u=Bt.last(Bt.filter(m,pg(0))))return Za(t,u.position.toRange(),!0)}},cb=function(e,t,n){var r,o,i,a,u=js(e.getBody()),s=ua.curry(ab,u.next),c=ua.curry(ab,u.prev);if(n.collapsed&&e.settings.forced_root_block){if(!(r=e.dom.getParent(n.startContainer,"PRE")))return;(1===t?s(Ba.fromRangeStart(n)):c(Ba.fromRangeStart(n)))||(a=(i=e).dom.create(i.settings.forced_root_block),(!ge.ie||11<=ge.ie)&&(a.innerHTML='<br data-mce-bogus="1">'),o=a,1===t?e.$(r).after(o):e.$(r).before(o),e.selection.select(o,!0),e.selection.collapse())}},lb=function(l,f){return function(){var e,t,n,r,o,i,a,u,s,c=(t=f,r=js((e=l).getBody()),o=ua.curry(ab,r.next),i=ua.curry(ab,r.prev),a=t?eu.Forwards:eu.Backwards,u=t?o:i,s=e.sel
ection.getRng(),(n=ub(a,e,u,s))?n:(n=cb(e,a,s))||null);return!!c&&(l.selection.setRng(c),!0)}},fb=function(u,s){return function(){var e,t,n,r,o,i,a=(r=(t=s)?1:-1,o=t?dg:fg,i=(e=u).selection.getRng(),(n=sb(r,e,o,i))?n:(n=cb(e,r,i))||null);return!!a&&(u.selection.setRng(a),!0)}},db=function(e,r){return H.bind((t=e,H.map(t,function(e){return Fv.merge({shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0,action:V.noop},e)})),function(e){return t=e,(n=r).keyCode===t.keyCode&&n.shiftKey===t.shiftKey&&n.altKey===t.altKey&&n.ctrlKey===t.ctrlKey&&n.metaKey===t.metaKey?[e]:[];var t,n});var t},mb=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,r)}},pb=function(e,t){return H.find(db(e,t),function(e){return e.action()})},gb=function(i,a){i.on("keydown",function(e){var t,n,r,o;!1===e.isDefaultPrevented()&&(t=i,n=a,r=e,o=z
n.detect().os,pb([{keyCode:kg.RIGHT,action:lb(t,!0)},{keyCode:kg.LEFT,action:lb(t,!1)},{keyCode:kg.UP,action:fb(t,!1)},{keyCode:kg.DOWN,action:fb(t,!0)},{keyCode:kg.RIGHT,action:Yu(t,!0)},{keyCode:kg.LEFT,action:Yu(t,!1)},{keyCode:kg.UP,action:Gu(t,!1)},{keyCode:kg.DOWN,action:Gu(t,!0)},{keyCode:kg.RIGHT,action:td.move(t,n,!0)},{keyCode:kg.LEFT,action:td.move(t,n,!1)},{keyCode:kg.RIGHT,ctrlKey:!o.isOSX(),altKey:o.isOSX(),action:td.moveNextWord(t,n)},{keyCode:kg.LEFT,ctrlKey:!o.isOSX(),altKey:o.isOSX(),action:td.movePrevWord(t,n)}],r).each(function(e){r.preventDefault()}))})},hb=function(e){return 1===qr.children(e).length},vb=function(e,t,n,r){var o,i,a,u,s=V.curry(Hh,t),c=H.map(H.filter(r,s),function(e){return e.dom()});if(0===c.length)lf(t,e,n);else{var l=(o=n.dom(),i=c,a=Ih(!1),u=qh(i,a.dom()),Fu.before(qn.fromDom(o),a),Ic.remove(qn.fromDom(o)),Ba(u,0));t.selection.setRng(l.toRange())}},yb=function(n,r){var t,e=qn.fromDom(n.getBody()),o=qn.fromDom(n.selection.getStart()),i=H.filt
er((t=Ml(o,e),H.findIndex(t,so).fold(V.constant(t),function(e){return t.slice(0,e)})),hb);return H.last(i).map(function(e){var t=Ba.fromRangeStart(n.selection.getRng());return!!vl(r,t,e.dom())&&(vb(r,n,e,i),!0)}).getOr(!1)},bb=function(e,t){return!!e.selection.isCollapsed()&&yb(e,t)},Cb=function(o,i){o.on("keydown",function(e){var t,n,r;!1===e.isDefaultPrevented()&&(t=o,n=i,r=e,pb([{keyCode:kg.BACKSPACE,action:mb(mf,t,!1)},{keyCode:kg.DELETE,action:mb(mf,t,!0)},{keyCode:kg.BACKSPACE,action:mb(id,t,n,!1)},{keyCode:kg.DELETE,action:mb(id,t,n,!0)},{keyCode:kg.BACKSPACE,action:mb(Xl,t,!1)},{keyCode:kg.DELETE,action:mb(Xl,t,!0)},{keyCode:kg.BACKSPACE,action:mb(jl,t,!1)},{keyCode:kg.DELETE,action:mb(jl,t,!0)},{keyCode:kg.BACKSPACE,action:mb(Fd,t,!1)},{keyCode:kg.DELETE,action:mb(Fd,t,!0)},{keyCode:kg.BACKSPACE,action:mb(bb,t,!1)},{keyCode:kg.DELETE,action:mb(bb,t,!0)}],r).each(function(e){r.preventDefault()}))}),o.on("keyup",function(e){var t,n;
!1===e.isDefaultPrevented()&&(t=o,n=e,pb([{keyCode:kg.BACKSPACE,action:mb(pf,t)},{keyCode:kg.DELETE,action:mb(pf,t)}],n))})},xb=function(e){return A.from(e.dom.getParent(e.selection.getStart(!0),e.dom.isBlock))},wb=function(e,t){var n,r,o,i=t,a=e.dom,u=e.schema.getMoveCaretBeforeOnEnterElements();if(t){if(/^(LI|DT|DD)$/.test(t.nodeName)){var s=function(e){for(;e;){if(1===e.nodeType||3===e.nodeType&&e.data&&/[\r\n\s]/.test(e.data))return e;e=e.nextSibling}}(t.firstChild);s&&/^(UL|OL|DL)$/.test(s.nodeName)&&t.insertBefore(a.doc.createTextNode("\xa0"),t.firstChild)}if(o=a.createRng(),t.normalize(),t.hasChildNodes()){for(n=new no(t,t);r=n.current();){if(Ao.isText(r)){o.setStart(r,0),o.setEnd(r,0);break}if(u[r.nodeName.toLowerCase()]){o.setStartBefore(r),o.setEndBefore(r);break}i=r,r=n.next()}r||(o.setStart(i,0),o.setEnd(i,0))}else Ao.isBr(t)?t.nextSibling&&a.isBlock(t.nextSibling)?(o.setStartBefore(t),o.setEndBefore(t)):(o.setSta
rtAfter(t),o.setEndAfter(t)):(o.setStart(t,0),o.setEnd(t,0));e.selection.setRng(o),a.remove(void 0),e.selection.scrollIntoView(t)}},Nb=function(e,t){var n,r,o=e.getRoot();for(n=t;n!==o&&"false"!==e.getContentEditable(n);)"true"===e.getContentEditable(n)&&(r=n),n=n.parentNode;return n!==o?r:o},Eb=xb,Sb=function(e){return xb(e).fold(V.constant(""),function(e){return e.nodeName.toUpperCase()})},kb=function(e){return xb(e).filter(function(e){return po(qn.fromDom(e))}).isSome()},Tb=function(e,t){return e&&e.parentNode&&e.parentNode.nodeName===t},Ab=function(e){return e&&/^(OL|UL|LI)$/.test(e.nodeName)},Rb=function(e){var t=e.parentNode;return/^(LI|DT|DD)$/.test(t.nodeName)?t:e},Bb=function(e,t,n){for(var r=e[n?"firstChild":"lastChild"];r&&!Ao.isElement(r);)r=r[n?"nextSibling":"previousSibling"];return r===t},_b=function(e,t,n,r,o){var i=e.dom,a=e.selection.getRng();if(n!=
=e.getBody()){var u;Ab(u=n)&&Ab(u.parentNode)&&(o="LI");var s,c,l=o?t(o):i.create("BR");if(Bb(n,r,!0)&&Bb(n,r,!1))Tb(n,"LI")?i.insertAfter(l,Rb(n)):i.replace(l,n);else if(Bb(n,r,!0))Tb(n,"LI")?(i.insertAfter(l,Rb(n)),l.appendChild(i.doc.createTextNode(" ")),l.appendChild(n)):n.parentNode.insertBefore(l,n);else if(Bb(n,r,!1))i.insertAfter(l,Rb(n));else{n=Rb(n);var f=a.cloneRange();f.setStartAfter(r),f.setEndAfter(n);var d=f.extractContents();"LI"===o&&(c="LI",(s=d).firstChild&&s.firstChild.nodeName===c)?(l=d.firstChild,i.insertAfter(d,n)):(i.insertAfter(d,n),i.insertAfter(l,n))}i.remove(r),wb(e,l)}},Db=function(e){e.innerHTML='<br data-mce-bogus="1">'},Ob=function(e,t){return e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t},Pb=function(e,t){return t&&e.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&!/^
(fixed|absolute)/i.test(t.style.position)&&"true"!==e.getContentEditable(t)},Lb=function(e,t,n){return!1===Ao.isText(t)?n:e?1===n&&t.data.charAt(n-1)===Ei?0:n:n===t.data.length-1&&t.data.charAt(n)===Ei?t.data.length:n},Ib=function(e,t){var n,r,o=e.getRoot();for(n=t;n!==o&&"false"!==e.getContentEditable(n);)"true"===e.getContentEditable(n)&&(r=n),n=n.parentNode;return n!==o?r:o},Mb=function(e,t){var n=Au(e);n&&n.toLowerCase()===t.tagName.toLowerCase()&&e.dom.setAttribs(t,Ru(e))},Fb=function(a,e){var t,u,s,i,c,n,r,o,l,f,d,m,p,g,h,v,y,b,C=a.dom,x=a.schema,w=x.getNonEmptyElements(),N=a.selection.getRng(),E=function(e){var t,n,r,o=s,i=x.getTextInlineElements();if(e||"TABLE"===f||"HR"===f?(t=C.create(e||m),Mb(a,t)):t=c.cloneNode(!1),r=t,!1===Du(a))C.setAttrib(t,"style",null),C.setAttrib(t,"class",null);else do{if(i[o.nodeName]){if(xc(o))continue;n=o.cloneNode(!1),C
.setAttrib(n,"id",""),t.hasChildNodes()?n.appendChild(t.firstChild):r=n,t.appendChild(n)}}while((o=o.parentNode)&&o!==u);return Db(r),t},S=function(e){var t,n,r,o;if(o=Lb(e,s,i),Ao.isText(s)&&(e?0<o:o<s.nodeValue.length))return!1;if(s.parentNode===c&&p&&!e)return!0;if(e&&Ao.isElement(s)&&s===c.firstChild)return!0;if(Ob(s,"TABLE")||Ob(s,"HR"))return p&&!e||!p&&e;for(t=new no(s,c),Ao.isText(s)&&(e&&0===o?t.prev():e||o!==s.nodeValue.length||t.next());n=t.current();){if(Ao.isElement(n)){if(!n.getAttribute("data-mce-bogus")&&(r=n.nodeName.toLowerCase(),w[r]&&"br"!==r))return!1}else if(Ao.isText(n)&&!/^[ \t\r\n]*$/.test(n.nodeValue))return!1;e?t.prev():t.next()}return!0},k=function(){r=/^(H[1-6]|PRE|FIGURE)$/.test(f)&&"HGROUP"!==d?E(m):E(),Ou(a)&&Pb(C,l)&&C.isEmpty(c)?r=C.split(l,c):C.ins
ertAfter(r,c),wb(a,r)};rm.normalize(C,N).each(function(e){N.setStart(e.startContainer,e.startOffset),N.setEnd(e.endContainer,e.endOffset)}),s=N.startContainer,i=N.startOffset,m=Au(a),n=e.shiftKey,Ao.isElement(s)&&s.hasChildNodes()&&(p=i>s.childNodes.length-1,s=s.childNodes[Math.min(i,s.childNodes.length-1)]||s,i=p&&Ao.isText(s)?s.nodeValue.length:0),(u=Ib(C,s))&&((m&&!n||!m&&n)&&(s=function(e,t,n,r,o){var i,a,u,s,c,l,f,d=t||"P",m=e.dom,p=Ib(m,r);if(!(a=m.getParent(r,m.isBlock))||!Pb(m,a)){if(l=(a=a||p)===e.getBody()||(f=a)&&/^(TD|TH|CAPTION)$/.test(f.nodeName)?a.nodeName.toLowerCase():a.parentNode.nodeName.toLowerCase(),!a.hasChildNodes())return i=m.create(d),Mb(e,i),a.appendChild(i),n.setStart(i,0),n.setEnd(i,0),i;for(s=r;s.parentNode!==a;)s=s.parentNode;for(;s&&!m.isBlock(s);)s=(u=s).previousSibling;if(u&&e.schema.isValidChild(l,d.toLowerCase())){for(i=m.create(d),Mb(e,i),u.parentNode.inse
rtBefore(i,u),s=u;s&&!m.isBlock(s);)c=s.nextSibling,i.appendChild(s),s=c;n.setStart(r,o),n.setEnd(r,o)}}return r}(a,m,N,s,i)),c=C.getParent(s,C.isBlock),l=c?C.getParent(c.parentNode,C.isBlock):null,f=c?c.nodeName.toUpperCase():"","LI"!==(d=l?l.nodeName.toUpperCase():"")||e.ctrlKey||(l=(c=l).parentNode,f=d),/^(LI|DT|DD)$/.test(f)&&C.isEmpty(c)?_b(a,E,l,c,m):m&&c===a.getBody()||(m=m||"P",Ai(c)?(r=Mi(c),C.isEmpty(c)&&Db(c),wb(a,r)):S()?k():S(!0)?(r=c.parentNode.insertBefore(E(),c),wb(a,Ob(c,"HR")?r:c)):((t=(y=N,b=y.cloneRange(),b.setStart(y.startContainer,Lb(!0,y.startContainer,y.startOffset)),b.setEnd(y.endContainer,Lb(!1,y.endContainer,y.endOffset)),b).cloneRange()).setEndAfter(c),function(e){for(;Ao.isText(e)&&(e.nodeValue=e.nodeValue.replace(/^[\r\n]+/,"")),e=e.firstChild;);}(o=t.extractContents()),r=o.firstChild,C.insertAfter(o,c),function(e,t,n){var r,o=n,i=[];if(o){for(;o=o.firstC
hild;){if(e.isBlock(o))return;Ao.isElement(o)&&!t[o.nodeName.toLowerCase()]&&i.push(o)}for(r=i.length;r--;)!(o=i[r]).hasChildNodes()||o.firstChild===o.lastChild&&""===o.firstChild.nodeValue?e.remove(o):(a=o)&&"A"===a.nodeName&&0===Lt.trim(Si(a.innerText||a.textContent)).length&&e.remove(o);var a}}(C,w,r),g=C,(h=c).normalize(),(v=h.lastChild)&&!/^(left|right)$/gi.test(g.getStyle(v,"float",!0))||g.add(h,"br"),C.isEmpty(c)&&Db(c),r.normalize(),C.isEmpty(r)?(C.remove(r),k()):wb(a,r)),C.setAttrib(r,"id",""),a.fire("NewBlock",{newBlock:r})))},zb=function(e,t){return Eb(e).filter(function(e){return 0<t.length&&Br.is(qn.fromDom(e),t)}).isSome()},Ub=function(e){return zb(e,Bu(e))},qb=function(e){return zb(e,_u(e))},Vb=Yl([{br:[]},{block:[]},{none:[]}]),Hb=function(e,t){return qb(e)},jb=function(n){return function(e,t){return""===Au(e)===n}
},$b=function(n){return function(e,t){return kb(e)===n}},Wb=function(n){return function(e,t){return"PRE"===Sb(e)===n}},Kb=function(n){return function(e,t){return Tu(e)===n}},Xb=function(e,t){return Ub(e)},Yb=function(e,t){return t},Gb=function(e){var t=Au(e),n=Nb(e.dom,e.selection.getStart());return n&&e.schema.isValidChild(n.nodeName,t||"P")},Jb=function(e,t){return function(n,r){return H.foldl(e,function(e,t){return e&&t(n,r)},!0)?A.some(t):A.none()}},Qb=function(e,t){return Sf([Jb([Hb],Vb.none()),Jb([Wb(!0),Kb(!1),Yb],Vb.br()),Jb([Wb(!0),Kb(!1)],Vb.block()),Jb([Wb(!0),Kb(!0),Yb],Vb.block()),Jb([Wb(!0),Kb(!0)],Vb.br()),Jb([$b(!0),Yb],Vb.br()),Jb([$b(!0)],Vb.block()),Jb([jb(!0),Yb,Gb],Vb.block()),Jb([jb(!0)],Vb.br()),Jb([Xb],Vb.br()),Jb([jb(!1),Yb],Vb.br()),Jb([Gb],Vb.block())],[e,t.shiftKey]).getOr(Vb.none())},Zb=function(e,t){Qb(e,t).fold(function(){mm.insert(e,t)},function(){Fb(e,t)},V.noop)},eC=function(o){o.on("keydown",function(e)
{var t,n,r;e.keyCode===kg.ENTER&&(t=o,(n=e).isDefaultPrevented()||(n.preventDefault(),(r=t.undoManager).typing&&(r.typing=!1,r.add()),t.undoManager.transact(function(){!1===t.selection.isCollapsed()&&t.execCommand("Delete"),Zb(t,n)})))})},tC=function(e,t,n){return u=t,!(!nC(n)||!Ao.isText(u.container())||(r=e,i=(o=t).container(),a=o.offset(),i.insertData(a,"\xa0"),r.selection.setCursorLocation(i,a+1),0));var r,o,i,a,u},nC=function(e){return e.fold(V.constant(!1),V.constant(!0),V.constant(!0),V.constant(!1))},rC=function(e){return!!e.selection.isCollapsed()&&(t=e,n=V.curry(pl.isInlineTarget,t),r=Ba.fromRangeStart(t.selection.getRng()),Hf(n,t.getBody(),r).map(V.curry(tC,t,r)).getOr(!1));var t,n,r},oC=function(r){r.on("keydown",function(e){var t,n;!1===e.isDefaultPrevented()&&(t=r,n=e,pb([{keyCode:kg.SPACEBAR,action:mb(rC,t)}],n).each(function(e){n.preventDefault()}))})},iC=function(e,t){var n;t.hasAttribute("da
ta-mce-caret")&&(Mi(t),(n=e).selection.setRng(n.selection.getRng()),e.selection.scrollIntoView(t))},aC=function(e,t){var n,r=(n=e,Cl(qn.fromDom(n.getBody()),"*[data-mce-caret]").fold(V.constant(null),function(e){return e.dom()}));if(r)return"compositionstart"===t.type?(t.preventDefault(),t.stopPropagation(),void iC(e,r)):void(_i(r)&&(iC(e,r),e.undoManager.add()))},uC=function(e){e.on("keyup compositionstart",V.curry(aC,e))},sC=function(e){var t=td.setupSelectedState(e);uC(e),gb(e,t),Cb(e,t),eC(e),oC(e)};function cC(u){var s,n,r,o=Lt.each,c=kg.BACKSPACE,l=kg.DELETE,f=u.dom,d=u.selection,e=u.settings,t=u.parser,i=ge.gecko,a=ge.ie,m=ge.webkit,p="data:text/mce-internal,",g=a?"Text":"URL",h=function(e,t){try{u.getDoc().execCommand(e,!1,t)}catch(n){}},v=function(e){return e.isDefaultPrevented()},y=function(){u.shortcuts.add("meta+a",null,"SelectAll")},b=function(){u.on("keydown",
function(e){if(!v(e)&&e.keyCode===c&&d.isCollapsed()&&0===d.getRng().startOffset){var t=d.getNode().previousSibling;if(t&&t.nodeName&&"table"===t.nodeName.toLowerCase())return e.preventDefault(),!1}})},C=function(){u.inline||(u.contentStyles.push("body {min-height: 150px}"),u.on("click",function(e){var t;if("HTML"===e.target.nodeName){if(11<ge.ie)return void u.getBody().focus();t=u.selection.getRng(),u.getBody().focus(),u.selection.setRng(t),u.selection.normalize(),u.nodeChanged()}}))};return u.on("keydown",function(e){var t,n,r,o,i;if(!v(e)&&e.keyCode===kg.BACKSPACE&&(n=(t=d.getRng()).startContainer,r=t.startOffset,o=f.getRoot(),i=n,t.collapsed&&0===r)){for(;i&&i.parentNode&&i.parentNode.firstChild===i&&i.parentNode!==o;)i=i.parentNode;"BLOCKQUOTE"===i.tagName&&(u.formatter.toggle("blockquote",null,i),(t=f.createRng
()).setStart(n,0),t.setEnd(n,0),d.setRng(t))}}),s=function(e){var t=f.create("body"),n=e.cloneContents();return t.appendChild(n),d.serializer.serialize(t,{format:"html"})},u.on("keydown",function(e){var t,n,r,o,i,a=e.keyCode;if(!v(e)&&(a===l||a===c)){if(t=u.selection.isCollapsed(),n=u.getBody(),t&&!f.isEmpty(n))return;if(!t&&(r=u.selection.getRng(),o=s(r),(i=f.createRng()).selectNode(u.getBody()),o!==s(i)))return;e.preventDefault(),u.setContent(""),n.firstChild&&f.isBlock(n.firstChild)?u.selection.setCursorLocation(n.firstChild,0):u.selection.setCursorLocation(n,0),u.nodeChanged()}}),ge.windowsPhone||u.on("keyup focusin mouseup",function(e){kg.modifierPressed(e)||d.normalize()},!0),m&&(u.settings.content_editable||f.bind(u.getDoc(),"mousedown mouseup",function(e){var t;if(e.target===u.getDoc().documentElement)if(t=d.getRng(),u.getBody().focus(),"mousedown"===e.type){if(Bi(t.
startContainer))return;d.placeCaretAt(e.clientX,e.clientY)}else d.setRng(t)}),u.on("click",function(e){var t=e.target;/^(IMG|HR)$/.test(t.nodeName)&&"false"!==f.getContentEditableParent(t)&&(e.preventDefault(),u.selection.select(t),u.nodeChanged()),"A"===t.nodeName&&f.hasClass(t,"mce-item-anchor")&&(e.preventDefault(),d.select(t))}),e.forced_root_block&&u.on("init",function(){h("DefaultParagraphSeparator",e.forced_root_block)}),u.on("init",function(){u.dom.bind(u.getBody(),"submit",function(e){e.preventDefault()})}),b(),t.addNodeFilter("br",function(e){for(var t=e.length;t--;)"Apple-interchange-newline"===e[t].attr("class")&&e[t].remove()}),ge.iOS?(u.inline||u.on("keydown",function(){document.activeElement===document.body&&u.getWin().focus()}),C(),u.on("click",function(e){var t=e.target;do{if("A
"===t.tagName)return void e.preventDefault()}while(t=t.parentNode)}),u.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")):y()),11<=ge.ie&&(C(),b()),ge.ie&&(y(),h("AutoUrlDetect",!1),u.on("dragstart",function(e){var t,n,r;(t=e).dataTransfer&&(u.selection.isCollapsed()&&"IMG"===t.target.tagName&&d.select(t.target),0<(n=u.selection.getContent()).length&&(r=p+escape(u.id)+","+escape(n),t.dataTransfer.setData(g,r)))}),u.on("drop",function(e){if(!v(e)){var t=(i=e).dataTransfer&&(a=i.dataTransfer.getData(g))&&0<=a.indexOf(p)?(a=a.substr(p.length).split(","),{id:unescape(a[0]),html:unescape(a[1])}):null;if(t&&t.id!==u.id){e.preventDefault();var n=by.fromPoint(e.x,e.y,u.getDoc());d.setRng(n),r=t.html,o=!0,u.queryCommandSupported("mceInsertClipboardContent")?u.execCommand("mceInsertClipboardContent",
!1,{content:r,internal:o}):u.execCommand("mceInsertContent",!1,r)}}var r,o,i,a})),i&&(u.on("keydown",function(e){if(!v(e)&&e.keyCode===c){if(!u.getBody().getElementsByTagName("hr").length)return;if(d.isCollapsed()&&0===d.getRng().startOffset){var t=d.getNode(),n=t.previousSibling;if("HR"===t.nodeName)return f.remove(t),void e.preventDefault();n&&n.nodeName&&"hr"===n.nodeName.toLowerCase()&&(f.remove(n),e.preventDefault())}}}),Range.prototype.getClientRects||u.on("mousedown",function(e){if(!v(e)&&"HTML"===e.target.nodeName){var t=u.getBody();t.blur(),Ce.setEditorTimeout(u,function(){t.focus()})}}),n=function(){var e=f.getAttribs(d.getStart().cloneNode(!1));return function(){var t=d.getStart();t!==u.getBody()&&(f.setAttrib(t,"style",null),o(e,function(e){t.setAttributeNode(e.cloneNode(!0))}))}},r=function(){return!d.isCollapsed()&&f.ge
tParent(d.getStart(),f.isBlock)!==f.getParent(d.getEnd(),f.isBlock)},u.on("keypress",function(e){var t;if(!v(e)&&(8===e.keyCode||46===e.keyCode)&&r())return t=n(),u.getDoc().execCommand("delete",!1,null),t(),e.preventDefault(),!1}),f.bind(u.getDoc(),"cut",function(e){var t;!v(e)&&r()&&(t=n(),Ce.setEditorTimeout(u,function(){t()}))}),e.readonly||u.on("BeforeExecCommand MouseDown",function(){h("StyleWithCSS",!1),h("enableInlineTableEditing",!1),e.object_resizing||h("enableObjectResizing",!1)}),u.on("SetContent ExecCommand",function(e){"setcontent"!==e.type&&"mceInsertLink"!==e.command||o(f.select("a"),function(e){var t=e.parentNode,n=f.getRoot();if(t.lastChild===e){for(;t&&!f.isBlock(t);){if(t.parentNode.lastChild!==t||t===n)return;t=t.parentNode}f.add(t,"br",{"data-mce-bogus":1})}})}),u.contentStyles.push(&qu
ot;img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}"),ge.mac&&u.on("keydown",function(e){!kg.metaKeyPressed(e)||e.shiftKey||37!==e.keyCode&&39!==e.keyCode||(e.preventDefault(),u.selection.getSel().modify("move",37===e.keyCode?"backward":"forward","lineboundary"))}),b()),{refreshContentEditable:function(){},isHidden:function(){var e;return!i||u.removed?0:!(e=u.selection.getSel())||!e.rangeCount||0===e.rangeCount}}}var lC=function(e){return Ao.isElement(e)&&fo(qn.fromDom(e))},fC=function(t){t.on("click",function(e){3===e.detail&&function(e){var t=e.selection.getRng(),n=Ta.fromRangeStart(t),r=Ta.fromRangeEnd(t);if(Ta.isElementPosition(n)){var o=n.container();lC(o)&&Ka.firstPositionIn(o).each(function(e){return t.setStart(e.container(),e.offset())})}Ta.isElementPosition(r)&&(o=n.container(),lC(o)&&Ka.lastPositionIn(o).each(function(e){re
turn t.setEnd(e.container(),e.offset())})),e.selection.setRng(Wc(t))}(t)})},dC=di.DOM,mC=function(e){var t;e.bindPendingEventDelegates(),e.initialized=!0,e.fire("init"),e.focus(!0),e.nodeChanged({initial:!0}),e.execCallback("init_instance_callback",e),(t=e).settings.auto_focus&&Ce.setEditorTimeout(t,function(){var e;(e=!0===t.settings.auto_focus?t:t.editorManager.get(t.settings.auto_focus)).destroyed||e.focus()},100)},pC=function(t,e){var n,r,u,o,i,a,s,c,l,f=t.settings,d=t.getElement(),m=t.getDoc();f.inline||(t.getElement().style.visibility=t.orgVisibility),e||f.content_editable||(m.open(),m.write(t.iframeHTML),m.close()),f.content_editable&&(t.on("remove",function(){var e=this.getBody();dC.removeClass(e,"mce-content-body"),dC.removeClass(e,"mce-edit-focus"),dC.setAttrib(e,"contentEditable",null)}),dC.addClass(d,"mce-content-body"),t.contentDocument=m=f.content_document||document,t.contentWindow=f.
content_window||window,t.bodyElement=d,f.content_document=f.content_window=null,f.root_name=d.nodeName.toLowerCase()),(n=t.getBody()).disabled=!0,t.readonly=f.readonly,t.readonly||(t.inline&&"static"===dC.getStyle(n,"position",!0)&&(n.style.position="relative"),n.contentEditable=t.getParam("content_editable_state",!0)),n.disabled=!1,t.editorUpload=$p(t),t.schema=Zo(f),t.dom=di(m,{keep_values:!0,url_converter:t.convertURL,url_converter_scope:t,hex_colors:f.force_hex_style_colors,class_filter:f.class_filter,update_styles:!0,root_element:t.inline?t.getBody():null,collect:f.content_editable,schema:t.schema,onSetAttrib:function(e){t.fire("SetAttrib",e)}}),t.parser=((o=uy((u=t).settings,u.schema)).addAttributeFilter("src,href,style,tabindex",function(e,t){for(var n,r,o,i=e.length,a=u.dom;i--;)if(r=(n=e[i]).attr(t),o="data-mce-"+t,!n.attributes.map[o]){if(0===r.indexOf("data:")||0===r.indexOf(&q
uot;blob:"))continue;"style"===t?((r=a.serializeStyle(a.parseStyle(r),n.name)).length||(r=null),n.attr(o,r),n.attr(t,r)):"tabindex"===t?(n.attr(o,r),n.attr(t,null)):n.attr(o,u.convertURL(r,t,n.name))}}),o.addNodeFilter("script",function(e){for(var t,n,r=e.length;r--;)0!==(n=(t=e[r]).attr("type")||"no/type").indexOf("mce-")&&t.attr("type","mce-"+n)}),o.addNodeFilter("#cdata",function(e){for(var t,n=e.length;n--;)(t=e[n]).type=8,t.name="#comment",t.value="[CDATA["+t.value+"]]"}),o.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",function(e){for(var t,n=e.length,r=u.schema.getNonEmptyElements();n--;)(t=e[n]).isEmpty(r)&&0===t.getAll("br").length&&(t.append(new Gv("br",1)).shortEnded=!0)}),o),t.serializer=dy(f,t),t.selection=tb(t.dom,t.getWin(),t.serializer,t),t.formatter=Pv(t),t.undoManager=oh(t),t._nodeChangeDispatche
r=new Gp(t),t._selectionOverrides=Dg(t),fC(t),sC(t),Yp(t),t.fire("PreInit"),f.browser_spellcheck||f.gecko_spellcheck||(m.body.spellcheck=!1,dC.setAttrib(n,"spellcheck","false")),t.quirks=cC(t),t.fire("PostRender"),f.directionality&&(n.dir=f.directionality),f.nowrap&&(n.style.whiteSpace="nowrap"),f.protect&&t.on("BeforeSetContent",function(t){Lt.each(f.protect,function(e){t.content=t.content.replace(e,function(e){return"\x3c!--mce:protected "+escape(e)+"--\x3e"})})}),t.on("SetContent",function(){t.addVisual(t.getBody())}),t.load({initial:!0,format:"html"}),t.startContent=t.getContent({format:"raw"}),t.on("compositionstart compositionend",function(e){t.composing="compositionstart"===e.type}),0<t.contentStyles.length&&(r="",Lt.each(t.contentStyles,function(e){r+=e+"\r\n"}),t.dom.addStyle(r)),(i=t,i.inlin
e?dC.styleSheetLoader:i.dom.styleSheetLoader).loadAll(t.contentCSS,function(e){mC(t)},function(e){mC(t)}),f.content_style&&(a=t,s=f.content_style,c=qn.fromDom(a.getDoc().head),l=qn.fromTag("style"),cr.set(l,"type","text/css"),Fu.append(l,qn.fromText(s)),Fu.append(c,l))},gC=di.DOM,hC=function(e,t){var n,r,o,i,a,u,s,c=e.editorManager.translate("Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help"),l=(n=e.id,r=c,o=t.height,i=xu(e),s=qn.fromTag("iframe"),cr.setAll(s,i),cr.setAll(s,{id:n+"_ifr",frameBorder:"0",allowTransparency:"true",title:r}),vr(s,{width:"100%",height:(a=o,u="number"==typeof a?a+"px":a,u||""),display:"block"}),s).dom();l.onload=function(){l.onload=null,e.fire("load")};var f,d,m,p,g=function(e,t){if(document.domain!==window.location.hostname&&ge.ie&&ge.ie<12){var n=jp.uui
d("mce");e[n]=function(){pC(e)};var r='javascript:(function(){document.open();document.domain="'+document.domain+'";var ed = window.parent.tinymce.get("'+e.id+'");document.write(ed.iframeHTML);document.close();ed.'+n+"(true);})()";return gC.setAttrib(t,"src",r),!0}return!1}(e,l);return e.contentAreaContainer=t.iframeContainer,e.iframeElement=l,e.iframeHTML=(p=wu(f=e)+"<html><head>",Nu(f)!==f.documentBaseUrl&&(p+='<base href="'+f.documentBaseURI.getURI()+'" />'),p+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />',d=Eu(f),m=Su(f),ku(f)&&(p+='<meta http-equiv="Content-Security-Policy" content="'+ku(f)+'" />'),p+='</head><body id="'+d+'" class="mce-content-body '+m+'" data-id="'+f.id+'"><br></body></html>'),gC.add(t.iframeContainer,l),g},vC=function(e,
t){var n=hC(e,t);t.editorContainer&&(gC.get(t.editorContainer).style.display=e.orgDisplay,e.hidden=gC.isHidden(t.editorContainer)),e.getElement().style.display="none",gC.setAttrib(e.id,"aria-hidden","true"),n||pC(e)},yC=di.DOM,bC=function(t,n,e){var r,o,i=Tp.get(e);if(r=Tp.urls[e]||t.documentBaseUrl.replace(/\/$/,""),e=Lt.trim(e),i&&-1===Lt.inArray(n,e)){if(Lt.each(Tp.dependencies(e),function(e){bC(t,n,e)}),t.plugins[e])return;o=new i(t,r,t.$),(t.plugins[e]=o).init&&(o.init(t,r),n.push(e))}},CC=function(e){return e.replace(/^\-/,"")},xC=function(e){return{editorContainer:e,iframeContainer:e}},wC=function(e){var t,n,r=e.getElement();return e.inline?xC(null):(t=r,n=yC.create("div"),yC.insertAfter(n,t),xC(n))},NC=function(e){var t,n,r,o,i,a,u,s,c,l,f,d=e.settings,m=e.getElement();return e.orgDisplay=m.style.display,E.isString(d.theme)?(l=(o=e).settings,f=o.getElement(),i=l.width||yC.getStyle(f,"wid
th")||"100%",a=l.height||yC.getStyle(f,"height")||f.offsetHeight,u=l.min_height||100,(s=/^[0-9\.]+(|px)$/i).test(""+i)&&(i=Math.max(parseInt(i,10),100)),s.test(""+a)&&(a=Math.max(parseInt(a,10),u)),c=o.theme.renderUI({targetNode:f,width:i,height:a,deltaWidth:l.delta_width,deltaHeight:l.delta_height}),l.content_editable||(a=(c.iframeHeight||a)+("number"==typeof a?c.deltaHeight||0:""))<u&&(a=u),c.height=a,c):E.isFunction(d.theme)?(r=(t=e).getElement(),(n=t.settings.theme(t,r)).editorContainer.nodeType&&(n.editorContainer.id=n.editorContainer.id||t.id+"_parent"),n.iframeContainer&&n.iframeContainer.nodeType&&(n.iframeContainer.id=n.iframeContainer.id||t.id+"_iframecontainer"),n.height=n.iframeHeight?n.iframeHeight:r.offsetHeight,n):wC(e)},EC=function(t){var e,n,r,o,i,a,u=t.settings,s=t.getElement();return t.rtl=u.rtl_ui||t.editorManager.i18n.rtl,t.edit
orManager.i18n.setCode(u.language),u.aria_label=u.aria_label||yC.getAttrib(s,"aria-label",t.getLang("aria.rich_text_area")),t.fire("ScriptsLoaded"),o=(n=t).settings.theme,E.isString(o)?(n.settings.theme=CC(o),r=Ap.get(o),n.theme=new r(n,Ap.urls[o]),n.theme.init&&n.theme.init(n,Ap.urls[o]||n.documentBaseUrl.replace(/\/$/,""),n.$)):n.theme={},i=t,a=[],Lt.each(i.settings.plugins.split(/[ ,]/),function(e){bC(i,a,CC(e))}),e=NC(t),t.editorContainer=e.editorContainer?e.editorContainer:null,u.content_css&&Lt.each(Lt.explode(u.content_css),function(e){t.contentCSS.push(t.documentBaseURI.toAbsolute(e))}),u.content_editable?pC(t):vC(t,e)},SC=di.DOM,kC=function(e){return"-"===e.charAt(0)},TC=function(i,a){var u=vi.ScriptLoader;!function(e,t,n,r){var o=t.settings,i=o.theme;if(E.isString(i)){if(!kC(i)&&!Ap.urls.hasOwnProperty(i)){var a=o.theme_url;a?Ap.load(i,t.documentBaseURI.toAbsolute(a)):Ap.load(i,"themes/"+i+
"/theme"+n+".js")}e.loadQueue(function(){Ap.waitFor(i,r)})}else r()}(u,i,a,function(){var e,t,n,r,o;e=u,(n=(t=i).settings).language&&"en"!==n.language&&!n.language_url&&(n.language_url=t.editorManager.baseURL+"/langs/"+n.language+".js"),n.language_url&&!t.editorManager.i18n.data[n.language]&&e.add(n.language_url),r=i.settings,o=a,Lt.isArray(r.plugins)&&(r.plugins=r.plugins.join(" ")),Lt.each(r.external_plugins,function(e,t){Tp.load(t,e),r.plugins+=" "+t}),Lt.each(r.plugins.split(/[ ,]/),function(e){if((e=Lt.trim(e))&&!Tp.urls[e])if(kC(e)){e=e.substr(1,e.length);var t=Tp.dependencies(e);Lt.each(t,function(e){var t={prefix:"plugins/",resource:e,suffix:"/plugin"+o+".js"};e=Tp.createUrl(t,e),Tp.load(e.resource,e)})}else Tp.load(e,{prefix:"plugins/",resource:e,suffix:"/plugin"+o+".js"})}),u.loadQueue(func
tion(){i.removed||EC(i)},i,function(e){kp.pluginLoadError(i,e[0]),i.removed||EC(i)})})},AC=function(t){var e=t.settings,n=t.id,r=function(){SC.unbind(window,"ready",r),t.render()};if(Re.Event.domLoaded){if(t.getElement()&&ge.contentEditable){e.inline?t.inline=!0:(t.orgVisibility=t.getElement().style.visibility,t.getElement().style.visibility="hidden");var o=t.getElement().form||SC.getParent(n,"form");o&&(t.formElement=o,e.hidden_input&&!/TEXTAREA|INPUT/i.test(t.getElement().nodeName)&&(SC.insertAfter(SC.create("input",{type:"hidden",name:n}),n),t.hasHiddenInput=!0),t.formEventDelegate=function(e){t.fire(e.type,e)},SC.bind(o,"submit reset",t.formEventDelegate),t.on("reset",function(){t.setContent(t.startContent,{format:"raw"})}),!e.submit_patch||o.submit.nodeType||o.submit.length||o._mceOldSubmit||(o._mceOldSubmit=o.submit,o.submit=function(){return t.editorManager.triggerS
ave(),t.setDirty(!1),o._mceOldSubmit(o)})),t.windowManager=xp(t),t.notificationManager=Cp(t),"xml"===e.encoding&&t.on("GetContent",function(e){e.save&&(e.content=SC.encode(e.content))}),e.add_form_submit_trigger&&t.on("submit",function(){t.initialized&&t.save()}),e.add_unload_trigger&&(t._beforeUnload=function(){!t.initialized||t.destroyed||t.isHidden()||t.save({format:"raw",no_events:!0,set_dirty:!1})},t.editorManager.on("BeforeUnload",t._beforeUnload)),t.editorManager.add(t),TC(t,t.suffix)}}else SC.bind(window,"ready",r)},RC=function(e,t,n){var r=e.sidebars?e.sidebars:[];r.push({name:t,settings:n}),e.sidebars=r},BC=Lt.each,_C=Lt.trim,DC="source protocol authority userInfo user password host port relative path directory file query anchor".split(" "),OC={ftp:21,http:80,https:443,mailto:25},PC=function(r,e){var t,n,o=this;if(r=_C(r),t=(e=o.settings=e||{}).base_uri,/
^([\w\-]+):([^\/]{2})/i.test(r)||/^\s*#/.test(r))o.source=r;else{var i=0===r.indexOf("//");0!==r.indexOf("/")||i||(r=(t&&t.protocol||"http")+"://mce_host"+r),/^[\w\-]*:?\/\//.test(r)||(n=e.base_uri?e.base_uri.path:new PC(document.location.href).directory,""==e.base_uri.protocol?r="//mce_host"+o.toAbsPath(n,r):(r=/([^#?]*)([#?]?.*)/.exec(r),r=(t&&t.protocol||"http")+"://mce_host"+o.toAbsPath(n,r[1])+r[2])),r=r.replace(/@@/g,"(mce_at)"),r=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(r),BC(DC,function(e,t){var n=r[t];n&&(n=n.replace(/\(mce_at\)/g,"@@")),o[e]=n}),t&&(o.protocol||(o.protocol=t.protocol),o.userInfo||(o.userInfo=t.userInfo),o.port||"mce_host"!==o.host||(o.port=t.port),o.host&&a
mp;"mce_host"!==o.host||(o.host=t.host),o.source=""),i&&(o.protocol="")}};PC.prototype={setPath:function(e){e=/^(.*?)\/?(\w+)?$/.exec(e),this.path=e[0],this.directory=e[1],this.file=e[2],this.source="",this.getURI()},toRelative:function(e){var t;if("./"===e)return e;if("mce_host"!==(e=new PC(e,{base_uri:this})).host&&this.host!==e.host&&e.host||this.port!==e.port||this.protocol!==e.protocol&&""!==e.protocol)return e.getURI();var n=this.getURI(),r=e.getURI();return n===r||"/"===n.charAt(n.length-1)&&n.substr(0,n.length-1)===r?n:(t=this.toRelPath(this.path,e.path),e.query&&(t+="?"+e.query),e.anchor&&(t+="#"+e.anchor),t)},toAbsolute:function(e,t){return(e=new PC(e,{base_uri:this})).getURI(t&&this.isSameOrigin(e))},isSameOrigin:function(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;
var t=OC[this.protocol];if(t&&(this.port||t)==(e.port||t))return!0}return!1},toRelPath:function(e,t){var n,r,o,i=0,a="";if(e=(e=e.substring(0,e.lastIndexOf("/"))).split("/"),n=t.split("/"),e.length>=n.length)for(r=0,o=e.length;r<o;r++)if(r>=n.length||e[r]!==n[r]){i=r+1;break}if(e.length<n.length)for(r=0,o=n.length;r<o;r++)if(r>=e.length||e[r]!==n[r]){i=r+1;break}if(1===i)return t;for(r=0,o=e.length-(i-1);r<o;r++)a+="../";for(r=i-1,o=n.length;r<o;r++)a+=r!==i-1?"/"+n[r]:n[r];return a},toAbsPath:function(e,t){var n,r,o,i=0,a=[];for(r=/\/$/.test(t)?"/":"",e=e.split("/"),t=t.split("/"),BC(e,function(e){e&&a.push(e)}),e=a,n=t.length-1,a=[];0<=n;n--)0!==t[n].length&&"."!==t[n]&&(".."!==t[n]?0<i?i--:a.push(t[n]):i++);return 0!==(o=(n=e.length-i)<=0?a.reverse().join("/"):e.slice(0,n).join("/&qu
ot;)+"/"+a.reverse().join("/")).indexOf("/")&&(o="/"+o),r&&o.lastIndexOf("/")!==o.length-1&&(o+=r),o},getURI:function(e){var t,n=this;return n.source&&!e||(t="",e||(n.protocol?t+=n.protocol+"://":t+="//",n.userInfo&&(t+=n.userInfo+"@"),n.host&&(t+=n.host),n.port&&(t+=":"+n.port)),n.path&&(t+=n.path),n.query&&(t+="?"+n.query),n.anchor&&(t+="#"+n.anchor),n.source=t),n.source}},PC.parseDataUri=function(e){var t,n;return e=decodeURIComponent(e).split(","),(n=/data:([^;]+)/.exec(e[0]))&&(t=n[1]),{type:t,data:e[1]}},PC.getDocumentBaseUrl=function(e){var t;return t=0!==e.protocol.indexOf("http")&&"file:"!==e.protocol?e.href:e.protocol+"//"+e.host+e.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(t)&&(t=t.replace(/[\?#].*$/,"").re
place(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(t)||(t+="/")),t};var LC=function(e,t){t(e),e.firstChild&&LC(e.firstChild,t),e.next&&LC(e.next,t)},IC=function(e,t,n){var r=function(e,n,t){var r={},o={},i=[];for(var a in t.firstChild&&LC(t.firstChild,function(t){H.each(e,function(e){e.name===t.name&&(r[e.name]?r[e.name].nodes.push(t):r[e.name]={filter:e,nodes:[t]})}),H.each(n,function(e){"string"==typeof t.attr(e.name)&&(o[e.name]?o[e.name].nodes.push(t):o[e.name]={filter:e,nodes:[t]})})}),r)r.hasOwnProperty(a)&&i.push(r[a]);for(var u in o)o.hasOwnProperty(u)&&i.push(o[u]);return i}(e,t,n);H.each(r,function(t){H.each(t.filter.callbacks,function(e){e(t.nodes,t.filter.name,{})})})},MC=function(e){return e instanceof Gv},FC=function(e,t,n){var r,o,i,a,u;if(t.format=t.format?t.format:"html",t.get=!0,t.getInner=!0,t.no_events||e.fire("BeforeGetContent",t),"raw"===t.format)r=Lt.trim(
Ug.trimExternal(e.serializer,n.innerHTML));else if("text"===t.format)r=Si(n.innerText||n.textContent);else{if("tree"===t.format)return e.serializer.serialize(n,t);i=(o=e).serializer.serialize(n,t),a=Au(o),u=new RegExp("^(<"+a+"[^>]*>( | |\\s|\xa0|<br \\/>|)<\\/"+a+">[\r\n]*|<br \\/>[\r\n]*)$"),r=i.replace(u,"")}return"text"!==t.format?t.content=Lt.trim(r):t.content=r,t.no_events||e.fire("GetContent",t),t.content},zC=function(u,s,c){return void 0===c&&(c={}),c.format=c.format?c.format:"html",c.set=!0,c.content=MC(s)?"":s,MC(s)||c.no_events||(u.fire("BeforeSetContent",c),s=c.content),A.from(u.getBody()).fold(V.constant(s),function(e){return MC(s)?function(e,t,n,r){IC(e.parser.getNodeFilters(),e.parser.getAttributeFilters(),n);var o=jc({validate:e.validate},e.schema).serialize(n);return r.content=Lt.trim(o),e.dom.setHTML(t,r.
content),r.no_events||e.fire("SetContent",r),n}(u,e,s,c):(t=u,n=e,o=c,0===(r=s).length||/^\s+$/.test(r)?(a='<br data-mce-bogus="1">',"TABLE"===n.nodeName?r="<tr><td>"+a+"</td></tr>":/^(UL|OL)$/.test(n.nodeName)&&(r="<li>"+a+"</li>"),(i=Au(t))&&t.schema.isValidChild(n.nodeName.toLowerCase(),i.toLowerCase())?(r=a,r=t.dom.createHTML(i,t.settings.forced_root_block_attrs,r)):r||(r='<br data-mce-bogus="1">'),t.dom.setHTML(n,r),t.fire("SetContent",o)):("raw"!==o.format&&(r=jc({validate:t.validate},t.schema).serialize(t.parser.parse(r,{isRootContent:!0,insert:!0}))),o.content=Lt.trim(r),t.dom.setHTML(n,o.content),o.no_events||t.fire("SetContent",o)),o.content);var t,n,r,o,i,a})},UC=di.DOM,qC=function(e){return A.from(e).each(function(e){return e.destroy()})},VC=function(e){if(!e.removed){var t=e._selectionOverri
des,n=e.editorUpload,r=e.getBody(),o=e.getElement();r&&e.save(),e.removed=!0,e.unbindAllNativeEvents(),e.hasHiddenInput&&o&&UC.remove(o.nextSibling),!e.inline&&r&&(i=e,UC.setStyle(i.id,"display",i.orgDisplay)),qv(e),e.editorManager.remove(e),UC.remove(e.getContainer()),qC(t),qC(n),e.destroy()}var i},HC=function(e,t){var n,r,o,i=e.selection,a=e.dom;e.destroyed||(t||e.removed?(t||(e.editorManager.off("beforeunload",e._beforeUnload),e.theme&&e.theme.destroy&&e.theme.destroy(),qC(i),qC(a)),(r=(n=e).formElement)&&(r._mceOldSubmit&&(r.submit=r._mceOldSubmit,r._mceOldSubmit=null),UC.unbind(r,"submit reset",n.formEventDelegate)),(o=e).contentAreaContainer=o.formElement=o.container=o.editorContainer=null,o.bodyElement=o.contentDocument=o.contentWindow=null,o.iframeElement=o.targetElm=null,o.selection&&(o.selection=o.selection.win=o.selection.dom=o.selection.dom.doc=null),e.destroyed=
!0):e.remove())},jC=di.DOM,$C=Lt.extend,WC=Lt.each,KC=Lt.resolve,XC=ge.ie,YC=function(e,t,n){var r,o,i,a,u,s,c,l=this,f=l.documentBaseUrl=n.documentBaseURL,d=n.baseURI;r=l,o=e,i=f,a=n.defaultSettings,u=t,c={id:o,theme:"modern",delta_width:0,delta_height:0,popup_css:"",plugins:"",document_base_url:i,add_form_submit_trigger:!0,submit_patch:!0,add_unload_trigger:!0,convert_urls:!0,relative_urls:!0,remove_script_host:!0,object_resizing:!0,doctype:"<!DOCTYPE html>",visual:!0,font_size_style_values:"xx-small,x-small,small,medium,large,x-large,xx-large",font_size_legacy_values:"xx-small,small,medium,large,x-large,xx-large,300%",forced_root_block:"p",hidden_input:!0,render_ui:!0,indentation:"30px",inline_styles:!0,convert_fonts_to_spans:!0,indent:"simple",indent_before:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,a
rticle,hgroup,aside,figure,figcaption,option,optgroup,datalist",indent_after:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,article,hgroup,aside,figure,figcaption,option,optgroup,datalist",entity_encoding:"named",url_converter:(s=r).convertURL,url_converter_scope:s,ie7_compat:!0},t=sl(nl,c,a,u),l.settings=t,Ci.language=t.language||"en",Ci.languageLoad=t.language_load,Ci.baseURL=n.baseURL,l.id=e,l.setDirty(!1),l.plugins={},l.documentBaseURI=new PC(t.document_base_url,{base_uri:d}),l.baseURI=d,l.contentCSS=[],l.contentStyles=[],l.shortcuts=new tp(l),l.loadedCSS={},l.editorCommands=new Mm(l),l.suffix=n.suffix,l.editorManager=n,l.inline=t.inline,l.buttons={},l.menuItems={},t.cache_suffix&&(ge.cacheSuffix=t.cache_suffix.replace(/^[\?\&]+/,"")),!1===t.override_viewport&&(ge.overrideViewPort=!1),n.fire("SetupEditor",{editor:l}),l.execCallbac
k("setup",l),l.$=en.overrideDefaults(function(){return{context:l.inline?l.getBody():l.getDoc(),element:l.getBody()}})};$C(YC.prototype={render:function(){AC(this)},focus:function(e){fp(this,e)},hasFocus:function(){return dp(this)},execCallback:function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r,o=this.settings[e];if(o)return this.callbackLookup&&(r=this.callbackLookup[e])&&(o=r.func,r=r.scope),"string"==typeof o&&(r=(r=o.replace(/\.\w+$/,""))?KC(r):0,o=KC(o),this.callbackLookup=this.callbackLookup||{},this.callbackLookup[e]={func:o,scope:r}),o.apply(r||this,Array.prototype.slice.call(arguments,1))},translate:function(e){if(e&&Lt.is(e,"string")){var n=this.settings.language||"en",r=this.editorManager.i18n;e=r.data[n+"."+e]||e.replace(/\{\#([^\}]+)\}/g,function(e,t){return r.data[n+"."+t]||"{#"+t+"}"})}return this.editorManager.translat
e(e)},getLang:function(e,t){return this.editorManager.i18n.data[(this.settings.language||"en")+"."+e]||(t!==undefined?t:"{#"+e+"}")},getParam:function(e,t,n){return fl(this,e,t,n)},nodeChanged:function(e){this._nodeChangeDispatcher.nodeChanged(e)},addButton:function(e,t){var n=this;t.cmd&&(t.onclick=function(){n.execCommand(t.cmd)}),t.stateSelector&&"undefined"==typeof t.active&&(t.active=!1),t.text||t.icon||(t.icon=e),n.buttons=n.buttons,t.tooltip=t.tooltip||t.title,n.buttons[e]=t},addSidebar:function(e,t){return RC(this,e,t)},addMenuItem:function(e,t){var n=this;t.cmd&&(t.onclick=function(){n.execCommand(t.cmd)}),n.menuItems=n.menuItems,n.menuItems[e]=t},addContextToolbar:function(e,t){var n,r=this;r.contextToolbars=r.contextToolbars||[],"string"==typeof e&&(n=e,e=function(e){return r.dom.is(e,n)}),r.contextToolbars.push({id:jp.uuid("mcet"),predicate:e,items:t})},addComman
d:function(e,t,n){this.editorCommands.addCommand(e,t,n)},addQueryStateHandler:function(e,t,n){this.editorCommands.addQueryStateHandler(e,t,n)},addQueryValueHandler:function(e,t,n){this.editorCommands.addQueryValueHandler(e,t,n)},addShortcut:function(e,t,n,r){this.shortcuts.add(e,t,n,r)},execCommand:function(e,t,n,r){return this.editorCommands.execCommand(e,t,n,r)},queryCommandState:function(e){return this.editorCommands.queryCommandState(e)},queryCommandValue:function(e){return this.editorCommands.queryCommandValue(e)},queryCommandSupported:function(e){return this.editorCommands.queryCommandSupported(e)},show:function(){this.hidden&&(this.hidden=!1,this.inline?this.getBody().contentEditable=!0:(jC.show(this.getContainer()),jC.hide(this.id)),this.load(),this.fire("show"))},hide:function(){var e=this,t=e.getDoc();e.hidden||(XC&&t&&!e.inline&&t.execCommand("SelectAll"),e.save(),e.inline?(e.getBody().contentEditable=!1,e===e.editorMana
ger.focusedEditor&&(e.editorManager.focusedEditor=null)):(jC.hide(e.getContainer()),jC.setStyle(e.id,"display",e.orgDisplay)),e.hidden=!0,e.fire("hide"))},isHidden:function(){return!!this.hidden},setProgressState:function(e,t){this.fire("ProgressState",{state:e,time:t})},load:function(e){var t,n=this.getElement();return this.removed?"":n?((e=e||{}).load=!0,t=this.setContent(n.value!==undefined?n.value:n.innerHTML,e),e.element=n,e.no_events||this.fire("LoadContent",e),e.element=n=null,t):void 0},save:function(e){var t,n,r=this,o=r.getElement();if(o&&r.initialized&&!r.removed)return(e=e||{}).save=!0,e.element=o,e.content=r.getContent(e),e.no_events||r.fire("SaveContent",e),"raw"===e.format&&r.fire("RawSaveContent",e),t=e.content,/TEXTAREA|INPUT/i.test(o.nodeName)?o.value=t:(r.inline||(o.innerHTML=t),(n=jC.getParent(r.id,"form"))&&WC(n.elements,function(e){i
f(e.name===r.id)return e.value=t,!1})),e.element=o=null,!1!==e.set_dirty&&r.setDirty(!1),t},setContent:function(e,t){return zC(this,e,t)},getContent:function(e){return t=this,void 0===(n=e)&&(n={}),A.from(t.getBody()).fold(V.constant("tree"===n.format?new Gv("body",11):""),function(e){return FC(t,n,e)});var t,n},insertContent:function(e,t){t&&(e=$C({content:e},t)),this.execCommand("mceInsertContent",!1,e)},isDirty:function(){return!this.isNotDirty},setDirty:function(e){var t=!this.isNotDirty;this.isNotDirty=!e,e&&e!==t&&this.fire("dirty")},setMode:function(e){Gm(this,e)},getContainer:function(){return this.container||(this.container=jC.get(this.editorContainer||this.id+"_parent")),this.container},getContentAreaContainer:function(){return this.contentAreaContainer},getElement:function(){return this.targetElm||(this.targetElm=jC.get(this.id)),this.targetElm},getWin:function(){var e;retu
rn this.contentWindow||(e=this.iframeElement)&&(this.contentWindow=e.contentWindow),this.contentWindow},getDoc:function(){var e;return this.contentDocument||(e=this.getWin())&&(this.contentDocument=e.document),this.contentDocument},getBody:function(){var e=this.getDoc();return this.bodyElement||(e?e.body:null)},convertURL:function(e,t,n){var r=this.settings;return r.urlconverter_callback?this.execCallback("urlconverter_callback",e,n,!0,t):!r.convert_urls||n&&"LINK"===n.nodeName||0===e.indexOf("file:")||0===e.length?e:r.relative_urls?this.documentBaseURI.toRelative(e):e=this.documentBaseURI.toAbsolute(e,r.remove_script_host)},addVisual:function(e){var n,r=this,o=r.settings,i=r.dom;e=e||r.getBody(),r.hasVisual===undefined&&(r.hasVisual=o.visual),WC(i.select("table,a",e),function(e){var t;switch(e.nodeName){case"TABLE":return n=o.visual_table_class||"mce-item-table",void((t=i.getAttrib(e,"b
order"))&&"0"!==t||!r.hasVisual?i.removeClass(e,n):i.addClass(e,n));case"A":return void(i.getAttrib(e,"href")||(t=i.getAttrib(e,"name")||e.id,n=o.visual_anchor_class||"mce-item-anchor",t&&r.hasVisual?i.addClass(e,n):i.removeClass(e,n)))}}),r.fire("VisualAid",{element:e,hasVisual:r.hasVisual})},remove:function(){VC(this)},destroy:function(e){HC(this,e)},uploadImages:function(e){return this.editorUpload.uploadImages(e)},_scanForImages:function(){return this.editorUpload.scanForImages()}},Km);var GC,JC,QC,ZC={isEditorUIElement:function(e){return-1!==e.className.toString().indexOf("mce-")}},ex=function(n,e){var t,r,o=zn.detect().browser;o.isIE()||o.isEdge()?(r=n).on("focusout",function(){_m.store(r)}):(t=e,n.on("mouseup touchend",function(e){t.throttle()})),n.on("keyup nodechange",function(e){var t;"nodechange"===(t=e).type&&t.selectionChange||_m.sto
re(n)})},tx=function(e){var t,n,r,o=Eg(function(){_m.store(e)},0);e.inline&&(t=e,n=o,r=function(){n.throttle()},di.DOM.bind(document,"mouseup",r),t.on("remove",function(){di.DOM.unbind(document,"mouseup",r)})),e.on("init",function(){ex(e,o)}),e.on("remove",function(){o.cancel()})},nx=di.DOM,rx=function(e){return ZC.isEditorUIElement(e)},ox=function(t,e){var n=t?t.settings.custom_ui_selector:"";return null!==nx.getParent(e,function(e){return rx(e)||!!n&&t.dom.is(e,n)})},ix=function(r,e){var t=e.editor;tx(t),t.on("focusin",function(){var e=r.focusedEditor;e!==this&&(e&&e.fire("blur",{focusedEditor:this}),r.setActive(this),(r.focusedEditor=this).fire("focus",{blurredEditor:e}),this.focus(!0))}),t.on("focusout",function(){var t=this;Ce.setEditorTimeout(t,function(){var e=r.focusedEditor;ox(t,function(){try{return document.activeElement}catch(e){return docum
ent.body}}())||e!==t||(t.fire("blur",{focusedEditor:null}),r.focusedEditor=null)})}),GC||(GC=function(e){var t,n=r.activeEditor;t=e.target,n&&t.ownerDocument===document&&(t===document.body||ox(n,t)||r.focusedEditor!==n||(n.fire("blur",{focusedEditor:null}),r.focusedEditor=null))},nx.bind(document,"focusin",GC))},ax=function(e,t){e.focusedEditor===t.editor&&(e.focusedEditor=null),e.activeEditor||(nx.unbind(document,"focusin",GC),GC=null)},ux=function(e){e.on("AddEditor",V.curry(ix,e)),e.on("RemoveEditor",V.curry(ax,e))},sx={},cx="en",lx={setCode:function(e){e&&(cx=e,this.rtl=!!this.data[e]&&"rtl"===this.data[e]._dir)},getCode:function(){return cx},rtl:!1,add:function(e,t){var n=sx[e];for(var r in n||(sx[e]=n={}),t)n[r]=t[r];this.setCode(e)},translate:function(e){var t=sx[cx]||{},n=function(e){return Lt.is(e,"function")?Object.prototype.toString.call(e):r(e
)?"":""+e},r=function(e){return""===e||null===e||Lt.is(e,"undefined")},o=function(e){return e=n(e),Lt.hasOwn(t,e)?n(t[e]):e};if(r(e))return"";if(Lt.is(e,"object")&&Lt.hasOwn(e,"raw"))return n(e.raw);if(Lt.is(e,"array")){var i=e.slice(1);e=o(e[0]).replace(/\{([0-9]+)\}/g,function(e,t){return Lt.hasOwn(i,t)?n(i[t]):e})}return o(e).replace(/{context:\w+}$/,"")},data:sx},fx=di.DOM,dx=Lt.explode,mx=Lt.each,px=Lt.extend,gx=0,hx=!1,vx=[],yx=[],bx=function(t){mx(QC.get(),function(e){"scroll"===t.type?e.fire("ScrollWindow",t):e.fire("ResizeWindow",t)})},Cx=function(e){e!==hx&&(e?en(window).on("resize scroll",bx):en(window).off("resize scroll",bx),hx=e)},xx=function(t){var e=yx;delete vx[t.id];for(var n=0;n<vx.length;n++)if(vx[n]===t){vx.splice(n,1);break}return yx=H.filter(yx,function(e){return t!==e}),QC.activeEditor===t&&(QC.
activeEditor=0<yx.length?yx[0]:null),QC.focusedEditor===t&&(QC.focusedEditor=null),e.length!==yx.length};px(QC={defaultSettings:{},$:en,majorVersion:"4",minorVersion:"7.11",releaseDate:"2018-04-11",editors:vx,i18n:lx,activeEditor:null,settings:{},setup:function(){var e,t,n,r,o="";if(t=PC.getDocumentBaseUrl(document.location),/^[^:]+:\/\/\/?[^\/]+\//.test(t)&&(t=t.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(t)||(t+="/")),n=window.tinymce||window.tinyMCEPreInit)e=n.base||n.baseURL,o=n.suffix;else{for(var i=document.getElementsByTagName("script"),a=0;a<i.length;a++){var u=(r=i[a].src).substring(r.lastIndexOf("/"));if(/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(r)){-1!==u.indexOf(".min")&&(o=".min"),e=r.substring(0,r.lastIndexOf("/"));break}}!e&&document.currentScript&&(-1!==(r=document.currentS
cript.src).indexOf(".min")&&(o=".min"),e=r.substring(0,r.lastIndexOf("/")))}this.baseURL=new PC(t).toAbsolute(e),this.documentBaseURL=t,this.baseURI=new PC(this.baseURL),this.suffix=o,ux(this)},overrideDefaults:function(e){var t,n;(t=e.base_url)&&(this.baseURL=new PC(this.documentBaseURL).toAbsolute(t.replace(/\/+$/,"")),this.baseURI=new PC(this.baseURL)),n=e.suffix,e.suffix&&(this.suffix=n);var r=(this.defaultSettings=e).plugin_base_urls;for(var o in r)Ci.PluginManager.urls[o]=r[o]},init:function(r){var n,u,s=this;u=Lt.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option tbody tfoot thead tr script noscript style textarea video audio iframe object menu"," ");var c=function(e){var t=e.id;return t||(t=(t=e.name)&&!fx.get(t)?e.name:fx.uniqueId(),e.setAttribute("id",t)),t},l=function(e,t){return t.constructor===RegExp?t.te
st(e.className):fx.hasClass(e,t)},f=function(e){n=e},e=function(){var o,i=0,a=[],n=function(e,t,n){var r=new YC(e,t,s);a.push(r),r.on("init",function(){++i===o.length&&f(a)}),r.targetElm=r.targetElm||n,r.render()};fx.unbind(window,"ready",e),function(e){var t=r[e];t&&t.apply(s,Array.prototype.slice.call(arguments,2))}("onpageload"),o=en.unique(function(t){var e,n=[];if(ge.ie&&ge.ie<11)return kp.initError("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/"),[];if(t.types)return mx(t.types,function(e){n=n.concat(fx.select(e.selector))}),n;if(t.selector)return fx.select(t.selector);if(t.target)return[t.target];switch(t.mode){case"exact":0<(e=t.elements||"").length&&mx(dx(e),function(t){var e;(e=fx.get(t))?n.push(e):mx(document.forms,function(e){mx(e.elements,function(e){e.name===t&a
mp;&(t="mce_editor_"+gx++,fx.setAttrib(e,"id",t),n.push(e))})})});break;case"textareas":case"specific_textareas":mx(fx.select("textarea"),function(e){t.editor_deselector&&l(e,t.editor_deselector)||t.editor_selector&&!l(e,t.editor_selector)||n.push(e)})}return n}(r)),r.types?mx(r.types,function(t){Lt.each(o,function(e){return!fx.is(e,t.selector)||(n(c(e),px({},r,t),e),!1)})}):(Lt.each(o,function(e){var t;(t=s.get(e.id))&&t.initialized&&!(t.getContainer()||t.getBody()).parentNode&&(xx(t),t.unbindAllNativeEvents(),t.destroy(!0),t.removed=!0,t=null)}),0===(o=Lt.grep(o,function(e){return!s.get(e.id)})).length?f([]):mx(o,function(e){var t;t=e,r.inline&&t.tagName.toLowerCase()in u?kp.initError("Could not initialize inline editor on invalid inline target element",e):n(c(e),r,e)}))};return s.settings=r,fx.bind(window,"ready",e),new he(function(t){n?t(n):f=function(e){t(e)
}})},get:function(t){return 0===arguments.length?yx.slice(0):E.isString(t)?H.find(yx,function(e){return e.id===t}).getOr(null):E.isNumber(t)&&yx[t]?yx[t]:null},add:function(e){var t=this;return vx[e.id]===e||(null===t.get(e.id)&&("length"!==e.id&&(vx[e.id]=e),vx.push(e),yx.push(e)),Cx(!0),t.activeEditor=e,t.fire("AddEditor",{editor:e}),JC||(JC=function(){t.fire("BeforeUnload")},fx.bind(window,"beforeunload",JC))),e},createEditor:function(e,t){return this.add(new YC(e,t,this))},remove:function(e){var t,n,r=this;if(e)return E.isString(e)?(e=e.selector||e,void mx(fx.select(e),function(e){(n=r.get(e.id))&&r.remove(n)})):(n=e,E.isNull(r.get(n.id))?null:(xx(n)&&r.fire("RemoveEditor",{editor:n}),0===yx.length&&fx.unbind(window,"beforeunload",JC),n.remove(),Cx(0<yx.length),n));for(t=yx.length-1;0<=t;t--)r.remove(yx[t])},execCommand:function(e,t,n){var r=this.get(n);switch(e){cas
e"mceAddEditor":return this.get(n)||new YC(n,this.settings,this).render(),!0;case"mceRemoveEditor":return r&&r.remove(),!0;case"mceToggleEditor":return r?r.isHidden()?r.show():r.hide():this.execCommand("mceAddEditor",0,n),!0}return!!this.activeEditor&&this.activeEditor.execCommand(e,t,n)},triggerSave:function(){mx(yx,function(e){e.save()})},addI18n:function(e,t){lx.add(e,t)},translate:function(e){return lx.translate(e)},setActive:function(e){var t=this.activeEditor;this.activeEditor!==e&&(t&&t.fire("deactivate",{relatedTarget:e}),e.fire("activate",{relatedTarget:t})),this.activeEditor=e}},Vm),QC.setup();var wx,Nx=QC;function Ex(n){return{walk:function(e,t){return Yh.walk(n,e,t)},split:_h.split,normalize:function(t){return rm.normalize(n,t).fold(V.constant(!1),function(e){return t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),!0})}}}(wx=Ex||(Ex={})).compareRange
s=Gd.isEq,wx.getCaretRangeFromPoint=by.fromPoint,wx.getSelectedNode=ta,wx.getNode=na;var Sx,kx,Tx=Ex,Ax=Math.min,Rx=Math.max,Bx=Math.round,_x=function(e,t,n){var r,o,i,a,u,s;return r=t.x,o=t.y,i=e.w,a=e.h,u=t.w,s=t.h,"b"===(n=(n||"").split(""))[0]&&(o+=s),"r"===n[1]&&(r+=u),"c"===n[0]&&(o+=Bx(s/2)),"c"===n[1]&&(r+=Bx(u/2)),"b"===n[3]&&(o-=a),"r"===n[4]&&(r-=i),"c"===n[3]&&(o-=Bx(a/2)),"c"===n[4]&&(r-=Bx(i/2)),Dx(r,o,i,a)},Dx=function(e,t,n,r){return{x:e,y:t,w:n,h:r}},Ox={inflate:function(e,t,n){return Dx(e.x-t,e.y-n,e.w+2*t,e.h+2*n)},relativePosition:_x,findBestRelativePosition:function(e,t,n,r){var o,i;for(i=0;i<r.length;i++)if((o=_x(e,t,r[i])).x>=n.x&&o.x+o.w<=n.w+n.x&&o.y>=n.y&&o.y+o.h<=n.h+n.y)return r[i];return null},intersect:function(e,t){var n,r,o,i;return n=Rx(e.x,t.x),r=Rx(
e.y,t.y),o=Ax(e.x+e.w,t.x+t.w),i=Ax(e.y+e.h,t.y+t.h),o-n<0||i-r<0?null:Dx(n,r,o-n,i-r)},clamp:function(e,t,n){var r,o,i,a,u,s,c,l,f,d;return u=e.x,s=e.y,c=e.x+e.w,l=e.y+e.h,f=t.x+t.w,d=t.y+t.h,r=Rx(0,t.x-u),o=Rx(0,t.y-s),i=Rx(0,c-f),a=Rx(0,l-d),u+=r,s+=o,n&&(c+=r,l+=o,u-=i,s-=a),Dx(u,s,(c-=i)-u,(l-=a)-s)},create:Dx,fromClientRect:function(e){return Dx(e.left,e.top,e.width,e.height)}},Px={},Lx={add:function(e,t){Px[e.toLowerCase()]=t},has:function(e){return!!Px[e.toLowerCase()]},get:function(e){var t=e.toLowerCase(),n=Px.hasOwnProperty(t)?Px[t]:null;if(null===n)throw new Error("Could not find module for type: "+e);return n},create:function(e,t){var n;if("string"==typeof e?(t=t||{}).type=e:e=(t=e).type,e=e.toLowerCase(),!(n=Px[e]))throw new Error("Could not find control by type: "+e);return(n=new n(t)).type=e,n}},Ix=Lt.each,Mx=Lt.extend,Fx=function(){};Fx.extend=Sx=function(n){var e,t,r,o=this.prototype,i=function(){var e,t,n;if(!kx&&
;(this.init&&this.init.apply(this,arguments),t=this.Mixins))for(e=t.length;e--;)(n=t[e]).init&&n.init.apply(this,arguments)},a=function(){return this},u=function(n,r){return function(){var e,t=this._super;return this._super=o[n],e=r.apply(this,arguments),this._super=t,e}};for(t in kx=!0,e=new this,kx=!1,n.Mixins&&(Ix(n.Mixins,function(e){for(var t in e)"init"!==t&&(n[t]=e[t])}),o.Mixins&&(n.Mixins=o.Mixins.concat(n.Mixins))),n.Methods&&Ix(n.Methods.split(","),function(e){n[e]=a}),n.Properties&&Ix(n.Properties.split(","),function(e){var t="_"+e;n[e]=function(e){return e!==undefined?(this[t]=e,this):this[t]}}),n.Statics&&Ix(n.Statics,function(e,t){i[t]=e}),n.Defaults&&o.Defaults&&(n.Defaults=Mx({},o.Defaults,n.Defaults)),n)"function"==typeof(r=n[t])&&o[t]?e[t]=u(t,r):e[t]=r;return i.prototype=e,(i.constructor=i).extend=Sx,i};var zx=Math.min,Ux=Math.
max,qx=Math.round,Vx=function(e,n){var r,o,t,i;if(n=n||'"',null===e)return"null";if("string"==(t=typeof e))return o="\bb\tt\nn\ff\rr\"\"''\\\\",n+e.replace(/([\u0080-\uFFFF\x00-\x1f\"\'\\])/g,function(e,t){return'"'===n&&"'"===e?e:(r=o.indexOf(t))+1?"\\"+o.charAt(r+1):(e=t.charCodeAt().toString(16),"\\u"+"0000".substring(e.length)+e)})+n;if("object"===t){if(e.hasOwnProperty&&"[object Array]"===Object.prototype.toString.call(e)){for(r=0,o="[";r<e.length;r++)o+=(0<r?",":"")+Vx(e[r],n);return o+"]"}for(i in o="{",e)e.hasOwnProperty(i)&&(o+="function"!=typeof e[i]?(1<o.length?","+n:n)+i+n+":"+Vx(e[i],n):"");return o+"}"}return""+e},Hx={serialize:Vx,parse:function(e){try{return JSON.parse(e)}catch(t){}}},jx={callbacks:{},count:0,send:
function(t){var n=this,r=di.DOM,o=t.count!==undefined?t.count:n.count,i="tinymce_jsonp_"+o;n.callbacks[o]=function(e){r.remove(i),delete n.callbacks[o],t.callback(e)},r.add(r.doc.body,"script",{id:i,src:t.url,type:"text/javascript"}),n.count++}},$x={send:function(e){var t,n=0,r=function(){!e.async||4===t.readyState||1e4<n++?(e.success&&n<1e4&&200===t.status?e.success.call(e.success_scope,""+t.responseText,t,e):e.error&&e.error.call(e.error_scope,1e4<n?"TIMED_OUT":"GENERAL",t,e),t=null):setTimeout(r,10)};if(e.scope=e.scope||this,e.success_scope=e.success_scope||e.scope,e.error_scope=e.error_scope||e.scope,e.async=!1!==e.async,e.data=e.data||"",$x.fire("beforeInitialize",{settings:e}),t=new Rp){if(t.overrideMimeType&&t.overrideMimeType(e.content_type),t.open(e.type||(e.data?"POST":"GET"),e.url,e.async),e.crossDomain&&(t.withCredentials=!0
),e.content_type&&t.setRequestHeader("Content-Type",e.content_type),e.requestheaders&&Lt.each(e.requestheaders,function(e){t.setRequestHeader(e.key,e.value)}),t.setRequestHeader("X-Requested-With","XMLHttpRequest"),(t=$x.fire("beforeSend",{xhr:t,settings:e}).xhr).send(e.data),!e.async)return r();setTimeout(r,10)}}};Lt.extend($x,Vm);var Wx=Lt.extend,Kx=function(e){this.settings=Wx({},e),this.count=0};Kx.sendRPC=function(e){return(new Kx).send(e)},Kx.prototype={send:function(n){var r=n.error,o=n.success;(n=Wx(this.settings,n)).success=function(e,t){void 0===(e=Hx.parse(e))&&(e={error:"JSON Parse error."}),e.error?r.call(n.error_scope||n.scope,e.error,t):o.call(n.success_scope||n.scope,e.result)},n.error=function(e,t){r&&r.call(n.error_scope||n.scope,e,t)},n.data=Hx.serialize({id:n.id||"c"+this.count++,method:n.method,params:n.params}),n.content_type="application/json",$x.send(n)}};var
Xx,Yx=window.localStorage,Gx=Nx,Jx={geom:{Rect:Ox},util:{Promise:he,Delay:Ce,Tools:Lt,VK:kg,URI:PC,Class:Fx,EventDispatcher:zm,Observable:Vm,I18n:lx,XHR:$x,JSON:Hx,JSONRequest:Kx,JSONP:jx,LocalStorage:Yx,Color:function(e){var n={},u=0,s=0,c=0,t=function(e){var t;return"object"==typeof e?"r"in e?(u=e.r,s=e.g,c=e.b):"v"in e&&function(e,t,n){var r,o,i,a;if(e=(parseInt(e,10)||0)%360,t=parseInt(t,10)/100,n=parseInt(n,10)/100,t=Ux(0,zx(t,1)),n=Ux(0,zx(n,1)),0!==t){switch(r=e/60,i=(o=n*t)*(1-Math.abs(r%2-1)),a=n-o,Math.floor(r)){case 0:u=o,s=i,c=0;break;case 1:u=i,s=o,c=0;break;case 2:u=0,s=o,c=i;break;case 3:u=0,s=i,c=o;break;case 4:u=i,s=0,c=o;break;case 5:u=o,s=0,c=i;break;default:u=s=c=0}u=qx(255*(u+a)),s=qx(255*(s+a)),c=qx(255*(c+a))}else u=s=c=qx(255*n)}(e.h,e.s,e.v):(t=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)[^\)]*\)/gi.exec(e))?(u=parseInt(t[1],10),s=parseInt(t[2],10),c=parseInt(t[3],10)):(t=/#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(e
))?(u=parseInt(t[1],16),s=parseInt(t[2],16),c=parseInt(t[3],16)):(t=/#([0-F])([0-F])([0-F])/gi.exec(e))&&(u=parseInt(t[1]+t[1],16),s=parseInt(t[2]+t[2],16),c=parseInt(t[3]+t[3],16)),u=u<0?0:255<u?255:u,s=s<0?0:255<s?255:s,c=c<0?0:255<c?255:c,n};return e&&t(e),n.toRgb=function(){return{r:u,g:s,b:c}},n.toHsv=function(){return e=u,t=s,n=c,o=0,(i=zx(e/=255,zx(t/=255,n/=255)))===(a=Ux(e,Ux(t,n)))?{h:0,s:0,v:100*(o=i)}:(r=(a-i)/a,{h:qx(60*((e===i?3:n===i?1:5)-(e===i?t-n:n===i?e-t:n-e)/((o=a)-i))),s:qx(100*r),v:qx(100*o)});var e,t,n,r,o,i,a},n.toHex=function(){var e=function(e){return 1<(e=parseInt(e,10).toString(16)).length?e:"0"+e};return"#"+e(u)+e(s)+e(c)},n.parse=t,n}},dom:{EventUtils:Re,Sizzle:dt,DomQuery:en,TreeWalker:no,DOMUtils:di,ScriptLoader:vi,RangeUtils:Tx,Serializer:dy,ControlSelection:vy,BookmarkManager:py,Selection:tb,Event:Re.Event},html:{Styles:ti,Entities:Vo,Node:Gv,Schema:Zo,SaxParser:Fg,DomParser:uy,Writer:Hc,Seri
alizer:jc},ui:{Factory:Lx},Env:ge,AddOnManager:Ci,Formatter:Pv,UndoManager:oh,EditorCommands:Mm,WindowManager:xp,NotificationManager:Cp,EditorObservable:Km,Shortcuts:tp,Editor:YC,FocusManager:ZC,EditorManager:Nx,DOM:di.DOM,ScriptLoader:vi.ScriptLoader,PluginManager:Ci.PluginManager,ThemeManager:Ci.ThemeManager,trim:Lt.trim,isArray:Lt.isArray,is:Lt.is,toArray:Lt.toArray,makeMap:Lt.makeMap,each:Lt.each,map:Lt.map,grep:Lt.grep,inArray:Lt.inArray,extend:Lt.extend,create:Lt.create,walk:Lt.walk,createNS:Lt.createNS,resolve:Lt.resolve,explode:Lt.explode,_addCacheSuffix:Lt._addCacheSuffix,isOpera:ge.opera,isWebKit:ge.webkit,isIE:ge.ie,isGecko:ge.gecko,isMac:ge.mac},Qx=Gx=Lt.extend(Gx,Jx);Xx=Qx,window.tinymce=Xx,window.tinyMCE=Xx,function(e){if("object"==typeof module)try{module.exports=e}catch(t){}}(Qx)}();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjstinymceutilsvalidatejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/js/tinymce/utils/validate.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/js/tinymce/utils/validate.js 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/js/tinymce/utils/validate.js 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -230,12 +230,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> addClass : function (n, c, b) {
</span><span class="cx" style="display: block; padding: 0 10px"> var o = this.removeClass(n, c);
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ n.className = b ? c + (o !== '' ? (' ' + o) : '') : (o !== '' ? (o + ' ') : '') + c;
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> removeClass : function (n, c) {
</span><span class="cx" style="display: block; padding: 0 10px"> c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return n.className = c != ' ' ? c : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return n.className = c !== ' ' ? c : '';
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> tags : function (f, s) {
</span></span></pre></div>
<a id="trunksrcwpincludesversionphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/version.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/version.php 2018-04-25 18:10:00 UTC (rev 43003)
+++ trunk/src/wp-includes/version.php 2018-04-25 22:34:41 UTC (rev 43004)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,7 +18,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global string $tinymce_version
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-$tinymce_version = '4607-20180123';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$tinymce_version = '4711-20180425';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Holds the required PHP version
</span></span></pre>
</div>
</div>
</body>
</html>