@syncfusion/ej2-richtexteditor 24.2.3 → 24.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +43 -5
  2. package/dist/ej2-richtexteditor.min.js +2 -2
  3. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  4. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-richtexteditor.es2015.js +485 -193
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +472 -186
  8. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  9. package/dist/global/ej2-richtexteditor.min.js +2 -2
  10. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +12 -12
  13. package/src/common/util.d.ts +6 -0
  14. package/src/common/util.js +31 -1
  15. package/src/editor-manager/plugin/formats.d.ts +1 -0
  16. package/src/editor-manager/plugin/formats.js +37 -2
  17. package/src/editor-manager/plugin/inserthtml.js +22 -4
  18. package/src/editor-manager/plugin/lists.js +14 -1
  19. package/src/editor-manager/plugin/ms-word-clean-up.js +87 -18
  20. package/src/editor-manager/plugin/nodecutter.js +1 -1
  21. package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
  22. package/src/editor-manager/plugin/selection-commands.js +56 -1
  23. package/src/editor-manager/plugin/table.js +1 -1
  24. package/src/rich-text-editor/actions/base-quick-toolbar.js +2 -2
  25. package/src/rich-text-editor/actions/enter-key.js +2 -2
  26. package/src/rich-text-editor/actions/html-editor.js +25 -12
  27. package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
  28. package/src/rich-text-editor/actions/paste-clean-up.js +26 -5
  29. package/src/rich-text-editor/actions/toolbar-action.js +1 -1
  30. package/src/rich-text-editor/actions/toolbar.js +1 -1
  31. package/src/rich-text-editor/base/interface.d.ts +0 -8
  32. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
  33. package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
  34. package/src/rich-text-editor/base/rich-text-editor.js +16 -6
  35. package/src/rich-text-editor/base/util.js +3 -0
  36. package/src/rich-text-editor/models/default-locale.js +8 -7
  37. package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
  38. package/src/rich-text-editor/renderer/image-module.js +3 -3
  39. package/src/rich-text-editor/renderer/table-module.d.ts +1 -0
  40. package/src/rich-text-editor/renderer/table-module.js +106 -98
  41. package/src/rich-text-editor/renderer/video-module.d.ts +2 -0
  42. package/src/rich-text-editor/renderer/video-module.js +33 -26
  43. package/src/selection/selection.js +3 -0
  44. package/styles/bootstrap-dark.css +25 -9
  45. package/styles/bootstrap.css +25 -9
  46. package/styles/bootstrap4.css +30 -14
  47. package/styles/bootstrap5-dark.css +25 -9
  48. package/styles/bootstrap5.css +25 -9
  49. package/styles/fabric-dark.css +25 -9
  50. package/styles/fabric.css +25 -9
  51. package/styles/fluent-dark.css +27 -11
  52. package/styles/fluent.css +27 -11
  53. package/styles/highcontrast-light.css +25 -9
  54. package/styles/highcontrast.css +25 -9
  55. package/styles/material-dark.css +25 -9
  56. package/styles/material.css +25 -9
  57. package/styles/material3-dark.css +33 -11
  58. package/styles/material3.css +33 -11
  59. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +4 -2
  60. package/styles/rich-text-editor/_bootstrap-definition.scss +4 -2
  61. package/styles/rich-text-editor/_bootstrap4-definition.scss +8 -6
  62. package/styles/rich-text-editor/_bootstrap5-definition.scss +4 -2
  63. package/styles/rich-text-editor/_fabric-dark-definition.scss +4 -2
  64. package/styles/rich-text-editor/_fabric-definition.scss +4 -2
  65. package/styles/rich-text-editor/_fluent-definition.scss +5 -3
  66. package/styles/rich-text-editor/_fusionnew-definition.scss +4 -2
  67. package/styles/rich-text-editor/_highcontrast-definition.scss +4 -2
  68. package/styles/rich-text-editor/_highcontrast-light-definition.scss +4 -2
  69. package/styles/rich-text-editor/_layout.scss +38 -7
  70. package/styles/rich-text-editor/_material-dark-definition.scss +4 -2
  71. package/styles/rich-text-editor/_material-definition.scss +4 -2
  72. package/styles/rich-text-editor/_material3-definition.scss +5 -3
  73. package/styles/rich-text-editor/_tailwind-definition.scss +21 -19
  74. package/styles/rich-text-editor/_theme.scss +21 -3
  75. package/styles/rich-text-editor/bootstrap-dark.css +25 -9
  76. package/styles/rich-text-editor/bootstrap.css +25 -9
  77. package/styles/rich-text-editor/bootstrap4.css +30 -14
  78. package/styles/rich-text-editor/bootstrap5-dark.css +25 -9
  79. package/styles/rich-text-editor/bootstrap5.css +25 -9
  80. package/styles/rich-text-editor/fabric-dark.css +25 -9
  81. package/styles/rich-text-editor/fabric.css +25 -9
  82. package/styles/rich-text-editor/fluent-dark.css +27 -11
  83. package/styles/rich-text-editor/fluent.css +27 -11
  84. package/styles/rich-text-editor/highcontrast-light.css +25 -9
  85. package/styles/rich-text-editor/highcontrast.css +25 -9
  86. package/styles/rich-text-editor/material-dark.css +25 -9
  87. package/styles/rich-text-editor/material.css +25 -9
  88. package/styles/rich-text-editor/material3-dark.css +33 -11
  89. package/styles/rich-text-editor/material3.css +33 -11
  90. package/styles/rich-text-editor/tailwind-dark.css +68 -32
  91. package/styles/rich-text-editor/tailwind.css +68 -32
  92. package/styles/tailwind-dark.css +68 -32
  93. package/styles/tailwind.css +68 -32
