@syncfusion/ej2-richtexteditor 20.3.59 → 20.3.61

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.
@@ -1978,8 +1978,8 @@ let videoAlignItems = [
1978
1978
  { iconCss: 'e-icons e-justify-right', command: 'Videos', subCommand: 'JustifyRight' },
1979
1979
  ];
1980
1980
  let displayLocale = [
1981
- { locale: 'imageLayoutOptionDropDownInline', value: 'Inline' },
1982
- { locale: 'imageLayoutOptionDropDownBreak', value: 'Break' }
1981
+ { locale: 'imageDisplayDropDownInline', value: 'Inline' },
1982
+ { locale: 'imageDisplayDropDownBreak', value: 'Break' }
1983
1983
  ];
1984
1984
  let audioLayoutOptionLocale = [
1985
1985
  { locale: 'audioLayoutOptionDropDownInline', value: 'Inline' },
@@ -12098,6 +12098,7 @@ class NodeCutter {
12098
12098
  for (let i = 0; !isNullOrUndefined(firstChild.childNodes) && i < firstChild.childNodes.length; i++) {
12099
12099
  if (firstChild.childNodes[i].nodeName === 'IMG' || (firstChild.childNodes[i].nodeName === 'SPAN' &&
12100
12100
  (firstChild.childNodes[i].classList.contains('e-video-wrap') ||
12101
+ firstChild.childNodes[i].classList.contains('e-embed-video-wrap') ||
12101
12102
  firstChild.childNodes[i].classList.contains('e-audio-wrap')))) {
12102
12103
  result = false;
12103
12104
  }
@@ -12960,7 +12961,8 @@ class InsertHtml {
12960
12961
  }
12961
12962
  }
12962
12963
  else if (currentNode.nodeName === '#text' && !isNullOrUndefined(currentNode.parentElement) &&
12963
- currentNode.parentElement.nodeName === 'LI' && currentNode.parentElement.textContent.trim().length > 0) {
12964
+ (currentNode.parentElement.nodeName === 'LI' || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
12965
+ currentNode.parentElement.textContent.trim().length > 0) {
12964
12966
  splitedElm = currentNode;
12965
12967
  if (currentNode.parentElement.nodeName === 'LI' && !isNullOrUndefined(currentNode.nextSibling) &&
12966
12968
  currentNode.nextSibling.nodeName === 'BR') {
@@ -15567,6 +15569,15 @@ class SelectionCommands {
15567
15569
  isSubSup = formatNode === null ? false : true;
15568
15570
  }
15569
15571
  }
15572
+ else if (formatNode.textContent !== nodes[index].textContent && formatNode.nodeName === 'SPAN' && formatNode.style[0] === 'font-size') {
15573
+ let currentParentElem = nodes[index].parentElement.textContent !== nodes[index].textContent ? nodes[index] : nodes[index].parentElement;
15574
+ let isSameTextContent = true;
15575
+ while (currentParentElem.textContent !== nodes[index].textContent && nodes[index].style[0] !== format && currentParentElem.nodeName === 'SPAN') {
15576
+ isSameTextContent = currentParentElem.textContent === currentParentElem.parentElement.textContent;
15577
+ currentParentElem = !isNullOrUndefined(currentParentElem.parentElement) && isSameTextContent ? currentParentElem.parentElement : currentParentElem;
15578
+ }
15579
+ formatNode = currentParentElem;
15580
+ }
15570
15581
  if (index === 0 && formatNode === null) {
15571
15582
  isFormat = true;
15572
15583
  }
@@ -15858,7 +15869,33 @@ class SelectionCommands {
15858
15869
  liElement.style.textDecoration = 'inherit';
15859
15870
  }
15860
15871
  }
15861
- nodes[index] = this.applyStyles(nodes, index, element);
15872
+ let enterType = isNullOrUndefined(this.enterAction) ? 'P' : this.enterAction.toString();
15873
+ const currentNode = nodes[index];
15874
+ let isNestedNode = !isNullOrUndefined(currentNode) && nodes[index].nodeName === '#text' && nodes[index].parentElement.nodeName !== enterType;
15875
+ let currentParentElem = currentNode.parentElement.textContent !== currentNode.textContent ? currentNode : currentNode.parentElement;
15876
+ if (isNestedNode) {
15877
+ let isSameTextContent = true;
15878
+ isNestedNode = false;
15879
+ while (!isNullOrUndefined(currentParentElem) && isSameTextContent && currentParentElem.parentElement.nodeName !== enterType
15880
+ && (currentParentElem.nodeName === 'SPAN' && (currentParentElem.style.textDecoration === 'line-through' || 'underline')
15881
+ || currentParentElem.nodeName === 'SPAN' && (currentParentElem.style[0] === 'background-color' || 'font-family' || 'color')
15882
+ || (currentParentElem.nodeName === 'EM' || 'STRONG' || 'SUB' || 'SUP'))) {
15883
+ isSameTextContent = currentParentElem.textContent === currentParentElem.parentElement.textContent;
15884
+ currentParentElem = !isNullOrUndefined(currentParentElem.parentElement) && isSameTextContent ? currentParentElem.parentElement : currentParentElem;
15885
+ }
15886
+ if (!isNullOrUndefined(currentParentElem) && currentParentElem.childNodes.length > 0) {
15887
+ let nodeList = currentParentElem.querySelectorAll('span,strong,em,sub,sup');
15888
+ isNestedNode = nodeList.length > 0 && isSameTextContent;
15889
+ }
15890
+ }
15891
+ if (isNestedNode) {
15892
+ let nodeList = [];
15893
+ nodeList[0] = currentParentElem;
15894
+ this.applyStyles(nodeList, index, element);
15895
+ }
15896
+ else {
15897
+ nodes[index] = this.applyStyles(nodes, index, element);
15898
+ }
15862
15899
  if (format === 'fontsize') {
15863
15900
  const bg = closest(nodes[index].parentElement, 'span[style*=' + 'background-color' + ']');
15864
15901
  if (!isNullOrUndefined(bg)) {
@@ -16818,7 +16855,9 @@ class MsWordPaste {
16818
16855
  for (let i = 0; i < allElements.length; i++) {
16819
16856
  if (allElements[i].children.length === 0 && allElements[i].innerHTML === '&nbsp;' &&
16820
16857
  (allElements[i].innerHTML === '&nbsp;' && !allElements[i].closest('li')) &&
16821
- !allElements[i].closest('td')) {
16858
+ !allElements[i].closest('td') && (allElements[i].nodeName !== 'SPAN' ||
16859
+ allElements[i].nodeName === 'SPAN' && (isNullOrUndefined(allElements[i].previousElementSibling) &&
16860
+ isNullOrUndefined(allElements[i].nextElementSibling)))) {
16822
16861
  const detachableElement = this.findDetachElem(allElements[i]);
16823
16862
  const brElement = createElement('br');
16824
16863
  if (!isNullOrUndefined(detachableElement.parentElement)) {
@@ -17761,7 +17800,7 @@ class ToolbarStatus {
17761
17800
  && (fontName === null || fontName === undefined || (fontName.filter((value, pos) => {
17762
17801
  const pattern = new RegExp(name, 'i');
17763
17802
  if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
17764
- (value.search(pattern) > -1)) {
17803
+ (value.split(',')[0] && value.split(',')[0].search(pattern) > -1)) {
17765
17804
  index = pos;
17766
17805
  }
17767
17806
  }) && (index !== null)))) {
@@ -28338,7 +28377,8 @@ class EnterKeyAction {
28338
28377
  }
28339
28378
  else {
28340
28379
  if ((nearBlockNode.textContent.trim().length !== 0 ||
28341
- nearBlockNode.childNodes[0].nodeName === 'IMG')) {
28380
+ nearBlockNode.childNodes[0].nodeName === 'IMG' ||
28381
+ (nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img').length > 0))) {
28342
28382
  if ((this.range.startOffset === this.range.endOffset && this.range.startOffset != 0)) {
28343
28383
  newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, false).cloneNode(true);
28344
28384
  }
@@ -29967,9 +30007,11 @@ let RichTextEditor = class RichTextEditor extends Component {
29967
30007
  this.notify(rtlMode, { enableRtl: this.enableRtl });
29968
30008
  if (this.enableRtl) {
29969
30009
  this.element.classList.add(CLS_RTL);
30010
+ this.inputElement.classList.add(CLS_RTL);
29970
30011
  }
29971
30012
  else {
29972
30013
  this.element.classList.remove(CLS_RTL);
30014
+ this.inputElement.classList.remove(CLS_RTL);
29973
30015
  }
29974
30016
  }
29975
30017
  updateReadOnly() {