tinymce-rails 5.0.16 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -2
  3. data/app/assets/source/tinymce/tinymce.js +935 -904
  4. data/lib/tinymce/rails/version.rb +2 -2
  5. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -1
  6. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +2 -2
  8. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +2 -2
  9. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
  10. data/vendor/assets/javascripts/tinymce/plugins/bbcode/plugin.js +1 -1
  11. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -1
  12. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
  14. data/vendor/assets/javascripts/tinymce/plugins/colorpicker/plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/contextmenu/plugin.js +1 -1
  16. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -1
  17. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +1 -1
  18. data/vendor/assets/javascripts/tinymce/plugins/fullpage/plugin.js +1 -1
  19. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +2 -2
  20. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +2 -2
  21. data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.js +1 -1
  22. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +2 -2
  23. data/vendor/assets/javascripts/tinymce/plugins/imagetools/plugin.js +2 -2
  24. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
  25. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +1 -1
  26. data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/plugin.js +1 -1
  27. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +2 -2
  28. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +2 -2
  29. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -2
  30. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
  31. data/vendor/assets/javascripts/tinymce/plugins/noneditable/plugin.js +1 -1
  32. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +1 -1
  33. data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +1 -1
  34. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +2 -2
  35. data/vendor/assets/javascripts/tinymce/plugins/print/plugin.js +2 -2
  36. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -2
  37. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
  38. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +2 -2
  39. data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.js +1 -1
  40. data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.js +1 -1
  41. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  42. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +1 -1
  43. data/vendor/assets/javascripts/tinymce/plugins/textcolor/plugin.js +1 -1
  44. data/vendor/assets/javascripts/tinymce/plugins/textpattern/plugin.js +2 -2
  45. data/vendor/assets/javascripts/tinymce/plugins/toc/plugin.js +1 -1
  46. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +2 -2
  47. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +2 -2
  48. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +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/skin.css +1 -1
  52. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  53. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.css +1 -1
  54. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  55. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
  56. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
  57. data/vendor/assets/javascripts/tinymce/themes/mobile/theme.js +2 -2
  58. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
  59. data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
  60. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 642de03f2a6c4fa40a5fdca3e494bad8cb86df14051c315ae2c3bba98c6246c4
4
- data.tar.gz: 021f854e60c97d9c7795d92be1815637b551cce27d52da22b8a208ad0151b4c3
3
+ metadata.gz: 29e7b2500cbf1a2f78bcc3efe0f93b290cb4306e9eae9ff682760ab95aabbca4
4
+ data.tar.gz: 743d7db4d1c95c82b0cf345a499bb9af90e30ea3cf20e3aa879db11fc8a80b0a
5
5
  SHA512:
6
- metadata.gz: 886db7c6b7c0625fa70fb0046a83c8d66491d4d675c3d56299dcf8ddf48d754db2792b48041d4b96976a8c4f32f97d0badabcba2220a92aac6977f6938851cfc
7
- data.tar.gz: d223c2bf7295cffe41034dedd11371f1f5f65b369c53ddbce45559d25687a108a51aede2689af7076f3e486474eee284c7ce010b50ad4cae8024257c4f52d566
6
+ metadata.gz: 2f6555573d696e5189cbafd85850f8b4b95a9971c06530f2ce22e7b28a74fc1c0abaef891d3975d36a9f58f7b180981116ce36df6ed4e993798c242ac98f6ddd
7
+ data.tar.gz: 7ea2269f74bc1496eb21daa8aaa7bc399df38a80ccee29625b5a491be739afe8708ebbcca018525b20dfdfa50045fe1dba499109a570e3a57782796753f021bd
data/README.md CHANGED
@@ -39,14 +39,13 @@ The Rails server no longer needs to be restarted when this file is updated in de
39
39
  To define multiple configuration sets, follow this syntax (a default configuration must be specified):
40
40
 
