tinymce-rails 5.6.2.1 → 5.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/source/tinymce/tinymce.js +1265 -1174
  3. data/lib/tinymce/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +2 -2
  5. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +1 -1
  6. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +1 -1
  8. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
  9. data/vendor/assets/javascripts/tinymce/plugins/bbcode/plugin.js +1 -1
  10. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -1
  11. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  12. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +2 -2
  13. data/vendor/assets/javascripts/tinymce/plugins/colorpicker/plugin.js +1 -1
  14. data/vendor/assets/javascripts/tinymce/plugins/contextmenu/plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +2 -2
  16. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +2 -2
  17. data/vendor/assets/javascripts/tinymce/plugins/fullpage/plugin.js +2 -2
  18. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +2 -2
  19. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +2 -2
  20. data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.js +1 -1
  21. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +2 -2
  22. data/vendor/assets/javascripts/tinymce/plugins/imagetools/plugin.js +2 -2
  23. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +2 -2
  24. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +1 -1
  25. data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/plugin.js +1 -1
  26. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +2 -2
  27. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +2 -2
  28. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -2
  29. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
  30. data/vendor/assets/javascripts/tinymce/plugins/noneditable/plugin.js +1 -1
  31. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +1 -1
  32. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +2 -2
  33. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +2 -2
  34. data/vendor/assets/javascripts/tinymce/plugins/print/plugin.js +1 -1
  35. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -2
  36. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
  37. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +2 -2
  38. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.js +2 -2
  39. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.js +2 -2
  40. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  41. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +2 -2
  42. data/vendor/assets/javascripts/tinymce/plugins/textcolor/plugin.js +1 -1
  43. data/vendor/assets/javascripts/tinymce/plugins/textpattern/plugin.js +2 -2
  44. data/vendor/assets/javascripts/tinymce/plugins/toc/plugin.js +1 -1
  45. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
  46. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -1
  47. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +1 -1
  48. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.css +1 -1
  49. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.css +1 -1
  50. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  51. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  52. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
  53. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  54. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +1 -1
  55. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -1
  56. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.css +1 -1
  57. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.css +1 -1
  58. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  59. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.min.css +1 -1
  60. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
  61. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
  62. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.shadowdom.css +1 -1
  63. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.shadowdom.min.css +1 -1
  64. data/vendor/assets/javascripts/tinymce/themes/mobile/theme.js +2 -2
  65. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
  66. data/vendor/assets/javascripts/tinymce/tinymce.d.ts +431 -389
  67. data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
  68. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '07884171bafd72dbe196a0c4c3a09b5dd856a9c4a916c81acb2ca47c8b3d0173'
4
- data.tar.gz: 60839fc89a4f102bc700bd3e36063e13851279ac610b1dc9005b6d7750b769cd
3
+ metadata.gz: b234fea66f361a361266406d0efca1a818e0baf682cfb8ea7767b11d7df537a6
4
+ data.tar.gz: 6d99aa630bf351c1667e8663b3d488f96eff5450a879948781ecd3ae3c8cb6a5
5
5
  SHA512:
6
- metadata.gz: 3d637fc1e06bf1b28140cf7555bedb1873bcb994fb272cd5a348c61cafbfd1e6d66cccfb881f03e6774037d3d500b2928a69993c25057949118e49c555172e7d
7
- data.tar.gz: 17fb09a8ec00b69764a1e3174bf61ea6637a564250ece124172ebb27f488ca83571ada96fe2c9253237fe77b682d726a1ca5db2da674301eb819fe0e855b9ff0
6
+ metadata.gz: 0eb32ff441d04558f7c0d8cd376cbfc01108275786212d09aa80283182125c8c7db5d7cacd0d89aad47b743797ebdbc6c77b04c71182a590be7d67f9ecc29ebe
7
+ data.tar.gz: '091bbcd6597d13369b4977426b8bcbf67d9b1ac5097ecbc409f207061e2f5ca83b603563abda94ccb64c32a48a2cc55fd37001bd34119eae74bfc5e74fb2c031'
@@ -4,7 +4,7 @@
4
4
  * For LGPL see License.txt in the project root for license information.
5
5
  * For commercial licenses see https://www.tiny.cloud/
6
6
  *
7
- * Version: 5.6.2 (2020-12-08)
7
+ * Version: 5.7.1 (2021-03-17)
8
8
  */
9
9
  (function () {
10
10
  'use strict';
@@ -157,6 +157,9 @@
157
157
  throw new Error(msg);
158
158
  };
159
159
  };
160
+ var apply = function (f) {
161
+ return f();
162
+ };
160
163
  var call = function (f) {
161
164
  f();
162
165
  };
@@ -1143,8 +1146,7 @@
1143
1146
  return;
1144
1147
  }
1145
1148
  if (!p[cn]) {
1146
- p[cn] = function () {
1147
- };
1149
+ p[cn] = noop;
1148
1150
  de = 1;
1149
1151
  }
1150
1152
  ns[cn] = p[cn];
@@ -1482,7 +1484,7 @@
1482
1484
  };
1483
1485
 
1484
1486
  var isShadowRoot = function (dos) {
1485
- return isDocumentFragment(dos);
1487
+ return isDocumentFragment(dos) && isNonNullable(dos.dom.host);
1486
1488
  };
1487
1489
  var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);
1488
1490
  var isSupported = constant(supported);
@@ -2707,14 +2709,14 @@
2707
2709
  }
2708
2710
  constructors.push(key);
2709
2711
  adt[key] = function () {
2710
- var argLength = arguments.length;
2712
+ var args = [];
2713
+ for (var _i = 0; _i < arguments.length; _i++) {
2714
+ args[_i] = arguments[_i];
2715
+ }
2716
+ var argLength = args.length;
2711
2717
  if (argLength !== value.length) {
2712
2718
  throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength);
2713
2719
  }
2714
- var args = new Array(argLength);
2715
- for (var i = 0; i < args.length; i++) {
2716
- args[i] = arguments[i];
2717
- }
2718
2720
  var match = function (branches) {
2719
2721
  var branchKeys = keys(branches);
2720
2722
  if (constructors.length !== branchKeys.length) {
@@ -2730,10 +2732,14 @@
2730
2732
  };
2731
2733
  return {
2732
2734
  fold: function () {
2733
- if (arguments.length !== cases.length) {
2734
- throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + arguments.length);
2735
+ var foldArgs = [];
2736
+ for (var _i = 0; _i < arguments.length; _i++) {
2737
+ foldArgs[_i] = arguments[_i];
2735
2738
  }
2736
- var target = arguments[count];
2739
+ if (foldArgs.length !== cases.length) {
2740
+ throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + foldArgs.length);
2741
+ }
2742
+ var target = foldArgs[count];
2737
2743
  return target.apply(null, args);
2738
2744
  },
2739
2745
  match: match,
@@ -2844,11 +2850,15 @@
2844
2850
  };
2845
2851
 
2846
2852
  var promise = function () {
2847
- function bind(fn, thisArg) {
2853
+ var bind = function (fn, thisArg) {
2848
2854
  return function () {
2849
- fn.apply(thisArg, arguments);
2855
+ var args = [];
2856
+ for (var _i = 0; _i < arguments.length; _i++) {
2857
+ args[_i] = arguments[_i];
2858
+ }
2859
+ fn.apply(thisArg, args);
2850
2860
  };
2851
- }
2861
+ };
2852
2862
  var isArray = Array.isArray || function (value) {
2853
2863
  return Object.prototype.toString.call(value) === '[object Array]';
2854
2864
  };
@@ -2865,7 +2875,7 @@
2865
2875
  doResolve(fn, bind(resolve, this), bind(reject, this));
2866
2876
  };
2867
2877
  var asap = Promise.immediateFn || typeof setImmediate === 'function' && setImmediate || function (fn) {
2868
- setTimeout(fn, 1);
2878
+ return setTimeout(fn, 1);
2869
2879
  };
2870
2880
  function handle(deferred) {
2871
2881
  var me = this;
@@ -2925,7 +2935,7 @@
2925
2935
  this.resolve = resolve;
2926
2936
  this.reject = reject;
2927
2937
  }
2928
- function doResolve(fn, onFulfilled, onRejected) {
2938
+ var doResolve = function (fn, onFulfilled, onRejected) {
2929
2939
  var done = false;
2930
2940
  try {
2931
2941
  fn(function (value) {
@@ -2948,7 +2958,7 @@
2948
2958
  done = true;
2949
2959
  onRejected(ex);
2950
2960
  }
2951
- }
2961
+ };
2952
2962
  Promise.prototype.catch = function (onRejected) {
2953
2963
  return this.then(null, onRejected);
2954
2964
  };
@@ -2959,13 +2969,17 @@
2959
2969
  });
2960
2970
  };
2961
2971
  Promise.all = function () {
2962
- var args = Array.prototype.slice.call(arguments.length === 1 && isArray(arguments[0]) ? arguments[0] : arguments);
2972
+ var values = [];
2973
+ for (var _i = 0; _i < arguments.length; _i++) {
2974
+ values[_i] = arguments[_i];
2975
+ }
2976
+ var args = Array.prototype.slice.call(values.length === 1 && isArray(values[0]) ? values[0] : values);
2963
2977
  return new Promise(function (resolve, reject) {
2964
2978
  if (args.length === 0) {
2965
2979
  return resolve([]);
2966
2980
  }
2967
2981
  var remaining = args.length;
2968
- function res(i, val) {
2982
+ var res = function (i, val) {
2969
2983
  try {
2970
2984
  if (val && (typeof val === 'object' || typeof val === 'function')) {
2971
2985
  var then = val.then;
@@ -2983,7 +2997,7 @@
2983
2997
  } catch (ex) {
2984
2998
  reject(ex);
2985
2999
  }
2986
- }
3000
+ };
2987
3001
  for (var i = 0; i < args.length; i++) {
2988
3002
  res(i, args[i]);
2989
3003
  }
@@ -3015,16 +3029,16 @@
3015
3029
 
3016
3030
  var requestAnimationFramePromise;
3017
3031
  var requestAnimationFrame = function (callback, element) {
3018
- var i, requestAnimationFrameFunc = window.requestAnimationFrame;
3032
+ var requestAnimationFrameFunc = window.requestAnimationFrame;
3019
3033
  var vendors = [
3020
3034
  'ms',
3021
3035
  'moz',
3022
3036
  'webkit'
3023
3037
  ];
3024
- var featurefill = function (callback) {
3025
- window.setTimeout(callback, 0);
3038
+ var featurefill = function (cb) {
3039
+ window.setTimeout(cb, 0);
3026
3040
  };
3027
- for (i = 0; i < vendors.length && !requestAnimationFrameFunc; i++) {
3041
+ for (var i = 0; i < vendors.length && !requestAnimationFrameFunc; i++) {
3028
3042
  requestAnimationFrameFunc = window[vendors[i] + 'RequestAnimationFrame'];
3029
3043
  }
3030
3044
  if (!requestAnimationFrameFunc) {
@@ -3105,7 +3119,7 @@
3105
3119
  clearTimeout: wrappedClearTimeout
3106
3120
  };
3107
3121
 
3108
- function StyleSheetLoader(documentOrShadowRoot, settings) {
3122
+ var StyleSheetLoader = function (documentOrShadowRoot, settings) {
3109
3123
  if (settings === void 0) {
3110
3124
  settings = {};
3111
3125
  }
@@ -3260,7 +3274,7 @@
3260
3274
  unloadAll: unloadAll,
3261
3275
  _setReferrerPolicy: _setReferrerPolicy
3262
3276
  };
3263
- }
3277
+ };
3264
3278
 
3265
3279
  var create$1 = function () {
3266
3280
  var map = new WeakMap();
@@ -4198,7 +4212,7 @@
4198
4212
  }
4199
4213
  return styles;
4200
4214
  };
4201
- function Schema(settings) {
4215
+ var Schema = function (settings) {
4202
4216
  var elements = {};
4203
4217
  var children = {};
4204
4218
  var patternElements = [];
@@ -4579,7 +4593,7 @@
4579
4593
  addCustomElements: addCustomElements,
4580
4594
  addValidChildren: addValidChildren
4581
4595
  };
4582
- }
4596
+ };
4583
4597
 
4584
4598
  var toHex = function (match, r, g, b) {
4585
4599
  var hex = function (val) {
@@ -4589,6 +4603,7 @@
4589
4603
  return '#' + hex(r) + hex(g) + hex(b);
4590
4604
  };
4591
4605
  var Styles = function (settings, schema) {
4606
+ var _this = this;
4592
4607
  var rgbRegExp = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi;
4593
4608
  var urlOrStrRegExp = /(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi;
4594
4609
  var styleRegExp = /\s*([^:]+):\s*([^;]+);?/g;
@@ -4616,7 +4631,7 @@
4616
4631
  var styles = {};
4617
4632
  var matches, name, value, isEncoded;
4618
4633
  var urlConverter = settings.url_converter;
4619
- var urlConverterScope = settings.url_converter_scope || this;
4634
+ var urlConverterScope = settings.url_converter_scope || _this;
4620
4635
  var compress = function (prefix, suffix, noJoin) {
4621
4636
  var top = styles[prefix + '-top' + suffix];
4622
4637
  if (!top) {
@@ -4824,12 +4839,8 @@
4824
4839
  var hasIsDefaultPrevented = function (event) {
4825
4840
  return event.isDefaultPrevented === returnTrue || event.isDefaultPrevented === returnFalse;
4826
4841
  };
4827
- var returnFalse = function () {
4828
- return false;
4829
- };
4830
- var returnTrue = function () {
4831
- return true;
4832
- };
4842
+ var returnFalse = never;
4843
+ var returnTrue = always;
4833
4844
  var addEvent = function (target, name, callback, capture) {
4834
4845
  if (target.addEventListener) {
4835
4846
  target.addEventListener(name, callback, capture || false);
@@ -4871,6 +4882,7 @@
4871
4882
  event.pageY = originalEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
4872
4883
  }
4873
4884
  event.preventDefault = function () {
4885
+ event.defaultPrevented = true;
4874
4886
  event.isDefaultPrevented = returnTrue;
4875
4887
  if (originalEvent) {
4876
4888
  if (originalEvent.preventDefault) {
@@ -4881,6 +4893,7 @@
4881
4893
  }
4882
4894
  };
4883
4895
  event.stopPropagation = function () {
4896
+ event.cancelBubble = true;
4884
4897
  event.isPropagationStopped = returnTrue;
4885
4898
  if (originalEvent) {
4886
4899
  if (originalEvent.stopPropagation) {
@@ -4895,8 +4908,8 @@
4895
4908
  event.stopPropagation();
4896
4909
  };
4897
4910
  if (hasIsDefaultPrevented(event) === false) {
4898
- event.isDefaultPrevented = returnFalse;
4899
- event.isPropagationStopped = returnFalse;
4911
+ event.isDefaultPrevented = event.defaultPrevented === true ? returnTrue : returnFalse;
4912
+ event.isPropagationStopped = event.cancelBubble === true ? returnTrue : returnFalse;
4900
4913
  event.isImmediatePropagationStopped = returnFalse;
4901
4914
  }
4902
4915
  if (typeof event.metaKey === 'undefined') {
@@ -5710,6 +5723,7 @@
5710
5723
  }) : function (elem, context, xml) {
5711
5724
  input[0] = elem;
5712
5725
  matcher(input, null, xml, results);
5726
+ input[0] = null;
5713
5727
  return !results.pop();
5714
5728
  };
5715
5729
  }),
@@ -6028,7 +6042,9 @@
6028
6042
  }, implicitRelative, true), matchAnyContext = addCombinator(function (elem) {
6029
6043
  return indexOf$2.call(checkContext, elem) > -1;
6030
6044
  }, implicitRelative, true), matchers = [function (elem, context, xml) {
6031
- return !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
6045
+ var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
6046
+ checkContext = null;
6047
+ return ret;
6032
6048
  }];
6033
6049
  for (; i < len; i++) {
6034
6050
  if (matcher = Expr.relative[tokens[i].type]) {
@@ -6167,7 +6183,9 @@
6167
6183
  setDocument();
6168
6184
  support.sortDetached = true;
6169
6185
 
6170
- var doc = document, push$1 = Array.prototype.push, slice$1 = Array.prototype.slice;
6186
+ var doc = document;
6187
+ var push$1 = Array.prototype.push;
6188
+ var slice$1 = Array.prototype.slice;
6171
6189
  var rquickExpr$1 = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/;
6172
6190
  var Event = EventUtils.Event;
6173
6191
  var skipUniques = Tools.makeMap('children,contents,next,prev');
@@ -6699,7 +6717,7 @@
6699
6717
  return this.css('display', 'none');
6700
6718
  },
6701
6719
  slice: function () {
6702
- return new DomQuery(slice$1.apply(this, arguments));
6720
+ return DomQuery(slice$1.apply(this, arguments));
6703
6721
  },
6704
6722
  eq: function (index) {
6705
6723
  return index === -1 ? this.slice(index) : this.slice(index, +index + 1);
@@ -7036,8 +7054,7 @@
7036
7054
  }
7037
7055
  return idx;
7038
7056
  };
7039
- function DOMUtils(doc, settings) {
7040
- var _this = this;
7057
+ var DOMUtils = function (doc, settings) {
7041
7058
  if (settings === void 0) {
7042
7059
  settings = {};
7043
7060
  }
@@ -7309,7 +7326,7 @@
7309
7326
  });
7310
7327
  return result;
7311
7328
  }
7312
- var context = scope ? scope : _this;
7329
+ var context = scope ? scope : this;
7313
7330
  return func.call(context, node);
7314
7331
  };
7315
7332
  var setAttribs = function (elm, attrs) {
@@ -7814,14 +7831,11 @@
7814
7831
  return self;
7815
7832
  });
7816
7833
  return self;
7817
- }
7818
- (function (DOMUtils) {
7819
- DOMUtils.DOM = DOMUtils(document);
7820
- DOMUtils.nodeIndex = findNodeIndex;
7821
- }(DOMUtils || (DOMUtils = {})));
7822
- var DOMUtils$1 = DOMUtils;
7834
+ };
7835
+ DOMUtils.DOM = DOMUtils(document);
7836
+ DOMUtils.nodeIndex = findNodeIndex;
7823
7837
 
7824
- var DOM = DOMUtils$1.DOM;
7838
+ var DOM = DOMUtils.DOM;
7825
7839
  var each$6 = Tools.each, grep$2 = Tools.grep;
7826
7840
  var QUEUED = 0;
7827
7841
  var LOADING = 1;
@@ -8077,8 +8091,7 @@
8077
8091
  hasCode: hasCode
8078
8092
  };
8079
8093
 
8080
- function AddOnManager() {
8081
- var _this = this;
8094
+ var AddOnManager = function () {
8082
8095
  var items = [];
8083
8096
  var urls = {};
8084
8097
  var lookup = {};
@@ -8145,7 +8158,7 @@
8145
8158
  };
8146
8159
  };
8147
8160
  var addComponents = function (pluginName, scripts) {
8148
- var pluginUrl = _this.urls[pluginName];
8161
+ var pluginUrl = urls[pluginName];
8149
8162
  each(scripts, function (script) {
8150
8163
  ScriptLoader.ScriptLoader.add(pluginUrl + '/' + script);
8151
8164
  });
@@ -8214,12 +8227,11 @@
8214
8227
  load: load,
8215
8228
  waitFor: waitFor
8216
8229
  };
8217
- }
8218
- (function (AddOnManager) {
8219
- AddOnManager.PluginManager = AddOnManager();
8220
- AddOnManager.ThemeManager = AddOnManager();
8221
- }(AddOnManager || (AddOnManager = {})));
8222
- var AddOnManager$1 = AddOnManager;
8230
+ };
8231
+ AddOnManager.languageLoad = true;
8232
+ AddOnManager.baseURL = '';
8233
+ AddOnManager.PluginManager = AddOnManager();
8234
+ AddOnManager.ThemeManager = AddOnManager();
8223
8235
 
8224
8236
  var first = function (fn, rate) {
8225
8237
  var timer = null;
@@ -8782,10 +8794,10 @@
8782
8794
  var isNotPre = not(matchStyleValues('white-space', 'pre pre-line pre-wrap'));
8783
8795
  var isText$4 = isText$1;
8784
8796
  var isBr$3 = isBr;
8785
- var nodeIndex = DOMUtils$1.nodeIndex;
8797
+ var nodeIndex = DOMUtils.nodeIndex;
8786
8798
  var resolveIndex = getNode;
8787
8799
  var createRange = function (doc) {
8788
- return 'createRange' in doc ? doc.createRange() : DOMUtils$1.DOM.createRng();
8800
+ return 'createRange' in doc ? doc.createRange() : DOMUtils.DOM.createRng();
8789
8801
  };
8790
8802
  var isWhiteSpace = function (chr) {
8791
8803
  return chr && /[\r\n\t ]/.test(chr);
@@ -8934,7 +8946,7 @@
8934
8946
  }
8935
8947
  return clientRects;
8936
8948
  };
8937
- function CaretPosition(container, offset, clientRects) {
8949
+ var CaretPosition = function (container, offset, clientRects) {
8938
8950
  var isAtStart = function () {
8939
8951
  if (isText$4(container)) {
8940
8952
  return offset === 0;
@@ -8979,40 +8991,37 @@
8979
8991
  isEqual: isEqual,
8980
8992
  getNode: getNode
8981
8993
  };
8982
- }
8983
- (function (CaretPosition) {
8984
- CaretPosition.fromRangeStart = function (range) {
8985
- return CaretPosition(range.startContainer, range.startOffset);
8986
- };
8987
- CaretPosition.fromRangeEnd = function (range) {
8988
- return CaretPosition(range.endContainer, range.endOffset);
8989
- };
8990
- CaretPosition.after = function (node) {
8991
- return CaretPosition(node.parentNode, nodeIndex(node) + 1);
8992
- };
8993
- CaretPosition.before = function (node) {
8994
- return CaretPosition(node.parentNode, nodeIndex(node));
8995
- };
8996
- CaretPosition.isAbove = function (pos1, pos2) {
8997
- return lift2(head(pos2.getClientRects()), last(pos1.getClientRects()), isAbove).getOr(false);
8998
- };
8999
- CaretPosition.isBelow = function (pos1, pos2) {
9000
- return lift2(last(pos2.getClientRects()), head(pos1.getClientRects()), isBelow).getOr(false);
9001
- };
9002
- CaretPosition.isAtStart = function (pos) {
9003
- return pos ? pos.isAtStart() : false;
9004
- };
9005
- CaretPosition.isAtEnd = function (pos) {
9006
- return pos ? pos.isAtEnd() : false;
9007
- };
9008
- CaretPosition.isTextPosition = function (pos) {
9009
- return pos ? isText$1(pos.container()) : false;
9010
- };
9011
- CaretPosition.isElementPosition = function (pos) {
9012
- return CaretPosition.isTextPosition(pos) === false;
9013
- };
9014
- }(CaretPosition || (CaretPosition = {})));
9015
- var CaretPosition$1 = CaretPosition;
8994
+ };
8995
+ CaretPosition.fromRangeStart = function (range) {
8996
+ return CaretPosition(range.startContainer, range.startOffset);
8997
+ };
8998
+ CaretPosition.fromRangeEnd = function (range) {
8999
+ return CaretPosition(range.endContainer, range.endOffset);
9000
+ };
9001
+ CaretPosition.after = function (node) {
9002
+ return CaretPosition(node.parentNode, nodeIndex(node) + 1);
9003
+ };
9004
+ CaretPosition.before = function (node) {
9005
+ return CaretPosition(node.parentNode, nodeIndex(node));
9006
+ };
9007
+ CaretPosition.isAbove = function (pos1, pos2) {
9008
+ return lift2(head(pos2.getClientRects()), last(pos1.getClientRects()), isAbove).getOr(false);
9009
+ };
9010
+ CaretPosition.isBelow = function (pos1, pos2) {
9011
+ return lift2(last(pos2.getClientRects()), head(pos1.getClientRects()), isBelow).getOr(false);
9012
+ };
9013
+ CaretPosition.isAtStart = function (pos) {
9014
+ return pos ? pos.isAtStart() : false;
9015
+ };
9016
+ CaretPosition.isAtEnd = function (pos) {
9017
+ return pos ? pos.isAtEnd() : false;
9018
+ };
9019
+ CaretPosition.isTextPosition = function (pos) {
9020
+ return pos ? isText$1(pos.container()) : false;
9021
+ };
9022
+ CaretPosition.isElementPosition = function (pos) {
9023
+ return CaretPosition.isTextPosition(pos) === false;
9024
+ };
9016
9025
 
9017
9026
  var trimEmptyTextNode = function (dom, node) {
9018
9027
  if (isText$1(node) && node.data.length === 0) {
@@ -9045,7 +9054,7 @@
9045
9054
 
9046
9055
  var isText$5 = isText$1;
9047
9056
  var isBogus$2 = isBogus;
9048
- var nodeIndex$1 = DOMUtils$1.nodeIndex;
9057
+ var nodeIndex$1 = DOMUtils.nodeIndex;
9049
9058
  var normalizedParent = function (node) {
9050
9059
  var parentNode = node.parentNode;
9051
9060
  if (isBogus$2(parentNode)) {
@@ -9166,7 +9175,7 @@
9166
9175
  if (isText$5(container) && offset > container.data.length) {
9167
9176
  offset = container.data.length;
9168
9177
  }
9169
- return CaretPosition$1(container, offset);
9178
+ return CaretPosition(container, offset);
9170
9179
  };
9171
9180
  var resolve$1 = function (root, path) {
9172
9181
  var offset;
@@ -9195,7 +9204,7 @@
9195
9204
  } else {
9196
9205
  offset = nodeIndex$1(container);
9197
9206
  }
9198
- return CaretPosition$1(container.parentNode, offset);
9207
+ return CaretPosition(container.parentNode, offset);
9199
9208
  }
9200
9209
  return findTextPosition(container, parseInt(offset, 10));
9201
9210
  };
@@ -9318,8 +9327,8 @@
9318
9327
  var getCaretBookmark = function (selection) {
9319
9328
  var rng = selection.getRng();
9320
9329
  return {
9321
- start: create$3(selection.dom.getRoot(), CaretPosition$1.fromRangeStart(rng)),
9322
- end: create$3(selection.dom.getRoot(), CaretPosition$1.fromRangeEnd(rng))
9330
+ start: create$3(selection.dom.getRoot(), CaretPosition.fromRangeStart(rng)),
9331
+ end: create$3(selection.dom.getRoot(), CaretPosition.fromRangeEnd(rng))
9323
9332
  };
9324
9333
  };
9325
9334
  var getRangeBookmark = function (selection) {
@@ -9375,7 +9384,7 @@
9375
9384
  };
9376
9385
  var getUndoBookmark = curry(getOffsetBookmark, identity, true);
9377
9386
 
9378
- var DOM$1 = DOMUtils$1.DOM;
9387
+ var DOM$1 = DOMUtils.DOM;
9379
9388
  var defaultPreviewStyles = 'font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow';
9380
9389
  var getBodySetting = function (editor, name, defaultValue) {
9381
9390
  var value = editor.getParam(name, defaultValue);
@@ -9501,6 +9510,10 @@
9501
9510
  return ['default'];
9502
9511
  }
9503
9512
  };
9513
+ var getFontCss = function (editor) {
9514
+ var fontCss = editor.getParam('font_css', []);
9515
+ return isArray(fontCss) ? fontCss : map(fontCss.split(','), trim);
9516
+ };
9504
9517
  var getDirectionality = function (editor) {
9505
9518
  return editor.getParam('directionality', I18n.isRtl() ? 'rtl' : undefined);
9506
9519
  };
@@ -9512,7 +9525,7 @@
9512
9525
  if (selector === false || Env.iOS) {
9513
9526
  return false;
9514
9527
  } else {
9515
- return isString(selector) ? selector : 'table,img,figure.image,div';
9528
+ return isString(selector) ? selector : 'table,img,figure.image,div,video,iframe';
9516
9529
  }
9517
9530
  };
