@syncfusion/ej2-richtexteditor 24.2.4 → 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 (89) hide show
  1. package/CHANGELOG.md +22 -0
  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 +400 -150
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +393 -149
  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 +11 -11
  13. package/src/common/util.js +4 -1
  14. package/src/editor-manager/plugin/formats.d.ts +1 -0
  15. package/src/editor-manager/plugin/formats.js +37 -2
  16. package/src/editor-manager/plugin/inserthtml.js +15 -2
  17. package/src/editor-manager/plugin/lists.js +14 -1
  18. package/src/editor-manager/plugin/ms-word-clean-up.js +87 -18
  19. package/src/editor-manager/plugin/nodecutter.js +1 -1
  20. package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
  21. package/src/editor-manager/plugin/selection-commands.js +56 -1
  22. package/src/editor-manager/plugin/table.js +1 -1
  23. package/src/rich-text-editor/actions/base-quick-toolbar.js +2 -2
  24. package/src/rich-text-editor/actions/enter-key.js +2 -2
  25. package/src/rich-text-editor/actions/html-editor.js +25 -12
  26. package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
  27. package/src/rich-text-editor/actions/paste-clean-up.js +26 -5
  28. package/src/rich-text-editor/actions/toolbar-action.js +1 -1
  29. package/src/rich-text-editor/actions/toolbar.js +1 -1
  30. package/src/rich-text-editor/base/interface.d.ts +0 -8
  31. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
  32. package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
  33. package/src/rich-text-editor/base/rich-text-editor.js +12 -2
  34. package/src/rich-text-editor/base/util.js +3 -0
  35. package/src/rich-text-editor/models/default-locale.js +2 -1
  36. package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
  37. package/src/rich-text-editor/renderer/image-module.js +3 -3
  38. package/src/rich-text-editor/renderer/table-module.d.ts +1 -0
  39. package/src/rich-text-editor/renderer/table-module.js +106 -98
  40. package/styles/bootstrap-dark.css +25 -9
  41. package/styles/bootstrap.css +25 -9
  42. package/styles/bootstrap4.css +30 -14
  43. package/styles/bootstrap5-dark.css +25 -9
  44. package/styles/bootstrap5.css +25 -9
  45. package/styles/fabric-dark.css +25 -9
  46. package/styles/fabric.css +25 -9
  47. package/styles/fluent-dark.css +27 -11
  48. package/styles/fluent.css +27 -11
  49. package/styles/highcontrast-light.css +25 -9
  50. package/styles/highcontrast.css +25 -9
  51. package/styles/material-dark.css +25 -9
  52. package/styles/material.css +25 -9
  53. package/styles/material3-dark.css +26 -10
  54. package/styles/material3.css +26 -10
  55. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +4 -2
  56. package/styles/rich-text-editor/_bootstrap-definition.scss +4 -2
  57. package/styles/rich-text-editor/_bootstrap4-definition.scss +8 -6
  58. package/styles/rich-text-editor/_bootstrap5-definition.scss +4 -2
  59. package/styles/rich-text-editor/_fabric-dark-definition.scss +4 -2
  60. package/styles/rich-text-editor/_fabric-definition.scss +4 -2
  61. package/styles/rich-text-editor/_fluent-definition.scss +5 -3
  62. package/styles/rich-text-editor/_fusionnew-definition.scss +4 -2
  63. package/styles/rich-text-editor/_highcontrast-definition.scss +4 -2
  64. package/styles/rich-text-editor/_highcontrast-light-definition.scss +4 -2
  65. package/styles/rich-text-editor/_layout.scss +35 -6
  66. package/styles/rich-text-editor/_material-dark-definition.scss +4 -2
  67. package/styles/rich-text-editor/_material-definition.scss +4 -2
  68. package/styles/rich-text-editor/_material3-definition.scss +5 -3
  69. package/styles/rich-text-editor/_tailwind-definition.scss +21 -19
  70. package/styles/rich-text-editor/_theme.scss +18 -3
  71. package/styles/rich-text-editor/bootstrap-dark.css +25 -9
  72. package/styles/rich-text-editor/bootstrap.css +25 -9
  73. package/styles/rich-text-editor/bootstrap4.css +30 -14
  74. package/styles/rich-text-editor/bootstrap5-dark.css +25 -9
  75. package/styles/rich-text-editor/bootstrap5.css +25 -9
  76. package/styles/rich-text-editor/fabric-dark.css +25 -9
  77. package/styles/rich-text-editor/fabric.css +25 -9
  78. package/styles/rich-text-editor/fluent-dark.css +27 -11
  79. package/styles/rich-text-editor/fluent.css +27 -11
  80. package/styles/rich-text-editor/highcontrast-light.css +25 -9
  81. package/styles/rich-text-editor/highcontrast.css +25 -9
  82. package/styles/rich-text-editor/material-dark.css +25 -9
  83. package/styles/rich-text-editor/material.css +25 -9
  84. package/styles/rich-text-editor/material3-dark.css +26 -10
  85. package/styles/rich-text-editor/material3.css +26 -10
  86. package/styles/rich-text-editor/tailwind-dark.css +68 -32
  87. package/styles/rich-text-editor/tailwind.css +68 -32
  88. package/styles/tailwind-dark.css +68 -32
  89. package/styles/tailwind.css +68 -32
@@ -2819,6 +2819,7 @@ let defaultLocale = {
2819
2819
  'emojiPickerNoResultFound': 'No results found',
2820
2820
  'emojiPickerTrySomethingElse': 'Try something else',
2821
2821
  'linkAriaLabel': 'Open in new window',
2822
+ 'unsupportedImage': 'Unsupported file format'
2822
2823
  };
