@syncfusion/ej2-richtexteditor 24.2.8 → 24.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.
@@ -6530,6 +6530,9 @@ var BaseQuickToolbar = /** @__PURE__ @class */ (function () {
6530
6530
  _this.parent.disableToolbarItem(_this.parent.toolbarSettings.items);
6531
6531
  _this.parent.enableToolbarItem(['Undo', 'Redo']);
6532
6532
  }
6533
+ else {
6534
+ _this.parent.enableToolbarItem(_this.parent.toolbarSettings.items);
6535
+ }
6533
6536
  append([_this.element], document.body);
6534
6537
  if (_this.parent.showTooltip) {
6535
6538
  _this.tooltip = new Tooltip({
@@ -6980,7 +6983,7 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
6980
6983
  * @deprecated
6981
6984
  */
6982
6985
  QuickToolbar.prototype.showInlineQTBar = function (x, y, target) {
6983
- if (isNullOrUndefined(this.parent) || this.parent.readonly || target.tagName.toLowerCase() === 'img') {
6986
+ if (isNullOrUndefined(this.parent) || this.parent.readonly || target.tagName.toLowerCase() === 'img' || this.inlineQTBar.element.querySelector('.e-rte-color-content')) {
6984
6987
  return;
6985
6988
  }
6986
6989
  this.inlineQTBar.showPopup(x, y, target);
@@ -13879,7 +13882,12 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13879
13882
  TABLE_BLOCK_TAGS.indexOf(closestParentNode.tagName.toLocaleLowerCase()) !== -1))
13880
13883
  || (node.nodeName.toLowerCase() === 'table' && closestParentNode &&
13881
13884
  TABLE_BLOCK_TAGS.indexOf(closestParentNode.tagName.toLocaleLowerCase()) === -1))) {
13882
- preNode = nodeCutter.GetSpliceNode(range, closestParentNode);
13885
+ if (isCollapsed) {
13886
+ preNode = nodeCutter.SplitNode(range, closestParentNode, true);
13887
+ }
13888
+ else {
13889
+ preNode = nodeCutter.SplitNode(range, closestParentNode, false);
13890
+ }
13883
13891
  sibNode = isNullOrUndefined(preNode.previousSibling) ? preNode.parentNode.previousSibling : preNode.previousSibling;
13884
13892
  if (nodes.length === 1) {
13885
13893
  nodeSelection.setSelectionContents(docElement, preNode);
@@ -13966,6 +13974,9 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13966
13974
  var paraElm = void 0;
13967
13975
  var previousParent = void 0;
13968
13976
  if (!this.contentsDeleted) {
13977
+ if (!isCollapsed && range.startContainer.parentElement.textContent.length === 0 && range.startContainer.nodeName === 'BR' && range.startContainer.parentElement.nodeName === 'P') {
13978
+ editNode.removeChild(range.startContainer.parentElement);
13979
+ }
13969
13980
  range.deleteContents();
13970
13981
  }
13971
13982
  while (node.firstChild) {
@@ -18294,6 +18305,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18294
18305
  var elm = createElement('p');
18295
18306
  elm.setAttribute('id', 'MSWord-Content');
18296
18307
  elm.innerHTML = tempHTMLContent;
18308
+ this.addDoubleBr(elm);
18297
18309
  var patern = /class='?Mso|style='[^ ]*\bmso-/i;
18298
18310
  var patern2 = /class="?Mso|style="[^ ]*\bmso-/i;
18299
18311
  var patern3 = /(class="?Mso|class='?Mso|class="?Xl|class='?Xl|class=Xl|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument)/gi;
@@ -18328,6 +18340,26 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
18328
18340
  e.callBack(elm.innerHTML);
18329
18341
  }
18330
18342
  };
18343
+ MsWordPaste.prototype.addDoubleBr = function (elm) {
18344
+ var newline = elm.querySelector('.Apple-interchange-newline');
18345
+ if (!isNullOrUndefined(newline) && Browser.userAgent.indexOf('Chrome') !== -1 && newline.parentElement.nodeName === 'P' && elm !== newline.parentElement) {
18346
+ for (var i = 0; i < elm.childNodes.length; i++) {
18347
+ // eslint-disable-next-line
18348
+ var node = elm.childNodes[i];
18349
+ if (node.nodeType === Node.COMMENT_NODE && node.nodeValue.includes('StartFragment')) {
18350
+ var newElement = document.createElement('p');
18351
+ newElement.innerHTML = '<br>';
18352
+ var cssText = newline.parentElement.style.cssText;
18353
+ var currentStyle = newElement.getAttribute('style') || '';
18354
+ var newStyle = currentStyle + cssText;
18355
+ newElement.setAttribute('style', newStyle);
18356
+ elm.insertBefore(newElement, node.nextSibling);
18357
+ detach(newline);
18358
+ break;
18359
+ }
18360
+ }
18361
+ }
18362
+ };
18331
18363
  MsWordPaste.prototype.cleanList = function (elm, listTag) {
18332
18364
  var replacableElem = elm.querySelectorAll(listTag + ' div');
18333
18365
  for (var j = replacableElem.length - 1; j >= 0; j--) {
@@ -21490,9 +21522,9 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
21490
21522
  var liElement = this.getRangeLiNode(currentRange.startContainer);
21491
21523
  if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
21492
21524
  this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
21493
- liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
21525
+ liElement.previousElementSibling : liElement.previousElementSibling.lastChild;
21494
21526
  if (!isNullOrUndefined(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR' &&
21495
- isNullOrUndefined(liElement.lastElementChild.previousSibling)) {
21527
+ isNullOrUndefined(liElement.lastElementChild.previousSibling) && liElement.lastChild.nodeName !== "#text") {
21496
21528
  this.rangeElement = liElement.lastElementChild;
21497
21529
  isLiElement = true;
21498
21530
  }
@@ -21517,7 +21549,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
21517
21549
  ? this.oldRangeElement.lastElementChild.lastElementChild :
21518
21550
  this.oldRangeElement.lastElementChild;
21519
21551
  }
21520
- var lastNode = this.oldRangeElement.lastChild;
21552
+ var lastNode = this.oldRangeElement.lastChild ? this.oldRangeElement.lastChild : this.oldRangeElement;
21521
21553
  while (lastNode.nodeType !== 3 && lastNode.nodeName !== '#text' &&
21522
21554
  lastNode.nodeName !== 'BR') {
21523
21555
  lastNode = lastNode.lastChild;
@@ -21525,12 +21557,17 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
21525
21557
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
21526
21558
  // eslint-disable-next-line
21527
21559
  lastNode, lastNode.textContent.length);
21528
- if (this.oldRangeElement.querySelectorAll('BR').length === 1) {
21560
+ if (this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
21529
21561
  detach(this.oldRangeElement.querySelector('BR'));
21530
21562
  }
21531
21563
  if (!isNullOrUndefined(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
21532
21564
  while (this.rangeElement.firstChild) {
21533
- this.oldRangeElement.appendChild(this.rangeElement.childNodes[0]);
21565
+ if (this.oldRangeElement.nodeName === '#text') {
21566
+ this.oldRangeElement.parentElement.appendChild(this.rangeElement.childNodes[0]);
21567
+ }
21568
+ else {
21569
+ this.oldRangeElement.appendChild(this.rangeElement.childNodes[0]);
21570
+ }
21534
21571
  }
21535
21572
  // eslint-disable-next-line
21536
21573
  !isLiElement ? detach(this.rangeElement) : detach(this.rangeElement.parentElement);
@@ -24015,7 +24052,7 @@ var EmojiPicker = /** @__PURE__ @class */ (function () {
24015
24052
  this.parent.getToolbar().appendChild(this.popDiv);
24016
24053
  }
24017
24054
  else if (this.parent.inlineMode.enable) {
24018
- this.parent.inputElement.appendChild(this.popDiv);
24055
+ this.parent.element.appendChild(this.popDiv);
24019
24056
  }
24020
24057
  EventHandler.add(this.popDiv, 'keydown', this.onKeyDown, this);
24021
24058
  EventHandler.add(this.popDiv, 'keyup', this.searchFilter, this);
@@ -33366,10 +33403,10 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
33366
33403
  }
33367
33404
  var previousBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].previousSibling;
33368
33405
  var nextBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].nextSibling;
33369
- if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.hasAttribute('style') && previousBlockNode.nodeName !== 'TABLE') {
33406
+ if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.nodeName !== '#text' && previousBlockNode.hasAttribute('style') && previousBlockNode.nodeName !== 'TABLE') {
33370
33407
  insertElem.setAttribute('style', previousBlockNode.getAttribute('style'));
33371
33408
  }
33372
- if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.hasAttribute('style') && nextBlockNode.nodeName !== 'TABLE') {
33409
+ if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.nodeName !== '#text' && nextBlockNode.hasAttribute('style') && nextBlockNode.nodeName !== 'TABLE') {
33373
33410
  insertElem.setAttribute('style', nextBlockNode.getAttribute('style'));
33374
33411
  }
33375
33412
  return insertElem;