@syncfusion/ej2-richtexteditor 24.1.41 → 24.1.43-569781

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 (269) hide show
  1. package/.eslintrc.json +259 -259
  2. package/CHANGELOG.md +1927 -1775
  3. package/README.md +76 -76
  4. package/dist/ej2-richtexteditor.umd.min.js +1 -10
  5. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es2015.js +2601 -1077
  7. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  8. package/dist/es6/ej2-richtexteditor.es5.js +2706 -1181
  9. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  10. package/helpers/e2e/index.js +3 -3
  11. package/helpers/e2e/rte-helper.js +13 -13
  12. package/license +9 -9
  13. package/package.json +74 -74
  14. package/src/common/config.d.ts +7 -0
  15. package/src/common/config.js +11 -0
  16. package/src/common/constant.d.ts +6 -0
  17. package/src/common/constant.js +6 -0
  18. package/src/common/interface.d.ts +19 -7
  19. package/src/common/types.d.ts +6 -0
  20. package/src/common/util.d.ts +6 -0
  21. package/src/common/util.js +61 -20
  22. package/src/editor-manager/base/classes.d.ts +1 -1
  23. package/src/editor-manager/base/classes.js +1 -1
  24. package/src/editor-manager/base/constant.d.ts +6 -0
  25. package/src/editor-manager/base/constant.js +6 -0
  26. package/src/editor-manager/base/editor-manager.d.ts +8 -3
  27. package/src/editor-manager/base/editor-manager.js +62 -3
  28. package/src/editor-manager/base/enum.d.ts +2 -2
  29. package/src/editor-manager/base/interface.d.ts +17 -9
  30. package/src/editor-manager/base/types.d.ts +1 -1
  31. package/src/editor-manager/plugin/alignments.d.ts +2 -2
  32. package/src/editor-manager/plugin/alignments.js +2 -2
  33. package/src/editor-manager/plugin/audio.d.ts +3 -3
  34. package/src/editor-manager/plugin/audio.js +3 -3
  35. package/src/editor-manager/plugin/clearformat-exec.d.ts +2 -2
  36. package/src/editor-manager/plugin/clearformat-exec.js +2 -2
  37. package/src/editor-manager/plugin/clearformat.d.ts +1 -1
  38. package/src/editor-manager/plugin/clearformat.js +1 -1
  39. package/src/editor-manager/plugin/dom-node.d.ts +39 -35
  40. package/src/editor-manager/plugin/dom-node.js +203 -49
  41. package/src/editor-manager/plugin/format-painter-actions.d.ts +2 -1
  42. package/src/editor-manager/plugin/format-painter-actions.js +20 -2
  43. package/src/editor-manager/plugin/formats.d.ts +3 -2
  44. package/src/editor-manager/plugin/formats.js +40 -5
  45. package/src/editor-manager/plugin/image.d.ts +3 -3
  46. package/src/editor-manager/plugin/image.js +15 -19
  47. package/src/editor-manager/plugin/indents.d.ts +2 -2
  48. package/src/editor-manager/plugin/indents.js +2 -2
  49. package/src/editor-manager/plugin/insert-methods.d.ts +4 -4
  50. package/src/editor-manager/plugin/insert-methods.js +4 -4
  51. package/src/editor-manager/plugin/insert-text.d.ts +2 -2
  52. package/src/editor-manager/plugin/insert-text.js +2 -2
  53. package/src/editor-manager/plugin/inserthtml-exec.d.ts +2 -2
  54. package/src/editor-manager/plugin/inserthtml-exec.js +2 -2
  55. package/src/editor-manager/plugin/inserthtml.d.ts +3 -2
  56. package/src/editor-manager/plugin/inserthtml.js +64 -7
  57. package/src/editor-manager/plugin/isformatted.d.ts +8 -8
  58. package/src/editor-manager/plugin/isformatted.js +8 -8
  59. package/src/editor-manager/plugin/link.d.ts +2 -2
  60. package/src/editor-manager/plugin/link.js +6 -3
  61. package/src/editor-manager/plugin/lists.d.ts +2 -2
  62. package/src/editor-manager/plugin/lists.js +123 -67
  63. package/src/editor-manager/plugin/ms-word-clean-up.d.ts +4 -1
  64. package/src/editor-manager/plugin/ms-word-clean-up.js +213 -86
  65. package/src/editor-manager/plugin/nodecutter.d.ts +6 -6
  66. package/src/editor-manager/plugin/nodecutter.js +8 -8
  67. package/src/editor-manager/plugin/selection-commands.d.ts +2 -1
  68. package/src/editor-manager/plugin/selection-commands.js +127 -4
  69. package/src/editor-manager/plugin/selection-exec.d.ts +2 -2
  70. package/src/editor-manager/plugin/selection-exec.js +2 -2
  71. package/src/editor-manager/plugin/table.d.ts +2 -3
  72. package/src/editor-manager/plugin/table.js +35 -32
  73. package/src/editor-manager/plugin/toolbar-status.d.ts +4 -4
  74. package/src/editor-manager/plugin/toolbar-status.js +22 -12
  75. package/src/editor-manager/plugin/undo.d.ts +7 -6
  76. package/src/editor-manager/plugin/undo.js +27 -7
  77. package/src/editor-manager/plugin/video.d.ts +3 -3
  78. package/src/editor-manager/plugin/video.js +3 -3
  79. package/src/markdown-parser/base/interface.d.ts +10 -10
  80. package/src/markdown-parser/base/markdown-parser.d.ts +3 -3
  81. package/src/markdown-parser/base/markdown-parser.js +3 -3
  82. package/src/markdown-parser/base/types.d.ts +1 -1
  83. package/src/markdown-parser/plugin/clearformat.d.ts +2 -2
  84. package/src/markdown-parser/plugin/clearformat.js +2 -2
  85. package/src/markdown-parser/plugin/formats.d.ts +2 -2
  86. package/src/markdown-parser/plugin/formats.js +2 -2
  87. package/src/markdown-parser/plugin/insert-text.d.ts +2 -2
  88. package/src/markdown-parser/plugin/insert-text.js +2 -2
  89. package/src/markdown-parser/plugin/link.d.ts +2 -2
  90. package/src/markdown-parser/plugin/link.js +2 -2
  91. package/src/markdown-parser/plugin/markdown-selection.d.ts +14 -14
  92. package/src/markdown-parser/plugin/markdown-selection.js +14 -14
  93. package/src/markdown-parser/plugin/md-selection-formats.d.ts +1 -1
  94. package/src/markdown-parser/plugin/md-selection-formats.js +1 -1
  95. package/src/markdown-parser/plugin/table.d.ts +3 -3
  96. package/src/markdown-parser/plugin/table.js +3 -3
  97. package/src/markdown-parser/plugin/undo.d.ts +6 -6
  98. package/src/markdown-parser/plugin/undo.js +6 -6
  99. package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +12 -12
  100. package/src/rich-text-editor/actions/base-quick-toolbar.js +57 -20
  101. package/src/rich-text-editor/actions/base-toolbar.d.ts +3 -3
  102. package/src/rich-text-editor/actions/base-toolbar.js +35 -37
  103. package/src/rich-text-editor/actions/color-picker.d.ts +3 -2
  104. package/src/rich-text-editor/actions/color-picker.js +12 -2
  105. package/src/rich-text-editor/actions/count.d.ts +3 -3
  106. package/src/rich-text-editor/actions/count.js +4 -4
  107. package/src/rich-text-editor/actions/dropdown-buttons.d.ts +2 -2
  108. package/src/rich-text-editor/actions/dropdown-buttons.js +23 -4
  109. package/src/rich-text-editor/actions/emoji-picker.d.ts +1 -1
  110. package/src/rich-text-editor/actions/emoji-picker.js +4 -4
  111. package/src/rich-text-editor/actions/enter-key.js +4 -3
  112. package/src/rich-text-editor/actions/full-screen.d.ts +3 -3
  113. package/src/rich-text-editor/actions/full-screen.js +6 -5
  114. package/src/rich-text-editor/actions/html-editor.d.ts +5 -5
  115. package/src/rich-text-editor/actions/html-editor.js +129 -45
  116. package/src/rich-text-editor/actions/keyboard-model.d.ts +16 -16
  117. package/src/rich-text-editor/actions/keyboard.d.ts +1 -1
  118. package/src/rich-text-editor/actions/keyboard.js +23 -21
  119. package/src/rich-text-editor/actions/markdown-editor.d.ts +2 -2
  120. package/src/rich-text-editor/actions/markdown-editor.js +5 -3
  121. package/src/rich-text-editor/actions/paste-clean-up.d.ts +4 -1
  122. package/src/rich-text-editor/actions/paste-clean-up.js +87 -12
  123. package/src/rich-text-editor/actions/quick-toolbar.d.ts +16 -9
  124. package/src/rich-text-editor/actions/quick-toolbar.js +33 -18
  125. package/src/rich-text-editor/actions/resize.js +2 -1
  126. package/src/rich-text-editor/actions/toolbar-action.js +1 -1
  127. package/src/rich-text-editor/actions/toolbar.d.ts +15 -16
  128. package/src/rich-text-editor/actions/toolbar.js +31 -100
  129. package/src/rich-text-editor/actions/xhtml-validation.d.ts +1 -1
  130. package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
  131. package/src/rich-text-editor/base/classes.d.ts +121 -126
  132. package/src/rich-text-editor/base/classes.js +121 -126
  133. package/src/rich-text-editor/base/constant.d.ts +190 -150
  134. package/src/rich-text-editor/base/constant.js +359 -150
  135. package/src/rich-text-editor/base/enum.d.ts +1 -1
  136. package/src/rich-text-editor/base/enum.js +1 -1
  137. package/src/rich-text-editor/base/interface.d.ts +87 -53
  138. package/src/rich-text-editor/base/interface.js +1 -1
  139. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +891 -891
  140. package/src/rich-text-editor/base/rich-text-editor.d.ts +68 -65
  141. package/src/rich-text-editor/base/rich-text-editor.js +232 -199
  142. package/src/rich-text-editor/base/util.d.ts +5 -1
  143. package/src/rich-text-editor/base/util.js +47 -4
  144. package/src/rich-text-editor/formatter/formatter.d.ts +8 -8
  145. package/src/rich-text-editor/formatter/formatter.js +23 -12
  146. package/src/rich-text-editor/formatter/html-formatter.d.ts +2 -2
  147. package/src/rich-text-editor/formatter/html-formatter.js +15 -15
  148. package/src/rich-text-editor/formatter/markdown-formatter.d.ts +2 -2
  149. package/src/rich-text-editor/formatter/markdown-formatter.js +15 -15
  150. package/src/rich-text-editor/models/default-locale.js +30 -26
  151. package/src/rich-text-editor/models/iframe-settings-model.d.ts +26 -26
  152. package/src/rich-text-editor/models/iframe-settings.js +19 -19
  153. package/src/rich-text-editor/models/inline-mode-model.d.ts +11 -11
  154. package/src/rich-text-editor/models/inline-mode.js +19 -19
  155. package/src/rich-text-editor/models/items.js +2 -2
  156. package/src/rich-text-editor/models/toolbar-settings-model.d.ts +760 -760
  157. package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
  158. package/src/rich-text-editor/models/toolbar-settings.js +20 -20
  159. package/src/rich-text-editor/renderer/audio-module.d.ts +2 -1
  160. package/src/rich-text-editor/renderer/audio-module.js +14 -1
  161. package/src/rich-text-editor/renderer/content-renderer.d.ts +6 -6
  162. package/src/rich-text-editor/renderer/content-renderer.js +6 -6
  163. package/src/rich-text-editor/renderer/dialog-renderer.d.ts +4 -2
  164. package/src/rich-text-editor/renderer/dialog-renderer.js +14 -3
  165. package/src/rich-text-editor/renderer/iframe-content-renderer.d.ts +4 -4
  166. package/src/rich-text-editor/renderer/iframe-content-renderer.js +19 -18
  167. package/src/rich-text-editor/renderer/image-module.d.ts +10 -2
  168. package/src/rich-text-editor/renderer/image-module.js +200 -168
  169. package/src/rich-text-editor/renderer/link-module.d.ts +1 -1
  170. package/src/rich-text-editor/renderer/link-module.js +11 -2
  171. package/src/rich-text-editor/renderer/markdown-renderer.d.ts +6 -6
  172. package/src/rich-text-editor/renderer/markdown-renderer.js +6 -6
  173. package/src/rich-text-editor/renderer/popup-renderer.d.ts +5 -5
  174. package/src/rich-text-editor/renderer/popup-renderer.js +5 -5
  175. package/src/rich-text-editor/renderer/render.d.ts +2 -2
  176. package/src/rich-text-editor/renderer/render.js +2 -2
  177. package/src/rich-text-editor/renderer/table-module.d.ts +9 -2
  178. package/src/rich-text-editor/renderer/table-module.js +289 -137
  179. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +13 -9
  180. package/src/rich-text-editor/renderer/toolbar-renderer.js +103 -24
  181. package/src/rich-text-editor/renderer/video-module.d.ts +4 -1
  182. package/src/rich-text-editor/renderer/video-module.js +62 -35
  183. package/src/rich-text-editor/renderer/view-source.d.ts +7 -6
  184. package/src/rich-text-editor/renderer/view-source.js +18 -10
  185. package/src/rich-text-editor/services/renderer-factory.d.ts +3 -3
  186. package/src/rich-text-editor/services/renderer-factory.js +3 -3
  187. package/src/rich-text-editor/services/service-locator.d.ts +3 -3
  188. package/src/rich-text-editor/services/service-locator.js +3 -3
  189. package/src/selection/selection.d.ts +22 -22
  190. package/src/selection/selection.js +25 -22
  191. package/styles/_all.scss +1 -1
  192. package/styles/bootstrap-dark.css +153 -49
  193. package/styles/bootstrap.css +158 -57
  194. package/styles/bootstrap4.css +145 -45
  195. package/styles/bootstrap5-dark.css +150 -45
  196. package/styles/bootstrap5.css +150 -45
  197. package/styles/fabric-dark.css +139 -39
  198. package/styles/fabric.css +140 -40
  199. package/styles/fluent-dark.css +147 -41
  200. package/styles/fluent.css +147 -41
  201. package/styles/highcontrast-light.css +139 -39
  202. package/styles/highcontrast.css +143 -40
  203. package/styles/material-dark.css +143 -39
  204. package/styles/material.css +143 -39
  205. package/styles/material3-dark.css +155 -49
  206. package/styles/material3-dark.scss +1 -1
  207. package/styles/material3.css +155 -49
  208. package/styles/material3.scss +1 -1
  209. package/styles/rich-text-editor/_all.scss +2 -2
  210. package/styles/rich-text-editor/_bds-definition.scss +279 -0
  211. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +281 -277
  212. package/styles/rich-text-editor/_bootstrap-definition.scss +337 -334
  213. package/styles/rich-text-editor/_bootstrap4-definition.scss +464 -460
  214. package/styles/rich-text-editor/_bootstrap5-definition.scss +266 -262
  215. package/styles/rich-text-editor/_fabric-dark-definition.scss +263 -259
  216. package/styles/rich-text-editor/_fabric-definition.scss +261 -257
  217. package/styles/rich-text-editor/_fluent-definition.scss +267 -263
  218. package/styles/rich-text-editor/_fusionnew-definition.scss +265 -261
  219. package/styles/rich-text-editor/_highcontrast-definition.scss +261 -257
  220. package/styles/rich-text-editor/_highcontrast-light-definition.scss +261 -257
  221. package/styles/rich-text-editor/_layout.scss +2249 -2147
  222. package/styles/rich-text-editor/_material-dark-definition.scss +266 -262
  223. package/styles/rich-text-editor/_material-definition.scss +264 -260
  224. package/styles/rich-text-editor/_material3-definition.scss +266 -262
  225. package/styles/rich-text-editor/_tailwind-definition.scss +261 -257
  226. package/styles/rich-text-editor/_theme.scss +906 -837
  227. package/styles/rich-text-editor/bootstrap-dark.css +153 -49
  228. package/styles/rich-text-editor/bootstrap.css +158 -57
  229. package/styles/rich-text-editor/bootstrap4.css +145 -45
  230. package/styles/rich-text-editor/bootstrap5-dark.css +150 -45
  231. package/styles/rich-text-editor/bootstrap5.css +150 -45
  232. package/styles/rich-text-editor/fabric-dark.css +139 -39
  233. package/styles/rich-text-editor/fabric.css +140 -40
  234. package/styles/rich-text-editor/fluent-dark.css +147 -41
  235. package/styles/rich-text-editor/fluent.css +147 -41
  236. package/styles/rich-text-editor/highcontrast-light.css +139 -39
  237. package/styles/rich-text-editor/highcontrast.css +143 -40
  238. package/styles/rich-text-editor/icons/_bds.scss +348 -0
  239. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +349 -349
  240. package/styles/rich-text-editor/icons/_bootstrap.scss +349 -349
  241. package/styles/rich-text-editor/icons/_bootstrap4.scss +349 -349
  242. package/styles/rich-text-editor/icons/_bootstrap5.scss +348 -348
  243. package/styles/rich-text-editor/icons/_fabric-dark.scss +349 -349
  244. package/styles/rich-text-editor/icons/_fabric.scss +349 -349
  245. package/styles/rich-text-editor/icons/_fluent.scss +348 -348
  246. package/styles/rich-text-editor/icons/_fusionnew.scss +348 -348
  247. package/styles/rich-text-editor/icons/_highcontrast-light.scss +349 -349
  248. package/styles/rich-text-editor/icons/_highcontrast.scss +349 -349
  249. package/styles/rich-text-editor/icons/_material-dark.scss +349 -349
  250. package/styles/rich-text-editor/icons/_material.scss +349 -349
  251. package/styles/rich-text-editor/icons/_material3.scss +348 -348
  252. package/styles/rich-text-editor/icons/_tailwind.scss +348 -348
  253. package/styles/rich-text-editor/material-dark.css +143 -39
  254. package/styles/rich-text-editor/material.css +143 -39
  255. package/styles/rich-text-editor/material3-dark.css +155 -49
  256. package/styles/rich-text-editor/material3-dark.scss +1 -1
  257. package/styles/rich-text-editor/material3.css +155 -49
  258. package/styles/rich-text-editor/material3.scss +1 -1
  259. package/styles/rich-text-editor/tailwind-dark.css +194 -66
  260. package/styles/rich-text-editor/tailwind.css +194 -66
  261. package/styles/tailwind-dark.css +194 -66
  262. package/styles/tailwind.css +194 -66
  263. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
  264. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
  265. package/dist/ej2-richtexteditor.min.js +0 -10
  266. package/dist/global/ej2-richtexteditor.min.js +0 -11
  267. package/dist/global/ej2-richtexteditor.min.js.map +0 -1
  268. package/dist/global/index.d.ts +0 -14
  269. package/tslint.json +0 -111
