@syncfusion/ej2-richtexteditor 21.1.41 → 21.2.4

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.
@@ -17031,6 +17031,12 @@ class MsWordPaste {
17031
17031
  'object', 'ol', 'pre', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'ul',
17032
17032
  'header', 'article', 'nav', 'footer', 'section', 'aside', 'main', 'figure', 'figcaption'];
17033
17033
  this.borderStyle = ['border-top', 'border-right', 'border-bottom', 'border-left'];
17034
+ this.upperRomanNumber = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX',
17035
+ 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX'];
17036
+ this.lowerRomanNumber = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix',
17037
+ 'x', 'xi', 'xii', 'xiii', 'xiv', 'xv', 'xvi', 'xvii', 'xviii', 'xix', 'xx'];
17038
+ this.lowerGreekNumber = ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ',
17039
+ 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
17034
17040
  this.removableElements = ['o:p', 'style'];
17035
17041
  this.listContents = [];
17036
17042
  this.parent = parent;
@@ -17532,6 +17538,15 @@ class MsWordPaste {
17532
17538
  else if (listStyleType === 'lower-alpha') {
17533
17539
  startAttr = (startString.split('.')[0].charCodeAt(0) - 96);
17534
17540
  }
17541
+ else if (listStyleType === 'upper-roman') {
17542
+ startAttr = this.upperRomanNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
17543
+ }
17544
+ else if (listStyleType === 'lower-roman') {
17545
+ startAttr = this.lowerRomanNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
17546
+ }
17547
+ else if (listStyleType === 'lower-greek') {
17548
+ startAttr = this.lowerGreekNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
17549
+ }
17535
17550
  }
