@syncfusion/ej2-richtexteditor 22.2.5 → 22.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.
@@ -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);
@@ -31051,7 +31072,7 @@ class EnterKeyAction {
31051
31072
  }
31052
31073
  isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
31053
31074
  }
31054
- if (e.args.which === 13 && (!Browser.isDevice ? e.args.code === 'Enter' : e.args.key === 'Enter')) {
31075
+ if (e.args.which === 13 && !e.args.ctrlKey && (!Browser.isDevice ? e.args.code === 'Enter' : e.args.key === 'Enter')) {
31055
31076
  if (isNullOrUndefined(this.startNode.closest('LI, UL, OL')) && isNullOrUndefined(this.endNode.closest('LI, UL, OL')) && isTableEnter &&
31056
31077
  isNullOrUndefined(this.startNode.closest('PRE')) && isNullOrUndefined(this.endNode.closest('PRE'))) {
31057
31078
  const shiftKey = e.args.shiftKey;
@@ -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
  }
@@ -33214,6 +33236,10 @@ let RichTextEditor = class RichTextEditor extends Component {
33214
33236
  // eslint-disable-next-line
33215
33237
  const imgPadding = 12;
33216
33238
  const imgResizeBorder = 2;
33239
+ if (isNullOrUndefined(this.contentModule) || isNullOrUndefined(this.contentModule.getEditPanel())) {
33240
+ EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.imageModule.resizing);
33241
+ return maxWidth;
33242
+ }
33217
33243
  const editEle = this.contentModule.getEditPanel();
33218
33244
  const eleStyle = window.getComputedStyle(editEle);
33219
33245
  const editEleMaxWidth = editEle.offsetWidth - (imgPadding + imgResizeBorder +