@syncfusion/ej2-richtexteditor 21.2.8 → 21.2.10

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.
@@ -5849,7 +5849,7 @@ class BaseQuickToolbar {
5849
5849
  * @deprecated
5850
5850
  */
5851
5851
  showPopup(x, y, target) {
5852
- const eventArgs = { popup: this.popupObj, cancel: false, targetElement: target };
5852
+ const eventArgs = { popup: this.popupObj, cancel: false, targetElement: target, positionX: x, positionY: y };
5853
5853
  this.parent.trigger(beforeQuickToolbarOpen, eventArgs, (beforeQuickToolbarArgs) => {
5854
5854
  if (!beforeQuickToolbarArgs.cancel) {
5855
5855
  let editPanelTop;
@@ -5889,8 +5889,8 @@ class BaseQuickToolbar {
5889
5889
  });
5890
5890
  this.tooltip.appendTo(this.element);
5891
5891
  }
5892
- this.popupObj.position.X = x + 20;
5893
- this.popupObj.position.Y = y + 20;
5892
+ this.popupObj.position.X = beforeQuickToolbarArgs.positionX + 20;
5893
+ this.popupObj.position.Y = beforeQuickToolbarArgs.positionY + 20;
5894
5894
  this.popupObj.dataBind();
5895
5895
  this.popupObj.element.classList.add('e-popup-open');
5896
5896
  this.dropDownButtons.renderDropDowns({
@@ -17143,7 +17143,7 @@ class MsWordPaste {
17143
17143
  imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 &&
17144
17144
  imgElem[i].getAttribute('v:shapes').indexOf('圖片') < 0 &&
17145
17145
  imgElem[i].getAttribute('v:shapes').indexOf('Grafik') < 0 &&
17146
- imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0 &&
17146
+ imgElem[i].getAttribute('v:shapes').toLowerCase().indexOf('image') < 0 &&
17147
17147
  imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0) {
17148
17148
  detach(imgElem[i]);
17149
17149
  }
@@ -17726,12 +17726,31 @@ class MsWordPaste {
17726
17726
  temp.style.listStyleType = collection[index].listStyleTypeName;
17727
17727
  }
17728
17728
  else {
17729
- root.appendChild(temp = createElement(collection[index].listType));
17730
- prevList = createElement('li');
17731
- prevList.appendChild(pElement);
17732
- temp.appendChild(prevList);
17733
- temp.setAttribute('level', collection[index].nestedLevel.toString());
17734
- temp.style.listStyleType = collection[index].listStyleTypeName;
17729
+ if (collection[index].nestedLevel > pLevel && isNormalList) {
17730
+ let initialNode;
17731
+ initialNode = createElement(collection[index].listType);
17732
+ prevList = createElement('li');
17733
+ initialNode.appendChild(prevList);
17734
+ initialNode.style.listStyleType = 'none';
17735
+ for (let j = 0; j < collection[index].nestedLevel - 1; j++) {
17736
+ prevList.appendChild(temp = createElement(collection[index].listType));
17737
+ prevList = createElement('li');
17738
+ temp.appendChild(prevList);
17739
+ temp.style.listStyleType = 'none';
17740
+ }
17741
+ prevList.appendChild(pElement);
17742
+ root.appendChild(initialNode);
17743
+ temp.setAttribute('level', collection[index].nestedLevel.toString());
17744
+ temp.style.listStyleType = collection[index].listStyleTypeName;
17745
+ }
17746
+ else {
17747
+ root.appendChild(temp = createElement(collection[index].listType));
17748
+ prevList = createElement('li');
17749
+ prevList.appendChild(pElement);
17750
+ temp.appendChild(prevList);
17751
+ temp.setAttribute('level', collection[index].nestedLevel.toString());
17752
+ temp.style.listStyleType = collection[index].listStyleTypeName;
17753
+ }
17735
17754
  }
17736
17755
  }
17737
17756
  else if (collection[index].nestedLevel === 1) {
@@ -19477,9 +19496,10 @@ class HtmlEditor {
19477
19496
  range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
19478
19497
  : isRootParent = true : range.startContainer.classList.add('currentStartMark');
19479
19498
  if (range.startContainer.textContent.charCodeAt(0) === 8203) {
19480
- pointer = range.startOffset === 0 ? range.startOffset :
19481
- range.startContainer.textContent.replace(regEx, '').trim().length !== 0 ? range.startOffset - 1 : 0;
19499
+ const previousLength = range.startContainer.textContent.length;
19500
+ const previousRange = range.startOffset;
19482
19501
  range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
19502
+ pointer = previousRange === 0 ? previousRange : previousRange - (previousLength - range.startContainer.textContent.length);
19483
19503
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
19484
19504
  }
19485
19505
  const previousLength = this.parent.inputElement.innerHTML.length;
@@ -19499,7 +19519,10 @@ class HtmlEditor {
19499
19519
  i--;
19500
19520
  }
19501
19521
  if (focusNode.textContent.replace(regEx, '') === currentChildNode[i].textContent) {
19502
- pointer = focusNode.textContent.length > 1 ? focusNode.textContent.length - 1 : focusNode.textContent.length;
19522
+ pointer = focusNode.textContent.length > 1 ?
19523
+ (focusNode.textContent === currentChildNode[i].textContent ? pointer :
19524
+ pointer - (focusNode.textContent.length - focusNode.textContent.replace(regEx, '').length)) :
19525
+ focusNode.textContent.length;
19503
19526
  focusNode = currentChildNode[i];
19504
19527
  }
19505
19528
  }
@@ -19689,9 +19712,14 @@ class HtmlEditor {
19689
19712
  ? this.oldRangeElement.lastElementChild.lastElementChild :
19690
19713
  this.oldRangeElement.lastElementChild;
19691
19714
  }
19715
+ let lastNode = this.oldRangeElement.lastChild;
19716
+ while (lastNode.nodeType !== 3 && lastNode.nodeName !== '#text' &&
19717
+ lastNode.nodeName !== 'BR') {
19718
+ lastNode = lastNode.lastChild;
19719
+ }
19692
19720
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
19693
19721
  // eslint-disable-next-line
19694
- this.oldRangeElement, this.oldRangeElement.childNodes.length);
19722
+ lastNode, lastNode.textContent.length);
19695
19723
  if (this.oldRangeElement.querySelectorAll('BR').length === 1) {
19696
19724
  detach(this.oldRangeElement.querySelector('BR'));
19697
19725
  }