17536
17551
  if (listNodes[i].style.marginLeft !== '') {
17537
17552
  styleMarginLeft = listNodes[i].style.marginLeft;
@@ -17579,22 +17594,16 @@ class MsWordPaste {
17579
17594
  }
17580
17595
  getlistStyleType(listContent, type) {
17581
17596
  let currentListClass;
17582
- const upperRomanNumber = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX',
17583
- 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX'];
17584
- const lowerRomanNumber = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix',
17585
- 'x', 'xi', 'xii', 'xiii', 'xiv', 'xv', 'xvi', 'xvii', 'xviii', 'xix', 'xx'];
17586
- const lowerGreekNumber = ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ',
17587
- 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
17588
17597
  if (type === 'ol') {
17589
17598
  const charCode = listContent.split('.')[0].charCodeAt(0);
17590
17599
  switch (true) {
17591
- case upperRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17600
+ case this.upperRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17592
17601
  currentListClass = 'upper-roman';
17593
17602
  break;
17594
- case lowerRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17603
+ case this.lowerRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17595
17604
  currentListClass = 'lower-roman';
17596
17605
  break;
17597
- case lowerGreekNumber.indexOf(listContent.split('.')[0]) > -1:
17606
+ case this.lowerGreekNumber.indexOf(listContent.split('.')[0]) > -1:
17598
17607
  currentListClass = 'lower-greek';
17599
17608
  break;
17600
17609
  case (charCode > 64 && charCode < 91):
@@ -20181,6 +20190,7 @@ class PasteCleanup {
20181
20190
  }
20182
20191
  this.parent.trigger(beforePasteCleanup, { value: value });
20183
20192
  if (e.args && value !== null && this.parent.editorMode === 'HTML') {
20193
+ let file;
20184
20194
  if (value.length === 0) {
20185
20195
  const htmlRegex = new RegExp(/<\/[a-z][\s\S]*>/i);
20186
20196
  value = e.args.clipboardData.getData('text/plain');
@@ -20188,7 +20198,7 @@ class PasteCleanup {
20188
20198
  value = value.replace(/</g, '&lt;');
20189
20199
  value = value.replace(/>/g, '&gt;');
20190
20200
  this.containsHtml = htmlRegex.test(value);
20191
- const file = e && e.args.clipboardData &&
20201
+ file = e && e.args.clipboardData &&
20192
20202
  e.args.clipboardData.items.length > 0 ?
20193
20203
  (e.args.clipboardData.items[0].getAsFile() === null ?
20194
20204
  (!isNullOrUndefined(e.args.clipboardData.items[1]) ?
@@ -20228,9 +20238,6 @@ class PasteCleanup {
20228
20238
  const currentDocument = this.contentRenderer.getDocument();
20229
20239
  const range = this.nodeSelectionObj.getRange(currentDocument);
20230
20240
  this.saveSelection = this.nodeSelectionObj.save(range, currentDocument);
20231
- this.parent.trigger(afterPasteCleanup, { value: value }, (updatedArgs) => {
20232
- value = updatedArgs.value;
20233
- });
20234
20241
  const tempDivElem = this.parent.createElement('div');
20235
20242
  tempDivElem.innerHTML = value;
20236
20243
  const isValueNotEmpty = tempDivElem.textContent !== '' || !isNullOrUndefined(tempDivElem.querySelector('img')) ||
@@ -20240,7 +20247,7 @@ class PasteCleanup {
20240
20247
  e.args.preventDefault();
20241
20248
  this.pasteDialog(value, args);
20242
20249
  }
20243
- else if (Browser.userAgent.indexOf('Firefox') !== -1) {
20250
+ else if (Browser.userAgent.indexOf('Firefox') !== -1 && isNullOrUndefined(file)) {
20244
20251
  this.fireFoxImageUpload();
20245
20252
  }
20246
20253
  }
@@ -20263,7 +20270,6 @@ class PasteCleanup {
20263
20270
  }
20264
20271
  }
20265
20272
  fireFoxImageUpload() {
20266
- // Timeout 500 is added to capture after default paste image from file manager is completed.
20267
20273
  setTimeout(() => {
20268
20274
  if (Browser.userAgent.indexOf('Firefox') !== -1) {
20269
20275
  let currentFocusNode = this.nodeSelectionObj.getRange(this.contentRenderer.getDocument()).startContainer;
@@ -20770,6 +20776,36 @@ class PasteCleanup {
20770
20776
  this.addTempClass(clipBoardElem);
20771
20777
  if (clipBoardElem.textContent !== '' || !isNullOrUndefined(clipBoardElem.querySelector('img')) ||
20772
20778
  !isNullOrUndefined(clipBoardElem.querySelector('table'))) {
20779
+ const tempWrapperElem = this.parent.createElement('div');
20780
+ tempWrapperElem.innerHTML = value;
20781
+ const filesData = [];
20782
+ if (!isNullOrUndefined(tempWrapperElem.querySelector('img'))) {
20783
+ const imgElem = tempWrapperElem.querySelectorAll('img');
20784
+ const base64Src = [];
20785
+ const imgName = [];
20786
+ const uploadImg = [];
20787
+ for (let i = 0; i < imgElem.length; i++) {
20788
+ if (imgElem[i].getAttribute('src') &&
20789
+ imgElem[i].getAttribute('src').split(',')[0].indexOf('base64') >= 0) {
20790
+ base64Src.push(imgElem[i].getAttribute('src'));
20791
+ imgName.push(getUniqueID('rte_image'));
20792
+ uploadImg.push(imgElem[i]);
20793
+ }
20794
+ }
20795
+ const fileList = [];
20796
+ let currentData;
20797
+ for (let i = 0; i < base64Src.length; i++) {
20798
+ fileList.push(this.base64ToFile(base64Src[i], imgName[i]));
20799
+ currentData = {
20800
+ name: fileList[i].name, rawFile: fileList[i],
20801
+ size: fileList[i].size, type: fileList[i].type,
20802
+ status: '', validationMessages: { minSize: '', maxSize: '' }, statusCode: '1'
20803
+ };
20804
+ filesData.push(currentData);
20805
+ }
20806
+ }
20807
+ this.parent.trigger(afterPasteCleanup, { value: clipBoardElem.innerHTML, filesData: filesData }, (updatedArgs) => { value = updatedArgs.value; });
20808
+ clipBoardElem.innerHTML = value;
20773
20809
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
20774
20810
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
20775
20811
  this.parent.formatter.onSuccess(this.parent, args);
@@ -20859,6 +20895,8 @@ class PasteCleanup {
20859
20895
  this.saveSelection.restore();
20860
20896
  clipBoardElem.innerHTML = this.sanitizeHelper(clipBoardElem.innerHTML);
20861
20897
  this.addTempClass(clipBoardElem);
20898
+ this.parent.trigger(afterPasteCleanup, { value: clipBoardElem.innerHTML, filesData: null }, (updatedArgs) => { value = updatedArgs.value; });
20899
+ clipBoardElem.innerHTML = value;
20862
20900
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
20863
20901
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
20864
20902
  this.parent.formatter.onSuccess(this.parent, args);
@@ -22815,6 +22853,7 @@ class Image {
22815
22853
  (this.parent.inputElement.getBoundingClientRect().right - 32) ?
22816
22854
  ((width / height * expectedY) + width / height) : (this.parent.inputElement.getBoundingClientRect().right - 32);
22817
22855
  img.style.width = currentWidth.toString() + 'px';
22856
+ img.style.height = expectedY + 'px';
22818
22857
  }
22819
22858
  else if (img.style.width !== '') {
22820
22859
  const currentWidth = (width / height * expectedY) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
@@ -28218,7 +28257,9 @@ class Table {
28218
28257
  this.curTable.style.width = this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) > 100 ? (100 + '%') : (this.convertPixelToPercentage(tableWidth + mouseX, widthCompare) + '%');
28219
28258
  const differenceWidth = currentTableWidth - this.convertPixelToPercentage(tableWidth + mouseX, widthCompare);
28220
28259
  for (let i = 0; i < lastColumnsCell.length; i++) {
28221
- this.curTable.rows[i].cells[this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
28260
+ if (this.curTable.rows[i].cells[this.colIndex]) {
28261
+ this.curTable.rows[i].cells[this.colIndex].style.width = (currentColumnCellWidth - differenceWidth) + '%';
28262
+ }
28222
28263
  }
28223
28264
  }
28224
28265
  }
@@ -28228,7 +28269,7 @@ class Table {
28228
28269
  const totalwid = parseFloat(this.columnEle.offsetWidth.toString()) +
28229
28270
  parseFloat(cellColl[this.colIndex - 1].offsetWidth.toString());
28230
28271
  for (let i = 0; i < this.curTable.rows.length; i++) {
28231
- if ((totalwid - actualwid) > 20 && actualwid > 20) {
28272
+ if ((totalwid - actualwid) > 20 && actualwid > 20 && this.curTable.rows[i].cells[i]) {
28232
28273
  const leftColumnWidth = totalwid - actualwid;
28233
28274
  const rightColWidth = actualwid;
28234
28275
  const index = this.curTable.rows[i].cells[i].hasAttribute('colspan') ?