tinymce-rails 6.6.2 → 6.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/app/assets/source/tinymce/tinymce.js +911 -691
  4. data/lib/tinymce/rails/version.rb +2 -2
  5. data/vendor/assets/javascripts/tinymce/models/dom/model.js +1 -1
  6. data/vendor/assets/javascripts/tinymce/plugins/accordion/plugin.js +1 -1
  7. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -1
  8. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +1 -1
  9. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +1 -1
  10. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +1 -1
  11. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
  12. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -1
  13. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  14. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
  15. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -1
  16. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +1 -1
  17. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -1
  18. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +2 -2
  19. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +1 -1
  20. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
  21. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +1 -1
  22. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +1 -1
  23. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +2 -2
  24. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -2
  25. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
  26. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +1 -1
  27. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
  28. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -2
  29. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
  30. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +1 -1
  31. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  32. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +1 -1
  33. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
  34. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -1
  35. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +1 -1
  36. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.css +1 -1
  37. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.css +1 -1
  38. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  39. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.min.css +1 -1
  40. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
  41. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
  42. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.css +1 -1
  43. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.css +1 -1
  44. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  45. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  46. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
  47. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  48. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.css +1 -1
  49. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.css +1 -1
  50. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
  51. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
  52. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.css +1 -1
  53. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  54. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.css +1 -1
  55. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.css +1 -1
  56. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
  57. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
  58. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.css +1 -1
  59. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  60. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +2 -2
  61. data/vendor/assets/javascripts/tinymce/tinymce.d.ts +4 -6
  62. data/vendor/assets/javascripts/tinymce/tinymce.js +2 -2
  63. metadata +3 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * TinyMCE version 6.6.2 (2023-08-09)
2
+ * TinyMCE version 6.7.0 (2023-08-30)
3
3
  */
4
4
 
