@syncfusion/ej2-richtexteditor 28.1.36 → 28.1.38

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.
@@ -6190,17 +6190,21 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
6190
6190
  value: colorpickerValue
6191
6191
  };
6192
6192
  proxy.parent.notify(selectionRestore, {});
6193
- proxy.currentElement.querySelector('.' + CLS_RTE_ELEMENTS).style.borderBottomColor = colorpickerValue;
6193
+ if (proxy.currentElement) {
6194
+ proxy.currentElement.querySelector('.' + CLS_RTE_ELEMENTS).style.borderBottomColor = colorpickerValue;
6195
+ }
6194
6196
  var range = proxy.parent.formatter.editorManager.nodeSelection.getRange(proxy.parent.contentModule.getDocument());
6195
6197
  var closestElement = closest(range.startContainer.parentNode, 'table');
6196
6198
  if ((range.startContainer.nodeName === 'TD' || range.startContainer.nodeName === 'TH' || range.startContainer.nodeName === 'BODY' ||
6197
- closest(range.startContainer.parentNode, 'td,th')) && range.collapsed && args.subCommand === 'BackgroundColor' && (closest(closestElement, '.' + CLS_RTE) || proxy.parent.iframeSettings.enable)) {
6199
+ (range.startContainer.parentNode && closest(range.startContainer.parentNode, 'td,th'))) && range.collapsed && args.subCommand === 'BackgroundColor' && (closestElement && closest(closestElement, '.' + CLS_RTE) || proxy.parent.iframeSettings.enable)) {
6198
6200
  proxy.parent.notify(tableColorPickerChanged, colorPickerArgs);
6199
6201
  }
6200
6202
  else {
6201
6203
  proxy.parent.notify(colorPickerChanged, colorPickerArgs);
6202
6204
  }
6203
- proxy.currentDropdown.toggle();
6205
+ if (proxy.currentDropdown) {
6206
+ proxy.currentDropdown.toggle();
6207
+ }
6204
6208
  },
