@syncfusion/ej2-richtexteditor 20.3.59 → 20.3.60

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' },
@@ -12960,7 +12960,8 @@ class InsertHtml {
12960
12960
  }
12961
12961
  }
12962
12962
  else if (currentNode.nodeName === '#text' && !isNullOrUndefined(currentNode.parentElement) &&
12963
- currentNode.parentElement.nodeName === 'LI' && currentNode.parentElement.textContent.trim().length > 0) {
12963
+ (currentNode.parentElement.nodeName === 'LI' || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
12964
+ currentNode.parentElement.textContent.trim().length > 0) {
12964
12965
  splitedElm = currentNode;
12965
12966
  if (currentNode.parentElement.nodeName === 'LI' && !isNullOrUndefined(currentNode.nextSibling) &&
12966
12967
  currentNode.nextSibling.nodeName === 'BR') {
@@ -15567,6 +15568,15 @@ class SelectionCommands {
15567
15568
  isSubSup = formatNode === null ? false : true;
15568
15569
  }
15569
15570
  }
15571
+ else if (formatNode.textContent !== nodes[index].textContent && formatNode.nodeName === 'SPAN' && formatNode.style[0] === 'font-size') {
15572
+ let currentParentElem = nodes[index].parentElement.textContent !== nodes[index].textContent ? nodes[index] : nodes[index].parentElement;
15573
+ let isSameTextContent = true;
15574
+ while (currentParentElem.textContent !== nodes[index].textContent && nodes[index].style[0] !== format && currentParentElem.nodeName === 'SPAN') {
15575
+ isSameTextContent = currentParentElem.textContent === currentParentElem.parentElement.textContent;
15576
+ currentParentElem = !isNullOrUndefined(currentParentElem.parentElement) && isSameTextContent ? currentParentElem.parentElement : currentParentElem;
15577
+ }
15578
+ formatNode = currentParentElem;
15579
+ }
15570
15580
  if (index === 0 && formatNode === null) {
15571
15581
  isFormat = true;
15572
15582
  }
@@ -15858,7 +15868,33 @@ class SelectionCommands {
15858
15868
  liElement.style.textDecoration = 'inherit';
15859
15869
  }
15860
15870
  }
15861
- nodes[index] = this.applyStyles(nodes, index, element);
15871
+ let enterType = isNullOrUndefined(this.enterAction) ? 'P' : this.enterAction.toString();
15872
+ const currentNode = nodes[index];
15873
+ let isNestedNode = !isNullOrUndefined(currentNode) && nodes[index].nodeName === '#text' && nodes[index].parentElement.nodeName !== enterType;
15874
+ let currentParentElem = currentNode.parentElement.textContent !== currentNode.textContent ? currentNode : currentNode.parentElement;
15875
+ if (isNestedNode) {
15876
+ let isSameTextContent = true;
15877
+ isNestedNode = false;
15878
+ while (!isNullOrUndefined(currentParentElem) && isSameTextContent && currentParentElem.parentElement.nodeName !== enterType
15879
+ && (currentParentElem.nodeName === 'SPAN' && (currentParentElem.style.textDecoration === 'line-through' || 'underline')
15880
+ || currentParentElem.nodeName === 'SPAN' && (currentParentElem.style[0] === 'background-color' || 'font-family' || 'color')
15881
+ || (currentParentElem.nodeName === 'EM' || 'STRONG' || 'SUB' || 'SUP'))) {
15882
+ isSameTextContent = currentParentElem.textContent === currentParentElem.parentElement.textContent;
15883
+ currentParentElem = !isNullOrUndefined(currentParentElem.parentElement) && isSameTextContent ? currentParentElem.parentElement : currentParentElem;
15884
+ }
15885
+ if (!isNullOrUndefined(currentParentElem) && currentParentElem.childNodes.length > 0) {
15886
+ let nodeList = currentParentElem.querySelectorAll('span,strong,em,sub,sup');
15887
+ isNestedNode = nodeList.length > 0 && isSameTextContent;
15888
+ }
15889
+ }
15890
+ if (isNestedNode) {
15891
+ let nodeList = [];
15892
+ nodeList[0] = currentParentElem;
15893
+ this.applyStyles(nodeList, index, element);
15894
+ }
15895
+ else {
15896
+ nodes[index] = this.applyStyles(nodes, index, element);
15897
+ }
15862
15898
  if (format === 'fontsize') {
15863
15899
  const bg = closest(nodes[index].parentElement, 'span[style*=' + 'background-color' + ']');
15864
15900
  if (!isNullOrUndefined(bg)) {
@@ -16818,7 +16854,9 @@ class MsWordPaste {
16818
16854
  for (let i = 0; i < allElements.length; i++) {
16819
16855
  if (allElements[i].children.length === 0 && allElements[i].innerHTML === '&nbsp;' &&
16820
16856
  (allElements[i].innerHTML === '&nbsp;' && !allElements[i].closest('li')) &&
16821
- !allElements[i].closest('td')) {
16857
+ !allElements[i].closest('td') && (allElements[i].nodeName !== 'SPAN' ||
16858
+ allElements[i].nodeName === 'SPAN' && (isNullOrUndefined(allElements[i].previousElementSibling) &&
16859
+ isNullOrUndefined(allElements[i].nextElementSibling)))) {
16822
16860
  const detachableElement = this.findDetachElem(allElements[i]);
16823
16861
  const brElement = createElement('br');
16824
16862
  if (!isNullOrUndefined(detachableElement.parentElement)) {
@@ -28338,7 +28376,8 @@ class EnterKeyAction {
28338
28376
  }
28339
28377
  else {
28340
28378
  if ((nearBlockNode.textContent.trim().length !== 0 ||
28341
- nearBlockNode.childNodes[0].nodeName === 'IMG')) {
28379
+ nearBlockNode.childNodes[0].nodeName === 'IMG' ||
28380
+ (nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img').length > 0))) {
28342
28381
  if ((this.range.startOffset === this.range.endOffset && this.range.startOffset != 0)) {
28343
28382
  newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, false).cloneNode(true);
28344
28383
  }