@syncfusion/ej2-richtexteditor 24.1.41-569421 → 24.1.41-581025

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 (167) hide show
  1. package/CHANGELOG.md +0 -176
  2. package/dist/ej2-richtexteditor.umd.min.js +1 -1
  3. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-richtexteditor.es2015.js +7822 -9502
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +5674 -7355
  7. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  8. package/package.json +12 -12
  9. package/src/common/config.d.ts +0 -7
  10. package/src/common/config.js +0 -11
  11. package/src/common/constant.d.ts +0 -6
  12. package/src/common/constant.js +0 -6
  13. package/src/common/interface.d.ts +0 -12
  14. package/src/common/types.d.ts +0 -6
  15. package/src/common/util.d.ts +0 -6
  16. package/src/common/util.js +20 -61
  17. package/src/editor-manager/base/constant.d.ts +0 -6
  18. package/src/editor-manager/base/constant.js +0 -6
  19. package/src/editor-manager/base/editor-manager.d.ts +0 -5
  20. package/src/editor-manager/base/editor-manager.js +0 -59
  21. package/src/editor-manager/base/interface.d.ts +0 -8
  22. package/src/editor-manager/plugin/dom-node.d.ts +1 -5
  23. package/src/editor-manager/plugin/dom-node.js +15 -169
  24. package/src/editor-manager/plugin/format-painter-actions.d.ts +0 -1
  25. package/src/editor-manager/plugin/format-painter-actions.js +1 -19
  26. package/src/editor-manager/plugin/formats.d.ts +0 -1
  27. package/src/editor-manager/plugin/formats.js +3 -38
  28. package/src/editor-manager/plugin/image.js +16 -12
  29. package/src/editor-manager/plugin/indents.js +1 -1
  30. package/src/editor-manager/plugin/inserthtml.d.ts +0 -1
  31. package/src/editor-manager/plugin/inserthtml.js +18 -78
  32. package/src/editor-manager/plugin/link.js +3 -8
  33. package/src/editor-manager/plugin/lists.js +70 -159
  34. package/src/editor-manager/plugin/ms-word-clean-up.d.ts +0 -3
  35. package/src/editor-manager/plugin/ms-word-clean-up.js +85 -212
  36. package/src/editor-manager/plugin/nodecutter.js +2 -5
  37. package/src/editor-manager/plugin/selection-commands.d.ts +0 -2
  38. package/src/editor-manager/plugin/selection-commands.js +4 -209
  39. package/src/editor-manager/plugin/table.d.ts +1 -4
  40. package/src/editor-manager/plugin/table.js +49 -95
  41. package/src/editor-manager/plugin/toolbar-status.d.ts +2 -2
  42. package/src/editor-manager/plugin/toolbar-status.js +10 -20
  43. package/src/editor-manager/plugin/undo.d.ts +0 -1
  44. package/src/editor-manager/plugin/undo.js +1 -21
  45. package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +3 -4
  46. package/src/rich-text-editor/actions/base-quick-toolbar.js +10 -43
  47. package/src/rich-text-editor/actions/base-toolbar.js +34 -33
  48. package/src/rich-text-editor/actions/color-picker.d.ts +0 -1
  49. package/src/rich-text-editor/actions/color-picker.js +0 -10
  50. package/src/rich-text-editor/actions/count.js +1 -1
  51. package/src/rich-text-editor/actions/dropdown-buttons.d.ts +0 -1
  52. package/src/rich-text-editor/actions/dropdown-buttons.js +4 -8
  53. package/src/rich-text-editor/actions/emoji-picker.js +4 -4
  54. package/src/rich-text-editor/actions/enter-key.js +4 -8
  55. package/src/rich-text-editor/actions/format-painter.js +1 -4
  56. package/src/rich-text-editor/actions/full-screen.js +2 -3
  57. package/src/rich-text-editor/actions/html-editor.d.ts +2 -2
  58. package/src/rich-text-editor/actions/html-editor.js +42 -123
  59. package/src/rich-text-editor/actions/keyboard.js +1 -3
  60. package/src/rich-text-editor/actions/markdown-editor.js +1 -3
  61. package/src/rich-text-editor/actions/paste-clean-up.d.ts +0 -3
  62. package/src/rich-text-editor/actions/paste-clean-up.js +14 -85
  63. package/src/rich-text-editor/actions/quick-toolbar.d.ts +0 -8
  64. package/src/rich-text-editor/actions/quick-toolbar.js +9 -37
  65. package/src/rich-text-editor/actions/resize.js +1 -2
  66. package/src/rich-text-editor/actions/toolbar-action.js +1 -1
  67. package/src/rich-text-editor/actions/toolbar.d.ts +3 -2
  68. package/src/rich-text-editor/actions/toolbar.js +87 -18
  69. package/src/rich-text-editor/base/classes.d.ts +5 -0
  70. package/src/rich-text-editor/base/classes.js +5 -0
  71. package/src/rich-text-editor/base/constant.d.ts +0 -40
  72. package/src/rich-text-editor/base/constant.js +0 -209
  73. package/src/rich-text-editor/base/interface.d.ts +3 -37
  74. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +3 -3
  75. package/src/rich-text-editor/base/rich-text-editor.d.ts +4 -7
  76. package/src/rich-text-editor/base/rich-text-editor.js +132 -156
  77. package/src/rich-text-editor/base/util.js +2 -11
  78. package/src/rich-text-editor/formatter/formatter.js +4 -16
  79. package/src/rich-text-editor/models/default-locale.js +26 -30
  80. package/src/rich-text-editor/models/items.js +2 -2
  81. package/src/rich-text-editor/models/toolbar-settings-model.d.ts +1 -1
  82. package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
  83. package/src/rich-text-editor/models/toolbar-settings.js +1 -1
  84. package/src/rich-text-editor/renderer/audio-module.d.ts +0 -1
  85. package/src/rich-text-editor/renderer/audio-module.js +4 -22
  86. package/src/rich-text-editor/renderer/dialog-renderer.d.ts +0 -2
  87. package/src/rich-text-editor/renderer/dialog-renderer.js +1 -12
  88. package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -2
  89. package/src/rich-text-editor/renderer/image-module.d.ts +1 -9
  90. package/src/rich-text-editor/renderer/image-module.js +168 -203
  91. package/src/rich-text-editor/renderer/link-module.js +1 -10
  92. package/src/rich-text-editor/renderer/table-module.d.ts +1 -8
  93. package/src/rich-text-editor/renderer/table-module.js +139 -301
  94. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -3
  95. package/src/rich-text-editor/renderer/toolbar-renderer.js +9 -94
  96. package/src/rich-text-editor/renderer/video-module.d.ts +0 -3
  97. package/src/rich-text-editor/renderer/video-module.js +41 -82
  98. package/src/rich-text-editor/renderer/view-source.d.ts +0 -1
  99. package/src/rich-text-editor/renderer/view-source.js +4 -12
  100. package/src/selection/selection.js +0 -3
  101. package/styles/bootstrap-dark.css +53 -161
  102. package/styles/bootstrap.css +61 -162
  103. package/styles/bootstrap4.css +46 -146
  104. package/styles/bootstrap5-dark.css +46 -151
  105. package/styles/bootstrap5.css +46 -151
  106. package/styles/fabric-dark.css +40 -140
  107. package/styles/fabric.css +41 -141
  108. package/styles/fluent-dark.css +47 -165
  109. package/styles/fluent.css +47 -165
  110. package/styles/highcontrast-light.css +40 -140
  111. package/styles/highcontrast.css +41 -144
  112. package/styles/material-dark.css +41 -145
  113. package/styles/material.css +41 -145
  114. package/styles/material3-dark.css +50 -156
  115. package/styles/material3.css +50 -156
  116. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +13 -17
  117. package/styles/rich-text-editor/_bootstrap-definition.scss +19 -22
  118. package/styles/rich-text-editor/_bootstrap4-definition.scss +7 -11
  119. package/styles/rich-text-editor/_bootstrap5-definition.scss +3 -7
  120. package/styles/rich-text-editor/_fabric-dark-definition.scss +2 -6
  121. package/styles/rich-text-editor/_fabric-definition.scss +3 -7
  122. package/styles/rich-text-editor/_fluent-definition.scss +9 -13
  123. package/styles/rich-text-editor/_fusionnew-definition.scss +3 -7
  124. package/styles/rich-text-editor/_highcontrast-definition.scss +3 -7
  125. package/styles/rich-text-editor/_highcontrast-light-definition.scss +2 -6
  126. package/styles/rich-text-editor/_layout.scss +31 -133
  127. package/styles/rich-text-editor/_material-dark-definition.scss +2 -6
  128. package/styles/rich-text-editor/_material-definition.scss +2 -6
  129. package/styles/rich-text-editor/_material3-definition.scss +12 -16
  130. package/styles/rich-text-editor/_tailwind-definition.scss +19 -23
  131. package/styles/rich-text-editor/_theme.scss +23 -112
  132. package/styles/rich-text-editor/bootstrap-dark.css +53 -161
  133. package/styles/rich-text-editor/bootstrap.css +61 -162
  134. package/styles/rich-text-editor/bootstrap4.css +46 -146
  135. package/styles/rich-text-editor/bootstrap5-dark.css +46 -151
  136. package/styles/rich-text-editor/bootstrap5.css +46 -151
  137. package/styles/rich-text-editor/fabric-dark.css +40 -140
  138. package/styles/rich-text-editor/fabric.css +41 -141
  139. package/styles/rich-text-editor/fluent-dark.css +47 -165
  140. package/styles/rich-text-editor/fluent.css +47 -165
  141. package/styles/rich-text-editor/highcontrast-light.css +40 -140
  142. package/styles/rich-text-editor/highcontrast.css +41 -144
  143. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +2 -2
  144. package/styles/rich-text-editor/icons/_bootstrap.scss +2 -2
  145. package/styles/rich-text-editor/icons/_bootstrap4.scss +2 -2
  146. package/styles/rich-text-editor/icons/_bootstrap5.scss +2 -2
  147. package/styles/rich-text-editor/icons/_fabric-dark.scss +2 -2
  148. package/styles/rich-text-editor/icons/_fabric.scss +2 -2
  149. package/styles/rich-text-editor/icons/_fluent.scss +2 -2
  150. package/styles/rich-text-editor/icons/_highcontrast-light.scss +2 -2
  151. package/styles/rich-text-editor/icons/_highcontrast.scss +2 -2
  152. package/styles/rich-text-editor/icons/_material-dark.scss +2 -2
  153. package/styles/rich-text-editor/icons/_material.scss +2 -2
  154. package/styles/rich-text-editor/icons/_material3.scss +2 -2
  155. package/styles/rich-text-editor/icons/_tailwind.scss +2 -2
  156. package/styles/rich-text-editor/material-dark.css +41 -145
  157. package/styles/rich-text-editor/material.css +41 -145
  158. package/styles/rich-text-editor/material3-dark.css +50 -156
  159. package/styles/rich-text-editor/material3.css +50 -156
  160. package/styles/rich-text-editor/tailwind-dark.css +63 -191
  161. package/styles/rich-text-editor/tailwind.css +63 -191
  162. package/styles/tailwind-dark.css +63 -191
  163. package/styles/tailwind.css +63 -191
  164. package/.eslintrc.json +0 -260
  165. package/src/global.d.ts +0 -1
  166. package/styles/rich-text-editor/_bds-definition.scss +0 -279
  167. package/styles/rich-text-editor/icons/_bds.scss +0 -348
