@syncfusion/ej2-richtexteditor 20.1.47 → 20.1.51
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 +36 -0
- 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 +50 -20
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +51 -21
- 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 +9 -9
- package/src/editor-manager/base/constant.d.ts +6 -0
- package/src/editor-manager/base/constant.js +6 -0
- package/src/editor-manager/plugin/insert-text.js +1 -1
- package/src/editor-manager/plugin/inserthtml.js +1 -3
- package/src/editor-manager/plugin/lists.js +4 -0
- package/src/editor-manager/plugin/ms-word-clean-up.js +6 -0
- package/src/editor-manager/plugin/nodecutter.js +1 -1
- package/src/editor-manager/plugin/selection-commands.js +8 -2
- package/src/editor-manager/plugin/table.js +2 -2
- package/src/editor-manager/plugin/undo.js +1 -1
- package/src/rich-text-editor/actions/html-editor.js +2 -2
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +11 -1
- package/src/rich-text-editor/base/rich-text-editor.js +6 -2
- package/src/rich-text-editor/renderer/image-module.js +1 -5
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 20.1.
|
|
3
|
+
* version : 20.1.51
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-richtexteditor@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-richtexteditor@
|
|
3
|
+
"_id": "@syncfusion/ej2-richtexteditor@20.1.50",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-gkz4PlU7B1CB+wMuzLpWYTa/n3NaAlzqGYfk2gxHEx+26SxT8sIbVVqGHSjvT9wKHU4TSczQhqTCg3+aiS8RHA==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-richtexteditor",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"/@syncfusion/ej2-react-richtexteditor",
|
|
27
27
|
"/@syncfusion/ej2-vue-richtexteditor"
|
|
28
28
|
],
|
|
29
|
-
"_resolved": "http://nexus.syncfusion.com/repository/ej2-
|
|
30
|
-
"_shasum": "
|
|
29
|
+
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-20.1.50.tgz",
|
|
30
|
+
"_shasum": "17718651142faa753d87d51a230d39c2a8e02db5",
|
|
31
31
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
32
32
|
"_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
|
|
33
33
|
"author": {
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
},
|
|
39
39
|
"bundleDependencies": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@syncfusion/ej2-base": "~20.1.
|
|
42
|
-
"@syncfusion/ej2-buttons": "~20.1.
|
|
41
|
+
"@syncfusion/ej2-base": "~20.1.50",
|
|
42
|
+
"@syncfusion/ej2-buttons": "~20.1.50",
|
|
43
43
|
"@syncfusion/ej2-filemanager": "~20.1.47",
|
|
44
|
-
"@syncfusion/ej2-inputs": "~20.1.
|
|
45
|
-
"@syncfusion/ej2-navigations": "~20.1.
|
|
44
|
+
"@syncfusion/ej2-inputs": "~20.1.48",
|
|
45
|
+
"@syncfusion/ej2-navigations": "~20.1.51",
|
|
46
46
|
"@syncfusion/ej2-popups": "~20.1.47",
|
|
47
47
|
"@syncfusion/ej2-splitbuttons": "~20.1.47"
|
|
48
48
|
},
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
|
|
71
71
|
},
|
|
72
72
|
"typings": "index.d.ts",
|
|
73
|
-
"version": "20.1.
|
|
73
|
+
"version": "20.1.51",
|
|
74
74
|
"sideEffects": false
|
|
75
75
|
}
|
|
@@ -79,3 +79,9 @@ export var INSERT_TEXT_TYPE = 'insert-text-type';
|
|
|
79
79
|
* @hidden
|
|
80
80
|
*/
|
|
81
81
|
export var CLEAR_TYPE = 'clear-type';
|
|
82
|
+
/**
|
|
83
|
+
* Self closing tags
|
|
84
|
+
*
|
|
85
|
+
* @hidden
|
|
86
|
+
*/
|
|
87
|
+
export var SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td'];
|
|
@@ -23,7 +23,7 @@ var InsertTextExec = /** @class */ (function () {
|
|
|
23
23
|
};
|
|
24
24
|
InsertTextExec.prototype.insertText = function (e) {
|
|
25
25
|
var node = document.createTextNode(e.value);
|
|
26
|
-
InsertHtml.Insert(this.parent.currentDocument, node);
|
|
26
|
+
InsertHtml.Insert(this.parent.currentDocument, node, this.parent.editableElement);
|
|
27
27
|
if (e.callBack) {
|
|
28
28
|
e.callBack({
|
|
29
29
|
requestType: e.subCommand,
|
|
@@ -437,9 +437,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
437
437
|
InsertHtml.removeEmptyElements = function (element) {
|
|
438
438
|
var emptyElements = element.querySelectorAll(':empty');
|
|
439
439
|
for (var i = 0; i < emptyElements.length; i++) {
|
|
440
|
-
if (emptyElements[i].tagName
|
|
441
|
-
emptyElements[i].tagName !== 'IFRAME' && emptyElements[i].tagName !== 'TD' &&
|
|
442
|
-
emptyElements[i].tagName !== 'SOURCE' && emptyElements[i].tagName !== 'HR') {
|
|
440
|
+
if (CONSTANT.SELF_CLOSING_TAGS.indexOf(emptyElements[i].tagName.toLowerCase()) < 0) {
|
|
443
441
|
var detachableElement = this.findDetachEmptyElem(emptyElements[i]);
|
|
444
442
|
if (!isNOU(detachableElement)) {
|
|
445
443
|
detach(detachableElement);
|
|
@@ -140,6 +140,10 @@ var Lists = /** @class */ (function () {
|
|
|
140
140
|
(startNode.textContent.length === 1 && startNode.textContent.charCodeAt(0) === 8203))) {
|
|
141
141
|
startNode.textContent = '';
|
|
142
142
|
}
|
|
143
|
+
if (startNode === endNode && startNode.tagName === 'LI' && startNode.textContent.length === 0 &&
|
|
144
|
+
isNOU(startNode.previousElementSibling)) {
|
|
145
|
+
startNode.removeAttribute('style');
|
|
146
|
+
}
|
|
143
147
|
if (startNode === endNode && startNode.textContent === '') {
|
|
144
148
|
if (startNode.parentElement.tagName === 'LI' && endNode.parentElement.tagName === 'LI') {
|
|
145
149
|
detach(startNode);
|
|
@@ -110,6 +110,12 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
110
110
|
MsWordPaste.prototype.imageConversion = function (elm, rtfData) {
|
|
111
111
|
this.checkVShape(elm);
|
|
112
112
|
var imgElem = elm.querySelectorAll('img');
|
|
113
|
+
for (var i = 0; i < imgElem.length; i++) {
|
|
114
|
+
if (!isNOU(imgElem[i].getAttribute('v:shapes')) && imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0) {
|
|
115
|
+
detach(imgElem[i]);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
imgElem = elm.querySelectorAll('img');
|
|
113
119
|
var imgSrc = [];
|
|
114
120
|
var base64Src = [];
|
|
115
121
|
var imgName = [];
|
|
@@ -71,7 +71,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
71
71
|
fragment = this.spliceEmptyNode(fragment, true);
|
|
72
72
|
if (fragment && fragment.childNodes.length > 0) {
|
|
73
73
|
var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG'
|
|
74
|
-
&& this.isImgElm(fragment) && fragment.textContent
|
|
74
|
+
&& this.isImgElm(fragment) && fragment.textContent === '') ? true : false;
|
|
75
75
|
if (!isEmpty) {
|
|
76
76
|
if (node) {
|
|
77
77
|
InsertMethods.AppendBefore(fragment, node, true);
|
|
@@ -46,12 +46,18 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
46
46
|
var preventRestore = false;
|
|
47
47
|
var isFontStyle = (['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1);
|
|
48
48
|
if (range.collapsed) {
|
|
49
|
+
var currentFormatNode = isFormatted.getFormattedNode(range.startContainer, format, endNode);
|
|
50
|
+
var currentSelector = !isNOU(currentFormatNode) ?
|
|
51
|
+
(currentFormatNode.getAttribute('style') === null ? currentFormatNode.nodeName :
|
|
52
|
+
currentFormatNode.nodeName + "[style='" + currentFormatNode.getAttribute('style') + "']") : null;
|
|
49
53
|
if (nodes.length > 0) {
|
|
50
54
|
isCollapsed = true;
|
|
51
55
|
range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
|
|
52
56
|
}
|
|
53
|
-
else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.childElementCount > 0 &&
|
|
54
|
-
range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br')
|
|
57
|
+
else if (range.startContainer.nodeType === 3 && ((range.startContainer.parentElement.childElementCount > 0 &&
|
|
58
|
+
range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') ||
|
|
59
|
+
!isNOU(currentFormatNode) && currentFormatNode === (range.startContainer.parentElement.closest(currentSelector)) &&
|
|
60
|
+
((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(new RegExp(String.fromCharCode(8203), 'g'), '').trim().length != 0))) {
|
|
55
61
|
isCollapsed = true;
|
|
56
62
|
range = nodeCutter.GetCursorRange(docElement, range, range.startContainer);
|
|
57
63
|
nodes.push(range.startContainer);
|
|
@@ -109,11 +109,11 @@ var TableCommand = /** @class */ (function () {
|
|
|
109
109
|
for (var i = 0; i < emptyUl.length; i++) {
|
|
110
110
|
detach(emptyUl[i]);
|
|
111
111
|
}
|
|
112
|
-
var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
|
|
112
|
+
var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
|
|
113
113
|
for (var i = 0; i < emptyLiChild.length; i++) {
|
|
114
114
|
detach(emptyLiChild[i]);
|
|
115
115
|
if (emptyLiChild.length === i + 1) {
|
|
116
|
-
emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
|
|
116
|
+
emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
|
|
117
117
|
i = -1;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -96,7 +96,7 @@ var UndoRedoManager = /** @class */ (function () {
|
|
|
96
96
|
*/
|
|
97
97
|
UndoRedoManager.prototype.saveData = function (e) {
|
|
98
98
|
var range = new NodeSelection().getRange(this.parent.currentDocument);
|
|
99
|
-
var currentContainer = range.startContainer;
|
|
99
|
+
var currentContainer = this.parent.editableElement === range.startContainer.parentElement ? range.startContainer.parentElement : range.startContainer;
|
|
100
100
|
for (var i = currentContainer.childNodes.length - 1; i >= 0; i--) {
|
|
101
101
|
if (!isNullOrUndefined(currentContainer.childNodes[i]) && currentContainer.childNodes[i].nodeName === '#text' &&
|
|
102
102
|
currentContainer.childNodes[i].textContent.length === 0 && currentContainer.childNodes[i].nodeName !== 'IMG' &&
|
|
@@ -246,8 +246,8 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
else if (this.rangeElement
|
|
250
|
-
this.rangeElement.previousElementSibling.tagName === 'TABLE')) {
|
|
249
|
+
else if (this.rangeElement === this.parent.inputElement || this.rangeElement.tagName === 'TABLE' ||
|
|
250
|
+
(!isNullOrUndefined(this.rangeElement.previousElementSibling) && this.rangeElement.previousElementSibling.tagName === 'TABLE')) {
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
253
|
else {
|
|
@@ -77,7 +77,9 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
77
77
|
this.containsHtml = htmlRegex.test(value);
|
|
78
78
|
var file = e && e.args.clipboardData &&
|
|
79
79
|
e.args.clipboardData.items.length > 0 ?
|
|
80
|
-
e.args.clipboardData.items[0].getAsFile()
|
|
80
|
+
(e.args.clipboardData.items[0].getAsFile() === null ?
|
|
81
|
+
(!isNOU(e.args.clipboardData.items[1]) ? e.args.clipboardData.items[1].getAsFile() : null) :
|
|
82
|
+
e.args.clipboardData.items[0].getAsFile()) : null;
|
|
81
83
|
this.parent.notify(events.paste, {
|
|
82
84
|
file: file,
|
|
83
85
|
args: e.args,
|
|
@@ -558,6 +560,13 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
558
560
|
detach(rteDialogWrapper.children[0]);
|
|
559
561
|
}
|
|
560
562
|
};
|
|
563
|
+
PasteCleanup.prototype.cleanAppleClass = function (elem) {
|
|
564
|
+
var appleClassElem = elem.querySelectorAll('br.Apple-interchange-newline');
|
|
565
|
+
for (var i = 0; i < appleClassElem.length; i++) {
|
|
566
|
+
detach(appleClassElem[i]);
|
|
567
|
+
}
|
|
568
|
+
return elem;
|
|
569
|
+
};
|
|
561
570
|
PasteCleanup.prototype.formatting = function (value, clean, args) {
|
|
562
571
|
var _this = this;
|
|
563
572
|
var clipBoardElem = this.parent.createElement('div', { className: 'pasteContent', styles: 'display:inline;' });
|
|
@@ -565,6 +574,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
565
574
|
value = this.splitBreakLine(value);
|
|
566
575
|
}
|
|
567
576
|
clipBoardElem.innerHTML = value;
|
|
577
|
+
clipBoardElem = this.cleanAppleClass(clipBoardElem);
|
|
568
578
|
if (this.parent.pasteCleanupSettings.deniedTags !== null) {
|
|
569
579
|
clipBoardElem = this.deniedTags(clipBoardElem);
|
|
570
580
|
}
|
|
@@ -728,6 +728,10 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
728
728
|
? 0 : e.clipboardData.getData('text/plain').length;
|
|
729
729
|
var totalLength = (currentLength - selectionLength) + pastedContentLength;
|
|
730
730
|
if (_this.editorMode === 'Markdown') {
|
|
731
|
+
var args_1 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
|
|
732
|
+
setTimeout(function () {
|
|
733
|
+
_this.formatter.onSuccess(_this, args_1);
|
|
734
|
+
}, 0);
|
|
731
735
|
if (!(_this.maxLength === -1 || totalLength <= _this.maxLength)) {
|
|
732
736
|
e.preventDefault();
|
|
733
737
|
}
|
|
@@ -739,7 +743,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
739
743
|
_this.notify(events.pasteClean, { args: e });
|
|
740
744
|
}
|
|
741
745
|
else {
|
|
742
|
-
var
|
|
746
|
+
var args_2 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
|
|
743
747
|
var value = null;
|
|
744
748
|
var htmlValue = false;
|
|
745
749
|
if (e && !isNOU(e.clipboardData)) {
|
|
@@ -757,7 +761,7 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
757
761
|
});
|
|
758
762
|
}
|
|
759
763
|
setTimeout(function () {
|
|
760
|
-
_this.formatter.onSuccess(_this,
|
|
764
|
+
_this.formatter.onSuccess(_this, args_2);
|
|
761
765
|
}, 0);
|
|
762
766
|
}
|
|
763
767
|
}
|
|
@@ -377,14 +377,10 @@ var Image = /** @class */ (function () {
|
|
|
377
377
|
img.style.height = null;
|
|
378
378
|
img.removeAttribute('height');
|
|
379
379
|
}
|
|
380
|
-
else
|
|
380
|
+
else {
|
|
381
381
|
img.style.width = expectedX + 'px';
|
|
382
382
|
img.style.height = expectedX + 'px';
|
|
383
383
|
}
|
|
384
|
-
else {
|
|
385
|
-
img.setAttribute('width', expectedX.toString());
|
|
386
|
-
img.setAttribute('height', expectedX.toString());
|
|
387
|
-
}
|
|
388
384
|
}
|
|
389
385
|
};
|
|
390
386
|
Image.prototype.pixToPerc = function (expected, parentEle) {
|