@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.
@@ -13450,7 +13450,8 @@ class InsertHtml {
13450
13450
  static findDetachEmptyElem(element) {
13451
13451
  let removableElement;
13452
13452
  if (!isNullOrUndefined(element.parentElement)) {
13453
- if (element.parentElement.textContent.trim() === '' && element.parentElement.contentEditable !== 'true') {
13453
+ if (element.parentElement.textContent.trim() === '' && element.parentElement.contentEditable !== 'true' &&
13454
+ isNullOrUndefined(element.parentElement.querySelector('img'))) {
13454
13455
  removableElement = this.findDetachEmptyElem(element.parentElement);
13455
13456
  }
13456
13457
  else {
@@ -18749,7 +18750,7 @@ class FormatPainterActions {
18749
18750
  const classLength = classes.length;
18750
18751
  for (let k = 0; k < classLength; k++) {
18751
18752
  if (elementsList[j].classList.contains(classes[k])) {
18752
- removeClass([elementsList[j]], classes[k]);
18753
+ removeClass([elementsList[j]], classes[k].trim());
18753
18754
  }
18754
18755
  }
18755
18756
  if (elementsList[j].classList.length === 0) {
@@ -18760,7 +18761,7 @@ class FormatPainterActions {
18760
18761
  const styles = deniedPropArray[i].styles;
18761
18762
  const styleLength = styles.length;
18762
18763
  for (let k = 0; k < styleLength; k++) {
18763
- elementsList[j].style.removeProperty(styles[k]);
18764
+ elementsList[j].style.removeProperty(styles[k].trim());
18764
18765
  }
18765
18766
  if (elementsList[j].style.length === 0) {
18766
18767
  elementsList[j].removeAttribute('style');
@@ -18770,7 +18771,7 @@ class FormatPainterActions {
18770
18771
  const attributes$$1 = deniedPropArray[i].attributes;
18771
18772
  const attributeLength = attributes$$1.length;
18772
18773
  for (let k = 0; k < attributeLength; k++) {
18773
- elementsList[j].removeAttribute(attributes$$1[k]);
18774
+ elementsList[j].removeAttribute(attributes$$1[k].trim());
18774
18775
  }
18775
18776
  }
18776
18777
  }
@@ -19213,7 +19214,7 @@ class FormatPainterActions {
19213
19214
  min = Math.min(openIndexArray[0], openIndexArray[1], openIndexArray[2]);
19214
19215
  }
19215
19216
  tagName = value.substring(0, min);
19216
- tagName.trim();
19217
+ tagName = tagName.trim();
19217
19218
  return ({
19218
19219
  tag: tagName, styles: stylesList, classes: classList,
19219
19220
  attributes: attributesList
@@ -19798,7 +19799,8 @@ class XhtmlValidation {
19798
19799
  * @deprecated
19799
19800
  */
19800
19801
  selfEncloseValidation(currentValue, valueLength) {
19801
- if (valueLength === 0 && currentValue.indexOf('table') < 0 && currentValue.indexOf('img') < 0) {
19802
+ if (valueLength === 0 && currentValue.indexOf('table') < 0 && currentValue.indexOf('img') < 0 &&
19803
+ currentValue !== '<p><br></p>' && currentValue !== '<div><br></div>' && currentValue !== '<br>') {
19802
19804
  const arrayValue = currentValue.split('&nbsp;');
19803
19805
  arrayValue[arrayValue.length - 1] = '&#8203;' + arrayValue[arrayValue.length - 1];
19804
19806
  currentValue = arrayValue.join('');
@@ -22350,10 +22352,17 @@ class FormatPainter {
22350
22352
  this.parent.on(keyDown, this.onKeyDown, this);
22351
22353
  this.parent.on(destroy, this.destroy, this);
22352
22354
  }
22353
- toolbarClick(args) {
22354
- this.isActive = true;
22355
+ toolbarClick(clickargs) {
22355
22356
  this.parent.focusIn();
22356
- this.actionHandler(args, 'click');
22357
+ if (!this.isSticky) {
22358
+ this.isActive = true;
22359
+ this.actionHandler(clickargs, 'click');
22360
+ }
22361
+ else {
22362
+ // Handling the format painter double click toolbar esape action
22363
+ clickargs.args.action = 'escape';
22364
+ this.actionHandler(clickargs, 'keyBoard');
22365
+ }
22357
22366
  }
22358
22367
  toolbarDoubleClick(args) {
22359
22368
  this.isActive = true;
@@ -29599,6 +29608,9 @@ class Table {
29599
29608
  let maxiumWidth;
29600
29609
  const currentTdElement = this.curTable.closest('td');
29601
29610
  const args = { event: e, requestType: 'table' };
29611
+ let isRowCellsMerged = false;
29612
+ let mergedCellIndex;
29613
+ let mergedElement;
29602
29614
  this.parent.trigger(onResize, args, (resizingArgs) => {
29603
29615
  if (resizingArgs.cancel) {
29604
29616
  this.cancelResizeAction();
@@ -29663,7 +29675,8 @@ class Table {
29663
29675
  const differenceWidth = currentTableWidth - this.convertPixelToPercentage(tableWidth + mouseX, widthCompare);
29664
29676
  for (let i = 0; i < lastColumnsCell.length; i++) {
29665
29677
  if (this.curTable.rows[i].cells[this.colIndex]) {
29666
- this.curTable.rows[i].cells[this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
29678
+ this.curTable.rows[i].cells[this.curTable.rows[i].cells.length === this.colIndex ?
29679
+ this.colIndex - 1 : this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
29667
29680
  }
29668
29681
  }
29669
29682
  }
@@ -29674,19 +29687,72 @@ class Table {
29674
29687
  const totalwid = parseFloat(this.columnEle.offsetWidth.toString()) +
29675
29688
  parseFloat(cellColl[this.colIndex - 1].offsetWidth.toString());
29676
29689
  for (let i = 0; i < this.curTable.rows.length; i++) {
29677
- if ((totalwid - actualwid) > 20 && actualwid > 20 && this.curTable.rows[i].cells[i]) {
29690
+ const currentRow = this.curTable.rows[i];
29691
+ if ((totalwid - actualwid) > 20 && actualwid > 20) {
29678
29692
  const leftColumnWidth = totalwid - actualwid;
29679
29693
  const rightColWidth = actualwid;
29680
- const index = this.curTable.rows[i].cells[i].hasAttribute('colspan') ?
29681
- parseInt(this.curTable.rows[i].cells[i].getAttribute('colspan'), 10) - 1 : this.colIndex;
29682
- if (!isNullOrUndefined(this.curTable.rows[i].cells[index - 1])) {
29683
- this.curTable.rows[i].cells[index - 1].style.width =
29694
+ let index;
29695
+ let isMergedEleResize = false;
29696
+ let leftTableCell;
29697
+ let rightTableCell;
29698
+ for (let j = 0; j < currentRow.cells.length; j++) {
29699
+ if (currentRow.cells[j].hasAttribute('rowspan') && j <= this.colIndex) {
29700
+ isRowCellsMerged = true;
29701
+ mergedCellIndex = i;
29702
+ mergedElement = currentRow.cells[j];
29703
+ }
29704
+ }
29705
+ if (!isNullOrUndefined(currentRow.cells[i]) && currentRow.cells[i].hasAttribute('colspan')) {
29706
+ index = parseInt(currentRow.cells[i].getAttribute('colspan'), 10) - 1;
29707
+ }
29708
+ else {
29709
+ index = this.colIndex;
29710
+ }
29711
+ if (isRowCellsMerged) {
29712
+ let currentResizeRow;
29713
+ if (currentRow.cells.length < cellColl.length) {
29714
+ index = currentRow.cells.length === this.colIndex ?
29715
+ this.colIndex - 1 : this.colIndex - (this.colIndex - 1);
29716
+ currentResizeRow = this.curTable.rows[!isNullOrUndefined(mergedCellIndex) ?
29717
+ mergedCellIndex : this.colIndex - 1];
29718
+ if (currentResizeRow && (currentResizeRow.cells[this.colIndex - 1] === mergedElement ||
29719
+ currentResizeRow.cells[currentResizeRow.cells.length - 1] === mergedElement)) {
29720
+ isMergedEleResize = true;
29721
+ }
29722
+ else {
29723
+ isMergedEleResize = false;
29724
+ }
29725
+ }
29726
+ else {
29727
+ index = this.colIndex;
29728
+ }
29729
+ leftTableCell = !isMergedEleResize ? currentRow.cells[index - 1] : (currentResizeRow &&
29730
+ currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement) ?
29731
+ currentResizeRow.cells[this.colIndex - 1] : currentRow.cells[currentRow.cells.length - 1];
29732
+ rightTableCell = !isMergedEleResize ? currentRow.cells[index] : rightTableCell && rightTableCell.hasAttribute('rowspan') ?
29733
+ rightTableCell : currentResizeRow && currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement ?
29734
+ currentRow.cells[index - 1] : currentResizeRow.cells[currentResizeRow.cells.length - 1];
29735
+ }
29736
+ if (!isNullOrUndefined(currentRow.cells[index - 1]) && !isRowCellsMerged) {
29737
+ currentRow.cells[index - 1].style.width =
29684
29738
  this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
29685
29739
  }
29686
- if (!isNullOrUndefined(this.curTable.rows[i].cells[index])) {
29687
- this.curTable.rows[i].cells[index].style.width =
29740
+ else {
29741
+ if (leftTableCell) {
29742
+ leftTableCell.style.width =
29743
+ this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
29744
+ }
29745
+ }
29746
+ if (!isNullOrUndefined(currentRow.cells[index]) && !isRowCellsMerged) {
29747
+ currentRow.cells[index].style.width =
29688
29748
  this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
29689
29749
  }
29750
+ else {
29751
+ if (rightTableCell) {
29752
+ rightTableCell.style.width =
29753
+ this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
29754
+ }
29755
+ }
29690
29756
  }
29691
29757
  }
29692
29758
  }
@@ -29710,8 +29776,8 @@ class Table {
29710
29776
  EventHandler.remove(this.contentModule.getEditPanel(), 'mouseover', this.resizeHelper);
29711
29777
  }
29712
29778
  if (currentTdElement) {
29713
- // eslint-disable-next-line max-len
29714
- const tableBoxPosition = this.curTable.getBoundingClientRect().left - currentTdElement.getBoundingClientRect().left;
29779
+ const tableBoxPosition = this.curTable.getBoundingClientRect().left
29780
+ - currentTdElement.getBoundingClientRect().left;
29715
29781
  maxiumWidth = Math.abs(tableBoxPosition - currentTdElement.getBoundingClientRect().width) - 5;
29716
29782
  this.curTable.style.maxWidth = maxiumWidth + 'px';
29717
29783
  }