@syncfusion/ej2-richtexteditor 19.4.40 → 19.4.52
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 +30 -0
- package/README.md +1 -1
- 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 +96 -49
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +96 -49
- 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 +12 -12
- package/src/editor-manager/plugin/inserthtml.js +3 -2
- package/src/editor-manager/plugin/lists.js +2 -1
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +1 -1
- package/src/editor-manager/plugin/ms-word-clean-up.js +53 -19
- package/src/rich-text-editor/actions/enter-key.js +11 -4
- package/src/rich-text-editor/actions/html-editor.js +3 -2
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
- package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
- package/src/rich-text-editor/base/rich-text-editor.js +2 -2
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.js +1 -1
- package/src/rich-text-editor/renderer/image-module.js +21 -18
|
@@ -10607,7 +10607,8 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
10607
10607
|
range.startContainer.parentElement.closest('LI');
|
|
10608
10608
|
var endNode = range.endContainer.nodeName === 'LI' ? range.endContainer :
|
|
10609
10609
|
range.endContainer.parentElement.closest('LI');
|
|
10610
|
-
if (!isNullOrUndefined(startNode) && !isNullOrUndefined(endNode) && startNode === endNode && startNode.tagName === 'LI' &&
|
|
10610
|
+
if (!isNullOrUndefined(startNode) && !isNullOrUndefined(endNode) && startNode === endNode && startNode.tagName === 'LI' &&
|
|
10611
|
+
startNode.textContent.trim() === '' && startNode.querySelectorAll('IMG').length === 0) {
|
|
10611
10612
|
if (startNode.textContent.charCodeAt(0) === 65279) {
|
|
10612
10613
|
startNode.textContent = '';
|
|
10613
10614
|
}
|
|
@@ -12235,8 +12236,9 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
12235
12236
|
};
|
|
12236
12237
|
InsertHtml.getNodeCollection = function (range, nodeSelection, node) {
|
|
12237
12238
|
var nodes = [];
|
|
12238
|
-
if (range.startOffset === range.endOffset && range.startContainer === range.endContainer
|
|
12239
|
-
|
|
12239
|
+
if (range.startOffset === range.endOffset && range.startContainer === range.endContainer &&
|
|
12240
|
+
range.startContainer.nodeName != 'BR' &&
|
|
12241
|
+
(range.startContainer.nodeName === 'TD' || (range.startContainer.nodeType !== 3 &&
|
|
12240
12242
|
node.classList && node.classList.contains('pasteContent')))) {
|
|
12241
12243
|
nodes.push(range.startContainer.childNodes[range.endOffset]);
|
|
12242
12244
|
}
|
|
@@ -15978,8 +15980,10 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
15978
15980
|
this.listContents = [];
|
|
15979
15981
|
this.getListContent(listNodes[i]);
|
|
15980
15982
|
var type = void 0;
|
|
15983
|
+
var listStyleType = void 0;
|
|
15981
15984
|
if (!isNullOrUndefined(this.listContents[0])) {
|
|
15982
15985
|
type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
|
|
15986
|
+
listStyleType = this.getlistStyleType(this.listContents[0], type);
|
|
15983
15987
|
var tempNode = [];
|
|
15984
15988
|
for (var j = 1; j < this.listContents.length; j++) {
|
|
15985
15989
|
tempNode.push(this.listContents[j]);
|
|
@@ -15996,7 +16000,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
15996
16000
|
}
|
|
15997
16001
|
}
|
|
15998
16002
|
collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
|
|
15999
|
-
listStyle: currentListStyle });
|
|
16003
|
+
listStyle: currentListStyle, listStyleTypeName: listStyleType });
|
|
16000
16004
|
}
|
|
16001
16005
|
}
|
|
16002
16006
|
stNode = listNodes.shift();
|
|
@@ -16020,6 +16024,45 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
16020
16024
|
}
|
|
16021
16025
|
}
|
|
16022
16026
|
};
|
|
16027
|
+
MsWordPaste.prototype.getlistStyleType = function (listContent, type) {
|
|
16028
|
+
var currentListClass;
|
|
16029
|
+
if (type === 'ol') {
|
|
16030
|
+
switch (listContent.split('.')[0]) {
|
|
16031
|
+
case "A":
|
|
16032
|
+
currentListClass = "upper-alpha";
|
|
16033
|
+
break;
|
|
16034
|
+
case "a":
|
|
16035
|
+
currentListClass = "lower-alpha";
|
|
16036
|
+
break;
|
|
16037
|
+
case "I":
|
|
16038
|
+
currentListClass = "upper-roman";
|
|
16039
|
+
break;
|
|
16040
|
+
case "i":
|
|
16041
|
+
currentListClass = "lower-roman";
|
|
16042
|
+
break;
|
|
16043
|
+
case "α":
|
|
16044
|
+
currentListClass = "lower-greek";
|
|
16045
|
+
break;
|
|
16046
|
+
default:
|
|
16047
|
+
currentListClass = "decimal";
|
|
16048
|
+
break;
|
|
16049
|
+
}
|
|
16050
|
+
}
|
|
16051
|
+
else {
|
|
16052
|
+
switch (listContent.split('.')[0]) {
|
|
16053
|
+
case "o":
|
|
16054
|
+
currentListClass = "circle";
|
|
16055
|
+
break;
|
|
16056
|
+
case "§":
|
|
16057
|
+
currentListClass = "square";
|
|
16058
|
+
break;
|
|
16059
|
+
default:
|
|
16060
|
+
currentListClass = "disc";
|
|
16061
|
+
break;
|
|
16062
|
+
}
|
|
16063
|
+
}
|
|
16064
|
+
return currentListClass;
|
|
16065
|
+
};
|
|
16023
16066
|
MsWordPaste.prototype.makeConversion = function (collection) {
|
|
16024
16067
|
var root = createElement('div');
|
|
16025
16068
|
var temp;
|
|
@@ -16036,7 +16079,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
16036
16079
|
prevList.appendChild(pElement);
|
|
16037
16080
|
temp.appendChild(prevList);
|
|
16038
16081
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
16039
|
-
temp.style.
|
|
16082
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
16040
16083
|
}
|
|
16041
16084
|
else if (collection[index].nestedLevel === pLevel) {
|
|
16042
16085
|
if (prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
|
|
@@ -16045,6 +16088,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
16045
16088
|
}
|
|
16046
16089
|
else {
|
|
16047
16090
|
temp = createElement(collection[index].listType);
|
|
16091
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
16048
16092
|
prevList.parentElement.parentElement.appendChild(temp);
|
|
16049
16093
|
prevList = createElement('li');
|
|
16050
16094
|
prevList.appendChild(pElement);
|
|
@@ -16056,14 +16100,15 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
16056
16100
|
if (!isNullOrUndefined(prevList)) {
|
|
16057
16101
|
for (var j = 0; j < collection[index].nestedLevel - pLevel; j++) {
|
|
16058
16102
|
prevList.appendChild(temp = createElement(collection[index].listType));
|
|
16059
|
-
prevList = createElement('li'
|
|
16103
|
+
prevList = createElement('li');
|
|
16104
|
+
if (j != collection[index].nestedLevel - pLevel - 1 && collection[index].nestedLevel - pLevel > 1) {
|
|
16105
|
+
prevList.style.listStyleType = "none";
|
|
16106
|
+
}
|
|
16060
16107
|
temp.appendChild(prevList);
|
|
16061
16108
|
}
|
|
16062
16109
|
prevList.appendChild(pElement);
|
|
16063
16110
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
16064
|
-
temp.style.
|
|
16065
|
-
temp.childNodes[0].style.listStyle =
|
|
16066
|
-
this.getListStyle(collection[index].listType, collection[index].nestedLevel);
|
|
16111
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
16067
16112
|
}
|
|
16068
16113
|
else {
|
|
16069
16114
|
root.appendChild(temp = createElement(collection[index].listType));
|
|
@@ -16071,7 +16116,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
16071
16116
|
prevList.appendChild(pElement);
|
|
16072
16117
|
temp.appendChild(prevList);
|
|
16073
16118
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
16074
|
-
temp.style.
|
|
16119
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
16075
16120
|
}
|
|
16076
16121
|
}
|
|
16077
16122
|
else if (collection[index].nestedLevel === 1) {
|
|
@@ -16080,12 +16125,12 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
16080
16125
|
}
|
|
16081
16126
|
else {
|
|
16082
16127
|
root.appendChild(temp = createElement(collection[index].listType));
|
|
16128
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
16083
16129
|
}
|
|
16084
16130
|
prevList = createElement('li');
|
|
16085
16131
|
prevList.appendChild(pElement);
|
|
16086
16132
|
temp.appendChild(prevList);
|
|
16087
16133
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
16088
|
-
temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
|
|
16089
16134
|
}
|
|
16090
16135
|
else {
|
|
16091
16136
|
elem = prevList;
|
|
@@ -16106,7 +16151,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
16106
16151
|
prevList.appendChild(pElement);
|
|
16107
16152
|
temp.appendChild(prevList);
|
|
16108
16153
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
16109
|
-
temp.style.
|
|
16154
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
16110
16155
|
break;
|
|
16111
16156
|
}
|
|
16112
16157
|
}
|
|
@@ -16115,21 +16160,12 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
16115
16160
|
}
|
|
16116
16161
|
prevList.setAttribute('class', collection[index].class);
|
|
16117
16162
|
var currentStyle = prevList.getAttribute('style');
|
|
16118
|
-
prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : '')
|
|
16163
|
+
prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : ''));
|
|
16119
16164
|
pLevel = collection[index].nestedLevel;
|
|
16120
16165
|
listCount++;
|
|
16121
16166
|
}
|
|
16122
16167
|
return root;
|
|
16123
16168
|
};
|
|
16124
|
-
MsWordPaste.prototype.getListStyle = function (listType, nestedLevel) {
|
|
16125
|
-
nestedLevel = (nestedLevel > 0) ? nestedLevel - 1 : nestedLevel;
|
|
16126
|
-
if (listType === 'ol') {
|
|
16127
|
-
return (nestedLevel < this.olData.length ? this.olData[nestedLevel] : this.olData[0]);
|
|
16128
|
-
}
|
|
16129
|
-
else {
|
|
16130
|
-
return (nestedLevel < this.ulData.length ? this.ulData[nestedLevel] : this.ulData[0]);
|
|
16131
|
-
}
|
|
16132
|
-
};
|
|
16133
16169
|
MsWordPaste.prototype.getListContent = function (elem) {
|
|
16134
16170
|
var pushContent = '';
|
|
16135
16171
|
var firstChild = elem.firstElementChild;
|
|
@@ -17389,8 +17425,9 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
17389
17425
|
if (this.rangeElement.tagName === 'OL' || this.rangeElement.tagName === 'UL') {
|
|
17390
17426
|
var liElement = this.getRangeLiNode(currentRange.startContainer);
|
|
17391
17427
|
if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
|
|
17392
|
-
this.oldRangeElement = liElement.previousElementSibling.lastElementChild
|
|
17393
|
-
|
|
17428
|
+
this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
|
|
17429
|
+
liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
|
|
17430
|
+
if (!isNullOrUndefined(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR') {
|
|
17394
17431
|
this.rangeElement = liElement.lastElementChild;
|
|
17395
17432
|
isLiElement = true;
|
|
17396
17433
|
}
|
|
@@ -20346,7 +20383,8 @@ var Image = /** @__PURE__ @class */ (function () {
|
|
|
20346
20383
|
};
|
|
20347
20384
|
Image.prototype.resizeImgDupPos = function (e) {
|
|
20348
20385
|
this.imgDupPos = {
|
|
20349
|
-
width: (e.style.width !== ''
|
|
20386
|
+
width: (e.style.width !== '' && (this.parent.insertImageSettings &&
|
|
20387
|
+
!this.parent.insertImageSettings.resizeByPercent)) ? this.imgEle.style.width : e.width + 'px',
|
|
20350
20388
|
height: (e.style.height !== '') ? this.imgEle.style.height : e.height + 'px'
|
|
20351
20389
|
};
|
|
20352
20390
|
};
|
|
@@ -20514,26 +20552,28 @@ var Image = /** @__PURE__ @class */ (function () {
|
|
|
20514
20552
|
var src = this.deletedImg[i].src;
|
|
20515
20553
|
this.imageRemovePost(src);
|
|
20516
20554
|
}
|
|
20517
|
-
if (
|
|
20518
|
-
if (
|
|
20519
|
-
if (
|
|
20520
|
-
range.startContainer.previousElementSibling.
|
|
20521
|
-
|
|
20522
|
-
|
|
20555
|
+
if (this.parent.editorMode !== 'Markdown') {
|
|
20556
|
+
if (range.startContainer.nodeType === 3) {
|
|
20557
|
+
if (originalEvent.code === 'Backspace') {
|
|
20558
|
+
if (range.startContainer.previousElementSibling && range.startOffset === 0 &&
|
|
20559
|
+
range.startContainer.previousElementSibling.classList.contains(CLS_CAPTION) &&
|
|
20560
|
+
range.startContainer.previousElementSibling.classList.contains(CLS_CAPINLINE)) {
|
|
20561
|
+
detach(range.startContainer.previousElementSibling);
|
|
20562
|
+
}
|
|
20523
20563
|
}
|
|
20524
|
-
|
|
20525
|
-
|
|
20526
|
-
|
|
20527
|
-
|
|
20528
|
-
|
|
20529
|
-
|
|
20530
|
-
|
|
20564
|
+
else {
|
|
20565
|
+
if (range.startContainer.nextElementSibling &&
|
|
20566
|
+
range.endContainer.textContent.length === range.endOffset &&
|
|
20567
|
+
range.startContainer.nextElementSibling.classList.contains(CLS_CAPTION) &&
|
|
20568
|
+
range.startContainer.nextElementSibling.classList.contains(CLS_CAPINLINE)) {
|
|
20569
|
+
detach(range.startContainer.nextElementSibling);
|
|
20570
|
+
}
|
|
20531
20571
|
}
|
|
20532
20572
|
}
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
|
|
20573
|
+
else if ((range.startContainer.nodeType === 1 &&
|
|
20574
|
+
range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE))) {
|
|
20575
|
+
detach(range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE));
|
|
20576
|
+
}
|
|
20537
20577
|
}
|
|
20538
20578
|
break;
|
|
20539
20579
|
case 'insert-image':
|
|
@@ -24080,7 +24120,7 @@ var PasteCleanupSettings = /** @__PURE__ @class */ (function (_super) {
|
|
|
24080
24120
|
Property(null)
|
|
24081
24121
|
], PasteCleanupSettings.prototype, "deniedAttrs", void 0);
|
|
24082
24122
|
__decorate$2([
|
|
24083
|
-
Property(['background', 'background-color', 'border', 'border-bottom', 'border-left', 'border-radius', 'border-right', 'border-style', 'border-top', 'border-width', 'clear', 'color', 'cursor', 'direction', 'display', 'float', 'font', 'font-family', 'font-size', 'font-weight', 'font-style', 'height', 'left', 'line-height', 'margin', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'max-height', 'max-width', 'min-height', 'min-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'position', 'right', 'table-layout', 'text-align', 'text-decoration', 'text-indent', 'top', 'vertical-align', 'visibility', 'white-space', 'width'])
|
|
24123
|
+
Property(['background', 'background-color', 'border', 'border-bottom', 'border-left', 'border-radius', 'border-right', 'border-style', 'border-top', 'border-width', 'clear', 'color', 'cursor', 'direction', 'display', 'float', 'font', 'font-family', 'font-size', 'font-weight', 'font-style', 'height', 'left', 'line-height', 'list-style-type', 'margin', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'max-height', 'max-width', 'min-height', 'min-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'position', 'right', 'table-layout', 'text-align', 'text-decoration', 'text-indent', 'top', 'vertical-align', 'visibility', 'white-space', 'width'])
|
|
24084
24124
|
], PasteCleanupSettings.prototype, "allowedStyleProps", void 0);
|
|
24085
24125
|
__decorate$2([
|
|
24086
24126
|
Property(null)
|
|
@@ -24545,7 +24585,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
24545
24585
|
currentParent = _this.startNode;
|
|
24546
24586
|
}
|
|
24547
24587
|
var currentParentLastChild = currentParent.lastChild;
|
|
24548
|
-
while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text')) {
|
|
24588
|
+
while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text' || currentParentLastChild.nodeName === 'BR')) {
|
|
24549
24589
|
currentParentLastChild = currentParentLastChild.lastChild;
|
|
24550
24590
|
}
|
|
24551
24591
|
var isLastNodeLength = _this.range.startContainer === currentParentLastChild ?
|
|
@@ -24554,9 +24594,16 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
24554
24594
|
_this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
|
|
24555
24595
|
_this.range.startOffset === _this.range.endOffset &&
|
|
24556
24596
|
_this.range.startOffset === isLastNodeLength) {
|
|
24557
|
-
var
|
|
24558
|
-
|
|
24559
|
-
|
|
24597
|
+
var focusBRElem = _this.parent.createElement('br');
|
|
24598
|
+
if (currentParentLastChild.nodeName === 'BR' && currentParent.textContent.length === 0) {
|
|
24599
|
+
_this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, currentParentLastChild);
|
|
24600
|
+
}
|
|
24601
|
+
else {
|
|
24602
|
+
var lineBreakBRElem = _this.parent.createElement('br');
|
|
24603
|
+
_this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, _this.range.startContainer);
|
|
24604
|
+
_this.parent.formatter.editorManager.domNode.insertAfter(lineBreakBRElem, _this.range.startContainer);
|
|
24605
|
+
}
|
|
24606
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), focusBRElem, 0);
|
|
24560
24607
|
}
|
|
24561
24608
|
else if (!isNullOrUndefined(currentParent) && currentParent !== _this.parent.inputElement && currentParent.nodeName !== 'BR') {
|
|
24562
24609
|
if (currentParent.textContent.trim().length === 0 || (currentParent.textContent.trim().length === 1 &&
|
|
@@ -25606,7 +25653,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
25606
25653
|
break;
|
|
25607
25654
|
case 'width':
|
|
25608
25655
|
this.setWidth(newProp[prop]);
|
|
25609
|
-
if (this.toolbarSettings.enable) {
|
|
25656
|
+
if (this.toolbarSettings.enable && !this.inlineMode.enable) {
|
|
25610
25657
|
this.toolbarModule.refreshToolbarOverflow();
|
|
25611
25658
|
this.resizeHandler();
|
|
25612
25659
|
}
|
|
@@ -26444,7 +26491,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
26444
26491
|
this.isRTE = false;
|
|
26445
26492
|
}
|
|
26446
26493
|
this.notify(docClick, { args: e });
|
|
26447
|
-
if (e.detail > 3) {
|
|
26494
|
+
if (Browser.info.name !== 'msie' && e.detail > 3) {
|
|
26448
26495
|
e.preventDefault();
|
|
26449
26496
|
}
|
|
26450
26497
|
};
|