@syncfusion/ej2-richtexteditor 28.1.35 → 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.
@@ -6158,11 +6158,10 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
6158
6158
  enableRtl: this.parent.enableRtl,
6159
6159
  inline: true,
6160
6160
  value: null,
6161
- cssClass: ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass + ' ' + 'e-rte-picker-init',
6161
+ cssClass: ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass,
6162
6162
  created: function () {
6163
6163
  var value = (item === 'backgroundcolor') ? proxy.parent.backgroundColor.default : proxy.parent.fontColor.default;
6164
- var cssClass = ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass;
6165
- colorPicker.setProperties({ value: value, cssClass: cssClass });
6164
+ colorPicker.setProperties({ value: value });
6166
6165
  },
6167
6166
  mode: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.mode : proxy.parent.fontColor.mode),
6168
6167
  modeSwitcher: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.modeSwitcher : proxy.parent.fontColor.modeSwitcher),
@@ -6191,17 +6190,21 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
6191
6190
  value: colorpickerValue
6192
6191
  };
6193
6192
  proxy.parent.notify(selectionRestore, {});
6194
- proxy.currentElement.querySelector('.' + CLS_RTE_ELEMENTS).style.borderBottomColor = colorpickerValue;
6193
+ if (proxy.currentElement) {
6194
+ proxy.currentElement.querySelector('.' + CLS_RTE_ELEMENTS).style.borderBottomColor = colorpickerValue;
6195
+ }
6195
6196
  var range = proxy.parent.formatter.editorManager.nodeSelection.getRange(proxy.parent.contentModule.getDocument());
6196
6197
  var closestElement = closest(range.startContainer.parentNode, 'table');
6197
6198
  if ((range.startContainer.nodeName === 'TD' || range.startContainer.nodeName === 'TH' || range.startContainer.nodeName === 'BODY' ||
6198
- 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)) {
6199
6200
  proxy.parent.notify(tableColorPickerChanged, colorPickerArgs);
6200
6201
  }
6201
6202
  else {
6202
6203
  proxy.parent.notify(colorPickerChanged, colorPickerArgs);
6203
6204
  }
6204
- proxy.currentDropdown.toggle();
6205
+ if (proxy.currentDropdown) {
6206
+ proxy.currentDropdown.toggle();
6207
+ }
6205
6208
  },
