@syncfusion/ej2-richtexteditor 20.1.50 → 20.1.51

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.
@@ -11360,7 +11360,7 @@ class NodeCutter {
11360
11360
  fragment = this.spliceEmptyNode(fragment, true);
11361
11361
  if (fragment && fragment.childNodes.length > 0) {
11362
11362
  const isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG'
11363
- && this.isImgElm(fragment) && fragment.textContent.trim() === '') ? true : false;
11363
+ && this.isImgElm(fragment) && fragment.textContent === '') ? true : false;
11364
11364
  if (!isEmpty) {
11365
11365
  if (node) {
11366
11366
  InsertMethods.AppendBefore(fragment, node, true);
@@ -13311,11 +13311,11 @@ class TableCommand {
13311
13311
  for (let i = 0; i < emptyUl.length; i++) {
13312
13312
  detach(emptyUl[i]);
13313
13313
  }
13314
- let emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
13314
+ let emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
13315
13315
  for (let i = 0; i < emptyLiChild.length; i++) {
13316
13316
  detach(emptyLiChild[i]);
13317
13317
  if (emptyLiChild.length === i + 1) {
13318
- emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
13318
+ emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
13319
13319
  i = -1;
13320
13320
  }
13321
13321
  }
@@ -14398,12 +14398,18 @@ class SelectionCommands {
14398
14398
  let preventRestore = false;
14399
14399
  const isFontStyle = (['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1);
14400
14400
  if (range.collapsed) {
14401
+ let currentFormatNode = isFormatted.getFormattedNode(range.startContainer, format, endNode);
14402
+ let currentSelector = !isNullOrUndefined(currentFormatNode) ?
14403
+ (currentFormatNode.getAttribute('style') === null ? currentFormatNode.nodeName :
14404
+ currentFormatNode.nodeName + `[style='` + currentFormatNode.getAttribute('style') + `']`) : null;
14401
14405
  if (nodes.length > 0) {
14402
14406
  isCollapsed = true;
14403
14407
  range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
14404
14408
  }
14405
- else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.childElementCount > 0 &&
14406
- range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') {
14409
+ else if (range.startContainer.nodeType === 3 && ((range.startContainer.parentElement.childElementCount > 0 &&
14410
+ range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') ||
14411
+ !isNullOrUndefined(currentFormatNode) && currentFormatNode === (range.startContainer.parentElement.closest(currentSelector)) &&
14412
+ ((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(new RegExp(String.fromCharCode(8203), 'g'), '').trim().length != 0))) {
14407
14413
  isCollapsed = true;
14408
14414
  range = nodeCutter.GetCursorRange(docElement, range, range.startContainer);
14409
14415
  nodes.push(range.startContainer);
@@ -16158,7 +16164,7 @@ class InsertTextExec {
16158
16164
  }
16159
16165
  insertText(e) {
16160
16166
  const node = document.createTextNode(e.value);
16161
- InsertHtml.Insert(this.parent.currentDocument, node);
16167
+ InsertHtml.Insert(this.parent.currentDocument, node, this.parent.editableElement);
16162
16168
  if (e.callBack) {
16163
16169
  e.callBack({
16164
16170
  requestType: e.subCommand,
@@ -20311,14 +20317,10 @@ class Image {
20311
20317
  img.style.height = null;
20312
20318
  img.removeAttribute('height');
20313
20319
  }
20314
- else if (img.style.width !== '') {
20320
+ else {
20315
20321
  img.style.width = expectedX + 'px';
20316
20322
  img.style.height = expectedX + 'px';
20317
20323
  }
20318
- else {
20319
- img.setAttribute('width', expectedX.toString());
20320
- img.setAttribute('height', expectedX.toString());
20321
- }
20322
20324
  }
20323
20325
  }
20324
20326
  pixToPerc(expected, parentEle) {
@@ -25255,6 +25257,10 @@ let RichTextEditor = class RichTextEditor extends Component {
25255
25257
  ? 0 : e.clipboardData.getData('text/plain').length;
25256
25258
  const totalLength = (currentLength - selectionLength) + pastedContentLength;
25257
25259
  if (this.editorMode === 'Markdown') {
25260
+ const args = { requestType: 'Paste', editorMode: this.editorMode, event: e };
25261
+ setTimeout(() => {
25262
+ this.formatter.onSuccess(this, args);
25263
+ }, 0);
25258
25264
  if (!(this.maxLength === -1 || totalLength <= this.maxLength)) {
25259
25265
  e.preventDefault();
25260
25266
  }