@syncfusion/ej2-richtexteditor 20.3.61 → 20.4.38

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 (100) hide show
  1. package/.eslintrc.json +16 -1
  2. package/CHANGELOG.md +0 -40
  3. package/README.md +53 -45
  4. package/dist/ej2-richtexteditor.min.js +2 -2
  5. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  6. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es2015.js +312 -181
  8. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  9. package/dist/es6/ej2-richtexteditor.es5.js +300 -168
  10. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  11. package/dist/global/ej2-richtexteditor.min.js +2 -2
  12. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  13. package/dist/global/index.d.ts +1 -1
  14. package/package.json +15 -15
  15. package/src/editor-manager/plugin/clearformat.js +2 -1
  16. package/src/editor-manager/plugin/dom-node.js +1 -1
  17. package/src/editor-manager/plugin/formats.js +1 -0
  18. package/src/editor-manager/plugin/image.js +1 -0
  19. package/src/editor-manager/plugin/link.js +3 -1
  20. package/src/editor-manager/plugin/lists.js +15 -7
  21. package/src/editor-manager/plugin/ms-word-clean-up.js +6 -2
  22. package/src/editor-manager/plugin/selection-commands.js +8 -41
  23. package/src/editor-manager/plugin/table.js +6 -0
  24. package/src/editor-manager/plugin/toolbar-status.js +3 -0
  25. package/src/editor-manager/plugin/video.js +2 -2
  26. package/src/markdown-parser/plugin/clearformat.js +9 -7
  27. package/src/markdown-parser/plugin/formats.js +6 -5
  28. package/src/markdown-parser/plugin/lists.js +5 -0
  29. package/src/markdown-parser/plugin/markdown-selection.js +3 -0
  30. package/src/markdown-parser/plugin/md-selection-formats.js +13 -10
  31. package/src/rich-text-editor/actions/enter-key.js +66 -15
  32. package/src/rich-text-editor/actions/file-manager.js +1 -0
  33. package/src/rich-text-editor/actions/html-attributes.js +8 -8
  34. package/src/rich-text-editor/actions/html-editor.js +2 -0
  35. package/src/rich-text-editor/actions/keyboard.js +4 -4
  36. package/src/rich-text-editor/actions/markdown-toolbar-status.js +2 -1
  37. package/src/rich-text-editor/actions/paste-clean-up.js +2 -1
  38. package/src/rich-text-editor/actions/toolbar.js +2 -0
  39. package/src/rich-text-editor/base/constant.d.ts +8 -8
  40. package/src/rich-text-editor/base/constant.js +8 -8
  41. package/src/rich-text-editor/base/rich-text-editor.d.ts +2 -0
  42. package/src/rich-text-editor/base/rich-text-editor.js +43 -10
  43. package/src/rich-text-editor/base/util.js +9 -9
  44. package/src/rich-text-editor/renderer/audio-module.d.ts +1 -1
  45. package/src/rich-text-editor/renderer/audio-module.js +7 -5
  46. package/src/rich-text-editor/renderer/image-module.js +10 -6
  47. package/src/rich-text-editor/renderer/link-module.js +5 -4
  48. package/src/rich-text-editor/renderer/table-module.js +19 -5
  49. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +1 -0
  50. package/src/rich-text-editor/renderer/toolbar-renderer.js +1 -0
  51. package/src/rich-text-editor/renderer/video-module.d.ts +1 -1
  52. package/src/rich-text-editor/renderer/video-module.js +13 -4
  53. package/src/rich-text-editor/services/renderer-factory.js +4 -4
  54. package/src/rich-text-editor/services/service-locator.js +4 -4
  55. package/src/selection/selection.js +2 -0
  56. package/styles/bootstrap-dark.css +12 -5
  57. package/styles/bootstrap.css +12 -5
  58. package/styles/bootstrap4.css +12 -5
  59. package/styles/bootstrap5-dark.css +12 -5
  60. package/styles/bootstrap5.css +12 -5
  61. package/styles/fabric-dark.css +12 -5
  62. package/styles/fabric.css +12 -5
  63. package/styles/fluent-dark.css +12 -5
  64. package/styles/fluent.css +12 -5
  65. package/styles/highcontrast-light.css +12 -5
  66. package/styles/highcontrast.css +12 -5
  67. package/styles/material-dark.css +12 -5
  68. package/styles/material.css +12 -5
  69. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -0
  70. package/styles/rich-text-editor/_bootstrap-definition.scss +1 -0
  71. package/styles/rich-text-editor/_bootstrap4-definition.scss +1 -0
  72. package/styles/rich-text-editor/_bootstrap5-definition.scss +1 -0
  73. package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -0
  74. package/styles/rich-text-editor/_fabric-definition.scss +1 -0
  75. package/styles/rich-text-editor/_fluent-definition.scss +1 -0
  76. package/styles/rich-text-editor/_fusionnew-definition.scss +1 -0
  77. package/styles/rich-text-editor/_highcontrast-definition.scss +1 -0
  78. package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -0
  79. package/styles/rich-text-editor/_material-dark-definition.scss +1 -0
  80. package/styles/rich-text-editor/_material-definition.scss +1 -0
  81. package/styles/rich-text-editor/_material3-definition.scss +1 -0
  82. package/styles/rich-text-editor/_tailwind-definition.scss +1 -0
  83. package/styles/rich-text-editor/_theme.scss +11 -6
  84. package/styles/rich-text-editor/bootstrap-dark.css +12 -5
  85. package/styles/rich-text-editor/bootstrap.css +12 -5
  86. package/styles/rich-text-editor/bootstrap4.css +12 -5
  87. package/styles/rich-text-editor/bootstrap5-dark.css +12 -5
  88. package/styles/rich-text-editor/bootstrap5.css +12 -5
  89. package/styles/rich-text-editor/fabric-dark.css +12 -5
  90. package/styles/rich-text-editor/fabric.css +12 -5
  91. package/styles/rich-text-editor/fluent-dark.css +12 -5
  92. package/styles/rich-text-editor/fluent.css +12 -5
  93. package/styles/rich-text-editor/highcontrast-light.css +12 -5
  94. package/styles/rich-text-editor/highcontrast.css +12 -5
  95. package/styles/rich-text-editor/material-dark.css +12 -5
  96. package/styles/rich-text-editor/material.css +12 -5
  97. package/styles/rich-text-editor/tailwind-dark.css +12 -5
  98. package/styles/rich-text-editor/tailwind.css +12 -5
  99. package/styles/tailwind-dark.css +12 -5
  100. package/styles/tailwind.css +12 -5
@@ -580,24 +580,24 @@ const imageRemoving = 'imageRemoving';
580
580
  */
581
581
  const fileSelected = 'fileSelected';
582
582
  /**
583
- * @hidden
584
- * @deprecated
585
- */
583
+ * @hidden
584
+ * @deprecated
585
+ */
586
586
  const fileUploading = 'fileUploading';
587
587
  /**
588
- * @hidden
589
- * @deprecated
590
- */
588
+ * @hidden
589
+ * @deprecated
590
+ */
591
591
  const fileUploadSuccess = 'fileUploadSuccess';
592
592
  /**
593
- * @hidden
594
- * @deprecated
595
- */
593
+ * @hidden
594
+ * @deprecated
595
+ */
596
596
  const fileUploadFailed = 'fileUploadFailed';
597
597
  /**
598
- * @hidden
599
- * @deprecated
600
- */
598
+ * @hidden
599
+ * @deprecated
600
+ */
601
601
  const fileRemoving = 'fileRemoving';
602
602
  /**
603
603
  * @hidden
@@ -2584,7 +2584,7 @@ function pageYOffset(e, parentElement, isIFrame) {
2584
2584
  */
2585
2585
  function getTooltipText(item, serviceLocator) {
2586
2586
  const i10n = serviceLocator.getService('rteLocale');
2587
- const itemLocale = toolsLocale[item];
2587
+ const itemLocale = toolsLocale[`${item}`];
2588
2588
  const tooltipText = i10n.getConstant(itemLocale);
2589
2589
  return tooltipText;
2590
2590
  }
