@syncfusion/ej2-richtexteditor 24.2.3 → 24.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.
@@ -2668,7 +2668,7 @@ let defaultLocale = {
2668
2668
  'audioLayoutOption': 'Layout option',
2669
2669
  'videoLayoutOption': 'Layout option',
2670
2670
  'align': 'Align',
2671
- 'caption': 'Image Caption',
2671
+ 'caption': 'Caption',
2672
2672
  'remove': 'Remove',
2673
2673
  'insertLink': 'Insert Link',
2674
2674
  'display': 'Display',
@@ -2732,14 +2732,14 @@ let defaultLocale = {
2732
2732
  'cellspacing': 'Cell Spacing',
2733
2733
  'columns': 'Number of columns',
2734
2734
  'rows': 'Number of rows',
2735
- 'tableRows': 'Table Rows',
2736
- 'tableColumns': 'Table Columns',
2735
+ 'tableRows': 'Row',
2736
+ 'tableColumns': 'Column',
2737
2737
  'tableCellHorizontalAlign': 'Table Cell Horizontal Align',
2738
- 'tableCellVerticalAlign': 'Table Vertical Align',
2738
+ 'tableCellVerticalAlign': 'Vertical Align',
2739
2739
  'createTable': 'Create Table',
2740
2740
  'removeTable': 'Remove Table',
2741
- 'tableHeader': 'Table Header',
2742
- 'tableRemove': 'Table Remove',
2741
+ 'tableHeader': 'Header Row',
2742
+ 'tableRemove': 'Delete',
2743
2743
  'tableCellBackground': 'Table Cell Background',
2744
2744
  'tableEditProperties': 'Table Edit Properties',
2745
2745
  'styles': 'Styles',
@@ -7882,6 +7882,33 @@ function getDefaultMDTbStatus() {
7882
7882
  formats: null
7883
7883
  };
7884
7884
  }
7885
+ /**
7886
+ * @param {Range} range - specifies the range
7887
+ * @returns {void}
7888
+ * @hidden
7889
+ */
7890
+ function nestedListCleanUp(range) {
7891
+ if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
7892
+ range.extractContents();
7893
+ while ((range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty').length > 0 ||
7894
+ (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('ol :empty').length > 0) {
7895
+ let emptyLI = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty');
7896
+ if (emptyLI.length > 0) {
7897
+ emptyLI.forEach((item) => {
7898
+ item.remove();
7899
+ });
7900
+ }
7901
+ }
7902
+ let liElem = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll("li");
7903
+ if (liElem.length > 0) {
7904
+ liElem.forEach((item) => {
7905
+ if (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL") {
7906
+ item.style.listStyleType = "none";
7907
+ }
7908
+ });
7909
+ }
7910
+ }
7911
+ }
7885
7912
 
7886
7913
  /**
7887
7914
  * MarkdownToolbarStatus module for refresh the toolbar status
@@ -10821,6 +10848,9 @@ class NodeSelection {
10821
10848
  || this.isChildNode(nodeCollection, startNode))) {
10822
10849
  return null;
10823
10850
  }
10851
+ if (startNode.nodeType === 3 && startNode.previousSibling === endNode && endNode.nodeName === 'IMG') {
10852
+ return null;
10853
+ }
10824
10854
  if (nodeCollection.indexOf(startNode.firstChild) === -1 && startNode.firstChild && !this.isChildNode(nodeCollection, startNode)) {
10825
10855
  return startNode.firstChild;
10826
10856
  }
@@ -13536,7 +13566,12 @@ class InsertHtml {
13536
13566
  lasNode.textContent.length : lasNode.childNodes.length);
13537
13567
  range = nodeSelection.getRange(docElement);
13538
13568
  }
13539
- range.extractContents();
13569
+ if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
13570
+ nestedListCleanUp(range);
13571
+ }
13572
+ else {
13573
+ range.extractContents();
13574
+ }
13540
13575
  if (insertNode.tagName === 'TABLE') {
13541
13576
  this.removeEmptyElements(editNode);
13542
13577
  }
@@ -20431,12 +20466,12 @@ const IFRAMEHEADER = `
20431
20466
  display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}
20432
20467
  .e-rte-image.e-img-focus:not(.e-resize), .e-audio-focus:not(.e-resize), .e-video-focus:not(.e-resize) {border: solid 2px #4a90e2;}
20433
20468
  img.e-img-focus::selection, audio.e-audio-focus::selection, .e-video-focus::selection { background: transparent;color: transparent;}
20434
- span.e-rte-imageboxmark { width: 10px; height: 10px; position: absolute; display: block;
20469
+ span.e-rte-imageboxmark, span.e-rte-videoboxmark { width: 10px; height: 10px; position: absolute; display: block;
20435
20470
  background: #4a90e2; border: 1px solid #fff; z-index: 1000;}
20436
- .e-mob-rte.e-mob-span span.e-rte-imageboxmark { background: #4a90e2; border: 1px solid #fff; }
20437
- .e-mob-rte span.e-rte-imageboxmark { background: #fff; border: 1px solid #4a90e2;
20471
+ .e-mob-rte.e-mob-span span.e-rte-imageboxmark, .e-mob-rte.e-mob-span span.e-rte-videoboxmark { background: #4a90e2; border: 1px solid #fff; }
20472
+ .e-mob-rte span.e-rte-imageboxmark, .e-mob-rte span.e-rte-videoboxmark { background: #fff; border: 1px solid #4a90e2;
20438
20473
  border-radius: 15px; height: 20px; width: 20px; }
20439
- .e-mob-rte.e-mob-span span.e-rte-imageboxmark { background: #4a90e2; border: 1px solid #fff; }
20474
+ .e-mob-rte.e-mob-span span.e-rte-imageboxmark, .e-mob-rte.e-mob-span span.e-rte-videoboxmark { background: #4a90e2; border: 1px solid #fff; }
20440
20475
  .e-rte-content .e-content img.e-resize, .e-rte-content .e-content video.e-resize { z-index: 1000; }
20441
20476
  .e-img-caption .e-img-inner { outline: 0; }
20442
20477
  .e-img-caption a:focus-visible { outline: none; }
@@ -28170,6 +28205,7 @@ class Video {
28170
28205
  this.isAllowedTypes = true;
28171
28206
  this.pageX = null;
28172
28207
  this.pageY = null;
28208
+ this.mouseX = null;
28173
28209
  this.deletedVid = [];
28174
28210
  this.parent = parent;
28175
28211
  this.rteID = parent.element.id;
@@ -28566,62 +28602,50 @@ class Video {
28566
28602
  if (isNullOrUndefined(vidEleStyle)) {
28567
28603
  return;
28568
28604
  }
28569
- // eslint-disable-next-line
28570
- const width = vidEleStyle.width !== '' ? vidEleStyle.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(vidEleStyle.width) :
28605
+ /* eslint-disable */
28606
+ let width = vidEleStyle.width !== '' ? vidEleStyle.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(vidEleStyle.width) :
28571
28607
  parseInt(vidEleStyle.width, 10) : vid.style.width !== '' ? vid.style.width : vid.width;
28572
- const height = vidEleStyle.height !== '' ? parseInt(vidEleStyle.height, 10) : vid.style.height !== '' ? vid.style.height : vid.height;
28608
+ let height = vidEleStyle.height !== '' ? parseInt(vidEleStyle.height, 10) : vid.style.height !== '' ? vid.style.height : vid.height;
28609
+ width = width.toString().match(/\b\d+(\.\d*)?(%|$)\b/g) ? parseFloat(width.toString()) : parseInt(width.toString(), 10);
28610
+ height = height.toString().match(/\b\d+(\.\d*)?(%|$)\b/g) ? parseFloat(height.toString()) : parseInt(height.toString(), 10);
28611
+ /* eslint-enable */
28573
28612
  if (width > height) {
28574
28613
  vid.style.minWidth = this.parent.insertVideoSettings.minWidth === 0 ? '200px' : formatUnit(this.parent.insertVideoSettings.minWidth);
28575
28614
  vid.style.minHeight = this.parent.insertVideoSettings.minHeight === 0 ? '90px' : formatUnit(this.parent.insertVideoSettings.minHeight);
28576
28615
  if (this.parent.insertVideoSettings.resizeByPercent) {
28577
- if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
28578
- const percentageValue = this.pixToPerc((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY), (vid.previousElementSibling || vid.parentElement));
28579
- vid.style.width = Math.min(Math.round((percentageValue / vid.getBoundingClientRect().width) * expectedX * 100) / 100, 100) + '%';
28580
- }
28581
- else {
28582
- vid.style.width = this.pixToPerc(parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY, (vid.previousElementSibling || vid.parentElement)) + '%';
28583
- }
28584
- vid.style.height = null;
28585
- vid.removeAttribute('height');
28616
+ this.updateVidEleWidth(vid, width, height, expectedX, expectedY);
28586
28617
  }
28587
28618
  else if ((vid.style.width === '' && vid.style.height !== '') || (vidEleStyle.width === '' && vidEleStyle.height !== '')) {
28588
28619
  vid.style.height = expectedY + 'px';
28589
28620
  }
28590
28621
  else if ((vid.style.width !== '' && vid.style.height === '') || (vidEleStyle.width !== '' && vidEleStyle.height === '')) {
28591
- const currentWidth = ((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) +
28592
- parseInt(width.toString(), 10) / parseInt(height.toString(), 10)) <
28622
+ const currentWidth = ((width / height * expectedY) +
28623
+ width / height) <
28593
28624
  (this.parent.inputElement.getBoundingClientRect().right - 32) ?
28594
- ((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) +
28595
- parseInt(width.toString(), 10) / parseInt(height.toString(), 10)) :
28625
+ ((width / height * expectedY) +
28626
+ width / height) :
28596
28627
  (this.parent.inputElement.getBoundingClientRect().right - 32);
28597
28628
  vid.style.width = currentWidth.toString() + 'px';
28598
28629
  }
28599
28630
  else if (vid.style.width !== '' || vidEleStyle.width !== '') {
28600
- const currentWidth = (parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) <
28631
+ const currentWidth = (width / height * expectedY) <
28601
28632
  (this.parent.inputElement.getBoundingClientRect().right - 32) ?
28602
- (parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) :
28633
+ (width / height * expectedY) :
28603
28634
  (this.parent.inputElement.getBoundingClientRect().right - 32);
28604
28635
  vid.style.width = currentWidth + 'px';
28605
28636
  vid.style.height = expectedY + 'px';
28606
28637
  }
28607
28638
  else {
28608
- vid.setAttribute('width', (parseInt(((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY) + parseInt(width.toString(), 10) / parseInt(height.toString(), 10)).toString(), 10)).toString());
28639
+ vid.setAttribute('width', (parseInt(((width / height * expectedY) + width / height).toString(), 10)).toString());
28609
28640
  }
28610
28641
  }
28611
28642
  else if (height > width) {
28612
28643
  if (this.parent.insertVideoSettings.resizeByPercent) {
28613
- if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
28614
- vid.style.width = Math.min(Math.round((parseInt(width.toString(), 10) / vid.getBoundingClientRect().width) * expectedX * 100) / 100, 100) + '%';
28615
- }
28616
- else {
28617
- vid.style.width = this.pixToPerc((expectedX / parseInt(height.toString(), 10) * expectedY), (vid.previousElementSibling || vid.parentElement)) + '%';
28618
- }
28619
- vid.style.height = null;
28620
- vid.removeAttribute('height');
28644
+ this.updateVidEleWidth(vid, width, height, expectedX, expectedY);
28621
28645
  }
28622
28646
  else if (vid.style.width !== '' || vidEleStyle.width !== '') {
28623
28647
  vid.style.width = expectedX + 'px';
28624
- vid.style.height = (parseInt(height.toString(), 10) / parseInt(width.toString(), 10) * expectedX) + 'px';
28648
+ vid.style.height = (height / width * expectedX) + 'px';
28625
28649
  }
28626
28650
  else {
28627
28651
  vid.setAttribute('width', this.resizeBtnStat.botRight ? (this.getPointX(e.event) - vid.getBoundingClientRect().left).toString() : expectedX.toString());
@@ -28639,6 +28663,23 @@ class Video {
28639
28663
  }
28640
28664
  }
28641
28665
  }