5
5
  (function () {
@@ -960,26 +960,26 @@
960
960
 
961
961
  const userAgent = navigator.userAgent;
962
962
  const platform$3 = detect$2();
963
- const browser$2 = platform$3.browser;
963
+ const browser$3 = platform$3.browser;
964
964
  const os$1 = platform$3.os;
965
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$2.isIE() ? document.documentMode || 7 : 10,
969
+ documentMode: browser$3.isIE() ? document.documentMode || 7 : 10,
970
970
  cacheSuffix: null,
971
971
  container: null,
972
- canHaveCSP: !browser$2.isIE(),
972
+ canHaveCSP: !browser$3.isIE(),
973
973
  windowsPhone,
974
974
  browser: {
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
975
+ current: browser$3.current,
976
+ version: browser$3.version,
977
+ isChromium: browser$3.isChromium,
978
+ isEdge: browser$3.isEdge,
979
+ isFirefox: browser$3.isFirefox,
980
+ isIE: browser$3.isIE,
981
+ isOpera: browser$3.isOpera,
982
+ isSafari: browser$3.isSafari
983
983
  },
984
984
  os: {
985
985
  current: os$1.current,
@@ -1101,6 +1101,7 @@
1101
1101
  };
1102
1102
 
1103
1103
  const is$2 = (lhs, rhs, comparator = tripleEquals) => lhs.exists(left => comparator(left, rhs));
1104
+ const equals = (lhs, rhs, comparator = tripleEquals) => lift2(lhs, rhs, comparator).getOr(lhs.isNone() && rhs.isNone());
1104
1105
  const cat = arr => {
1105
1106
  const r = [];
1106
1107
  const push = x => {
@@ -1744,6 +1745,13 @@
1744
1745
  const y = doc.body.scrollTop || doc.documentElement.scrollTop;
1745
1746
  return SugarPosition(x, y);
1746
1747
  };
1748
+ const to = (x, y, _DOC) => {
1749
+ const doc = _DOC !== undefined ? _DOC.dom : document;
1750
+ const win = doc.defaultView;
1751
+ if (win) {
1752
+ win.scrollTo(x, y);
1753
+ }
1754
+ };
1747
1755
  const intoView = (element, alignToTop) => {
1748
1756
  const isSafari = detect$2().browser.isSafari();
1749
1757
  if (isSafari && isFunction(element.dom.scrollIntoViewIfNeeded)) {
@@ -2524,10 +2532,10 @@
2524
2532
  const isTransparentInline = (schema, node) => isTransparentElement(schema, node) && !hasBlockAttr(node);
2525
2533
  const isTransparentAstBlock = (schema, node) => node.type === 1 && isTransparentElementName(schema, node.name) && isString(node.attr(transparentBlockAttr));
2526
2534
 
2527
- const browser$1 = detect$2().browser;
2535
+ const browser$2 = detect$2().browser;
2528
2536
  const firstElement = nodes => find$2(nodes, isElement$7);
2529
2537
  const getTableCaptionDeltaY = elm => {
2530
- if (browser$1.isFirefox() && name(elm) === 'table') {
2538
+ if (browser$2.isFirefox() && name(elm) === 'table') {
2531
2539
  return firstElement(children$1(elm)).filter(elm => {
2532
2540
  return name(elm) === 'caption';
2533
2541
  }).bind(caption => {
@@ -2890,23 +2898,75 @@
2890
2898
  decode
2891
2899
  };
2892
2900
 
2893
- const lookupCache = {};
2894
- const mapCache = {};
2895
- const dummyObj = {};
2896
- const makeMap$2 = Tools.makeMap, each$b = Tools.each, extend$2 = Tools.extend, explode$2 = Tools.explode, inArray = Tools.inArray;
2897
2901
  const split$1 = (items, delim) => {
2898
2902
  items = Tools.trim(items);
2899
2903
  return items ? items.split(delim || ' ') : [];
2900
2904
  };
2901
- const createMap = (defaultValue, extendWith = {}) => {
2902
- const value = makeMap$2(defaultValue, ' ', makeMap$2(defaultValue.toUpperCase(), ' '));
2903
- return extend$2(value, extendWith);
2905
+ const patternToRegExp = str => new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');
2906
+
2907
+ const parseCustomElementsRules = value => {
2908
+ const customElementRegExp = /^(~)?(.+)$/;
2909
+ return bind$3(split$1(value, ','), rule => {
2910
+ const matches = customElementRegExp.exec(rule);
2911
+ if (matches) {
2912
+ const inline = matches[1] === '~';
2913
+ const cloneName = inline ? 'span' : 'div';
2914
+ const name = matches[2];
2915
+ return [{
2916
+ inline,
2917
+ cloneName,
2918
+ name
2919
+ }];
2920
+ } else {
2921
+ return [];
2922
+ }
2923
+ });
2904
2924
  };
2905
- const getTextRootBlockElements = schema => createMap('td th li dt dd figcaption caption details summary', schema.getTextBlockElements());
2906
- const compileSchema = type => {
2907
- const schema = {};
2925
+
2926
+ const getElementSetsAsStrings = type => {
2908
2927
  let globalAttributes, blockContent;
2909
2928
  let phrasingContent, flowContent;
2929
+ globalAttributes = 'id accesskey class dir lang style tabindex title role';
2930
+ blockContent = 'address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul';
2931
+ phrasingContent = 'a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd ' + 'label map noscript object q s samp script select small span strong sub sup ' + 'textarea u var #text #comment';
2932
+ if (type !== 'html4') {
2933
+ const transparentContent = 'a ins del canvas map';
2934
+ globalAttributes += ' contenteditable contextmenu draggable dropzone ' + 'hidden spellcheck translate';
2935
+ blockContent += ' article aside details dialog figure main header footer hgroup section nav ' + transparentContent;
2936
+ phrasingContent += ' audio canvas command datalist mark meter output picture ' + 'progress time wbr video ruby bdi keygen';
2937
+ }
2938
+ if (type !== 'html5-strict') {
2939
+ globalAttributes += ' xml:lang';
2940
+ const html4PhrasingContent = 'acronym applet basefont big font strike tt';
2941
+ phrasingContent = [
2942
+ phrasingContent,
2943
+ html4PhrasingContent
2944
+ ].join(' ');
2945
+ const html4BlockContent = 'center dir isindex noframes';
2946
+ blockContent = [
2947
+ blockContent,
2948
+ html4BlockContent
2949
+ ].join(' ');
2950
+ flowContent = [
2951
+ blockContent,
2952
+ phrasingContent
2953
+ ].join(' ');
2954
+ }
2955
+ flowContent = flowContent || [
2956
+ blockContent,
2957
+ phrasingContent
2958
+ ].join(' ');
2959
+ return {
2960
+ globalAttributes,
2961
+ blockContent,
2962
+ phrasingContent,
2963
+ flowContent
2964
+ };
2965
+ };
2966
+
2967
+ const makeSchema = type => {
2968
+ const {globalAttributes, phrasingContent, flowContent} = getElementSetsAsStrings(type);
2969
+ const schema = {};
2910
2970
  const add = (name, attributes = '', children = '') => {
2911
2971
  const childNames = split$1(children);
2912
2972
  const names = split$1(name);
@@ -2917,9 +2977,9 @@
2917
2977
  attributes
2918
2978
  ].join(' '));
2919
2979
  schema[names[ni]] = {
2920
- attributes: mapToObject(attributesOrder, () => ({})),
2980
+ attributes: mapToObject(attributesOrder, constant({})),
2921
2981
  attributesOrder,
2922
- children: mapToObject(childNames, constant(dummyObj))
2982
+ children: mapToObject(childNames, constant({}))
2923
2983
  };
2924
2984
  }
2925
2985
  };
@@ -2935,45 +2995,16 @@
2935
2995
  }
2936
2996
  }
2937
2997
  };
2938
- if (lookupCache[type]) {
2939
- return lookupCache[type];
2940
- }
2941
- globalAttributes = 'id accesskey class dir lang style tabindex title role';
2942
- blockContent = 'address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul';
2943
- phrasingContent = 'a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd ' + 'label map noscript object q s samp script select small span strong sub sup ' + 'textarea u var #text #comment';
2944
- if (type !== 'html4') {
2945
- const transparentContent = 'a ins del canvas map';
2946
- globalAttributes += ' contenteditable contextmenu draggable dropzone ' + 'hidden spellcheck translate';
2947
- blockContent += ' article aside details dialog figure main header footer hgroup section nav ' + transparentContent;
2948
- phrasingContent += ' audio canvas command datalist mark meter output picture ' + 'progress time wbr video ruby bdi keygen';
2949
- }
2950
2998
  if (type !== 'html5-strict') {
2951
- globalAttributes += ' xml:lang';
2952
2999
  const html4PhrasingContent = 'acronym applet basefont big font strike tt';
2953
- phrasingContent = [
2954
- phrasingContent,
2955
- html4PhrasingContent
2956
- ].join(' ');
2957
- each$b(split$1(html4PhrasingContent), name => {
3000
+ each$e(split$1(html4PhrasingContent), name => {
2958
3001
  add(name, '', phrasingContent);
2959
3002
  });
2960
3003
  const html4BlockContent = 'center dir isindex noframes';
2961
- blockContent = [
2962
- blockContent,
2963
- html4BlockContent
2964
- ].join(' ');
2965
- flowContent = [
2966
- blockContent,
2967
- phrasingContent
2968
- ].join(' ');
2969
- each$b(split$1(html4BlockContent), name => {
3004
+ each$e(split$1(html4BlockContent), name => {
2970
3005
  add(name, '', flowContent);
2971
3006
  });
2972
3007
  }
2973
- flowContent = flowContent || [
2974
- blockContent,
2975
- phrasingContent
2976
- ].join(' ');
2977
3008
  add('html', 'manifest', 'head body');
2978
3009
  add('head', '', 'base command link meta noscript script style title');
2979
3010
  add('title hr noscript br');
@@ -3125,16 +3156,155 @@
3125
3156
  delete item.children.video;
3126
3157
  });
3127
3158
  }
3128
- each$b(split$1('a form meter progress dfn'), name => {
3159
+ each$e(split$1('a form meter progress dfn'), name => {
3129
3160
  if (schema[name]) {
3130
3161
  delete schema[name].children[name];
3131
3162
  }
3132
3163
  });
3133
3164
  delete schema.caption.children.table;
3134
3165
  delete schema.script;
3135
- lookupCache[type] = schema;
3136
3166
  return schema;
3137
3167
  };
3168
+
3169
+ const prefixToOperation = prefix => prefix === '-' ? 'remove' : 'add';
3170
+ const parseValidChildrenRules = value => {
3171
+ const childRuleRegExp = /^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;
3172
+ return bind$3(split$1(value, ','), rule => {
3173
+ const matches = childRuleRegExp.exec(rule);
3174
+ if (matches) {
3175
+ const prefix = matches[1];
3176
+ const operation = prefix ? prefixToOperation(prefix) : 'replace';
3177
+ const name = matches[2];
3178
+ const validChildren = split$1(matches[3], '|');
3179
+ return [{
3180
+ operation,
3181
+ name,
3182
+ validChildren
3183
+ }];
3184
+ } else {
3185
+ return [];
3186
+ }
3187
+ });
3188
+ };
3189
+
3190
+ const parseValidElementsAttrDataIntoElement = (attrData, targetElement) => {
3191
+ const attrRuleRegExp = /^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/;
3192
+ const hasPatternsRegExp = /[*?+]/;
3193
+ const {attributes, attributesOrder} = targetElement;
3194
+ return each$e(split$1(attrData, '|'), rule => {
3195
+ const matches = attrRuleRegExp.exec(rule);
3196
+ if (matches) {
3197
+ const attr = {};
3198
+ const attrType = matches[1];
3199
+ const attrName = matches[2].replace(/[\\:]:/g, ':');
3200
+ const attrPrefix = matches[3];
3201
+ const value = matches[4];
3202
+ if (attrType === '!') {
3203
+ targetElement.attributesRequired = targetElement.attributesRequired || [];
3204
+ targetElement.attributesRequired.push(attrName);
3205
+ attr.required = true;
3206
+ }
3207
+ if (attrType === '-') {
3208
+ delete attributes[attrName];
3209
+ attributesOrder.splice(Tools.inArray(attributesOrder, attrName), 1);
3210
+ return;
3211
+ }
3212
+ if (attrPrefix) {
3213
+ if (attrPrefix === '=') {
3214
+ targetElement.attributesDefault = targetElement.attributesDefault || [];
3215
+ targetElement.attributesDefault.push({
3216
+ name: attrName,
3217
+ value
3218
+ });
3219
+ attr.defaultValue = value;
3220
+ } else if (attrPrefix === '~') {
3221
+ targetElement.attributesForced = targetElement.attributesForced || [];
3222
+ targetElement.attributesForced.push({
3223
+ name: attrName,
3224
+ value
3225
+ });
3226
+ attr.forcedValue = value;
3227
+ } else if (attrPrefix === '<') {
3228
+ attr.validValues = Tools.makeMap(value, '?');
3229
+ }
3230
+ }
3231
+ if (hasPatternsRegExp.test(attrName)) {
3232
+ const attrPattern = attr;
3233
+ targetElement.attributePatterns = targetElement.attributePatterns || [];
3234
+ attrPattern.pattern = patternToRegExp(attrName);
3235
+ targetElement.attributePatterns.push(attrPattern);
3236
+ } else {
3237
+ if (!attributes[attrName]) {
3238
+ attributesOrder.push(attrName);
3239
+ }
3240
+ attributes[attrName] = attr;
3241
+ }
3242
+ }
3243
+ });
3244
+ };
3245
+ const cloneAttributesInto = (from, to) => {
3246
+ each$d(from.attributes, (value, key) => {
3247
+ to.attributes[key] = value;
3248
+ });
3249
+ to.attributesOrder.push(...from.attributesOrder);
3250
+ };
3251
+ const parseValidElementsRules = (globalElement, validElements) => {
3252
+ const elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;
3253
+ return bind$3(split$1(validElements, ','), rule => {
3254
+ const matches = elementRuleRegExp.exec(rule);
3255
+ if (matches) {
3256
+ const prefix = matches[1];
3257
+ const elementName = matches[2];
3258
+ const outputName = matches[3];
3259
+ const attrsPrefix = matches[4];
3260
+ const attrData = matches[5];
3261
+ const element = {
3262
+ attributes: {},
3263
+ attributesOrder: []
3264
+ };
3265
+ globalElement.each(el => cloneAttributesInto(el, element));
3266
+ if (prefix === '#') {
3267
+ element.paddEmpty = true;
3268
+ } else if (prefix === '-') {
3269
+ element.removeEmpty = true;
3270
+ }
3271
+ if (attrsPrefix === '!') {
3272
+ element.removeEmptyAttrs = true;
3273
+ }
3274
+ if (attrData) {
3275
+ parseValidElementsAttrDataIntoElement(attrData, element);
3276
+ }
3277
+ if (outputName) {
3278
+ element.outputName = elementName;
3279
+ }
3280
+ if (elementName === '@') {
3281
+ if (globalElement.isNone()) {
3282
+ globalElement = Optional.some(element);
3283
+ } else {
3284
+ return [];
3285
+ }
3286
+ }
3287
+ return [outputName ? {
3288
+ name: elementName,
3289
+ element,
3290
+ aliasName: outputName
3291
+ } : {
3292
+ name: elementName,
3293
+ element
3294
+ }];
3295
+ } else {
3296
+ return [];
3297
+ }
3298
+ });
3299
+ };
3300
+
3301
+ const mapCache = {};
3302
+ const makeMap$2 = Tools.makeMap, each$b = Tools.each, extend$2 = Tools.extend, explode$2 = Tools.explode;
3303
+ const createMap = (defaultValue, extendWith = {}) => {
3304
+ const value = makeMap$2(defaultValue, ' ', makeMap$2(defaultValue.toUpperCase(), ' '));
3305
+ return extend$2(value, extendWith);
3306
+ };
3307
+ const getTextRootBlockElements = schema => createMap('td th li dt dd figcaption caption details summary', schema.getTextBlockElements());
3138
3308
  const compileElementMap = (value, mode) => {
3139
3309
  if (value) {
3140
3310
  const styles = {};
@@ -3170,7 +3340,7 @@
3170
3340
  }
3171
3341
  };
3172
3342
  const schemaType = (_a = settings.schema) !== null && _a !== void 0 ? _a : 'html5';
3173
- const schemaItems = compileSchema(schemaType);
3343
+ const schemaItems = makeSchema(schemaType);
3174
3344
  if (settings.verify_html === false) {
3175
3345
  settings.valid_elements = '*[*]';
3176
3346
  }
@@ -3191,122 +3361,21 @@
3191
3361
  each$b('script noscript iframe noframes noembed title style textarea xmp plaintext'.split(' '), name => {
3192
3362
  specialElements[name] = new RegExp('</' + name + '[^>]*>', 'gi');
3193
3363
  });
3194
- const patternToRegExp = str => new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');
3195
3364
  const addValidElements = validElements => {
3196
- const elementRuleRegExp = /^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;
3197
- const attrRuleRegExp = /^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/;
3365
+ const globalElement = Optional.from(elements['@']);
3198
3366
  const hasPatternsRegExp = /[*?+]/;
3199
- if (validElements) {
3200
- const validElementsArr = split$1(validElements, ',');
3201
- let globalAttributes;
3202
- let globalAttributesOrder;
3203
- if (elements['@']) {
3204
- globalAttributes = elements['@'].attributes;
3205
- globalAttributesOrder = elements['@'].attributesOrder;
3206
- }
3207
- for (let ei = 0, el = validElementsArr.length; ei < el; ei++) {
3208
- let matches = elementRuleRegExp.exec(validElementsArr[ei]);
3209
- if (matches) {
3210
- const prefix = matches[1];
3211
- const elementName = matches[2];
3212
- const outputName = matches[3];
3213
- const attrData = matches[5];
3214
- const attributes = {};
3215
- const attributesOrder = [];
3216
- const element = {
3217
- attributes,
3218
- attributesOrder
3219
- };
3220
- if (prefix === '#') {
3221
- element.paddEmpty = true;
3222
- }
3223
- if (prefix === '-') {
3224
- element.removeEmpty = true;
3225
- }
3226
- if (matches[4] === '!') {
3227
- element.removeEmptyAttrs = true;
3228
- }
3229
- if (globalAttributes) {
3230
- each$d(globalAttributes, (value, key) => {
3231
- attributes[key] = value;
3232
- });
3233
- if (globalAttributesOrder) {
3234
- attributesOrder.push(...globalAttributesOrder);
3235
- }
3236
- }
3237
- if (attrData) {
3238
- const attrDatas = split$1(attrData, '|');
3239
- for (let ai = 0, al = attrDatas.length; ai < al; ai++) {
3240
- matches = attrRuleRegExp.exec(attrDatas[ai]);
3241
- if (matches) {
3242
- const attr = {};
3243
- const attrType = matches[1];
3244
- const attrName = matches[2].replace(/[\\:]:/g, ':');
3245
- const attrPrefix = matches[3];
3246
- const value = matches[4];
3247
- if (attrType === '!') {
3248
- element.attributesRequired = element.attributesRequired || [];
3249
- element.attributesRequired.push(attrName);
3250
- attr.required = true;
3251
- }
3252
- if (attrType === '-') {
3253
- delete attributes[attrName];
3254
- attributesOrder.splice(inArray(attributesOrder, attrName), 1);
3255
- continue;
3256
- }
3257
- if (attrPrefix) {
3258
- if (attrPrefix === '=') {
3259
- element.attributesDefault = element.attributesDefault || [];
3260
- element.attributesDefault.push({
3261
- name: attrName,
3262
- value
3263
- });
3264
- attr.defaultValue = value;
3265
- }
3266
- if (attrPrefix === '~') {
3267
- element.attributesForced = element.attributesForced || [];
3268
- element.attributesForced.push({
3269
- name: attrName,
3270
- value
3271
- });
3272
- attr.forcedValue = value;
3273
- }
3274
- if (attrPrefix === '<') {
3275
- attr.validValues = makeMap$2(value, '?');
3276
- }
3277
- }
3278
- if (hasPatternsRegExp.test(attrName)) {
3279
- const attrPattern = attr;
3280
- element.attributePatterns = element.attributePatterns || [];
3281
- attrPattern.pattern = patternToRegExp(attrName);
3282
- element.attributePatterns.push(attrPattern);
3283
- } else {
3284
- if (!attributes[attrName]) {
3285
- attributesOrder.push(attrName);
3286
- }
3287
- attributes[attrName] = attr;
3288
- }
3289
- }
3290
- }
3291
- }
3292
- if (!globalAttributes && elementName === '@') {
3293
- globalAttributes = attributes;
3294
- globalAttributesOrder = attributesOrder;
3295
- }
3296
- if (outputName) {
3297
- element.outputName = elementName;
3298
- elements[outputName] = element;
3299
- }
3300
- if (hasPatternsRegExp.test(elementName)) {
3301
- const patternElement = element;
3302
- patternElement.pattern = patternToRegExp(elementName);
3303
- patternElements.push(patternElement);
3304
- } else {
3305
- elements[elementName] = element;
3306
- }
3307
- }
3367
+ each$e(parseValidElementsRules(globalElement, validElements !== null && validElements !== void 0 ? validElements : ''), ({name, element, aliasName}) => {
3368
+ if (aliasName) {
3369
+ elements[aliasName] = element;
3370
+ }
3371
+ if (hasPatternsRegExp.test(name)) {
3372
+ const patternElement = element;
3373
+ patternElement.pattern = patternToRegExp(name);
3374
+ patternElements.push(patternElement);
3375
+ } else {
3376
+ elements[name] = element;
3308
3377
  }
3309
- }
3378
+ });
3310
3379
  };
3311
3380
  const setValidElements = validElements => {
3312
3381
  patternElements = [];
@@ -3314,71 +3383,46 @@
3314
3383
  delete elements[name];
3315
3384
  });
3316
3385
  addValidElements(validElements);
3317
- each$b(schemaItems, (element, name) => {
3318
- children[name] = element.children;
3319
- });
3320
3386
  };
3321
3387
  const addCustomElements = customElements => {
3322
- const customElementRegExp = /^(~)?(.+)$/;
3323
- if (customElements) {
3324
- delete mapCache.text_block_elements;
3325
- delete mapCache.block_elements;
3326
- each$b(split$1(customElements, ','), rule => {
3327
- const matches = customElementRegExp.exec(rule);
3328
- if (matches) {
3329
- const inline = matches[1] === '~';
3330
- const cloneName = inline ? 'span' : 'div';
3331
- const name = matches[2];
3332
- children[name] = children[cloneName];
3333
- customElementsMap[name] = cloneName;
3334
- nonEmptyElementsMap[name.toUpperCase()] = {};
3335
- nonEmptyElementsMap[name] = {};
3336
- if (!inline) {
3337
- blockElementsMap[name.toUpperCase()] = {};
3338
- blockElementsMap[name] = {};
3339
- }
3340
- if (!elements[name]) {
3341
- let customRule = elements[cloneName];
3342
- customRule = extend$2({}, customRule);
3343
- delete customRule.removeEmptyAttrs;
3344
- delete customRule.removeEmpty;
3345
- elements[name] = customRule;
3346
- }
3347
- each$b(children, (element, elmName) => {
3348
- if (element[cloneName]) {
3349
- children[elmName] = element = extend$2({}, children[elmName]);
3350
- element[name] = element[cloneName];
3351
- }
3352
- });
3388
+ delete mapCache.text_block_elements;
3389
+ delete mapCache.block_elements;
3390
+ each$e(parseCustomElementsRules(customElements !== null && customElements !== void 0 ? customElements : ''), ({inline, name, cloneName}) => {
3391
+ children[name] = children[cloneName];
3392
+ customElementsMap[name] = cloneName;
3393
+ nonEmptyElementsMap[name.toUpperCase()] = {};
3394
+ nonEmptyElementsMap[name] = {};
3395
+ if (!inline) {
3396
+ blockElementsMap[name.toUpperCase()] = {};
3397
+ blockElementsMap[name] = {};
3398
+ }
3399
+ if (!elements[name]) {
3400
+ let customRule = elements[cloneName];
3401
+ customRule = extend$2({}, customRule);
3402
+ delete customRule.removeEmptyAttrs;
3403
+ delete customRule.removeEmpty;
3404
+ elements[name] = customRule;
3405
+ }
3406
+ each$d(children, (element, elmName) => {
3407
+ if (element[cloneName]) {
3408
+ children[elmName] = element = extend$2({}, children[elmName]);
3409
+ element[name] = element[cloneName];
3353
3410
  }
3354
3411
  });
3355
- }
3412
+ });
3356
3413
  };
3357
3414
  const addValidChildren = validChildren => {
3358
- const childRuleRegExp = /^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;
3359
- delete lookupCache[schemaType];
3360
- if (validChildren) {
3361
- each$b(split$1(validChildren, ','), rule => {
3362
- const matches = childRuleRegExp.exec(rule);
3363
- if (matches) {
3364
- const prefix = matches[1];
3365
- let parent;
3366
- if (prefix) {
3367
- parent = children[matches[2]];
3368
- } else {
3369
- parent = children[matches[2]] = { '#comment': {} };
3370
- }
3371
- parent = children[matches[2]];
3372
- each$b(split$1(matches[3], '|'), child => {
3373
- if (prefix === '-') {
3374
- delete parent[child];
3375
- } else {
3376
- parent[child] = {};
3377
- }
3378
- });
3415
+ each$e(parseValidChildrenRules(validChildren !== null && validChildren !== void 0 ? validChildren : ''), ({operation, name, validChildren}) => {
3416
+ const parent = operation === 'replace' ? { '#comment': {} } : children[name];
3417
+ each$e(validChildren, child => {
3418
+ if (operation === 'remove') {
3419
+ delete parent[child];
3420
+ } else {
3421
+ parent[child] = {};
3379
3422
  }
3380
3423
  });
3381
- }
3424
+ children[name] = parent;
3425
+ });
3382
3426
  };
3383
3427
  const getElementRule = name => {
3384
3428
  const element = elements[name];
@@ -3429,6 +3473,9 @@
3429
3473
  });
3430
3474
  } else {
3431
3475
  setValidElements(settings.valid_elements);
3476
+ each$b(schemaItems, (element, name) => {
3477
+ children[name] = element.children;
3478
+ });
3432
3479
  }
3433
3480
  addCustomElements(settings.custom_elements);
3434
3481
  addValidChildren(settings.valid_children);
@@ -3598,7 +3645,7 @@
3598
3645
  if (!value) {
3599
3646
  return;
3600
3647
  }
3601
- const values = value.split(' ');
3648
+ const values = value.indexOf(',') > -1 ? [value] : value.split(' ');
3602
3649
  let i = values.length;
3603
3650
  while (i--) {
3604
3651
  if (values[i] !== values[0]) {
@@ -5023,6 +5070,10 @@
5023
5070
  };
5024
5071
  };
5025
5072
 
5073
+ const isDuplicated = (items, item) => {
5074
+ const firstIndex = items.indexOf(item);
5075
+ return firstIndex !== -1 && items.indexOf(item, firstIndex + 1) > firstIndex;
5076
+ };
5026
5077
  const isRaw = str => isObject(str) && has$2(str, 'raw');
5027
5078
  const isTokenised = str => isArray$1(str) && str.length > 1;
5028
5079
  const data = {};
@@ -5040,8 +5091,17 @@
5040
5091
  if (!langData) {
5041
5092
  data[code] = langData = {};
5042
5093
  }
5094
+ const lcNames = map$3(keys(items), name => name.toLowerCase());
5043
5095
  each$d(items, (translation, name) => {
5044
- langData[name.toLowerCase()] = translation;
5096
+ const lcName = name.toLowerCase();
5097
+ if (lcName !== name && isDuplicated(lcNames, lcName)) {
5098
+ if (!has$2(items, lcName)) {
5099
+ langData[lcName] = translation;
5100
+ }
5101
+ langData[name] = translation;
5102
+ } else {
5103
+ langData[lcName] = translation;
5104
+ }
5045
5105
  });
5046
5106
  };
5047
5107
  const translate = text => {
@@ -5054,8 +5114,8 @@
5054
5114
  };
5055
5115
  const isEmpty = text => text === '' || text === null || text === undefined;
5056
5116
  const getLangData = text => {
5057
- const textstr = toString(text);
5058
- return get$a(langData, textstr.toLowerCase()).map(toString).getOr(textstr);
5117
+ const textStr = toString(text);
5118
+ return has$2(langData, textStr) ? toString(langData[textStr]) : get$a(langData, textStr.toLowerCase()).map(toString).getOr(textStr);
5059
5119
  };
5060
5120
  const removeContext = str => str.replace(/{context:\w+}$/, '');
5061
5121
  if (isEmpty(text)) {
@@ -10278,7 +10338,7 @@
10278
10338
  return;
10279
10339
  }
10280
10340
  const scrollTop = get$5(doc).top;
10281
- f(doc, scrollTop, marker, alignToTop);
10341
+ f(editor, doc, scrollTop, marker, alignToTop);
10282
10342
  fireAfterScrollIntoViewEvent(editor, data);
10283
10343
  };
10284
10344
  const applyWithMarker = (editor, f, rng, alignToTop) => {
@@ -10304,28 +10364,36 @@
10304
10364
  newRng.setEnd(endElement, endOffset);
10305
10365
  editor.selection.setRng(rng);
10306
10366
  };
10307
- const scrollToMarker = (marker, alignToTop) => marker.element.dom.scrollIntoView({ block: alignToTop ? 'start' : 'end' });
10308
- const intoWindowIfNeeded = (scrollTop, viewHeight, marker, alignToTop) => {
10367
+ const scrollToMarker = (editor, marker, viewHeight, alignToTop, doc) => {
10368
+ const pos = marker.pos;
10369
+ if (alignToTop) {
10370
+ to(pos.left, pos.top, doc);
10371
+ } else {
10372
+ const y = pos.top - viewHeight + marker.height;
10373
+ to(-editor.getBody().getBoundingClientRect().left, y, doc);
10374
+ }
10375
+ };
10376
+ const intoWindowIfNeeded = (editor, doc, scrollTop, viewHeight, marker, alignToTop) => {
10309
10377
  const viewportBottom = viewHeight + scrollTop;
10310
10378
  const markerTop = marker.pos.top;
10311
10379
  const markerBottom = marker.bottom;
10312
10380
  const largerThanViewport = markerBottom - markerTop >= viewHeight;
10313
10381
  if (markerTop < scrollTop) {
10314
- scrollToMarker(marker, alignToTop !== false);
10382
+ scrollToMarker(editor, marker, viewHeight, alignToTop !== false, doc);
10315
10383
  } else if (markerTop > viewportBottom) {
10316
10384
  const align = largerThanViewport ? alignToTop !== false : alignToTop === true;
10317
- scrollToMarker(marker, align);
10385
+ scrollToMarker(editor, marker, viewHeight, align, doc);
10318
10386
  } else if (markerBottom > viewportBottom && !largerThanViewport) {
10319
- scrollToMarker(marker, alignToTop === true);
10387
+ scrollToMarker(editor, marker, viewHeight, alignToTop === true, doc);
10320
10388
  }
10321
10389
  };
10322
- const intoWindow = (doc, scrollTop, marker, alignToTop) => {
10390
+ const intoWindow = (editor, doc, scrollTop, marker, alignToTop) => {
10323
10391
  const viewHeight = defaultView(doc).dom.innerHeight;
10324
- intoWindowIfNeeded(scrollTop, viewHeight, marker, alignToTop);
10392
+ intoWindowIfNeeded(editor, doc, scrollTop, viewHeight, marker, alignToTop);
10325
10393
  };
10326
- const intoFrame = (doc, scrollTop, marker, alignToTop) => {
10394
+ const intoFrame = (editor, doc, scrollTop, marker, alignToTop) => {
10327
10395
  const frameViewHeight = defaultView(doc).dom.innerHeight;
10328
- intoWindowIfNeeded(scrollTop, frameViewHeight, marker, alignToTop);
10396
+ intoWindowIfNeeded(editor, doc, scrollTop, frameViewHeight, marker, alignToTop);
10329
10397
  const op = find(marker.element);
10330
10398
  const viewportBounds = getBounds(window);
10331
10399
  if (op.top < viewportBounds.y) {
@@ -12183,7 +12251,7 @@
12183
12251
  const rootElm = SugarElement.fromDom(editor.getBody());
12184
12252
  return getParentCaption(rootElm, startElm).fold(() => deleteCaretCells(editor, forward, rootElm, startElm).orThunk(() => someIf(isBeforeOrAfterTable(editor, forward), noop)), fromCaption => deleteCaretCaption(editor, forward, rootElm, fromCaption));
12185
12253
  };
12186
- const backspaceDelete$9 = (editor, forward) => {
12254
+ const backspaceDelete$a = (editor, forward) => {
12187
12255
  const startElm = SugarElement.fromDom(editor.selection.getStart(true));
12188
12256
  const cells = getCellsFromEditor(editor);
12189
12257
  return editor.selection.isCollapsed() && cells.length === 0 ? deleteCaret$3(editor, forward, startElm) : deleteRange$3(editor, startElm, cells);
@@ -12396,7 +12464,7 @@
12396
12464
  const textBlockElements = schema.getTextBlockElements();
12397
12465
  const nonEmptyElements = schema.getNonEmptyElements();
12398
12466
  const whitespaceElements = schema.getWhitespaceElements();
12399
- const nonSplittableElements = Tools.makeMap('tr,td,th,tbody,thead,tfoot,table');
12467
+ const nonSplittableElements = Tools.makeMap('tr,td,th,tbody,thead,tfoot,table,summary');
12400
12468
  const fixed = new Set();
12401
12469
  const isSplittableElement = node => node !== rootNode && !nonSplittableElements[node.name];
12402
12470
  for (let ni = 0; ni < nodes.length; ni++) {
@@ -12635,7 +12703,7 @@
12635
12703
  }
12636
12704
  return findLastOf(elms[elms.length - 1], rootNode);
12637
12705
  };
12638
- const insertBefore$1 = (target, elms, rootNode) => {
12706
+ const insertBefore$2 = (target, elms, rootNode) => {
12639
12707
  const parentElm = target.parentNode;
12640
12708
  if (parentElm) {
12641
12709
  Tools.each(elms, elm => {
@@ -12644,7 +12712,7 @@
12644
12712
  }
12645
12713
  return findFirstIn(target, rootNode);
12646
12714
  };
12647
- const insertAfter$1 = (target, elms, rootNode, dom) => {
12715
+ const insertAfter$2 = (target, elms, rootNode, dom) => {
12648
12716
  dom.insertAfter(elms.reverse(), target);
12649
12717
  return findLastOf(elms[0], rootNode);
12650
12718
  };
@@ -12664,9 +12732,9 @@
12664
12732
  if (!liTarget) {
12665
12733
  return null;
12666
12734
  } else if (isAt(BEGINNING)) {
12667
- return insertBefore$1(liTarget, liElms, rootNode);
12735
+ return insertBefore$2(liTarget, liElms, rootNode);
12668
12736
  } else if (isAt(END)) {
12669
- return insertAfter$1(liTarget, liElms, rootNode, dom);
12737
+ return insertAfter$2(liTarget, liElms, rootNode, dom);
12670
12738
  } else {
12671
12739
  return insertMiddle(liTarget, liElms, rootNode, rng);
12672
12740
  }
@@ -12794,14 +12862,15 @@
12794
12862
  const parentBlock = dom.getParent(marker, dom.isBlock);
12795
12863
  dom.remove(marker);
12796
12864
  if (parentBlock && dom.isEmpty(parentBlock)) {
12865
+ const isCell = isTableCell(parentBlock);
12797
12866
  empty(SugarElement.fromDom(parentBlock));
12798
12867
  rng.setStart(parentBlock, 0);
12799
12868
  rng.setEnd(parentBlock, 0);
12800
- if (!isTableCell(parentBlock) && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) {
12869
+ if (!isCell && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) {
12801
12870
  rng = nextRng;
12802
12871
  dom.remove(parentBlock);
12803
12872
  } else {
12804
- dom.add(parentBlock, dom.create('br', { 'data-mce-bogus': '1' }));
12873
+ dom.add(parentBlock, dom.create('br', isCell ? {} : { 'data-mce-bogus': '1' }));
12805
12874
  }
12806
12875
  }
12807
12876
  selection.setRng(rng);
@@ -12827,18 +12896,6 @@
12827
12896
  }
12828
12897
  return Optional.none();
12829
12898
  };
12830
- const preventSplittingSummary = editor => {
12831
- each$e(from(editor.getBody().querySelectorAll('details')), accordion => {
12832
- const summaries = filter$5(from(accordion.children), node => node.nodeName === 'SUMMARY');
12833
- if (summaries.length > 1) {
12834
- each$e(summaries.slice(1), summary => {
12835
- const element = SugarElement.fromDom(summary);
12836
- remove$7(element, 'mce-accordion-summary');
12837
- mutate(element, 'p');
12838
- });
12839
- }
12840
- });
12841
- };
12842
12899
  const insertHtmlAtCaret = (editor, value, details) => {
12843
12900
  var _a, _b;
12844
12901
  const selection = editor.selection;
@@ -12935,7 +12992,6 @@
12935
12992
  moveSelectionToMarker(editor, dom.get('mce_marker'));
12936
12993
  unmarkFragmentElements(editor.getBody());
12937
12994
  trimBrsFromTableCell(dom, selection.getStart());
12938
- preventSplittingSummary(editor);
12939
12995
  updateCaret(editor.schema, editor.getBody(), selection.getStart());
12940
12996
  return value;
12941
12997
  };
@@ -20958,7 +21014,7 @@
20958
21014
  };
20959
21015
  const mergeBlocks = (rootNode, forward, block1, block2) => forward ? mergeBlockInto(rootNode, block2, block1) : mergeBlockInto(rootNode, block1, block2);
20960
21016
 
20961
- const backspaceDelete$8 = (editor, forward) => {
21017
+ const backspaceDelete$9 = (editor, forward) => {
20962
21018
  const rootNode = SugarElement.fromDom(editor.getBody());
20963
21019
  const position = read$1(rootNode.dom, forward, editor.selection.getRng()).map(blockBoundary => () => {
20964
21020
  mergeBlocks(rootNode, forward, blockBoundary.from.block, blockBoundary.to.block).each(pos => {
@@ -21005,7 +21061,7 @@
21005
21061
  const rng = editor.selection.getRng();
21006
21062
  return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection);
21007
21063
  };
21008
- const backspaceDelete$7 = (editor, _forward) => editor.selection.isCollapsed() ? Optional.none() : deleteRange$2(editor);
21064
+ const backspaceDelete$8 = (editor, _forward) => editor.selection.isCollapsed() ? Optional.none() : deleteRange$2(editor);
21009
21065
 
21010
21066
  const showCaret = (direction, editor, node, before, scrollIntoView) => Optional.from(editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView));
21011
21067
  const getNodeRange = node => {
@@ -21088,7 +21144,7 @@
21088
21144
  }
21089
21145
  return Optional.none();
21090
21146
  };
21091
- const backspaceDelete$6 = (editor, forward) => deleteBoundaryText(editor, forward);
21147
+ const backspaceDelete$7 = (editor, forward) => deleteBoundaryText(editor, forward);
21092
21148
 
21093
21149
  const getEdgeCefPosition = (editor, atStart) => {
21094
21150
  const root = editor.getBody();
@@ -21227,7 +21283,7 @@
21227
21283
  }
21228
21284
  return true;
21229
21285
  };
21230
- const backspaceDelete$5 = (editor, forward) => {
21286
+ const backspaceDelete$6 = (editor, forward) => {
21231
21287
  if (editor.selection.isCollapsed()) {
21232
21288
  return backspaceDeleteCaret(editor, forward);
21233
21289
  } else {
@@ -21239,7 +21295,7 @@
21239
21295
  const fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());
21240
21296
  return fromPosition(forward, editor.getBody(), fromPos).filter(pos => forward ? isBeforeImageBlock(pos) : isAfterImageBlock(pos)).bind(pos => getChildNodeAtRelativeOffset(forward ? 0 : -1, pos)).map(elm => () => editor.selection.select(elm));
21241
21297
  };
21242
- const backspaceDelete$4 = (editor, forward) => editor.selection.isCollapsed() ? deleteCaret$2(editor, forward) : Optional.none();
21298
+ const backspaceDelete$5 = (editor, forward) => editor.selection.isCollapsed() ? deleteCaret$2(editor, forward) : Optional.none();
21243
21299
 
21244
21300
  const isText$2 = isText$a;
21245
21301
  const startsWithCaretContainer = node => isText$2(node) && node.data[0] === ZWSP$1;
@@ -21249,7 +21305,7 @@
21249
21305
  const doc = (_a = node.ownerDocument) !== null && _a !== void 0 ? _a : document;
21250
21306
  return doc.createTextNode(ZWSP$1);
21251
21307
  };
21252
- const insertBefore = node => {
21308
+ const insertBefore$1 = node => {
21253
21309
  var _a;
21254
21310
  if (isText$2(node.previousSibling)) {
21255
21311
  if (endsWithCaretContainer(node.previousSibling)) {
@@ -21271,7 +21327,7 @@
21271
21327
  return newNode;
21272
21328
  }
21273
21329
  };
21274
- const insertAfter = node => {
21330
+ const insertAfter$1 = node => {
21275
21331
  var _a, _b;
21276
21332
  if (isText$2(node.nextSibling)) {
21277
21333
  if (startsWithCaretContainer(node.nextSibling)) {
@@ -21297,7 +21353,7 @@
21297
21353
  return newNode;
21298
21354
  }
21299
21355
  };
21300
- const insertInline = (before, node) => before ? insertBefore(node) : insertAfter(node);
21356
+ const insertInline = (before, node) => before ? insertBefore$1(node) : insertAfter$1(node);
21301
21357
  const insertInlineBefore = curry(insertInline, true);
21302
21358
  const insertInlineAfter = curry(insertInline, false);
21303
21359
 
@@ -21847,7 +21903,7 @@
21847
21903
  });
21848
21904
  }
21849
21905
  };
21850
- const move$2 = (editor, caret, forward) => isInlineBoundariesEnabled(editor) ? findLocation(editor, caret, forward).isSome() : false;
21906
+ const move$3 = (editor, caret, forward) => isInlineBoundariesEnabled(editor) ? findLocation(editor, caret, forward).isSome() : false;
21851
21907
  const moveWord = (forward, editor, _caret) => isInlineBoundariesEnabled(editor) ? moveByWord(forward, editor) : false;
21852
21908
  const setupSelectedState = editor => {
21853
21909
  const caret = Cell(null);
@@ -21940,7 +21996,7 @@
21940
21996
  })));
21941
21997
  });
21942
21998
  };
21943
- const backspaceDelete$3 = (editor, caret, forward) => {
21999
+ const backspaceDelete$4 = (editor, caret, forward) => {
21944
22000
  if (editor.selection.isCollapsed() && isInlineBoundariesEnabled(editor)) {
21945
22001
  const from = CaretPosition.fromRangeStart(editor.selection.getRng());
21946
22002
  return backspaceDeleteCollapsed(editor, caret, forward, from);
@@ -22035,7 +22091,7 @@
22035
22091
  return Optional.none();
22036
22092
  }
22037
22093
  };
22038
- const backspaceDelete$2 = (editor, forward) => editor.selection.isCollapsed() ? deleteCaret$1(editor, forward) : deleteRange$1(editor);
22094
+ const backspaceDelete$3 = (editor, forward) => editor.selection.isCollapsed() ? deleteCaret$1(editor, forward) : deleteRange$1(editor);
22039
22095
  const hasAncestorInlineCaret = elm => ancestor$1(elm, node => isCaretNode(node.dom), isBlock$2);
22040
22096
  const hasAncestorInlineCaretAtStart = editor => hasAncestorInlineCaret(SugarElement.fromDom(editor.selection.getStart()));
22041
22097
  const requiresRefreshCaretOverride = editor => {
@@ -22073,7 +22129,7 @@
22073
22129
  const selectedNode = editor.selection.getNode();
22074
22130
  return isMedia$2(selectedNode) ? deleteElement(editor, forward, selectedNode) : Optional.none();
22075
22131
  };
22076
- const backspaceDelete$1 = (editor, forward) => editor.selection.isCollapsed() ? deleteCaret(editor, forward) : deleteRange(editor, forward);
22132
+ const backspaceDelete$2 = (editor, forward) => editor.selection.isCollapsed() ? deleteCaret(editor, forward) : deleteRange(editor, forward);
22077
22133
 
22078
22134
  const isEditable = target => closest$4(target, elm => isContentEditableTrue$3(elm.dom) || isContentEditableFalse$b(elm.dom)).exists(elm => isContentEditableTrue$3(elm.dom));
22079
22135
  const parseIndentValue = value => toInt(value !== null && value !== void 0 ? value : '').getOr(0);
@@ -22120,7 +22176,7 @@
22120
22176
  const indent = editor => handle(editor, 'indent');
22121
22177
  const outdent = editor => handle(editor, 'outdent');
22122
22178
 
22123
- const backspaceDelete = editor => {
22179
+ const backspaceDelete$1 = editor => {
22124
22180
  if (editor.selection.isCollapsed() && canOutdent(editor)) {
22125
22181
  const dom = editor.dom;
22126
22182
  const rng = editor.selection.getRng();
@@ -22134,16 +22190,16 @@
22134
22190
  };
22135
22191
 
22136
22192
  const findAction = (editor, caret, forward) => findMap([
22137
- backspaceDelete,
22138
- backspaceDelete$5,
22139
- backspaceDelete$6,
22140
- (editor, forward) => backspaceDelete$3(editor, caret, forward),
22141
- backspaceDelete$8,
22142
- backspaceDelete$9,
22143
- backspaceDelete$4,
22144
22193
  backspaceDelete$1,
22194
+ backspaceDelete$6,
22145
22195
  backspaceDelete$7,
22146
- backspaceDelete$2
22196
+ (editor, forward) => backspaceDelete$4(editor, caret, forward),
22197
+ backspaceDelete$9,
22198
+ backspaceDelete$a,
22199
+ backspaceDelete$5,
22200
+ backspaceDelete$2,
22201
+ backspaceDelete$8,
22202
+ backspaceDelete$3
22147
22203
  ], item => item(editor, forward)).filter(_ => editor.selection.isEditable());
22148
22204
  const deleteCommand = (editor, caret) => {
22149
22205
  const result = findAction(editor, caret, false);
@@ -22480,7 +22536,7 @@
22480
22536
  moveToRange(editor, newRange);
22481
22537
  return true;
22482
22538
  });
22483
- const moveV$3 = (editor, down) => getVerticalRange(editor, down).exists(newRange => {
22539
+ const moveV$4 = (editor, down) => getVerticalRange(editor, down).exists(newRange => {
22484
22540
  moveToRange(editor, newRange);
22485
22541
  return true;
22486
22542
  });
@@ -22522,7 +22578,7 @@
22522
22578
  }
22523
22579
  });
22524
22580
  };
22525
- const moveV$2 = (editor, forward) => {
22581
+ const moveV$3 = (editor, forward) => {
22526
22582
  if (editor.selection.isCollapsed()) {
22527
22583
  return moveCaretToNewEmptyLine(editor, forward);
22528
22584
  } else {
@@ -22530,6 +22586,37 @@
22530
22586
  }
22531
22587
  };
22532
22588
 
22589
+ const moveUp = (editor, details, summary) => {
22590
+ const rng = editor.selection.getRng();
22591
+ const pos = CaretPosition.fromRangeStart(rng);
22592
+ const root = editor.getBody();
22593
+ if (root.firstChild === details && isAtFirstLine(summary, pos)) {
22594
+ editor.execCommand('InsertNewBlockBefore');
22595
+ return true;
22596
+ } else {
22597
+ return false;
22598
+ }
22599
+ };
22600
+ const moveDown = (editor, details) => {
22601
+ const rng = editor.selection.getRng();
22602
+ const pos = CaretPosition.fromRangeStart(rng);
22603
+ const root = editor.getBody();
22604
+ if (root.lastChild === details && isAtLastLine(details, pos)) {
22605
+ editor.execCommand('InsertNewBlockAfter');
22606
+ return true;
22607
+ } else {
22608
+ return false;
22609
+ }
22610
+ };
22611
+ const move$2 = (editor, forward) => {
22612
+ if (forward) {
22613
+ return Optional.from(editor.dom.getParent(editor.selection.getNode(), 'details')).map(details => moveDown(editor, details)).getOr(false);
22614
+ } else {
22615
+ return Optional.from(editor.dom.getParent(editor.selection.getNode(), 'summary')).bind(summary => Optional.from(editor.dom.getParent(summary, 'details')).map(details => moveUp(editor, details, summary))).getOr(false);
22616
+ }
22617
+ };
22618
+ const moveV$2 = (editor, forward) => move$2(editor, forward);
22619
+
22533
22620
  const baseKeyPattern = {
22534
22621
  shiftKey: false,
22535
22622
  altKey: false,
@@ -22822,11 +22909,11 @@
22822
22909
  },
22823
22910
  {
22824
22911
  keyCode: VK.UP,
22825
- action: action(moveV$3, editor, false)
22912
+ action: action(moveV$4, editor, false)
22826
22913
  },
22827
22914
  {
22828
22915
  keyCode: VK.DOWN,
22829
- action: action(moveV$3, editor, true)
22916
+ action: action(moveV$4, editor, true)
22830
22917
  },
22831
22918
  ...isMac ? [
22832
22919
  {
@@ -22858,6 +22945,18 @@
22858
22945
  keyCode: VK.DOWN,
22859
22946
  action: action(moveV, editor, true)
22860
22947
  },
22948
+ {
22949
+ keyCode: VK.UP,
22950
+ action: action(moveV, editor, false)
22951
+ },
22952
+ {
22953
+ keyCode: VK.UP,
22954
+ action: action(moveV$2, editor, false)
22955
+ },
22956
+ {
22957
+ keyCode: VK.DOWN,
22958
+ action: action(moveV$2, editor, true)
22959
+ },
22861
22960
  {
22862
22961
  keyCode: VK.RIGHT,
22863
22962
  action: action(moveH$1, editor, true)
@@ -22876,11 +22975,11 @@
22876
22975
  },
22877
22976
  {
22878
22977
  keyCode: VK.RIGHT,
22879
- action: action(move$2, editor, caret, true)
22978
+ action: action(move$3, editor, caret, true)
22880
22979
  },
22881
22980
  {
22882
22981
  keyCode: VK.LEFT,
22883
- action: action(move$2, editor, caret, false)
22982
+ action: action(move$3, editor, caret, false)
22884
22983
  },
22885
22984
  {
22886
22985
  keyCode: VK.RIGHT,
@@ -22896,11 +22995,11 @@
22896
22995
  },
22897
22996
  {
22898
22997
  keyCode: VK.UP,
22899
- action: action(moveV$2, editor, false)
22998
+ action: action(moveV$3, editor, false)
22900
22999
  },
22901
23000
  {
22902
23001
  keyCode: VK.DOWN,
22903
- action: action(moveV$2, editor, true)
23002
+ action: action(moveV$3, editor, true)
22904
23003
  }
22905
23004
  ], evt).each(_ => {
22906
23005
  evt.preventDefault();
@@ -23597,98 +23696,318 @@
23597
23696
  });
23598
23697
  };
23599
23698
 
23600
- const createAndFireInputEvent = eventType => (editor, inputType, specifics = {}) => {
23601
- const target = editor.getBody();
23602
- const overrides = {
23603
- bubbles: true,
23604
- composed: true,
23605
- data: null,
23606
- isComposing: false,
23607
- detail: 0,
23608
- view: null,
23609
- target,
23610
- currentTarget: target,
23611
- eventPhase: Event.AT_TARGET,
23612
- originalTarget: target,
23613
- explicitOriginalTarget: target,
23614
- isTrusted: false,
23615
- srcElement: target,
23616
- cancelable: false,
23617
- preventDefault: noop,
23618
- inputType
23619
- };
23620
- const input = clone$3(new InputEvent(eventType));
23621
- return editor.dispatch(eventType, {
23622
- ...input,
23623
- ...overrides,
23624
- ...specifics
23699
+ const browser$1 = detect$2().browser;
23700
+ const isSafari = browser$1.isSafari();
23701
+ const emptyNodeContents = node => fillWithPaddingBr(SugarElement.fromDom(node));
23702
+ const isEntireNodeSelected = (rng, node) => {
23703
+ var _a;
23704
+ return rng.startOffset === 0 && rng.endOffset === ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.length);
23705
+ };
23706
+ const getParentDetailsElementAtPos = (dom, pos) => Optional.from(dom.getParent(pos.container(), 'details'));
23707
+ const isInDetailsElement = (dom, pos) => getParentDetailsElementAtPos(dom, pos).isSome();
23708
+ const getDetailsElements = (dom, rng) => {
23709
+ const startDetails = Optional.from(dom.getParent(rng.startContainer, 'details'));
23710
+ const endDetails = Optional.from(dom.getParent(rng.endContainer, 'details'));
23711
+ if (startDetails.isSome() || endDetails.isSome()) {
23712
+ const startSummary = startDetails.bind(details => Optional.from(dom.select('summary', details)[0]));
23713
+ return Optional.some({
23714
+ startSummary,
23715
+ startDetails,
23716
+ endDetails
23717
+ });
23718
+ } else {
23719
+ return Optional.none();
23720
+ }
23721
+ };
23722
+ const isCaretInTheBeginningOf = (caretPos, element) => firstPositionIn(element).exists(pos => pos.isEqual(caretPos));
23723
+ const isCaretInTheEndOf = (caretPos, element) => {
23724
+ return lastPositionIn(element).exists(pos => {
23725
+ if (isBr$6(pos.getNode())) {
23726
+ return prevPosition(element, pos).exists(pos2 => pos2.isEqual(caretPos)) || pos.isEqual(caretPos);
23727
+ } else {
23728
+ return pos.isEqual(caretPos);
23729
+ }
23730
+ });
23731
+ };
23732
+ const isCaretAtStartOfSummary = (caretPos, detailsElements) => detailsElements.startSummary.exists(summary => isCaretInTheBeginningOf(caretPos, summary));
23733
+ const isCaretAtEndOfSummary = (caretPos, detailsElements) => detailsElements.startSummary.exists(summary => isCaretInTheEndOf(caretPos, summary));
23734
+ 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()))));
23735
+ const isCaretInLastPositionInBody = (root, caretPos, detailsElements) => detailsElements.startDetails.exists(details => nextPosition(root, caretPos).forall(pos => !details.contains(pos.container())));
23736
+ const setCaretToPosition = (editor, position) => {
23737
+ const node = position.getNode();
23738
+ if (!isUndefined(node)) {
23739
+ editor.selection.setCursorLocation(node, position.offset());
23740
+ }
23741
+ };
23742
+ const moveCaretToDetailsPos = (editor, pos, forward) => {
23743
+ const details = editor.dom.getParent(pos.container(), 'details');
23744
+ if (details && !details.open) {
23745
+ const summary = editor.dom.select('summary', details)[0];
23746
+ if (summary) {
23747
+ const newPos = forward ? firstPositionIn(summary) : lastPositionIn(summary);
23748
+ newPos.each(pos => setCaretToPosition(editor, pos));
23749
+ }
23750
+ } else {
23751
+ setCaretToPosition(editor, pos);
23752
+ }
23753
+ };
23754
+ const isPartialDelete = (rng, detailsElements) => {
23755
+ const containsStart = element => element.contains(rng.startContainer);
23756
+ const containsEnd = element => element.contains(rng.endContainer);
23757
+ const startInSummary = detailsElements.startSummary.exists(containsStart);
23758
+ const endInSummary = detailsElements.startSummary.exists(containsEnd);
23759
+ const isPartiallySelectedDetailsElements = detailsElements.startDetails.forall(startDetails => detailsElements.endDetails.forall(endDetails => startDetails !== endDetails));
23760
+ const isInPartiallySelectedSummary = (startInSummary || endInSummary) && !(startInSummary && endInSummary);
23761
+ return isInPartiallySelectedSummary || isPartiallySelectedDetailsElements;
23762
+ };
23763
+ const shouldPreventDeleteIntoDetails = (editor, forward, granularity) => {
23764
+ const {dom, selection} = editor;
23765
+ const root = editor.getBody();
23766
+ if (granularity === 'character') {
23767
+ const caretPos = CaretPosition.fromRangeStart(selection.getRng());
23768
+ const parentBlock = dom.getParent(caretPos.container(), dom.isBlock);
23769
+ const parentDetailsAtCaret = getParentDetailsElementAtPos(dom, caretPos);
23770
+ const inEmptyParentBlock = parentBlock && dom.isEmpty(parentBlock);
23771
+ const isFirstBlock = isNull(parentBlock === null || parentBlock === void 0 ? void 0 : parentBlock.previousSibling);
23772
+ const isLastBlock = isNull(parentBlock === null || parentBlock === void 0 ? void 0 : parentBlock.nextSibling);
23773
+ if (inEmptyParentBlock) {
23774
+ const firstOrLast = forward ? isLastBlock : isFirstBlock;
23775
+ if (firstOrLast) {
23776
+ const isBeforeAfterDetails = navigate(!forward, root, caretPos).exists(pos => {
23777
+ return isInDetailsElement(dom, pos) && !equals(parentDetailsAtCaret, getParentDetailsElementAtPos(dom, pos));
23778
+ });
23779
+ if (isBeforeAfterDetails) {
23780
+ return true;
23781
+ }
23782
+ }
23783
+ }
23784
+ return navigate(forward, root, caretPos).fold(never, pos => {
23785
+ const parentDetailsAtNewPos = getParentDetailsElementAtPos(dom, pos);
23786
+ if (isInDetailsElement(dom, pos) && !equals(parentDetailsAtCaret, parentDetailsAtNewPos)) {
23787
+ if (!forward) {
23788
+ moveCaretToDetailsPos(editor, pos, false);
23789
+ }
23790
+ if (parentBlock && inEmptyParentBlock) {
23791
+ if (forward && isFirstBlock) {
23792
+ return true;
23793
+ } else if (!forward && isLastBlock) {
23794
+ return true;
23795
+ }
23796
+ moveCaretToDetailsPos(editor, pos, forward);
23797
+ editor.dom.remove(parentBlock);
23798
+ }
23799
+ return true;
23800
+ } else {
23801
+ return false;
23802
+ }
23803
+ });
23804
+ } else {
23805
+ return false;
23806
+ }
23807
+ };
23808
+ const shouldPreventDeleteSummaryAction = (editor, detailElements, forward, granularity) => {
23809
+ const selection = editor.selection;
23810
+ const rng = selection.getRng();
23811
+ const caretPos = CaretPosition.fromRangeStart(rng);
23812
+ const root = editor.getBody();
23813
+ if (granularity === 'selection') {
23814
+ return isPartialDelete(rng, detailElements);
23815
+ } else if (forward) {
23816
+ return isCaretAtEndOfSummary(caretPos, detailElements) || isCaretInLastPositionInBody(root, caretPos, detailElements);
23817
+ } else {
23818
+ return isCaretAtStartOfSummary(caretPos, detailElements) || isCaretInFirstPositionInBody(caretPos, detailElements);
23819
+ }
23820
+ };
23821
+ const shouldPreventDeleteAction = (editor, forward, granularity) => getDetailsElements(editor.dom, editor.selection.getRng()).fold(() => shouldPreventDeleteIntoDetails(editor, forward, granularity), detailsElements => shouldPreventDeleteSummaryAction(editor, detailsElements, forward, granularity) || shouldPreventDeleteIntoDetails(editor, forward, granularity));
23822
+ const handleDeleteActionSafari = (editor, forward, granularity) => {
23823
+ const selection = editor.selection;
23824
+ const node = selection.getNode();
23825
+ const rng = selection.getRng();
23826
+ const caretPos = CaretPosition.fromRangeStart(rng);
23827
+ if (isSummary(node)) {
23828
+ if (granularity === 'selection' && isEntireNodeSelected(rng, node) || willDeleteLastPositionInElement(forward, caretPos, node)) {
23829
+ emptyNodeContents(node);
23830
+ } else {
23831
+ editor.undoManager.transact(() => {
23832
+ const sel = selection.getSel();
23833
+ let {anchorNode, anchorOffset, focusNode, focusOffset} = sel !== null && sel !== void 0 ? sel : {};
23834
+ const applySelection = () => {
23835
+ if (isNonNullable(anchorNode) && isNonNullable(anchorOffset) && isNonNullable(focusNode) && isNonNullable(focusOffset)) {
23836
+ sel === null || sel === void 0 ? void 0 : sel.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
23837
+ }
23838
+ };
23839
+ const updateSelection = () => {
23840
+ anchorNode = sel === null || sel === void 0 ? void 0 : sel.anchorNode;
23841
+ anchorOffset = sel === null || sel === void 0 ? void 0 : sel.anchorOffset;
23842
+ focusNode = sel === null || sel === void 0 ? void 0 : sel.focusNode;
23843
+ focusOffset = sel === null || sel === void 0 ? void 0 : sel.focusOffset;
23844
+ };
23845
+ const appendAllChildNodes = (from, to) => {
23846
+ each$e(from.childNodes, child => {
23847
+ if (isNode(child)) {
23848
+ to.appendChild(child);
23849
+ }
23850
+ });
23851
+ };
23852
+ const container = editor.dom.create('span', { 'data-mce-bogus': '1' });
23853
+ appendAllChildNodes(node, container);
23854
+ node.appendChild(container);
23855
+ applySelection();
23856
+ if (granularity === 'word' || granularity === 'line') {
23857
+ sel === null || sel === void 0 ? void 0 : sel.modify('extend', forward ? 'right' : 'left', granularity);
23858
+ }
23859
+ if (!selection.isCollapsed() && isEntireNodeSelected(selection.getRng(), container)) {
23860
+ emptyNodeContents(node);
23861
+ } else {
23862
+ editor.execCommand(forward ? 'ForwardDelete' : 'Delete');
23863
+ updateSelection();
23864
+ appendAllChildNodes(container, node);
23865
+ applySelection();
23866
+ }
23867
+ editor.dom.remove(container);
23868
+ });
23869
+ }
23870
+ return true;
23871
+ } else {
23872
+ return false;
23873
+ }
23874
+ };
23875
+ const backspaceDelete = (editor, forward, granularity) => shouldPreventDeleteAction(editor, forward, granularity) || isSafari && handleDeleteActionSafari(editor, forward, granularity) ? Optional.some(noop) : Optional.none();
23876
+
23877
+ const createAndFireInputEvent = eventType => (editor, inputType, specifics = {}) => {
23878
+ const target = editor.getBody();
23879
+ const overrides = {
23880
+ bubbles: true,
23881
+ composed: true,
23882
+ data: null,
23883
+ isComposing: false,
23884
+ detail: 0,
23885
+ view: null,
23886
+ target,
23887
+ currentTarget: target,
23888
+ eventPhase: Event.AT_TARGET,
23889
+ originalTarget: target,
23890
+ explicitOriginalTarget: target,
23891
+ isTrusted: false,
23892
+ srcElement: target,
23893
+ cancelable: false,
23894
+ preventDefault: noop,
23895
+ inputType
23896
+ };
23897
+ const input = clone$3(new InputEvent(eventType));
23898
+ return editor.dispatch(eventType, {
23899
+ ...input,
23900
+ ...overrides,
23901
+ ...specifics
23625
23902
  });
23626
23903
  };
23627
23904
  const fireInputEvent = createAndFireInputEvent('input');
23628
23905
  const fireBeforeInputEvent = createAndFireInputEvent('beforeinput');
23629
23906
 
23907
+ const platform$2 = detect$2();
23908
+ const os = platform$2.os;
23909
+ const isMacOSOriOS = os.isMacOS() || os.isiOS();
23910
+ const browser = platform$2.browser;
23911
+ const isFirefox = browser.isFirefox();
23630
23912
  const executeKeydownOverride$3 = (editor, caret, evt) => {
23631
23913
  const inputType = evt.keyCode === VK.BACKSPACE ? 'deleteContentBackward' : 'deleteContentForward';
23914
+ const isCollapsed = editor.selection.isCollapsed();
23915
+ const unmodifiedGranularity = isCollapsed ? 'character' : 'selection';
23916
+ const getModifiedGranularity = isWord => {
23917
+ if (isCollapsed) {
23918
+ return isWord ? 'word' : 'line';
23919
+ } else {
23920
+ return 'selection';
23921
+ }
23922
+ };
23632
23923
  executeWithDelayedAction([
23633
23924
  {
23634
23925
  keyCode: VK.BACKSPACE,
23635
- action: action(backspaceDelete, editor)
23926
+ action: action(backspaceDelete$1, editor)
23636
23927
  },
23637
23928
  {
23638
23929
  keyCode: VK.BACKSPACE,
23639
- action: action(backspaceDelete$5, editor, false)
23930
+ action: action(backspaceDelete$6, editor, false)
23640
23931
  },
23641
23932
  {
23642
23933
  keyCode: VK.DELETE,
23643
- action: action(backspaceDelete$5, editor, true)
23934
+ action: action(backspaceDelete$6, editor, true)
23644
23935
  },
23645
23936
  {
23646
23937
  keyCode: VK.BACKSPACE,
23647
- action: action(backspaceDelete$6, editor, false)
23938
+ action: action(backspaceDelete$7, editor, false)
23648
23939
  },
23649
23940
  {
23650
23941
  keyCode: VK.DELETE,
23651
- action: action(backspaceDelete$6, editor, true)
23942
+ action: action(backspaceDelete$7, editor, true)
23652
23943
  },
23653
23944
  {
23654
23945
  keyCode: VK.BACKSPACE,
23655
- action: action(backspaceDelete$3, editor, caret, false)
23946
+ action: action(backspaceDelete$4, editor, caret, false)
23656
23947
  },
23657
23948
  {
23658
23949
  keyCode: VK.DELETE,
23659
- action: action(backspaceDelete$3, editor, caret, true)
23950
+ action: action(backspaceDelete$4, editor, caret, true)
23660
23951
  },
23661
23952
  {
23662
23953
  keyCode: VK.BACKSPACE,
23663
- action: action(backspaceDelete$9, editor, false)
23954
+ action: action(backspaceDelete$a, editor, false)
23664
23955
  },
23665
23956
  {
23666
23957
  keyCode: VK.DELETE,
23667
- action: action(backspaceDelete$9, editor, true)
23958
+ action: action(backspaceDelete$a, editor, true)
23668
23959
  },
23669
23960
  {
23670
23961
  keyCode: VK.BACKSPACE,
23671
- action: action(backspaceDelete$4, editor, false)
23962
+ action: action(backspaceDelete, editor, false, unmodifiedGranularity)
23672
23963
  },
23673
23964
  {
23674
23965
  keyCode: VK.DELETE,
23675
- action: action(backspaceDelete$4, editor, true)
23966
+ action: action(backspaceDelete, editor, true, unmodifiedGranularity)
23676
23967
  },
23968
+ ...isMacOSOriOS ? [
23969
+ {
23970
+ keyCode: VK.BACKSPACE,
23971
+ altKey: true,
23972
+ action: action(backspaceDelete, editor, false, getModifiedGranularity(true))
23973
+ },
23974
+ {
23975
+ keyCode: VK.DELETE,
23976
+ altKey: true,
23977
+ action: action(backspaceDelete, editor, true, getModifiedGranularity(true))
23978
+ },
23979
+ {
23980
+ keyCode: VK.BACKSPACE,
23981
+ metaKey: true,
23982
+ action: action(backspaceDelete, editor, false, getModifiedGranularity(false))
23983
+ }
23984
+ ] : [
23985
+ {
23986
+ keyCode: VK.BACKSPACE,
23987
+ ctrlKey: true,
23988
+ action: action(backspaceDelete, editor, false, getModifiedGranularity(true))
23989
+ },
23990
+ {
23991
+ keyCode: VK.DELETE,
23992
+ ctrlKey: true,
23993
+ action: action(backspaceDelete, editor, true, getModifiedGranularity(true))
23994
+ }
23995
+ ],
23677
23996
  {
23678
23997
  keyCode: VK.BACKSPACE,
23679
- action: action(backspaceDelete$1, editor, false)
23998
+ action: action(backspaceDelete$5, editor, false)
23680
23999
  },
23681
24000
  {
23682
24001
  keyCode: VK.DELETE,
23683
- action: action(backspaceDelete$1, editor, true)
24002
+ action: action(backspaceDelete$5, editor, true)
23684
24003
  },
23685
24004
  {
23686
24005
  keyCode: VK.BACKSPACE,
23687
- action: action(backspaceDelete$7, editor, false)
24006
+ action: action(backspaceDelete$2, editor, false)
23688
24007
  },
23689
24008
  {
23690
24009
  keyCode: VK.DELETE,
23691
- action: action(backspaceDelete$7, editor, true)
24010
+ action: action(backspaceDelete$2, editor, true)
23692
24011
  },
23693
24012
  {
23694
24013
  keyCode: VK.BACKSPACE,
@@ -23700,11 +24019,19 @@
23700
24019
  },
23701
24020
  {
23702
24021
  keyCode: VK.BACKSPACE,
23703
- action: action(backspaceDelete$2, editor, false)
24022
+ action: action(backspaceDelete$9, editor, false)
23704
24023
  },
23705
24024
  {
23706
24025
  keyCode: VK.DELETE,
23707
- action: action(backspaceDelete$2, editor, true)
24026
+ action: action(backspaceDelete$9, editor, true)
24027
+ },
24028
+ {
24029
+ keyCode: VK.BACKSPACE,
24030
+ action: action(backspaceDelete$3, editor, false)
24031
+ },
24032
+ {
24033
+ keyCode: VK.DELETE,
24034
+ action: action(backspaceDelete$3, editor, true)
23708
24035
  }
23709
24036
  ], evt).filter(_ => editor.selection.isEditable()).each(applyAction => {
23710
24037
  evt.preventDefault();
@@ -23715,11 +24042,16 @@
23715
24042
  }
23716
24043
  });
23717
24044
  };
23718
- const executeKeyupOverride = (editor, evt, isBackspaceKeydown) => {
23719
- const platform = detect$2();
23720
- const os = platform.os;
23721
- const browser = platform.browser;
23722
- const multiDeleteKeyPatterns = os.isMacOS() ? [
24045
+ const executeKeyupOverride = (editor, evt, isBackspaceKeydown) => execute([
24046
+ {
24047
+ keyCode: VK.BACKSPACE,
24048
+ action: action(paddEmptyElement, editor)
24049
+ },
24050
+ {
24051
+ keyCode: VK.DELETE,
24052
+ action: action(paddEmptyElement, editor)
24053
+ },
24054
+ ...isMacOSOriOS ? [
23723
24055
  {
23724
24056
  keyCode: VK.BACKSPACE,
23725
24057
  altKey: true,
@@ -23729,7 +24061,11 @@
23729
24061
  keyCode: VK.DELETE,
23730
24062
  altKey: true,
23731
24063
  action: action(refreshCaret, editor)
23732
- }
24064
+ },
24065
+ ...isBackspaceKeydown ? [{
24066
+ keyCode: isFirefox ? 224 : 91,
24067
+ action: action(refreshCaret, editor)
24068
+ }] : []
23733
24069
  ] : [
23734
24070
  {
23735
24071
  keyCode: VK.BACKSPACE,
@@ -23741,25 +24077,8 @@
23741
24077
  ctrlKey: true,
23742
24078
  action: action(refreshCaret, editor)
23743
24079
  }
23744
- ];
23745
- if (os.isMacOS() && isBackspaceKeydown) {
23746
- multiDeleteKeyPatterns.push({
23747
- keyCode: browser.isFirefox() ? 224 : 91,
23748
- action: action(refreshCaret, editor)
23749
- });
23750
- }
23751
- execute([
23752
- {
23753
- keyCode: VK.BACKSPACE,
23754
- action: action(paddEmptyElement, editor)
23755
- },
23756
- {
23757
- keyCode: VK.DELETE,
23758
- action: action(paddEmptyElement, editor)
23759
- },
23760
- ...multiDeleteKeyPatterns
23761
- ], evt);
23762
- };
24080
+ ]
24081
+ ], evt);
23763
24082
  const setup$i = (editor, caret) => {
23764
24083
  let isBackspaceKeydown = false;
23765
24084
  editor.on('keydown', evt => {
@@ -23845,6 +24164,7 @@
23845
24164
  while (parent !== root && parent && dom.getContentEditable(parent) !== 'false') {
23846
24165
  if (dom.getContentEditable(parent) === 'true') {
23847
24166
  editableRoot = parent;
24167
+ break;
23848
24168
  }
23849
24169
  parent = parent.parentNode;
23850
24170
  }
@@ -23863,6 +24183,82 @@
23863
24183
  return isListItem$1(SugarElement.fromDom(elm));
23864
24184
  }).isSome();
23865
24185
  };
24186
+ const emptyBlock = elm => {
24187
+ elm.innerHTML = '<br data-mce-bogus="1">';
24188
+ };
24189
+ const applyAttributes = (editor, node, forcedRootBlockAttrs) => {
24190
+ const dom = editor.dom;
24191
+ Optional.from(forcedRootBlockAttrs.style).map(dom.parseStyle).each(attrStyles => {
24192
+ const currentStyles = getAllRaw(SugarElement.fromDom(node));
24193
+ const newStyles = {
24194
+ ...currentStyles,
24195
+ ...attrStyles
24196
+ };
24197
+ dom.setStyles(node, newStyles);
24198
+ });
24199
+ const attrClassesOpt = Optional.from(forcedRootBlockAttrs.class).map(attrClasses => attrClasses.split(/\s+/));
24200
+ const currentClassesOpt = Optional.from(node.className).map(currentClasses => filter$5(currentClasses.split(/\s+/), clazz => clazz !== ''));
24201
+ lift2(attrClassesOpt, currentClassesOpt, (attrClasses, currentClasses) => {
24202
+ const filteredClasses = filter$5(currentClasses, clazz => !contains$2(attrClasses, clazz));
24203
+ const newClasses = [
24204
+ ...attrClasses,
24205
+ ...filteredClasses
24206
+ ];
24207
+ dom.setAttrib(node, 'class', newClasses.join(' '));
24208
+ });
24209
+ const appliedAttrs = [
24210
+ 'style',
24211
+ 'class'
24212
+ ];
24213
+ const remainingAttrs = filter$4(forcedRootBlockAttrs, (_, attrs) => !contains$2(appliedAttrs, attrs));
24214
+ dom.setAttribs(node, remainingAttrs);
24215
+ };
24216
+ const setForcedBlockAttrs = (editor, node) => {
24217
+ const forcedRootBlockName = getForcedRootBlock(editor);
24218
+ if (forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {
24219
+ const forcedRootBlockAttrs = getForcedRootBlockAttrs(editor);
24220
+ applyAttributes(editor, node, forcedRootBlockAttrs);
24221
+ }
24222
+ };
24223
+ const createNewBlock = (editor, container, parentBlock, editableRoot, keepStyles = true, name) => {
24224
+ const dom = editor.dom;
24225
+ const schema = editor.schema;
24226
+ const newBlockName = getForcedRootBlock(editor);
24227
+ const parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : '';
24228
+ let node = container;
24229
+ const textInlineElements = schema.getTextInlineElements();
24230
+ let block;
24231
+ if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') {
24232
+ block = dom.create(name || newBlockName);
24233
+ } else {
24234
+ block = parentBlock.cloneNode(false);
24235
+ }
24236
+ let caretNode = block;
24237
+ if (!keepStyles) {
24238
+ dom.setAttrib(block, 'style', null);
24239
+ dom.setAttrib(block, 'class', null);
24240
+ } else {
24241
+ do {
24242
+ if (textInlineElements[node.nodeName]) {
24243
+ if (isCaretNode(node) || isBookmarkNode$1(node)) {
24244
+ continue;
24245
+ }
24246
+ const clonedNode = node.cloneNode(false);
24247
+ dom.setAttrib(clonedNode, 'id', '');
24248
+ if (block.hasChildNodes()) {
24249
+ clonedNode.appendChild(block.firstChild);
24250
+ block.appendChild(clonedNode);
24251
+ } else {
24252
+ caretNode = clonedNode;
24253
+ block.appendChild(clonedNode);
24254
+ }
24255
+ }
24256
+ } while ((node = node.parentNode) && node !== editableRoot);
24257
+ }
24258
+ setForcedBlockAttrs(editor, block);
24259
+ emptyBlock(caretNode);
24260
+ return block;
24261
+ };
23866
24262
 
23867
24263
  const getDetailsRoot = (editor, element) => editor.dom.getParent(element, isDetails);
23868
24264
  const isAtDetailsEdge = (root, element, isTextBlock) => {
@@ -23925,7 +24321,7 @@
23925
24321
  }
23926
24322
  return node === parentBlock;
23927
24323
  };
23928
- const insert$3 = (editor, createNewBlock, containerBlock, parentBlock, newBlockName) => {
24324
+ const insert$4 = (editor, createNewBlock, containerBlock, parentBlock, newBlockName) => {
23929
24325
  const dom = editor.dom;
23930
24326
  const rng = editor.selection.getRng();
23931
24327
  const containerParent = containerBlock.parentNode;
@@ -23991,9 +24387,6 @@
23991
24387
  const isEmptyAnchor = (dom, elm) => {
23992
24388
  return elm && elm.nodeName === 'A' && dom.isEmpty(elm);
23993
24389
  };
23994
- const emptyBlock = elm => {
23995
- elm.innerHTML = '<br data-mce-bogus="1">';
23996
- };
23997
24390
  const containerAndSiblingName = (container, nodeName) => {
23998
24391
  return container.nodeName === nodeName || container.previousSibling && container.previousSibling.nodeName === nodeName;
23999
24392
  };
@@ -24027,64 +24420,30 @@
24027
24420
  }
24028
24421
  }
24029
24422
  };
24030
- const normalizeZwspOffset = (start, container, offset) => {
24031
- if (!isText$a(container)) {
24032
- return offset;
24033
- } else if (start) {
24034
- return offset === 1 && container.data.charAt(offset - 1) === ZWSP$1 ? 0 : offset;
24035
- } else {
24036
- return offset === container.data.length - 1 && container.data.charAt(offset) === ZWSP$1 ? container.data.length : offset;
24037
- }
24038
- };
24039
- const includeZwspInRange = rng => {
24040
- const newRng = rng.cloneRange();
24041
- newRng.setStart(rng.startContainer, normalizeZwspOffset(true, rng.startContainer, rng.startOffset));
24042
- newRng.setEnd(rng.endContainer, normalizeZwspOffset(false, rng.endContainer, rng.endOffset));
24043
- return newRng;
24044
- };
24045
- const trimLeadingLineBreaks = node => {
24046
- let currentNode = node;
24047
- do {
24048
- if (isText$a(currentNode)) {
24049
- currentNode.data = currentNode.data.replace(/^[\r\n]+/, '');
24050
- }
24051
- currentNode = currentNode.firstChild;
24052
- } while (currentNode);
24053
- };
24054
- const applyAttributes = (editor, node, forcedRootBlockAttrs) => {
24055
- const dom = editor.dom;
24056
- Optional.from(forcedRootBlockAttrs.style).map(dom.parseStyle).each(attrStyles => {
24057
- const currentStyles = getAllRaw(SugarElement.fromDom(node));
24058
- const newStyles = {
24059
- ...currentStyles,
24060
- ...attrStyles
24061
- };
24062
- dom.setStyles(node, newStyles);
24063
- });
24064
- const attrClassesOpt = Optional.from(forcedRootBlockAttrs.class).map(attrClasses => attrClasses.split(/\s+/));
24065
- const currentClassesOpt = Optional.from(node.className).map(currentClasses => filter$5(currentClasses.split(/\s+/), clazz => clazz !== ''));
24066
- lift2(attrClassesOpt, currentClassesOpt, (attrClasses, currentClasses) => {
24067
- const filteredClasses = filter$5(currentClasses, clazz => !contains$2(attrClasses, clazz));
24068
- const newClasses = [
24069
- ...attrClasses,
24070
- ...filteredClasses
24071
- ];
24072
- dom.setAttrib(node, 'class', newClasses.join(' '));
24073
- });
24074
- const appliedAttrs = [
24075
- 'style',
24076
- 'class'
24077
- ];
24078
- const remainingAttrs = filter$4(forcedRootBlockAttrs, (_, attrs) => !contains$2(appliedAttrs, attrs));
24079
- dom.setAttribs(node, remainingAttrs);
24080
- };
24081
- const setForcedBlockAttrs = (editor, node) => {
24082
- const forcedRootBlockName = getForcedRootBlock(editor);
24083
- if (forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {
24084
- const forcedRootBlockAttrs = getForcedRootBlockAttrs(editor);
24085
- applyAttributes(editor, node, forcedRootBlockAttrs);
24423
+ const normalizeZwspOffset = (start, container, offset) => {
24424
+ if (!isText$a(container)) {
24425
+ return offset;
24426
+ } else if (start) {
24427
+ return offset === 1 && container.data.charAt(offset - 1) === ZWSP$1 ? 0 : offset;
24428
+ } else {
24429
+ return offset === container.data.length - 1 && container.data.charAt(offset) === ZWSP$1 ? container.data.length : offset;
24086
24430
  }
24087
24431
  };
24432
+ const includeZwspInRange = rng => {
24433
+ const newRng = rng.cloneRange();
24434
+ newRng.setStart(rng.startContainer, normalizeZwspOffset(true, rng.startContainer, rng.startOffset));
24435
+ newRng.setEnd(rng.endContainer, normalizeZwspOffset(false, rng.endContainer, rng.endOffset));
24436
+ return newRng;
24437
+ };
24438
+ const trimLeadingLineBreaks = node => {
24439
+ let currentNode = node;
24440
+ do {
24441
+ if (isText$a(currentNode)) {
24442
+ currentNode.data = currentNode.data.replace(/^[\r\n]+/, '');
24443
+ }
24444
+ currentNode = currentNode.firstChild;
24445
+ } while (currentNode);
24446
+ };
24088
24447
  const wrapSelfAndSiblingsInDefaultBlock = (editor, newBlockName, rng, container, offset) => {
24089
24448
  var _a, _b;
24090
24449
  const dom = editor.dom;
@@ -24144,7 +24503,7 @@
24144
24503
  return optionValue;
24145
24504
  }
24146
24505
  };
24147
- const insert$2 = (editor, evt) => {
24506
+ const insert$3 = (editor, evt) => {
24148
24507
  let container;
24149
24508
  let offset;
24150
24509
  let parentBlockName;
@@ -24154,45 +24513,12 @@
24154
24513
  const schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements();
24155
24514
  const rng = editor.selection.getRng();
24156
24515
  const newBlockName = getForcedRootBlock(editor);
24157
- const isInRoot = rng.collapsed && rng.startContainer === editor.dom.getRoot();
24158
24516
  const start = SugarElement.fromDom(rng.startContainer);
24159
24517
  const child = child$1(start, rng.startOffset);
24160
24518
  const isCef = child.exists(element => isHTMLElement(element) && !isEditable$3(element));
24161
- const inRootAndLastOrCef = isInRoot && isCef;
24162
- const createNewBlock = name => {
24163
- let node = container;
24164
- const textInlineElements = schema.getTextInlineElements();
24165
- let block;
24166
- if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') {
24167
- block = dom.create(name || newBlockName);
24168
- } else {
24169
- block = parentBlock.cloneNode(false);
24170
- }
24171
- let caretNode = block;
24172
- if (shouldKeepStyles(editor) === false) {
24173
- dom.setAttrib(block, 'style', null);
24174
- dom.setAttrib(block, 'class', null);
24175
- } else {
24176
- do {
24177
- if (textInlineElements[node.nodeName]) {
24178
- if (isCaretNode(node) || isBookmarkNode$1(node)) {
24179
- continue;
24180
- }
24181
- const clonedNode = node.cloneNode(false);
24182
- dom.setAttrib(clonedNode, 'id', '');
24183
- if (block.hasChildNodes()) {
24184
- clonedNode.appendChild(block.firstChild);
24185
- block.appendChild(clonedNode);
24186
- } else {
24187
- caretNode = clonedNode;
24188
- block.appendChild(clonedNode);
24189
- }
24190
- }
24191
- } while ((node = node.parentNode) && node !== editableRoot);
24192
- }
24193
- setForcedBlockAttrs(editor, block);
24194
- emptyBlock(caretNode);
24195
- return block;
24519
+ const collapsedAndCef = rng.collapsed && isCef;
24520
+ const createNewBlock$1 = name => {
24521
+ return createNewBlock(editor, container, parentBlock, editableRoot, shouldKeepStyles(editor), name);
24196
24522
  };
24197
24523
  const isCaretAtStartOrEndOfBlock = start => {
24198
24524
  const normalizedOffset = normalizeZwspOffset(start, container, offset);
@@ -24239,9 +24565,9 @@
24239
24565
  const insertNewBlockAfter = () => {
24240
24566
  let block;
24241
24567
  if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName !== 'HGROUP') {
24242
- block = createNewBlock(newBlockName);
24568
+ block = createNewBlock$1(newBlockName);
24243
24569
  } else {
24244
- block = createNewBlock();
24570
+ block = createNewBlock$1();
24245
24571
  }
24246
24572
  if (shouldEndContainer(editor, containerBlock) && canSplitBlock(dom, containerBlock) && dom.isEmpty(parentBlock, undefined, { includeZwsp: true })) {
24247
24573
  block = dom.split(containerBlock, parentBlock);
@@ -24259,7 +24585,7 @@
24259
24585
  offset = rng.startOffset;
24260
24586
  const shiftKey = !!(evt && evt.shiftKey);
24261
24587
  const ctrlKey = !!(evt && evt.ctrlKey);
24262
- if (isElement$6(container) && container.hasChildNodes() && !inRootAndLastOrCef) {
24588
+ if (isElement$6(container) && container.hasChildNodes() && !collapsedAndCef) {
24263
24589
  isAfterLastNodeInContainer = offset > container.childNodes.length - 1;
24264
24590
  container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;
24265
24591
  if (isAfterLastNodeInContainer && isText$a(container)) {
@@ -24286,21 +24612,21 @@
24286
24612
  parentBlockName = containerBlockName;
24287
24613
  }
24288
24614
  if (isElement$6(containerBlock) && isLastEmptyBlockInDetails(editor, shiftKey, parentBlock)) {
24289
- return insertNewLine(editor, createNewBlock, parentBlock);
24615
+ return insertNewLine(editor, createNewBlock$1, parentBlock);
24290
24616
  }
24291
24617
  if (/^(LI|DT|DD)$/.test(parentBlockName) && isElement$6(containerBlock)) {
24292
24618
  if (dom.isEmpty(parentBlock)) {
24293
- insert$3(editor, createNewBlock, containerBlock, parentBlock, newBlockName);
24619
+ insert$4(editor, createNewBlock$1, containerBlock, parentBlock, newBlockName);
24294
24620
  return;
24295
24621
  }
24296
24622
  }
24297
- if (!inRootAndLastOrCef && (parentBlock === editor.getBody() || !canSplitBlock(dom, parentBlock))) {
24623
+ if (!collapsedAndCef && (parentBlock === editor.getBody() || !canSplitBlock(dom, parentBlock))) {
24298
24624
  return;
24299
24625
  }
24300
24626
  const parentBlockParent = parentBlock.parentNode;
24301
24627
  let newBlock;
24302
- if (inRootAndLastOrCef) {
24303
- newBlock = createNewBlock(newBlockName);
24628
+ if (collapsedAndCef) {
24629
+ newBlock = createNewBlock$1(newBlockName);
24304
24630
  child.fold(() => {
24305
24631
  append$1(start, SugarElement.fromDom(newBlock));
24306
24632
  }, child => {
@@ -24317,7 +24643,7 @@
24317
24643
  } else if (isCaretAtStartOrEndOfBlock(false)) {
24318
24644
  newBlock = insertNewBlockAfter();
24319
24645
  } else if (isCaretAtStartOrEndOfBlock(true) && parentBlockParent) {
24320
- newBlock = parentBlockParent.insertBefore(createNewBlock(), parentBlock);
24646
+ newBlock = parentBlockParent.insertBefore(createNewBlock$1(), parentBlock);
24321
24647
  const isNearChildren = hasChildNodes(SugarElement.fromDom(rng.startContainer)) && rng.collapsed;
24322
24648
  moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') || isNearChildren ? newBlock : parentBlock);
24323
24649
  } else {
@@ -24347,7 +24673,7 @@
24347
24673
  };
24348
24674
  const fakeEventName$1 = 'insertParagraph';
24349
24675
  const blockbreak = {
24350
- insert: insert$2,
24676
+ insert: insert$3,
24351
24677
  fakeEventName: fakeEventName$1
24352
24678
  };
24353
24679
 
@@ -24456,7 +24782,7 @@
24456
24782
  const insertBrOutsideAnchor = (editor, location) => {
24457
24783
  location.fold(noop, curry(insertBrBefore, editor), curry(insertBrAfter, editor), noop);
24458
24784
  };
24459
- const insert$1 = (editor, evt) => {
24785
+ const insert$2 = (editor, evt) => {
24460
24786
  const anchorLocation = readInlineAnchorLocation(editor);
24461
24787
  if (anchorLocation.isSome()) {
24462
24788
  anchorLocation.each(curry(insertBrOutsideAnchor, editor));
@@ -24466,7 +24792,7 @@
24466
24792
  };
24467
24793
  const fakeEventName = 'insertLineBreak';
24468
24794
  const linebreak = {
24469
- insert: insert$1,
24795
+ insert: insert$2,
24470
24796
  fakeEventName
24471
24797
  };
24472
24798
 
@@ -24523,11 +24849,10 @@
24523
24849
  };
24524
24850
  const isInRootWithEmptyOrCEF = editor => {
24525
24851
  const rng = editor.selection.getRng();
24526
- const isInRoot = rng.collapsed && rng.startContainer === editor.dom.getRoot();
24527
24852
  const start = SugarElement.fromDom(rng.startContainer);
24528
24853
  const child = child$1(start, rng.startOffset);
24529
24854
  const isCefOpt = child.map(element => isHTMLElement(element) && !isEditable$3(element));
24530
- return isInRoot && isCefOpt.getOr(true);
24855
+ return rng.collapsed && isCefOpt.getOr(true);
24531
24856
  };
24532
24857
  const match = (predicates, action) => {
24533
24858
  return (editor, shiftKey) => {
@@ -24593,7 +24918,7 @@
24593
24918
  fireInputEvent(editor, breakType.fakeEventName);
24594
24919
  }
24595
24920
  };
24596
- const insert = (editor, evt) => {
24921
+ const insert$1 = (editor, evt) => {
24597
24922
  const br = () => insertBreak(linebreak, editor, evt);
24598
24923
  const block = () => insertBreak(blockbreak, editor, evt);
24599
24924
  const logicalAction = getAction(editor, evt);
@@ -24613,8 +24938,8 @@
24613
24938
  }
24614
24939
  };
24615
24940
 
24616
- const platform$2 = detect$2();
24617
- const isIOSSafari = platform$2.os.isiOS() && platform$2.browser.isSafari();
24941
+ const platform$1 = detect$2();
24942
+ const isIOSSafari = platform$1.os.isiOS() && platform$1.browser.isSafari();
24618
24943
  const handleEnterKeyEvent = (editor, event) => {
24619
24944
  if (event.isDefaultPrevented()) {
24620
24945
  return;
@@ -24622,7 +24947,7 @@
24622
24947
  event.preventDefault();
24623
24948
  endTypingLevelIgnoreLocks(editor.undoManager);
24624
24949
  editor.undoManager.transact(() => {
24625
- insert(editor, event);
24950
+ insert$1(editor, event);
24626
24951
  });
24627
24952
  };
24628
24953
  const isCaretAfterKoreanCharacter = rng => {
@@ -24727,7 +25052,7 @@
24727
25052
  });
24728
25053
  };
24729
25054
 
24730
- const platform$1 = detect$2();
25055
+ const platform = detect$2();
24731
25056
  const executeKeyupAction = (editor, caret, evt) => {
24732
25057
  execute([
24733
25058
  {
@@ -24751,7 +25076,7 @@
24751
25076
  blocked.set(block);
24752
25077
  };
24753
25078
  const setup$e = (editor, caret) => {
24754
- if (platform$1.os.isMacOS()) {
25079
+ if (platform.os.isMacOS()) {
24755
25080
  return;
24756
25081
  }
24757
25082
  const blocked = Cell(false);
@@ -25781,15 +26106,34 @@
25781
26106
  }
25782
26107
  };
25783
26108
  const hasImage = dataTransfer => exists(dataTransfer.files, file => /^image\//.test(file.type));
25784
- const isTransparentBlockDrop = (dom, schema, target, dropContent) => {
26109
+ const needsCustomInternalDrop = (dom, schema, target, dropContent) => {
25785
26110
  const parentTransparent = dom.getParent(target, node => isTransparentBlock(schema, node));
25786
- if (parentTransparent && has$2(dropContent, 'text/html')) {
26111
+ const inSummary = !isNull(dom.getParent(target, 'summary'));
26112
+ if (inSummary) {
26113
+ return true;
26114
+ } else if (parentTransparent && has$2(dropContent, 'text/html')) {
25787
26115
  const fragment = new DOMParser().parseFromString(dropContent['text/html'], 'text/html').body;
25788
26116
  return !isNull(fragment.querySelector(parentTransparent.nodeName.toLowerCase()));
25789
26117
  } else {
25790
26118
  return false;
25791
26119
  }
25792
26120
  };
26121
+ const setupSummaryDeleteByDragFix = editor => {
26122
+ editor.on('input', e => {
26123
+ const hasNoSummary = el => isNull(el.querySelector('summary'));
26124
+ if (e.inputType === 'deleteByDrag') {
26125
+ const brokenDetailElements = filter$5(editor.dom.select('details'), hasNoSummary);
26126
+ each$e(brokenDetailElements, details => {
26127
+ if (isBr$6(details.firstChild)) {
26128
+ details.firstChild.remove();
26129
+ }
26130
+ const summary = editor.dom.create('summary');
26131
+ summary.appendChild(createPaddingBr().dom);
26132
+ details.prepend(summary);
26133
+ });
26134
+ }
26135
+ });
26136
+ };
25793
26137
  const setup$a = (editor, draggingInternallyState) => {
25794
26138
  if (shouldPasteBlockDrop(editor)) {
25795
26139
  editor.on('dragend dragover draggesture dragdrop drop drag', e => {
@@ -25820,15 +26164,16 @@
25820
26164
  }
25821
26165
  const internalContent = dropContent[internalHtmlMime()];
25822
26166
  const content = internalContent || dropContent['text/html'] || dropContent['text/plain'];
25823
- const transparentElementDrop = isTransparentBlockDrop(editor.dom, editor.schema, rng.startContainer, dropContent);
25824
- if (draggingInternallyState.get() && !transparentElementDrop) {
26167
+ const needsInternalDrop = needsCustomInternalDrop(editor.dom, editor.schema, rng.startContainer, dropContent);
26168
+ const isInternalDrop = draggingInternallyState.get();
26169
+ if (isInternalDrop && !needsInternalDrop) {
25825
26170
  return;
25826
26171
  }
25827
26172
  if (content) {
25828
26173
  e.preventDefault();
25829
26174
  Delay.setEditorTimeout(editor, () => {
25830
26175
  editor.undoManager.transact(() => {
25831
- if (internalContent) {
26176
+ if (internalContent || isInternalDrop && needsInternalDrop) {
25832
26177
  editor.execCommand('Delete');
25833
26178
  }
25834
26179
  setFocusedRange(editor, rng);
@@ -25854,6 +26199,7 @@
25854
26199
  draggingInternallyState.set(false);
25855
26200
  }
25856
26201
  });
26202
+ setupSummaryDeleteByDragFix(editor);
25857
26203
  };
25858
26204
 
25859
26205
  const setup$9 = editor => {
@@ -25963,197 +26309,9 @@
25963
26309
  });
25964
26310
  });
25965
26311
  };
25966
- const emptyNodeContents = node => fillWithPaddingBr(SugarElement.fromDom(node));
25967
- const setCaretToPosition = (editor, position) => {
25968
- const node = position.getNode();
25969
- if (!isUndefined(node)) {
25970
- editor.selection.setCursorLocation(node, position.offset());
25971
- }
25972
- };
25973
- const isEntireNodeSelected = (rng, node) => {
25974
- var _a;
25975
- return rng.startOffset === 0 && rng.endOffset === ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.length);
25976
- };
25977
- const platform = detect$2();
25978
- const browser = platform.browser;
25979
- const os = platform.os;
25980
- const isSafari = browser.isSafari();
25981
- const isMacOSOriOS = os.isMacOS() || os.isiOS();
25982
- const isCaretInTheBeginningOf = (caretPos, element) => firstPositionIn(element).exists(pos => pos.isEqual(caretPos));
25983
- const isCaretInTheEndOf = (caretPos, element) => {
25984
- return lastPositionIn(element).exists(pos => {
25985
- if (isBr$6(pos.getNode())) {
25986
- return prevPosition(element, pos).exists(pos2 => pos2.isEqual(caretPos)) || pos.isEqual(caretPos);
25987
- } else {
25988
- return pos.isEqual(caretPos);
25989
- }
25990
- });
25991
- };
25992
- const getDetailsElements = (dom, rng) => {
25993
- const startDetails = Optional.from(dom.getParent(rng.startContainer, 'details'));
25994
- const endDetails = Optional.from(dom.getParent(rng.endContainer, 'details'));
25995
- if (startDetails.isSome() || endDetails.isSome()) {
25996
- const startSummary = startDetails.bind(details => Optional.from(dom.select('summary', details)[0]));
25997
- return Optional.some({
25998
- startSummary,
25999
- startDetails,
26000
- endDetails
26001
- });
26002
- } else {
26003
- return Optional.none();
26004
- }
26005
- };
26006
- const isPartialDelete = (rng, detailsElements) => {
26007
- const containsStart = element => element.contains(rng.startContainer);
26008
- const containsEnd = element => element.contains(rng.endContainer);
26009
- const startInSummary = detailsElements.startSummary.exists(containsStart);
26010
- const endInSummary = detailsElements.startSummary.exists(containsEnd);
26011
- const isPartiallySelectedDetailsElements = detailsElements.startDetails.forall(startDetails => detailsElements.endDetails.forall(endDetails => startDetails !== endDetails));
26012
- const isInPartiallySelectedSummary = (startInSummary || endInSummary) && !(startInSummary && endInSummary);
26013
- return isInPartiallySelectedSummary || isPartiallySelectedDetailsElements;
26014
- };
26015
- const isCaretAtStartOfSummary = (caretPos, detailsElements) => detailsElements.startSummary.exists(summary => isCaretInTheBeginningOf(caretPos, summary));
26016
- const isCaretAtEndOfSummary = (caretPos, detailsElements) => detailsElements.startSummary.exists(summary => isCaretInTheEndOf(caretPos, summary));
26017
- 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()))));
26018
- const isCaretInLastPositionInBody = (root, caretPos, detailsElements) => detailsElements.startDetails.exists(details => nextPosition(root, caretPos).forall(pos => !details.contains(pos.container())));
26019
- const isInDetailsElement = (dom, pos) => isNonNullable(dom.getParent(pos.container(), 'details'));
26020
- const moveCaretToDetailsPos = (editor, pos) => {
26021
- const details = editor.dom.getParent(pos.container(), 'details');
26022
- if (details && !details.open) {
26023
- const summary = editor.dom.select('summary', details)[0];
26024
- if (summary) {
26025
- lastPositionIn(summary).each(pos => setCaretToPosition(editor, pos));
26026
- }
26027
- } else {
26028
- setCaretToPosition(editor, pos);
26029
- }
26030
- };
26031
- const preventDeleteIntoDetails = (editor, forward) => {
26032
- const {dom, selection} = editor;
26033
- const root = editor.getBody();
26034
- if (editor.selection.isCollapsed()) {
26035
- const caretPos = CaretPosition.fromRangeStart(selection.getRng());
26036
- const parentBlock = dom.getParent(caretPos.container(), dom.isBlock);
26037
- if (parentBlock && dom.isEmpty(parentBlock)) {
26038
- if (isNull(parentBlock.nextSibling)) {
26039
- const pos = prevPosition(root, caretPos).filter(pos => isInDetailsElement(dom, pos));
26040
- if (pos.isSome()) {
26041
- pos.each(pos => {
26042
- if (!forward) {
26043
- moveCaretToDetailsPos(editor, pos);
26044
- }
26045
- });
26046
- return true;
26047
- }
26048
- } else if (isNull(parentBlock.previousSibling)) {
26049
- const pos = nextPosition(root, caretPos).filter(pos => isInDetailsElement(dom, pos));
26050
- if (pos) {
26051
- return true;
26052
- }
26053
- }
26054
- }
26055
- return navigate(forward, root, caretPos).fold(never, pos => {
26056
- if (isInDetailsElement(dom, pos)) {
26057
- if (parentBlock && dom.isEmpty(parentBlock)) {
26058
- editor.dom.remove(parentBlock);
26059
- }
26060
- if (!forward) {
26061
- moveCaretToDetailsPos(editor, pos);
26062
- }
26063
- return true;
26064
- } else {
26065
- return false;
26066
- }
26067
- });
26068
- } else {
26069
- return false;
26070
- }
26071
- };
26072
- const preventDeleteSummaryAction = (editor, detailElements, e) => {
26073
- const selection = editor.selection;
26074
- const node = selection.getNode();
26075
- const rng = selection.getRng();
26076
- const isBackspace = e.keyCode === VK.BACKSPACE;
26077
- const isDelete = e.keyCode === VK.DELETE;
26078
- const isCollapsed = editor.selection.isCollapsed();
26079
- const caretPos = CaretPosition.fromRangeStart(rng);
26080
- const root = editor.getBody();
26081
- if (!isCollapsed && isPartialDelete(rng, detailElements)) {
26082
- return true;
26083
- } else if (isCollapsed && isBackspace && isCaretAtStartOfSummary(caretPos, detailElements)) {
26084
- return true;
26085
- } else if (isCollapsed && isDelete && isCaretAtEndOfSummary(caretPos, detailElements)) {
26086
- return true;
26087
- } else if (isCollapsed && isBackspace && isCaretInFirstPositionInBody(caretPos, detailElements)) {
26088
- return true;
26089
- } else if (isCollapsed && isDelete && isCaretInLastPositionInBody(root, caretPos, detailElements)) {
26090
- return true;
26091
- } else if (isSafari && isSummary(node)) {
26092
- if (!isCollapsed && isEntireNodeSelected(rng, node) || willDeleteLastPositionInElement(isDelete, caretPos, node)) {
26093
- emptyNodeContents(node);
26094
- } else {
26095
- editor.undoManager.transact(() => {
26096
- const sel = selection.getSel();
26097
- let {anchorNode, anchorOffset, focusNode, focusOffset} = sel !== null && sel !== void 0 ? sel : {};
26098
- const applySelection = () => {
26099
- if (isNonNullable(anchorNode) && isNonNullable(anchorOffset) && isNonNullable(focusNode) && isNonNullable(focusOffset)) {
26100
- sel === null || sel === void 0 ? void 0 : sel.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset);
26101
- }
26102
- };
26103
- const updateSelection = () => {
26104
- anchorNode = sel === null || sel === void 0 ? void 0 : sel.anchorNode;
26105
- anchorOffset = sel === null || sel === void 0 ? void 0 : sel.anchorOffset;
26106
- focusNode = sel === null || sel === void 0 ? void 0 : sel.focusNode;
26107
- focusOffset = sel === null || sel === void 0 ? void 0 : sel.focusOffset;
26108
- };
26109
- const appendAllChildNodes = (from, to) => {
26110
- each$e(from.childNodes, child => {
26111
- if (isNode(child)) {
26112
- to.appendChild(child);
26113
- }
26114
- });
26115
- };
26116
- const container = editor.dom.create('span', { 'data-mce-bogus': 'all' });
26117
- appendAllChildNodes(node, container);
26118
- node.appendChild(container);
26119
- applySelection();
26120
- if (isCollapsed && (isMacOSOriOS && (e.altKey || isBackspace && e.metaKey) || !isMacOSOriOS && e.ctrlKey)) {
26121
- sel === null || sel === void 0 ? void 0 : sel.modify('extend', isBackspace ? 'left' : 'right', e.metaKey ? 'line' : 'word');
26122
- }
26123
- if (!selection.isCollapsed() && isEntireNodeSelected(selection.getRng(), container)) {
26124
- emptyNodeContents(node);
26125
- } else {
26126
- editor.execCommand(isBackspace ? 'Delete' : 'ForwardDelete');
26127
- updateSelection();
26128
- appendAllChildNodes(container, node);
26129
- applySelection();
26130
- }
26131
- editor.dom.remove(container);
26132
- });
26133
- }
26134
- return true;
26135
- }
26136
- return false;
26137
- };
26138
- const preventDeletingSummary = editor => {
26139
- editor.on('keydown', e => {
26140
- if (e.keyCode === VK.BACKSPACE || e.keyCode === VK.DELETE) {
26141
- getDetailsElements(editor.dom, editor.selection.getRng()).fold(() => {
26142
- if (preventDeleteIntoDetails(editor, e.keyCode === VK.DELETE)) {
26143
- e.preventDefault();
26144
- }
26145
- }, detailsElements => {
26146
- if (preventDeleteSummaryAction(editor, detailsElements, e)) {
26147
- e.preventDefault();
26148
- }
26149
- });
26150
- }
26151
- });
26152
- };
26153
26312
  const setup$6 = editor => {
26154
26313
  preventSummaryToggle(editor);
26155
26314
  filterDetails(editor);
26156
- preventDeletingSummary(editor);
26157
26315
  };
26158
26316
 
26159
26317
  const isBr = isBr$6;
@@ -27130,7 +27288,7 @@
27130
27288
  const cleanEmptyNodes = (dom, node, isRoot) => {
27131
27289
  if (node && dom.isEmpty(node) && !isRoot(node)) {
27132
27290
  const parent = node.parentNode;
27133
- dom.remove(node);
27291
+ dom.remove(node, isText$a(node.firstChild) && isWhitespaceText(node.firstChild.data));
27134
27292
  cleanEmptyNodes(dom, parent, isRoot);
27135
27293
  }
27136
27294
  };
@@ -27622,12 +27780,17 @@
27622
27780
  const allSelection = serializeRng(allRng);
27623
27781
  return selection === allSelection;
27624
27782
  };
27783
+ const hasPreservedEmptyElements = elm => {
27784
+ const scope = SugarElement.fromDom(elm);
27785
+ const isEditableHost = elm => parentElement(elm).exists(elm => !isEditable$3(elm));
27786
+ return exists(descendants(scope, '[contenteditable="true"]'), isEditableHost);
27787
+ };
27625
27788
  editor.on('keydown', e => {
27626
27789
  const keyCode = e.keyCode;
27627
27790
  if (!isDefaultPrevented(e) && (keyCode === DELETE || keyCode === BACKSPACE) && editor.selection.isEditable()) {
27628
27791
  const isCollapsed = editor.selection.isCollapsed();
27629
27792
  const body = editor.getBody();
27630
- if (isCollapsed && !dom.isEmpty(body)) {
27793
+ if (isCollapsed && (!dom.isEmpty(body) || hasPreservedEmptyElements(body))) {
27631
27794
  return;
27632
27795
  }
27633
27796
  if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {
@@ -28252,6 +28415,19 @@
28252
28415
  initEditor(editor);
28253
28416
  }
28254
28417
  };
28418
+ const startProgress = editor => {
28419
+ let canceled = false;
28420
+ const progressTimeout = setTimeout(() => {
28421
+ if (!canceled) {
28422
+ editor.setProgressState(true);
28423
+ }
28424
+ }, 500);
28425
+ return () => {
28426
+ clearTimeout(progressTimeout);
28427
+ canceled = true;
28428
+ editor.setProgressState(false);
28429
+ };
28430
+ };
28255
28431
  const contentBodyLoaded = editor => {
28256
28432
  const targetElm = editor.getElement();
28257
28433
  let doc = editor.getDoc();
@@ -28312,7 +28488,11 @@
28312
28488
  const setupRtcThunk = setup$s(editor);
28313
28489
  preInit(editor);
28314
28490
  setupRtcThunk.fold(() => {
28315
- loadContentCss(editor).then(() => initEditorWithInitialContent(editor));
28491
+ const cancelProgress = startProgress(editor);
28492
+ loadContentCss(editor).then(() => {
28493
+ initEditorWithInitialContent(editor);
28494
+ cancelProgress();
28495
+ });
28316
28496
  }, setupRtc => {
28317
28497
  editor.setProgressState(true);
28318
28498
  loadContentCss(editor).then(() => {
@@ -28870,12 +29050,12 @@
28870
29050
  JustifyFull: alignStates('alignjustify')
28871
29051
  }, 'state');
28872
29052
  };
28873
- const registerCommands$a = editor => {
29053
+ const registerCommands$b = editor => {
28874
29054
  registerExecCommands$3(editor);
28875
29055
  registerQueryStateCommands$1(editor);
28876
29056
  };
28877
29057
 
28878
- const registerCommands$9 = editor => {
29058
+ const registerCommands$a = editor => {
28879
29059
  editor.editorCommands.addCommands({
28880
29060
  'Cut,Copy,Paste': command => {
28881
29061
  const doc = editor.getDoc();
@@ -28959,7 +29139,7 @@
28959
29139
  }
28960
29140
  };
28961
29141
 
28962
- const registerCommands$8 = editor => {
29142
+ const registerCommands$9 = editor => {
28963
29143
  editor.editorCommands.addCommands({
28964
29144
  mceCleanup: () => {
28965
29145
  const bm = editor.selection.getBookmark();
@@ -29137,12 +29317,12 @@
29137
29317
  editor.editorCommands.addQueryValueHandler('FontSize', () => fontSizeQuery(editor));
29138
29318
  editor.editorCommands.addQueryValueHandler('LineHeight', () => lineHeightQuery(editor));
29139
29319
  };
29140
- const registerCommands$7 = editor => {
29320
+ const registerCommands$8 = editor => {
29141
29321
  registerExecCommands$2(editor);
29142
29322
  registerQueryValueCommands(editor);
29143
29323
  };
29144
29324
 
29145
- const registerCommands$6 = editor => {
29325
+ const registerCommands$7 = editor => {
29146
29326
  editor.editorCommands.addCommands({
29147
29327
  mceAddUndoLevel: () => {
29148
29328
  editor.undoManager.add();
@@ -29159,7 +29339,7 @@
29159
29339
  });
29160
29340
  };
29161
29341
 
29162
- const registerCommands$5 = editor => {
29342
+ const registerCommands$6 = editor => {
29163
29343
  editor.editorCommands.addCommands({
29164
29344
  Indent: () => {
29165
29345
  indent(editor);
@@ -29171,7 +29351,7 @@
29171
29351
  editor.editorCommands.addCommands({ Outdent: () => canOutdent(editor) }, 'state');
29172
29352
  };
29173
29353
 
29174
- const registerCommands$4 = editor => {
29354
+ const registerCommands$5 = editor => {
29175
29355
  const applyLinkToSelection = (_command, _ui, value) => {
29176
29356
  const linkDetails = isString(value) ? { href: value } : value;
29177
29357
  const anchor = editor.dom.getParent(editor.selection.getNode(), 'a');
@@ -29227,18 +29407,57 @@
29227
29407
  }
29228
29408
  }, 'state');
29229
29409
  };
29230
- const registerCommands$3 = editor => {
29410
+ const registerCommands$4 = editor => {
29231
29411
  registerExecCommands$1(editor);
29232
29412
  registerQueryStateCommands(editor);
29233
29413
  };
29234
29414
 
29415
+ const getTopParentBlock = (editor, node, root, container) => {
29416
+ const dom = editor.dom;
29417
+ const selector = node => dom.isBlock(node) && node.parentElement === root;
29418
+ const topParentBlock = selector(node) ? node : dom.getParent(container, selector, root);
29419
+ return Optional.from(topParentBlock).map(SugarElement.fromDom);
29420
+ };
29421
+ const insert = (editor, before) => {
29422
+ const dom = editor.dom;
29423
+ const rng = editor.selection.getRng();
29424
+ const node = before ? editor.selection.getStart() : editor.selection.getEnd();
29425
+ const container = before ? rng.startContainer : rng.endContainer;
29426
+ const root = getEditableRoot(dom, container);
29427
+ if (!root || !root.isContentEditable) {
29428
+ return;
29429
+ }
29430
+ const insertFn = before ? before$3 : after$4;
29431
+ const newBlockName = getForcedRootBlock(editor);
29432
+ getTopParentBlock(editor, node, root, container).each(parentBlock => {
29433
+ const newBlock = createNewBlock(editor, container, parentBlock.dom, root, false, newBlockName);
29434
+ insertFn(parentBlock, SugarElement.fromDom(newBlock));
29435
+ editor.selection.setCursorLocation(newBlock, 0);
29436
+ editor.dispatch('NewBlock', { newBlock });
29437
+ fireInputEvent(editor, 'insertParagraph');
29438
+ });
29439
+ };
29440
+ const insertBefore = editor => insert(editor, true);
29441
+ const insertAfter = editor => insert(editor, false);
29442
+
29443
+ const registerCommands$3 = editor => {
29444
+ editor.editorCommands.addCommands({
29445
+ InsertNewBlockBefore: () => {
29446
+ insertBefore(editor);
29447
+ },
29448
+ InsertNewBlockAfter: () => {
29449
+ insertAfter(editor);
29450
+ }
29451
+ });
29452
+ };
29453
+
29235
29454
  const registerCommands$2 = editor => {
29236
29455
  editor.editorCommands.addCommands({
29237
29456
  insertParagraph: () => {
29238
29457
  insertBreak(blockbreak, editor);
29239
29458
  },
29240
29459
  mceInsertNewLine: (_command, _ui, value) => {
29241
- insert(editor, value);
29460
+ insert$1(editor, value);
29242
29461
  },
29243
29462
  InsertLineBreak: (_command, _ui, _value) => {
29244
29463
  insertBreak(linebreak, editor);
@@ -29296,16 +29515,17 @@
29296
29515
  });
29297
29516
  };
29298
29517
  const registerCommands = editor => {
29518
+ registerCommands$b(editor);
29299
29519
  registerCommands$a(editor);
29300
- registerCommands$9(editor);
29301
- registerCommands$6(editor);
29520
+ registerCommands$7(editor);
29302
29521
  registerCommands$1(editor);
29303
- registerCommands$8(editor);
29304
- registerCommands$4(editor);
29522
+ registerCommands$9(editor);
29305
29523
  registerCommands$5(editor);
29306
- registerCommands$2(editor);
29524
+ registerCommands$6(editor);
29307
29525
  registerCommands$3(editor);
29308
- registerCommands$7(editor);
29526
+ registerCommands$2(editor);
29527
+ registerCommands$4(editor);
29528
+ registerCommands$8(editor);
29309
29529
  registerExecCommands(editor);
29310
29530
  };
29311
29531
 
@@ -30694,8 +30914,8 @@
30694
30914
  documentBaseURL: null,
30695
30915
  suffix: null,
30696
30916
  majorVersion: '6',
30697
- minorVersion: '6.2',
30698
- releaseDate: '2023-08-09',
30917
+ minorVersion: '7.0',
30918
+ releaseDate: '2023-08-30',
30699
30919
  i18n: I18n,
30700
30920
  activeEditor: null,
30701
30921
  focusedEditor: null,