@syncfusion/ej2-richtexteditor 22.1.39 → 22.2.9

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.
@@ -10345,7 +10345,7 @@ var CLEAR_TYPE = 'clear-type';
10345
10345
  *
10346
10346
  * @hidden
10347
10347
  */
10348
- var SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td'];
10348
+ var SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td', 'table'];
10349
10349
 
10350
10350
  /**
10351
10351
  * `Selection` module is used to handle RTE Selections.
@@ -13129,6 +13129,14 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13129
13129
  nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
13130
13130
  range = nodeSelection.getRange(docElement);
13131
13131
  }
13132
+ if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
13133
+ range.startOffset === range.endOffset && editNode.textContent.trim().length > 0) {
13134
+ var focusNode = this.findFirstTextNode(range.startContainer);
13135
+ if (!isNullOrUndefined(focusNode)) {
13136
+ nodeSelection.setSelectionText(docElement, focusNode, focusNode, 0, 0);
13137
+ range = nodeSelection.getRange(docElement);
13138
+ }
13139
+ }
13132
13140
  if (range.startContainer.nodeName === 'BR' && range.startOffset === 0 && range.startOffset === range.endOffset &&
13133
13141
  range.startContainer === range.endContainer) {
13134
13142
  var currentIndex = Array.prototype.slice.call(range.startContainer.parentElement.childNodes).indexOf(range.startContainer);
@@ -13256,6 +13264,18 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13256
13264
  }
13257
13265
  }
13258
13266
  };
13267
+ InsertHtml.findFirstTextNode = function (node) {
13268
+ if (node.nodeType === Node.TEXT_NODE) {
13269
+ return node;
13270
+ }
13271
+ for (var i = 0; i < node.childNodes.length; i++) {
13272
+ var textNode = this.findFirstTextNode(node.childNodes[i]);
13273
+ if (!isNullOrUndefined(textNode)) {
13274
+ return textNode;
13275
+ }
13276
+ }
13277
+ return null;
13278
+ };
13259
13279
  InsertHtml.pasteInsertHTML = function (nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
13260
13280
  var isCursor = range.startOffset === range.endOffset &&
13261
13281
  range.startContainer === range.endContainer;
@@ -18269,6 +18289,10 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18269
18289
  else {
18270
18290
  //Add to support separate list which looks like same list and also to add all tags as it is inside list
18271
18291
  if (firstChild.childNodes.length > 0) {
18292
+ var listIgnoreTag = firstChild.querySelectorAll('[style*="mso-list"]');
18293
+ for (var i = 0; i < listIgnoreTag.length; i++) {
18294
+ listIgnoreTag[i].setAttribute('style', listIgnoreTag[i].getAttribute('style').replace(/\n/g, ""));
18295
+ }
18272
18296
  var listOrder = firstChild.querySelector('span[style="mso-list:Ignore"]');
18273
18297
  if (!isNullOrUndefined(listOrder)) {
18274
18298
  this.listContents.push(listOrder.textContent.trim());
@@ -20298,8 +20322,9 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
20298
20322
  currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH' &&
20299
20323
  isPreviousNotContentEditable) {
20300
20324
  var checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
20301
- if (!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
20302
- !isNullOrUndefined(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') {
20325
+ if ((!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
20326
+ !isNullOrUndefined(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') ||
20327
+ (!isNullOrUndefined(currentRange.startContainer.previousSibling) && currentRange.startContainer.previousSibling.nodeName === 'BR')) {
20303
20328
  return;
20304
20329
  }
20305
20330
  this.rangeElement = this.getRootBlockNode(currentRange.startContainer);
@@ -21513,6 +21538,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
21513
21538
  }
21514
21539
  this.parent.trigger(afterPasteCleanup, { value: clipBoardElem.innerHTML, filesData: filesData }, function (updatedArgs) { value = updatedArgs.value; });
21515
21540
  clipBoardElem.innerHTML = value;
21541
+ clipBoardElem = this.addTableClass(clipBoardElem);
21516
21542
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, function (returnArgs) {
21517
21543
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
21518
21544
  _this.parent.formatter.onSuccess(_this.parent, args);
@@ -21525,6 +21551,15 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
21525
21551
  }
21526
21552
  }
21527
21553
  };
21554
+ PasteCleanup.prototype.addTableClass = function (element) {
21555
+ var tableElement = element.querySelectorAll('table');
21556
+ for (var i = 0; i < tableElement.length; i++) {
21557
+ if (!tableElement[i].classList.contains('e-rte-table')) {
21558
+ tableElement[i].classList.add('e-rte-table');
21559
+ }
21560
+ }
21561
+ return element;
21562
+ };
21528
21563
  PasteCleanup.prototype.setImageProperties = function (allImg) {
21529
21564
  if (this.parent.insertImageSettings.width !== 'auto') {
21530
21565
  allImg.setAttribute('width', this.parent.insertImageSettings.width);
@@ -29781,7 +29816,13 @@ var Table = /** @__PURE__ @class */ (function () {
29781
29816
  if (_this.resizeBtnStat.column) {
29782
29817
  var width = parseFloat(_this.columnEle.offsetWidth.toString());
29783
29818
  var cellRow = _this.curTable.rows[0].cells[0].nodeName === 'TH' ? 1 : 0;
29784
- var currentTableWidth = parseFloat(_this.curTable.style.width.split('%')[0]);
29819
+ var currentTableWidth = void 0;
29820
+ if (_this.curTable.style.width != '') {
29821
+ currentTableWidth = parseFloat(_this.curTable.style.width.split('%')[0]);
29822
+ }
29823
+ else {
29824
+ currentTableWidth = _this.getCurrentTableWidth(_this.curTable.offsetWidth, _this.parent.inputElement.offsetWidth);
29825
+ }
29785
29826
  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]);
29786
29827
  if (_this.currentColumnResize === 'first') {
29787
29828
  mouseX = mouseX - 0.75; //This was done for to make the gripper and the table first/last column will be close.
@@ -29936,6 +29977,11 @@ var Table = /** @__PURE__ @class */ (function () {
29936
29977
  }
29937
29978
  });
29938
29979
  };
29980
+ Table.prototype.getCurrentTableWidth = function (tableWidth, parentWidth) {
29981
+ var currentTableWidth = 0;
29982
+ currentTableWidth = tableWidth / parentWidth * 100;
29983
+ return currentTableWidth;
29984
+ };
29939
29985
  Table.prototype.findFirstLastColCells = function (table, isFirst) {
29940
29986
  var resultColumns = [];
29941
29987
  var rows = table.querySelectorAll('tr');
@@ -33256,9 +33302,10 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
33256
33302
  if (!initial) {
33257
33303
  if (this.readonly && this.enabled) {
33258
33304
  this.unbindEvents();
33305
+ this.unWireEvents();
33259
33306
  }
33260
33307
  else if (this.enabled) {
33261
- this.bindEvents();
33308
+ this.wireEvents();
33262
33309
  }
33263
33310
  }
33264
33311
  };