9518
9531
  var getResizeImgProportional = function (editor) {
@@ -9639,7 +9652,7 @@
9639
9652
  var text = before.text + after.text;
9640
9653
  if (text.length > 0) {
9641
9654
  deleteZwspChars(caretContainer);
9642
- return CaretPosition$1(caretContainer, pos.offset() - before.count);
9655
+ return CaretPosition(caretContainer, pos.offset() - before.count);
9643
9656
  } else {
9644
9657
  return pos;
9645
9658
  }
@@ -9647,7 +9660,7 @@
9647
9660
  var removeElementAndReposition = function (caretContainer, pos) {
9648
9661
  var parentNode = pos.container();
9649
9662
  var newPosition = indexOf(from$1(parentNode.childNodes), caretContainer).map(function (index) {
9650
- return index < pos.offset() ? CaretPosition$1(parentNode, pos.offset() - 1) : pos;
9663
+ return index < pos.offset() ? CaretPosition(parentNode, pos.offset() - 1) : pos;
9651
9664
  }).getOr(pos);
9652
9665
  remove$5(caretContainer);
9653
9666
  return newPosition;
@@ -9659,7 +9672,7 @@
9659
9672
  return pos.container() === caretContainer.parentNode ? removeElementAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);
9660
9673
  };
9661
9674
  var removeAndReposition = function (container, pos) {
9662
- return CaretPosition$1.isTextPosition(pos) ? removeTextCaretContainer(container, pos) : removeElementCaretContainer(container, pos);
9675
+ return CaretPosition.isTextPosition(pos) ? removeTextCaretContainer(container, pos) : removeElementCaretContainer(container, pos);
9663
9676
  };
