@syncfusion/ej2-richtexteditor 20.3.60 → 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 (101) hide show
  1. package/.eslintrc.json +16 -1
  2. package/CHANGELOG.md +0 -24
  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 +316 -182
  8. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  9. package/dist/es6/ej2-richtexteditor.es5.js +304 -169
  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/nodecutter.js +1 -0
  23. package/src/editor-manager/plugin/selection-commands.js +8 -41
  24. package/src/editor-manager/plugin/table.js +6 -0
  25. package/src/editor-manager/plugin/toolbar-status.js +4 -1
  26. package/src/editor-manager/plugin/video.js +2 -2
  27. package/src/markdown-parser/plugin/clearformat.js +9 -7
  28. package/src/markdown-parser/plugin/formats.js +6 -5
  29. package/src/markdown-parser/plugin/lists.js +5 -0
  30. package/src/markdown-parser/plugin/markdown-selection.js +3 -0
  31. package/src/markdown-parser/plugin/md-selection-formats.js +13 -10
  32. package/src/rich-text-editor/actions/enter-key.js +66 -15
  33. package/src/rich-text-editor/actions/file-manager.js +1 -0
  34. package/src/rich-text-editor/actions/html-attributes.js +8 -8
  35. package/src/rich-text-editor/actions/html-editor.js +2 -0
  36. package/src/rich-text-editor/actions/keyboard.js +4 -4
  37. package/src/rich-text-editor/actions/markdown-toolbar-status.js +2 -1
  38. package/src/rich-text-editor/actions/paste-clean-up.js +2 -1
  39. package/src/rich-text-editor/actions/toolbar.js +2 -0
  40. package/src/rich-text-editor/base/constant.d.ts +8 -8
  41. package/src/rich-text-editor/base/constant.js +8 -8
  42. package/src/rich-text-editor/base/rich-text-editor.d.ts +2 -0
  43. package/src/rich-text-editor/base/rich-text-editor.js +45 -10
  44. package/src/rich-text-editor/base/util.js +9 -9
  45. package/src/rich-text-editor/renderer/audio-module.d.ts +1 -1
  46. package/src/rich-text-editor/renderer/audio-module.js +7 -5
  47. package/src/rich-text-editor/renderer/image-module.js +10 -6
  48. package/src/rich-text-editor/renderer/link-module.js +5 -4
  49. package/src/rich-text-editor/renderer/table-module.js +19 -5
  50. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +1 -0
  51. package/src/rich-text-editor/renderer/toolbar-renderer.js +1 -0
  52. package/src/rich-text-editor/renderer/video-module.d.ts +1 -1
  53. package/src/rich-text-editor/renderer/video-module.js +13 -4
  54. package/src/rich-text-editor/services/renderer-factory.js +4 -4
  55. package/src/rich-text-editor/services/service-locator.js +4 -4
  56. package/src/selection/selection.js +2 -0
  57. package/styles/bootstrap-dark.css +12 -5
  58. package/styles/bootstrap.css +12 -5
  59. package/styles/bootstrap4.css +12 -5
  60. package/styles/bootstrap5-dark.css +12 -5
  61. package/styles/bootstrap5.css +12 -5
  62. package/styles/fabric-dark.css +12 -5
  63. package/styles/fabric.css +12 -5
  64. package/styles/fluent-dark.css +12 -5
  65. package/styles/fluent.css +12 -5
  66. package/styles/highcontrast-light.css +12 -5
  67. package/styles/highcontrast.css +12 -5
  68. package/styles/material-dark.css +12 -5
  69. package/styles/material.css +12 -5
  70. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -0
  71. package/styles/rich-text-editor/_bootstrap-definition.scss +1 -0
  72. package/styles/rich-text-editor/_bootstrap4-definition.scss +1 -0
  73. package/styles/rich-text-editor/_bootstrap5-definition.scss +1 -0
  74. package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -0
  75. package/styles/rich-text-editor/_fabric-definition.scss +1 -0
  76. package/styles/rich-text-editor/_fluent-definition.scss +1 -0
  77. package/styles/rich-text-editor/_fusionnew-definition.scss +1 -0
  78. package/styles/rich-text-editor/_highcontrast-definition.scss +1 -0
  79. package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -0
  80. package/styles/rich-text-editor/_material-dark-definition.scss +1 -0
  81. package/styles/rich-text-editor/_material-definition.scss +1 -0
  82. package/styles/rich-text-editor/_material3-definition.scss +1 -0
  83. package/styles/rich-text-editor/_tailwind-definition.scss +1 -0
  84. package/styles/rich-text-editor/_theme.scss +11 -6
  85. package/styles/rich-text-editor/bootstrap-dark.css +12 -5
  86. package/styles/rich-text-editor/bootstrap.css +12 -5
  87. package/styles/rich-text-editor/bootstrap4.css +12 -5
  88. package/styles/rich-text-editor/bootstrap5-dark.css +12 -5
  89. package/styles/rich-text-editor/bootstrap5.css +12 -5
  90. package/styles/rich-text-editor/fabric-dark.css +12 -5
  91. package/styles/rich-text-editor/fabric.css +12 -5
  92. package/styles/rich-text-editor/fluent-dark.css +12 -5
  93. package/styles/rich-text-editor/fluent.css +12 -5
  94. package/styles/rich-text-editor/highcontrast-light.css +12 -5
  95. package/styles/rich-text-editor/highcontrast.css +12 -5
  96. package/styles/rich-text-editor/material-dark.css +12 -5
  97. package/styles/rich-text-editor/material.css +12 -5
  98. package/styles/rich-text-editor/tailwind-dark.css +12 -5
  99. package/styles/rich-text-editor/tailwind.css +12 -5
  100. package/styles/tailwind-dark.css +12 -5
  101. 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);
@@ -12098,6 +12126,7 @@ class NodeCutter {
12098
12126
  for (let i = 0; !isNullOrUndefined(firstChild.childNodes) && i < firstChild.childNodes.length; i++) {
12099
12127
  if (firstChild.childNodes[i].nodeName === 'IMG' || (firstChild.childNodes[i].nodeName === 'SPAN' &&
12100
12128
  (firstChild.childNodes[i].classList.contains('e-video-wrap') ||
12129
+ firstChild.childNodes[i].classList.contains('e-embed-video-wrap') ||
12101
12130
  firstChild.childNodes[i].classList.contains('e-audio-wrap')))) {
12102
12131
  result = false;
12103
12132
  }
@@ -12311,6 +12340,7 @@ class Formats {
12311
12340
  }
12312
12341
  }
12313
12342
  removeCodeContent(range) {
12343
+ // eslint-disable-next-line
12314
12344
  const regEx = new RegExp(String.fromCharCode(65279), 'g');
12315
12345
  if (!isNullOrUndefined(range.endContainer.textContent.match(regEx))) {
12316
12346
  const pointer = range.endContainer.textContent.charCodeAt(range.endOffset - 1) === 65279 ?
@@ -13211,7 +13241,8 @@ class LinkCommand {
13211
13241
  finalinlineNodes[j] = inlineNodes[i];
13212
13242
  }
13213
13243
  if (inlineNodes.length > 1 && i < inlineNodes.length - 1) {
13214
- 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])) {
13215
13246
  continue;
13216
13247
  }
13217
13248
  else {
@@ -13308,6 +13339,7 @@ class LinkCommand {
13308
13339
  return arr.join(' ') + ' ';
13309
13340
  }
13310
13341
  openLink(e) {
13342
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
13311
13343
  document.defaultView.open(e.item.url, e.item.target);
13312
13344
  this.callBack(e);
13313
13345
  }
@@ -13771,6 +13803,7 @@ class ImageCommand {
13771
13803
  this.callBack(e);
13772
13804
  }
13773
13805
  openImageLink(e) {
13806
+ // eslint-disable-next-line security/detect-non-literal-fs-filename
13774
13807
  document.defaultView.open(e.item.url, e.item.target);
13775
13808
  this.callBack(e);
13776
13809
  }
@@ -14253,8 +14286,8 @@ class VideoCommand {
14253
14286
  videoElm.load();
14254
14287
  }
14255
14288
  if (Browser.userAgent.indexOf('Firefox') !== -1) {
14256
- vidElement.addEventListener('play', (args) => { this.editAreaVideoClick(e); });
14257
- vidElement.addEventListener('pause', (args) => { this.editAreaVideoClick(e); });
14289
+ vidElement.addEventListener('play', () => { this.editAreaVideoClick(e); });
14290
+ vidElement.addEventListener('pause', () => { this.editAreaVideoClick(e); });
14258
14291
  }
14259
14292
  }
14260
14293
  }
