@syncfusion/ej2-richtexteditor 21.1.35 → 21.1.39

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.
@@ -3008,8 +3008,9 @@ function decode(value) {
3008
3008
  function sanitizeHelper(value, parent) {
3009
3009
  if (parent.enableHtmlSanitizer) {
3010
3010
  const item = SanitizeHtmlHelper.beforeSanitize();
3011
- if (item.selectors.tags[2] && item.selectors.tags[2].indexOf('iframe') > -1)
3011
+ if (item.selectors.tags[2] && item.selectors.tags[2].indexOf('iframe') > -1) {
3012
3012
  item.selectors.tags[2] = 'iframe:not(.e-rte-embed-url)';
3013
+ }
3013
3014
  const beforeEvent = {
3014
3015
  cancel: false,
3015
3016
  helper: null
@@ -5075,7 +5076,7 @@ class Toolbar$2 {
5075
5076
  toolbarClickHandler(e) {
5076
5077
  const trg = closest(e.originalEvent.target, '.e-hor-nav');
5077
5078
  if (trg && this.parent.toolbarSettings.type === ToolbarType.Expand && !isNullOrUndefined(trg)) {
5078
- let extendedTbar = this.tbElement.querySelector('.e-toolbar-extended');
5079
+ const extendedTbar = this.tbElement.querySelector('.e-toolbar-extended');
5079
5080
  if (!isNullOrUndefined(extendedTbar)) {
5080
5081
  setStyleAttribute(extendedTbar, { maxHeight: '', display: 'block' });
5081
5082
  setStyleAttribute(extendedTbar, { maxHeight: extendedTbar.offsetHeight + 'px', display: '' });
@@ -5956,8 +5957,8 @@ class BaseQuickToolbar {
5956
5957
  }
5957
5958
  if (!isNullOrUndefined(document.querySelector('.e-tooltip-wrap'))) {
5958
5959
  if (!isNullOrUndefined(document.querySelector('#' + this.element.id + ' [data-tooltip-id]'))) {
5959
- let tooltipTargetEle = document.querySelector('#' + this.element.id + ' [data-tooltip-id]');
5960
- let dataContent = tooltipTargetEle.getAttribute('data-content');
5960
+ const tooltipTargetEle = document.querySelector('#' + this.element.id + ' [data-tooltip-id]');
5961
+ const dataContent = tooltipTargetEle.getAttribute('data-content');
5961
5962
  tooltipTargetEle.removeAttribute('data-content');
5962
5963
  tooltipTargetEle.setAttribute('title', dataContent);
5963
5964
  tooltipTargetEle.removeAttribute('data-tooltip-id');
@@ -14440,8 +14441,9 @@ class VideoCommand {
14440
14441
  : (Browser.isIE ? selectedNode : !e.item.isEmbedUrl ? selectedNode.lastElementChild : selectedNode.querySelector('iframe'));
14441
14442
  videoElm.addEventListener(videoElm.tagName !== 'IFRAME' ? 'loadeddata' : 'load', () => {
14442
14443
  if (e.value !== 'VideoReplace' || !isReplaced) {
14443
- if (e.item.isEmbedUrl && videoElm)
14444
+ if (e.item.isEmbedUrl && videoElm) {
14444
14445
  videoElm.classList.add('e-rte-embed-url');
14446
+ }
14445
14447
  e.callBack({
14446
14448
  requestType: 'Videos',
14447
14449
  editorMode: 'HTML',
@@ -14856,7 +14858,7 @@ class TableCommand {
14856
14858
  const colIndex = Array.prototype.indexOf.call(selectedCell.parentNode.childNodes, selectedCell);
14857
14859
  this.curTable = closest(selectedCell, 'table');
14858
14860
  let currentRow;
14859
- const allCells = this.getCorrespondingColumns();
14861
+ let allCells = this.getCorrespondingColumns();
14860
14862
  const minMaxIndex = this.getSelectedCellMinMaxIndex(allCells);
14861
14863
  let maxI;
14862
14864
  let j;
@@ -14871,8 +14873,19 @@ class TableCommand {
14871
14873
  if (j === 0 || allCells[maxI][j] !== allCells[maxI][j - 1]) {
14872
14874
  if (1 < parseInt(allCells[maxI][j].getAttribute('rowspan'), 10)) {
14873
14875
  const rowSpanVal = parseInt(allCells[maxI][j].getAttribute('rowspan'), 10) - 1;
14874
- //eslint-disable-next-line
14875
- 1 === rowSpanVal ? allCells[maxI][j].removeAttribute('rowspan') : allCells[maxI][j].setAttribute('rowspan', rowSpanVal.toString());
14876
+ /* eslint-disable */
14877
+ if (1 === rowSpanVal) {
14878
+ allCells[maxI][j].removeAttribute('rowspan');
14879
+ const cell = allCells[maxI][j].cloneNode(true);
14880
+ allCells = this.getCorrespondingColumns();
14881
+ if (allCells[rowSpanVal][j] && allCells[rowSpanVal][j].parentElement) {
14882
+ allCells[rowSpanVal][j].parentElement.insertBefore(cell, allCells[rowSpanVal][j]);
14883
+ }
14884
+ }
14885
+ else {
14886
+ allCells[maxI][j].setAttribute('rowspan', rowSpanVal.toString());
14887
+ }
14888
+ /* eslint-enable */
14876
14889
  }
14877
14890
  }
14878
14891
  // eslint-disable-next-line max-len
@@ -17065,6 +17078,7 @@ class MsWordPaste {
17065
17078
  if (!isNullOrUndefined(imgElem[i].getAttribute('v:shapes')) &&
17066
17079
  imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 &&
17067
17080
  imgElem[i].getAttribute('v:shapes').indexOf('圖片') < 0 &&
17081
+ imgElem[i].getAttribute('v:shapes').indexOf('Grafik') < 0 &&
17068
17082
  imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0) {
17069
17083
  detach(imgElem[i]);
17070
17084
  }
@@ -17159,7 +17173,7 @@ class MsWordPaste {
17159
17173
  hexConversion(rtfData) {
17160
17174
  // eslint-disable-next-line
17161
17175
  const picHead = /\{\\pict[\s\S]+?\\bliptag\-?\d+(\\blipupi\-?\d+)?(\{\\\*\\blipuid\s?[\da-fA-F]+)?[\s\}]*?/;
17162
- // eslint-disable-next-line security/detect-non-literal-regexp
17176
+ // eslint-disable-next-line
17163
17177
  const pic = new RegExp('(?:(' + picHead.source + '))([\\da-fA-F\\s]+)\\}', 'g');
17164
17178
  const fullImg = rtfData.match(pic);
17165
17179
  let imgType;
@@ -17223,9 +17237,9 @@ class MsWordPaste {
17223
17237
  removeUnwantedElements(elm) {
17224
17238
  let innerElement = elm.innerHTML;
17225
17239
  for (let i = 0; i < this.removableElements.length; i++) {
17226
- // eslint-disable-next-line security/detect-non-literal-regexp
17240
+ // eslint-disable-next-line
17227
17241
  const regExpStartElem = new RegExp('<' + this.removableElements[i] + '>', 'g');
17228
- // eslint-disable-next-line security/detect-non-literal-regexp
17242
+ // eslint-disable-next-line
17229
17243
  const regExpEndElem = new RegExp('</' + this.removableElements[i] + '>', 'g');
17230
17244
  innerElement = innerElement.replace(regExpStartElem, '');
17231
17245
  innerElement = innerElement.replace(regExpEndElem, '');
@@ -17316,10 +17330,10 @@ class MsWordPaste {
17316
17330
  }
17317
17331
  fromClass = false;
17318
17332
  }
17319
- let listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
17333
+ const listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
17320
17334
  for (let i = 0; i < listClass.length; i++) {
17321
17335
  if (keys.indexOf('li.' + listClass[i]) > -1) {
17322
- let olULElems = elm.querySelectorAll('ol.' + listClass[i] + ', ul.' + listClass[i]);
17336
+ const olULElems = elm.querySelectorAll('ol.' + listClass[i] + ', ul.' + listClass[i]);
17323
17337
  for (let j = 0; j < olULElems.length; j++) {
17324
17338
  const styleProperty = olULElems[j].getAttribute('style');
17325
17339
  if (!isNullOrUndefined(styleProperty) && styleProperty.trim() !== '' && olULElems[j].style.marginLeft !== '') {
@@ -17329,8 +17343,8 @@ class MsWordPaste {
17329
17343
  if (!isNullOrUndefined(valueSplit[k].split(':')[1]) &&
17330
17344
  valueSplit[k].split(':')[1].indexOf('in') >= 0 &&
17331
17345
  olULElems[j].style.marginLeft.indexOf('in') >= 0) {
17332
- let classStyle = parseFloat(valueSplit[k].split(':')[1].split('in')[0]);
17333
- let inlineStyle = parseFloat(olULElems[j].style.marginLeft.split('in')[0]);
17346
+ const classStyle = parseFloat(valueSplit[k].split(':')[1].split('in')[0]);
17347
+ const inlineStyle = parseFloat(olULElems[j].style.marginLeft.split('in')[0]);
17334
17348
  olULElems[j].style.marginLeft = (inlineStyle - classStyle) + 'in';
17335
17349
  }
17336
17350
  }
@@ -17526,14 +17540,14 @@ class MsWordPaste {
17526
17540
  }
17527
17541
  getlistStyleType(listContent, type) {
17528
17542
  let currentListClass;
17529
- let upperRomanNumber = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX',
17543
+ const upperRomanNumber = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX',
17530
17544
  'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX'];
17531
- let lowerRomanNumber = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix',
17545
+ const lowerRomanNumber = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix',
17532
17546
  'x', 'xi', 'xii', 'xiii', 'xiv', 'xv', 'xvi', 'xvii', 'xviii', 'xix', 'xx'];
17533
- let lowerGreekNumber = ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ',
17547
+ const lowerGreekNumber = ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ',
17534
17548
  'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
17535
17549
  if (type === 'ol') {
17536
- let charCode = listContent.split('.')[0].charCodeAt(0);
17550
+ const charCode = listContent.split('.')[0].charCodeAt(0);
17537
17551
  switch (true) {
17538
17552
  case upperRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17539
17553
  currentListClass = 'upper-roman';
@@ -22698,7 +22712,7 @@ class Image {
22698
22712
  if (isNullOrUndefined(img.width)) {
22699
22713
  return;
22700
22714
  }
22701
- // eslint-disable-next-line security/detect-unsafe-regex
22715
+ // eslint-disable-next-line
22702
22716
  const width = img.style.width !== '' ? img.style.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(img.style.width) :
22703
22717
  parseInt(img.style.width, 10) : img.width;
22704
22718
  const height = img.style.height !== '' ? parseInt(img.style.height, 10) : img.height;
@@ -22736,7 +22750,7 @@ class Image {
22736
22750
  img.setAttribute('width', (img.width + this.mouseX).toString());
22737
22751
  }
22738
22752
  else {
22739
- const currentWidth = img.offsetWidth === 0 ? img.width + this.mouseX + parseInt(img.style.outlineWidth.split('p')[0]) : img.offsetWidth + this.mouseX;
22753
+ const currentWidth = img.offsetWidth === 0 ? img.width + this.mouseX + parseInt(img.style.outlineWidth.split('p')[0], 10) : img.offsetWidth + this.mouseX;
22740
22754
  img.setAttribute('width', (currentWidth).toString());
22741
22755
  }
22742
22756
  }
@@ -30423,7 +30437,6 @@ let RichTextEditor = class RichTextEditor extends Component {
30423
30437
  const currentEndContainer = range.endContainer;
30424
30438
  const currentStartOffset = range.startOffset;
30425
30439
  const isSameContainer = currentStartContainer === currentEndContainer ? true : false;
30426
- const currentEndOffset = currentEndContainer.textContent.length;
30427
30440
  const endNode = range.endContainer.nodeName === '#text' ? range.endContainer.parentElement :
30428
30441
  range.endContainer;
30429
30442
  const closestLI = closest(endNode, 'LI');
@@ -30442,7 +30455,7 @@ let RichTextEditor = class RichTextEditor extends Component {
30442
30455
  currentLastElem = currentLastElem.lastChild;
30443
30456
  }
30444
30457
  if (isDetached) {
30445
- let currentLast = currentLastElem.nodeName === 'BR' && !isNullOrUndefined(currentLastElem.previousSibling) ?
30458
+ const currentLast = currentLastElem.nodeName === 'BR' && !isNullOrUndefined(currentLastElem.previousSibling) ?
30446
30459
  currentLastElem.previousSibling : currentLastElem;
30447
30460
  this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), isSameContainer ? currentLast : currentStartContainer, currentLast, currentStartOffset, (currentLast.nodeName === 'BR' ? 0 : currentLast.textContent.length));
30448
30461
  }