9664
9677
  var remove$5 = function (caretContainerNode) {
9665
9678
  if (isElement$4(caretContainerNode) && isCaretContainer(caretContainerNode)) {
@@ -9858,12 +9871,12 @@
9858
9871
  var isCefOrCaretContainer = isContentEditableFalse$4(node) || isCaretContainerBlock$1(node);
9859
9872
  if (isBackwards(direction)) {
9860
9873
  if (isCefOrCaretContainer) {
9861
- node = skipCaretContainers(walker.prev, true);
9874
+ node = skipCaretContainers(walker.prev.bind(walker), true);
9862
9875
  if (predicateFn(node)) {
9863
9876
  return node;
9864
9877
  }
9865
9878
  }
9866
- while (node = skipCaretContainers(walker.prev, shallow)) {
9879
+ while (node = skipCaretContainers(walker.prev.bind(walker), shallow)) {
9867
9880
  if (predicateFn(node)) {
9868
9881
  return node;
9869
9882
  }
@@ -9871,12 +9884,12 @@
9871
9884
  }
9872
9885
  if (isForwards(direction)) {
9873
9886
  if (isCefOrCaretContainer) {
9874
- node = skipCaretContainers(walker.next, true);
9887
+ node = skipCaretContainers(walker.next.bind(walker), true);
9875
9888
  if (predicateFn(node)) {
9876
9889
  return node;
9877
9890
  }
9878
9891
  }
9879
- while (node = skipCaretContainers(walker.next, shallow)) {
9892
+ while (node = skipCaretContainers(walker.next.bind(walker), shallow)) {
9880
9893
  if (predicateFn(node)) {
9881
9894
  return node;
9882
9895
  }
@@ -10095,38 +10108,38 @@
10095
10108
  var getCaretCandidatePosition = function (direction, node) {
10096
10109
  if (isForwards(direction)) {
10097
10110
  if (isCaretCandidate$3(node.previousSibling) && !isText$7(node.previousSibling)) {
10098
- return CaretPosition$1.before(node);
10111
+ return CaretPosition.before(node);
10099
10112
  }
10100
10113
  if (isText$7(node)) {
10101
- return CaretPosition$1(node, 0);
10114
+ return CaretPosition(node, 0);
10102
10115
  }
10103
10116
  }
10104
10117
  if (isBackwards(direction)) {
10105
10118
  if (isCaretCandidate$3(node.nextSibling) && !isText$7(node.nextSibling)) {
10106
- return CaretPosition$1.after(node);
10119
+ return CaretPosition.after(node);
10107
10120
  }
10108
10121
  if (isText$7(node)) {
10109
- return CaretPosition$1(node, node.data.length);
10122
+ return CaretPosition(node, node.data.length);
10110
10123
  }
10111
10124
  }
10112
10125
  if (isBackwards(direction)) {
10113
10126
  if (isBr$4(node)) {
10114
- return CaretPosition$1.before(node);
10127
+ return CaretPosition.before(node);
10115
10128
  }
10116
- return CaretPosition$1.after(node);
10129
+ return CaretPosition.after(node);
10117
10130
  }
10118
- return CaretPosition$1.before(node);
10131
+ return CaretPosition.before(node);
10119
10132
  };
10120
10133
  var moveForwardFromBr = function (root, nextNode) {
10121
10134
  var nextSibling = nextNode.nextSibling;
10122
10135
  if (nextSibling && isCaretCandidate$3(nextSibling)) {
10123
10136
  if (isText$7(nextSibling)) {
10124
- return CaretPosition$1(nextSibling, 0);
10137
+ return CaretPosition(nextSibling, 0);
10125
10138
  } else {
10126
- return CaretPosition$1.before(nextSibling);
10139
+ return CaretPosition.before(nextSibling);
10127
10140
  }
10128
10141
  } else {
10129
- return findCaretPosition(HDirection.Forwards, CaretPosition$1.after(nextNode), root);
10142
+ return findCaretPosition(HDirection.Forwards, CaretPosition.after(nextNode), root);
10130
10143
  }
10131
10144
  };
10132
10145
  var findCaretPosition = function (direction, startPos, root) {
@@ -10135,10 +10148,10 @@
10135
10148
  if (!isElement$6(root) || !startPos) {
10136
10149
  return null;
10137
10150
  }
10138
- if (startPos.isEqual(CaretPosition$1.after(root)) && root.lastChild) {
10139
- caretPosition = CaretPosition$1.after(root.lastChild);
10151
+ if (startPos.isEqual(CaretPosition.after(root)) && root.lastChild) {
10152
+ caretPosition = CaretPosition.after(root.lastChild);
10140
10153
  if (isBackwards(direction) && isCaretCandidate$3(root.lastChild) && isElement$6(root.lastChild)) {
10141
- return isBr$4(root.lastChild) ? CaretPosition$1.before(root.lastChild) : caretPosition;
10154
+ return isBr$4(root.lastChild) ? CaretPosition.before(root.lastChild) : caretPosition;
10142
10155
  }
10143
10156
  } else {
10144
10157
  caretPosition = startPos;
@@ -10147,10 +10160,10 @@
10147
10160
  var offset = caretPosition.offset();
10148
10161
  if (isText$7(container)) {
10149
10162
  if (isBackwards(direction) && offset > 0) {
10150
- return CaretPosition$1(container, --offset);
10163
+ return CaretPosition(container, --offset);
10151
10164
  }
10152
10165
  if (isForwards(direction) && offset < container.length) {
10153
- return CaretPosition$1(container, ++offset);
10166
+ return CaretPosition(container, ++offset);
10154
10167
  }
10155
10168
  node = container;
10156
10169
  } else {
@@ -10161,15 +10174,15 @@
10161
10174
  innerNode = findNode(nextNode, direction, isEditableCaretCandidate$1, nextNode);
10162
10175
  if (innerNode) {
10163
10176
  if (isText$7(innerNode)) {
10164
- return CaretPosition$1(innerNode, innerNode.data.length);
10177
+ return CaretPosition(innerNode, innerNode.data.length);
10165
10178
  }
10166
- return CaretPosition$1.after(innerNode);
10179
+ return CaretPosition.after(innerNode);
10167
10180
  }
10168
10181
  }
10169
10182
  if (isText$7(nextNode)) {
10170
- return CaretPosition$1(nextNode, nextNode.data.length);
10183
+ return CaretPosition(nextNode, nextNode.data.length);
10171
10184
  }
10172
- return CaretPosition$1.before(nextNode);
10185
+ return CaretPosition.before(nextNode);
10173
10186
  }
10174
10187
  }
10175
10188
  if (isForwards(direction) && offset < container.childNodes.length) {
@@ -10182,15 +10195,15 @@
10182
10195
  innerNode = findNode(nextNode, direction, isEditableCaretCandidate$1, nextNode);
10183
10196
  if (innerNode) {
10184
10197
  if (isText$7(innerNode)) {
10185
- return CaretPosition$1(innerNode, 0);
10198
+ return CaretPosition(innerNode, 0);
10186
10199
  }
10187
- return CaretPosition$1.before(innerNode);
10200
+ return CaretPosition.before(innerNode);
10188
10201
  }
10189
10202
  }
10190
10203
  if (isText$7(nextNode)) {
10191
- return CaretPosition$1(nextNode, 0);
10204
+ return CaretPosition(nextNode, 0);
10192
10205
  }
10193
- return CaretPosition$1.after(nextNode);
10206
+ return CaretPosition.after(nextNode);
10194
10207
  }
10195
10208
  }
10196
10209
  node = nextNode ? nextNode : caretPosition.getNode();
@@ -10205,9 +10218,9 @@
10205
10218
  var rootContentEditableFalseElm = last$1(filter(getParents(container, root), isContentEditableFalse$5));
10206
10219
  if (rootContentEditableFalseElm && (!nextNode || !rootContentEditableFalseElm.contains(nextNode))) {
10207
10220
  if (isForwards(direction)) {
10208
- caretPosition = CaretPosition$1.after(rootContentEditableFalseElm);
10221
+ caretPosition = CaretPosition.after(rootContentEditableFalseElm);
10209
10222
  } else {
10210
- caretPosition = CaretPosition$1.before(rootContentEditableFalseElm);
10223
+ caretPosition = CaretPosition.before(rootContentEditableFalseElm);
10211
10224
  }
10212
10225
  return caretPosition;
10213
10226
  }
@@ -10228,21 +10241,21 @@
10228
10241
  };
10229
10242
 
10230
10243
  var walkToPositionIn = function (forward, root, start) {
10231
- var position = forward ? CaretPosition$1.before(start) : CaretPosition$1.after(start);
10244
+ var position = forward ? CaretPosition.before(start) : CaretPosition.after(start);
10232
10245
  return fromPosition(forward, root, position);
10233
10246
  };
10234
10247
  var afterElement = function (node) {
10235
- return isBr(node) ? CaretPosition$1.before(node) : CaretPosition$1.after(node);
10248
+ return isBr(node) ? CaretPosition.before(node) : CaretPosition.after(node);
10236
10249
  };
10237
10250
  var isBeforeOrStart = function (position) {
10238
- if (CaretPosition$1.isTextPosition(position)) {
10251
+ if (CaretPosition.isTextPosition(position)) {
10239
10252
  return position.offset() === 0;
10240
10253
  } else {
10241
10254
  return isCaretCandidate(position.getNode());
10242
10255
  }
10243
10256
  };
10244
10257
  var isAfterOrEnd = function (position) {
10245
- if (CaretPosition$1.isTextPosition(position)) {
10258
+ if (CaretPosition.isTextPosition(position)) {
10246
10259
  var container = position.container();
10247
10260
  return position.offset() === container.data.length;
10248
10261
  } else {
@@ -10250,10 +10263,10 @@
10250
10263
  }
10251
10264
  };
10252
10265
  var isBeforeAfterSameElement = function (from, to) {
10253
- return !CaretPosition$1.isTextPosition(from) && !CaretPosition$1.isTextPosition(to) && from.getNode() === to.getNode(true);
10266
+ return !CaretPosition.isTextPosition(from) && !CaretPosition.isTextPosition(to) && from.getNode() === to.getNode(true);
10254
10267
  };
10255
10268
  var isAtBr = function (position) {
10256
- return !CaretPosition$1.isTextPosition(position) && isBr(position.getNode());
10269
+ return !CaretPosition.isTextPosition(position) && isBr(position.getNode());
10257
10270
  };
10258
10271
  var shouldSkipPosition = function (forward, from, to) {
10259
10272
  if (forward) {
@@ -10283,10 +10296,10 @@
10283
10296
  var positionIn = function (forward, element) {
10284
10297
  var startNode = forward ? element.firstChild : element.lastChild;
10285
10298
  if (isText$1(startNode)) {
10286
- return Optional.some(CaretPosition$1(startNode, forward ? 0 : startNode.data.length));
10299
+ return Optional.some(CaretPosition(startNode, forward ? 0 : startNode.data.length));
10287
10300
  } else if (startNode) {
10288
10301
  if (isCaretCandidate(startNode)) {
10289
- return Optional.some(forward ? CaretPosition$1.before(startNode) : afterElement(startNode));
10302
+ return Optional.some(forward ? CaretPosition.before(startNode) : afterElement(startNode));
10290
10303
  } else {
10291
10304
  return walkToPositionIn(forward, element, startNode);
10292
10305
  }
@@ -10314,7 +10327,7 @@
10314
10327
  };
10315
10328
 
10316
10329
  var isStringPathBookmark = function (bookmark) {
10317
- return typeof bookmark.start === 'string';
10330
+ return isString(bookmark.start);
10318
10331
  };
10319
10332
  var isRangeBookmark = function (bookmark) {
10320
10333
  return bookmark.hasOwnProperty('rng');
@@ -10354,9 +10367,7 @@
10354
10367
  return node.hasChildNodes() === false;
10355
10368
  };
10356
10369
  var tryFindRangePosition = function (node, rng) {
10357
- return lastPositionIn(node).fold(function () {
10358
- return false;
10359
- }, function (pos) {
10370
+ return lastPositionIn(node).fold(never, function (pos) {
10360
10371
  rng.setStart(pos.container(), pos.offset());
10361
10372
  rng.setEnd(pos.container(), pos.offset());
10362
10373
  return true;
@@ -10469,7 +10480,7 @@
10469
10480
  offset = idx;
10470
10481
  }
10471
10482
  }
10472
- return Optional.some(CaretPosition$1(container, offset));
10483
+ return Optional.some(CaretPosition(container, offset));
10473
10484
  } else {
10474
10485
  return Optional.none();
10475
10486
  }
@@ -11171,7 +11182,7 @@
11171
11182
  selection.moveToBookmark(bookmark);
11172
11183
  };
11173
11184
 
11174
- function NodeValue (is, name) {
11185
+ var NodeValue = function (is, name) {
11175
11186
  var get = function (element) {
11176
11187
  if (!is(element)) {
11177
11188
  throw new Error('Can only get ' + name + ' value of a ' + name + ' node');
@@ -11192,7 +11203,7 @@
11192
11203
  getOption: getOption,
11193
11204
  set: set
11194
11205
  };
11195
- }
11206
+ };
11196
11207
 
11197
11208
  var api = NodeValue(isText, 'text');
11198
11209
  var get$8 = function (element) {
@@ -11338,16 +11349,13 @@
11338
11349
  };
11339
11350
  };
11340
11351
 
11341
- function BookmarkManager(selection) {
11352
+ var BookmarkManager = function (selection) {
11342
11353
  return {
11343
11354
  getBookmark: curry(getBookmark$1, selection),
11344
11355
  moveToBookmark: curry(moveToBookmark, selection)
11345
11356
  };
11346
- }
11347
- (function (BookmarkManager) {
11348
- BookmarkManager.isBookmarkNode = isBookmarkNode$1;
11349
- }(BookmarkManager || (BookmarkManager = {})));
11350
- var BookmarkManager$1 = BookmarkManager;
11357
+ };
11358
+ BookmarkManager.isBookmarkNode = isBookmarkNode$1;
11351
11359
 
11352
11360
  var getContentEditableRoot = function (root, node) {
11353
11361
  while (node && node !== root) {
@@ -11436,7 +11444,7 @@
11436
11444
  END: 35,
11437
11445
  HOME: 36,
11438
11446
  modifierPressed: function (e) {
11439
- return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);
11447
+ return e.shiftKey || e.ctrlKey || e.altKey || VK.metaKeyPressed(e);
11440
11448
  },
11441
11449
  metaKeyPressed: function (e) {
11442
11450
  return Env.mac ? e.metaKey : e.ctrlKey && !e.altKey;
@@ -11445,8 +11453,9 @@
11445
11453
 
11446
11454
  var isContentEditableFalse$6 = isContentEditableFalse;
11447
11455
  var ControlSelection = function (selection, editor) {
11448
- var dom = editor.dom, each = Tools.each;
11449
- var selectedElm, selectedElmGhost, resizeHelper, selectedHandle;
11456
+ var elementSelectionAttr = 'data-mce-selected';
11457
+ var dom = editor.dom, each$2 = Tools.each;
11458
+ var selectedElm, selectedElmGhost, resizeHelper, selectedHandle, resizeBackdrop;
11450
11459
  var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted;
11451
11460
  var width, height;
11452
11461
  var editableDoc = editor.getDoc(), rootDocument = document;
@@ -11481,6 +11490,9 @@
11481
11490
  var isImage = function (elm) {
11482
11491
  return elm && (elm.nodeName === 'IMG' || editor.dom.is(elm, 'figure.image'));
11483
11492
  };
11493
+ var isMedia$1 = function (elm) {
11494
+ return isMedia(elm) || dom.hasClass(elm, 'mce-preview-object');
11495
+ };
11484
11496
  var isEventOnImageOutsideRange = function (evt, range) {
11485
11497
  if (evt.type === 'longpress' || evt.type.indexOf('touch') === 0) {
11486
11498
  var touch = evt.touches[0];
@@ -11495,8 +11507,17 @@
11495
11507
  editor.selection.select(target);
11496
11508
  }
11497
11509
  };
11498
- var getResizeTarget = function (elm) {
11499
- return editor.dom.is(elm, 'figure.image') ? elm.querySelector('img') : elm;
11510
+ var getResizeTargets = function (elm) {
11511
+ if (dom.is(elm, 'figure.image')) {
11512
+ return [elm.querySelector('img')];
11513
+ } else if (dom.hasClass(elm, 'mce-preview-object') && isNonNullable(elm.firstElementChild)) {
11514
+ return [
11515
+ elm,
11516
+ elm.firstElementChild
11517
+ ];
11518
+ } else {
11519
+ return [elm];
11520
+ }
11500
11521
  };
11501
11522
  var isResizable = function (elm) {
11502
11523
  var selector = getObjectResizing(editor);
@@ -11509,13 +11530,34 @@
11509
11530
  if (elm === editor.getBody()) {
11510
11531
  return false;
11511
11532
  }
11512
- return is$1(SugarElement.fromDom(elm), selector);
11533
+ if (dom.hasClass(elm, 'mce-preview-object')) {
11534
+ return is$1(SugarElement.fromDom(elm.firstElementChild), selector);
11535
+ } else {
11536
+ return is$1(SugarElement.fromDom(elm), selector);
11537
+ }
11538
+ };
11539
+ var createGhostElement = function (elm) {
11540
+ if (isMedia$1(elm)) {
11541
+ return dom.create('img', { src: Env.transparentSrc });
11542
+ } else {
11543
+ return elm.cloneNode(true);
11544
+ }
11545
+ };
11546
+ var setSizeProp = function (element, name, value) {
11547
+ if (isNonNullable(value)) {
11548
+ var targets = getResizeTargets(element);
11549
+ each(targets, function (target) {
11550
+ if (target.style[name] || !editor.schema.isValid(target.nodeName.toLowerCase(), name)) {
11551
+ dom.setStyle(target, name, value);
11552
+ } else {
11553
+ dom.setAttrib(target, name, '' + value);
11554
+ }
11555
+ });
11556
+ }
11513
11557
  };
11514
11558
  var setGhostElmSize = function (ghostElm, width, height) {
11515
- dom.setStyles(getResizeTarget(ghostElm), {
11516
- width: width,
11517
- height: height
11518
- });
11559
+ setSizeProp(ghostElm, 'width', width);
11560
+ setSizeProp(ghostElm, 'height', height);
11519
11561
  };
11520
11562
  var resizeGhostElement = function (e) {
11521
11563
  var deltaX, deltaY, proportional;
@@ -11526,7 +11568,7 @@
11526
11568
  height = deltaY * selectedHandle[3] + startH;
11527
11569
  width = width < 5 ? 5 : width;
11528
11570
  height = height < 5 ? 5 : height;
11529
- if (isImage(selectedElm) && getResizeImgProportional(editor) !== false) {
11571
+ if ((isImage(selectedElm) || isMedia$1(selectedElm)) && getResizeImgProportional(editor) !== false) {
11530
11572
  proportional = !VK.modifierPressed(e);
11531
11573
  } else {
11532
11574
  proportional = VK.modifierPressed(e);
@@ -11573,18 +11615,9 @@
11573
11615
  var endGhostResize = function () {
11574
11616
  var wasResizeStarted = resizeStarted;
11575
11617
  resizeStarted = false;
11576
- var setSizeProp = function (name, value) {
11577
- if (value) {
11578
- if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) {
11579
- dom.setStyle(getResizeTarget(selectedElm), name, value);
11580
- } else {
11581
- dom.setAttrib(getResizeTarget(selectedElm), name, '' + value);
11582
- }
11583
- }
11584
- };
11585
11618
  if (wasResizeStarted) {
11586
- setSizeProp('width', width);
11587
- setSizeProp('height', height);
11619
+ setSizeProp(selectedElm, 'width', width);
11620
+ setSizeProp(selectedElm, 'height', height);
11588
11621
  }
11589
11622
  dom.unbind(editableDoc, 'mousemove', resizeGhostElement);
11590
11623
  dom.unbind(editableDoc, 'mouseup', endGhostResize);
@@ -11594,6 +11627,7 @@
11594
11627
  }
11595
11628
  dom.remove(selectedElmGhost);
11596
11629
  dom.remove(resizeHelper);
11630
+ dom.remove(resizeBackdrop);
11597
11631
  showResizeRect(selectedElm);
11598
11632
  if (wasResizeStarted) {
11599
11633
  fireObjectResized(editor, selectedElm, width, height, 'corner-' + selectedHandle.name);
@@ -11602,7 +11636,6 @@
11602
11636
  editor.nodeChanged();
11603
11637
  };
11604
11638
  var showResizeRect = function (targetElm) {
11605
- hideResizeRect();
11606
11639
  unbindResizeHandleEvents();
11607
11640
  var position = dom.getPos(targetElm, rootElement);
11608
11641
  var selectedElmX = position.x;
@@ -11611,18 +11644,21 @@
11611
11644
  var targetWidth = rect.width || rect.right - rect.left;
11612
11645
  var targetHeight = rect.height || rect.bottom - rect.top;
11613
11646
  if (selectedElm !== targetElm) {
11647
+ hideResizeRect();
11614
11648
  selectedElm = targetElm;
11615
11649
  width = height = 0;
11616
11650
  }
11617
11651
  var e = editor.fire('ObjectSelected', { target: targetElm });
11652
+ var selectedValue = dom.getAttrib(selectedElm, elementSelectionAttr, '1');
11618
11653
  if (isResizable(targetElm) && !e.isDefaultPrevented()) {
11619
- each(resizeHandles, function (handle, name) {
11654
+ each$2(resizeHandles, function (handle, name) {
11620
11655
  var handleElm;
11621
11656
  var startDrag = function (e) {
11657
+ var target = getResizeTargets(selectedElm)[0];
11622
11658
  startX = e.screenX;
11623
11659
  startY = e.screenY;
11624
- startW = getResizeTarget(selectedElm).clientWidth;
11625
- startH = getResizeTarget(selectedElm).clientHeight;
11660
+ startW = target.clientWidth;
11661
+ startH = target.clientHeight;
11626
11662
  ratio = startH / startW;
11627
11663
  selectedHandle = handle;
11628
11664
  selectedHandle.name = name;
@@ -11632,18 +11668,25 @@
11632
11668
  };
11633
11669
  startScrollWidth = rootElement.scrollWidth;
11634
11670
  startScrollHeight = rootElement.scrollHeight;
11635
- selectedElmGhost = selectedElm.cloneNode(true);
11671
+ resizeBackdrop = dom.add(rootElement, 'div', { class: 'mce-resize-backdrop' });
11672
+ dom.setStyles(resizeBackdrop, {
11673
+ position: 'fixed',
11674
+ left: '0',
11675
+ top: '0',
11676
+ width: '100%',
11677
+ height: '100%'
11678
+ });
11679
+ selectedElmGhost = createGhostElement(selectedElm);
11636
11680
  dom.addClass(selectedElmGhost, 'mce-clonedresizable');
11637
11681
  dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all');
11638
- selectedElmGhost.contentEditable = false;
11639
- selectedElmGhost.unSelectabe = true;
11682
+ selectedElmGhost.contentEditable = 'false';
11640
11683
  dom.setStyles(selectedElmGhost, {
11641
11684
  left: selectedElmX,
11642
11685
  top: selectedElmY,
11643
11686
  margin: 0
11644
11687
  });
11645
11688
  setGhostElmSize(selectedElmGhost, targetWidth, targetHeight);
11646
- selectedElmGhost.removeAttribute('data-mce-selected');
11689
+ selectedElmGhost.removeAttribute(elementSelectionAttr);
11647
11690
  rootElement.appendChild(selectedElmGhost);
11648
11691
  dom.bind(editableDoc, 'mousemove', resizeGhostElement);
11649
11692
  dom.bind(editableDoc, 'mouseup', endGhostResize);
@@ -11684,12 +11727,14 @@
11684
11727
  } else {
11685
11728
  hideResizeRect();
11686
11729
  }
11687
- selectedElm.setAttribute('data-mce-selected', '1');
11730
+ if (!dom.getAttrib(selectedElm, elementSelectionAttr)) {
11731
+ selectedElm.setAttribute(elementSelectionAttr, selectedValue);
11732
+ }
11688
11733
  };
11689
11734
  var hideResizeRect = function () {
11690
11735
  unbindResizeHandleEvents();
11691
11736
  if (selectedElm) {
11692
- selectedElm.removeAttribute('data-mce-selected');
11737
+ selectedElm.removeAttribute(elementSelectionAttr);
11693
11738
  }
11694
11739
  each$1(resizeHandles, function (value, name) {
11695
11740
  var handleElm = dom.get('mceResizeHandle' + name);
@@ -11713,11 +11758,11 @@
11713
11758
  if (resizeStarted || editor.removed) {
11714
11759
  return;
11715
11760
  }
11716
- each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function (img) {
11717
- img.removeAttribute('data-mce-selected');
11761
+ each$2(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function (img) {
11762
+ img.removeAttribute(elementSelectionAttr);
11718
11763
  });
11719
11764
  controlElm = e.type === 'mousedown' ? e.target : selection.getNode();
11720
- controlElm = dom.$(controlElm).closest('table,img,figure.image,hr')[0];
11765
+ controlElm = dom.$(controlElm).closest('table,img,figure.image,hr,video,span.mce-preview-object')[0];
11721
11766
  if (isChildOrEqual(controlElm, rootElement)) {
11722
11767
  disableGeckoResize();
11723
11768
  startElm = selection.getStart(true);
@@ -11798,7 +11843,7 @@
11798
11843
  });
11799
11844
  editor.on('remove', unbindResizeHandleEvents);
11800
11845
  var destroy = function () {
11801
- selectedElm = selectedElmGhost = null;
11846
+ selectedElm = selectedElmGhost = resizeBackdrop = null;
11802
11847
  };
11803
11848
  return {
11804
11849
  isResizable: isResizable,
@@ -12110,7 +12155,7 @@
12110
12155
  };
12111
12156
  };
12112
12157
 
12113
- function RangeUtils(dom) {
12158
+ var RangeUtils = function (dom) {
12114
12159
  var walk = function (rng, callback) {
12115
12160
  return walk$1(dom, rng, callback);
12116
12161
  };
@@ -12127,16 +12172,13 @@
12127
12172
  split: split,
12128
12173
  normalize: normalize$1
12129
12174
  };
12130
- }
12131
- (function (RangeUtils) {
12132
- RangeUtils.compareRanges = isEq$1;
12133
- RangeUtils.getCaretRangeFromPoint = fromPoint$1;
12134
- RangeUtils.getSelectedNode = getSelectedNode;
12135
- RangeUtils.getNode = getNode;
12136
- }(RangeUtils || (RangeUtils = {})));
12137
- var RangeUtils$1 = RangeUtils;
12138
-
12139
- function Dimension (name, getOffset) {
12175
+ };
12176
+ RangeUtils.compareRanges = isEq$1;
12177
+ RangeUtils.getCaretRangeFromPoint = fromPoint$1;
12178
+ RangeUtils.getSelectedNode = getSelectedNode;
12179
+ RangeUtils.getNode = getNode;
12180
+
12181
+ var Dimension = function (name, getOffset) {
12140
12182
  var set = function (element, h) {
12141
12183
  if (!isNumber(h) && !h.match(/^[0-9]+$/)) {
12142
12184
  throw new Error(name + '.set accepts only positive integer values. Value was ' + h);
@@ -12174,7 +12216,7 @@
12174
12216
  aggregate: aggregate,
12175
12217
  max: max
12176
12218
  };
12177
- }
12219
+ };
12178
12220
 
12179
12221
  var api$1 = Dimension('height', function (element) {
12180
12222
  var dom = element.dom;
@@ -12594,9 +12636,9 @@
12594
12636
  var mouseUpPage = function () {
12595
12637
  throttledStore.throttle();
12596
12638
  };
12597
- DOMUtils$1.DOM.bind(document, 'mouseup', mouseUpPage);
12639
+ DOMUtils.DOM.bind(document, 'mouseup', mouseUpPage);
12598
12640
  editor.on('remove', function () {
12599
- DOMUtils$1.DOM.unbind(document, 'mouseup', mouseUpPage);
12641
+ DOMUtils.DOM.unbind(document, 'mouseup', mouseUpPage);
12600
12642
  });
12601
12643
  };
12602
12644
  var registerFocusOut = function (editor) {
@@ -12638,7 +12680,7 @@
12638
12680
  };
12639
12681
 
12640
12682
  var documentFocusInHandler;
12641
- var DOM$2 = DOMUtils$1.DOM;
12683
+ var DOM$2 = DOMUtils.DOM;
12642
12684
  var isEditorUIElement$1 = function (elm) {
12643
12685
  return FocusManager.isEditorUIElement(elm);
12644
12686
  };
@@ -12673,24 +12715,22 @@
12673
12715
  var editor = e.editor;
12674
12716
  register(editor);
12675
12717
  editor.on('focusin', function () {
12676
- var self = this;
12677
12718
  var focusedEditor = editorManager.focusedEditor;
12678
- if (focusedEditor !== self) {
12719
+ if (focusedEditor !== editor) {
12679
12720
  if (focusedEditor) {
12680
- focusedEditor.fire('blur', { focusedEditor: self });
12721
+ focusedEditor.fire('blur', { focusedEditor: editor });
12681
12722
  }
12682
- editorManager.setActive(self);
12683
- editorManager.focusedEditor = self;
12684
- self.fire('focus', { blurredEditor: focusedEditor });
12685
- self.focus(true);
12723
+ editorManager.setActive(editor);
12724
+ editorManager.focusedEditor = editor;
12725
+ editor.fire('focus', { blurredEditor: focusedEditor });
12726
+ editor.focus(true);
12686
12727
  }
12687
12728
  });
12688
12729
  editor.on('focusout', function () {
12689
- var self = this;
12690
- Delay.setEditorTimeout(self, function () {
12730
+ Delay.setEditorTimeout(editor, function () {
12691
12731
  var focusedEditor = editorManager.focusedEditor;
12692
- if (!isUIElement(self, getActiveElement(self)) && focusedEditor === self) {
12693
- self.fire('blur', { focusedEditor: null });
12732
+ if (!isUIElement(editor, getActiveElement(editor)) && focusedEditor === editor) {
12733
+ editor.fire('blur', { focusedEditor: null });
12694
12734
  editorManager.focusedEditor = null;
12695
12735
  }
12696
12736
  });
@@ -12777,7 +12817,8 @@
12777
12817
  return rawBody && hasElementFocus(SugarElement.fromDom(rawBody));
12778
12818
  };
12779
12819
  var hasUiFocus = function (editor) {
12780
- return active().filter(function (elem) {
12820
+ var dos = getRootNode(SugarElement.fromDom(editor.getElement()));
12821
+ return active(dos).filter(function (elem) {
12781
12822
  return !isEditorContentAreaElement(elem.dom) && isUIElement(editor, elem.dom);
12782
12823
  }).isSome();
12783
12824
  };
@@ -12938,248 +12979,54 @@
12938
12979
  });
12939
12980
  };
12940
12981
 
12941
- var ensureIsRoot = function (isRoot) {
12942
- return isFunction(isRoot) ? isRoot : never;
12982
+ var typeLookup = {
12983
+ '#text': 3,
12984
+ '#comment': 8,
12985
+ '#cdata': 4,
12986
+ '#pi': 7,
12987
+ '#doctype': 10,
12988
+ '#document-fragment': 11
12943
12989
  };
12944
- var ancestor$3 = function (scope, transform, isRoot) {
12945
- var element = scope.dom;
12946
- var stop = ensureIsRoot(isRoot);
12947
- while (element.parentNode) {
12948
- element = element.parentNode;
12949
- var el = SugarElement.fromDom(element);
12950
- var transformed = transform(el);
12951
- if (transformed.isSome()) {
12952
- return transformed;
12953
- } else if (stop(el)) {
12954
- break;
12955
- }
12990
+ var walk$2 = function (node, root, prev) {
12991
+ var startName = prev ? 'lastChild' : 'firstChild';
12992
+ var siblingName = prev ? 'prev' : 'next';
12993
+ if (node[startName]) {
12994
+ return node[startName];
12956
12995
  }
12957
- return Optional.none();
12958
- };
12959
- var closest$2 = function (scope, transform, isRoot) {
12960
- var current = transform(scope);
12961
- var stop = ensureIsRoot(isRoot);
12962
- return current.orThunk(function () {
12963
- return stop(scope) ? Optional.none() : ancestor$3(scope, transform, stop);
12964
- });
12965
- };
12966
-
12967
- var isEq$2 = isEq;
12968
- var matchesUnInheritedFormatSelector = function (ed, node, name) {
12969
- var formatList = ed.formatter.get(name);
12970
- if (formatList) {
12971
- for (var i = 0; i < formatList.length; i++) {
12972
- if (formatList[i].inherit === false && ed.dom.is(node, formatList[i].selector)) {
12973
- return true;
12996
+ if (node !== root) {
12997
+ var sibling = node[siblingName];
12998
+ if (sibling) {
12999
+ return sibling;
13000
+ }
13001
+ for (var parent_1 = node.parent; parent_1 && parent_1 !== root; parent_1 = parent_1.parent) {
13002
+ sibling = parent_1[siblingName];
13003
+ if (sibling) {
13004
+ return sibling;
12974
13005
  }
12975
13006
  }
12976
13007
  }
12977
- return false;
12978
13008
  };
12979
- var matchParents = function (editor, node, name, vars) {
12980
- var root = editor.dom.getRoot();
12981
- if (node === root) {
13009
+ var isEmptyTextNode$1 = function (node) {
13010
+ if (!isWhitespaceText(node.value)) {
12982
13011
  return false;
12983
13012
  }
12984
- node = editor.dom.getParent(node, function (node) {
12985
- if (matchesUnInheritedFormatSelector(editor, node, name)) {
12986
- return true;
12987
- }
12988
- return node.parentNode === root || !!matchNode(editor, node, name, vars, true);
12989
- });
12990
- return matchNode(editor, node, name, vars);
12991
- };
12992
- var matchName = function (dom, node, format) {
12993
- if (isEq$2(node, format.inline)) {
12994
- return true;
12995
- }
12996
- if (isEq$2(node, format.block)) {
12997
- return true;
12998
- }
12999
- if (format.selector) {
13000
- return node.nodeType === 1 && dom.is(node, format.selector);
13001
- }
13002
- };
13003
- var matchItems = function (dom, node, format, itemName, similar, vars) {
13004
- var key, value;
13005
- var items = format[itemName];
13006
- var i;
13007
- if (format.onmatch) {
13008
- return format.onmatch(node, format, itemName);
13009
- }
13010
- if (items) {
13011
- if (typeof items.length === 'undefined') {
13012
- for (key in items) {
13013
- if (items.hasOwnProperty(key)) {
13014
- if (itemName === 'attributes') {
13015
- value = dom.getAttrib(node, key);
13016
- } else {
13017
- value = getStyle(dom, node, key);
13018
- }
13019
- if (similar && !value && !format.exact) {
13020
- return;
13021
- }
13022
- if ((!similar || format.exact) && !isEq$2(value, normalizeStyleValue(dom, replaceVars(items[key], vars), key))) {
13023
- return;
13024
- }
13025
- }
13026
- }
13027
- } else {
13028
- for (i = 0; i < items.length; i++) {
13029
- if (itemName === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(dom, node, items[i])) {
13030
- return format;
13031
- }
13032
- }
13033
- }
13013
+ var parentNode = node.parent;
13014
+ if (parentNode && (parentNode.name !== 'span' || parentNode.attr('style')) && /^[ ]+$/.test(node.value)) {
13015
+ return false;
13034
13016
  }
13035
- return format;
13017
+ return true;
13036
13018
  };
13037
- var matchNode = function (ed, node, name, vars, similar) {
13038
- var formatList = ed.formatter.get(name);
13039
- var format, i, x, classes;
13040
- var dom = ed.dom;
13041
- if (formatList && node) {
13042
- for (i = 0; i < formatList.length; i++) {
13043
- format = formatList[i];
13044
- if (matchName(ed.dom, node, format) && matchItems(dom, node, format, 'attributes', similar, vars) && matchItems(dom, node, format, 'styles', similar, vars)) {
13045
- if (classes = format.classes) {
13046
- for (x = 0; x < classes.length; x++) {
13047
- if (!ed.dom.hasClass(node, classes[x])) {
13048
- return;
13049
- }
13050
- }
13051
- }
13052
- return format;
13053
- }
13054
- }
13055
- }
13019
+ var isNonEmptyElement = function (node) {
13020
+ var isNamedAnchor = node.name === 'a' && !node.attr('href') && node.attr('id');
13021
+ return node.attr('name') || node.attr('id') && !node.firstChild || node.attr('data-mce-bookmark') || isNamedAnchor;
13056
13022
  };
13057
- var match = function (editor, name, vars, node) {
13058
- if (node) {
13059
- return matchParents(editor, node, name, vars);
13060
- }
13061
- node = editor.selection.getNode();
13062
- if (matchParents(editor, node, name, vars)) {
13063
- return true;
13064
- }
13065
- var startNode = editor.selection.getStart();
13066
- if (startNode !== node) {
13067
- if (matchParents(editor, startNode, name, vars)) {
13068
- return true;
13069
- }
13070
- }
13071
- return false;
13072
- };
13073
- var matchAll = function (editor, names, vars) {
13074
- var matchedFormatNames = [];
13075
- var checkedMap = {};
13076
- var startElement = editor.selection.getStart();
13077
- editor.dom.getParent(startElement, function (node) {
13078
- for (var i = 0; i < names.length; i++) {
13079
- var name_1 = names[i];
13080
- if (!checkedMap[name_1] && matchNode(editor, node, name_1, vars)) {
13081
- checkedMap[name_1] = true;
13082
- matchedFormatNames.push(name_1);
13083
- }
13084
- }
13085
- }, editor.dom.getRoot());
13086
- return matchedFormatNames;
13087
- };
13088
- var closest$3 = function (editor, names) {
13089
- var isRoot = function (elm) {
13090
- return eq$2(elm, SugarElement.fromDom(editor.getBody()));
13091
- };
13092
- var match = function (elm, name) {
13093
- return matchNode(editor, elm.dom, name) ? Optional.some(name) : Optional.none();
13094
- };
13095
- return Optional.from(editor.selection.getStart(true)).bind(function (rawElm) {
13096
- return closest$2(SugarElement.fromDom(rawElm), function (elm) {
13097
- return findMap(names, function (name) {
13098
- return match(elm, name);
13099
- });
13100
- }, isRoot);
13101
- }).getOrNull();
13102
- };
13103
- var canApply = function (editor, name) {
13104
- var formatList = editor.formatter.get(name);
13105
- var startNode, parents, i, x, selector;
13106
- var dom = editor.dom;
13107
- if (formatList) {
13108
- startNode = editor.selection.getStart();
13109
- parents = getParents$1(dom, startNode);
13110
- for (x = formatList.length - 1; x >= 0; x--) {
13111
- selector = formatList[x].selector;
13112
- if (!selector || formatList[x].defaultBlock) {
13113
- return true;
13114
- }
13115
- for (i = parents.length - 1; i >= 0; i--) {
13116
- if (dom.is(parents[i], selector)) {
13117
- return true;
13118
- }
13119
- }
13120
- }
13121
- }
13122
- return false;
13123
- };
13124
- var matchAllOnNode = function (editor, node, formatNames) {
13125
- return foldl(formatNames, function (acc, name) {
13126
- var matchSimilar = isVariableFormatName(editor, name);
13127
- if (editor.formatter.matchNode(node, name, {}, matchSimilar)) {
13128
- return acc.concat([name]);
13129
- } else {
13130
- return acc;
13131
- }
13132
- }, []);
13133
- };
13134
-
13135
- var typeLookup = {
13136
- '#text': 3,
13137
- '#comment': 8,
13138
- '#cdata': 4,
13139
- '#pi': 7,
13140
- '#doctype': 10,
13141
- '#document-fragment': 11
13142
- };
13143
- var walk$2 = function (node, root, prev) {
13144
- var startName = prev ? 'lastChild' : 'firstChild';
13145
- var siblingName = prev ? 'prev' : 'next';
13146
- if (node[startName]) {
13147
- return node[startName];
13148
- }
13149
- if (node !== root) {
13150
- var sibling = node[siblingName];
13151
- if (sibling) {
13152
- return sibling;
13153
- }
13154
- for (var parent_1 = node.parent; parent_1 && parent_1 !== root; parent_1 = parent_1.parent) {
13155
- sibling = parent_1[siblingName];
13156
- if (sibling) {
13157
- return sibling;
13158
- }
13159
- }
13160
- }
13161
- };
13162
- var isEmptyTextNode$1 = function (node) {
13163
- if (!isWhitespaceText(node.value)) {
13164
- return false;
13165
- }
13166
- var parentNode = node.parent;
13167
- if (parentNode && (parentNode.name !== 'span' || parentNode.attr('style')) && /^[ ]+$/.test(node.value)) {
13168
- return false;
13169
- }
13170
- return true;
13171
- };
13172
- var isNonEmptyElement = function (node) {
13173
- var isNamedAnchor = node.name === 'a' && !node.attr('href') && node.attr('id');
13174
- return node.attr('name') || node.attr('id') && !node.firstChild || node.attr('data-mce-bookmark') || isNamedAnchor;
13175
- };
13176
- var AstNode = function () {
13177
- function AstNode(name, type) {
13178
- this.name = name;
13179
- this.type = type;
13180
- if (type === 1) {
13181
- this.attributes = [];
13182
- this.attributes.map = {};
13023
+ var AstNode = function () {
13024
+ function AstNode(name, type) {
13025
+ this.name = name;
13026
+ this.type = type;
13027
+ if (type === 1) {
13028
+ this.attributes = [];
13029
+ this.attributes.map = {};
13183
13030
  }
13184
13031
  }
13185
13032
  AstNode.create = function (name, attrs) {
@@ -13420,180 +13267,6 @@
13420
13267
  return AstNode;
13421
13268
  }();
13422
13269
 
13423
- var makeMap$3 = Tools.makeMap;
13424
- var Writer = function (settings) {
13425
- var html = [];
13426
- settings = settings || {};
13427
- var indent = settings.indent;
13428
- var indentBefore = makeMap$3(settings.indent_before || '');
13429
- var indentAfter = makeMap$3(settings.indent_after || '');
13430
- var encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities);
13431
- var htmlOutput = settings.element_format === 'html';
13432
- return {
13433
- start: function (name, attrs, empty) {
13434
- var i, l, attr, value;
13435
- if (indent && indentBefore[name] && html.length > 0) {
13436
- value = html[html.length - 1];
13437
- if (value.length > 0 && value !== '\n') {
13438
- html.push('\n');
13439
- }
13440
- }
13441
- html.push('<', name);
13442
- if (attrs) {
13443
- for (i = 0, l = attrs.length; i < l; i++) {
13444
- attr = attrs[i];
13445
- html.push(' ', attr.name, '="', encode(attr.value, true), '"');
13446
- }
13447
- }
13448
- if (!empty || htmlOutput) {
13449
- html[html.length] = '>';
13450
- } else {
13451
- html[html.length] = ' />';
13452
- }
13453
- if (empty && indent && indentAfter[name] && html.length > 0) {
13454
- value = html[html.length - 1];
13455
- if (value.length > 0 && value !== '\n') {
13456
- html.push('\n');
13457
- }
13458
- }
13459
- },
13460
- end: function (name) {
13461
- var value;
13462
- html.push('</', name, '>');
13463
- if (indent && indentAfter[name] && html.length > 0) {
13464
- value = html[html.length - 1];
13465
- if (value.length > 0 && value !== '\n') {
13466
- html.push('\n');
13467
- }
13468
- }
13469
- },
13470
- text: function (text, raw) {
13471
- if (text.length > 0) {
13472
- html[html.length] = raw ? text : encode(text);
13473
- }
13474
- },
13475
- cdata: function (text) {
13476
- html.push('<![CDATA[', text, ']]>');
13477
- },
13478
- comment: function (text) {
13479
- html.push('<!--', text, '-->');
13480
- },
13481
- pi: function (name, text) {
13482
- if (text) {
13483
- html.push('<?', name, ' ', encode(text), '?>');
13484
- } else {
13485
- html.push('<?', name, '?>');
13486
- }
13487
- if (indent) {
13488
- html.push('\n');
13489
- }
13490
- },
13491
- doctype: function (text) {
13492
- html.push('<!DOCTYPE', text, '>', indent ? '\n' : '');
13493
- },
13494
- reset: function () {
13495
- html.length = 0;
13496
- },
13497
- getContent: function () {
13498
- return html.join('').replace(/\n$/, '');
13499
- }
13500
- };
13501
- };
13502
-
13503
- var HtmlSerializer = function (settings, schema) {
13504
- if (schema === void 0) {
13505
- schema = Schema();
13506
- }
13507
- var writer = Writer(settings);
13508
- settings = settings || {};
13509
- settings.validate = 'validate' in settings ? settings.validate : true;
13510
- var serialize = function (node) {
13511
- var validate = settings.validate;
13512
- var handlers = {
13513
- 3: function (node) {
13514
- writer.text(node.value, node.raw);
13515
- },
13516
- 8: function (node) {
13517
- writer.comment(node.value);
13518
- },
13519
- 7: function (node) {
13520
- writer.pi(node.name, node.value);
13521
- },
13522
- 10: function (node) {
13523
- writer.doctype(node.value);
13524
- },
13525
- 4: function (node) {
13526
- writer.cdata(node.value);
13527
- },
13528
- 11: function (node) {
13529
- if (node = node.firstChild) {
13530
- do {
13531
- walk(node);
13532
- } while (node = node.next);
13533
- }
13534
- }
13535
- };
13536
- writer.reset();
13537
- var walk = function (node) {
13538
- var handler = handlers[node.type];
13539
- var name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule;
13540
- if (!handler) {
13541
- name = node.name;
13542
- isEmpty = node.shortEnded;
13543
- attrs = node.attributes;
13544
- if (validate && attrs && attrs.length > 1) {
13545
- sortedAttrs = [];
13546
- sortedAttrs.map = {};
13547
- elementRule = schema.getElementRule(node.name);
13548
- if (elementRule) {
13549
- for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {
13550
- attrName = elementRule.attributesOrder[i];
13551
- if (attrName in attrs.map) {
13552
- attrValue = attrs.map[attrName];
13553
- sortedAttrs.map[attrName] = attrValue;
13554
- sortedAttrs.push({
13555
- name: attrName,
13556
- value: attrValue
13557
- });
13558
- }
13559
- }
13560
- for (i = 0, l = attrs.length; i < l; i++) {
13561
- attrName = attrs[i].name;
13562
- if (!(attrName in sortedAttrs.map)) {
13563
- attrValue = attrs.map[attrName];
13564
- sortedAttrs.map[attrName] = attrValue;
13565
- sortedAttrs.push({
13566
- name: attrName,
13567
- value: attrValue
13568
- });
13569
- }
13570
- }
13571
- attrs = sortedAttrs;
13572
- }
13573
- }
13574
- writer.start(node.name, attrs, isEmpty);
13575
- if (!isEmpty) {
13576
- if (node = node.firstChild) {
13577
- do {
13578
- walk(node);
13579
- } while (node = node.next);
13580
- }
13581
- writer.end(name);
13582
- }
13583
- } else {
13584
- handler(node);
13585
- }
13586
- };
13587
- if (node.type === 1 && !settings.inner) {
13588
- walk(node);
13589
- } else {
13590
- handlers[11](node);
13591
- }
13592
- return writer.getContent();
13593
- };
13594
- return { serialize: serialize };
13595
- };
13596
-
13597
13270
  var extractBase64DataUris = function (html) {
13598
13271
  var dataImageUri = /data:[^;]+;base64,([a-z0-9\+\/=]+)/gi;
13599
13272
  var chunks = [];
@@ -13612,11 +13285,13 @@
13612
13285
  chunks.push(imageId);
13613
13286
  index = matches.index + uri.length;
13614
13287
  }
13288
+ var re = new RegExp(prefix + '_[0-9]+', 'g');
13615
13289
  if (index === 0) {
13616
13290
  return {
13617
13291
  prefix: prefix,
13618
13292
  uris: uris,
13619
- html: html
13293
+ html: html,
13294
+ re: re
13620
13295
  };
13621
13296
  } else {
13622
13297
  if (index < html.length) {
@@ -13625,12 +13300,13 @@
13625
13300
  return {
13626
13301
  prefix: prefix,
13627
13302
  uris: uris,
13628
- html: chunks.join('')
13303
+ html: chunks.join(''),
13304
+ re: re
13629
13305
  };
13630
13306
  }
13631
13307
  };
13632
13308
  var restoreDataUris = function (html, result) {
13633
- return html.replace(new RegExp(result.prefix + '_[0-9]+', 'g'), function (imageId) {
13309
+ return html.replace(result.re, function (imageId) {
13634
13310
  return get$1(result.uris, imageId).getOr(imageId);
13635
13311
  });
13636
13312
  };
@@ -13669,7 +13345,7 @@
13669
13345
  var findEndTagIndex = function (schema, html, startIndex) {
13670
13346
  var count = 1, index, matches;
13671
13347
  var shortEndedElements = schema.getShortEndedElements();
13672
- var tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_\:\.]+)((?:\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\/|\s+)>/g;
13348
+ var tokenRegExp = /<([!?\/])?([A-Za-z0-9\-_:.]+)(\s(?:[^'">]+(?:"[^"]*"|'[^']*'))*[^"'>]*(?:"[^">]*|'[^'>]*)?|\s*|\/)>/g;
13673
13349
  tokenRegExp.lastIndex = index = startIndex;
13674
13350
  while (matches = tokenRegExp.exec(html)) {
13675
13351
  index = tokenRegExp.lastIndex;
@@ -13703,7 +13379,7 @@
13703
13379
  var endIndex = lcHtml.indexOf('>', startIndex);
13704
13380
  return endIndex !== -1 ? endIndex : lcHtml.length;
13705
13381
  } else {
13706
- var endCommentRegexp = /--!?>/;
13382
+ var endCommentRegexp = /--!?>/g;
13707
13383
  endCommentRegexp.lastIndex = startIndex;
13708
13384
  var match = endCommentRegexp.exec(html);
13709
13385
  return match ? match.index + match[0].length : lcHtml.length;
@@ -13720,12 +13396,10 @@
13720
13396
  return null;
13721
13397
  }
13722
13398
  };
13723
- function SaxParser(settings, schema) {
13399
+ var SaxParser = function (settings, schema) {
13724
13400
  if (schema === void 0) {
13725
13401
  schema = Schema();
13726
13402
  }
13727
- var noop = function () {
13728
- };
13729
13403
  settings = settings || {};
13730
13404
  if (settings.fix_self_closing !== false) {
13731
13405
  settings.fix_self_closing = true;
@@ -13750,7 +13424,7 @@
13750
13424
  var attributesRequired, attributesDefault, attributesForced;
13751
13425
  var anyAttributesRequired, attrValue, idCount = 0;
13752
13426
  var decode = Entities.decode;
13753
- var filteredUrlAttrs = Tools.makeMap('src,href,data,background,formaction,poster,xlink:href');
13427
+ var filteredUrlAttrs = Tools.makeMap('src,href,data,background,action,formaction,poster,xlink:href');
13754
13428
  var scriptUriRegExp = /((java|vb)script|mhtml):/i;
13755
13429
  var parsingMode = format === 'html' ? 0 : 1;
13756
13430
  var processEndTag = function (name) {
@@ -13787,7 +13461,7 @@
13787
13461
  comment(restoreDataUris(value, base64Extract));
13788
13462
  };
13789
13463
  var processAttr = function (value) {
13790
- return get$1(base64Extract.uris, value).getOr(value);
13464
+ return restoreDataUris(value, base64Extract);
13791
13465
  };
13792
13466
  var processMalformedComment = function (value, startIndex) {
13793
13467
  var startTag = value || '';
@@ -13846,7 +13520,7 @@
13846
13520
  value: value
13847
13521
  });
13848
13522
  };
13849
- var tokenRegExp = new RegExp('<(?:' + '(?:!--([\\w\\W]*?)--!?>)|' + '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + '(?:![Dd][Oo][Cc][Tt][Yy][Pp][Ee]([\\w\\W]*?)>)|' + '(?:!(--)?)|' + '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + '(?:\\/([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)>)|' + '(?:([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)((?:\\s+[^"\'>]+(?:(?:"[^"]*")|(?:\'[^\']*\')|[^>]*))*|\\/|\\s+)>)' + ')', 'g');
13523
+ var tokenRegExp = new RegExp('<(?:' + '(?:!--([\\w\\W]*?)--!?>)|' + '(?:!\\[CDATA\\[([\\w\\W]*?)\\]\\]>)|' + '(?:![Dd][Oo][Cc][Tt][Yy][Pp][Ee]([\\w\\W]*?)>)|' + '(?:!(--)?)|' + '(?:\\?([^\\s\\/<>]+) ?([\\w\\W]*?)[?/]>)|' + '(?:\\/([A-Za-z][A-Za-z0-9\\-_\\:\\.]*)>)|' + '(?:([A-Za-z][A-Za-z0-9\\-_:.]*)(\\s(?:[^\'">]+(?:"[^"]*"|\'[^\']*\'))*[^"\'>]*(?:"[^">]*|\'[^\'>]*)?|\\s*|\\/)>)' + ')', 'g');
13850
13524
  var attrRegExp = /([\w:\-]+)(?:\s*=\s*(?:(?:\"((?:[^\"])*)\")|(?:\'((?:[^\'])*)\')|([^>\s]+)))?/g;
13851
13525
  var shortEndedElements = schema.getShortEndedElements();
13852
13526
  var selfClosing = settings.self_closing_elements || schema.getSelfClosingElements();
@@ -14054,11 +13728,8 @@
14054
13728
  parseInternal(extractBase64DataUris(html), format);
14055
13729
  };
14056
13730
  return { parse: parse };
14057
- }
14058
- (function (SaxParser) {
14059
- SaxParser.findEndTag = findEndTagIndex;
14060
- }(SaxParser || (SaxParser = {})));
14061
- var SaxParser$1 = SaxParser;
13731
+ };
13732
+ SaxParser.findEndTag = findEndTagIndex;
14062
13733
 
14063
13734
  var trimHtml = function (tempAttrs, html) {
14064
13735
  var trimContentRegExp = new RegExp(['\\s?(' + tempAttrs.join('|') + ')="[^"]+"'].join('|'), 'gi');
@@ -14077,7 +13748,7 @@
14077
13748
  if (shortEndedElements[matches[1]]) {
14078
13749
  endTagIndex = index;
14079
13750
  } else {
14080
- endTagIndex = SaxParser$1.findEndTag(schema, content, index);
13751
+ endTagIndex = SaxParser.findEndTag(schema, content, index);
14081
13752
  }
14082
13753
  content = content.substring(0, index - matchLength) + content.substring(endTagIndex);
14083
13754
  bogusAllRegExp.lastIndex = index - matchLength;
@@ -14129,7 +13800,7 @@
14129
13800
 
14130
13801
  var each$7 = Tools.each;
14131
13802
  var ElementUtils = function (dom) {
14132
- this.compare = function (node1, node2) {
13803
+ var compare = function (node1, node2) {
14133
13804
  if (node1.nodeName !== node2.nodeName) {
14134
13805
  return false;
14135
13806
  }
@@ -14154,24 +13825,199 @@
14154
13825
  if (obj1[name] !== value) {
14155
13826
  return false;
14156
13827
  }
14157
- delete obj2[name];
13828
+ delete obj2[name];
13829
+ }
13830
+ }
13831
+ for (name in obj2) {
13832
+ if (obj2.hasOwnProperty(name)) {
13833
+ return false;
13834
+ }
13835
+ }
13836
+ return true;
13837
+ };
13838
+ if (!compareObjects(getAttribs(node1), getAttribs(node2))) {
13839
+ return false;
13840
+ }
13841
+ if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) {
13842
+ return false;
13843
+ }
13844
+ return !isBookmarkNode$1(node1) && !isBookmarkNode$1(node2);
13845
+ };
13846
+ return { compare: compare };
13847
+ };
13848
+
13849
+ var makeMap$3 = Tools.makeMap;
13850
+ var Writer = function (settings) {
13851
+ var html = [];
13852
+ settings = settings || {};
13853
+ var indent = settings.indent;
13854
+ var indentBefore = makeMap$3(settings.indent_before || '');
13855
+ var indentAfter = makeMap$3(settings.indent_after || '');
13856
+ var encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities);
13857
+ var htmlOutput = settings.element_format === 'html';
13858
+ return {
13859
+ start: function (name, attrs, empty) {
13860
+ var i, l, attr, value;
13861
+ if (indent && indentBefore[name] && html.length > 0) {
13862
+ value = html[html.length - 1];
13863
+ if (value.length > 0 && value !== '\n') {
13864
+ html.push('\n');
13865
+ }
13866
+ }
13867
+ html.push('<', name);
13868
+ if (attrs) {
13869
+ for (i = 0, l = attrs.length; i < l; i++) {
13870
+ attr = attrs[i];
13871
+ html.push(' ', attr.name, '="', encode(attr.value, true), '"');
13872
+ }
13873
+ }
13874
+ if (!empty || htmlOutput) {
13875
+ html[html.length] = '>';
13876
+ } else {
13877
+ html[html.length] = ' />';
13878
+ }
13879
+ if (empty && indent && indentAfter[name] && html.length > 0) {
13880
+ value = html[html.length - 1];
13881
+ if (value.length > 0 && value !== '\n') {
13882
+ html.push('\n');
13883
+ }
13884
+ }
13885
+ },
13886
+ end: function (name) {
13887
+ var value;
13888
+ html.push('</', name, '>');
13889
+ if (indent && indentAfter[name] && html.length > 0) {
13890
+ value = html[html.length - 1];
13891
+ if (value.length > 0 && value !== '\n') {
13892
+ html.push('\n');
13893
+ }
13894
+ }
13895
+ },
13896
+ text: function (text, raw) {
13897
+ if (text.length > 0) {
13898
+ html[html.length] = raw ? text : encode(text);
13899
+ }
13900
+ },
13901
+ cdata: function (text) {
13902
+ html.push('<![CDATA[', text, ']]>');
13903
+ },
13904
+ comment: function (text) {
13905
+ html.push('<!--', text, '-->');
13906
+ },
13907
+ pi: function (name, text) {
13908
+ if (text) {
13909
+ html.push('<?', name, ' ', encode(text), '?>');
13910
+ } else {
13911
+ html.push('<?', name, '?>');
13912
+ }
13913
+ if (indent) {
13914
+ html.push('\n');
13915
+ }
13916
+ },
13917
+ doctype: function (text) {
13918
+ html.push('<!DOCTYPE', text, '>', indent ? '\n' : '');
13919
+ },
13920
+ reset: function () {
13921
+ html.length = 0;
13922
+ },
13923
+ getContent: function () {
13924
+ return html.join('').replace(/\n$/, '');
13925
+ }
13926
+ };
13927
+ };
13928
+
13929
+ var HtmlSerializer = function (settings, schema) {
13930
+ if (schema === void 0) {
13931
+ schema = Schema();
13932
+ }
13933
+ var writer = Writer(settings);
13934
+ settings = settings || {};
13935
+ settings.validate = 'validate' in settings ? settings.validate : true;
13936
+ var serialize = function (node) {
13937
+ var validate = settings.validate;
13938
+ var handlers = {
13939
+ 3: function (node) {
13940
+ writer.text(node.value, node.raw);
13941
+ },
13942
+ 8: function (node) {
13943
+ writer.comment(node.value);
13944
+ },
13945
+ 7: function (node) {
13946
+ writer.pi(node.name, node.value);
13947
+ },
13948
+ 10: function (node) {
13949
+ writer.doctype(node.value);
13950
+ },
13951
+ 4: function (node) {
13952
+ writer.cdata(node.value);
13953
+ },
13954
+ 11: function (node) {
13955
+ if (node = node.firstChild) {
13956
+ do {
13957
+ walk(node);
13958
+ } while (node = node.next);
13959
+ }
13960
+ }
13961
+ };
13962
+ writer.reset();
13963
+ var walk = function (node) {
13964
+ var handler = handlers[node.type];
13965
+ var name, isEmpty, attrs, attrName, attrValue, sortedAttrs, i, l, elementRule;
13966
+ if (!handler) {
13967
+ name = node.name;
13968
+ isEmpty = node.shortEnded;
13969
+ attrs = node.attributes;
13970
+ if (validate && attrs && attrs.length > 1) {
13971
+ sortedAttrs = [];
13972
+ sortedAttrs.map = {};
13973
+ elementRule = schema.getElementRule(node.name);
13974
+ if (elementRule) {
13975
+ for (i = 0, l = elementRule.attributesOrder.length; i < l; i++) {
13976
+ attrName = elementRule.attributesOrder[i];
13977
+ if (attrName in attrs.map) {
13978
+ attrValue = attrs.map[attrName];
13979
+ sortedAttrs.map[attrName] = attrValue;
13980
+ sortedAttrs.push({
13981
+ name: attrName,
13982
+ value: attrValue
13983
+ });
13984
+ }
13985
+ }
13986
+ for (i = 0, l = attrs.length; i < l; i++) {
13987
+ attrName = attrs[i].name;
13988
+ if (!(attrName in sortedAttrs.map)) {
13989
+ attrValue = attrs.map[attrName];
13990
+ sortedAttrs.map[attrName] = attrValue;
13991
+ sortedAttrs.push({
13992
+ name: attrName,
13993
+ value: attrValue
13994
+ });
13995
+ }
13996
+ }
13997
+ attrs = sortedAttrs;
13998
+ }
14158
13999
  }
14159
- }
14160
- for (name in obj2) {
14161
- if (obj2.hasOwnProperty(name)) {
14162
- return false;
14000
+ writer.start(node.name, attrs, isEmpty);
14001
+ if (!isEmpty) {
14002
+ if (node = node.firstChild) {
14003
+ do {
14004
+ walk(node);
14005
+ } while (node = node.next);
14006
+ }
14007
+ writer.end(name);
14163
14008
  }
14009
+ } else {
14010
+ handler(node);
14164
14011
  }
14165
- return true;
14166
14012
  };
14167
- if (!compareObjects(getAttribs(node1), getAttribs(node2))) {
14168
- return false;
14169
- }
14170
- if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) {
14171
- return false;
14013
+ if (node.type === 1 && !settings.inner) {
14014
+ walk(node);
14015
+ } else {
14016
+ handlers[11](node);
14172
14017
  }
14173
- return !isBookmarkNode$1(node1) && !isBookmarkNode$1(node2);
14018
+ return writer.getContent();
14174
14019
  };
14020
+ return { serialize: serialize };
14175
14021
  };
14176
14022
 
14177
14023
  var isChar = function (forward, predicate, pos) {
@@ -14184,7 +14030,7 @@
14184
14030
  var isAfterSpace = curry(isChar, false, isWhiteSpace$1);
14185
14031
  var isEmptyText = function (pos) {
14186
14032
  var container = pos.container();
14187
- return isText$1(container) && (container.data.length === 0 || isZwsp$1(container.data) && BookmarkManager$1.isBookmarkNode(container.parentNode));
14033
+ return isText$1(container) && (container.data.length === 0 || isZwsp$1(container.data) && BookmarkManager.isBookmarkNode(container.parentNode));
14188
14034
  };
14189
14035
  var matchesElementPosition = function (before, predicate) {
14190
14036
  return function (pos) {
@@ -14473,8 +14319,8 @@
14473
14319
  var elm = SugarElement.fromDom(node);
14474
14320
  var root = ancestor(elm, isBlock).getOr(elm);
14475
14321
  var whitespace = node.data.slice(offset, offset + count);
14476
- var isEndOfContent = offset + count >= node.data.length && needsToBeNbspRight(root, CaretPosition$1(node, node.data.length));
14477
- var isStartOfContent = offset === 0 && needsToBeNbspLeft(root, CaretPosition$1(node, 0));
14322
+ var isEndOfContent = offset + count >= node.data.length && needsToBeNbspRight(root, CaretPosition(node, node.data.length));
14323
+ var isStartOfContent = offset === 0 && needsToBeNbspLeft(root, CaretPosition(node, 0));
14478
14324
  node.replaceData(offset, count, normalizeContent(whitespace, isStartOfContent, isEndOfContent));
14479
14325
  };
14480
14326
  var normalizeWhitespaceAfter = function (node, offset) {
@@ -14509,16 +14355,16 @@
14509
14355
  var needsReposition = function (pos, elm) {
14510
14356
  var container = pos.container();
14511
14357
  var offset = pos.offset();
14512
- return CaretPosition$1.isTextPosition(pos) === false && container === elm.parentNode && offset > CaretPosition$1.before(elm).offset();
14358
+ return CaretPosition.isTextPosition(pos) === false && container === elm.parentNode && offset > CaretPosition.before(elm).offset();
14513
14359
  };
14514
14360
  var reposition = function (elm, pos) {
14515
- return needsReposition(pos, elm) ? CaretPosition$1(pos.container(), pos.offset() - 1) : pos;
14361
+ return needsReposition(pos, elm) ? CaretPosition(pos.container(), pos.offset() - 1) : pos;
14516
14362
  };
14517
14363
  var beforeOrStartOf = function (node) {
14518
- return isText$1(node) ? CaretPosition$1(node, 0) : CaretPosition$1.before(node);
14364
+ return isText$1(node) ? CaretPosition(node, 0) : CaretPosition.before(node);
14519
14365
  };
14520
14366
  var afterOrEndOf = function (node) {
14521
- return isText$1(node) ? CaretPosition$1(node, node.data.length) : CaretPosition$1.after(node);
14367
+ return isText$1(node) ? CaretPosition(node, node.data.length) : CaretPosition.after(node);
14522
14368
  };
14523
14369
  var getPreviousSiblingCaretPosition = function (elm) {
14524
14370
  if (isCaretCandidate(elm.previousSibling)) {
@@ -14535,14 +14381,14 @@
14535
14381
  }
14536
14382
  };
14537
14383
  var findCaretPositionBackwardsFromElm = function (rootElement, elm) {
14538
- var startPosition = CaretPosition$1.before(elm.previousSibling ? elm.previousSibling : elm.parentNode);
14384
+ var startPosition = CaretPosition.before(elm.previousSibling ? elm.previousSibling : elm.parentNode);
14539
14385
  return prevPosition(rootElement, startPosition).fold(function () {
14540
- return nextPosition(rootElement, CaretPosition$1.after(elm));
14386
+ return nextPosition(rootElement, CaretPosition.after(elm));
14541
14387
  }, Optional.some);
14542
14388
  };
14543
14389
  var findCaretPositionForwardsFromElm = function (rootElement, elm) {
14544
- return nextPosition(rootElement, CaretPosition$1.after(elm)).fold(function () {
14545
- return prevPosition(rootElement, CaretPosition$1.before(elm));
14390
+ return nextPosition(rootElement, CaretPosition.after(elm)).fold(function () {
14391
+ return prevPosition(rootElement, CaretPosition.before(elm));
14546
14392
  }, Optional.some);
14547
14393
  };
14548
14394
  var findCaretPositionBackwards = function (rootElement, elm) {
@@ -14585,7 +14431,7 @@
14585
14431
  var br = SugarElement.fromHtml('<br data-mce-bogus="1">');
14586
14432
  empty(elm);
14587
14433
  append(elm, br);
14588
- return Optional.some(CaretPosition$1.before(br.dom));
14434
+ return Optional.some(CaretPosition.before(br.dom));
14589
14435
  } else {
14590
14436
  return Optional.none();
14591
14437
  }
@@ -14598,7 +14444,7 @@
14598
14444
  var prevNode = prev.dom, nextNode = next.dom;
14599
14445
  var offset = prevNode.data.length;
14600
14446
  mergeTextNodes(prevNode, nextNode, normalizeWhitespace);
14601
- return pos.container() === nextNode ? CaretPosition$1(prevNode, offset) : pos;
14447
+ return pos.container() === nextNode ? CaretPosition(prevNode, offset) : pos;
14602
14448
  }).orThunk(function () {
14603
14449
  if (normalizeWhitespace) {
14604
14450
  prevTextOpt.each(function (elm) {
@@ -14870,20 +14716,20 @@
14870
14716
  }).or(Optional.some(true));
14871
14717
  };
14872
14718
  var deleteCaretCells = function (editor, forward, rootElm, startElm) {
14873
- var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());
14719
+ var from = CaretPosition.fromRangeStart(editor.selection.getRng());
14874
14720
  return getParentCell(rootElm, startElm).bind(function (fromCell) {
14875
14721
  return isEmpty(fromCell) ? emptyElement(editor, fromCell) : deleteBetweenCells(editor, rootElm, forward, fromCell, from);
14876
14722
  }).getOr(false);
14877
14723
  };
14878
14724
  var deleteCaretCaption = function (editor, forward, rootElm, fromCaption) {
14879
- var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());
14725
+ var from = CaretPosition.fromRangeStart(editor.selection.getRng());
14880
14726
  return isEmpty(fromCaption) ? emptyElement(editor, fromCaption) : deleteCaretInsideCaption(editor, rootElm, forward, fromCaption, from);
14881
14727
  };
14882
14728
  var isNearTable = function (forward, pos) {
14883
14729
  return forward ? isBeforeTable(pos) : isAfterTable(pos);
14884
14730
  };
14885
14731
  var isBeforeOrAfterTable = function (editor, forward) {
14886
- var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng());
14732
+ var fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());
14887
14733
  return isNearTable(forward, fromPos) || fromPosition(forward, editor.getBody(), fromPos).exists(function (pos) {
14888
14734
  return isNearTable(forward, pos);
14889
14735
  });
@@ -14909,8 +14755,8 @@
14909
14755
  return rng;
14910
14756
  };
14911
14757
  var normalizeBlockSelectionRange = function (rng) {
14912
- var startPos = CaretPosition$1.fromRangeStart(rng);
14913
- var endPos = CaretPosition$1.fromRangeEnd(rng);
14758
+ var startPos = CaretPosition.fromRangeStart(rng);
14759
+ var endPos = CaretPosition.fromRangeEnd(rng);
14914
14760
  var rootNode = rng.commonAncestorContainer;
14915
14761
  return fromPosition(false, rootNode, endPos).map(function (newEndPos) {
14916
14762
  if (!isInSameBlock(startPos, endPos, rootNode) && isInSameBlock(startPos, newEndPos, rootNode)) {
@@ -15006,13 +14852,13 @@
15006
14852
  ];
15007
14853
  };
15008
14854
  var findFirstIn = function (node, rootNode) {
15009
- var caretPos = CaretPosition$1.before(node);
14855
+ var caretPos = CaretPosition.before(node);
15010
14856
  var caretWalker = CaretWalker(rootNode);
15011
14857
  var newCaretPos = caretWalker.next(caretPos);
15012
14858
  return newCaretPos ? newCaretPos.toRange() : null;
15013
14859
  };
15014
14860
  var findLastOf = function (node, rootNode) {
15015
- var caretPos = CaretPosition$1.after(node);
14861
+ var caretPos = CaretPosition.after(node);
15016
14862
  var caretWalker = CaretWalker(rootNode);
15017
14863
  var newCaretPos = caretWalker.prev(caretPos);
15018
14864
  return newCaretPos ? newCaretPos.toRange() : null;
@@ -15046,7 +14892,7 @@
15046
14892
  var BEGINNING = 1, END = 2;
15047
14893
  var rootNode = dom.getRoot();
15048
14894
  var isAt = function (location) {
15049
- var caretPos = CaretPosition$1.fromRangeStart(rng);
14895
+ var caretPos = CaretPosition.fromRangeStart(rng);
15050
14896
  var caretWalker = CaretWalker(dom.getRoot());
15051
14897
  var newPos = location === BEGINNING ? caretWalker.prev(caretPos) : caretWalker.next(caretPos);
15052
14898
  return newPos ? getParentLi(dom, newPos.getNode()) !== liTarget : true;
@@ -15061,12 +14907,12 @@
15061
14907
 
15062
14908
  var trimOrPadLeftRight = function (dom, rng, html) {
15063
14909
  var root = SugarElement.fromDom(dom.getRoot());
15064
- if (needsToBeNbspLeft(root, CaretPosition$1.fromRangeStart(rng))) {
14910
+ if (needsToBeNbspLeft(root, CaretPosition.fromRangeStart(rng))) {
15065
14911
  html = html.replace(/^ /, '&nbsp;');
15066
14912
  } else {
15067
14913
  html = html.replace(/^&nbsp;/, ' ');
15068
14914
  }
15069
- if (needsToBeNbspRight(root, CaretPosition$1.fromRangeEnd(rng))) {
14915
+ if (needsToBeNbspRight(root, CaretPosition.fromRangeEnd(rng))) {
15070
14916
  html = html.replace(/(&nbsp;| )(<br( \/)>)?$/, '&nbsp;');
15071
14917
  } else {
15072
14918
  html = html.replace(/&nbsp;(<br( \/)?>)?$/, ' ');
@@ -15103,7 +14949,7 @@
15103
14949
  var textInlineElements = editor.schema.getTextInlineElements();
15104
14950
  var dom = editor.dom;
15105
14951
  if (merge) {
15106
- var root_1 = editor.getBody(), elementUtils_1 = new ElementUtils(dom);
14952
+ var root_1 = editor.getBody(), elementUtils_1 = ElementUtils(dom);
15107
14953
  Tools.each(dom.select('*[data-mce-fragment]'), function (node) {
15108
14954
  for (var testNode = node.parentNode; testNode && testNode !== root_1; testNode = testNode.parentNode) {
15109
14955
  if (textInlineElements[node.nodeName.toLowerCase()] && elementUtils_1.compare(testNode, node)) {
@@ -15171,7 +15017,7 @@
15171
15017
  rng.setEndBefore(marker);
15172
15018
  }
15173
15019
  var findNextCaretRng = function (rng) {
15174
- var caretPos = CaretPosition$1.fromRangeStart(rng);
15020
+ var caretPos = CaretPosition.fromRangeStart(rng);
15175
15021
  var caretWalker = CaretWalker(editor.getBody());
15176
15022
  caretPos = caretWalker.next(caretPos);
15177
15023
  if (caretPos) {
@@ -15448,44 +15294,202 @@
15448
15294
  });
15449
15295
  };
15450
15296
 
15451
- var addVisualInternal = function (editor, elm) {
15452
- var dom = editor.dom;
15453
- var scope = isNonNullable(elm) ? elm : editor.getBody();
15454
- if (isUndefined(editor.hasVisual)) {
15455
- editor.hasVisual = isVisualAidsEnabled(editor);
15297
+ var sibling$2 = function (scope, predicate) {
15298
+ return sibling(scope, predicate).isSome();
15299
+ };
15300
+
15301
+ var ensureIsRoot = function (isRoot) {
15302
+ return isFunction(isRoot) ? isRoot : never;
15303
+ };
15304
+ var ancestor$3 = function (scope, transform, isRoot) {
15305
+ var element = scope.dom;
15306
+ var stop = ensureIsRoot(isRoot);
15307
+ while (element.parentNode) {
15308
+ element = element.parentNode;
15309
+ var el = SugarElement.fromDom(element);
15310
+ var transformed = transform(el);
15311
+ if (transformed.isSome()) {
15312
+ return transformed;
15313
+ } else if (stop(el)) {
15314
+ break;
15315
+ }
15456
15316
  }
15457
- each(dom.select('table,a', scope), function (matchedElm) {
15458
- switch (matchedElm.nodeName) {
15459
- case 'TABLE':
15460
- var cls = getVisualAidsTableClass(editor);
15461
- var value = dom.getAttrib(matchedElm, 'border');
15462
- if ((!value || value === '0') && editor.hasVisual) {
15463
- dom.addClass(matchedElm, cls);
15464
- } else {
15465
- dom.removeClass(matchedElm, cls);
15317
+ return Optional.none();
15318
+ };
15319
+ var closest$2 = function (scope, transform, isRoot) {
15320
+ var current = transform(scope);
15321
+ var stop = ensureIsRoot(isRoot);
15322
+ return current.orThunk(function () {
15323
+ return stop(scope) ? Optional.none() : ancestor$3(scope, transform, stop);
15324
+ });
15325
+ };
15326
+
15327
+ var isEq$2 = isEq;
15328
+ var matchesUnInheritedFormatSelector = function (ed, node, name) {
15329
+ var formatList = ed.formatter.get(name);
15330
+ if (formatList) {
15331
+ for (var i = 0; i < formatList.length; i++) {
15332
+ if (formatList[i].inherit === false && ed.dom.is(node, formatList[i].selector)) {
15333
+ return true;
15466
15334
  }
15467
- break;
15468
- case 'A':
15469
- if (!dom.getAttrib(matchedElm, 'href')) {
15470
- var value_1 = dom.getAttrib(matchedElm, 'name') || matchedElm.id;
15471
- var cls_1 = getVisualAidsAnchorClass(editor);
15472
- if (value_1 && editor.hasVisual) {
15473
- dom.addClass(matchedElm, cls_1);
15474
- } else {
15475
- dom.removeClass(matchedElm, cls_1);
15335
+ }
15336
+ }
15337
+ return false;
15338
+ };
15339
+ var matchParents = function (editor, node, name, vars) {
15340
+ var root = editor.dom.getRoot();
15341
+ if (node === root) {
15342
+ return false;
15343
+ }
15344
+ node = editor.dom.getParent(node, function (node) {
15345
+ if (matchesUnInheritedFormatSelector(editor, node, name)) {
15346
+ return true;
15347
+ }
15348
+ return node.parentNode === root || !!matchNode(editor, node, name, vars, true);
15349
+ });
15350
+ return matchNode(editor, node, name, vars);
15351
+ };
15352
+ var matchName = function (dom, node, format) {
15353
+ if (isEq$2(node, format.inline)) {
15354
+ return true;
15355
+ }
15356
+ if (isEq$2(node, format.block)) {
15357
+ return true;
15358
+ }
15359
+ if (format.selector) {
15360
+ return node.nodeType === 1 && dom.is(node, format.selector);
15361
+ }
15362
+ };
15363
+ var matchItems = function (dom, node, format, itemName, similar, vars) {
15364
+ var key, value;
15365
+ var items = format[itemName];
15366
+ var i;
15367
+ if (format.onmatch) {
15368
+ return format.onmatch(node, format, itemName);
15369
+ }
15370
+ if (items) {
15371
+ if (typeof items.length === 'undefined') {
15372
+ for (key in items) {
15373
+ if (items.hasOwnProperty(key)) {
15374
+ if (itemName === 'attributes') {
15375
+ value = dom.getAttrib(node, key);
15376
+ } else {
15377
+ value = getStyle(dom, node, key);
15378
+ }
15379
+ if (similar && !value && !format.exact) {
15380
+ return;
15381
+ }
15382
+ if ((!similar || format.exact) && !isEq$2(value, normalizeStyleValue(dom, replaceVars(items[key], vars), key))) {
15383
+ return;
15384
+ }
15385
+ }
15386
+ }
15387
+ } else {
15388
+ for (i = 0; i < items.length; i++) {
15389
+ if (itemName === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(dom, node, items[i])) {
15390
+ return format;
15476
15391
  }
15477
15392
  }
15478
- break;
15479
15393
  }
15480
- });
15481
- editor.fire('VisualAid', {
15482
- element: elm,
15483
- hasVisual: editor.hasVisual
15484
- });
15394
+ }
15395
+ return format;
15485
15396
  };
15486
-
15487
- var sibling$2 = function (scope, predicate) {
15488
- return sibling(scope, predicate).isSome();
15397
+ var matchNode = function (ed, node, name, vars, similar) {
15398
+ var formatList = ed.formatter.get(name);
15399
+ var format, i, x, classes;
15400
+ var dom = ed.dom;
15401
+ if (formatList && node) {
15402
+ for (i = 0; i < formatList.length; i++) {
15403
+ format = formatList[i];
15404
+ if (matchName(ed.dom, node, format) && matchItems(dom, node, format, 'attributes', similar, vars) && matchItems(dom, node, format, 'styles', similar, vars)) {
15405
+ if (classes = format.classes) {
15406
+ for (x = 0; x < classes.length; x++) {
15407
+ if (!ed.dom.hasClass(node, classes[x])) {
15408
+ return;
15409
+ }
15410
+ }
15411
+ }
15412
+ return format;
15413
+ }
15414
+ }
15415
+ }
15416
+ };
15417
+ var match = function (editor, name, vars, node) {
15418
+ if (node) {
15419
+ return matchParents(editor, node, name, vars);
15420
+ }
15421
+ node = editor.selection.getNode();
15422
+ if (matchParents(editor, node, name, vars)) {
15423
+ return true;
15424
+ }
15425
+ var startNode = editor.selection.getStart();
15426
+ if (startNode !== node) {
15427
+ if (matchParents(editor, startNode, name, vars)) {
15428
+ return true;
15429
+ }
15430
+ }
15431
+ return false;
15432
+ };
15433
+ var matchAll = function (editor, names, vars) {
15434
+ var matchedFormatNames = [];
15435
+ var checkedMap = {};
15436
+ var startElement = editor.selection.getStart();
15437
+ editor.dom.getParent(startElement, function (node) {
15438
+ for (var i = 0; i < names.length; i++) {
15439
+ var name_1 = names[i];
15440
+ if (!checkedMap[name_1] && matchNode(editor, node, name_1, vars)) {
15441
+ checkedMap[name_1] = true;
15442
+ matchedFormatNames.push(name_1);
15443
+ }
15444
+ }
15445
+ }, editor.dom.getRoot());
15446
+ return matchedFormatNames;
15447
+ };
15448
+ var closest$3 = function (editor, names) {
15449
+ var isRoot = function (elm) {
15450
+ return eq$2(elm, SugarElement.fromDom(editor.getBody()));
15451
+ };
15452
+ var match = function (elm, name) {
15453
+ return matchNode(editor, elm.dom, name) ? Optional.some(name) : Optional.none();
15454
+ };
15455
+ return Optional.from(editor.selection.getStart(true)).bind(function (rawElm) {
15456
+ return closest$2(SugarElement.fromDom(rawElm), function (elm) {
15457
+ return findMap(names, function (name) {
15458
+ return match(elm, name);
15459
+ });
15460
+ }, isRoot);
15461
+ }).getOrNull();
15462
+ };
15463
+ var canApply = function (editor, name) {
15464
+ var formatList = editor.formatter.get(name);
15465
+ var startNode, parents, i, x, selector;
15466
+ var dom = editor.dom;
15467
+ if (formatList) {
15468
+ startNode = editor.selection.getStart();
15469
+ parents = getParents$1(dom, startNode);
15470
+ for (x = formatList.length - 1; x >= 0; x--) {
15471
+ selector = formatList[x].selector;
15472
+ if (!selector || formatList[x].defaultBlock) {
15473
+ return true;
15474
+ }
15475
+ for (i = parents.length - 1; i >= 0; i--) {
15476
+ if (dom.is(parents[i], selector)) {
15477
+ return true;
15478
+ }
15479
+ }
15480
+ }
15481
+ }
15482
+ return false;
15483
+ };
15484
+ var matchAllOnNode = function (editor, node, formatNames) {
15485
+ return foldl(formatNames, function (acc, name) {
15486
+ var matchSimilar = isVariableFormatName(editor, name);
15487
+ if (editor.formatter.matchNode(node, name, {}, matchSimilar)) {
15488
+ return acc.concat([name]);
15489
+ } else {
15490
+ return acc;
15491
+ }
15492
+ }, []);
15489
15493
  };
15490
15494
 
15491
15495
  var ZWSP$1 = ZWSP, CARET_ID$1 = '_mce_caret';
@@ -15726,7 +15730,7 @@
15726
15730
  var innerMost = insertFormatNodesIntoCaretContainer(formatNodes, caretContainer.dom);
15727
15731
  before(SugarElement.fromDom(targetNode), caretContainer);
15728
15732
  remove(SugarElement.fromDom(targetNode));
15729
- return CaretPosition$1(innerMost, 0);
15733
+ return CaretPosition(innerMost, 0);
15730
15734
  };
15731
15735
  var isFormatElement = function (editor, element) {
15732
15736
  var inlineElements = editor.schema.getTextInlineElements();
@@ -15788,7 +15792,7 @@
15788
15792
  };
15789
15793
  var mergeSiblingsNodes = function (dom, prev, next) {
15790
15794
  var sibling, tmpSibling;
15791
- var elementUtils = new ElementUtils(dom);
15795
+ var elementUtils = ElementUtils(dom);
15792
15796
  if (prev && next) {
15793
15797
  prev = findElementSibling(prev, 'previousSibling');
15794
15798
  next = findElementSibling(next, 'nextSibling');
@@ -17377,26 +17381,42 @@
17377
17381
  }
17378
17382
  };
17379
17383
 
17380
- var isTreeNode$1 = function (content) {
17381
- return content instanceof AstNode;
17382
- };
17383
- var runSerializerFiltersOnFragment = function (editor, fragment) {
17384
- filter$3(editor.serializer.getNodeFilters(), editor.serializer.getAttributeFilters(), fragment);
17385
- };
17386
- var getInsertContext = function (editor) {
17387
- return Optional.from(editor.selection.getStart(true)).map(function (elm) {
17388
- return elm.nodeName.toLowerCase();
17384
+ var addVisualInternal = function (editor, elm) {
17385
+ var dom = editor.dom;
17386
+ var scope = isNonNullable(elm) ? elm : editor.getBody();
17387
+ if (isUndefined(editor.hasVisual)) {
17388
+ editor.hasVisual = isVisualAidsEnabled(editor);
17389
+ }
17390
+ each(dom.select('table,a', scope), function (matchedElm) {
17391
+ switch (matchedElm.nodeName) {
17392
+ case 'TABLE':
17393
+ var cls = getVisualAidsTableClass(editor);
17394
+ var value = dom.getAttrib(matchedElm, 'border');
17395
+ if ((!value || value === '0') && editor.hasVisual) {
17396
+ dom.addClass(matchedElm, cls);
17397
+ } else {
17398
+ dom.removeClass(matchedElm, cls);
17399
+ }
17400
+ break;
17401
+ case 'A':
17402
+ if (!dom.getAttrib(matchedElm, 'href')) {
17403
+ var value_1 = dom.getAttrib(matchedElm, 'name') || matchedElm.id;
17404
+ var cls_1 = getVisualAidsAnchorClass(editor);
17405
+ if (value_1 && editor.hasVisual) {
17406
+ dom.addClass(matchedElm, cls_1);
17407
+ } else {
17408
+ dom.removeClass(matchedElm, cls_1);
17409
+ }
17410
+ }
17411
+ break;
17412
+ }
17413
+ });
17414
+ editor.fire('VisualAid', {
17415
+ element: elm,
17416
+ hasVisual: editor.hasVisual
17389
17417
  });
17390
17418
  };
17391
- var createDummyUndoLevel = function () {
17392
- return {
17393
- type: 'complete',
17394
- fragments: [],
17395
- content: '',
17396
- bookmark: null,
17397
- beforeBookmark: null
17398
- };
17399
- };
17419
+
17400
17420
  var makePlainAdaptor = function (editor) {
17401
17421
  return {
17402
17422
  undoManager: {
@@ -17489,114 +17509,132 @@
17489
17509
  }
17490
17510
  };
17491
17511
  };
17492
- var makeRtcAdaptor = function (tinymceEditor, rtcEditor) {
17512
+ var makeRtcAdaptor = function (rtcEditor) {
17493
17513
  var defaultVars = function (vars) {
17494
17514
  return isObject(vars) ? vars : {};
17495
17515
  };
17496
17516
  var unsupported = die('Unimplemented feature for rtc');
17517
+ var undoManager = rtcEditor.undoManager, formatter = rtcEditor.formatter, editor = rtcEditor.editor, selection = rtcEditor.selection, raw = rtcEditor.raw;
17497
17518
  var ignore = noop;
17498
17519
  return {
17499
17520
  undoManager: {
17500
17521
  beforeChange: ignore,
17501
17522
  addUndoLevel: unsupported,
17502
17523
  undo: function () {
17503
- rtcEditor.undo();
17504
- return createDummyUndoLevel();
17524
+ return undoManager.undo();
17505
17525
  },
17506
17526
  redo: function () {
17507
- rtcEditor.redo();
17508
- return createDummyUndoLevel();
17527
+ return undoManager.redo();
17528
+ },
17529
+ clear: function () {
17530
+ return undoManager.clear();
17531
+ },
17532
+ reset: function () {
17533
+ return undoManager.reset();
17509
17534
  },
17510
- clear: unsupported,
17511
- reset: unsupported,
17512
17535
  hasUndo: function () {
17513
- return rtcEditor.hasUndo();
17536
+ return undoManager.hasUndo();
17514
17537
  },
17515
17538
  hasRedo: function () {
17516
- return rtcEditor.hasRedo();
17539
+ return undoManager.hasRedo();
17517
17540
  },
17518
17541
  transact: function (_undoManager, _locks, fn) {
17519
- rtcEditor.transact(fn);
17520
- return createDummyUndoLevel();
17542
+ return undoManager.transact(fn);
17521
17543
  },
17522
- ignore: unsupported,
17523
- extra: unsupported
17544
+ ignore: function (_locks, callback) {
17545
+ return undoManager.ignore(callback);
17546
+ },
17547
+ extra: function (_undoManager, _index, callback1, callback2) {
17548
+ return undoManager.extra(callback1, callback2);
17549
+ }
17524
17550
  },
17525
17551
  formatter: {
17526
17552
  match: function (name, vars, _node) {
17527
- return rtcEditor.matchFormat(name, defaultVars(vars));
17553
+ return formatter.match(name, defaultVars(vars));
17528
17554
  },
17529
17555
  matchAll: unsupported,
17530
17556
  matchNode: unsupported,
17531
17557
  canApply: function (name) {
17532
- return rtcEditor.canApplyFormat(name);
17558
+ return formatter.canApply(name);
17533
17559
  },
17534
17560
  closest: function (names) {
17535
- return rtcEditor.closestFormat(names);
17561
+ return formatter.closest(names);
17536
17562
  },
17537
17563
  apply: function (name, vars, _node) {
17538
- return rtcEditor.applyFormat(name, defaultVars(vars));
17564
+ return formatter.apply(name, defaultVars(vars));
17539
17565
  },
17540
17566
  remove: function (name, vars, _node, _similar) {
17541
- return rtcEditor.removeFormat(name, defaultVars(vars));
17567
+ return formatter.remove(name, defaultVars(vars));
17542
17568
  },
17543
17569
  toggle: function (name, vars, _node) {
17544
- return rtcEditor.toggleFormat(name, defaultVars(vars));
17570
+ return formatter.toggle(name, defaultVars(vars));
17545
17571
  },
17546
17572
  formatChanged: function (_rfl, formats, callback, similar) {
17547
- return rtcEditor.formatChanged(formats, callback, similar);
17573
+ return formatter.formatChanged(formats, callback, similar);
17548
17574
  }
17549
17575
  },
17550
17576
  editor: {
17551
- getContent: function (args, format) {
17552
- if (format === 'html' || format === 'tree') {
17553
- var fragment = rtcEditor.getContent();
17554
- var serializer = HtmlSerializer({ inner: true });
17555
- runSerializerFiltersOnFragment(tinymceEditor, fragment);
17556
- return format === 'tree' ? fragment : serializer.serialize(fragment);
17557
- } else {
17558
- return makePlainAdaptor(tinymceEditor).editor.getContent(args, format);
17559
- }
17577
+ getContent: function (args, _format) {
17578
+ return editor.getContent(args);
17560
17579
  },
17561
- setContent: function (content, _args) {
17562
- var fragment = isTreeNode$1(content) ? content : tinymceEditor.parser.parse(content, {
17563
- isRootContent: true,
17564
- insert: true
17565
- });
17566
- rtcEditor.setContent(fragment);
17567
- return content;
17580
+ setContent: function (content, args) {
17581
+ return editor.setContent(content, args);
17568
17582
  },
17569
- insertContent: function (value, _details) {
17570
- var contextArgs = getInsertContext(tinymceEditor).fold(function () {
17571
- return {};
17572
- }, function (context) {
17573
- return { context: context };
17574
- });
17575
- var fragment = isTreeNode$1(value) ? value : tinymceEditor.parser.parse(value, __assign(__assign({}, contextArgs), { insert: true }));
17576
- rtcEditor.insertContent(fragment);
17583
+ insertContent: function (content, _details) {
17584
+ return editor.insertContent(content);
17577
17585
  },
17578
- addVisual: function (_elm) {
17579
- }
17586
+ addVisual: ignore
17580
17587
  },
17581
17588
  selection: {
17582
- getContent: function (format, args) {
17583
- if (format === 'html' || format === 'tree') {
17584
- var fragment = rtcEditor.getSelectedContent();
17585
- var serializer = HtmlSerializer({});
17586
- runSerializerFiltersOnFragment(tinymceEditor, fragment);
17587
- return format === 'tree' ? fragment : serializer.serialize(fragment);
17588
- } else {
17589
- return makePlainAdaptor(tinymceEditor).selection.getContent(format, args);
17590
- }
17589
+ getContent: function (_format, args) {
17590
+ return selection.getContent(args);
17591
17591
  }
17592
17592
  },
17593
17593
  raw: {
17594
17594
  getModel: function () {
17595
- return Optional.some(rtcEditor.getRawModel());
17595
+ return Optional.some(raw.getRawModel());
17596
17596
  }
17597
17597
  }
17598
17598
  };
17599
17599
  };
17600
+ var makeNoopAdaptor = function () {
17601
+ var nul = constant(null);
17602
+ var empty = constant('');
17603
+ return {
17604
+ undoManager: {
17605
+ beforeChange: noop,
17606
+ addUndoLevel: nul,
17607
+ undo: nul,
17608
+ redo: nul,
17609
+ clear: noop,
17610
+ reset: noop,
17611
+ hasUndo: never,
17612
+ hasRedo: never,
17613
+ transact: nul,
17614
+ ignore: noop,
17615
+ extra: noop
17616
+ },
17617
+ formatter: {
17618
+ match: never,
17619
+ matchAll: constant([]),
17620
+ matchNode: never,
17621
+ canApply: never,
17622
+ closest: empty,
17623
+ apply: noop,
17624
+ remove: noop,
17625
+ toggle: noop,
17626
+ formatChanged: constant({ unbind: noop })
17627
+ },
17628
+ editor: {
17629
+ getContent: empty,
17630
+ setContent: empty,
17631
+ insertContent: noop,
17632
+ addVisual: noop
17633
+ },
17634
+ selection: { getContent: empty },
17635
+ raw: { getModel: constant(Optional.none()) }
17636
+ };
17637
+ };
17600
17638
  var isRtc = function (editor) {
17601
17639
  return has(editor.plugins, 'rtc');
17602
17640
  };
@@ -17607,8 +17645,11 @@
17607
17645
  return Optional.none();
17608
17646
  }, function (rtc) {
17609
17647
  return Optional.some(rtc.setup().then(function (rtcEditor) {
17610
- editorCast.rtcInstance = makeRtcAdaptor(editor, rtcEditor);
17611
- return rtcEditor.isRemote;
17648
+ editorCast.rtcInstance = makeRtcAdaptor(rtcEditor);
17649
+ return rtcEditor.rtc.isRemote;
17650
+ }, function (err) {
17651
+ editorCast.rtcInstance = makeNoopAdaptor();
17652
+ return promiseObj.reject(err);
17612
17653
  }));
17613
17654
  });
17614
17655
  };
@@ -17720,7 +17761,7 @@
17720
17761
  };
17721
17762
  var walkPastBookmark = function (node, start) {
17722
17763
  return node.filter(function (elm) {
17723
- return BookmarkManager$1.isBookmarkNode(elm.dom);
17764
+ return BookmarkManager.isBookmarkNode(elm.dom);
17724
17765
  }).bind(start ? nextSibling : prevSibling);
17725
17766
  };
17726
17767
  var merge = function (outer, inner, rng, start) {
@@ -17738,9 +17779,9 @@
17738
17779
  var normalizeTextIfRequired = function (inner, start) {
17739
17780
  parent(inner).each(function (root) {
17740
17781
  var text = inner.dom;
17741
- if (start && needsToBeNbspLeft(root, CaretPosition$1(text, 0))) {
17782
+ if (start && needsToBeNbspLeft(root, CaretPosition(text, 0))) {
17742
17783
  normalizeWhitespaceAfter(text, 0);
17743
- } else if (!start && needsToBeNbspRight(root, CaretPosition$1(text, text.length))) {
17784
+ } else if (!start && needsToBeNbspRight(root, CaretPosition(text, text.length))) {
17744
17785
  normalizeWhitespaceBefore(text, text.length);
17745
17786
  }
17746
17787
  });
@@ -17902,14 +17943,14 @@
17902
17943
  var selectorChangedWithUnbind = SelectorChanged(dom, editor).selectorChangedWithUnbind;
17903
17944
  var setCursorLocation = function (node, offset) {
17904
17945
  var rng = dom.createRng();
17905
- if (!node) {
17906
- moveEndPoint$1(dom, rng, editor.getBody(), true);
17907
- setRng(rng);
17908
- } else {
17946
+ if (isNonNullable(node) && isNonNullable(offset)) {
17909
17947
  rng.setStart(node, offset);
17910
17948
  rng.setEnd(node, offset);
17911
17949
  setRng(rng);
17912
17950
  collapse(false);
17951
+ } else {
17952
+ moveEndPoint$1(dom, rng, editor.getBody(), true);
17953
+ setRng(rng);
17913
17954
  }
17914
17955
  };
17915
17956
  var getContent = function (args) {
@@ -17961,13 +18002,7 @@
17961
18002
  return -1;
17962
18003
  }
17963
18004
  };
17964
- if (!win) {
17965
- return null;
17966
- }
17967
18005
  var doc = win.document;
17968
- if (typeof doc === 'undefined' || doc === null) {
17969
- return null;
17970
- }
17971
18006
  if (editor.bookmark !== undefined && hasFocus$1(editor) === false) {
17972
18007
  var bookmark = getRng(editor);
17973
18008
  if (bookmark.isSome()) {
@@ -18117,7 +18152,7 @@
18117
18152
  };
18118
18153
  var getBoundingClientRect = function () {
18119
18154
  var rng = getRng$1();
18120
- return rng.collapsed ? CaretPosition$1.fromRangeStart(rng).getClientRects()[0] : rng.getBoundingClientRect();
18155
+ return rng.collapsed ? CaretPosition.fromRangeStart(rng).getClientRects()[0] : rng.getBoundingClientRect();
18121
18156
  };
18122
18157
  var destroy = function () {
18123
18158
  win = selectedRange = explicitRange = null;
@@ -18156,7 +18191,7 @@
18156
18191
  getBoundingClientRect: getBoundingClientRect,
18157
18192
  destroy: destroy
18158
18193
  };
18159
- var bookmarkManager = BookmarkManager$1(exports);
18194
+ var bookmarkManager = BookmarkManager(exports);
18160
18195
  var controlSelection = ControlSelection(exports, editor);
18161
18196
  exports.bookmarkManager = bookmarkManager;
18162
18197
  exports.controlSelection = controlSelection;
@@ -18223,18 +18258,18 @@
18223
18258
  reject('Cannot convert ' + url + ' to Blob. Resource might not exist or is inaccessible.');
18224
18259
  };
18225
18260
  try {
18226
- var xhr = new XMLHttpRequest();
18227
- xhr.open('GET', url, true);
18228
- xhr.responseType = 'blob';
18229
- xhr.onload = function () {
18230
- if (this.status === 200) {
18231
- resolve(this.response);
18261
+ var xhr_1 = new XMLHttpRequest();
18262
+ xhr_1.open('GET', url, true);
18263
+ xhr_1.responseType = 'blob';
18264
+ xhr_1.onload = function () {
18265
+ if (xhr_1.status === 200) {
18266
+ resolve(xhr_1.response);
18232
18267
  } else {
18233
18268
  rejectWithError();
18234
18269
  }
18235
18270
  };
18236
- xhr.onerror = rejectWithError;
18237
- xhr.send();
18271
+ xhr_1.onerror = rejectWithError;
18272
+ xhr_1.send();
18238
18273
  } catch (ex) {
18239
18274
  rejectWithError();
18240
18275
  }
@@ -18346,7 +18381,7 @@
18346
18381
  var getAllImages = function (elm) {
18347
18382
  return elm ? from$1(elm.getElementsByTagName('img')) : [];
18348
18383
  };
18349
- function ImageScanner(uploadStatus, blobCache) {
18384
+ var ImageScanner = function (uploadStatus, blobCache) {
18350
18385
  var cachedPromises = {};
18351
18386
  var findAll = function (elm, predicate) {
18352
18387
  if (!predicate) {
@@ -18403,7 +18438,7 @@
18403
18438
  return promiseObj.all(promises);
18404
18439
  };
18405
18440
  return { findAll: findAll };
18406
- }
18441
+ };
18407
18442
 
18408
18443
  var paddEmptyNode = function (settings, args, blockElements, node) {
18409
18444
  var brPreferred = settings.padd_empty_with_br || args.insert;
@@ -18909,7 +18944,7 @@
18909
18944
  }
18910
18945
  return output;
18911
18946
  };
18912
- var parser = SaxParser$1({
18947
+ var parser = SaxParser({
18913
18948
  validate: validate,
18914
18949
  allow_html_data_urls: settings.allow_html_data_urls,
18915
18950
  allow_svg_data_urls: settings.allow_svg_data_urls,
@@ -19333,7 +19368,7 @@
19333
19368
  };
19334
19369
  var DomSerializerImpl = function (settings, editor) {
19335
19370
  var tempAttrs = ['data-mce-selected'];
19336
- var dom = editor && editor.dom ? editor.dom : DOMUtils$1.DOM;
19371
+ var dom = editor && editor.dom ? editor.dom : DOMUtils.DOM;
19337
19372
  var schema = editor && editor.schema ? editor.schema : Schema(settings);
19338
19373
  settings.entity_encoding = settings.entity_encoding || 'named';
19339
19374
  settings.remove_trailing_brs = 'remove_trailing_brs' in settings ? settings.remove_trailing_brs : true;
@@ -19361,9 +19396,7 @@
19361
19396
  schema.setValidElements(rules);
19362
19397
  },
19363
19398
  addTempAttr: curry(addTempAttr, htmlParser, tempAttrs),
19364
- getTempAttrs: function () {
19365
- return tempAttrs;
19366
- },
19399
+ getTempAttrs: constant(tempAttrs),
19367
19400
  getNodeFilters: htmlParser.getNodeFilters,
19368
19401
  getAttributeFilters: htmlParser.getAttributeFilters
19369
19402
  };
@@ -19401,7 +19434,7 @@
19401
19434
  return setContent(editor, content, args);
19402
19435
  };
19403
19436
 
19404
- var DOM$3 = DOMUtils$1.DOM;
19437
+ var DOM$3 = DOMUtils.DOM;
19405
19438
  var restoreOriginalStyles = function (editor) {
19406
19439
  DOM$3.setStyle(editor.id, 'display', editor.orgDisplay);
19407
19440
  };
@@ -19482,9 +19515,9 @@
19482
19515
  };
19483
19516
  var baseMerge = function (merger) {
19484
19517
  return function () {
19485
- var objects = new Array(arguments.length);
19486
- for (var i = 0; i < objects.length; i++) {
19487
- objects[i] = arguments[i];
19518
+ var objects = [];
19519
+ for (var _i = 0; _i < arguments.length; _i++) {
19520
+ objects[_i] = arguments[_i];
19488
19521
  }
19489
19522
  if (objects.length === 0) {
19490
19523
  throw new Error('Can\'t merge zero objects');
@@ -19764,7 +19797,7 @@
19764
19797
  return fromDomSafe(rawContainer).map(inBody).getOr(false);
19765
19798
  };
19766
19799
 
19767
- function NotificationManagerImpl() {
19800
+ var NotificationManagerImpl = function () {
19768
19801
  var unimplemented = function () {
19769
19802
  throw new Error('Theme did not provide a NotificationManager implementation.');
19770
19803
  };
@@ -19774,9 +19807,9 @@
19774
19807
  reposition: unimplemented,
19775
19808
  getArgs: unimplemented
19776
19809
  };
19777
- }
19810
+ };
19778
19811
 
19779
- function NotificationManager(editor) {
19812
+ var NotificationManager = function (editor) {
19780
19813
  var notifications = [];
19781
19814
  var getImplementation = function () {
19782
19815
  var theme = editor.theme;
@@ -19868,11 +19901,11 @@
19868
19901
  close: close,
19869
19902
  getNotifications: getNotifications
19870
19903
  };
19871
- }
19904
+ };
19872
19905
 
19873
- var PluginManager = AddOnManager$1.PluginManager;
19906
+ var PluginManager = AddOnManager.PluginManager;
19874
19907
 
19875
- var ThemeManager = AddOnManager$1.ThemeManager;
19908
+ var ThemeManager = AddOnManager.ThemeManager;
19876
19909
 
19877
19910
  function WindowManagerImpl () {
19878
19911
  var unimplemented = function () {
@@ -19897,7 +19930,11 @@
19897
19930
  };
19898
19931
  var funcBind = function (scope, f) {
19899
19932
  return function () {
19900
- return f ? f.apply(scope, arguments) : undefined;
19933
+ var args = [];
19934
+ for (var _i = 0; _i < arguments.length; _i++) {
19935
+ args[_i] = arguments[_i];
19936
+ }
19937
+ return f ? f.apply(scope, args) : undefined;
19901
19938
  };
19902
19939
  };
19903
19940
  var fireOpenEvent = function (dialog) {
@@ -19940,10 +19977,12 @@
19940
19977
  });
19941
19978
  };
19942
19979
  var alert = function (message, callback, scope) {
19943
- getImplementation().alert(message, funcBind(scope ? scope : this, callback));
19980
+ var windowManagerImpl = getImplementation();
19981
+ windowManagerImpl.alert(message, funcBind(scope ? scope : windowManagerImpl, callback));
19944
19982
  };
19945
19983
  var confirm = function (message, callback, scope) {
19946
- getImplementation().confirm(message, funcBind(scope ? scope : this, callback));
19984
+ var windowManagerImpl = getImplementation();
19985
+ windowManagerImpl.confirm(message, funcBind(scope ? scope : windowManagerImpl, callback));
19947
19986
  };
19948
19987
  var close = function () {
19949
19988
  getTopDialog().each(function (dialog) {
@@ -20007,177 +20046,52 @@
20007
20046
  'Failed to initialize plugin: {0}',
20008
20047
  name
20009
20048
  ]);
20049
+ fireError(editor, 'PluginLoadError', { message: message });
20010
20050
  initError(message, err);
20011
- displayError(editor, message);
20012
- };
20013
- var initError = function (message) {
20014
- var x = [];
20015
- for (var _i = 1; _i < arguments.length; _i++) {
20016
- x[_i - 1] = arguments[_i];
20017
- }
20018
- var console = window.console;
20019
- if (console) {
20020
- if (console.error) {
20021
- console.error.apply(console, __spreadArrays([message], x));
20022
- } else {
20023
- console.log.apply(console, __spreadArrays([message], x));
20024
- }
20025
- }
20026
- };
20027
-
20028
- var isContentCssSkinName = function (url) {
20029
- return /^[a-z0-9\-]+$/i.test(url);
20030
- };
20031
- var getContentCssUrls = function (editor) {
20032
- var contentCss = getContentCss(editor);
20033
- var skinUrl = editor.editorManager.baseURL + '/skins/content';
20034
- var suffix = editor.editorManager.suffix;
20035
- var contentCssFile = 'content' + suffix + '.css';
20036
- var inline = editor.inline === true;
20037
- return map(contentCss, function (url) {
20038
- if (isContentCssSkinName(url) && !inline) {
20039
- return skinUrl + '/' + url + '/' + contentCssFile;
20040
- } else {
20041
- return editor.documentBaseURI.toAbsolute(url);
20042
- }
20043
- });
20044
- };
20045
- var appendContentCssFromSettings = function (editor) {
20046
- editor.contentCSS = editor.contentCSS.concat(getContentCssUrls(editor));
20047
- };
20048
-
20049
- function Uploader(uploadStatus, settings) {
20050
- var pendingPromises = {};
20051
- var pathJoin = function (path1, path2) {
20052
- if (path1) {
20053
- return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, '');
20054
- }
20055
- return path2;
20056
- };
20057
- var defaultHandler = function (blobInfo, success, failure, progress) {
20058
- var xhr = new XMLHttpRequest();
20059
- xhr.open('POST', settings.url);
20060
- xhr.withCredentials = settings.credentials;
20061
- xhr.upload.onprogress = function (e) {
20062
- progress(e.loaded / e.total * 100);
20063
- };
20064
- xhr.onerror = function () {
20065
- failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);
20066
- };
20067
- xhr.onload = function () {
20068
- if (xhr.status < 200 || xhr.status >= 300) {
20069
- failure('HTTP Error: ' + xhr.status);
20070
- return;
20071
- }
20072
- var json = JSON.parse(xhr.responseText);
20073
- if (!json || typeof json.location !== 'string') {
20074
- failure('Invalid JSON: ' + xhr.responseText);
20075
- return;
20076
- }
20077
- success(pathJoin(settings.basePath, json.location));
20078
- };
20079
- var formData = new FormData();
20080
- formData.append('file', blobInfo.blob(), blobInfo.filename());
20081
- xhr.send(formData);
20082
- };
20083
- var noUpload = function () {
20084
- return new promiseObj(function (resolve) {
20085
- resolve([]);
20086
- });
20087
- };
20088
- var handlerSuccess = function (blobInfo, url) {
20089
- return {
20090
- url: url,
20091
- blobInfo: blobInfo,
20092
- status: true
20093
- };
20094
- };
20095
- var handlerFailure = function (blobInfo, message, options) {
20096
- return {
20097
- url: '',
20098
- blobInfo: blobInfo,
20099
- status: false,
20100
- error: {
20101
- message: message,
20102
- options: options
20103
- }
20104
- };
20105
- };
20106
- var resolvePending = function (blobUri, result) {
20107
- Tools.each(pendingPromises[blobUri], function (resolve) {
20108
- resolve(result);
20109
- });
20110
- delete pendingPromises[blobUri];
20111
- };
20112
- var uploadBlobInfo = function (blobInfo, handler, openNotification) {
20113
- uploadStatus.markPending(blobInfo.blobUri());
20114
- return new promiseObj(function (resolve) {
20115
- var notification, progress;
20116
- var noop = function () {
20117
- };
20118
- try {
20119
- var closeNotification_1 = function () {
20120
- if (notification) {
20121
- notification.close();
20122
- progress = noop;
20123
- }
20124
- };
20125
- var success = function (url) {
20126
- closeNotification_1();
20127
- uploadStatus.markUploaded(blobInfo.blobUri(), url);
20128
- resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url));
20129
- resolve(handlerSuccess(blobInfo, url));
20130
- };
20131
- var failure = function (error, options) {
20132
- var failureOptions = options ? options : {};
20133
- closeNotification_1();
20134
- uploadStatus.removeFailed(blobInfo.blobUri());
20135
- resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error, failureOptions));
20136
- resolve(handlerFailure(blobInfo, error, failureOptions));
20137
- };
20138
- progress = function (percent) {
20139
- if (percent < 0 || percent > 100) {
20140
- return;
20141
- }
20142
- if (!notification) {
20143
- notification = openNotification();
20144
- }
20145
- notification.progressBar.value(percent);
20146
- };
20147
- handler(blobInfo, success, failure, progress);
20148
- } catch (ex) {
20149
- resolve(handlerFailure(blobInfo, ex.message, {}));
20150
- }
20151
- });
20152
- };
20153
- var isDefaultHandler = function (handler) {
20154
- return handler === defaultHandler;
20155
- };
20156
- var pendingUploadBlobInfo = function (blobInfo) {
20157
- var blobUri = blobInfo.blobUri();
20158
- return new promiseObj(function (resolve) {
20159
- pendingPromises[blobUri] = pendingPromises[blobUri] || [];
20160
- pendingPromises[blobUri].push(resolve);
20161
- });
20162
- };
20163
- var uploadBlobs = function (blobInfos, openNotification) {
20164
- blobInfos = Tools.grep(blobInfos, function (blobInfo) {
20165
- return !uploadStatus.isUploaded(blobInfo.blobUri());
20166
- });
20167
- return promiseObj.all(Tools.map(blobInfos, function (blobInfo) {
20168
- return uploadStatus.isPending(blobInfo.blobUri()) ? pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification);
20169
- }));
20170
- };
20171
- var upload = function (blobInfos, openNotification) {
20172
- return !settings.url && isDefaultHandler(settings.handler) ? noUpload() : uploadBlobs(blobInfos, openNotification);
20173
- };
20174
- if (isFunction(settings.handler) === false) {
20175
- settings.handler = defaultHandler;
20051
+ displayError(editor, message);
20052
+ };
20053
+ var initError = function (message) {
20054
+ var x = [];
20055
+ for (var _i = 1; _i < arguments.length; _i++) {
20056
+ x[_i - 1] = arguments[_i];
20176
20057
  }
20177
- return { upload: upload };
20178
- }
20058
+ var console = window.console;
20059
+ if (console) {
20060
+ if (console.error) {
20061
+ console.error.apply(console, __spreadArrays([message], x));
20062
+ } else {
20063
+ console.log.apply(console, __spreadArrays([message], x));
20064
+ }
20065
+ }
20066
+ };
20067
+
20068
+ var isContentCssSkinName = function (url) {
20069
+ return /^[a-z0-9\-]+$/i.test(url);
20070
+ };
20071
+ var getContentCssUrls = function (editor) {
20072
+ return transformToUrls(editor, getContentCss(editor));
20073
+ };
20074
+ var getFontCssUrls = function (editor) {
20075
+ return transformToUrls(editor, getFontCss(editor));
20076
+ };
20077
+ var transformToUrls = function (editor, cssLinks) {
20078
+ var skinUrl = editor.editorManager.baseURL + '/skins/content';
20079
+ var suffix = editor.editorManager.suffix;
20080
+ var contentCssFile = 'content' + suffix + '.css';
20081
+ var inline = editor.inline === true;
20082
+ return map(cssLinks, function (url) {
20083
+ if (isContentCssSkinName(url) && !inline) {
20084
+ return skinUrl + '/' + url + '/' + contentCssFile;
20085
+ } else {
20086
+ return editor.documentBaseURI.toAbsolute(url);
20087
+ }
20088
+ });
20089
+ };
20090
+ var appendContentCssFromSettings = function (editor) {
20091
+ editor.contentCSS = editor.contentCSS.concat(getContentCssUrls(editor), getFontCssUrls(editor));
20092
+ };
20179
20093
 
20180
- function UploadStatus () {
20094
+ var UploadStatus = function () {
20181
20095
  var PENDING = 1, UPLOADED = 2;
20182
20096
  var blobUriStatuses = {};
20183
20097
  var createStatus = function (status, resultUri) {
@@ -20221,7 +20135,7 @@
20221
20135
  removeFailed: removeFailed,
20222
20136
  destroy: destroy
20223
20137
  };
20224
- }
20138
+ };
20225
20139
 
20226
20140
  var count$1 = 0;
20227
20141
  var seed = function () {
@@ -20335,6 +20249,168 @@
20335
20249
  };
20336
20250
  };
20337
20251
 
20252
+ var Uploader = function (uploadStatus, settings) {
20253
+ var pendingPromises = {};
20254
+ var pathJoin = function (path1, path2) {
20255
+ if (path1) {
20256
+ return path1.replace(/\/$/, '') + '/' + path2.replace(/^\//, '');
20257
+ }
20258
+ return path2;
20259
+ };
20260
+ var defaultHandler = function (blobInfo, success, failure, progress) {
20261
+ var xhr = new XMLHttpRequest();
20262
+ xhr.open('POST', settings.url);
20263
+ xhr.withCredentials = settings.credentials;
20264
+ xhr.upload.onprogress = function (e) {
20265
+ progress(e.loaded / e.total * 100);
20266
+ };
20267
+ xhr.onerror = function () {
20268
+ failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);
20269
+ };
20270
+ xhr.onload = function () {
20271
+ if (xhr.status < 200 || xhr.status >= 300) {
20272
+ failure('HTTP Error: ' + xhr.status);
20273
+ return;
20274
+ }
20275
+ var json = JSON.parse(xhr.responseText);
20276
+ if (!json || typeof json.location !== 'string') {
20277
+ failure('Invalid JSON: ' + xhr.responseText);
20278
+ return;
20279
+ }
20280
+ success(pathJoin(settings.basePath, json.location));
20281
+ };
20282
+ var formData = new FormData();
20283
+ formData.append('file', blobInfo.blob(), blobInfo.filename());
20284
+ xhr.send(formData);
20285
+ };
20286
+ var noUpload = function () {
20287
+ return new promiseObj(function (resolve) {
20288
+ resolve([]);
20289
+ });
20290
+ };
20291
+ var handlerSuccess = function (blobInfo, url) {
20292
+ return {
20293
+ url: url,
20294
+ blobInfo: blobInfo,
20295
+ status: true
20296
+ };
20297
+ };
20298
+ var handlerFailure = function (blobInfo, message, options) {
20299
+ return {
20300
+ url: '',
20301
+ blobInfo: blobInfo,
20302
+ status: false,
20303
+ error: {
20304
+ message: message,
20305
+ options: options
20306
+ }
20307
+ };
20308
+ };
20309
+ var resolvePending = function (blobUri, result) {
20310
+ Tools.each(pendingPromises[blobUri], function (resolve) {
20311
+ resolve(result);
20312
+ });
20313
+ delete pendingPromises[blobUri];
20314
+ };
20315
+ var uploadBlobInfo = function (blobInfo, handler, openNotification) {
20316
+ uploadStatus.markPending(blobInfo.blobUri());
20317
+ return new promiseObj(function (resolve) {
20318
+ var notification, progress;
20319
+ try {
20320
+ var closeNotification_1 = function () {
20321
+ if (notification) {
20322
+ notification.close();
20323
+ progress = noop;
20324
+ }
20325
+ };
20326
+ var success = function (url) {
20327
+ closeNotification_1();
20328
+ uploadStatus.markUploaded(blobInfo.blobUri(), url);
20329
+ resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url));
20330
+ resolve(handlerSuccess(blobInfo, url));
20331
+ };
20332
+ var failure = function (error, options) {
20333
+ var failureOptions = options ? options : {};
20334
+ closeNotification_1();
20335
+ uploadStatus.removeFailed(blobInfo.blobUri());
20336
+ resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error, failureOptions));
20337
+ resolve(handlerFailure(blobInfo, error, failureOptions));
20338
+ };
20339
+ progress = function (percent) {
20340
+ if (percent < 0 || percent > 100) {
20341
+ return;
20342
+ }
20343
+ Optional.from(notification).orThunk(function () {
20344
+ return Optional.from(openNotification).map(apply);
20345
+ }).each(function (n) {
20346
+ notification = n;
20347
+ n.progressBar.value(percent);
20348
+ });
20349
+ };
20350
+ handler(blobInfo, success, failure, progress);
20351
+ } catch (ex) {
20352
+ resolve(handlerFailure(blobInfo, ex.message, {}));
20353
+ }
20354
+ });
20355
+ };
20356
+ var isDefaultHandler = function (handler) {
20357
+ return handler === defaultHandler;
20358
+ };
20359
+ var pendingUploadBlobInfo = function (blobInfo) {
20360
+ var blobUri = blobInfo.blobUri();
20361
+ return new promiseObj(function (resolve) {
20362
+ pendingPromises[blobUri] = pendingPromises[blobUri] || [];
20363
+ pendingPromises[blobUri].push(resolve);
20364
+ });
20365
+ };
20366
+ var uploadBlobs = function (blobInfos, openNotification) {
20367
+ blobInfos = Tools.grep(blobInfos, function (blobInfo) {
20368
+ return !uploadStatus.isUploaded(blobInfo.blobUri());
20369
+ });
20370
+ return promiseObj.all(Tools.map(blobInfos, function (blobInfo) {
20371
+ return uploadStatus.isPending(blobInfo.blobUri()) ? pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification);
20372
+ }));
20373
+ };
20374
+ var upload = function (blobInfos, openNotification) {
20375
+ return !settings.url && isDefaultHandler(settings.handler) ? noUpload() : uploadBlobs(blobInfos, openNotification);
20376
+ };
20377
+ if (isFunction(settings.handler) === false) {
20378
+ settings.handler = defaultHandler;
20379
+ }
20380
+ return { upload: upload };
20381
+ };
20382
+
20383
+ var openNotification = function (editor) {
20384
+ return function () {
20385
+ return editor.notificationManager.open({
20386
+ text: editor.translate('Image uploading...'),
20387
+ type: 'info',
20388
+ timeout: -1,
20389
+ progressBar: true
20390
+ });
20391
+ };
20392
+ };
20393
+ var createUploader = function (editor, uploadStatus) {
20394
+ return Uploader(uploadStatus, {
20395
+ url: getImageUploadUrl(editor),
20396
+ basePath: getImageUploadBasePath(editor),
20397
+ credentials: getImagesUploadCredentials(editor),
20398
+ handler: getImagesUploadHandler(editor)
20399
+ });
20400
+ };
20401
+ var ImageUploader = function (editor) {
20402
+ var uploadStatus = UploadStatus();
20403
+ var uploader = createUploader(editor, uploadStatus);
20404
+ return {
20405
+ upload: function (blobInfos, showNotification) {
20406
+ if (showNotification === void 0) {
20407
+ showNotification = true;
20408
+ }
20409
+ return uploader.upload(blobInfos, showNotification ? openNotification(editor) : undefined);
20410
+ }
20411
+ };
20412
+ };
20413
+
20338
20414
  var UploadChangeHandler = function (editor) {
20339
20415
  var lastChangedLevel = Cell(null);
20340
20416
  editor.on('change AddUndo', function (e) {
@@ -20399,14 +20475,6 @@
20399
20475
  }
20400
20476
  });
20401
20477
  };
20402
- var openNotification = function () {
20403
- return editor.notificationManager.open({
20404
- text: editor.translate('Image uploading...'),
20405
- type: 'info',
20406
- timeout: -1,
20407
- progressBar: true
20408
- });
20409
- };
20410
20478
  var replaceImageUriInView = function (image, resultUri) {
20411
20479
  var src = editor.convertURL(resultUri, 'src');
20412
20480
  replaceUrlInUndoStack(image.src, resultUri);
@@ -20417,18 +20485,13 @@
20417
20485
  };
20418
20486
  var uploadImages = function (callback) {
20419
20487
  if (!uploader) {
20420
- uploader = Uploader(uploadStatus, {
20421
- url: getImageUploadUrl(editor),
20422
- basePath: getImageUploadBasePath(editor),
20423
- credentials: getImagesUploadCredentials(editor),
20424
- handler: getImagesUploadHandler(editor)
20425
- });
20488
+ uploader = createUploader(editor, uploadStatus);
20426
20489
  }
20427
20490
  return scanForImages().then(aliveGuard(function (imageInfos) {
20428
20491
  var blobInfos = map(imageInfos, function (imageInfo) {
20429
20492
  return imageInfo.blobInfo;
20430
20493
  });
20431
- return uploader.upload(blobInfos, openNotification).then(aliveGuard(function (result) {
20494
+ return uploader.upload(blobInfos, openNotification(editor)).then(aliveGuard(function (result) {
20432
20495
  var imagesToRemove = [];
20433
20496
  var filteredResult = map(result, function (uploadInfo, index) {
20434
20497
  var blobInfo = imageInfos[index].blobInfo;
@@ -20857,7 +20920,7 @@
20857
20920
  return formats;
20858
20921
  };
20859
20922
 
20860
- function FormatRegistry(editor) {
20923
+ var FormatRegistry = function (editor) {
20861
20924
  var formats = {};
20862
20925
  var get = function (name) {
20863
20926
  return name ? formats[name] : formats;
@@ -20911,10 +20974,10 @@
20911
20974
  register: register,
20912
20975
  unregister: unregister
20913
20976
  };
20914
- }
20977
+ };
20915
20978
 
20916
20979
  var each$e = Tools.each;
20917
- var dom = DOMUtils$1.DOM;
20980
+ var dom = DOMUtils.DOM;
20918
20981
  var parsedSelectorToHtml = function (ancestry, editor) {
20919
20982
  var elm, item, fragment;
20920
20983
  var schema = editor && editor.schema || Schema({});
@@ -21449,10 +21512,10 @@
21449
21512
  return is$1(SugarElement.fromDom(elm), getInlineBoundarySelector(editor));
21450
21513
  };
21451
21514
  var isRtl$1 = function (element) {
21452
- return DOMUtils$1.DOM.getStyle(element, 'direction', true) === 'rtl' || hasStrongRtl(element.textContent);
21515
+ return DOMUtils.DOM.getStyle(element, 'direction', true) === 'rtl' || hasStrongRtl(element.textContent);
21453
21516
  };
21454
21517
  var findInlineParents = function (isInlineTarget, rootNode, pos) {
21455
- return filter(DOMUtils$1.DOM.getParents(pos.container(), '*', rootNode), isInlineTarget);
21518
+ return filter(DOMUtils.DOM.getParents(pos.container(), '*', rootNode), isInlineTarget);
21456
21519
  };
21457
21520
  var findRootInline = function (isInlineTarget, rootNode, pos) {
21458
21521
  var parents = findInlineParents(isInlineTarget, rootNode, pos);
@@ -21474,22 +21537,22 @@
21474
21537
  if (forward) {
21475
21538
  if (isCaretContainerInline(container)) {
21476
21539
  if (isText$1(container.nextSibling)) {
21477
- return CaretPosition$1(container.nextSibling, 0);
21540
+ return CaretPosition(container.nextSibling, 0);
21478
21541
  } else {
21479
- return CaretPosition$1.after(container);
21542
+ return CaretPosition.after(container);
21480
21543
  }
21481
21544
  } else {
21482
- return isBeforeInline(pos) ? CaretPosition$1(container, offset + 1) : pos;
21545
+ return isBeforeInline(pos) ? CaretPosition(container, offset + 1) : pos;
21483
21546
  }
21484
21547
  } else {
21485
21548
  if (isCaretContainerInline(container)) {
21486
21549
  if (isText$1(container.previousSibling)) {
21487
- return CaretPosition$1(container.previousSibling, container.previousSibling.data.length);
21550
+ return CaretPosition(container.previousSibling, container.previousSibling.data.length);
21488
21551
  } else {
21489
- return CaretPosition$1.before(container);
21552
+ return CaretPosition.before(container);
21490
21553
  }
21491
21554
  } else {
21492
- return isAfterInline(pos) ? CaretPosition$1(container, offset - 1) : pos;
21555
+ return isAfterInline(pos) ? CaretPosition(container, offset - 1) : pos;
21493
21556
  }
21494
21557
  }
21495
21558
  };
@@ -21582,7 +21645,7 @@
21582
21645
  }
21583
21646
  };
21584
21647
  var readFromRange = function (rootNode, forward, rng) {
21585
- var fromBlockPos = getBlockPosition(rootNode, CaretPosition$1.fromRangeStart(rng));
21648
+ var fromBlockPos = getBlockPosition(rootNode, CaretPosition.fromRangeStart(rng));
21586
21649
  var toBlockPos = fromBlockPos.bind(function (blockPos) {
21587
21650
  return fromPosition(forward, rootNode, blockPos.position).bind(function (to) {
21588
21651
  return getBlockPosition(rootNode, to).map(function (blockPos) {
@@ -21630,7 +21693,7 @@
21630
21693
  if (isEmptyBefore(insertionPoint) && isEmpty(fromBlock)) {
21631
21694
  before(insertionPoint, SugarElement.fromTag('br'));
21632
21695
  }
21633
- var position = prevPosition(toBlock.dom, CaretPosition$1.before(insertionPoint.dom));
21696
+ var position = prevPosition(toBlock.dom, CaretPosition.before(insertionPoint.dom));
21634
21697
  each(extractChildren(fromBlock), function (child) {
21635
21698
  before(insertionPoint, child);
21636
21699
  });
@@ -21707,8 +21770,8 @@
21707
21770
  return isRawNodeInTable(root, rng.startContainer) || isRawNodeInTable(root, rng.endContainer);
21708
21771
  };
21709
21772
  var isEverythingSelected = function (root, rng) {
21710
- var noPrevious = prevPosition(root.dom, CaretPosition$1.fromRangeStart(rng)).isNone();
21711
- var noNext = nextPosition(root.dom, CaretPosition$1.fromRangeEnd(rng)).isNone();
21773
+ var noPrevious = prevPosition(root.dom, CaretPosition.fromRangeStart(rng)).isNone();
21774
+ var noNext = nextPosition(root.dom, CaretPosition.fromRangeEnd(rng)).isNone();
21712
21775
  return !isSelectionInTable(root, rng) && noPrevious && noNext;
21713
21776
  };
21714
21777
  var emptyEditor = function (editor) {
@@ -21744,7 +21807,7 @@
21744
21807
  };
21745
21808
  var renderCaretAtRange = function (editor, range, scrollIntoView) {
21746
21809
  var normalizedRange = normalizeRange(1, editor.getBody(), range);
21747
- var caretPosition = CaretPosition$1.fromRangeStart(normalizedRange);
21810
+ var caretPosition = CaretPosition.fromRangeStart(normalizedRange);
21748
21811
  var caretPositionNode = caretPosition.getNode();
21749
21812
  if (isInlineFakeCaretTarget(caretPositionNode)) {
21750
21813
  return showCaret(1, editor, caretPositionNode, !caretPosition.isAtEnd(), false);
@@ -21905,7 +21968,7 @@
21905
21968
  };
21906
21969
  var read$4 = function (root, forward, rng) {
21907
21970
  var normalizedRange = normalizeRange(forward ? 1 : -1, root, rng);
21908
- var from = CaretPosition$1.fromRangeStart(normalizedRange);
21971
+ var from = CaretPosition.fromRangeStart(normalizedRange);
21909
21972
  var rootElement = SugarElement.fromDom(root);
21910
21973
  if (forward === false && isAfterContentEditableFalse(from)) {
21911
21974
  return Optional.some(DeleteAction.remove(from.getNode(true)));
@@ -21933,7 +21996,7 @@
21933
21996
  };
21934
21997
  var moveToElement = function (editor, forward) {
21935
21998
  return function (element) {
21936
- var pos = forward ? CaretPosition$1.before(element) : CaretPosition$1.after(element);
21999
+ var pos = forward ? CaretPosition.before(element) : CaretPosition.after(element);
21937
22000
  editor.selection.setRng(pos.toRange());
21938
22001
  return true;
21939
22002
  };
@@ -21967,9 +22030,7 @@
21967
22030
  deleteElement(editor, forward, SugarElement.fromDom(editor.selection.getNode()));
21968
22031
  paddEmptyBody(editor);
21969
22032
  return true;
21970
- }, function () {
21971
- return true;
21972
- });
22033
+ }, always);
21973
22034
  }
21974
22035
  return false;
21975
22036
  };
@@ -21980,7 +22041,7 @@
21980
22041
  var br = dom.create('br', { 'data-mce-bogus': '1' });
21981
22042
  dom.setHTML(ceRoot, '');
21982
22043
  ceRoot.appendChild(br);
21983
- selection.setRng(CaretPosition$1.before(br).toRange());
22044
+ selection.setRng(CaretPosition.before(br).toRange());
21984
22045
  }
21985
22046
  return true;
21986
22047
  };
@@ -21993,7 +22054,7 @@
21993
22054
  };
21994
22055
 
21995
22056
  var deleteCaret$1 = function (editor, forward) {
21996
- var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng());
22057
+ var fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());
21997
22058
  return fromPosition(forward, editor.getBody(), fromPos).filter(function (pos) {
21998
22059
  return forward ? isBeforeImageBlock(pos) : isAfterImageBlock(pos);
21999
22060
  }).bind(function (pos) {
@@ -22085,16 +22146,16 @@
22085
22146
  remove$5(caret.get());
22086
22147
  var text = insertInlineBefore(element);
22087
22148
  caret.set(text);
22088
- return Optional.some(CaretPosition$1(text, text.length - 1));
22149
+ return Optional.some(CaretPosition(text, text.length - 1));
22089
22150
  }, function (element) {
22090
22151
  return firstPositionIn(element).map(function (pos) {
22091
22152
  if (!isPosCaretContainer(pos, caret)) {
22092
22153
  remove$5(caret.get());
22093
22154
  var text = insertInlinePos(pos, true);
22094
22155
  caret.set(text);
22095
- return CaretPosition$1(text, 1);
22156
+ return CaretPosition(text, 1);
22096
22157
  } else {
22097
- return CaretPosition$1(caret.get(), 1);
22158
+ return CaretPosition(caret.get(), 1);
22098
22159
  }
22099
22160
  });
22100
22161
  }, function (element) {
@@ -22103,16 +22164,16 @@
22103
22164
  remove$5(caret.get());
22104
22165
  var text = insertInlinePos(pos, false);
22105
22166
  caret.set(text);
22106
- return CaretPosition$1(text, text.length - 1);
22167
+ return CaretPosition(text, text.length - 1);
22107
22168
  } else {
22108
- return CaretPosition$1(caret.get(), caret.get().length - 1);
22169
+ return CaretPosition(caret.get(), caret.get().length - 1);
22109
22170
  }
22110
22171
  });
22111
22172
  }, function (element) {
22112
22173
  remove$5(caret.get());
22113
22174
  var text = insertInlineAfter(element);
22114
22175
  caret.set(text);
22115
- return Optional.some(CaretPosition$1(text, 1));
22176
+ return Optional.some(CaretPosition(text, 1));
22116
22177
  });
22117
22178
  };
22118
22179
 
@@ -22251,13 +22312,13 @@
22251
22312
  };
22252
22313
  var moveRel = function (forward, selection, pos) {
22253
22314
  var delta = forward ? 1 : -1;
22254
- selection.setRng(CaretPosition$1(pos.container(), pos.offset() + delta).toRange());
22315
+ selection.setRng(CaretPosition(pos.container(), pos.offset() + delta).toRange());
22255
22316
  selection.getSel().modify('move', forward ? 'forward' : 'backward', 'word');
22256
22317
  return true;
22257
22318
  };
22258
22319
  var moveByWord = function (forward, editor) {
22259
22320
  var rng = editor.selection.getRng();
22260
- var pos = forward ? CaretPosition$1.fromRangeEnd(rng) : CaretPosition$1.fromRangeStart(rng);
22321
+ var pos = forward ? CaretPosition.fromRangeEnd(rng) : CaretPosition.fromRangeStart(rng);
22261
22322
  if (!hasSelectionModifyApi(editor)) {
22262
22323
  return false;
22263
22324
  } else if (forward && isBeforeInline(pos)) {
@@ -22290,7 +22351,7 @@
22290
22351
  };
22291
22352
  var findLocation$1 = function (editor, caret, forward) {
22292
22353
  var rootNode = editor.getBody();
22293
- var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());
22354
+ var from = CaretPosition.fromRangeStart(editor.selection.getRng());
22294
22355
  var isInlineTarget$1 = curry(isInlineTarget, editor);
22295
22356
  var location = findLocation(forward, isInlineTarget$1, rootNode, from);
22296
22357
  return location.bind(function (location) {
@@ -22308,8 +22369,8 @@
22308
22369
  };
22309
22370
  var safeRemoveCaretContainer = function (editor, caret) {
22310
22371
  if (editor.selection.isCollapsed() && editor.composing !== true && caret.get()) {
22311
- var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng());
22312
- if (CaretPosition$1.isTextPosition(pos) && isAtZwsp(pos) === false) {
22372
+ var pos = CaretPosition.fromRangeStart(editor.selection.getRng());
22373
+ if (CaretPosition.isTextPosition(pos) && isAtZwsp(pos) === false) {
22313
22374
  setCaretPosition(editor, removeAndReposition(caret.get(), pos));
22314
22375
  caret.set(null);
22315
22376
  }
@@ -22319,7 +22380,7 @@
22319
22380
  if (editor.selection.isCollapsed()) {
22320
22381
  var inlines = filter(elms, isInlineTarget);
22321
22382
  each(inlines, function (_inline) {
22322
- var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng());
22383
+ var pos = CaretPosition.fromRangeStart(editor.selection.getRng());
22323
22384
  readLocation(isInlineTarget, editor.getBody(), pos).bind(function (location) {
22324
22385
  return renderCaretLocation(editor, caret, location);
22325
22386
  });
@@ -22376,7 +22437,7 @@
22376
22437
  editor.undoManager.ignore(function () {
22377
22438
  editor.selection.setRng(rangeFromPositions(from, to));
22378
22439
  editor.execCommand('Delete');
22379
- readLocation(isInlineTarget$1, rootNode, CaretPosition$1.fromRangeStart(editor.selection.getRng())).map(inside).map(setCaretLocation(editor, caret));
22440
+ readLocation(isInlineTarget$1, rootNode, CaretPosition.fromRangeStart(editor.selection.getRng())).map(inside).map(setCaretLocation(editor, caret));
22380
22441
  });
22381
22442
  editor.nodeChanged();
22382
22443
  };
@@ -22424,7 +22485,7 @@
22424
22485
  };
22425
22486
  var backspaceDelete$6 = function (editor, caret, forward) {
22426
22487
  if (editor.selection.isCollapsed() && isInlineBoundariesEnabled(editor)) {
22427
- var from = CaretPosition$1.fromRangeStart(editor.selection.getRng());
22488
+ var from = CaretPosition.fromRangeStart(editor.selection.getRng());
22428
22489
  return backspaceDeleteCollapsed(editor, caret, forward, from);
22429
22490
  }
22430
22491
  return false;
@@ -22456,7 +22517,7 @@
22456
22517
  var startElm = SugarElement.fromDom(editor.selection.getStart());
22457
22518
  var parentInlines = filter(getParentInlines(rootElm, startElm), hasOnlyOneChild$1);
22458
22519
  return last(parentInlines).exists(function (target) {
22459
- var fromPos = CaretPosition$1.fromRangeStart(editor.selection.getRng());
22520
+ var fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());
22460
22521
  if (willDeleteLastPositionInElement(forward, fromPos, target.dom) && !isEmptyCaretFormatElement(target)) {
22461
22522
  deleteLastPosition(forward, editor, target, parentInlines);
22462
22523
  return true;
@@ -22566,7 +22627,7 @@
22566
22627
  if (editor.selection.isCollapsed() && canOutdent(editor)) {
22567
22628
  var dom = editor.dom;
22568
22629
  var rng = editor.selection.getRng();
22569
- var pos = CaretPosition$1.fromRangeStart(rng);
22630
+ var pos = CaretPosition.fromRangeStart(rng);
22570
22631
  var block = dom.getParent(rng.startContainer, dom.isBlock);
22571
22632
  if (block !== null && isAtStartOfBlock(SugarElement.fromDom(block), pos)) {
22572
22633
  handle(editor, 'outdent');
@@ -23018,12 +23079,12 @@
23018
23079
  walkFn = caretWalker.next;
23019
23080
  isBelowFn = isBelow;
23020
23081
  isAboveFn = isAbove;
23021
- caretPosition = CaretPosition$1.after(node);
23082
+ caretPosition = CaretPosition.after(node);
23022
23083
  } else {
23023
23084
  walkFn = caretWalker.prev;
23024
23085
  isBelowFn = isAbove;
23025
23086
  isAboveFn = isBelow;
23026
- caretPosition = CaretPosition$1.before(node);
23087
+ caretPosition = CaretPosition.before(node);
23027
23088
  }
23028
23089
  var targetClientRect = getClientRect(caretPosition);
23029
23090
  do {
@@ -23227,11 +23288,11 @@
23227
23288
  var rng = editor.selection.getRng();
23228
23289
  var body = editor.getBody();
23229
23290
  if (forward) {
23230
- var from = CaretPosition$1.fromRangeEnd(rng);
23291
+ var from = CaretPosition.fromRangeEnd(rng);
23231
23292
  var result = getPositionsUntilNextLine(body, from);
23232
23293
  return last(result.positions);
23233
23294
  } else {
23234
- var from = CaretPosition$1.fromRangeStart(rng);
23295
+ var from = CaretPosition.fromRangeStart(rng);
23235
23296
  var result = getPositionsUntilPreviousLine(body, from);
23236
23297
  return head(result.positions);
23237
23298
  }
@@ -23271,7 +23332,7 @@
23271
23332
  if (!pre) {
23272
23333
  return;
23273
23334
  }
23274
- var caretPos = getVisualCaretPosition$1(CaretPosition$1.fromRangeStart(range));
23335
+ var caretPos = getVisualCaretPosition$1(CaretPosition.fromRangeStart(range));
23275
23336
  if (!caretPos) {
23276
23337
  var newBlock = createTextBlock(editor);
23277
23338
  if (direction === 1) {
@@ -23362,7 +23423,7 @@
23362
23423
  };
23363
23424
  var moveCaretToNewEmptyLine = function (editor, forward) {
23364
23425
  var root = SugarElement.fromDom(editor.getBody());
23365
- var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng());
23426
+ var pos = CaretPosition.fromRangeStart(editor.selection.getRng());
23366
23427
  var rootBlock = getForcedRootBlock(editor);
23367
23428
  var rootBlockAttrs = getForcedRootBlockAttrs(editor);
23368
23429
  return getClosestTargetBlock(pos, root).exists(function () {
@@ -23539,7 +23600,7 @@
23539
23600
  var isAtFirstTableCellLine = curry(isAtTableCellLine, getPositionsUntilPreviousLine);
23540
23601
  var isAtLastTableCellLine = curry(isAtTableCellLine, getPositionsUntilNextLine);
23541
23602
  var isCaretAtStartOrEndOfTable = function (forward, rng, table) {
23542
- var caretPos = CaretPosition$1.fromRangeStart(rng);
23603
+ var caretPos = CaretPosition.fromRangeStart(rng);
23543
23604
  return positionIn(!forward, table).exists(function (pos) {
23544
23605
  return pos.isEqual(caretPos);
23545
23606
  });
@@ -23558,16 +23619,16 @@
23558
23619
  var getClosestAbovePosition = function (root, table, start) {
23559
23620
  return findClosestPositionInAboveCell(table, start).orThunk(function () {
23560
23621
  return head(start.getClientRects()).bind(function (rect) {
23561
- return findClosestHorizontalPositionFromPoint(getPositionsAbove(root, CaretPosition$1.before(table)), rect.left);
23622
+ return findClosestHorizontalPositionFromPoint(getPositionsAbove(root, CaretPosition.before(table)), rect.left);
23562
23623
  });
23563
- }).getOr(CaretPosition$1.before(table));
23624
+ }).getOr(CaretPosition.before(table));
23564
23625
  };
23565
23626
  var getClosestBelowPosition = function (root, table, start) {
23566
23627
  return findClosestPositionInBelowCell(table, start).orThunk(function () {
23567
23628
  return head(start.getClientRects()).bind(function (rect) {
23568
- return findClosestHorizontalPositionFromPoint(getPositionsBelow(root, CaretPosition$1.after(table)), rect.left);
23629
+ return findClosestHorizontalPositionFromPoint(getPositionsBelow(root, CaretPosition.after(table)), rect.left);
23569
23630
  });
23570
- }).getOr(CaretPosition$1.after(table));
23631
+ }).getOr(CaretPosition.after(table));
23571
23632
  };
23572
23633
  var getTable = function (previous, pos) {
23573
23634
  var node = pos.getNode(previous);
@@ -23611,7 +23672,7 @@
23611
23672
  };
23612
23673
  var navigateVertically = function (editor, down, table, td) {
23613
23674
  var rng = editor.selection.getRng();
23614
- var pos = CaretPosition$1.fromRangeStart(rng);
23675
+ var pos = CaretPosition.fromRangeStart(rng);
23615
23676
  var root = editor.getBody();
23616
23677
  if (!down && isAtFirstTableCellLine(td, pos)) {
23617
23678
  var newPos = getClosestAbovePosition(root, table, pos);
@@ -23926,6 +23987,10 @@
23926
23987
  var hasFirstChild = function (elm, name) {
23927
23988
  return elm.firstChild && elm.firstChild.nodeName === name;
23928
23989
  };
23990
+ var isFirstChild = function (elm) {
23991
+ var _a;
23992
+ return ((_a = elm.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild) === elm;
23993
+ };
23929
23994
  var hasParent$1 = function (elm, parentName) {
23930
23995
  return elm && elm.parentNode && elm.parentNode.nodeName === parentName;
23931
23996
  };
@@ -23964,7 +24029,13 @@
23964
24029
  var newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR');
23965
24030
  if (isFirstOrLastLi(containerBlock, parentBlock, true) && isFirstOrLastLi(containerBlock, parentBlock, false)) {
23966
24031
  if (hasParent$1(containerBlock, 'LI')) {
23967
- dom.insertAfter(newBlock, getContainerBlock(containerBlock));
24032
+ var containerBlockParent = getContainerBlock(containerBlock);
24033
+ dom.insertAfter(newBlock, containerBlockParent);
24034
+ if (isFirstChild(containerBlock)) {
24035
+ dom.remove(containerBlockParent);
24036
+ } else {
24037
+ dom.remove(containerBlock);
24038
+ }
23968
24039
  } else {
23969
24040
  dom.replace(newBlock, containerBlock);
23970
24041
  }
@@ -23976,8 +24047,10 @@
23976
24047
  } else {
23977
24048
  containerBlock.parentNode.insertBefore(newBlock, containerBlock);
23978
24049
  }
24050
+ dom.remove(parentBlock);
23979
24051
  } else if (isFirstOrLastLi(containerBlock, parentBlock, false)) {
23980
24052
  dom.insertAfter(newBlock, getContainerBlock(containerBlock));
24053
+ dom.remove(parentBlock);
23981
24054
  } else {
23982
24055
  containerBlock = getContainerBlock(containerBlock);
23983
24056
  var tmpRng = rng.cloneRange();
@@ -23991,8 +24064,8 @@
23991
24064
  dom.insertAfter(fragment, containerBlock);
23992
24065
  dom.insertAfter(newBlock, containerBlock);
23993
24066
  }
24067
+ dom.remove(parentBlock);
23994
24068
  }
23995
- dom.remove(parentBlock);
23996
24069
  moveToCaretPosition(editor, newBlock);
23997
24070
  };
23998
24071
 
@@ -24355,14 +24428,8 @@
24355
24428
  }
24356
24429
  }
24357
24430
  };
24358
- var scrollToBr = function (dom, selection, brElm) {
24359
- var marker = dom.create('span', {}, '&nbsp;');
24360
- brElm.parentNode.insertBefore(marker, brElm);
24361
- selection.scrollIntoView(marker);
24362
- dom.remove(marker);
24363
- };
24364
- var moveSelectionToBr = function (dom, selection, brElm, extraBr) {
24365
- var rng = dom.createRng();
24431
+ var moveSelectionToBr = function (editor, brElm, extraBr) {
24432
+ var rng = editor.dom.createRng();
24366
24433
  if (!extraBr) {
24367
24434
  rng.setStartAfter(brElm);
24368
24435
  rng.setEndAfter(brElm);
@@ -24370,7 +24437,8 @@
24370
24437
  rng.setStartBefore(brElm);
24371
24438
  rng.setEndBefore(brElm);
24372
24439
  }
24373
- selection.setRng(rng);
24440
+ editor.selection.setRng(rng);
24441
+ scrollRangeIntoView(editor, rng);
24374
24442
  };
24375
24443
  var insertBrAtCaret = function (editor, evt) {
24376
24444
  var selection = editor.selection;
@@ -24411,8 +24479,7 @@
24411
24479
  }
24412
24480
  brElm = dom.create('br');
24413
24481
  rangeInsertNode(dom, rng, brElm);
24414
- scrollToBr(dom, selection, brElm);
24415
- moveSelectionToBr(dom, selection, brElm, extraBr);
24482
+ moveSelectionToBr(editor, brElm, extraBr);
24416
24483
  editor.undoManager.add();
24417
24484
  };
24418
24485
  var insertBrBefore = function (editor, inline) {
@@ -24426,18 +24493,17 @@
24426
24493
  }
24427
24494
  var br = SugarElement.fromTag('br');
24428
24495
  after(SugarElement.fromDom(inline), br);
24429
- scrollToBr(editor.dom, editor.selection, br.dom);
24430
- moveSelectionToBr(editor.dom, editor.selection, br.dom, false);
24496
+ moveSelectionToBr(editor, br.dom, false);
24431
24497
  editor.undoManager.add();
24432
24498
  };
24433
24499
  var isBeforeBr$1 = function (pos) {
24434
24500
  return isBr(pos.getNode());
24435
24501
  };
24436
24502
  var hasBrAfter = function (rootNode, startNode) {
24437
- if (isBeforeBr$1(CaretPosition$1.after(startNode))) {
24503
+ if (isBeforeBr$1(CaretPosition.after(startNode))) {
24438
24504
  return true;
24439
24505
  } else {
24440
- return nextPosition(rootNode, CaretPosition$1.after(startNode)).map(function (pos) {
24506
+ return nextPosition(rootNode, CaretPosition.after(startNode)).map(function (pos) {
24441
24507
  return isBr(pos.getNode());
24442
24508
  }).getOr(false);
24443
24509
  }
@@ -24450,7 +24516,7 @@
24450
24516
  };
24451
24517
  var readInlineAnchorLocation = function (editor) {
24452
24518
  var isInlineTarget$1 = curry(isInlineTarget, editor);
24453
- var position = CaretPosition$1.fromRangeStart(editor.selection.getRng());
24519
+ var position = CaretPosition.fromRangeStart(editor.selection.getRng());
24454
24520
  return readLocation(isInlineTarget$1, editor.getBody(), position).filter(isInsideAnchor);
24455
24521
  };
24456
24522
  var insertBrOutsideAnchor = function (editor, location) {
@@ -24685,13 +24751,13 @@
24685
24751
  var locationToCaretPosition = function (root) {
24686
24752
  return function (location) {
24687
24753
  return location.fold(function (element) {
24688
- return prevPosition(root.dom, CaretPosition$1.before(element));
24754
+ return prevPosition(root.dom, CaretPosition.before(element));
24689
24755
  }, function (element) {
24690
24756
  return firstPositionIn(element);
24691
24757
  }, function (element) {
24692
24758
  return lastPositionIn(element);
24693
24759
  }, function (element) {
24694
- return nextPosition(root.dom, CaretPosition$1.after(element));
24760
+ return nextPosition(root.dom, CaretPosition.after(element));
24695
24761
  });
24696
24762
  };
24697
24763
  };
@@ -24708,11 +24774,11 @@
24708
24774
  };
24709
24775
  };
24710
24776
  var insertSpaceOrNbspAtSelection = function (editor) {
24711
- var pos = CaretPosition$1.fromRangeStart(editor.selection.getRng());
24777
+ var pos = CaretPosition.fromRangeStart(editor.selection.getRng());
24712
24778
  var root = SugarElement.fromDom(editor.getBody());
24713
24779
  if (editor.selection.isCollapsed()) {
24714
24780
  var isInlineTarget$1 = curry(isInlineTarget, editor);
24715
- var caretPosition = CaretPosition$1.fromRangeStart(editor.selection.getRng());
24781
+ var caretPosition = CaretPosition.fromRangeStart(editor.selection.getRng());
24716
24782
  return readLocation(isInlineTarget$1, editor.getBody(), caretPosition).bind(locationToCaretPosition(root)).bind(insertInlineBoundarySpaceOrNbsp(root, pos)).exists(setSelection$1(editor));
24717
24783
  } else {
24718
24784
  return false;
@@ -25160,7 +25226,7 @@
25160
25226
  };
25161
25227
  var bindFakeDragEvents = function (editor) {
25162
25228
  var state = value$1();
25163
- var pageDom = DOMUtils$1.DOM;
25229
+ var pageDom = DOMUtils.DOM;
25164
25230
  var rootDocument = document;
25165
25231
  var dragStartHandler = start$1(state, editor);
25166
25232
  var dragHandler = move$2(state, editor);
@@ -25186,7 +25252,7 @@
25186
25252
  };
25187
25253
  var blockUnsupportedFileDrop = function (editor) {
25188
25254
  var preventFileDrop = function (e) {
25189
- if (!e.defaultPrevented) {
25255
+ if (!e.isDefaultPrevented()) {
25190
25256
  var dataTransfer = e.dataTransfer;
25191
25257
  if (dataTransfer && (contains(dataTransfer.types, 'Files') || dataTransfer.files.length > 0)) {
25192
25258
  e.preventDefault();
@@ -25202,7 +25268,7 @@
25202
25268
  }
25203
25269
  };
25204
25270
  var setup = function () {
25205
- var pageDom = DOMUtils$1.DOM;
25271
+ var pageDom = DOMUtils.DOM;
25206
25272
  var dom = editor.dom;
25207
25273
  var doc = document;
25208
25274
  var editorRoot = editor.inline ? editor.getBody() : editor.getDoc();
@@ -25354,7 +25420,7 @@
25354
25420
  if (!elm.firstChild) {
25355
25421
  return false;
25356
25422
  }
25357
- var startPos = CaretPosition$1.before(elm.firstChild);
25423
+ var startPos = CaretPosition.before(elm.firstChild);
25358
25424
  var newPos = caretWalker.next(startPos);
25359
25425
  return newPos && !isNearFakeSelectionElement(newPos);
25360
25426
  };
@@ -25993,8 +26059,7 @@
25993
26059
  }
25994
26060
  });
25995
26061
  };
25996
- var refreshContentEditable = function () {
25997
- };
26062
+ var refreshContentEditable = noop;
25998
26063
  var isHidden = function () {
25999
26064
  if (!isGecko || editor.removed) {
26000
26065
  return false;
@@ -26047,7 +26112,7 @@
26047
26112
  };
26048
26113
  };
26049
26114
 
26050
- var DOM$4 = DOMUtils$1.DOM;
26115
+ var DOM$4 = DOMUtils.DOM;
26051
26116
  var appendStyle = function (editor, text) {
26052
26117
  var body = SugarElement.fromDom(editor.getBody());
26053
26118
  var container = getStyleContainer(getRootNode(body));
@@ -26229,15 +26294,36 @@
26229
26294
  var getStyleSheetLoader = function (editor) {
26230
26295
  return editor.inline ? editor.ui.styleSheetLoader : editor.dom.styleSheetLoader;
26231
26296
  };
26297
+ var makeStylesheetLoadingPromises = function (editor, css, framedFonts) {
26298
+ var promises = [new promiseObj(function (resolve, reject) {
26299
+ return getStyleSheetLoader(editor).loadAll(css, resolve, reject);
26300
+ })];
26301
+ if (editor.inline) {
26302
+ return promises;
26303
+ } else {
26304
+ return promises.concat([new promiseObj(function (resolve, reject) {
26305
+ return editor.ui.styleSheetLoader.loadAll(framedFonts, resolve, reject);
26306
+ })]);
26307
+ }
26308
+ };
26232
26309
  var loadContentCss = function (editor, css) {
26233
26310
  var styleSheetLoader = getStyleSheetLoader(editor);
26311
+ var fontCss = getFontCss(editor);
26312
+ var removeCss = function () {
26313
+ styleSheetLoader.unloadAll(css);
26314
+ if (!editor.inline) {
26315
+ editor.ui.styleSheetLoader.unloadAll(fontCss);
26316
+ }
26317
+ };
26234
26318
  var loaded = function () {
26235
- editor.on('remove', function () {
26236
- return styleSheetLoader.unloadAll(css);
26237
- });
26238
- initEditor(editor);
26319
+ if (editor.removed) {
26320
+ removeCss();
26321
+ } else {
26322
+ editor.on('remove', removeCss);
26323
+ initEditor(editor);
26324
+ }
26239
26325
  };
26240
- styleSheetLoader.loadAll(css, loaded, loaded);
26326
+ promiseObj.all(makeStylesheetLoadingPromises(editor, css, fontCss)).then(loaded).catch(loaded);
26241
26327
  };
26242
26328
  var preInit = function (editor, rtcMode) {
26243
26329
  var settings = editor.settings, doc = editor.getDoc(), body = editor.getBody();
@@ -26316,7 +26402,7 @@
26316
26402
  body.disabled = false;
26317
26403
  editor.editorUpload = EditorUpload(editor);
26318
26404
  editor.schema = Schema(settings);
26319
- editor.dom = DOMUtils$1(doc, {
26405
+ editor.dom = DOMUtils(doc, {
26320
26406
  keep_values: true,
26321
26407
  url_converter: editor.convertURL,
26322
26408
  url_converter_scope: editor,
@@ -26358,11 +26444,17 @@
26358
26444
  loadingRtc.then(function (rtcMode) {
26359
26445
  editor.setProgressState(false);
26360
26446
  preInit(editor, rtcMode);
26447
+ }, function (err) {
26448
+ editor.notificationManager.open({
26449
+ type: 'error',
26450
+ text: String(err)
26451
+ });
26452
+ preInit(editor, true);
26361
26453
  });
26362
26454
  });
26363
26455
  };
26364
26456
 
26365
- var DOM$5 = DOMUtils$1.DOM;
26457
+ var DOM$5 = DOMUtils.DOM;
26366
26458
  var relaxDomain = function (editor, ifr) {
26367
26459
  if (document.domain !== window.location.hostname && Env.browser.isIE()) {
26368
26460
  var bodyUuid = uuid('mce');
@@ -26428,7 +26520,7 @@
26428
26520
  }
26429
26521
  };
26430
26522
 
26431
- var DOM$6 = DOMUtils$1.DOM;
26523
+ var DOM$6 = DOMUtils.DOM;
26432
26524
  var initPlugin = function (editor, initializedPlugins, plugin) {
26433
26525
  var Plugin = PluginManager.get(plugin);
26434
26526
  var pluginUrl = PluginManager.urls[plugin] || editor.documentBaseUrl.replace(/\/$/, '');
@@ -26561,7 +26653,7 @@
26561
26653
  }
26562
26654
  };
26563
26655
 
26564
- var DOM$7 = DOMUtils$1.DOM;
26656
+ var DOM$7 = DOMUtils.DOM;
26565
26657
  var hasSkipLoadPrefix = function (name) {
26566
26658
  return name.charAt(0) === '-';
26567
26659
  };
@@ -26808,7 +26900,7 @@
26808
26900
  return fontFamily.replace(/[\'\"\\]/g, '').replace(/,\s+/g, ',');
26809
26901
  };
26810
26902
  var getComputedFontProp = function (propName, elm) {
26811
- return Optional.from(DOMUtils$1.DOM.getStyle(elm, propName, true));
26903
+ return Optional.from(DOMUtils.DOM.getStyle(elm, propName, true));
26812
26904
  };
26813
26905
  var getFontProp = function (propName) {
26814
26906
  return function (rootElm, elm) {
@@ -27106,8 +27198,7 @@
27106
27198
  EditorCommands.prototype.setupCommands = function (editor) {
27107
27199
  var self = this;
27108
27200
  this.addCommands({
27109
- 'mceResetDesignMode,mceBeginUndoLevel': function () {
27110
- },
27201
+ 'mceResetDesignMode,mceBeginUndoLevel': noop,
27111
27202
  'mceEndUndoLevel,mceAddUndoLevel': function () {
27112
27203
  editor.undoManager.add();
27113
27204
  },
@@ -27241,8 +27332,7 @@
27241
27332
  'Indent,Outdent': function (command) {
27242
27333
  handle(editor, command);
27243
27334
  },
27244
- 'mceRepaint': function () {
27245
- },
27335
+ 'mceRepaint': noop,
27246
27336
  'InsertHorizontalRule': function () {
27247
27337
  editor.execCommand('mceInsertContent', false, '<hr />');
27248
27338
  },
@@ -27638,7 +27728,7 @@
27638
27728
  }
27639
27729
  };
27640
27730
 
27641
- var DOM$8 = DOMUtils$1.DOM;
27731
+ var DOM$8 = DOMUtils.DOM;
27642
27732
  var customEventRootDelegates;
27643
27733
  var getEventTarget = function (editor, eventName) {
27644
27734
  if (eventName === 'selectionchange') {
@@ -27860,6 +27950,48 @@
27860
27950
  f12: 123
27861
27951
  };
27862
27952
  var modifierNames = Tools.makeMap('alt,ctrl,shift,meta,access');
27953
+ var parseShortcut = function (pattern) {
27954
+ var key;
27955
+ var shortcut = {};
27956
+ each$g(explode$3(pattern.toLowerCase(), '+'), function (value) {
27957
+ if (value in modifierNames) {
27958
+ shortcut[value] = true;
27959
+ } else {
27960
+ if (/^[0-9]{2,}$/.test(value)) {
27961
+ shortcut.keyCode = parseInt(value, 10);
27962
+ } else {
27963
+ shortcut.charCode = value.charCodeAt(0);
27964
+ shortcut.keyCode = keyCodeLookup[value] || value.toUpperCase().charCodeAt(0);
27965
+ }
27966
+ }
27967
+ });
27968
+ var id = [shortcut.keyCode];
27969
+ for (key in modifierNames) {
27970
+ if (shortcut[key]) {
27971
+ id.push(key);
27972
+ } else {
27973
+ shortcut[key] = false;
27974
+ }
27975
+ }
27976
+ shortcut.id = id.join(',');
27977
+ if (shortcut.access) {
27978
+ shortcut.alt = true;
27979
+ if (Env.mac) {
27980
+ shortcut.ctrl = true;
27981
+ } else {
27982
+ shortcut.shift = true;
27983
+ }
27984
+ }
27985
+ if (shortcut.meta) {
27986
+ if (Env.mac) {
27987
+ shortcut.meta = true;
27988
+ } else {
27989
+ shortcut.ctrl = true;
27990
+ shortcut.meta = false;
27991
+ }
27992
+ }
27993
+ return shortcut;
27994
+ };
27863
27995
  var Shortcuts = function () {
27864
27996
  function Shortcuts(editor) {
27865
27997
  this.shortcuts = {};
@@ -27920,50 +28052,8 @@
27920
28052
  return cmd;
27921
28053
  }
27922
28054
  };
27923
- Shortcuts.prototype.parseShortcut = function (pattern) {
27924
- var key;
27925
- var shortcut = {};
27926
- each$g(explode$3(pattern.toLowerCase(), '+'), function (value) {
27927
- if (value in modifierNames) {
27928
- shortcut[value] = true;
27929
- } else {
27930
- if (/^[0-9]{2,}$/.test(value)) {
27931
- shortcut.keyCode = parseInt(value, 10);
27932
- } else {
27933
- shortcut.charCode = value.charCodeAt(0);
27934
- shortcut.keyCode = keyCodeLookup[value] || value.toUpperCase().charCodeAt(0);
27935
- }
27936
- }
27937
- });
27938
- var id = [shortcut.keyCode];
27939
- for (key in modifierNames) {
27940
- if (shortcut[key]) {
27941
- id.push(key);
27942
- } else {
27943
- shortcut[key] = false;
27944
- }
27945
- }
27946
- shortcut.id = id.join(',');
27947
- if (shortcut.access) {
27948
- shortcut.alt = true;
27949
- if (Env.mac) {
27950
- shortcut.ctrl = true;
27951
- } else {
27952
- shortcut.shift = true;
27953
- }
27954
- }
27955
- if (shortcut.meta) {
27956
- if (Env.mac) {
27957
- shortcut.meta = true;
27958
- } else {
27959
- shortcut.ctrl = true;
27960
- shortcut.meta = false;
27961
- }
27962
- }
27963
- return shortcut;
27964
- };
27965
28055
  Shortcuts.prototype.createShortcut = function (pattern, desc, cmdFunc, scope) {
27966
- var shortcuts = Tools.map(explode$3(pattern, '>'), this.parseShortcut);
28056
+ var shortcuts = Tools.map(explode$3(pattern, '>'), parseShortcut);
27967
28057
  shortcuts[shortcuts.length - 1] = Tools.extend(shortcuts[shortcuts.length - 1], {
27968
28058
  func: cmdFunc,
27969
28059
  scope: scope || this.editor
@@ -28099,7 +28189,7 @@
28099
28189
  }
28100
28190
  }
28101
28191
  url = url.replace(/@@/g, '(mce_at)');
28102
- var urlMatch = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url);
28192
+ var urlMatch = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url);
28103
28193
  each$h(queryParts, function (v, i) {
28104
28194
  var part = urlMatch[i];
28105
28195
  if (part) {
@@ -28312,7 +28402,7 @@
28312
28402
  return URI;
28313
28403
  }();
28314
28404
 
28315
- var DOM$9 = DOMUtils$1.DOM;
28405
+ var DOM$9 = DOMUtils.DOM;
28316
28406
  var extend$3 = Tools.extend, each$i = Tools.each;
28317
28407
  var resolve$3 = Tools.resolve;
28318
28408
  var ie$1 = Env.ie;
@@ -28338,10 +28428,10 @@
28338
28428
  this.baseUri = editorManager.baseURI;
28339
28429
  if (this.settings.referrer_policy) {
28340
28430
  ScriptLoader.ScriptLoader._setReferrerPolicy(this.settings.referrer_policy);
28341
- DOMUtils$1.DOM.styleSheetLoader._setReferrerPolicy(this.settings.referrer_policy);
28431
+ DOMUtils.DOM.styleSheetLoader._setReferrerPolicy(this.settings.referrer_policy);
28342
28432
  }
28343
- AddOnManager$1.languageLoad = this.settings.language_load;
28344
- AddOnManager$1.baseURL = editorManager.baseURL;
28433
+ AddOnManager.languageLoad = this.settings.language_load;
28434
+ AddOnManager.baseURL = editorManager.baseURL;
28345
28435
  this.id = id;
28346
28436
  this.setDirty(false);
28347
28437
  this.documentBaseURI = new URI(this.settings.document_base_url, { base_uri: this.baseUri });
@@ -28668,7 +28758,7 @@
28668
28758
  return Editor;
28669
28759
  }();
28670
28760
 
28671
- var DOM$a = DOMUtils$1.DOM;
28761
+ var DOM$a = DOMUtils.DOM;
28672
28762
  var explode$4 = Tools.explode, each$j = Tools.each, extend$4 = Tools.extend;
28673
28763
  var instanceCounter = 0, boundGlobalEvents = false;
28674
28764
  var beforeUnloadDelegate;
@@ -28739,8 +28829,8 @@
28739
28829
  suffix: null,
28740
28830
  $: DomQuery,
28741
28831
  majorVersion: '5',
28742
- minorVersion: '6.2',
28743
- releaseDate: '2020-12-08',
28832
+ minorVersion: '7.1',
28833
+ releaseDate: '2021-03-17',
28744
28834
  editors: legacyEditors,
28745
28835
  i18n: I18n,
28746
28836
  activeEditor: null,
@@ -28803,7 +28893,7 @@
28803
28893
  var pluginBaseUrls = defaultSettings.plugin_base_urls;
28804
28894
  if (pluginBaseUrls !== undefined) {
28805
28895
  each$1(pluginBaseUrls, function (pluginBaseUrl, pluginName) {
28806
- AddOnManager$1.PluginManager.urls[pluginName] = pluginBaseUrl;
28896
+ AddOnManager.PluginManager.urls[pluginName] = pluginBaseUrl;
28807
28897
  });
28808
28898
  }
28809
28899
  },
@@ -28829,7 +28919,7 @@
28829
28919
  if (!callback) {
28830
28920
  return;
28831
28921
  }
28832
- return callback.apply(self, Array.prototype.slice.call(arguments, 2));
28922
+ return callback.apply(self, []);
28833
28923
  };
28834
28924
  var hasClass = function (elm, className) {
28835
28925
  return className.constructor === RegExp ? className.test(elm.className) : DOM$a.hasClass(elm, className);
@@ -29044,7 +29134,7 @@
29044
29134
  return true;
29045
29135
  case 'mceToggleEditor':
29046
29136
  if (!editor) {
29047
- self.execCommand('mceAddEditor', 0, value);
29137
+ self.execCommand('mceAddEditor', false, value);
29048
29138
  return true;
29049
29139
  }
29050
29140
  if (editor.isHidden()) {
@@ -29525,7 +29615,7 @@
29525
29615
  callbacks: {},
29526
29616
  count: 0,
29527
29617
  send: function (settings) {
29528
- var self = this, dom = DOMUtils$1.DOM, count = settings.count !== undefined ? settings.count : self.count;
29618
+ var self = this, dom = DOMUtils.DOM, count = settings.count !== undefined ? settings.count : self.count;
29529
29619
  var id = 'tinymce_jsonp_' + count;
29530
29620
  self.callbacks[count] = function (json) {
29531
29621
  dom.remove(id);
@@ -29697,7 +29787,8 @@
29697
29787
  JSONRequest: JSONRequest,
29698
29788
  JSONP: JSONP,
29699
29789
  LocalStorage: LocalStorage,
29700
- Color: Color
29790
+ Color: Color,
29791
+ ImageUploader: ImageUploader
29701
29792
  },
29702
29793
  dom: {
29703
29794
  EventUtils: EventUtils,
@@ -29705,13 +29796,13 @@
29705
29796
  DomQuery: DomQuery,
29706
29797
  TreeWalker: DomTreeWalker,
29707
29798
  TextSeeker: TextSeeker,
29708
- DOMUtils: DOMUtils$1,
29799
+ DOMUtils: DOMUtils,
29709
29800
  ScriptLoader: ScriptLoader,
29710
- RangeUtils: RangeUtils$1,
29801
+ RangeUtils: RangeUtils,
29711
29802
  Serializer: DomSerializer,
29712
29803
  StyleSheetLoader: StyleSheetLoader,
29713
29804
  ControlSelection: ControlSelection,
29714
- BookmarkManager: BookmarkManager$1,
29805
+ BookmarkManager: BookmarkManager,
29715
29806
  Selection: EditorSelection,
29716
29807
  Event: EventUtils.Event
29717
29808
  },
@@ -29720,13 +29811,13 @@
29720
29811
  Entities: Entities,
29721
29812
  Node: AstNode,
29722
29813
  Schema: Schema,
29723
- SaxParser: SaxParser$1,
29814
+ SaxParser: SaxParser,
29724
29815
  DomParser: DomParser,
29725
29816
  Writer: Writer,
29726
29817
  Serializer: HtmlSerializer
29727
29818
  },
29728
29819
  Env: Env,
29729
- AddOnManager: AddOnManager$1,
29820
+ AddOnManager: AddOnManager,
29730
29821
  Annotator: Annotator,
29731
29822
  Formatter: Formatter,
29732
29823
  UndoManager: UndoManager,
@@ -29738,7 +29829,7 @@
29738
29829
  Editor: Editor,
29739
29830
  FocusManager: FocusManager,
29740
29831
  EditorManager: EditorManager,
29741
- DOM: DOMUtils$1.DOM,
29832
+ DOM: DOMUtils.DOM,
29742
29833
  ScriptLoader: ScriptLoader.ScriptLoader,
29743
29834
  PluginManager: PluginManager,
29744
29835
  ThemeManager: ThemeManager,