@@ -14493,6 +14526,7 @@ class TableCommand {
14493
14526
  const newRow = createElement('tr');
14494
14527
  const isHeaderSelect = this.curTable.querySelectorAll('th.e-cell-select').length > 0;
14495
14528
  for (let i = 0; i < allCells[minVal].length; i++) {
14529
+ // eslint-disable-next-line max-len
14496
14530
  if (isBelow && minVal < allCells.length - 1 && allCells[minVal][i] === allCells[minVal + 1][i] ||
14497
14531
  !isBelow && 0 < minVal && allCells[minVal][i] === allCells[minVal - 1][i]) {
14498
14532
  if (0 === i || 0 < i && allCells[minVal][i] !== allCells[minVal][i - 1]) {
@@ -14672,10 +14706,12 @@ class TableCommand {
14672
14706
  1 === rowSpanVal ? allCells[maxI][j].removeAttribute('rowspan') : allCells[maxI][j].setAttribute('rowspan', rowSpanVal.toString());
14673
14707
  }
14674
14708
  }
14709
+ // eslint-disable-next-line max-len
14675
14710
  if (maxI < allCells.length - 1 && allCells[maxI][j] === allCells[maxI + 1][j] && (0 === maxI ||
14676
14711
  allCells[maxI][j] !== allCells[maxI - 1][j])) {
14677
14712
  const element = allCells[maxI][j];
14678
14713
  let index;
14714
+ // eslint-disable-next-line max-len
14679
14715
  for (index = j; 0 < index && allCells[maxI][index] === allCells[maxI][index - 1]; index--) {
14680
14716
  if (index === 0) {
14681
14717
  this.curTable.rows[maxI + 1].prepend(element);
@@ -14888,6 +14924,7 @@ class TableCommand {
14888
14924
  for (rowValue = min; rowValue <= max; rowValue++) {
14889
14925
  // eslint-disable-next-line
14890
14926
  if (!(min < rowValue && eleArray[rowValue][0] === eleArray[rowValue - 1][0])
14927
+ // eslint-disable-next-line no-cond-assign
14891
14928
  && eleArray[rowValue][0] && 1 < (index = Math.min(parseInt(eleArray[rowValue][0].getAttribute('rowspan'), 10) ||
14892
14929
  1, max - min + 1)) && eleArray[rowValue][0] === eleArray[rowValue + 1][0]) {
14893
14930
  for (count = index - 1, colIndex = 1; colIndex < eleArray[0].length; colIndex++) {
@@ -14924,6 +14961,7 @@ class TableCommand {
14924
14961
  min < rowIndex && elements[rowIndex][colIndex] === elements[rowIndex - 1][colIndex] ||
14925
14962
  firstIndex < colIndex && elements[rowIndex][colIndex] === elements[rowIndex][colIndex - 1] ||
14926
14963
  1 < (spanCount = parseInt(elements[rowIndex][colIndex].getAttribute(attr), 10) || 1) &&
14964
+ // eslint-disable-next-line max-len
14927
14965
  (1 < spanCount - index ? elements[rowIndex][colIndex].setAttribute(attr, (spanCount - index).toString()) :
14928
14966
  elements[rowIndex][colIndex].removeAttribute(attr));
14929
14967
  }
@@ -14987,6 +15025,7 @@ class TableCommand {
14987
15025
  let colIndex;
14988
15026
  for (avgRowIndex = activeCellIndex[0] + Math.ceil(activeCellRowSpan / 2), colIndex = 0 === activeCellIndex[1] ? activeCellIndex[1]
14989
15027
  : activeCellIndex[1] - 1; 0 <= colIndex && (correspondingCells[avgRowIndex][colIndex] ===
15028
+ // eslint-disable-next-line max-len
14990
15029
  correspondingCells[avgRowIndex][colIndex - 1] || 0 < avgRowIndex && correspondingCells[avgRowIndex][colIndex]
14991
15030
  === correspondingCells[avgRowIndex - 1][colIndex]);) {
14992
15031
  colIndex--;
@@ -15524,7 +15563,7 @@ class SelectionCommands {
15524
15563
  const currentFormatNode = isFormatted.getFormattedNode(range.startContainer, format, endNode);
15525
15564
  const currentSelector = !isNullOrUndefined(currentFormatNode) ?
15526
15565
  (currentFormatNode.getAttribute('style') === null ? currentFormatNode.nodeName :
15527
- currentFormatNode.nodeName + `[style='` + currentFormatNode.getAttribute('style') + `']`) : null;
15566
+ currentFormatNode.nodeName + '[style=\'' + currentFormatNode.getAttribute('style') + '\']') : null;
15528
15567
  if (nodes.length > 0) {
15529
15568
  isCollapsed = true;
15530
15569
  range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
@@ -15533,7 +15572,9 @@ class SelectionCommands {
15533
15572
  range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') ||
15534
15573
  !isNullOrUndefined(currentFormatNode) && currentFormatNode ===
15535
15574
  (range.startContainer.parentElement.closest(currentSelector)) &&
15536
- ((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))) {
15537
15578
  isCollapsed = true;
15538
15579
  range = nodeCutter.GetCursorRange(docElement, range, range.startContainer);
15539
15580
  nodes.push(range.startContainer);
@@ -15568,15 +15609,6 @@ class SelectionCommands {
15568
15609
  isSubSup = formatNode === null ? false : true;
15569
15610
  }
15570
15611
  }
15571
- else if (formatNode.textContent !== nodes[index].textContent && formatNode.nodeName === 'SPAN' && formatNode.style[0] === 'font-size') {
15572
- let currentParentElem = nodes[index].parentElement.textContent !== nodes[index].textContent ? nodes[index] : nodes[index].parentElement;
15573
- let isSameTextContent = true;
15574
- while (currentParentElem.textContent !== nodes[index].textContent && nodes[index].style[0] !== format && currentParentElem.nodeName === 'SPAN') {
15575
- isSameTextContent = currentParentElem.textContent === currentParentElem.parentElement.textContent;
15576
- currentParentElem = !isNullOrUndefined(currentParentElem.parentElement) && isSameTextContent ? currentParentElem.parentElement : currentParentElem;
15577
- }
15578
- formatNode = currentParentElem;
15579
- }
15580
15612
  if (index === 0 && formatNode === null) {
15581
15613
  isFormat = true;
15582
15614
  }
@@ -15610,6 +15642,7 @@ class SelectionCommands {
15610
15642
  if (cursorFormat) {
15611
15643
  cursorNode = cursorNodes[0];
15612
15644
  if (cursorFormat.firstChild.textContent.charCodeAt(0) === 8203 && cursorFormat.firstChild.nodeType === 3) {
15645
+ // eslint-disable-next-line
15613
15646
  const regEx = new RegExp(String.fromCharCode(8203), 'g');
15614
15647
  let emptySpaceNode;
15615
15648
  if (cursorFormat.firstChild === cursorNode) {
@@ -15620,7 +15653,6 @@ class SelectionCommands {
15620
15653
  cursorFormat.parentElement.firstChild && cursorFormat.parentElement.firstChild.nodeType === 1) ?
15621
15654
  cursorNode.textContent : cursorNode.textContent.replace(regEx, ''));
15622
15655
  emptySpaceNode = cursorNode;
15623
-
15624
15656
  }
15625
15657
  else {
15626
15658
  cursorFormat.firstChild.textContent = cursorFormat.firstChild.textContent.replace(regEx, '');
@@ -15792,7 +15824,8 @@ class SelectionCommands {
15792
15824
  }
15793
15825
  if (child.length > 0 && isFontStyle) {
15794
15826
  for (let num = 0; num < child.length; num++) {
15795
- 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)) {
15796
15829
  child[num] = InsertMethods.Wrap(child[num], this.GetFormatNode(format, value, formatNodeTagName, formatNodeStyles));
15797
15830
  if (child[num].textContent === startText) {
15798
15831
  if (num === 0) {
@@ -15868,33 +15901,7 @@ class SelectionCommands {
15868
15901
  liElement.style.textDecoration = 'inherit';
15869
15902
  }
15870
15903
  }
15871
- let enterType = isNullOrUndefined(this.enterAction) ? 'P' : this.enterAction.toString();
15872
- const currentNode = nodes[index];
15873
- let isNestedNode = !isNullOrUndefined(currentNode) && nodes[index].nodeName === '#text' && nodes[index].parentElement.nodeName !== enterType;
15874
- let currentParentElem = currentNode.parentElement.textContent !== currentNode.textContent ? currentNode : currentNode.parentElement;
15875
- if (isNestedNode) {
15876
- let isSameTextContent = true;
15877
- isNestedNode = false;
15878
- while (!isNullOrUndefined(currentParentElem) && isSameTextContent && currentParentElem.parentElement.nodeName !== enterType
15879
- && (currentParentElem.nodeName === 'SPAN' && (currentParentElem.style.textDecoration === 'line-through' || 'underline')
15880
- || currentParentElem.nodeName === 'SPAN' && (currentParentElem.style[0] === 'background-color' || 'font-family' || 'color')
15881
- || (currentParentElem.nodeName === 'EM' || 'STRONG' || 'SUB' || 'SUP'))) {
15882
- isSameTextContent = currentParentElem.textContent === currentParentElem.parentElement.textContent;
15883
- currentParentElem = !isNullOrUndefined(currentParentElem.parentElement) && isSameTextContent ? currentParentElem.parentElement : currentParentElem;
15884
- }
15885
- if (!isNullOrUndefined(currentParentElem) && currentParentElem.childNodes.length > 0) {
15886
- let nodeList = currentParentElem.querySelectorAll('span,strong,em,sub,sup');
15887
- isNestedNode = nodeList.length > 0 && isSameTextContent;
15888
- }
15889
- }
15890
- if (isNestedNode) {
15891
- let nodeList = [];
15892
- nodeList[0] = currentParentElem;
15893
- this.applyStyles(nodeList, index, element);
15894
- }
15895
- else {
15896
- nodes[index] = this.applyStyles(nodes, index, element);
15897
- }
15904
+ nodes[index] = this.applyStyles(nodes, index, element);
15898
15905
  if (format === 'fontsize') {
15899
15906
  const bg = closest(nodes[index].parentElement, 'span[style*=' + 'background-color' + ']');
15900
15907
  if (!isNullOrUndefined(bg)) {
@@ -16304,7 +16311,8 @@ class ClearFormat$1 {
16304
16311
  this.unWrap(docElement, blockNodes, nodeCutter, nodeSelection);
16305
16312
  }
16306
16313
  else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
16307
- childNodes[index2].parentNode.nodeName.toLocaleLowerCase() === childNodes[index2].nodeName.toLocaleLowerCase()) {
16314
+ childNodes[index2].parentNode.nodeName.toLocaleLowerCase() ===
16315
+ childNodes[index2].nodeName.toLocaleLowerCase()) {
16308
16316
  InsertMethods.unwrap(childNodes[index2]);
16309
16317
  }
16310
16318
  else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
@@ -16818,6 +16826,7 @@ class MsWordPaste {
16818
16826
  hexConversion(rtfData) {
16819
16827
  // eslint-disable-next-line
16820
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
16821
16830
  const pic = new RegExp('(?:(' + picHead.source + '))([\\da-fA-F\\s]+)\\}', 'g');
16822
16831
  const fullImg = rtfData.match(pic);
16823
16832
  let imgType;
@@ -16881,7 +16890,9 @@ class MsWordPaste {
16881
16890
  removeUnwantedElements(elm) {
16882
16891
  let innerElement = elm.innerHTML;
16883
16892
  for (let i = 0; i < this.removableElements.length; i++) {
16893
+ // eslint-disable-next-line security/detect-non-literal-regexp
16884
16894
  const regExpStartElem = new RegExp('<' + this.removableElements[i] + '>', 'g');
16895
+ // eslint-disable-next-line security/detect-non-literal-regexp
16885
16896
  const regExpEndElem = new RegExp('</' + this.removableElements[i] + '>', 'g');
16886
16897
  innerElement = innerElement.replace(regExpStartElem, '');
16887
16898
  innerElement = innerElement.replace(regExpEndElem, '');
@@ -16930,7 +16941,7 @@ class MsWordPaste {
16930
16941
  const styleClassObject = !isNullOrUndefined(styles) ? this.findStyleObject(styles) : null;
16931
16942
  const keys = Object.keys(styleClassObject);
16932
16943
  let values = keys.map((key) => {
16933
- return styleClassObject[key];
16944
+ return styleClassObject[`${key}`];
16934
16945
  });
16935
16946
  values = this.removeUnwantedStyle(values, wordPasteStyleConfig);
16936
16947
  this.filterStyles(elm, wordPasteStyleConfig);
@@ -17211,7 +17222,8 @@ class MsWordPaste {
17211
17222
  for (let j = 0; j < collection[index].nestedLevel - pLevel; j++) {
17212
17223
  prevList.appendChild(temp = createElement(collection[index].listType));
17213
17224
  prevList = createElement('li');
17214
- 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) {
17215
17227
  prevList.style.listStyleType = 'none';
17216
17228
  }
17217
17229
  temp.appendChild(prevList);
@@ -17618,6 +17630,7 @@ class ToolbarStatus {
17618
17630
  }
17619
17631
  }
17620
17632
  for (let index = 0; index < nodes.length; index++) {
17633
+ // eslint-disable-next-line max-len
17621
17634
  formatCollection = this.getFormatParent(docElement, formatCollection, nodes[index], targetNode, formatNode, fontSize, fontName);
17622
17635
  if ((index === 0 && formatCollection.bold) || !formatCollection.bold) {
17623
17636
  nodeCollection.bold = formatCollection.bold;
@@ -17797,12 +17810,14 @@ class ToolbarStatus {
17797
17810
  let index = null;
17798
17811
  if ((name !== null && name !== '' && name !== undefined)
17799
17812
  && (fontName === null || fontName === undefined || (fontName.filter((value, pos) => {
17813
+ // eslint-disable-next-line
17800
17814
  const pattern = new RegExp(name, 'i');
17801
17815
  if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
17802
- (value.search(pattern) > -1)) {
17816
+ (value.split(',')[0] && value.split(',')[0].search(pattern) > -1)) {
17803
17817
  index = pos;
17804
17818
  }
17805
17819
  }) && (index !== null)))) {
17820
+ // eslint-disable-next-line
17806
17821
  return (index !== null) ? fontName[index] : name.replace(/"/g, '');
17807
17822
  }
17808
17823
  else {
@@ -18466,7 +18481,7 @@ class HtmlEditor {
18466
18481
  }
18467
18482
  }
18468
18483
  isTableClassAdded() {
18469
- let tableElement = this.parent.inputElement.querySelectorAll('table');
18484
+ const tableElement = this.parent.inputElement.querySelectorAll('table');
18470
18485
  for (let i = 0; i < tableElement.length; i++) {
18471
18486
  if (!tableElement[i].classList.contains('e-rte-table')) {
18472
18487
  tableElement[i].classList.add('e-rte-table');
@@ -18478,18 +18493,20 @@ class HtmlEditor {
18478
18493
  const restrictKeys = [8, 9, 13, 16, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
18479
18494
  112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
18480
18495
  const range = this.parent.getRange();
18496
+ // eslint-disable-next-line
18481
18497
  const regEx = new RegExp(String.fromCharCode(8203), 'g');
18482
18498
  let pointer;
18483
18499
  if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
18484
18500
  pointer = range.startOffset;
18501
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
18485
18502
  range.startContainer.nodeName === '#text' ? range.startContainer.parentElement.classList.add('currentStartMark') : range.startContainer.classList.add('currentStartMark');
18486
18503
  if (range.startContainer.textContent.charCodeAt(0) === 8203) {
18487
18504
  pointer = range.startOffset === 0 ? range.startOffset : range.startOffset - 1;
18488
18505
  range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
18489
18506
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
18490
18507
  }
18491
- let previousLength = this.parent.inputElement.innerHTML.length;
18492
- 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;
18493
18510
  if (previousLength > currentLength) {
18494
18511
  let currentChild = this.parent.inputElement.firstChild;
18495
18512
  while (!isNullOrUndefined(currentChild) && currentChild.textContent.replace(regEx, '').trim().length > 0) {
@@ -18497,7 +18514,7 @@ class HtmlEditor {
18497
18514
  currentChild = currentChild.nextElementSibling;
18498
18515
  }
18499
18516
  if (this.parent.inputElement.querySelector('.currentStartMark').childNodes.length > 1) {
18500
- let currentChild = this.parent.inputElement.querySelector('.currentStartMark').childNodes;
18517
+ const currentChild = this.parent.inputElement.querySelector('.currentStartMark').childNodes;
18501
18518
  for (let i = 0; i < currentChild.length; i++) {
18502
18519
  if (currentChild[i].nodeName === '#text' && currentChild[i].textContent.length === 0) {
18503
18520
  detach(currentChild[i]);
@@ -18507,7 +18524,7 @@ class HtmlEditor {
18507
18524
  }
18508
18525
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.parent.inputElement.querySelector('.currentStartMark').childNodes[0], pointer);
18509
18526
  }
18510
- let currentElem = this.parent.inputElement.querySelector('.currentStartMark');
18527
+ const currentElem = this.parent.inputElement.querySelector('.currentStartMark');
18511
18528
  if (!isNullOrUndefined(currentElem)) {
18512
18529
  currentElem.classList.remove('currentStartMark');
18513
18530
  if (currentElem.getAttribute('class').trim() === '') {
@@ -18649,7 +18666,7 @@ class HtmlEditor {
18649
18666
  if (e.args.code === 'Backspace' && e.args.keyCode === 8 && currentRange.startOffset === 0 &&
18650
18667
  currentRange.endOffset === 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.textContent.length > 0 &&
18651
18668
  currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH') {
18652
- let checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
18669
+ const checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
18653
18670
  if (!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
18654
18671
  !isNullOrUndefined(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') {
18655
18672
  return;
@@ -19709,6 +19726,7 @@ class PasteCleanup {
19709
19726
  }
19710
19727
  }
19711
19728
  }
19729
+ // eslint-disable-next-line @typescript-eslint/tslint/config
19712
19730
  setCssClass(e) {
19713
19731
  if (this.popupObj && e.cssClass) {
19714
19732
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -19958,7 +19976,7 @@ class PasteCleanup {
19958
19976
  const groupingTags = [...deniedTags];
19959
19977
  const keys = Object.keys(pasteCleanupGroupingTags);
19960
19978
  const values = keys.map((key) => {
19961
- return pasteCleanupGroupingTags[key];
19979
+ return pasteCleanupGroupingTags[`${key}`];
19962
19980
  });
19963
19981
  const addTags = [];
19964
19982
  for (let i = 0; i < groupingTags.length; i++) {
@@ -20278,6 +20296,7 @@ class FileManager$1 {
20278
20296
  this.dialogObj.show(Browser.isDevice ? true : false);
20279
20297
  this.setCssClass({ cssClass: this.parent.cssClass });
20280
20298
  }
20299
+ // eslint-disable-next-line @typescript-eslint/tslint/config
20281
20300
  setCssClass(e) {
20282
20301
  if (this.dialogObj && e.cssClass) {
20283
20302
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -20636,33 +20655,33 @@ function setAttributes(htmlAttributes, rte, isFrame, initial) {
20636
20655
  if (Object.keys(htmlAttributes).length) {
20637
20656
  for (const htmlAttr of Object.keys(htmlAttributes)) {
20638
20657
  if (htmlAttr === 'class') {
20639
- target.classList.add(htmlAttributes[htmlAttr]);
20658
+ target.classList.add(htmlAttributes[`${htmlAttr}`]);
20640
20659
  }
20641
- else if (htmlAttr === 'disabled' && htmlAttributes[htmlAttr] === 'disabled') {
20660
+ else if (htmlAttr === 'disabled' && htmlAttributes[`${htmlAttr}`] === 'disabled') {
20642
20661
  rte.enabled = false;
20643
20662
  rte.setEnable();
20644
20663
  }
20645
- else if (htmlAttr === 'readonly' && htmlAttributes[htmlAttr] === 'readonly') {
20664
+ else if (htmlAttr === 'readonly' && htmlAttributes[`${htmlAttr}`] === 'readonly') {
20646
20665
  rte.readonly = true;
20647
20666
  rte.setReadOnly(initial);
20648
20667
  }
20649
20668
  else if (htmlAttr === 'style') {
20650
- target.setAttribute('style', htmlAttributes[htmlAttr]);
20669
+ target.setAttribute('style', htmlAttributes[`${htmlAttr}`]);
20651
20670
  }
20652
20671
  else if (htmlAttr === 'tabindex') {
20653
- rte.inputElement.setAttribute('tabindex', htmlAttributes[htmlAttr]);
20672
+ rte.inputElement.setAttribute('tabindex', htmlAttributes[`${htmlAttr}`]);
20654
20673
  }
20655
20674
  else if (htmlAttr === 'placeholder') {
20656
- rte.placeholder = htmlAttributes[htmlAttr];
20675
+ rte.placeholder = htmlAttributes[`${htmlAttr}`];
20657
20676
  rte.setPlaceHolder();
20658
20677
  }
20659
20678
  else {
20660
20679
  const validateAttr = ['name', 'required'];
20661
20680
  if (validateAttr.indexOf(htmlAttr) > -1) {
20662
- rte.valueContainer.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
20681
+ rte.valueContainer.setAttribute(htmlAttr, htmlAttributes[`${htmlAttr}`]);
20663
20682
  }
20664
20683
  else {
20665
- target.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
20684
+ target.setAttribute(htmlAttr, htmlAttributes[`${htmlAttr}`]);
20666
20685
  }
20667
20686
  }
20668
20687
  }
@@ -20856,6 +20875,7 @@ class Link {
20856
20875
  }
20857
20876
  }
20858
20877
  }
20878
+ // eslint-disable-next-line @typescript-eslint/tslint/config
20859
20879
  setCssClass(e) {
20860
20880
  this.updateCss(this.checkBoxObj, e);
20861
20881
  this.updateCss(this.dialogObj, e);
@@ -21028,13 +21048,13 @@ class Link {
21028
21048
  });
21029
21049
  const htmlTextbox = (this.parent.editorMode === 'HTML') ? '<label>' + linkTooltip +
21030
21050
  '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
21031
- '<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>' +
21032
21052
  '<div class="e-rte-label' + ' ' + this.parent.cssClass + '"></div>' + '<div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
21033
21053
  '<input type="checkbox" class="e-rte-linkTarget' + ' ' + this.parent.cssClass + '" data-role ="none"></div>' : '';
21034
21054
  const content = '<div class="e-rte-label' + ' ' + this.parent.cssClass + '"><label>' + linkWebAddress + '</label></div>' + '<div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
21035
- '<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>' +
21036
21056
  '<div class="e-rte-label' + ' ' + this.parent.cssClass + '">' + '<label>' + linkDisplayText + '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"> ' +
21037
- '<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 + '">' +
21038
21058
  '</div><div class="e-rte-label' + ' ' + this.parent.cssClass + '">' + htmlTextbox;
21039
21059
  const contentElem = parseHtml(content);
21040
21060
  linkContent.appendChild(contentElem);
@@ -21060,7 +21080,7 @@ class Link {
21060
21080
  cssClass: CLS_RTE_ELEMENTS + ' ' + this.parent.cssClass,
21061
21081
  enableRtl: this.parent.enableRtl,
21062
21082
  locale: this.parent.locale,
21063
- showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '310px', height: 'inherit',
21083
+ showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '310px',
21064
21084
  isModal: Browser.isDevice,
21065
21085
  buttons: [{
21066
21086
  click: this.insertlink.bind(selectObj),
@@ -21402,6 +21422,7 @@ class Image {
21402
21422
  }
21403
21423
  }
21404
21424
  }
21425
+ // eslint-disable-next-line @typescript-eslint/tslint/config
21405
21426
  setCssClass(e) {
21406
21427
  if (this.popupObj && e.cssClass) {
21407
21428
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -21594,8 +21615,8 @@ class Image {
21594
21615
  const pos = this.calcPos(e);
21595
21616
  const top = pos.top;
21596
21617
  const left = pos.left;
21597
- const imgWid = e.width;
21598
- const imgHgt = e.height;
21618
+ const imgWid = e.getBoundingClientRect().width;
21619
+ const imgHgt = e.getBoundingClientRect().height;
21599
21620
  const borWid = (Browser.isDevice) ? (4 * parseInt((e.style.outline.slice(-3)), 10)) + 2 :
21600
21621
  (2 * parseInt((e.style.outline.slice(-3)), 10)) + 2; //span border width + image outline width
21601
21622
  const devWid = ((Browser.isDevice) ? 0 : 2); // span border width
@@ -21622,7 +21643,6 @@ class Image {
21622
21643
  offsetParent = offsetParent.parentNode;
21623
21644
  }
21624
21645
  if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
21625
- // eslint-disable-next-line
21626
21646
  parentOffset = offsetParent.getBoundingClientRect();
21627
21647
  }
21628
21648
  if (elem.offsetParent && (elem.offsetParent.classList.contains('e-img-caption'))) {
@@ -21643,6 +21663,7 @@ class Image {
21643
21663
  if (isNullOrUndefined(img.width)) {
21644
21664
  return;
21645
21665
  }
21666
+ // eslint-disable-next-line security/detect-unsafe-regex
21646
21667
  const width = img.style.width !== '' ? img.style.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(img.style.width) :
21647
21668
  parseInt(img.style.width, 10) : img.width;
21648
21669
  const height = img.style.height !== '' ? parseInt(img.style.height, 10) : img.height;
@@ -22439,6 +22460,7 @@ class Image {
22439
22460
  }
22440
22461
  }
22441
22462
  imageRemovePost(src) {
22463
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
22442
22464
  const proxy = this;
22443
22465
  let absoluteUrl = '';
22444
22466
  if (isNullOrUndefined(this.parent.insertImageSettings.removeUrl) || this.parent.insertImageSettings.removeUrl === '') {
@@ -22450,8 +22472,9 @@ class Image {
22450
22472
  else {
22451
22473
  absoluteUrl = new URL(src, document.baseURI).href;
22452
22474
  }
22453
- this.removingImgName = absoluteUrl.replace(/^.*[\\\/]/, '');
22475
+ this.removingImgName = absoluteUrl.replace(/^.*[\\/]/, '');
22454
22476
  const xhr = new XMLHttpRequest();
22477
+ // eslint-disable-next-line @typescript-eslint/tslint/config
22455
22478
  xhr.addEventListener('readystatechange', function () {
22456
22479
  if (this.readyState === 4 && this.status === 200) {
22457
22480
  proxy.triggerPost(this.response);
@@ -22466,6 +22489,7 @@ class Image {
22466
22489
  if (isNullOrUndefined(removeUrl) || removeUrl === '') {
22467
22490
  return;
22468
22491
  }
22492
+ // eslint-disable-next-line @typescript-eslint/tslint/config
22469
22493
  const file = new File([response], this.removingImgName);
22470
22494
  const ajax = new Ajax(removeUrl, 'POST', true, null);
22471
22495
  const formData = new FormData();
@@ -22613,7 +22637,7 @@ class Image {
22613
22637
  cssClass: CLS_RTE_ELEMENTS + ' ' + this.parent.cssClass,
22614
22638
  enableRtl: this.parent.enableRtl,
22615
22639
  locale: this.parent.locale,
22616
- showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px', height: 'inherit',
22640
+ showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px',
22617
22641
  position: { X: 'center', Y: (Browser.isDevice) ? 'center' : 'top' },
22618
22642
  isModal: Browser.isDevice,
22619
22643
  buttons: [{
@@ -22761,7 +22785,7 @@ class Image {
22761
22785
  const placeUrl = this.i10n.getConstant('imageUrl');
22762
22786
  this.inputUrl = this.parent.createElement('input', {
22763
22787
  className: 'e-input e-img-url' + ' ' + this.parent.cssClass,
22764
- attrs: { placeholder: placeUrl, spellcheck: 'false' }
22788
+ attrs: { placeholder: placeUrl, spellcheck: 'false', 'aria-label': this.i10n.getConstant('imageLinkHeader') }
22765
22789
  });
22766
22790
  this.inputUrl.addEventListener('input', () => {
22767
22791
  if (!isNullOrUndefined(this.inputUrl)) {
@@ -23688,6 +23712,7 @@ class Audio {
23688
23712
  }
23689
23713
  }
23690
23714
  }
23715
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
23691
23716
  touchStart(e, ele) {
23692
23717
  if (this.parent.readonly) {
23693
23718
  return;
@@ -23894,6 +23919,7 @@ class Audio {
23894
23919
  }
23895
23920
  }
23896
23921
  audioRemovePost(src) {
23922
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
23897
23923
  const proxy = this;
23898
23924
  let absoluteUrl = '';
23899
23925
  if (isNullOrUndefined(this.parent.insertAudioSettings.removeUrl) || this.parent.insertAudioSettings.removeUrl === '') {
@@ -23905,8 +23931,9 @@ class Audio {
23905
23931
  else {
23906
23932
  absoluteUrl = new URL(src, document.baseURI).href;
23907
23933
  }
23908
- this.removingAudioName = absoluteUrl.replace(/^.*[\\\/]/, '');
23934
+ this.removingAudioName = absoluteUrl.replace(/^.*[\\/]/, '');
23909
23935
  const xhr = new XMLHttpRequest();
23936
+ // eslint-disable-next-line @typescript-eslint/tslint/config
23910
23937
  xhr.addEventListener('readystatechange', function () {
23911
23938
  if (this.readyState === 4 && this.status === 200) {
23912
23939
  proxy.triggerPost(this.response);
@@ -23940,6 +23967,7 @@ class Audio {
23940
23967
  }
23941
23968
  }
23942
23969
  if (this.isAudioElem(e.target)) {
23970
+ this.audEle = e.target.querySelector('audio');
23943
23971
  e.preventDefault();
23944
23972
  }
23945
23973
  }
@@ -24078,8 +24106,6 @@ class Audio {
24078
24106
  addClass([target.querySelector('audio')], [CLS_AUD_FOCUS]);
24079
24107
  target.querySelector('audio').style.outline = '2px solid #4a90e2';
24080
24108
  }
24081
- const pageY = (this.parent.iframeSettings.enable) ? window.pageYOffset +
24082
- this.parent.element.getBoundingClientRect().top + args.clientY : args.pageY;
24083
24109
  if (this.parent.quickToolbarModule.audioQTBar) {
24084
24110
  if (e.isNotify) {
24085
24111
  setTimeout(() => {
@@ -24134,7 +24160,7 @@ class Audio {
24134
24160
  cssClass: CLS_RTE_ELEMENTS,
24135
24161
  enableRtl: this.parent.enableRtl,
24136
24162
  locale: this.parent.locale,
24137
- showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px', height: 'inherit',
24163
+ showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px',
24138
24164
  position: { X: 'center', Y: (Browser.isDevice) ? 'center' : 'top' },
24139
24165
  isModal: Browser.isDevice,
24140
24166
  buttons: [{
@@ -24205,7 +24231,7 @@ class Audio {
24205
24231
  const placeUrl = this.i10n.getConstant('audioUrl');
24206
24232
  this.inputUrl = this.parent.createElement('input', {
24207
24233
  className: 'e-input e-audio-url',
24208
- attrs: { placeholder: placeUrl, spellcheck: 'false' }
24234
+ attrs: { placeholder: placeUrl, spellcheck: 'false', 'aria-label': this.i10n.getConstant('audioLinkHeader') }
24209
24235
  });
24210
24236
  this.inputUrl.addEventListener('input', () => {
24211
24237
  if (!isNullOrUndefined(this.inputUrl)) {
@@ -24832,7 +24858,6 @@ class Video {
24832
24858
  offsetParent = offsetParent.parentNode;
24833
24859
  }
24834
24860
  if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
24835
- // eslint-disable-next-line
24836
24861
  parentOffset = offsetParent.getBoundingClientRect();
24837
24862
  }
24838
24863
  if (elem && elem.nodeType === 1 && elem.tagName === 'IFRAME') {
@@ -24854,6 +24879,7 @@ class Video {
24854
24879
  if (isNullOrUndefined(vidEleStyle)) {
24855
24880
  return;
24856
24881
  }
24882
+ // eslint-disable-next-line
24857
24883
  const width = vidEleStyle.width !== '' ? vidEleStyle.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(vidEleStyle.width) :
24858
24884
  parseInt(vidEleStyle.width, 10) : vid.style.width !== '' ? vid.style.width : vid.width;
24859
24885
  const height = vidEleStyle.height !== '' ? parseInt(vidEleStyle.height, 10) : vid.style.height !== '' ? vid.style.height : vid.height;
@@ -25251,6 +25277,7 @@ class Video {
25251
25277
  }
25252
25278
  }
25253
25279
  videoRemovePost(src) {
25280
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
25254
25281
  const proxy = this;
25255
25282
  let absoluteUrl = '';
25256
25283
  if (isNullOrUndefined(this.parent.insertVideoSettings.removeUrl) || this.parent.insertVideoSettings.removeUrl === '') {
@@ -25262,8 +25289,10 @@ class Video {
25262
25289
  else {
25263
25290
  absoluteUrl = new URL(src, document.baseURI).href;
25264
25291
  }
25292
+ // eslint-disable-next-line no-useless-escape
25265
25293
  this.removingVideoName = absoluteUrl.replace(/^.*[\\\/]/, '');
25266
25294
  const xhr = new XMLHttpRequest();
25295
+ // eslint-disable-next-line @typescript-eslint/tslint/config
25267
25296
  xhr.addEventListener('readystatechange', function () {
25268
25297
  if (this.readyState === 4 && this.status === 200) {
25269
25298
  proxy.triggerPost(this.response);
@@ -25393,7 +25422,7 @@ class Video {
25393
25422
  }
25394
25423
  }
25395
25424
  showVideoQuickToolbar(e) {
25396
- if (e.type !== 'Videos' || isNullOrUndefined(this.parent.quickToolbarModule)
25425
+ if (e.type !== 'Videos' || e.args.detail === 2 || isNullOrUndefined(this.parent.quickToolbarModule)
25397
25426
  || isNullOrUndefined(this.parent.quickToolbarModule.videoQTBar) || isNullOrUndefined(e.args)) {
25398
25427
  return;
25399
25428
  }
@@ -25426,6 +25455,12 @@ class Video {
25426
25455
  hideVideoQuickToolbar() {
25427
25456
  if (!isNullOrUndefined(this.contentModule.getEditPanel().querySelector('.' + CLS_VID_FOCUS))) {
25428
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
+ }
25429
25464
  if (this.quickToolObj && this.quickToolObj.videoQTBar && document.body.contains(this.quickToolObj.videoQTBar.element)) {
25430
25465
  this.quickToolObj.videoQTBar.hidePopup();
25431
25466
  }
@@ -25470,7 +25505,7 @@ class Video {
25470
25505
  cssClass: CLS_RTE_ELEMENTS,
25471
25506
  enableRtl: this.parent.enableRtl,
25472
25507
  locale: this.parent.locale,
25473
- showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px', height: 'inherit',
25508
+ showCloseIcon: true, closeOnEscape: true, width: (Browser.isDevice) ? '290px' : '340px',
25474
25509
  position: { X: 'center', Y: (Browser.isDevice) ? 'center' : 'top' },
25475
25510
  isModal: Browser.isDevice,
25476
25511
  buttons: [{
@@ -25552,7 +25587,7 @@ class Video {
25552
25587
  videoUrl.appendChild(urlContent);
25553
25588
  this.embedInputUrl = this.parent.createElement('textarea', {
25554
25589
  className: 'e-input e-embed-video-url',
25555
- 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') }
25556
25591
  });
25557
25592
  this.embedInputUrl.addEventListener('keyup', () => {
25558
25593
  if (!isNullOrUndefined(this.embedInputUrl)) {
@@ -26199,6 +26234,7 @@ class Table {
26199
26234
  }
26200
26235
  }
26201
26236
  }
26237
+ // eslint-disable-next-line @typescript-eslint/tslint/config
26202
26238
  setCssClass(e) {
26203
26239
  if (this.popupObj && e.cssClass) {
26204
26240
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -26331,18 +26367,17 @@ class Table {
26331
26367
  }
26332
26368
  }
26333
26369
  }
26370
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
26334
26371
  tableModulekeyUp(e) {
26335
- const event = e.args;
26336
26372
  if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection) && this.contentModule) {
26337
26373
  const range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
26338
- const selection = this.parent.formatter.editorManager.nodeSelection.save(range, this.contentModule.getDocument());
26339
26374
  let ele = this.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range)[0];
26340
26375
  ele = (ele && ele.tagName !== 'TD' && ele.tagName !== 'TH') ? ele.parentElement : ele;
26341
26376
  if (ele && ele.tagName !== 'TD' && ele.tagName !== 'TH') {
26342
26377
  const closestTd = closest(ele, 'td');
26343
26378
  ele = !isNullOrUndefined(closestTd) && this.parent.inputElement.contains(closestTd) ? closestTd : ele;
26344
26379
  }
26345
- if (this.previousTableElement != ele && !isNullOrUndefined(this.previousTableElement)) {
26380
+ if (this.previousTableElement !== ele && !isNullOrUndefined(this.previousTableElement)) {
26346
26381
  this.previousTableElement.classList.remove(CLS_TABLE_SEL);
26347
26382
  }
26348
26383
  }
@@ -26771,7 +26806,6 @@ class Table {
26771
26806
  top: 0,
26772
26807
  left: 0
26773
26808
  };
26774
- // eslint-disable-next-line
26775
26809
  const offset = elem.getBoundingClientRect();
26776
26810
  const doc = elem.ownerDocument;
26777
26811
  let offsetParent = elem.offsetParent || doc.documentElement;
@@ -26786,7 +26820,6 @@ class Table {
26786
26820
  isNestedTable = true;
26787
26821
  }
26788
26822
  if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
26789
- // eslint-disable-next-line
26790
26823
  parentOffset = offsetParent.getBoundingClientRect();
26791
26824
  }
26792
26825
  if (isNestedTable) {
@@ -26953,6 +26986,8 @@ class Table {
26953
26986
  const mouseY = (this.parent.enableRtl) ? -(pageY - this.pageY) : (pageY - this.pageY);
26954
26987
  this.pageX = pageX;
26955
26988
  this.pageY = pageY;
26989
+ let maxiumWidth;
26990
+ const currentTdElement = this.curTable.closest('td');
26956
26991
  const args = { event: e, requestType: 'table' };
26957
26992
  this.parent.trigger(onResize, args, (resizingArgs) => {
26958
26993
  if (resizingArgs.cancel) {
@@ -26985,6 +27020,10 @@ class Table {
26985
27020
  if (this.currentColumnResize === 'first') {
26986
27021
  mouseX = mouseX - 0.75; //This was done for to make the gripper and the table first/last column will be close.
26987
27022
  this.removeResizeElement();
27023
+ if (currentTdElement) {
27024
+ maxiumWidth = this.curTable.getBoundingClientRect().right - this.calcPos(currentTdElement).left;
27025
+ this.curTable.style.maxWidth = maxiumWidth + 'px';
27026
+ }
26988
27027
  // Below the value '100' is the 100% width of the parent element.
26989
27028
  if (((mouseX !== 0 && 5 < currentColumnCellWidth) || mouseX < 0) && currentTableWidth <= 100 &&
26990
27029
  this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) <= 100) {
@@ -27002,6 +27041,10 @@ class Table {
27002
27041
  else if (this.currentColumnResize === 'last') {
27003
27042
  mouseX = mouseX + 0.75; //This was done for to make the gripper and the table first/last column will be close.
27004
27043
  this.removeResizeElement();
27044
+ if (currentTdElement) {
27045
+ maxiumWidth = currentTdElement.getBoundingClientRect().right - this.curTable.getBoundingClientRect().left;
27046
+ this.curTable.style.maxWidth = maxiumWidth + 'px';
27047
+ }
27005
27048
  // Below the value '100' is the 100% width of the parent element.
27006
27049
  if (((mouseX !== 0 && 5 < currentColumnCellWidth) || mouseX > 0) &&
27007
27050
  currentTableWidth <= 100 && this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) <= 100) {
@@ -27052,6 +27095,12 @@ class Table {
27052
27095
  if (!Browser.isDevice) {
27053
27096
  EventHandler.remove(this.contentModule.getEditPanel(), 'mouseover', this.resizeHelper);
27054
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
+ }
27055
27104
  const widthType = this.curTable.style.width.indexOf('%') > -1;
27056
27105
  this.curTable.style.width = widthType ? this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%'
27057
27106
  : tableWidth + mouseX + 'px';
@@ -28246,8 +28295,8 @@ class EnterKeyAction {
28246
28295
  let curElement = this.startNode;
28247
28296
  let blockElement = curElement;
28248
28297
  while (!this.parent.formatter.editorManager.domNode.isBlockNode(curElement)) {
28249
- blockElement = curElement;
28250
28298
  curElement = curElement.parentElement;
28299
+ blockElement = curElement;
28251
28300
  }
28252
28301
  isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
28253
28302
  }
@@ -28264,7 +28313,10 @@ class EnterKeyAction {
28264
28313
  this.parent.trigger(actionBegin, actionBeginArgs, (actionBeginArgs) => {
28265
28314
  if (!actionBeginArgs.cancel) {
28266
28315
  if (!(this.range.startOffset === this.range.endOffset && this.range.startContainer === this.range.endContainer)) {
28267
- 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
+ }
28268
28320
  if (this.range.startContainer.nodeName === '#text' && this.range.startContainer.textContent.length === 0 &&
28269
28321
  this.range.startContainer.parentElement !== this.parent.inputElement) {
28270
28322
  if (this.parent.enterKey === 'BR') {
@@ -28293,8 +28345,8 @@ class EnterKeyAction {
28293
28345
  while (!isNullOrUndefined(currentFocusElem) && currentFocusElem.nodeName !== '#text' && currentFocusElem.nodeName !== 'BR') {
28294
28346
  currentFocusElem = currentFocusElem.lastChild;
28295
28347
  }
28296
- if (currentFocusElem.nodeName != 'BR' && currentFocusElem.parentElement.textContent.length === 0 && currentFocusElem.parentElement.innerHTML.length === 0 &&
28297
- currentFocusElem.parentElement.nodeName != 'BR') {
28348
+ if (currentFocusElem.nodeName !== 'BR' && currentFocusElem.parentElement.textContent.length === 0 && currentFocusElem.parentElement.innerHTML.length === 0 &&
28349
+ currentFocusElem.parentElement.nodeName !== 'BR') {
28298
28350
  currentFocusElem.parentElement.appendChild(this.parent.createElement('BR'));
28299
28351
  }
28300
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);
@@ -28333,7 +28385,7 @@ class EnterKeyAction {
28333
28385
  (this.parent.shiftEnterKey === 'P' && shiftKey) ||
28334
28386
  (this.parent.shiftEnterKey === 'DIV' && shiftKey)) {
28335
28387
  if (this.range.startOffset === 1 && this.parent.inputElement.childNodes.length === 1 && this.parent.inputElement.childNodes[0].nodeName === 'TABLE') {
28336
- let newElem = this.createInsertElement(shiftKey);
28388
+ const newElem = this.createInsertElement(shiftKey);
28337
28389
  newElem.appendChild(this.parent.createElement('BR'));
28338
28390
  this.parent.inputElement.appendChild(newElem);
28339
28391
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), newElem, 0);
@@ -28346,13 +28398,14 @@ class EnterKeyAction {
28346
28398
  else {
28347
28399
  nearBlockNode = this.parent.formatter.editorManager.domNode.blockParentNode(this.startNode);
28348
28400
  }
28349
- let isImageNode = false;
28401
+ let isMediaNode = false; // To check the image audio and video node cases
28350
28402
  let isFocusedFirst = false;
28351
28403
  if (this.range.startOffset !== 0 && this.range.endOffset !== 0 &&
28352
28404
  this.range.startContainer === this.range.endContainer && !(!isNullOrUndefined(nearBlockNode.childNodes[0])
28353
- && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
28405
+ && nearBlockNode.childNodes[0].nodeName === 'IMG' && nearBlockNode.querySelectorAll('img,audio,video').length > 0)) {
28354
28406
  const startNodeText = this.range.startContainer.textContent;
28355
28407
  const splitFirstText = startNodeText.substring(0, this.range.startOffset);
28408
+ // eslint-disable-next-line max-len
28356
28409
  if (splitFirstText.charCodeAt(this.range.startOffset - 1) !== 160 && splitFirstText.trim().length === 0) {
28357
28410
  isFocusedFirst = true;
28358
28411
  }
@@ -28364,26 +28417,29 @@ class EnterKeyAction {
28364
28417
  const fireFoxEnterAtMiddle = Browser.userAgent.indexOf('Firefox') !== -1 && this.range.startOffset === 0 && this.range.startContainer === this.range.endContainer &&
28365
28418
  this.range.startContainer.nodeName === '#text' && !this.parent.formatter.editorManager.domNode.isBlockNode(this.range.startContainer.previousSibling) &&
28366
28419
  this.range.startContainer.parentElement === this.range.startContainer.previousSibling.parentElement;
28420
+ // eslint-disable-next-line max-len
28367
28421
  if (!fireFoxEnterAtMiddle && ((this.range.startOffset === 0 && this.range.endOffset === 0) || isFocusedFirst) &&
28368
28422
  !(!isNullOrUndefined(this.range.startContainer.previousSibling) &&
28369
28423
  (this.range.startContainer.previousSibling.nodeName === 'IMG' || this.range.startContainer.previousSibling.nodeName === 'BR'))) {
28370
28424
  let isNearBlockLengthZero;
28371
28425
  let newElem;
28372
- 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')) {
28373
28429
  newElem = this.createInsertElement(shiftKey);
28374
- isImageNode = true;
28430
+ isMediaNode = true;
28375
28431
  isNearBlockLengthZero = false;
28376
28432
  }
28377
28433
  else {
28378
28434
  if ((nearBlockNode.textContent.trim().length !== 0 ||
28379
28435
  nearBlockNode.childNodes[0].nodeName === 'IMG' ||
28380
- (nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img').length > 0))) {
28381
- 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)) {
28382
28438
  newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, false).cloneNode(true);
28383
28439
  }
28384
28440
  else {
28385
28441
  newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, true).cloneNode(true);
28386
- isImageNode = true;
28442
+ isMediaNode = true;
28387
28443
  }
28388
28444
  isNearBlockLengthZero = false;
28389
28445
  }
@@ -28406,7 +28462,7 @@ class EnterKeyAction {
28406
28462
  if (!isNearBlockLengthZero) {
28407
28463
  let currentFocusElem = insertElem;
28408
28464
  let finalFocusElem;
28409
- if (this.range.startOffset === this.range.endOffset && this.range.startOffset != 0) {
28465
+ if (this.range.startOffset === this.range.endOffset && this.range.startOffset !== 0) {
28410
28466
  while (!isNullOrUndefined(currentFocusElem) && currentFocusElem.nodeName !== '#text' &&
28411
28467
  currentFocusElem.nodeName !== 'BR') {
28412
28468
  finalFocusElem = currentFocusElem;
@@ -28417,7 +28473,7 @@ class EnterKeyAction {
28417
28473
  finalFocusElem = currentFocusElem;
28418
28474
  }
28419
28475
  finalFocusElem.innerHTML = '<br>';
28420
- if (!isImageNode) {
28476
+ if (!isMediaNode) {
28421
28477
  detach(nearBlockNode);
28422
28478
  }
28423
28479
  }
@@ -28436,6 +28492,48 @@ class EnterKeyAction {
28436
28492
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), insertElem, 0);
28437
28493
  }
28438
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
+ }
28439
28537
  else {
28440
28538
  const newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, true);
28441
28539
  if (!isNullOrUndefined(newElem.childNodes[0]) && newElem.childNodes[0].nodeName === '#text' &&
@@ -28451,7 +28549,7 @@ class EnterKeyAction {
28451
28549
  this.startNode = startParentElem;
28452
28550
  }
28453
28551
  else {
28454
- if (this.startNode.nodeName != 'BR') {
28552
+ if (this.startNode.nodeName !== 'BR') {
28455
28553
  this.startNode.appendChild(brElm);
28456
28554
  }
28457
28555
  }
@@ -28462,7 +28560,7 @@ class EnterKeyAction {
28462
28560
  }
28463
28561
  if (((this.parent.enterKey === 'P' || this.parent.enterKey === 'DIV') && !shiftKey) || ((this.parent.shiftEnterKey === 'DIV' ||
28464
28562
  this.parent.shiftEnterKey === 'P') && shiftKey)) {
28465
- let isHeadingTag = this.formatTags.indexOf(newElem.nodeName.toLocaleLowerCase());
28563
+ const isHeadingTag = this.formatTags.indexOf(newElem.nodeName.toLocaleLowerCase());
28466
28564
  if ((isHeadingTag < 0) || (isHeadingTag >= 0 && newElem.textContent.trim().length === 0)) {
28467
28565
  const insertElm = this.createInsertElement(shiftKey);
28468
28566
  while (newElem.firstChild) {
@@ -28534,6 +28632,7 @@ class EnterKeyAction {
28534
28632
  const outerBRElem = this.parent.createElement('br');
28535
28633
  if (this.range.startOffset === 0 && this.range.endOffset === 0 &&
28536
28634
  !isNullOrUndefined(currentParent.previousSibling) && currentParent.previousSibling.nodeName === 'BR') {
28635
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
28537
28636
  newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, currentParent, false).cloneNode(true);
28538
28637
  this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
28539
28638
  this.insertFocusContent();
@@ -28542,6 +28641,7 @@ class EnterKeyAction {
28542
28641
  currentFocusElem = currentFocusElem.lastChild;
28543
28642
  }
28544
28643
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), currentFocusElem, 0);
28644
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
28545
28645
 
28546
28646
  }
28547
28647
  else {
@@ -28571,7 +28671,7 @@ class EnterKeyAction {
28571
28671
  insertBRElement() {
28572
28672
  let isEmptyBrInserted = false;
28573
28673
  let isFocusTextNode = true;
28574
- 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') {
28575
28675
  isFocusTextNode = false;
28576
28676
  }
28577
28677
  const brElm = this.parent.createElement('br');
@@ -28904,7 +29004,7 @@ let RichTextEditor = class RichTextEditor extends Component {
28904
29004
  this.focusIn();
28905
29005
  }
28906
29006
  }
28907
- const tool = executeGroup[commandName];
29007
+ const tool = executeGroup[`${commandName}`];
28908
29008
  if (option && option.undo) {
28909
29009
  if (option.undo && this.formatter.getUndoRedoStack().length === 0) {
28910
29010
  this.formatter.saveData();
@@ -29122,16 +29222,18 @@ let RichTextEditor = class RichTextEditor extends Component {
29122
29222
  */
29123
29223
  addAudioVideoWrapper() {
29124
29224
  let insertElem;
29125
- let audioElm = this.element.querySelectorAll('audio');
29225
+ const audioElm = this.element.querySelectorAll('audio');
29126
29226
  for (let i = 0; i < audioElm.length; i++) {
29127
29227
  if (!audioElm[i].classList.contains('e-rte-audio')) {
29128
29228
  audioElm[i].classList.add('e-rte-audio');
29129
29229
  audioElm[i].classList.add(CLS_AUDIOINLINE);
29130
29230
  }
29231
+ // eslint-disable-next-line max-len
29131
29232
  if (!audioElm[i].parentElement.classList.contains(CLS_CLICKELEM) && !audioElm[i].parentElement.classList.contains(CLS_AUDIOWRAP)) {
29132
- 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;');
29133
29235
  audioWrapElem.contentEditable = 'false';
29134
- let audioInnerWrapElem = this.createElement('span', { className: CLS_CLICKELEM });
29236
+ const audioInnerWrapElem = this.createElement('span', { className: CLS_CLICKELEM });
29135
29237
  audioWrapElem.appendChild(audioInnerWrapElem);
29136
29238
  audioElm[i].parentNode.insertBefore(audioWrapElem, audioElm[i].nextSibling);
29137
29239
  audioInnerWrapElem.appendChild(audioElm[i]);
@@ -29141,14 +29243,15 @@ let RichTextEditor = class RichTextEditor extends Component {
29141
29243
  }
29142
29244
  }
29143
29245
  }
29144
- let videoElm = this.element.querySelectorAll('video');
29246
+ const videoElm = this.element.querySelectorAll('video');
29145
29247
  for (let i = 0; i < videoElm.length; i++) {
29146
29248
  if (!videoElm[i].classList.contains('e-rte-video')) {
29147
29249
  videoElm[i].classList.add('e-rte-video');
29148
29250
  videoElm[i].classList.add(CLS_VIDEOINLINE);
29149
29251
  }
29252
+ // eslint-disable-next-line max-len
29150
29253
  if (!videoElm[i].parentElement.classList.contains(CLS_CLICKELEM) && !videoElm[i].parentElement.classList.contains(CLS_VIDEOWRAP)) {
29151
- let videoWrapElem = this.createElement('span', { className: CLS_VIDEOWRAP });
29254
+ const videoWrapElem = this.createElement('span', { className: CLS_VIDEOWRAP });
29152
29255
  videoWrapElem.contentEditable = 'false';
29153
29256
  videoElm[i].parentNode.insertBefore(videoWrapElem, videoElm[i].nextSibling);
29154
29257
  videoWrapElem.appendChild(videoElm[i]);
@@ -29158,10 +29261,12 @@ let RichTextEditor = class RichTextEditor extends Component {
29158
29261
  }
29159
29262
  }
29160
29263
  if (Browser.userAgent.indexOf('Firefox') !== -1) {
29264
+ // eslint-disable-next-line
29161
29265
  videoElm[i].addEventListener('play', (args) => {
29162
29266
  this.notify(mouseDown, { args: args });
29163
29267
  this.notify('editAreaClick', { args: args });
29164
29268
  });
29269
+ // eslint-disable-next-line
29165
29270
  videoElm[i].addEventListener('pause', (args) => {
29166
29271
  this.notify(mouseDown, { args: args });
29167
29272
  this.notify('editAreaClick', { args: args });
@@ -29180,6 +29285,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29180
29285
  eventInitializer() {
29181
29286
  this.wireEvents();
29182
29287
  }
29288
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29183
29289
  cleanList(e) {
29184
29290
  const range = this.getRange();
29185
29291
  const currentStartContainer = range.startContainer;
@@ -29227,6 +29333,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29227
29333
  if (closest(startNode, 'pre') &&
29228
29334
  (e.which === 8 && range.startContainer.textContent.charCodeAt(range.startOffset - 1) === 8203) ||
29229
29335
  (e.which === 46 && range.startContainer.textContent.charCodeAt(range.startOffset) === 8203)) {
29336
+ // eslint-disable-next-line
29230
29337
  const regEx = new RegExp(String.fromCharCode(8203), 'g');
29231
29338
  const pointer = e.which === 8 ? range.startOffset - 1 : range.startOffset;
29232
29339
  range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
@@ -29245,6 +29352,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29245
29352
  let bool = true;
29246
29353
  const removeNodeArray = [];
29247
29354
  for (i = index; i >= 0; i--) {
29355
+ // eslint-disable-next-line max-len
29248
29356
  if (parentEle.childNodes[i].nodeType === 3 && parentEle.childNodes[i].textContent.charCodeAt(0) === 8203 && bool) {
29249
29357
  removeNodeArray.push(i);
29250
29358
  }
@@ -29303,7 +29411,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29303
29411
  }
29304
29412
  }
29305
29413
  this.notify(keyUp, { member: 'keyup', args: e });
29306
- if (e.keyCode == 39 || e.keyCode == 37) {
29414
+ if (e.keyCode === 39 || e.keyCode === 37) {
29307
29415
  this.notify(tableModulekeyUp, { member: 'tableModulekeyUp', args: e });
29308
29416
  }
29309
29417
  if (e.code === 'KeyX' && e.which === 88 && e.keyCode === 88 && e.ctrlKey && (this.inputElement.innerHTML === '' ||
@@ -29721,6 +29829,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29721
29829
  * @hidden
29722
29830
  * @deprecated
29723
29831
  */
29832
+ /* eslint-disable */
29724
29833
  onPropertyChanged(newProp, oldProp) {
29725
29834
  for (const prop of Object.keys(newProp)) {
29726
29835
  switch (prop) {
@@ -29759,7 +29868,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29759
29868
  break;
29760
29869
  }
29761
29870
  case 'valueTemplate':
29762
- this.setValue();
29871
+ this.setValue(true);
29763
29872
  if (this.showCharCount) {
29764
29873
  this.countModule.refresh();
29765
29874
  }
@@ -29855,7 +29964,6 @@ let RichTextEditor = class RichTextEditor extends Component {
29855
29964
  this.notify(xhtmlValidation, { module: 'XhtmlValidation', newProp: newProp, oldProp: oldProp });
29856
29965
  break;
29857
29966
  case 'quickToolbarSettings':
29858
- // eslint-disable-next-line
29859
29967
  newProp.quickToolbarSettings.showOnRightClick ? this.wireContextEvent() : this.unWireContextEvent();
29860
29968
  this.notify(modelChanged, { newProp: newProp, oldProp: oldProp });
29861
29969
  break;
@@ -29865,6 +29973,7 @@ let RichTextEditor = class RichTextEditor extends Component {
29865
29973
  }
29866
29974
  }
29867
29975
  }
29976
+ /* eslint-enable */
29868
29977
  /**
29869
29978
  * @hidden
29870
29979
  * @returns {void}
@@ -30006,9 +30115,11 @@ let RichTextEditor = class RichTextEditor extends Component {
30006
30115
  this.notify(rtlMode, { enableRtl: this.enableRtl });
30007
30116
  if (this.enableRtl) {
30008
30117
  this.element.classList.add(CLS_RTL);
30118
+ this.inputElement.classList.add(CLS_RTL);
30009
30119
  }
30010
30120
  else {
30011
30121
  this.element.classList.remove(CLS_RTL);
30122
+ this.inputElement.classList.remove(CLS_RTL);
30012
30123
  }
30013
30124
  }
30014
30125
  updateReadOnly() {
@@ -30203,7 +30314,7 @@ let RichTextEditor = class RichTextEditor extends Component {
30203
30314
  styleEle.rel = 'stylesheet';
30204
30315
  return styleEle;
30205
30316
  }
30206
- setValue() {
30317
+ setValue(isPropertyChange) {
30207
30318
  if (this.valueTemplate) {
30208
30319
  const regEx = new RegExp(/<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i);
30209
30320
  if (regEx.test(this.valueTemplate)) {
@@ -30211,11 +30322,30 @@ let RichTextEditor = class RichTextEditor extends Component {
30211
30322
  }
30212
30323
  else {
30213
30324
  const compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
30214
- for (let i = 0; i < compiledTemplate.length; i++) {
30215
- const item = compiledTemplate[i];
30216
- 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();
30217
30348
  }
30218
- this.setProperties({ value: this.element.innerHTML.trim() });
30219
30349
  }
30220
30350
  }
30221
30351
  else {
@@ -30231,6 +30361,10 @@ let RichTextEditor = class RichTextEditor extends Component {
30231
30361
  }
30232
30362
  }
30233
30363
  }
30364
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
30365
+ renderTemplates(callBack) {
30366
+ this.renderReactTemplates(callBack);
30367
+ }
30234
30368
  updateResizeFlag() {
30235
30369
  this.isResizeInitialized = true;
30236
30370
  }
@@ -30300,7 +30434,7 @@ let RichTextEditor = class RichTextEditor extends Component {
30300
30434
  const rzHandle = this.element.querySelector('.' + CLS_RTE_RES_HANDLE);
30301
30435
  const rzHeight = this.enableResize ? (!isNullOrUndefined(rzHandle) ? (rzHandle.offsetHeight + 8) : 0) : 0;
30302
30436
  const expandPopHeight = this.getToolbar() ? this.toolbarModule.getExpandTBarPopHeight() : 0;
30303
- if (this.toolbarSettings.type === ToolbarType.Expand && isExpand && target !== 'preview') {
30437
+ if (this.toolbarSettings.type === ToolbarType.Expand && isExpand) {
30304
30438
  heightValue = (this.height === 'auto' && rzHeight === 0) ? 'auto' : rteHeight - (tbHeight + expandPopHeight + rzHeight) + 'px';
30305
30439
  topValue = (!this.toolbarSettings.enableFloating) ? expandPopHeight : 0;
30306
30440
  }