@@ -1,4 +1,4 @@
1
- import { detach, closest, Browser, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
1
+ import { createElement, 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.currentMarginLeft = 0;
20
+ this.resizeEndTime = 0;
21
21
  this.parent = parent;
22
22
  this.rteID = parent.element.id;
23
23
  this.l10n = serviceLocator.getService('rteLocale');
@@ -47,6 +47,7 @@ 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);
50
51
  };
51
52
  Table.prototype.removeEventListener = function () {
52
53
  if (this.parent.isDestroyed) {
@@ -72,6 +73,7 @@ var Table = /** @class */ (function () {
72
73
  this.parent.off(events.bindCssClass, this.setCssClass);
73
74
  this.parent.off(events.destroy, this.destroy);
74
75
  this.parent.off(events.moduleDestroy, this.moduleDestroy);
76
+ this.parent.off(events.afterKeyDown, this.afterKeyDown);
75
77
  if (!Browser.isDevice && this.parent.tableSettings.resize) {
76
78
  EventHandler.remove(this.contentModule.getEditPanel(), 'mouseover', this.resizeHelper);
77
79
  }
@@ -173,7 +175,15 @@ var Table = /** @class */ (function () {
173
175
  Table.prototype.keyUp = function (e) {
174
176
  var target = e.args.target;
175
177
  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
+ }
176
183
  this.popupObj.hide();
184
+ if (createTableToolbarBtn) {
185
+ createTableToolbarBtn.focus();
186
+ }
177
187
  }
178
188
  };
179
189
  Table.prototype.keyDown = function (e) {
@@ -229,6 +239,14 @@ var Table = /** @class */ (function () {
229
239
  }
230
240
  }
231
241
  }
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);
232
250
  };
233
251
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
234
252
  Table.prototype.tableModulekeyUp = function (e) {
@@ -262,7 +280,6 @@ var Table = /** @class */ (function () {
262
280
  name: !isInternal ? 'showDialog' : null
263
281
  };
264
282
  this.insertTableDialog({ self: this, args: args, selection: selection });
265
- this.parent.formatter.editorManager.nodeSelection.restore();
266
283
  }
267
284
  };
268
285
  Table.prototype.showDialog = function () {
@@ -346,7 +363,20 @@ var Table = /** @class */ (function () {
346
363
  return false;
347
364
  }
348
365
  };
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
+ };
349
375
  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
+ }
350
380
  this.previousTableElement = ele;
351
381
  var insideList = this.insideList(selection.range);
352
382
  if ((event.keyCode === 37 || event.keyCode === 39) && selection.range.startContainer.nodeType === 3 ||
@@ -483,10 +513,12 @@ var Table = /** @class */ (function () {
483
513
  var startNode = this.parent.getRange().startContainer.parentElement;
484
514
  var endNode = this.parent.getRange().endContainer.parentElement;
485
515
  var isAnchorEle = this.getAnchorNode(target);
516
+ var currentTime = new Date().getTime();
486
517
  if (target && target.nodeName !== 'A' && isAnchorEle.nodeName !== 'A' && target.nodeName !== 'IMG' && target.nodeName !== 'VIDEO' && !target.classList.contains(classes.CLS_CLICKELEM) &&
487
518
  target.nodeName !== 'AUDIO' && startNode === endNode && (target.nodeName === 'TD' || target.nodeName === 'TH' ||
488
519
  target.nodeName === 'TABLE' || (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable)))
489
- && !(range.startContainer.nodeType === 3 && !range.collapsed)) {
520
+ && !(range.startContainer.nodeType === 3 && !range.collapsed) &&
521
+ currentTime - this.resizeEndTime > 100) {
490
522
  var range_1 = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
491
523
  this.parent.formatter.editorManager.nodeSelection.save(range_1, this.contentModule.getDocument());
492
524
  this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
@@ -582,7 +614,10 @@ var Table = /** @class */ (function () {
582
614
  var tdNode = closest(target, 'td,th');
583
615
  target = (target.nodeName !== 'TD' && tdNode && this.parent.contentModule.getEditPanel().contains(tdNode)) ?
584
616
  tdNode : target;
585
- removeClass(this.contentModule.getEditPanel().querySelectorAll('table td, table th'), classes.CLS_TABLE_SEL);
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
+ }
586
621
  if (target && (target.tagName === 'TD' || target.tagName === 'TH')) {
587
622
  addClass([target], classes.CLS_TABLE_SEL);
588
623
  this.activeCell = target;
@@ -607,7 +642,7 @@ var Table = /** @class */ (function () {
607
642
  return;
608
643
  }
609
644
  var target = e.target || e.targetTouches[0].target;
610
- var closestTable = closest(target, 'table.e-rte-table');
645
+ var closestTable = closest(target, 'table.e-rte-table, table.e-rte-paste-table');
611
646
  if (!isNOU(this.curTable) && !isNOU(closestTable) && closestTable !== this.curTable &&
612
647
  this.parent.contentModule.getEditPanel().contains(closestTable)) {
613
648
  this.removeResizeElement();
@@ -624,7 +659,7 @@ var Table = /** @class */ (function () {
624
659
  };
625
660
  Table.prototype.tableResizeEleCreation = function (table, e) {
626
661
  this.parent.preventDefaultResize(e);
627
- var columns = table.rows[this.calMaxCol(table)].cells;
662
+ var columns = this.calMaxCol(this.curTable);
628
663
  var rows = [];
629
664
  for (var i = 0; i < table.rows.length; i++) {
630
665
  for (var j = 0; j < table.rows[i].cells.length; j++) {
@@ -646,11 +681,11 @@ var Table = /** @class */ (function () {
646
681
  colReEle.classList.add(classes.CLS_RTE_TABLE_RESIZE, classes.CLS_TB_COL_RES);
647
682
  if (columns.length === i) {
648
683
  colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
649
- 'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth) + 'px;';
684
+ 'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth - 2) + 'px;';
650
685
  }
651
686
  else {
652
687
  colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
653
- 'px; left:' + (pos.left + this.calcPos(columns[i]).left) + 'px;';
688
+ 'px; left:' + (pos.left + this.calcPos(columns[i]).left - 2) + 'px;';
654
689
  }
655
690
  this.contentModule.getEditPanel().appendChild(colReEle);
656
691
  }
@@ -682,7 +717,7 @@ var Table = /** @class */ (function () {
682
717
  };
683
718
  Table.prototype.removeResizeElement = function () {
684
719
  var item = this.parent.contentModule.getEditPanel().
685
- querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box, .e-table-rhelper');
720
+ querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box');
686
721
  if (item.length > 0) {
687
722
  for (var i = 0; i < item.length; i++) {
688
723
  detach(item[i]);
@@ -756,6 +791,7 @@ var Table = /** @class */ (function () {
756
791
  if (target.classList.contains(classes.CLS_TB_COL_RES) ||
757
792
  target.classList.contains(classes.CLS_TB_ROW_RES) ||
758
793
  target.classList.contains(classes.CLS_TB_BOX_RES)) {
794
+ this.resetResizeHelper(this.curTable);
759
795
  e.preventDefault();
760
796
  this.parent.preventDefaultResize(e);
761
797
  removeClass(this.curTable.querySelectorAll('td,th'), classes.CLS_TABLE_SEL);
@@ -766,9 +802,10 @@ var Table = /** @class */ (function () {
766
802
  this.hideTableQuickToolbar();
767
803
  if (target.classList.contains(classes.CLS_TB_COL_RES)) {
768
804
  this.resizeBtnStat.column = true;
769
- if (parseInt(target.getAttribute('data-col'), 10) === this.curTable.rows[this.calMaxCol(this.curTable)].cells.length) {
805
+ if (parseInt(target.getAttribute('data-col'), 10) === this.calMaxCol(this.curTable).length) {
770
806
  this.currentColumnResize = 'last';
771
- this.columnEle = this.curTable.rows[this.calMaxCol(this.curTable)].cells[parseInt(target.getAttribute('data-col'), 10) - 1];
807
+ this.colIndex = parseInt(target.getAttribute('data-col'), 10) - 1;
808
+ this.columnEle = this.calMaxCol(this.curTable)[this.colIndex];
772
809
  }
773
810
  else {
774
811
  if (parseInt(target.getAttribute('data-col'), 10) === 0) {
@@ -776,10 +813,48 @@ var Table = /** @class */ (function () {
776
813
  }
777
814
  else {
778
815
  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
+ }
779
854
  }
780
- this.columnEle = this.curTable.rows[this.calMaxCol(this.curTable)].cells[parseInt(target.getAttribute('data-col'), 10)];
855
+ this.colIndex = parseInt(target.getAttribute('data-col'), 10);
856
+ this.columnEle = this.calMaxCol(this.curTable)[this.colIndex];
781
857
  }
782
- this.colIndex = this.columnEle.cellIndex;
783
858
  this.moveEle = e.target;
784
859
  this.appendHelper();
785
860
  }
@@ -808,6 +883,16 @@ var Table = /** @class */ (function () {
808
883
  EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
809
884
  }
810
885
  };
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
+ };
811
896
  Table.prototype.removeHelper = function (e) {
812
897
  var cls = e.target.classList;
813
898
  if (!(cls.contains('e-reicon')) && this.helper) {
@@ -836,12 +921,12 @@ var Table = /** @class */ (function () {
836
921
  this.helper.classList.add('e-column-helper');
837
922
  this.helper.style.cssText = 'height: ' + getComputedStyle(this.curTable).height + '; top: ' +
838
923
  pos.top + 'px; left:' + ((pos.left + this.calcPos(this.columnEle).left) +
839
- (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth + 2 : 0) - 1) + 'px;';
924
+ (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1) + 'px;';
840
925
  }
841
926
  else {
842
927
  this.helper.classList.add('e-row-helper');
843
928
  this.helper.style.cssText = 'width: ' + getComputedStyle(this.curTable).width + '; top: ' +
844
- (this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight) +
929
+ (this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1) +
845
930
  'px; left:' + (this.calcPos(this.rowEle).left + pos.left) + 'px;';
846
931
  }
847
932
  };
@@ -849,24 +934,42 @@ var Table = /** @class */ (function () {
849
934
  var pos = this.calcPos(this.curTable);
850
935
  if (this.resizeBtnStat.column) {
851
936
  var left = (pos.left + this.calcPos(this.columnEle).left) +
852
- (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth + 2 : 0) - 1;
937
+ (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1;
853
938
  this.helper.style.left = left + 'px';
939
+ this.helper.style.height = this.curTable.offsetHeight + 'px';
854
940
  }
855
941
  else {
856
- var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight;
942
+ var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1;
857
943
  this.helper.style.top = top_1 + 'px';
858
944
  }
859
945
  };
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;
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;
867
970
  }
868
971
  }
869
- return maxRowIndex;
972
+ return cells;
870
973
  };
871
974
  Table.prototype.resizing = function (e) {
872
975
  var _this = this;
@@ -879,10 +982,6 @@ var Table = /** @class */ (function () {
879
982
  var maxiumWidth;
880
983
  var currentTdElement = this.curTable.closest('td');
881
984
  var args = { event: e, requestType: 'table' };
882
- var isRowCellsMerged = false;
883
- var isColCellsMerged = false;
884
- var mergedCellIndex;
885
- var mergedElement;
886
985
  this.parent.trigger(events.onResize, args, function (resizingArgs) {
887
986
  if (resizingArgs.cancel) {
888
987
  _this.cancelResizeAction();
@@ -907,8 +1006,10 @@ var Table = /** @class */ (function () {
907
1006
  widthCompare = rteWidth;
908
1007
  }
909
1008
  if (_this.resizeBtnStat.column) {
910
- var width = parseFloat(_this.columnEle.offsetWidth.toString());
911
- var cellRow = _this.curTable.rows[0].cells[0].nodeName === 'TH' ? 1 : 0;
1009
+ if (_this.curTable.closest('li')) {
1010
+ widthCompare = _this.curTable.closest('li').offsetWidth;
1011
+ }
1012
+ var colGroup = _this.curTable.querySelectorAll('colgroup > col');
912
1013
  var currentTableWidth = void 0;
913
1014
  if (_this.curTable.style.width !== '' && _this.curTable.style.width.includes('%')) {
914
1015
  currentTableWidth = parseFloat(_this.curTable.style.width.split('%')[0]);
@@ -916,7 +1017,8 @@ var Table = /** @class */ (function () {
916
1017
  else {
917
1018
  currentTableWidth = _this.getCurrentTableWidth(_this.curTable.offsetWidth, _this.parent.inputElement.offsetWidth);
918
1019
  }
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]);
1020
+ var currentCol = _this.calMaxCol(_this.curTable)[_this.colIndex];
1021
+ var currentColResizableWidth = _this.getCurrentColWidth(currentCol, tableWidth);
920
1022
  if (_this.currentColumnResize === 'first') {
921
1023
  mouseX = mouseX - 0.75; //This was done for to make the gripper and the table first/last column will be close.
922
1024
  _this.removeResizeElement();
@@ -925,16 +1027,43 @@ var Table = /** @class */ (function () {
925
1027
  _this.curTable.style.maxWidth = maxiumWidth + 'px';
926
1028
  }
927
1029
  // Below the value '100' is the 100% width of the parent element.
928
- if (((mouseX !== 0 && 5 < currentColumnCellWidth) || mouseX < 0) && currentTableWidth <= 100 &&
1030
+ if (((mouseX !== 0 && 5 < currentColResizableWidth) || mouseX < 0) && currentTableWidth <= 100 &&
929
1031
  _this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) <= 100) {
930
1032
  var firstColumnsCell = _this.findFirstLastColCells(_this.curTable, true);
931
1033
  _this.curTable.style.width = _this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) > 100 ? (100 + '%') :
932
1034
  (_this.convertPixelToPercentage(tableWidth - mouseX, widthCompare) + '%');
933
1035
  var differenceWidth = currentTableWidth - _this.convertPixelToPercentage(tableWidth - mouseX, widthCompare);
934
- _this.currentMarginLeft = _this.currentMarginLeft + differenceWidth;
935
- _this.curTable.style.marginLeft = 'calc(' + (_this.curTable.style.width === '100%' ? 0 : _this.currentMarginLeft) + '%)';
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
+ if (currentMarginLeft && currentMarginLeft < 1) {
1059
+ _this.curTable.style.marginLeft = null;
1060
+ _this.curTable.style.width = '100%';
1061
+ return;
1062
+ }
1063
+ _this.curTable.style.marginLeft = 'calc(' + (_this.curTable.style.width === '100%' ? 0 : currentMarginLeft) + '%)';
936
1064
  for (var i = 0; i < firstColumnsCell.length; i++) {
937
- _this.curTable.rows[i].cells[_this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
1065
+ var currentColumnCellWidth = _this.getCurrentColWidth(firstColumnsCell[i], tableWidth);
1066
+ firstColumnsCell[i].style.width = (currentColumnCellWidth - differenceWidth) + '%';
938
1067
  }
939
1068
  }
940
1069
  }
@@ -946,112 +1075,48 @@ var Table = /** @class */ (function () {
946
1075
  _this.curTable.style.maxWidth = maxiumWidth + 'px';
947
1076
  }
948
1077
  // Below the value '100' is the 100% width of the parent element.
949
- if (((mouseX !== 0 && 5 < currentColumnCellWidth) || mouseX > 0) &&
1078
+ if (((mouseX !== 0 && 5 < currentColResizableWidth) || mouseX > 0) &&
950
1079
  currentTableWidth <= 100 && _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) <= 100) {
951
1080
  var lastColumnsCell = _this.findFirstLastColCells(_this.curTable, false);
952
1081
  _this.curTable.style.width = _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) > 100 ? (100 + '%') : (_this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%');
953
1082
  var differenceWidth = currentTableWidth - _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare);
954
1083
  for (var i = 0; i < lastColumnsCell.length; i++) {
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
- }
1084
+ var currentColumnCellWidth = _this.getCurrentColWidth(lastColumnsCell[i], tableWidth);
1085
+ lastColumnsCell[i].style.width = (currentColumnCellWidth - differenceWidth) + '%';
959
1086
  }
960
1087
  }
961
1088
  }
962
1089
  else {
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
- }
1090
+ var actualwid = colGroup[_this.colIndex].offsetWidth - mouseX;
1091
+ // eslint-disable-next-line
1092
+ var totalwid = colGroup[_this.colIndex].offsetWidth + colGroup[_this.colIndex - 1].offsetWidth;
1093
+ if ((totalwid - actualwid) > 20 && actualwid > 20) {
1094
+ var leftColumnWidth = totalwid - actualwid;
1095
+ var rightColWidth = actualwid;
1096
+ colGroup[_this.colIndex - 1].style.width = _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
1097
+ colGroup[_this.colIndex].style.width = _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
1044
1098
  }
1045
1099
  }
1046
1100
  _this.updateHelper();
1047
1101
  }
1048
1102
  else if (_this.resizeBtnStat.row) {
1049
1103
  _this.parent.preventDefaultResize(e);
1050
- var height = parseFloat(_this.rowEle.clientHeight.toString()) + mouseY;
1051
- if (height > 20) {
1052
- _this.rowEle.style.height = height + 'px';
1104
+ var tableTrElementPixel = [];
1105
+ var currentTableTrElement = _this.curTable.querySelectorAll('tr');
1106
+ for (var i = 0; i < currentTableTrElement.length; i++) {
1107
+ if (_this.rowEle !== currentTableTrElement[i]) {
1108
+ tableTrElementPixel[i] = (parseFloat(currentTableTrElement[i].clientHeight.toString()));
1109
+ }
1110
+ }
1111
+ _this.curTable.style.height = (parseFloat(_this.curTable.clientHeight.toString()) + ((mouseY > 0) ? 0 : mouseY)) + 'px';
1112
+ for (var i = 0; i < currentTableTrElement.length; i++) {
1113
+ if (_this.rowEle === currentTableTrElement[i]) {
1114
+ currentTableTrElement[i].style.height = (parseFloat(currentTableTrElement[i].clientHeight.toString()) + mouseY) + 'px';
1115
+ }
1116
+ else {
1117
+ currentTableTrElement[i].style.height = tableTrElementPixel[i] + 'px';
1118
+ }
1053
1119
  }
1054
- _this.curTable.style.height = '';
1055
1120
  if (!isNOU(tableReBox)) {
1056
1121
  tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
1057
1122
  'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
@@ -1065,19 +1130,40 @@ var Table = /** @class */ (function () {
1065
1130
  maxiumWidth = Math.abs(tableBoxPosition - currentTdElement.getBoundingClientRect().width) - 5;
1066
1131
  _this.curTable.style.maxWidth = maxiumWidth + 'px';
1067
1132
  }
1068
- var widthType = _this.curTable.style.width.indexOf('%') > -1;
1069
- _this.curTable.style.width = widthType ? _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%'
1070
- : tableWidth + mouseX + 'px';
1071
1133
  _this.curTable.style.height = tableHeight + mouseY + 'px';
1072
1134
  if (!isNOU(tableReBox)) {
1073
1135
  tableReBox.classList.add('e-rbox-select');
1074
1136
  tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
1075
1137
  'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
1076
1138
  }
1139
+ if (_this.curTable.closest('li')) {
1140
+ widthCompare = _this.curTable.closest('li').offsetWidth;
1141
+ }
1142
+ var widthType = _this.curTable.style.width.indexOf('%') > -1;
1143
+ if (widthType && parseFloat(_this.curTable.style.width.split('%')[0]) > 100) {
1144
+ _this.curTable.style.width = '100%';
1145
+ return;
1146
+ }
1147
+ if (!widthType && _this.curTable.offsetWidth > _this.contentModule.getEditPanel().offsetWidth) {
1148
+ _this.curTable.style.width = rteWidth + 'px';
1149
+ return;
1150
+ }
1151
+ _this.curTable.style.width = widthType ? _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%'
1152
+ : tableWidth + mouseX + 'px';
1077
1153
  }
1078
1154
  }
1079
1155
  });
1080
1156
  };
1157
+ Table.prototype.getCurrentColWidth = function (col, tableWidth) {
1158
+ var currentColWidth = 0;
1159
+ if (col.style.width !== '' && col.style.width.includes('%')) {
1160
+ currentColWidth = parseFloat(col.style.width.split('%')[0]);
1161
+ }
1162
+ else {
1163
+ currentColWidth = this.convertPixelToPercentage(col.offsetWidth, tableWidth);
1164
+ }
1165
+ return currentColWidth;
1166
+ };
1081
1167
  Table.prototype.getCurrentTableWidth = function (tableWidth, parentWidth) {
1082
1168
  var currentTableWidth = 0;
1083
1169
  currentTableWidth = tableWidth / parentWidth * 100;
@@ -1085,12 +1171,22 @@ var Table = /** @class */ (function () {
1085
1171
  };
1086
1172
  Table.prototype.findFirstLastColCells = function (table, isFirst) {
1087
1173
  var resultColumns = [];
1088
- var rows = table.querySelectorAll('tr');
1089
- for (var i = 0; i < rows.length; 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]);
1174
+ var rows = table.rows;
1175
+ var rowSpanCellIndexs = new Array();
1176
+ var _loop_1 = function (i) {
1177
+ var cellIndex = isFirst ? 0 : rows[i].cells.length - 1;
1178
+ var column = rows[i].cells[cellIndex];
1179
+ for (var rowSpan = 1; rowSpan < column.rowSpan; rowSpan++) {
1180
+ var key = i + rowSpan + "-" + cellIndex;
1181
+ rowSpanCellIndexs.push(key);
1182
+ }
1183
+ var spannedCellKey = i + "-" + cellIndex;
1184
+ if (rowSpanCellIndexs.length === 0 || (isFirst && rowSpanCellIndexs.indexOf(spannedCellKey) === -1) || (!isFirst && rowSpanCellIndexs.indexOf(spannedCellKey) === -1 && rowSpanCellIndexs.every(function (key) { return key.split('-')[0] !== i.toString(); }))) {
1185
+ resultColumns.push(column);
1093
1186
  }
1187
+ };
1188
+ for (var i = 0; i < rows.length; i++) {
1189
+ _loop_1(i);
1094
1190
  }
1095
1191
  return resultColumns;
1096
1192
  };
@@ -1114,12 +1210,50 @@ var Table = /** @class */ (function () {
1114
1210
  detach(this.helper);
1115
1211
  this.helper = null;
1116
1212
  }
1213
+ this.resetResizeHelper(this.curTable);
1117
1214
  this.pageX = null;
1118
1215
  this.pageY = null;
1119
1216
  this.moveEle = null;
1217
+ var currentTableTrElement = this.curTable.querySelectorAll("tr");
1218
+ var tableTrPercentage = [];
1219
+ for (var i = 0; i < currentTableTrElement.length; i++) {
1220
+ var percentage = (parseFloat(currentTableTrElement[i].clientHeight.toString()) / parseFloat(this.curTable.clientHeight.toString())) * 100;
1221
+ tableTrPercentage[i] = percentage;
1222
+ }
1223
+ for (var i = 0; i < currentTableTrElement.length; i++) {
1224
+ currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
1225
+ }
1120
1226
  var args = { event: e, requestType: 'table' };
1121
1227
  this.parent.trigger(events.resizeStop, args);
1122
1228
  this.parent.formatter.saveData();
1229
+ this.resizeEndTime = new Date().getTime();
1230
+ };
1231
+ Table.prototype.resetResizeHelper = function (curTable) {
1232
+ var colHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-column-helper');
1233
+ Array.from(colHelper).forEach(function (element) {
1234
+ if (element.parentNode) {
1235
+ element.parentNode.removeChild(element);
1236
+ }
1237
+ });
1238
+ var rowHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-row-helper');
1239
+ Array.from(rowHelper).forEach(function (element) {
1240
+ if (element.parentNode) {
1241
+ element.parentNode.removeChild(element);
1242
+ }
1243
+ });
1244
+ if (!curTable.style.width) {
1245
+ curTable.style.width = curTable.offsetWidth + 'px';
1246
+ }
1247
+ var colGroup = curTable.querySelector('colgroup');
1248
+ if (colGroup) {
1249
+ for (var i = 0; i < curTable.rows.length; i++) {
1250
+ for (var k = 0; k < curTable.rows[i].cells.length; k++) {
1251
+ var width = this.convertPixelToPercentage(curTable.rows[i].cells[k].offsetWidth, parseInt(getComputedStyle(curTable).width, 10)) + '%';
1252
+ curTable.rows[i].cells[k].style.width = width;
1253
+ }
1254
+ }
1255
+ curTable.removeChild(colGroup);
1256
+ }
1123
1257
  };
1124
1258
  Table.prototype.resizeBtnInit = function () {
1125
1259
  return this.resizeBtnStat = { column: false, row: false, tableBox: false };
@@ -1206,7 +1340,7 @@ var Table = /** @class */ (function () {
1206
1340
  this.createTableButton.isStringTemplate = true;
1207
1341
  this.createTableButton.appendTo(btnEle);
1208
1342
  EventHandler.add(btnEle, 'click', this.insertTableDialog, { self: this, args: args.args, selection: args.selection });
1209
- this.parent.getToolbar().appendChild(this.dlgDiv);
1343
+ this.parent.getToolbar().parentElement.appendChild(this.dlgDiv);
1210
1344
  var target = args.args.originalEvent.target;
1211
1345
  target = target.classList.contains('e-toolbar-item') ? target.firstChild : target.parentElement;
1212
1346
  this.popupObj = new Popup(this.dlgDiv, {
@@ -1230,6 +1364,7 @@ var Table = /** @class */ (function () {
1230
1364
  if (!isNOU(this.parent.cssClass)) {
1231
1365
  addClass([this.popupObj.element], this.parent.getCssClass());
1232
1366
  }
1367
+ btnEle.focus();
1233
1368
  this.popupObj.refreshPosition(target);
1234
1369
  };
1235
1370
  Table.prototype.onIframeMouseDown = function () {
@@ -1247,6 +1382,7 @@ var Table = /** @class */ (function () {
1247
1382
  this.popupObj.hide();
1248
1383
  }
1249
1384
  if (this.editdlgObj) {
1385
+ this.parent.notify(events.documentClickClosedBy, { closedBy: "outside click" });
1250
1386
  this.editdlgObj.hide();
1251
1387
  }
1252
1388
  this.parent.isBlur = true;
@@ -1538,7 +1674,7 @@ var Table = /** @class */ (function () {
1538
1674
  * @function destroy
1539
1675
  * @returns {void}
1540
1676
  * @hidden
1541
-
1677
+ * @deprecated
1542
1678
  */
1543
1679
  Table.prototype.destroy = function () {
1544
1680
  if (isNOU(this.parent)) {
@@ -1557,6 +1693,22 @@ var Table = /** @class */ (function () {
1557
1693
  Table.prototype.getModuleName = function () {
1558
1694
  return 'table';
1559
1695
  };
1696
+ Table.prototype.afterKeyDown = function (e) {
1697
+ var _this = this;
1698
+ if (this.curTable) {
1699
+ setTimeout(function () {
1700
+ _this.updateResizeIconPosition();
1701
+ }, 1);
1702
+ }
1703
+ };
1704
+ Table.prototype.updateResizeIconPosition = function () {
1705
+ var tableReBox = this.parent.contentModule.getEditPanel().querySelector('.e-table-box');
1706
+ if (!isNOU(tableReBox)) {
1707
+ var tablePosition = this.calcPos(this.curTable);
1708
+ tableReBox.style.cssText = 'top: ' + (tablePosition.top + parseInt(getComputedStyle(this.curTable).height, 10) - 4) +
1709
+ 'px; left:' + (tablePosition.left + parseInt(getComputedStyle(this.curTable).width, 10) - 4) + 'px;';
1710
+ }
1711
+ };
1560
1712
  return Table;
1561
1713
  }());
1562
1714
  export { Table };