@syncfusion/ej2-richtexteditor 26.2.8 → 26.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.
@@ -26793,6 +26793,12 @@ class SelectionCommands {
26793
26793
  if (cursorNodes.length === 1 && range.startOffset === 0 && (cursorNodes[0].nodeName === 'BR' || (isNullOrUndefined(cursorNodes[0].nextSibling) ? false : cursorNodes[0].nextSibling.nodeName === 'BR'))) {
26794
26794
  detach(cursorNodes[0].nodeName === '#text' ? cursorNodes[0].nextSibling : cursorNodes[0]);
26795
26795
  }
26796
+ if (!isNullOrUndefined(cursorNodes[0].parentElement) && IsFormatted.inlineTags.
26797
+ indexOf((cursorNodes[0].parentElement).tagName.toLowerCase()) !== -1 && cursorNodes[0].textContent.includes('\u200B')) {
26798
+ const element = this.GetFormatNode(format, value);
26799
+ this.applyStyles(cursorNodes, 0, element);
26800
+ return cursorNodes[0];
26801
+ }
26796
26802
  cursorNode = this.getInsertNode(docElement, range, format, value).firstChild;
26797
26803
  }
26798
26804
  return cursorNode;
@@ -30825,7 +30831,7 @@ class HtmlEditor {
30825
30831
  }
30826
30832
  onKeyUp(e) {
30827
30833
  const args = e.args;
30828
- const restrictKeys = [8, 9, 13, 16, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
30834
+ const restrictKeys = [8, 9, 13, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
30829
30835
  112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
30830
30836
  const range = this.parent.getRange();
30831
30837
  const regEx = new RegExp('\u200B', 'g');
@@ -30833,9 +30839,18 @@ class HtmlEditor {
30833
30839
  range.startOffset === 1 && range.startContainer.textContent.length === 1 &&
30834
30840
  range.startContainer.textContent.charCodeAt(0) === 8203 &&
30835
30841
  range.startContainer.textContent.replace(regEx, '').length === 0;
30842
+ let isMention = false;
30843
+ if (range.startContainer === range.endContainer &&
30844
+ range.startOffset === range.endOffset && (range.startContainer !== this.parent.inputElement && range.startOffset !== 0)) {
30845
+ const mentionStartNode = range.startContainer.nodeType === 3 ?
30846
+ range.startContainer : range.startContainer.childNodes[range.startOffset - 1];
30847
+ isMention = args.keyCode === 16 &&
30848
+ mentionStartNode.textContent.charCodeAt(0) === 8203 &&
30849
+ !isNullOrUndefined(mentionStartNode.previousSibling) && mentionStartNode.previousSibling.contentEditable === 'false';
30850
+ }
30836
30851
  let pointer;
30837
30852
  let isRootParent = false;
30838
- if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
30853
+ if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode && !isMention) {
30839
30854
  pointer = range.startOffset;
30840
30855
  const container = range.startContainer;
30841
30856
  // Check if the container is a text node and contains a zero-width space
@@ -36651,7 +36666,7 @@ let RichTextEditor = class RichTextEditor extends Component {
36651
36666
  this.inputElement.innerHTML = this.enterKey !== 'BR' ? '<' + this.enterKey + '><br></' + this.enterKey + '>' : '<br>';
36652
36667
  this.isSelectAll = false;
36653
36668
  }
36654
- if (selection.rangeCount > 0 && this.contentModule.getDocument().activeElement.tagName !== 'INPUT' && this.inputElement.contains(this.contentModule.getDocument().activeElement)) {
36669
+ if (selection.rangeCount > 0 && this.contentModule.getDocument().activeElement.tagName !== 'INPUT' && this.inputElement.contains(this.contentModule.getDocument().activeElement) && range.startContainer.innerHTML === '<br>' && range.startContainer.textContent === '') {
36655
36670
  selection.removeAllRanges();
36656
36671
  selection.addRange(currentRange);
36657
36672
  }
@@ -36913,6 +36928,10 @@ let RichTextEditor = class RichTextEditor extends Component {
36913
36928
  clearInterval(this.timeInterval);
36914
36929
  this.timeInterval = null;
36915
36930
  }
36931
+ if (!isNullOrUndefined(this.autoSaveTimeOut)) {
36932
+ clearTimeout(this.autoSaveTimeOut);
36933
+ this.autoSaveTimeOut = null;
36934
+ }
36916
36935
  if (!isNullOrUndefined(this.idleInterval)) {
36917
36936
  clearTimeout(this.idleInterval);
36918
36937
  this.idleInterval = null;
@@ -37944,7 +37963,7 @@ let RichTextEditor = class RichTextEditor extends Component {
37944
37963
  }
37945
37964
  this.preventDefaultResize(e);
37946
37965
  this.trigger('focus', { event: e, isInteracted: Object.keys(e).length === 0 ? false : true });
37947
- if (!isNullOrUndefined(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle) {
37966
+ if (!isNullOrUndefined(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle && isNullOrUndefined(this.timeInterval)) {
37948
37967
  this.timeInterval = setInterval(this.updateValueOnIdle.bind(this), this.saveInterval);
37949
37968
  }
37950
37969
  EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
@@ -38113,8 +38132,8 @@ let RichTextEditor = class RichTextEditor extends Component {
38113
38132
  contentChanged() {
38114
38133
  if (this.autoSaveOnIdle) {
38115
38134
  if (!isNullOrUndefined(this.saveInterval)) {
38116
- clearTimeout(this.timeInterval);
38117
- this.timeInterval = setTimeout(this.updateIntervalValue.bind(this), this.saveInterval);
38135
+ clearTimeout(this.autoSaveTimeOut);
38136
+ this.autoSaveTimeOut = setTimeout(this.updateIntervalValue.bind(this), this.saveInterval);
38118
38137
  }
38119
38138
  }
38120
38139
  }