@@ -1,4 +1,4 @@
1
- import { createElement, detach, closest, Browser, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
1
+ import { detach, closest, Browser, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
2
2
  import { isNullOrUndefined, EventHandler, addClass, removeClass } from '@syncfusion/ej2-base';
3
3
  import { Popup } from '@syncfusion/ej2-popups';
4
4
  import { Button } from '@syncfusion/ej2-buttons';
@@ -17,7 +17,7 @@ var Table = /** @class */ (function () {
17
17
  this.pageY = null;
18
18
  this.moveEle = null;
19
19
  this.currentColumnResize = '';
20
- this.resizeEndTime = 0;
20
+ this.currentMarginLeft = 0;
21
21
  this.parent = parent;
22
22
  this.rteID = parent.element.id;
23
23
  this.l10n = serviceLocator.getService('rteLocale');
@@ -47,7 +47,6 @@ var Table = /** @class */ (function () {
47
47
  this.parent.on(events.bindCssClass, this.setCssClass, this);
48
48
  this.parent.on(events.destroy, this.destroy, this);
49
49
  this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
50
- this.parent.on(events.afterKeyDown, this.afterKeyDown, this);
51
50
  };
52
51
  Table.prototype.removeEventListener = function () {
53
52
  if (this.parent.isDestroyed) {
@@ -73,7 +72,6 @@ var Table = /** @class */ (function () {
73
72
  this.parent.off(events.bindCssClass, this.setCssClass);
74
73
  this.parent.off(events.destroy, this.destroy);
75
74
  this.parent.off(events.moduleDestroy, this.moduleDestroy);
76
- this.parent.off(events.afterKeyDown, this.afterKeyDown);
77
75
  if (!Browser.isDevice && this.parent.tableSettings.resize) {
78
76
  EventHandler.remove(this.contentModule.getEditPanel(), 'mouseover', this.resizeHelper);
79
77
  }
@@ -175,15 +173,7 @@ var Table = /** @class */ (function () {
175
173
  Table.prototype.keyUp = function (e) {
176
174
  var target = e.args.target;
177
175
  if (e.args.key.toLocaleLowerCase() === 'escape' && target && target.classList && (this.popupObj && !closest(target, '[id=' + "'" + this.popupObj.element.id + "'" + ']')) && this.popupObj) {
178
- var createTableToolbarBtn = this.popupObj.relateTo;
179
- if (createTableToolbarBtn.nodeName !== 'BUTTON') {
180
- createTableToolbarBtn = createTableToolbarBtn.querySelector('span.e-create-table');
181
- createTableToolbarBtn = createTableToolbarBtn.parentElement;
182
- }
183
176
  this.popupObj.hide();
184
- if (createTableToolbarBtn) {
185
- createTableToolbarBtn.focus();
186
- }
187
177
  }
188
178
  };
189
179
  Table.prototype.keyDown = function (e) {
@@ -239,14 +229,6 @@ var Table = /** @class */ (function () {
239
229
  }
240
230
  }
241
231
  }
242
- if (event.ctrlKey && event.key === 'a') {
243
- this.handleSelectAll();
244
- }
245
- };
246
- Table.prototype.handleSelectAll = function () {
247
- this.cancelResizeAction();
248
- var selectedCells = this.parent.inputElement.querySelectorAll('.' + classes.CLS_TABLE_SEL);
249
- removeClass(selectedCells, classes.CLS_TABLE_SEL);
250
232
  };
251
233
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
252
234
  Table.prototype.tableModulekeyUp = function (e) {
@@ -280,6 +262,7 @@ var Table = /** @class */ (function () {
280
262
  name: !isInternal ? 'showDialog' : null
281
263
  };
282
264
  this.insertTableDialog({ self: this, args: args, selection: selection });
265
+ this.parent.formatter.editorManager.nodeSelection.restore();
283
266
  }
284
267
  };
285
268
  Table.prototype.showDialog = function () {
@@ -363,20 +346,7 @@ var Table = /** @class */ (function () {
363
346
  return false;
364
347
  }
365
348
  };
366
- Table.prototype.removeEmptyTextNodes = function (element) {
367
- var children = element.childNodes;
368
- for (var i = children.length - 1; i >= 0; i--) {
369
- var node = children[i];
370
- if (node.nodeType === Node.TEXT_NODE && node.nodeValue.trim() === '') {
371
- element.removeChild(node);
372
- }
373
- }
374
- };
375
349
  Table.prototype.tabSelection = function (event, selection, ele) {
376
- var allHeadBodyTRElements = ele.closest('table').querySelectorAll('thead, tbody, tr');
377
- for (var i = 0; i < allHeadBodyTRElements.length; i++) {
378
- this.removeEmptyTextNodes(allHeadBodyTRElements[i]);
379
- }
380
350
  this.previousTableElement = ele;
381
351
  var insideList = this.insideList(selection.range);
382
352
  if ((event.keyCode === 37 || event.keyCode === 39) && selection.range.startContainer.nodeType === 3 ||
@@ -513,12 +483,10 @@ var Table = /** @class */ (function () {
513
483
  var startNode = this.parent.getRange().startContainer.parentElement;
514
484
  var endNode = this.parent.getRange().endContainer.parentElement;
515
485
  var isAnchorEle = this.getAnchorNode(target);
516
- var currentTime = new Date().getTime();
517
486
  if (target && target.nodeName !== 'A' && isAnchorEle.nodeName !== 'A' && target.nodeName !== 'IMG' && target.nodeName !== 'VIDEO' && !target.classList.contains(classes.CLS_CLICKELEM) &&
518
487
  target.nodeName !== 'AUDIO' && startNode === endNode && (target.nodeName === 'TD' || target.nodeName === 'TH' ||
519
488
  target.nodeName === 'TABLE' || (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable)))
520
- && !(range.startContainer.nodeType === 3 && !range.collapsed) &&
521
- currentTime - this.resizeEndTime > 100) {
489
+ && !(range.startContainer.nodeType === 3 && !range.collapsed)) {
522
490
  var range_1 = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
523
491
  this.parent.formatter.editorManager.nodeSelection.save(range_1, this.contentModule.getDocument());
524
492
  this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
@@ -614,10 +582,7 @@ var Table = /** @class */ (function () {
614
582
  var tdNode = closest(target, 'td,th');
615
583
  target = (target.nodeName !== 'TD' && tdNode && this.parent.contentModule.getEditPanel().contains(tdNode)) ?
616
584
  tdNode : target;
617
- if (!(this.parent.quickToolbarSettings.showOnRightClick && e.args.which === 3 &&
618
- target.classList.contains(classes.CLS_TABLE_SEL))) {
619
- removeClass(this.contentModule.getEditPanel().querySelectorAll('table td, table th'), classes.CLS_TABLE_SEL);
620
- }
585
+ removeClass(this.contentModule.getEditPanel().querySelectorAll('table td, table th'), classes.CLS_TABLE_SEL);
621
586
  if (target && (target.tagName === 'TD' || target.tagName === 'TH')) {
622
587
  addClass([target], classes.CLS_TABLE_SEL);
623
588
  this.activeCell = target;
@@ -642,15 +607,14 @@ var Table = /** @class */ (function () {
642
607
  return;
643
608
  }
644
609
  var target = e.target || e.targetTouches[0].target;
645
- var closestTable = closest(target, 'table.e-rte-table, table.e-rte-paste-table');
646
- var isResizing = this.parent.contentModule.getEditPanel().querySelectorAll('.e-table-box.e-rbox-select, .e-table-rhelper.e-column-helper, .e-table-rhelper.e-row-helper').length > 0;
647
- if (!isResizing && !isNOU(this.curTable) && !isNOU(closestTable) && closestTable !== this.curTable &&
610
+ var closestTable = closest(target, 'table.e-rte-table');
611
+ if (!isNOU(this.curTable) && !isNOU(closestTable) && closestTable !== this.curTable &&
648
612
  this.parent.contentModule.getEditPanel().contains(closestTable)) {
649
613
  this.removeResizeElement();
650
614
  this.removeHelper(e);
651
615
  this.cancelResizeAction();
652
616
  }
653
- if (!isResizing && (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH')) {
617
+ if (target.nodeName === 'TABLE' || target.nodeName === 'TD' || target.nodeName === 'TH') {
654
618
  this.curTable = (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable))
655
619
  && (target.nodeName === 'TD' || target.nodeName === 'TH') ?
656
620
  closestTable : target;
@@ -660,7 +624,7 @@ var Table = /** @class */ (function () {
660
624
  };
661
625
  Table.prototype.tableResizeEleCreation = function (table, e) {
662
626
  this.parent.preventDefaultResize(e);
663
- var columns = this.calMaxCol(this.curTable);
627
+ var columns = table.rows[this.calMaxCol(table)].cells;
664
628
  var rows = [];
665
629
  for (var i = 0; i < table.rows.length; i++) {
666
630
  for (var j = 0; j < table.rows[i].cells.length; j++) {
@@ -682,11 +646,11 @@ var Table = /** @class */ (function () {
682
646
  colReEle.classList.add(classes.CLS_RTE_TABLE_RESIZE, classes.CLS_TB_COL_RES);
683
647
  if (columns.length === i) {
684
648
  colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
685
- 'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth - 2) + 'px;';
649
+ 'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth) + 'px;';
686
650
  }
687
651
  else {
688
652
  colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
689
- 'px; left:' + (pos.left + this.calcPos(columns[i]).left - 2) + 'px;';
653
+ 'px; left:' + (pos.left + this.calcPos(columns[i]).left) + 'px;';
690
654
  }
691
655
  this.contentModule.getEditPanel().appendChild(colReEle);
692
656
  }
@@ -718,7 +682,7 @@ var Table = /** @class */ (function () {
718
682
  };
719
683
  Table.prototype.removeResizeElement = function () {
720
684
  var item = this.parent.contentModule.getEditPanel().
721
- querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box');
685
+ querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box, .e-table-rhelper');
722
686
  if (item.length > 0) {
723
687
  for (var i = 0; i < item.length; i++) {
724
688
  detach(item[i]);
@@ -792,20 +756,19 @@ var Table = /** @class */ (function () {
792
756
  if (target.classList.contains(classes.CLS_TB_COL_RES) ||
793
757
  target.classList.contains(classes.CLS_TB_ROW_RES) ||
794
758
  target.classList.contains(classes.CLS_TB_BOX_RES)) {
795
- this.resetResizeHelper(this.curTable);
796
759
  e.preventDefault();
797
760
  this.parent.preventDefaultResize(e);
798
761
  removeClass(this.curTable.querySelectorAll('td,th'), classes.CLS_TABLE_SEL);
762
+ this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
799
763
  this.pageX = this.getPointX(e);
800
764
  this.pageY = this.getPointY(e);
801
765
  this.resizeBtnInit();
802
766
  this.hideTableQuickToolbar();
803
767
  if (target.classList.contains(classes.CLS_TB_COL_RES)) {
804
768
  this.resizeBtnStat.column = true;
805
- if (parseInt(target.getAttribute('data-col'), 10) === this.calMaxCol(this.curTable).length) {
769
+ if (parseInt(target.getAttribute('data-col'), 10) === this.curTable.rows[this.calMaxCol(this.curTable)].cells.length) {
806
770
  this.currentColumnResize = 'last';
807
- this.colIndex = parseInt(target.getAttribute('data-col'), 10) - 1;
808
- this.columnEle = this.calMaxCol(this.curTable)[this.colIndex];
771
+ this.columnEle = this.curTable.rows[this.calMaxCol(this.curTable)].cells[parseInt(target.getAttribute('data-col'), 10) - 1];
809
772
  }
810
773
  else {
811
774
  if (parseInt(target.getAttribute('data-col'), 10) === 0) {
@@ -813,48 +776,10 @@ var Table = /** @class */ (function () {
813
776
  }
814
777
  else {
815
778
  this.currentColumnResize = 'middle';
816
- var cellColl = this.curTable.rows[0].cells;
817
- var cellCount = 0;
818
- for (var cell = 0; cell < cellColl.length; cell++) {
819
- cellCount = cellCount + cellColl[cell].colSpan;
820
- }
821
- var sizes = new Array(cellCount);
822
- var colGroupEle = createElement('colgroup');
823
- var rowSpanCells = new Map();
824
- for (var i = 0; i < this.curTable.rows.length; i++) {
825
- var currentColIndex = 0;
826
- for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
827
- for (var l = 1; l < this.curTable.rows[i].cells[k].rowSpan; l++) {
828
- var key = "" + (i + l) + currentColIndex;
829
- rowSpanCells.set(key, this.curTable.rows[i].cells[k]);
830
- }
831
- var cellIndex = this.getCellIndex(rowSpanCells, i, k);
832
- if (cellIndex > currentColIndex) {
833
- currentColIndex = cellIndex;
834
- }
835
- var width = this.curTable.rows[i].cells[k].offsetWidth;
836
- if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
837
- sizes[currentColIndex] = width;
838
- }
839
- currentColIndex += 1 + this.curTable.rows[i].cells[k].colSpan - 1;
840
- }
841
- }
842
- for (var size = 0; size < sizes.length; size++) {
843
- var cell = createElement('col');
844
- cell.appendChild(createElement('br'));
845
- cell.style.width = this.convertPixelToPercentage(sizes[size], parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
846
- colGroupEle.appendChild(cell);
847
- }
848
- this.curTable.insertBefore(colGroupEle, this.curTable.firstChild);
849
- for (var i = 0; i < this.curTable.rows.length; i++) {
850
- for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
851
- this.curTable.rows[i].cells[k].style.width = '';
852
- }
853
- }
854
779
  }
855
- this.colIndex = parseInt(target.getAttribute('data-col'), 10);
856
- this.columnEle = this.calMaxCol(this.curTable)[this.colIndex];
780
+ this.columnEle = this.curTable.rows[this.calMaxCol(this.curTable)].cells[parseInt(target.getAttribute('data-col'), 10)];
857
781
  }
782
+ this.colIndex = this.columnEle.cellIndex;
858
783
  this.moveEle = e.target;
859
784
  this.appendHelper();
860
785
  }
@@ -883,16 +808,6 @@ var Table = /** @class */ (function () {
883
808
  EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
884
809
  }
885
810
  };
886
- Table.prototype.getCellIndex = function (rowSpanCells, rowIndex, colIndex) {
887
- var cellKey = "" + rowIndex + colIndex;
888
- var spannedCell = rowSpanCells.get(cellKey);
889
- if (spannedCell) {
890
- return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
891
- }
892
- else {
893
- return colIndex;
894
- }
895
- };
896
811
  Table.prototype.removeHelper = function (e) {
897
812
  var cls = e.target.classList;
898
813
  if (!(cls.contains('e-reicon')) && this.helper) {
@@ -921,12 +836,12 @@ var Table = /** @class */ (function () {
921
836
  this.helper.classList.add('e-column-helper');
922
837
  this.helper.style.cssText = 'height: ' + getComputedStyle(this.curTable).height + '; top: ' +
923
838
  pos.top + 'px; left:' + ((pos.left + this.calcPos(this.columnEle).left) +
924
- (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1) + 'px;';
839
+ (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth + 2 : 0) - 1) + 'px;';
925
840
  }
926
841
  else {
927
842
  this.helper.classList.add('e-row-helper');
928
843
  this.helper.style.cssText = 'width: ' + getComputedStyle(this.curTable).width + '; top: ' +
929
- (this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1) +
844
+ (this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight) +
930
845
  'px; left:' + (this.calcPos(this.rowEle).left + pos.left) + 'px;';
931
846
  }
932
847
  };
@@ -934,42 +849,24 @@ var Table = /** @class */ (function () {
934
849
  var pos = this.calcPos(this.curTable);
935
850
  if (this.resizeBtnStat.column) {
936
851
  var left = (pos.left + this.calcPos(this.columnEle).left) +
937
- (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1;
852
+ (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth + 2 : 0) - 1;
938
853
  this.helper.style.left = left + 'px';
939
- this.helper.style.height = this.curTable.offsetHeight + 'px';
940
854
  }
941
855
  else {
942
- var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1;
856
+ var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight;
943
857
  this.helper.style.top = top_1 + 'px';
944
858
  }
945
859
  };
946
- Table.prototype.calMaxCol = function (curTable) {
947
- var cellColl = curTable.rows[0].cells;
948
- var cellCount = 0;
949
- for (var cell = 0; cell < cellColl.length; cell++) {
950
- cellCount = cellCount + cellColl[cell].colSpan;
951
- }
952
- var cells = new Array(cellCount);
953
- var rowSpanCells = new Map();
954
- for (var i = 0; i < curTable.rows.length; i++) {
955
- var currentColIndex = 0;
956
- for (var k = 0; k < curTable.rows[i].cells.length; k++) {
957
- for (var l = 1; l < curTable.rows[i].cells[k].rowSpan; l++) {
958
- var key = "" + (i + l) + currentColIndex;
959
- rowSpanCells.set(key, curTable.rows[i].cells[k]);
960
- }
961
- var cellIndex = this.getCellIndex(rowSpanCells, i, k);
962
- if (cellIndex > currentColIndex) {
963
- currentColIndex = cellIndex;
964
- }
965
- var width = curTable.rows[i].cells[k].offsetWidth;
966
- if (!cells[currentColIndex] || width < cells[currentColIndex].offsetWidth) {
967
- cells[currentColIndex] = curTable.rows[i].cells[k];
968
- }
969
- currentColIndex += 1 + curTable.rows[i].cells[k].colSpan - 1;
860
+ Table.prototype.calMaxCol = function (element) {
861
+ var max = 0;
862
+ var maxRowIndex;
863
+ for (var i = 0; i < element.rows.length; i++) {
864
+ if (max < element.rows[i].cells.length) {
865
+ maxRowIndex = i;
866
+ max = element.rows[i].cells.length;
970
867
  }
971
868
  }
972
- return cells;
869
+ return maxRowIndex;
973
870
  };
974
871
  Table.prototype.resizing = function (e) {
975
872
  var _this = this;
@@ -982,6 +879,10 @@ var Table = /** @class */ (function () {
982
879
  var maxiumWidth;
983
880
  var currentTdElement = this.curTable.closest('td');
984
881
  var args = { event: e, requestType: 'table' };
882
+ var isRowCellsMerged = false;
883
+ var isColCellsMerged = false;
884
+ var mergedCellIndex;
885
+ var mergedElement;
985
886
  this.parent.trigger(events.onResize, args, function (resizingArgs) {
986
887
  if (resizingArgs.cancel) {
987
888
  _this.cancelResizeAction();
@@ -1006,10 +907,8 @@ var Table = /** @class */ (function () {
1006
907
  widthCompare = rteWidth;
1007
908
  }
1008
909
  if (_this.resizeBtnStat.column) {
1009
- if (_this.curTable.closest('li')) {
1010
- widthCompare = _this.curTable.closest('li').offsetWidth;
1011
- }
1012
- var colGroup = _this.curTable.querySelectorAll('colgroup > col');
910
+ var width = parseFloat(_this.columnEle.offsetWidth.toString());
911
+ var cellRow = _this.curTable.rows[0].cells[0].nodeName === 'TH' ? 1 : 0;
1013
912
  var currentTableWidth = void 0;
1014
913
  if (_this.curTable.style.width !== '' && _this.curTable.style.width.includes('%')) {
1015
914
  currentTableWidth = parseFloat(_this.curTable.style.width.split('%')[0]);
@@ -1017,8 +916,7 @@ var Table = /** @class */ (function () {
1017
916
  else {
1018
917
  currentTableWidth = _this.getCurrentTableWidth(_this.curTable.offsetWidth, _this.parent.inputElement.offsetWidth);
1019
918
  }
1020
- var currentCol = _this.calMaxCol(_this.curTable)[_this.colIndex];
1021
- var currentColResizableWidth = _this.getCurrentColWidth(currentCol, tableWidth);
919
+ var currentColumnCellWidth = parseFloat(_this.curTable.rows[cellRow].cells[_this.colIndex >= _this.curTable.rows[cellRow].cells.length ? _this.curTable.rows[cellRow].cells.length - 1 : _this.colIndex].style.width.split('%')[0]);
1022
920
  if (_this.currentColumnResize === 'first') {
1023
921
  mouseX = mouseX - 0.75; //This was done for to make the gripper and the table first/last column will be close.
1024
922
  _this.removeResizeElement();
@@ -1027,44 +925,16 @@ var Table = /** @class */ (function () {
1027
925
  _this.curTable.style.maxWidth = maxiumWidth + 'px';
1028
926
  }
1029
927
  // Below the value '100' is the 100% width of the parent element.
1030
- if (((mouseX !== 0 && 5 < currentColResizableWidth) || mouseX < 0) && currentTableWidth <= 100 &&
928
+ if (((mouseX !== 0 && 5 < currentColumnCellWidth) || mouseX < 0) && currentTableWidth <= 100 &&
1031
929
  _this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) <= 100) {
1032
930
  var firstColumnsCell = _this.findFirstLastColCells(_this.curTable, true);
1033
931
  _this.curTable.style.width = _this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) > 100 ? (100 + '%') :
1034
932
  (_this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) + '%');
1035
933
  var differenceWidth = currentTableWidth - _this.convertPixelToPercentage(tableWidth - mouseX, widthCompare);
1036
- var preMarginLeft = 0;
1037
- var widthType = _this.curTable.style.width.indexOf('%') > -1;
1038
- if (!widthType && _this.curTable.offsetWidth > _this.contentModule.getEditPanel().offsetWidth) {
1039
- _this.curTable.style.width = rteWidth + 'px';
1040
- return;
1041
- }
1042
- if (widthType && parseFloat(_this.curTable.style.width.split('%')[0]) > 100) {
1043
- _this.curTable.style.width = '100%';
1044
- return;
1045
- }
1046
- if (!isNOU(_this.curTable.style.marginLeft) && _this.curTable.style.marginLeft !== '') {
1047
- var regex = /[-+]?\d*\.\d+|\d+/;
1048
- var value = _this.curTable.style.marginLeft.match(regex);
1049
- if (!isNOU(value)) {
1050
- preMarginLeft = parseFloat(value[0]);
1051
- }
1052
- }
1053
- var currentMarginLeft = preMarginLeft + differenceWidth;
1054
- if (currentMarginLeft && currentMarginLeft > 100) {
1055
- var width = parseFloat(_this.curTable.style.width);
1056
- currentMarginLeft = 100 - width;
1057
- }
1058
- // For table pasted from word, Margin left can be anything so we are avoiding the below process.
1059
- if (!_this.curTable.classList.contains('e-rte-paste-table') && currentMarginLeft && currentMarginLeft < 1) {
1060
- _this.curTable.style.marginLeft = null;
1061
- _this.curTable.style.width = '100%';
1062
- return;
1063
- }
1064
- _this.curTable.style.marginLeft = 'calc(' + (_this.curTable.style.width === '100%' ? 0 : currentMarginLeft) + '%)';
934
+ _this.currentMarginLeft = _this.currentMarginLeft + differenceWidth;
935
+ _this.curTable.style.marginLeft = 'calc(' + (_this.curTable.style.width === '100%' ? 0 : _this.currentMarginLeft) + '%)';
1065
936
  for (var i = 0; i < firstColumnsCell.length; i++) {
1066
- var currentColumnCellWidth = _this.getCurrentColWidth(firstColumnsCell[i], tableWidth);
1067
- firstColumnsCell[i].style.width = (currentColumnCellWidth - differenceWidth) + '%';
937
+ _this.curTable.rows[i].cells[_this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
1068
938
  }
1069
939
  }
1070
940
  }
@@ -1076,48 +946,112 @@ var Table = /** @class */ (function () {
1076
946
  _this.curTable.style.maxWidth = maxiumWidth + 'px';
1077
947
  }
1078
948
  // Below the value '100' is the 100% width of the parent element.
1079
- if (((mouseX !== 0 && 5 < currentColResizableWidth) || mouseX > 0) &&
949
+ if (((mouseX !== 0 && 5 < currentColumnCellWidth) || mouseX > 0) &&
1080
950
  currentTableWidth <= 100 && _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) <= 100) {
1081
951
  var lastColumnsCell = _this.findFirstLastColCells(_this.curTable, false);
1082
952
  _this.curTable.style.width = _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) > 100 ? (100 + '%') : (_this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%');
1083
953
  var differenceWidth = currentTableWidth - _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare);
1084
954
  for (var i = 0; i < lastColumnsCell.length; i++) {
1085
- var currentColumnCellWidth = _this.getCurrentColWidth(lastColumnsCell[i], tableWidth);
1086
- lastColumnsCell[i].style.width = (currentColumnCellWidth - differenceWidth) + '%';
955
+ if (_this.curTable.rows[i].cells[_this.colIndex]) {
956
+ _this.curTable.rows[i].cells[_this.curTable.rows[i].cells.length === _this.colIndex ?
957
+ _this.colIndex - 1 : _this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
958
+ }
1087
959
  }
1088
960
  }
1089
961
  }
1090
962
  else {
1091
- var actualwid = colGroup[_this.colIndex].offsetWidth - mouseX;
1092
- // eslint-disable-next-line
1093
- var totalwid = colGroup[_this.colIndex].offsetWidth + colGroup[_this.colIndex - 1].offsetWidth;
1094
- if ((totalwid - actualwid) > 20 && actualwid > 20) {
1095
- var leftColumnWidth = totalwid - actualwid;
1096
- var rightColWidth = actualwid;
1097
- colGroup[_this.colIndex - 1].style.width = _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
1098
- colGroup[_this.colIndex].style.width = _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
963
+ var cellColl = _this.curTable.rows[_this.calMaxCol(_this.curTable)].cells;
964
+ var actualwid = width - mouseX;
965
+ var totalwid = parseFloat(_this.columnEle.offsetWidth.toString()) +
966
+ parseFloat(cellColl[_this.colIndex - 1].offsetWidth.toString());
967
+ for (var i = 0; i < _this.curTable.rows.length; i++) {
968
+ var currentRow = _this.curTable.rows[i];
969
+ if ((totalwid - actualwid) > 20 && actualwid > 20) {
970
+ var leftColumnWidth = totalwid - actualwid;
971
+ var rightColWidth = actualwid;
972
+ var index = void 0;
973
+ var isMergedEleResize = false;
974
+ var leftTableCell = void 0;
975
+ var rightTableCell = void 0;
976
+ isColCellsMerged = false;
977
+ isRowCellsMerged = false;
978
+ /* eslint-disable */
979
+ for (var j = 0; j < currentRow.cells.length; j++) {
980
+ if (currentRow.cells[j].hasAttribute('rowspan') && j <= _this.colIndex) {
981
+ isRowCellsMerged = true;
982
+ mergedCellIndex = i;
983
+ mergedElement = currentRow.cells[j];
984
+ }
985
+ else if (currentRow.cells[j].hasAttribute('colspan') && j <= currentRow.cells.length) {
986
+ isColCellsMerged = true;
987
+ mergedCellIndex = i;
988
+ mergedElement = currentRow.cells[j];
989
+ }
990
+ }
991
+ if (!isNOU(currentRow.cells[i]) && currentRow.cells[i].hasAttribute('colspan')) {
992
+ index = parseInt(currentRow.cells[i].getAttribute('colspan'), 10) - 1;
993
+ }
994
+ else {
995
+ index = _this.colIndex;
996
+ }
997
+ if (isRowCellsMerged || isColCellsMerged) {
998
+ var currentResizeRow = void 0;
999
+ if (currentRow.cells.length < cellColl.length) {
1000
+ index = currentRow.cells.length === _this.colIndex || currentRow === _this.curTable.rows[_this.curTable.rows.length - 1] ?
1001
+ _this.colIndex - 1 : _this.colIndex;
1002
+ currentResizeRow = _this.curTable.rows[!isNullOrUndefined(mergedCellIndex) ?
1003
+ mergedCellIndex : _this.colIndex - 1];
1004
+ if (currentResizeRow && currentResizeRow !== currentRow && (currentResizeRow.cells[_this.colIndex - 1] === mergedElement ||
1005
+ currentResizeRow.cells[currentResizeRow.cells.length - 1] === mergedElement)) {
1006
+ isMergedEleResize = true;
1007
+ }
1008
+ else {
1009
+ isMergedEleResize = false;
1010
+ }
1011
+ }
1012
+ else {
1013
+ index = _this.colIndex;
1014
+ }
1015
+ leftTableCell = !isMergedEleResize ? currentRow.cells[index - 1] : (currentResizeRow &&
1016
+ currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement) ?
1017
+ currentResizeRow.cells[_this.colIndex - 1] : currentRow.cells[currentRow.cells.length - 1];
1018
+ rightTableCell = !isMergedEleResize ? currentRow.cells[index] : rightTableCell && rightTableCell.hasAttribute('rowspan') ?
1019
+ currentResizeRow.cells[_this.colIndex] : currentResizeRow && currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement ?
1020
+ currentRow.cells[index - 1] : currentResizeRow.cells[currentResizeRow.cells.length - 1];
1021
+ }
1022
+ if (!isNOU(currentRow.cells[index - 1]) && !isRowCellsMerged && !isColCellsMerged) {
1023
+ currentRow.cells[index - 1].style.width =
1024
+ _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
1025
+ }
1026
+ else {
1027
+ if (leftTableCell) {
1028
+ leftTableCell.style.width =
1029
+ _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
1030
+ }
1031
+ }
1032
+ if (!isNOU(currentRow.cells[index]) && !isRowCellsMerged && !isColCellsMerged) {
1033
+ currentRow.cells[index].style.width =
1034
+ _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
1035
+ }
1036
+ else {
1037
+ if (rightTableCell) {
1038
+ rightTableCell.style.width =
1039
+ _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
1040
+ }
1041
+ }
1042
+ /* eslint-enable */
1043
+ }
1099
1044
  }
1100
1045
  }
1101
1046
  _this.updateHelper();
1102
1047
  }
1103
1048
  else if (_this.resizeBtnStat.row) {
1104
1049
  _this.parent.preventDefaultResize(e);
1105
- var tableTrElementPixel = [];
1106
- var currentTableTrElement = _this.curTable.querySelectorAll('tr');
1107
- for (var i = 0; i < currentTableTrElement.length; i++) {
1108
- if (_this.rowEle !== currentTableTrElement[i]) {
1109
- tableTrElementPixel[i] = (parseFloat(currentTableTrElement[i].clientHeight.toString()));
1110
- }
1111
- }
1112
- _this.curTable.style.height = (parseFloat(_this.curTable.clientHeight.toString()) + ((mouseY > 0) ? 0 : mouseY)) + 'px';
1113
- for (var i = 0; i < currentTableTrElement.length; i++) {
1114
- if (_this.rowEle === currentTableTrElement[i]) {
1115
- currentTableTrElement[i].style.height = (parseFloat(currentTableTrElement[i].clientHeight.toString()) + mouseY) + 'px';
1116
- }
1117
- else {
1118
- currentTableTrElement[i].style.height = tableTrElementPixel[i] + 'px';
1119
- }
1050
+ var height = parseFloat(_this.rowEle.clientHeight.toString()) + mouseY;
1051
+ if (height > 20) {
1052
+ _this.rowEle.style.height = height + 'px';
1120
1053
  }
1054
+ _this.curTable.style.height = '';
1121
1055
  if (!isNOU(tableReBox)) {
1122
1056
  tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
1123
1057
  'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
@@ -1131,40 +1065,19 @@ var Table = /** @class */ (function () {
1131
1065
  maxiumWidth = Math.abs(tableBoxPosition - currentTdElement.getBoundingClientRect().width) - 5;
1132
1066
  _this.curTable.style.maxWidth = maxiumWidth + 'px';
1133
1067
  }
1068
+ var widthType = _this.curTable.style.width.indexOf('%') > -1;
1069
+ _this.curTable.style.width = widthType ? _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%'
1070
+ : tableWidth + mouseX + 'px';
1134
1071
  _this.curTable.style.height = tableHeight + mouseY + 'px';
1135
1072
  if (!isNOU(tableReBox)) {
1136
1073
  tableReBox.classList.add('e-rbox-select');
1137
1074
  tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
1138
1075
  'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
1139
1076
  }
1140
- if (_this.curTable.closest('li')) {
1141
- widthCompare = _this.curTable.closest('li').offsetWidth;
1142
- }
1143
- var widthType = _this.curTable.style.width.indexOf('%') > -1;
1144
- if (widthType && parseFloat(_this.curTable.style.width.split('%')[0]) > 100) {
1145
- _this.curTable.style.width = '100%';
1146
- return;
1147
- }
1148
- if (!widthType && _this.curTable.offsetWidth > _this.contentModule.getEditPanel().offsetWidth) {
1149
- _this.curTable.style.width = rteWidth + 'px';
1150
- return;
1151
- }
1152
- _this.curTable.style.width = widthType ? _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%'
1153
- : tableWidth + mouseX + 'px';
1154
1077
  }
1155
1078
  }
1156
1079
  });
1157
1080
  };
1158
- Table.prototype.getCurrentColWidth = function (col, tableWidth) {
1159
- var currentColWidth = 0;
1160
- if (col.style.width !== '' && col.style.width.includes('%')) {
1161
- currentColWidth = parseFloat(col.style.width.split('%')[0]);
1162
- }
1163
- else {
1164
- currentColWidth = this.convertPixelToPercentage(col.offsetWidth, tableWidth);
1165
- }
1166
- return currentColWidth;
1167
- };
1168
1081
  Table.prototype.getCurrentTableWidth = function (tableWidth, parentWidth) {
1169
1082
  var currentTableWidth = 0;
1170
1083
  currentTableWidth = tableWidth / parentWidth * 100;
@@ -1172,22 +1085,12 @@ var Table = /** @class */ (function () {
1172
1085
  };
1173
1086
  Table.prototype.findFirstLastColCells = function (table, isFirst) {
1174
1087
  var resultColumns = [];
1175
- var rows = table.rows;
1176
- var rowSpanCellIndexs = new Array();
1177
- var _loop_1 = function (i) {
1178
- var cellIndex = isFirst ? 0 : rows[i].cells.length - 1;
1179
- var column = rows[i].cells[cellIndex];
1180
- for (var rowSpan = 1; rowSpan < column.rowSpan; rowSpan++) {
1181
- var key = i + rowSpan + "-" + cellIndex;
1182
- rowSpanCellIndexs.push(key);
1183
- }
1184
- var spannedCellKey = i + "-" + cellIndex;
1185
- if (rowSpanCellIndexs.length === 0 || (isFirst && rowSpanCellIndexs.indexOf(spannedCellKey) === -1) || (!isFirst && rowSpanCellIndexs.indexOf(spannedCellKey) === -1 && rowSpanCellIndexs.every(function (key) { return key.split('-')[0] !== i.toString(); }))) {
1186
- resultColumns.push(column);
1187
- }
1188
- };
1088
+ var rows = table.querySelectorAll('tr');
1189
1089
  for (var i = 0; i < rows.length; i++) {
1190
- _loop_1(i);
1090
+ if (rows[i].closest('table') === table) {
1091
+ var columns = rows[i].querySelectorAll('th, td');
1092
+ resultColumns.push(isFirst ? columns[0] : columns[columns.length - 1]);
1093
+ }
1191
1094
  }
1192
1095
  return resultColumns;
1193
1096
  };
@@ -1211,56 +1114,12 @@ var Table = /** @class */ (function () {
1211
1114
  detach(this.helper);
1212
1115
  this.helper = null;
1213
1116
  }
1214
- this.resetResizeHelper(this.curTable);
1215
1117
  this.pageX = null;
1216
1118
  this.pageY = null;
1217
1119
  this.moveEle = null;
1218
- var currentTableTrElement = this.curTable.querySelectorAll("tr");
1219
- var tableTrPercentage = [];
1220
- for (var i = 0; i < currentTableTrElement.length; i++) {
1221
- var percentage = (parseFloat(currentTableTrElement[i].clientHeight.toString()) / parseFloat(this.curTable.clientHeight.toString())) * 100;
1222
- tableTrPercentage[i] = percentage;
1223
- }
1224
- for (var i = 0; i < currentTableTrElement.length; i++) {
1225
- if (currentTableTrElement[i].parentElement.nodeName === 'THEAD') {
1226
- currentTableTrElement[i].parentElement.style.height = tableTrPercentage[i] + '%';
1227
- currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
1228
- }
1229
- else {
1230
- currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
1231
- }
1232
- }
1233
1120
  var args = { event: e, requestType: 'table' };
1234
1121
  this.parent.trigger(events.resizeStop, args);
1235
1122
  this.parent.formatter.saveData();
1236
- this.resizeEndTime = new Date().getTime();
1237
- };
1238
- Table.prototype.resetResizeHelper = function (curTable) {
1239
- var colHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-column-helper');
1240
- Array.from(colHelper).forEach(function (element) {
1241
- if (element.parentNode) {
1242
- element.parentNode.removeChild(element);
1243
- }
1244
- });
1245
- var rowHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-row-helper');
1246
- Array.from(rowHelper).forEach(function (element) {
1247
- if (element.parentNode) {
1248
- element.parentNode.removeChild(element);
1249
- }
1250
- });
1251
- if (!curTable.style.width) {
1252
- curTable.style.width = curTable.offsetWidth + 'px';
1253
- }
1254
- var colGroup = curTable.querySelector('colgroup');
1255
- if (colGroup) {
1256
- for (var i = 0; i < curTable.rows.length; i++) {
1257
- for (var k = 0; k < curTable.rows[i].cells.length; k++) {
1258
- var width = this.convertPixelToPercentage(curTable.rows[i].cells[k].offsetWidth, parseInt(getComputedStyle(curTable).width, 10)) + '%';
1259
- curTable.rows[i].cells[k].style.width = width;
1260
- }
1261
- }
1262
- curTable.removeChild(colGroup);
1263
- }
1264
1123
  };
1265
1124
  Table.prototype.resizeBtnInit = function () {
1266
1125
  return this.resizeBtnStat = { column: false, row: false, tableBox: false };
@@ -1347,7 +1206,7 @@ var Table = /** @class */ (function () {
1347
1206
  this.createTableButton.isStringTemplate = true;
1348
1207
  this.createTableButton.appendTo(btnEle);
1349
1208
  EventHandler.add(btnEle, 'click', this.insertTableDialog, { self: this, args: args.args, selection: args.selection });
1350
- this.parent.getToolbar().parentElement.appendChild(this.dlgDiv);
1209
+ this.parent.getToolbar().appendChild(this.dlgDiv);
1351
1210
  var target = args.args.originalEvent.target;
1352
1211
  target = target.classList.contains('e-toolbar-item') ? target.firstChild : target.parentElement;
1353
1212
  this.popupObj = new Popup(this.dlgDiv, {
@@ -1371,16 +1230,12 @@ var Table = /** @class */ (function () {
1371
1230
  if (!isNOU(this.parent.cssClass)) {
1372
1231
  addClass([this.popupObj.element], this.parent.getCssClass());
1373
1232
  }
1374
- btnEle.focus();
1375
1233
  this.popupObj.refreshPosition(target);
1376
1234
  };
1377
1235
  Table.prototype.onIframeMouseDown = function () {
1378
1236
  if (this.popupObj) {
1379
1237
  this.popupObj.hide();
1380
1238
  }
1381
- if (this.parent.inlineMode.enable && this.editdlgObj) {
1382
- this.editdlgObj.hide();
1383
- }
1384
1239
  };
1385
1240
  Table.prototype.docClick = function (e) {
1386
1241
  var target = e.args.target;
@@ -1392,7 +1247,6 @@ var Table = /** @class */ (function () {
1392
1247
  this.popupObj.hide();
1393
1248
  }
1394
1249
  if (this.editdlgObj) {
1395
- this.parent.notify(events.documentClickClosedBy, { closedBy: "outside click" });
1396
1250
  this.editdlgObj.hide();
1397
1251
  }
1398
1252
  this.parent.isBlur = true;
@@ -1703,22 +1557,6 @@ var Table = /** @class */ (function () {
1703
1557
  Table.prototype.getModuleName = function () {
1704
1558
  return 'table';
1705
1559
  };
1706
- Table.prototype.afterKeyDown = function (e) {
1707
- var _this = this;
1708
- if (this.curTable) {
1709
- setTimeout(function () {
1710
- _this.updateResizeIconPosition();
1711
- }, 1);
1712
- }
1713
- };
1714
- Table.prototype.updateResizeIconPosition = function () {
1715
- var tableReBox = this.parent.contentModule.getEditPanel().querySelector('.e-table-box');
1716
- if (!isNOU(tableReBox)) {
1717
- var tablePosition = this.calcPos(this.curTable);
1718
- tableReBox.style.cssText = 'top: ' + (tablePosition.top + parseInt(getComputedStyle(this.curTable).height, 10) - 4) +
1719
- 'px; left:' + (tablePosition.left + parseInt(getComputedStyle(this.curTable).width, 10) - 4) + 'px;';
1720
- }
1721
- };
1722
1560
  return Table;
1723
1561
  }());
1724
1562
  export { Table };