@syncfusion/ej2-richtexteditor 24.2.3 → 24.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +43 -5
  2. package/dist/ej2-richtexteditor.min.js +2 -2
  3. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  4. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-richtexteditor.es2015.js +485 -193
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +472 -186
  8. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  9. package/dist/global/ej2-richtexteditor.min.js +2 -2
  10. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +12 -12
  13. package/src/common/util.d.ts +6 -0
  14. package/src/common/util.js +31 -1
  15. package/src/editor-manager/plugin/formats.d.ts +1 -0
  16. package/src/editor-manager/plugin/formats.js +37 -2
  17. package/src/editor-manager/plugin/inserthtml.js +22 -4
  18. package/src/editor-manager/plugin/lists.js +14 -1
  19. package/src/editor-manager/plugin/ms-word-clean-up.js +87 -18
  20. package/src/editor-manager/plugin/nodecutter.js +1 -1
  21. package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
  22. package/src/editor-manager/plugin/selection-commands.js +56 -1
  23. package/src/editor-manager/plugin/table.js +1 -1
  24. package/src/rich-text-editor/actions/base-quick-toolbar.js +2 -2
  25. package/src/rich-text-editor/actions/enter-key.js +2 -2
  26. package/src/rich-text-editor/actions/html-editor.js +25 -12
  27. package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
  28. package/src/rich-text-editor/actions/paste-clean-up.js +26 -5
  29. package/src/rich-text-editor/actions/toolbar-action.js +1 -1
  30. package/src/rich-text-editor/actions/toolbar.js +1 -1
  31. package/src/rich-text-editor/base/interface.d.ts +0 -8
  32. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
  33. package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
  34. package/src/rich-text-editor/base/rich-text-editor.js +16 -6
  35. package/src/rich-text-editor/base/util.js +3 -0
  36. package/src/rich-text-editor/models/default-locale.js +8 -7
  37. package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
  38. package/src/rich-text-editor/renderer/image-module.js +3 -3
  39. package/src/rich-text-editor/renderer/table-module.d.ts +1 -0
  40. package/src/rich-text-editor/renderer/table-module.js +106 -98
  41. package/src/rich-text-editor/renderer/video-module.d.ts +2 -0
  42. package/src/rich-text-editor/renderer/video-module.js +33 -26
  43. package/src/selection/selection.js +3 -0
  44. package/styles/bootstrap-dark.css +25 -9
  45. package/styles/bootstrap.css +25 -9
  46. package/styles/bootstrap4.css +30 -14
  47. package/styles/bootstrap5-dark.css +25 -9
  48. package/styles/bootstrap5.css +25 -9
  49. package/styles/fabric-dark.css +25 -9
  50. package/styles/fabric.css +25 -9
  51. package/styles/fluent-dark.css +27 -11
  52. package/styles/fluent.css +27 -11
  53. package/styles/highcontrast-light.css +25 -9
  54. package/styles/highcontrast.css +25 -9
  55. package/styles/material-dark.css +25 -9
  56. package/styles/material.css +25 -9
  57. package/styles/material3-dark.css +33 -11
  58. package/styles/material3.css +33 -11
  59. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +4 -2
  60. package/styles/rich-text-editor/_bootstrap-definition.scss +4 -2
  61. package/styles/rich-text-editor/_bootstrap4-definition.scss +8 -6
  62. package/styles/rich-text-editor/_bootstrap5-definition.scss +4 -2
  63. package/styles/rich-text-editor/_fabric-dark-definition.scss +4 -2
  64. package/styles/rich-text-editor/_fabric-definition.scss +4 -2
  65. package/styles/rich-text-editor/_fluent-definition.scss +5 -3
  66. package/styles/rich-text-editor/_fusionnew-definition.scss +4 -2
  67. package/styles/rich-text-editor/_highcontrast-definition.scss +4 -2
  68. package/styles/rich-text-editor/_highcontrast-light-definition.scss +4 -2
  69. package/styles/rich-text-editor/_layout.scss +38 -7
  70. package/styles/rich-text-editor/_material-dark-definition.scss +4 -2
  71. package/styles/rich-text-editor/_material-definition.scss +4 -2
  72. package/styles/rich-text-editor/_material3-definition.scss +5 -3
  73. package/styles/rich-text-editor/_tailwind-definition.scss +21 -19
  74. package/styles/rich-text-editor/_theme.scss +21 -3
  75. package/styles/rich-text-editor/bootstrap-dark.css +25 -9
  76. package/styles/rich-text-editor/bootstrap.css +25 -9
  77. package/styles/rich-text-editor/bootstrap4.css +30 -14
  78. package/styles/rich-text-editor/bootstrap5-dark.css +25 -9
  79. package/styles/rich-text-editor/bootstrap5.css +25 -9
  80. package/styles/rich-text-editor/fabric-dark.css +25 -9
  81. package/styles/rich-text-editor/fabric.css +25 -9
  82. package/styles/rich-text-editor/fluent-dark.css +27 -11
  83. package/styles/rich-text-editor/fluent.css +27 -11
  84. package/styles/rich-text-editor/highcontrast-light.css +25 -9
  85. package/styles/rich-text-editor/highcontrast.css +25 -9
  86. package/styles/rich-text-editor/material-dark.css +25 -9
  87. package/styles/rich-text-editor/material.css +25 -9
  88. package/styles/rich-text-editor/material3-dark.css +33 -11
  89. package/styles/rich-text-editor/material3.css +33 -11
  90. package/styles/rich-text-editor/tailwind-dark.css +68 -32
  91. package/styles/rich-text-editor/tailwind.css +68 -32
  92. package/styles/tailwind-dark.css +68 -32
  93. package/styles/tailwind.css +68 -32