6205
6209
  beforeModeSwitch: function (args) {
6206
6210
  value = colorPicker.value;
@@ -14554,34 +14558,40 @@ var Table = /** @__PURE__ @class */ (function () {
14554
14558
  // eslint-disable-next-line
14555
14559
  Table.prototype.applyProperties = function (args, e) {
14556
14560
  var dialogEle = this.editdlgObj.element;
14557
- var table = closest(args.selectNode[0], 'table');
14558
- table.style.width = dialogEle.querySelector('.e-table-width') ? dialogEle.querySelector('.e-table-width').value + 'px'
14559
- : table.style.width;
14560
- if (dialogEle.querySelector('.e-cell-padding') && dialogEle.querySelector('.e-cell-padding').value !== '') {
14561
- var tdElm = table.querySelectorAll('td');
14562
- for (var i = 0; i < tdElm.length; i++) {
14563
- var padVal = '';
14564
- if (tdElm[i].style.padding === '') {
14565
- padVal = tdElm[i].getAttribute('style') + ' padding:' +
14566
- dialogEle.querySelector('.e-cell-padding').value + 'px;';
14561
+ if (dialogEle && args && args.selectNode.length > 0 && args.selectNode[0]) {
14562
+ var selectedElement = (args.selectNode[0] && args.selectNode[0].nodeType === 3 ?
14563
+ args.selectNode[0].parentNode : args.selectNode[0]);
14564
+ var table = selectedElement ? closest(selectedElement, 'table') : null;
14565
+ if (table) {
14566
+ table.style.width = dialogEle.querySelector('.e-table-width') ? dialogEle.querySelector('.e-table-width').value + 'px'
14567
+ : table.style.width;
14568
+ if (dialogEle.querySelector('.e-cell-padding') && dialogEle.querySelector('.e-cell-padding').value !== '') {
14569
+ var tdElm = table.querySelectorAll('td');
14570
+ for (var i = 0; i < tdElm.length; i++) {
14571
+ var padVal = '';
14572
+ if (tdElm[i].style.padding === '') {
14573
+ padVal = tdElm[i].getAttribute('style') + ' padding:' +
14574
+ dialogEle.querySelector('.e-cell-padding').value + 'px;';
14575
+ }
14576
+ else {
14577
+ tdElm[i].style.padding = dialogEle.querySelector('.e-cell-padding').value + 'px';
14578
+ padVal = tdElm[i].getAttribute('style');
14579
+ }
14580
+ tdElm[i].setAttribute('style', padVal);
14581
+ }
14582
+ }
14583
+ table.cellSpacing = dialogEle.querySelector('.e-cell-spacing') ? dialogEle.querySelector('.e-cell-spacing').value
14584
+ : table.cellSpacing;
14585
+ if (!isNullOrUndefined(table.cellSpacing) && table.cellSpacing !== '0') {
14586
+ addClass([table], CLS_TABLE_BORDER);
14567
14587
  }
14568
14588
  else {
14569
- tdElm[i].style.padding = dialogEle.querySelector('.e-cell-padding').value + 'px';
14570
- padVal = tdElm[i].getAttribute('style');
14589
+ removeClassWithAttr([table], CLS_TABLE_BORDER);
14571
14590
  }
14572
- tdElm[i].setAttribute('style', padVal);
14591
+ this.parent.formatter.saveData();
14592
+ this.editdlgObj.hide({ returnValue: true });
14573
14593
  }
14574
14594
  }
14575
- table.cellSpacing = dialogEle.querySelector('.e-cell-spacing') ? dialogEle.querySelector('.e-cell-spacing').value
14576
- : table.cellSpacing;
14577
- if (!isNullOrUndefined(table.cellSpacing) && table.cellSpacing !== '0') {
14578
- addClass([table], CLS_TABLE_BORDER);
14579
- }
14580
- else {
14581
- removeClassWithAttr([table], CLS_TABLE_BORDER);
14582
- }
14583
- this.parent.formatter.saveData();
14584
- this.editdlgObj.hide({ returnValue: true });
14585
14595
  };
14586
14596
  Table.prototype.tableDlgContent = function (e) {
14587
14597
  var selectNode = e.selectParent[0];
@@ -18965,7 +18975,7 @@ var Formatter = /** @__PURE__ @class */ (function () {
18965
18975
  }
18966
18976
  }
18967
18977
  var command = actionBeginArgs.item.subCommand.toLocaleLowerCase();
18968
- if (command === 'image') {
18978
+ if (command === 'image' || command === 'file' || command === 'replace') {
18969
18979
  value = actionBeginArgs.itemCollection;
18970
18980
  }
18971
18981
  if (command === 'paste' || command === 'cut' || command === 'copy') {
@@ -28220,6 +28230,7 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
28220
28230
  }
28221
28231
  else {
28222
28232
  InsertMethods.unwrap(cursorFormat);
28233
+ domSelection.setCursorPoint(docElement, cursorNode, 0);
28223
28234
  }
28224
28235
  }
28225
28236
  else {
@@ -32361,7 +32372,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
32361
32372
  HtmlEditor.prototype.onSelectionRestore = function (e) {
32362
32373
  this.parent.isBlur = false;
32363
32374
  this.contentRenderer.getEditPanel().focus({ preventScroll: true });
32364
- if (isNullOrUndefined(e.items) || e.items) {
32375
+ if ((isNullOrUndefined(e.items) || e.items) && (!isNullOrUndefined(this.saveSelection))) {
32365
32376
  this.saveSelection.restore();
32366
32377
  }
32367
32378
  };
@@ -32826,7 +32837,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
32826
32837
  var checkParent = false;
32827
32838
  if (this.oldRangeElement && this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
32828
32839
  var brElement = this.oldRangeElement.querySelector('BR');
32829
- if (brElement) {
32840
+ if (brElement && isNullOrUndefined(brElement.nextSibling)) {
32830
32841
  var brParentElement = brElement.parentNode;
32831
32842
  var currentState = this.oldRangeElement.innerHTML;
32832
32843
  this.parent.formatter.saveData(currentState);
@@ -33586,6 +33597,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
33586
33597
  var isValueNotEmpty = tempDivElem.textContent !== '' || !isNullOrUndefined(tempDivElem.querySelector('img')) ||
33587
33598
  !isNullOrUndefined(tempDivElem.querySelector('table'));
33588
33599
  var imgElements = tempDivElem.querySelectorAll('img');
33600
+ var base_1 = this.parent.contentModule.getDocument().location.origin;
33589
33601
  imgElements.forEach(function (imgElement) {
33590
33602
  var imageFileFormat;
33591
33603
  var imgElementSrc = imgElement.getAttribute('src');
@@ -33594,7 +33606,9 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
33594
33606
  imageFileFormat = imgElementSrc.split(';')[0].split('/')[1];
33595
33607
  }
33596
33608
  else {
33597
- imageFileFormat = imgElementSrc.split('.').pop().toLowerCase();
33609
+ var parsedUrl = imgElementSrc.indexOf('http') > -1 ? new URL(imgElementSrc) : new URL(imgElementSrc, base_1);
33610
+ var path = parsedUrl.pathname;
33611
+ imageFileFormat = path.split('.').pop().toLowerCase();
33598
33612
  }
33599
33613
  if (!isNullOrUndefined(imageFileFormat) &&
33600
33614
  allowedTypes.every(function (type) { return imageFileFormat !== type.substring(1).toLowerCase(); }) &&
@@ -37616,7 +37630,8 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
37616
37630
  && isSplitTextEmpty && !isPreWrapApplied && !isTextWrapApplied;
37617
37631
  var isCursorAtStartPreWrapWithContent = lastCharBeforeCursor === 32
37618
37632
  && (isPreWrapApplied || isTextWrapApplied) && isSplitTextEmpty && hasContentAfterCursor;
37619
- if (isCursorAtStartNonPreWrap || isCursorAtStartPreWrapWithContent) {
37633
+ if ((isCursorAtStartNonPreWrap || isCursorAtStartPreWrapWithContent) &&
37634
+ !_this.range.startContainer.previousSibling) {
37620
37635
  isFocusedFirst = true;
37621
37636
  }
37622
37637
  }
@@ -37625,7 +37640,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
37625
37640
  }
37626
37641
  _this.removeBRElement(nearBlockNode);
37627
37642
  var fireFoxEnterAtMiddle = Browser.userAgent.indexOf('Firefox') !== -1 && _this.range.startOffset === 0 && _this.range.startContainer === _this.range.endContainer &&
37628
- _this.range.startContainer.nodeName === '#text' && !_this.parent.formatter.editorManager.domNode.isBlockNode(_this.range.startContainer.previousSibling) &&
37643
+ _this.range.startContainer.nodeName === '#text' && !isNullOrUndefined(_this.range.startContainer.previousSibling) && !_this.parent.formatter.editorManager.domNode.isBlockNode(_this.range.startContainer.previousSibling) &&
37629
37644
  _this.range.startContainer.parentElement === _this.range.startContainer.previousSibling.parentElement;
37630
37645
  var preventZeroWithSpace = ((_this.range.startContainer.nodeName === '#text' && _this.range.startContainer.textContent.includes('\u200B') &&
37631
37646
  _this.range.startContainer.textContent.trim() === '\u200B') ||