@syncfusion/ej2-richtexteditor 27.1.57 → 27.1.58

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.
@@ -7884,7 +7884,9 @@ var Image$1 = /** @__PURE__ @class */ (function () {
7884
7884
  _this.parent.formatter.editorManager.nodeSelection.Clear(_this.contentModule.getDocument());
7885
7885
  _this.parent.formatter.editorManager.nodeSelection.setSelectionContents(_this.contentModule.getDocument(), target);
7886
7886
  _this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
7887
- _this.resizeStart(e.args, target);
7887
+ if (_this.parent.insertImageSettings.resize === true) {
7888
+ _this.resizeStart(e.args, target);
7889
+ }
7888
7890
  }, 400);
7889
7891
  }
7890
7892
  else {
@@ -9364,7 +9366,9 @@ var Image$1 = /** @__PURE__ @class */ (function () {
9364
9366
  if (imageElement) {
9365
9367
  this.showImageQTbarTime = setTimeout(function () {
9366
9368
  _this.showImageQuickToolbar(args);
9367
- _this.resizeStart(e.args, imageElement);
9369
+ if (_this.parent.insertImageSettings.resize) {
9370
+ _this.resizeStart(e.args, imageElement);
9371
+ }
9368
9372
  }, 0);
9369
9373
  }
9370
9374
  };
@@ -23459,7 +23463,7 @@ var NodeCutter = /** @__PURE__ @class */ (function () {
23459
23463
  fragment = this.spliceEmptyNode(fragment, false);
23460
23464
  if (fragment && fragment.childNodes.length > 0) {
23461
23465
  var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG' && !(fragment.querySelectorAll('img').length > 0)
23462
- && this.isRteElm(fragment) && fragment.textContent.trim() === '') ? true : false;
23466
+ && this.isRteElm(fragment) && fragment.textContent.trim() === '' && fragment.textContent !== ' ' && fragment.textContent.charCodeAt(0) !== 160) ? true : false;
23463
23467
  if (!isEmpty) {
23464
23468
  if (node) {
23465
23469
  InsertMethods.AppendBefore(fragment, node);
@@ -23480,7 +23484,7 @@ var NodeCutter = /** @__PURE__ @class */ (function () {
23480
23484
  fragment = this.spliceEmptyNode(fragment, true);
23481
23485
  if (fragment && fragment.childNodes.length > 0) {
23482
23486
  var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG'
23483
- && this.isRteElm(fragment) && fragment.textContent.trim() === '') ? true : false;
23487
+ && this.isRteElm(fragment) && fragment.textContent.trim() === '' && fragment.textContent !== ' ' && fragment.textContent.charCodeAt(0) !== 160) ? true : false;
23484
23488
  if (!isEmpty) {
23485
23489
  if (node) {
23486
23490
  InsertMethods.AppendBefore(fragment, node, true);
@@ -32189,12 +32193,16 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
32189
32193
  }
32190
32194
  var brNode = this.deleteRangeElement.querySelector('BR');
32191
32195
  var brLastChildNode = this.deleteRangeElement.lastChild;
32196
+ var brParentNode = brLastChildNode.parentNode;
32192
32197
  if (brNode && brNode.classList.contains('e-rte-image-remove-focus')) {
32193
32198
  removeClass([brNode], ['e-rte-image-focus']);
32194
32199
  return;
32195
32200
  }
32196
32201
  else if (brNode && brLastChildNode && brLastChildNode.nodeName === 'BR') {
32197
32202
  detach(brLastChildNode);
32203
+ if (!isNullOrUndefined(brParentNode) && brParentNode.childNodes.length === 0) {
32204
+ detach(brParentNode);
32205
+ }
32198
32206
  e.args.preventDefault();
32199
32207
  }
32200
32208
  if (!isNullOrUndefined(this.deleteRangeElement) && (this.deleteOldRangeElement.tagName !== 'OL' && this.deleteOldRangeElement.tagName !== 'UL')
@@ -32868,38 +32876,62 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
32868
32876
  }
32869
32877
  };
32870
32878
  PasteCleanup.prototype.splitBreakLine = function (value) {
32871
- var enterSplitText = value.split('\n');
32872
- var contentInnerElem = '';
32879
+ var enterSplitText = value.split('\r\n\r\n');
32880
+ var finalText = '';
32873
32881
  var startNode = this.parent.enterKey === 'P' ? '<p>' : (this.parent.enterKey === 'DIV' ? '<div>' : '');
32874
32882
  var endNode = this.parent.enterKey === 'P' ? '</p>' : (this.parent.enterKey === 'DIV' ? '</div>' : '<br>');
32875
32883
  for (var i = 0; i < enterSplitText.length; i++) {
32876
- if (enterSplitText[i].trim() === '') {
32877
- contentInnerElem += getDefaultValue(this.parent);
32884
+ var content = enterSplitText[i];
32885
+ var contentWithSpace = this.makeSpace(content);
32886
+ var contentWithLineBreak = contentWithSpace.replace(/\r\n|\n/g, '<br>');
32887
+ if (i === 0) {
32888
+ if (this.parent.enterKey === 'BR') {
32889
+ finalText += (contentWithLineBreak + endNode);
32890
+ }
32891
+ else {
32892
+ finalText += contentWithLineBreak; // In order to merge the content in current line. No P/Div tag is added.
32893
+ }
32878
32894
  }
32879
32895
  else {
32880
- var contentWithSpace = this.makeSpace(enterSplitText[i]);
32881
- contentInnerElem += (i === 0 && this.parent.enterKey !== 'BR' ? '<span>' : startNode) +
32882
- (contentWithSpace.trim() === '' ? '<br>' : contentWithSpace.trim()) +
32883
- (enterSplitText.length - 1 === i && this.parent.enterKey === 'BR' ? '' : (i === 0 && this.parent.enterKey !== 'BR' ? '</span>' : endNode));
32896
+ if (this.parent.enterKey === 'BR') {
32897
+ if (i === enterSplitText.length - 1) {
32898
+ finalText += (contentWithLineBreak + endNode);
32899
+ }
32900
+ else {
32901
+ finalText += (contentWithLineBreak + endNode + endNode);
32902
+ }
32903
+ }
32904
+ else {
32905
+ finalText += startNode + contentWithLineBreak + endNode;
32906
+ }
32884
32907
  }
32885
32908
  }
32886
- return contentInnerElem;
32909
+ return finalText;
32887
32910
  };
32888
- PasteCleanup.prototype.makeSpace = function (enterSplitText) {
32889
- var contentWithSpace = '';
32890
- var spaceBetweenContent = true;
32891
- enterSplitText = enterSplitText.replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;');
32892
- var spaceSplit = enterSplitText.split(' ');
32893
- for (var j = 0; j < spaceSplit.length; j++) {
32894
- if (spaceSplit[j].trim() === '') {
32895
- contentWithSpace += spaceBetweenContent ? '&nbsp;' : ' ';
32911
+ PasteCleanup.prototype.makeSpace = function (text) {
32912
+ var spacedContent = '';
32913
+ if (text === '') {
32914
+ return text;
32915
+ }
32916
+ var lineBreakSplitText = text.split(' ');
32917
+ for (var i = 0; i < lineBreakSplitText.length; i++) {
32918
+ var currentText = lineBreakSplitText[i];
32919
+ if (currentText === '') {
32920
+ spacedContent += '&nbsp;';
32921
+ }
32922
+ else if (currentText === '\t') {
32923
+ spacedContent += '&nbsp;&nbsp;&nbsp;&nbsp;';
32896
32924
  }
32897
32925
  else {
32898
- spaceBetweenContent = false;
32899
- contentWithSpace += spaceSplit[j] + ' ';
32926
+ if (i > 0 && i < lineBreakSplitText.length) {
32927
+ spacedContent += ' ';
32928
+ }
32929
+ spacedContent += currentText;
32900
32930
  }
32901
32931
  }
32902
- return contentWithSpace;
32932
+ spacedContent = spacedContent.replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;');
32933
+ spacedContent = spacedContent.replace(/&nbsp;&nbsp;/g, '&nbsp; ');
32934
+ return spacedContent;
32903
32935
  };
32904
32936
  PasteCleanup.prototype.imgUploading = function (elm) {
32905
32937
  var allImgElm = elm.querySelectorAll('.pasteContent_Img');
@@ -37979,7 +38011,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
37979
38011
  }
37980
38012
  var notFormatPainterCopy = isNullOrUndefined(e.action) ? true : (e.action !== 'format-copy' ? true : false);
37981
38013
  if (this.formatter.getUndoRedoStack().length === 0 && notFormatPainterCopy &&
37982
- !(e.altKey || e.shiftKey || (e.altKey && e.shiftKey && e.which === 67))) {
38014
+ !(e.altKey || (e.shiftKey && e.which === 16) || (e.altKey && e.shiftKey && e.which === 67))) {
37983
38015
  this.formatter.saveData();
37984
38016
  }
37985
38017
  var preventingMention = false;
@@ -39033,7 +39065,10 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
39033
39065
  var item = compiledTemplate[i];
39034
39066
  append([item], appendElem);
39035
39067
  }
39036
- this.setProperties({ value: appendElem.innerHTML.trim() });
39068
+ var content = appendElem.innerHTML.trim();
39069
+ if (content.length > 0) {
39070
+ this.setProperties({ value: content });
39071
+ }
39037
39072
  this.renderReactTemplates();
39038
39073
  }
39039
39074
  }