@syncfusion/ej2-richtexteditor 20.4.50 → 20.4.52

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.
@@ -12747,8 +12747,8 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
12747
12747
  }
12748
12748
  if (range.startContainer.nodeName === 'BR' && range.startOffset === 0 && range.startOffset === range.endOffset &&
12749
12749
  range.startContainer === range.endContainer) {
12750
- var currentIndex = Array.prototype.slice.call(range.startContainer.parentElement.children).indexOf(range.startContainer);
12751
- nodeSelection.setSelectionText(docElement, range.startContainer.parentElement, range.startContainer.parentElement, currentIndex + 1, currentIndex + 1);
12750
+ var currentIndex = Array.prototype.slice.call(range.startContainer.parentElement.childNodes).indexOf(range.startContainer);
12751
+ nodeSelection.setSelectionText(docElement, range.startContainer.parentElement, range.startContainer.parentElement, currentIndex, currentIndex);
12752
12752
  range = nodeSelection.getRange(docElement);
12753
12753
  }
12754
12754
  var isCursor = range.startOffset === range.endOffset && range.startOffset === 0 &&
@@ -16968,7 +16968,10 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16968
16968
  this.checkVShape(elm);
16969
16969
  var imgElem = elm.querySelectorAll('img');
16970
16970
  for (var i = 0; i < imgElem.length; i++) {
16971
- if (!isNullOrUndefined(imgElem[i].getAttribute('v:shapes')) && imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 && imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0) {
16971
+ if (!isNullOrUndefined(imgElem[i].getAttribute('v:shapes')) &&
16972
+ imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 &&
16973
+ imgElem[i].getAttribute('v:shapes').indexOf('圖片') < 0 &&
16974
+ imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0) {
16972
16975
  detach(imgElem[i]);
16973
16976
  }
16974
16977
  }
@@ -18009,7 +18012,7 @@ var ToolbarStatus = /** @__PURE__ @class */ (function () {
18009
18012
  formatCollection.fontname = this.isFontName(docElement, node, fontName);
18010
18013
  }
18011
18014
  if (!formatCollection.fontsize) {
18012
- formatCollection.fontsize = this.isFontSize(node, fontSize);
18015
+ formatCollection.fontsize = this.isFontSize(docElement, node, fontSize);
18013
18016
  }
18014
18017
  if (!formatCollection.backgroundcolor) {
18015
18018
  formatCollection.backgroundcolor = this.isBackgroundColor(node);
@@ -18069,8 +18072,12 @@ var ToolbarStatus = /** @__PURE__ @class */ (function () {
18069
18072
  return null;
18070
18073
  }
18071
18074
  };
18072
- ToolbarStatus.isFontSize = function (node, fontSize) {
18075
+ ToolbarStatus.isFontSize = function (docElement, node, fontSize) {
18073
18076
  var size = node.style && node.style.fontSize;
18077
+ if ((size === null || size === undefined || size === '') && node.nodeType !== 3 &&
18078
+ node.parentElement.classList.contains('e-content')) {
18079
+ size = this.getComputedStyle(docElement, node, 'font-size');
18080
+ }
18074
18081
  if ((size !== null && size !== '' && size !== undefined)
18075
18082
  && (fontSize === null || fontSize === undefined || (fontSize.indexOf(size) > -1))) {
18076
18083
  return size;
@@ -18449,7 +18456,6 @@ var XhtmlValidation = /** @__PURE__ @class */ (function () {
18449
18456
  this.currentElement = this.parent.inputElement;
18450
18457
  }
18451
18458
  this.clean(this.currentElement);
18452
- this.AddRootElement();
18453
18459
  this.ImageTags();
18454
18460
  this.removeTags();
18455
18461
  this.RemoveUnsupported();
@@ -18496,16 +18502,6 @@ var XhtmlValidation = /** @__PURE__ @class */ (function () {
18496
18502
  }
18497
18503
  return currentValue;
18498
18504
  };
18499
- XhtmlValidation.prototype.AddRootElement = function () {
18500
- if ((this.currentElement.childNodes.length === 1 && this.currentElement.firstChild.nodeName !== 'DIV') ||
18501
- this.currentElement.childNodes.length > 1) {
18502
- var parentEle = this.parent.createElement('div');
18503
- while (this.currentElement.childNodes.length > 0) {
18504
- parentEle.appendChild(this.currentElement.childNodes[0]);
18505
- }
18506
- this.currentElement.appendChild(parentEle);
18507
- }
18508
- };
18509
18505
  XhtmlValidation.prototype.clean = function (node) {
18510
18506
  for (var n = 0; n < node.childNodes.length; n++) {
18511
18507
  var child = node.childNodes[n];
@@ -19930,7 +19926,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
19930
19926
  this.radioRender();
19931
19927
  /* eslint-disable */
19932
19928
  if (this.parent.element.offsetHeight < parseInt(this.dialogObj.height.split('px')[0], null)) {
19933
- this.parent.height = parseInt(this.dialogObj.height.split('px')[0], null) + 40;
19929
+ this.parent.setProperties({ height: parseInt(this.dialogObj.height.split('px')[0], null) + 40 });
19934
19930
  /* eslint-enable */
19935
19931
  isHeight = true;
19936
19932
  }
@@ -27353,12 +27349,14 @@ var Table = /** @__PURE__ @class */ (function () {
27353
27349
  if ((totalwid - actualwid) > 20 && actualwid > 20) {
27354
27350
  var leftColumnWidth = totalwid - actualwid;
27355
27351
  var rightColWidth = actualwid;
27356
- if (!isNullOrUndefined(_this.curTable.rows[i].cells[_this.colIndex - 1])) {
27357
- _this.curTable.rows[i].cells[_this.colIndex - 1].style.width =
27352
+ var index = _this.curTable.rows[i].cells[i].hasAttribute('colspan') ?
27353
+ parseInt(_this.curTable.rows[i].cells[i].getAttribute('colspan'), 10) - 1 : _this.colIndex;
27354
+ if (!isNullOrUndefined(_this.curTable.rows[i].cells[index - 1])) {
27355
+ _this.curTable.rows[i].cells[index - 1].style.width =
27358
27356
  _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
27359
27357
  }
27360
- if (!isNullOrUndefined(_this.curTable.rows[i].cells[_this.colIndex])) {
27361
- _this.curTable.rows[i].cells[_this.colIndex].style.width =
27358
+ if (!isNullOrUndefined(_this.curTable.rows[i].cells[index])) {
27359
+ _this.curTable.rows[i].cells[index].style.width =
27362
27360
  _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
27363
27361
  }
27364
27362
  }
@@ -28724,7 +28722,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
28724
28722
  isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
28725
28723
  }
28726
28724
  if (e.args.which === 13 && e.args.code === 'Enter') {
28727
- if (isNullOrUndefined(this.startNode.closest('LI')) && isNullOrUndefined(this.endNode.closest('LI')) && isTableEnter &&
28725
+ if (isNullOrUndefined(this.startNode.closest('LI,UL,OL')) && isNullOrUndefined(this.endNode.closest('LI,UL,OL')) && isTableEnter &&
28728
28726
  isNullOrUndefined(this.startNode.closest('PRE')) && isNullOrUndefined(this.endNode.closest('PRE'))) {
28729
28727
  var shiftKey_1 = e.args.shiftKey;
28730
28728
  var actionBeginArgs = {
@@ -29016,7 +29014,8 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
29016
29014
  }
29017
29015
  _this.removeBRElement(currentParent);
29018
29016
  var currentParentLastChild = currentParent.lastChild;
29019
- while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text' || currentParentLastChild.nodeName === 'BR')) {
29017
+ while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text' || currentParentLastChild.nodeName === 'BR'
29018
+ || currentParentLastChild.nodeName === 'IMG')) {
29020
29019
  currentParentLastChild = currentParentLastChild.lastChild;
29021
29020
  }
29022
29021
  var isLastNodeLength = _this.range.startContainer === currentParentLastChild ?
@@ -29024,7 +29023,8 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
29024
29023
  if (currentParent !== _this.parent.inputElement &&
29025
29024
  _this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
29026
29025
  _this.range.startOffset === _this.range.endOffset &&
29027
- _this.range.startOffset === isLastNodeLength) {
29026
+ (_this.range.startOffset === isLastNodeLength ||
29027
+ (currentParent.textContent.trim().length === 0 && currentParent.lastChild.nodeName === 'IMG'))) {
29028
29028
  var focusBRElem = _this.parent.createElement('br');
29029
29029
  if (_this.range.startOffset === 0 && _this.range.startContainer.nodeName === 'TABLE') {
29030
29030
  _this.range.startContainer.parentElement.insertBefore(focusBRElem, _this.range.startContainer);
@@ -29033,6 +29033,11 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
29033
29033
  if (currentParentLastChild.nodeName === 'BR' && currentParent.textContent.length === 0) {
29034
29034
  _this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, currentParentLastChild);
29035
29035
  }
29036
+ else if (_this.range.startOffset === 0 && _this.range.endOffset === 0 &&
29037
+ currentParent.lastChild && currentParent.lastChild.nodeName === 'IMG') {
29038
+ currentParentLastChild.parentElement.insertBefore(focusBRElem, currentParentLastChild);
29039
+ focusBRElem = currentParentLastChild;
29040
+ }
29036
29041
  else {
29037
29042
  var lineBreakBRElem = _this.parent.createElement('br');
29038
29043
  _this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, _this.range.startContainer);
@@ -29899,6 +29904,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
29899
29904
  }
29900
29905
  else {
29901
29906
  value = this.htmlEditorModule.sanitizeHelper(value);
29907
+ value = this.enableXhtml ? this.htmlEditorModule.xhtmlValidation.selfEncloseValidation(value) : value;
29902
29908
  }
29903
29909
  }
29904
29910
  return value;
@@ -31118,7 +31124,9 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
31118
31124
  this.notify(windowResize, null);
31119
31125
  };
31120
31126
  RichTextEditor.prototype.scrollHandler = function (e) {
31121
- this.notify(scroll, { args: e });
31127
+ if (this.element) {
31128
+ this.notify(scroll, { args: e });
31129
+ }
31122
31130
  };
31123
31131
  RichTextEditor.prototype.contentScrollHandler = function (e) {
31124
31132
  this.notify(contentscroll, { args: e });
@@ -31179,8 +31187,8 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
31179
31187
  }
31180
31188
  var getTextArea = this.element.querySelector('.e-rte-srctextarea');
31181
31189
  if (this.editorMode === 'HTML') {
31182
- value = (this.inputElement.innerHTML === '<p><br></p>' || this.inputElement.innerHTML === '<div><br></div>' ||
31183
- this.inputElement.innerHTML === '<br>') ? null : this.enableHtmlEncode ?
31190
+ value = (this.inputElement.innerHTML === '<p><br></p>' || this.inputElement.innerHTML === '<div><br></div>'
31191
+ || this.inputElement.innerHTML === '<br>') ? null : this.enableHtmlEncode ?
31184
31192
  this.encode(decode(this.inputElement.innerHTML)) : this.inputElement.innerHTML;
31185
31193
  if (getTextArea && getTextArea.style.display === 'block') {
31186
31194
  value = getTextArea.value;