@syncfusion/ej2-richtexteditor 26.1.41 → 26.1.42

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.
@@ -1,4 +1,4 @@
1
- import { isNullOrUndefined, Browser, addClass, removeClass, selectAll as selectAll$1, createElement, detach, SanitizeHtmlHelper, extend, EventHandler, closest, getInstance, formatUnit, select, Ajax, Base, Property, Event, NotifyPropertyChanges, KeyboardEvents as KeyboardEvents$1, setStyleAttribute, getUniqueID, append, debounce, Observer, prepend, attributes, getComponent, getEnumValue, Complex, ChildProperty, Component, remove, print, L10n, compile, Touch } from '@syncfusion/ej2-base';
1
+ import { isNullOrUndefined, Browser, addClass, removeClass, selectAll as selectAll$1, createElement, detach, SanitizeHtmlHelper, extend, EventHandler, closest, getInstance, formatUnit, select, Ajax, Base, Property, Event, NotifyPropertyChanges, KeyboardEvents as KeyboardEvents$1, setStyleAttribute, getUniqueID, append, debounce, Observer, prepend, attributes, getComponent, getEnumValue, Complex, ChildProperty, Component, print, L10n, compile, Touch } from '@syncfusion/ej2-base';
2
2
  import { Toolbar as Toolbar$1 } from '@syncfusion/ej2-navigations';
3
3
  import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
4
4
  import { Tooltip, Popup, Dialog, isCollide, getScrollableParent } from '@syncfusion/ej2-popups';
@@ -20064,13 +20064,11 @@ class MarkdownParser {
20064
20064
  this.observer.on(KEY_DOWN, this.editorKeyDown, this);
20065
20065
  this.observer.on(KEY_UP, this.editorKeyUp, this);
20066
20066
  this.observer.on(MODEL_CHANGED, this.onPropertyChanged, this);
20067
- this.observer.on(INTERNAL_DESTROY, this.destroy, this);
20068
20067
  }
20069
20068
  unwireEvents() {
20070
20069
  this.observer.off(KEY_DOWN, this.editorKeyDown);
20071
20070
  this.observer.off(KEY_UP, this.editorKeyUp);
20072
20071
  this.observer.off(MODEL_CHANGED, this.onPropertyChanged);
20073
- this.observer.off(INTERNAL_DESTROY, this.destroy);
20074
20072
  }
20075
20073
  onPropertyChanged(props) {
20076
20074
  this.observer.notify(MODEL_CHANGED_PLUGIN, props);
@@ -20133,6 +20131,7 @@ class MarkdownParser {
20133
20131
  }
20134
20132
  }
20135
20133
  destroy() {
20134
+ this.observer.notify(INTERNAL_DESTROY, {});
20136
20135
  this.unwireEvents();
20137
20136
  }
20138
20137
  }
@@ -30838,7 +30837,9 @@ class HtmlEditor {
30838
30837
  focusNode = currentChildNode[0];
30839
30838
  }
30840
30839
  }
30841
- this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), focusNode, pointer);
30840
+ if (range.startContainer !== focusNode) {
30841
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), focusNode, pointer);
30842
+ }
30842
30843
  }
30843
30844
  const currentElem = this.parent.inputElement.querySelector('.currentStartMark');
30844
30845
  if (!isNullOrUndefined(currentElem)) {
@@ -31161,6 +31162,7 @@ class HtmlEditor {
31161
31162
  }
31162
31163
  else if (brNode) {
31163
31164
  detach(brNode);
31165
+ e.args.preventDefault();
31164
31166
  }
31165
31167
  if (!isNullOrUndefined(this.deleteRangeElement) && (this.deleteOldRangeElement.tagName !== 'OL' && this.deleteOldRangeElement.tagName !== 'UL')
31166
31168
  && this.deleteOldRangeElement !== this.deleteRangeElement) {
@@ -35854,6 +35856,7 @@ let RichTextEditor = class RichTextEditor extends Component {
35854
35856
  constructor(options, element) {
35855
35857
  super(options, element);
35856
35858
  this.needsID = true;
35859
+ this.isSelectAll = false;
35857
35860
  }
35858
35861
  /**
35859
35862
  * To provide the array of modules needed for component rendering
@@ -36584,6 +36587,15 @@ let RichTextEditor = class RichTextEditor extends Component {
36584
36587
  if (!isNullOrUndefined(this.placeholder)) {
36585
36588
  this.setPlaceHolder();
36586
36589
  }
36590
+ if (!isNullOrUndefined(e) && !isNullOrUndefined(e.code) && (e.code === 'Backspace' || e.code === 'Delete')) {
36591
+ const range = this.contentModule.getDocument().getSelection().getRangeAt(0);
36592
+ const div = document.createElement('div');
36593
+ div.appendChild(range.cloneContents());
36594
+ const selectedHTML = div.innerHTML;
36595
+ if (selectedHTML === this.inputElement.innerHTML) {
36596
+ this.isSelectAll = true;
36597
+ }
36598
+ }
36587
36599
  }
36588
36600
  keyUp(e) {
36589
36601
  if (this.editorMode === 'HTML') {
@@ -36593,6 +36605,10 @@ let RichTextEditor = class RichTextEditor extends Component {
36593
36605
  const currentRange = this.getRange();
36594
36606
  const selection = this.iframeSettings.enable ? this.contentModule.getPanel().ownerDocument.getSelection() :
36595
36607
  this.contentModule.getDocument().getSelection();
36608
+ if (this.isSelectAll) {
36609
+ this.inputElement.innerHTML = this.enterKey !== 'BR' ? '<' + this.enterKey + '><br></' + this.enterKey + '>' : '<br>';
36610
+ this.isSelectAll = false;
36611
+ }
36596
36612
  if (selection.rangeCount > 0) {
36597
36613
  selection.removeAllRanges();
36598
36614
  selection.addRange(currentRange);
@@ -36887,7 +36903,6 @@ let RichTextEditor = class RichTextEditor extends Component {
36887
36903
  removeClass([this.element], CLS_RTE_HIDDEN);
36888
36904
  }
36889
36905
  else {
36890
- remove(this.inputElement);
36891
36906
  if (this.originalElement.innerHTML.trim() !== '') {
36892
36907
  this.element.innerHTML = this.originalElement.innerHTML.trim();
36893
36908
  this.setProperties({ value: (!isNullOrUndefined(this.initialValue) ? this.initialValue : null) }, true);
@@ -36911,9 +36926,6 @@ let RichTextEditor = class RichTextEditor extends Component {
36911
36926
  }
36912
36927
  }
36913
36928
  }
36914
- if (this.inputElement) {
36915
- this.inputElement = null;
36916
- }
36917
36929
  if (this.rootContainer) {
36918
36930
  this.rootContainer = null;
36919
36931
  }