@syncfusion/ej2-richtexteditor 20.1.50 → 20.1.55

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.
@@ -4253,7 +4253,7 @@ var Toolbar$2 = /** @__PURE__ @class */ (function () {
4253
4253
  if ((parent_1.bottom < (floatOffset + tbHeight + topValue)) || parent_1.bottom < 0 || parent_1.top > floatOffset + topValue) {
4254
4254
  isFloat = false;
4255
4255
  }
4256
- else if (parent_1.top < floatOffset) {
4256
+ else if (parent_1.top < floatOffset || parent_1.top < floatOffset + topValue) {
4257
4257
  isFloat = true;
4258
4258
  }
4259
4259
  }
@@ -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);
@@ -11510,7 +11510,7 @@ var NodeCutter = /** @__PURE__ @class */ (function () {
11510
11510
  else if (len > -1) {
11511
11511
  this.spliceEmptyNode(fragment.childNodes[0], isStart);
11512
11512
  }
11513
- else if (fragment.nodeType !== 3 && fragment.nodeType !== 11) {
11513
+ else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG') {
11514
11514
  fragment.parentNode.removeChild(fragment);
11515
11515
  }
11516
11516
  return fragment;
@@ -12336,7 +12336,8 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
12336
12336
  tempSpan.parentNode.replaceChild(node, tempSpan);
12337
12337
  }
12338
12338
  else {
12339
- var currentNode = nodes[nodes.length - 1];
12339
+ var nodeSelection = new NodeSelection();
12340
+ var currentNode = this.getNodeCollection(range, nodeSelection, node)[this.getNodeCollection(range, nodeSelection, node).length - 1];
12340
12341
  var splitedElm = void 0;
12341
12342
  if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNullOrUndefined(currentNode.parentElement) &&
12342
12343
  currentNode.parentElement.textContent.trim().length === 0) {
@@ -13420,11 +13421,11 @@ var TableCommand = /** @__PURE__ @class */ (function () {
13420
13421
  for (var i = 0; i < emptyUl.length; i++) {
13421
13422
  detach(emptyUl[i]);
13422
13423
  }
13423
- var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
13424
+ var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
13424
13425
  for (var i = 0; i < emptyLiChild.length; i++) {
13425
13426
  detach(emptyLiChild[i]);
13426
13427
  if (emptyLiChild.length === i + 1) {
13427
- emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
13428
+ emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
13428
13429
  i = -1;
13429
13430
  }
13430
13431
  }
@@ -14516,12 +14517,18 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
14516
14517
  var preventRestore = false;
14517
14518
  var isFontStyle = (['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1);
14518
14519
  if (range.collapsed) {
14520
+ var currentFormatNode = isFormatted.getFormattedNode(range.startContainer, format, endNode);
14521
+ var currentSelector = !isNullOrUndefined(currentFormatNode) ?
14522
+ (currentFormatNode.getAttribute('style') === null ? currentFormatNode.nodeName :
14523
+ currentFormatNode.nodeName + "[style='" + currentFormatNode.getAttribute('style') + "']") : null;
14519
14524
  if (nodes.length > 0) {
14520
14525
  isCollapsed = true;
14521
14526
  range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
14522
14527
  }
14523
- else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.childElementCount > 0 &&
14524
- range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') {
14528
+ else if (range.startContainer.nodeType === 3 && ((range.startContainer.parentElement.childElementCount > 0 &&
14529
+ range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') ||
14530
+ !isNullOrUndefined(currentFormatNode) && currentFormatNode === (range.startContainer.parentElement.closest(currentSelector)) &&
14531
+ ((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(new RegExp(String.fromCharCode(8203), 'g'), '').trim().length != 0))) {
14525
14532
  isCollapsed = true;
14526
14533
  range = nodeCutter.GetCursorRange(docElement, range, range.startContainer);
14527
14534
  nodes.push(range.startContainer);
@@ -16286,7 +16293,7 @@ var InsertTextExec = /** @__PURE__ @class */ (function () {
16286
16293
  };
16287
16294
  InsertTextExec.prototype.insertText = function (e) {
16288
16295
  var node = document.createTextNode(e.value);
16289
- InsertHtml.Insert(this.parent.currentDocument, node);
16296
+ InsertHtml.Insert(this.parent.currentDocument, node, this.parent.editableElement);
16290
16297
  if (e.callBack) {
16291
16298
  e.callBack({
16292
16299
  requestType: e.subCommand,
@@ -20410,14 +20417,10 @@ var Image = /** @__PURE__ @class */ (function () {
20410
20417
  img.style.height = null;
20411
20418
  img.removeAttribute('height');
20412
20419
  }
20413
- else if (img.style.width !== '') {
20420
+ else {
20414
20421
  img.style.width = expectedX + 'px';
20415
20422
  img.style.height = expectedX + 'px';
20416
20423
  }
20417
- else {
20418
- img.setAttribute('width', expectedX.toString());
20419
- img.setAttribute('height', expectedX.toString());
20420
- }
20421
20424
  }
20422
20425
  };
20423
20426
  Image.prototype.pixToPerc = function (expected, parentEle) {
@@ -23301,7 +23304,8 @@ var Table = /** @__PURE__ @class */ (function () {
23301
23304
  var tableWidth = parseInt(getComputedStyle(_this.curTable).width, 10);
23302
23305
  var tableHeight = parseInt(getComputedStyle(_this.curTable).height, 10);
23303
23306
  var paddingSize = +getComputedStyle(_this.contentModule.getEditPanel()).paddingRight.match(/\d/g).join('');
23304
- var rteWidth = _this.contentModule.getEditPanel().offsetWidth - paddingSize * 2;
23307
+ var rteWidth = _this.contentModule.getEditPanel().offsetWidth - (_this.contentModule.getEditPanel().offsetWidth -
23308
+ _this.contentModule.getEditPanel().clientWidth) - paddingSize * 2;
23305
23309
  if (_this.resizeBtnStat.column) {
23306
23310
  var cellColl = _this.curTable.rows[_this.calMaxCol(_this.curTable)].cells;
23307
23311
  var width = parseFloat(_this.columnEle.offsetWidth.toString());
@@ -24774,8 +24778,9 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24774
24778
  };
24775
24779
  EnterKeyAction.prototype.removeBRElement = function (currentElement) {
24776
24780
  if (Browser.userAgent.indexOf('Firefox') != -1 &&
24777
- this.range.endOffset === currentElement.textContent.length &&
24778
- currentElement.lastChild.nodeName === 'BR') {
24781
+ this.range.endOffset === currentElement.textContent.length && (currentElement.textContent.length !== 0 ||
24782
+ currentElement.querySelectorAll('BR').length > 1) &&
24783
+ !isNullOrUndefined(currentElement.lastChild) && currentElement.lastChild.nodeName === 'BR') {
24779
24784
  detach(currentElement.lastChild);
24780
24785
  }
24781
24786
  };
@@ -25527,6 +25532,10 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
25527
25532
  ? 0 : e.clipboardData.getData('text/plain').length;
25528
25533
  var totalLength = (currentLength - selectionLength) + pastedContentLength;
25529
25534
  if (_this.editorMode === 'Markdown') {
25535
+ var args_1 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
25536
+ setTimeout(function () {
25537
+ _this.formatter.onSuccess(_this, args_1);
25538
+ }, 0);
25530
25539
  if (!(_this.maxLength === -1 || totalLength <= _this.maxLength)) {
25531
25540
  e.preventDefault();
25532
25541
  }
@@ -25538,7 +25547,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
25538
25547
  _this.notify(pasteClean, { args: e });
25539
25548
  }
25540
25549
  else {
25541
- var args_1 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
25550
+ var args_2 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
25542
25551
  var value = null;
25543
25552
  var htmlValue = false;
25544
25553
  if (e && !isNullOrUndefined(e.clipboardData)) {
@@ -25556,7 +25565,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
25556
25565
  });
25557
25566
  }
25558
25567
  setTimeout(function () {
25559
- _this.formatter.onSuccess(_this, args_1);
25568
+ _this.formatter.onSuccess(_this, args_2);
25560
25569
  }, 0);
25561
25570
  }
25562
25571
  }