tinymce-rails 6.4.2 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/source/tinymce/tinymce.js +1018 -343
  3. data/lib/tinymce/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/tinymce/icons/default/icons.js +1 -1
  5. data/vendor/assets/javascripts/tinymce/langs/README.md +1 -1
  6. data/vendor/assets/javascripts/tinymce/models/dom/model.js +2 -2
  7. data/vendor/assets/javascripts/tinymce/plugins/accordion/plugin.js +4 -0
  8. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +2 -2
  9. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +2 -2
  10. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +2 -2
  11. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +1 -1
  12. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +2 -2
  14. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +2 -2
  16. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +2 -2
  17. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +2 -2
  18. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -1
  19. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ar.js +90 -0
  20. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +90 -0
  21. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ca.js +90 -0
  22. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/cs.js +90 -0
  23. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/da.js +90 -0
  24. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/de.js +90 -0
  25. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/el.js +90 -0
  26. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/en.js +90 -0
  27. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/es.js +90 -0
  28. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/eu.js +90 -0
  29. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/fa.js +90 -0
  30. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/fi.js +90 -0
  31. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +90 -0
  32. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/he_IL.js +90 -0
  33. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/hi.js +90 -0
  34. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/hr.js +90 -0
  35. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +90 -0
  36. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/id.js +90 -0
  37. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/it.js +90 -0
  38. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ja.js +90 -0
  39. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/kk.js +90 -0
  40. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +90 -0
  41. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ms.js +90 -0
  42. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +90 -0
  43. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/nl.js +90 -0
  44. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/pl.js +90 -0
  45. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +90 -0
  46. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +90 -0
  47. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ro.js +90 -0
  48. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ru.js +90 -0
  49. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/sk.js +90 -0
  50. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +90 -0
  51. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +90 -0
  52. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/th_TH.js +90 -0
  53. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/tr.js +90 -0
  54. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/uk.js +90 -0
  55. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/vi.js +90 -0
  56. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +84 -0
  57. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +90 -0
  58. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +2 -2
  59. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +2 -2
  60. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
  61. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +2 -2
  62. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +2 -2
  63. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +2 -2
  64. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -2
  65. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +2 -2
  66. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +2 -2
  67. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
  68. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -2
  69. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
  70. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +2 -2
  71. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  72. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +2 -2
  73. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
  74. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -1
  75. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +2 -2
  76. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.css +1 -1
  77. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.css +1 -1
  78. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  79. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.min.css +1 -1
  80. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
  81. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
  82. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.css +1 -1
  83. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.css +1 -1
  84. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  85. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  86. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
  87. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  88. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.css +1 -1
  89. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.css +1 -1
  90. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
  91. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
  92. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.css +1 -1
  93. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  94. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.css +1 -1
  95. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.css +1 -1
  96. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
  97. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
  98. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.css +1 -1
  99. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  100. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
  101. data/vendor/assets/javascripts/tinymce/tinymce.d.ts +141 -120
  102. data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
  103. metadata +42 -2
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TinyMCE version 6.4.2 (2023-04-26)
2
+ * TinyMCE version 6.5.0 (2023-06-12)
3
3
  */
4
4
 
5
5
  (function () {
@@ -955,43 +955,43 @@
955
955
  const PlatformDetection = { detect: detect$3 };
956
956
 
957
957
  const mediaMatch = query => window.matchMedia(query).matches;
958
- let platform$2 = cached(() => PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch));
959
- const detect$2 = () => platform$2();
958
+ let platform$4 = cached(() => PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch));
959
+ const detect$2 = () => platform$4();
960
960
 
961
961
  const userAgent = navigator.userAgent;
962
- const platform$1 = detect$2();
963
- const browser$1 = platform$1.browser;
964
- const os = platform$1.os;
965
- const deviceType = platform$1.deviceType;
962
+ const platform$3 = detect$2();
963
+ const browser$2 = platform$3.browser;
964
+ const os$1 = platform$3.os;
965
+ const deviceType = platform$3.deviceType;
966
966
  const windowsPhone = userAgent.indexOf('Windows Phone') !== -1;