2823
2824
  let toolsLocale = {
2824
2825
  'alignments': 'alignments',
@@ -2914,7 +2915,7 @@ let toolsLocale = {
2914
2915
  'emojiPickerTypeToFind': 'Type to find',
2915
2916
  'emojiPickerNoResultFound': 'No results found',
2916
2917
  'emojiPickerTrySomethingElse': 'Try something else',
2917
- 'ImageLinkAriaLabel': 'Open in new window',
2918
+ 'imageLinkAriaLabel': 'Open in new window',
2918
2919
  };
2919
2920
  let fontNameLocale = [
2920
2921
  { locale: 'fontNameSegoeUI', value: 'Segoe UI' },
@@ -3443,6 +3444,9 @@ function updateTextNode(value, rteObj) {
3443
3444
  }
3444
3445
  const imageElm = resultElm.querySelectorAll('img');
3445
3446
  for (let i = 0; i < imageElm.length; i++) {
3447
+ if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
3448
+ continue; // Should not add the class if the image is Broken.
3449
+ }
3446
3450
  if (!imageElm[i].classList.contains(CLS_RTE_IMAGE)) {
3447
3451
  imageElm[i].classList.add(CLS_RTE_IMAGE);
3448
3452
  }
@@ -5058,7 +5062,7 @@ class ToolbarAction {
5058
5062
  if (args.item.command === 'Lists') {
5059
5063
  if (args.originalEvent.target.classList.contains('e-caret') &&
5060
5064
  (args.originalEvent.target.parentElement.classList.contains('e-rte-bulletformatlist-dropdown') || args.originalEvent.target.parentElement.classList.contains('e-rte-numberformatlist-dropdown'))) {
5061
- args.item.command = args.item.subCommand = null;
5065
+ return;
5062
5066
  }
5063
5067
  }
5064
5068
  this.parent.notify(htmlToolbarClick, args);
@@ -5668,7 +5672,7 @@ class Toolbar$2 {
5668
5672
  else if (Browser.isDevice || this.parent.inlineMode.enable) {
5669
5673
  this.isToolbar = true;
5670
5674
  }
5671
- if (isNullOrUndefined(trg) && this.parent.toolbarSettings.type === ToolbarType.Expand) {
5675
+ if (isNullOrUndefined(trg) && this.parent.toolbarSettings.type === ToolbarType.Expand && this.parent.toolbarModule.getExpandTBarPopHeight() === 0) {
5672
5676
  removeClass([this.tbElement], [CLS_EXPAND_OPEN]);
5673
5677
  }
5674
5678
  }
@@ -6321,7 +6325,7 @@ class BaseQuickToolbar {
6321
6325
  e.target.classList.contains('e-imgbreak')) ? false : true;
6322
6326
  let target = !isNullOrUndefined(imgWrapper) ? imgWrapper : e.target;
6323
6327
  addClass([this.toolbarElement], [CLS_RM_WHITE_SPACE]);
6324
- const targetOffsetTop = target.offsetTop;
6328
+ const targetOffsetTop = (target.classList.contains("e-rte-audio")) ? target.parentElement.offsetTop : target.offsetTop;
6325
6329
  const parentOffsetTop = window.pageYOffset + e.parentData.top;
6326
6330
  if ((targetOffsetTop - e.editTop) > e.popHeight) {
6327
6331
  y = parentOffsetTop + e.tBarElementHeight + (targetOffsetTop - e.editTop) - e.popHeight - 5;
@@ -6334,7 +6338,7 @@ class BaseQuickToolbar {
6334
6338
  }
6335
6339
  target = isAligned ? e.target : target;
6336
6340
  if (target.offsetWidth > e.popWidth) {
6337
- x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + target.offsetLeft;
6341
+ x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + ((target.classList.contains("e-rte-audio")) ? target.parentElement.offsetLeft : target.offsetLeft);
6338
6342
  }
6339
6343
  else {
6340
6344
  x = e.parentData.left + target.offsetLeft;
@@ -7778,7 +7782,7 @@ function updateTextNode$1(value, enterAction) {
7778
7782
  tableElm[i].classList.add('e-rte-paste-table');
7779
7783
  if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
7780
7784
  tableElm[i].classList.remove('e-rte-paste-word-table');
7781
- continue; // Sking the removal of the border if the source is from word.
7785
+ continue; // Skiping the removal of the border if the source is from word.
7782
7786
  }
7783
7787
  else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
7784
7788
  tableElm[i].classList.remove('e-rte-paste-excel-table');
@@ -7812,6 +7816,9 @@ function updateTextNode$1(value, enterAction) {
7812
7816
  }
7813
7817
  const imageElm = resultElm.querySelectorAll('img');
7814
7818
  for (let i = 0; i < imageElm.length; i++) {
7819
+ if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
7820
+ continue; // Should not add the class if the image is Broken.
7821
+ }
7815
7822
  if (!imageElm[i].classList.contains('e-rte-image')) {
7816
7823
  imageElm[i].classList.add('e-rte-image');
7817
7824
  }
@@ -12641,6 +12648,9 @@ class Lists {
12641
12648
  isNullOrUndefined(item) && nodes[i].parentNode.style.listStyleType !== '') {
12642
12649
  isRevert = false;
12643
12650
  }
12651
+ if (nodes[i].parentNode.tagName === tagName && nodes[i].parentNode.style.listStyleType !== '') {
12652
+ isRevert = true;
12653
+ }
12644
12654
  }
12645
12655
  return isRevert;
12646
12656
  }
@@ -12781,8 +12791,18 @@ class Lists {
12781
12791
  if (DEFAULT_TAG && 0 === element.querySelectorAll(BLOCK_TAGS.join(', ')).length) {
12782
12792
  const wrapperclass = isNullOrUndefined(className) ? ' class="e-rte-wrap-inner"' :
12783
12793
  ' class="' + className + ' e-rte-wrap-inner"';
12794
+ let parentElement = parentNode;
12795
+ if (!isNullOrUndefined(parentElement.style.listStyleType)) {
12796
+ parentNode.style.removeProperty("list-style-type");
12797
+ }
12798
+ if (!isNullOrUndefined(parentElement.style.listStyleImage)) {
12799
+ parentNode.style.removeProperty("list-style-image");
12800
+ }
12801
+ if (parentElement.style.length === 0) {
12802
+ parentNode.removeAttribute("style");
12803
+ }
12784
12804
  const wrapper = '<' + DEFAULT_TAG + wrapperclass +
12785
- this.domNode.attributes(parentNode) + '></' + DEFAULT_TAG + '>';
12805
+ this.domNode.attributes(parentElement) + '></' + DEFAULT_TAG + '>';
12786
12806
  if (e.enterAction !== 'BR') {
12787
12807
  this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
12788
12808
  }
@@ -13038,7 +13058,7 @@ class NodeCutter {
13038
13058
  else if (len > -1) {
13039
13059
  this.spliceEmptyNode(fragment.childNodes[0], isStart);
13040
13060
  }
13041
- else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG' && !(fragment.classList.contains('e-video-wrap')) && !(fragment.classList.contains('e-audio-wrap'))) {
13061
+ 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'))) {
13042
13062
  fragment.parentNode.removeChild(fragment);
13043
13063
  }
13044
13064
  return fragment;
@@ -13171,6 +13191,14 @@ class Formats {
13171
13191
  }
13172
13192
  }
13173
13193
  }
13194
+ getBlockParent(node, endNode) {
13195
+ let currentParent;
13196
+ while (node != endNode) {
13197
+ currentParent = node;
13198
+ node = node.parentElement;
13199
+ }
13200
+ return currentParent;
13201
+ }
13174
13202
  onKeyDown(e) {
13175
13203
  if (e.event.which === 13) {
13176
13204
  let range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
@@ -13180,6 +13208,8 @@ class Formats {
13180
13208
  ? range.endContainer : range.endContainer.parentElement;
13181
13209
  const preElem = closest(startCon, 'pre');
13182
13210
  const endPreElem = closest(endCon, 'pre');
13211
+ const blockquoteEle = closest(startCon, 'blockquote');
13212
+ const endBlockquoteEle = closest(endCon, 'blockquote');
13183
13213
  const liParent = !isNullOrUndefined(preElem) && !isNullOrUndefined(preElem.parentElement) && preElem.parentElement.tagName === 'LI';
13184
13214
  if (liParent) {
13185
13215
  return;
@@ -13191,6 +13221,17 @@ class Formats {
13191
13221
  range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
13192
13222
  this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, endCon, 0);
13193
13223
  }
13224
+ if (e.event.which === 13 && ((!isNullOrUndefined(blockquoteEle) && !isNullOrUndefined(endBlockquoteEle)) || (!isNullOrUndefined(blockquoteEle) && isNullOrUndefined(endBlockquoteEle)))) {
13225
+ let startParent = this.getBlockParent(range.startContainer, blockquoteEle);
13226
+ if ((startParent.textContent.charCodeAt(0) === 8203 &&
13227
+ startParent.textContent.length === 1) || startParent.textContent.length === 0) {
13228
+ if (isNullOrUndefined(startParent.nextSibling) && ((startParent.previousSibling.textContent.charCodeAt(0) === 8203 &&
13229
+ startParent.previousSibling.textContent.length === 1) || startParent.previousSibling.textContent.length === 0)) {
13230
+ e.event.preventDefault();
13231
+ this.paraFocus(startParent.parentElement); //Revert from blockquotes while pressing enter key
13232
+ }
13233
+ }
13234
+ }
13194
13235
  if (e.event.which === 13 && !isNullOrUndefined(preElem) && !isNullOrUndefined(endPreElem)) {
13195
13236
  e.event.preventDefault();
13196
13237
  this.deleteContent(range);
@@ -13414,7 +13455,7 @@ class Formats {
13414
13455
  replaceHTML = parentNode.innerHTML;
13415
13456
  }
13416
13457
  if ((e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase() &&
13417
- (e.subCommand.toLowerCase() !== 'pre' ||
13458
+ (e.subCommand.toLowerCase() !== 'pre' && e.subCommand.toLowerCase() !== 'blockquote' ||
13418
13459
  (!isNullOrUndefined(e.exeValue) && e.exeValue.name === 'dropDownSelect'))) ||
13419
13460
  isNullOrUndefined(parentNode.parentNode) ||
13420
13461
  (parentNode.tagName === 'TABLE' && e.subCommand.toLowerCase() === 'pre')) {
@@ -13423,7 +13464,21 @@ class Formats {
13423
13464
  this.cleanFormats(parentNode, e.subCommand);
13424
13465
  const replaceNode = (e.subCommand.toLowerCase() === 'pre' && parentNode.tagName.toLowerCase() === 'pre') ?
13425
13466
  'p' : e.subCommand;
13426
- const replaceTag = this.parent.domNode.createTagString(replaceNode, parentNode, replaceHTML.replace(/>\s+</g, '><'));
13467
+ const isToggleBlockquoteList = e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase() &&
13468
+ e.subCommand.toLowerCase() === 'blockquote' && this.parent.domNode.isList(parentNode.firstElementChild);
13469
+ const isToggleBlockquote = e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase()
13470
+ && e.subCommand.toLowerCase() === 'blockquote';
13471
+ let replaceTag;
13472
+ if (isToggleBlockquoteList) {
13473
+ replaceTag = replaceHTML.replace(/>\s+</g, '><');
13474
+ }
13475
+ else if (isToggleBlockquote) {
13476
+ let tagWrap = (e.enterAction == 'BR' || e.enterAction == 'P') ? 'P' : e.enterAction;
13477
+ replaceTag = this.parent.domNode.createTagString(tagWrap, parentNode, replaceHTML.replace(/>\s+</g, '><'));
13478
+ }
13479
+ else {
13480
+ replaceTag = this.parent.domNode.createTagString(replaceNode, parentNode, replaceHTML.replace(/>\s+</g, '><'));
13481
+ }
13427
13482
  if (parentNode.tagName === 'LI') {
13428
13483
  parentNode.innerHTML = '';
13429
13484
  parentNode.insertAdjacentHTML('beforeend', replaceTag);
@@ -13732,12 +13787,17 @@ class InsertHtml {
13732
13787
  preNode.parentNode.replaceChild(fragment, preNode);
13733
13788
  }
13734
13789
  else {
13790
+ const startContainerParent = range.startContainer.parentNode;
13791
+ // Get the index of the start container among its siblings
13792
+ const startIndex = Array.prototype.indexOf.call(startContainerParent.childNodes, range.startContainer);
13735
13793
  range.deleteContents();
13794
+ range.setStart(startContainerParent, startIndex);
13795
+ range.setEnd(startContainerParent, startIndex);
13736
13796
  if (!isNullOrUndefined(lasNode)) {
13737
13797
  detach(lasNode);
13738
13798
  }
13739
13799
  // eslint-disable-next-line
13740
- !isNullOrUndefined(sibNode) ? sibNode.parentNode.appendChild(fragment) : editNode.appendChild(fragment);
13800
+ !isNullOrUndefined(sibNode) ? (sibNode.parentNode === editNode ? sibNode.appendChild(fragment) : sibNode.parentNode.appendChild(fragment)) : range.insertNode(fragment);
13741
13801
  }
13742
13802
  }
13743
13803
  else {
@@ -13962,7 +14022,15 @@ class InsertHtml {
13962
14022
  }
13963
14023
  static imageFocus(node, nodeSelection, docElement) {
13964
14024
  const focusNode = document.createTextNode(' ');
13965
- node.parentNode.insertBefore(focusNode, node.nextSibling);
14025
+ if (node.parentNode && node.parentNode.nodeName === 'A') {
14026
+ const anchorTag = node.parentNode;
14027
+ const parentNode = anchorTag.parentNode;
14028
+ parentNode.insertBefore(focusNode, anchorTag.nextSibling);
14029
+ parentNode.insertBefore(node, focusNode);
14030
+ }
14031
+ else {
14032
+ node.parentNode.insertBefore(focusNode, node.nextSibling);
14033
+ }
13966
14034
  nodeSelection.setSelectionText(docElement, node.nextSibling, node.nextSibling, 0, 0);
13967
14035
  }
13968
14036
  // eslint-disable-next-line
@@ -15889,7 +15957,7 @@ class TableCommand {
15889
15957
  const eleArray = elements;
15890
15958
  //eslint-disable-next-line
15891
15959
  if (min < (max = Math.min(max, eleArray[0].length - 1))) {
15892
- for (colIndex === min; colIndex <= max; colIndex++) {
15960
+ for (colIndex = min; colIndex <= max; colIndex++) {
15893
15961
  // eslint-disable-next-line
15894
15962
  if (!(min < colIndex && eleArray[0][colIndex] === eleArray[0][colIndex - 1]) && 1 < (index =
15895
15963
  Math.min(parseInt(eleArray[0][colIndex].getAttribute('colspan'), 10) || 1, max - min + 1)) &&
@@ -16567,6 +16635,29 @@ class SelectionCommands {
16567
16635
  const nodeCutter = new NodeCutter();
16568
16636
  const isFormatted = new IsFormatted();
16569
16637
  let range = domSelection.getRange(docElement);
16638
+ let currentAnchorNode = range.startContainer.parentElement;
16639
+ if (range.collapsed && !isNullOrUndefined(currentAnchorNode) &&
16640
+ currentAnchorNode.tagName === 'A' &&
16641
+ (range.startOffset === currentAnchorNode.textContent.length || range.startOffset === 0)) {
16642
+ const emptyTextNode = document.createTextNode('');
16643
+ if (range.startOffset === 0) {
16644
+ currentAnchorNode.parentNode.insertBefore(emptyTextNode, currentAnchorNode);
16645
+ }
16646
+ else {
16647
+ if (!isNullOrUndefined(currentAnchorNode.nextSibling)) {
16648
+ currentAnchorNode.parentElement.insertBefore(emptyTextNode, currentAnchorNode.nextSibling);
16649
+ }
16650
+ else {
16651
+ currentAnchorNode.parentNode.appendChild(emptyTextNode);
16652
+ }
16653
+ }
16654
+ // Set the range to the empty text node
16655
+ const newRange = docElement.createRange();
16656
+ range.setStart(emptyTextNode, 0);
16657
+ range.setEnd(emptyTextNode, 0);
16658
+ range.collapse(true);
16659
+ domSelection.setRange(docElement, newRange);
16660
+ }
16570
16661
  if (Browser.userAgent.indexOf('Firefox') !== -1 && range.startContainer === range.endContainer && !isNullOrUndefined(endNode) && range.startContainer === endNode) {
16571
16662
  const startChildNodes = range.startContainer.childNodes;
16572
16663
  const startNode = ((startChildNodes[(range.startOffset > 0) ? (range.startOffset - 1) :
@@ -16942,7 +17033,10 @@ class SelectionCommands {
16942
17033
  }
16943
17034
  let num = index;
16944
17035
  let liChildContent = '';
16945
- while (num >= 0 && !isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
17036
+ /* eslint-disable security/detect-object-injection */
17037
+ while (num >= 0 && !isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.contains(nodes[num]) &&
17038
+ liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
17039
+ /* eslint-enable security/detect-object-injection */
16946
17040
  liChildContent = ' ' + nodes[num].textContent.trim() + liChildContent;
16947
17041
  num--;
16948
17042
  }
@@ -17014,6 +17108,23 @@ class SelectionCommands {
17014
17108
  parentElement = parentElement.parentElement;
17015
17109
  liElement = parentElement;
17016
17110
  }
17111
+ if (format === 'fontcolor') {
17112
+ const parentElem = nodes[index].parentElement;
17113
+ if (!isNullOrUndefined(parentElem) && parentElem.childNodes) {
17114
+ for (let i = 0; i < parentElem.childNodes.length; i++) {
17115
+ if (this.concatenateTextExcludingList(nodes, index) === nodes[index].textContent) {
17116
+ if (parentElem.tagName === 'LI') {
17117
+ parentElem.style.color = value;
17118
+ }
17119
+ }
17120
+ // eslint-disable-next-line
17121
+ const childElement = parentElem.childNodes[i];
17122
+ if (childElement.tagName === 'OL' || childElement.tagName === 'UL') {
17123
+ childElement.style.color = 'initial';
17124
+ }
17125
+ }
17126
+ }
17127
+ }
17017
17128
  if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' &&
17018
17129
  liElement.textContent.trim() === nodes[index].textContent.trim()) {
17019
17130
  if (format === 'fontsize') {
@@ -17313,6 +17424,18 @@ class SelectionCommands {
17313
17424
  }
17314
17425
  }
17315
17426
  }
17427
+ static concatenateTextExcludingList(nodes, index) {
17428
+ let result = '';
17429
+ const parentNode = nodes[index].parentElement;
17430
+ for (let i = 0; i < parentNode.childNodes.length; i++) {
17431
+ // eslint-disable-next-line
17432
+ const childNode = parentNode.childNodes[i];
17433
+ if ((childNode.nodeType === 3) || (childNode.nodeType === 1 && (childNode.tagName !== 'OL' && childNode.tagName !== 'UL'))) {
17434
+ result += childNode.textContent;
17435
+ }
17436
+ }
17437
+ return result;
17438
+ }
17316
17439
  }
17317
17440
  SelectionCommands.enterAction = 'P';
17318
17441
 
@@ -18021,7 +18144,6 @@ class MsWordPaste {
18021
18144
  if (patern.test(tempHTMLContent) || patern2.test(tempHTMLContent) || patern3.test(tempHTMLContent) ||
18022
18145
  pattern4.test(tempHTMLContent)) {
18023
18146
  const source = this.findSource(elm);
18024
- this.imageConversion(elm, rtfData);
18025
18147
  tempHTMLContent = tempHTMLContent.replace(/<img[^>]+>/i, '');
18026
18148
  this.addListClass(elm);
18027
18149
  listNodes = this.cleanUp(elm, listNodes);
@@ -18029,6 +18151,7 @@ class MsWordPaste {
18029
18151
  listNodes[0].parentElement.tagName !== 'OL') {
18030
18152
  this.listConverter(listNodes);
18031
18153
  }
18154
+ this.imageConversion(elm, rtfData);
18032
18155
  this.cleanList(elm, 'UL');
18033
18156
  this.cleanList(elm, 'OL');
18034
18157
  this.styleCorrection(elm, wordPasteStyleConfig);
@@ -18037,11 +18160,11 @@ class MsWordPaste {
18037
18160
  this.removeEmptyElements(elm);
18038
18161
  this.removeEmptyAnchorTag(elm);
18039
18162
  this.breakLineAddition(elm);
18163
+ this.processMargin(elm);
18040
18164
  this.removeClassName(elm);
18041
18165
  if (pattern4.test(tempHTMLContent)) {
18042
18166
  this.addTableBorderClass(elm);
18043
18167
  }
18044
- this.processMargin(elm);
18045
18168
  e.callBack(elm.innerHTML, this.cropImageDimensions, source);
18046
18169
  }
18047
18170
  else {
@@ -18112,8 +18235,9 @@ class MsWordPaste {
18112
18235
  imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0 &&
18113
18236
  imgElem[i].getAttribute('v:shapes').indexOf('_x0000_s') < 0 &&
18114
18237
  imgElem[i].getAttribute('v:shapes').indexOf('_x0000_i') < 0) {
18115
- detach(imgElem[i]);
18238
+ imgElem[i].classList.add('e-rte-image-unsupported');
18116
18239
  }
18240
+ imgElem[i].removeAttribute('v:shapes');
18117
18241
  }
18118
18242
  imgElem = elm.querySelectorAll('img');
18119
18243
  const imgSrc = [];
@@ -18143,6 +18267,7 @@ class MsWordPaste {
18143
18267
  });
18144
18268
  }
18145
18269
  }
18270
+ imgElem = elm.querySelectorAll('img:not(.e-rte-image-unsupported');
18146
18271
  for (let i = 0; i < imgElem.length; i++) {
18147
18272
  if (imgSrc[i].match(linkRegex)) {
18148
18273
  imgElem[i].setAttribute('src', imgSrc[i]);
@@ -18153,7 +18278,7 @@ class MsWordPaste {
18153
18278
  }
18154
18279
  else {
18155
18280
  imgElem[i].removeAttribute('src');
18156
- imgElem[i].setAttribute('alt', 'Unsupported file format');
18281
+ imgElem[i].classList.add('e-rte-image-unsupported');
18157
18282
  }
18158
18283
  if (!isNullOrUndefined(base64Src[i]) && base64Src[i].isCroppedImage) {
18159
18284
  imgElem[i].classList.add('e-img-cropped');
@@ -18161,6 +18286,10 @@ class MsWordPaste {
18161
18286
  }
18162
18287
  imgElem[i].setAttribute('id', 'msWordImg-' + imgName[i]);
18163
18288
  }
18289
+ imgElem = elm.querySelectorAll('.e-rte-image-unsupported');
18290
+ for (let i = 0; i < imgElem.length; i++) {
18291
+ imgElem[i].removeAttribute('src');
18292
+ }
18164
18293
  }
18165
18294
  }
18166
18295
  checkVShape(elm) {
@@ -18234,6 +18363,9 @@ class MsWordPaste {
18234
18363
  const result = [];
18235
18364
  if (!isNullOrUndefined(fullImg)) {
18236
18365
  for (let i = 0; i < fullImg.length; i++) {
18366
+ if (fullImg[i].indexOf('fIsBullet') !== -1 && fullImg[i].indexOf('wzName') === -1) {
18367
+ continue;
18368
+ }
18237
18369
  let isCroppedImage = false;
18238
18370
  let goalWidth = 0;
18239
18371
  let goalHeight = 0;
@@ -18248,7 +18380,7 @@ class MsWordPaste {
18248
18380
  else if (fullImg[i].indexOf('\\jpegblip') !== -1) {
18249
18381
  imgType = 'image/jpeg';
18250
18382
  }
18251
- else if (fullImg[i].indexOf('\\picprop') !== -1) {
18383
+ else if (fullImg[i].indexOf('\\emfblip') !== -1) {
18252
18384
  imgType = null;
18253
18385
  }
18254
18386
  else {
@@ -18288,7 +18420,7 @@ class MsWordPaste {
18288
18420
  return parseInt(result, 10);
18289
18421
  }
18290
18422
  removeClassName(elm) {
18291
- const elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped)');
18423
+ const elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped):not(.e-rte-image-unsupported)');
18292
18424
  for (let i = 0; i < elmWithClass.length; i++) {
18293
18425
  elmWithClass[i].removeAttribute('class');
18294
18426
  }
@@ -18325,7 +18457,7 @@ class MsWordPaste {
18325
18457
  return removableElement;
18326
18458
  }
18327
18459
  removeUnwantedElements(elm) {
18328
- let styleElm = elm.querySelector('style');
18460
+ const styleElm = elm.querySelector('style');
18329
18461
  if (!isNullOrUndefined(styleElm)) {
18330
18462
  detach(styleElm);
18331
18463
  }
@@ -18561,6 +18693,7 @@ class MsWordPaste {
18561
18693
  listConverter(listNodes) {
18562
18694
  let level;
18563
18695
  const data = [];
18696
+ let listFormatOverride;
18564
18697
  let collection = [];
18565
18698
  let content = '';
18566
18699
  let stNode;
@@ -18582,6 +18715,17 @@ class MsWordPaste {
18582
18715
  else {
18583
18716
  level = 1;
18584
18717
  }
18718
+ if (content && content.indexOf('mso-list:') !== -1) {
18719
+ let msoListValue;
18720
+ if (content.match(/mso-list:[^;]+;?/)) {
18721
+ const changedContent = content.replace('\n', '').split(' ').join('');
18722
+ msoListValue = changedContent.match(/mso-list:[^;]+;?/)[0].split(':l');
18723
+ listFormatOverride = isNullOrUndefined(msoListValue) ? null : parseInt(msoListValue[1].split('level')[0], 10);
18724
+ }
18725
+ else {
18726
+ listFormatOverride = null;
18727
+ }
18728
+ }
18585
18729
  this.listContents = [];
18586
18730
  this.getListContent(listNodes[i]);
18587
18731
  let type;
@@ -18617,9 +18761,9 @@ class MsWordPaste {
18617
18761
  startAttr = this.lowerGreekNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
18618
18762
  }
18619
18763
  }
18620
- if (listNodes[i].style.marginLeft !== '') {
18621
- styleMarginLeft = listNodes[i].style.marginLeft;
18622
- }
18764
+ }
18765
+ if (listNodes[i].style.marginLeft !== '') {
18766
+ styleMarginLeft = listNodes[i].style.marginLeft;
18623
18767
  }
18624
18768
  const tempNode = [];
18625
18769
  for (let j = 1; j < this.listContents.length; j++) {
@@ -18635,7 +18779,8 @@ class MsWordPaste {
18635
18779
  currentListStyle = listNodes[i].getAttribute('style');
18636
18780
  }
18637
18781
  collection.push({
18638
- listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
18782
+ listType: type, content: tempNode, nestedLevel: level,
18783
+ listFormatOverride: listFormatOverride, class: currentClassName,
18639
18784
  listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft
18640
18785
  });
18641
18786
  }
@@ -18708,6 +18853,7 @@ class MsWordPaste {
18708
18853
  let prevList;
18709
18854
  let listCount = 0;
18710
18855
  let elem;
18856
+ let lfo = collection[0].listFormatOverride;
18711
18857
  for (let index = 0; index < collection.length; index++) {
18712
18858
  const listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
18713
18859
  let isNormalList = false;
@@ -18724,16 +18870,24 @@ class MsWordPaste {
18724
18870
  }
18725
18871
  const pElement = createElement('p', { className: 'MsoNormal' });
18726
18872
  pElement.innerHTML = collection[index].content.join(' ');
18727
- if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
18873
+ if ((collection[index].nestedLevel === 1) &&
18874
+ (listCount === 0 || lfo !== collection[index].listFormatOverride) &&
18875
+ collection[index].content) {
18728
18876
  root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
18729
18877
  prevList = createElement('li');
18730
18878
  prevList.appendChild(pElement);
18731
18879
  temp.appendChild(prevList);
18732
18880
  temp.setAttribute('level', collection[index].nestedLevel.toString());
18733
- temp.style.marginLeft = collection[index].styleMarginLeft;
18881
+ if (collection[index].class !== 'msolistparagraph') {
18882
+ temp.style.marginLeft = collection[index].styleMarginLeft;
18883
+ }
18884
+ else {
18885
+ addClass([temp], 'marginLeftIgnore');
18886
+ }
18734
18887
  temp.style.listStyleType = collection[index].listStyleTypeName;
18735
18888
  }
18736
- else if (collection[index].nestedLevel === pLevel) {
18889
+ else if (collection[index].nestedLevel === pLevel &&
18890
+ lfo === collection[index].listFormatOverride) {
18737
18891
  if (!isNullOrUndefined(prevList) && !isNullOrUndefined(prevList.parentElement)
18738
18892
  && prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
18739
18893
  prevList.parentElement.appendChild(prevList = createElement('li'));
@@ -18796,6 +18950,12 @@ class MsWordPaste {
18796
18950
  prevList.appendChild(pElement);
18797
18951
  temp.appendChild(prevList);
18798
18952
  temp.setAttribute('level', collection[index].nestedLevel.toString());
18953
+ if (collection[index].class !== 'msolistparagraph') {
18954
+ temp.style.marginLeft = collection[index].styleMarginLeft;
18955
+ }
18956
+ else {
18957
+ addClass([temp], 'marginLeftIgnore');
18958
+ }
18799
18959
  temp.style.listStyleType = collection[index].listStyleTypeName;
18800
18960
  }
18801
18961
  }
@@ -18819,14 +18979,34 @@ class MsWordPaste {
18819
18979
  elem = elem.parentElement;
18820
18980
  if (elem.attributes.getNamedItem('level')) {
18821
18981
  // eslint-disable-next-line
18822
- if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel) {
18982
+ if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
18983
+ lfo === collection[index].listFormatOverride) {
18823
18984
  prevList = createElement('li');
18824
18985
  prevList.appendChild(pElement);
18825
18986
  elem.appendChild(prevList);
18826
18987
  break;
18827
18988
  // eslint-disable-next-line
18828
18989
  }
18829
- else if (collection[index].nestedLevel > parseInt(elem.attributes.getNamedItem('level').textContent, null)) {
18990
+ else if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
18991
+ lfo !== collection[index].listFormatOverride) {
18992
+ temp = createElement(collection[index].listType);
18993
+ prevList = createElement('li');
18994
+ temp.appendChild(prevList);
18995
+ if (collection[index].nestedLevel > 1) {
18996
+ for (let k = 0; k < collection[index].nestedLevel - 1; k++) {
18997
+ prevList.appendChild(temp = createElement(collection[index].listType));
18998
+ prevList = createElement('li');
18999
+ temp.appendChild(prevList);
19000
+ temp.style.listStyleType = 'none';
19001
+ }
19002
+ }
19003
+ prevList.appendChild(pElement);
19004
+ elem.appendChild(temp);
19005
+ temp.setAttribute('level', collection[index].nestedLevel.toString());
19006
+ temp.style.listStyleType = collection[index].listStyleTypeName;
19007
+ break;
19008
+ }
19009
+ else if (collection[index].nestedLevel > parseInt(elem.attributes.getNamedItem('level').textContent, 10)) {
18830
19010
  elem.appendChild(temp = createElement(collection[index].listType));
18831
19011
  prevList = createElement('li');
18832
19012
  prevList.appendChild(pElement);
@@ -18842,8 +19022,9 @@ class MsWordPaste {
18842
19022
  prevList.setAttribute('class', collection[index].class);
18843
19023
  prevList.setAttribute('style', (!isNullOrUndefined(collection[index].listStyle) ? collection[index].listStyle : ''));
18844
19024
  pLevel = collection[index].nestedLevel;
19025
+ lfo = collection[index].listFormatOverride;
18845
19026
  listCount++;
18846
- if (!isNullOrUndefined(collection[index].start)) {
19027
+ if (!isNullOrUndefined(collection[index].start && collection[index].start !== 1 && collection[index].listType === 'ol')) {
18847
19028
  temp.setAttribute('start', collection[index].start.toString());
18848
19029
  }
18849
19030
  }
@@ -18880,7 +19061,7 @@ class MsWordPaste {
18880
19061
  const liChildren = element.querySelectorAll('li');
18881
19062
  if (liChildren.length > 0) {
18882
19063
  for (let i = 0; i < liChildren.length; i++) {
18883
- if (!isNullOrUndefined((liChildren[i]).style.marginLeft)) {
19064
+ if (!isNullOrUndefined((liChildren[i]).style.marginLeft) && !liChildren[i].parentElement.classList.contains('marginLeftIgnore')) {
18884
19065
  (liChildren[i]).style.marginLeft = '';
18885
19066
  }
18886
19067
  }
@@ -18894,6 +19075,17 @@ class MsWordPaste {
18894
19075
  }
18895
19076
  }
18896
19077
  }
19078
+ const ignoredNode = element.querySelectorAll('.marginLeftIgnore li');
19079
+ if (ignoredNode.length > 0) {
19080
+ for (let i = 0; i < ignoredNode.length; i++) {
19081
+ if (!isNullOrUndefined((ignoredNode[i]).style.marginLeft) && (ignoredNode[i]).style.marginLeft !== '') {
19082
+ const marginLeft = (ignoredNode[i]).style.marginLeft;
19083
+ const marginLeftValue = parseFloat(marginLeft.split('in')[0]);
19084
+ const result = marginLeftValue - 0.5;
19085
+ (ignoredNode[i]).style.marginLeft = result.toString() + 'in';
19086
+ }
19087
+ }
19088
+ }
18897
19089
  }
18898
19090
  removeEmptyAnchorTag(element) {
18899
19091
  const removableElement = element.querySelectorAll('a:not([href])');
@@ -20443,8 +20635,10 @@ const IFRAMEHEADER = `
20443
20635
  span.e-selected-node {background-color: #939393;color: white;}
20444
20636
  span.e-selected-node.e-highlight {background-color: #1d9dd8;}
20445
20637
  body{color:#333;word-wrap:break-word;padding: 8px;box-sizing: border-box;}
20446
- .e-rte-image, .e-rte-audio, .e-rte-video {border: 0;cursor: pointer;display:
20638
+ .e-rte-image, .e-rte-video {border: 0;cursor: pointer;display:
20447
20639
  block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}
20640
+ .e-rte-audio {border: 0;cursor: pointer;display:
20641
+ block;float: none;margin: 5px auto;max-width: 100%;position: relative;}
20448
20642
  .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;}
20449
20643
  .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;}
20450
20644
  .e-rte-image.e-imgright, .e-rte-video.e-video-right { float: right; margin: 0 auto;margin-left: 5px;text-align: right;}
@@ -20453,6 +20647,10 @@ const IFRAMEHEADER = `
20453
20647
  .e-img-caption.e-caption-inline {display: inline-block;float: none;
20454
20648
  margin: 5px auto;margin-left: 5px;margin-right: 5px;max-width: calc(100% - (2 * 5px));
20455
20649
  position: relativetext-align: center;vertical-align: bottom;}
20650
+ .e-rte-img-caption.e-imgcenter {display: contents; margin-left: auto; margin-right: auto;}
20651
+ .e-rte-img-caption.e-imgright {display: contents; margin-left: auto; margin-right: 0;}
20652
+ .e-rte-img-caption.e-imgleft {display: contents;margin-left: 0;margin-right: auto;}
20653
+ .e-img-caption.e-rte-img-caption.e-imgbreak {display: contents;}
20456
20654
  .e-img-inner {box-sizing: border-box;display: block;font-size: 16px;font-weight: initial;
20457
20655
  margin: auto;opacity: .9;text-align: center;width: 100%;}
20458
20656
  .e-img-wrap {display: inline-block;margin: auto;padding: 0;text-align: center;width: 100%;}
@@ -20936,9 +21134,12 @@ class HtmlEditor {
20936
21134
  const range = this.parent.getRange();
20937
21135
  // eslint-disable-next-line
20938
21136
  const regEx = new RegExp(String.fromCharCode(8203), 'g');
21137
+ const isEmptyNode = range.startContainer === range.endContainer && range.startOffset === range.endOffset &&
21138
+ range.startOffset === 1 && range.startContainer.textContent.length === 1 && range.startContainer.textContent.charCodeAt(0) == 8203 &&
21139
+ range.startContainer.textContent.replace(regEx, '').length === 0;
20939
21140
  let pointer;
20940
21141
  let isRootParent = false;
20941
- if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
21142
+ if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
20942
21143
  pointer = range.startOffset;
20943
21144
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
20944
21145
  range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
@@ -21060,8 +21261,13 @@ class HtmlEditor {
21060
21261
  else {
21061
21262
  this.parent.notify(enterHandler, { args: e.args });
21062
21263
  const newRange = this.parent.getRange();
21063
- if (!isNullOrUndefined(newRange.startContainer) && newRange.startContainer === this.parent.inputElement.lastChild && newRange.startContainer.nodeName !== '#text' && this.parent.height !== 'auto') {
21064
- newRange.startContainer.scrollIntoView({ block: "end", inline: "nearest" });
21264
+ if (!isNullOrUndefined(newRange.startContainer) && this.parent.height !== 'auto' && newRange.startContainer.nodeName !== '#text'
21265
+ && !this.parent.iframeSettings.enable && newRange.startContainer.getBoundingClientRect().bottom > this.parent.element.getBoundingClientRect().bottom) {
21266
+ this.parent.element.querySelector('.e-rte-content').scrollTop += newRange.startContainer.getBoundingClientRect().bottom - this.parent.element.getBoundingClientRect().bottom;
21267
+ }
21268
+ else if (!isNullOrUndefined(newRange.startContainer) && this.parent.height === 'auto' && newRange.startContainer.nodeName !== '#text'
21269
+ && !this.parent.iframeSettings.enable && window.innerHeight < newRange.startContainer.getBoundingClientRect().top) {
21270
+ newRange.startContainer.scrollIntoView({ block: 'end', inline: 'nearest' });
21065
21271
  }
21066
21272
  }
21067
21273
  }
@@ -21143,11 +21349,13 @@ class HtmlEditor {
21143
21349
  currentRange.startContainer.previousSibling.nodeName === 'SPAN') {
21144
21350
  isPreviousNotContentEditable = currentRange.startContainer.previousSibling.contentEditable === 'false' ? false : true;
21145
21351
  }
21352
+ const checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
21353
+ const isSelectedPositionNotStart = closest(currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer, 'li') ?
21354
+ checkNode.nodeName !== 'li' && isNullOrUndefined(checkNode.previousSibling) : true;
21146
21355
  if (e.args.code === 'Backspace' && e.args.keyCode === 8 && currentRange.startOffset === 0 &&
21147
21356
  currentRange.endOffset === 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.textContent.length > 0 &&
21148
21357
  currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH' &&
21149
- isPreviousNotContentEditable) {
21150
- const checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
21358
+ isPreviousNotContentEditable && isSelectedPositionNotStart) {
21151
21359
  if ((!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
21152
21360
  !isNullOrUndefined(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') ||
21153
21361
  (!isNullOrUndefined(currentRange.startContainer.previousSibling) && currentRange.startContainer.previousSibling.nodeName === 'BR')) {
@@ -21159,7 +21367,8 @@ class HtmlEditor {
21159
21367
  if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
21160
21368
  this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
21161
21369
  liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
21162
- if (!isNullOrUndefined(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR') {
21370
+ if (!isNullOrUndefined(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR' &&
21371
+ isNullOrUndefined(liElement.lastElementChild.previousSibling)) {
21163
21372
  this.rangeElement = liElement.lastElementChild;
21164
21373
  isLiElement = true;
21165
21374
  }
@@ -21450,9 +21659,11 @@ class HtmlEditor {
21450
21659
  this.tooltipTargetEle = closest(args.originalEvent.target, '[data-tooltip-id]');
21451
21660
  if (!isNullOrUndefined(this.tooltipTargetEle) && this.parent.showTooltip && !isNullOrUndefined(currentDocument.querySelector('.e-tooltip-wrap'))) {
21452
21661
  this.parent.notify(destroyTooltip, { args: event });
21453
- this.tooltipTargetEle.setAttribute('data-title', this.tooltipTargetEle.getAttribute('title'));
21454
- this.tooltipTargetEle.removeAttribute('title');
21455
- EventHandler.add(this.tooltipTargetEle, 'mouseout', this.mouseOutHandler, this);
21662
+ if (!this.tooltipTargetEle.closest('.e-rte-quick-popup')) {
21663
+ this.tooltipTargetEle.setAttribute('data-title', this.tooltipTargetEle.getAttribute('title'));
21664
+ this.tooltipTargetEle.removeAttribute('title');
21665
+ EventHandler.add(this.tooltipTargetEle, 'mouseout', this.mouseOutHandler, this);
21666
+ }
21456
21667
  }
21457
21668
  if (item.command !== 'FormatPainter') {
21458
21669
  if (closestElement && !closestElement.classList.contains('e-rte-inline-popup') && !closestElement.classList.contains('e-rte-text-popup')) {
@@ -21745,6 +21956,7 @@ class PasteCleanup {
21745
21956
  this.parent.on(pasteClean, this.pasteClean, this);
21746
21957
  this.parent.on(bindCssClass, this.setCssClass, this);
21747
21958
  this.parent.on(destroy, this.destroy, this);
21959
+ this.parent.on(docClick, this.docClick, this);
21748
21960
  }
21749
21961
  destroy() {
21750
21962
  this.removeEventListener();
@@ -21756,6 +21968,7 @@ class PasteCleanup {
21756
21968
  this.parent.off(pasteClean, this.pasteClean);
21757
21969
  this.parent.off(bindCssClass, this.setCssClass);
21758
21970
  this.parent.off(destroy, this.destroy);
21971
+ this.parent.off(docClick, this.docClick);
21759
21972
  }
21760
21973
  pasteClean(e) {
21761
21974
  const args = {
@@ -21824,6 +22037,12 @@ class PasteCleanup {
21824
22037
  this.saveSelection = this.nodeSelectionObj.save(range, currentDocument);
21825
22038
  const tempDivElem = this.parent.createElement('div');
21826
22039
  tempDivElem.innerHTML = value;
22040
+ const unsupportedImg = tempDivElem.querySelectorAll('.e-rte-image-unsupported');
22041
+ for (let index = 0; index < unsupportedImg.length; index++) {
22042
+ unsupportedImg[index].setAttribute('alt', this.i10n.getConstant('unsupportedImage'));
22043
+ unsupportedImg[index].classList.remove('e-rte-image-unsupported');
22044
+ }
22045
+ value = tempDivElem.innerHTML;
21827
22046
  const isValueNotEmpty = tempDivElem.textContent !== '' || !isNullOrUndefined(tempDivElem.querySelector('img')) ||
21828
22047
  !isNullOrUndefined(tempDivElem.querySelector('table'));
21829
22048
  this.parent.notify(cleanupResizeElements, {
@@ -22103,7 +22322,9 @@ class PasteCleanup {
22103
22322
  });
22104
22323
  popupObj.close();
22105
22324
  imgElem.style.opacity = '1';
22106
- uploadObj.destroy();
22325
+ if (!uploadObj.isDestroyed) {
22326
+ uploadObj.destroy();
22327
+ }
22107
22328
  this.toolbarEnableDisable(false);
22108
22329
  }
22109
22330
  refreshPopup(imageElement, popupObj) {
@@ -22253,7 +22474,7 @@ class PasteCleanup {
22253
22474
  width: '300px',
22254
22475
  height: '265px',
22255
22476
  cssClass: CLS_RTE_DIALOG_MIN_HEIGHT,
22256
- isModal: true,
22477
+ isModal: Browser.isDevice,
22257
22478
  visible: false
22258
22479
  };
22259
22480
  this.dialogObj = this.dialogRenderObj.render(dialogModel);
@@ -22307,13 +22528,22 @@ class PasteCleanup {
22307
22528
  this.updateCss(this.keepRadioButton, e);
22308
22529
  }
22309
22530
  destroyDialog(rteDialogWrapper) {
22310
- const rteDialogContainer = this.parent.element.querySelector('.e-dlg-container');
22531
+ const rteDialogContainer = this.parent.element.querySelector('.e-rte-dialog-minheight');
22311
22532
  detach(rteDialogContainer);
22312
22533
  const rteDialogWrapperChildLength = rteDialogWrapper.children.length;
22313
22534
  for (let i = 0; i < rteDialogWrapperChildLength; i++) {
22314
22535
  detach(rteDialogWrapper.children[0]);
22315
22536
  }
22316
22537
  }
22538
+ docClick(e) {
22539
+ const target = e.args.target;
22540
+ if (target && target.classList && ((this.dialogObj && !closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']')))
22541
+ && (!target.classList.contains('e-toolbar-item'))) {
22542
+ if (this.dialogObj) {
22543
+ this.dialogObj.hide();
22544
+ }
22545
+ }
22546
+ }
22317
22547
  cleanAppleClass(elem) {
22318
22548
  const appleClassElem = elem.querySelectorAll('br.Apple-interchange-newline');
22319
22549
  for (let i = 0; i < appleClassElem.length; i++) {
@@ -22386,7 +22616,8 @@ class PasteCleanup {
22386
22616
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
22387
22617
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
22388
22618
  this.parent.formatter.onSuccess(this.parent, args);
22389
- if (!isNullOrUndefined(returnArgs.elements) && !isNullOrUndefined(returnArgs.imgElem)) {
22619
+ if (!isNullOrUndefined(returnArgs.elements) && !isNullOrUndefined(returnArgs.imgElem) &&
22620
+ returnArgs.imgElem.length > 0) {
22390
22621
  const pasteContent = returnArgs.elements;
22391
22622
  const imageContent = returnArgs.imgElem;
22392
22623
  const lastElementChild = this.findLastElement(pasteContent[pasteContent.length - 1]);
@@ -22451,6 +22682,7 @@ class PasteCleanup {
22451
22682
  }
22452
22683
  }
22453
22684
  addTableClass(element, source) {
22685
+ source = isNullOrUndefined(source) ? '' : source;
22454
22686
  const tableElement = element.querySelectorAll('table');
22455
22687
  for (let i = 0; i < tableElement.length; i++) {
22456
22688
  if (!tableElement[i].classList.contains('e-rte-table') && (source === 'html' || source === '')) {
@@ -26054,7 +26286,7 @@ class Image$1 {
26054
26286
  this.checkBoxObj.createElement = this.parent.createElement;
26055
26287
  this.checkBoxObj.appendTo(linkTarget);
26056
26288
  let target = this.checkBoxObj.checked ? '_blank' : null;
26057
- let imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : null;
26289
+ let imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null;
26058
26290
  const linkUpdate = this.i10n.getConstant('dialogUpdate');
26059
26291
  const linkargs = {
26060
26292
  args: e.args,
@@ -26173,14 +26405,14 @@ class Image$1 {
26173
26405
  }
26174
26406
  if (e.selectNode[0].parentElement.nodeName === 'A') {
26175
26407
  proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
26176
- url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : null, selectNode: e.selectNode,
26408
+ url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
26177
26409
  subCommand: e.args.item.subCommand
26178
26410
  });
26179
26411
  proxy.dialogObj.hide({ returnValue: true });
26180
26412
  return;
26181
26413
  }
26182
26414
  proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
26183
- url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('ImageLinkAriaLabel') : null, selectNode: e.selectNode,
26415
+ url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
26184
26416
  subCommand: e.args.item.subCommand, selection: e.selection
26185
26417
  });
26186
26418
  const captionEle = closest(e.selectNode[0], '.e-img-caption');
@@ -30544,11 +30776,11 @@ class Table {
30544
30776
  colReEle.classList.add(CLS_RTE_TABLE_RESIZE, CLS_TB_COL_RES);
30545
30777
  if (columns.length === i) {
30546
30778
  colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
30547
- 'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth) + 'px;';
30779
+ 'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth - 2) + 'px;';
30548
30780
  }
30549
30781
  else {
30550
30782
  colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
30551
- 'px; left:' + (pos.left + this.calcPos(columns[i]).left) + 'px;';
30783
+ 'px; left:' + (pos.left + this.calcPos(columns[i]).left - 2) + 'px;';
30552
30784
  }
30553
30785
  this.contentModule.getEditPanel().appendChild(colReEle);
30554
30786
  }
@@ -30580,7 +30812,7 @@ class Table {
30580
30812
  }
30581
30813
  removeResizeElement() {
30582
30814
  const item = this.parent.contentModule.getEditPanel().
30583
- querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box, .e-table-rhelper');
30815
+ querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box');
30584
30816
  if (item.length > 0) {
30585
30817
  for (let i = 0; i < item.length; i++) {
30586
30818
  detach(item[i]);
@@ -30673,6 +30905,44 @@ class Table {
30673
30905
  }
30674
30906
  else {
30675
30907
  this.currentColumnResize = 'middle';
30908
+ const cellColl = this.curTable.rows[0].cells;
30909
+ let cellCount = 0;
30910
+ for (let cell = 0; cell < cellColl.length; cell++) {
30911
+ cellCount = cellCount + cellColl[cell].colSpan;
30912
+ }
30913
+ const sizes = new Array(cellCount);
30914
+ const colGroupEle = createElement('colgroup');
30915
+ const rowSpanCells = new Map();
30916
+ for (let i = 0; i < this.curTable.rows.length; i++) {
30917
+ let currentColIndex = 0;
30918
+ for (let k = 0; k < this.curTable.rows[i].cells.length; k++) {
30919
+ for (let l = 1; l < this.curTable.rows[i].cells[k].rowSpan; l++) {
30920
+ const key = `${i + l}${currentColIndex}`;
30921
+ rowSpanCells.set(key, this.curTable.rows[i].cells[k]);
30922
+ }
30923
+ const cellIndex = this.getCellIndex(rowSpanCells, i, k);
30924
+ if (cellIndex > currentColIndex) {
30925
+ currentColIndex = cellIndex;
30926
+ }
30927
+ const width = this.curTable.rows[i].cells[k].offsetWidth;
30928
+ if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
30929
+ sizes[currentColIndex] = width;
30930
+ }
30931
+ currentColIndex += 1 + this.curTable.rows[i].cells[k].colSpan - 1;
30932
+ }
30933
+ }
30934
+ for (let size = 0; size < sizes.length; size++) {
30935
+ const cell = createElement('col');
30936
+ cell.appendChild(createElement('br'));
30937
+ cell.style.width = this.convertPixelToPercentage(sizes[size], parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
30938
+ colGroupEle.appendChild(cell);
30939
+ }
30940
+ this.curTable.insertBefore(colGroupEle, this.curTable.firstChild);
30941
+ for (let i = 0; i < this.curTable.rows.length; i++) {
30942
+ for (let k = 0; k < this.curTable.rows[i].cells.length; k++) {
30943
+ this.curTable.rows[i].cells[k].style.width = '';
30944
+ }
30945
+ }
30676
30946
  }
30677
30947
  this.columnEle = this.curTable.rows[this.calMaxCol(this.curTable)].cells[parseInt(target.getAttribute('data-col'), 10)];
30678
30948
  }
@@ -30705,6 +30975,16 @@ class Table {
30705
30975
  EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
30706
30976
  }
30707
30977
  }
30978
+ getCellIndex(rowSpanCells, rowIndex, colIndex) {
30979
+ const cellKey = `${rowIndex}${colIndex}`;
30980
+ const spannedCell = rowSpanCells.get(cellKey);
30981
+ if (spannedCell) {
30982
+ return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
30983
+ }
30984
+ else {
30985
+ return colIndex;
30986
+ }
30987
+ }
30708
30988
  removeHelper(e) {
30709
30989
  const cls = e.target.classList;
30710
30990
  if (!(cls.contains('e-reicon')) && this.helper) {
@@ -30733,12 +31013,12 @@ class Table {
30733
31013
  this.helper.classList.add('e-column-helper');
30734
31014
  this.helper.style.cssText = 'height: ' + getComputedStyle(this.curTable).height + '; top: ' +
30735
31015
  pos.top + 'px; left:' + ((pos.left + this.calcPos(this.columnEle).left) +
30736
- (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth + 2 : 0) - 1) + 'px;';
31016
+ (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1) + 'px;';
30737
31017
  }
30738
31018
  else {
30739
31019
  this.helper.classList.add('e-row-helper');
30740
31020
  this.helper.style.cssText = 'width: ' + getComputedStyle(this.curTable).width + '; top: ' +
30741
- (this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight) +
31021
+ (this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1) +
30742
31022
  'px; left:' + (this.calcPos(this.rowEle).left + pos.left) + 'px;';
30743
31023
  }
30744
31024
  }
@@ -30746,11 +31026,12 @@ class Table {
30746
31026
  const pos = this.calcPos(this.curTable);
30747
31027
  if (this.resizeBtnStat.column) {
30748
31028
  const left = (pos.left + this.calcPos(this.columnEle).left) +
30749
- (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth + 2 : 0) - 1;
31029
+ (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1;
30750
31030
  this.helper.style.left = left + 'px';
31031
+ this.helper.style.height = this.curTable.offsetHeight + 'px';
30751
31032
  }
30752
31033
  else {
30753
- const top = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight;
31034
+ const top = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1;
30754
31035
  this.helper.style.top = top + 'px';
30755
31036
  }
30756
31037
  }
@@ -30775,10 +31056,6 @@ class Table {
30775
31056
  let maxiumWidth;
30776
31057
  const currentTdElement = this.curTable.closest('td');
30777
31058
  const args = { event: e, requestType: 'table' };
30778
- let isRowCellsMerged = false;
30779
- let isColCellsMerged = false;
30780
- let mergedCellIndex;
30781
- let mergedElement;
30782
31059
  this.parent.trigger(onResize, args, (resizingArgs) => {
30783
31060
  if (resizingArgs.cancel) {
30784
31061
  this.cancelResizeAction();
@@ -30803,7 +31080,7 @@ class Table {
30803
31080
  widthCompare = rteWidth;
30804
31081
  }
30805
31082
  if (this.resizeBtnStat.column) {
30806
- const width = parseFloat(this.columnEle.offsetWidth.toString());
31083
+ const colGroup = this.curTable.querySelectorAll('colgroup > col');
30807
31084
  const cellRow = this.curTable.rows[0].cells[0].nodeName === 'TH' ? 1 : 0;
30808
31085
  let currentTableWidth;
30809
31086
  if (this.curTable.style.width !== '' && this.curTable.style.width.includes('%')) {
@@ -30856,98 +31133,36 @@ class Table {
30856
31133
  }
30857
31134
  }
30858
31135
  else {
30859
- const cellColl = this.curTable.rows[this.calMaxCol(this.curTable)].cells;
30860
- const actualwid = width - mouseX;
30861
- const totalwid = parseFloat(this.columnEle.offsetWidth.toString()) +
30862
- parseFloat(cellColl[this.colIndex - 1].offsetWidth.toString());
30863
- for (let i = 0; i < this.curTable.rows.length; i++) {
30864
- const currentRow = this.curTable.rows[i];
30865
- if ((totalwid - actualwid) > 20 && actualwid > 20) {
30866
- const leftColumnWidth = totalwid - actualwid;
30867
- const rightColWidth = actualwid;
30868
- let index;
30869
- let isMergedEleResize = false;
30870
- let leftTableCell;
30871
- let rightTableCell;
30872
- isColCellsMerged = false;
30873
- isRowCellsMerged = false;
30874
- /* eslint-disable */
30875
- for (let j = 0; j < currentRow.cells.length; j++) {
30876
- if (currentRow.cells[j].hasAttribute('rowspan') && j <= this.colIndex) {
30877
- isRowCellsMerged = true;
30878
- mergedCellIndex = i;
30879
- mergedElement = currentRow.cells[j];
30880
- }
30881
- else if (currentRow.cells[j].hasAttribute('colspan') && j <= currentRow.cells.length) {
30882
- isColCellsMerged = true;
30883
- mergedCellIndex = i;
30884
- mergedElement = currentRow.cells[j];
30885
- }
30886
- }
30887
- if (!isNullOrUndefined(currentRow.cells[i]) && currentRow.cells[i].hasAttribute('colspan')) {
30888
- index = parseInt(currentRow.cells[i].getAttribute('colspan'), 10) - 1;
30889
- }
30890
- else {
30891
- index = this.colIndex;
30892
- }
30893
- if (isRowCellsMerged || isColCellsMerged) {
30894
- let currentResizeRow;
30895
- if (currentRow.cells.length < cellColl.length) {
30896
- index = currentRow.cells.length === this.colIndex || currentRow === this.curTable.rows[this.curTable.rows.length - 1] ?
30897
- this.colIndex - 1 : this.colIndex;
30898
- currentResizeRow = this.curTable.rows[!isNullOrUndefined(mergedCellIndex) ?
30899
- mergedCellIndex : this.colIndex - 1];
30900
- if (currentResizeRow && currentResizeRow !== currentRow && (currentResizeRow.cells[this.colIndex - 1] === mergedElement ||
30901
- currentResizeRow.cells[currentResizeRow.cells.length - 1] === mergedElement)) {
30902
- isMergedEleResize = true;
30903
- }
30904
- else {
30905
- isMergedEleResize = false;
30906
- }
30907
- }
30908
- else {
30909
- index = this.colIndex;
30910
- }
30911
- leftTableCell = !isMergedEleResize ? currentRow.cells[index - 1] : (currentResizeRow &&
30912
- currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement) ?
30913
- currentResizeRow.cells[this.colIndex - 1] : currentRow.cells[currentRow.cells.length - 1];
30914
- rightTableCell = !isMergedEleResize ? currentRow.cells[index] : rightTableCell && rightTableCell.hasAttribute('rowspan') ?
30915
- currentResizeRow.cells[this.colIndex] : currentResizeRow && currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement ?
30916
- currentRow.cells[index - 1] : currentResizeRow.cells[currentResizeRow.cells.length - 1];
30917
- }
30918
- if (!isNullOrUndefined(currentRow.cells[index - 1]) && !isRowCellsMerged && !isColCellsMerged) {
30919
- currentRow.cells[index - 1].style.width =
30920
- this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
30921
- }
30922
- else {
30923
- if (leftTableCell) {
30924
- leftTableCell.style.width =
30925
- this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
30926
- }
30927
- }
30928
- if (!isNullOrUndefined(currentRow.cells[index]) && !isRowCellsMerged && !isColCellsMerged) {
30929
- currentRow.cells[index].style.width =
30930
- this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
30931
- }
30932
- else {
30933
- if (rightTableCell) {
30934
- rightTableCell.style.width =
30935
- this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
30936
- }
30937
- }
30938
- /* eslint-enable */
30939
- }
31136
+ const actualwid = colGroup[this.colIndex].offsetWidth - mouseX;
31137
+ // eslint-disable-next-line
31138
+ const totalwid = colGroup[this.colIndex].offsetWidth + colGroup[this.colIndex - 1].offsetWidth;
31139
+ if ((totalwid - actualwid) > 20 && actualwid > 20) {
31140
+ const leftColumnWidth = totalwid - actualwid;
31141
+ const rightColWidth = actualwid;
31142
+ colGroup[this.colIndex - 1].style.width = this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
31143
+ colGroup[this.colIndex].style.width = this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
30940
31144
  }
30941
31145
  }
30942
31146
  this.updateHelper();
30943
31147
  }
30944
31148
  else if (this.resizeBtnStat.row) {
30945
31149
  this.parent.preventDefaultResize(e);
30946
- const height = parseFloat(this.rowEle.clientHeight.toString()) + mouseY;
30947
- if (height > 20) {
30948
- this.rowEle.style.height = height + 'px';
31150
+ const tableTrElementPixel = [];
31151
+ const currentTableTrElement = this.curTable.querySelectorAll('tr');
31152
+ for (let i = 0; i < currentTableTrElement.length; i++) {
31153
+ if (this.rowEle !== currentTableTrElement[i]) {
31154
+ tableTrElementPixel[i] = (parseFloat(currentTableTrElement[i].clientHeight.toString()));
31155
+ }
31156
+ }
31157
+ this.curTable.style.height = (parseFloat(this.curTable.clientHeight.toString()) + mouseY) + 'px';
31158
+ for (let i = 0; i < currentTableTrElement.length; i++) {
31159
+ if (this.rowEle === currentTableTrElement[i]) {
31160
+ currentTableTrElement[i].style.height = (parseFloat(currentTableTrElement[i].clientHeight.toString()) + mouseY) + 'px';
31161
+ }
31162
+ else {
31163
+ currentTableTrElement[i].style.height = tableTrElementPixel[i] + 'px';
31164
+ }
30949
31165
  }
30950
- this.curTable.style.height = '';
30951
31166
  if (!isNullOrUndefined(tableReBox)) {
30952
31167
  tableReBox.style.cssText = 'top: ' + (this.calcPos(this.curTable).top + tableHeight - 4) +
30953
31168
  'px; left:' + (this.calcPos(this.curTable).left + tableWidth - 4) + 'px;';
@@ -31010,9 +31225,34 @@ class Table {
31010
31225
  detach(this.helper);
31011
31226
  this.helper = null;
31012
31227
  }
31228
+ const colHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-column-helper');
31229
+ Array.from(colHelper).forEach((element) => {
31230
+ if (element.parentNode) {
31231
+ element.parentNode.removeChild(element);
31232
+ }
31233
+ });
31234
+ for (let i = 0; i < this.curTable.rows.length; i++) {
31235
+ for (let k = 0; k < this.curTable.rows[i].cells.length; k++) {
31236
+ const width = this.convertPixelToPercentage(this.curTable.rows[i].cells[k].offsetWidth, parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
31237
+ this.curTable.rows[i].cells[k].style.width = width;
31238
+ }
31239
+ }
31240
+ const colGroup = this.curTable.querySelector('colgroup');
31241
+ if (colGroup) {
31242
+ this.curTable.removeChild(colGroup);
31243
+ }
31013
31244
  this.pageX = null;
31014
31245
  this.pageY = null;
31015
31246
  this.moveEle = null;
31247
+ const currentTableTrElement = this.curTable.querySelectorAll("tr");
31248
+ const tableTrPercentage = [];
31249
+ for (let i = 0; i < currentTableTrElement.length; i++) {
31250
+ const percentage = (parseFloat(currentTableTrElement[i].clientHeight.toString()) / parseFloat(this.curTable.clientHeight.toString())) * 100;
31251
+ tableTrPercentage[i] = percentage;
31252
+ }
31253
+ for (let i = 0; i < currentTableTrElement.length; i++) {
31254
+ currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
31255
+ }
31016
31256
  const args = { event: e, requestType: 'table' };
31017
31257
  this.parent.trigger(resizeStop, args);
31018
31258
  this.parent.formatter.saveData();
@@ -32705,10 +32945,10 @@ class EnterKeyAction {
32705
32945
  }
32706
32946
  const previousBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].previousSibling;
32707
32947
  const nextBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].nextSibling;
32708
- if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.hasAttribute('style')) {
32948
+ if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.hasAttribute('style') && previousBlockNode.nodeName !== 'TABLE') {
32709
32949
  insertElem.setAttribute('style', previousBlockNode.getAttribute('style'));
32710
32950
  }
32711
- if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.hasAttribute('style')) {
32951
+ if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.hasAttribute('style') && nextBlockNode.nodeName !== 'TABLE') {
32712
32952
  insertElem.setAttribute('style', nextBlockNode.getAttribute('style'));
32713
32953
  }
32714
32954
  return insertElem;
@@ -33463,6 +33703,16 @@ let RichTextEditor = class RichTextEditor extends Component {
33463
33703
  keyUp(e) {
33464
33704
  if (this.editorMode === 'HTML') {
33465
33705
  const range = this.getRange();
33706
+ if (!isNullOrUndefined(e) && !isNullOrUndefined(e.code) && (e.code === 'Backspace' || e.code === 'Delete')) {
33707
+ // To prevent the reformatting the content removed browser behavior.
33708
+ const currentRange = this.getRange();
33709
+ const selection = this.iframeSettings.enable ? this.contentModule.getPanel().ownerDocument.getSelection() :
33710
+ this.contentModule.getDocument().getSelection();
33711
+ if (selection.rangeCount > 0) {
33712
+ selection.removeAllRanges();
33713
+ selection.addRange(currentRange);
33714
+ }
33715
+ }
33466
33716
  if (Browser.userAgent.indexOf('Firefox') !== -1 && range.startContainer.nodeName === '#text' &&
33467
33717
  range.startContainer.parentElement === this.inputElement && this.enterKey !== 'BR') {
33468
33718
  const range = this.getRange();
@@ -34330,10 +34580,10 @@ let RichTextEditor = class RichTextEditor extends Component {
34330
34580
  if (this.iframeSettings.resources) {
34331
34581
  const styleSrc = this.iframeSettings.resources.styles;
34332
34582
  const scriptSrc = this.iframeSettings.resources.scripts;
34333
- if (this.iframeSettings.resources.scripts.length > 0) {
34583
+ if (!isNullOrUndefined(this.iframeSettings.resources.scripts) && this.iframeSettings.resources.scripts.length > 0) {
34334
34584
  this.InjectSheet(true, scriptSrc);
34335
34585
  }
34336
- if (this.iframeSettings.resources.styles.length > 0) {
34586
+ if (!isNullOrUndefined(this.iframeSettings.resources.styles) && this.iframeSettings.resources.styles.length > 0) {
34337
34587
  this.InjectSheet(false, styleSrc);
34338
34588
  }
34339
34589
  }