@syncfusion/ej2-richtexteditor 19.3.55 → 19.3.57

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.
@@ -5765,7 +5765,7 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
5765
5765
  * @deprecated
5766
5766
  */
5767
5767
  QuickToolbar.prototype.showInlineQTBar = function (x, y, target) {
5768
- if (this.parent.readonly) {
5768
+ if (this.parent.readonly || target.tagName.toLowerCase() === "img") {
5769
5769
  return;
5770
5770
  }
5771
5771
  this.inlineQTBar.showPopup(x, y, target);
@@ -6917,7 +6917,7 @@ var Formatter = /** @__PURE__ @class */ (function () {
6917
6917
  || ((args.item.subCommand === 'FontName' || args.item.subCommand === 'FontSize') && args.name === 'dropDownSelect')
6918
6918
  || ((args.item.subCommand === 'BackgroundColor' || args.item.subCommand === 'FontColor')
6919
6919
  && args.name === 'colorPickerChanged'))) {
6920
- extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value }, true);
6920
+ extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value, selectType: args.name }, true);
6921
6921
  self.trigger(actionBegin, args, function (actionBeginArgs) {
6922
6922
  if (!actionBeginArgs.cancel) {
6923
6923
  if (_this.getUndoRedoStack().length === 0 && actionBeginArgs.item.command !== 'Links'
@@ -6935,8 +6935,8 @@ var Formatter = /** @__PURE__ @class */ (function () {
6935
6935
  }
6936
6936
  else {
6937
6937
  _this.editorManager.observer.notify(checkUndo, { subCommand: actionBeginArgs.item.subCommand });
6938
- _this.editorManager.execCommand(actionBeginArgs.item.command, actionBeginArgs.item.subCommand, event, _this.onSuccess.bind(_this, self), actionBeginArgs.item.value, actionBeginArgs.item.subCommand === 'Pre' && args.name === 'dropDownSelect' ?
6939
- { name: args.name } : value, ('#' + self.getID() + ' iframe'), self.enterKey);
6938
+ _this.editorManager.execCommand(actionBeginArgs.item.command, actionBeginArgs.item.subCommand, event, _this.onSuccess.bind(_this, self), actionBeginArgs.item.value, actionBeginArgs.item.subCommand === 'Pre' && actionBeginArgs.selectType === 'dropDownSelect' ?
6939
+ { name: actionBeginArgs.selectType } : value, ('#' + self.getID() + ' iframe'), self.enterKey);
6940
6940
  }
6941
6941
  }
6942
6942
  });
@@ -9436,7 +9436,8 @@ var NodeSelection = /** @__PURE__ @class */ (function () {
9436
9436
  || range.startContainer;
9437
9437
  var endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
9438
9438
  || range.endContainer;
9439
- if (startNode === endNode && startNode.childNodes.length === 0) {
9439
+ if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
9440
+ startNode.childNodes.length === 0) {
9440
9441
  return [startNode];
9441
9442
  }
9442
9443
  if (range.startOffset === range.endOffset && range.startOffset !== 0 && range.startContainer.nodeName === 'PRE') {
@@ -12300,7 +12301,15 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
12300
12301
  tempSpan.parentNode.replaceChild(node, tempSpan);
12301
12302
  }
12302
12303
  else {
12303
- var splitedElm = nodeCutter.GetSpliceNode(range, blockNode);
12304
+ var currentNode = nodes[nodes.length - 1];
12305
+ var splitedElm = void 0;
12306
+ if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNullOrUndefined(currentNode.parentElement) &&
12307
+ currentNode.parentElement.textContent.trim().length === 0 && !node.classList.contains('pasteContent')) {
12308
+ splitedElm = currentNode;
12309
+ }
12310
+ else {
12311
+ splitedElm = nodeCutter.GetSpliceNode(range, blockNode);
12312
+ }
12304
12313
  splitedElm.parentNode.replaceChild(node, splitedElm);
12305
12314
  }
12306
12315
  }
@@ -17293,7 +17302,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
17293
17302
  e.args.action === 'enter' ||
17294
17303
  e.args.keyCode === 13) {
17295
17304
  this.spaceLink(e.args);
17296
- if (this.parent.editorMode === 'HTML' && !((this.parent.shiftEnterKey === 'BR' && e.args.shiftKey))) {
17305
+ if (this.parent.editorMode === 'HTML') {
17297
17306
  this.parent.notify(enterHandler, { args: e.args });
17298
17307
  }
17299
17308
  }
@@ -17570,7 +17579,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
17570
17579
  var divElement = this.parent.createElement('div');
17571
17580
  divElement.setAttribute('class', 'pasteContent');
17572
17581
  divElement.style.display = 'inline';
17573
- divElement.innerHTML = contentInnerElem;
17582
+ divElement.innerHTML = contentInnerElem.replace('&para', '&para');
17574
17583
  var paraElem = divElement.querySelectorAll('span, p');
17575
17584
  for (var i = 0; i < paraElem.length; i++) {
17576
17585
  var splitTextContent = paraElem[i].innerHTML.split(' ');
@@ -20214,10 +20223,14 @@ var Image = /** @__PURE__ @class */ (function () {
20214
20223
  img.style.height = expectedY + 'px';
20215
20224
  }
20216
20225
  else if (img.style.width !== '' && img.style.height === '') {
20217
- img.style.width = ((width / height * expectedY) + width / height).toString() + 'px';
20226
+ var currentWidth = ((width / height * expectedY) + width / height) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
20227
+ ((width / height * expectedY) + width / height) : (this.parent.inputElement.getBoundingClientRect().right - 32);
20228
+ img.style.width = currentWidth.toString() + 'px';
20218
20229
  }
20219
20230
  else if (img.style.width !== '') {
20220
- img.style.width = (width / height * expectedY) + 'px';
20231
+ var currentWidth = (width / height * expectedY) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
20232
+ (width / height * expectedY) : (this.parent.inputElement.getBoundingClientRect().right - 32);
20233
+ img.style.width = currentWidth + 'px';
20221
20234
  img.style.height = expectedY + 'px';
20222
20235
  }
20223
20236
  else {
@@ -20326,7 +20339,7 @@ var Image = /** @__PURE__ @class */ (function () {
20326
20339
  };
20327
20340
  Image.prototype.resizeImgDupPos = function (e) {
20328
20341
  this.imgDupPos = {
20329
- width: (e.style.height !== '') ? this.imgEle.style.width : e.width + 'px',
20342
+ width: (e.style.width !== '') ? this.imgEle.style.width : e.width + 'px',
20330
20343
  height: (e.style.height !== '') ? this.imgEle.style.height : e.height + 'px'
20331
20344
  };
20332
20345
  };
@@ -20494,6 +20507,27 @@ var Image = /** @__PURE__ @class */ (function () {
20494
20507
  var src = this.deletedImg[i].src;
20495
20508
  this.imageRemovePost(src);
20496
20509
  }
20510
+ if (range.startContainer.nodeType === 3) {
20511
+ if (originalEvent.code === 'Backspace') {
20512
+ if (range.startContainer.previousElementSibling && range.startOffset === 0 &&
20513
+ range.startContainer.previousElementSibling.classList.contains(CLS_CAPTION) &&
20514
+ range.startContainer.previousElementSibling.classList.contains(CLS_CAPINLINE)) {
20515
+ detach(range.startContainer.previousElementSibling);
20516
+ }
20517
+ }
20518
+ else {
20519
+ if (range.startContainer.nextElementSibling &&
20520
+ range.endContainer.textContent.length === range.endOffset &&
20521
+ range.startContainer.nextElementSibling.classList.contains(CLS_CAPTION) &&
20522
+ range.startContainer.nextElementSibling.classList.contains(CLS_CAPINLINE)) {
20523
+ detach(range.startContainer.nextElementSibling);
20524
+ }
20525
+ }
20526
+ }
20527
+ else if ((range.startContainer.nodeType === 1 &&
20528
+ range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE))) {
20529
+ detach(range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE));
20530
+ }
20497
20531
  break;
20498
20532
  case 'insert-image':
20499
20533
  this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
@@ -20699,7 +20733,7 @@ var Image = /** @__PURE__ @class */ (function () {
20699
20733
  var target = args.target;
20700
20734
  this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
20701
20735
  var isPopupOpen = this.quickToolObj.imageQTBar.element.classList.contains('e-rte-pop');
20702
- if (target.nodeName === 'IMG' && this.parent.quickToolbarModule && this.parent.getRange().startOffset === this.parent.getRange().endOffset) {
20736
+ if (target.nodeName === 'IMG' && this.parent.quickToolbarModule) {
20703
20737
  if (isPopupOpen) {
20704
20738
  return;
20705
20739
  }
@@ -20940,6 +20974,9 @@ var Image = /** @__PURE__ @class */ (function () {
20940
20974
  Image.prototype.imageRemovePost = function (src) {
20941
20975
  var proxy = this;
20942
20976
  var absoluteUrl = '';
20977
+ if (isNullOrUndefined(this.parent.insertImageSettings.removeUrl) || this.parent.insertImageSettings.removeUrl === '') {
20978
+ return;
20979
+ }
20943
20980
  if (src.indexOf('http://') > -1 || src.indexOf('https://') > -1) {
20944
20981
  absoluteUrl = src;
20945
20982
  }
@@ -21784,6 +21821,7 @@ var Image = /** @__PURE__ @class */ (function () {
21784
21821
  imageTag.addEventListener('load', function () {
21785
21822
  _this.parent.trigger(actionComplete, e);
21786
21823
  });
21824
+ detach(parentElement);
21787
21825
  };
21788
21826
  /**
21789
21827
  * Rendering uploader and popup for drag and drop
@@ -21819,6 +21857,9 @@ var Image = /** @__PURE__ @class */ (function () {
21819
21857
  _this.popupObj.destroy();
21820
21858
  detach(_this.popupObj.element);
21821
21859
  _this.popupObj = null;
21860
+ if (!_this.parent.inlineMode.enable) {
21861
+ _this.parent.toolbarModule.baseToolbar.toolbarObj.disable(false);
21862
+ }
21822
21863
  }
21823
21864
  });
21824
21865
  this.popupObj.element.style.display = 'none';
@@ -21850,6 +21891,10 @@ var Image = /** @__PURE__ @class */ (function () {
21850
21891
  isUploading = false;
21851
21892
  detach(imageElement);
21852
21893
  _this.popupObj.close();
21894
+ _this.quickToolObj.imageQTBar.hidePopup();
21895
+ setTimeout(function () {
21896
+ _this.uploadObj.destroy();
21897
+ }, 900);
21853
21898
  },
21854
21899
  beforeUpload: function (args) {
21855
21900
  if (_this.parent.isServerRendered) {
@@ -21861,6 +21906,9 @@ var Image = /** @__PURE__ @class */ (function () {
21861
21906
  if (beforeUploadArgs.cancel) {
21862
21907
  return;
21863
21908
  }
21909
+ if (!_this.parent.inlineMode.enable) {
21910
+ _this.parent.toolbarModule.baseToolbar.toolbarObj.disable(true);
21911
+ }
21864
21912
  /* eslint-disable */
21865
21913
  _this.uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
21866
21914
  beforeUploadArgs.currentRequest : _this.uploadObj.currentRequestHeader;
@@ -21873,6 +21921,9 @@ var Image = /** @__PURE__ @class */ (function () {
21873
21921
  }
21874
21922
  else {
21875
21923
  _this.parent.trigger(beforeImageUpload, args);
21924
+ if (!_this.parent.inlineMode.enable) {
21925
+ _this.parent.toolbarModule.baseToolbar.toolbarObj.disable(true);
21926
+ }
21876
21927
  }
21877
21928
  },
21878
21929
  uploading: function (e) {
@@ -21915,6 +21966,9 @@ var Image = /** @__PURE__ @class */ (function () {
21915
21966
  }, 900);
21916
21967
  },
21917
21968
  success: function (e) {
21969
+ if (e.operation === "cancel") {
21970
+ return;
21971
+ }
21918
21972
  isUploading = false;
21919
21973
  _this.parent.inputElement.contentEditable = 'true';
21920
21974
  var args = {
@@ -24346,12 +24400,13 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24346
24400
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], 0);
24347
24401
  _this.getRangeNode();
24348
24402
  }
24349
- if (_this.parent.enterKey === 'P' || _this.parent.enterKey === 'DIV' ||
24403
+ if ((_this.parent.enterKey === 'P' && !shiftKey_1) || (_this.parent.enterKey === 'DIV' && !shiftKey_1) ||
24350
24404
  (_this.parent.shiftEnterKey === 'P' && shiftKey_1) ||
24351
24405
  (_this.parent.shiftEnterKey === 'DIV' && shiftKey_1)) {
24352
24406
  var nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
24353
24407
  var isImageNode = false;
24354
- if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && !(!isNullOrUndefined(_this.range.startContainer.previousSibling) && _this.range.startContainer.previousSibling.nodeName === 'IMG')) {
24408
+ if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && !(!isNullOrUndefined(_this.range.startContainer.previousSibling) &&
24409
+ (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
24355
24410
  var isNearBlockLengthZero = void 0;
24356
24411
  var newElem = void 0;
24357
24412
  if (_this.range.startContainer.nodeName === 'IMG') {
@@ -24425,7 +24480,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24425
24480
  }
24426
24481
  e.args.preventDefault();
24427
24482
  }
24428
- if (_this.parent.enterKey === 'BR' && !shiftKey_1) {
24483
+ if ((_this.parent.enterKey === 'BR' && !shiftKey_1) || (_this.parent.shiftEnterKey === 'BR' && shiftKey_1)) {
24429
24484
  var currentParent = void 0;
24430
24485
  if (!_this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode)) {
24431
24486
  var currentNode = _this.startNode;
@@ -24440,11 +24495,16 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24440
24495
  else {
24441
24496
  currentParent = _this.startNode;
24442
24497
  }
24443
- var isEmptyBrInserted = false;
24498
+ var currentParentLastChild = currentParent.lastChild;
24499
+ while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text')) {
24500
+ currentParentLastChild = currentParentLastChild.lastChild;
24501
+ }
24502
+ var isLastNodeLength = _this.range.startContainer === currentParentLastChild ?
24503
+ _this.range.startContainer.textContent.length : currentParent.textContent.length;
24444
24504
  if (currentParent !== _this.parent.inputElement &&
24445
24505
  _this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
24446
24506
  _this.range.startOffset === _this.range.endOffset &&
24447
- _this.range.startOffset === currentParent.textContent.length) {
24507
+ _this.range.startOffset === isLastNodeLength) {
24448
24508
  var outerBRElem = _this.parent.createElement('br');
24449
24509
  _this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
24450
24510
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), outerBRElem, 0);
@@ -24471,37 +24531,15 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24471
24531
  currentFocusElem = currentFocusElem.lastChild;
24472
24532
  }
24473
24533
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentFocusElem, 0);
24474
- isEmptyBrInserted = true;
24534
+
24475
24535
  }
24476
24536
  else {
24477
- newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, true);
24478
- newElem.parentElement.insertBefore(outerBRElem, newElem);
24479
- _this.insertFocusContent();
24537
+ _this.insertBRElement();
24480
24538
  }
24481
24539
  }
24482
24540
  }
24483
24541
  else {
24484
- var brElm = _this.parent.createElement('br');
24485
- if (_this.startNode.nodeName === 'BR' && _this.endNode.nodeName === 'BR' && _this.range.startOffset === 0 && _this.range.startOffset === _this.range.endOffset) {
24486
- _this.parent.formatter.editorManager.domNode.insertAfter(brElm, _this.startNode);
24487
- isEmptyBrInserted = true;
24488
- }
24489
- else {
24490
- if (_this.startNode === _this.parent.inputElement && !isNullOrUndefined(_this.range.startContainer.previousSibling) &&
24491
- _this.range.startContainer.previousSibling.nodeName === 'BR' && _this.range.startContainer.textContent.length === 0) {
24492
- isEmptyBrInserted = true;
24493
- }
24494
- _this.range.insertNode(brElm);
24495
- }
24496
- if (isEmptyBrInserted || (!isNullOrUndefined(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNullOrUndefined(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
24497
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), !isNullOrUndefined(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
24498
- isEmptyBrInserted = false;
24499
- }
24500
- else {
24501
- var brElm2 = _this.parent.createElement('br');
24502
- _this.range.insertNode(brElm2);
24503
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), brElm, 0);
24504
- }
24542
+ _this.insertBRElement();
24505
24543
  }
24506
24544
  e.args.preventDefault();
24507
24545
  }
@@ -24511,6 +24549,30 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24511
24549
  }
24512
24550
  }
24513
24551
  };
24552
+ EnterKeyAction.prototype.insertBRElement = function () {
24553
+ var isEmptyBrInserted = false;
24554
+ var brElm = this.parent.createElement('br');
24555
+ if (this.startNode.nodeName === 'BR' && this.endNode.nodeName === 'BR' && this.range.startOffset === 0 && this.range.startOffset === this.range.endOffset) {
24556
+ this.parent.formatter.editorManager.domNode.insertAfter(brElm, this.startNode);
24557
+ isEmptyBrInserted = true;
24558
+ }
24559
+ else {
24560
+ if (this.startNode === this.parent.inputElement && !isNullOrUndefined(this.range.startContainer.previousSibling) &&
24561
+ this.range.startContainer.previousSibling.nodeName === 'BR' && this.range.startContainer.textContent.length === 0) {
24562
+ isEmptyBrInserted = true;
24563
+ }
24564
+ this.range.insertNode(brElm);
24565
+ }
24566
+ if (isEmptyBrInserted || (!isNullOrUndefined(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNullOrUndefined(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
24567
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), !isNullOrUndefined(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
24568
+ isEmptyBrInserted = false;
24569
+ }
24570
+ else {
24571
+ var brElm2 = this.parent.createElement('br');
24572
+ this.range.insertNode(brElm2);
24573
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), brElm, 0);
24574
+ }
24575
+ };
24514
24576
  EnterKeyAction.prototype.insertFocusContent = function () {
24515
24577
  if (this.range.startContainer.textContent.length === 0) {
24516
24578
  if (this.range.startContainer.nodeName === '#text') {