@syncfusion/ej2-richtexteditor 26.2.7 → 26.2.8

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.
@@ -5432,6 +5432,7 @@ class ToolbarRenderer {
5432
5432
  openDelay: 400,
5433
5433
  opensOn: 'Hover',
5434
5434
  beforeRender: this.tooltipBeforeRender.bind(this),
5435
+ beforeOpen: this.tooltipBeforeOpen.bind(this),
5435
5436
  cssClass: this.parent.getCssClass(),
5436
5437
  windowCollision: true,
5437
5438
  position: 'BottomCenter'
@@ -6808,6 +6809,7 @@ class Image$1 {
6808
6809
  if (this.parent.insertImageSettings.resize) {
6809
6810
  EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.resizeStart);
6810
6811
  this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
6812
+ this.docClick = null;
6811
6813
  EventHandler.remove(this.contentModule.getEditPanel(), 'cut', this.onCutHandler);
6812
6814
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
6813
6815
  }
@@ -9156,6 +9158,7 @@ class Audio {
9156
9158
  EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.touchStart);
9157
9159
  EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.audioClick);
9158
9160
  this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
9161
+ this.docClick = null;
9159
9162
  }
9160
9163
  }
9161
9164
  afterRender() {
@@ -10053,6 +10056,7 @@ class Video {
10053
10056
  if (this.parent.insertVideoSettings.resize) {
10054
10057
  EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.resizeStart);
10055
10058
  this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
10059
+ this.docClick = null;
10056
10060
  EventHandler.remove(this.contentModule.getEditPanel(), 'cut', this.onCutHandler);
10057
10061
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
10058
10062
  }
@@ -21946,7 +21950,9 @@ class Lists {
21946
21950
  && (!isNullOrUndefined(closest(startNode, 'ul')) || !isNullOrUndefined(closest(startNode, 'ol')))
21947
21951
  && (!isNullOrUndefined(closest(endNode, 'ul')) || !isNullOrUndefined(closest(endNode, 'ol')))
21948
21952
  && ((commonAncestor.lastElementChild === closest(endNode, 'li') && commonAncestor.lastChild !== endNode)) && !range.collapsed) {
21949
- detach(commonAncestor);
21953
+ if (this.areAllListItemsSelected(commonAncestor, range)) {
21954
+ detach(commonAncestor);
21955
+ }
21950
21956
  }
21951
21957
  this.removeList(range, e);
21952
21958
  }
@@ -22617,6 +22623,18 @@ class Lists {
22617
22623
  this.domNode = null;
22618
22624
  }
22619
22625
  }
22626
+ areAllListItemsSelected(list, range) {
22627
+ const listItems = list.querySelectorAll('li');
22628
+ for (let i = 0; i < listItems.length; i++) {
22629
+ const listItem = listItems[i];
22630
+ const listItemRange = this.parent.currentDocument.createRange();
22631
+ listItemRange.selectNodeContents(listItem);
22632
+ if (!range.intersectsNode(listItem)) {
22633
+ return false;
22634
+ }
22635
+ }
22636
+ return true;
22637
+ }
22620
22638
  }
22621
22639
 
