@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.
@@ -11459,7 +11459,7 @@ var NodeCutter = /** @__PURE__ @class */ (function () {
11459
11459
  fragment = this.spliceEmptyNode(fragment, true);
11460
11460
  if (fragment && fragment.childNodes.length > 0) {
11461
11461
  var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG'
11462
- && this.isImgElm(fragment) && fragment.textContent.trim() === '') ? true : false;
11462
+ && this.isImgElm(fragment) && fragment.textContent === '') ? true : false;
11463
11463
  if (!isEmpty) {
11464
11464
  if (node) {
11465
11465
  InsertMethods.AppendBefore(fragment, node, true);
@@ -13420,11 +13420,11 @@ var TableCommand = /** @__PURE__ @class */ (function () {
13420
13420
  for (var i = 0; i < emptyUl.length; i++) {
13421
13421
  detach(emptyUl[i]);
13422
13422
  }
13423
- var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
13423
+ var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
13424
13424
  for (var i = 0; i < emptyLiChild.length; i++) {
13425
13425
  detach(emptyLiChild[i]);
13426
13426
  if (emptyLiChild.length === i + 1) {
13427
- emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
13427
+ emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
13428
13428
  i = -1;
13429
13429
  }
13430
13430
  }
@@ -14516,12 +14516,18 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
14516
14516
  var preventRestore = false;
14517
14517
  var isFontStyle = (['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1);
14518
14518
  if (range.collapsed) {
14519
+ var currentFormatNode = isFormatted.getFormattedNode(range.startContainer, format, endNode);
14520
+ var currentSelector = !isNullOrUndefined(currentFormatNode) ?
14521
+ (currentFormatNode.getAttribute('style') === null ? currentFormatNode.nodeName :
14522
+ currentFormatNode.nodeName + "[style='" + currentFormatNode.getAttribute('style') + "']") : null;
14519
14523
  if (nodes.length > 0) {
14520
14524
  isCollapsed = true;
14521
14525
  range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
14522
14526
  }
14523
- else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.childElementCount > 0 &&
14524
- range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') {
14527
+ else if (range.startContainer.nodeType === 3 && ((range.startContainer.parentElement.childElementCount > 0 &&
14528
+ range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') ||
14529
+ !isNullOrUndefined(currentFormatNode) && currentFormatNode === (range.startContainer.parentElement.closest(currentSelector)) &&
14530
+ ((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(new RegExp(String.fromCharCode(8203), 'g'), '').trim().length != 0))) {
14525
14531
  isCollapsed = true;
14526
14532
  range = nodeCutter.GetCursorRange(docElement, range, range.startContainer);
14527
14533
  nodes.push(range.startContainer);
@@ -16286,7 +16292,7 @@ var InsertTextExec = /** @__PURE__ @class */ (function () {
16286
16292
  };
16287
16293
  InsertTextExec.prototype.insertText = function (e) {
16288
16294
  var node = document.createTextNode(e.value);
16289
- InsertHtml.Insert(this.parent.currentDocument, node);
16295
+ InsertHtml.Insert(this.parent.currentDocument, node, this.parent.editableElement);
16290
16296
  if (e.callBack) {
16291
16297
  e.callBack({
16292
16298
  requestType: e.subCommand,
@@ -20410,14 +20416,10 @@ var Image = /** @__PURE__ @class */ (function () {
20410
20416
  img.style.height = null;
20411
20417
  img.removeAttribute('height');
20412
20418
  }
20413
- else if (img.style.width !== '') {
20419
+ else {
20414
20420
  img.style.width = expectedX + 'px';
20415
20421
  img.style.height = expectedX + 'px';
20416
20422
  }
20417
- else {
20418
- img.setAttribute('width', expectedX.toString());
20419
- img.setAttribute('height', expectedX.toString());
20420
- }
20421
20423
  }
20422
20424
  };
20423
20425
  Image.prototype.pixToPerc = function (expected, parentEle) {
@@ -25527,6 +25529,10 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
25527
25529
  ? 0 : e.clipboardData.getData('text/plain').length;
25528
25530
  var totalLength = (currentLength - selectionLength) + pastedContentLength;
25529
25531
  if (_this.editorMode === 'Markdown') {
25532
+ var args_1 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
25533
+ setTimeout(function () {
25534
+ _this.formatter.onSuccess(_this, args_1);
25535
+ }, 0);
25530
25536
  if (!(_this.maxLength === -1 || totalLength <= _this.maxLength)) {
25531
25537
  e.preventDefault();
25532
25538
  }
@@ -25538,7 +25544,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
25538
25544
  _this.notify(pasteClean, { args: e });
25539
25545
  }
25540
25546
  else {
25541
- var args_1 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
25547
+ var args_2 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
25542
25548
  var value = null;
25543
25549
  var htmlValue = false;
25544
25550
  if (e && !isNullOrUndefined(e.clipboardData)) {
@@ -25556,7 +25562,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
25556
25562
  });
25557
25563
  }
25558
25564
  setTimeout(function () {
25559
- _this.formatter.onSuccess(_this, args_1);
25565
+ _this.formatter.onSuccess(_this, args_2);
25560
25566
  }, 0);
25561
25567
  }
25562
25568
  }