@@ -2661,7 +2661,7 @@ var defaultLocale = {
2661
2661
  'audioLayoutOption': 'Layout option',
2662
2662
  'videoLayoutOption': 'Layout option',
2663
2663
  'align': 'Align',
2664
- 'caption': 'Image Caption',
2664
+ 'caption': 'Caption',
2665
2665
  'remove': 'Remove',
2666
2666
  'insertLink': 'Insert Link',
2667
2667
  'display': 'Display',
@@ -2725,14 +2725,14 @@ var defaultLocale = {
2725
2725
  'cellspacing': 'Cell Spacing',
2726
2726
  'columns': 'Number of columns',
2727
2727
  'rows': 'Number of rows',
2728
- 'tableRows': 'Table Rows',
2729
- 'tableColumns': 'Table Columns',
2728
+ 'tableRows': 'Row',
2729
+ 'tableColumns': 'Column',
2730
2730
  'tableCellHorizontalAlign': 'Table Cell Horizontal Align',
2731
- 'tableCellVerticalAlign': 'Table Vertical Align',
2731
+ 'tableCellVerticalAlign': 'Vertical Align',
2732
2732
  'createTable': 'Create Table',
2733
2733
  'removeTable': 'Remove Table',
2734
- 'tableHeader': 'Table Header',
2735
- 'tableRemove': 'Table Remove',
2734
+ 'tableHeader': 'Header Row',
2735
+ 'tableRemove': 'Delete',
2736
2736
  'tableCellBackground': 'Table Cell Background',
2737
2737
  'tableEditProperties': 'Table Edit Properties',
2738
2738
  'styles': 'Styles',
@@ -2812,6 +2812,7 @@ var defaultLocale = {
2812
2812
  'emojiPickerNoResultFound': 'No results found',
2813
2813
  'emojiPickerTrySomethingElse': 'Try something else',
2814
2814
  'linkAriaLabel': 'Open in new window',
2815
+ 'unsupportedImage': 'Unsupported file format'
2815
2816
  };
2816
2817
  var toolsLocale = {
2817
2818
  'alignments': 'alignments',
@@ -2907,7 +2908,7 @@ var toolsLocale = {
2907
2908
  'emojiPickerTypeToFind': 'Type to find',
2908
2909
  'emojiPickerNoResultFound': 'No results found',
2909
2910
  'emojiPickerTrySomethingElse': 'Try something else',
2910
- 'ImageLinkAriaLabel': 'Open in new window',
2911
+ 'imageLinkAriaLabel': 'Open in new window',
2911
2912
  };
2912
2913
  var fontNameLocale = [
2913
2914
  { locale: 'fontNameSegoeUI', value: 'Segoe UI' },
@@ -3438,6 +3439,9 @@ function updateTextNode(value, rteObj) {
3438
3439
  }
3439
3440
  var imageElm = resultElm.querySelectorAll('img');
3440
3441
  for (var i = 0; i < imageElm.length; i++) {
3442
+ if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
3443
+ continue; // Should not add the class if the image is Broken.
3444
+ }
3441
3445
  if (!imageElm[i].classList.contains(CLS_RTE_IMAGE)) {
3442
3446
  imageElm[i].classList.add(CLS_RTE_IMAGE);
3443
3447
  }
@@ -5074,7 +5078,7 @@ var ToolbarAction = /** @__PURE__ @class */ (function () {
5074
5078
  if (args.item.command === 'Lists') {
5075
5079
  if (args.originalEvent.target.classList.contains('e-caret') &&
5076
5080
  (args.originalEvent.target.parentElement.classList.contains('e-rte-bulletformatlist-dropdown') || args.originalEvent.target.parentElement.classList.contains('e-rte-numberformatlist-dropdown'))) {
5077
- args.item.command = args.item.subCommand = null;
5081
+ return;
5078
5082
  }
5079
5083
  }
5080
5084
  this.parent.notify(htmlToolbarClick, args);
@@ -5685,7 +5689,7 @@ var Toolbar$2 = /** @__PURE__ @class */ (function () {
5685
5689
  else if (Browser.isDevice || this.parent.inlineMode.enable) {
5686
5690
  this.isToolbar = true;
5687
5691
  }
5688
- if (isNullOrUndefined(trg) && this.parent.toolbarSettings.type === ToolbarType.Expand) {
5692
+ if (isNullOrUndefined(trg) && this.parent.toolbarSettings.type === ToolbarType.Expand && this.parent.toolbarModule.getExpandTBarPopHeight() === 0) {
5689
5693
  removeClass([this.tbElement], [CLS_EXPAND_OPEN]);
5690
5694
  }
5691
5695
  };
@@ -6364,7 +6368,7 @@ var BaseQuickToolbar = /** @__PURE__ @class */ (function () {
6364
6368
  e.target.classList.contains('e-imgbreak')) ? false : true;
6365
6369
  var target = !isNullOrUndefined(imgWrapper) ? imgWrapper : e.target;
6366
6370
  addClass([this.toolbarElement], [CLS_RM_WHITE_SPACE]);
6367
- var targetOffsetTop = target.offsetTop;
6371
+ var targetOffsetTop = (target.classList.contains("e-rte-audio")) ? target.parentElement.offsetTop : target.offsetTop;
6368
6372
  var parentOffsetTop = window.pageYOffset + e.parentData.top;
6369
6373
  if ((targetOffsetTop - e.editTop) > e.popHeight) {
6370
6374
  y = parentOffsetTop + e.tBarElementHeight + (targetOffsetTop - e.editTop) - e.popHeight - 5;
@@ -6377,7 +6381,7 @@ var BaseQuickToolbar = /** @__PURE__ @class */ (function () {
6377
6381
  }
6378
6382
  target = isAligned ? e.target : target;
6379
6383
  if (target.offsetWidth > e.popWidth) {
6380
- x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + target.offsetLeft;
6384
+ x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + ((target.classList.contains("e-rte-audio")) ? target.parentElement.offsetLeft : target.offsetLeft);
6381
6385
  }
6382
6386
  else {
6383
6387
  x = e.parentData.left + target.offsetLeft;
@@ -7833,7 +7837,7 @@ function updateTextNode$1(value, enterAction) {
7833
7837
  tableElm[i].classList.add('e-rte-paste-table');
7834
7838
  if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
7835
7839
  tableElm[i].classList.remove('e-rte-paste-word-table');
7836
- continue; // Sking the removal of the border if the source is from word.
7840
+ continue; // Skiping the removal of the border if the source is from word.
7837
7841
  }
7838
7842
  else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
7839
7843
  tableElm[i].classList.remove('e-rte-paste-excel-table');
@@ -7867,6 +7871,9 @@ function updateTextNode$1(value, enterAction) {
7867
7871
  }
7868
7872
  var imageElm = resultElm.querySelectorAll('img');
7869
7873
  for (var i = 0; i < imageElm.length; i++) {
7874
+ if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
7875
+ continue; // Should not add the class if the image is Broken.
7876
+ }
7870
7877
  if (!imageElm[i].classList.contains('e-rte-image')) {
7871
7878
  imageElm[i].classList.add('e-rte-image');
7872
7879
  }
@@ -7937,6 +7944,33 @@ function getDefaultMDTbStatus() {
7937
7944
  formats: null
7938
7945
  };
7939
7946
  }
7947
+ /**
7948
+ * @param {Range} range - specifies the range
7949
+ * @returns {void}
7950
+ * @hidden
7951
+ */
7952
+ function nestedListCleanUp(range) {
7953
+ if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
7954
+ range.extractContents();
7955
+ while ((range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty').length > 0 ||
7956
+ (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('ol :empty').length > 0) {
7957
+ var emptyLI = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty');
7958
+ if (emptyLI.length > 0) {
7959
+ emptyLI.forEach(function (item) {
7960
+ item.remove();
7961
+ });
7962
+ }
7963
+ }
7964
+ var liElem = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll("li");
7965
+ if (liElem.length > 0) {
7966
+ liElem.forEach(function (item) {
7967
+ if (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL") {
7968
+ item.style.listStyleType = "none";
7969
+ }
7970
+ });
7971
+ }
7972
+ }
7973
+ }
7940
7974
 
7941
7975
  /**
7942
7976
  * MarkdownToolbarStatus module for refresh the toolbar status
@@ -10911,6 +10945,9 @@ var NodeSelection = /** @__PURE__ @class */ (function () {
10911
10945
  || this.isChildNode(nodeCollection, startNode))) {
10912
10946
  return null;
10913
10947
  }
10948
+ if (startNode.nodeType === 3 && startNode.previousSibling === endNode && endNode.nodeName === 'IMG') {
10949
+ return null;
10950
+ }
10914
10951
  if (nodeCollection.indexOf(startNode.firstChild) === -1 && startNode.firstChild && !this.isChildNode(nodeCollection, startNode)) {
10915
10952
  return startNode.firstChild;
10916
10953
  }
@@ -12703,6 +12740,9 @@ var Lists = /** @__PURE__ @class */ (function () {
12703
12740
  isNullOrUndefined(item) && nodes[i].parentNode.style.listStyleType !== '') {
12704
12741
  isRevert = false;
12705
12742
  }
12743
+ if (nodes[i].parentNode.tagName === tagName && nodes[i].parentNode.style.listStyleType !== '') {
12744
+ isRevert = true;
12745
+ }
12706
12746
  }
12707
12747
  return isRevert;
12708
12748
  };
@@ -12843,8 +12883,18 @@ var Lists = /** @__PURE__ @class */ (function () {
12843
12883
  if (DEFAULT_TAG && 0 === element.querySelectorAll(BLOCK_TAGS.join(', ')).length) {
12844
12884
  var wrapperclass = isNullOrUndefined(className) ? ' class="e-rte-wrap-inner"' :
12845
12885
  ' class="' + className + ' e-rte-wrap-inner"';
12886
+ var parentElement = parentNode;
12887
+ if (!isNullOrUndefined(parentElement.style.listStyleType)) {
12888
+ parentNode.style.removeProperty("list-style-type");
12889
+ }
12890
+ if (!isNullOrUndefined(parentElement.style.listStyleImage)) {
12891
+ parentNode.style.removeProperty("list-style-image");
12892
+ }
12893
+ if (parentElement.style.length === 0) {
12894
+ parentNode.removeAttribute("style");
12895
+ }
12846
12896
  var wrapper = '<' + DEFAULT_TAG + wrapperclass +
12847
- this.domNode.attributes(parentNode) + '></' + DEFAULT_TAG + '>';
12897
+ this.domNode.attributes(parentElement) + '></' + DEFAULT_TAG + '>';
12848
12898
  if (e.enterAction !== 'BR') {
12849
12899
  this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
12850
12900
  }
@@ -13104,7 +13154,7 @@ var NodeCutter = /** @__PURE__ @class */ (function () {
13104
13154
  else if (len > -1) {
13105
13155
  this.spliceEmptyNode(fragment.childNodes[0], isStart);
13106
13156
  }
13107
- else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG' && !(fragment.classList.contains('e-video-wrap')) && !(fragment.classList.contains('e-audio-wrap'))) {
13157
+ else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG' && !(fragment.querySelectorAll('img').length > 0) && !(fragment.classList.contains('e-video-wrap')) && !(fragment.classList.contains('e-audio-wrap'))) {
13108
13158
  fragment.parentNode.removeChild(fragment);
13109
13159
  }
13110
13160
  return fragment;
@@ -13238,6 +13288,14 @@ var Formats = /** @__PURE__ @class */ (function () {
13238
13288
  }
13239
13289
  }
13240
13290
  };
13291
+ Formats.prototype.getBlockParent = function (node, endNode) {
13292
+ var currentParent;
13293
+ while (node != endNode) {
13294
+ currentParent = node;
13295
+ node = node.parentElement;
13296
+ }
13297
+ return currentParent;
13298
+ };
13241
13299
  Formats.prototype.onKeyDown = function (e) {
13242
13300
  if (e.event.which === 13) {
13243
13301
  var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
@@ -13247,6 +13305,8 @@ var Formats = /** @__PURE__ @class */ (function () {
13247
13305
  ? range.endContainer : range.endContainer.parentElement;
13248
13306
  var preElem = closest(startCon, 'pre');
13249
13307
  var endPreElem = closest(endCon, 'pre');
13308
+ var blockquoteEle = closest(startCon, 'blockquote');
13309
+ var endBlockquoteEle = closest(endCon, 'blockquote');
13250
13310
  var liParent = !isNullOrUndefined(preElem) && !isNullOrUndefined(preElem.parentElement) && preElem.parentElement.tagName === 'LI';
13251
13311
  if (liParent) {
13252
13312
  return;
@@ -13258,6 +13318,17 @@ var Formats = /** @__PURE__ @class */ (function () {
13258
13318
  range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
13259
13319
  this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, endCon, 0);
13260
13320
  }
13321
+ if (e.event.which === 13 && ((!isNullOrUndefined(blockquoteEle) && !isNullOrUndefined(endBlockquoteEle)) || (!isNullOrUndefined(blockquoteEle) && isNullOrUndefined(endBlockquoteEle)))) {
13322
+ var startParent = this.getBlockParent(range.startContainer, blockquoteEle);
13323
+ if ((startParent.textContent.charCodeAt(0) === 8203 &&
13324
+ startParent.textContent.length === 1) || startParent.textContent.length === 0) {
13325
+ if (isNullOrUndefined(startParent.nextSibling) && ((startParent.previousSibling.textContent.charCodeAt(0) === 8203 &&
13326
+ startParent.previousSibling.textContent.length === 1) || startParent.previousSibling.textContent.length === 0)) {
13327
+ e.event.preventDefault();
13328
+ this.paraFocus(startParent.parentElement); //Revert from blockquotes while pressing enter key
13329
+ }
13330
+ }
13331
+ }
13261
13332
  if (e.event.which === 13 && !isNullOrUndefined(preElem) && !isNullOrUndefined(endPreElem)) {
13262
13333
  e.event.preventDefault();
13263
13334
  this.deleteContent(range);
@@ -13481,7 +13552,7 @@ var Formats = /** @__PURE__ @class */ (function () {
13481
13552
  replaceHTML = parentNode.innerHTML;
13482
13553
  }
13483
13554
  if ((e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase() &&
13484
- (e.subCommand.toLowerCase() !== 'pre' ||
13555
+ (e.subCommand.toLowerCase() !== 'pre' && e.subCommand.toLowerCase() !== 'blockquote' ||
13485
13556
  (!isNullOrUndefined(e.exeValue) && e.exeValue.name === 'dropDownSelect'))) ||
13486
13557
  isNullOrUndefined(parentNode.parentNode) ||
13487
13558
  (parentNode.tagName === 'TABLE' && e.subCommand.toLowerCase() === 'pre')) {
@@ -13490,7 +13561,21 @@ var Formats = /** @__PURE__ @class */ (function () {
13490
13561
  this.cleanFormats(parentNode, e.subCommand);
13491
13562
  var replaceNode = (e.subCommand.toLowerCase() === 'pre' && parentNode.tagName.toLowerCase() === 'pre') ?
13492
13563
  'p' : e.subCommand;
13493
- var replaceTag = this.parent.domNode.createTagString(replaceNode, parentNode, replaceHTML.replace(/>\s+</g, '><'));
13564
+ var isToggleBlockquoteList = e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase() &&
13565
+ e.subCommand.toLowerCase() === 'blockquote' && this.parent.domNode.isList(parentNode.firstElementChild);
13566
+ var isToggleBlockquote = e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase()
13567
+ && e.subCommand.toLowerCase() === 'blockquote';
13568
+ var replaceTag = void 0;
13569
+ if (isToggleBlockquoteList) {
13570
+ replaceTag = replaceHTML.replace(/>\s+</g, '><');
13571
+ }
13572
+ else if (isToggleBlockquote) {
13573
+ var tagWrap = (e.enterAction == 'BR' || e.enterAction == 'P') ? 'P' : e.enterAction;
13574
+ replaceTag = this.parent.domNode.createTagString(tagWrap, parentNode, replaceHTML.replace(/>\s+</g, '><'));
13575
+ }
13576
+ else {
13577
+ replaceTag = this.parent.domNode.createTagString(replaceNode, parentNode, replaceHTML.replace(/>\s+</g, '><'));
13578
+ }
13494
13579
  if (parentNode.tagName === 'LI') {
13495
13580
  parentNode.innerHTML = '';
13496
13581
  parentNode.insertAdjacentHTML('beforeend', replaceTag);
@@ -13636,7 +13721,12 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13636
13721
  lasNode.textContent.length : lasNode.childNodes.length);
13637
13722
  range = nodeSelection.getRange(docElement);
13638
13723
  }
13639
- range.extractContents();
13724
+ if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
13725
+ nestedListCleanUp(range);
13726
+ }
13727
+ else {
13728
+ range.extractContents();
13729
+ }
13640
13730
  if (insertNode.tagName === 'TABLE') {
13641
13731
  this.removeEmptyElements(editNode);
13642
13732
  }
@@ -13797,12 +13887,17 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13797
13887
  preNode.parentNode.replaceChild(fragment, preNode);
13798
13888
  }
13799
13889
  else {
13890
+ var startContainerParent = range.startContainer.parentNode;
13891
+ // Get the index of the start container among its siblings
13892
+ var startIndex = Array.prototype.indexOf.call(startContainerParent.childNodes, range.startContainer);
13800
13893
  range.deleteContents();
13894
+ range.setStart(startContainerParent, startIndex);
13895
+ range.setEnd(startContainerParent, startIndex);
13801
13896
  if (!isNullOrUndefined(lasNode)) {
13802
13897
  detach(lasNode);
13803
13898
  }
13804
13899
  // eslint-disable-next-line
13805
- !isNullOrUndefined(sibNode) ? sibNode.parentNode.appendChild(fragment) : editNode.appendChild(fragment);
13900
+ !isNullOrUndefined(sibNode) ? (sibNode.parentNode === editNode ? sibNode.appendChild(fragment) : sibNode.parentNode.appendChild(fragment)) : range.insertNode(fragment);
13806
13901
  }
13807
13902
  }
13808
13903
  else {
@@ -14027,7 +14122,15 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
14027
14122
  };
14028
14123
  InsertHtml.imageFocus = function (node, nodeSelection, docElement) {
14029
14124
  var focusNode = document.createTextNode(' ');
14030
- node.parentNode.insertBefore(focusNode, node.nextSibling);
14125
+ if (node.parentNode && node.parentNode.nodeName === 'A') {
14126
+ var anchorTag = node.parentNode;
14127
+ var parentNode = anchorTag.parentNode;
14128
+ parentNode.insertBefore(focusNode, anchorTag.nextSibling);
14129
+ parentNode.insertBefore(node, focusNode);
14130
+ }
14131
+ else {
14132
+ node.parentNode.insertBefore(focusNode, node.nextSibling);
14133
+ }
14031
14134
  nodeSelection.setSelectionText(docElement, node.nextSibling, node.nextSibling, 0, 0);
14032
14135
  };
14033
14136
  // eslint-disable-next-line
@@ -15964,7 +16067,7 @@ var TableCommand = /** @__PURE__ @class */ (function () {
15964
16067
  var eleArray = elements;
15965
16068
  //eslint-disable-next-line
15966
16069
  if (min < (max = Math.min(max, eleArray[0].length - 1))) {
15967
- for (colIndex === min; colIndex <= max; colIndex++) {
16070
+ for (colIndex = min; colIndex <= max; colIndex++) {
15968
16071
  // eslint-disable-next-line
15969
16072
  if (!(min < colIndex && eleArray[0][colIndex] === eleArray[0][colIndex - 1]) && 1 < (index =
15970
16073
  Math.min(parseInt(eleArray[0][colIndex].getAttribute('colspan'), 10) || 1, max - min + 1)) &&
@@ -16651,6 +16754,29 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
16651
16754
  var nodeCutter = new NodeCutter();
16652
16755
  var isFormatted = new IsFormatted();
16653
16756
  var range = domSelection.getRange(docElement);
16757
+ var currentAnchorNode = range.startContainer.parentElement;
16758
+ if (range.collapsed && !isNullOrUndefined(currentAnchorNode) &&
16759
+ currentAnchorNode.tagName === 'A' &&
16760
+ (range.startOffset === currentAnchorNode.textContent.length || range.startOffset === 0)) {
16761
+ var emptyTextNode = document.createTextNode('');
16762
+ if (range.startOffset === 0) {
16763
+ currentAnchorNode.parentNode.insertBefore(emptyTextNode, currentAnchorNode);
16764
+ }
16765
+ else {
16766
+ if (!isNullOrUndefined(currentAnchorNode.nextSibling)) {
16767
+ currentAnchorNode.parentElement.insertBefore(emptyTextNode, currentAnchorNode.nextSibling);
16768
+ }
16769
+ else {
16770
+ currentAnchorNode.parentNode.appendChild(emptyTextNode);
16771
+ }
16772
+ }
16773
+ // Set the range to the empty text node
16774
+ var newRange = docElement.createRange();
16775
+ range.setStart(emptyTextNode, 0);
16776
+ range.setEnd(emptyTextNode, 0);
16777
+ range.collapse(true);
16778
+ domSelection.setRange(docElement, newRange);
16779
+ }
16654
16780
  if (Browser.userAgent.indexOf('Firefox') !== -1 && range.startContainer === range.endContainer && !isNullOrUndefined(endNode) && range.startContainer === endNode) {
16655
16781
  var startChildNodes = range.startContainer.childNodes;
16656
16782
  var startNode = ((startChildNodes[(range.startOffset > 0) ? (range.startOffset - 1) :
@@ -17026,7 +17152,10 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17026
17152
  }
17027
17153
  var num = index;
17028
17154
  var liChildContent = '';
17029
- while (num >= 0 && !isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
17155
+ /* eslint-disable security/detect-object-injection */
17156
+ while (num >= 0 && !isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.contains(nodes[num]) &&
17157
+ liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
17158
+ /* eslint-enable security/detect-object-injection */
17030
17159
  liChildContent = ' ' + nodes[num].textContent.trim() + liChildContent;
17031
17160
  num--;
17032
17161
  }
@@ -17098,6 +17227,23 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17098
17227
  parentElement = parentElement.parentElement;
17099
17228
  liElement = parentElement;
17100
17229
  }
17230
+ if (format === 'fontcolor') {
17231
+ var parentElem = nodes[index].parentElement;
17232
+ if (!isNullOrUndefined(parentElem) && parentElem.childNodes) {
17233
+ for (var i = 0; i < parentElem.childNodes.length; i++) {
17234
+ if (this.concatenateTextExcludingList(nodes, index) === nodes[index].textContent) {
17235
+ if (parentElem.tagName === 'LI') {
17236
+ parentElem.style.color = value;
17237
+ }
17238
+ }
17239
+ // eslint-disable-next-line
17240
+ var childElement = parentElem.childNodes[i];
17241
+ if (childElement.tagName === 'OL' || childElement.tagName === 'UL') {
17242
+ childElement.style.color = 'initial';
17243
+ }
17244
+ }
17245
+ }
17246
+ }
17101
17247
  if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' &&
17102
17248
  liElement.textContent.trim() === nodes[index].textContent.trim()) {
17103
17249
  if (format === 'fontsize') {
@@ -17397,6 +17543,18 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
17397
17543
  }
17398
17544
  }
17399
17545
  };
17546
+ SelectionCommands.concatenateTextExcludingList = function (nodes, index) {
17547
+ var result = '';
17548
+ var parentNode = nodes[index].parentElement;
17549
+ for (var i = 0; i < parentNode.childNodes.length; i++) {
17550
+ // eslint-disable-next-line
17551
+ var childNode = parentNode.childNodes[i];
17552
+ if ((childNode.nodeType === 3) || (childNode.nodeType === 1 && (childNode.tagName !== 'OL' && childNode.tagName !== 'UL'))) {
17553
+ result += childNode.textContent;
17554
+ }
17555
+ }
17556
+ return result;
17557
+ };
17400
17558
  SelectionCommands.enterAction = 'P';
17401
17559
  return SelectionCommands;
17402
17560
  }());
@@ -18114,7 +18272,6 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18114
18272
  if (patern.test(tempHTMLContent) || patern2.test(tempHTMLContent) || patern3.test(tempHTMLContent) ||
18115
18273
  pattern4.test(tempHTMLContent)) {
18116
18274
  var source = this.findSource(elm);
18117
- this.imageConversion(elm, rtfData);
18118
18275
  tempHTMLContent = tempHTMLContent.replace(/<img[^>]+>/i, '');
18119
18276
  this.addListClass(elm);
18120
18277
  listNodes = this.cleanUp(elm, listNodes);
@@ -18122,6 +18279,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18122
18279
  listNodes[0].parentElement.tagName !== 'OL') {
18123
18280
  this.listConverter(listNodes);
18124
18281
  }
18282
+ this.imageConversion(elm, rtfData);
18125
18283
  this.cleanList(elm, 'UL');
18126
18284
  this.cleanList(elm, 'OL');
18127
18285
  this.styleCorrection(elm, wordPasteStyleConfig);
@@ -18130,11 +18288,11 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18130
18288
  this.removeEmptyElements(elm);
18131
18289
  this.removeEmptyAnchorTag(elm);
18132
18290
  this.breakLineAddition(elm);
18291
+ this.processMargin(elm);
18133
18292
  this.removeClassName(elm);
18134
18293
  if (pattern4.test(tempHTMLContent)) {
18135
18294
  this.addTableBorderClass(elm);
18136
18295
  }
18137
- this.processMargin(elm);
18138
18296
  e.callBack(elm.innerHTML, this.cropImageDimensions, source);
18139
18297
  }
18140
18298
  else {
@@ -18205,8 +18363,9 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18205
18363
  imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0 &&
18206
18364
  imgElem[i].getAttribute('v:shapes').indexOf('_x0000_s') < 0 &&
18207
18365
  imgElem[i].getAttribute('v:shapes').indexOf('_x0000_i') < 0) {
18208
- detach(imgElem[i]);
18366
+ imgElem[i].classList.add('e-rte-image-unsupported');
18209
18367
  }
18368
+ imgElem[i].removeAttribute('v:shapes');
18210
18369
  }
18211
18370
  imgElem = elm.querySelectorAll('img');
18212
18371
  var imgSrc = [];
@@ -18236,6 +18395,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18236
18395
  });
18237
18396
  }
18238
18397
  }
18398
+ imgElem = elm.querySelectorAll('img:not(.e-rte-image-unsupported');
18239
18399
  for (var i = 0; i < imgElem.length; i++) {
18240
18400
  if (imgSrc[i].match(linkRegex)) {
18241
18401
  imgElem[i].setAttribute('src', imgSrc[i]);
@@ -18246,7 +18406,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18246
18406
  }
18247
18407
  else {
18248
18408
  imgElem[i].removeAttribute('src');
18249
- imgElem[i].setAttribute('alt', 'Unsupported file format');
18409
+ imgElem[i].classList.add('e-rte-image-unsupported');
18250
18410
  }
18251
18411
  if (!isNullOrUndefined(base64Src[i]) && base64Src[i].isCroppedImage) {
18252
18412
  imgElem[i].classList.add('e-img-cropped');
@@ -18254,6 +18414,10 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18254
18414
  }
18255
18415
  imgElem[i].setAttribute('id', 'msWordImg-' + imgName[i]);
18256
18416
  }
18417
+ imgElem = elm.querySelectorAll('.e-rte-image-unsupported');
18418
+ for (var i = 0; i < imgElem.length; i++) {
18419
+ imgElem[i].removeAttribute('src');
18420
+ }
18257
18421
  }
18258
18422
  };
18259
18423
  MsWordPaste.prototype.checkVShape = function (elm) {
@@ -18327,6 +18491,9 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18327
18491
  var result = [];
18328
18492
  if (!isNullOrUndefined(fullImg)) {
18329
18493
  for (var i = 0; i < fullImg.length; i++) {
18494
+ if (fullImg[i].indexOf('fIsBullet') !== -1 && fullImg[i].indexOf('wzName') === -1) {
18495
+ continue;
18496
+ }
18330
18497
  var isCroppedImage = false;
18331
18498
  var goalWidth = 0;
18332
18499
  var goalHeight = 0;
@@ -18341,7 +18508,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18341
18508
  else if (fullImg[i].indexOf('\\jpegblip') !== -1) {
18342
18509
  imgType = 'image/jpeg';
18343
18510
  }
18344
- else if (fullImg[i].indexOf('\\picprop') !== -1) {
18511
+ else if (fullImg[i].indexOf('\\emfblip') !== -1) {
18345
18512
  imgType = null;
18346
18513
  }
18347
18514
  else {
@@ -18381,7 +18548,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18381
18548
  return parseInt(result, 10);
18382
18549
  };
18383
18550
  MsWordPaste.prototype.removeClassName = function (elm) {
18384
- var elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped)');
18551
+ var elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped):not(.e-rte-image-unsupported)');
18385
18552
  for (var i = 0; i < elmWithClass.length; i++) {
18386
18553
  elmWithClass[i].removeAttribute('class');
18387
18554
  }
@@ -18654,6 +18821,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18654
18821
  MsWordPaste.prototype.listConverter = function (listNodes) {
18655
18822
  var level;
18656
18823
  var data = [];
18824
+ var listFormatOverride;
18657
18825
  var collection = [];
18658
18826
  var content = '';
18659
18827
  var stNode;
@@ -18675,6 +18843,17 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18675
18843
  else {
18676
18844
  level = 1;
18677
18845
  }
18846
+ if (content && content.indexOf('mso-list:') !== -1) {
18847
+ var msoListValue = void 0;
18848
+ if (content.match(/mso-list:[^;]+;?/)) {
18849
+ var changedContent = content.replace('\n', '').split(' ').join('');
18850
+ msoListValue = changedContent.match(/mso-list:[^;]+;?/)[0].split(':l');
18851
+ listFormatOverride = isNullOrUndefined(msoListValue) ? null : parseInt(msoListValue[1].split('level')[0], 10);
18852
+ }
18853
+ else {
18854
+ listFormatOverride = null;
18855
+ }
18856
+ }
18678
18857
  this.listContents = [];
18679
18858
  this.getListContent(listNodes[i]);
18680
18859
  var type = void 0;
@@ -18710,9 +18889,9 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18710
18889
  startAttr = this.lowerGreekNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
18711
18890
  }
18712
18891
  }
18713
- if (listNodes[i].style.marginLeft !== '') {
18714
- styleMarginLeft = listNodes[i].style.marginLeft;
18715
- }
18892
+ }
18893
+ if (listNodes[i].style.marginLeft !== '') {
18894
+ styleMarginLeft = listNodes[i].style.marginLeft;
18716
18895
  }
18717
18896
  var tempNode = [];
18718
18897
  for (var j = 1; j < this.listContents.length; j++) {
@@ -18728,7 +18907,8 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18728
18907
  currentListStyle = listNodes[i].getAttribute('style');
18729
18908
  }
18730
18909
  collection.push({
18731
- listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
18910
+ listType: type, content: tempNode, nestedLevel: level,
18911
+ listFormatOverride: listFormatOverride, class: currentClassName,
18732
18912
  listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft
18733
18913
  });
18734
18914
  }
@@ -18801,6 +18981,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18801
18981
  var prevList;
18802
18982
  var listCount = 0;
18803
18983
  var elem;
18984
+ var lfo = collection[0].listFormatOverride;
18804
18985
  for (var index = 0; index < collection.length; index++) {
18805
18986
  var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
18806
18987
  var isNormalList = false;
@@ -18817,16 +18998,24 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18817
18998
  }
18818
18999
  var pElement = createElement('p', { className: 'MsoNormal' });
18819
19000
  pElement.innerHTML = collection[index].content.join(' ');
18820
- if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
19001
+ if ((collection[index].nestedLevel === 1) &&
19002
+ (listCount === 0 || lfo !== collection[index].listFormatOverride) &&
19003
+ collection[index].content) {
18821
19004
  root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
18822
19005
  prevList = createElement('li');
18823
19006
  prevList.appendChild(pElement);
18824
19007
  temp.appendChild(prevList);
18825
19008
  temp.setAttribute('level', collection[index].nestedLevel.toString());
18826
- temp.style.marginLeft = collection[index].styleMarginLeft;
19009
+ if (collection[index].class !== 'msolistparagraph') {
19010
+ temp.style.marginLeft = collection[index].styleMarginLeft;
19011
+ }
19012
+ else {
19013
+ addClass([temp], 'marginLeftIgnore');
19014
+ }
18827
19015
  temp.style.listStyleType = collection[index].listStyleTypeName;
18828
19016
  }
18829
- else if (collection[index].nestedLevel === pLevel) {
19017
+ else if (collection[index].nestedLevel === pLevel &&
19018
+ lfo === collection[index].listFormatOverride) {
18830
19019
  if (!isNullOrUndefined(prevList) && !isNullOrUndefined(prevList.parentElement)
18831
19020
  && prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
18832
19021
  prevList.parentElement.appendChild(prevList = createElement('li'));
@@ -18889,6 +19078,12 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18889
19078
  prevList.appendChild(pElement);
18890
19079
  temp.appendChild(prevList);
18891
19080
  temp.setAttribute('level', collection[index].nestedLevel.toString());
19081
+ if (collection[index].class !== 'msolistparagraph') {
19082
+ temp.style.marginLeft = collection[index].styleMarginLeft;
19083
+ }
19084
+ else {
19085
+ addClass([temp], 'marginLeftIgnore');
19086
+ }
18892
19087
  temp.style.listStyleType = collection[index].listStyleTypeName;
18893
19088
  }
18894
19089
  }
@@ -18912,14 +19107,34 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18912
19107
  elem = elem.parentElement;
18913
19108
  if (elem.attributes.getNamedItem('level')) {
18914
19109
  // eslint-disable-next-line
18915
- if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel) {
19110
+ if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
19111
+ lfo === collection[index].listFormatOverride) {
18916
19112
  prevList = createElement('li');
18917
19113
  prevList.appendChild(pElement);
18918
19114
  elem.appendChild(prevList);
18919
19115
  break;
18920
19116
  // eslint-disable-next-line
18921
19117
  }
18922
- else if (collection[index].nestedLevel > parseInt(elem.attributes.getNamedItem('level').textContent, null)) {
19118
+ else if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
19119
+ lfo !== collection[index].listFormatOverride) {
19120
+ temp = createElement(collection[index].listType);
19121
+ prevList = createElement('li');
19122
+ temp.appendChild(prevList);
19123
+ if (collection[index].nestedLevel > 1) {
19124
+ for (var k = 0; k < collection[index].nestedLevel - 1; k++) {
19125
+ prevList.appendChild(temp = createElement(collection[index].listType));
19126
+ prevList = createElement('li');
19127
+ temp.appendChild(prevList);
19128
+ temp.style.listStyleType = 'none';
19129
+ }
19130
+ }
19131
+ prevList.appendChild(pElement);
19132
+ elem.appendChild(temp);
19133
+ temp.setAttribute('level', collection[index].nestedLevel.toString());
19134
+ temp.style.listStyleType = collection[index].listStyleTypeName;
19135
+ break;
19136
+ }
19137
+ else if (collection[index].nestedLevel > parseInt(elem.attributes.getNamedItem('level').textContent, 10)) {
18923
19138
  elem.appendChild(temp = createElement(collection[index].listType));
18924
19139
  prevList = createElement('li');
18925
19140
  prevList.appendChild(pElement);
@@ -18935,8 +19150,9 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18935
19150
  prevList.setAttribute('class', collection[index].class);
18936
19151
  prevList.setAttribute('style', (!isNullOrUndefined(collection[index].listStyle) ? collection[index].listStyle : ''));
18937
19152
  pLevel = collection[index].nestedLevel;
19153
+ lfo = collection[index].listFormatOverride;
18938
19154
  listCount++;
18939
- if (!isNullOrUndefined(collection[index].start)) {
19155
+ if (!isNullOrUndefined(collection[index].start && collection[index].start !== 1 && collection[index].listType === 'ol')) {
18940
19156
  temp.setAttribute('start', collection[index].start.toString());
18941
19157
  }
18942
19158
  }
@@ -18973,7 +19189,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18973
19189
  var liChildren = element.querySelectorAll('li');
18974
19190
  if (liChildren.length > 0) {
18975
19191
  for (var i = 0; i < liChildren.length; i++) {
18976
- if (!isNullOrUndefined((liChildren[i]).style.marginLeft)) {
19192
+ if (!isNullOrUndefined((liChildren[i]).style.marginLeft) && !liChildren[i].parentElement.classList.contains('marginLeftIgnore')) {
18977
19193
  (liChildren[i]).style.marginLeft = '';
18978
19194
  }
18979
19195
  }
@@ -18987,6 +19203,17 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18987
19203
  }
18988
19204
  }
18989
19205
  }
19206
+ var ignoredNode = element.querySelectorAll('.marginLeftIgnore li');
19207
+ if (ignoredNode.length > 0) {
19208
+ for (var i = 0; i < ignoredNode.length; i++) {
19209
+ if (!isNullOrUndefined((ignoredNode[i]).style.marginLeft) && (ignoredNode[i]).style.marginLeft !== '') {
19210
+ var marginLeft = (ignoredNode[i]).style.marginLeft;
19211
+ var marginLeftValue = parseFloat(marginLeft.split('in')[0]);
19212
+ var result = marginLeftValue - 0.5;
19213
+ (ignoredNode[i]).style.marginLeft = result.toString() + 'in';
19214
+ }
19215
+ }
19216
+ }
18990
19217
  };
18991
19218
  MsWordPaste.prototype.removeEmptyAnchorTag = function (element) {
18992
19219
  var removableElement = element.querySelectorAll('a:not([href])');
@@ -20559,7 +20786,7 @@ var __extends$3 = (undefined && undefined.__extends) || (function () {
20559
20786
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
20560
20787
  };
20561
20788
  })();
20562
- var IFRAMEHEADER = "\n<!DOCTYPE html> \n <html>\n <head>\n <meta charset='utf-8' /> \n <style>\n @charset \"UTF-8\";\n body {\n font-family: \"Roboto\", sans-serif;\n font-size: 14px;\n }\n html, body{height: 100%;margin: 0;}\n body.e-cursor{cursor:default}\n span.e-selected-node\t{background-color: #939393;color: white;}\n span.e-selected-node.e-highlight {background-color: #1d9dd8;}\n body{color:#333;word-wrap:break-word;padding: 8px;box-sizing: border-box;}\n .e-rte-image, .e-rte-audio, .e-rte-video {border: 0;cursor: pointer;display:\n block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-imginline, .e-rte-audio.e-audio-inline, .e-rte-video.e-video-inline {display: inline-block;float: none;max-width: calc(100% - (2 * 5px));padding: 1px;vertical-align: bottom;}\n .e-rte-image.e-imgcenter, .e-rte-video.e-video-center {cursor: pointer;display: block;float: none;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-imgright, .e-rte-video.e-video-right { float: right; margin: 0 auto;margin-left: 5px;text-align: right;}\n .e-rte-image.e-imgleft, .e-rte-video.e-video-left {float: left;margin: 0 auto;margin-right: 5px;text-align: left;}\n .e-img-caption { display: inline-block; float: none; margin: 5px auto; max-width: 100%;position: relative;}\n .e-img-caption.e-caption-inline {display: inline-block;float: none;\n margin: 5px auto;margin-left: 5px;margin-right: 5px;max-width: calc(100% - (2 * 5px));\n position: relativetext-align: center;vertical-align: bottom;}\n .e-img-inner {box-sizing: border-box;display: block;font-size: 16px;font-weight: initial;\n margin: auto;opacity: .9;text-align: center;width: 100%;}\n .e-img-wrap {display: inline-block;margin: auto;padding: 0;text-align: center;width: 100%;}\n .e-imgleft, .e-video-left {float: left;margin: 0 5px 0 0;text-align: left;}\n .e-imgright, .e-video-right {float: right;margin: 0 0 0 5px;text-align: right;}\n .e-imgcenter, .e-video-center {cursor: pointer;display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-control img:not(.e-resize) {border: 2px solid transparent; z-index: 1000}\n .e-imginline , .e-audio-inline, .e-video-inline {display: inline-block;float: none;margin-left: 5px;margin-right: 5px;\n max-width: calc(100% - (2 * 5px));vertical-align: bottom;}\n .e-imgbreak, .e-audio-break, .e-video-break {border: 0;cursor: pointer;\n display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-img-focus:not(.e-resize), .e-audio-focus:not(.e-resize), .e-video-focus:not(.e-resize) {border: solid 2px #4a90e2;}\n img.e-img-focus::selection, audio.e-audio-focus::selection, .e-video-focus::selection { background: transparent;color: transparent;}\n span.e-rte-imageboxmark { width: 10px; height: 10px; position: absolute; display: block;\n background: #4a90e2; border: 1px solid #fff; z-index: 1000;}\n .e-mob-rte.e-mob-span span.e-rte-imageboxmark { background: #4a90e2; border: 1px solid #fff; }\n .e-mob-rte span.e-rte-imageboxmark { background: #fff; border: 1px solid #4a90e2;\n border-radius: 15px; height: 20px; width: 20px; }\n .e-mob-rte.e-mob-span span.e-rte-imageboxmark { background: #4a90e2; border: 1px solid #fff; }\n .e-rte-content .e-content img.e-resize, .e-rte-content .e-content video.e-resize { z-index: 1000; }\n .e-img-caption .e-img-inner { outline: 0; }\n .e-img-caption a:focus-visible { outline: none; }\n .e-img-caption .e-rte-image.e-imgright, .e-img-caption .e-rte-image.e-imgleft { float: none; margin: 0;}\n body{box-sizing: border-box;min-height: 100px;outline: 0 solid transparent;\n overflow-x: auto;padding: 16px;position: relative;text-align: inherit;z-index: 2;}\n p{margin: 0 0 10px;margin-bottom: 10px;}\n li{margin-bottom: 10px;}\n h1{font-size: 2.17em;font-weight: 400;line-height: 1;margin: 10px 0;}\n h2{font-size: 1.74em;font-weight: 400;margin: 10px 0;}\n h3{font-size: 1.31em;font-weight: 400;margin: 10px 0;}\n h4{font-size: 16px;font-weight: 400;line-height: 1.5;margin: 0;}\n h5{font-size: 00.8em;font-weight: 400;margin: 0;}\n h6{font-size: 00.65em;font-weight: 400;margin: 0;}\n blockquote{margin: 10px 0;margin-left: 0;padding-left: 5px;border-left: solid 2px #5c5c5c;}\n pre{background-color: inherit;border: 0;border-radius: 0;color: #333;\n font-size: inherit;line-height: inherit;margin: 0 0 10px;overflow: visible;padding: 0;\n white-space: pre-wrap;word-break: inherit;word-wrap: break-word;}\n strong, b{font-weight: 700;}\n a{text-decoration: none;user-select: auto;}\n a:hover{text-decoration: underline;};\n p:last-child, pre:last-child, blockquote:last-child{margin-bottom: 0;}\n h3+h4, h4+h5, h5+h6{margin-top: 00.6em;}\n ul:last-child{margin-bottom: 0;}\n table { border-collapse: collapse; empty-cells: show;}\n table td,table th {border: 1px solid #BDBDBD; height: 20px; padding: 2px 5px; vertical-align: middle;}\n table.e-alternate-border tbody tr:nth-child(2n) {background-color: #F5F5F5;}\n table th {background-color: #E0E0E0;}\n table.e-dashed-border td,table.e-dashed-border th { border: 1px dashed #BDBDBD} \n table .e-cell-select {border: 1px double #4a90e2;}\n span.e-table-box { cursor: nwse-resize; display: block; height: 10px; position: absolute; width: 10px; }\n span.e-table-box.e-rmob {height: 14px;width: 14px;}\n .e-row-resize, .e-column-resize { background-color: transparent; background-repeat: repeat;\n bottom: 0;cursor: col-resize;height: 1px;overflow: visible;position: absolute;width: 1px; }\n .e-row-resize { cursor: row-resize; height: 1px;}\n .e-table-rhelper { cursor: col-resize; opacity: .87;position: absolute;}\n .e-table-rhelper.e-column-helper { width: 1px; }\n .e-table-rhelper.e-row-helper {height: 1px;}\n .e-reicon::before { border-bottom: 6px solid transparent; border-right: 6px solid;\n border-top: 6px solid transparent; content: ''; display: block; height: 0;\n position: absolute; right: 4px; top: 4px; width: 20px; }\n .e-reicon::after { border-bottom: 6px solid transparent; border-left: 6px solid;\n border-top: 6px solid transparent; content: ''; display: block;\n height: 0; left: 4px; position: absolute; top: 4px; width: 20px; z-index: 3; }\n .e-row-helper.e-reicon::after { top: 10px; transform: rotate(90deg); }\n .e-row-helper.e-reicon::before { left: 4px; top: -20px; transform: rotate(90deg); }\n span.e-table-box { background-color: #ffffff; border: 1px solid #BDBDBD; }\n span.e-table-box.e-rbox-select { background-color: #BDBDBD; border: 1px solid #BDBDBD; }\n .e-table-rhelper { background-color: #4a90e2;}\n .e-rtl { direction: rtl; }\n .e-rte-placeholder::before { content: attr(placeholder); opacity: 0.54; overflow: hidden; padding-top: 16px; position: absolute; text-align: start; top: 0; z-index: 1; }\n </style>\n </head>";
20789
+ var IFRAMEHEADER = "\n<!DOCTYPE html> \n <html>\n <head>\n <meta charset='utf-8' /> \n <style>\n @charset \"UTF-8\";\n body {\n font-family: \"Roboto\", sans-serif;\n font-size: 14px;\n }\n html, body{height: 100%;margin: 0;}\n body.e-cursor{cursor:default}\n span.e-selected-node\t{background-color: #939393;color: white;}\n span.e-selected-node.e-highlight {background-color: #1d9dd8;}\n body{color:#333;word-wrap:break-word;padding: 8px;box-sizing: border-box;}\n .e-rte-image, .e-rte-video {border: 0;cursor: pointer;display:\n block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-audio {border: 0;cursor: pointer;display:\n block;float: none;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-imginline, .e-rte-audio.e-audio-inline, .e-rte-video.e-video-inline {display: inline-block;float: none;max-width: calc(100% - (2 * 5px));padding: 1px;vertical-align: bottom;}\n .e-rte-image.e-imgcenter, .e-rte-video.e-video-center {cursor: pointer;display: block;float: none;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-imgright, .e-rte-video.e-video-right { float: right; margin: 0 auto;margin-left: 5px;text-align: right;}\n .e-rte-image.e-imgleft, .e-rte-video.e-video-left {float: left;margin: 0 auto;margin-right: 5px;text-align: left;}\n .e-img-caption { display: inline-block; float: none; margin: 5px auto; max-width: 100%;position: relative;}\n .e-img-caption.e-caption-inline {display: inline-block;float: none;\n margin: 5px auto;margin-left: 5px;margin-right: 5px;max-width: calc(100% - (2 * 5px));\n position: relativetext-align: center;vertical-align: bottom;}\n .e-rte-img-caption.e-imgcenter {display: contents; margin-left: auto; margin-right: auto;}\n .e-rte-img-caption.e-imgright {display: contents; margin-left: auto; margin-right: 0;}\n .e-rte-img-caption.e-imgleft {display: contents;margin-left: 0;margin-right: auto;}\n .e-img-caption.e-rte-img-caption.e-imgbreak {display: contents;}\n .e-img-inner {box-sizing: border-box;display: block;font-size: 16px;font-weight: initial;\n margin: auto;opacity: .9;text-align: center;width: 100%;}\n .e-img-wrap {display: inline-block;margin: auto;padding: 0;text-align: center;width: 100%;}\n .e-imgleft, .e-video-left {float: left;margin: 0 5px 0 0;text-align: left;}\n .e-imgright, .e-video-right {float: right;margin: 0 0 0 5px;text-align: right;}\n .e-imgcenter, .e-video-center {cursor: pointer;display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-control img:not(.e-resize) {border: 2px solid transparent; z-index: 1000}\n .e-imginline , .e-audio-inline, .e-video-inline {display: inline-block;float: none;margin-left: 5px;margin-right: 5px;\n max-width: calc(100% - (2 * 5px));vertical-align: bottom;}\n .e-imgbreak, .e-audio-break, .e-video-break {border: 0;cursor: pointer;\n display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}\n .e-rte-image.e-img-focus:not(.e-resize), .e-audio-focus:not(.e-resize), .e-video-focus:not(.e-resize) {border: solid 2px #4a90e2;}\n img.e-img-focus::selection, audio.e-audio-focus::selection, .e-video-focus::selection { background: transparent;color: transparent;}\n span.e-rte-imageboxmark, span.e-rte-videoboxmark { width: 10px; height: 10px; position: absolute; display: block;\n background: #4a90e2; border: 1px solid #fff; z-index: 1000;}\n .e-mob-rte.e-mob-span span.e-rte-imageboxmark, .e-mob-rte.e-mob-span span.e-rte-videoboxmark { background: #4a90e2; border: 1px solid #fff; }\n .e-mob-rte span.e-rte-imageboxmark, .e-mob-rte span.e-rte-videoboxmark { background: #fff; border: 1px solid #4a90e2;\n border-radius: 15px; height: 20px; width: 20px; }\n .e-mob-rte.e-mob-span span.e-rte-imageboxmark, .e-mob-rte.e-mob-span span.e-rte-videoboxmark { background: #4a90e2; border: 1px solid #fff; }\n .e-rte-content .e-content img.e-resize, .e-rte-content .e-content video.e-resize { z-index: 1000; }\n .e-img-caption .e-img-inner { outline: 0; }\n .e-img-caption a:focus-visible { outline: none; }\n .e-img-caption .e-rte-image.e-imgright, .e-img-caption .e-rte-image.e-imgleft { float: none; margin: 0;}\n body{box-sizing: border-box;min-height: 100px;outline: 0 solid transparent;\n overflow-x: auto;padding: 16px;position: relative;text-align: inherit;z-index: 2;}\n p{margin: 0 0 10px;margin-bottom: 10px;}\n li{margin-bottom: 10px;}\n h1{font-size: 2.17em;font-weight: 400;line-height: 1;margin: 10px 0;}\n h2{font-size: 1.74em;font-weight: 400;margin: 10px 0;}\n h3{font-size: 1.31em;font-weight: 400;margin: 10px 0;}\n h4{font-size: 16px;font-weight: 400;line-height: 1.5;margin: 0;}\n h5{font-size: 00.8em;font-weight: 400;margin: 0;}\n h6{font-size: 00.65em;font-weight: 400;margin: 0;}\n blockquote{margin: 10px 0;margin-left: 0;padding-left: 5px;border-left: solid 2px #5c5c5c;}\n pre{background-color: inherit;border: 0;border-radius: 0;color: #333;\n font-size: inherit;line-height: inherit;margin: 0 0 10px;overflow: visible;padding: 0;\n white-space: pre-wrap;word-break: inherit;word-wrap: break-word;}\n strong, b{font-weight: 700;}\n a{text-decoration: none;user-select: auto;}\n a:hover{text-decoration: underline;};\n p:last-child, pre:last-child, blockquote:last-child{margin-bottom: 0;}\n h3+h4, h4+h5, h5+h6{margin-top: 00.6em;}\n ul:last-child{margin-bottom: 0;}\n table { border-collapse: collapse; empty-cells: show;}\n table td,table th {border: 1px solid #BDBDBD; height: 20px; padding: 2px 5px; vertical-align: middle;}\n table.e-alternate-border tbody tr:nth-child(2n) {background-color: #F5F5F5;}\n table th {background-color: #E0E0E0;}\n table.e-dashed-border td,table.e-dashed-border th { border: 1px dashed #BDBDBD} \n table .e-cell-select {border: 1px double #4a90e2;}\n span.e-table-box { cursor: nwse-resize; display: block; height: 10px; position: absolute; width: 10px; }\n span.e-table-box.e-rmob {height: 14px;width: 14px;}\n .e-row-resize, .e-column-resize { background-color: transparent; background-repeat: repeat;\n bottom: 0;cursor: col-resize;height: 1px;overflow: visible;position: absolute;width: 1px; }\n .e-row-resize { cursor: row-resize; height: 1px;}\n .e-table-rhelper { cursor: col-resize; opacity: .87;position: absolute;}\n .e-table-rhelper.e-column-helper { width: 1px; }\n .e-table-rhelper.e-row-helper {height: 1px;}\n .e-reicon::before { border-bottom: 6px solid transparent; border-right: 6px solid;\n border-top: 6px solid transparent; content: ''; display: block; height: 0;\n position: absolute; right: 4px; top: 4px; width: 20px; }\n .e-reicon::after { border-bottom: 6px solid transparent; border-left: 6px solid;\n border-top: 6px solid transparent; content: ''; display: block;\n height: 0; left: 4px; position: absolute; top: 4px; width: 20px; z-index: 3; }\n .e-row-helper.e-reicon::after { top: 10px; transform: rotate(90deg); }\n .e-row-helper.e-reicon::before { left: 4px; top: -20px; transform: rotate(90deg); }\n span.e-table-box { background-color: #ffffff; border: 1px solid #BDBDBD; }\n span.e-table-box.e-rbox-select { background-color: #BDBDBD; border: 1px solid #BDBDBD; }\n .e-table-rhelper { background-color: #4a90e2;}\n .e-rtl { direction: rtl; }\n .e-rte-placeholder::before { content: attr(placeholder); opacity: 0.54; overflow: hidden; padding-top: 16px; position: absolute; text-align: start; top: 0; z-index: 1; }\n </style>\n </head>";
20563
20790
  /**
20564
20791
  * Content module is used to render Rich Text Editor content
20565
20792
  *
@@ -20983,9 +21210,12 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
20983
21210
  var range = this.parent.getRange();
20984
21211
  // eslint-disable-next-line
20985
21212
  var regEx = new RegExp(String.fromCharCode(8203), 'g');
21213
+ var isEmptyNode = range.startContainer === range.endContainer && range.startOffset === range.endOffset &&
21214
+ range.startOffset === 1 && range.startContainer.textContent.length === 1 && range.startContainer.textContent.charCodeAt(0) == 8203 &&
21215
+ range.startContainer.textContent.replace(regEx, '').length === 0;
20986
21216
  var pointer;
20987
21217
  var isRootParent = false;
20988
- if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
21218
+ if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
20989
21219
  pointer = range.startOffset;
20990
21220
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
20991
21221
  range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
@@ -21108,8 +21338,13 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
21108
21338
  else {
21109
21339
  this.parent.notify(enterHandler, { args: e.args });
21110
21340
  var newRange = this.parent.getRange();
21111
- if (!isNullOrUndefined(newRange.startContainer) && newRange.startContainer === this.parent.inputElement.lastChild && newRange.startContainer.nodeName !== '#text' && this.parent.height !== 'auto') {
21112
- newRange.startContainer.scrollIntoView({ block: "end", inline: "nearest" });
21341
+ if (!isNullOrUndefined(newRange.startContainer) && this.parent.height !== 'auto' && newRange.startContainer.nodeName !== '#text'
21342
+ && !this.parent.iframeSettings.enable && newRange.startContainer.getBoundingClientRect().bottom > this.parent.element.getBoundingClientRect().bottom) {
21343
+ this.parent.element.querySelector('.e-rte-content').scrollTop += newRange.startContainer.getBoundingClientRect().bottom - this.parent.element.getBoundingClientRect().bottom;
21344
+ }
21345
+ else if (!isNullOrUndefined(newRange.startContainer) && this.parent.height === 'auto' && newRange.startContainer.nodeName !== '#text'
21346
+ && !this.parent.iframeSettings.enable && window.innerHeight < newRange.startContainer.getBoundingClientRect().top) {
21347
+ newRange.startContainer.scrollIntoView({ block: 'end', inline: 'nearest' });
21113
21348
  }
21114
21349
  }
21115
21350
  }
@@ -21191,11 +21426,13 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
21191
21426
  currentRange.startContainer.previousSibling.nodeName === 'SPAN') {
21192
21427
  isPreviousNotContentEditable = currentRange.startContainer.previousSibling.contentEditable === 'false' ? false : true;
21193
21428
  }
21429
+ var checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
21430
+ var isSelectedPositionNotStart = closest(currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer, 'li') ?
21431
+ checkNode.nodeName !== 'li' && isNullOrUndefined(checkNode.previousSibling) : true;
21194
21432
  if (e.args.code === 'Backspace' && e.args.keyCode === 8 && currentRange.startOffset === 0 &&
21195
21433
  currentRange.endOffset === 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.textContent.length > 0 &&
21196
21434
  currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH' &&
21197
- isPreviousNotContentEditable) {
21198
- var checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
21435
+ isPreviousNotContentEditable && isSelectedPositionNotStart) {
21199
21436
  if ((!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
21200
21437
  !isNullOrUndefined(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') ||
21201
21438
  (!isNullOrUndefined(currentRange.startContainer.previousSibling) && currentRange.startContainer.previousSibling.nodeName === 'BR')) {
@@ -21207,7 +21444,8 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
21207
21444
  if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
21208
21445
  this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
21209
21446
  liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
21210
- if (!isNullOrUndefined(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR') {
21447
+ if (!isNullOrUndefined(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR' &&
21448
+ isNullOrUndefined(liElement.lastElementChild.previousSibling)) {
21211
21449
  this.rangeElement = liElement.lastElementChild;
21212
21450
  isLiElement = true;
21213
21451
  }
@@ -21499,9 +21737,11 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
21499
21737
  this.tooltipTargetEle = closest(args.originalEvent.target, '[data-tooltip-id]');
21500
21738
  if (!isNullOrUndefined(this.tooltipTargetEle) && this.parent.showTooltip && !isNullOrUndefined(currentDocument.querySelector('.e-tooltip-wrap'))) {
21501
21739
  this.parent.notify(destroyTooltip, { args: event });
21502
- this.tooltipTargetEle.setAttribute('data-title', this.tooltipTargetEle.getAttribute('title'));
21503
- this.tooltipTargetEle.removeAttribute('title');
21504
- EventHandler.add(this.tooltipTargetEle, 'mouseout', this.mouseOutHandler, this);
21740
+ if (!this.tooltipTargetEle.closest('.e-rte-quick-popup')) {
21741
+ this.tooltipTargetEle.setAttribute('data-title', this.tooltipTargetEle.getAttribute('title'));
21742
+ this.tooltipTargetEle.removeAttribute('title');
21743
+ EventHandler.add(this.tooltipTargetEle, 'mouseout', this.mouseOutHandler, this);
21744
+ }
21505
21745
  }
21506
21746
  if (item.command !== 'FormatPainter') {
21507
21747
  if (closestElement && !closestElement.classList.contains('e-rte-inline-popup') && !closestElement.classList.contains('e-rte-text-popup')) {
@@ -21795,6 +22035,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
21795
22035
  this.parent.on(pasteClean, this.pasteClean, this);
21796
22036
  this.parent.on(bindCssClass, this.setCssClass, this);
21797
22037
  this.parent.on(destroy, this.destroy, this);
22038
+ this.parent.on(docClick, this.docClick, this);
21798
22039
  };
21799
22040
  PasteCleanup.prototype.destroy = function () {
21800
22041
  this.removeEventListener();
@@ -21806,6 +22047,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
21806
22047
  this.parent.off(pasteClean, this.pasteClean);
21807
22048
  this.parent.off(bindCssClass, this.setCssClass);
21808
22049
  this.parent.off(destroy, this.destroy);
22050
+ this.parent.off(docClick, this.docClick);
21809
22051
  };
21810
22052
  PasteCleanup.prototype.pasteClean = function (e) {
21811
22053
  var _this = this;
@@ -21875,6 +22117,12 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
21875
22117
  this.saveSelection = this.nodeSelectionObj.save(range, currentDocument);
21876
22118
  var tempDivElem = this.parent.createElement('div');
21877
22119
  tempDivElem.innerHTML = value;
22120
+ var unsupportedImg = tempDivElem.querySelectorAll('.e-rte-image-unsupported');
22121
+ for (var index = 0; index < unsupportedImg.length; index++) {
22122
+ unsupportedImg[index].setAttribute('alt', this.i10n.getConstant('unsupportedImage'));
22123
+ unsupportedImg[index].classList.remove('e-rte-image-unsupported');
22124
+ }
22125
+ value = tempDivElem.innerHTML;
21878
22126
  var isValueNotEmpty = tempDivElem.textContent !== '' || !isNullOrUndefined(tempDivElem.querySelector('img')) ||
21879
22127
  !isNullOrUndefined(tempDivElem.querySelector('table'));
21880
22128
  this.parent.notify(cleanupResizeElements, {
@@ -22157,7 +22405,9 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
22157
22405
  });
22158
22406
  popupObj.close();
22159
22407
  imgElem.style.opacity = '1';
22160
- uploadObj.destroy();
22408
+ if (!uploadObj.isDestroyed) {
22409
+ uploadObj.destroy();
22410
+ }
22161
22411
  this.toolbarEnableDisable(false);
22162
22412
  };
22163
22413
  PasteCleanup.prototype.refreshPopup = function (imageElement, popupObj) {
@@ -22308,7 +22558,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
22308
22558
  width: '300px',
22309
22559
  height: '265px',
22310
22560
  cssClass: CLS_RTE_DIALOG_MIN_HEIGHT,
22311
- isModal: true,
22561
+ isModal: Browser.isDevice,
22312
22562
  visible: false
22313
22563
  };
22314
22564
  this.dialogObj = this.dialogRenderObj.render(dialogModel);
@@ -22362,13 +22612,22 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
22362
22612
  this.updateCss(this.keepRadioButton, e);
22363
22613
  };
22364
22614
  PasteCleanup.prototype.destroyDialog = function (rteDialogWrapper) {
22365
- var rteDialogContainer = this.parent.element.querySelector('.e-dlg-container');
22615
+ var rteDialogContainer = this.parent.element.querySelector('.e-rte-dialog-minheight');
22366
22616
  detach(rteDialogContainer);
22367
22617
  var rteDialogWrapperChildLength = rteDialogWrapper.children.length;
22368
22618
  for (var i = 0; i < rteDialogWrapperChildLength; i++) {
22369
22619
  detach(rteDialogWrapper.children[0]);
22370
22620
  }
22371
22621
  };
22622
+ PasteCleanup.prototype.docClick = function (e) {
22623
+ var target = e.args.target;
22624
+ if (target && target.classList && ((this.dialogObj && !closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']')))
22625
+ && (!target.classList.contains('e-toolbar-item'))) {
22626
+ if (this.dialogObj) {
22627
+ this.dialogObj.hide();
22628
+ }
22629
+ }
22630
+ };
22372
22631
  PasteCleanup.prototype.cleanAppleClass = function (elem) {
22373
22632
  var appleClassElem = elem.querySelectorAll('br.Apple-interchange-newline');
22374
22633
  for (var i = 0; i < appleClassElem.length; i++) {
@@ -22442,7 +22701,8 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
22442
22701
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, function (returnArgs) {
22443
22702
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
22444
22703
  _this.parent.formatter.onSuccess(_this.parent, args);
22445
- if (!isNullOrUndefined(returnArgs.elements) && !isNullOrUndefined(returnArgs.imgElem)) {
22704
+ if (!isNullOrUndefined(returnArgs.elements) && !isNullOrUndefined(returnArgs.imgElem) &&
22705
+ returnArgs.imgElem.length > 0) {
22446
22706
  var pasteContent = returnArgs.elements;
22447
22707
  var imageContent = returnArgs.imgElem;
22448
22708
  var lastElementChild = _this.findLastElement(pasteContent[pasteContent.length - 1]);
@@ -22511,6 +22771,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
22511
22771
  }
22512
22772
  };
22513
22773
  PasteCleanup.prototype.addTableClass = function (element, source) {
22774
+ source = isNullOrUndefined(source) ? '' : source;
22514
22775
  var tableElement = element.querySelectorAll('table');
22515
22776
  for (var i = 0; i < tableElement.length; i++) {
22516
22777
  if (!tableElement[i].classList.contains('e-rte-table') && (source === 'html' || source === '')) {
@@ -26135,7 +26396,7 @@ var Image$1 = /** @__PURE__ @class */ (function () {
26135
26396
  this.checkBoxObj.createElement = this.parent.createElement;
26136
26397
  this.checkBoxObj.appendTo(linkTarget);
26137
26398
  var target_1 = this.checkBoxObj.checked ? '_blank' : null;
26138
- var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : null;
26399
+ var imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null;
26139
26400
  var linkUpdate = this.i10n.getConstant('dialogUpdate');
26140
26401
  var linkargs_1 = {
26141
26402
  args: e.args,
@@ -26255,14 +26516,14 @@ var Image$1 = /** @__PURE__ @class */ (function () {
26255
26516
  }
26256
26517
  if (e.selectNode[0].parentElement.nodeName === 'A') {
26257
26518
  proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
26258
- url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : null, selectNode: e.selectNode,
26519
+ url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
26259
26520
  subCommand: e.args.item.subCommand
26260
26521
  });
26261
26522
  proxy.dialogObj.hide({ returnValue: true });
26262
26523
  return;
26263
26524
  }
26264
26525
  proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
26265
- url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : null, selectNode: e.selectNode,
26526
+ url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
26266
26527
  subCommand: e.args.item.subCommand, selection: e.selection
26267
26528
  });
26268
26529
  var captionEle = closest(e.selectNode[0], '.e-img-caption');
@@ -28305,6 +28566,7 @@ var Video = /** @__PURE__ @class */ (function () {
28305
28566
  this.isAllowedTypes = true;
28306
28567
  this.pageX = null;
28307
28568
  this.pageY = null;
28569
+ this.mouseX = null;
28308
28570
  this.deletedVid = [];
28309
28571
  this.parent = parent;
28310
28572
  this.rteID = parent.element.id;
@@ -28704,62 +28966,50 @@ var Video = /** @__PURE__ @class */ (function () {
28704
28966
  if (isNullOrUndefined(vidEleStyle)) {
28705
28967
  return;
28706
28968
  }
28707
- // eslint-disable-next-line
28969
+ /* eslint-disable */
28708
28970
  var width = vidEleStyle.width !== '' ? vidEleStyle.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(vidEleStyle.width) :
28709
28971
  parseInt(vidEleStyle.width, 10) : vid.style.width !== '' ? vid.style.width : vid.width;
28710
28972
  var height = vidEleStyle.height !== '' ? parseInt(vidEleStyle.height, 10) : vid.style.height !== '' ? vid.style.height : vid.height;
28973
+ width = width.toString().match(/\b\d+(\.\d*)?(%|$)\b/g) ? parseFloat(width.toString()) : parseInt(width.toString(), 10);
28974
+ height = height.toString().match(/\b\d+(\.\d*)?(%|$)\b/g) ? parseFloat(height.toString()) : parseInt(height.toString(), 10);
28975
+ /* eslint-enable */
28711
28976
  if (width > height) {
28712
28977
  vid.style.minWidth = this.parent.insertVideoSettings.minWidth === 0 ? '200px' : formatUnit(this.parent.insertVideoSettings.minWidth);
28713
28978
  vid.style.minHeight = this.parent.insertVideoSettings.minHeight === 0 ? '90px' : formatUnit(this.parent.insertVideoSettings.minHeight);
28714
28979
  if (this.parent.insertVideoSettings.resizeByPercent) {
28715
- if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
28716
- var percentageValue = this.pixToPerc((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY), (vid.previousElementSibling || vid.parentElement));
28717
- vid.style.width = Math.min(Math.round((percentageValue / vid.getBoundingClientRect().width) * expectedX * 100) / 100, 100) + '%';
28718
- }
28719
- else {
28720
- vid.style.width = this.pixToPerc(parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY, (vid.previousElementSibling || vid.parentElement)) + '%';
28721
- }
28722
- vid.style.height = null;
28723
- vid.removeAttribute('height');
28980
+ this.updateVidEleWidth(vid, width, height, expectedX, expectedY);
28724
28981
  }
28725
28982
  else if ((vid.style.width === '' && vid.style.height !== '') || (vidEleStyle.width === '' && vidEleStyle.height !== '')) {
28726
28983
  vid.style.height = expectedY + 'px';
28727
28984
  }
28728
28985
  else if ((vid.style.width !== '' && vid.style.height === '') || (vidEleStyle.width !== '' && vidEleStyle.height === '')) {
28729
- var currentWidth = ((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) +
28730
- parseInt(width.toString(), 10) / parseInt(height.toString(), 10)) <
28986
+ var currentWidth = ((width / height * expectedY) +
28987
+ width / height) <
28731
28988
  (this.parent.inputElement.getBoundingClientRect().right - 32) ?
28732
- ((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) +
28733
- parseInt(width.toString(), 10) / parseInt(height.toString(), 10)) :
28989
+ ((width / height * expectedY) +
28990
+ width / height) :
28734
28991
  (this.parent.inputElement.getBoundingClientRect().right - 32);
28735
28992
  vid.style.width = currentWidth.toString() + 'px';
28736
28993
  }
28737
28994
  else if (vid.style.width !== '' || vidEleStyle.width !== '') {
28738
- var currentWidth = (parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) <
28995
+ var currentWidth = (width / height * expectedY) <
28739
28996
  (this.parent.inputElement.getBoundingClientRect().right - 32) ?
28740
- (parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) :
28997
+ (width / height * expectedY) :
28741
28998
  (this.parent.inputElement.getBoundingClientRect().right - 32);
28742
28999
  vid.style.width = currentWidth + 'px';
28743
29000
  vid.style.height = expectedY + 'px';
28744
29001
  }
28745
29002
  else {
28746
- vid.setAttribute('width', (parseInt(((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) + parseInt(width.toString(), 10) / parseInt(height.toString(), 10)).toString(), 10)).toString());
29003
+ vid.setAttribute('width', (parseInt(((width / height * expectedY) + width / height).toString(), 10)).toString());
28747
29004
  }
28748
29005
  }
28749
29006
  else if (height > width) {
28750
29007
  if (this.parent.insertVideoSettings.resizeByPercent) {
28751
- if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
28752
- vid.style.width = Math.min(Math.round((parseInt(width.toString(), 10) / vid.getBoundingClientRect().width) * expectedX * 100) / 100, 100) + '%';
28753
- }
28754
- else {
28755
- vid.style.width = this.pixToPerc((expectedX / parseInt(height.toString(), 10) * expectedY), (vid.previousElementSibling || vid.parentElement)) + '%';
28756
- }
28757
- vid.style.height = null;
28758
- vid.removeAttribute('height');
29008
+ this.updateVidEleWidth(vid, width, height, expectedX, expectedY);
28759
29009
  }
28760
29010
  else if (vid.style.width !== '' || vidEleStyle.width !== '') {
28761
29011
  vid.style.width = expectedX + 'px';
28762
- vid.style.height = (parseInt(height.toString(), 10) / parseInt(width.toString(), 10) * expectedX) + 'px';
29012
+ vid.style.height = (height / width * expectedX) + 'px';
28763
29013
  }
28764
29014
  else {
28765
29015
  vid.setAttribute('width', this.resizeBtnStat.botRight ? (this.getPointX(e.event) - vid.getBoundingClientRect().left).toString() : expectedX.toString());
@@ -28777,6 +29027,23 @@ var Video = /** @__PURE__ @class */ (function () {
28777
29027
  }
28778
29028
  }
28779
29029
  };
29030
+ Video.prototype.updateVidEleWidth = function (vid, width, height, expectedX, expectedY) {
29031
+ if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
29032
+ var original = vid.offsetWidth + this.mouseX;
29033
+ var finalWidthByPerc = (original / vid.offsetWidth) * (parseFloat(vid.style.width).toString() === 'NaN' ? (vid.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) : parseFloat(vid.style.width));
29034
+ vid.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
29035
+ }
29036
+ else {
29037
+ if (width > height) {
29038
+ vid.style.width = this.pixToPerc(width / height * expectedY, (vid.previousElementSibling || vid.parentElement)) + '%';
29039
+ }
29040
+ else {
29041
+ vid.style.width = this.pixToPerc((expectedX / height * expectedY), (vid.previousElementSibling || vid.parentElement)) + '%';
29042
+ }
29043
+ }
29044
+ vid.style.height = null;
29045
+ vid.removeAttribute('height');
29046
+ };
28780
29047
  Video.prototype.pixToPerc = function (expected, parentEle) {
28781
29048
  return expected / parseFloat(getComputedStyle(parentEle).width) * 100;
28782
29049
  };
@@ -28818,6 +29085,7 @@ var Video = /** @__PURE__ @class */ (function () {
28818
29085
  var height = parseInt(this.vidDupPos.height, 10) + mouseY;
28819
29086
  this.pageX = pageX;
28820
29087
  this.pageY = pageY;
29088
+ this.mouseX = mouseX;
28821
29089
  if (this.resizeBtnStat.botRight) {
28822
29090
  this.vidDupMouseMove(width + 'px', height + 'px', e);
28823
29091
  }
@@ -30648,11 +30916,11 @@ var Table = /** @__PURE__ @class */ (function () {
30648
30916
  colReEle.classList.add(CLS_RTE_TABLE_RESIZE, CLS_TB_COL_RES);
30649
30917
  if (columns.length === i) {
30650
30918
  colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
30651
- 'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth) + 'px;';
30919
+ 'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth - 2) + 'px;';
30652
30920
  }
30653
30921
  else {
30654
30922
  colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
30655
- 'px; left:' + (pos.left + this.calcPos(columns[i]).left) + 'px;';
30923
+ 'px; left:' + (pos.left + this.calcPos(columns[i]).left - 2) + 'px;';
30656
30924
  }
30657
30925
  this.contentModule.getEditPanel().appendChild(colReEle);
30658
30926
  }
@@ -30684,7 +30952,7 @@ var Table = /** @__PURE__ @class */ (function () {
30684
30952
  };
30685
30953
  Table.prototype.removeResizeElement = function () {
30686
30954
  var item = this.parent.contentModule.getEditPanel().
30687
- querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box, .e-table-rhelper');
30955
+ querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box');
30688
30956
  if (item.length > 0) {
30689
30957
  for (var i = 0; i < item.length; i++) {
30690
30958
  detach(item[i]);
@@ -30778,6 +31046,44 @@ var Table = /** @__PURE__ @class */ (function () {
30778
31046
  }
30779
31047
  else {
30780
31048
  this.currentColumnResize = 'middle';
31049
+ var cellColl = this.curTable.rows[0].cells;
31050
+ var cellCount = 0;
31051
+ for (var cell = 0; cell < cellColl.length; cell++) {
31052
+ cellCount = cellCount + cellColl[cell].colSpan;
31053
+ }
31054
+ var sizes = new Array(cellCount);
31055
+ var colGroupEle = createElement('colgroup');
31056
+ var rowSpanCells = new Map();
31057
+ for (var i = 0; i < this.curTable.rows.length; i++) {
31058
+ var currentColIndex = 0;
31059
+ for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
31060
+ for (var l = 1; l < this.curTable.rows[i].cells[k].rowSpan; l++) {
31061
+ var key = "" + (i + l) + currentColIndex;
31062
+ rowSpanCells.set(key, this.curTable.rows[i].cells[k]);
31063
+ }
31064
+ var cellIndex = this.getCellIndex(rowSpanCells, i, k);
31065
+ if (cellIndex > currentColIndex) {
31066
+ currentColIndex = cellIndex;
31067
+ }
31068
+ var width = this.curTable.rows[i].cells[k].offsetWidth;
31069
+ if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
31070
+ sizes[currentColIndex] = width;
31071
+ }
31072
+ currentColIndex += 1 + this.curTable.rows[i].cells[k].colSpan - 1;
31073
+ }
31074
+ }
31075
+ for (var size = 0; size < sizes.length; size++) {
31076
+ var cell = createElement('col');
31077
+ cell.appendChild(createElement('br'));
31078
+ cell.style.width = this.convertPixelToPercentage(sizes[size], parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
31079
+ colGroupEle.appendChild(cell);
31080
+ }
31081
+ this.curTable.insertBefore(colGroupEle, this.curTable.firstChild);
31082
+ for (var i = 0; i < this.curTable.rows.length; i++) {
31083
+ for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
31084
+ this.curTable.rows[i].cells[k].style.width = '';
31085
+ }
31086
+ }
30781
31087
  }
30782
31088
  this.columnEle = this.curTable.rows[this.calMaxCol(this.curTable)].cells[parseInt(target.getAttribute('data-col'), 10)];
30783
31089
  }
@@ -30810,6 +31116,16 @@ var Table = /** @__PURE__ @class */ (function () {
30810
31116
  EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
30811
31117
  }
30812
31118
  };
31119
+ Table.prototype.getCellIndex = function (rowSpanCells, rowIndex, colIndex) {
31120
+ var cellKey = "" + rowIndex + colIndex;
31121
+ var spannedCell = rowSpanCells.get(cellKey);
31122
+ if (spannedCell) {
31123
+ return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
31124
+ }
31125
+ else {
31126
+ return colIndex;
31127
+ }
31128
+ };
30813
31129
  Table.prototype.removeHelper = function (e) {
30814
31130
  var cls = e.target.classList;
30815
31131
  if (!(cls.contains('e-reicon')) && this.helper) {
@@ -30838,12 +31154,12 @@ var Table = /** @__PURE__ @class */ (function () {
30838
31154
  this.helper.classList.add('e-column-helper');
30839
31155
  this.helper.style.cssText = 'height: ' + getComputedStyle(this.curTable).height + '; top: ' +
30840
31156
  pos.top + 'px; left:' + ((pos.left + this.calcPos(this.columnEle).left) +
30841
- (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth + 2 : 0) - 1) + 'px;';
31157
+ (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1) + 'px;';
30842
31158
  }
30843
31159
  else {
30844
31160
  this.helper.classList.add('e-row-helper');
30845
31161
  this.helper.style.cssText = 'width: ' + getComputedStyle(this.curTable).width + '; top: ' +
30846
- (this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight) +
31162
+ (this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1) +
30847
31163
  'px; left:' + (this.calcPos(this.rowEle).left + pos.left) + 'px;';
30848
31164
  }
30849
31165
  };
@@ -30851,11 +31167,12 @@ var Table = /** @__PURE__ @class */ (function () {
30851
31167
  var pos = this.calcPos(this.curTable);
30852
31168
  if (this.resizeBtnStat.column) {
30853
31169
  var left = (pos.left + this.calcPos(this.columnEle).left) +
30854
- (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth + 2 : 0) - 1;
31170
+ (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1;
30855
31171
  this.helper.style.left = left + 'px';
31172
+ this.helper.style.height = this.curTable.offsetHeight + 'px';
30856
31173
  }
30857
31174
  else {
30858
- var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight;
31175
+ var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1;
30859
31176
  this.helper.style.top = top_1 + 'px';
30860
31177
  }
30861
31178
  };
@@ -30881,10 +31198,6 @@ var Table = /** @__PURE__ @class */ (function () {
30881
31198
  var maxiumWidth;
30882
31199
  var currentTdElement = this.curTable.closest('td');
30883
31200
  var args = { event: e, requestType: 'table' };
30884
- var isRowCellsMerged = false;
30885
- var isColCellsMerged = false;
30886
- var mergedCellIndex;
30887
- var mergedElement;
30888
31201
  this.parent.trigger(onResize, args, function (resizingArgs) {
30889
31202
  if (resizingArgs.cancel) {
30890
31203
  _this.cancelResizeAction();
@@ -30909,7 +31222,7 @@ var Table = /** @__PURE__ @class */ (function () {
30909
31222
  widthCompare = rteWidth;
30910
31223
  }
30911
31224
  if (_this.resizeBtnStat.column) {
30912
- var width = parseFloat(_this.columnEle.offsetWidth.toString());
31225
+ var colGroup = _this.curTable.querySelectorAll('colgroup > col');
30913
31226
  var cellRow = _this.curTable.rows[0].cells[0].nodeName === 'TH' ? 1 : 0;
30914
31227
  var currentTableWidth = void 0;
30915
31228
  if (_this.curTable.style.width !== '' && _this.curTable.style.width.includes('%')) {
@@ -30962,98 +31275,36 @@ var Table = /** @__PURE__ @class */ (function () {
30962
31275
  }
30963
31276
  }
30964
31277
  else {
30965
- var cellColl = _this.curTable.rows[_this.calMaxCol(_this.curTable)].cells;
30966
- var actualwid = width - mouseX;
30967
- var totalwid = parseFloat(_this.columnEle.offsetWidth.toString()) +
30968
- parseFloat(cellColl[_this.colIndex - 1].offsetWidth.toString());
30969
- for (var i = 0; i < _this.curTable.rows.length; i++) {
30970
- var currentRow = _this.curTable.rows[i];
30971
- if ((totalwid - actualwid) > 20 && actualwid > 20) {
30972
- var leftColumnWidth = totalwid - actualwid;
30973
- var rightColWidth = actualwid;
30974
- var index = void 0;
30975
- var isMergedEleResize = false;
30976
- var leftTableCell = void 0;
30977
- var rightTableCell = void 0;
30978
- isColCellsMerged = false;
30979
- isRowCellsMerged = false;
30980
- /* eslint-disable */
30981
- for (var j = 0; j < currentRow.cells.length; j++) {
30982
- if (currentRow.cells[j].hasAttribute('rowspan') && j <= _this.colIndex) {
30983
- isRowCellsMerged = true;
30984
- mergedCellIndex = i;
30985
- mergedElement = currentRow.cells[j];
30986
- }
30987
- else if (currentRow.cells[j].hasAttribute('colspan') && j <= currentRow.cells.length) {
30988
- isColCellsMerged = true;
30989
- mergedCellIndex = i;
30990
- mergedElement = currentRow.cells[j];
30991
- }
30992
- }
30993
- if (!isNullOrUndefined(currentRow.cells[i]) && currentRow.cells[i].hasAttribute('colspan')) {
30994
- index = parseInt(currentRow.cells[i].getAttribute('colspan'), 10) - 1;
30995
- }
30996
- else {
30997
- index = _this.colIndex;
30998
- }
30999
- if (isRowCellsMerged || isColCellsMerged) {
31000
- var currentResizeRow = void 0;
31001
- if (currentRow.cells.length < cellColl.length) {
31002
- index = currentRow.cells.length === _this.colIndex || currentRow === _this.curTable.rows[_this.curTable.rows.length - 1] ?
31003
- _this.colIndex - 1 : _this.colIndex;
31004
- currentResizeRow = _this.curTable.rows[!isNullOrUndefined(mergedCellIndex) ?
31005
- mergedCellIndex : _this.colIndex - 1];
31006
- if (currentResizeRow && currentResizeRow !== currentRow && (currentResizeRow.cells[_this.colIndex - 1] === mergedElement ||
31007
- currentResizeRow.cells[currentResizeRow.cells.length - 1] === mergedElement)) {
31008
- isMergedEleResize = true;
31009
- }
31010
- else {
31011
- isMergedEleResize = false;
31012
- }
31013
- }
31014
- else {
31015
- index = _this.colIndex;
31016
- }
31017
- leftTableCell = !isMergedEleResize ? currentRow.cells[index - 1] : (currentResizeRow &&
31018
- currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement) ?
31019
- currentResizeRow.cells[_this.colIndex - 1] : currentRow.cells[currentRow.cells.length - 1];
31020
- rightTableCell = !isMergedEleResize ? currentRow.cells[index] : rightTableCell && rightTableCell.hasAttribute('rowspan') ?
31021
- currentResizeRow.cells[_this.colIndex] : currentResizeRow && currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement ?
31022
- currentRow.cells[index - 1] : currentResizeRow.cells[currentResizeRow.cells.length - 1];
31023
- }
31024
- if (!isNullOrUndefined(currentRow.cells[index - 1]) && !isRowCellsMerged && !isColCellsMerged) {
31025
- currentRow.cells[index - 1].style.width =
31026
- _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
31027
- }
31028
- else {
31029
- if (leftTableCell) {
31030
- leftTableCell.style.width =
31031
- _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
31032
- }
31033
- }
31034
- if (!isNullOrUndefined(currentRow.cells[index]) && !isRowCellsMerged && !isColCellsMerged) {
31035
- currentRow.cells[index].style.width =
31036
- _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
31037
- }
31038
- else {
31039
- if (rightTableCell) {
31040
- rightTableCell.style.width =
31041
- _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
31042
- }
31043
- }
31044
- /* eslint-enable */
31045
- }
31278
+ var actualwid = colGroup[_this.colIndex].offsetWidth - mouseX;
31279
+ // eslint-disable-next-line
31280
+ var totalwid = colGroup[_this.colIndex].offsetWidth + colGroup[_this.colIndex - 1].offsetWidth;
31281
+ if ((totalwid - actualwid) > 20 && actualwid > 20) {
31282
+ var leftColumnWidth = totalwid - actualwid;
31283
+ var rightColWidth = actualwid;
31284
+ colGroup[_this.colIndex - 1].style.width = _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
31285
+ colGroup[_this.colIndex].style.width = _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
31046
31286
  }
31047
31287
  }
31048
31288
  _this.updateHelper();
31049
31289
  }
31050
31290
  else if (_this.resizeBtnStat.row) {
31051
31291
  _this.parent.preventDefaultResize(e);
31052
- var height = parseFloat(_this.rowEle.clientHeight.toString()) + mouseY;
31053
- if (height > 20) {
31054
- _this.rowEle.style.height = height + 'px';
31292
+ var tableTrElementPixel = [];
31293
+ var currentTableTrElement = _this.curTable.querySelectorAll('tr');
31294
+ for (var i = 0; i < currentTableTrElement.length; i++) {
31295
+ if (_this.rowEle !== currentTableTrElement[i]) {
31296
+ tableTrElementPixel[i] = (parseFloat(currentTableTrElement[i].clientHeight.toString()));
31297
+ }
31298
+ }
31299
+ _this.curTable.style.height = (parseFloat(_this.curTable.clientHeight.toString()) + mouseY) + 'px';
31300
+ for (var i = 0; i < currentTableTrElement.length; i++) {
31301
+ if (_this.rowEle === currentTableTrElement[i]) {
31302
+ currentTableTrElement[i].style.height = (parseFloat(currentTableTrElement[i].clientHeight.toString()) + mouseY) + 'px';
31303
+ }
31304
+ else {
31305
+ currentTableTrElement[i].style.height = tableTrElementPixel[i] + 'px';
31306
+ }
31055
31307
  }
31056
- _this.curTable.style.height = '';
31057
31308
  if (!isNullOrUndefined(tableReBox)) {
31058
31309
  tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
31059
31310
  'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
@@ -31116,9 +31367,34 @@ var Table = /** @__PURE__ @class */ (function () {
31116
31367
  detach(this.helper);
31117
31368
  this.helper = null;
31118
31369
  }
31370
+ var colHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-column-helper');
31371
+ Array.from(colHelper).forEach(function (element) {
31372
+ if (element.parentNode) {
31373
+ element.parentNode.removeChild(element);
31374
+ }
31375
+ });
31376
+ for (var i = 0; i < this.curTable.rows.length; i++) {
31377
+ for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
31378
+ var width = this.convertPixelToPercentage(this.curTable.rows[i].cells[k].offsetWidth, parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
31379
+ this.curTable.rows[i].cells[k].style.width = width;
31380
+ }
31381
+ }
31382
+ var colGroup = this.curTable.querySelector('colgroup');
31383
+ if (colGroup) {
31384
+ this.curTable.removeChild(colGroup);
31385
+ }
31119
31386
  this.pageX = null;
31120
31387
  this.pageY = null;
31121
31388
  this.moveEle = null;
31389
+ var currentTableTrElement = this.curTable.querySelectorAll("tr");
31390
+ var tableTrPercentage = [];
31391
+ for (var i = 0; i < currentTableTrElement.length; i++) {
31392
+ var percentage = (parseFloat(currentTableTrElement[i].clientHeight.toString()) / parseFloat(this.curTable.clientHeight.toString())) * 100;
31393
+ tableTrPercentage[i] = percentage;
31394
+ }
31395
+ for (var i = 0; i < currentTableTrElement.length; i++) {
31396
+ currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
31397
+ }
31122
31398
  var args = { event: e, requestType: 'table' };
31123
31399
  this.parent.trigger(resizeStop, args);
31124
31400
  this.parent.formatter.saveData();
@@ -32957,10 +33233,10 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
32957
33233
  }
32958
33234
  var previousBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].previousSibling;
32959
33235
  var nextBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].nextSibling;
32960
- if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.hasAttribute('style')) {
33236
+ if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.hasAttribute('style') && previousBlockNode.nodeName !== 'TABLE') {
32961
33237
  insertElem.setAttribute('style', previousBlockNode.getAttribute('style'));
32962
33238
  }
32963
- if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.hasAttribute('style')) {
33239
+ if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.hasAttribute('style') && nextBlockNode.nodeName !== 'TABLE') {
32964
33240
  insertElem.setAttribute('style', nextBlockNode.getAttribute('style'));
32965
33241
  }
32966
33242
  return insertElem;
@@ -33743,6 +34019,16 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
33743
34019
  RichTextEditor.prototype.keyUp = function (e) {
33744
34020
  if (this.editorMode === 'HTML') {
33745
34021
  var range = this.getRange();
34022
+ if (!isNullOrUndefined(e) && !isNullOrUndefined(e.code) && (e.code === 'Backspace' || e.code === 'Delete')) {
34023
+ // To prevent the reformatting the content removed browser behavior.
34024
+ var currentRange = this.getRange();
34025
+ var selection = this.iframeSettings.enable ? this.contentModule.getPanel().ownerDocument.getSelection() :
34026
+ this.contentModule.getDocument().getSelection();
34027
+ if (selection.rangeCount > 0) {
34028
+ selection.removeAllRanges();
34029
+ selection.addRange(currentRange);
34030
+ }
34031
+ }
33746
34032
  if (Browser.userAgent.indexOf('Firefox') !== -1 && range.startContainer.nodeName === '#text' &&
33747
34033
  range.startContainer.parentElement === this.inputElement && this.enterKey !== 'BR') {
33748
34034
  var range_1 = this.getRange();
@@ -34344,7 +34630,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
34344
34630
  if (this.valueContainer) {
34345
34631
  this.valueContainer.value = (this.enableHtmlEncode) ? this.value : value;
34346
34632
  }
34347
- if (this.editorMode === 'HTML' && this.inputElement && this.inputElement.innerHTML.replace('&amp;', '&').trim() !== value.trim()) {
34633
+ if (this.editorMode === 'HTML' && this.inputElement && this.inputElement.innerHTML.trim() !== value.trim()) {
34348
34634
  this.inputElement.innerHTML = value;
34349
34635
  }
34350
34636
  else if (this.editorMode === 'Markdown' && this.inputElement
@@ -34365,9 +34651,6 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
34365
34651
  }
34366
34652
  else {
34367
34653
  this.inputElement.innerHTML = '<p><br/></p>';
34368
- if (value === '' && this.formatter && this.inputElement) {
34369
- this.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), this.inputElement.firstElementChild, this.inputElement.firstElementChild.childElementCount);
34370
- }
34371
34654
  }
34372
34655
  }
34373
34656
  else {
@@ -34616,10 +34899,10 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
34616
34899
  if (this.iframeSettings.resources) {
34617
34900
  var styleSrc = this.iframeSettings.resources.styles;
34618
34901
  var scriptSrc = this.iframeSettings.resources.scripts;
34619
- if (this.iframeSettings.resources.scripts.length > 0) {
34902
+ if (!isNullOrUndefined(this.iframeSettings.resources.scripts) && this.iframeSettings.resources.scripts.length > 0) {
34620
34903
  this.InjectSheet(true, scriptSrc);
34621
34904
  }
34622
- if (this.iframeSettings.resources.styles.length > 0) {
34905
+ if (!isNullOrUndefined(this.iframeSettings.resources.styles) && this.iframeSettings.resources.styles.length > 0) {
34623
34906
  this.InjectSheet(false, styleSrc);
34624
34907
  }
34625
34908
  }
@@ -35530,6 +35813,9 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
35530
35813
  if (item[j].classList.length === 0) {
35531
35814
  item[j].removeAttribute('class');
35532
35815
  }
35816
+ if (item[j].nodeName === 'IMG' && item[j].style.outline !== '') {
35817
+ item[j].style.outline = '';
35818
+ }
35533
35819
  }
35534
35820
  }
35535
35821
  };