@syncfusion/ej2-richtexteditor 21.2.5 → 21.2.8
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.
- package/CHANGELOG.md +26 -0
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +76 -29
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +75 -28
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/dist/global/ej2-richtexteditor.min.js +2 -2
- package/dist/global/ej2-richtexteditor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +8 -8
- package/src/editor-manager/plugin/isformatted.js +8 -2
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +2 -0
- package/src/editor-manager/plugin/ms-word-clean-up.js +46 -20
- package/src/editor-manager/plugin/table.d.ts +1 -0
- package/src/editor-manager/plugin/table.js +16 -4
- package/src/rich-text-editor/actions/html-editor.js +3 -2
- package/src/rich-text-editor/actions/paste-clean-up.js +1 -1
- package/src/rich-text-editor/base/rich-text-editor.js +1 -0
|
@@ -14984,10 +14984,13 @@ var TableCommand = /** @__PURE__ @class */ (function () {
|
|
|
14984
14984
|
/* eslint-disable */
|
|
14985
14985
|
if (1 === rowSpanVal) {
|
|
14986
14986
|
allCells[maxI][j].removeAttribute('rowspan');
|
|
14987
|
-
var cell =
|
|
14988
|
-
|
|
14989
|
-
|
|
14990
|
-
|
|
14987
|
+
var cell = this.getMergedRow(this.getCorrespondingColumns())[j];
|
|
14988
|
+
if (cell) {
|
|
14989
|
+
var cloneNode = cell.cloneNode(true);
|
|
14990
|
+
cloneNode.innerHTML = '<br>';
|
|
14991
|
+
if (cell.parentElement) {
|
|
14992
|
+
cell.parentElement.insertBefore(cloneNode, cell);
|
|
14993
|
+
}
|
|
14991
14994
|
}
|
|
14992
14995
|
}
|
|
14993
14996
|
else {
|
|
@@ -15037,6 +15040,15 @@ var TableCommand = /** @__PURE__ @class */ (function () {
|
|
|
15037
15040
|
});
|
|
15038
15041
|
}
|
|
15039
15042
|
};
|
|
15043
|
+
TableCommand.prototype.getMergedRow = function (cells) {
|
|
15044
|
+
var mergedRow;
|
|
15045
|
+
for (var i = 0; i < cells.length; i++) {
|
|
15046
|
+
if (cells[i].length !== this.curTable.rows[0].childNodes.length) {
|
|
15047
|
+
mergedRow = cells[i];
|
|
15048
|
+
}
|
|
15049
|
+
}
|
|
15050
|
+
return mergedRow;
|
|
15051
|
+
};
|
|
15040
15052
|
TableCommand.prototype.removeTable = function (e) {
|
|
15041
15053
|
var selectedCell = e.item.selection.range.startContainer;
|
|
15042
15054
|
selectedCell = (selectedCell.nodeType === 3) ? selectedCell.parentNode : selectedCell;
|
|
@@ -15684,9 +15696,12 @@ var IsFormatted = /** @__PURE__ @class */ (function () {
|
|
|
15684
15696
|
var validTags = ['u'];
|
|
15685
15697
|
if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
|
|
15686
15698
|
return true;
|
|
15699
|
+
/* eslint-disable */
|
|
15687
15700
|
}
|
|
15688
15701
|
else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
|
|
15689
|
-
node.style && node.style.textDecoration === 'underline'
|
|
15702
|
+
node.style && (node.style.textDecoration === 'underline' ||
|
|
15703
|
+
node.style.textDecorationLine === 'underline')) {
|
|
15704
|
+
/* eslint-enable */
|
|
15690
15705
|
return true;
|
|
15691
15706
|
}
|
|
15692
15707
|
else {
|
|
@@ -15705,9 +15720,12 @@ var IsFormatted = /** @__PURE__ @class */ (function () {
|
|
|
15705
15720
|
var validTags = ['del', 'strike'];
|
|
15706
15721
|
if (validTags.indexOf(node.nodeName.toLowerCase()) !== -1) {
|
|
15707
15722
|
return true;
|
|
15723
|
+
/* eslint-disable */
|
|
15708
15724
|
}
|
|
15709
15725
|
else if (this.inlineTags.indexOf(node.nodeName.toLowerCase()) !== -1 &&
|
|
15710
|
-
node.style && node.style.textDecoration === 'line-through'
|
|
15726
|
+
node.style && (node.style.textDecoration === 'line-through' ||
|
|
15727
|
+
node.style.textDecorationLine === 'line-through')) {
|
|
15728
|
+
/* eslint-enable */
|
|
15711
15729
|
return true;
|
|
15712
15730
|
}
|
|
15713
15731
|
else {
|
|
@@ -17197,6 +17215,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17197
17215
|
this.removingComments(elm);
|
|
17198
17216
|
this.removeUnwantedElements(elm);
|
|
17199
17217
|
this.removeEmptyElements(elm);
|
|
17218
|
+
this.removeEmptyAnchorTag(elm);
|
|
17200
17219
|
this.breakLineAddition(elm);
|
|
17201
17220
|
this.removeClassName(elm);
|
|
17202
17221
|
if (pattern4.test(tempHTMLContent)) {
|
|
@@ -17250,7 +17269,8 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17250
17269
|
imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 &&
|
|
17251
17270
|
imgElem[i].getAttribute('v:shapes').indexOf('圖片') < 0 &&
|
|
17252
17271
|
imgElem[i].getAttribute('v:shapes').indexOf('Grafik') < 0 &&
|
|
17253
|
-
imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0
|
|
17272
|
+
imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0 &&
|
|
17273
|
+
imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0) {
|
|
17254
17274
|
detach(imgElem[i]);
|
|
17255
17275
|
}
|
|
17256
17276
|
}
|
|
@@ -17423,6 +17443,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17423
17443
|
if (!isNullOrUndefined(element.parentElement)) {
|
|
17424
17444
|
if (element.parentElement.textContent.trim() === '' &&
|
|
17425
17445
|
element.parentElement.getAttribute('id') !== 'MSWord-Content' &&
|
|
17446
|
+
!(this.hasParentWithClass(element, 'MsoListParagraph')) &&
|
|
17426
17447
|
isNullOrUndefined(element.parentElement.querySelector('img'))) {
|
|
17427
17448
|
removableElement = this.findDetachEmptyElem(element.parentElement);
|
|
17428
17449
|
}
|
|
@@ -17435,6 +17456,16 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17435
17456
|
}
|
|
17436
17457
|
return removableElement;
|
|
17437
17458
|
};
|
|
17459
|
+
MsWordPaste.prototype.hasParentWithClass = function (element, className) {
|
|
17460
|
+
var currentParentElem = element.parentElement;
|
|
17461
|
+
while (!isNullOrUndefined(currentParentElem)) {
|
|
17462
|
+
if (currentParentElem.classList.contains(className)) {
|
|
17463
|
+
return true;
|
|
17464
|
+
}
|
|
17465
|
+
currentParentElem = currentParentElem.parentElement;
|
|
17466
|
+
}
|
|
17467
|
+
return false;
|
|
17468
|
+
};
|
|
17438
17469
|
MsWordPaste.prototype.removeEmptyElements = function (element) {
|
|
17439
17470
|
var emptyElements = element.querySelectorAll(':empty');
|
|
17440
17471
|
for (var i = 0; i < emptyElements.length; i++) {
|
|
@@ -17585,7 +17616,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17585
17616
|
}
|
|
17586
17617
|
else if (allNodes[index].className &&
|
|
17587
17618
|
allNodes[index].className.toLowerCase().indexOf('msolistparagraph') !== -1 &&
|
|
17588
|
-
|
|
17619
|
+
!isNullOrUndefined(allNodes[index].getAttribute('style')) &&
|
|
17589
17620
|
allNodes[index].getAttribute('style').indexOf('mso-list:') >= 0) {
|
|
17590
17621
|
if (allNodes[index].className.indexOf('MsoListParagraphCxSpFirst') >= 0 && listNodes.length > 0 &&
|
|
17591
17622
|
listNodes[listNodes.length - 1] !== null) {
|
|
@@ -17766,6 +17797,19 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17766
17797
|
var listCount = 0;
|
|
17767
17798
|
var elem;
|
|
17768
17799
|
for (var index = 0; index < collection.length; index++) {
|
|
17800
|
+
var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
|
|
17801
|
+
var isNormalList = false;
|
|
17802
|
+
for (var i = 0; i < listClass.length; i++) {
|
|
17803
|
+
if (listClass[i].indexOf(collection[index].class) >= 0) {
|
|
17804
|
+
isNormalList = true;
|
|
17805
|
+
break;
|
|
17806
|
+
}
|
|
17807
|
+
}
|
|
17808
|
+
if (!isNullOrUndefined(prevList) && index != 0 &&
|
|
17809
|
+
collection[index - 1].listType !== collection[index].listType &&
|
|
17810
|
+
!isNormalList) {
|
|
17811
|
+
prevList = null;
|
|
17812
|
+
}
|
|
17769
17813
|
var pElement = createElement('p');
|
|
17770
17814
|
pElement.innerHTML = collection[index].content.join(' ');
|
|
17771
17815
|
if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
|
|
@@ -17876,28 +17920,29 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17876
17920
|
this.listContents.push(pushContent);
|
|
17877
17921
|
}
|
|
17878
17922
|
else {
|
|
17879
|
-
|
|
17880
|
-
if (firstChild.childNodes.length > 0
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
|
|
17886
|
-
|
|
17887
|
-
}
|
|
17888
|
-
else if (firstChild.childNodes[i].textContent.trim().length === 1) {
|
|
17889
|
-
this.listContents.push(firstChild.childNodes[i].textContent.trim());
|
|
17890
|
-
}
|
|
17923
|
+
//Add to support separate list which looks like same list and also to add all tags as it is inside list
|
|
17924
|
+
if (firstChild.childNodes.length > 0) {
|
|
17925
|
+
var listOrder = firstChild.querySelector('span[style="mso-list:Ignore"]');
|
|
17926
|
+
if (!isNullOrUndefined(listOrder)) {
|
|
17927
|
+
this.listContents.push(listOrder.textContent.trim());
|
|
17928
|
+
detach(listOrder);
|
|
17929
|
+
this.removingComments(elem);
|
|
17930
|
+
this.removeUnwantedElements(elem);
|
|
17891
17931
|
}
|
|
17892
17932
|
}
|
|
17893
|
-
else {
|
|
17894
|
-
pushContent = firstChild.textContent.trim();
|
|
17895
|
-
this.listContents.push(pushContent);
|
|
17896
|
-
}
|
|
17897
17933
|
}
|
|
17898
|
-
detach(firstChild);
|
|
17899
17934
|
this.listContents.push(elem.innerHTML);
|
|
17900
17935
|
};
|
|
17936
|
+
MsWordPaste.prototype.removeEmptyAnchorTag = function (element) {
|
|
17937
|
+
var removableElement = element.querySelectorAll('a:not([href])');
|
|
17938
|
+
for (var j = removableElement.length - 1; j >= 0; j--) {
|
|
17939
|
+
var parentElem = removableElement[j].parentNode;
|
|
17940
|
+
while (removableElement[j].firstChild) {
|
|
17941
|
+
parentElem.insertBefore(removableElement[j].firstChild, removableElement[j]);
|
|
17942
|
+
}
|
|
17943
|
+
parentElem.removeChild(removableElement[j]);
|
|
17944
|
+
}
|
|
17945
|
+
};
|
|
17901
17946
|
return MsWordPaste;
|
|
17902
17947
|
}());
|
|
17903
17948
|
|
|
@@ -19504,7 +19549,8 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
19504
19549
|
range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
|
|
19505
19550
|
: isRootParent = true : range.startContainer.classList.add('currentStartMark');
|
|
19506
19551
|
if (range.startContainer.textContent.charCodeAt(0) === 8203) {
|
|
19507
|
-
pointer = range.startOffset === 0 ? range.startOffset :
|
|
19552
|
+
pointer = range.startOffset === 0 ? range.startOffset :
|
|
19553
|
+
range.startContainer.textContent.replace(regEx, '').trim().length !== 0 ? range.startOffset - 1 : 0;
|
|
19508
19554
|
range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
|
|
19509
19555
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
|
|
19510
19556
|
}
|
|
@@ -19719,7 +19765,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
19719
19765
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
|
|
19720
19766
|
// eslint-disable-next-line
|
|
19721
19767
|
this.oldRangeElement, this.oldRangeElement.childNodes.length);
|
|
19722
|
-
if (this.oldRangeElement.
|
|
19768
|
+
if (this.oldRangeElement.querySelectorAll('BR').length === 1) {
|
|
19723
19769
|
detach(this.oldRangeElement.querySelector('BR'));
|
|
19724
19770
|
}
|
|
19725
19771
|
if (!isNullOrUndefined(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
|
|
@@ -20582,7 +20628,6 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
20582
20628
|
statusCode: '1'
|
|
20583
20629
|
}];
|
|
20584
20630
|
this.uploadObj.createFileList(fileData);
|
|
20585
|
-
this.uploadObj.filesData.push(fileData[0]);
|
|
20586
20631
|
/* eslint-enable */
|
|
20587
20632
|
rawFile = fileData;
|
|
20588
20633
|
this.uploadObj.upload(fileData);
|
|
@@ -20659,6 +20704,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
20659
20704
|
* @deprecated
|
|
20660
20705
|
*/
|
|
20661
20706
|
PasteCleanup.prototype.imageFormatting = function (pasteArgs, imgElement) {
|
|
20707
|
+
imgElement.elements[0].classList.add('pasteContent_Img');
|
|
20662
20708
|
var imageElement = this.parent.createElement('span');
|
|
20663
20709
|
imageElement.appendChild(imgElement.elements[0]);
|
|
20664
20710
|
var imageValue = imageElement.innerHTML;
|
|
@@ -30940,6 +30986,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
30940
30986
|
}
|
|
30941
30987
|
if (e.action !== 'insert-link' &&
|
|
30942
30988
|
e.action !== 'format-copy' && e.action !== 'format-paste' &&
|
|
30989
|
+
(!e.target || !e.target.classList.contains('e-mention')) &&
|
|
30943
30990
|
(e.action && e.action !== 'paste' && e.action !== 'space'
|
|
30944
30991
|
|| e.which === 9 || (e.code === 'Backspace' && e.which === 8))) {
|
|
30945
30992
|
var FormatPainterEscapeAction = false;
|