@syncfusion/ej2-richtexteditor 22.1.34 → 22.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13548,7 +13548,8 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13548
13548
  InsertHtml.findDetachEmptyElem = function (element) {
13549
13549
  var removableElement;
13550
13550
  if (!isNullOrUndefined(element.parentElement)) {
13551
- if (element.parentElement.textContent.trim() === '' && element.parentElement.contentEditable !== 'true') {
13551
+ if (element.parentElement.textContent.trim() === '' && element.parentElement.contentEditable !== 'true' &&
13552
+ isNullOrUndefined(element.parentElement.querySelector('img'))) {
13552
13553
  removableElement = this.findDetachEmptyElem(element.parentElement);
13553
13554
  }
13554
13555
  else {
@@ -18881,7 +18882,7 @@ var FormatPainterActions = /** @__PURE__ @class */ (function () {
18881
18882
  var classLength = classes.length;
18882
18883
  for (var k = 0; k < classLength; k++) {
18883
18884
  if (elementsList[j].classList.contains(classes[k])) {
18884
- removeClass([elementsList[j]], classes[k]);
18885
+ removeClass([elementsList[j]], classes[k].trim());
18885
18886
  }
18886
18887
  }
18887
18888
  if (elementsList[j].classList.length === 0) {
@@ -18892,7 +18893,7 @@ var FormatPainterActions = /** @__PURE__ @class */ (function () {
18892
18893
  var styles = deniedPropArray[i].styles;
18893
18894
  var styleLength = styles.length;
18894
18895
  for (var k = 0; k < styleLength; k++) {
18895
- elementsList[j].style.removeProperty(styles[k]);
18896
+ elementsList[j].style.removeProperty(styles[k].trim());
18896
18897
  }
18897
18898
  if (elementsList[j].style.length === 0) {
18898
18899
  elementsList[j].removeAttribute('style');
@@ -18902,7 +18903,7 @@ var FormatPainterActions = /** @__PURE__ @class */ (function () {
18902
18903
  var attributes$$1 = deniedPropArray[i].attributes;
18903
18904
  var attributeLength = attributes$$1.length;
18904
18905
  for (var k = 0; k < attributeLength; k++) {
18905
- elementsList[j].removeAttribute(attributes$$1[k]);
18906
+ elementsList[j].removeAttribute(attributes$$1[k].trim());
18906
18907
  }
18907
18908
  }
18908
18909
  }
@@ -19345,7 +19346,7 @@ var FormatPainterActions = /** @__PURE__ @class */ (function () {
19345
19346
  min = Math.min(openIndexArray[0], openIndexArray[1], openIndexArray[2]);
19346
19347
  }
19347
19348
  tagName = value.substring(0, min);
19348
- tagName.trim();
19349
+ tagName = tagName.trim();
19349
19350
  return ({
19350
19351
  tag: tagName, styles: stylesList, classes: classList,
19351
19352
  attributes: attributesList
@@ -19871,7 +19872,8 @@ var XhtmlValidation = /** @__PURE__ @class */ (function () {
19871
19872
  * @deprecated
19872
19873
  */
19873
19874
  XhtmlValidation.prototype.selfEncloseValidation = function (currentValue, valueLength) {
19874
- if (valueLength === 0 && currentValue.indexOf('table') < 0 && currentValue.indexOf('img') < 0) {
19875
+ if (valueLength === 0 && currentValue.indexOf('table') < 0 && currentValue.indexOf('img') < 0 &&
19876
+ currentValue !== '<p><br></p>' && currentValue !== '<div><br></div>' && currentValue !== '<br>') {
19875
19877
  var arrayValue = currentValue.split('&nbsp;');
19876
19878
  arrayValue[arrayValue.length - 1] = '&#8203;' + arrayValue[arrayValue.length - 1];
19877
19879
  currentValue = arrayValue.join('');
@@ -22442,10 +22444,17 @@ var FormatPainter = /** @__PURE__ @class */ (function () {
22442
22444
  this.parent.on(keyDown, this.onKeyDown, this);
22443
22445
  this.parent.on(destroy, this.destroy, this);
22444
22446
  };
22445
- FormatPainter.prototype.toolbarClick = function (args) {
22446
- this.isActive = true;
22447
+ FormatPainter.prototype.toolbarClick = function (clickargs) {
22447
22448
  this.parent.focusIn();
22448
- this.actionHandler(args, 'click');
22449
+ if (!this.isSticky) {
22450
+ this.isActive = true;
22451
+ this.actionHandler(clickargs, 'click');
22452
+ }
22453
+ else {
22454
+ // Handling the format painter double click toolbar esape action
22455
+ clickargs.args.action = 'escape';
22456
+ this.actionHandler(clickargs, 'keyBoard');
22457
+ }
22449
22458
  };
22450
22459
  FormatPainter.prototype.toolbarDoubleClick = function (args) {
22451
22460
  this.isActive = true;
@@ -29734,6 +29743,9 @@ var Table = /** @__PURE__ @class */ (function () {
29734
29743
  var maxiumWidth;
29735
29744
  var currentTdElement = this.curTable.closest('td');
29736
29745
  var args = { event: e, requestType: 'table' };
29746
+ var isRowCellsMerged = false;
29747
+ var mergedCellIndex;
29748
+ var mergedElement;
29737
29749
  this.parent.trigger(onResize, args, function (resizingArgs) {
29738
29750
  if (resizingArgs.cancel) {
29739
29751
  _this.cancelResizeAction();
@@ -29798,7 +29810,8 @@ var Table = /** @__PURE__ @class */ (function () {
29798
29810
  var differenceWidth = currentTableWidth - _this.convertPixelToPercentage(tableWidth + mouseX, widthCompare);
29799
29811
  for (var i = 0; i < lastColumnsCell.length; i++) {
29800
29812
  if (_this.curTable.rows[i].cells[_this.colIndex]) {
29801
- _this.curTable.rows[i].cells[_this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
29813
+ _this.curTable.rows[i].cells[_this.curTable.rows[i].cells.length === _this.colIndex ?
29814
+ _this.colIndex - 1 : _this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
29802
29815
  }
29803
29816
  }
29804
29817
  }
@@ -29809,19 +29822,72 @@ var Table = /** @__PURE__ @class */ (function () {
29809
29822
  var totalwid = parseFloat(_this.columnEle.offsetWidth.toString()) +
29810
29823
  parseFloat(cellColl[_this.colIndex - 1].offsetWidth.toString());
29811
29824
  for (var i = 0; i < _this.curTable.rows.length; i++) {
29812
- if ((totalwid - actualwid) > 20 && actualwid > 20 && _this.curTable.rows[i].cells[i]) {
29825
+ var currentRow = _this.curTable.rows[i];
29826
+ if ((totalwid - actualwid) > 20 && actualwid > 20) {
29813
29827
  var leftColumnWidth = totalwid - actualwid;
29814
29828
  var rightColWidth = actualwid;
29815
- var index = _this.curTable.rows[i].cells[i].hasAttribute('colspan') ?
29816
- parseInt(_this.curTable.rows[i].cells[i].getAttribute('colspan'), 10) - 1 : _this.colIndex;
29817
- if (!isNullOrUndefined(_this.curTable.rows[i].cells[index - 1])) {
29818
- _this.curTable.rows[i].cells[index - 1].style.width =
29829
+ var index = void 0;
29830
+ var isMergedEleResize = false;
29831
+ var leftTableCell = void 0;
29832
+ var rightTableCell = void 0;
29833
+ for (var j = 0; j < currentRow.cells.length; j++) {
29834
+ if (currentRow.cells[j].hasAttribute('rowspan') && j <= _this.colIndex) {
29835
+ isRowCellsMerged = true;
29836
+ mergedCellIndex = i;
29837
+ mergedElement = currentRow.cells[j];
29838
+ }
29839
+ }
29840
+ if (!isNullOrUndefined(currentRow.cells[i]) && currentRow.cells[i].hasAttribute('colspan')) {
29841
+ index = parseInt(currentRow.cells[i].getAttribute('colspan'), 10) - 1;
29842
+ }
29843
+ else {
29844
+ index = _this.colIndex;
29845
+ }
29846
+ if (isRowCellsMerged) {
29847
+ var currentResizeRow = void 0;
29848
+ if (currentRow.cells.length < cellColl.length) {
29849
+ index = currentRow.cells.length === _this.colIndex ?
29850
+ _this.colIndex - 1 : _this.colIndex - (_this.colIndex - 1);
29851
+ currentResizeRow = _this.curTable.rows[!isNullOrUndefined(mergedCellIndex) ?
29852
+ mergedCellIndex : _this.colIndex - 1];
29853
+ if (currentResizeRow && (currentResizeRow.cells[_this.colIndex - 1] === mergedElement ||
29854
+ currentResizeRow.cells[currentResizeRow.cells.length - 1] === mergedElement)) {
29855
+ isMergedEleResize = true;
29856
+ }
29857
+ else {
29858
+ isMergedEleResize = false;
29859
+ }
29860
+ }
29861
+ else {
29862
+ index = _this.colIndex;
29863
+ }
29864
+ leftTableCell = !isMergedEleResize ? currentRow.cells[index - 1] : (currentResizeRow &&
29865
+ currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement) ?
29866
+ currentResizeRow.cells[_this.colIndex - 1] : currentRow.cells[currentRow.cells.length - 1];
29867
+ rightTableCell = !isMergedEleResize ? currentRow.cells[index] : rightTableCell && rightTableCell.hasAttribute('rowspan') ?
29868
+ rightTableCell : currentResizeRow && currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement ?
29869
+ currentRow.cells[index - 1] : currentResizeRow.cells[currentResizeRow.cells.length - 1];
29870
+ }
29871
+ if (!isNullOrUndefined(currentRow.cells[index - 1]) && !isRowCellsMerged) {
29872
+ currentRow.cells[index - 1].style.width =
29819
29873
  _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
29820
29874
  }
29821
- if (!isNullOrUndefined(_this.curTable.rows[i].cells[index])) {
29822
- _this.curTable.rows[i].cells[index].style.width =
29875
+ else {
29876
+ if (leftTableCell) {
29877
+ leftTableCell.style.width =
29878
+ _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
29879
+ }
29880
+ }
29881
+ if (!isNullOrUndefined(currentRow.cells[index]) && !isRowCellsMerged) {
29882
+ currentRow.cells[index].style.width =
29823
29883
  _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
29824
29884
  }
29885
+ else {
29886
+ if (rightTableCell) {
29887
+ rightTableCell.style.width =
29888
+ _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
29889
+ }
29890
+ }
29825
29891
  }
29826
29892
  }
29827
29893
  }
@@ -29845,8 +29911,8 @@ var Table = /** @__PURE__ @class */ (function () {
29845
29911
  EventHandler.remove(_this.contentModule.getEditPanel(), 'mouseover', _this.resizeHelper);
29846
29912
  }
29847
29913
  if (currentTdElement) {
29848
- // eslint-disable-next-line max-len
29849
- var tableBoxPosition = _this.curTable.getBoundingClientRect().left - currentTdElement.getBoundingClientRect().left;
29914
+ var tableBoxPosition = _this.curTable.getBoundingClientRect().left
29915
+ - currentTdElement.getBoundingClientRect().left;
29850
29916
  maxiumWidth = Math.abs(tableBoxPosition - currentTdElement.getBoundingClientRect().width) - 5;
29851
29917
  _this.curTable.style.maxWidth = maxiumWidth + 'px';
29852
29918
  }