28666
+ updateVidEleWidth(vid, width, height, expectedX, expectedY) {
28667
+ if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
28668
+ const original = vid.offsetWidth + this.mouseX;
28669
+ const finalWidthByPerc = (original / vid.offsetWidth) * (parseFloat(vid.style.width).toString() === 'NaN' ? (vid.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) : parseFloat(vid.style.width));
28670
+ vid.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
28671
+ }
28672
+ else {
28673
+ if (width > height) {
28674
+ vid.style.width = this.pixToPerc(width / height * expectedY, (vid.previousElementSibling || vid.parentElement)) + '%';
28675
+ }
28676
+ else {
28677
+ vid.style.width = this.pixToPerc((expectedX / height * expectedY), (vid.previousElementSibling || vid.parentElement)) + '%';
28678
+ }
28679
+ }
28680
+ vid.style.height = null;
28681
+ vid.removeAttribute('height');
28682
+ }
28642
28683
  pixToPerc(expected, parentEle) {
28643
28684
  return expected / parseFloat(getComputedStyle(parentEle).width) * 100;
28644
28685
  }
@@ -28679,6 +28720,7 @@ class Video {
28679
28720
  const height = parseInt(this.vidDupPos.height, 10) + mouseY;
28680
28721
  this.pageX = pageX;
28681
28722
  this.pageY = pageY;
28723
+ this.mouseX = mouseX;
28682
28724
  if (this.resizeBtnStat.botRight) {
28683
28725
  this.vidDupMouseMove(width + 'px', height + 'px', e);
28684
28726
  }
@@ -34020,7 +34062,7 @@ let RichTextEditor = class RichTextEditor extends Component {
34020
34062
  if (this.valueContainer) {
34021
34063
  this.valueContainer.value = (this.enableHtmlEncode) ? this.value : value;
34022
34064
  }
34023
- if (this.editorMode === 'HTML' && this.inputElement && this.inputElement.innerHTML.replace('&amp;', '&').trim() !== value.trim()) {
34065
+ if (this.editorMode === 'HTML' && this.inputElement && this.inputElement.innerHTML.trim() !== value.trim()) {
34024
34066
  this.inputElement.innerHTML = value;
34025
34067
  }
34026
34068
  else if (this.editorMode === 'Markdown' && this.inputElement
@@ -34041,9 +34083,6 @@ let RichTextEditor = class RichTextEditor extends Component {
34041
34083
  }
34042
34084
  else {
34043
34085
  this.inputElement.innerHTML = '<p><br/></p>';
34044
- if (value === '' && this.formatter && this.inputElement) {
34045
- this.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), this.inputElement.firstElementChild, this.inputElement.firstElementChild.childElementCount);
34046
- }
34047
34086
  }
34048
34087
  }
34049
34088
  else {
@@ -35201,6 +35240,9 @@ let RichTextEditor = class RichTextEditor extends Component {
35201
35240
  if (item[j].classList.length === 0) {
35202
35241
  item[j].removeAttribute('class');
35203
35242
  }
35243
+ if (item[j].nodeName === 'IMG' && item[j].style.outline !== '') {
35244
+ item[j].style.outline = '';
35245
+ }
35204
35246
  }
35205
35247
  }
35206
35248
  }