967
967
  const Env = {
968
968
  transparentSrc: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
969
- documentMode: browser$1.isIE() ? document.documentMode || 7 : 10,
969
+ documentMode: browser$2.isIE() ? document.documentMode || 7 : 10,
970
970
  cacheSuffix: null,
971
971
  container: null,
972
- canHaveCSP: !browser$1.isIE(),
972
+ canHaveCSP: !browser$2.isIE(),
973
973
  windowsPhone,
974
974
  browser: {
975
- current: browser$1.current,
976
- version: browser$1.version,
977
- isChromium: browser$1.isChromium,
978
- isEdge: browser$1.isEdge,
979
- isFirefox: browser$1.isFirefox,
980
- isIE: browser$1.isIE,
981
- isOpera: browser$1.isOpera,
982
- isSafari: browser$1.isSafari
975
+ current: browser$2.current,
976
+ version: browser$2.version,
977
+ isChromium: browser$2.isChromium,
978
+ isEdge: browser$2.isEdge,
979
+ isFirefox: browser$2.isFirefox,
980
+ isIE: browser$2.isIE,
981
+ isOpera: browser$2.isOpera,
982
+ isSafari: browser$2.isSafari
983
983
  },
984
984
  os: {
985
- current: os.current,
986
- version: os.version,
987
- isAndroid: os.isAndroid,
988
- isChromeOS: os.isChromeOS,
989
- isFreeBSD: os.isFreeBSD,
990
- isiOS: os.isiOS,
991
- isLinux: os.isLinux,
992
- isMacOS: os.isMacOS,
993
- isSolaris: os.isSolaris,
994
- isWindows: os.isWindows
985
+ current: os$1.current,
986
+ version: os$1.version,
987
+ isAndroid: os$1.isAndroid,
988
+ isChromeOS: os$1.isChromeOS,
989
+ isFreeBSD: os$1.isFreeBSD,
990
+ isiOS: os$1.isiOS,
991
+ isLinux: os$1.isLinux,
992
+ isMacOS: os$1.isMacOS,
993
+ isSolaris: os$1.isSolaris,
994
+ isWindows: os$1.isWindows
995
995
  },
996
996
  deviceType: {
997
997
  isDesktop: deviceType.isDesktop,
@@ -1195,7 +1195,7 @@
1195
1195
  const dom = element.dom;
1196
1196
  return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;
1197
1197
  };
1198
- const remove$b = (element, key) => {
1198
+ const remove$a = (element, key) => {
1199
1199
  element.dom.removeAttribute(key);
1200
1200
  };
1201
1201
  const hasNone = element => {
@@ -1217,12 +1217,12 @@
1217
1217
  set$3(element, attr, nu.join(' '));
1218
1218
  return true;
1219
1219
  };
1220
- const remove$a = (element, attr, id) => {
1220
+ const remove$9 = (element, attr, id) => {
1221
1221
  const nu = filter$5(read$4(element, attr), v => v !== id);
1222
1222
  if (nu.length > 0) {
1223
1223
  set$3(element, attr, nu.join(' '));
1224
1224
  } else {
1225
- remove$b(element, attr);
1225
+ remove$a(element, attr);
1226
1226
  }
1227
1227
  return false;
1228
1228
  };
@@ -1230,10 +1230,10 @@
1230
1230
  const supports = element => element.dom.classList !== undefined;
1231
1231
  const get$8 = element => read$4(element, 'class');
1232
1232
  const add$3 = (element, clazz) => add$4(element, 'class', clazz);
1233
- const remove$9 = (element, clazz) => remove$a(element, 'class', clazz);
1233
+ const remove$8 = (element, clazz) => remove$9(element, 'class', clazz);
1234
1234
  const toggle$2 = (element, clazz) => {
1235
1235
  if (contains$2(get$8(element), clazz)) {
1236
- return remove$9(element, clazz);
1236
+ return remove$8(element, clazz);
1237
1237
  } else {
1238
1238
  return add$3(element, clazz);
1239
1239
  }
@@ -1249,15 +1249,15 @@
1249
1249
  const cleanClass = element => {
1250
1250
  const classList = supports(element) ? element.dom.classList : get$8(element);
1251
1251
  if (classList.length === 0) {
1252
- remove$b(element, 'class');
1252
+ remove$a(element, 'class');
1253
1253
  }
1254
1254
  };
1255
- const remove$8 = (element, clazz) => {
1255
+ const remove$7 = (element, clazz) => {
1256
1256
  if (supports(element)) {
1257
1257
  const classList = element.dom.classList;
1258
1258
  classList.remove(clazz);
1259
1259
  } else {
1260
- remove$9(element, clazz);
1260
+ remove$8(element, clazz);
1261
1261
  }
1262
1262
  cleanClass(element);
1263
1263
  };
@@ -1391,6 +1391,7 @@
1391
1391
  const firstChild = element => child$1(element, 0);
1392
1392
  const lastChild = element => child$1(element, element.dom.childNodes.length - 1);
1393
1393
  const childNodesCount = element => element.dom.childNodes.length;
1394
+ const hasChildNodes = element => element.dom.hasChildNodes();
1394
1395
 
1395
1396
  const getHead = doc => {
1396
1397
  const b = doc.dom.head;
@@ -1559,11 +1560,11 @@
1559
1560
  }
1560
1561
  return css;
1561
1562
  };
1562
- const remove$7 = (element, property) => {
1563
+ const remove$6 = (element, property) => {
1563
1564
  const dom = element.dom;
1564
1565
  internalRemove(dom, property);
1565
1566
  if (is$2(getOpt(element, 'style').map(trim$3), '')) {
1566
- remove$b(element, 'style');
1567
+ remove$a(element, 'style');
1567
1568
  }
1568
1569
  };
1569
1570
  const reflow = e => e.dom.offsetWidth;
@@ -1616,10 +1617,10 @@
1616
1617
  const empty = element => {
1617
1618
  element.dom.textContent = '';
1618
1619
  each$e(children$1(element), rogue => {
1619
- remove$6(rogue);
1620
+ remove$5(rogue);
1620
1621
  });
1621
1622
  };
1622
- const remove$6 = element => {
1623
+ const remove$5 = element => {
1623
1624
  const dom = element.dom;
1624
1625
  if (dom.parentNode !== null) {
1625
1626
  dom.parentNode.removeChild(dom);
@@ -1630,7 +1631,7 @@
1630
1631
  if (children.length > 0) {
1631
1632
  after$3(wrapper, children);
1632
1633
  }
1633
- remove$6(wrapper);
1634
+ remove$5(wrapper);
1634
1635
  };
1635
1636
 
1636
1637
  const fromHtml = (html, scope) => {
@@ -1960,10 +1961,12 @@
1960
1961
  'embed'
1961
1962
  ]);
1962
1963
  const isListItem$2 = matchNodeName('li');
1964
+ const isDetails = matchNodeName('details');
1965
+ const isSummary = matchNodeName('summary');
1963
1966
 
1964
1967
  const zeroWidth = '\uFEFF';
1965
1968
  const nbsp = '\xA0';
1966
- const isZwsp$1 = char => char === zeroWidth;
1969
+ const isZwsp$2 = char => char === zeroWidth;
1967
1970
  const removeZwsp = s => s.replace(/\uFEFF/g, '');
1968
1971
 
1969
1972
  const NodeValue = (is, name) => {
@@ -2135,7 +2138,7 @@
2135
2138
  const allBrs = descendants(elm, 'br');
2136
2139
  const brs = filter$5(getLastChildren$1(elm).slice(-1), isBr$5);
2137
2140
  if (allBrs.length === brs.length) {
2138
- each$e(brs, remove$6);
2141
+ each$e(brs, remove$5);
2139
2142
  }
2140
2143
  };
2141
2144
  const createPaddingBr = () => {
@@ -2151,14 +2154,14 @@
2151
2154
  lastChild(elm).each(lastChild => {
2152
2155
  prevSibling(lastChild).each(lastChildPrevSibling => {
2153
2156
  if (isBlock$2(elm) && isBr$5(lastChild) && isBlock$2(lastChildPrevSibling)) {
2154
- remove$6(lastChild);
2157
+ remove$5(lastChild);
2155
2158
  }
2156
2159
  });
2157
2160
  });
2158
2161
  };
2159
2162
 
2160
2163
  const ZWSP$1 = zeroWidth;
2161
- const isZwsp = isZwsp$1;
2164
+ const isZwsp$1 = isZwsp$2;
2162
2165
  const trim$1 = removeZwsp;
2163
2166
 
2164
2167
  const isElement$5 = isElement$6;
@@ -2169,7 +2172,7 @@
2169
2172
  }
2170
2173
  return isElement$5(node) && node.hasAttribute('data-mce-caret');
2171
2174
  };
2172
- const isCaretContainerInline = node => isText$9(node) && isZwsp(node.data);
2175
+ const isCaretContainerInline = node => isText$9(node) && isZwsp$1(node.data);
2173
2176
  const isCaretContainer$2 = node => isCaretContainerBlock$1(node) || isCaretContainerInline(node);
2174
2177
  const hasContent = node => node.firstChild !== node.lastChild || !isBr$6(node.firstChild);
2175
2178
  const insertInline$1 = (node, before) => {
@@ -2321,6 +2324,14 @@
2321
2324
 
2322
2325
  const whiteSpaceRegExp = /^[ \t\r\n]*$/;
2323
2326
  const isWhitespaceText = text => whiteSpaceRegExp.test(text);
2327
+ const isZwsp = text => {
2328
+ for (const c of text) {
2329
+ if (!isZwsp$2(c)) {
2330
+ return false;
2331
+ }
2332
+ }
2333
+ return true;
2334
+ };
2324
2335
  const isCollapsibleWhitespace$1 = c => ' \f\t\x0B'.indexOf(c) !== -1;
2325
2336
  const isNewLineChar = c => c === '\n' || c === '\r';
2326
2337
  const isNewline = (text, idx) => idx < text.length && idx >= 0 ? isNewLineChar(text[idx]) : false;
@@ -2514,10 +2525,10 @@
2514
2525
  const isTransparentAstBlock = (schema, node) => node.type === 1 && isTransparentElementName(schema, node.name) && isString(node.attr(transparentBlockAttr));
2515
2526
  const isTransparentAstInline = (schema, node) => node.type === 1 && isTransparentElementName(schema, node.name) && isUndefined(node.attr(transparentBlockAttr));
2516
2527
 
2517
- const browser = detect$2().browser;
2528
+ const browser$1 = detect$2().browser;
2518
2529
  const firstElement = nodes => find$2(nodes, isElement$7);
2519
2530
  const getTableCaptionDeltaY = elm => {
2520
- if (browser.isFirefox() && name(elm) === 'table') {
2531
+ if (browser$1.isFirefox() && name(elm) === 'table') {
2521
2532
  return firstElement(children$1(elm)).filter(elm => {
2522
2533
  return name(elm) === 'caption';
2523
2534
  }).bind(caption => {
@@ -2584,7 +2595,7 @@
2584
2595
  };
2585
2596
  const removeStyle = id => {
2586
2597
  const styleContainer = getStyleContainer(edos);
2587
- descendant(styleContainer, '#' + id).each(remove$6);
2598
+ descendant(styleContainer, '#' + id).each(remove$5);
2588
2599
  };
2589
2600
  const getOrCreateState = url => get$a(loadedStates, url).getOrThunk(() => ({
2590
2601
  id: 'mce-u' + idCount++,
@@ -2973,14 +2984,15 @@
2973
2984
  add('style', 'media type scoped');
2974
2985
  add('script', 'src async defer type charset');
2975
2986
  add('body', 'onafterprint onbeforeprint onbeforeunload onblur onerror onfocus ' + 'onhashchange onload onmessage onoffline ononline onpagehide onpageshow ' + 'onpopstate onresize onscroll onstorage onunload', flowContent);
2976
- add('address dt dd div caption', '', flowContent);
2987
+ add('dd div', '', flowContent);
2988
+ add('address dt caption', '', type === 'html4' ? phrasingContent : flowContent);
2977
2989
  add('h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn', '', phrasingContent);
2978
2990
  add('blockquote', 'cite', flowContent);
2979
2991
  add('ol', 'reversed start type', 'li');
2980
2992
  add('ul', '', 'li');
2981
2993
  add('li', 'value', flowContent);
2982
2994
  add('dl', '', 'dt dd');
2983
- add('a', 'href target rel media hreflang type', flowContent);
2995
+ add('a', 'href target rel media hreflang type', type === 'html4' ? phrasingContent : flowContent);
2984
2996
  add('q', 'cite', phrasingContent);
2985
2997
  add('ins del', 'cite datetime', flowContent);
2986
2998
  add('img', 'src sizes srcset alt usemap ismap width height');
@@ -3408,8 +3420,10 @@
3408
3420
  elements[name].removeEmpty = true;
3409
3421
  }
3410
3422
  });
3411
- each$b(split$1('p h1 h2 h3 h4 h5 h6 th td pre div address caption li'), name => {
3412
- elements[name].paddEmpty = true;
3423
+ each$b(split$1('p h1 h2 h3 h4 h5 h6 th td pre div address caption li summary'), name => {
3424
+ if (elements[name]) {
3425
+ elements[name].paddEmpty = true;
3426
+ }
3413
3427
  });
3414
3428
  each$b(split$1('span'), name => {
3415
3429
  elements[name].removeEmptyAttrs = true;
@@ -4055,7 +4069,7 @@
4055
4069
  const numericalCssMap = Tools.makeMap('fill-opacity font-weight line-height opacity orphans widows z-index zoom', ' ');
4056
4070
  const legacySetAttribute = (elm, name, value) => {
4057
4071
  if (isNullable(value) || value === '') {
4058
- remove$b(elm, name);
4072
+ remove$a(elm, name);
4059
4073
  } else {
4060
4074
  set$3(elm, name, value);
4061
4075
  }
@@ -4092,7 +4106,7 @@
4092
4106
  const applyStyle$1 = ($elm, cssName, cssValue) => {
4093
4107
  const normalizedName = camelCaseToHyphens(cssName);
4094
4108
  if (isNullable(cssValue) || cssValue === '') {
4095
- remove$7($elm, normalizedName);
4109
+ remove$6($elm, normalizedName);
4096
4110
  } else {
4097
4111
  set$2($elm, normalizedName, convertStyleToString(cssValue, normalizedName));
4098
4112
  }
@@ -4121,7 +4135,7 @@
4121
4135
  if (keepValues) {
4122
4136
  legacySetAttribute(sugarElm, internalStyleName, value);
4123
4137
  }
4124
- remove$b(sugarElm, 'style');
4138
+ remove$a(sugarElm, 'style');
4125
4139
  if (isString(value)) {
4126
4140
  setAll(sugarElm, styles.parse(value));
4127
4141
  }
@@ -4433,13 +4447,13 @@
4433
4447
  if (keepChildren) {
4434
4448
  each$e(children$1($node), child => {
4435
4449
  if (isText$b(child) && child.dom.length === 0) {
4436
- remove$6(child);
4450
+ remove$5(child);
4437
4451
  } else {
4438
4452
  before$3($node, child);
4439
4453
  }
4440
4454
  });
4441
4455
  }
4442
- remove$6($node);
4456
+ remove$5($node);
4443
4457
  return $node.dom;
4444
4458
  });
4445
4459
  };
@@ -4492,7 +4506,7 @@
4492
4506
  const classes = cls.split(' ');
4493
4507
  each$e(classes, c => {
4494
4508
  if (isNonNullable(state)) {
4495
- const fn = state ? add$2 : remove$8;
4509
+ const fn = state ? add$2 : remove$7;
4496
4510
  fn($elm, c);
4497
4511
  } else {
4498
4512
  toggle$1($elm, c);
@@ -4513,7 +4527,7 @@
4513
4527
  return isNonNullable($elm) && forall(classes, c => has($elm, c));
4514
4528
  };
4515
4529
  const show = elm => {
4516
- run(elm, e => remove$7(SugarElement.fromDom(e), 'display'));
4530
+ run(elm, e => remove$6(SugarElement.fromDom(e), 'display'));
4517
4531
  };
4518
4532
  const hide = elm => {
4519
4533
  run(elm, e => set$2(SugarElement.fromDom(e), 'display', 'none'));
@@ -4603,7 +4617,7 @@
4603
4617
  }
4604
4618
  return false;
4605
4619
  };
4606
- const isEmpty = (node, elements) => {
4620
+ const isEmpty = (node, elements, options) => {
4607
4621
  let brCount = 0;
4608
4622
  if (isNonEmptyElement(node)) {
4609
4623
  return false;
@@ -4637,7 +4651,7 @@
4637
4651
  if (isComment(tempNode)) {
4638
4652
  return false;
4639
4653
  }
4640
- if (isText$a(tempNode) && !isWhitespaceText(tempNode.data)) {
4654
+ if (isText$a(tempNode) && !isWhitespaceText(tempNode.data) && (!(options === null || options === void 0 ? void 0 : options.includeZwsp) || !isZwsp(tempNode.data))) {
4641
4655
  return false;
4642
4656
  }
4643
4657
  if (isText$a(tempNode) && tempNode.parentNode && whitespaceElements[tempNode.parentNode.nodeName] && isWhitespaceText(tempNode.data)) {
@@ -4743,8 +4757,7 @@
4743
4757
  const isEditable = node => {
4744
4758
  if (isNonNullable(node)) {
4745
4759
  const scope = isElement$6(node) ? node : node.parentElement;
4746
- const isRootEditable = getContentEditable(getRoot()) === 'true';
4747
- return isNonNullable(scope) && isEditable$3(SugarElement.fromDom(scope), isRootEditable);
4760
+ return isNonNullable(scope) && isEditable$3(SugarElement.fromDom(scope));
4748
4761
  } else {
4749
4762
  return false;
4750
4763
  }
@@ -4986,7 +4999,9 @@
4986
4999
  const uniqueScripts = stringArray(scripts);
4987
5000
  if (self.loading) {
4988
5001
  return new Promise((resolve, reject) => {
4989
- self.queueLoadedCallbacks.push(() => processQueue(uniqueScripts).then(resolve, reject));
5002
+ self.queueLoadedCallbacks.push(() => {
5003
+ processQueue(uniqueScripts).then(resolve, reject);
5004
+ });
4990
5005
  });
4991
5006
  } else {
4992
5007
  return processQueue(uniqueScripts);
@@ -5354,7 +5369,7 @@
5354
5369
  if (state) {
5355
5370
  set$3(elem, dataAnnotationActive(), 'true');
5356
5371
  } else {
5357
- remove$b(elem, dataAnnotationActive());
5372
+ remove$a(elem, dataAnnotationActive());
5358
5373
  }
5359
5374
  });
5360
5375
  };
@@ -5463,9 +5478,9 @@
5463
5478
  add$2(element, x);
5464
5479
  });
5465
5480
  };
5466
- const remove$5 = (element, classes) => {
5481
+ const remove$4 = (element, classes) => {
5467
5482
  each$e(classes, x => {
5468
- remove$8(element, x);
5483
+ remove$7(element, x);
5469
5484
  });
5470
5485
  };
5471
5486
 
@@ -5483,7 +5498,7 @@
5483
5498
  after$4(original, nu);
5484
5499
  const children = children$1(original);
5485
5500
  append(nu, children);
5486
- remove$6(original);
5501
+ remove$5(original);
5487
5502
  return nu;
5488
5503
  };
5489
5504
 
@@ -6744,11 +6759,11 @@
6744
6759
  });
6745
6760
  registerOption('indent_before', {
6746
6761
  processor: 'string',
6747
- default: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist'
6762
+ default: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist'
6748
6763
  });
6749
6764
  registerOption('indent_after', {
6750
6765
  processor: 'string',
6751
- default: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist'
6766
+ default: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist'
6752
6767
  });
6753
6768
  registerOption('indent_use_margin', {
6754
6769
  processor: 'boolean',
@@ -6917,6 +6932,10 @@
6917
6932
  processor: 'boolean',
6918
6933
  default: false
6919
6934
  });
6935
+ registerOption('editable_root', {
6936
+ processor: 'boolean',
6937
+ default: true
6938
+ });
6920
6939
  registerOption('plugins', {
6921
6940
  processor: 'string[]',
6922
6941
  default: []
@@ -6993,7 +7012,10 @@
6993
7012
  processor: 'boolean',
6994
7013
  default: false
6995
7014
  });
6996
- registerOption('remove_trailing_brs', { processor: 'boolean' });
7015
+ registerOption('remove_trailing_brs', {
7016
+ processor: 'boolean',
7017
+ default: true
7018
+ });
6997
7019
  registerOption('inline_styles', {
6998
7020
  processor: 'boolean',
6999
7021
  default: true,
@@ -7206,6 +7228,48 @@
7206
7228
  processor: 'boolean',
7207
7229
  default: true
7208
7230
  });
7231
+ registerOption('details_initial_state', {
7232
+ processor: value => {
7233
+ const valid = contains$2([
7234
+ 'inherited',
7235
+ 'collapsed',
7236
+ 'expanded'
7237
+ ], value);
7238
+ return valid ? {
7239
+ value,
7240
+ valid
7241
+ } : {
7242
+ valid: false,
7243
+ message: 'Must be one of: inherited, collapsed, or expanded.'
7244
+ };
7245
+ },
7246
+ default: 'inherited'
7247
+ });
7248
+ registerOption('details_serialized_state', {
7249
+ processor: value => {
7250
+ const valid = contains$2([
7251
+ 'inherited',
7252
+ 'collapsed',
7253
+ 'expanded'
7254
+ ], value);
7255
+ return valid ? {
7256
+ value,
7257
+ valid
7258
+ } : {
7259
+ valid: false,
7260
+ message: 'Must be one of: inherited, collapsed, or expanded.'
7261
+ };
7262
+ },
7263
+ default: 'inherited'
7264
+ });
7265
+ registerOption('init_content_sync', {
7266
+ processor: 'boolean',
7267
+ default: false
7268
+ });
7269
+ registerOption('newdocument_content', {
7270
+ processor: 'string',
7271
+ default: ''
7272
+ });
7209
7273
  editor.on('ScriptsLoaded', () => {
7210
7274
  registerOption('directionality', {
7211
7275
  processor: 'string',
@@ -7274,6 +7338,7 @@
7274
7338
  const getCustomUndoRedoLevels = option('custom_undo_redo_levels');
7275
7339
  const shouldDisableNodeChange = option('disable_nodechange');
7276
7340
  const isReadOnly$1 = option('readonly');
7341
+ const hasEditableRoot$1 = option('editable_root');
7277
7342
  const hasContentCssCors = option('content_css_cors');
7278
7343
  const getPlugins = option('plugins');
7279
7344
  const getExternalPlugins$1 = option('external_plugins');
@@ -7292,6 +7357,7 @@
7292
7357
  const shouldPasteDataImages = option('paste_data_images');
7293
7358
  const getPastePreProcess = option('paste_preprocess');
7294
7359
  const getPastePostProcess = option('paste_postprocess');
7360
+ const getNewDocumentContent = option('newdocument_content');
7295
7361
  const getPasteWebkitStyles = option('paste_webkit_styles');
7296
7362
  const shouldPasteRemoveWebKitStyles = option('paste_remove_styles_if_webkit');
7297
7363
  const shouldPasteMergeFormats = option('paste_merge_formats');
@@ -7307,12 +7373,15 @@
7307
7373
  const shouldPreserveCData = option('preserve_cdata');
7308
7374
  const shouldHighlightOnFocus = option('highlight_on_focus');
7309
7375
  const shouldSanitizeXss = option('xss_sanitization');
7376
+ const shouldUseDocumentWrite = option('init_content_sync');
7310
7377
  const hasTextPatternsLookup = editor => editor.options.isSet('text_patterns_lookup');
7311
7378
  const getFontStyleValues = editor => Tools.explode(editor.options.get('font_size_style_values'));
7312
7379
  const getFontSizeClasses = editor => Tools.explode(editor.options.get('font_size_classes'));
7313
7380
  const isEncodingXml = editor => editor.options.get('encoding') === 'xml';
7314
7381
  const getAllowedImageFileTypes = editor => Tools.explode(editor.options.get('images_file_types'));
7315
7382
  const hasTableTabNavigation = option('table_tab_navigation');
7383
+ const getDetailsInitialState = option('details_initial_state');
7384
+ const getDetailsSerializedState = option('details_serialized_state');
7316
7385
 
7317
7386
  const isElement$3 = isElement$6;
7318
7387
  const isText$5 = isText$a;
@@ -7336,7 +7405,7 @@
7336
7405
  }
7337
7406
  };
7338
7407
  const removeUnchanged = (caretContainer, pos) => {
7339
- remove$4(caretContainer);
7408
+ remove$3(caretContainer);
7340
7409
  return pos;
7341
7410
  };
7342
7411
  const removeTextAndReposition = (caretContainer, pos) => {
@@ -7355,13 +7424,13 @@
7355
7424
  const newPosition = indexOf$1(from(parentNode.childNodes), caretContainer).map(index => {
7356
7425
  return index < pos.offset() ? CaretPosition(parentNode, pos.offset() - 1) : pos;
7357
7426
  }).getOr(pos);
7358
- remove$4(caretContainer);
7427
+ remove$3(caretContainer);
7359
7428
  return newPosition;
7360
7429
  };
7361
7430
  const removeTextCaretContainer = (caretContainer, pos) => isText$5(caretContainer) && pos.container() === caretContainer ? removeTextAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);
7362
7431
  const removeElementCaretContainer = (caretContainer, pos) => pos.container() === caretContainer.parentNode ? removeElementAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);
7363
7432
  const removeAndReposition = (container, pos) => CaretPosition.isTextPosition(pos) ? removeTextCaretContainer(container, pos) : removeElementCaretContainer(container, pos);
7364
- const remove$4 = caretContainerNode => {
7433
+ const remove$3 = caretContainerNode => {
7365
7434
  if (isElement$3(caretContainerNode) && isCaretContainer$2(caretContainerNode)) {
7366
7435
  if (hasContent(caretContainerNode)) {
7367
7436
  caretContainerNode.removeAttribute('data-mce-caret');
@@ -7486,7 +7555,7 @@
7486
7555
  const hide = () => {
7487
7556
  trimInlineCaretContainers(root);
7488
7557
  if (caretContainerNode) {
7489
- remove$4(caretContainerNode);
7558
+ remove$3(caretContainerNode);
7490
7559
  caretContainerNode = null;
7491
7560
  }
7492
7561
  lastVisualCaret.on(caretState => {
@@ -8208,7 +8277,7 @@
8208
8277
  const is = expected => actual => expected === actual;
8209
8278
  const isNbsp = is(nbsp);
8210
8279
  const isWhiteSpace = chr => chr !== '' && ' \f\n\r\t\x0B'.indexOf(chr) !== -1;
8211
- const isContent = chr => !isWhiteSpace(chr) && !isNbsp(chr) && !isZwsp$1(chr);
8280
+ const isContent = chr => !isWhiteSpace(chr) && !isNbsp(chr) && !isZwsp$2(chr);
8212
8281
 
8213
8282
  const hexColour = value => ({ value: normalizeHex(value) });
8214
8283
  const normalizeHex = hex => removeLeading(hex, '#').toUpperCase();
@@ -8911,16 +8980,16 @@
8911
8980
  }
8912
8981
  };
8913
8982
  const removeDirectAnnotation = elem => {
8914
- remove$8(elem, annotation());
8915
- remove$b(elem, `${ dataAnnotationId() }`);
8916
- remove$b(elem, `${ dataAnnotation() }`);
8917
- remove$b(elem, `${ dataAnnotationActive() }`);
8983
+ remove$7(elem, annotation());
8984
+ remove$a(elem, `${ dataAnnotationId() }`);
8985
+ remove$a(elem, `${ dataAnnotation() }`);
8986
+ remove$a(elem, `${ dataAnnotationActive() }`);
8918
8987
  const customAttrNames = getOpt(elem, `${ dataAnnotationAttributes() }`).map(names => names.split(',')).getOr([]);
8919
8988
  const customClasses = getOpt(elem, `${ dataAnnotationClasses() }`).map(names => names.split(',')).getOr([]);
8920
- each$e(customAttrNames, name => remove$b(elem, name));
8921
- remove$5(elem, customClasses);
8922
- remove$b(elem, `${ dataAnnotationClasses() }`);
8923
- remove$b(elem, `${ dataAnnotationAttributes() }`);
8989
+ each$e(customAttrNames, name => remove$a(elem, name));
8990
+ remove$4(elem, customClasses);
8991
+ remove$a(elem, `${ dataAnnotationClasses() }`);
8992
+ remove$a(elem, `${ dataAnnotationAttributes() }`);
8924
8993
  };
8925
8994
  const makeAnnotation = (eDoc, uid, data, annotationName, decorate) => {
8926
8995
  const master = SugarElement.fromTag('span', eDoc);
@@ -9140,6 +9209,7 @@
9140
9209
  internal
9141
9210
  });
9142
9211
  const firePastePlainTextToggle = (editor, state) => editor.dispatch('PastePlainTextToggle', { state });
9212
+ const fireEditableRootStateChange = (editor, state) => editor.dispatch('EditableRootStateChange', { state });
9143
9213
 
9144
9214
  const VK = {
9145
9215
  BACKSPACE: 8,
@@ -9165,7 +9235,7 @@
9165
9235
  };
9166
9236
 
9167
9237
  const elementSelectionAttr = 'data-mce-selected';
9168
- const controlElmSelector = 'table,img,figure.image,hr,video,span.mce-preview-object';
9238
+ const controlElmSelector = 'table,img,figure.image,hr,video,span.mce-preview-object,details';
9169
9239
  const abs = Math.abs;
9170
9240
  const round$1 = Math.round;
9171
9241
  const resizeHandles = {
@@ -9467,7 +9537,7 @@
9467
9537
  each$e(dom.select(`img[${ elementSelectionAttr }],hr[${ elementSelectionAttr }]`), img => {
9468
9538
  img.removeAttribute(elementSelectionAttr);
9469
9539
  });
9470
- if (isNonNullable(controlElm) && isChildOrEqual(controlElm, rootElement)) {
9540
+ if (isNonNullable(controlElm) && isChildOrEqual(controlElm, rootElement) && editor.hasFocus()) {
9471
9541
  disableGeckoResize();
9472
9542
  const startElm = selection.getStart(true);
9473
9543
  if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) {
@@ -10190,7 +10260,7 @@
10190
10260
  const startPoint = descend(element, offset);
10191
10261
  const span = SugarElement.fromHtml('<span data-mce-bogus="all" style="display: inline-block;">' + ZWSP$1 + '</span>');
10192
10262
  before$3(startPoint.element, span);
10193
- return markerInfo(span, () => remove$6(span));
10263
+ return markerInfo(span, () => remove$5(span));
10194
10264
  };
10195
10265
  const elementMarker = element => markerInfo(SugarElement.fromDom(element), noop);
10196
10266
  const withMarker = (editor, f, rng, alignToTop) => {
@@ -10462,7 +10532,7 @@
10462
10532
  Delay.setEditorTimeout(editor, () => {
10463
10533
  const focusedEditor = editorManager.focusedEditor;
10464
10534
  if (!isEditorContentAreaElement(getActiveElement(editor)) || focusedEditor !== editor) {
10465
- toggleContentAreaOnFocus(editor, remove$8);
10535
+ toggleContentAreaOnFocus(editor, remove$7);
10466
10536
  }
10467
10537
  if (!isUIElement(editor, getActiveElement(editor)) && focusedEditor === editor) {
10468
10538
  editor.dispatch('blur', { focusedEditor: null });
@@ -10720,7 +10790,7 @@
10720
10790
  };
10721
10791
  const detect$1 = elm => closest$3(elm, autocompleteSelector);
10722
10792
  const findIn = elm => descendant(elm, autocompleteSelector);
10723
- const remove$3 = (editor, elm) => findIn(elm).each(wrapper => {
10793
+ const remove$2 = (editor, elm) => findIn(elm).each(wrapper => {
10724
10794
  const bookmark = editor.selection.getBookmark();
10725
10795
  unwrap(wrapper);
10726
10796
  editor.selection.moveToBookmark(bookmark);
@@ -10771,14 +10841,6 @@
10771
10841
  return node.attr('name') || node.attr('id') && !node.firstChild || node.attr('data-mce-bookmark') || isNamedAnchor;
10772
10842
  };
10773
10843
  class AstNode {
10774
- constructor(name, type) {
10775
- this.name = name;
10776
- this.type = type;
10777
- if (type === 1) {
10778
- this.attributes = [];
10779
- this.attributes.map = {};
10780
- }
10781
- }
10782
10844
  static create(name, attrs) {
10783
10845
  const node = new AstNode(name, typeLookup[name] || 1);
10784
10846
  if (attrs) {
@@ -10788,6 +10850,14 @@
10788
10850
  }
10789
10851
  return node;
10790
10852
  }
10853
+ constructor(name, type) {
10854
+ this.name = name;
10855
+ this.type = type;
10856
+ if (type === 1) {
10857
+ this.attributes = [];
10858
+ this.attributes.map = {};
10859
+ }
10860
+ }
10791
10861
  replace(node) {
10792
10862
  const self = this;
10793
10863
  if (node.parent) {
@@ -11109,10 +11179,10 @@
11109
11179
  each$e(bogusElements, elem => {
11110
11180
  const bogusValue = get$9(elem, 'data-mce-bogus');
11111
11181
  if (bogusValue === 'all') {
11112
- remove$6(elem);
11182
+ remove$5(elem);
11113
11183
  } else if (isBr$5(elem)) {
11114
11184
  before$3(elem, SugarElement.fromText(zeroWidth));
11115
- remove$6(elem);
11185
+ remove$5(elem);
11116
11186
  } else {
11117
11187
  unwrap(elem);
11118
11188
  }
@@ -11121,7 +11191,7 @@
11121
11191
  const cleanupInputNames = parent => {
11122
11192
  const inputs = descendants(parent, 'input');
11123
11193
  each$e(inputs, input => {
11124
- remove$b(input, 'name');
11194
+ remove$a(input, 'name');
11125
11195
  });
11126
11196
  };
11127
11197
 
@@ -11146,7 +11216,7 @@
11146
11216
  const root = getContentContainer(dos);
11147
11217
  append$1(root, offscreenDiv);
11148
11218
  const content = trim$1(offscreenDiv.dom.innerText);
11149
- remove$6(offscreenDiv);
11219
+ remove$5(offscreenDiv);
11150
11220
  return content;
11151
11221
  };
11152
11222
  const getContentFromBody = (editor, args, body) => {
@@ -11438,7 +11508,7 @@
11438
11508
  const isAfterSpace = curry(isChar, false, isWhiteSpace);
11439
11509
  const isEmptyText = pos => {
11440
11510
  const container = pos.container();
11441
- return isText$a(container) && (container.data.length === 0 || isZwsp(container.data) && BookmarkManager.isBookmarkNode(container.parentNode));
11511
+ return isText$a(container) && (container.data.length === 0 || isZwsp$1(container.data) && BookmarkManager.isBookmarkNode(container.parentNode));
11442
11512
  };
11443
11513
  const matchesElementPosition = (before, predicate) => pos => getChildNodeAtRelativeOffset(before ? 0 : -1, pos).filter(predicate).isSome();
11444
11514
  const isImageBlock = node => isImg(node) && get$7(SugarElement.fromDom(node), 'display') === 'block';
@@ -11663,7 +11733,7 @@
11663
11733
  } else {
11664
11734
  newNode.insertData(0, removeNode.data);
11665
11735
  }
11666
- remove$6(SugarElement.fromDom(removeNode));
11736
+ remove$5(SugarElement.fromDom(removeNode));
11667
11737
  if (normalizeWhitespace) {
11668
11738
  normalizeWhitespaceAfter(newNode, whitespaceOffset);
11669
11739
  }
@@ -11722,7 +11792,7 @@
11722
11792
  const deleteNormalized = (elm, afterDeletePosOpt, normalizeWhitespace) => {
11723
11793
  const prevTextOpt = prevSibling(elm).filter(isText$b);
11724
11794
  const nextTextOpt = nextSibling(elm).filter(isText$b);
11725
- remove$6(elm);
11795
+ remove$5(elm);
11726
11796
  return lift3(prevTextOpt, nextTextOpt, afterDeletePosOpt, (prev, next, pos) => {
11727
11797
  const prevNode = prev.dom, nextNode = next.dom;
11728
11798
  const offset = prevNode.data.length;
@@ -11859,7 +11929,7 @@
11859
11929
  const additionalCleanupNodes = is$2(parent(lastBlock), root) ? [] : siblings(lastBlock);
11860
11930
  each$e(additionalCleanupNodes.concat(children$1(root)), node => {
11861
11931
  if (!eq(node, lastBlock) && !contains(node, lastBlock) && isEmpty$2(node)) {
11862
- remove$6(node);
11932
+ remove$5(node);
11863
11933
  }
11864
11934
  });
11865
11935
  }
@@ -12004,14 +12074,14 @@
12004
12074
  };
12005
12075
 
12006
12076
  const cleanCells = cells => each$e(cells, cell => {
12007
- remove$b(cell, 'contenteditable');
12077
+ remove$a(cell, 'contenteditable');
12008
12078
  fillWithPaddingBr(cell);
12009
12079
  });
12010
12080
  const getOutsideBlock = (editor, container) => Optional.from(editor.dom.getParent(container, editor.dom.isBlock)).map(SugarElement.fromDom);
12011
12081
  const handleEmptyBlock = (editor, startInTable, emptyBlock) => {
12012
12082
  emptyBlock.each(block => {
12013
12083
  if (startInTable) {
12014
- remove$6(block);
12084
+ remove$5(block);
12015
12085
  } else {
12016
12086
  fillWithPaddingBr(block);
12017
12087
  editor.selection.setCursorLocation(block.dom, 0);
@@ -12451,7 +12521,7 @@
12451
12521
  };
12452
12522
  const normalize = rng => rng.collapsed ? rng : normalizeBlockSelectionRange(rng);
12453
12523
 
12454
- const hasOnlyOneChild = node => {
12524
+ const hasOnlyOneChild$1 = node => {
12455
12525
  return isNonNullable(node.firstChild) && node.firstChild === node.lastChild;
12456
12526
  };
12457
12527
  const isPaddingNode = node => {
@@ -12459,7 +12529,7 @@
12459
12529
  };
12460
12530
  const isPaddedEmptyBlock = (schema, node) => {
12461
12531
  const blockElements = schema.getBlockElements();
12462
- return blockElements[node.name] && hasOnlyOneChild(node) && isPaddingNode(node.firstChild);
12532
+ return blockElements[node.name] && hasOnlyOneChild$1(node) && isPaddingNode(node.firstChild);
12463
12533
  };
12464
12534
  const isEmptyFragmentElement = (schema, node) => {
12465
12535
  const nonEmptyElements = schema.getNonEmptyElements();
@@ -12751,6 +12821,18 @@
12751
12821
  }
12752
12822
  return Optional.none();
12753
12823
  };
12824
+ const preventSplittingSummary = editor => {
12825
+ each$e(from(editor.getBody().querySelectorAll('details')), accordion => {
12826
+ const summaries = filter$5(from(accordion.children), node => node.nodeName === 'SUMMARY');
12827
+ if (summaries.length > 1) {
12828
+ each$e(summaries.slice(1), summary => {
12829
+ const element = SugarElement.fromDom(summary);
12830
+ remove$7(element, 'mce-accordion-summary');
12831
+ mutate(element, 'p');
12832
+ });
12833
+ }
12834
+ });
12835
+ };
12754
12836
  const insertHtmlAtCaret = (editor, value, details) => {
12755
12837
  var _a, _b;
12756
12838
  const selection = editor.selection;
@@ -12847,6 +12929,7 @@
12847
12929
  moveSelectionToMarker(editor, dom.get('mce_marker'));
12848
12930
  unmarkFragmentElements(editor.getBody());
12849
12931
  trimBrsFromTableCell(dom, selection.getStart());
12932
+ preventSplittingSummary(editor);
12850
12933
  updateCaret(editor.schema, editor.getBody(), selection.getStart());
12851
12934
  return value;
12852
12935
  };
@@ -13083,7 +13166,7 @@
13083
13166
  const canApply = (editor, name) => {
13084
13167
  const formatList = editor.formatter.get(name);
13085
13168
  const dom = editor.dom;
13086
- if (formatList) {
13169
+ if (formatList && editor.selection.isEditable()) {
13087
13170
  const startNode = editor.selection.getStart();
13088
13171
  const parents = getParents$2(dom, startNode);
13089
13172
  for (let x = formatList.length - 1; x >= 0; x--) {
@@ -13191,7 +13274,7 @@
13191
13274
  node = getParentCaretContainer(editor.getBody(), selection.getStart());
13192
13275
  if (!node) {
13193
13276
  while (node = dom.get(CARET_ID)) {
13194
- removeCaretContainerNode(editor, node, false);
13277
+ removeCaretContainerNode(editor, node, moveCaret);
13195
13278
  }
13196
13279
  }
13197
13280
  } else {
@@ -13331,9 +13414,9 @@
13331
13414
  }
13332
13415
  }
13333
13416
  };
13334
- const disableCaretContainer = (editor, keyCode) => {
13417
+ const disableCaretContainer = (editor, keyCode, moveCaret) => {
13335
13418
  const selection = editor.selection, body = editor.getBody();
13336
- removeCaretContainer(editor, null, false);
13419
+ removeCaretContainer(editor, null, moveCaret);
13337
13420
  if ((keyCode === 8 || keyCode === 46) && selection.isCollapsed() && selection.getStart().innerHTML === ZWSP) {
13338
13421
  removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart()));
13339
13422
  }
@@ -13341,9 +13424,10 @@
13341
13424
  removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart()));
13342
13425
  }
13343
13426
  };
13427
+ const endsWithNbsp = element => isText$a(element) && endsWith(element.data, nbsp);
13344
13428
  const setup$u = editor => {
13345
13429
  editor.on('mouseup keydown', e => {
13346
- disableCaretContainer(editor, e.keyCode);
13430
+ disableCaretContainer(editor, e.keyCode, endsWithNbsp(editor.selection.getRng().endContainer));
13347
13431
  });
13348
13432
  };
13349
13433
  const createCaretFormat = formatNodes => {
@@ -13357,12 +13441,12 @@
13357
13441
  const replaceWithCaretFormat = (targetNode, formatNodes) => {
13358
13442
  const {caretContainer, caretPosition} = createCaretFormat(formatNodes);
13359
13443
  before$3(SugarElement.fromDom(targetNode), caretContainer);
13360
- remove$6(SugarElement.fromDom(targetNode));
13444
+ remove$5(SugarElement.fromDom(targetNode));
13361
13445
  return caretPosition;
13362
13446
  };
13363
- const createCaretFormatAtStart$1 = (editor, formatNodes) => {
13447
+ const createCaretFormatAtStart$1 = (rng, formatNodes) => {
13364
13448
  const {caretContainer, caretPosition} = createCaretFormat(formatNodes);
13365
- editor.selection.getRng().insertNode(caretContainer.dom);
13449
+ rng.insertNode(caretContainer.dom);
13366
13450
  return caretPosition;
13367
13451
  };
13368
13452
  const isFormatElement = (editor, element) => {
@@ -13398,7 +13482,7 @@
13398
13482
  const joinPre = (pre1, pre2) => {
13399
13483
  const sPre2 = SugarElement.fromDom(pre2);
13400
13484
  const doc = documentOrOwner(sPre2).dom;
13401
- remove$6(sPre2);
13485
+ remove$5(sPre2);
13402
13486
  append(SugarElement.fromDom(pre1), [
13403
13487
  SugarElement.fromTag('br', doc),
13404
13488
  SugarElement.fromTag('br', doc),
@@ -13668,7 +13752,7 @@
13668
13752
  });
13669
13753
  }
13670
13754
  };
13671
- const removeFormatInternal = (ed, format, vars, node, compareNode) => {
13755
+ const removeNodeFormatInternal = (ed, format, vars, node, compareNode) => {
13672
13756
  const dom = ed.dom;
13673
13757
  const elementUtils = ElementUtils(ed);
13674
13758
  const schema = ed.schema;
@@ -13749,10 +13833,6 @@
13749
13833
  }
13750
13834
  return removeResult.keep();
13751
13835
  };
13752
- const removeFormat$1 = (ed, format, vars, node, compareNode) => removeFormatInternal(ed, format, vars, node, compareNode).fold(never, newName => {
13753
- ed.dom.rename(node, newName);
13754
- return true;
13755
- }, always);
13756
13836
  const findFormatRoot = (editor, container, name, vars, similar) => {
13757
13837
  let formatRoot;
13758
13838
  if (container.parentNode) {
@@ -13767,7 +13847,7 @@
13767
13847
  }
13768
13848
  return formatRoot;
13769
13849
  };
13770
- const removeFormatFromClone = (editor, format, vars, clone) => removeFormatInternal(editor, format, vars, clone, clone).fold(constant(clone), newName => {
13850
+ const removeNodeFormatFromClone = (editor, format, vars, clone) => removeNodeFormatInternal(editor, format, vars, clone, clone).fold(constant(clone), newName => {
13771
13851
  const fragment = editor.dom.createFragment();
13772
13852
  fragment.appendChild(clone);
13773
13853
  return editor.dom.rename(clone, newName);
@@ -13782,7 +13862,7 @@
13782
13862
  for (let parent = container.parentNode; parent && parent !== formatRootParent; parent = parent.parentNode) {
13783
13863
  let clone = dom.clone(parent, false);
13784
13864
  for (let i = 0; i < formatList.length; i++) {
13785
- clone = removeFormatFromClone(editor, formatList[i], vars, clone);
13865
+ clone = removeNodeFormatFromClone(editor, formatList[i], vars, clone);
13786
13866
  if (clone === null) {
13787
13867
  break;
13788
13868
  }
@@ -13810,7 +13890,7 @@
13810
13890
  }
13811
13891
  return container;
13812
13892
  };
13813
- const remove$2 = (ed, name, vars, node, similar) => {
13893
+ const removeFormatInternal = (ed, name, vars, node, similar) => {
13814
13894
  const formatList = ed.formatter.get(name);
13815
13895
  const format = formatList[0];
13816
13896
  const dom = ed.dom;
@@ -13820,14 +13900,14 @@
13820
13900
  return wrapAndSplit(ed, formatList, formatRoot, container, container, true, format, vars);
13821
13901
  };
13822
13902
  const isRemoveBookmarkNode = node => isBookmarkNode$1(node) && isElement$6(node) && (node.id === '_start' || node.id === '_end');
13823
- const removeNodeFormat = node => exists(formatList, fmt => removeFormat$1(ed, fmt, vars, node, node));
13903
+ const removeFormatOnNode = node => exists(formatList, fmt => removeNodeFormat(ed, fmt, vars, node, node));
13824
13904
  const process = node => {
13825
13905
  const children = from(node.childNodes);
13826
- const removed = removeNodeFormat(node);
13906
+ const removed = removeFormatOnNode(node);
13827
13907
  const currentNodeMatches = removed || exists(formatList, f => matchName(dom, node, f));
13828
13908
  const parentNode = node.parentNode;
13829
13909
  if (!currentNodeMatches && isNonNullable(parentNode) && shouldExpandToSelector(format)) {
13830
- removeNodeFormat(parentNode);
13910
+ removeFormatOnNode(parentNode);
13831
13911
  }
13832
13912
  if (format.deep) {
13833
13913
  if (children.length) {
@@ -13843,7 +13923,7 @@
13843
13923
  ];
13844
13924
  each$e(textDecorations, decoration => {
13845
13925
  if (isElement$6(node) && ed.dom.getStyle(node, 'text-decoration') === decoration && node.parentNode && getTextDecoration(dom, node.parentNode) === decoration) {
13846
- removeFormat$1(ed, {
13926
+ removeNodeFormat(ed, {
13847
13927
  deep: false,
13848
13928
  exact: true,
13849
13929
  inline: 'span',
@@ -13952,6 +14032,17 @@
13952
14032
  removeListStyleFormats(ed, name, vars);
13953
14033
  fireFormatRemove(ed, name, node, vars);
13954
14034
  };
14035
+ const removeFormat$1 = (ed, name, vars, node, similar) => {
14036
+ if (node || ed.selection.isEditable()) {
14037
+ removeFormatInternal(ed, name, vars, node, similar);
14038
+ }
14039
+ };
14040
+ const removeNodeFormat = (editor, format, vars, node, compareNode) => {
14041
+ return removeNodeFormatInternal(editor, format, vars, node, compareNode).fold(never, newName => {
14042
+ editor.dom.rename(node, newName);
14043
+ return true;
14044
+ }, always);
14045
+ };
13955
14046
 
13956
14047
  const each$6 = Tools.each;
13957
14048
  const mergeTextDecorationsAndColor = (dom, format, vars, node) => {
@@ -13989,7 +14080,7 @@
13989
14080
  if (isInlineFormat(format)) {
13990
14081
  each$6(editor.dom.select(format.inline, node), child => {
13991
14082
  if (isElementNode(child)) {
13992
- removeFormat$1(editor, format, vars, child, format.exact ? child : null);
14083
+ removeNodeFormat(editor, format, vars, child, format.exact ? child : null);
13993
14084
  }
13994
14085
  });
13995
14086
  }
@@ -13999,14 +14090,14 @@
13999
14090
  const mergeWithParents = (editor, format, name, vars, node) => {
14000
14091
  const parentNode = node.parentNode;
14001
14092
  if (matchNode(editor, parentNode, name, vars)) {
14002
- if (removeFormat$1(editor, format, vars, node)) {
14093
+ if (removeNodeFormat(editor, format, vars, node)) {
14003
14094
  return;
14004
14095
  }
14005
14096
  }
14006
14097
  if (format.merge_with_parents && parentNode) {
14007
14098
  editor.dom.getParent(parentNode, parent => {
14008
14099
  if (matchNode(editor, parent, name, vars)) {
14009
- removeFormat$1(editor, format, vars, node);
14100
+ removeNodeFormat(editor, format, vars, node);
14010
14101
  return true;
14011
14102
  } else {
14012
14103
  return false;
@@ -14036,7 +14127,7 @@
14036
14127
  }
14037
14128
  }
14038
14129
  };
14039
- const applyFormat$1 = (ed, name, vars, node) => {
14130
+ const applyFormatAction = (ed, name, vars, node) => {
14040
14131
  const formatList = ed.formatter.get(name);
14041
14132
  const format = formatList[0];
14042
14133
  const isCollapsed = !node && ed.selection.isCollapsed();
@@ -14100,10 +14191,10 @@
14100
14191
  const canWrapNode = (node, parentName, isEditableDescendant, isWrappableNoneditableElm) => {
14101
14192
  const nodeName = node.nodeName.toLowerCase();
14102
14193
  const isValidWrapNode = isValid(ed, wrapName, nodeName) && isValid(ed, parentName, wrapName);
14103
- const isZwsp$1 = !nodeSpecific && isText$a(node) && isZwsp(node.data);
14194
+ const isZwsp = !nodeSpecific && isText$a(node) && isZwsp$1(node.data);
14104
14195
  const isCaret = isCaretNode(node);
14105
14196
  const isCorrectFormatForNode = !isInlineFormat(format) || !dom.isBlock(node);
14106
- return (isEditableDescendant || isWrappableNoneditableElm) && isValidWrapNode && !isZwsp$1 && !isCaret && isCorrectFormatForNode;
14197
+ return (isEditableDescendant || isWrappableNoneditableElm) && isValidWrapNode && !isZwsp && !isCaret && isCorrectFormatForNode;
14107
14198
  };
14108
14199
  walk$3(dom, rng, nodes => {
14109
14200
  let currentWrapElm;
@@ -14259,6 +14350,11 @@
14259
14350
  }
14260
14351
  fireFormatApply(ed, name, node, vars);
14261
14352
  };
14353
+ const applyFormat$1 = (editor, name, vars, node) => {
14354
+ if (node || editor.selection.isEditable()) {
14355
+ applyFormatAction(editor, name, vars, node);
14356
+ }
14357
+ };
14262
14358
 
14263
14359
  const hasVars = value => has$2(value, 'vars');
14264
14360
  const setup$t = (registeredFormatListeners, editor) => {
@@ -14392,7 +14488,7 @@
14392
14488
  const fmt = editor.formatter.get(name);
14393
14489
  if (fmt) {
14394
14490
  if (match$2(editor, name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) {
14395
- remove$2(editor, name, vars, node);
14491
+ removeFormat$1(editor, name, vars, node);
14396
14492
  } else {
14397
14493
  applyFormat$1(editor, name, vars, node);
14398
14494
  }
@@ -14500,6 +14596,60 @@
14500
14596
  }
14501
14597
  };
14502
14598
 
14599
+ const addNodeFilter = (htmlParser, schema) => {
14600
+ htmlParser.addNodeFilter('br', (nodes, _, args) => {
14601
+ const blockElements = Tools.extend({}, schema.getBlockElements());
14602
+ const nonEmptyElements = schema.getNonEmptyElements();
14603
+ const whitespaceElements = schema.getWhitespaceElements();
14604
+ blockElements.body = 1;
14605
+ const isBlock = node => node.name in blockElements && isTransparentAstInline(schema, node);
14606
+ for (let i = 0, l = nodes.length; i < l; i++) {
14607
+ let node = nodes[i];
14608
+ let parent = node.parent;
14609
+ if (parent && blockElements[parent.name] && node === parent.lastChild) {
14610
+ let prev = node.prev;
14611
+ while (prev) {
14612
+ const prevName = prev.name;
14613
+ if (prevName !== 'span' || prev.attr('data-mce-type') !== 'bookmark') {
14614
+ if (prevName === 'br') {
14615
+ node = null;
14616
+ }
14617
+ break;
14618
+ }
14619
+ prev = prev.prev;
14620
+ }
14621
+ if (node) {
14622
+ node.remove();
14623
+ if (isEmpty(schema, nonEmptyElements, whitespaceElements, parent)) {
14624
+ const elementRule = schema.getElementRule(parent.name);
14625
+ if (elementRule) {
14626
+ if (elementRule.removeEmpty) {
14627
+ parent.remove();
14628
+ } else if (elementRule.paddEmpty) {
14629
+ paddEmptyNode(args, isBlock, parent);
14630
+ }
14631
+ }
14632
+ }
14633
+ }
14634
+ } else {
14635
+ let lastParent = node;
14636
+ while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) {
14637
+ lastParent = parent;
14638
+ if (blockElements[parent.name]) {
14639
+ break;
14640
+ }
14641
+ parent = parent.parent;
14642
+ }
14643
+ if (lastParent === parent) {
14644
+ const textNode = new AstNode('#text', 3);
14645
+ textNode.value = nbsp;
14646
+ node.replace(textNode);
14647
+ }
14648
+ }
14649
+ }
14650
+ });
14651
+ };
14652
+
14503
14653
  const blobUriToBlob = url => fetch(url).then(res => res.ok ? res.blob() : Promise.reject()).catch(() => Promise.reject({
14504
14654
  message: `Cannot convert ${ url } to Blob. Resource might not exist or is inaccessible.`,
14505
14655
  uriType: 'blob'
@@ -14631,57 +14781,7 @@
14631
14781
  const register$4 = (parser, settings) => {
14632
14782
  const schema = parser.schema;
14633
14783
  if (settings.remove_trailing_brs) {
14634
- parser.addNodeFilter('br', (nodes, _, args) => {
14635
- const blockElements = Tools.extend({}, schema.getBlockElements());
14636
- const nonEmptyElements = schema.getNonEmptyElements();
14637
- const whitespaceElements = schema.getWhitespaceElements();
14638
- blockElements.body = 1;
14639
- const isBlock = node => node.name in blockElements && isTransparentAstInline(schema, node);
14640
- for (let i = 0, l = nodes.length; i < l; i++) {
14641
- let node = nodes[i];
14642
- let parent = node.parent;
14643
- if (parent && blockElements[parent.name] && node === parent.lastChild) {
14644
- let prev = node.prev;
14645
- while (prev) {
14646
- const prevName = prev.name;
14647
- if (prevName !== 'span' || prev.attr('data-mce-type') !== 'bookmark') {
14648
- if (prevName === 'br') {
14649
- node = null;
14650
- }
14651
- break;
14652
- }
14653
- prev = prev.prev;
14654
- }
14655
- if (node) {
14656
- node.remove();
14657
- if (isEmpty(schema, nonEmptyElements, whitespaceElements, parent)) {
14658
- const elementRule = schema.getElementRule(parent.name);
14659
- if (elementRule) {
14660
- if (elementRule.removeEmpty) {
14661
- parent.remove();
14662
- } else if (elementRule.paddEmpty) {
14663
- paddEmptyNode(args, isBlock, parent);
14664
- }
14665
- }
14666
- }
14667
- }
14668
- } else {
14669
- let lastParent = node;
14670
- while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) {
14671
- lastParent = parent;
14672
- if (blockElements[parent.name]) {
14673
- break;
14674
- }
14675
- parent = parent.parent;
14676
- }
14677
- if (lastParent === parent) {
14678
- const textNode = new AstNode('#text', 3);
14679
- textNode.value = nbsp;
14680
- node.replace(textNode);
14681
- }
14682
- }
14683
- }
14684
- });
14784
+ addNodeFilter(parser, schema);
14685
14785
  }
14686
14786
  parser.addAttributeFilter('href', nodes => {
14687
14787
  let i = nodes.length;
@@ -16398,6 +16498,42 @@
16398
16498
  }
16399
16499
  };
16400
16500
  class URI {
16501
+ static parseDataUri(uri) {
16502
+ let type;
16503
+ const uriComponents = decodeURIComponent(uri).split(',');
16504
+ const matches = /data:([^;]+)/.exec(uriComponents[0]);
16505
+ if (matches) {
16506
+ type = matches[1];
16507
+ }
16508
+ return {
16509
+ type,
16510
+ data: uriComponents[1]
16511
+ };
16512
+ }
16513
+ static isDomSafe(uri, context, options = {}) {
16514
+ if (options.allow_script_urls) {
16515
+ return true;
16516
+ } else {
16517
+ const decodedUri = Entities.decode(uri).replace(/[\s\u0000-\u001F]+/g, '');
16518
+ return !isInvalidUri(options, decodedUri, context);
16519
+ }
16520
+ }
16521
+ static getDocumentBaseUrl(loc) {
16522
+ var _a;
16523
+ let baseUrl;
16524
+ if (loc.protocol.indexOf('http') !== 0 && loc.protocol !== 'file:') {
16525
+ baseUrl = (_a = loc.href) !== null && _a !== void 0 ? _a : '';
16526
+ } else {
16527
+ baseUrl = loc.protocol + '//' + loc.host + loc.pathname;
16528
+ }
16529
+ if (/^[^:]+:\/\/\/?[^\/]+\//.test(baseUrl)) {
16530
+ baseUrl = baseUrl.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
16531
+ if (!/[\/\\]$/.test(baseUrl)) {
16532
+ baseUrl += '/';
16533
+ }
16534
+ }
16535
+ return baseUrl;
16536
+ }
16401
16537
  constructor(url, settings = {}) {
16402
16538
  this.path = '';
16403
16539
  this.directory = '';
@@ -16454,42 +16590,6 @@
16454
16590
  self.protocol = '';
16455
16591
  }
16456
16592
  }
16457
- static parseDataUri(uri) {
16458
- let type;
16459
- const uriComponents = decodeURIComponent(uri).split(',');
16460
- const matches = /data:([^;]+)/.exec(uriComponents[0]);
16461
- if (matches) {
16462
- type = matches[1];
16463
- }
16464
- return {
16465
- type,
16466
- data: uriComponents[1]
16467
- };
16468
- }
16469
- static isDomSafe(uri, context, options = {}) {
16470
- if (options.allow_script_urls) {
16471
- return true;
16472
- } else {
16473
- const decodedUri = Entities.decode(uri).replace(/[\s\u0000-\u001F]+/g, '');
16474
- return !isInvalidUri(options, decodedUri, context);
16475
- }
16476
- }
16477
- static getDocumentBaseUrl(loc) {
16478
- var _a;
16479
- let baseUrl;
16480
- if (loc.protocol.indexOf('http') !== 0 && loc.protocol !== 'file:') {
16481
- baseUrl = (_a = loc.href) !== null && _a !== void 0 ? _a : '';
16482
- } else {
16483
- baseUrl = loc.protocol + '//' + loc.host + loc.pathname;
16484
- }
16485
- if (/^[^:]+:\/\/\/?[^\/]+\//.test(baseUrl)) {
16486
- baseUrl = baseUrl.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
16487
- if (!/[\/\\]$/.test(baseUrl)) {
16488
- baseUrl += '/';
16489
- }
16490
- }
16491
- return baseUrl;
16492
- }
16493
16593
  setPath(path) {
16494
16594
  const pathMatch = /^(.*?)\/?(\w+)?$/.exec(path);
16495
16595
  if (pathMatch) {
@@ -16667,7 +16767,7 @@
16667
16767
  const bogus = get$9(element, 'data-mce-bogus');
16668
16768
  if (!isInternalElement && isString(bogus)) {
16669
16769
  if (bogus === 'all') {
16670
- remove$6(element);
16770
+ remove$5(element);
16671
16771
  } else {
16672
16772
  unwrap(element);
16673
16773
  }
@@ -16676,7 +16776,7 @@
16676
16776
  const rule = schema.getElementRule(lcTagName);
16677
16777
  if (validate && !rule) {
16678
16778
  if (has$2(specialElements, lcTagName)) {
16679
- remove$6(element);
16779
+ remove$5(element);
16680
16780
  } else {
16681
16781
  unwrap(element);
16682
16782
  }
@@ -16861,7 +16961,7 @@
16861
16961
  }
16862
16962
  return false;
16863
16963
  };
16864
- const isBlock = node => node.name in blockElements && !isTransparentAstInline(schema, node);
16964
+ const isBlock = node => node.name in blockElements || isTransparentAstBlock(schema, node);
16865
16965
  const isAtEdgeOfBlock = (node, start) => {
16866
16966
  const neighbour = start ? node.prev : node.next;
16867
16967
  if (isNonNullable(neighbour) || isNullable(node.parent)) {
@@ -17234,8 +17334,8 @@
17234
17334
  return map$3(table.rows, row => {
17235
17335
  const cells = map$3(row.cells, cell => {
17236
17336
  const td = deep$1(cell);
17237
- remove$b(td, 'colspan');
17238
- remove$b(td, 'rowspan');
17337
+ remove$a(td, 'colspan');
17338
+ remove$a(td, 'rowspan');
17239
17339
  return td;
17240
17340
  });
17241
17341
  const tr = shallow$1(row.element);
@@ -17827,7 +17927,7 @@
17827
17927
  canApply: name => canApply(editor, name),
17828
17928
  closest: names => closest(editor, names),
17829
17929
  apply: (name, vars, node) => applyFormat$1(editor, name, vars, node),
17830
- remove: (name, vars, node, similar) => remove$2(editor, name, vars, node, similar),
17930
+ remove: (name, vars, node, similar) => removeFormat$1(editor, name, vars, node, similar),
17831
17931
  toggle: (name, vars, node) => toggle(editor, name, vars, node),
17832
17932
  formatChanged: (registeredFormatListeners, formats, callback, similar, vars) => formatChangedInternal(editor, registeredFormatListeners, formats, callback, similar, vars)
17833
17933
  },
@@ -17840,7 +17940,7 @@
17840
17940
  selection: { getContent: (format, args) => getSelectedContentInternal(editor, format, args) },
17841
17941
  autocompleter: {
17842
17942
  addDecoration: range => create$9(editor, range),
17843
- removeDecoration: () => remove$3(editor, SugarElement.fromDom(editor.getBody()))
17943
+ removeDecoration: () => remove$2(editor, SugarElement.fromDom(editor.getBody()))
17844
17944
  },
17845
17945
  raw: { getModel: () => Optional.none() }
17846
17946
  });
@@ -18017,7 +18117,7 @@
18017
18117
 
18018
18118
  const removeEmpty = text => {
18019
18119
  if (text.dom.length === 0) {
18020
- remove$6(text);
18120
+ remove$5(text);
18021
18121
  return Optional.none();
18022
18122
  } else {
18023
18123
  return Optional.some(text);
@@ -18483,7 +18583,7 @@
18483
18583
  if (node.attr('data-mce-type') === 'bookmark' && !args.cleanup) {
18484
18584
  const hasChildren = Optional.from(node.firstChild).exists(firstChild => {
18485
18585
  var _a;
18486
- return !isZwsp((_a = firstChild.value) !== null && _a !== void 0 ? _a : '');
18586
+ return !isZwsp$1((_a = firstChild.value) !== null && _a !== void 0 ? _a : '');
18487
18587
  });
18488
18588
  if (hasChildren) {
18489
18589
  node.unwrap();
@@ -18575,6 +18675,9 @@
18575
18675
  nodes[i].attr(name, null);
18576
18676
  }
18577
18677
  });
18678
+ if (settings.remove_trailing_brs) {
18679
+ addNodeFilter(htmlParser, htmlParser.schema);
18680
+ }
18578
18681
  };
18579
18682
  const trimTrailingBr = rootNode => {
18580
18683
  const isBr = node => {
@@ -18669,12 +18772,15 @@
18669
18772
  };
18670
18773
  const DomSerializerImpl = (settings, editor) => {
18671
18774
  const tempAttrs = ['data-mce-selected'];
18775
+ const defaultedSettings = {
18776
+ entity_encoding: 'named',
18777
+ remove_trailing_brs: true,
18778
+ ...settings
18779
+ };
18672
18780
  const dom = editor && editor.dom ? editor.dom : DOMUtils.DOM;
18673
- const schema = editor && editor.schema ? editor.schema : Schema(settings);
18674
- settings.entity_encoding = settings.entity_encoding || 'named';
18675
- settings.remove_trailing_brs = 'remove_trailing_brs' in settings ? settings.remove_trailing_brs : true;
18676
- const htmlParser = DomParser(settings, schema);
18677
- register$3(htmlParser, settings, dom);
18781
+ const schema = editor && editor.schema ? editor.schema : Schema(defaultedSettings);
18782
+ const htmlParser = DomParser(defaultedSettings, schema);
18783
+ register$3(htmlParser, defaultedSettings, dom);
18678
18784
  const serialize = (node, parserArgs = {}) => {
18679
18785
  const args = {
18680
18786
  format: 'html',
@@ -18683,7 +18789,7 @@
18683
18789
  const targetNode = process$1(editor, node, args);
18684
18790
  const html = getHtmlFromNode(dom, targetNode, args);
18685
18791
  const rootNode = parseHtml(htmlParser, html, args);
18686
- return args.format === 'tree' ? rootNode : toHtml(editor, settings, schema, rootNode, args);
18792
+ return args.format === 'tree' ? rootNode : toHtml(editor, defaultedSettings, schema, rootNode, args);
18687
18793
  };
18688
18794
  return {
18689
18795
  schema,
@@ -18754,10 +18860,13 @@
18754
18860
  const removedOptions = ('autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,' + 'boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,' + 'force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,' + 'non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,' + 'tab_focus,tabfocus_elements,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,' + 'paste_enable_default_filters,paste_filter_drop,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists').split(',');
18755
18861
  const deprecatedOptions = 'template_cdate_classes,template_mdate_classes,template_selected_content_classes,template_preview_replace_values,template_replace_values,templates,template_cdate_format,template_mdate_format'.split(',');
18756
18862
  const removedPlugins = 'bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,textcolor'.split(',');
18757
- const deprecatedPlugins = [{
18863
+ const deprecatedPlugins = [
18864
+ {
18758
18865
  name: 'template',
18759
18866
  replacedWith: 'Advanced Template'
18760
- }];
18867
+ },
18868
+ { name: 'rtc' }
18869
+ ];
18761
18870
  const getMatchingOptions = (options, searchingFor) => {
18762
18871
  const settingNames = filter$5(searchingFor, setting => has$2(options, setting));
18763
18872
  return sort(settingNames);
@@ -18793,7 +18902,13 @@
18793
18902
  console.warn('The following deprecated features are currently enabled and have been removed in TinyMCE 6.0. These features will no longer work and should be removed from the TinyMCE configuration. ' + 'See https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/ for more information.' + themesMessage + pluginsMessage + optionsMessage);
18794
18903
  }
18795
18904
  };
18796
- const getPluginDescription = name => find$2(deprecatedPlugins, entry => entry.name === name).fold(() => name, entry => `${ name }, replaced by ${ entry.replacedWith }`);
18905
+ const getPluginDescription = name => find$2(deprecatedPlugins, entry => entry.name === name).fold(() => name, entry => {
18906
+ if (entry.replacedWith) {
18907
+ return `${ name }, replaced by ${ entry.replacedWith }`;
18908
+ } else {
18909
+ return name;
18910
+ }
18911
+ });
18797
18912
  const logDeprecatedWarnings = (rawOptions, normalizedOptions) => {
18798
18913
  const deprecatedOptions = getDeprecatedOptions(rawOptions);
18799
18914
  const deprecatedPlugins = getDeprecatedPlugins(normalizedOptions);
@@ -19550,6 +19665,12 @@
19550
19665
  return { upload: (blobInfos, showNotification = true) => uploader.upload(blobInfos, showNotification ? openNotification(editor) : undefined) };
19551
19666
  };
19552
19667
 
19668
+ const isEmptyForPadding = (editor, element) => editor.dom.isEmpty(element.dom) && isNonNullable(editor.schema.getTextBlockElements()[name(element)]);
19669
+ const addPaddingToEmpty = editor => element => {
19670
+ if (isEmptyForPadding(editor, element)) {
19671
+ append$1(element, SugarElement.fromHtml('<br data-mce-bogus="1" />'));
19672
+ }
19673
+ };
19553
19674
  const EditorUpload = editor => {
19554
19675
  const blobCache = BlobCache();
19555
19676
  let uploader, imageScanner;
@@ -19636,9 +19757,11 @@
19636
19757
  });
19637
19758
  if (imagesToRemove.length > 0 && !isRtc(editor)) {
19638
19759
  editor.undoManager.transact(() => {
19639
- each$e(imagesToRemove, element => {
19640
- editor.dom.remove(element);
19641
- blobCache.removeByUri(element.src);
19760
+ each$e(fromDom$1(imagesToRemove), sugarElement => {
19761
+ const parentOpt = parent(sugarElement);
19762
+ remove$5(sugarElement);
19763
+ parentOpt.each(addPaddingToEmpty(editor));
19764
+ blobCache.removeByUri(sugarElement.dom.src);
19642
19765
  });
19643
19766
  });
19644
19767
  } else if (shouldDispatchChange) {
@@ -20508,7 +20631,8 @@
20508
20631
  if (e.isDefaultPrevented()) {
20509
20632
  return;
20510
20633
  }
20511
- if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45 || e.ctrlKey) {
20634
+ const isMeta = Env.os.isMacOS() && e.key === 'Meta';
20635
+ if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45 || e.ctrlKey || isMeta) {
20512
20636
  addNonTypingUndoLevel();
20513
20637
  editor.nodeChanged();
20514
20638
  }
@@ -20541,6 +20665,11 @@
20541
20665
  setTyping(undoManager, true, locks);
20542
20666
  undoManager.add({}, e);
20543
20667
  isFirstTypedCharacter.set(true);
20668
+ return;
20669
+ }
20670
+ const hasOnlyMetaOrCtrlModifier = Env.os.isMacOS() ? e.metaKey : e.ctrlKey && !e.altKey;
20671
+ if (hasOnlyMetaOrCtrlModifier) {
20672
+ undoManager.beforeChange();
20544
20673
  }
20545
20674
  });
20546
20675
  editor.on('mousedown', e => {
@@ -20760,12 +20889,12 @@
20760
20889
  };
20761
20890
  const extractChildren = block => {
20762
20891
  const children = getChildrenUntilBlockBoundary(block);
20763
- each$e(children, remove$6);
20892
+ each$e(children, remove$5);
20764
20893
  return children;
20765
20894
  };
20766
20895
  const removeEmptyRoot = (rootNode, block) => {
20767
20896
  const parents = parentsAndSelf(block, rootNode);
20768
- return find$2(parents.reverse(), element => isEmpty$2(element)).each(remove$6);
20897
+ return find$2(parents.reverse(), element => isEmpty$2(element)).each(remove$5);
20769
20898
  };
20770
20899
  const isEmptyBefore = el => filter$5(prevSiblings(el), el => !isEmpty$2(el)).length === 0;
20771
20900
  const nestedBlockMerge = (rootNode, fromBlock, toBlock, insertionPoint) => {
@@ -20797,7 +20926,7 @@
20797
20926
  empty(fromBlock);
20798
20927
  append$1(fromBlock, newFromBlockDescendants);
20799
20928
  }
20800
- remove$6(toBlock);
20929
+ remove$5(toBlock);
20801
20930
  return firstPositionIn(fromBlock.dom);
20802
20931
  }
20803
20932
  const position = lastPositionIn(toBlock.dom);
@@ -20813,7 +20942,7 @@
20813
20942
  };
20814
20943
  const getInsertionPoint = (fromBlock, toBlock) => contains(toBlock, fromBlock) ? findInsertionPoint(toBlock, fromBlock) : Optional.none();
20815
20944
  const trimBr = (first, block) => {
20816
- positionIn(first, block.dom).bind(position => Optional.from(position.getNode())).map(SugarElement.fromDom).filter(isBr$5).each(remove$6);
20945
+ positionIn(first, block.dom).bind(position => Optional.from(position.getNode())).map(SugarElement.fromDom).filter(isBr$5).each(remove$5);
20817
20946
  };
20818
20947
  const mergeBlockInto = (rootNode, fromBlock, toBlock) => {
20819
20948
  trimBr(true, fromBlock);
@@ -21061,7 +21190,7 @@
21061
21190
  return getAncestorCe(editor, selectedNode).filter(isContentEditableFalse$b).fold(() => read(editor.getBody(), forward, editor.selection.getRng()).map(deleteAction => () => deleteAction.fold(deleteElement$1(editor, forward), moveToElement(editor, forward), moveToPosition(editor))), () => Optional.some(noop));
21062
21191
  };
21063
21192
  const deleteOffscreenSelection = rootElement => {
21064
- each$e(descendants(rootElement, '.mce-offscreen-selection'), remove$6);
21193
+ each$e(descendants(rootElement, '.mce-offscreen-selection'), remove$5);
21065
21194
  };
21066
21195
  const backspaceDeleteRange = (editor, forward) => {
21067
21196
  const selectedNode = editor.selection.getNode();
@@ -21177,13 +21306,13 @@
21177
21306
  return caretNode && pos.container() === caretNode && isCaretContainerInline(caretNode);
21178
21307
  };
21179
21308
  const renderCaret = (caret, location) => location.fold(element => {
21180
- remove$4(caret.get());
21309
+ remove$3(caret.get());
21181
21310
  const text = insertInlineBefore(element);
21182
21311
  caret.set(text);
21183
21312
  return Optional.some(CaretPosition(text, text.length - 1));
21184
21313
  }, element => firstPositionIn(element).map(pos => {
21185
21314
  if (!isPosCaretContainer(pos, caret)) {
21186
- remove$4(caret.get());
21315
+ remove$3(caret.get());
21187
21316
  const text = insertInlinePos(pos, true);
21188
21317
  caret.set(text);
21189
21318
  return CaretPosition(text, 1);
@@ -21193,7 +21322,7 @@
21193
21322
  }
21194
21323
  }), element => lastPositionIn(element).map(pos => {
21195
21324
  if (!isPosCaretContainer(pos, caret)) {
21196
- remove$4(caret.get());
21325
+ remove$3(caret.get());
21197
21326
  const text = insertInlinePos(pos, false);
21198
21327
  caret.set(text);
21199
21328
  return CaretPosition(text, text.length - 1);
@@ -21202,7 +21331,7 @@
21202
21331
  return CaretPosition(node, node.length - 1);
21203
21332
  }
21204
21333
  }), element => {
21205
- remove$4(caret.get());
21334
+ remove$3(caret.get());
21206
21335
  const text = insertInlineAfter(element);
21207
21336
  caret.set(text);
21208
21337
  return Optional.some(CaretPosition(text, 1));
@@ -21819,6 +21948,7 @@
21819
21948
  const parents = parentsAndSelf(startElm, rootElm);
21820
21949
  return findIndex$2(parents, pred).fold(constant(parents), index => parents.slice(0, index));
21821
21950
  };
21951
+ const hasOnlyOneChild = elm => childNodesCount(elm) === 1;
21822
21952
  const getParentInlinesUntilMultichildInline = editor => getParentsUntil(editor, elm => isBlock$2(elm) || hasMultipleChildren(elm));
21823
21953
  const getParentInlines = editor => getParentsUntil(editor, isBlock$2);
21824
21954
  const getFormatNodes = (editor, parentInlines) => {
@@ -21839,7 +21969,7 @@
21839
21969
  }
21840
21970
  };
21841
21971
  const deleteCaret$1 = (editor, forward) => {
21842
- const parentInlines = getParentInlinesUntilMultichildInline(editor);
21972
+ const parentInlines = filter$5(getParentInlinesUntilMultichildInline(editor), hasOnlyOneChild);
21843
21973
  return last$3(parentInlines).bind(target => {
21844
21974
  const fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());
21845
21975
  if (willDeleteLastPositionInElement(forward, fromPos, target.dom) && !isEmptyCaretFormatElement(target)) {
@@ -21856,7 +21986,7 @@
21856
21986
  const isEmptyCaret = elm => isEmptyCaretFormatElement(SugarElement.fromDom(elm));
21857
21987
  const createCaretFormatAtStart = (editor, formatNodes) => {
21858
21988
  const startElm = editor.selection.getStart();
21859
- const pos = isBrInEmptyElement(editor, startElm) || isEmptyCaret(startElm) ? replaceWithCaretFormat(startElm, formatNodes) : createCaretFormatAtStart$1(editor, formatNodes);
21989
+ const pos = isBrInEmptyElement(editor, startElm) || isEmptyCaret(startElm) ? replaceWithCaretFormat(startElm, formatNodes) : createCaretFormatAtStart$1(editor.selection.getRng(), formatNodes);
21860
21990
  editor.selection.setRng(pos.toRange());
21861
21991
  };
21862
21992
  const updateCaretFormat = (editor, updateFormats) => {
@@ -22335,7 +22465,11 @@
22335
22465
  return Optional.none();
22336
22466
  });
22337
22467
  };
22338
- const moveH$2 = (editor, forward) => getHorizontalRange(editor, forward).exists(newRange => {
22468
+ const flipDirection = (selection, forward) => {
22469
+ const elm = forward ? selection.getEnd(true) : selection.getStart(true);
22470
+ return isRtl(elm) ? !forward : forward;
22471
+ };
22472
+ const moveH$2 = (editor, forward) => getHorizontalRange(editor, flipDirection(editor.selection, forward)).exists(newRange => {
22339
22473
  moveToRange(editor, newRange);
22340
22474
  return true;
22341
22475
  });
@@ -23483,8 +23617,8 @@
23483
23617
  ...specifics
23484
23618
  });
23485
23619
  };
23486
- const fireFakeInputEvent = createAndFireInputEvent('input');
23487
- const fireFakeBeforeInputEvent = createAndFireInputEvent('beforeinput');
23620
+ const fireInputEvent = createAndFireInputEvent('input');
23621
+ const fireBeforeInputEvent = createAndFireInputEvent('beforeinput');
23488
23622
 
23489
23623
  const executeKeydownOverride$3 = (editor, caret, evt) => {
23490
23624
  const inputType = evt.keyCode === VK.BACKSPACE ? 'deleteContentBackward' : 'deleteContentForward';
@@ -23567,10 +23701,10 @@
23567
23701
  }
23568
23702
  ], evt).filter(_ => editor.selection.isEditable()).each(applyAction => {
23569
23703
  evt.preventDefault();
23570
- const beforeInput = fireFakeBeforeInputEvent(editor, inputType);
23704
+ const beforeInput = fireBeforeInputEvent(editor, inputType);
23571
23705
  if (!beforeInput.isDefaultPrevented()) {
23572
23706
  applyAction();
23573
- fireFakeInputEvent(editor, inputType);
23707
+ fireInputEvent(editor, inputType);
23574
23708
  }
23575
23709
  });
23576
23710
  };
@@ -23723,6 +23857,33 @@
23723
23857
  }).isSome();
23724
23858
  };
23725
23859
 
23860
+ const getDetailsRoot = (editor, element) => editor.dom.getParent(element, isDetails);
23861
+ const isAtDetailsEdge = (root, element, isTextBlock) => {
23862
+ let node = element;
23863
+ while (node && node !== root && isNull(node.nextSibling)) {
23864
+ const parent = node.parentElement;
23865
+ if (!parent || !isTextBlock(parent)) {
23866
+ return isDetails(parent);
23867
+ }
23868
+ node = parent;
23869
+ }
23870
+ return false;
23871
+ };
23872
+ const isLastEmptyBlockInDetails = (editor, shiftKey, element) => !shiftKey && element.nodeName.toLowerCase() === getForcedRootBlock(editor) && editor.dom.isEmpty(element) && isAtDetailsEdge(editor.getBody(), element, el => has$2(editor.schema.getTextBlockElements(), el.nodeName.toLowerCase()));
23873
+ const insertNewLine = (editor, createNewBlock, parentBlock) => {
23874
+ var _a, _b, _c;
23875
+ const newBlock = createNewBlock(getForcedRootBlock(editor));
23876
+ const root = getDetailsRoot(editor, parentBlock);
23877
+ if (!root) {
23878
+ return;
23879
+ }
23880
+ editor.dom.insertAfter(newBlock, root);
23881
+ moveToCaretPosition(editor, newBlock);
23882
+ if (((_c = (_b = (_a = parentBlock.parentElement) === null || _a === void 0 ? void 0 : _a.childNodes) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 1) {
23883
+ editor.dom.remove(parentBlock);
23884
+ }
23885
+ };
23886
+
23726
23887
  const hasFirstChild = (elm, name) => {
23727
23888
  return elm.firstChild && elm.firstChild.nodeName === name;
23728
23889
  };
@@ -23986,6 +24147,11 @@
23986
24147
  const schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements();
23987
24148
  const rng = editor.selection.getRng();
23988
24149
  const newBlockName = getForcedRootBlock(editor);
24150
+ const isInRoot = rng.collapsed && rng.startContainer === editor.dom.getRoot();
24151
+ const start = SugarElement.fromDom(rng.startContainer);
24152
+ const child = child$1(start, rng.startOffset);
24153
+ const isCef = child.exists(element => isHTMLElement(element) && !isEditable$3(element));
24154
+ const inRootAndLastOrCef = isInRoot && isCef;
23989
24155
  const createNewBlock = name => {
23990
24156
  let node = container;
23991
24157
  const textInlineElements = schema.getTextInlineElements();
@@ -24070,7 +24236,7 @@
24070
24236
  } else {
24071
24237
  block = createNewBlock();
24072
24238
  }
24073
- if (shouldEndContainer(editor, containerBlock) && canSplitBlock(dom, containerBlock) && dom.isEmpty(parentBlock)) {
24239
+ if (shouldEndContainer(editor, containerBlock) && canSplitBlock(dom, containerBlock) && dom.isEmpty(parentBlock, undefined, { includeZwsp: true })) {
24074
24240
  block = dom.split(containerBlock, parentBlock);
24075
24241
  } else {
24076
24242
  dom.insertAfter(block, parentBlock);
@@ -24086,7 +24252,7 @@
24086
24252
  offset = rng.startOffset;
24087
24253
  const shiftKey = !!(evt && evt.shiftKey);
24088
24254
  const ctrlKey = !!(evt && evt.ctrlKey);
24089
- if (isElement$6(container) && container.hasChildNodes()) {
24255
+ if (isElement$6(container) && container.hasChildNodes() && !inRootAndLastOrCef) {
24090
24256
  isAfterLastNodeInContainer = offset > container.childNodes.length - 1;
24091
24257
  container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
24092
24258
  if (isAfterLastNodeInContainer && isText$a(container)) {
@@ -24112,18 +24278,29 @@
24112
24278
  containerBlock = liBlock.parentNode;
24113
24279
  parentBlockName = containerBlockName;
24114
24280
  }
24281
+ if (isElement$6(containerBlock) && isLastEmptyBlockInDetails(editor, shiftKey, parentBlock)) {
24282
+ return insertNewLine(editor, createNewBlock, parentBlock);
24283
+ }
24115
24284
  if (/^(LI|DT|DD)$/.test(parentBlockName) && isElement$6(containerBlock)) {
24116
24285
  if (dom.isEmpty(parentBlock)) {
24117
24286
  insert$3(editor, createNewBlock, containerBlock, parentBlock, newBlockName);
24118
24287
  return;
24119
24288
  }
24120
24289
  }
24121
- if (parentBlock === editor.getBody() || !canSplitBlock(dom, parentBlock)) {
24290
+ if (!inRootAndLastOrCef && (parentBlock === editor.getBody() || !canSplitBlock(dom, parentBlock))) {
24122
24291
  return;
24123
24292
  }
24124
24293
  const parentBlockParent = parentBlock.parentNode;
24125
24294
  let newBlock;
24126
- if (isCaretContainerBlock$1(parentBlock)) {
24295
+ if (inRootAndLastOrCef) {
24296
+ newBlock = createNewBlock(newBlockName);
24297
+ child.fold(() => {
24298
+ append$1(start, SugarElement.fromDom(newBlock));
24299
+ }, child => {
24300
+ before$3(child, SugarElement.fromDom(newBlock));
24301
+ });
24302
+ editor.selection.setCursorLocation(newBlock, 0);
24303
+ } else if (isCaretContainerBlock$1(parentBlock)) {
24127
24304
  newBlock = showCaretContainerBlock(parentBlock);
24128
24305
  if (dom.isEmpty(parentBlock)) {
24129
24306
  emptyBlock(parentBlock);
@@ -24134,7 +24311,8 @@
24134
24311
  newBlock = insertNewBlockAfter();
24135
24312
  } else if (isCaretAtStartOrEndOfBlock(true) && parentBlockParent) {
24136
24313
  newBlock = parentBlockParent.insertBefore(createNewBlock(), parentBlock);
24137
- moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') ? newBlock : parentBlock);
24314
+ const isNearChildren = hasChildNodes(SugarElement.fromDom(rng.startContainer)) && rng.collapsed;
24315
+ moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') || isNearChildren ? newBlock : parentBlock);
24138
24316
  } else {
24139
24317
  const tmpRng = includeZwspInRange(rng).cloneRange();
24140
24318
  tmpRng.setEndAfter(parentBlock);
@@ -24336,6 +24514,14 @@
24336
24514
  const rootEditable = getEditableRoot(editor.dom, editor.selection.getStart());
24337
24515
  return isNonNullable(rootEditable) && editor.schema.isValidChild(rootEditable.nodeName, forcedRootBlock);
24338
24516
  };
24517
+ const isInRootWithEmptyOrCEF = editor => {
24518
+ const rng = editor.selection.getRng();
24519
+ const isInRoot = rng.collapsed && rng.startContainer === editor.dom.getRoot();
24520
+ const start = SugarElement.fromDom(rng.startContainer);
24521
+ const child = child$1(start, rng.startOffset);
24522
+ const isCefOpt = child.map(element => isHTMLElement(element) && !isEditable$3(element));
24523
+ return isInRoot && isCefOpt.getOr(true);
24524
+ };
24339
24525
  const match = (predicates, action) => {
24340
24526
  return (editor, shiftKey) => {
24341
24527
  const isMatch = foldl(predicates, (res, p) => {
@@ -24377,7 +24563,8 @@
24377
24563
  match([inListBlock(true)], newLineAction.block()),
24378
24564
  match([inBrContext], newLineAction.br()),
24379
24565
  match([hasShiftKey], newLineAction.br()),
24380
- match([canInsertIntoEditableRoot], newLineAction.block())
24566
+ match([canInsertIntoEditableRoot], newLineAction.block()),
24567
+ match([isInRootWithEmptyOrCEF], newLineAction.block())
24381
24568
  ], [
24382
24569
  editor,
24383
24570
  !!(evt && evt.shiftKey)
@@ -24389,14 +24576,14 @@
24389
24576
  execEditorDeleteCommand(editor);
24390
24577
  }
24391
24578
  if (isNonNullable(evt)) {
24392
- const event = fireFakeBeforeInputEvent(editor, breakType.fakeEventName);
24579
+ const event = fireBeforeInputEvent(editor, breakType.fakeEventName);
24393
24580
  if (event.isDefaultPrevented()) {
24394
24581
  return;
24395
24582
  }
24396
24583
  }
24397
24584
  breakType.insert(editor, evt);
24398
24585
  if (isNonNullable(evt)) {
24399
- fireFakeInputEvent(editor, breakType.fakeEventName);
24586
+ fireInputEvent(editor, breakType.fakeEventName);
24400
24587
  }
24401
24588
  };
24402
24589
  const insert = (editor, evt) => {
@@ -24419,6 +24606,8 @@
24419
24606
  }
24420
24607
  };
24421
24608
 
24609
+ const platform$2 = detect$2();
24610
+ const isIOSSafari = platform$2.os.isiOS() && platform$2.browser.isSafari();
24422
24611
  const handleEnterKeyEvent = (editor, event) => {
24423
24612
  if (event.isDefaultPrevented()) {
24424
24613
  return;
@@ -24429,10 +24618,43 @@
24429
24618
  insert(editor, event);
24430
24619
  });
24431
24620
  };
24621
+ const isCaretAfterKoreanCharacter = rng => {
24622
+ if (!rng.collapsed) {
24623
+ return false;
24624
+ }
24625
+ const startContainer = rng.startContainer;
24626
+ if (isText$a(startContainer)) {
24627
+ const koreanCharRegex = /^[\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]$/;
24628
+ const char = startContainer.data.charAt(rng.startOffset - 1);
24629
+ return koreanCharRegex.test(char);
24630
+ } else {
24631
+ return false;
24632
+ }
24633
+ };
24432
24634
  const setup$h = editor => {
24635
+ let iOSSafariKeydownBookmark = Optional.none();
24636
+ const iOSSafariKeydownOverride = editor => {
24637
+ iOSSafariKeydownBookmark = Optional.some(editor.selection.getBookmark());
24638
+ editor.undoManager.add();
24639
+ };
24640
+ const iOSSafariKeyupOverride = (editor, event) => {
24641
+ editor.undoManager.undo();
24642
+ iOSSafariKeydownBookmark.fold(noop, b => editor.selection.moveToBookmark(b));
24643
+ handleEnterKeyEvent(editor, event);
24644
+ iOSSafariKeydownBookmark = Optional.none();
24645
+ };
24433
24646
  editor.on('keydown', event => {
24434
24647
  if (event.keyCode === VK.ENTER) {
24435
- handleEnterKeyEvent(editor, event);
24648
+ if (isIOSSafari && isCaretAfterKoreanCharacter(editor.selection.getRng())) {
24649
+ iOSSafariKeydownOverride(editor);
24650
+ } else {
24651
+ handleEnterKeyEvent(editor, event);
24652
+ }
24653
+ }
24654
+ });
24655
+ editor.on('keyup', event => {
24656
+ if (event.keyCode === VK.ENTER) {
24657
+ iOSSafariKeydownBookmark.each(() => iOSSafariKeyupOverride(editor, event));
24436
24658
  }
24437
24659
  });
24438
24660
  };
@@ -24498,7 +24720,7 @@
24498
24720
  });
24499
24721
  };
24500
24722
 
24501
- const platform = detect$2();
24723
+ const platform$1 = detect$2();
24502
24724
  const executeKeyupAction = (editor, caret, evt) => {
24503
24725
  execute([
24504
24726
  {
@@ -24522,7 +24744,7 @@
24522
24744
  blocked.set(block);
24523
24745
  };
24524
24746
  const setup$e = (editor, caret) => {
24525
- if (platform.os.isMacOS()) {
24747
+ if (platform$1.os.isMacOS()) {
24526
24748
  return;
24527
24749
  }
24528
24750
  const blocked = Cell(false);
@@ -24588,10 +24810,10 @@
24588
24810
  action: action(insertSpaceOrNbspAtSelection, editor)
24589
24811
  }], evt).each(applyAction => {
24590
24812
  evt.preventDefault();
24591
- const event = fireFakeBeforeInputEvent(editor, 'insertText', { data: ' ' });
24813
+ const event = fireBeforeInputEvent(editor, 'insertText', { data: ' ' });
24592
24814
  if (!event.isDefaultPrevented()) {
24593
24815
  applyAction();
24594
- fireFakeInputEvent(editor, 'insertText', { data: ' ' });
24816
+ fireInputEvent(editor, 'insertText', { data: ' ' });
24595
24817
  }
24596
24818
  });
24597
24819
  };
@@ -24743,6 +24965,201 @@
24743
24965
  }
24744
24966
  }
24745
24967
 
24968
+ const imageId = generate$1('image');
24969
+ const getDragImage = transfer => {
24970
+ const dt = transfer;
24971
+ return Optional.from(dt[imageId]);
24972
+ };
24973
+ const setDragImage = (transfer, imageData) => {
24974
+ const dt = transfer;
24975
+ dt[imageId] = imageData;
24976
+ };
24977
+
24978
+ const eventId = generate$1('event');
24979
+ const getEvent = transfer => {
24980
+ const dt = transfer;
24981
+ return Optional.from(dt[eventId]);
24982
+ };
24983
+ const mkSetEventFn = type => transfer => {
24984
+ const dt = transfer;
24985
+ dt[eventId] = type;
24986
+ };
24987
+ const setEvent = (transfer, type) => mkSetEventFn(type)(transfer);
24988
+ const setDragstartEvent = mkSetEventFn(0);
24989
+ const setDropEvent = mkSetEventFn(2);
24990
+ const setDragendEvent = mkSetEventFn(1);
24991
+ const checkEvent = expectedType => transfer => {
24992
+ const dt = transfer;
24993
+ return Optional.from(dt[eventId]).exists(type => type === expectedType);
24994
+ };
24995
+ const isInDragStartEvent = checkEvent(0);
24996
+
24997
+ const createEmptyFileList = () => Object.freeze({
24998
+ length: 0,
24999
+ item: _ => null
25000
+ });
25001
+
25002
+ const modeId = generate$1('mode');
25003
+ const getMode = transfer => {
25004
+ const dt = transfer;
25005
+ return Optional.from(dt[modeId]);
25006
+ };
25007
+ const mkSetModeFn = mode => transfer => {
25008
+ const dt = transfer;
25009
+ dt[modeId] = mode;
25010
+ };
25011
+ const setMode$1 = (transfer, mode) => mkSetModeFn(mode)(transfer);
25012
+ const setReadWriteMode = mkSetModeFn(0);
25013
+ const setReadOnlyMode = mkSetModeFn(2);
25014
+ const setProtectedMode = mkSetModeFn(1);
25015
+ const checkMode = expectedMode => transfer => {
25016
+ const dt = transfer;
25017
+ return Optional.from(dt[modeId]).exists(mode => mode === expectedMode);
25018
+ };
25019
+ const isInReadWriteMode = checkMode(0);
25020
+ const isInProtectedMode = checkMode(1);
25021
+
25022
+ const normalizeItems = (dataTransfer, itemsImpl) => ({
25023
+ ...itemsImpl,
25024
+ get length() {
25025
+ return itemsImpl.length;
25026
+ },
25027
+ add: (data, type) => {
25028
+ if (isInReadWriteMode(dataTransfer)) {
25029
+ if (isString(data)) {
25030
+ if (!isUndefined(type)) {
25031
+ return itemsImpl.add(data, type);
25032
+ }
25033
+ } else {
25034
+ return itemsImpl.add(data);
25035
+ }
25036
+ }
25037
+ return null;
25038
+ },
25039
+ remove: idx => {
25040
+ if (isInReadWriteMode(dataTransfer)) {
25041
+ itemsImpl.remove(idx);
25042
+ }
25043
+ },
25044
+ clear: () => {
25045
+ if (isInReadWriteMode(dataTransfer)) {
25046
+ itemsImpl.clear();
25047
+ }
25048
+ }
25049
+ });
25050
+
25051
+ const validDropEffects = [
25052
+ 'none',
25053
+ 'copy',
25054
+ 'link',
25055
+ 'move'
25056
+ ];
25057
+ const validEffectAlloweds = [
25058
+ 'none',
25059
+ 'copy',
25060
+ 'copyLink',
25061
+ 'copyMove',
25062
+ 'link',
25063
+ 'linkMove',
25064
+ 'move',
25065
+ 'all',
25066
+ 'uninitialized'
25067
+ ];
25068
+ const createDataTransfer = () => {
25069
+ const dataTransferImpl = new window.DataTransfer();
25070
+ let dropEffect = 'move';
25071
+ let effectAllowed = 'all';
25072
+ const dataTransfer = {
25073
+ get dropEffect() {
25074
+ return dropEffect;
25075
+ },
25076
+ set dropEffect(effect) {
25077
+ if (contains$2(validDropEffects, effect)) {
25078
+ dropEffect = effect;
25079
+ }
25080
+ },
25081
+ get effectAllowed() {
25082
+ return effectAllowed;
25083
+ },
25084
+ set effectAllowed(allowed) {
25085
+ if (isInDragStartEvent(dataTransfer) && contains$2(validEffectAlloweds, allowed)) {
25086
+ effectAllowed = allowed;
25087
+ }
25088
+ },
25089
+ get items() {
25090
+ return normalizeItems(dataTransfer, dataTransferImpl.items);
25091
+ },
25092
+ get files() {
25093
+ if (isInProtectedMode(dataTransfer)) {
25094
+ return createEmptyFileList();
25095
+ } else {
25096
+ return dataTransferImpl.files;
25097
+ }
25098
+ },
25099
+ get types() {
25100
+ return dataTransferImpl.types;
25101
+ },
25102
+ setDragImage: (image, x, y) => {
25103
+ if (isInReadWriteMode(dataTransfer)) {
25104
+ setDragImage(dataTransfer, {
25105
+ image,
25106
+ x,
25107
+ y
25108
+ });
25109
+ dataTransferImpl.setDragImage(image, x, y);
25110
+ }
25111
+ },
25112
+ getData: format => {
25113
+ if (isInProtectedMode(dataTransfer)) {
25114
+ return '';
25115
+ } else {
25116
+ return dataTransferImpl.getData(format);
25117
+ }
25118
+ },
25119
+ setData: (format, data) => {
25120
+ if (isInReadWriteMode(dataTransfer)) {
25121
+ dataTransferImpl.setData(format, data);
25122
+ }
25123
+ },
25124
+ clearData: format => {
25125
+ if (isInReadWriteMode(dataTransfer)) {
25126
+ dataTransferImpl.clearData(format);
25127
+ }
25128
+ }
25129
+ };
25130
+ setReadWriteMode(dataTransfer);
25131
+ return dataTransfer;
25132
+ };
25133
+ const cloneDataTransfer = original => {
25134
+ const clone = createDataTransfer();
25135
+ const originalMode = getMode(original);
25136
+ setReadOnlyMode(original);
25137
+ setDragstartEvent(clone);
25138
+ clone.dropEffect = original.dropEffect;
25139
+ clone.effectAllowed = original.effectAllowed;
25140
+ getDragImage(original).each(imageData => clone.setDragImage(imageData.image, imageData.x, imageData.y));
25141
+ each$e(original.types, type => {
25142
+ if (type !== 'Files') {
25143
+ clone.setData(type, original.getData(type));
25144
+ }
25145
+ });
25146
+ each$e(original.files, file => clone.items.add(file));
25147
+ getEvent(original).each(type => {
25148
+ setEvent(clone, type);
25149
+ });
25150
+ originalMode.each(mode => {
25151
+ setMode$1(original, mode);
25152
+ setMode$1(clone, mode);
25153
+ });
25154
+ return clone;
25155
+ };
25156
+
25157
+ const getHtmlData = dataTransfer => {
25158
+ const html = dataTransfer.getData('text/html');
25159
+ return html === '' ? Optional.none() : Optional.some(html);
25160
+ };
25161
+ const setHtmlData = (dataTransfer, html) => dataTransfer.setData('text/html', html);
25162
+
24746
25163
  const internalMimeType = 'x-tinymce/html';
24747
25164
  const internalHtmlMime = constant(internalMimeType);
24748
25165
  const internalMark = '<!-- ' + internalMimeType + ' -->';
@@ -25019,10 +25436,21 @@
25019
25436
  };
25020
25437
 
25021
25438
  const uniqueId = createIdGenerator('mceclip');
25439
+ const createPasteDataTransfer = html => {
25440
+ const dataTransfer = createDataTransfer();
25441
+ setHtmlData(dataTransfer, html);
25442
+ setReadOnlyMode(dataTransfer);
25443
+ return dataTransfer;
25444
+ };
25022
25445
  const doPaste = (editor, content, internal, pasteAsText) => {
25023
- const args = process(editor, content, internal);
25024
- if (!args.cancelled) {
25025
- insertContent(editor, args.content, pasteAsText);
25446
+ const res = process(editor, content, internal);
25447
+ if (!res.cancelled) {
25448
+ const content = res.content;
25449
+ const args = fireBeforeInputEvent(editor, 'insertFromPaste', { dataTransfer: createPasteDataTransfer(content) });
25450
+ if (!args.isDefaultPrevented()) {
25451
+ insertContent(editor, content, pasteAsText);
25452
+ fireInputEvent(editor, 'insertFromPaste');
25453
+ }
25026
25454
  }
25027
25455
  };
25028
25456
  const pasteHtml = (editor, html, internalFlag) => {
@@ -25160,11 +25588,10 @@
25160
25588
  if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {
25161
25589
  return;
25162
25590
  }
25591
+ e.preventDefault();
25163
25592
  if (hasContentType(clipboardContent, 'text/html')) {
25164
- e.preventDefault();
25165
25593
  insertClipboardContent(editor, clipboardContent, clipboardContent['text/html'], plainTextMode);
25166
25594
  } else if (hasContentType(clipboardContent, 'text/plain') && hasContentType(clipboardContent, 'text/uri-list')) {
25167
- e.preventDefault();
25168
25595
  insertClipboardContent(editor, clipboardContent, clipboardContent['text/plain'], plainTextMode);
25169
25596
  } else {
25170
25597
  pasteBin.create();
@@ -25250,7 +25677,7 @@
25250
25677
  fallback(data.html, done);
25251
25678
  }
25252
25679
  };
25253
- const fallback$1 = editor => (html, done) => {
25680
+ const fallback = editor => (html, done) => {
25254
25681
  const {dom, selection} = editor;
25255
25682
  const outer = dom.create('div', {
25256
25683
  'contenteditable': 'false',
@@ -25285,7 +25712,7 @@
25285
25712
  const hasSelectedContent = editor => !editor.selection.isCollapsed() || isTableSelection(editor);
25286
25713
  const cut = editor => evt => {
25287
25714
  if (!evt.isDefaultPrevented() && hasSelectedContent(editor)) {
25288
- setClipboardData(evt, getData(editor), fallback$1(editor), () => {
25715
+ setClipboardData(evt, getData(editor), fallback(editor), () => {
25289
25716
  if (Env.browser.isChromium() || Env.browser.isFirefox()) {
25290
25717
  const rng = editor.selection.getRng();
25291
25718
  Delay.setEditorTimeout(editor, () => {
@@ -25300,7 +25727,7 @@
25300
25727
  };
25301
25728
  const copy = editor => evt => {
25302
25729
  if (!evt.isDefaultPrevented() && hasSelectedContent(editor)) {
25303
- setClipboardData(evt, getData(editor), fallback$1(editor), noop);
25730
+ setClipboardData(evt, getData(editor), fallback(editor), noop);
25304
25731
  }
25305
25732
  };
25306
25733
  const register = editor => {
@@ -25485,22 +25912,217 @@
25485
25912
  };
25486
25913
  const filterDetails = editor => {
25487
25914
  editor.parser.addNodeFilter('details', elms => {
25915
+ const initialStateOption = getDetailsInitialState(editor);
25488
25916
  each$e(elms, details => {
25489
- details.attr('data-mce-open', details.attr('open'));
25490
- details.attr('open', 'open');
25917
+ if (initialStateOption === 'expanded') {
25918
+ details.attr('open', 'open');
25919
+ } else if (initialStateOption === 'collapsed') {
25920
+ details.attr('open', null);
25921
+ }
25491
25922
  });
25492
25923
  });
25493
25924
  editor.serializer.addNodeFilter('details', elms => {
25925
+ const serializedStateOption = getDetailsSerializedState(editor);
25494
25926
  each$e(elms, details => {
25495
- const open = details.attr('data-mce-open');
25496
- details.attr('open', isString(open) ? open : null);
25497
- details.attr('data-mce-open', null);
25927
+ if (serializedStateOption === 'expanded') {
25928
+ details.attr('open', 'open');
25929
+ } else if (serializedStateOption === 'collapsed') {
25930
+ details.attr('open', null);
25931
+ }
25932
+ });
25933
+ });
25934
+ };
25935
+ const emptyNodeContents = node => fillWithPaddingBr(SugarElement.fromDom(node));
25936
+ const setCaretToPosition = (editor, position) => {
25937
+ const node = position.getNode();
25938
+ if (!isUndefined(node)) {
25939
+ editor.selection.setCursorLocation(node, position.offset());
25940
+ }
25941
+ };
25942
+ const isEntireNodeSelected = (rng, node) => {
25943
+ var _a;
25944
+ return rng.startOffset === 0 && rng.endOffset === ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.length);
25945
+ };
25946
+ const platform = detect$2();
25947
+ const browser = platform.browser;
25948
+ const os = platform.os;
25949
+ const isSafari = browser.isSafari();
25950
+ const isMacOSOriOS = os.isMacOS() || os.isiOS();
25951
+ const isCaretInTheBeginningOf = (caretPos, element) => firstPositionIn(element).exists(pos => pos.isEqual(caretPos));
25952
+ const isCaretInTheEndOf = (caretPos, element) => {
25953
+ return lastPositionIn(element).exists(pos => {
25954
+ if (isBr$6(pos.getNode())) {
25955
+ return prevPosition(element, pos).exists(pos2 => pos2.isEqual(caretPos)) || pos.isEqual(caretPos);
25956
+ } else {
25957
+ return pos.isEqual(caretPos);
25958
+ }
25959
+ });
25960
+ };
25961
+ const getDetailsElements = (dom, rng) => {
25962
+ const startDetails = Optional.from(dom.getParent(rng.startContainer, 'details'));
25963
+ const endDetails = Optional.from(dom.getParent(rng.endContainer, 'details'));
25964
+ if (startDetails.isSome() || endDetails.isSome()) {
25965
+ const startSummary = startDetails.bind(details => Optional.from(dom.select('summary', details)[0]));
25966
+ return Optional.some({
25967
+ startSummary,
25968
+ startDetails,
25969
+ endDetails
25498
25970
  });
25971
+ } else {
25972
+ return Optional.none();
25973
+ }
25974
+ };
25975
+ const isPartialDelete = (rng, detailsElements) => {
25976
+ const containsStart = element => element.contains(rng.startContainer);
25977
+ const containsEnd = element => element.contains(rng.endContainer);
25978
+ const startInSummary = detailsElements.startSummary.exists(containsStart);
25979
+ const endInSummary = detailsElements.startSummary.exists(containsEnd);
25980
+ const isPartiallySelectedDetailsElements = detailsElements.startDetails.forall(startDetails => detailsElements.endDetails.forall(endDetails => startDetails !== endDetails));
25981
+ const isInPartiallySelectedSummary = (startInSummary || endInSummary) && !(startInSummary && endInSummary);
25982
+ return isInPartiallySelectedSummary || isPartiallySelectedDetailsElements;
25983
+ };
25984
+ const isCaretAtStartOfSummary = (caretPos, detailsElements) => detailsElements.startSummary.exists(summary => isCaretInTheBeginningOf(caretPos, summary));
25985
+ const isCaretAtEndOfSummary = (caretPos, detailsElements) => detailsElements.startSummary.exists(summary => isCaretInTheEndOf(caretPos, summary));
25986
+ const isCaretInFirstPositionInBody = (caretPos, detailsElements) => detailsElements.startDetails.exists(details => prevPosition(details, caretPos).forall(pos => detailsElements.startSummary.exists(summary => !summary.contains(caretPos.container()) && summary.contains(pos.container()))));
25987
+ const isCaretInLastPositionInBody = (root, caretPos, detailsElements) => detailsElements.startDetails.exists(details => nextPosition(root, caretPos).forall(pos => !details.contains(pos.container())));
25988
+ const isInDetailsElement = (dom, pos) => isNonNullable(dom.getParent(pos.container(), 'details'));
25989
+ const moveCaretToDetailsPos = (editor, pos) => {
25990
+ const details = editor.dom.getParent(pos.container(), 'details');
25991
+ if (details && !details.open) {
25992
+ const summary = editor.dom.select('summary', details)[0];
25993
+ if (summary) {
25994
+ lastPositionIn(summary).each(pos => setCaretToPosition(editor, pos));
25995
+ }
25996
+ } else {
25997
+ setCaretToPosition(editor, pos);
25998
+ }
25999
+ };
26000
+ const preventDeleteIntoDetails = (editor, forward) => {
26001
+ const {dom, selection} = editor;
26002
+ const root = editor.getBody();
26003
+ if (editor.selection.isCollapsed()) {
26004
+ const caretPos = CaretPosition.fromRangeStart(selection.getRng());
26005
+ const parentBlock = dom.getParent(caretPos.container(), dom.isBlock);
26006
+ if (parentBlock && dom.isEmpty(parentBlock)) {
26007
+ if (isNull(parentBlock.nextSibling)) {
26008
+ const pos = prevPosition(root, caretPos).filter(pos => isInDetailsElement(dom, pos));
26009
+ if (pos.isSome()) {
26010
+ pos.each(pos => {
26011
+ if (!forward) {
26012
+ moveCaretToDetailsPos(editor, pos);
26013
+ }
26014
+ });
26015
+ return true;
26016
+ }
26017
+ } else if (isNull(parentBlock.previousSibling)) {
26018
+ const pos = nextPosition(root, caretPos).filter(pos => isInDetailsElement(dom, pos));
26019
+ if (pos) {
26020
+ return true;
26021
+ }
26022
+ }
26023
+ }
26024
+ return navigate(forward, root, caretPos).fold(never, pos => {
26025
+ if (isInDetailsElement(dom, pos)) {
26026
+ if (parentBlock && dom.isEmpty(parentBlock)) {
26027
+ editor.dom.remove(parentBlock);
26028
+ }
26029
+ if (!forward) {
26030
+ moveCaretToDetailsPos(editor, pos);
26031
+ }
26032
+ return true;
26033
+ } else {
26034
+ return false;
26035
+ }
26036
+ });
26037
+ } else {
26038
+ return false;
26039
+ }
26040
+ };
26041
+ const preventDeleteSummaryAction = (editor, detailElements, e) => {
26042
+ const selection = editor.selection;
26043
+ const node = selection.getNode();
26044
+ const rng = selection.getRng();
26045
+ const isBackspace = e.keyCode === VK.BACKSPACE;
26046
+ const isDelete = e.keyCode === VK.DELETE;
26047
+ const isCollapsed = editor.selection.isCollapsed();
26048
+ const caretPos = CaretPosition.fromRangeStart(rng);
26049
+ const root = editor.getBody();
26050
+ if (!isCollapsed && isPartialDelete(rng, detailElements)) {
26051
+ return true;
26052
+ } else if (isCollapsed && isBackspace && isCaretAtStartOfSummary(caretPos, detailElements)) {
26053
+ return true;
26054
+ } else if (isCollapsed && isDelete && isCaretAtEndOfSummary(caretPos, detailElements)) {
26055
+ return true;
26056
+ } else if (isCollapsed && isBackspace && isCaretInFirstPositionInBody(caretPos, detailElements)) {
26057
+ return true;
26058
+ } else if (isCollapsed && isDelete && isCaretInLastPositionInBody(root, caretPos, detailElements)) {
26059
+ return true;
26060
+ } else if (isSafari && isSummary(node)) {
26061
+ if (!isCollapsed && isEntireNodeSelected(rng, node) || willDeleteLastPositionInElement(isDelete, caretPos, node)) {
26062
+ emptyNodeContents(node);
26063
+ } else {
26064
+ editor.undoManager.transact(() => {
26065
+ const sel = selection.getSel();
26066
+ let {anchorNode, anchorOffset, focusNode, focusOffset} = sel !== null && sel !== void 0 ? sel : {};
26067
+ const applySelection = () => {
26068
+ if (isNonNullable(anchorNode) && isNonNullable(anchorOffset) && isNonNullable(focusNode) && isNonNullable(focusOffset)) {
26069
+ sel === null || sel === void 0 ? void 0 : sel.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
26070
+ }
26071
+ };
26072
+ const updateSelection = () => {
26073
+ anchorNode = sel === null || sel === void 0 ? void 0 : sel.anchorNode;
26074
+ anchorOffset = sel === null || sel === void 0 ? void 0 : sel.anchorOffset;
26075
+ focusNode = sel === null || sel === void 0 ? void 0 : sel.focusNode;
26076
+ focusOffset = sel === null || sel === void 0 ? void 0 : sel.focusOffset;
26077
+ };
26078
+ const appendAllChildNodes = (from, to) => {
26079
+ each$e(from.childNodes, child => {
26080
+ if (isNode(child)) {
26081
+ to.appendChild(child);
26082
+ }
26083
+ });
26084
+ };
26085
+ const container = editor.dom.create('span', { 'data-mce-bogus': 'all' });
26086
+ appendAllChildNodes(node, container);
26087
+ node.appendChild(container);
26088
+ applySelection();
26089
+ if (isCollapsed && (isMacOSOriOS && (e.altKey || isBackspace && e.metaKey) || !isMacOSOriOS && e.ctrlKey)) {
26090
+ sel === null || sel === void 0 ? void 0 : sel.modify('extend', isBackspace ? 'left' : 'right', e.metaKey ? 'line' : 'word');
26091
+ }
26092
+ if (!selection.isCollapsed() && isEntireNodeSelected(selection.getRng(), container)) {
26093
+ emptyNodeContents(node);
26094
+ } else {
26095
+ editor.execCommand(isBackspace ? 'Delete' : 'ForwardDelete');
26096
+ updateSelection();
26097
+ appendAllChildNodes(container, node);
26098
+ applySelection();
26099
+ }
26100
+ editor.dom.remove(container);
26101
+ });
26102
+ }
26103
+ return true;
26104
+ }
26105
+ return false;
26106
+ };
26107
+ const preventDeletingSummary = editor => {
26108
+ editor.on('keydown', e => {
26109
+ if (e.keyCode === VK.BACKSPACE || e.keyCode === VK.DELETE) {
26110
+ getDetailsElements(editor.dom, editor.selection.getRng()).fold(() => {
26111
+ if (preventDeleteIntoDetails(editor, e.keyCode === VK.DELETE)) {
26112
+ e.preventDefault();
26113
+ }
26114
+ }, detailsElements => {
26115
+ if (preventDeleteSummaryAction(editor, detailsElements, e)) {
26116
+ e.preventDefault();
26117
+ }
26118
+ });
26119
+ }
25499
26120
  });
25500
26121
  };
25501
26122
  const setup$6 = editor => {
25502
26123
  preventSummaryToggle(editor);
25503
26124
  filterDetails(editor);
26125
+ preventDeletingSummary(editor);
25504
26126
  };
25505
26127
 
25506
26128
  const isBr = isBr$6;
@@ -25709,13 +26331,17 @@
25709
26331
  });
25710
26332
  const calc = (editor, event) => calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));
25711
26333
 
25712
- const makeDndEventFromMouseEvent = (type, mouseEvent, extra) => ({
26334
+ const getTargetProps = target => ({
26335
+ target,
26336
+ srcElement: target
26337
+ });
26338
+ const makeDndEventFromMouseEvent = (type, mouseEvent, target, dataTransfer) => ({
25713
26339
  ...mouseEvent,
25714
- dataTransfer: null,
26340
+ dataTransfer,
25715
26341
  type,
25716
- ...extra
26342
+ ...getTargetProps(target)
25717
26343
  });
25718
- const makeDndEvent = (type, props) => {
26344
+ const makeDndEvent = (type, target, dataTransfer) => {
25719
26345
  const fail = die('Function not supported on simulated event.');
25720
26346
  const event = {
25721
26347
  bubbles: true,
@@ -25727,8 +26353,6 @@
25727
26353
  eventPhase: 0,
25728
26354
  isTrusted: true,
25729
26355
  returnValue: false,
25730
- srcElement: null,
25731
- target: null,
25732
26356
  timeStamp: 0,
25733
26357
  type,
25734
26358
  composedPath: fail,
@@ -25765,21 +26389,29 @@
25765
26389
  initUIEvent: fail,
25766
26390
  initMouseEvent: fail,
25767
26391
  getModifierState: fail,
25768
- dataTransfer: null,
25769
- ...props
26392
+ dataTransfer,
26393
+ ...getTargetProps(target)
25770
26394
  };
25771
26395
  return event;
25772
26396
  };
25773
- const fallback = target => ({
25774
- target,
25775
- srcElement: target
25776
- });
25777
- const dndEvent = type => target => makeDndEvent(type, fallback(target));
25778
- const dndEventFromMouseEvent = type => (mouseEvent, target) => makeDndEventFromMouseEvent(type, mouseEvent, fallback(target));
25779
- const makeDragstartEventFromMouseEvent = dndEventFromMouseEvent('dragstart');
25780
- const makeDropEventFromMouseEvent = dndEventFromMouseEvent('drop');
25781
- const makeDragendEvent = dndEvent('dragend');
25782
- const makeDragendEventFromMouseEvent = dndEventFromMouseEvent('dragend');
26397
+ const makeDataTransferCopyForDragEvent = (dataTransfer, eventType) => {
26398
+ const copy = cloneDataTransfer(dataTransfer);
26399
+ if (eventType === 'dragstart') {
26400
+ setDragstartEvent(copy);
26401
+ setReadWriteMode(copy);
26402
+ } else if (eventType === 'drop') {
26403
+ setDropEvent(copy);
26404
+ setReadOnlyMode(copy);
26405
+ } else {
26406
+ setDragendEvent(copy);
26407
+ setProtectedMode(copy);
26408
+ }
26409
+ return copy;
26410
+ };
26411
+ const makeDragEvent = (type, target, dataTransfer, mouseEvent) => {
26412
+ const dataTransferForDispatch = makeDataTransferCopyForDragEvent(dataTransfer, type);
26413
+ return isUndefined(mouseEvent) ? makeDndEvent(type, target, dataTransferForDispatch) : makeDndEventFromMouseEvent(type, mouseEvent, target, dataTransferForDispatch);
26414
+ };
25783
26415
 
25784
26416
  const scrollPixelsPerInterval = 32;
25785
26417
  const scrollIntervalValue = 100;
@@ -25797,11 +26429,6 @@
25797
26429
  return editor.dom.isEditable(targetElement);
25798
26430
  }
25799
26431
  };
25800
- const cloneElement = elm => {
25801
- const cloneElm = elm.cloneNode(true);
25802
- cloneElm.removeAttribute('data-mce-selected');
25803
- return cloneElm;
25804
- };
25805
26432
  const createGhost = (editor, elm, width, height) => {
25806
26433
  const dom = editor.dom;
25807
26434
  const clonedElm = elm.cloneNode(true);
@@ -25914,6 +26541,7 @@
25914
26541
  const docElm = editor.getDoc().documentElement;
25915
26542
  state.set({
25916
26543
  element: ceElm,
26544
+ dataTransfer: createDataTransfer(),
25917
26545
  dragging: false,
25918
26546
  screenX: e.screenX,
25919
26547
  screenY: e.screenY,
@@ -25940,6 +26568,14 @@
25940
26568
  }
25941
26569
  });
25942
26570
  };
26571
+ const dispatchDragEvent = (editor, type, target, dataTransfer, mouseEvent) => {
26572
+ if (type === 'dragstart') {
26573
+ setHtmlData(dataTransfer, editor.dom.getOuterHTML(target));
26574
+ }
26575
+ const event = makeDragEvent(type, target, dataTransfer, mouseEvent);
26576
+ const args = editor.dispatch(type, event);
26577
+ return args;
26578
+ };
25943
26579
  const move = (state, editor) => {
25944
26580
  const throttledPlaceCaretAt = first$1((clientX, clientY) => placeCaretAt(editor, clientX, clientY), 0);
25945
26581
  editor.on('remove', throttledPlaceCaretAt.cancel);
@@ -25947,7 +26583,10 @@
25947
26583
  return e => state.on(state => {
25948
26584
  const movement = Math.max(Math.abs(e.screenX - state.screenX), Math.abs(e.screenY - state.screenY));
25949
26585
  if (!state.dragging && movement > 10) {
25950
- const args = editor.dispatch('dragstart', makeDragstartEventFromMouseEvent(e, state.element));
26586
+ const args = dispatchDragEvent(editor, 'dragstart', state.element, state.dataTransfer, e);
26587
+ if (isNonNullable(args.dataTransfer)) {
26588
+ state.dataTransfer = args.dataTransfer;
26589
+ }
25951
26590
  if (args.isDefaultPrevented()) {
25952
26591
  return;
25953
26592
  }
@@ -25979,18 +26618,17 @@
25979
26618
  state.intervalId.clear();
25980
26619
  if (state.dragging) {
25981
26620
  if (isValidDropTarget(editor, getRawTarget(editor.selection), state.element)) {
25982
- const targetClone = cloneElement(state.element);
25983
26621
  const dropTarget = (_a = editor.getDoc().elementFromPoint(e.clientX, e.clientY)) !== null && _a !== void 0 ? _a : editor.getBody();
25984
- const args = editor.dispatch('drop', makeDropEventFromMouseEvent(e, dropTarget));
26622
+ const args = dispatchDragEvent(editor, 'drop', dropTarget, state.dataTransfer, e);
25985
26623
  if (!args.isDefaultPrevented()) {
25986
26624
  editor.undoManager.transact(() => {
25987
26625
  removeElementWithPadding(editor.dom, state.element);
25988
- editor.insertContent(editor.dom.getOuterHTML(targetClone));
26626
+ getHtmlData(state.dataTransfer).each(content => editor.insertContent(content));
25989
26627
  editor._selectionOverrides.hideFakeCaret();
25990
26628
  });
25991
26629
  }
25992
26630
  }
25993
- editor.dispatch('dragend', makeDragendEventFromMouseEvent(e, editor.getBody()));
26631
+ dispatchDragEvent(editor, 'dragend', editor.getBody(), state.dataTransfer, e);
25994
26632
  }
25995
26633
  });
25996
26634
  removeDragState(state);
@@ -25999,8 +26637,7 @@
25999
26637
  state.on(state => {
26000
26638
  state.intervalId.clear();
26001
26639
  if (state.dragging) {
26002
- const event = e.fold(() => makeDragendEvent(state.element), mouseEvent => makeDragendEventFromMouseEvent(mouseEvent, state.element));
26003
- editor.dispatch('dragend', event);
26640
+ e.fold(() => dispatchDragEvent(editor, 'dragend', state.element, state.dataTransfer), mouseEvent => dispatchDragEvent(editor, 'dragend', state.element, state.dataTransfer, mouseEvent));
26004
26641
  }
26005
26642
  });
26006
26643
  removeDragState(state);
@@ -26310,7 +26947,7 @@
26310
26947
  const nodeElm = SugarElement.fromDom(elm);
26311
26948
  each$e(descendants(SugarElement.fromDom(editor.getBody()), `*[${ elementSelectionAttr }]`), elm => {
26312
26949
  if (!eq(nodeElm, elm)) {
26313
- remove$b(elm, elementSelectionAttr);
26950
+ remove$a(elm, elementSelectionAttr);
26314
26951
  }
26315
26952
  });
26316
26953
  if (!dom.getAttrib(elm, elementSelectionAttr)) {
@@ -26378,7 +27015,7 @@
26378
27015
  if (selectedElement) {
26379
27016
  selectedElement.removeAttribute(elementSelectionAttr);
26380
27017
  }
26381
- descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).each(remove$6);
27018
+ descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).each(remove$5);
26382
27019
  selectedElement = null;
26383
27020
  };
26384
27021
  const destroy = () => {
@@ -27270,6 +27907,15 @@
27270
27907
  blockCmdArrowNavigation();
27271
27908
  }
27272
27909
  };
27910
+ const dropDragEndEvent = () => {
27911
+ editor.on('drop', event => {
27912
+ var _a;
27913
+ const data = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData('text/html');
27914
+ if (isString(data) && /^<img[^>]*>$/.test(data)) {
27915
+ editor.dispatch('dragend', new window.DragEvent('dragend', event));
27916
+ }
27917
+ });
27918
+ };
27273
27919
  const setup = () => {
27274
27920
  removeBlockQuoteOnBackSpace();
27275
27921
  emptyEditorWhenDeleting();
@@ -27300,6 +27946,7 @@
27300
27946
  showBrokenImageIcon();
27301
27947
  blockCmdArrowNavigation();
27302
27948
  disableBackspaceIntoATable();
27949
+ dropDragEndEvent();
27303
27950
  }
27304
27951
  };
27305
27952
  if (isRtc(editor)) {
@@ -27322,7 +27969,7 @@
27322
27969
  append$1(style, SugarElement.fromText(text));
27323
27970
  append$1(container, style);
27324
27971
  editor.on('remove', () => {
27325
- remove$6(style);
27972
+ remove$5(style);
27326
27973
  });
27327
27974
  };
27328
27975
  const getRootName = editor => editor.inline ? editor.getElement().nodeName.toLowerCase() : undefined;
@@ -27343,7 +27990,6 @@
27343
27990
  forced_root_block: getOption('forced_root_block'),
27344
27991
  forced_root_block_attrs: getOption('forced_root_block_attrs'),
27345
27992
  preserve_cdata: getOption('preserve_cdata'),
27346
- remove_trailing_brs: getOption('remove_trailing_brs'),
27347
27993
  inline_styles: getOption('inline_styles'),
27348
27994
  root_name: getRootName(editor),
27349
27995
  sanitize: getOption('xss_sanitization'),
@@ -27374,6 +28020,7 @@
27374
28020
  ...mkParserSettings(editor),
27375
28021
  ...mkSchemaSettings(editor),
27376
28022
  ...removeUndefined({
28023
+ remove_trailing_brs: getOption('remove_trailing_brs'),
27377
28024
  url_converter: getOption('url_converter'),
27378
28025
  url_converter_scope: getOption('url_converter_scope'),
27379
28026
  element_format: getOption('element_format'),
@@ -27586,7 +28233,8 @@
27586
28233
  const body = editor.getBody();
27587
28234
  body.disabled = true;
27588
28235
  editor.readonly = isReadOnly$1(editor);
27589
- if (!editor.readonly) {
28236
+ editor._editableRoot = hasEditableRoot$1(editor);
28237
+ if (!editor.readonly && editor.hasEditableRoot()) {
27590
28238
  if (editor.inline && DOM$6.getStyle(body, 'position', true) === 'static') {
27591
28239
  body.style.position = 'relative';
27592
28240
  }
@@ -27699,17 +28347,21 @@
27699
28347
  };
27700
28348
  const setupIframeBody = editor => {
27701
28349
  const iframe = editor.iframeElement;
27702
- const binder = bind(SugarElement.fromDom(iframe), 'load', () => {
27703
- binder.unbind();
28350
+ const ready = () => {
27704
28351
  editor.contentDocument = iframe.contentDocument;
27705
28352
  contentBodyLoaded(editor);
27706
- });
27707
- if (Env.browser.isFirefox()) {
28353
+ };
28354
+ if (shouldUseDocumentWrite(editor) || Env.browser.isFirefox()) {
27708
28355
  const doc = editor.getDoc();
27709
28356
  doc.open();
27710
28357
  doc.write(editor.iframeHTML);
27711
28358
  doc.close();
28359
+ ready();
27712
28360
  } else {
28361
+ const binder = bind(SugarElement.fromDom(iframe), 'load', () => {
28362
+ binder.unbind();
28363
+ ready();
28364
+ });
27713
28365
  iframe.srcdoc = editor.iframeHTML;
27714
28366
  }
27715
28367
  };
@@ -27977,7 +28629,7 @@
27977
28629
  const element = SugarElement.fromDom(editor.getElement());
27978
28630
  const snapshot = clone$4(element);
27979
28631
  editor.on('remove', () => {
27980
- eachr(element.dom.attributes, attr => remove$b(element, attr.name));
28632
+ eachr(element.dom.attributes, attr => remove$a(element, attr.name));
27981
28633
  setAll$1(element, snapshot);
27982
28634
  });
27983
28635
  editor.ui.styleSheetLoader = getStyleSheetLoader(element, editor);
@@ -28045,6 +28697,18 @@
28045
28697
  loadScripts(editor, editor.suffix);
28046
28698
  };
28047
28699
 
28700
+ const setEditableRoot = (editor, state) => {
28701
+ if (editor._editableRoot !== state) {
28702
+ editor._editableRoot = state;
28703
+ if (!editor.readonly) {
28704
+ editor.getBody().contentEditable = String(editor.hasEditableRoot());
28705
+ editor.nodeChanged();
28706
+ }
28707
+ fireEditableRootStateChange(editor, state);
28708
+ }
28709
+ };
28710
+ const hasEditableRoot = editor => editor._editableRoot;
28711
+
28048
28712
  const sectionResult = (sections, settings) => ({
28049
28713
  sections: constant(sections),
28050
28714
  options: constant(settings)
@@ -28292,7 +28956,7 @@
28292
28956
  editor.execCommand('mceInsertContent', false, value.replace(/\{\$selection\}/g, editor.selection.getContent({ format: 'text' })));
28293
28957
  },
28294
28958
  mceNewDocument: () => {
28295
- editor.setContent('');
28959
+ editor.setContent(getNewDocumentContent(editor));
28296
28960
  }
28297
28961
  });
28298
28962
  };
@@ -28491,14 +29155,16 @@
28491
29155
  };
28492
29156
  editor.editorCommands.addCommands({
28493
29157
  unlink: () => {
28494
- if (editor.selection.isCollapsed()) {
28495
- const elm = editor.dom.getParent(editor.selection.getStart(), 'a');
28496
- if (elm) {
28497
- editor.dom.remove(elm, true);
29158
+ if (editor.selection.isEditable()) {
29159
+ if (editor.selection.isCollapsed()) {
29160
+ const elm = editor.dom.getParent(editor.selection.getStart(), 'a');
29161
+ if (elm) {
29162
+ editor.dom.remove(elm, true);
29163
+ }
29164
+ return;
28498
29165
  }
28499
- return;
29166
+ editor.formatter.remove('link');
28500
29167
  }
28501
- editor.formatter.remove('link');
28502
29168
  },
28503
29169
  mceInsertLink: applyLinkToSelection,
28504
29170
  createLink: applyLinkToSelection
@@ -28709,7 +29375,7 @@
28709
29375
  const internalContentEditableAttr = 'data-mce-contenteditable';
28710
29376
  const toggleClass = (elm, cls, state) => {
28711
29377
  if (has(elm, cls) && !state) {
28712
- remove$8(elm, cls);
29378
+ remove$7(elm, cls);
28713
29379
  } else if (state) {
28714
29380
  add$2(elm, cls);
28715
29381
  }
@@ -28731,7 +29397,7 @@
28731
29397
  };
28732
29398
  const switchOnContentEditableTrue = elm => {
28733
29399
  each$e(descendants(elm, `*[${ internalContentEditableAttr }="true"]`), elm => {
28734
- remove$b(elm, internalContentEditableAttr);
29400
+ remove$a(elm, internalContentEditableAttr);
28735
29401
  setContentEditable(elm, true);
28736
29402
  });
28737
29403
  };
@@ -28755,7 +29421,9 @@
28755
29421
  switchOffContentEditableTrue(body);
28756
29422
  } else {
28757
29423
  editor.readonly = false;
28758
- setContentEditable(body, true);
29424
+ if (editor.hasEditableRoot()) {
29425
+ setContentEditable(body, true);
29426
+ }
28759
29427
  switchOnContentEditableTrue(body);
28760
29428
  setEditorCommandState(editor, 'StyleWithCSS', false);
28761
29429
  setEditorCommandState(editor, 'enableInlineTableEditing', false);
@@ -28835,15 +29503,15 @@
28835
29503
 
28836
29504
  const 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', ' ');
28837
29505
  class EventDispatcher {
29506
+ static isNative(name) {
29507
+ return !!nativeEvents[name.toLowerCase()];
29508
+ }
28838
29509
  constructor(settings) {
28839
29510
  this.bindings = {};
28840
29511
  this.settings = settings || {};
28841
29512
  this.scope = this.settings.scope || this;
28842
29513
  this.toggleEvent = this.settings.toggleEvent || never;
28843
29514
  }
28844
- static isNative(name) {
28845
- return !!nativeEvents[name.toLowerCase()];
28846
- }
28847
29515
  fire(name, args) {
28848
29516
  return this.dispatch(name, args);
28849
29517
  }
@@ -29585,6 +30253,7 @@
29585
30253
  this.startContent = '';
29586
30254
  this._pendingNativeEvents = [];
29587
30255
  this._skinLoaded = false;
30256
+ this._editableRoot = true;
29588
30257
  this.editorManager = editorManager;
29589
30258
  this.documentBaseUrl = editorManager.documentBaseURL;
29590
30259
  extend(this, EditorObservable);
@@ -29912,6 +30581,12 @@
29912
30581
  addVisual(elm) {
29913
30582
  addVisual(this, elm);
29914
30583
  }
30584
+ setEditableRoot(state) {
30585
+ setEditableRoot(this, state);
30586
+ }
30587
+ hasEditableRoot() {
30588
+ return hasEditableRoot(this);
30589
+ }
29915
30590
  remove() {
29916
30591
  remove$1(this);
29917
30592
  }
@@ -29987,8 +30662,8 @@
29987
30662
  documentBaseURL: null,
29988
30663
  suffix: null,
29989
30664
  majorVersion: '6',
29990
- minorVersion: '4.2',
29991
- releaseDate: '2023-04-26',
30665
+ minorVersion: '5.0',
30666
+ releaseDate: '2023-06-12',
29992
30667
  i18n: I18n,
29993
30668
  activeEditor: null,
29994
30669
  focusedEditor: null,