@syncfusion/ej2-richtexteditor 22.2.5 → 22.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.
@@ -10257,7 +10257,7 @@ const CLEAR_TYPE = 'clear-type';
10257
10257
  *
10258
10258
  * @hidden
10259
10259
  */
10260
- const SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td'];
10260
+ const SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td', 'table'];
10261
10261
 
10262
10262
  /**
10263
10263
  * `Selection` module is used to handle RTE Selections.
@@ -13031,6 +13031,14 @@ class InsertHtml {
13031
13031
  nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
13032
13032
  range = nodeSelection.getRange(docElement);
13033
13033
  }
13034
+ if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
13035
+ range.startOffset === range.endOffset && editNode.textContent.trim().length > 0) {
13036
+ const focusNode = this.findFirstTextNode(range.startContainer);
13037
+ if (!isNullOrUndefined(focusNode)) {
13038
+ nodeSelection.setSelectionText(docElement, focusNode, focusNode, 0, 0);
13039
+ range = nodeSelection.getRange(docElement);
13040
+ }
13041
+ }
13034
13042
  if (range.startContainer.nodeName === 'BR' && range.startOffset === 0 && range.startOffset === range.endOffset &&
13035
13043
  range.startContainer === range.endContainer) {
13036
13044
  const currentIndex = Array.prototype.slice.call(range.startContainer.parentElement.childNodes).indexOf(range.startContainer);
@@ -13158,6 +13166,18 @@ class InsertHtml {
13158
13166
  }
13159
13167
  }
13160
13168
  }
13169
+ static findFirstTextNode(node) {
13170
+ if (node.nodeType === Node.TEXT_NODE) {
13171
+ return node;
13172
+ }
13173
+ for (let i = 0; i < node.childNodes.length; i++) {
13174
+ const textNode = this.findFirstTextNode(node.childNodes[i]);
13175
+ if (!isNullOrUndefined(textNode)) {
13176
+ return textNode;
13177
+ }
13178
+ }
13179
+ return null;
13180
+ }
13161
13181
  static pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
13162
13182
  const isCursor = range.startOffset === range.endOffset &&
13163
13183
  range.startContainer === range.endContainer;
@@ -20227,8 +20247,9 @@ class HtmlEditor {
20227
20247
  currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH' &&
20228
20248
  isPreviousNotContentEditable) {
20229
20249
  const checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
20230
- if (!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
20231
- !isNullOrUndefined(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') {
20250
+ if ((!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
20251
+ !isNullOrUndefined(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') ||
20252
+ (!isNullOrUndefined(currentRange.startContainer.previousSibling) && currentRange.startContainer.previousSibling.nodeName === 'BR')) {
20232
20253
  return;
20233
20254
  }
20234
20255
  this.rangeElement = this.getRootBlockNode(currentRange.startContainer);
@@ -32971,9 +32992,10 @@ let RichTextEditor = class RichTextEditor extends Component {
32971
32992
  if (!initial) {
32972
32993
  if (this.readonly && this.enabled) {
32973
32994
  this.unbindEvents();
32995
+ this.unWireEvents();
32974
32996
  }
32975
32997
  else if (this.enabled) {
32976
- this.bindEvents();
32998
+ this.wireEvents();
32977
32999
  }
32978
33000
  }
32979
33001
  }