6206
6209
  beforeModeSwitch: function (args) {
6207
6210
  value = colorPicker.value;
@@ -14555,34 +14558,40 @@ var Table = /** @__PURE__ @class */ (function () {
14555
14558
  // eslint-disable-next-line
14556
14559
  Table.prototype.applyProperties = function (args, e) {
14557
14560
  var dialogEle = this.editdlgObj.element;
14558
- var table = closest(args.selectNode[0], 'table');
14559
- table.style.width = dialogEle.querySelector('.e-table-width') ? dialogEle.querySelector('.e-table-width').value + 'px'
14560
- : table.style.width;
14561
- if (dialogEle.querySelector('.e-cell-padding') && dialogEle.querySelector('.e-cell-padding').value !== '') {
14562
- var tdElm = table.querySelectorAll('td');
14563
- for (var i = 0; i < tdElm.length; i++) {
14564
- var padVal = '';
14565
- if (tdElm[i].style.padding === '') {
14566
- padVal = tdElm[i].getAttribute('style') + ' padding:' +
14567
- 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);
14568
14587
  }
14569
14588
  else {
14570
- tdElm[i].style.padding = dialogEle.querySelector('.e-cell-padding').value + 'px';
14571
- padVal = tdElm[i].getAttribute('style');
14589
+ removeClassWithAttr([table], CLS_TABLE_BORDER);
14572
14590
  }
14573
- tdElm[i].setAttribute('style', padVal);
14591
+ this.parent.formatter.saveData();
14592
+ this.editdlgObj.hide({ returnValue: true });
14574
14593
  }
14575
14594
  }
14576
- table.cellSpacing = dialogEle.querySelector('.e-cell-spacing') ? dialogEle.querySelector('.e-cell-spacing').value
14577
- : table.cellSpacing;
14578
- if (!isNullOrUndefined(table.cellSpacing) && table.cellSpacing !== '0') {
14579
- addClass([table], CLS_TABLE_BORDER);
14580
- }
14581
- else {
14582
- removeClassWithAttr([table], CLS_TABLE_BORDER);
14583
- }
14584
- this.parent.formatter.saveData();
14585
- this.editdlgObj.hide({ returnValue: true });
14586
14595
  };
14587
14596
  Table.prototype.tableDlgContent = function (e) {
14588
14597
  var selectNode = e.selectParent[0];
@@ -18966,7 +18975,7 @@ var Formatter = /** @__PURE__ @class */ (function () {
18966
18975
  }
18967
18976
  }
18968
18977
  var command = actionBeginArgs.item.subCommand.toLocaleLowerCase();
18969
- if (command === 'image') {
18978
+ if (command === 'image' || command === 'file' || command === 'replace') {
18970
18979
  value = actionBeginArgs.itemCollection;
18971
18980
  }
18972
18981
  if (command === 'paste' || command === 'cut' || command === 'copy') {
@@ -25550,6 +25559,7 @@ var LinkCommand = /** @__PURE__ @class */ (function () {
25550
25559
  if (child && child.length === 1) {
25551
25560
  e.item.selection.startContainer = e.item.selection.getNodeArray(child[child.length - 1], true);
25552
25561
  e.item.selection.endContainer = e.item.selection.startContainer;
25562
+ e.item.selection.endOffset = child[child.length - 1].textContent.length;
25553
25563
  }
25554
25564
  e.item.selection = this.parent.domNode.saveMarker(e.item.selection);
25555
25565
  }
@@ -29907,7 +29917,8 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
29907
29917
  imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0 &&
29908
29918
  imgElem[i].getAttribute('v:shapes').indexOf('_x0000_s') < 0 &&
29909
29919
  imgElem[i].getAttribute('v:shapes').indexOf('_x0000_i') < 0 &&
29910
- imgElem[i].getAttribute('v:shapes').indexOf('img1') < 0) {
29920
+ imgElem[i].getAttribute('v:shapes').indexOf('img1') < 0 &&
29921
+ imgElem[i].getAttribute('v:shapes').indexOf('Immagine') < 0) {
29911
29922
  imgElem[i].classList.add('e-rte-image-unsupported');
29912
29923
  }
29913
29924
  imgElem[i].removeAttribute('v:shapes');
@@ -29921,7 +29932,8 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
29921
29932
  if (imgElem.length > 0) {
29922
29933
  for (var i = 0; i < imgElem.length; i++) {
29923
29934
  imgSrc.push(imgElem[i].getAttribute('src'));
29924
- imgName.push(imgElem[i].getAttribute('src').split('/')[imgElem[i].getAttribute('src').split('/').length - 1].split('.')[0]);
29935
+ var imageName = imgElem[i].getAttribute('src').split('/')[imgElem[i].getAttribute('src').split('/').length - 1].split('.')[0] + i;
29936
+ imgName.push(imageName);
29925
29937
  }
29926
29938
  var hexValue = this.hexConversion(rtfData);
29927
29939
  for (var i = 0; i < hexValue.length; i++) {
@@ -32359,7 +32371,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
32359
32371
  HtmlEditor.prototype.onSelectionRestore = function (e) {
32360
32372
  this.parent.isBlur = false;
32361
32373
  this.contentRenderer.getEditPanel().focus({ preventScroll: true });
32362
- if (isNullOrUndefined(e.items) || e.items) {
32374
+ if ((isNullOrUndefined(e.items) || e.items) && (!isNullOrUndefined(this.saveSelection))) {
32363
32375
  this.saveSelection.restore();
32364
32376
  }
32365
32377
  };
@@ -32824,7 +32836,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
32824
32836
  var checkParent = false;
32825
32837
  if (this.oldRangeElement && this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
32826
32838
  var brElement = this.oldRangeElement.querySelector('BR');
32827
- if (brElement) {
32839
+ if (brElement && isNullOrUndefined(brElement.nextSibling)) {
32828
32840
  var brParentElement = brElement.parentNode;
32829
32841
  var currentState = this.oldRangeElement.innerHTML;
32830
32842
  this.parent.formatter.saveData(currentState);
@@ -33868,8 +33880,20 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
33868
33880
  this.parent.trigger(imageUploadSuccess, e, function (e) {
33869
33881
  if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
33870
33882
  var url = _this.parent.insertImageSettings.path + e.file.name;
33871
- imgElem.src = url;
33872
- imgElem.setAttribute('alt', e.file.name);
33883
+ if (!_this.parent.inputElement.contains(imgElem)) {
33884
+ var imgHtmlElems = _this.parent.inputElement.querySelectorAll('#' + imgElem.id);
33885
+ for (var i = 0; i < imgHtmlElems.length; i++) {
33886
+ var imgHtmlElem = imgHtmlElems[i];
33887
+ if (imgHtmlElem && imgHtmlElem.style && imgHtmlElem.style.opacity === '0.5') {
33888
+ imgHtmlElem.src = url;
33889
+ imgHtmlElem.setAttribute('alt', e.file.name);
33890
+ }
33891
+ }
33892
+ }
33893
+ else {
33894
+ imgElem.src = url;
33895
+ imgElem.setAttribute('alt', e.file.name);
33896
+ }
33873
33897
  }
33874
33898
  });
33875
33899
  }
@@ -33882,7 +33906,18 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
33882
33906
  }
33883
33907
  this.popupCloseTime = setTimeout(function () {
33884
33908
  popupObj.close();
33885
- imgElem.style.opacity = '1';
33909
+ if (!_this.parent.inputElement.contains(imgElem)) {
33910
+ var imgHtmlElems = _this.parent.inputElement.querySelectorAll('#' + imgElem.id);
33911
+ for (var i = 0; i < imgHtmlElems.length; i++) {
33912
+ var imgHtmlElem = imgHtmlElems[i];
33913
+ if (imgHtmlElem && imgHtmlElem.style && imgHtmlElem.style.opacity === '0.5') {
33914
+ imgHtmlElem.style.opacity = '1';
33915
+ }
33916
+ }
33917
+ }
33918
+ else {
33919
+ imgElem.style.opacity = '1';
33920
+ }
33886
33921
  _this.toolbarEnableDisable(false);
33887
33922
  if (uploadObj && document.body.contains(uploadObj.element)) {
33888
33923
  uploadObj.destroy();
@@ -37571,7 +37606,14 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
37571
37606
  var isMediaNode = false; // To check the image audio and video node cases
37572
37607
  var isFocusedFirst = false;
37573
37608
  var parentElement = _this.range.startContainer.parentElement;
37574
- var isPreWrapApplied = parentElement ? _this.parent.contentModule.getDocument().defaultView.getComputedStyle(parentElement, null).getPropertyValue('white-space') === 'pre-wrap' : false;
37609
+ var isPreWrapApplied = false;
37610
+ var isTextWrapApplied = false;
37611
+ if (parentElement) {
37612
+ // eslint-disable-next-line max-len
37613
+ var computedStyle = _this.parent.contentModule.getDocument().defaultView.getComputedStyle(parentElement);
37614
+ isPreWrapApplied = computedStyle.getPropertyValue('white-space') === 'pre-wrap';
37615
+ isTextWrapApplied = computedStyle.getPropertyValue('text-wrap') === 'nowrap';
37616
+ }
37575
37617
  if (_this.range.startOffset !== 0 && _this.range.endOffset !== 0 &&
37576
37618
  _this.range.startContainer === _this.range.endContainer && !(!isNullOrUndefined(nearBlockNode.childNodes[0])
37577
37619
  && (nearBlockNode.childNodes[0].nodeName === 'IMG' || nearBlockNode.querySelectorAll('img, audio, video').length > 0))) {
@@ -37581,10 +37623,11 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
37581
37623
  var isSplitTextEmpty = splitFirstText.trim().length === 0;
37582
37624
  var hasContentAfterCursor = startNodeText.slice(_this.range.startOffset).trim().length !== 0;
37583
37625
  var isCursorAtStartNonPreWrap = lastCharBeforeCursor !== 160
37584
- && isSplitTextEmpty && !isPreWrapApplied;
37626
+ && isSplitTextEmpty && !isPreWrapApplied && !isTextWrapApplied;
37585
37627
  var isCursorAtStartPreWrapWithContent = lastCharBeforeCursor === 32
37586
- && isPreWrapApplied && isSplitTextEmpty && hasContentAfterCursor;
37587
- if (isCursorAtStartNonPreWrap || isCursorAtStartPreWrapWithContent) {
37628
+ && (isPreWrapApplied || isTextWrapApplied) && isSplitTextEmpty && hasContentAfterCursor;
37629
+ if ((isCursorAtStartNonPreWrap || isCursorAtStartPreWrapWithContent) &&
37630
+ !_this.range.startContainer.previousSibling) {
37588
37631
  isFocusedFirst = true;
37589
37632
  }
37590
37633
  }
@@ -37593,7 +37636,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
37593
37636
  }
37594
37637
  _this.removeBRElement(nearBlockNode);
37595
37638
  var fireFoxEnterAtMiddle = Browser.userAgent.indexOf('Firefox') !== -1 && _this.range.startOffset === 0 && _this.range.startContainer === _this.range.endContainer &&
37596
- _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) &&
37597
37640
  _this.range.startContainer.parentElement === _this.range.startContainer.previousSibling.parentElement;
37598
37641
  var preventZeroWithSpace = ((_this.range.startContainer.nodeName === '#text' && _this.range.startContainer.textContent.includes('\u200B') &&
37599
37642
  _this.range.startContainer.textContent.trim() === '\u200B') ||