@@ -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';
@@ -655,11 +655,11 @@ var Table = /** @class */ (function () {
655
655
  colReEle.classList.add(classes.CLS_RTE_TABLE_RESIZE, classes.CLS_TB_COL_RES);
656
656
  if (columns.length === i) {
657
657
  colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
658
- 'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth) + 'px;';
658
+ 'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth - 2) + 'px;';
659
659
  }
660
660
  else {
661
661
  colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
662
- 'px; left:' + (pos.left + this.calcPos(columns[i]).left) + 'px;';
662
+ 'px; left:' + (pos.left + this.calcPos(columns[i]).left - 2) + 'px;';
663
663
  }
664
664
  this.contentModule.getEditPanel().appendChild(colReEle);
665
665
  }
@@ -691,7 +691,7 @@ var Table = /** @class */ (function () {
691
691
  };
692
692
  Table.prototype.removeResizeElement = function () {
693
693
  var item = this.parent.contentModule.getEditPanel().
694
- querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box, .e-table-rhelper');
694
+ querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box');
695
695
  if (item.length > 0) {
696
696
  for (var i = 0; i < item.length; i++) {
697
697
  detach(item[i]);
@@ -785,6 +785,44 @@ var Table = /** @class */ (function () {
785
785
  }
786
786
  else {
787
787
  this.currentColumnResize = 'middle';
788
+ var cellColl = this.curTable.rows[0].cells;
789
+ var cellCount = 0;
790
+ for (var cell = 0; cell < cellColl.length; cell++) {
791
+ cellCount = cellCount + cellColl[cell].colSpan;
792
+ }
793
+ var sizes = new Array(cellCount);
794
+ var colGroupEle = createElement('colgroup');
795
+ var rowSpanCells = new Map();
796
+ for (var i = 0; i < this.curTable.rows.length; i++) {
797
+ var currentColIndex = 0;
798
+ for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
799
+ for (var l = 1; l < this.curTable.rows[i].cells[k].rowSpan; l++) {
800
+ var key = "" + (i + l) + currentColIndex;
801
+ rowSpanCells.set(key, this.curTable.rows[i].cells[k]);
802
+ }
803
+ var cellIndex = this.getCellIndex(rowSpanCells, i, k);
804
+ if (cellIndex > currentColIndex) {
805
+ currentColIndex = cellIndex;
806
+ }
807
+ var width = this.curTable.rows[i].cells[k].offsetWidth;
808
+ if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
809
+ sizes[currentColIndex] = width;
810
+ }
811
+ currentColIndex += 1 + this.curTable.rows[i].cells[k].colSpan - 1;
812
+ }
813
+ }
814
+ for (var size = 0; size < sizes.length; size++) {
815
+ var cell = createElement('col');
816
+ cell.appendChild(createElement('br'));
817
+ cell.style.width = this.convertPixelToPercentage(sizes[size], parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
818
+ colGroupEle.appendChild(cell);
819
+ }
820
+ this.curTable.insertBefore(colGroupEle, this.curTable.firstChild);
821
+ for (var i = 0; i < this.curTable.rows.length; i++) {
822
+ for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
823
+ this.curTable.rows[i].cells[k].style.width = '';
824
+ }
825
+ }
788
826
  }
789
827
  this.columnEle = this.curTable.rows[this.calMaxCol(this.curTable)].cells[parseInt(target.getAttribute('data-col'), 10)];
790
828
  }
@@ -817,6 +855,16 @@ var Table = /** @class */ (function () {
817
855
  EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
818
856
  }
819
857
  };
858
+ Table.prototype.getCellIndex = function (rowSpanCells, rowIndex, colIndex) {
859
+ var cellKey = "" + rowIndex + colIndex;
860
+ var spannedCell = rowSpanCells.get(cellKey);
861
+ if (spannedCell) {
862
+ return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
863
+ }
864
+ else {
865
+ return colIndex;
866
+ }
867
+ };
820
868
  Table.prototype.removeHelper = function (e) {
821
869
  var cls = e.target.classList;
822
870
  if (!(cls.contains('e-reicon')) && this.helper) {
@@ -845,12 +893,12 @@ var Table = /** @class */ (function () {
845
893
  this.helper.classList.add('e-column-helper');
846
894
  this.helper.style.cssText = 'height: ' + getComputedStyle(this.curTable).height + '; top: ' +
847
895
  pos.top + 'px; left:' + ((pos.left + this.calcPos(this.columnEle).left) +
848
- (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth + 2 : 0) - 1) + 'px;';
896
+ (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1) + 'px;';
849
897
  }
850
898
  else {
851
899
  this.helper.classList.add('e-row-helper');
852
900
  this.helper.style.cssText = 'width: ' + getComputedStyle(this.curTable).width + '; top: ' +
853
- (this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight) +
901
+ (this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1) +
854
902
  'px; left:' + (this.calcPos(this.rowEle).left + pos.left) + 'px;';
855
903
  }
856
904
  };
@@ -858,11 +906,12 @@ var Table = /** @class */ (function () {
858
906
  var pos = this.calcPos(this.curTable);
859
907
  if (this.resizeBtnStat.column) {
860
908
  var left = (pos.left + this.calcPos(this.columnEle).left) +
861
- (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth + 2 : 0) - 1;
909
+ (this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1;
862
910
  this.helper.style.left = left + 'px';
911
+ this.helper.style.height = this.curTable.offsetHeight + 'px';
863
912
  }
864
913
  else {
865
- var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight;
914
+ var top_1 = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1;
866
915
  this.helper.style.top = top_1 + 'px';
867
916
  }
868
917
  };
@@ -888,10 +937,6 @@ var Table = /** @class */ (function () {
888
937
  var maxiumWidth;
889
938
  var currentTdElement = this.curTable.closest('td');
890
939
  var args = { event: e, requestType: 'table' };
891
- var isRowCellsMerged = false;
892
- var isColCellsMerged = false;
893
- var mergedCellIndex;
894
- var mergedElement;
895
940
  this.parent.trigger(events.onResize, args, function (resizingArgs) {
896
941
  if (resizingArgs.cancel) {
897
942
  _this.cancelResizeAction();
@@ -916,7 +961,7 @@ var Table = /** @class */ (function () {
916
961
  widthCompare = rteWidth;
917
962
  }
918
963
  if (_this.resizeBtnStat.column) {
919
- var width = parseFloat(_this.columnEle.offsetWidth.toString());
964
+ var colGroup = _this.curTable.querySelectorAll('colgroup > col');
920
965
  var cellRow = _this.curTable.rows[0].cells[0].nodeName === 'TH' ? 1 : 0;
921
966
  var currentTableWidth = void 0;
922
967
  if (_this.curTable.style.width !== '' && _this.curTable.style.width.includes('%')) {
@@ -969,98 +1014,36 @@ var Table = /** @class */ (function () {
969
1014
  }
970
1015
  }
971
1016
  else {
972
- var cellColl = _this.curTable.rows[_this.calMaxCol(_this.curTable)].cells;
973
- var actualwid = width - mouseX;
974
- var totalwid = parseFloat(_this.columnEle.offsetWidth.toString()) +
975
- parseFloat(cellColl[_this.colIndex - 1].offsetWidth.toString());
976
- for (var i = 0; i < _this.curTable.rows.length; i++) {
977
- var currentRow = _this.curTable.rows[i];
978
- if ((totalwid - actualwid) > 20 && actualwid > 20) {
979
- var leftColumnWidth = totalwid - actualwid;
980
- var rightColWidth = actualwid;
981
- var index = void 0;
982
- var isMergedEleResize = false;
983
- var leftTableCell = void 0;
984
- var rightTableCell = void 0;
985
- isColCellsMerged = false;
986
- isRowCellsMerged = false;
987
- /* eslint-disable */
988
- for (var j = 0; j < currentRow.cells.length; j++) {
989
- if (currentRow.cells[j].hasAttribute('rowspan') && j <= _this.colIndex) {
990
- isRowCellsMerged = true;
991
- mergedCellIndex = i;
992
- mergedElement = currentRow.cells[j];
993
- }
994
- else if (currentRow.cells[j].hasAttribute('colspan') && j <= currentRow.cells.length) {
995
- isColCellsMerged = true;
996
- mergedCellIndex = i;
997
- mergedElement = currentRow.cells[j];
998
- }
999
- }
1000
- if (!isNOU(currentRow.cells[i]) && currentRow.cells[i].hasAttribute('colspan')) {
1001
- index = parseInt(currentRow.cells[i].getAttribute('colspan'), 10) - 1;
1002
- }
1003
- else {
1004
- index = _this.colIndex;
1005
- }
1006
- if (isRowCellsMerged || isColCellsMerged) {
1007
- var currentResizeRow = void 0;
1008
- if (currentRow.cells.length < cellColl.length) {
1009
- index = currentRow.cells.length === _this.colIndex || currentRow === _this.curTable.rows[_this.curTable.rows.length - 1] ?
1010
- _this.colIndex - 1 : _this.colIndex;
1011
- currentResizeRow = _this.curTable.rows[!isNullOrUndefined(mergedCellIndex) ?
1012
- mergedCellIndex : _this.colIndex - 1];
1013
- if (currentResizeRow && currentResizeRow !== currentRow && (currentResizeRow.cells[_this.colIndex - 1] === mergedElement ||
1014
- currentResizeRow.cells[currentResizeRow.cells.length - 1] === mergedElement)) {
1015
- isMergedEleResize = true;
1016
- }
1017
- else {
1018
- isMergedEleResize = false;
1019
- }
1020
- }
1021
- else {
1022
- index = _this.colIndex;
1023
- }
1024
- leftTableCell = !isMergedEleResize ? currentRow.cells[index - 1] : (currentResizeRow &&
1025
- currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement) ?
1026
- currentResizeRow.cells[_this.colIndex - 1] : currentRow.cells[currentRow.cells.length - 1];
1027
- rightTableCell = !isMergedEleResize ? currentRow.cells[index] : rightTableCell && rightTableCell.hasAttribute('rowspan') ?
1028
- currentResizeRow.cells[_this.colIndex] : currentResizeRow && currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement ?
1029
- currentRow.cells[index - 1] : currentResizeRow.cells[currentResizeRow.cells.length - 1];
1030
- }
1031
- if (!isNOU(currentRow.cells[index - 1]) && !isRowCellsMerged && !isColCellsMerged) {
1032
- currentRow.cells[index - 1].style.width =
1033
- _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
1034
- }
1035
- else {
1036
- if (leftTableCell) {
1037
- leftTableCell.style.width =
1038
- _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
1039
- }
1040
- }
1041
- if (!isNOU(currentRow.cells[index]) && !isRowCellsMerged && !isColCellsMerged) {
1042
- currentRow.cells[index].style.width =
1043
- _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
1044
- }
1045
- else {
1046
- if (rightTableCell) {
1047
- rightTableCell.style.width =
1048
- _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
1049
- }
1050
- }
1051
- /* eslint-enable */
1052
- }
1017
+ var actualwid = colGroup[_this.colIndex].offsetWidth - mouseX;
1018
+ // eslint-disable-next-line
1019
+ var totalwid = colGroup[_this.colIndex].offsetWidth + colGroup[_this.colIndex - 1].offsetWidth;
1020
+ if ((totalwid - actualwid) > 20 && actualwid > 20) {
1021
+ var leftColumnWidth = totalwid - actualwid;
1022
+ var rightColWidth = actualwid;
1023
+ colGroup[_this.colIndex - 1].style.width = _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
1024
+ colGroup[_this.colIndex].style.width = _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
1053
1025
  }
1054
1026
  }
1055
1027
  _this.updateHelper();
1056
1028
  }
1057
1029
  else if (_this.resizeBtnStat.row) {
1058
1030
  _this.parent.preventDefaultResize(e);
1059
- var height = parseFloat(_this.rowEle.clientHeight.toString()) + mouseY;
1060
- if (height > 20) {
1061
- _this.rowEle.style.height = height + 'px';
1031
+ var tableTrElementPixel = [];
1032
+ var currentTableTrElement = _this.curTable.querySelectorAll('tr');
1033
+ for (var i = 0; i < currentTableTrElement.length; i++) {
1034
+ if (_this.rowEle !== currentTableTrElement[i]) {
1035
+ tableTrElementPixel[i] = (parseFloat(currentTableTrElement[i].clientHeight.toString()));
1036
+ }
1037
+ }
1038
+ _this.curTable.style.height = (parseFloat(_this.curTable.clientHeight.toString()) + mouseY) + 'px';
1039
+ for (var i = 0; i < currentTableTrElement.length; i++) {
1040
+ if (_this.rowEle === currentTableTrElement[i]) {
1041
+ currentTableTrElement[i].style.height = (parseFloat(currentTableTrElement[i].clientHeight.toString()) + mouseY) + 'px';
1042
+ }
1043
+ else {
1044
+ currentTableTrElement[i].style.height = tableTrElementPixel[i] + 'px';
1045
+ }
1062
1046
  }
1063
- _this.curTable.style.height = '';
1064
1047
  if (!isNOU(tableReBox)) {
1065
1048
  tableReBox.style.cssText = 'top: ' + (_this.calcPos(_this.curTable).top + tableHeight - 4) +
1066
1049
  'px; left:' + (_this.calcPos(_this.curTable).left + tableWidth - 4) + 'px;';
@@ -1123,9 +1106,34 @@ var Table = /** @class */ (function () {
1123
1106
  detach(this.helper);
1124
1107
  this.helper = null;
1125
1108
  }
1109
+ var colHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-column-helper');
1110
+ Array.from(colHelper).forEach(function (element) {
1111
+ if (element.parentNode) {
1112
+ element.parentNode.removeChild(element);
1113
+ }
1114
+ });
1115
+ for (var i = 0; i < this.curTable.rows.length; i++) {
1116
+ for (var k = 0; k < this.curTable.rows[i].cells.length; k++) {
1117
+ var width = this.convertPixelToPercentage(this.curTable.rows[i].cells[k].offsetWidth, parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
1118
+ this.curTable.rows[i].cells[k].style.width = width;
1119
+ }
1120
+ }
1121
+ var colGroup = this.curTable.querySelector('colgroup');
1122
+ if (colGroup) {
1123
+ this.curTable.removeChild(colGroup);
1124
+ }
1126
1125
  this.pageX = null;
1127
1126
  this.pageY = null;
1128
1127
  this.moveEle = null;
1128
+ var currentTableTrElement = this.curTable.querySelectorAll("tr");
1129
+ var tableTrPercentage = [];
1130
+ for (var i = 0; i < currentTableTrElement.length; i++) {
1131
+ var percentage = (parseFloat(currentTableTrElement[i].clientHeight.toString()) / parseFloat(this.curTable.clientHeight.toString())) * 100;
1132
+ tableTrPercentage[i] = percentage;
1133
+ }
1134
+ for (var i = 0; i < currentTableTrElement.length; i++) {
1135
+ currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
1136
+ }
1129
1137
  var args = { event: e, requestType: 'table' };
1130
1138
  this.parent.trigger(events.resizeStop, args);
1131
1139
  this.parent.formatter.saveData();
@@ -23,6 +23,7 @@ export declare class Video {
23
23
  private isAllowedTypes;
24
24
  private pageX;
25
25
  private pageY;
26
+ private mouseX;
26
27
  private dialogRenderObj;
27
28
  private deletedVid;
28
29
  private changedWidthValue;
@@ -51,6 +52,7 @@ export declare class Video {
51
52
  private vidResizePos;
52
53
  private calcPos;
53
54
  private setAspectRatio;
55
+ private updateVidEleWidth;
54
56
  private pixToPerc;
55
57
  private vidDupMouseMove;
56
58
  private resizing;
@@ -13,6 +13,7 @@ var Video = /** @class */ (function () {
13
13
  this.isAllowedTypes = true;
14
14
  this.pageX = null;
15
15
  this.pageY = null;
16
+ this.mouseX = null;
16
17
  this.deletedVid = [];
17
18
  this.parent = parent;
18
19
  this.rteID = parent.element.id;
@@ -412,62 +413,50 @@ var Video = /** @class */ (function () {
412
413
  if (isNullOrUndefined(vidEleStyle)) {
413
414
  return;
414
415
  }
415
- // eslint-disable-next-line
416
+ /* eslint-disable */
416
417
  var width = vidEleStyle.width !== '' ? vidEleStyle.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(vidEleStyle.width) :
417
418
  parseInt(vidEleStyle.width, 10) : vid.style.width !== '' ? vid.style.width : vid.width;
418
419
  var height = vidEleStyle.height !== '' ? parseInt(vidEleStyle.height, 10) : vid.style.height !== '' ? vid.style.height : vid.height;
420
+ width = width.toString().match(/\b\d+(\.\d*)?(%|$)\b/g) ? parseFloat(width.toString()) : parseInt(width.toString(), 10);
421
+ height = height.toString().match(/\b\d+(\.\d*)?(%|$)\b/g) ? parseFloat(height.toString()) : parseInt(height.toString(), 10);
422
+ /* eslint-enable */
419
423
  if (width > height) {
420
424
  vid.style.minWidth = this.parent.insertVideoSettings.minWidth === 0 ? '200px' : formatUnit(this.parent.insertVideoSettings.minWidth);
421
425
  vid.style.minHeight = this.parent.insertVideoSettings.minHeight === 0 ? '90px' : formatUnit(this.parent.insertVideoSettings.minHeight);
422
426
  if (this.parent.insertVideoSettings.resizeByPercent) {
423
- if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
424
- var percentageValue = this.pixToPerc((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY), (vid.previousElementSibling || vid.parentElement));
425
- vid.style.width = Math.min(Math.round((percentageValue / vid.getBoundingClientRect().width) * expectedX * 100) / 100, 100) + '%';
426
- }
427
- else {
428
- vid.style.width = this.pixToPerc(parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY, (vid.previousElementSibling || vid.parentElement)) + '%';
429
- }
430
- vid.style.height = null;
431
- vid.removeAttribute('height');
427
+ this.updateVidEleWidth(vid, width, height, expectedX, expectedY);
432
428
  }
433
429
  else if ((vid.style.width === '' && vid.style.height !== '') || (vidEleStyle.width === '' && vidEleStyle.height !== '')) {
434
430
  vid.style.height = expectedY + 'px';
435
431
  }
436
432
  else if ((vid.style.width !== '' && vid.style.height === '') || (vidEleStyle.width !== '' && vidEleStyle.height === '')) {
437
- var currentWidth = ((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) +
438
- parseInt(width.toString(), 10) / parseInt(height.toString(), 10)) <
433
+ var currentWidth = ((width / height * expectedY) +
434
+ width / height) <
439
435
  (this.parent.inputElement.getBoundingClientRect().right - 32) ?
440
- ((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) +
441
- parseInt(width.toString(), 10) / parseInt(height.toString(), 10)) :
436
+ ((width / height * expectedY) +
437
+ width / height) :
442
438
  (this.parent.inputElement.getBoundingClientRect().right - 32);
443
439
  vid.style.width = currentWidth.toString() + 'px';
444
440
  }
445
441
  else if (vid.style.width !== '' || vidEleStyle.width !== '') {
446
- var currentWidth = (parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) <
442
+ var currentWidth = (width / height * expectedY) <
447
443
  (this.parent.inputElement.getBoundingClientRect().right - 32) ?
448
- (parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) :
444
+ (width / height * expectedY) :
449
445
  (this.parent.inputElement.getBoundingClientRect().right - 32);
450
446
  vid.style.width = currentWidth + 'px';
451
447
  vid.style.height = expectedY + 'px';
452
448
  }
453
449
  else {
454
- vid.setAttribute('width', (parseInt(((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) + parseInt(width.toString(), 10) / parseInt(height.toString(), 10)).toString(), 10)).toString());
450
+ vid.setAttribute('width', (parseInt(((width / height * expectedY) + width / height).toString(), 10)).toString());
455
451
  }
456
452
  }
457
453
  else if (height > width) {
458
454
  if (this.parent.insertVideoSettings.resizeByPercent) {
459
- if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
460
- vid.style.width = Math.min(Math.round((parseInt(width.toString(), 10) / vid.getBoundingClientRect().width) * expectedX * 100) / 100, 100) + '%';
461
- }
462
- else {
463
- vid.style.width = this.pixToPerc((expectedX / parseInt(height.toString(), 10) * expectedY), (vid.previousElementSibling || vid.parentElement)) + '%';
464
- }
465
- vid.style.height = null;
466
- vid.removeAttribute('height');
455
+ this.updateVidEleWidth(vid, width, height, expectedX, expectedY);
467
456
  }
468
457
  else if (vid.style.width !== '' || vidEleStyle.width !== '') {
469
458
  vid.style.width = expectedX + 'px';
470
- vid.style.height = (parseInt(height.toString(), 10) / parseInt(width.toString(), 10) * expectedX) + 'px';
459
+ vid.style.height = (height / width * expectedX) + 'px';
471
460
  }
472
461
  else {
473
462
  vid.setAttribute('width', this.resizeBtnStat.botRight ? (this.getPointX(e.event) - vid.getBoundingClientRect().left).toString() : expectedX.toString());
@@ -485,6 +474,23 @@ var Video = /** @class */ (function () {
485
474
  }
486
475
  }
487
476
  };
477
+ Video.prototype.updateVidEleWidth = function (vid, width, height, expectedX, expectedY) {
478
+ if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
479
+ var original = vid.offsetWidth + this.mouseX;
480
+ var finalWidthByPerc = (original / vid.offsetWidth) * (parseFloat(vid.style.width).toString() === 'NaN' ? (vid.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) : parseFloat(vid.style.width));
481
+ vid.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
482
+ }
483
+ else {
484
+ if (width > height) {
485
+ vid.style.width = this.pixToPerc(width / height * expectedY, (vid.previousElementSibling || vid.parentElement)) + '%';
486
+ }
487
+ else {
488
+ vid.style.width = this.pixToPerc((expectedX / height * expectedY), (vid.previousElementSibling || vid.parentElement)) + '%';
489
+ }
490
+ }
491
+ vid.style.height = null;
492
+ vid.removeAttribute('height');
493
+ };
488
494
  Video.prototype.pixToPerc = function (expected, parentEle) {
489
495
  return expected / parseFloat(getComputedStyle(parentEle).width) * 100;
490
496
  };
@@ -526,6 +532,7 @@ var Video = /** @class */ (function () {
526
532
  var height = parseInt(this.vidDupPos.height, 10) + mouseY;
527
533
  this.pageX = pageX;
528
534
  this.pageY = pageY;
535
+ this.mouseX = mouseX;
529
536
  if (this.resizeBtnStat.botRight) {
530
537
  this.vidDupMouseMove(width + 'px', height + 'px', e);
531
538
  }
@@ -90,6 +90,9 @@ var NodeSelection = /** @class */ (function () {
90
90
  || this.isChildNode(nodeCollection, startNode))) {
91
91
  return null;
92
92
  }
93
+ if (startNode.nodeType === 3 && startNode.previousSibling === endNode && endNode.nodeName === 'IMG') {
94
+ return null;
95
+ }
93
96
  if (nodeCollection.indexOf(startNode.firstChild) === -1 && startNode.firstChild && !this.isChildNode(nodeCollection, startNode)) {
94
97
  return startNode.firstChild;
95
98
  }
@@ -533,6 +533,14 @@
533
533
  .e-richtexteditor.e-bigger .e-rte-content .e-content {
534
534
  font-size: 16px;
535
535
  }
536
+ .e-bigger .e-richtexteditor .e-dialog .e-img-uploadwrap.e-droparea .e-browsebtn,
537
+ .e-bigger .e-richtexteditor .e-dialog .e-aud-uploadwrap.e-droparea .e-browsebtn,
538
+ .e-bigger .e-richtexteditor .e-dialog .e-vid-uploadwrap.e-droparea .e-browsebtn,
539
+ .e-richtexteditor.e-bigger .e-dialog .e-img-uploadwrap.e-droparea .e-browsebtn,
540
+ .e-richtexteditor.e-bigger .e-dialog .e-aud-uploadwrap.e-droparea .e-browsebtn,
541
+ .e-richtexteditor.e-bigger .e-dialog .e-vid-uploadwrap.e-droparea .e-browsebtn {
542
+ top: -120px;
543
+ }
536
544
 
537
545
  .e-richtexteditor {
538
546
  color: #f0f0f0;
@@ -1172,6 +1180,8 @@
1172
1180
  .e-rte-image.e-imginline,
1173
1181
  .e-rte-audio.e-audio-inline,
1174
1182
  .e-rte-video.e-video-inline {
1183
+ margin-left: 5px;
1184
+ margin-right: 5px;
1175
1185
  display: inline-block;
1176
1186
  float: none;
1177
1187
  max-width: calc(100% - 10px);
@@ -1229,19 +1239,19 @@
1229
1239
  }
1230
1240
 
1231
1241
  .e-rte-img-caption.e-imgcenter {
1232
- display: block;
1242
+ display: contents;
1233
1243
  margin-left: auto;
1234
1244
  margin-right: auto;
1235
1245
  }
1236
1246
 
1237
1247
  .e-rte-img-caption.e-imgright {
1238
- display: block;
1248
+ display: contents;
1239
1249
  margin-left: auto;
1240
1250
  margin-right: 0;
1241
1251
  }
1242
1252
 
1243
1253
  .e-rte-img-caption.e-imgleft {
1244
- display: block;
1254
+ display: contents;
1245
1255
  margin-left: 0;
1246
1256
  margin-right: auto;
1247
1257
  }
@@ -1258,7 +1268,7 @@
1258
1268
  }
1259
1269
 
1260
1270
  .e-img-caption.e-rte-img-caption.e-imgbreak {
1261
- display: block;
1271
+ display: contents;
1262
1272
  }
1263
1273
 
1264
1274
  .e-rte-table {
@@ -1443,13 +1453,13 @@
1443
1453
  margin: 0 auto;
1444
1454
  padding: 0 18px;
1445
1455
  position: relative;
1446
- top: -50px;
1456
+ top: -120px;
1447
1457
  }
1448
1458
  .e-richtexteditor .e-dialog .e-vid-uploadwrap.e-droparea .e-browsebtn,
1449
1459
  .e-richtexteditor .e-rte-video-dialog.e-dialog.e-device.e-dlg-modal .e-vid-uploadwrap.e-droparea .e-browsebtn,
1450
1460
  .e-rte-elements .e-dialog .e-vid-uploadwrap.e-droparea .e-browsebtn,
1451
1461
  .e-rte-elements .e-rte-video-dialog.e-dialog.e-device.e-dlg-modal .e-vid-uploadwrap.e-droparea .e-browsebtn {
1452
- top: -130px;
1462
+ top: -120px;
1453
1463
  }
1454
1464
  .e-richtexteditor .e-dialog.e-device.e-dlg-modal .e-img-uploadwrap.e-droparea .e-browsebtn,
1455
1465
  .e-richtexteditor .e-dialog.e-device.e-dlg-modal .e-aud-uploadwrap.e-droparea .e-browsebtn,
@@ -2606,7 +2616,7 @@
2606
2616
  margin: 0 auto;
2607
2617
  padding: 0 18px;
2608
2618
  position: relative;
2609
- top: -50px;
2619
+ top: -120px;
2610
2620
  }
2611
2621
  .e-rte-elements.e-dialog .e-vid-uploadwrap.e-droparea .e-browsebtn,
2612
2622
  .e-rte-elements.e-dialog .e-rte-video-dialog.e-dialog.e-device.e-dlg-modal .e-vid-uploadwrap.e-droparea .e-browsebtn {
@@ -2955,14 +2965,20 @@
2955
2965
  display: block;
2956
2966
  font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif, "-apple-system", "BlinkMacSystemFont";
2957
2967
  font-size: 14px;
2958
- height: 185px;
2968
+ height: 128px;
2959
2969
  margin: 0 auto;
2960
2970
  text-align: center;
2961
2971
  width: auto;
2962
2972
  }
2963
2973
 
2964
2974
  .e-dialog .e-vid-uploadwrap .e-droptext {
2965
- height: 108px;
2975
+ height: 128px;
2976
+ }
2977
+
2978
+ .e-bigger .e-richtexteditor .e-dialog .e-img-uploadwrap .e-droptext,
2979
+ .e-bigger .e-richtexteditor .e-dialog .e-aud-uploadwrap .e-droptext,
2980
+ .e-bigger .e-richtexteditor .e-dialog .e-vid-uploadwrap .e-droptext {
2981
+ height: 140px;
2966
2982
  }
2967
2983
 
2968
2984
  .e-dialog.e-device.e-dlg-modal .e-img-uploadwrap .e-droptext,
@@ -674,6 +674,14 @@
674
674
  .e-richtexteditor.e-bigger .e-rte-content .e-content {
675
675
  font-size: 16px;
676
676
  }
677
+ .e-bigger .e-richtexteditor .e-dialog .e-img-uploadwrap.e-droparea .e-browsebtn,
678
+ .e-bigger .e-richtexteditor .e-dialog .e-aud-uploadwrap.e-droparea .e-browsebtn,
679
+ .e-bigger .e-richtexteditor .e-dialog .e-vid-uploadwrap.e-droparea .e-browsebtn,
680
+ .e-richtexteditor.e-bigger .e-dialog .e-img-uploadwrap.e-droparea .e-browsebtn,
681
+ .e-richtexteditor.e-bigger .e-dialog .e-aud-uploadwrap.e-droparea .e-browsebtn,
682
+ .e-richtexteditor.e-bigger .e-dialog .e-vid-uploadwrap.e-droparea .e-browsebtn {
683
+ top: -120px;
684
+ }
677
685
 
678
686
  .e-richtexteditor {
679
687
  color: #333;
@@ -1313,6 +1321,8 @@
1313
1321
  .e-rte-image.e-imginline,
1314
1322
  .e-rte-audio.e-audio-inline,
1315
1323
  .e-rte-video.e-video-inline {
1324
+ margin-left: 5px;
1325
+ margin-right: 5px;
1316
1326
  display: inline-block;
1317
1327
  float: none;
1318
1328
  max-width: calc(100% - 10px);
@@ -1370,19 +1380,19 @@
1370
1380
  }
1371
1381
 
1372
1382
  .e-rte-img-caption.e-imgcenter {
1373
- display: block;
1383
+ display: contents;
1374
1384
  margin-left: auto;
1375
1385
  margin-right: auto;
1376
1386
  }
1377
1387
 
1378
1388
  .e-rte-img-caption.e-imgright {
1379
- display: block;
1389
+ display: contents;
1380
1390
  margin-left: auto;
1381
1391
  margin-right: 0;
1382
1392
  }
1383
1393
 
1384
1394
  .e-rte-img-caption.e-imgleft {
1385
- display: block;
1395
+ display: contents;
1386
1396
  margin-left: 0;
1387
1397
  margin-right: auto;
1388
1398
  }
@@ -1399,7 +1409,7 @@
1399
1409
  }
1400
1410
 
1401
1411
  .e-img-caption.e-rte-img-caption.e-imgbreak {
1402
- display: block;
1412
+ display: contents;
1403
1413
  }
1404
1414
 
1405
1415
  .e-rte-table {
@@ -1584,13 +1594,13 @@
1584
1594
  margin: 0 auto;
1585
1595
  padding: 0 18px;
1586
1596
  position: relative;
1587
- top: -50px;
1597
+ top: -120px;
1588
1598
  }
1589
1599
  .e-richtexteditor .e-dialog .e-vid-uploadwrap.e-droparea .e-browsebtn,
1590
1600
  .e-richtexteditor .e-rte-video-dialog.e-dialog.e-device.e-dlg-modal .e-vid-uploadwrap.e-droparea .e-browsebtn,
1591
1601
  .e-rte-elements .e-dialog .e-vid-uploadwrap.e-droparea .e-browsebtn,
1592
1602
  .e-rte-elements .e-rte-video-dialog.e-dialog.e-device.e-dlg-modal .e-vid-uploadwrap.e-droparea .e-browsebtn {
1593
- top: -130px;
1603
+ top: -120px;
1594
1604
  }
1595
1605
  .e-richtexteditor .e-dialog.e-device.e-dlg-modal .e-img-uploadwrap.e-droparea .e-browsebtn,
1596
1606
  .e-richtexteditor .e-dialog.e-device.e-dlg-modal .e-aud-uploadwrap.e-droparea .e-browsebtn,
@@ -2752,7 +2762,7 @@
2752
2762
  margin: 0 auto;
2753
2763
  padding: 0 18px;
2754
2764
  position: relative;
2755
- top: -50px;
2765
+ top: -120px;
2756
2766
  }
2757
2767
  .e-rte-elements.e-dialog .e-vid-uploadwrap.e-droparea .e-browsebtn,
2758
2768
  .e-rte-elements.e-dialog .e-rte-video-dialog.e-dialog.e-device.e-dlg-modal .e-vid-uploadwrap.e-droparea .e-browsebtn {
@@ -3101,14 +3111,20 @@
3101
3111
  display: block;
3102
3112
  font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif, "-apple-system", "BlinkMacSystemFont";
3103
3113
  font-size: 14px;
3104
- height: 185px;
3114
+ height: 128px;
3105
3115
  margin: 0 auto;
3106
3116
  text-align: center;
3107
3117
  width: auto;
3108
3118
  }
3109
3119
 
3110
3120
  .e-dialog .e-vid-uploadwrap .e-droptext {
3111
- height: 108px;
3121
+ height: 128px;
3122
+ }
3123
+
3124
+ .e-bigger .e-richtexteditor .e-dialog .e-img-uploadwrap .e-droptext,
3125
+ .e-bigger .e-richtexteditor .e-dialog .e-aud-uploadwrap .e-droptext,
3126
+ .e-bigger .e-richtexteditor .e-dialog .e-vid-uploadwrap .e-droptext {
3127
+ height: 140px;
3112
3128
  }
3113
3129
 
3114
3130
  .e-dialog.e-device.e-dlg-modal .e-img-uploadwrap .e-droptext,