22622
22640
  /**
@@ -23689,6 +23707,9 @@ class InsertHtml {
23689
23707
  const rangeElement = closest(nearestAnchor, 'span');
23690
23708
  rangeElement.appendChild(tempSpan);
23691
23709
  }
23710
+ else if (nodes[0].nodeName === '#text' && nodes[0].nodeValue.includes('\u200B') && !isNullOrUndefined(nodes[0].parentElement) && !isNullOrUndefined(nodes[0].parentElement.previousElementSibling) && nodes[0].parentElement.previousElementSibling.classList.contains('e-mention-chip')) {
23711
+ range.startContainer.parentElement.insertAdjacentElement('afterend', tempSpan);
23712
+ }
23692
23713
  else {
23693
23714
  range.insertNode(tempSpan);
23694
23715
  }
@@ -23777,17 +23798,7 @@ class InsertHtml {
23777
23798
  else {
23778
23799
  this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
23779
23800
  }
23780
- const spanAligns = editNode.querySelectorAll('span[style*="text-align"]');
23781
- if (spanAligns.length > 0) {
23782
- spanAligns.forEach((spanAlign) => {
23783
- if (!isNullOrUndefined(spanAlign)) {
23784
- const blockAlign = this.getImmediateBlockNode(spanAlign, null);
23785
- if (blockAlign && blockAlign.textContent.trim() === spanAlign.textContent.trim()) {
23786
- blockAlign.style.textAlign = spanAlign.style.textAlign;
23787
- }
23788
- }
23789
- });
23790
- }
23801
+ this.alignCheck(editNode);
23791
23802
  }
23792
23803
  static placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode) {
23793
23804
  lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNullOrUndefined(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
@@ -24027,6 +24038,27 @@ class InsertHtml {
24027
24038
  }
24028
24039
  insertNode.classList.add('ignore-table');
24029
24040
  }
24041
+ static alignCheck(editNode) {
24042
+ const spanAligns = editNode.querySelectorAll('span[style*="text-align"]');
24043
+ for (let i = 0; i < spanAligns.length; i++) {
24044
+ const spanAlign = spanAligns[i];
24045
+ if (spanAlign) {
24046
+ const blockAlign = this.getImmediateBlockNode(spanAlign, null);
24047
+ if (blockAlign) {
24048
+ let totalSpanText = '';
24049
+ for (let j = 0; j < spanAligns.length; j++) {
24050
+ const span = spanAligns[j];
24051
+ if (blockAlign.contains(span)) {
24052
+ totalSpanText += span.textContent;
24053
+ }
24054
+ }
24055
+ if (blockAlign.textContent.trim() === totalSpanText.trim()) {
24056
+ blockAlign.style.textAlign = spanAlign.style.textAlign;
24057
+ }
24058
+ }
24059
+ }
24060
+ }
24061
+ }
24030
24062
  }
24031
24063
  /**
24032
24064
  * Insert method
@@ -35981,8 +36013,6 @@ let RichTextEditor = class RichTextEditor extends Component {
35981
36013
  */
35982
36014
  preRender() {
35983
36015
  this.initializeValue();
35984
- this.onBlurHandler = this.blurHandler.bind(this);
35985
- this.onFocusHandler = this.focusHandler.bind(this);
35986
36016
  this.clickPoints = { clientX: 0, clientY: 0 };
35987
36017
  this.initialValue = this.value;
35988
36018
  this.serviceLocator = new ServiceLocator;
@@ -36621,7 +36651,7 @@ let RichTextEditor = class RichTextEditor extends Component {
36621
36651
  this.inputElement.innerHTML = this.enterKey !== 'BR' ? '<' + this.enterKey + '><br></' + this.enterKey + '>' : '<br>';
36622
36652
  this.isSelectAll = false;
36623
36653
  }
36624
- if (selection.rangeCount > 0) {
36654
+ if (selection.rangeCount > 0 && this.contentModule.getDocument().activeElement.tagName !== 'INPUT' && this.inputElement.contains(this.contentModule.getDocument().activeElement)) {
36625
36655
  selection.removeAllRanges();
36626
36656
  selection.addRange(currentRange);
36627
36657
  }
@@ -38225,6 +38255,9 @@ let RichTextEditor = class RichTextEditor extends Component {
38225
38255
  }
38226
38256
  }
38227
38257
  wireEvents() {
38258
+ this.onResizeHandler = this.resizeHandler.bind(this);
38259
+ this.onBlurHandler = this.blurHandler.bind(this);
38260
+ this.onFocusHandler = this.focusHandler.bind(this);
38228
38261
  this.element.addEventListener('focusin', this.onFocusHandler, true);
38229
38262
  this.element.addEventListener('focusout', this.onBlurHandler, true);
38230
38263
  this.on(contentChanged, this.contentChanged, this);
@@ -38280,7 +38313,6 @@ let RichTextEditor = class RichTextEditor extends Component {
38280
38313
  EventHandler.add(this.inputElement, 'input', this.inputHandler, this);
38281
38314
  this.wireContextEvent();
38282
38315
  this.formatter.editorManager.observer.on(KEY_DOWN_HANDLER, this.editorKeyDown, this);
38283
- this.onResizeHandler = this.resizeHandler.bind(this);
38284
38316
  this.element.ownerDocument.defaultView.addEventListener('resize', this.onResizeHandler, true);
38285
38317
  if (this.iframeSettings.enable) {
38286
38318
  EventHandler.add(this.inputElement, 'focusin', this.focusHandler, this);