@syncfusion/ej2-richtexteditor 28.1.36 → 28.1.37

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') {
@@ -32361,7 +32371,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
32361
32371
  HtmlEditor.prototype.onSelectionRestore = function (e) {
32362
32372
  this.parent.isBlur = false;
32363
32373
  this.contentRenderer.getEditPanel().focus({ preventScroll: true });
32364
- if (isNullOrUndefined(e.items) || e.items) {
32374
+ if ((isNullOrUndefined(e.items) || e.items) && (!isNullOrUndefined(this.saveSelection))) {
32365
32375
  this.saveSelection.restore();
32366
32376
  }
32367
32377
  };
@@ -32826,7 +32836,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
32826
32836
  var checkParent = false;
32827
32837
  if (this.oldRangeElement && this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
32828
32838
  var brElement = this.oldRangeElement.querySelector('BR');
32829
- if (brElement) {
32839
+ if (brElement && isNullOrUndefined(brElement.nextSibling)) {
32830
32840
  var brParentElement = brElement.parentNode;
32831
32841
  var currentState = this.oldRangeElement.innerHTML;
32832
32842
  this.parent.formatter.saveData(currentState);
@@ -37616,7 +37626,8 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
37616
37626
  && isSplitTextEmpty && !isPreWrapApplied && !isTextWrapApplied;
37617
37627
  var isCursorAtStartPreWrapWithContent = lastCharBeforeCursor === 32
37618
37628
  && (isPreWrapApplied || isTextWrapApplied) && isSplitTextEmpty && hasContentAfterCursor;
37619
- if (isCursorAtStartNonPreWrap || isCursorAtStartPreWrapWithContent) {
37629
+ if ((isCursorAtStartNonPreWrap || isCursorAtStartPreWrapWithContent) &&
37630
+ !_this.range.startContainer.previousSibling) {
37620
37631
  isFocusedFirst = true;
37621
37632
  }
37622
37633
  }
@@ -37625,7 +37636,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
37625
37636
  }
37626
37637
  _this.removeBRElement(nearBlockNode);
37627
37638
  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) &&
37639
+ _this.range.startContainer.nodeName === '#text' && !isNullOrUndefined(_this.range.startContainer.previousSibling) && !_this.parent.formatter.editorManager.domNode.isBlockNode(_this.range.startContainer.previousSibling) &&
37629
37640
  _this.range.startContainer.parentElement === _this.range.startContainer.previousSibling.parentElement;
37630
37641
  var preventZeroWithSpace = ((_this.range.startContainer.nodeName === '#text' && _this.range.startContainer.textContent.includes('\u200B') &&
37631
37642
  _this.range.startContainer.textContent.trim() === '\u200B') ||