@@ -2606,17 +2606,17 @@ function setToolbarStatus(e, isPopToolbar, self) {
2606
2606
  const itemStr = item && item.toLocaleLowerCase();
2607
2607
  if (item && (itemStr === key) || (item === 'UL' && key === 'unorderedlist') || (item === 'OL' && key === 'orderedlist') ||
2608
2608
  (itemStr === 'pre' && key === 'insertcode')) {
2609
- if (typeof data[key] === 'boolean') {
2610
- if (data[key] === true) {
2609
+ if (typeof data[`${key}`] === 'boolean') {
2610
+ if (data[`${key}`] === true) {
2611
2611
  addClass([e.tbElements[j]], [CLS_ACTIVE]);
2612
2612
  }
2613
2613
  else {
2614
2614
  removeClass([e.tbElements[j]], [CLS_ACTIVE]);
2615
2615
  }
2616
2616
  }
2617
- else if ((typeof data[key] === 'string' || data[key] === null) &&
2617
+ else if ((typeof data[`${key}`] === 'string' || data[`${key}`] === null) &&
2618
2618
  getIndex(key, e.parent.toolbarSettings.items) > -1) {
2619
- const value = ((data[key]) ? data[key] : '');
2619
+ const value = ((data[`${key}`]) ? data[`${key}`] : '');
2620
2620
  let result = '';
2621
2621
  switch (key) {
2622
2622
  case 'formats': {
@@ -2630,7 +2630,7 @@ function setToolbarStatus(e, isPopToolbar, self) {
2630
2630
  result = getDropDownValue(formatItems$$1, value, 'subCommand', 'text');
2631
2631
  dropDown.formatDropDown.content = ('<span style="display: inline-flex;' +
2632
2632
  'width:' + e.parent.format.width + '" >' +
2633
- '<span class="e-rte-dropdown-btn-text' + ' ' + e.parent.cssClass + '">'
2633
+ '<span class="e-rte-dropdown-btn-text' + (isNullOrUndefined(e.parent.cssClass) ? '' : ' ' + e.parent.cssClass) + '">'
2634
2634
  + (isNullOrUndefined(result) ? formatContent : result) +
2635
2635
  '</span></span>');
2636
2636
  dropDown.formatDropDown.dataBind();
@@ -2660,7 +2660,7 @@ function setToolbarStatus(e, isPopToolbar, self) {
2660
2660
  e.tbElements[j].title = name;
2661
2661
  dropDown.fontNameDropDown.content = ('<span style="display: inline-flex;' +
2662
2662
  'width:' + e.parent.fontFamily.width + '" >' +
2663
- '<span class="e-rte-dropdown-btn-text' + ' ' + e.parent.cssClass + '">'
2663
+ '<span class="e-rte-dropdown-btn-text' + (isNullOrUndefined(e.parent.cssClass) ? '' : ' ' + e.parent.cssClass) + '">'
2664
2664
  + name + '</span></span>');
2665
2665
  dropDown.fontNameDropDown.dataBind();
2666
2666
  break;
@@ -2676,7 +2676,7 @@ function setToolbarStatus(e, isPopToolbar, self) {
2676
2676
  result = getDropDownValue(fontSizeItems, (value === '' ? fontSizeContent.replace(/\s/g, '') : value), 'value', 'text');
2677
2677
  dropDown.fontSizeDropDown.content = ('<span style="display: inline-flex;' +
2678
2678
  'width:' + e.parent.fontSize.width + '" >' +
2679
- '<span class="e-rte-dropdown-btn-text' + ' ' + e.parent.cssClass + '">'
2679
+ '<span class="e-rte-dropdown-btn-text' + (isNullOrUndefined(e.parent.cssClass) ? '' : ' ' + e.parent.cssClass) + '">'
2680
2680
  + getFormattedFontSize(result) + '</span></span>');
2681
2681
  dropDown.fontSizeDropDown.dataBind();
2682
2682
  break;
@@ -2757,7 +2757,7 @@ function updateUndoRedoStatus(baseToolbar, undoRedoStatus) {
2757
2757
  for (const key of keys) {
2758
2758
  const target = tbItems[trgItems[i]];
2759
2759
  if (target) {
2760
- baseToolbar.toolbarObj.enableItems(target, undoRedoStatus[key]);
2760
+ baseToolbar.toolbarObj.enableItems(target, undoRedoStatus[`${key}`]);
2761
2761
  }
2762
2762
  i++;
2763
2763
  }
@@ -3308,6 +3308,7 @@ class ToolbarRenderer {
3308
3308
  * @param {IColorPickerModel} args - specifies the arguments.
3309
3309
  * @param {string} item - specifies the item.
3310
3310
  * @param {ColorPicker} colorPicker - specifies the colorpicker.
3311
+ * @param {string} defaultColor -specifies the defaultColor.
3311
3312
  * @returns {void}
3312
3313
  * @hidden
3313
3314
  * @deprecated
@@ -4304,8 +4305,8 @@ class ServiceLocator {
4304
4305
  */
4305
4306
  /* eslint-enable */
4306
4307
  register(name, type) {
4307
- if (isNullOrUndefined(this.services[name])) {
4308
- this.services[name] = type;
4308
+ if (isNullOrUndefined(this.services[`${name}`])) {
4309
+ this.services[`${name}`] = type;
4309
4310
  }
4310
4311
  }
4311
4312
  /**
@@ -4317,11 +4318,11 @@ class ServiceLocator {
4317
4318
  * @deprecated
4318
4319
  */
4319
4320
  getService(name) {
4320
- if (isNullOrUndefined(this.services[name])) {
4321
+ if (isNullOrUndefined(this.services[`${name}`])) {
4321
4322
  // eslint-disable-next-line
4322
4323
  throw `The service ${name} is not registered`;
4323
4324
  }
4324
- return this.services[name];
4325
+ return this.services[`${name}`];
4325
4326
  }
4326
4327
  }
4327
4328
 
@@ -4346,8 +4347,8 @@ class RendererFactory {
4346
4347
  */
4347
4348
  addRenderer(name, type) {
4348
4349
  const rName = getEnumValue(RenderType, name);
4349
- if (isNullOrUndefined(this.rendererMap[rName])) {
4350
- this.rendererMap[rName] = type;
4350
+ if (isNullOrUndefined(this.rendererMap[`${rName}`])) {
4351
+ this.rendererMap[`${rName}`] = type;
4351
4352
  }
4352
4353
  }
4353
4354
  /**
@@ -4360,12 +4361,12 @@ class RendererFactory {
4360
4361
  */
4361
4362
  getRenderer(name) {
4362
4363
  const rName = getEnumValue(RenderType, name);
4363
- if (isNullOrUndefined(this.rendererMap[rName])) {
4364
+ if (isNullOrUndefined(this.rendererMap[`${rName}`])) {
4364
4365
  // eslint-disable-next-line
4365
4366
  throw `The renderer ${rName} is not found`;
4366
4367
  }
4367
4368
  else {
4368
- return this.rendererMap[rName];
4369
+ return this.rendererMap[`${rName}`];
4369
4370
  }
4370
4371
  }
4371
4372
  }
@@ -4566,6 +4567,7 @@ class Toolbar$2 {
4566
4567
  this.isTransformChild = false;
4567
4568
  const transformElements = selectAll('[style*="transform"]', document);
4568
4569
  for (let i = 0; i < transformElements.length; i++) {
4570
+ // eslint-disable-next-line max-len
4569
4571
  if (!isNullOrUndefined(transformElements[i].contains) && transformElements[i].contains(this.parent.element)) {
4570
4572
  this.isTransformChild = true;
4571
4573
  break;
@@ -5064,6 +5066,7 @@ class Toolbar$2 {
5064
5066
  this.parent.off(toolbarClick, this.toolbarClickHandler);
5065
5067
  }
5066
5068
  }
5069
+ // eslint-disable-next-line @typescript-eslint/tslint/config
5067
5070
  setCssClass(e) {
5068
5071
  if (this.toolbarObj && e.cssClass) {
5069
5072
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -5232,7 +5235,7 @@ let KeyboardEvents$1 = KeyboardEvents_1 = class KeyboardEvents$$1 extends Base {
5232
5235
  const curkeyCode = e.which;
5233
5236
  const keys = Object.keys(this.keyConfigs);
5234
5237
  for (const key of keys) {
5235
- const configCollection = this.keyConfigs[key].split(',');
5238
+ const configCollection = this.keyConfigs[`${key}`].split(',');
5236
5239
  for (const rconfig of configCollection) {
5237
5240
  const rKeyObj = KeyboardEvents_1.getKeyConfigData(rconfig.trim());
5238
5241
  if (isAltKey === rKeyObj.altKey && (isCtrlKey === rKeyObj.ctrlKey || isMetaKey) &&
@@ -5303,7 +5306,7 @@ let KeyboardEvents$1 = KeyboardEvents_1 = class KeyboardEvents$$1 extends Base {
5303
5306
  */
5304
5307
  static getKeyConfigData(config) {
5305
5308
  if (config in this.configCache) {
5306
- return this.configCache[config];
5309
+ return this.configCache[`${config}`];
5307
5310
  }
5308
5311
  const keys = config.toLowerCase().split('+');
5309
5312
  const keyData = {
@@ -5318,12 +5321,12 @@ let KeyboardEvents$1 = KeyboardEvents_1 = class KeyboardEvents$$1 extends Base {
5318
5321
  else {
5319
5322
  keyData.keyCode = KeyboardEvents_1.getKeyCode(keys[keys.length - 1]);
5320
5323
  }
5321
- KeyboardEvents_1.configCache[config] = keyData;
5324
+ KeyboardEvents_1.configCache[`${config}`] = keyData;
5322
5325
  return keyData;
5323
5326
  }
5324
5327
  // Return the keycode value as string
5325
5328
  static getKeyCode(keyVal) {
5326
- return keyCode[keyVal] || keyVal.toUpperCase().charCodeAt(0);
5329
+ return keyCode[`${keyVal}`] || keyVal.toUpperCase().charCodeAt(0);
5327
5330
  }
5328
5331
  };
5329
5332
  KeyboardEvents$1.configCache = {};
@@ -6852,7 +6855,9 @@ class MarkdownSelection {
6852
6855
  let isStart = false;
6853
6856
  if (line) {
6854
6857
  const reg = line.trim() === command.trim() ?
6858
+ // eslint-disable-next-line
6855
6859
  new RegExp('^(' + this.replaceSpecialChar(command.trim()) + ')', 'gim') :
6860
+ // eslint-disable-next-line
6856
6861
  new RegExp('^(' + this.replaceSpecialChar(command) + ')', 'gim');
6857
6862
  isStart = reg.test(line.trim());
6858
6863
  }
@@ -6882,6 +6887,7 @@ class MarkdownSelection {
6882
6887
  isClear(parents, regex) {
6883
6888
  const isClear = false;
6884
6889
  for (let i = 0; i < parents.length; i++) {
6890
+ // eslint-disable-next-line
6885
6891
  if (new RegExp(regex, 'gim').test(parents[i].text)) {
6886
6892
  return true;
6887
6893
  }
@@ -7131,7 +7137,7 @@ class MarkdownToolbarStatus {
7131
7137
  }
7132
7138
  else {
7133
7139
  for (let i = 0; i < lines.length; i++) {
7134
- if (!this.selection.isStartWith(lines[i].text, this.parent.formatter.listTags[type])) {
7140
+ if (!this.selection.isStartWith(lines[i].text, this.parent.formatter.listTags[`${type}`])) {
7135
7141
  isApply = false;
7136
7142
  break;
7137
7143
  }
@@ -7191,6 +7197,7 @@ class MarkdownToolbarStatus {
7191
7197
  return text.search('\\' + cmd + '') !== -1;
7192
7198
  }
7193
7199
  multiCharRegx(cmd) {
7200
+ // eslint-disable-next-line
7194
7201
  return new RegExp('(\\' + cmd + ')', 'g');
7195
7202
  }
7196
7203
  }
@@ -7643,6 +7650,7 @@ class MDLists {
7643
7650
  const regex = this.getListRegex();
7644
7651
  this.currentAction = this.getAction(parents[0].text);
7645
7652
  for (let i = 0; i < parents.length; i++) {
7653
+ // eslint-disable-next-line max-len
7646
7654
  let prevIndex = event.event.shiftKey ? parents[i].line - 1 : parents[i].line - 1;
7647
7655
  let prevLine = this.selection.getLine(textArea, prevIndex);
7648
7656
  if (prevLine && (!event.event.shiftKey && isNotFirst || (event.event.shiftKey))) {
@@ -7690,6 +7698,7 @@ class MDLists {
7690
7698
  addedLength += tabSpaceLength;
7691
7699
  if (parents.length !== 1) {
7692
7700
  for (let j = i; j < parents.length; j++) {
7701
+ // eslint-disable-next-line max-len
7693
7702
  parents[j].start = j !== 0 ? parents[j].start + tabSpaceLength : parents[j].start;
7694
7703
  parents[j].end = parents[j].end + tabSpaceLength;
7695
7704
  }
@@ -7820,6 +7829,7 @@ class MDLists {
7820
7829
  const ol = line.split('. ')[0];
7821
7830
  // eslint-disable-next-line
7822
7831
  const currentState = /^\d+$/.test(ol.trim());
7832
+ // eslint-disable-next-line
7823
7833
  const ul = line.trim().split(new RegExp('^(' + this.selection.replaceSpecialChar(this.syntax.UL).trim() + ')'))[1];
7824
7834
  return (currentState ? 'OL' : ul ? 'UL' : 'NOTLIST');
7825
7835
  }
@@ -7979,6 +7989,7 @@ class MDLists {
7979
7989
  }
7980
7990
  appliedLine(line, prefixPattern, perfixObj, preTabSpaceLength) {
7981
7991
  const points = {};
7992
+ // eslint-disable-next-line
7982
7993
  const regex = new RegExp('^[' + this.syntax.UL.trim() + ']');
7983
7994
  const lineSplit = line.split('. ');
7984
7995
  const currentPrefix = lineSplit[0] + '. ';
@@ -8041,6 +8052,7 @@ class MDLists {
8041
8052
  regex += regex === '' ? '^(' + syntax + ')|^(' + syntax.trim() + ')' :
8042
8053
  '|^(' + syntax + ')|^(' + syntax.trim() + ')';
8043
8054
  }
8055
+ // eslint-disable-next-line
8044
8056
  return new RegExp(regex);
8045
8057
  }
8046
8058
  }
@@ -8165,6 +8177,7 @@ class MDFormats {
8165
8177
  if (configKey[j] === command) {
8166
8178
  continue;
8167
8179
  }
8180
+ // eslint-disable-next-line
8168
8181
  const regex = new RegExp('^(' + this.selection.replaceSpecialChar(removeText) + ')', 'gim');
8169
8182
  if (regex.test(parents[i].text)) {
8170
8183
  parents[i].text = parents[i].text.replace(regex, '');
@@ -8207,14 +8220,14 @@ class MDFormats {
8207
8220
  !this.selection.isStartWith(lastNextText, this.syntax.pre.split('\n')[0])) {
8208
8221
  const lines = textArea.value.substring(start, end).split('\n');
8209
8222
  const lastLine = lines[lines.length - 1] === '' ? '' : '\n';
8210
- textArea.value = textArea.value.substr(0, start) + this.syntax[command] + textArea.value.substring(start, end) +
8211
- lastLine + this.syntax[command] +
8223
+ textArea.value = textArea.value.substr(0, start) + this.syntax[`${command}`] + textArea.value.substring(start, end) +
8224
+ lastLine + this.syntax[`${command}`] +
8212
8225
  textArea.value.substr(end, textArea.value.length);
8213
- start = this.selection.selectionStart + this.syntax[command].length;
8214
- end = this.selection.selectionEnd + this.syntax[command].length - 1;
8226
+ start = this.selection.selectionStart + this.syntax[`${command}`].length;
8227
+ end = this.selection.selectionEnd + this.syntax[`${command}`].length - 1;
8215
8228
  }
8216
8229
  else {
8217
- const cmd = this.syntax[command];
8230
+ const cmd = this.syntax[`${command}`];
8218
8231
  const selection = this.parent.markdownSelection.getSelectedInlinePoints(textArea);
8219
8232
  const startNo = textArea.value.substr(0, textArea.selectionStart).lastIndexOf(cmd);
8220
8233
  let endNo = textArea.value.substr(textArea.selectionEnd, textArea.selectionEnd).indexOf(cmd);
@@ -8341,9 +8354,11 @@ class MDSelectionFormats {
8341
8354
  return matchText;
8342
8355
  }
8343
8356
  multiCharRegx(cmd) {
8357
+ // eslint-disable-next-line
8344
8358
  return new RegExp('(\\' + cmd + '\\' + cmd + ')', 'g');
8345
8359
  }
8346
8360
  singleCharRegx(cmd) {
8361
+ // eslint-disable-next-line
8347
8362
  return new RegExp('(\\' + cmd + ')', 'g');
8348
8363
  }
8349
8364
  isAppliedCommand(cmd) {
@@ -8531,22 +8546,22 @@ class MDSelectionFormats {
8531
8546
  }
8532
8547
  }
8533
8548
  textReplace(text, command) {
8534
- let regx = this.singleCharRegx(this.syntax[command]);
8549
+ let regx = this.singleCharRegx(this.syntax[`${command}`]);
8535
8550
  switch (command) {
8536
8551
  case 'Bold':
8537
- regx = this.multiCharRegx(this.syntax[command].substr(0, 1));
8552
+ regx = this.multiCharRegx(this.syntax[`${command}`].substr(0, 1));
8538
8553
  text = text.replace(regx, '');
8539
8554
  break;
8540
8555
  case 'Italic':
8541
- if (!this.isBold(text, this.syntax[command].substr(0, 1))) {
8556
+ if (!this.isBold(text, this.syntax[`${command}`].substr(0, 1))) {
8542
8557
  text = text.replace(regx, '');
8543
8558
  }
8544
8559
  else {
8545
- const regxB = this.multiCharRegx(this.syntax[command].substr(0, 1));
8560
+ const regxB = this.multiCharRegx(this.syntax[`${command}`].substr(0, 1));
8546
8561
  let repText = text;
8547
8562
  repText = repText.replace(regxB, '$%@').replace(regx, '');
8548
8563
  const regxTemp = new RegExp('\\$%@', 'g');
8549
- text = repText.replace(regxTemp, this.syntax[command].substr(0, 1) + this.syntax[command].substr(0, 1));
8564
+ text = repText.replace(regxTemp, this.syntax[`${command}`].substr(0, 1) + this.syntax[`${command}`].substr(0, 1));
8550
8565
  }
8551
8566
  break;
8552
8567
  case 'StrikeThrough':
@@ -8565,23 +8580,24 @@ class MDSelectionFormats {
8565
8580
  return text;
8566
8581
  }
8567
8582
  isApplied(line, command) {
8568
- let regx = this.singleCharRegx(this.syntax[command]);
8583
+ let regx = this.singleCharRegx(this.syntax[`${command}`]);
8569
8584
  switch (command) {
8570
8585
  case 'SubScript':
8571
8586
  case 'SuperScript':
8572
- regx = this.singleCharRegx(this.syntax[command]);
8587
+ regx = this.singleCharRegx(this.syntax[`${command}`]);
8573
8588
  return regx.test(line.text);
8574
8589
  case 'Bold':
8575
8590
  case 'StrikeThrough':
8576
- regx = this.multiCharRegx(this.syntax[command].substr(0, 1));
8591
+ regx = this.multiCharRegx(this.syntax[`${command}`].substr(0, 1));
8577
8592
  return regx.test(line.text);
8578
8593
  case 'UpperCase':
8579
8594
  case 'LowerCase':
8580
- regx = new RegExp('^[' + this.syntax[command] + ']*$', 'g');
8595
+ // eslint-disable-next-line
8596
+ regx = new RegExp('^[' + this.syntax[`${command}`] + ']*$', 'g');
8581
8597
  return regx.test(line.text);
8582
8598
  case 'Italic': {
8583
8599
  let regTest;
8584
- const regxB = this.multiCharRegx(this.syntax[command].substr(0, 1));
8600
+ const regxB = this.multiCharRegx(this.syntax[`${command}`].substr(0, 1));
8585
8601
  if (regxB.test(line.text)) {
8586
8602
  let repText = line.text;
8587
8603
  repText = repText.replace(regxB, '$%#');
@@ -9234,23 +9250,25 @@ class ClearFormat {
9234
9250
  const key = keys[num];
9235
9251
  // eslint-disable-next-line
9236
9252
  if (data.hasOwnProperty(key) && data[key] !== '') {
9237
- const expString = this.replaceRegex(data[key]);
9253
+ const expString = this.replaceRegex(data[`${key}`]);
9238
9254
  let regExp;
9239
- const startExp = data[key].length;
9240
- const endExp = (data[key] === '<sup>' || data[key] === '<sub>') ? data[key].length + 1 : data[key].length;
9241
- if (data[key] === '<sup>') {
9255
+ const startExp = data[`${key}`].length;
9256
+ const endExp = (data[`${key}`] === '<sup>' || data[`${key}`] === '<sub>') ? data[`${key}`].length + 1 : data[`${key}`].length;
9257
+ if (data[`${key}`] === '<sup>') {
9242
9258
  // eslint-disable-next-line
9243
9259
  regExp = new RegExp('<sup>(.*?)<\/sup>', 'ig');
9244
9260
  }
9245
- else if (data[key] === '<sub>') {
9261
+ else if (data[`${key}`] === '<sub>') {
9246
9262
  // eslint-disable-next-line
9247
9263
  regExp = new RegExp('<sub>(.*?)<\/sub>', 'ig');
9248
9264
  }
9249
9265
  else {
9266
+ // eslint-disable-next-line
9250
9267
  regExp = new RegExp(expString + '(.*?)' + expString, 'ig');
9251
9268
  }
9252
9269
  const val = text.match(regExp);
9253
9270
  for (let index = 0; val && index < val.length && val[index] !== ''; index++) {
9271
+ // eslint-disable-next-line max-len
9254
9272
  text = text.replace(val[index], val[index].substr(startExp, val[index].length - endExp - startExp));
9255
9273
  }
9256
9274
  }
@@ -9272,8 +9290,8 @@ class ClearFormat {
9272
9290
  const key = keys[index];
9273
9291
  // eslint-disable-next-line
9274
9292
  if (data.hasOwnProperty(key) && data[key] !== '') {
9275
- if (lines[len].indexOf(data[key]) === 0) {
9276
- lines[len] = lines[len].replace(data[key], '');
9293
+ if (lines[len].indexOf(data[`${key}`]) === 0) {
9294
+ lines[len] = lines[len].replace(data[`${key}`], '');
9277
9295
  lines[len] = this.clearFormatLines([lines[len]]);
9278
9296
  }
9279
9297
  }
@@ -10056,6 +10074,7 @@ class NodeSelection {
10056
10074
  */
10057
10075
  getSelectionNodes(nodeCollection) {
10058
10076
  nodeCollection = nodeCollection.reverse();
10077
+ // eslint-disable-next-line
10059
10078
  const regEx = new RegExp(String.fromCharCode(8203), 'g');
10060
10079
  for (let index = 0; index < nodeCollection.length; index++) {
10061
10080
  if (nodeCollection[index].nodeType !== 3 || (nodeCollection[index].textContent.trim() === '' ||
@@ -10076,6 +10095,7 @@ class NodeSelection {
10076
10095
  */
10077
10096
  getSelectionNodesBr(nodeCollection) {
10078
10097
  nodeCollection = nodeCollection.reverse();
10098
+ // eslint-disable-next-line
10079
10099
  const regEx = new RegExp(String.fromCharCode(8203), 'g');
10080
10100
  for (let index = 0; index < nodeCollection.length; index++) {
10081
10101
  if (nodeCollection[index].nodeName !== 'BR' &&
@@ -10408,7 +10428,7 @@ class DOMNode {
10408
10428
  const orderRawAttr = Object.keys(rawAttr).sort();
10409
10429
  for (let e = 0; e < orderRawAttr.length; e++) {
10410
10430
  const attrKey = orderRawAttr[e];
10411
- let attrValue = rawAttr[attrKey];
10431
+ let attrValue = rawAttr[`${attrKey}`];
10412
10432
  /* eslint-disable */
10413
10433
  if (attrValue.indexOf("'") < 0 && attrValue.indexOf('"') >= 0) {
10414
10434
  attr += ' ' + attrKey + "='" + attrValue + "'";
@@ -11159,8 +11179,15 @@ class Lists {
11159
11179
  range.startContainer.parentElement.closest('LI');
11160
11180
  const endNode = range.endContainer.nodeName === 'LI' ? range.endContainer :
11161
11181
  range.endContainer.parentElement.closest('LI');
11182
+ // Checks for Image, Audio , Video Element inside List Element
11183
+ let hasMediaElem = false;
11184
+ if (!isNullOrUndefined(startNode)) {
11185
+ const videoElemList = startNode.querySelectorAll('.e-video-clickelem');
11186
+ const embedVideoElem = videoElemList.length > 0 && videoElemList[0].childNodes[0].nodeName === 'IFRAME';
11187
+ hasMediaElem = startNode.querySelectorAll('IMG').length > 0 || startNode.querySelectorAll('AUDIO').length > 0 || startNode.querySelectorAll('VIDEO').length > 0 || embedVideoElem;
11188
+ }
11162
11189
  if (!isNullOrUndefined(startNode) && !isNullOrUndefined(endNode) && startNode === endNode && startNode.tagName === 'LI' &&
11163
- startNode.textContent.trim() === '' && startNode.querySelectorAll('IMG').length === 0) {
11190
+ startNode.textContent.trim() === '' && !hasMediaElem) {
11164
11191
  if (startNode.innerHTML.indexOf('&nbsp;') >= 0) {
11165
11192
  return;
11166
11193
  }
@@ -11197,7 +11224,6 @@ class Lists {
11197
11224
  }
11198
11225
  }
11199
11226
  }
11200
- // eslint-disable-next-line
11201
11227
  backspaceList(e) {
11202
11228
  const range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
11203
11229
  let startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
@@ -11283,7 +11309,8 @@ class Lists {
11283
11309
  detach(currentLIElem);
11284
11310
  }
11285
11311
  }
11286
- firstListBackSpace(range, e) {
11312
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
11313
+ firstListBackSpace(range, _e) {
11287
11314
  const startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
11288
11315
  if (!isNullOrUndefined(startNode.closest('OL'))) {
11289
11316
  this.commonLIParent = startNode.closest('OL');
@@ -11546,6 +11573,7 @@ class Lists {
11546
11573
  range.startOffset]) || range.startContainer);
11547
11574
  const endNode = (range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) :
11548
11575
  range.endOffset] || range.endContainer);
11576
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11549
11577
  let lastSelectionNode = endNode.lastChild.nodeName === 'BR' ? (isNullOrUndefined(endNode.lastChild.previousSibling) ? endNode
11550
11578
  : endNode.lastChild.previousSibling) : endNode.lastChild;
11551
11579
  while (!isNullOrUndefined(lastSelectionNode) && lastSelectionNode.nodeName !== '#text' && lastSelectionNode.nodeName !== 'IMG' &&
@@ -11686,8 +11714,8 @@ class Lists {
11686
11714
  const openTag = '<' + type + '>';
11687
11715
  const closeTag = '</' + type + '>';
11688
11716
  const newTag = 'li' + elemAtt;
11689
- const replaceHTML = (elements[i].tagName.toLowerCase() === DEFAULT_TAG ? elements[i].innerHTML :
11690
- elements[i].outerHTML);
11717
+ const replaceHTML = (elements[i].tagName.toLowerCase() === DEFAULT_TAG ?
11718
+ elements[i].innerHTML : elements[i].outerHTML);
11691
11719
  const innerHTML = this.domNode.createTagString(newTag, null, replaceHTML);
11692
11720
  const collectionString = openTag + innerHTML + closeTag;
11693
11721
  this.domNode.replaceWith(elements[i], collectionString);
@@ -11698,8 +11726,8 @@ class Lists {
11698
11726
  const openTag = '<' + type + elemAtt + '>';
11699
11727
  const closeTag = '</' + type + '>';
11700
11728
  const newTag = 'li';
11701
- const replaceHTML = (elements[i].tagName.toLowerCase() === DEFAULT_TAG ? elements[i].innerHTML :
11702
- elements[i].outerHTML);
11729
+ const replaceHTML = (elements[i].tagName.toLowerCase() === DEFAULT_TAG ?
11730
+ elements[i].innerHTML : elements[i].outerHTML);
11703
11731
  const innerHTML = this.domNode.createTagString(newTag, null, replaceHTML);
11704
11732
  const collectionString = openTag + innerHTML + closeTag;
11705
11733
  this.domNode.replaceWith(elements[i], collectionString);
@@ -12312,6 +12340,7 @@ class Formats {
12312
12340
  }
12313
12341
  }
12314
12342
  removeCodeContent(range) {
12343
+ // eslint-disable-next-line
12315
12344
  const regEx = new RegExp(String.fromCharCode(65279), 'g');
12316
12345
  if (!isNullOrUndefined(range.endContainer.textContent.match(regEx))) {
12317
12346
  const pointer = range.endContainer.textContent.charCodeAt(range.endOffset - 1) === 65279 ?
@@ -13212,7 +13241,8 @@ class LinkCommand {
13212
13241
  finalinlineNodes[j] = inlineNodes[i];
13213
13242
  }
13214
13243
  if (inlineNodes.length > 1 && i < inlineNodes.length - 1) {
13215
- if ((inlineNodes[i].parentElement === inlineNodes[i + 1].parentElement) && (inlineNodes[i] === inlineNodes[i + 1])) {
13244
+ if ((inlineNodes[i].parentElement === inlineNodes[i + 1].parentElement) &&
13245
+ (inlineNodes[i] === inlineNodes[i + 1])) {
13216
13246
  continue;
13217
13247
  }
13218
13248
  else {
@@ -13309,6 +13339,7 @@ class LinkCommand {
13309
13339
  return arr.join(' ') + ' ';
13310
13340
  }
13311
13341
  openLink(e) {
13342
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
13312
13343
  document.defaultView.open(e.item.url, e.item.target);
13313
13344
  this.callBack(e);
13314
13345
  }
@@ -13772,6 +13803,7 @@ class ImageCommand {
13772
13803
  this.callBack(e);
13773
13804
  }
13774
13805
  openImageLink(e) {
13806
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
13775
13807
  document.defaultView.open(e.item.url, e.item.target);
13776
13808
  this.callBack(e);
13777
13809
  }
@@ -14254,8 +14286,8 @@ class VideoCommand {
14254
14286
  videoElm.load();
14255
14287
  }
14256
14288
  if (Browser.userAgent.indexOf('Firefox') !== -1) {
14257
- vidElement.addEventListener('play', (args) => { this.editAreaVideoClick(e); });
14258
- vidElement.addEventListener('pause', (args) => { this.editAreaVideoClick(e); });
14289
+ vidElement.addEventListener('play', () => { this.editAreaVideoClick(e); });
14290
+ vidElement.addEventListener('pause', () => { this.editAreaVideoClick(e); });
14259
14291
  }
14260
14292
  }
14261
14293
  }
@@ -14494,6 +14526,7 @@ class TableCommand {
14494
14526
  const newRow = createElement('tr');
14495
14527
  const isHeaderSelect = this.curTable.querySelectorAll('th.e-cell-select').length > 0;
14496
14528
  for (let i = 0; i < allCells[minVal].length; i++) {
14529
+ // eslint-disable-next-line max-len
14497
14530
  if (isBelow && minVal < allCells.length - 1 && allCells[minVal][i] === allCells[minVal + 1][i] ||
14498
14531
  !isBelow && 0 < minVal && allCells[minVal][i] === allCells[minVal - 1][i]) {
14499
14532
  if (0 === i || 0 < i && allCells[minVal][i] !== allCells[minVal][i - 1]) {
@@ -14673,10 +14706,12 @@ class TableCommand {
14673
14706
  1 === rowSpanVal ? allCells[maxI][j].removeAttribute('rowspan') : allCells[maxI][j].setAttribute('rowspan', rowSpanVal.toString());
14674
14707
  }
14675
14708
  }
14709
+ // eslint-disable-next-line max-len
14676
14710
  if (maxI < allCells.length - 1 && allCells[maxI][j] === allCells[maxI + 1][j] && (0 === maxI ||
14677
14711
  allCells[maxI][j] !== allCells[maxI - 1][j])) {
14678
14712
  const element = allCells[maxI][j];
14679
14713
  let index;
14714
+ // eslint-disable-next-line max-len
14680
14715
  for (index = j; 0 < index && allCells[maxI][index] === allCells[maxI][index - 1]; index--) {
14681
14716
  if (index === 0) {
14682
14717
  this.curTable.rows[maxI + 1].prepend(element);
@@ -14889,6 +14924,7 @@ class TableCommand {
14889
14924
  for (rowValue = min; rowValue <= max; rowValue++) {
14890
14925
  // eslint-disable-next-line
14891
14926
  if (!(min < rowValue && eleArray[rowValue][0] === eleArray[rowValue - 1][0])
14927
+ // eslint-disable-next-line no-cond-assign
14892
14928
  && eleArray[rowValue][0] && 1 < (index = Math.min(parseInt(eleArray[rowValue][0].getAttribute('rowspan'), 10) ||
14893
14929
  1, max - min + 1)) && eleArray[rowValue][0] === eleArray[rowValue + 1][0]) {
14894
14930
  for (count = index - 1, colIndex = 1; colIndex < eleArray[0].length; colIndex++) {
@@ -14925,6 +14961,7 @@ class TableCommand {
14925
14961
  min < rowIndex && elements[rowIndex][colIndex] === elements[rowIndex - 1][colIndex] ||
14926
14962
  firstIndex < colIndex && elements[rowIndex][colIndex] === elements[rowIndex][colIndex - 1] ||
14927
14963
  1 < (spanCount = parseInt(elements[rowIndex][colIndex].getAttribute(attr), 10) || 1) &&
14964
+ // eslint-disable-next-line max-len
14928
14965
  (1 < spanCount - index ? elements[rowIndex][colIndex].setAttribute(attr, (spanCount - index).toString()) :
14929
14966
  elements[rowIndex][colIndex].removeAttribute(attr));
14930
14967
  }
@@ -14988,6 +15025,7 @@ class TableCommand {
14988
15025
  let colIndex;
14989
15026
  for (avgRowIndex = activeCellIndex[0] + Math.ceil(activeCellRowSpan / 2), colIndex = 0 === activeCellIndex[1] ? activeCellIndex[1]
14990
15027
  : activeCellIndex[1] - 1; 0 <= colIndex && (correspondingCells[avgRowIndex][colIndex] ===
15028
+ // eslint-disable-next-line max-len
14991
15029
  correspondingCells[avgRowIndex][colIndex - 1] || 0 < avgRowIndex && correspondingCells[avgRowIndex][colIndex]
14992
15030
  === correspondingCells[avgRowIndex - 1][colIndex]);) {
14993
15031
  colIndex--;
@@ -15525,7 +15563,7 @@ class SelectionCommands {
15525
15563
  const currentFormatNode = isFormatted.getFormattedNode(range.startContainer, format, endNode);
15526
15564
  const currentSelector = !isNullOrUndefined(currentFormatNode) ?
15527
15565
  (currentFormatNode.getAttribute('style') === null ? currentFormatNode.nodeName :
15528
- currentFormatNode.nodeName + `[style='` + currentFormatNode.getAttribute('style') + `']`) : null;
15566
+ currentFormatNode.nodeName + '[style=\'' + currentFormatNode.getAttribute('style') + '\']') : null;
15529
15567
  if (nodes.length > 0) {
15530
15568
  isCollapsed = true;
15531
15569
  range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
@@ -15534,7 +15572,9 @@ class SelectionCommands {
15534
15572
  range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') ||
15535
15573
  !isNullOrUndefined(currentFormatNode) && currentFormatNode ===
15536
15574
  (range.startContainer.parentElement.closest(currentSelector)) &&
15537
- ((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(new RegExp(String.fromCharCode(8203), 'g'), '').trim().length !== 0))) {
15575
+ ((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(
15576
+ // eslint-disable-next-line
15577
+ new RegExp(String.fromCharCode(8203), 'g'), '').trim().length !== 0))) {
15538
15578
  isCollapsed = true;
15539
15579
  range = nodeCutter.GetCursorRange(docElement, range, range.startContainer);
15540
15580
  nodes.push(range.startContainer);
@@ -15569,15 +15609,6 @@ class SelectionCommands {
15569
15609
  isSubSup = formatNode === null ? false : true;
15570
15610
  }
15571
15611
  }
15572
- else if (formatNode.textContent !== nodes[index].textContent && formatNode.nodeName === 'SPAN' && formatNode.style[0] === 'font-size') {
15573
- let currentParentElem = nodes[index].parentElement.textContent !== nodes[index].textContent ? nodes[index] : nodes[index].parentElement;
15574
- let isSameTextContent = true;
15575
- while (currentParentElem.textContent !== nodes[index].textContent && nodes[index].style[0] !== format && currentParentElem.nodeName === 'SPAN') {
15576
- isSameTextContent = currentParentElem.textContent === currentParentElem.parentElement.textContent;
15577
- currentParentElem = !isNullOrUndefined(currentParentElem.parentElement) && isSameTextContent ? currentParentElem.parentElement : currentParentElem;
15578
- }
15579
- formatNode = currentParentElem;
15580
- }
15581
15612
  if (index === 0 && formatNode === null) {
15582
15613
  isFormat = true;
15583
15614
  }
@@ -15611,6 +15642,7 @@ class SelectionCommands {
15611
15642
  if (cursorFormat) {
15612
15643
  cursorNode = cursorNodes[0];
15613
15644
  if (cursorFormat.firstChild.textContent.charCodeAt(0) === 8203 && cursorFormat.firstChild.nodeType === 3) {
15645
+ // eslint-disable-next-line
15614
15646
  const regEx = new RegExp(String.fromCharCode(8203), 'g');
15615
15647
  let emptySpaceNode;
15616
15648
  if (cursorFormat.firstChild === cursorNode) {
@@ -15621,7 +15653,6 @@ class SelectionCommands {
15621
15653
  cursorFormat.parentElement.firstChild && cursorFormat.parentElement.firstChild.nodeType === 1) ?
15622
15654
  cursorNode.textContent : cursorNode.textContent.replace(regEx, ''));
15623
15655
  emptySpaceNode = cursorNode;
15624
-
15625
15656
  }
15626
15657
  else {
15627
15658
  cursorFormat.firstChild.textContent = cursorFormat.firstChild.textContent.replace(regEx, '');
@@ -15793,7 +15824,8 @@ class SelectionCommands {
15793
15824
  }
15794
15825
  if (child.length > 0 && isFontStyle) {
15795
15826
  for (let num = 0; num < child.length; num++) {
15796
- if (child[num].nodeType !== 3 || (child[num].textContent && child[num].textContent.trim().length > 0)) {
15827
+ if (child[num].nodeType !== 3 || (child[num].textContent &&
15828
+ child[num].textContent.trim().length > 0)) {
15797
15829
  child[num] = InsertMethods.Wrap(child[num], this.GetFormatNode(format, value, formatNodeTagName, formatNodeStyles));
15798
15830
  if (child[num].textContent === startText) {
15799
15831
  if (num === 0) {
@@ -15869,33 +15901,7 @@ class SelectionCommands {
15869
15901
  liElement.style.textDecoration = 'inherit';
15870
15902
  }
15871
15903
  }
15872
- let enterType = isNullOrUndefined(this.enterAction) ? 'P' : this.enterAction.toString();
15873
- const currentNode = nodes[index];
15874
- let isNestedNode = !isNullOrUndefined(currentNode) && nodes[index].nodeName === '#text' && nodes[index].parentElement.nodeName !== enterType;
15875
- let currentParentElem = currentNode.parentElement.textContent !== currentNode.textContent ? currentNode : currentNode.parentElement;
15876
- if (isNestedNode) {
15877
- let isSameTextContent = true;
15878
- isNestedNode = false;
15879
- while (!isNullOrUndefined(currentParentElem) && isSameTextContent && currentParentElem.parentElement.nodeName !== enterType
15880
- && (currentParentElem.nodeName === 'SPAN' && (currentParentElem.style.textDecoration === 'line-through' || 'underline')
15881
- || currentParentElem.nodeName === 'SPAN' && (currentParentElem.style[0] === 'background-color' || 'font-family' || 'color')
15882
- || (currentParentElem.nodeName === 'EM' || 'STRONG' || 'SUB' || 'SUP'))) {
15883
- isSameTextContent = currentParentElem.textContent === currentParentElem.parentElement.textContent;
15884
- currentParentElem = !isNullOrUndefined(currentParentElem.parentElement) && isSameTextContent ? currentParentElem.parentElement : currentParentElem;
15885
- }
15886
- if (!isNullOrUndefined(currentParentElem) && currentParentElem.childNodes.length > 0) {
15887
- let nodeList = currentParentElem.querySelectorAll('span,strong,em,sub,sup');
15888
- isNestedNode = nodeList.length > 0 && isSameTextContent;
15889
- }
15890
- }
15891
- if (isNestedNode) {
15892
- let nodeList = [];
15893
- nodeList[0] = currentParentElem;
15894
- this.applyStyles(nodeList, index, element);
15895
- }
15896
- else {
15897
- nodes[index] = this.applyStyles(nodes, index, element);
15898
- }
15904
+ nodes[index] = this.applyStyles(nodes, index, element);
15899
15905
  if (format === 'fontsize') {
15900
15906
  const bg = closest(nodes[index].parentElement, 'span[style*=' + 'background-color' + ']');
15901
15907
  if (!isNullOrUndefined(bg)) {
@@ -16305,7 +16311,8 @@ class ClearFormat$1 {
16305
16311
  this.unWrap(docElement, blockNodes, nodeCutter, nodeSelection);
16306
16312
  }
16307
16313
  else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
16308
- childNodes[index2].parentNode.nodeName.toLocaleLowerCase() === childNodes[index2].nodeName.toLocaleLowerCase()) {
16314
+ childNodes[index2].parentNode.nodeName.toLocaleLowerCase() ===
16315
+ childNodes[index2].nodeName.toLocaleLowerCase()) {
16309
16316
  InsertMethods.unwrap(childNodes[index2]);
16310
16317
  }
16311
16318
  else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
@@ -16819,6 +16826,7 @@ class MsWordPaste {
16819
16826
  hexConversion(rtfData) {
16820
16827
  // eslint-disable-next-line
16821
16828
  const picHead = /\{\\pict[\s\S]+?\\bliptag\-?\d+(\\blipupi\-?\d+)?(\{\\\*\\blipuid\s?[\da-fA-F]+)?[\s\}]*?/;
16829
+ // eslint-disable-next-line security/detect-non-literal-regexp
16822
16830
  const pic = new RegExp('(?:(' + picHead.source + '))([\\da-fA-F\\s]+)\\}', 'g');
16823
16831
  const fullImg = rtfData.match(pic);
16824
16832
  let imgType;
@@ -16882,7 +16890,9 @@ class MsWordPaste {
16882
16890
  removeUnwantedElements(elm) {
16883
16891
  let innerElement = elm.innerHTML;
16884
16892
  for (let i = 0; i < this.removableElements.length; i++) {
16893
+ // eslint-disable-next-line security/detect-non-literal-regexp
16885
16894
  const regExpStartElem = new RegExp('<' + this.removableElements[i] + '>', 'g');
16895
+ // eslint-disable-next-line security/detect-non-literal-regexp
16886
16896
  const regExpEndElem = new RegExp('</' + this.removableElements[i] + '>', 'g');
16887
16897
  innerElement = innerElement.replace(regExpStartElem, '');
16888
16898
  innerElement = innerElement.replace(regExpEndElem, '');
@@ -16931,7 +16941,7 @@ class MsWordPaste {
16931
16941
  const styleClassObject = !isNullOrUndefined(styles) ? this.findStyleObject(styles) : null;
16932
16942
  const keys = Object.keys(styleClassObject);
16933
16943
  let values = keys.map((key) => {
16934
- return styleClassObject[key];
16944
+ return styleClassObject[`${key}`];
16935
16945
  });
16936
16946
  values = this.removeUnwantedStyle(values, wordPasteStyleConfig);
16937
16947
  this.filterStyles(elm, wordPasteStyleConfig);
@@ -17212,7 +17222,8 @@ class MsWordPaste {
17212
17222
  for (let j = 0; j < collection[index].nestedLevel - pLevel; j++) {
17213
17223
  prevList.appendChild(temp = createElement(collection[index].listType));
17214
17224
  prevList = createElement('li');
17215
- if (j !== collection[index].nestedLevel - pLevel - 1 && collection[index].nestedLevel - pLevel > 1) {
17225
+ if (j !== collection[index].nestedLevel - pLevel - 1 &&
17226
+ collection[index].nestedLevel - pLevel > 1) {
17216
17227
  prevList.style.listStyleType = 'none';
17217
17228
  }
17218
17229
  temp.appendChild(prevList);
@@ -17619,6 +17630,7 @@ class ToolbarStatus {
17619
17630
  }
17620
17631
  }
17621
17632
  for (let index = 0; index < nodes.length; index++) {
17633
+ // eslint-disable-next-line max-len
17622
17634
  formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], targetNode, formatNode, fontSize, fontName);
17623
17635
  if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
17624
17636
  nodeCollection.bold = formatCollection.bold;
@@ -17798,12 +17810,14 @@ class ToolbarStatus {
17798
17810
  let index = null;
17799
17811
  if ((name !== null && name !== '' && name !== undefined)
17800
17812
  && (fontName === null || fontName === undefined || (fontName.filter((value, pos) => {
17813
+ // eslint-disable-next-line
17801
17814
  const pattern = new RegExp(name, 'i');
17802
17815
  if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
17803
17816
  (value.split(',')[0] && value.split(',')[0].search(pattern) > -1)) {
17804
17817
  index = pos;
17805
17818
  }
17806
17819
  }) && (index !== null)))) {
17820
+ // eslint-disable-next-line
17807
17821
  return (index !== null) ? fontName[index] : name.replace(/"/g, '');
17808
17822
  }
17809
17823
  else {
@@ -18467,7 +18481,7 @@ class HtmlEditor {
18467
18481
  }
18468
18482
  }
18469
18483
  isTableClassAdded() {
18470
- let tableElement = this.parent.inputElement.querySelectorAll('table');
18484
+ const tableElement = this.parent.inputElement.querySelectorAll('table');
18471
18485
  for (let i = 0; i < tableElement.length; i++) {
18472
18486
  if (!tableElement[i].classList.contains('e-rte-table')) {
18473
18487
  tableElement[i].classList.add('e-rte-table');
@@ -18479,18 +18493,20 @@ class HtmlEditor {
18479
18493
  const restrictKeys = [8, 9, 13, 16, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
18480
18494
  112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
18481
18495
  const range = this.parent.getRange();
18496
+ // eslint-disable-next-line
18482
18497
  const regEx = new RegExp(String.fromCharCode(8203), 'g');
18483
18498
  let pointer;
18484
18499
  if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
18485
18500
  pointer = range.startOffset;
18501
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
18486
18502
  range.startContainer.nodeName === '#text' ? range.startContainer.parentElement.classList.add('currentStartMark') : range.startContainer.classList.add('currentStartMark');
18487
18503
  if (range.startContainer.textContent.charCodeAt(0) === 8203) {
18488
18504
  pointer = range.startOffset === 0 ? range.startOffset : range.startOffset - 1;
18489
18505
  range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
18490
18506
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
18491
18507
  }
18492
- let previousLength = this.parent.inputElement.innerHTML.length;
18493
- let currentLength = this.parent.inputElement.innerHTML.replace(regEx, '').length;
18508
+ const previousLength = this.parent.inputElement.innerHTML.length;
18509
+ const currentLength = this.parent.inputElement.innerHTML.replace(regEx, '').length;
18494
18510
  if (previousLength > currentLength) {
18495
18511
  let currentChild = this.parent.inputElement.firstChild;
18496
18512
  while (!isNullOrUndefined(currentChild) && currentChild.textContent.replace(regEx, '').trim().length > 0) {
@@ -18498,7 +18514,7 @@ class HtmlEditor {
18498
18514
  currentChild = currentChild.nextElementSibling;
18499
18515
  }
18500
18516
  if (this.parent.inputElement.querySelector('.currentStartMark').childNodes.length > 1) {
18501
- let currentChild = this.parent.inputElement.querySelector('.currentStartMark').childNodes;
18517
+ const currentChild = this.parent.inputElement.querySelector('.currentStartMark').childNodes;
18502
18518
  for (let i = 0; i < currentChild.length; i++) {
18503
18519
  if (currentChild[i].nodeName === '#text' && currentChild[i].textContent.length === 0) {
18504
18520
  detach(currentChild[i]);
@@ -18508,7 +18524,7 @@ class HtmlEditor {
18508
18524
  }
18509
18525
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.parent.inputElement.querySelector('.currentStartMark').childNodes[0], pointer);
18510
18526
  }
18511
- let currentElem = this.parent.inputElement.querySelector('.currentStartMark');
18527
+ const currentElem = this.parent.inputElement.querySelector('.currentStartMark');
18512
18528
  if (!isNullOrUndefined(currentElem)) {
18513
18529
  currentElem.classList.remove('currentStartMark');
18514
18530
  if (currentElem.getAttribute('class').trim() === '') {
@@ -18650,7 +18666,7 @@ class HtmlEditor {
18650
18666
  if (e.args.code === 'Backspace' && e.args.keyCode === 8 && currentRange.startOffset === 0 &&
18651
18667
  currentRange.endOffset === 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.textContent.length > 0 &&
18652
18668
  currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH') {
18653
- let checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
18669
+ const checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
18654
18670
  if (!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
18655
18671
  !isNullOrUndefined(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') {
18656
18672
  return;
@@ -19710,6 +19726,7 @@ class PasteCleanup {
19710
19726
  }
19711
19727
  }
19712
19728
  }
19729
+ // eslint-disable-next-line @typescript-eslint/tslint/config
19713
19730
  setCssClass(e) {
19714
19731
  if (this.popupObj && e.cssClass) {
19715
19732
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -19959,7 +19976,7 @@ class PasteCleanup {
19959
19976
  const groupingTags = [...deniedTags];
19960
19977
  const keys = Object.keys(pasteCleanupGroupingTags);
19961
19978
  const values = keys.map((key) => {
19962
- return pasteCleanupGroupingTags[key];
19979
+ return pasteCleanupGroupingTags[`${key}`];
19963
19980
  });
19964
19981
  const addTags = [];
19965
19982
  for (let i = 0; i < groupingTags.length; i++) {
@@ -20279,6 +20296,7 @@ class FileManager$1 {
20279
20296
  this.dialogObj.show(Browser.isDevice ? true : false);
20280
20297
  this.setCssClass({ cssClass: this.parent.cssClass });
20281
20298
  }
20299
+ // eslint-disable-next-line @typescript-eslint/tslint/config
20282
20300
  setCssClass(e) {
20283
20301
  if (this.dialogObj && e.cssClass) {
20284
20302
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -20637,33 +20655,33 @@ function setAttributes(htmlAttributes, rte, isFrame, initial) {
20637
20655
  if (Object.keys(htmlAttributes).length) {
20638
20656
  for (const htmlAttr of Object.keys(htmlAttributes)) {
20639
20657
  if (htmlAttr === 'class') {
20640
- target.classList.add(htmlAttributes[htmlAttr]);
20658
+ target.classList.add(htmlAttributes[`${htmlAttr}`]);
20641
20659
  }
20642
- else if (htmlAttr === 'disabled' && htmlAttributes[htmlAttr] === 'disabled') {
20660
+ else if (htmlAttr === 'disabled' && htmlAttributes[`${htmlAttr}`] === 'disabled') {
20643
20661
  rte.enabled = false;
20644
20662
  rte.setEnable();
20645
20663
  }
20646
- else if (htmlAttr === 'readonly' && htmlAttributes[htmlAttr] === 'readonly') {
20664
+ else if (htmlAttr === 'readonly' && htmlAttributes[`${htmlAttr}`] === 'readonly') {
20647
20665
  rte.readonly = true;
20648
20666
  rte.setReadOnly(initial);
20649
20667
  }
20650
20668
  else if (htmlAttr === 'style') {
20651
- target.setAttribute('style', htmlAttributes[htmlAttr]);
20669
+ target.setAttribute('style', htmlAttributes[`${htmlAttr}`]);
20652
20670
  }
20653
20671
  else if (htmlAttr === 'tabindex') {
20654
- rte.inputElement.setAttribute('tabindex', htmlAttributes[htmlAttr]);
20672
+ rte.inputElement.setAttribute('tabindex', htmlAttributes[`${htmlAttr}`]);
20655
20673
  }
20656
20674
  else if (htmlAttr === 'placeholder') {
20657
- rte.placeholder = htmlAttributes[htmlAttr];
20675
+ rte.placeholder = htmlAttributes[`${htmlAttr}`];
20658
20676
  rte.setPlaceHolder();
20659
20677
  }
20660
20678
  else {
20661
20679
  const validateAttr = ['name', 'required'];
20662
20680
  if (validateAttr.indexOf(htmlAttr) > -1) {
20663
- rte.valueContainer.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
20681
+ rte.valueContainer.setAttribute(htmlAttr, htmlAttributes[`${htmlAttr}`]);
20664
20682
  }
20665
20683
  else {
20666
- target.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
20684
+ target.setAttribute(htmlAttr, htmlAttributes[`${htmlAttr}`]);
20667
20685
  }
20668
20686
  }
20669
20687
  }
@@ -20857,6 +20875,7 @@ class Link {
20857
20875
  }
20858
20876
  }
20859
20877
  }
20878
+ // eslint-disable-next-line @typescript-eslint/tslint/config
20860
20879
  setCssClass(e) {
20861
20880
  this.updateCss(this.checkBoxObj, e);
20862
20881
  this.updateCss(this.dialogObj, e);
@@ -21029,13 +21048,13 @@ class Link {
21029
21048
  });
21030
21049
  const htmlTextbox = (this.parent.editorMode === 'HTML') ? '<label>' + linkTooltip +
21031
21050
  '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
21032
- '<input type="text" data-role ="none" spellcheck="false" placeholder = "' + title + '" class="e-input e-rte-linkTitle' + ' ' + this.parent.cssClass + '"></div>' +
21051
+ '<input type="text" data-role ="none" spellcheck="false" placeholder = "' + title + '"aria-label="' + this.i10n.getConstant('linkTitle') + '" class="e-input e-rte-linkTitle' + ' ' + this.parent.cssClass + '"></div>' +
21033
21052
  '<div class="e-rte-label' + ' ' + this.parent.cssClass + '"></div>' + '<div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
21034
21053
  '<input type="checkbox" class="e-rte-linkTarget' + ' ' + this.parent.cssClass + '" data-role ="none"></div>' : '';
21035
21054
  const content = '<div class="e-rte-label' + ' ' + this.parent.cssClass + '"><label>' + linkWebAddress + '</label></div>' + '<div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
21036
- '<input type="text" data-role ="none" spellcheck="false" placeholder="' + urlPlace + '" class="e-input e-rte-linkurl' + ' ' + this.parent.cssClass + '"/></div>' +
21055
+ '<input type="text" data-role ="none" spellcheck="false" placeholder="' + urlPlace + '"aria-label="' + this.i10n.getConstant('linkWebUrl') + '" class="e-input e-rte-linkurl' + ' ' + this.parent.cssClass + '"/></div>' +
21037
21056
  '<div class="e-rte-label' + ' ' + this.parent.cssClass + '">' + '<label>' + linkDisplayText + '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"> ' +
21038
- '<input type="text" data-role ="none" spellcheck="false" class="e-input e-rte-linkText' + ' ' + this.parent.cssClass + '" placeholder="' + textPlace + '">' +
21057
+ '<input type="text" data-role ="none" spellcheck="false" class="e-input e-rte-linkText' + ' ' + this.parent.cssClass + '"aria-label="' + this.i10n.getConstant('linkText') + '" placeholder="' + textPlace + '">' +
21039
21058
  '</div><div class="e-rte-label' + ' ' + this.parent.cssClass + '">' + htmlTextbox;
21040
21059
  const contentElem = parseHtml(content);
21041
21060
  linkContent.appendChild(contentElem);
@@ -21061,7 +21080,7 @@ class Link {
21061
21080
  cssClass: CLS_RTE_ELEMENTS + ' ' + this.parent.cssClass,
21062
21081
  enableRtl: this.parent.enableRtl,
21063
21082
  locale: this.parent.locale,
21064
- showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '310px', height: 'inherit',
21083
+ showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '310px',
21065
21084
  isModal: Browser.isDevice,
21066
21085
  buttons: [{
21067
21086
  click: this.insertlink.bind(selectObj),
@@ -21403,6 +21422,7 @@ class Image {
21403
21422
  }
21404
21423
  }
21405
21424
  }
21425
+ // eslint-disable-next-line @typescript-eslint/tslint/config
21406
21426
  setCssClass(e) {
21407
21427
  if (this.popupObj && e.cssClass) {
21408
21428
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -21595,8 +21615,8 @@ class Image {
21595
21615
  const pos = this.calcPos(e);
21596
21616
  const top = pos.top;
21597
21617
  const left = pos.left;
21598
- const imgWid = e.width;
21599
- const imgHgt = e.height;
21618
+ const imgWid = e.getBoundingClientRect().width;
21619
+ const imgHgt = e.getBoundingClientRect().height;
21600
21620
  const borWid = (Browser.isDevice) ? (4 * parseInt((e.style.outline.slice(-3)), 10)) + 2 :
21601
21621
  (2 * parseInt((e.style.outline.slice(-3)), 10)) + 2; //span border width + image outline width
21602
21622
  const devWid = ((Browser.isDevice) ? 0 : 2); // span border width
@@ -21623,7 +21643,6 @@ class Image {
21623
21643
  offsetParent = offsetParent.parentNode;
21624
21644
  }
21625
21645
  if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
21626
- // eslint-disable-next-line
21627
21646
  parentOffset = offsetParent.getBoundingClientRect();
21628
21647
  }
21629
21648
  if (elem.offsetParent && (elem.offsetParent.classList.contains('e-img-caption'))) {
@@ -21644,6 +21663,7 @@ class Image {
21644
21663
  if (isNullOrUndefined(img.width)) {
21645
21664
  return;
21646
21665
  }
21666
+ // eslint-disable-next-line security/detect-unsafe-regex
21647
21667
  const width = img.style.width !== '' ? img.style.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(img.style.width) :
21648
21668
  parseInt(img.style.width, 10) : img.width;
21649
21669
  const height = img.style.height !== '' ? parseInt(img.style.height, 10) : img.height;
@@ -22440,6 +22460,7 @@ class Image {
22440
22460
  }
22441
22461
  }
22442
22462
  imageRemovePost(src) {
22463
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
22443
22464
  const proxy = this;
22444
22465
  let absoluteUrl = '';
22445
22466
  if (isNullOrUndefined(this.parent.insertImageSettings.removeUrl) || this.parent.insertImageSettings.removeUrl === '') {
@@ -22451,8 +22472,9 @@ class Image {
22451
22472
  else {
22452
22473
  absoluteUrl = new URL(src, document.baseURI).href;
22453
22474
  }
22454
- this.removingImgName = absoluteUrl.replace(/^.*[\\\/]/, '');
22475
+ this.removingImgName = absoluteUrl.replace(/^.*[\\/]/, '');
22455
22476
  const xhr = new XMLHttpRequest();
22477
+ // eslint-disable-next-line @typescript-eslint/tslint/config
22456
22478
  xhr.addEventListener('readystatechange', function () {
22457
22479
  if (this.readyState === 4 && this.status === 200) {
22458
22480
  proxy.triggerPost(this.response);
@@ -22467,6 +22489,7 @@ class Image {
22467
22489
  if (isNullOrUndefined(removeUrl) || removeUrl === '') {
22468
22490
  return;
22469
22491
  }
22492
+ // eslint-disable-next-line @typescript-eslint/tslint/config
22470
22493
  const file = new File([response], this.removingImgName);
22471
22494
  const ajax = new Ajax(removeUrl, 'POST', true, null);
22472
22495
  const formData = new FormData();
@@ -22614,7 +22637,7 @@ class Image {
22614
22637
  cssClass: CLS_RTE_ELEMENTS + ' ' + this.parent.cssClass,
22615
22638
  enableRtl: this.parent.enableRtl,
22616
22639
  locale: this.parent.locale,
22617
- showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px', height: 'inherit',
22640
+ showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px',
22618
22641
  position: { X: 'center', Y: (Browser.isDevice) ? 'center' : 'top' },
22619
22642
  isModal: Browser.isDevice,
22620
22643
  buttons: [{
@@ -22762,7 +22785,7 @@ class Image {
22762
22785
  const placeUrl = this.i10n.getConstant('imageUrl');
22763
22786
  this.inputUrl = this.parent.createElement('input', {
22764
22787
  className: 'e-input e-img-url' + ' ' + this.parent.cssClass,
22765
- attrs: { placeholder: placeUrl, spellcheck: 'false' }
22788
+ attrs: { placeholder: placeUrl, spellcheck: 'false', 'aria-label': this.i10n.getConstant('imageLinkHeader') }
22766
22789
  });
22767
22790
  this.inputUrl.addEventListener('input', () => {
22768
22791
  if (!isNullOrUndefined(this.inputUrl)) {
@@ -23689,6 +23712,7 @@ class Audio {
23689
23712
  }
23690
23713
  }
23691
23714
  }
23715
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
23692
23716
  touchStart(e, ele) {
23693
23717
  if (this.parent.readonly) {
23694
23718
  return;
@@ -23895,6 +23919,7 @@ class Audio {
23895
23919
  }
23896
23920
  }
23897
23921
  audioRemovePost(src) {
23922
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
23898
23923
  const proxy = this;
23899
23924
  let absoluteUrl = '';
23900
23925
  if (isNullOrUndefined(this.parent.insertAudioSettings.removeUrl) || this.parent.insertAudioSettings.removeUrl === '') {
@@ -23906,8 +23931,9 @@ class Audio {
23906
23931
  else {
23907
23932
  absoluteUrl = new URL(src, document.baseURI).href;
23908
23933
  }
23909
- this.removingAudioName = absoluteUrl.replace(/^.*[\\\/]/, '');
23934
+ this.removingAudioName = absoluteUrl.replace(/^.*[\\/]/, '');
23910
23935
  const xhr = new XMLHttpRequest();
23936
+ // eslint-disable-next-line @typescript-eslint/tslint/config
23911
23937
  xhr.addEventListener('readystatechange', function () {
23912
23938
  if (this.readyState === 4 && this.status === 200) {
23913
23939
  proxy.triggerPost(this.response);
@@ -23941,6 +23967,7 @@ class Audio {
23941
23967
  }
23942
23968
  }
23943
23969
  if (this.isAudioElem(e.target)) {
23970
+ this.audEle = e.target.querySelector('audio');
23944
23971
  e.preventDefault();
23945
23972
  }
23946
23973
  }
@@ -24079,8 +24106,6 @@ class Audio {
24079
24106
  addClass([target.querySelector('audio')], [CLS_AUD_FOCUS]);
24080
24107
  target.querySelector('audio').style.outline = '2px solid #4a90e2';
24081
24108
  }
24082
- const pageY = (this.parent.iframeSettings.enable) ? window.pageYOffset +
24083
- this.parent.element.getBoundingClientRect().top + args.clientY : args.pageY;
24084
24109
  if (this.parent.quickToolbarModule.audioQTBar) {
24085
24110
  if (e.isNotify) {
24086
24111
  setTimeout(() => {
@@ -24135,7 +24160,7 @@ class Audio {
24135
24160
  cssClass: CLS_RTE_ELEMENTS,
24136
24161
  enableRtl: this.parent.enableRtl,
24137
24162
  locale: this.parent.locale,
24138
- showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px', height: 'inherit',
24163
+ showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px',
24139
24164
  position: { X: 'center', Y: (Browser.isDevice) ? 'center' : 'top' },
24140
24165
  isModal: Browser.isDevice,
24141
24166
  buttons: [{
@@ -24206,7 +24231,7 @@ class Audio {
24206
24231
  const placeUrl = this.i10n.getConstant('audioUrl');
24207
24232
  this.inputUrl = this.parent.createElement('input', {
24208
24233
  className: 'e-input e-audio-url',
24209
- attrs: { placeholder: placeUrl, spellcheck: 'false' }
24234
+ attrs: { placeholder: placeUrl, spellcheck: 'false', 'aria-label': this.i10n.getConstant('audioLinkHeader') }
24210
24235
  });
24211
24236
  this.inputUrl.addEventListener('input', () => {
24212
24237
  if (!isNullOrUndefined(this.inputUrl)) {
@@ -24833,7 +24858,6 @@ class Video {
24833
24858
  offsetParent = offsetParent.parentNode;
24834
24859
  }
24835
24860
  if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
24836
- // eslint-disable-next-line
24837
24861
  parentOffset = offsetParent.getBoundingClientRect();
24838
24862
  }
24839
24863
  if (elem && elem.nodeType === 1 && elem.tagName === 'IFRAME') {
@@ -24855,6 +24879,7 @@ class Video {
24855
24879
  if (isNullOrUndefined(vidEleStyle)) {
24856
24880
  return;
24857
24881
  }
24882
+ // eslint-disable-next-line
24858
24883
  const width = vidEleStyle.width !== '' ? vidEleStyle.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(vidEleStyle.width) :
24859
24884
  parseInt(vidEleStyle.width, 10) : vid.style.width !== '' ? vid.style.width : vid.width;
24860
24885
  const height = vidEleStyle.height !== '' ? parseInt(vidEleStyle.height, 10) : vid.style.height !== '' ? vid.style.height : vid.height;
@@ -25252,6 +25277,7 @@ class Video {
25252
25277
  }
25253
25278
  }
25254
25279
  videoRemovePost(src) {
25280
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
25255
25281
  const proxy = this;
25256
25282
  let absoluteUrl = '';
25257
25283
  if (isNullOrUndefined(this.parent.insertVideoSettings.removeUrl) || this.parent.insertVideoSettings.removeUrl === '') {
@@ -25263,8 +25289,10 @@ class Video {
25263
25289
  else {
25264
25290
  absoluteUrl = new URL(src, document.baseURI).href;
25265
25291
  }
25292
+ // eslint-disable-next-line no-useless-escape
25266
25293
  this.removingVideoName = absoluteUrl.replace(/^.*[\\\/]/, '');
25267
25294
  const xhr = new XMLHttpRequest();
25295
+ // eslint-disable-next-line @typescript-eslint/tslint/config
25268
25296
  xhr.addEventListener('readystatechange', function () {
25269
25297
  if (this.readyState === 4 && this.status === 200) {
25270
25298
  proxy.triggerPost(this.response);
@@ -25394,7 +25422,7 @@ class Video {
25394
25422
  }
25395
25423
  }
25396
25424
  showVideoQuickToolbar(e) {
25397
- if (e.type !== 'Videos' || isNullOrUndefined(this.parent.quickToolbarModule)
25425
+ if (e.type !== 'Videos' || e.args.detail === 2 || isNullOrUndefined(this.parent.quickToolbarModule)
25398
25426
  || isNullOrUndefined(this.parent.quickToolbarModule.videoQTBar) || isNullOrUndefined(e.args)) {
25399
25427
  return;
25400
25428
  }
@@ -25427,6 +25455,12 @@ class Video {
25427
25455
  hideVideoQuickToolbar() {
25428
25456
  if (!isNullOrUndefined(this.contentModule.getEditPanel().querySelector('.' + CLS_VID_FOCUS))) {
25429
25457
  removeClass([this.contentModule.getEditPanel().querySelector('.' + CLS_VID_FOCUS)], CLS_VID_FOCUS);
25458
+ if (!isNullOrUndefined(this.videoEle)) {
25459
+ this.videoEle.style.outline = '';
25460
+ }
25461
+ if (!isNullOrUndefined(this.contentModule.getEditPanel().querySelector('.e-vid-resize'))) {
25462
+ detach(this.contentModule.getEditPanel().querySelector('.e-vid-resize'));
25463
+ }
25430
25464
  if (this.quickToolObj && this.quickToolObj.videoQTBar && document.body.contains(this.quickToolObj.videoQTBar.element)) {
25431
25465
  this.quickToolObj.videoQTBar.hidePopup();
25432
25466
  }
@@ -25471,7 +25505,7 @@ class Video {
25471
25505
  cssClass: CLS_RTE_ELEMENTS,
25472
25506
  enableRtl: this.parent.enableRtl,
25473
25507
  locale: this.parent.locale,
25474
- showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px', height: 'inherit',
25508
+ showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px',
25475
25509
  position: { X: 'center', Y: (Browser.isDevice) ? 'center' : 'top' },
25476
25510
  isModal: Browser.isDevice,
25477
25511
  buttons: [{
@@ -25553,7 +25587,7 @@ class Video {
25553
25587
  videoUrl.appendChild(urlContent);
25554
25588
  this.embedInputUrl = this.parent.createElement('textarea', {
25555
25589
  className: 'e-input e-embed-video-url',
25556
- attrs: { placeholder: 'Paste Embed URL here', type: 'text', tabindex: '-1' }
25590
+ attrs: { placeholder: 'Paste Embed URL here', type: 'text', tabindex: '-1', 'aria-label': this.i10n.getConstant('embedVideoLinkHeader') }
25557
25591
  });
25558
25592
  this.embedInputUrl.addEventListener('keyup', () => {
25559
25593
  if (!isNullOrUndefined(this.embedInputUrl)) {
@@ -26200,6 +26234,7 @@ class Table {
26200
26234
  }
26201
26235
  }
26202
26236
  }
26237
+ // eslint-disable-next-line @typescript-eslint/tslint/config
26203
26238
  setCssClass(e) {
26204
26239
  if (this.popupObj && e.cssClass) {
26205
26240
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -26332,18 +26367,17 @@ class Table {
26332
26367
  }
26333
26368
  }
26334
26369
  }
26370
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
26335
26371
  tableModulekeyUp(e) {
26336
- const event = e.args;
26337
26372
  if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection) && this.contentModule) {
26338
26373
  const range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
26339
- const selection = this.parent.formatter.editorManager.nodeSelection.save(range, this.contentModule.getDocument());
26340
26374
  let ele = this.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range)[0];
26341
26375
  ele = (ele && ele.tagName !== 'TD' && ele.tagName !== 'TH') ? ele.parentElement : ele;
26342
26376
  if (ele && ele.tagName !== 'TD' && ele.tagName !== 'TH') {
26343
26377
  const closestTd = closest(ele, 'td');
26344
26378
  ele = !isNullOrUndefined(closestTd) && this.parent.inputElement.contains(closestTd) ? closestTd : ele;
26345
26379
  }
26346
- if (this.previousTableElement != ele && !isNullOrUndefined(this.previousTableElement)) {
26380
+ if (this.previousTableElement !== ele && !isNullOrUndefined(this.previousTableElement)) {
26347
26381
  this.previousTableElement.classList.remove(CLS_TABLE_SEL);
26348
26382
  }
26349
26383
  }
@@ -26772,7 +26806,6 @@ class Table {
26772
26806
  top: 0,
26773
26807
  left: 0
26774
26808
  };
26775
- // eslint-disable-next-line
26776
26809
  const offset = elem.getBoundingClientRect();
26777
26810
  const doc = elem.ownerDocument;
26778
26811
  let offsetParent = elem.offsetParent || doc.documentElement;
@@ -26787,7 +26820,6 @@ class Table {
26787
26820
  isNestedTable = true;
26788
26821
  }
26789
26822
  if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
26790
- // eslint-disable-next-line
26791
26823
  parentOffset = offsetParent.getBoundingClientRect();
26792
26824
  }
26793
26825
  if (isNestedTable) {
@@ -26954,6 +26986,8 @@ class Table {
26954
26986
  const mouseY = (this.parent.enableRtl) ? -(pageY - this.pageY) : (pageY - this.pageY);
26955
26987
  this.pageX = pageX;
26956
26988
  this.pageY = pageY;
26989
+ let maxiumWidth;
26990
+ const currentTdElement = this.curTable.closest('td');
26957
26991
  const args = { event: e, requestType: 'table' };
26958
26992
  this.parent.trigger(onResize, args, (resizingArgs) => {
26959
26993
  if (resizingArgs.cancel) {
@@ -26986,6 +27020,10 @@ class Table {
26986
27020
  if (this.currentColumnResize === 'first') {
26987
27021
  mouseX = mouseX - 0.75; //This was done for to make the gripper and the table first/last column will be close.
26988
27022
  this.removeResizeElement();
27023
+ if (currentTdElement) {
27024
+ maxiumWidth = this.curTable.getBoundingClientRect().right - this.calcPos(currentTdElement).left;
27025
+ this.curTable.style.maxWidth = maxiumWidth + 'px';
27026
+ }
26989
27027
  // Below the value '100' is the 100% width of the parent element.
26990
27028
  if (((mouseX !== 0 && 5 < currentColumnCellWidth) || mouseX < 0) && currentTableWidth <= 100 &&
26991
27029
  this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) <= 100) {
@@ -27003,6 +27041,10 @@ class Table {
27003
27041
  else if (this.currentColumnResize === 'last') {
27004
27042
  mouseX = mouseX + 0.75; //This was done for to make the gripper and the table first/last column will be close.
27005
27043
  this.removeResizeElement();
27044
+ if (currentTdElement) {
27045
+ maxiumWidth = currentTdElement.getBoundingClientRect().right - this.curTable.getBoundingClientRect().left;
27046
+ this.curTable.style.maxWidth = maxiumWidth + 'px';
27047
+ }
27006
27048
  // Below the value '100' is the 100% width of the parent element.
27007
27049
  if (((mouseX !== 0 && 5 < currentColumnCellWidth) || mouseX > 0) &&
27008
27050
  currentTableWidth <= 100 && this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) <= 100) {
@@ -27053,6 +27095,12 @@ class Table {
27053
27095
  if (!Browser.isDevice) {
27054
27096
  EventHandler.remove(this.contentModule.getEditPanel(), 'mouseover', this.resizeHelper);
27055
27097
  }
27098
+ if (currentTdElement) {
27099
+ // eslint-disable-next-line max-len
27100
+ const tableBoxPosition = this.curTable.getBoundingClientRect().left - currentTdElement.getBoundingClientRect().left;
27101
+ maxiumWidth = Math.abs(tableBoxPosition - currentTdElement.getBoundingClientRect().width) - 5;
27102
+ this.curTable.style.maxWidth = maxiumWidth + 'px';
27103
+ }
27056
27104
  const widthType = this.curTable.style.width.indexOf('%') > -1;
27057
27105
  this.curTable.style.width = widthType ? this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%'
27058
27106
  : tableWidth + mouseX + 'px';
@@ -28247,8 +28295,8 @@ class EnterKeyAction {
28247
28295
  let curElement = this.startNode;
28248
28296
  let blockElement = curElement;
28249
28297
  while (!this.parent.formatter.editorManager.domNode.isBlockNode(curElement)) {
28250
- blockElement = curElement;
28251
28298
  curElement = curElement.parentElement;
28299
+ blockElement = curElement;
28252
28300
  }
28253
28301
  isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
28254
28302
  }
@@ -28265,7 +28313,10 @@ class EnterKeyAction {
28265
28313
  this.parent.trigger(actionBegin, actionBeginArgs, (actionBeginArgs) => {
28266
28314
  if (!actionBeginArgs.cancel) {
28267
28315
  if (!(this.range.startOffset === this.range.endOffset && this.range.startContainer === this.range.endContainer)) {
28268
- this.range.deleteContents();
28316
+ if (!(this.range.startContainer.nodeName === 'SPAN' && (this.range.startContainer.classList.contains('e-video-wrap') ||
28317
+ this.range.startContainer.classList.contains('e-audio-wrap')))) {
28318
+ this.range.deleteContents();
28319
+ }
28269
28320
  if (this.range.startContainer.nodeName === '#text' && this.range.startContainer.textContent.length === 0 &&
28270
28321
  this.range.startContainer.parentElement !== this.parent.inputElement) {
28271
28322
  if (this.parent.enterKey === 'BR') {
@@ -28294,8 +28345,8 @@ class EnterKeyAction {
28294
28345
  while (!isNullOrUndefined(currentFocusElem) && currentFocusElem.nodeName !== '#text' && currentFocusElem.nodeName !== 'BR') {
28295
28346
  currentFocusElem = currentFocusElem.lastChild;
28296
28347
  }
28297
- if (currentFocusElem.nodeName != 'BR' && currentFocusElem.parentElement.textContent.length === 0 && currentFocusElem.parentElement.innerHTML.length === 0 &&
28298
- currentFocusElem.parentElement.nodeName != 'BR') {
28348
+ if (currentFocusElem.nodeName !== 'BR' && currentFocusElem.parentElement.textContent.length === 0 && currentFocusElem.parentElement.innerHTML.length === 0 &&
28349
+ currentFocusElem.parentElement.nodeName !== 'BR') {
28299
28350
  currentFocusElem.parentElement.appendChild(this.parent.createElement('BR'));
28300
28351
  }
28301
28352
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), currentFocusElem.nodeName === 'BR' ? currentFocusElem : currentFocusElem.parentElement, currentFocusElem.parentElement.textContent.length >= 0 || currentFocusElem.nodeName === 'BR' ? 0 : 1);
@@ -28334,7 +28385,7 @@ class EnterKeyAction {
28334
28385
  (this.parent.shiftEnterKey === 'P' && shiftKey) ||
28335
28386
  (this.parent.shiftEnterKey === 'DIV' && shiftKey)) {
28336
28387
  if (this.range.startOffset === 1 && this.parent.inputElement.childNodes.length === 1 && this.parent.inputElement.childNodes[0].nodeName === 'TABLE') {
28337
- let newElem = this.createInsertElement(shiftKey);
28388
+ const newElem = this.createInsertElement(shiftKey);
28338
28389
  newElem.appendChild(this.parent.createElement('BR'));
28339
28390
  this.parent.inputElement.appendChild(newElem);
28340
28391
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), newElem, 0);
@@ -28347,13 +28398,14 @@ class EnterKeyAction {
28347
28398
  else {
28348
28399
  nearBlockNode = this.parent.formatter.editorManager.domNode.blockParentNode(this.startNode);
28349
28400
  }
28350
- let isImageNode = false;
28401
+ let isMediaNode = false; // To check the image audio and video node cases
28351
28402
  let isFocusedFirst = false;
28352
28403
  if (this.range.startOffset !== 0 && this.range.endOffset !== 0 &&
28353
28404
  this.range.startContainer === this.range.endContainer && !(!isNullOrUndefined(nearBlockNode.childNodes[0])
28354
- && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
28405
+ && nearBlockNode.childNodes[0].nodeName === 'IMG' && nearBlockNode.querySelectorAll('img,audio,video').length > 0)) {
28355
28406
  const startNodeText = this.range.startContainer.textContent;
28356
28407
  const splitFirstText = startNodeText.substring(0, this.range.startOffset);
28408
+ // eslint-disable-next-line max-len
28357
28409
  if (splitFirstText.charCodeAt(this.range.startOffset - 1) !== 160 && splitFirstText.trim().length === 0) {
28358
28410
  isFocusedFirst = true;
28359
28411
  }
@@ -28365,26 +28417,29 @@ class EnterKeyAction {
28365
28417
  const fireFoxEnterAtMiddle = Browser.userAgent.indexOf('Firefox') !== -1 && this.range.startOffset === 0 && this.range.startContainer === this.range.endContainer &&
28366
28418
  this.range.startContainer.nodeName === '#text' && !this.parent.formatter.editorManager.domNode.isBlockNode(this.range.startContainer.previousSibling) &&
28367
28419
  this.range.startContainer.parentElement === this.range.startContainer.previousSibling.parentElement;
28420
+ // eslint-disable-next-line max-len
28368
28421
  if (!fireFoxEnterAtMiddle && ((this.range.startOffset === 0 && this.range.endOffset === 0) || isFocusedFirst) &&
28369
28422
  !(!isNullOrUndefined(this.range.startContainer.previousSibling) &&
28370
28423
  (this.range.startContainer.previousSibling.nodeName === 'IMG' || this.range.startContainer.previousSibling.nodeName === 'BR'))) {
28371
28424
  let isNearBlockLengthZero;
28372
28425
  let newElem;
28373
- if (this.range.startContainer.nodeName === 'IMG' || this.range.startContainer.nodeName === 'TABLE') {
28426
+ if (!isNullOrUndefined(this.range.startContainer.childNodes) && this.range.startContainer.textContent.length === 0 &&
28427
+ (this.range.startContainer.querySelectorAll('img,audio,video').length > 0 ||
28428
+ this.range.startContainer.nodeName === 'IMG' || this.range.startContainer.nodeName === 'TABLE')) {
28374
28429
  newElem = this.createInsertElement(shiftKey);
28375
- isImageNode = true;
28430
+ isMediaNode = true;
28376
28431
  isNearBlockLengthZero = false;
28377
28432
  }
28378
28433
  else {
28379
28434
  if ((nearBlockNode.textContent.trim().length !== 0 ||
28380
28435
  nearBlockNode.childNodes[0].nodeName === 'IMG' ||
28381
- (nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img').length > 0))) {
28382
- if ((this.range.startOffset === this.range.endOffset && this.range.startOffset != 0)) {
28436
+ (nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img,audio,video').length > 0))) {
28437
+ if ((this.range.startOffset === this.range.endOffset && this.range.startOffset !== 0)) {
28383
28438
  newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, false).cloneNode(true);
28384
28439
  }
28385
28440
  else {
28386
28441
  newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, true).cloneNode(true);
28387
- isImageNode = true;
28442
+ isMediaNode = true;
28388
28443
  }
28389
28444
  isNearBlockLengthZero = false;
28390
28445
  }
@@ -28407,7 +28462,7 @@ class EnterKeyAction {
28407
28462
  if (!isNearBlockLengthZero) {
28408
28463
  let currentFocusElem = insertElem;
28409
28464
  let finalFocusElem;
28410
- if (this.range.startOffset === this.range.endOffset && this.range.startOffset != 0) {
28465
+ if (this.range.startOffset === this.range.endOffset && this.range.startOffset !== 0) {
28411
28466
  while (!isNullOrUndefined(currentFocusElem) && currentFocusElem.nodeName !== '#text' &&
28412
28467
  currentFocusElem.nodeName !== 'BR') {
28413
28468
  finalFocusElem = currentFocusElem;
@@ -28418,7 +28473,7 @@ class EnterKeyAction {
28418
28473
  finalFocusElem = currentFocusElem;
28419
28474
  }
28420
28475
  finalFocusElem.innerHTML = '<br>';
28421
- if (!isImageNode) {
28476
+ if (!isMediaNode) {
28422
28477
  detach(nearBlockNode);
28423
28478
  }
28424
28479
  }
@@ -28437,6 +28492,48 @@ class EnterKeyAction {
28437
28492
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), insertElem, 0);
28438
28493
  }
28439
28494
  }
28495
+ else if (this.range.startContainer === this.range.endContainer && this.range.startContainer.nodeName === 'SPAN' &&
28496
+ (this.range.startContainer.classList.contains('e-video-wrap') ||
28497
+ this.range.startContainer.classList.contains('e-audio-wrap'))) {
28498
+ if (nearBlockNode.textContent.trim().length > 0) {
28499
+ const newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, true);
28500
+ let audioVideoElem = !isNullOrUndefined(newElem.previousSibling.querySelector('.e-video-wrap')) ?
28501
+ newElem.previousSibling.querySelector('.e-video-wrap') : newElem.previousSibling.querySelector('.e-audio-wrap');
28502
+ let isBRInserted = false;
28503
+ let lastNode = audioVideoElem.previousSibling;
28504
+ while (!isNullOrUndefined(lastNode) && lastNode.nodeName !== '#text') {
28505
+ lastNode = lastNode.lastChild;
28506
+ }
28507
+ if (isNullOrUndefined(lastNode)) {
28508
+ const brElm = this.parent.createElement('br');
28509
+ audioVideoElem.parentElement.appendChild(brElm);
28510
+ isBRInserted = true;
28511
+ }
28512
+ if (isBRInserted) {
28513
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), audioVideoElem.parentElement, 0);
28514
+ }
28515
+ else {
28516
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), lastNode, lastNode.textContent.length);
28517
+ }
28518
+ detach(audioVideoElem);
28519
+ }
28520
+ else {
28521
+ const newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, true);
28522
+ let focusElem = newElem.previousSibling;
28523
+ while (!isNullOrUndefined(focusElem.firstChild)) {
28524
+ detach(focusElem.firstChild);
28525
+ }
28526
+ const brElm = this.parent.createElement('br');
28527
+ focusElem.appendChild(brElm);
28528
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), focusElem, 0);
28529
+ }
28530
+ if (!isNullOrUndefined(this.parent.audioModule)) {
28531
+ this.parent.audioModule.hideAudioQuickToolbar();
28532
+ }
28533
+ if (!isNullOrUndefined(this.parent.videoModule)) {
28534
+ this.parent.videoModule.hideVideoQuickToolbar();
28535
+ }
28536
+ }
28440
28537
  else {
28441
28538
  const newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, true);
28442
28539
  if (!isNullOrUndefined(newElem.childNodes[0]) && newElem.childNodes[0].nodeName === '#text' &&
@@ -28452,7 +28549,7 @@ class EnterKeyAction {
28452
28549
  this.startNode = startParentElem;
28453
28550
  }
28454
28551
  else {
28455
- if (this.startNode.nodeName != 'BR') {
28552
+ if (this.startNode.nodeName !== 'BR') {
28456
28553
  this.startNode.appendChild(brElm);
28457
28554
  }
28458
28555
  }
@@ -28463,7 +28560,7 @@ class EnterKeyAction {
28463
28560
  }
28464
28561
  if (((this.parent.enterKey === 'P' || this.parent.enterKey === 'DIV') && !shiftKey) || ((this.parent.shiftEnterKey === 'DIV' ||
28465
28562
  this.parent.shiftEnterKey === 'P') && shiftKey)) {
28466
- let isHeadingTag = this.formatTags.indexOf(newElem.nodeName.toLocaleLowerCase());
28563
+ const isHeadingTag = this.formatTags.indexOf(newElem.nodeName.toLocaleLowerCase());
28467
28564
  if ((isHeadingTag < 0) || (isHeadingTag >= 0 && newElem.textContent.trim().length === 0)) {
28468
28565
  const insertElm = this.createInsertElement(shiftKey);
28469
28566
  while (newElem.firstChild) {
@@ -28535,6 +28632,7 @@ class EnterKeyAction {
28535
28632
  const outerBRElem = this.parent.createElement('br');
28536
28633
  if (this.range.startOffset === 0 && this.range.endOffset === 0 &&
28537
28634
  !isNullOrUndefined(currentParent.previousSibling) && currentParent.previousSibling.nodeName === 'BR') {
28635
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
28538
28636
  newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, currentParent, false).cloneNode(true);
28539
28637
  this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
28540
28638
  this.insertFocusContent();
@@ -28543,6 +28641,7 @@ class EnterKeyAction {
28543
28641
  currentFocusElem = currentFocusElem.lastChild;
28544
28642
  }
28545
28643
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), currentFocusElem, 0);
28644
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
28546
28645
 
28547
28646
  }
28548
28647
  else {
@@ -28572,7 +28671,7 @@ class EnterKeyAction {
28572
28671
  insertBRElement() {
28573
28672
  let isEmptyBrInserted = false;
28574
28673
  let isFocusTextNode = true;
28575
- if (this.range.endContainer.textContent.length == 0 && this.range.startContainer.nodeName === "BR") {
28674
+ if (this.range.endContainer.textContent.length === 0 && this.range.startContainer.nodeName === 'BR') {
28576
28675
  isFocusTextNode = false;
28577
28676
  }
28578
28677
  const brElm = this.parent.createElement('br');
@@ -28905,7 +29004,7 @@ let RichTextEditor = class RichTextEditor extends Component {
28905
29004
  this.focusIn();
28906
29005
  }
28907
29006
  }
28908
- const tool = executeGroup[commandName];
29007
+ const tool = executeGroup[`${commandName}`];
28909
29008
  if (option && option.undo) {
28910
29009
  if (option.undo && this.formatter.getUndoRedoStack().length === 0) {
28911
29010
  this.formatter.saveData();
@@ -29123,16 +29222,18 @@ let RichTextEditor = class RichTextEditor extends Component {
29123
29222
  */
29124
29223
  addAudioVideoWrapper() {
29125
29224
  let insertElem;
29126
- let audioElm = this.element.querySelectorAll('audio');
29225
+ const audioElm = this.element.querySelectorAll('audio');
29127
29226
  for (let i = 0; i < audioElm.length; i++) {
29128
29227
  if (!audioElm[i].classList.contains('e-rte-audio')) {
29129
29228
  audioElm[i].classList.add('e-rte-audio');
29130
29229
  audioElm[i].classList.add(CLS_AUDIOINLINE);
29131
29230
  }
29231
+ // eslint-disable-next-line max-len
29132
29232
  if (!audioElm[i].parentElement.classList.contains(CLS_CLICKELEM) && !audioElm[i].parentElement.classList.contains(CLS_AUDIOWRAP)) {
29133
- let audioWrapElem = this.createElement('span', { className: CLS_AUDIOWRAP });
29233
+ const audioWrapElem = this.createElement('span', { className: CLS_AUDIOWRAP });
29234
+ audioWrapElem.setAttribute('style', 'width:300px; margin:0 auto;');
29134
29235
  audioWrapElem.contentEditable = 'false';
29135
- let audioInnerWrapElem = this.createElement('span', { className: CLS_CLICKELEM });
29236
+ const audioInnerWrapElem = this.createElement('span', { className: CLS_CLICKELEM });
29136
29237
  audioWrapElem.appendChild(audioInnerWrapElem);
29137
29238
  audioElm[i].parentNode.insertBefore(audioWrapElem, audioElm[i].nextSibling);
29138
29239
  audioInnerWrapElem.appendChild(audioElm[i]);
@@ -29142,14 +29243,15 @@ let RichTextEditor = class RichTextEditor extends Component {
29142
29243
  }
29143
29244
  }
29144
29245
  }
29145
- let videoElm = this.element.querySelectorAll('video');
29246
+ const videoElm = this.element.querySelectorAll('video');
29146
29247
  for (let i = 0; i < videoElm.length; i++) {
29147
29248
  if (!videoElm[i].classList.contains('e-rte-video')) {
29148
29249
  videoElm[i].classList.add('e-rte-video');
29149
29250
  videoElm[i].classList.add(CLS_VIDEOINLINE);
29150
29251
  }
29252
+ // eslint-disable-next-line max-len
29151
29253
  if (!videoElm[i].parentElement.classList.contains(CLS_CLICKELEM) && !videoElm[i].parentElement.classList.contains(CLS_VIDEOWRAP)) {
29152
- let videoWrapElem = this.createElement('span', { className: CLS_VIDEOWRAP });
29254
+ const videoWrapElem = this.createElement('span', { className: CLS_VIDEOWRAP });
29153
29255
  videoWrapElem.contentEditable = 'false';
29154
29256
  videoElm[i].parentNode.insertBefore(videoWrapElem, videoElm[i].nextSibling);
29155
29257
  videoWrapElem.appendChild(videoElm[i]);
@@ -29159,10 +29261,12 @@ let RichTextEditor = class RichTextEditor extends Component {
29159
29261
  }
29160
29262
  }
29161
29263
  if (Browser.userAgent.indexOf('Firefox') !== -1) {
29264
+ // eslint-disable-next-line
29162
29265
  videoElm[i].addEventListener('play', (args) => {
29163
29266
  this.notify(mouseDown, { args: args });
29164
29267
  this.notify('editAreaClick', { args: args });
29165
29268
  });
29269
+ // eslint-disable-next-line
29166
29270
  videoElm[i].addEventListener('pause', (args) => {
29167
29271
  this.notify(mouseDown, { args: args });
29168
29272
  this.notify('editAreaClick', { args: args });
@@ -29181,6 +29285,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29181
29285
  eventInitializer() {
29182
29286
  this.wireEvents();
29183
29287
  }
29288
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29184
29289
  cleanList(e) {
29185
29290
  const range = this.getRange();
29186
29291
  const currentStartContainer = range.startContainer;
@@ -29228,6 +29333,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29228
29333
  if (closest(startNode, 'pre') &&
29229
29334
  (e.which === 8 && range.startContainer.textContent.charCodeAt(range.startOffset - 1) === 8203) ||
29230
29335
  (e.which === 46 && range.startContainer.textContent.charCodeAt(range.startOffset) === 8203)) {
29336
+ // eslint-disable-next-line
29231
29337
  const regEx = new RegExp(String.fromCharCode(8203), 'g');
29232
29338
  const pointer = e.which === 8 ? range.startOffset - 1 : range.startOffset;
29233
29339
  range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
@@ -29246,6 +29352,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29246
29352
  let bool = true;
29247
29353
  const removeNodeArray = [];
29248
29354
  for (i = index; i >= 0; i--) {
29355
+ // eslint-disable-next-line max-len
29249
29356
  if (parentEle.childNodes[i].nodeType === 3 && parentEle.childNodes[i].textContent.charCodeAt(0) === 8203 && bool) {
29250
29357
  removeNodeArray.push(i);
29251
29358
  }
@@ -29304,7 +29411,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29304
29411
  }
29305
29412
  }
29306
29413
  this.notify(keyUp, { member: 'keyup', args: e });
29307
- if (e.keyCode == 39 || e.keyCode == 37) {
29414
+ if (e.keyCode === 39 || e.keyCode === 37) {
29308
29415
  this.notify(tableModulekeyUp, { member: 'tableModulekeyUp', args: e });
29309
29416
  }
29310
29417
  if (e.code === 'KeyX' && e.which === 88 && e.keyCode === 88 && e.ctrlKey && (this.inputElement.innerHTML === '' ||
@@ -29722,6 +29829,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29722
29829
  * @hidden
29723
29830
  * @deprecated
29724
29831
  */
29832
+ /* eslint-disable */
29725
29833
  onPropertyChanged(newProp, oldProp) {
29726
29834
  for (const prop of Object.keys(newProp)) {
29727
29835
  switch (prop) {
@@ -29760,7 +29868,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29760
29868
  break;
29761
29869
  }
29762
29870
  case 'valueTemplate':
29763
- this.setValue();
29871
+ this.setValue(true);
29764
29872
  if (this.showCharCount) {
29765
29873
  this.countModule.refresh();
29766
29874
  }
@@ -29856,7 +29964,6 @@ let RichTextEditor = class RichTextEditor extends Component {
29856
29964
  this.notify(xhtmlValidation, { module: 'XhtmlValidation', newProp: newProp, oldProp: oldProp });
29857
29965
  break;
29858
29966
  case 'quickToolbarSettings':
29859
- // eslint-disable-next-line
29860
29967
  newProp.quickToolbarSettings.showOnRightClick ? this.wireContextEvent() : this.unWireContextEvent();
29861
29968
  this.notify(modelChanged, { newProp: newProp, oldProp: oldProp });
29862
29969
  break;
@@ -29866,6 +29973,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29866
29973
  }
29867
29974
  }
29868
29975
  }
29976
+ /* eslint-enable */
29869
29977
  /**
29870
29978
  * @hidden
29871
29979
  * @returns {void}
@@ -30206,7 +30314,7 @@ let RichTextEditor = class RichTextEditor extends Component {
30206
30314
  styleEle.rel = 'stylesheet';
30207
30315
  return styleEle;
30208
30316
  }
30209
- setValue() {
30317
+ setValue(isPropertyChange) {
30210
30318
  if (this.valueTemplate) {
30211
30319
  const regEx = new RegExp(/<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i);
30212
30320
  if (regEx.test(this.valueTemplate)) {
@@ -30214,11 +30322,30 @@ let RichTextEditor = class RichTextEditor extends Component {
30214
30322
  }
30215
30323
  else {
30216
30324
  const compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
30217
- for (let i = 0; i < compiledTemplate.length; i++) {
30218
- const item = compiledTemplate[i];
30219
- append([item], this.element);
30325
+ if (typeof this.valueTemplate !== 'string' && this.isReact) {
30326
+ this.displayTempElem = this.createElement('div');
30327
+ for (let i = 0; i < compiledTemplate.length; i++) {
30328
+ const item = compiledTemplate[i];
30329
+ append([item], this.displayTempElem);
30330
+ }
30331
+ this.renderTemplates(() => {
30332
+ this.inputElement.innerHTML = this.displayTempElem.childNodes[0].innerHTML;
30333
+ this.setProperties({ value: this.inputElement.innerHTML.trim() });
30334
+ });
30335
+ }
30336
+ else {
30337
+ let appendElem = this.element;
30338
+ if (isPropertyChange) {
30339
+ this.inputElement.innerHTML = '';
30340
+ appendElem = this.inputElement;
30341
+ }
30342
+ for (let i = 0; i < compiledTemplate.length; i++) {
30343
+ const item = compiledTemplate[i];
30344
+ append([item], appendElem);
30345
+ }
30346
+ this.setProperties({ value: appendElem.innerHTML.trim() });
30347
+ this.renderReactTemplates();
30220
30348
  }
30221
- this.setProperties({ value: this.element.innerHTML.trim() });
30222
30349
  }
30223
30350
  }
30224
30351
  else {
@@ -30234,6 +30361,10 @@ let RichTextEditor = class RichTextEditor extends Component {
30234
30361
  }
30235
30362
  }
30236
30363
  }
30364
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30365
+ renderTemplates(callBack) {
30366
+ this.renderReactTemplates(callBack);
30367
+ }
30237
30368
  updateResizeFlag() {
30238
30369
  this.isResizeInitialized = true;
30239
30370
  }
@@ -30303,7 +30434,7 @@ let RichTextEditor = class RichTextEditor extends Component {
30303
30434
  const rzHandle = this.element.querySelector('.' + CLS_RTE_RES_HANDLE);
30304
30435
  const rzHeight = this.enableResize ? (!isNullOrUndefined(rzHandle) ? (rzHandle.offsetHeight + 8) : 0) : 0;
30305
30436
  const expandPopHeight = this.getToolbar() ? this.toolbarModule.getExpandTBarPopHeight() : 0;
30306
- if (this.toolbarSettings.type === ToolbarType.Expand && isExpand && target !== 'preview') {
30437
+ if (this.toolbarSettings.type === ToolbarType.Expand && isExpand) {
30307
30438
  heightValue = (this.height === 'auto' && rzHeight === 0) ? 'auto' : rteHeight - (tbHeight + expandPopHeight + rzHeight) + 'px';
30308
30439
  topValue = (!this.toolbarSettings.enableFloating) ? expandPopHeight : 0;
30309
30440
  }