41
41
  ```yml
42
- default:
42
+ default: &default
43
43
  plugins:
44
44
  - image
45
45
  - link
46
46
 
47
47
  alternate:
48
48
  <<: *default
49
- selector: textarea.table-editor
50
49
  toolbar: styleselect | bold italic | undo redo | table
51
50
  plugins:
52
51
  - table
@@ -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.0.16 (2019-09-24)
7
+ * Version: 5.1.1 (2019-10-28)
8
8
  */
9
9
  (function (domGlobals) {
10
10
  'use strict';
@@ -477,19 +477,21 @@
477
477
  isTextareaOrInput: isTextareaOrInput
478
478
  };
479
479
 
480
- var cached = function (f) {
481
- var called = false;
482
- var r;
483
- return function () {
484
- var args = [];
485
- for (var _i = 0; _i < arguments.length; _i++) {
486
- args[_i] = arguments[_i];
487
- }
488
- if (!called) {
489
- called = true;
490
- r = f.apply(null, args);
491
- }
492
- return r;
480
+ var Cell = function (initial) {
481
+ var value = initial;
482
+ var get = function () {
483
+ return value;
484
+ };
485
+ var set = function (v) {
486
+ value = v;
487
+ };
488
+ var clone = function () {
489
+ return Cell(get());
490
+ };
491
+ return {
492
+ get: get,
493
+ set: set,
494
+ clone: clone
493
495
  };
494
496
  };
495
497
 
@@ -624,15 +626,15 @@
624
626
  freebsd: constant(freebsd)
625
627
  };
626
628
 
627
- var DeviceType = function (os, browser, userAgent) {
629
+ var DeviceType = function (os, browser, userAgent, mediaMatch) {
628
630
  var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
629
631
  var isiPhone = os.isiOS() && !isiPad;
630
- var isAndroid3 = os.isAndroid() && os.version.major === 3;
631
- var isAndroid4 = os.isAndroid() && os.version.major === 4;
632
- var isTablet = isiPad || isAndroid3 || isAndroid4 && /mobile/i.test(userAgent) === true;
633
- var isTouch = os.isiOS() || os.isAndroid();
634
- var isPhone = isTouch && !isTablet;
632
+ var isMobile = os.isiOS() || os.isAndroid();
633
+ var isTouch = isMobile || mediaMatch('(pointer:coarse)');
634
+ var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)');
635
+ var isPhone = isiPhone || isMobile && !isTablet;
635
636
  var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
637
+ var isDesktop = !isPhone && !isTablet && !iOSwebview;
636
638
  return {
637
639
  isiPad: constant(isiPad),
638
640
  isiPhone: constant(isiPhone),
@@ -641,7 +643,8 @@
641
643
  isTouch: constant(isTouch),
642
644
  isAndroid: os.isAndroid,
643
645
  isiOS: os.isiOS,
644
- isWebView: constant(iOSwebview)
646
+ isWebView: constant(iOSwebview),
647
+ isDesktop: constant(isDesktop)
645
648
  };
646
649
  };
647
650
 
@@ -806,12 +809,12 @@
806
809
  oses: constant(oses)
807
810
  };
808
811
 
809
- var detect$2 = function (userAgent) {
812
+ var detect$2 = function (userAgent, mediaMatch) {
810
813
  var browsers = PlatformInfo.browsers();
811
814
  var oses = PlatformInfo.oses();
812
815
  var browser = UaString.detectBrowser(browsers, userAgent).fold(Browser.unknown, Browser.nu);
813
816
  var os = UaString.detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
814
- var deviceType = DeviceType(os, browser, userAgent);
817
+ var deviceType = DeviceType(os, browser, userAgent, mediaMatch);
815
818
  return {
816
819
  browser: browser,
817
820
  os: os,
@@ -820,11 +823,13 @@
820
823
  };
821
824
  var PlatformDetection = { detect: detect$2 };
822
825
 
823
- var detect$3 = cached(function () {
824
- var userAgent = domGlobals.navigator.userAgent;
825
- return PlatformDetection.detect(userAgent);
826
- });
827
- var PlatformDetection$1 = { detect: detect$3 };
826
+ var mediaMatch = function (query) {
827
+ return domGlobals.window.matchMedia(query).matches;
828
+ };
829
+ var platform = Cell(PlatformDetection.detect(domGlobals.navigator.userAgent, mediaMatch));
830
+ var detect$3 = function () {
831
+ return platform.get();
832
+ };
828
833
 
829
834
  var fromHtml = function (html, scope) {
830
835
  var doc = scope || domGlobals.document;
@@ -1091,7 +1096,7 @@
1091
1096
  var ieContains = function (e1, e2) {
1092
1097
  return Node.documentPositionContainedBy(e1.dom(), e2.dom());
1093
1098
  };
1094
- var browser = PlatformDetection$1.detect().browser;
1099
+ var browser = detect$3().browser;
1095
1100
  var contains$2 = browser.isIE() ? ieContains : regularContains;
1096
1101
 
1097
1102
  var owner = function (element) {
@@ -1152,7 +1157,7 @@
1152
1157
  };
1153
1158
  var spot = Immutable('element', 'offset');
1154
1159
 
1155
- var browser$1 = PlatformDetection$1.detect().browser;
1160
+ var browser$1 = detect$3().browser;
1156
1161
  var firstElement = function (nodes) {
1157
1162
  return find(nodes, isElement$1);
1158
1163
  };
@@ -2224,51 +2229,65 @@
2224
2229
  clearTimeout: wrappedClearTimeout
2225
2230
  };
2226
2231
 
2227
- var nav = domGlobals.navigator, userAgent = nav.userAgent;
2228
- var opera$1, webkit, ie$1, ie11, ie12, gecko, mac, iDevice, android$1, fileApi, phone, tablet, windowsPhone;
2229
- var matchMediaQuery = function (query) {
2230
- return 'matchMedia' in domGlobals.window ? domGlobals.matchMedia(query).matches : false;
2231
- };
2232
- opera$1 = false;
2233
- android$1 = /Android/.test(userAgent);
2234
- webkit = /WebKit/.test(userAgent);
2235
- ie$1 = !webkit && !opera$1 && /MSIE/gi.test(userAgent) && /Explorer/gi.test(nav.appName);
2236
- ie$1 = ie$1 && /MSIE (\w+)\./.exec(userAgent)[1];
2237
- ie11 = userAgent.indexOf('Trident/') !== -1 && (userAgent.indexOf('rv:') !== -1 || nav.appName.indexOf('Netscape') !== -1) ? 11 : false;
2238
- ie12 = userAgent.indexOf('Edge/') !== -1 && !ie$1 && !ie11 ? 12 : false;
2239
- ie$1 = ie$1 || ie11 || ie12;
2240
- gecko = !webkit && !ie11 && /Gecko/.test(userAgent);
2241
- mac = userAgent.indexOf('Mac') !== -1;
2242
- iDevice = /(iPad|iPhone)/.test(userAgent);
2243
- fileApi = 'FormData' in domGlobals.window && 'FileReader' in domGlobals.window && 'URL' in domGlobals.window && !!domGlobals.URL.createObjectURL;
2244
- phone = matchMediaQuery('only screen and (max-device-width: 480px)') && (android$1 || iDevice);
2245
- tablet = matchMediaQuery('only screen and (min-width: 800px)') && (android$1 || iDevice);
2246
- windowsPhone = userAgent.indexOf('Windows Phone') !== -1;
2247
- if (ie12) {
2248
- webkit = false;
2249
- }
2250
- var contentEditable = !iDevice || fileApi || parseInt(userAgent.match(/AppleWebKit\/(\d*)/)[1], 10) >= 534;
2232
+ var userAgent = domGlobals.navigator.userAgent;
2233
+ var platform$1 = detect$3();
2234
+ var browser$2 = platform$1.browser;
2235
+ var os = platform$1.os;
2236
+ var deviceType = platform$1.deviceType;
2237
+ var webkit = /WebKit/.test(userAgent) && !browser$2.isEdge();
2238
+ var fileApi = 'FormData' in domGlobals.window && 'FileReader' in domGlobals.window && 'URL' in domGlobals.window && !!domGlobals.URL.createObjectURL;
2239
+ var windowsPhone = userAgent.indexOf('Windows Phone') !== -1;
2251
2240
  var Env = {
2252
- opera: opera$1,
2241
+ opera: browser$2.isOpera(),
2253
2242
  webkit: webkit,
2254
- ie: ie$1,
2255
- gecko: gecko,
2256
- mac: mac,
2257
- iOS: iDevice,
2258
- android: android$1,
2259
- contentEditable: contentEditable,
2243
+ ie: browser$2.isIE() || browser$2.isEdge() ? browser$2.version.major : false,
2244
+ gecko: browser$2.isFirefox(),
2245
+ mac: os.isOSX() || os.isiOS(),
2246
+ iOS: deviceType.isiPad() || deviceType.isiPhone(),
2247
+ android: os.isAndroid(),
2248
+ contentEditable: true,
2260
2249
  transparentSrc: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
2261
- caretAfter: ie$1 !== 8,
2250
+ caretAfter: true,
2262
2251
  range: domGlobals.window.getSelection && 'Range' in domGlobals.window,
2263
- documentMode: ie$1 && !ie12 ? domGlobals.document.documentMode || 7 : 10,
2252
+ documentMode: browser$2.isIE() ? domGlobals.document.documentMode || 7 : 10,
2264
2253
  fileApi: fileApi,
2265
- ceFalse: ie$1 === false || ie$1 > 8,
2254
+ ceFalse: true,
2266
2255
  cacheSuffix: null,
2267
2256
  container: null,
2268
2257
  experimentalShadowDom: false,
2269
- canHaveCSP: ie$1 === false || ie$1 > 11,
2270
- desktop: !phone && !tablet,
2271
- windowsPhone: windowsPhone
2258
+ canHaveCSP: !browser$2.isIE(),
2259
+ desktop: deviceType.isDesktop(),
2260
+ windowsPhone: windowsPhone,
2261
+ browser: {
2262
+ current: browser$2.current,
2263
+ version: browser$2.version,
2264
+ isChrome: browser$2.isChrome,
2265
+ isEdge: browser$2.isEdge,
2266
+ isFirefox: browser$2.isFirefox,
2267
+ isIE: browser$2.isIE,
2268
+ isOpera: browser$2.isOpera,
2269
+ isSafari: browser$2.isSafari
2270
+ },
2271
+ os: {
2272
+ current: os.current,
2273
+ version: os.version,
2274
+ isAndroid: os.isAndroid,
2275
+ isFreeBSD: os.isFreeBSD,
2276
+ isiOS: os.isiOS,
2277
+ isLinux: os.isLinux,
2278
+ isOSX: os.isOSX,
2279
+ isSolaris: os.isSolaris,
2280
+ isWindows: os.isWindows
2281
+ },
2282
+ deviceType: {
2283
+ isDesktop: deviceType.isDesktop,
2284
+ isiPad: deviceType.isiPad,
2285
+ isiPhone: deviceType.isiPhone,
2286
+ isPhone: deviceType.isPhone,
2287
+ isTablet: deviceType.isTablet,
2288
+ isTouch: deviceType.isTouch,
2289
+ isWebView: deviceType.isWebView
2290
+ }
2272
2291
  };
2273
2292
 
2274
2293
  var isArray$1 = Array.isArray;
@@ -4062,32 +4081,10 @@
4062
4081
  callback(event);
4063
4082
  }
4064
4083
  };
4065
- var waitForDomLoaded = function () {
4066
- if (isDocReady()) {
4067
- removeEvent(doc, 'readystatechange', waitForDomLoaded);
4068
- readyHandler();
4069
- }
4070
- };
4071
- var tryScroll = function () {
4072
- try {
4073
- doc.documentElement.doScroll('left');
4074
- } catch (ex) {
4075
- Delay.setTimeout(tryScroll);
4076
- return;
4077
- }
4084
+ if (isDocReady()) {
4078
4085
  readyHandler();
4079
- };
4080
- if (doc.addEventListener && !(Env.ie && Env.ie < 11)) {
4081
- if (isDocReady()) {
4082
- readyHandler();
4083
- } else {
4084
- addEvent(win, 'DOMContentLoaded', readyHandler);
4085
- }
4086
4086
  } else {
4087
- addEvent(doc, 'readystatechange', waitForDomLoaded);
4088
- if (doc.documentElement.doScroll && win.self === win.top) {
4089
- tryScroll();
4090
- }
4087
+ addEvent(win, 'DOMContentLoaded', readyHandler);
4091
4088
  }
4092
4089
  addEvent(win, 'load', readyHandler);
4093
4090
  };
@@ -6123,62 +6120,6 @@
6123
6120
  DomQuery.extend(sub, this);
6124
6121
  return sub;
6125
6122
  };
6126
- var appendHooks = function (targetHooks, prop, hooks) {
6127
- each$4(hooks, function (name, func) {
6128
- targetHooks[name] = targetHooks[name] || {};
6129
- targetHooks[name][prop] = func;
6130
- });
6131
- };
6132
- if (Env.ie && Env.ie < 8) {
6133
- appendHooks(attrHooks, 'get', {
6134
- maxlength: function (elm) {
6135
- var value = elm.maxLength;
6136
- if (value === 2147483647) {
6137
- return undefined;
6138
- }
6139
- return value;
6140
- },
6141
- size: function (elm) {
6142
- var value = elm.size;
6143
- if (value === 20) {
6144
- return undefined;
6145
- }
6146
- return value;
6147
- },
6148
- class: function (elm) {
6149
- return elm.className;
6150
- },
6151
- style: function (elm) {
6152
- var value = elm.style.cssText;
6153
- if (value.length === 0) {
6154
- return undefined;
6155
- }
6156
- return value;
6157
- }
6158
- });
6159
- appendHooks(attrHooks, 'set', {
6160
- class: function (elm, value) {
6161
- elm.className = value;
6162
- },
6163
- style: function (elm, value) {
6164
- elm.style.cssText = value;
6165
- }
6166
- });
6167
- }
6168
- if (Env.ie && Env.ie < 9) {
6169
- cssFix.float = 'styleFloat';
6170
- appendHooks(cssHooks, 'set', {
6171
- opacity: function (elm, value) {
6172
- var style = elm.style;
6173
- if (value === null || value === '') {
6174
- style.removeAttribute('filter');
6175
- } else {
6176
- style.zoom = 1;
6177
- style.filter = 'alpha(opacity=' + value * 100 + ')';
6178
- }
6179
- }
6180
- });
6181
- }
6182
6123
  DomQueryConstructor.attrHooks = attrHooks;
6183
6124
  DomQueryConstructor.cssHooks = cssHooks;
6184
6125
  var DomQuery = DomQueryConstructor;
@@ -6253,6 +6194,161 @@
6253
6194
  return TreeWalker;
6254
6195
  }();
6255
6196
 
6197
+ var before = function (marker, element) {
6198
+ var parent$1 = parent(marker);
6199
+ parent$1.each(function (v) {
6200
+ v.dom().insertBefore(element.dom(), marker.dom());
6201
+ });
6202
+ };
6203
+ var after = function (marker, element) {
6204
+ var sibling = nextSibling(marker);
6205
+ sibling.fold(function () {
6206
+ var parent$1 = parent(marker);
6207
+ parent$1.each(function (v) {
6208
+ append(v, element);
6209
+ });
6210
+ }, function (v) {
6211
+ before(v, element);
6212
+ });
6213
+ };
6214
+ var prepend = function (parent, element) {
6215
+ var firstChild$1 = firstChild(parent);
6216
+ firstChild$1.fold(function () {
6217
+ append(parent, element);
6218
+ }, function (v) {
6219
+ parent.dom().insertBefore(element.dom(), v.dom());
6220
+ });
6221
+ };
6222
+ var append = function (parent, element) {
6223
+ parent.dom().appendChild(element.dom());
6224
+ };
6225
+ var wrap$1 = function (element, wrapper) {
6226
+ before(element, wrapper);
6227
+ append(wrapper, element);
6228
+ };
6229
+
6230
+ var before$1 = function (marker, elements) {
6231
+ each(elements, function (x) {
6232
+ before(marker, x);
6233
+ });
6234
+ };
6235
+ var append$1 = function (parent, elements) {
6236
+ each(elements, function (x) {
6237
+ append(parent, x);
6238
+ });
6239
+ };
6240
+
6241
+ var empty = function (element) {
6242
+ element.dom().textContent = '';
6243
+ each(children(element), function (rogue) {
6244
+ remove$1(rogue);
6245
+ });
6246
+ };
6247
+ var remove$1 = function (element) {
6248
+ var dom = element.dom();
6249
+ if (dom.parentNode !== null) {
6250
+ dom.parentNode.removeChild(dom);
6251
+ }
6252
+ };
6253
+ var unwrap = function (wrapper) {
6254
+ var children$1 = children(wrapper);
6255
+ if (children$1.length > 0) {
6256
+ before$1(wrapper, children$1);
6257
+ }
6258
+ remove$1(wrapper);
6259
+ };
6260
+
6261
+ var r = function (left, top) {
6262
+ var translate = function (x, y) {
6263
+ return r(left + x, top + y);
6264
+ };
6265
+ return {
6266
+ left: constant(left),
6267
+ top: constant(top),
6268
+ translate: translate
6269
+ };
6270
+ };
6271
+ var Position$1 = r;
6272
+
6273
+ var boxPosition = function (dom) {
6274
+ var box = dom.getBoundingClientRect();
6275
+ return Position$1(box.left, box.top);
6276
+ };
6277
+ var firstDefinedOrZero = function (a, b) {
6278
+ return a !== undefined ? a : b !== undefined ? b : 0;
6279
+ };
6280
+ var absolute = function (element) {
6281
+ var doc = element.dom().ownerDocument;
6282
+ var body = doc.body;
6283
+ var win = doc.defaultView;
6284
+ var html = doc.documentElement;
6285
+ if (body === element.dom()) {
6286
+ return Position$1(body.offsetLeft, body.offsetTop);
6287
+ }
6288
+ var scrollTop = firstDefinedOrZero(win.pageYOffset, html.scrollTop);
6289
+ var scrollLeft = firstDefinedOrZero(win.pageXOffset, html.scrollLeft);
6290
+ var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop);
6291
+ var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft);
6292
+ return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop);
6293
+ };
6294
+ var viewport = function (element) {
6295
+ var dom = element.dom();
6296
+ var doc = dom.ownerDocument;
6297
+ var body = doc.body;
6298
+ if (body === dom) {
6299
+ return Position$1(body.offsetLeft, body.offsetTop);
6300
+ }
6301
+ if (!inBody(element)) {
6302
+ return Position$1(0, 0);
6303
+ }
6304
+ return boxPosition(dom);
6305
+ };
6306
+
6307
+ var isSafari = detect$3().browser.isSafari();
6308
+ var get$3 = function (_DOC) {
6309
+ var doc = _DOC !== undefined ? _DOC.dom() : domGlobals.document;
6310
+ var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;
6311
+ var y = doc.body.scrollTop || doc.documentElement.scrollTop;
6312
+ return Position$1(x, y);
6313
+ };
6314
+ var to = function (x, y, _DOC) {
6315
+ var doc = _DOC !== undefined ? _DOC.dom() : domGlobals.document;
6316
+ var win = doc.defaultView;
6317
+ win.scrollTo(x, y);
6318
+ };
6319
+ var intoView = function (element, alignToTop) {
6320
+ if (isSafari && isFunction(element.dom().scrollIntoViewIfNeeded)) {
6321
+ element.dom().scrollIntoViewIfNeeded(false);
6322
+ } else {
6323
+ element.dom().scrollIntoView(alignToTop);
6324
+ }
6325
+ };
6326
+
6327
+ var bounds = function (x, y, width, height) {
6328
+ return {
6329
+ x: constant(x),
6330
+ y: constant(y),
6331
+ width: constant(width),
6332
+ height: constant(height),
6333
+ right: constant(x + width),
6334
+ bottom: constant(y + height)
6335
+ };
6336
+ };
6337
+ var getBounds = function (_win) {
6338
+ var win = _win === undefined ? domGlobals.window : _win;
6339
+ var visualViewport = win['visualViewport'];
6340
+ if (visualViewport !== undefined) {
6341
+ return bounds(visualViewport.pageLeft, visualViewport.pageTop, visualViewport.width, visualViewport.height);
6342
+ } else {
6343
+ var doc = Element.fromDom(win.document);
6344
+ var html = win.document.documentElement;
6345
+ var scroll = get$3(doc);
6346
+ var width = html.clientWidth;
6347
+ var height = html.clientHeight;
6348
+ return bounds(scroll.left(), scroll.top(), width, height);
6349
+ }
6350
+ };
6351
+
6256
6352
  var each$5 = Tools.each;
6257
6353
  var grep$1 = Tools.grep;
6258
6354
  var isIE = Env.ie;
@@ -6441,14 +6537,12 @@
6441
6537
  return settings.root_element || doc.body;
6442
6538
  };
6443
6539
  var getViewPort = function (argWin) {
6444
- var actWin = !argWin ? win : argWin;
6445
- var doc = actWin.document;
6446
- var rootElm = doc.documentElement ;
6540
+ var vp = getBounds(argWin);
6447
6541
  return {
6448
- x: actWin.pageXOffset || rootElm.scrollLeft,
6449
- y: actWin.pageYOffset || rootElm.scrollTop,
6450
- w: actWin.innerWidth || rootElm.clientWidth,
6451
- h: actWin.innerHeight || rootElm.clientHeight
6542
+ x: vp.x(),
6543
+ y: vp.y(),
6544
+ w: vp.width(),
6545
+ h: vp.height()
6452
6546
  };
6453
6547
  };
6454
6548
  var getPos = function (elm, rootElm) {
@@ -6475,7 +6569,7 @@
6475
6569
  return b.toUpperCase();
6476
6570
  });
6477
6571
  if (name === 'float') {
6478
- name = Env.ie && Env.ie < 12 ? 'styleFloat' : 'cssFloat';
6572
+ name = Env.browser.isIE() ? 'styleFloat' : 'cssFloat';
6479
6573
  }
6480
6574
  return $elm[0] && $elm[0].style ? $elm[0].style[name] : undefined;
6481
6575
  };
@@ -7278,24 +7372,6 @@
7278
7372
  return ScriptLoader;
7279
7373
  }();
7280
7374
 
7281
- var Cell = function (initial) {
7282
- var value = initial;
7283
- var get = function () {
7284
- return value;
7285
- };
7286
- var set = function (v) {
7287
- value = v;
7288
- };
7289
- var clone = function () {
7290
- return Cell(get());
7291
- };
7292
- return {
7293
- get: get,
7294
- set: set,
7295
- clone: clone
7296
- };
7297
- };
7298
-
7299
7375
  var isRaw = function (str) {
7300
7376
  return isObject(str) && has(str, 'raw');
7301
7377
  };
@@ -7519,94 +7595,30 @@
7519
7595
  }(AddOnManager || (AddOnManager = {})));
7520
7596
  var AddOnManager$1 = AddOnManager;
7521
7597
 
7522
- var before = function (marker, element) {
7523
- var parent$1 = parent(marker);
7524
- parent$1.each(function (v) {
7525
- v.dom().insertBefore(element.dom(), marker.dom());
7526
- });
7527
- };
7528
- var after = function (marker, element) {
7529
- var sibling = nextSibling(marker);
7530
- sibling.fold(function () {
7531
- var parent$1 = parent(marker);
7532
- parent$1.each(function (v) {
7533
- append(v, element);
7534
- });
7535
- }, function (v) {
7536
- before(v, element);
7537
- });
7538
- };
7539
- var prepend = function (parent, element) {
7540
- var firstChild$1 = firstChild(parent);
7541
- firstChild$1.fold(function () {
7542
- append(parent, element);
7543
- }, function (v) {
7544
- parent.dom().insertBefore(element.dom(), v.dom());
7545
- });
7546
- };
7547
- var append = function (parent, element) {
7548
- parent.dom().appendChild(element.dom());
7549
- };
7550
- var wrap$1 = function (element, wrapper) {
7551
- before(element, wrapper);
7552
- append(wrapper, element);
7553
- };
7554
-
7555
- var before$1 = function (marker, elements) {
7556
- each(elements, function (x) {
7557
- before(marker, x);
7558
- });
7559
- };
7560
- var append$1 = function (parent, elements) {
7561
- each(elements, function (x) {
7562
- append(parent, x);
7563
- });
7564
- };
7565
-
7566
- var empty = function (element) {
7567
- element.dom().textContent = '';
7568
- each(children(element), function (rogue) {
7569
- remove$1(rogue);
7570
- });
7571
- };
7572
- var remove$1 = function (element) {
7573
- var dom = element.dom();
7574
- if (dom.parentNode !== null) {
7575
- dom.parentNode.removeChild(dom);
7576
- }
7577
- };
7578
- var unwrap = function (wrapper) {
7579
- var children$1 = children(wrapper);
7580
- if (children$1.length > 0) {
7581
- before$1(wrapper, children$1);
7582
- }
7583
- remove$1(wrapper);
7584
- };
7585
-
7586
- var first = function (fn, rate) {
7587
- var timer = null;
7588
- var cancel = function () {
7589
- if (timer !== null) {
7590
- domGlobals.clearTimeout(timer);
7591
- timer = null;
7592
- }
7593
- };
7594
- var throttle = function () {
7595
- var args = [];
7596
- for (var _i = 0; _i < arguments.length; _i++) {
7597
- args[_i] = arguments[_i];
7598
- }
7599
- if (timer === null) {
7600
- timer = domGlobals.setTimeout(function () {
7601
- fn.apply(null, args);
7602
- timer = null;
7603
- }, rate);
7604
- }
7605
- };
7606
- return {
7607
- cancel: cancel,
7608
- throttle: throttle
7609
- };
7598
+ var first = function (fn, rate) {
7599
+ var timer = null;
7600
+ var cancel = function () {
7601
+ if (timer !== null) {
7602
+ domGlobals.clearTimeout(timer);
7603
+ timer = null;
7604
+ }
7605
+ };
7606
+ var throttle = function () {
7607
+ var args = [];
7608
+ for (var _i = 0; _i < arguments.length; _i++) {
7609
+ args[_i] = arguments[_i];
7610
+ }
7611
+ if (timer === null) {
7612
+ timer = domGlobals.setTimeout(function () {
7613
+ fn.apply(null, args);
7614
+ timer = null;
7615
+ }, rate);
7616
+ }
7617
+ };
7618
+ return {
7619
+ cancel: cancel,
7620
+ throttle: throttle
7621
+ };
7610
7622
  };
7611
7623
  var last$2 = function (fn, rate) {
7612
7624
  var timer = null;
@@ -7660,7 +7672,7 @@
7660
7672
  var supports = function (element) {
7661
7673
  return element.dom().classList !== undefined;
7662
7674
  };
7663
- var get$3 = function (element) {
7675
+ var get$4 = function (element) {
7664
7676
  return read(element, 'class');
7665
7677
  };
7666
7678
  var add$2 = function (element, clazz) {
@@ -7678,7 +7690,7 @@
7678
7690
  }
7679
7691
  };
7680
7692
  var cleanClass = function (element) {
7681
- var classList = supports(element) ? element.dom().classList : get$3(element);
7693
+ var classList = supports(element) ? element.dom().classList : get$4(element);
7682
7694
  if (classList.length === 0) {
7683
7695
  remove(element, 'class');
7684
7696
  }
@@ -7954,7 +7966,7 @@
7954
7966
  return children(Element.fromDom(div));
7955
7967
  };
7956
7968
 
7957
- var get$4 = function (element) {
7969
+ var get$5 = function (element) {
7958
7970
  return element.dom().innerHTML;
7959
7971
  };
7960
7972
  var set$1 = function (element, content) {
@@ -8991,7 +9003,7 @@
8991
9003
  remove: remove$5
8992
9004
  };
8993
9005
 
8994
- var browser$2 = PlatformDetection$1.detect().browser;
9006
+ var browser$3 = detect$3().browser;
8995
9007
  var isContentEditableFalse$3 = NodeType.isContentEditableFalse;
8996
9008
  var isTableCell$1 = function (node) {
8997
9009
  return NodeType.isElement(node) && /^(TD|TH)$/i.test(node.tagName);
@@ -9132,7 +9144,7 @@
9132
9144
  };
9133
9145
  };
9134
9146
  var isFakeCaretTableBrowser = function () {
9135
- return browser$2.isIE() || browser$2.isEdge() || browser$2.isFirefox();
9147
+ return browser$3.isIE() || browser$3.isEdge() || browser$3.isFirefox();
9136
9148
  };
9137
9149
  var isFakeCaretTarget = function (node) {
9138
9150
  return isContentEditableFalse$3(node) || NodeType.isTable(node) && isFakeCaretTableBrowser();
@@ -10357,12 +10369,12 @@
10357
10369
  }
10358
10370
 
10359
10371
  var api = NodeValue(isText$1, 'text');
10360
- var get$5 = function (element) {
10372
+ var get$6 = function (element) {
10361
10373
  return api.get(element);
10362
10374
  };
10363
10375
 
10364
10376
  var isZeroWidth = function (elem) {
10365
- return isText$1(elem) && get$5(elem) === zeroWidth();
10377
+ return isText$1(elem) && get$6(elem) === zeroWidth();
10366
10378
  };
10367
10379
  var context = function (editor, elem, wrapName, nodeName) {
10368
10380
  return parent(elem).fold(function () {
@@ -11752,9 +11764,9 @@
11752
11764
  range: range
11753
11765
  };
11754
11766
 
11755
- var browser$3 = PlatformDetection$1.detect().browser;
11767
+ var browser$4 = detect$3().browser;
11756
11768
  var clamp = function (offset, element) {
11757
- var max = isText$1(element) ? get$5(element).length : children(element).length + 1;
11769
+ var max = isText$1(element) ? get$6(element).length : children(element).length + 1;
11758
11770
  if (offset > max) {
11759
11771
  return max;
11760
11772
  } else if (offset < 0) {
@@ -11774,7 +11786,7 @@
11774
11786
  };
11775
11787
  };
11776
11788
  var shouldStore = function (editor) {
11777
- return editor.inline === true || browser$3.isIE();
11789
+ return editor.inline === true || browser$4.isIE();
11778
11790
  };
11779
11791
  var nativeRangeToSelectionRange = function (r) {
11780
11792
  return Selection.range(Element.fromDom(r.startContainer), r.startOffset, Element.fromDom(r.endContainer), r.endOffset);
@@ -11861,7 +11873,7 @@
11861
11873
  });
11862
11874
  };
11863
11875
  var registerEditorEvents = function (editor, throttledStore) {
11864
- var browser = PlatformDetection$1.detect().browser;
11876
+ var browser = detect$3().browser;
11865
11877
  if (browser.isIE()) {
11866
11878
  registerFocusOut(editor);
11867
11879
  } else {
@@ -12305,15 +12317,19 @@
12305
12317
  var merge = baseMerge(shallow$1);
12306
12318
 
12307
12319
  var sectionResult = Immutable('sections', 'settings');
12308
- var detection = PlatformDetection$1.detect();
12309
- var isTouch = detection.deviceType.isTouch();
12310
- var isPhone = detection.deviceType.isPhone();
12311
- var mobilePlugins = [
12320
+ var deviceDetection = detect$3().deviceType;
12321
+ var isTouch = deviceDetection.isTouch();
12322
+ var isPhone = deviceDetection.isPhone();
12323
+ var legacyMobilePlugins = [
12312
12324
  'lists',
12313
12325
  'autolink',
12314
12326
  'autosave'
12315
12327
  ];
12316
- var defaultMobileSettings = { theme: 'mobile' };
12328
+ var defaultTouchSettings = {
12329
+ table_grid: false,
12330
+ object_resizing: false,
12331
+ resize: false
12332
+ };
12317
12333
  var normalizePlugins = function (plugins) {
12318
12334
  var pluginNames = isArray(plugins) ? plugins.join(' ') : plugins;
12319
12335
  var trimmedPlugins = map(isString(pluginNames) ? pluginNames.split(' ') : [], trim);
@@ -12321,8 +12337,8 @@
12321
12337
  return item.length > 0;
12322
12338
  });
12323
12339
  };
12324
- var filterMobilePlugins = function (plugins) {
12325
- return filter(plugins, curry(contains, mobilePlugins));
12340
+ var filterLegacyMobilePlugins = function (plugins) {
12341
+ return filter(plugins, curry(contains, legacyMobilePlugins));
12326
12342
  };
12327
12343
  var extractSections = function (keys, settings) {
12328
12344
  var result = bifilter(settings, function (value, key) {
@@ -12348,10 +12364,11 @@
12348
12364
  var getSectionConfig = function (sectionResult, name) {
12349
12365
  return hasSection(sectionResult, name) ? sectionResult.sections()[name] : {};
12350
12366
  };
12351
- var getDefaultSettings = function (id, documentBaseUrl, editor) {
12352
- return {
12367
+ var getDefaultSettings = function (id, documentBaseUrl, isTouch, editor) {
12368
+ var baseDefaults = {
12353
12369
  id: id,
12354
12370
  theme: 'silver',
12371
+ toolbar_drawer: 'floating',
12355
12372
  plugins: '',
12356
12373
  document_base_url: documentBaseUrl,
12357
12374
  add_form_submit_trigger: true,
@@ -12375,6 +12392,16 @@
12375
12392
  url_converter: editor.convertURL,
12376
12393
  url_converter_scope: editor
12377
12394
  };
12395
+ return __assign(__assign({}, baseDefaults), isTouch ? defaultTouchSettings : {});
12396
+ };
12397
+ var getDefaultMobileSettings = function (isPhone) {
12398
+ var defaultMobileSettings = {
12399
+ resize: false,
12400
+ toolbar_drawer: false,
12401
+ toolbar_sticky: false
12402
+ };
12403
+ var defaultPhoneSettings = { menubar: false };
12404
+ return __assign(__assign(__assign({}, defaultTouchSettings), defaultMobileSettings), isPhone ? defaultPhoneSettings : {});
12378
12405
  };
12379
12406
  var getExternalPlugins = function (overrideSettings, settings) {
12380
12407
  var userDefinedExternalPlugins = settings.external_plugins ? settings.external_plugins : {};
@@ -12392,16 +12419,15 @@
12392
12419
  var desktopPlugins = normalizePlugins(settings.plugins);
12393
12420
  var mobileConfig = getSectionConfig(sectionResult, 'mobile');
12394
12421
  var mobilePlugins = mobileConfig.plugins ? normalizePlugins(mobileConfig.plugins) : desktopPlugins;
12395
- var platformPlugins = isTouchDevice && isSectionTheme(sectionResult, 'mobile', 'mobile') ? filterMobilePlugins(mobilePlugins) : isTouchDevice && hasSection(sectionResult, 'mobile') ? mobilePlugins : desktopPlugins;
12422
+ var platformPlugins = isTouchDevice && isSectionTheme(sectionResult, 'mobile', 'mobile') ? filterLegacyMobilePlugins(mobilePlugins) : isTouchDevice && hasSection(sectionResult, 'mobile') ? mobilePlugins : desktopPlugins;
12396
12423
  var combinedPlugins = combinePlugins(forcedPlugins, platformPlugins);
12397
12424
  return Tools.extend(settings, { plugins: combinedPlugins.join(' ') });
12398
12425
  };
12399
12426
  var isOnMobile = function (isTouchDevice, sectionResult) {
12400
- var isInline = sectionResult.settings().inline;
12401
- return isTouchDevice && hasSection(sectionResult, 'mobile') && !isInline;
12427
+ return isTouchDevice && hasSection(sectionResult, 'mobile');
12402
12428
  };
12403
12429
  var combineSettings = function (isTouchDevice, isPhone, defaultSettings, defaultOverrideSettings, settings) {
12404
- var defaultDeviceSettings = isPhone ? { mobile: defaultMobileSettings } : {};
12430
+ var defaultDeviceSettings = isTouchDevice ? { mobile: getDefaultMobileSettings(isPhone) } : {};
12405
12431
  var sectionResult = extractSections(['mobile'], deepMerge(defaultDeviceSettings, settings));
12406
12432
  var extendedSettings = Tools.extend(defaultSettings, defaultOverrideSettings, sectionResult.settings(), isOnMobile(isTouchDevice, sectionResult) ? getSection(sectionResult, 'mobile') : {}, {
12407
12433
  validate: true,
@@ -12410,7 +12436,7 @@
12410
12436
  return processPlugins(isTouchDevice, sectionResult, defaultOverrideSettings, extendedSettings);
12411
12437
  };
12412
12438
  var getEditorSettings = function (editor, id, documentBaseUrl, defaultOverrideSettings, settings) {
12413
- var defaultSettings = getDefaultSettings(id, documentBaseUrl, editor);
12439
+ var defaultSettings = getDefaultSettings(id, documentBaseUrl, isTouch, editor);
12414
12440
  return combineSettings(isTouch, isPhone, defaultSettings, defaultOverrideSettings, settings);
12415
12441
  };
12416
12442
  var getFiltered = function (predicate, editor, name) {
@@ -12582,7 +12608,7 @@
12582
12608
  if (serviceMessage) {
12583
12609
  open({
12584
12610
  text: serviceMessage,
12585
- type: 'warn',
12611
+ type: 'warning',
12586
12612
  timeout: 0
12587
12613
  });
12588
12614
  }
@@ -12858,7 +12884,6 @@
12858
12884
  'orientation': '<svg width="24" height="24"><path d="M7.3 6.4L1 13l6.4 6.5 6.5-6.5-6.5-6.5zM3.7 13l3.6-3.7L11 13l-3.7 3.7-3.6-3.7zM12 6l2.8 2.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0L9.2 5.7a.8.8 0 0 1 0-1.2L13.6.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L12 4h1a9 9 0 1 1-4.3 16.9l1.5-1.5A7 7 0 1 0 13 6h-1z" fill-rule="nonzero"/></svg>',
12859
12885
  'outdent': '<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 1 1 0-2zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 0 1 0-2zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 0 1 0-2zm-5 4h12a1 1 0 0 1 0 2H7a1 1 0 0 1 0-2zm1.6-3.8a1 1 0 0 1-1.2 1.6l-3-2a1 1 0 0 1 0-1.6l3-2a1 1 0 0 1 1.2 1.6L6.8 12l1.8 1.2z" fill-rule="evenodd"/></svg>',
12860
12886
  'page-break': '<svg width="24" height="24"><g fill-rule="evenodd"><path d="M5 11c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2zm3 0h1c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2zm4 0c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2zm3 0h1c.6 0 1 .4 1 1s-.4 1-1 1h-1a1 1 0 0 1 0-2zm4 0c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2zM7 3v5h10V3c0-.6.4-1 1-1s1 .4 1 1v7H5V3c0-.6.4-1 1-1s1 .4 1 1zM6 22a1 1 0 0 1-1-1v-7h14v7c0 .6-.4 1-1 1a1 1 0 0 1-1-1v-5H7v5c0 .6-.4 1-1 1z"/></g></svg>',
12861
- 'paragraph': '<svg width="24" height="24"><path d="M10 5h7a1 1 0 0 1 0 2h-1v11a1 1 0 0 1-2 0V7h-2v11a1 1 0 0 1-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 6.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L10 5z" fill-rule="evenodd"/></svg>',
12862
12887
  'paste-text': '<svg width="24" height="24"><path d="M18 9V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h3V9h9zM9 20H6a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.2A3 3 0 0 1 12 1a3 3 0 0 1 2.8 2H18a2 2 0 0 1 2 2v4h1v12H9v-1zm1.5-9.5v9h9v-9h-9zM12 3a1 1 0 0 0-1 1c0 .5.4 1 1 1s1-.5 1-1-.4-1-1-1zm0 9h6v2h-.5l-.5-1h-1v4h.8v1h-3.6v-1h.8v-4h-1l-.5 1H12v-2z" fill-rule="nonzero"/></svg>',
12863
12888
  'paste': '<svg width="24" height="24"><path d="M18 9V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h3V9h9zM9 20H6a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.2A3 3 0 0 1 12 1a3 3 0 0 1 2.8 2H18a2 2 0 0 1 2 2v4h1v12H9v-1zm1.5-9.5v9h9v-9h-9zM12 3a1 1 0 0 0-1 1c0 .5.4 1 1 1s1-.5 1-1-.4-1-1-1z" fill-rule="nonzero"/></svg>',
12864
12889
  'permanent-pen': '<svg width="24" height="24"><path d="M10.5 17.5L8 20H3v-3l3.5-3.5a2 2 0 0 1 0-3L14 3l1 1-7.3 7.3a1 1 0 0 0 0 1.4l3.6 3.6c.4.4 1 .4 1.4 0L20 9l1 1-7.6 7.6a2 2 0 0 1-2.8 0l-.1-.1z" fill-rule="nonzero"/></svg>',
@@ -12917,6 +12942,8 @@
12917
12942
  'unselected': '<svg width="24" height="24"><path fill-rule="nonzero" d="M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2zm0 1a1 1 0 0 0-1 1v12c0 .6.4 1 1 1h12c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H6z"/></svg>',
12918
12943
  'upload': '<svg width="24" height="24"><path d="M18 19v-2a1 1 0 0 1 2 0v3c0 .6-.4 1-1 1H5a1 1 0 0 1-1-1v-3a1 1 0 0 1 2 0v2h12zM11 6.4L8.7 8.7a1 1 0 0 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 1 1-1.4 1.4L13 6.4V16a1 1 0 0 1-2 0V6.4z" fill-rule="nonzero"/></svg>',
12919
12944
  'user': '<svg width="24" height="24"><path d="M12 24a12 12 0 1 1 0-24 12 12 0 0 1 0 24zm-8.7-5.3a11 11 0 0 0 17.4 0C19.4 16.3 14.6 15 12 15c-2.6 0-7.4 1.3-8.7 3.7zM12 13c2.2 0 4-2 4-4.5S14.2 4 12 4 8 6 8 8.5 9.8 13 12 13z" fill-rule="nonzero"/></svg>',
12945
+ 'visualblocks': '<svg width="24" height="24"><path d="M9 19v2H7v-2h2zm-4 0v2a2 2 0 0 1-2-2h2zm8 0v2h-2v-2h2zm8 0a2 2 0 0 1-2 2v-2h2zm-4 0v2h-2v-2h2zM15 7a1 1 0 0 1 0 2v7a1 1 0 0 1-2 0V9h-1v7a1 1 0 0 1-2 0v-4a2.5 2.5 0 0 1-.2-5H15zM5 15v2H3v-2h2zm16 0v2h-2v-2h2zM5 11v2H3v-2h2zm16 0v2h-2v-2h2zM5 7v2H3V7h2zm16 0v2h-2V7h2zM5 3v2H3c0-1.1.9-2 2-2zm8 0v2h-2V3h2zm6 0a2 2 0 0 1 2 2h-2V3zM9 3v2H7V3h2zm8 0v2h-2V3h2z" fill-rule="evenodd"/></svg>',
12946
+ 'visualchars': '<svg width="24" height="24"><path d="M10 5h7a1 1 0 0 1 0 2h-1v11a1 1 0 0 1-2 0V7h-2v11a1 1 0 0 1-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 6.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L10 5z" fill-rule="evenodd"/></svg>',
12920
12947
  'warning': '<svg width="24" height="24"><path d="M19.8 18.3c.2.5.3.9 0 1.2-.1.3-.5.5-1 .5H5.2c-.5 0-.9-.2-1-.5-.3-.3-.2-.7 0-1.2L11 4.7l.5-.5.5-.2c.2 0 .3 0 .5.2.2 0 .3.3.5.5l6.8 13.6zM12 18c.3 0 .5-.1.7-.3.2-.2.3-.4.3-.7a1 1 0 0 0-.3-.7 1 1 0 0 0-.7-.3 1 1 0 0 0-.7.3 1 1 0 0 0-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3zm.7-3l.3-4a1 1 0 0 0-.3-.7 1 1 0 0 0-.7-.3 1 1 0 0 0-.7.3 1 1 0 0 0-.3.7l.3 4h1.4z" fill-rule="evenodd"/></svg>',
12921
12948
  'zoom-in': '<svg width="24" height="24"><path d="M16 17.3a8 8 0 1 1 1.4-1.4l4.3 4.4a1 1 0 0 1-1.4 1.4l-4.4-4.3zm-5-.3a6 6 0 1 0 0-12 6 6 0 0 0 0 12zm-1-9a1 1 0 0 1 2 0v6a1 1 0 0 1-2 0V8zm-2 4a1 1 0 0 1 0-2h6a1 1 0 0 1 0 2H8z" fill-rule="nonzero"/></svg>',
12922
12949
  'zoom-out': '<svg width="24" height="24"><path d="M16 17.3a8 8 0 1 1 1.4-1.4l4.3 4.4a1 1 0 0 1-1.4 1.4l-4.4-4.3zm-5-.3a6 6 0 1 0 0-12 6 6 0 0 0 0 12zm-3-5a1 1 0 0 1 0-2h6a1 1 0 0 1 0 2H8z" fill-rule="nonzero"/></svg>'
@@ -13790,14 +13817,6 @@
13790
13817
  }
13791
13818
  return;
13792
13819
  }
13793
- if (Env.ie && Env.ie < 11 && dom.isBlock(node) && dom.isEmpty(node)) {
13794
- if (start) {
13795
- rng.setStart(node, 0);
13796
- } else {
13797
- rng.setEnd(node, 0);
13798
- }
13799
- return;
13800
- }
13801
13820
  } while (node = start ? walker.next() : walker.prev());
13802
13821
  if (root.nodeName === 'BODY') {
13803
13822
  if (start) {
@@ -13900,285 +13919,85 @@
13900
13919
  return NodeChange;
13901
13920
  }();
13902
13921
 
13903
- var getAbsolutePosition = function (elm) {
13904
- var doc, docElem, win, clientRect;
13905
- clientRect = elm.getBoundingClientRect();
13906
- doc = elm.ownerDocument;
13907
- docElem = doc.documentElement;
13908
- win = doc.defaultView;
13909
- return {
13910
- top: clientRect.top + win.pageYOffset - docElem.clientTop,
13911
- left: clientRect.left + win.pageXOffset - docElem.clientLeft
13912
- };
13922
+ var VK = {
13923
+ BACKSPACE: 8,
13924
+ DELETE: 46,
13925
+ DOWN: 40,
13926
+ ENTER: 13,
13927
+ LEFT: 37,
13928
+ RIGHT: 39,
13929
+ SPACEBAR: 32,
13930
+ TAB: 9,
13931
+ UP: 38,
13932
+ END: 35,
13933
+ HOME: 36,
13934
+ modifierPressed: function (e) {
13935
+ return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);
13936
+ },
13937
+ metaKeyPressed: function (e) {
13938
+ return Env.mac ? e.metaKey : e.ctrlKey && !e.altKey;
13939
+ }
13913
13940
  };
13914
- var getBodyPosition = function (editor) {
13915
- return editor.inline ? getAbsolutePosition(editor.getBody()) : {
13916
- left: 0,
13917
- top: 0
13941
+
13942
+ var is$2 = function (expected) {
13943
+ return function (actual) {
13944
+ return expected === actual;
13918
13945
  };
13919
13946
  };
13920
- var getScrollPosition = function (editor) {
13921
- var body = editor.getBody();
13922
- return editor.inline ? {
13923
- left: body.scrollLeft,
13924
- top: body.scrollTop
13925
- } : {
13926
- left: 0,
13927
- top: 0
13928
- };
13947
+ var isNbsp = is$2('\xA0');
13948
+ var isWhiteSpace$1 = function (chr) {
13949
+ return /^[\r\n\t ]$/.test(chr);
13929
13950
  };
13930
- var getBodyScroll = function (editor) {
13931
- var body = editor.getBody(), docElm = editor.getDoc().documentElement;
13932
- var inlineScroll = {
13933
- left: body.scrollLeft,
13934
- top: body.scrollTop
13935
- };
13936
- var iframeScroll = {
13937
- left: body.scrollLeft || docElm.scrollLeft,
13938
- top: body.scrollTop || docElm.scrollTop
13939
- };
13940
- return editor.inline ? inlineScroll : iframeScroll;
13951
+ var isContent = function (chr) {
13952
+ return !isWhiteSpace$1(chr) && !isNbsp(chr);
13941
13953
  };
13942
- var getMousePosition = function (editor, event) {
13943
- if (event.target.ownerDocument !== editor.getDoc()) {
13944
- var iframePosition = getAbsolutePosition(editor.getContentAreaContainer());
13945
- var scrollPosition = getBodyScroll(editor);
13946
- return {
13947
- left: event.pageX - iframePosition.left + scrollPosition.left,
13948
- top: event.pageY - iframePosition.top + scrollPosition.top
13949
- };
13950
- }
13951
- return {
13952
- left: event.pageX,
13953
- top: event.pageY
13954
- };
13954
+
13955
+ var isChar = function (forward, predicate, pos) {
13956
+ return Option.from(pos.container()).filter(NodeType.isText).exists(function (text) {
13957
+ var delta = forward ? 0 : -1;
13958
+ return predicate(text.data.charAt(pos.offset() + delta));
13959
+ });
13955
13960
  };
13956
- var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) {
13957
- return {
13958
- pageX: mousePosition.left - bodyPosition.left + scrollPosition.left,
13959
- pageY: mousePosition.top - bodyPosition.top + scrollPosition.top
13961
+ var isBeforeSpace = curry(isChar, true, isWhiteSpace$1);
13962
+ var isAfterSpace = curry(isChar, false, isWhiteSpace$1);
13963
+ var isEmptyText = function (pos) {
13964
+ var container = pos.container();
13965
+ return NodeType.isText(container) && container.data.length === 0;
13966
+ };
13967
+ var matchesElementPosition = function (before, predicate) {
13968
+ return function (pos) {
13969
+ return Option.from(getChildNodeAtRelativeOffset(before ? 0 : -1, pos)).filter(predicate).isSome();
13960
13970
  };
13961
13971
  };
13962
- var calc = function (editor, event) {
13963
- return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));
13972
+ var isImageBlock = function (node) {
13973
+ return node.nodeName === 'IMG' && get$2(Element.fromDom(node), 'display') === 'block';
13964
13974
  };
13965
- var MousePosition = { calc: calc };
13966
-
13967
- var isContentEditableFalse$6 = NodeType.isContentEditableFalse, isContentEditableTrue$2 = NodeType.isContentEditableTrue;
13968
- var isDraggable = function (rootElm, elm) {
13969
- return isContentEditableFalse$6(elm) && elm !== rootElm;
13975
+ var isCefNode = function (node) {
13976
+ return NodeType.isContentEditableFalse(node) && !NodeType.isBogusAll(node);
13970
13977
  };
13971
- var isValidDropTarget = function (editor, targetElement, dragElement) {
13972
- if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) {
13973
- return false;
13978
+ var isBeforeImageBlock = matchesElementPosition(true, isImageBlock);
13979
+ var isAfterImageBlock = matchesElementPosition(false, isImageBlock);
13980
+ var isBeforeTable = matchesElementPosition(true, NodeType.isTable);
13981
+ var isAfterTable = matchesElementPosition(false, NodeType.isTable);
13982
+ var isBeforeContentEditableFalse = matchesElementPosition(true, isCefNode);
13983
+ var isAfterContentEditableFalse = matchesElementPosition(false, isCefNode);
13984
+
13985
+ var getNodeClientRects = function (node) {
13986
+ var toArrayWithNode = function (clientRects) {
13987
+ return map(clientRects, function (clientRect) {
13988
+ clientRect = clone$1(clientRect);
13989
+ clientRect.node = node;
13990
+ return clientRect;
13991
+ });
13992
+ };
13993
+ if (NodeType.isElement(node)) {
13994
+ return toArrayWithNode(node.getClientRects());
13974
13995
  }
13975
- return !isContentEditableFalse$6(targetElement);
13976
- };
13977
- var cloneElement = function (elm) {
13978
- var cloneElm = elm.cloneNode(true);
13979
- cloneElm.removeAttribute('data-mce-selected');
13980
- return cloneElm;
13981
- };
13982
- var createGhost = function (editor, elm, width, height) {
13983
- var clonedElm = elm.cloneNode(true);
13984
- editor.dom.setStyles(clonedElm, {
13985
- width: width,
13986
- height: height
13987
- });
13988
- editor.dom.setAttrib(clonedElm, 'data-mce-selected', null);
13989
- var ghostElm = editor.dom.create('div', {
13990
- 'class': 'mce-drag-container',
13991
- 'data-mce-bogus': 'all',
13992
- 'unselectable': 'on',
13993
- 'contenteditable': 'false'
13994
- });
13995
- editor.dom.setStyles(ghostElm, {
13996
- position: 'absolute',
13997
- opacity: 0.5,
13998
- overflow: 'hidden',
13999
- border: 0,
14000
- padding: 0,
14001
- margin: 0,
14002
- width: width,
14003
- height: height
14004
- });
14005
- editor.dom.setStyles(clonedElm, {
14006
- margin: 0,
14007
- boxSizing: 'border-box'
14008
- });
14009
- ghostElm.appendChild(clonedElm);
14010
- return ghostElm;
14011
- };
14012
- var appendGhostToBody = function (ghostElm, bodyElm) {
14013
- if (ghostElm.parentNode !== bodyElm) {
14014
- bodyElm.appendChild(ghostElm);
14015
- }
14016
- };
14017
- var moveGhost = function (ghostElm, position, width, height, maxX, maxY) {
14018
- var overflowX = 0, overflowY = 0;
14019
- ghostElm.style.left = position.pageX + 'px';
14020
- ghostElm.style.top = position.pageY + 'px';
14021
- if (position.pageX + width > maxX) {
14022
- overflowX = position.pageX + width - maxX;
14023
- }
14024
- if (position.pageY + height > maxY) {
14025
- overflowY = position.pageY + height - maxY;
14026
- }
14027
- ghostElm.style.width = width - overflowX + 'px';
14028
- ghostElm.style.height = height - overflowY + 'px';
14029
- };
14030
- var removeElement = function (elm) {
14031
- if (elm && elm.parentNode) {
14032
- elm.parentNode.removeChild(elm);
14033
- }
14034
- };
14035
- var isLeftMouseButtonPressed = function (e) {
14036
- return e.button === 0;
14037
- };
14038
- var hasDraggableElement = function (state) {
14039
- return state.element;
14040
- };
14041
- var applyRelPos = function (state, position) {
14042
- return {
14043
- pageX: position.pageX - state.relX,
14044
- pageY: position.pageY + 5
14045
- };
14046
- };
14047
- var start = function (state, editor) {
14048
- return function (e) {
14049
- if (isLeftMouseButtonPressed(e)) {
14050
- var ceElm = find(editor.dom.getParents(e.target), Predicate.or(isContentEditableFalse$6, isContentEditableTrue$2)).getOr(null);
14051
- if (isDraggable(editor.getBody(), ceElm)) {
14052
- var elmPos = editor.dom.getPos(ceElm);
14053
- var bodyElm = editor.getBody();
14054
- var docElm = editor.getDoc().documentElement;
14055
- state.element = ceElm;
14056
- state.screenX = e.screenX;
14057
- state.screenY = e.screenY;
14058
- state.maxX = (editor.inline ? bodyElm.scrollWidth : docElm.offsetWidth) - 2;
14059
- state.maxY = (editor.inline ? bodyElm.scrollHeight : docElm.offsetHeight) - 2;
14060
- state.relX = e.pageX - elmPos.x;
14061
- state.relY = e.pageY - elmPos.y;
14062
- state.width = ceElm.offsetWidth;
14063
- state.height = ceElm.offsetHeight;
14064
- state.ghost = createGhost(editor, ceElm, state.width, state.height);
14065
- }
14066
- }
14067
- };
14068
- };
14069
- var move = function (state, editor) {
14070
- var throttledPlaceCaretAt = Delay.throttle(function (clientX, clientY) {
14071
- editor._selectionOverrides.hideFakeCaret();
14072
- editor.selection.placeCaretAt(clientX, clientY);
14073
- }, 0);
14074
- return function (e) {
14075
- var movement = Math.max(Math.abs(e.screenX - state.screenX), Math.abs(e.screenY - state.screenY));
14076
- if (hasDraggableElement(state) && !state.dragging && movement > 10) {
14077
- var args = editor.fire('dragstart', { target: state.element });
14078
- if (args.isDefaultPrevented()) {
14079
- return;
14080
- }
14081
- state.dragging = true;
14082
- editor.focus();
14083
- }
14084
- if (state.dragging) {
14085
- var targetPos = applyRelPos(state, MousePosition.calc(editor, e));
14086
- appendGhostToBody(state.ghost, editor.getBody());
14087
- moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY);
14088
- throttledPlaceCaretAt(e.clientX, e.clientY);
14089
- }
14090
- };
14091
- };
14092
- var getRawTarget = function (selection) {
14093
- var rng = selection.getSel().getRangeAt(0);
14094
- var startContainer = rng.startContainer;
14095
- return startContainer.nodeType === 3 ? startContainer.parentNode : startContainer;
14096
- };
14097
- var drop = function (state, editor) {
14098
- return function (e) {
14099
- if (state.dragging) {
14100
- if (isValidDropTarget(editor, getRawTarget(editor.selection), state.element)) {
14101
- var targetClone_1 = cloneElement(state.element);
14102
- var args = editor.fire('drop', {
14103
- targetClone: targetClone_1,
14104
- clientX: e.clientX,
14105
- clientY: e.clientY
14106
- });
14107
- if (!args.isDefaultPrevented()) {
14108
- targetClone_1 = args.targetClone;
14109
- editor.undoManager.transact(function () {
14110
- removeElement(state.element);
14111
- editor.insertContent(editor.dom.getOuterHTML(targetClone_1));
14112
- editor._selectionOverrides.hideFakeCaret();
14113
- });
14114
- }
14115
- }
14116
- }
14117
- removeDragState(state);
14118
- };
14119
- };
14120
- var stop = function (state, editor) {
14121
- return function () {
14122
- if (state.dragging) {
14123
- editor.fire('dragend');
14124
- }
14125
- removeDragState(state);
14126
- };
14127
- };
14128
- var removeDragState = function (state) {
14129
- state.dragging = false;
14130
- state.element = null;
14131
- removeElement(state.ghost);
14132
- };
14133
- var bindFakeDragEvents = function (editor) {
14134
- var state = {};
14135
- var pageDom, dragStartHandler, dragHandler, dropHandler, dragEndHandler, rootDocument;
14136
- pageDom = DOMUtils$1.DOM;
14137
- rootDocument = domGlobals.document;
14138
- dragStartHandler = start(state, editor);
14139
- dragHandler = move(state, editor);
14140
- dropHandler = drop(state, editor);
14141
- dragEndHandler = stop(state, editor);
14142
- editor.on('mousedown', dragStartHandler);
14143
- editor.on('mousemove', dragHandler);
14144
- editor.on('mouseup', dropHandler);
14145
- pageDom.bind(rootDocument, 'mousemove', dragHandler);
14146
- pageDom.bind(rootDocument, 'mouseup', dragEndHandler);
14147
- editor.on('remove', function () {
14148
- pageDom.unbind(rootDocument, 'mousemove', dragHandler);
14149
- pageDom.unbind(rootDocument, 'mouseup', dragEndHandler);
14150
- });
14151
- };
14152
- var blockIeDrop = function (editor) {
14153
- editor.on('drop', function (e) {
14154
- var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null;
14155
- if (isContentEditableFalse$6(realTarget) || isContentEditableFalse$6(editor.dom.getContentEditableParent(realTarget))) {
14156
- e.preventDefault();
14157
- }
14158
- });
14159
- };
14160
- var init = function (editor) {
14161
- bindFakeDragEvents(editor);
14162
- blockIeDrop(editor);
14163
- };
14164
- var DragDropOverrides = { init: init };
14165
-
14166
- var getNodeClientRects = function (node) {
14167
- var toArrayWithNode = function (clientRects) {
14168
- return map(clientRects, function (clientRect) {
14169
- clientRect = clone$1(clientRect);
14170
- clientRect.node = node;
14171
- return clientRect;
14172
- });
14173
- };
14174
- if (NodeType.isElement(node)) {
14175
- return toArrayWithNode(node.getClientRects());
14176
- }
14177
- if (NodeType.isText(node)) {
14178
- var rng = node.ownerDocument.createRange();
14179
- rng.setStart(node, 0);
14180
- rng.setEnd(node, node.data.length);
14181
- return toArrayWithNode(rng.getClientRects());
13996
+ if (NodeType.isText(node)) {
13997
+ var rng = node.ownerDocument.createRange();
13998
+ rng.setStart(node, 0);
13999
+ rng.setEnd(node, node.data.length);
14000
+ return toArrayWithNode(rng.getClientRects());
14182
14001
  }
14183
14002
  };
14184
14003
  var getClientRects = function (node) {
@@ -14296,7 +14115,7 @@
14296
14115
  };
14297
14116
  };
14298
14117
 
14299
- var isContentEditableFalse$7 = NodeType.isContentEditableFalse;
14118
+ var isContentEditableFalse$6 = NodeType.isContentEditableFalse;
14300
14119
  var findNode$1 = findNode;
14301
14120
  var distanceToRectLeft = function (clientRect, clientX) {
14302
14121
  return Math.abs(clientRect.left - clientX);
@@ -14318,7 +14137,7 @@
14318
14137
  if (isInside(clientX, oldClientRect)) {
14319
14138
  return oldClientRect;
14320
14139
  }
14321
- if (newDistance === oldDistance && isContentEditableFalse$7(clientRect.node)) {
14140
+ if (newDistance === oldDistance && isContentEditableFalse$6(clientRect.node)) {
14322
14141
  return clientRect;
14323
14142
  }
14324
14143
  if (newDistance < oldDistance) {
@@ -14373,24 +14192,287 @@
14373
14192
  }
14374
14193
  return null;
14375
14194
  };
14376
-
14377
- var isXYWithinRange = function (clientX, clientY, range) {
14378
- if (range.collapsed) {
14379
- return false;
14380
- }
14381
- if (Env.ie && Env.ie <= 11 && range.startOffset === range.endOffset - 1 && range.startContainer === range.endContainer) {
14382
- var elm = range.startContainer.childNodes[range.startOffset];
14383
- if (NodeType.isElement(elm)) {
14384
- return exists(elm.getClientRects(), function (rect) {
14385
- return containsXY(rect, clientX, clientY);
14386
- });
14195
+
14196
+ var isXYWithinRange = function (clientX, clientY, range) {
14197
+ if (range.collapsed) {
14198
+ return false;
14199
+ }
14200
+ if (Env.browser.isIE() && range.startOffset === range.endOffset - 1 && range.startContainer === range.endContainer) {
14201
+ var elm = range.startContainer.childNodes[range.startOffset];
14202
+ if (NodeType.isElement(elm)) {
14203
+ return exists(elm.getClientRects(), function (rect) {
14204
+ return containsXY(rect, clientX, clientY);
14205
+ });
14206
+ }
14207
+ }
14208
+ return exists(range.getClientRects(), function (rect) {
14209
+ return containsXY(rect, clientX, clientY);
14210
+ });
14211
+ };
14212
+ var RangePoint = { isXYWithinRange: isXYWithinRange };
14213
+
14214
+ var getAbsolutePosition = function (elm) {
14215
+ var doc, docElem, win, clientRect;
14216
+ clientRect = elm.getBoundingClientRect();
14217
+ doc = elm.ownerDocument;
14218
+ docElem = doc.documentElement;
14219
+ win = doc.defaultView;
14220
+ return {
14221
+ top: clientRect.top + win.pageYOffset - docElem.clientTop,
14222
+ left: clientRect.left + win.pageXOffset - docElem.clientLeft
14223
+ };
14224
+ };
14225
+ var getBodyPosition = function (editor) {
14226
+ return editor.inline ? getAbsolutePosition(editor.getBody()) : {
14227
+ left: 0,
14228
+ top: 0
14229
+ };
14230
+ };
14231
+ var getScrollPosition = function (editor) {
14232
+ var body = editor.getBody();
14233
+ return editor.inline ? {
14234
+ left: body.scrollLeft,
14235
+ top: body.scrollTop
14236
+ } : {
14237
+ left: 0,
14238
+ top: 0
14239
+ };
14240
+ };
14241
+ var getBodyScroll = function (editor) {
14242
+ var body = editor.getBody(), docElm = editor.getDoc().documentElement;
14243
+ var inlineScroll = {
14244
+ left: body.scrollLeft,
14245
+ top: body.scrollTop
14246
+ };
14247
+ var iframeScroll = {
14248
+ left: body.scrollLeft || docElm.scrollLeft,
14249
+ top: body.scrollTop || docElm.scrollTop
14250
+ };
14251
+ return editor.inline ? inlineScroll : iframeScroll;
14252
+ };
14253
+ var getMousePosition = function (editor, event) {
14254
+ if (event.target.ownerDocument !== editor.getDoc()) {
14255
+ var iframePosition = getAbsolutePosition(editor.getContentAreaContainer());
14256
+ var scrollPosition = getBodyScroll(editor);
14257
+ return {
14258
+ left: event.pageX - iframePosition.left + scrollPosition.left,
14259
+ top: event.pageY - iframePosition.top + scrollPosition.top
14260
+ };
14261
+ }
14262
+ return {
14263
+ left: event.pageX,
14264
+ top: event.pageY
14265
+ };
14266
+ };
14267
+ var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) {
14268
+ return {
14269
+ pageX: mousePosition.left - bodyPosition.left + scrollPosition.left,
14270
+ pageY: mousePosition.top - bodyPosition.top + scrollPosition.top
14271
+ };
14272
+ };
14273
+ var calc = function (editor, event) {
14274
+ return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));
14275
+ };
14276
+ var MousePosition = { calc: calc };
14277
+
14278
+ var isContentEditableFalse$7 = NodeType.isContentEditableFalse, isContentEditableTrue$2 = NodeType.isContentEditableTrue;
14279
+ var isDraggable = function (rootElm, elm) {
14280
+ return isContentEditableFalse$7(elm) && elm !== rootElm;
14281
+ };
14282
+ var isValidDropTarget = function (editor, targetElement, dragElement) {
14283
+ if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) {
14284
+ return false;
14285
+ }
14286
+ return !isContentEditableFalse$7(targetElement);
14287
+ };
14288
+ var cloneElement = function (elm) {
14289
+ var cloneElm = elm.cloneNode(true);
14290
+ cloneElm.removeAttribute('data-mce-selected');
14291
+ return cloneElm;
14292
+ };
14293
+ var createGhost = function (editor, elm, width, height) {
14294
+ var clonedElm = elm.cloneNode(true);
14295
+ editor.dom.setStyles(clonedElm, {
14296
+ width: width,
14297
+ height: height
14298
+ });
14299
+ editor.dom.setAttrib(clonedElm, 'data-mce-selected', null);
14300
+ var ghostElm = editor.dom.create('div', {
14301
+ 'class': 'mce-drag-container',
14302
+ 'data-mce-bogus': 'all',
14303
+ 'unselectable': 'on',
14304
+ 'contenteditable': 'false'
14305
+ });
14306
+ editor.dom.setStyles(ghostElm, {
14307
+ position: 'absolute',
14308
+ opacity: 0.5,
14309
+ overflow: 'hidden',
14310
+ border: 0,
14311
+ padding: 0,
14312
+ margin: 0,
14313
+ width: width,
14314
+ height: height
14315
+ });
14316
+ editor.dom.setStyles(clonedElm, {
14317
+ margin: 0,
14318
+ boxSizing: 'border-box'
14319
+ });
14320
+ ghostElm.appendChild(clonedElm);
14321
+ return ghostElm;
14322
+ };
14323
+ var appendGhostToBody = function (ghostElm, bodyElm) {
14324
+ if (ghostElm.parentNode !== bodyElm) {
14325
+ bodyElm.appendChild(ghostElm);
14326
+ }
14327
+ };
14328
+ var moveGhost = function (ghostElm, position, width, height, maxX, maxY) {
14329
+ var overflowX = 0, overflowY = 0;
14330
+ ghostElm.style.left = position.pageX + 'px';
14331
+ ghostElm.style.top = position.pageY + 'px';
14332
+ if (position.pageX + width > maxX) {
14333
+ overflowX = position.pageX + width - maxX;
14334
+ }
14335
+ if (position.pageY + height > maxY) {
14336
+ overflowY = position.pageY + height - maxY;
14337
+ }
14338
+ ghostElm.style.width = width - overflowX + 'px';
14339
+ ghostElm.style.height = height - overflowY + 'px';
14340
+ };
14341
+ var removeElement = function (elm) {
14342
+ if (elm && elm.parentNode) {
14343
+ elm.parentNode.removeChild(elm);
14344
+ }
14345
+ };
14346
+ var isLeftMouseButtonPressed = function (e) {
14347
+ return e.button === 0;
14348
+ };
14349
+ var hasDraggableElement = function (state) {
14350
+ return state.element;
14351
+ };
14352
+ var applyRelPos = function (state, position) {
14353
+ return {
14354
+ pageX: position.pageX - state.relX,
14355
+ pageY: position.pageY + 5
14356
+ };
14357
+ };
14358
+ var start = function (state, editor) {
14359
+ return function (e) {
14360
+ if (isLeftMouseButtonPressed(e)) {
14361
+ var ceElm = find(editor.dom.getParents(e.target), Predicate.or(isContentEditableFalse$7, isContentEditableTrue$2)).getOr(null);
14362
+ if (isDraggable(editor.getBody(), ceElm)) {
14363
+ var elmPos = editor.dom.getPos(ceElm);
14364
+ var bodyElm = editor.getBody();
14365
+ var docElm = editor.getDoc().documentElement;
14366
+ state.element = ceElm;
14367
+ state.screenX = e.screenX;
14368
+ state.screenY = e.screenY;
14369
+ state.maxX = (editor.inline ? bodyElm.scrollWidth : docElm.offsetWidth) - 2;
14370
+ state.maxY = (editor.inline ? bodyElm.scrollHeight : docElm.offsetHeight) - 2;
14371
+ state.relX = e.pageX - elmPos.x;
14372
+ state.relY = e.pageY - elmPos.y;
14373
+ state.width = ceElm.offsetWidth;
14374
+ state.height = ceElm.offsetHeight;
14375
+ state.ghost = createGhost(editor, ceElm, state.width, state.height);
14376
+ }
14377
+ }
14378
+ };
14379
+ };
14380
+ var move = function (state, editor) {
14381
+ var throttledPlaceCaretAt = Delay.throttle(function (clientX, clientY) {
14382
+ editor._selectionOverrides.hideFakeCaret();
14383
+ editor.selection.placeCaretAt(clientX, clientY);
14384
+ }, 0);
14385
+ return function (e) {
14386
+ var movement = Math.max(Math.abs(e.screenX - state.screenX), Math.abs(e.screenY - state.screenY));
14387
+ if (hasDraggableElement(state) && !state.dragging && movement > 10) {
14388
+ var args = editor.fire('dragstart', { target: state.element });
14389
+ if (args.isDefaultPrevented()) {
14390
+ return;
14391
+ }
14392
+ state.dragging = true;
14393
+ editor.focus();
14394
+ }
14395
+ if (state.dragging) {
14396
+ var targetPos = applyRelPos(state, MousePosition.calc(editor, e));
14397
+ appendGhostToBody(state.ghost, editor.getBody());
14398
+ moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY);
14399
+ throttledPlaceCaretAt(e.clientX, e.clientY);
14400
+ }
14401
+ };
14402
+ };
14403
+ var getRawTarget = function (selection) {
14404
+ var rng = selection.getSel().getRangeAt(0);
14405
+ var startContainer = rng.startContainer;
14406
+ return startContainer.nodeType === 3 ? startContainer.parentNode : startContainer;
14407
+ };
14408
+ var drop = function (state, editor) {
14409
+ return function (e) {
14410
+ if (state.dragging) {
14411
+ if (isValidDropTarget(editor, getRawTarget(editor.selection), state.element)) {
14412
+ var targetClone_1 = cloneElement(state.element);
14413
+ var args = editor.fire('drop', {
14414
+ targetClone: targetClone_1,
14415
+ clientX: e.clientX,
14416
+ clientY: e.clientY
14417
+ });
14418
+ if (!args.isDefaultPrevented()) {
14419
+ targetClone_1 = args.targetClone;
14420
+ editor.undoManager.transact(function () {
14421
+ removeElement(state.element);
14422
+ editor.insertContent(editor.dom.getOuterHTML(targetClone_1));
14423
+ editor._selectionOverrides.hideFakeCaret();
14424
+ });
14425
+ }
14426
+ }
14427
+ }
14428
+ removeDragState(state);
14429
+ };
14430
+ };
14431
+ var stop = function (state, editor) {
14432
+ return function () {
14433
+ if (state.dragging) {
14434
+ editor.fire('dragend');
14435
+ }
14436
+ removeDragState(state);
14437
+ };
14438
+ };
14439
+ var removeDragState = function (state) {
14440
+ state.dragging = false;
14441
+ state.element = null;
14442
+ removeElement(state.ghost);
14443
+ };
14444
+ var bindFakeDragEvents = function (editor) {
14445
+ var state = {};
14446
+ var pageDom, dragStartHandler, dragHandler, dropHandler, dragEndHandler, rootDocument;
14447
+ pageDom = DOMUtils$1.DOM;
14448
+ rootDocument = domGlobals.document;
14449
+ dragStartHandler = start(state, editor);
14450
+ dragHandler = move(state, editor);
14451
+ dropHandler = drop(state, editor);
14452
+ dragEndHandler = stop(state, editor);
14453
+ editor.on('mousedown', dragStartHandler);
14454
+ editor.on('mousemove', dragHandler);
14455
+ editor.on('mouseup', dropHandler);
14456
+ pageDom.bind(rootDocument, 'mousemove', dragHandler);
14457
+ pageDom.bind(rootDocument, 'mouseup', dragEndHandler);
14458
+ editor.on('remove', function () {
14459
+ pageDom.unbind(rootDocument, 'mousemove', dragHandler);
14460
+ pageDom.unbind(rootDocument, 'mouseup', dragEndHandler);
14461
+ });
14462
+ };
14463
+ var blockIeDrop = function (editor) {
14464
+ editor.on('drop', function (e) {
14465
+ var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null;
14466
+ if (isContentEditableFalse$7(realTarget) || isContentEditableFalse$7(editor.dom.getContentEditableParent(realTarget))) {
14467
+ e.preventDefault();
14387
14468
  }
14388
- }
14389
- return exists(range.getClientRects(), function (rect) {
14390
- return containsXY(rect, clientX, clientY);
14391
14469
  });
14392
14470
  };
14393
- var RangePoint = { isXYWithinRange: isXYWithinRange };
14471
+ var init = function (editor) {
14472
+ bindFakeDragEvents(editor);
14473
+ blockIeDrop(editor);
14474
+ };
14475
+ var DragDropOverrides = { init: init };
14394
14476
 
14395
14477
  var isContentEditableTrue$3 = NodeType.isContentEditableTrue;
14396
14478
  var isContentEditableFalse$8 = NodeType.isContentEditableFalse;
@@ -14458,69 +14540,6 @@
14458
14540
  };
14459
14541
  var CefFocus = { setup: setup$4 };
14460
14542
 
14461
- var VK = {
14462
- BACKSPACE: 8,
14463
- DELETE: 46,
14464
- DOWN: 40,
14465
- ENTER: 13,
14466
- LEFT: 37,
14467
- RIGHT: 39,
14468
- SPACEBAR: 32,
14469
- TAB: 9,
14470
- UP: 38,
14471
- END: 35,
14472
- HOME: 36,
14473
- modifierPressed: function (e) {
14474
- return e.shiftKey || e.ctrlKey || e.altKey || this.metaKeyPressed(e);
14475
- },
14476
- metaKeyPressed: function (e) {
14477
- return Env.mac ? e.metaKey : e.ctrlKey && !e.altKey;
14478
- }
14479
- };
14480
-
14481
- var is$2 = function (expected) {
14482
- return function (actual) {
14483
- return expected === actual;
14484
- };
14485
- };
14486
- var isNbsp = is$2('\xA0');
14487
- var isWhiteSpace$1 = function (chr) {
14488
- return /^[\r\n\t ]$/.test(chr);
14489
- };
14490
- var isContent = function (chr) {
14491
- return !isWhiteSpace$1(chr) && !isNbsp(chr);
14492
- };
14493
-
14494
- var isChar = function (forward, predicate, pos) {
14495
- return Option.from(pos.container()).filter(NodeType.isText).exists(function (text) {
14496
- var delta = forward ? 0 : -1;
14497
- return predicate(text.data.charAt(pos.offset() + delta));
14498
- });
14499
- };
14500
- var isBeforeSpace = curry(isChar, true, isWhiteSpace$1);
14501
- var isAfterSpace = curry(isChar, false, isWhiteSpace$1);
14502
- var isEmptyText = function (pos) {
14503
- var container = pos.container();
14504
- return NodeType.isText(container) && container.data.length === 0;
14505
- };
14506
- var matchesElementPosition = function (before, predicate) {
14507
- return function (pos) {
14508
- return Option.from(getChildNodeAtRelativeOffset(before ? 0 : -1, pos)).filter(predicate).isSome();
14509
- };
14510
- };
14511
- var isImageBlock = function (node) {
14512
- return node.nodeName === 'IMG' && get$2(Element.fromDom(node), 'display') === 'block';
14513
- };
14514
- var isCefNode = function (node) {
14515
- return NodeType.isContentEditableFalse(node) && !NodeType.isBogusAll(node);
14516
- };
14517
- var isBeforeImageBlock = matchesElementPosition(true, isImageBlock);
14518
- var isAfterImageBlock = matchesElementPosition(false, isImageBlock);
14519
- var isBeforeTable = matchesElementPosition(true, NodeType.isTable);
14520
- var isAfterTable = matchesElementPosition(false, NodeType.isTable);
14521
- var isBeforeContentEditableFalse = matchesElementPosition(true, isCefNode);
14522
- var isAfterContentEditableFalse = matchesElementPosition(false, isCefNode);
14523
-
14524
14543
  var isContentEditableTrue$4 = NodeType.isContentEditableTrue;
14525
14544
  var isContentEditableFalse$9 = NodeType.isContentEditableFalse;
14526
14545
  var getContentEditableRoot = function (editor, node) {
@@ -14576,13 +14595,6 @@
14576
14595
  }
14577
14596
  return fakeCaret.show(before, node);
14578
14597
  };
14579
- var getNormalizedRangeEndPoint = function (direction, range) {
14580
- range = normalizeRange(direction, rootNode, range);
14581
- if (direction === -1) {
14582
- return CaretPosition$1.fromRangeStart(range);
14583
- }
14584
- return CaretPosition$1.fromRangeEnd(range);
14585
- };
14586
14598
  var showBlockCaretContainer = function (blockCaretContainer) {
14587
14599
  if (blockCaretContainer.hasAttribute('data-mce-caret')) {
14588
14600
  showCaretContainerBlock(blockCaretContainer);
@@ -14627,14 +14639,14 @@
14627
14639
  moved = true;
14628
14640
  });
14629
14641
  editor.on('touchend', function (e) {
14630
- var contentEditableRoot = getContentEditableRoot(editor, e.target);
14631
- if (isContentEditableFalse$9(contentEditableRoot)) {
14632
- if (!moved) {
14642
+ if (!moved) {
14643
+ var contentEditableRoot = getContentEditableRoot(editor, e.target);
14644
+ if (isContentEditableFalse$9(contentEditableRoot)) {
14633
14645
  e.preventDefault();
14634
14646
  setContentEditableSelection(selectNode(editor, contentEditableRoot));
14635
14647
  }
14636
14648
  }
14637
- });
14649
+ }, true);
14638
14650
  };
14639
14651
  var hasNormalCaretPosition = function (elm) {
14640
14652
  var caretWalker = CaretWalker(elm);
@@ -14719,8 +14731,8 @@
14719
14731
  }
14720
14732
  });
14721
14733
  editor.on('SetSelectionRange', function (e) {
14722
- var rng;
14723
- rng = setContentEditableSelection(e.range, e.forward);
14734
+ e.range = normalizeShortEndedElementSelection(e.range);
14735
+ var rng = setContentEditableSelection(e.range, e.forward);
14724
14736
  if (rng) {
14725
14737
  e.range = rng;
14726
14738
  }
@@ -14758,6 +14770,33 @@
14758
14770
  var isRangeInCaretContainer = function (rng) {
14759
14771
  return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer);
14760
14772
  };
14773
+ var normalizeShortEndedElementSelection = function (rng) {
14774
+ var shortEndedElements = editor.schema.getShortEndedElements();
14775
+ var newRng = editor.dom.createRng();
14776
+ var startContainer = rng.startContainer;
14777
+ var startOffset = rng.startOffset;
14778
+ var endContainer = rng.endContainer;
14779
+ var endOffset = rng.endOffset;
14780
+ if (has(shortEndedElements, startContainer.nodeName.toLowerCase())) {
14781
+ if (startOffset === 0) {
14782
+ newRng.setStartBefore(startContainer);
14783
+ } else {
14784
+ newRng.setStartAfter(startContainer);
14785
+ }
14786
+ } else {
14787
+ newRng.setStart(startContainer, startOffset);
14788
+ }
14789
+ if (has(shortEndedElements, endContainer.nodeName.toLowerCase())) {
14790
+ if (endOffset === 0) {
14791
+ newRng.setEndBefore(endContainer);
14792
+ } else {
14793
+ newRng.setEndAfter(endContainer);
14794
+ }
14795
+ } else {
14796
+ newRng.setEnd(endContainer, endOffset);
14797
+ }
14798
+ return newRng;
14799
+ };
14761
14800
  var setContentEditableSelection = function (range, forward) {
14762
14801
  var node;
14763
14802
  var $ = editor.$;
@@ -14769,7 +14808,7 @@
14769
14808
  if (range.collapsed) {
14770
14809
  if (!isRangeInCaretContainer(range)) {
14771
14810
  if (forward === false) {
14772
- caretPosition = getNormalizedRangeEndPoint(-1, range);
14811
+ caretPosition = getNormalizedRangeEndPoint(-1, rootNode, range);
14773
14812
  if (isFakeCaretTarget(caretPosition.getNode(true))) {
14774
14813
  return showCaret(-1, caretPosition.getNode(true), false, false);
14775
14814
  }
@@ -14777,7 +14816,7 @@
14777
14816
  return showCaret(-1, caretPosition.getNode(), !caretPosition.isAtEnd(), false);
14778
14817
  }
14779
14818
  } else {
14780
- caretPosition = getNormalizedRangeEndPoint(1, range);
14819
+ caretPosition = getNormalizedRangeEndPoint(1, rootNode, range);
14781
14820
  if (isFakeCaretTarget(caretPosition.getNode())) {
14782
14821
  return showCaret(1, caretPosition.getNode(), !caretPosition.isAtEnd(), false);
14783
14822
  }
@@ -14838,10 +14877,15 @@
14838
14877
  sel = editor.selection.getSel();
14839
14878
  sel.removeAllRanges();
14840
14879
  sel.addRange(range);
14880
+ var nodeElm = Element.fromDom(node);
14841
14881
  each(descendants$1(Element.fromDom(editor.getBody()), '*[data-mce-selected]'), function (elm) {
14842
- remove(elm, 'data-mce-selected');
14882
+ if (!eq(nodeElm, elm)) {
14883
+ remove(elm, 'data-mce-selected');
14884
+ }
14843
14885
  });
14844
- node.setAttribute('data-mce-selected', '1');
14886
+ if (!editor.dom.getAttrib(node, 'data-mce-selected')) {
14887
+ node.setAttribute('data-mce-selected', '1');
14888
+ }
14845
14889
  selectedContentEditableNode = node;
14846
14890
  hideFakeCaret();
14847
14891
  return range;
@@ -15115,7 +15159,7 @@
15115
15159
  var elm = Element.fromTag('body', lazyTempDocument());
15116
15160
  set$1(elm, getLevelContent(level));
15117
15161
  each(descendants$1(elm, '*[data-mce-bogus]'), unwrap);
15118
- return get$4(elm);
15162
+ return get$5(elm);
15119
15163
  };
15120
15164
  var hasEqualContent = function (level1, level2) {
15121
15165
  return getLevelContent(level1) === getLevelContent(level2);
@@ -15140,37 +15184,166 @@
15140
15184
  isEq: isEq$2
15141
15185
  };
15142
15186
 
15143
- var UndoManager = function (editor) {
15144
- var self = this, index = 0, data = [], beforeBookmark, isFirstTypedCharacter, locks = 0;
15145
- var isUnlocked = function () {
15146
- return locks === 0;
15147
- };
15148
- var setTyping = function (typing) {
15149
- if (isUnlocked()) {
15150
- self.typing = typing;
15187
+ var isUnlocked = function (locks) {
15188
+ return locks.get() === 0;
15189
+ };
15190
+
15191
+ var setTyping = function (undoManager, typing, locks) {
15192
+ if (isUnlocked(locks)) {
15193
+ undoManager.typing = typing;
15194
+ }
15195
+ };
15196
+ var endTyping = function (undoManager, locks) {
15197
+ if (undoManager.typing) {
15198
+ setTyping(undoManager, false, locks);
15199
+ undoManager.add();
15200
+ }
15201
+ };
15202
+ var endTypingLevelIgnoreLocks = function (undoManager) {
15203
+ if (undoManager.typing) {
15204
+ undoManager.typing = false;
15205
+ undoManager.add();
15206
+ }
15207
+ };
15208
+
15209
+ var beforeChange = function (editor, locks, beforeBookmark) {
15210
+ if (isUnlocked(locks)) {
15211
+ beforeBookmark.set(Option.some(GetBookmark.getUndoBookmark(editor.selection)));
15212
+ }
15213
+ };
15214
+ var addUndoLevel = function (editor, undoManager, index, locks, beforeBookmark, level, event) {
15215
+ var settings = editor.settings;
15216
+ var currentLevel = Levels.createFromEditor(editor);
15217
+ level = level || {};
15218
+ level = Tools.extend(level, currentLevel);
15219
+ if (isUnlocked(locks) === false || editor.removed) {
15220
+ return null;
15221
+ }
15222
+ var lastLevel = undoManager.data[index.get()];
15223
+ if (editor.fire('BeforeAddUndo', {
15224
+ level: level,
15225
+ lastLevel: lastLevel,
15226
+ originalEvent: event
15227
+ }).isDefaultPrevented()) {
15228
+ return null;
15229
+ }
15230
+ if (lastLevel && Levels.isEq(lastLevel, level)) {
15231
+ return null;
15232
+ }
15233
+ if (undoManager.data[index.get()]) {
15234
+ beforeBookmark.get().each(function (bm) {
15235
+ undoManager.data[index.get()].beforeBookmark = bm;
15236
+ });
15237
+ }
15238
+ if (settings.custom_undo_redo_levels) {
15239
+ if (undoManager.data.length > settings.custom_undo_redo_levels) {
15240
+ for (var i = 0; i < undoManager.data.length - 1; i++) {
15241
+ undoManager.data[i] = undoManager.data[i + 1];
15242
+ }
15243
+ undoManager.data.length--;
15244
+ index.set(undoManager.data.length);
15151
15245
  }
15152
- };
15153
- var setDirty = function (state) {
15154
- editor.setDirty(state);
15155
- };
15246
+ }
15247
+ level.bookmark = GetBookmark.getUndoBookmark(editor.selection);
15248
+ if (index.get() < undoManager.data.length - 1) {
15249
+ undoManager.data.length = index.get() + 1;
15250
+ }
15251
+ undoManager.data.push(level);
15252
+ index.set(undoManager.data.length - 1);
15253
+ var args = {
15254
+ level: level,
15255
+ lastLevel: lastLevel,
15256
+ originalEvent: event
15257
+ };
15258
+ editor.fire('AddUndo', args);
15259
+ if (index.get() > 0) {
15260
+ editor.setDirty(true);
15261
+ editor.fire('change', args);
15262
+ }
15263
+ return level;
15264
+ };
15265
+ var clear = function (editor, undoManager, index) {
15266
+ undoManager.data = [];
15267
+ index.set(0);
15268
+ undoManager.typing = false;
15269
+ editor.fire('ClearUndos');
15270
+ };
15271
+ var extra = function (editor, undoManager, index, callback1, callback2) {
15272
+ if (undoManager.transact(callback1)) {
15273
+ var bookmark = undoManager.data[index.get()].bookmark;
15274
+ var lastLevel = undoManager.data[index.get() - 1];
15275
+ Levels.applyToEditor(editor, lastLevel, true);
15276
+ if (undoManager.transact(callback2)) {
15277
+ undoManager.data[index.get() - 1].beforeBookmark = bookmark;
15278
+ }
15279
+ }
15280
+ };
15281
+ var redo = function (editor, index, data) {
15282
+ var level;
15283
+ if (index.get() < data.length - 1) {
15284
+ index.set(index.get() + 1);
15285
+ level = data[index.get()];
15286
+ Levels.applyToEditor(editor, level, false);
15287
+ editor.setDirty(true);
15288
+ editor.fire('Redo', { level: level });
15289
+ }
15290
+ return level;
15291
+ };
15292
+ var undo = function (editor, undoManager, locks, index) {
15293
+ var level;
15294
+ if (undoManager.typing) {
15295
+ undoManager.add();
15296
+ undoManager.typing = false;
15297
+ setTyping(undoManager, false, locks);
15298
+ }
15299
+ if (index.get() > 0) {
15300
+ index.set(index.get() - 1);
15301
+ level = undoManager.data[index.get()];
15302
+ Levels.applyToEditor(editor, level, true);
15303
+ editor.setDirty(true);
15304
+ editor.fire('Undo', { level: level });
15305
+ }
15306
+ return level;
15307
+ };
15308
+ var reset = function (undoManager) {
15309
+ undoManager.clear();
15310
+ undoManager.add();
15311
+ };
15312
+ var hasUndo = function (editor, undoManager, index) {
15313
+ return index.get() > 0 || undoManager.typing && undoManager.data[0] && !Levels.isEq(Levels.createFromEditor(editor), undoManager.data[0]);
15314
+ };
15315
+ var hasRedo = function (undoManager, index) {
15316
+ return index.get() < undoManager.data.length - 1 && !undoManager.typing;
15317
+ };
15318
+ var transact = function (undoManager, locks, callback) {
15319
+ endTyping(undoManager, locks);
15320
+ undoManager.beforeChange();
15321
+ undoManager.ignore(callback);
15322
+ return undoManager.add();
15323
+ };
15324
+ var ignore = function (locks, callback) {
15325
+ try {
15326
+ locks.set(locks.get() + 1);
15327
+ callback();
15328
+ } finally {
15329
+ locks.set(locks.get() - 1);
15330
+ }
15331
+ };
15332
+
15333
+ var registerEvents$1 = function (editor, undoManager, locks) {
15334
+ var isFirstTypedCharacter = Cell(false);
15156
15335
  var addNonTypingUndoLevel = function (e) {
15157
- setTyping(false);
15158
- self.add({}, e);
15159
- };
15160
- var endTyping = function () {
15161
- if (self.typing) {
15162
- setTyping(false);
15163
- self.add();
15164
- }
15336
+ setTyping(undoManager, false, locks);
15337
+ undoManager.add({}, e);
15165
15338
  };
15166
15339
  editor.on('init', function () {
15167
- self.add();
15340
+ undoManager.add();
15168
15341
  });
15169
15342
  editor.on('BeforeExecCommand', function (e) {
15170
15343
  var cmd = e.command;
15171
15344
  if (cmd !== 'Undo' && cmd !== 'Redo' && cmd !== 'mceRepaint') {
15172
- endTyping();
15173
- self.beforeChange();
15345
+ endTyping(undoManager, locks);
15346
+ undoManager.beforeChange();
15174
15347
  }
15175
15348
  });
15176
15349
  editor.on('ExecCommand', function (e) {
@@ -15180,7 +15353,7 @@
15180
15353
  }
15181
15354
  });
15182
15355
  editor.on('ObjectResizeStart cut', function () {
15183
- self.beforeChange();
15356
+ undoManager.beforeChange();
15184
15357
  });
15185
15358
  editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel);
15186
15359
  editor.on('dragend', addNonTypingUndoLevel);
@@ -15196,16 +15369,16 @@
15196
15369
  if (keyCode === 46 || keyCode === 8) {
15197
15370
  editor.nodeChanged();
15198
15371
  }
15199
- if (isFirstTypedCharacter && self.typing && Levels.isEq(Levels.createFromEditor(editor), data[0]) === false) {
15372
+ if (isFirstTypedCharacter.get() && undoManager.typing && Levels.isEq(Levels.createFromEditor(editor), undoManager.data[0]) === false) {
15200
15373
  if (editor.isDirty() === false) {
15201
- setDirty(true);
15374
+ editor.setDirty(true);
15202
15375
  editor.fire('change', {
15203
- level: data[0],
15376
+ level: undoManager.data[0],
15204
15377
  lastLevel: null
15205
15378
  });
15206
15379
  }
15207
15380
  editor.fire('TypingUndo');
15208
- isFirstTypedCharacter = false;
15381
+ isFirstTypedCharacter.set(false);
15209
15382
  editor.nodeChanged();
15210
15383
  }
15211
15384
  });
@@ -15215,21 +15388,21 @@
15215
15388
  return;
15216
15389
  }
15217
15390
  if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45) {
15218
- if (self.typing) {
15391
+ if (undoManager.typing) {
15219
15392
  addNonTypingUndoLevel(e);
15220
15393
  }
15221
15394
  return;
15222
15395
  }
15223
15396
  var modKey = e.ctrlKey && !e.altKey || e.metaKey;
15224
- if ((keyCode < 16 || keyCode > 20) && keyCode !== 224 && keyCode !== 91 && !self.typing && !modKey) {
15225
- self.beforeChange();
15226
- setTyping(true);
15227
- self.add({}, e);
15228
- isFirstTypedCharacter = true;
15397
+ if ((keyCode < 16 || keyCode > 20) && keyCode !== 224 && keyCode !== 91 && !undoManager.typing && !modKey) {
15398
+ undoManager.beforeChange();
15399
+ setTyping(undoManager, true, locks);
15400
+ undoManager.add({}, e);
15401
+ isFirstTypedCharacter.set(true);
15229
15402
  }
15230
15403
  });
15231
15404
  editor.on('mousedown', function (e) {
15232
- if (self.typing) {
15405
+ if (undoManager.typing) {
15233
15406
  addNonTypingUndoLevel(e);
15234
15407
  }
15235
15408
  });
@@ -15244,141 +15417,61 @@
15244
15417
  addNonTypingUndoLevel(e);
15245
15418
  }
15246
15419
  });
15247
- editor.addShortcut('meta+z', '', 'Undo');
15248
- editor.addShortcut('meta+y,meta+shift+z', '', 'Redo');
15249
15420
  editor.on('AddUndo Undo Redo ClearUndos', function (e) {
15250
15421
  if (!e.isDefaultPrevented()) {
15251
15422
  editor.nodeChanged();
15252
15423
  }
15253
15424
  });
15254
- self = {
15255
- data: data,
15425
+ };
15426
+ var addKeyboardShortcuts = function (editor) {
15427
+ editor.addShortcut('meta+z', '', 'Undo');
15428
+ editor.addShortcut('meta+y,meta+shift+z', '', 'Redo');
15429
+ };
15430
+
15431
+ var UndoManager = function (editor) {
15432
+ var beforeBookmark = Cell(Option.none());
15433
+ var locks = Cell(0);
15434
+ var index = Cell(0);
15435
+ var undoManager = {
15436
+ data: [],
15256
15437
  typing: false,
15257
15438
  beforeChange: function () {
15258
- if (isUnlocked()) {
15259
- beforeBookmark = GetBookmark.getUndoBookmark(editor.selection);
15260
- }
15439
+ beforeChange(editor, locks, beforeBookmark);
15261
15440
  },
15262
15441
  add: function (level, event) {
15263
- var i;
15264
- var settings = editor.settings;
15265
- var lastLevel, currentLevel;
15266
- currentLevel = Levels.createFromEditor(editor);
15267
- level = level || {};
15268
- level = Tools.extend(level, currentLevel);
15269
- if (isUnlocked() === false || editor.removed) {
15270
- return null;
15271
- }
15272
- lastLevel = data[index];
15273
- if (editor.fire('BeforeAddUndo', {
15274
- level: level,
15275
- lastLevel: lastLevel,
15276
- originalEvent: event
15277
- }).isDefaultPrevented()) {
15278
- return null;
15279
- }
15280
- if (lastLevel && Levels.isEq(lastLevel, level)) {
15281
- return null;
15282
- }
15283
- if (data[index]) {
15284
- data[index].beforeBookmark = beforeBookmark;
15285
- }
15286
- if (settings.custom_undo_redo_levels) {
15287
- if (data.length > settings.custom_undo_redo_levels) {
15288
- for (i = 0; i < data.length - 1; i++) {
15289
- data[i] = data[i + 1];
15290
- }
15291
- data.length--;
15292
- index = data.length;
15293
- }
15294
- }
15295
- level.bookmark = GetBookmark.getUndoBookmark(editor.selection);
15296
- if (index < data.length - 1) {
15297
- data.length = index + 1;
15298
- }
15299
- data.push(level);
15300
- index = data.length - 1;
15301
- var args = {
15302
- level: level,
15303
- lastLevel: lastLevel,
15304
- originalEvent: event
15305
- };
15306
- editor.fire('AddUndo', args);
15307
- if (index > 0) {
15308
- setDirty(true);
15309
- editor.fire('change', args);
15310
- }
15311
- return level;
15442
+ return addUndoLevel(editor, undoManager, index, locks, beforeBookmark, level, event);
15312
15443
  },
15313
15444
  undo: function () {
15314
- var level;
15315
- if (self.typing) {
15316
- self.add();
15317
- self.typing = false;
15318
- setTyping(false);
15319
- }
15320
- if (index > 0) {
15321
- level = data[--index];
15322
- Levels.applyToEditor(editor, level, true);
15323
- setDirty(true);
15324
- editor.fire('Undo', { level: level });
15325
- }
15326
- return level;
15445
+ return undo(editor, undoManager, locks, index);
15327
15446
  },
15328
15447
  redo: function () {
15329
- var level;
15330
- if (index < data.length - 1) {
15331
- level = data[++index];
15332
- Levels.applyToEditor(editor, level, false);
15333
- setDirty(true);
15334
- editor.fire('Redo', { level: level });
15335
- }
15336
- return level;
15448
+ return redo(editor, index, undoManager.data);
15337
15449
  },
15338
15450
  clear: function () {
15339
- data = [];
15340
- index = 0;
15341
- self.typing = false;
15342
- self.data = data;
15343
- editor.fire('ClearUndos');
15451
+ clear(editor, undoManager, index);
15344
15452
  },
15345
15453
  reset: function () {
15346
- self.clear();
15347
- self.add();
15454
+ reset(undoManager);
15348
15455
  },
15349
15456
  hasUndo: function () {
15350
- return index > 0 || self.typing && data[0] && !Levels.isEq(Levels.createFromEditor(editor), data[0]);
15457
+ return hasUndo(editor, undoManager, index);
15351
15458
  },
15352
15459
  hasRedo: function () {
15353
- return index < data.length - 1 && !self.typing;
15460
+ return hasRedo(undoManager, index);
15354
15461
  },
15355
15462
  transact: function (callback) {
15356
- endTyping();
15357
- self.beforeChange();
15358
- self.ignore(callback);
15359
- return self.add();
15463
+ return transact(undoManager, locks, callback);
15360
15464
  },
15361
15465
  ignore: function (callback) {
15362
- try {
15363
- locks++;
15364
- callback();
15365
- } finally {
15366
- locks--;
15367
- }
15466
+ ignore(locks, callback);
15368
15467
  },
15369
15468
  extra: function (callback1, callback2) {
15370
- var lastLevel, bookmark;
15371
- if (self.transact(callback1)) {
15372
- bookmark = data[index].bookmark;
15373
- lastLevel = data[index - 1];
15374
- Levels.applyToEditor(editor, lastLevel, true);
15375
- if (self.transact(callback2)) {
15376
- data[index - 1].beforeBookmark = bookmark;
15377
- }
15378
- }
15469
+ extra(editor, undoManager, index, callback1, callback2);
15379
15470
  }
15380
15471
  };
15381
- return self;
15472
+ registerEvents$1(editor, undoManager, locks);
15473
+ addKeyboardShortcuts(editor);
15474
+ return undoManager;
15382
15475
  };
15383
15476
 
15384
15477
  var getLastChildren$1 = function (elm) {
@@ -15402,7 +15495,7 @@
15402
15495
  append(elm, Element.fromHtml('<br data-mce-bogus="1">'));
15403
15496
  };
15404
15497
  var isPaddingContents = function (elm) {
15405
- return isText$1(elm) ? get$5(elm) === '\xA0' : isBr$1(elm);
15498
+ return isText$1(elm) ? get$6(elm) === '\xA0' : isBr$1(elm);
15406
15499
  };
15407
15500
  var isPaddedElement = function (elm) {
15408
15501
  return filter(children(elm), isPaddingContents).length === 1;
@@ -17034,7 +17127,7 @@
17034
17127
  };
17035
17128
  };
17036
17129
 
17037
- var get$6 = function (dom) {
17130
+ var get$7 = function (dom) {
17038
17131
  var formats = {
17039
17132
  valigntop: [{
17040
17133
  selector: 'td,th',
@@ -17277,7 +17370,7 @@
17277
17370
  });
17278
17371
  return formats;
17279
17372
  };
17280
- var DefaultFormats = { get: get$6 };
17373
+ var DefaultFormats = { get: get$7 };
17281
17374
 
17282
17375
  function FormatRegistry(editor) {
17283
17376
  var formats = {};
@@ -18677,7 +18770,12 @@
18677
18770
  return elm && (elm.nodeName === 'IMG' || editor.dom.is(elm, 'figure.image'));
18678
18771
  };
18679
18772
  var isEventOnImageOutsideRange = function (evt, range) {
18680
- return isImage(evt.target) && !RangePoint.isXYWithinRange(evt.clientX, evt.clientY, range);
18773
+ if (evt.type === 'longpress' || evt.type.indexOf('touch') === 0) {
18774
+ var touch = evt.touches[0];
18775
+ return isImage(evt.target) && !RangePoint.isXYWithinRange(touch.clientX, touch.clientY, range);
18776
+ } else {
18777
+ return isImage(evt.target) && !RangePoint.isXYWithinRange(evt.clientX, evt.clientY, range);
18778
+ }
18681
18779
  };
18682
18780
  var contextMenuSelectImage = function (evt) {
18683
18781
  var target = evt.target;
@@ -18933,7 +19031,7 @@
18933
19031
  };
18934
19032
  editor.on('init', function () {
18935
19033
  disableGeckoResize();
18936
- if (Env.ie && Env.ie >= 11) {
19034
+ if (Env.browser.isIE() || Env.browser.isEdge()) {
18937
19035
  editor.on('mousedown click', function (e) {
18938
19036
  var target = e.target, nodeName = target.nodeName;
18939
19037
  if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName) && !isWithinContentEditableFalse(target)) {
@@ -18976,7 +19074,7 @@
18976
19074
  }
18977
19075
  });
18978
19076
  editor.on('hide blur', hideResizeRect);
18979
- editor.on('contextmenu', contextMenuSelectImage, true);
19077
+ editor.on('contextmenu longpress', contextMenuSelectImage, true);
18980
19078
  });
18981
19079
  editor.on('remove', unbindResizeHandleEvents);
18982
19080
  var destroy = function () {
@@ -19035,73 +19133,10 @@
19035
19133
  var dom = element.dom();
19036
19134
  return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight;
19037
19135
  });
19038
- var get$7 = function (element) {
19136
+ var get$8 = function (element) {
19039
19137
  return api$1.get(element);
19040
19138
  };
19041
19139
 
19042
- var r = function (left, top) {
19043
- var translate = function (x, y) {
19044
- return r(left + x, top + y);
19045
- };
19046
- return {
19047
- left: constant(left),
19048
- top: constant(top),
19049
- translate: translate
19050
- };
19051
- };
19052
- var Position$1 = r;
19053
-
19054
- var boxPosition = function (dom) {
19055
- var box = dom.getBoundingClientRect();
19056
- return Position$1(box.left, box.top);
19057
- };
19058
- var firstDefinedOrZero = function (a, b) {
19059
- return a !== undefined ? a : b !== undefined ? b : 0;
19060
- };
19061
- var absolute = function (element) {
19062
- var doc = element.dom().ownerDocument;
19063
- var body = doc.body;
19064
- var win = doc.defaultView;
19065
- var html = doc.documentElement;
19066
- var scrollTop = firstDefinedOrZero(win.pageYOffset, html.scrollTop);
19067
- var scrollLeft = firstDefinedOrZero(win.pageXOffset, html.scrollLeft);
19068
- var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop);
19069
- var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft);
19070
- return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop);
19071
- };
19072
- var viewport = function (element) {
19073
- var dom = element.dom();
19074
- var doc = dom.ownerDocument;
19075
- var body = doc.body;
19076
- if (body === dom) {
19077
- return Position$1(body.offsetLeft, body.offsetTop);
19078
- }
19079
- if (!inBody(element)) {
19080
- return Position$1(0, 0);
19081
- }
19082
- return boxPosition(dom);
19083
- };
19084
-
19085
- var isSafari = PlatformDetection$1.detect().browser.isSafari();
19086
- var get$8 = function (_DOC) {
19087
- var doc = _DOC !== undefined ? _DOC.dom() : domGlobals.document;
19088
- var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;
19089
- var y = doc.body.scrollTop || doc.documentElement.scrollTop;
19090
- return Position$1(x, y);
19091
- };
19092
- var to = function (x, y, _DOC) {
19093
- var doc = _DOC !== undefined ? _DOC.dom() : domGlobals.document;
19094
- var win = doc.defaultView;
19095
- win.scrollTo(x, y);
19096
- };
19097
- var intoView = function (element, alignToTop) {
19098
- if (isSafari && isFunction(element.dom().scrollIntoViewIfNeeded)) {
19099
- element.dom().scrollIntoViewIfNeeded(false);
19100
- } else {
19101
- element.dom().scrollIntoView(alignToTop);
19102
- }
19103
- };
19104
-
19105
19140
  var walkUp = function (navigation, doc) {
19106
19141
  var frame = navigation.view(doc);
19107
19142
  return frame.fold(constant([]), function (f) {
@@ -19130,7 +19165,7 @@
19130
19165
 
19131
19166
  var find$4 = function (element) {
19132
19167
  var doc = Element.fromDom(domGlobals.document);
19133
- var scroll = get$8(doc);
19168
+ var scroll = get$3(doc);
19134
19169
  var frames = pathTo(element, Navigation);
19135
19170
  var offset = viewport(element);
19136
19171
  var r = foldr(frames, function (b, a) {
@@ -19177,7 +19212,7 @@
19177
19212
  } else if (isText$1(last)) {
19178
19213
  return {
19179
19214
  element: last,
19180
- offset: get$5(last).length
19215
+ offset: get$6(last).length
19181
19216
  };
19182
19217
  } else {
19183
19218
  return {
@@ -19190,7 +19225,7 @@
19190
19225
  };
19191
19226
  var markerInfo = function (element, cleanupFun) {
19192
19227
  var pos = absolute(element);
19193
- var height = get$7(element);
19228
+ var height = get$8(element);
19194
19229
  return {
19195
19230
  element: element,
19196
19231
  bottom: pos.top() + height,
@@ -19218,14 +19253,14 @@
19218
19253
  var body = Element.fromDom(editor.getBody());
19219
19254
  var doc = Element.fromDom(editor.getDoc());
19220
19255
  reflow(body);
19221
- var scrollTop = get$8(doc).top();
19256
+ var scrollTop = get$3(doc).top();
19222
19257
  var marker = createMarker(Element.fromDom(rng.startContainer), rng.startOffset);
19223
19258
  f(doc, scrollTop, marker, alignToTop);
19224
19259
  marker.cleanup();
19225
19260
  };
19226
19261
  var withElement = function (editor, element, f, alignToTop) {
19227
19262
  var doc = Element.fromDom(editor.getDoc());
19228
- var scrollTop = get$8(doc).top();
19263
+ var scrollTop = get$3(doc).top();
19229
19264
  f(doc, scrollTop, element, alignToTop);
19230
19265
  };
19231
19266
  var preserveWith = function (editor, f, rng) {
@@ -19270,11 +19305,10 @@
19270
19305
  var frameViewHeight = doc.dom().defaultView.innerHeight;
19271
19306
  intoWindowIfNeeded(doc, scrollTop, frameViewHeight, marker, alignToTop);
19272
19307
  var op = find$4(marker.element);
19273
- var viewTop = get$8().top();
19274
- var viewBot = domGlobals.window.innerHeight + viewTop;
19275
- if (op.top() < viewTop) {
19308
+ var viewportBounds = getBounds(domGlobals.window);
19309
+ if (op.top() < viewportBounds.y()) {
19276
19310
  intoView(marker.element, alignToTop !== false);
19277
- } else if (op.top() > viewBot) {
19311
+ } else if (op.top() > viewportBounds.bottom()) {
19278
19312
  intoView(marker.element, alignToTop === true);
19279
19313
  }
19280
19314
  };
@@ -21417,7 +21451,7 @@
21417
21451
  };
21418
21452
 
21419
21453
  var executeKeydownOverride = function (editor, caret, evt) {
21420
- var os = PlatformDetection$1.detect().os;
21454
+ var os = detect$3().os;
21421
21455
  MatchKeys.execute([
21422
21456
  {
21423
21457
  keyCode: VK.RIGHT,
@@ -22445,8 +22479,8 @@
22445
22479
  var dom = editor.dom;
22446
22480
  var rng = editor.selection.getRng();
22447
22481
  var pos = CaretPosition$1.fromRangeStart(rng);
22448
- var block = Element.fromDom(dom.getParent(rng.startContainer, dom.isBlock));
22449
- if (isAtStartOfBlock(block, pos)) {
22482
+ var block = dom.getParent(rng.startContainer, dom.isBlock);
22483
+ if (block !== null && isAtStartOfBlock(Element.fromDom(block), pos)) {
22450
22484
  handle(editor, 'outdent');
22451
22485
  return true;
22452
22486
  }
@@ -23286,18 +23320,12 @@
23286
23320
  };
23287
23321
  var InsertNewLine = { insert: insert$3 };
23288
23322
 
23289
- var endTypingLevel = function (undoManager) {
23290
- if (undoManager.typing) {
23291
- undoManager.typing = false;
23292
- undoManager.add();
23293
- }
23294
- };
23295
23323
  var handleEnterKeyEvent = function (editor, event) {
23296
23324
  if (event.isDefaultPrevented()) {
23297
23325
  return;
23298
23326
  }
23299
23327
  event.preventDefault();
23300
- endTypingLevel(editor.undoManager);
23328
+ endTypingLevelIgnoreLocks(editor.undoManager);
23301
23329
  editor.undoManager.transact(function () {
23302
23330
  if (editor.selection.isCollapsed() === false) {
23303
23331
  editor.execCommand('Delete');
@@ -23566,14 +23594,14 @@
23566
23594
  };
23567
23595
  var CaretContainerInput = { setup: setup$c };
23568
23596
 
23569
- var browser$4 = PlatformDetection$1.detect().browser;
23597
+ var browser$5 = detect$3().browser;
23570
23598
  var setupIeInput = function (editor) {
23571
23599
  var keypressThrotter = first(function () {
23572
23600
  if (!editor.composing) {
23573
23601
  normalizeNbspsInEditor(editor);
23574
23602
  }
23575
23603
  }, 0);
23576
- if (browser$4.isIE()) {
23604
+ if (browser$5.isIE()) {
23577
23605
  editor.on('keypress', function (e) {
23578
23606
  keypressThrotter.throttle();
23579
23607
  });
@@ -24328,7 +24356,7 @@
24328
24356
 
24329
24357
  var DOM$4 = DOMUtils$1.DOM;
24330
24358
  var relaxDomain = function (editor, ifr) {
24331
- if (domGlobals.document.domain !== domGlobals.window.location.hostname && Env.ie && Env.ie < 12) {
24359
+ if (domGlobals.document.domain !== domGlobals.window.location.hostname && Env.browser.isIE()) {
24332
24360
  var bodyUuid = Uuid.uuid('mce');
24333
24361
  editor[bodyUuid] = function () {
24334
24362
  InitContentBody.initContentBody(editor);
@@ -24821,9 +24849,12 @@
24821
24849
  });
24822
24850
  }
24823
24851
  };
24852
+ var isClickEvent = function (e) {
24853
+ return e.type === 'click';
24854
+ };
24824
24855
  var preventReadOnlyEvents = function (e) {
24825
24856
  var target = e.target;
24826
- if (e.type === 'click' && target.tagName === 'A') {
24857
+ if (isClickEvent(e) && target.tagName === 'A' && !VK.metaKeyPressed(e)) {
24827
24858
  e.preventDefault();
24828
24859
  }
24829
24860
  };
@@ -25492,7 +25523,7 @@
25492
25523
  var fonts = font.split(/\s*,\s*/);
25493
25524
  return map(fonts, function (font) {
25494
25525
  if (font.indexOf(' ') !== -1 && !(startsWith(font, '"') || startsWith(font, '\''))) {
25495
- return '"' + font + '"';
25526
+ return '\'' + font + '\'';
25496
25527
  } else {
25497
25528
  return font;
25498
25529
  }
@@ -25928,7 +25959,7 @@
25928
25959
  return EditorCommands;
25929
25960
  }();
25930
25961
 
25931
- var nativeEvents = Tools.makeMap('focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange ' + 'mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover ' + 'draggesture dragdrop drop drag submit ' + 'compositionstart compositionend compositionupdate touchstart touchmove touchend', ' ');
25962
+ var nativeEvents = Tools.makeMap('focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange ' + 'mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover ' + 'draggesture dragdrop drop drag submit ' + 'compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel', ' ');
25932
25963
  var EventDispatcher = function () {
25933
25964
  function EventDispatcher(settings) {
25934
25965
  this.bindings = {};
@@ -26695,7 +26726,7 @@
26695
26726
  var DOM$8 = DOMUtils$1.DOM;
26696
26727
  var extend$3 = Tools.extend, each$j = Tools.each;
26697
26728
  var resolve$3 = Tools.resolve;
26698
- var ie$2 = Env.ie;
26729
+ var ie$1 = Env.ie;
26699
26730
  var Editor = function () {
26700
26731
  function Editor(id, settings, editorManager) {
26701
26732
  var _this = this;
@@ -26726,7 +26757,7 @@
26726
26757
  this.setDirty(false);
26727
26758
  this.documentBaseURI = new URI(this.settings.document_base_url, { base_uri: this.baseUri });
26728
26759
  this.baseURI = this.baseUri;
26729
- this.inline = this.settings.inline;
26760
+ this.inline = !!this.settings.inline;
26730
26761
  this.shortcuts = new Shortcuts(this);
26731
26762
  this.editorCommands = new EditorCommands(this);
26732
26763
  if (this.settings.cache_suffix) {
@@ -26831,7 +26862,7 @@
26831
26862
  Editor.prototype.hide = function () {
26832
26863
  var self = this, doc = self.getDoc();
26833
26864
  if (!self.hidden) {
26834
- if (ie$2 && doc && !self.inline) {
26865
+ if (ie$1 && doc && !self.inline) {
26835
26866
  doc.execCommand('SelectAll');
26836
26867
  }
26837
26868
  self.save();
@@ -27139,8 +27170,8 @@
27139
27170
  suffix: null,
27140
27171
  $: DomQuery,
27141
27172
  majorVersion: '5',
27142
- minorVersion: '0.16',
27143
- releaseDate: '2019-09-24',
27173
+ minorVersion: '1.1',
27174
+ releaseDate: '2019-10-28',
27144
27175
  editors: legacyEditors,
27145
27176
  i18n: I18n,
27146
27177
  activeEditor: null,
@@ -27238,7 +27269,7 @@
27238
27269
  };
27239
27270
  var findTargets = function (settings) {
27240
27271
  var l, targets = [];
27241
- if (Env.ie && Env.ie < 11) {
27272
+ if (Env.browser.isIE() && Env.browser.version.major < 11) {
27242
27273
  ErrorReporter.initError('TinyMCE does not support the browser you are using. For a list of supported' + ' browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/');
27243
27274
  return [];
27244
27275
  } else if (isQuirksMode) {