@syncfusion/ej2-richtexteditor 25.1.41 → 25.2.3
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 +38 -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 +226 -90
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +226 -91
- 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 +23 -13
- package/src/common/util.d.ts +8 -0
- package/src/common/util.js +52 -0
- package/src/editor-manager/plugin/inserthtml.js +8 -2
- package/src/editor-manager/plugin/lists.d.ts +1 -0
- package/src/editor-manager/plugin/lists.js +97 -51
- package/src/editor-manager/plugin/ms-word-clean-up.js +2 -2
- package/src/editor-manager/plugin/nodecutter.js +2 -2
- package/src/editor-manager/plugin/undo.js +3 -1
- package/src/rich-text-editor/actions/emoji-picker.js +1 -1
- package/src/rich-text-editor/actions/enter-key.js +9 -0
- package/src/rich-text-editor/actions/html-editor.js +10 -12
- package/src/rich-text-editor/actions/paste-clean-up.js +13 -9
- package/src/rich-text-editor/base/enum.d.ts +4 -4
- package/src/rich-text-editor/base/enum.js +9 -9
- package/src/rich-text-editor/base/interface.d.ts +3 -3
- package/src/rich-text-editor/base/rich-text-editor.js +7 -0
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
- package/src/rich-text-editor/renderer/image-module.js +3 -3
- package/src/rich-text-editor/renderer/link-module.js +3 -0
- package/src/rich-text-editor/renderer/table-module.js +3 -0
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +2 -0
- package/src/rich-text-editor/renderer/toolbar-renderer.js +7 -1
- package/styles/bootstrap-dark.css +7 -6
- package/styles/bootstrap.css +7 -6
- package/styles/bootstrap4.css +7 -6
- package/styles/bootstrap5-dark.css +7 -6
- package/styles/bootstrap5.css +7 -6
- package/styles/fabric-dark.css +7 -6
- package/styles/fabric.css +7 -6
- package/styles/fluent-dark.css +7 -6
- package/styles/fluent.css +7 -6
- package/styles/highcontrast-light.css +7 -6
- package/styles/highcontrast.css +7 -6
- package/styles/material-dark.css +7 -6
- package/styles/material.css +7 -6
- package/styles/material3-dark.css +7 -6
- package/styles/material3.css +7 -6
- package/styles/rich-text-editor/_layout.scss +7 -6
- package/styles/rich-text-editor/bootstrap-dark.css +7 -6
- package/styles/rich-text-editor/bootstrap.css +7 -6
- package/styles/rich-text-editor/bootstrap4.css +7 -6
- package/styles/rich-text-editor/bootstrap5-dark.css +7 -6
- package/styles/rich-text-editor/bootstrap5.css +7 -6
- package/styles/rich-text-editor/fabric-dark.css +7 -6
- package/styles/rich-text-editor/fabric.css +7 -6
- package/styles/rich-text-editor/fluent-dark.css +7 -6
- package/styles/rich-text-editor/fluent.css +7 -6
- package/styles/rich-text-editor/highcontrast-light.css +7 -6
- package/styles/rich-text-editor/highcontrast.css +7 -6
- package/styles/rich-text-editor/material-dark.css +7 -6
- package/styles/rich-text-editor/material.css +7 -6
- package/styles/rich-text-editor/material3-dark.css +7 -6
- package/styles/rich-text-editor/material3.css +7 -6
- package/styles/rich-text-editor/tailwind-dark.css +7 -6
- package/styles/rich-text-editor/tailwind.css +7 -6
- package/styles/tailwind-dark.css +7 -6
- package/styles/tailwind.css +7 -6
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 25.
|
|
3
|
+
* version : 25.2.3
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2023. 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@25.1.
|
|
3
|
+
"_id": "@syncfusion/ej2-richtexteditor@25.1.42",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-XGBgOsVJDjeoUg7NCBMs+ayX0m4MrTWbdXlHzdK3COGoWMO8ssDjO3iw8e+6828qeoGJnLQrJHa23r7RYWpb/Q==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-richtexteditor",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"/@syncfusion/ej2-react-richtexteditor",
|
|
26
26
|
"/@syncfusion/ej2-vue-richtexteditor"
|
|
27
27
|
],
|
|
28
|
-
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-25.1.
|
|
29
|
-
"_shasum": "
|
|
28
|
+
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-25.1.42.tgz",
|
|
29
|
+
"_shasum": "e1bb753283216537b608b5a49c85096650d5693d",
|
|
30
30
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
31
31
|
"_where": "/jenkins/workspace/elease-automation_release_25.1.1/packages/included",
|
|
32
32
|
"author": {
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
},
|
|
38
38
|
"bundleDependencies": false,
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@syncfusion/ej2-base": "~25.
|
|
41
|
-
"@syncfusion/ej2-buttons": "~25.
|
|
42
|
-
"@syncfusion/ej2-filemanager": "~25.
|
|
43
|
-
"@syncfusion/ej2-inputs": "~25.
|
|
44
|
-
"@syncfusion/ej2-navigations": "~25.
|
|
45
|
-
"@syncfusion/ej2-popups": "~25.
|
|
46
|
-
"@syncfusion/ej2-splitbuttons": "~25.
|
|
40
|
+
"@syncfusion/ej2-base": "~25.2.3",
|
|
41
|
+
"@syncfusion/ej2-buttons": "~25.2.3",
|
|
42
|
+
"@syncfusion/ej2-filemanager": "~25.2.3",
|
|
43
|
+
"@syncfusion/ej2-inputs": "~25.2.3",
|
|
44
|
+
"@syncfusion/ej2-navigations": "~25.2.3",
|
|
45
|
+
"@syncfusion/ej2-popups": "~25.2.3",
|
|
46
|
+
"@syncfusion/ej2-splitbuttons": "~25.2.3"
|
|
47
47
|
},
|
|
48
48
|
"deprecated": false,
|
|
49
49
|
"description": "Essential JS 2 RichTextEditor component",
|
|
@@ -58,7 +58,17 @@
|
|
|
58
58
|
"rich-text-editor",
|
|
59
59
|
"markdown-editor",
|
|
60
60
|
"wysiwyg-markdown-editor",
|
|
61
|
-
"editor"
|
|
61
|
+
"editor",
|
|
62
|
+
"rich text editor",
|
|
63
|
+
"editing",
|
|
64
|
+
"rich text",
|
|
65
|
+
"rich editor",
|
|
66
|
+
"text editor",
|
|
67
|
+
"contenteditable",
|
|
68
|
+
"wysiwyg",
|
|
69
|
+
"html",
|
|
70
|
+
"text",
|
|
71
|
+
"markdown"
|
|
62
72
|
],
|
|
63
73
|
"license": "SEE LICENSE IN license",
|
|
64
74
|
"main": "./dist/ej2-richtexteditor.umd.min.js",
|
|
@@ -69,6 +79,6 @@
|
|
|
69
79
|
"url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
|
|
70
80
|
},
|
|
71
81
|
"typings": "index.d.ts",
|
|
72
|
-
"version": "25.
|
|
82
|
+
"version": "25.2.3",
|
|
73
83
|
"sideEffects": false
|
|
74
84
|
}
|
package/src/common/util.d.ts
CHANGED
|
@@ -40,3 +40,11 @@ export declare function getDefaultMDTbStatus(): IToolbarStatus;
|
|
|
40
40
|
* @hidden
|
|
41
41
|
*/
|
|
42
42
|
export declare function nestedListCleanUp(range: Range): void;
|
|
43
|
+
/**
|
|
44
|
+
* Method to scroll the content to the cursor position
|
|
45
|
+
*
|
|
46
|
+
* @param {Document} document - specifies the document.
|
|
47
|
+
* @param {HTMLElement | HTMLBodyElement} inputElement - specifies the input element.
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
export declare function scrollToCursor(document: Document, inputElement: HTMLElement | HTMLBodyElement): void;
|
package/src/common/util.js
CHANGED
|
@@ -116,6 +116,10 @@ export function updateTextNode(value, enterAction) {
|
|
|
116
116
|
tableElm[i].classList.remove('e-rte-paste-onenote-table');
|
|
117
117
|
continue;
|
|
118
118
|
}
|
|
119
|
+
else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
|
|
120
|
+
tableElm[i].classList.remove('e-rte-paste-html-table');
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
125
|
var imageElm = resultElm.querySelectorAll('img');
|
|
@@ -220,3 +224,51 @@ export function nestedListCleanUp(range) {
|
|
|
220
224
|
}
|
|
221
225
|
}
|
|
222
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Method to scroll the content to the cursor position
|
|
229
|
+
*
|
|
230
|
+
* @param {Document} document - specifies the document.
|
|
231
|
+
* @param {HTMLElement | HTMLBodyElement} inputElement - specifies the input element.
|
|
232
|
+
* @returns {void}
|
|
233
|
+
*/
|
|
234
|
+
export function scrollToCursor(document, inputElement) {
|
|
235
|
+
var rootElement = inputElement.nodeName === 'BODY' ?
|
|
236
|
+
inputElement.ownerDocument.defaultView.frameElement.closest('.e-richtexteditor') :
|
|
237
|
+
inputElement.closest('.e-richtexteditor');
|
|
238
|
+
var height = rootElement.style.height;
|
|
239
|
+
if (document.getSelection().rangeCount === 0) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
var range = document.getSelection().getRangeAt(0);
|
|
243
|
+
var finalFocusElement = range.startContainer.nodeName === '#text' ? range.startContainer.parentElement :
|
|
244
|
+
range.startContainer;
|
|
245
|
+
var rect = finalFocusElement.getBoundingClientRect();
|
|
246
|
+
var cursorTop = rect.top;
|
|
247
|
+
var cursorBottom = rect.bottom;
|
|
248
|
+
var rootRect = rootElement.getBoundingClientRect();
|
|
249
|
+
var hasMargin = rootElement.querySelectorAll('.e-count-enabled, .e-resize-enabled').length > 0;
|
|
250
|
+
if (inputElement.nodeName === 'BODY') {
|
|
251
|
+
if (height === 'auto') {
|
|
252
|
+
if (window.innerHeight < cursorTop) {
|
|
253
|
+
finalFocusElement.scrollIntoView(false);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
if (cursorTop > inputElement.getBoundingClientRect().height) {
|
|
258
|
+
finalFocusElement.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
if (height === 'auto') {
|
|
264
|
+
if (window.innerHeight < cursorTop) {
|
|
265
|
+
finalFocusElement.scrollIntoView({ block: 'end', inline: 'nearest' });
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
if (cursorBottom > rootRect.bottom) {
|
|
270
|
+
rootElement.querySelector('.e-rte-content').scrollTop += (cursorBottom - rootRect.bottom) + (hasMargin ? 20 : 0);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
@@ -58,7 +58,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
58
58
|
range.startContainer === range.endContainer;
|
|
59
59
|
var isCollapsed = range.collapsed;
|
|
60
60
|
var nodes = this.getNodeCollection(range, nodeSelection, node);
|
|
61
|
-
var closestParentNode = (node.nodeName.toLowerCase() === 'table') ? this.closestEle(nodes[0].parentNode, editNode) : nodes[0];
|
|
61
|
+
var closestParentNode = (node.nodeName.toLowerCase() === 'table') ? (!isNOU(nodes[0]) ? this.closestEle(nodes[0].parentNode, editNode) : range.startContainer) : nodes[0];
|
|
62
62
|
if (closestParentNode && closestParentNode.nodeName === 'LI' && node.nodeName.toLowerCase() === 'table') {
|
|
63
63
|
this.insertTableInList(range, node, closestParentNode, nodes[0], nodeCutter);
|
|
64
64
|
return;
|
|
@@ -103,7 +103,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
103
103
|
nodes[index].parentNode.removeChild(nodes[index]);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
if (sibNode) {
|
|
106
|
+
if (!isNOU(sibNode) && !isNOU(sibNode.parentNode)) {
|
|
107
107
|
InsertMethods.AppendBefore(node, sibNode, true);
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
@@ -354,6 +354,12 @@ var InsertHtml = /** @class */ (function () {
|
|
|
354
354
|
node.parentNode.replaceChild(fragment, node);
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
+
if (lastSelectionNode.nodeName === 'TABLE') {
|
|
358
|
+
var pTag = createElement('p');
|
|
359
|
+
pTag.appendChild(createElement('br'));
|
|
360
|
+
lastSelectionNode.parentElement.insertBefore(pTag, lastSelectionNode.nextSibling);
|
|
361
|
+
lastSelectionNode = pTag;
|
|
362
|
+
}
|
|
357
363
|
if (lastSelectionNode.nodeName === '#text') {
|
|
358
364
|
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
359
365
|
}
|
|
@@ -553,58 +553,36 @@ var Lists = /** @class */ (function () {
|
|
|
553
553
|
var listsNodes = this.domNode.blockNodes(true);
|
|
554
554
|
if (e.enterAction === 'BR') {
|
|
555
555
|
this.setSelectionBRConfig();
|
|
556
|
-
var
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
while (!this.parent.domNode.isBlockNode(currentNode) && currentNode !== this.parent.editableElement) {
|
|
566
|
-
previousCurrentNode = currentNode;
|
|
567
|
-
currentNode = currentNode.parentElement;
|
|
568
|
-
}
|
|
569
|
-
if (this.parent.domNode.isBlockNode(currentNode) && currentNode === this.parent.editableElement) {
|
|
570
|
-
currentFormatNodes.push(previousCurrentNode);
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
for (var i = 0; i < currentFormatNodes.length; i++) {
|
|
574
|
-
if (!this.parent.domNode.isBlockNode(currentFormatNodes[i])) {
|
|
575
|
-
var currentNode = currentFormatNodes[i];
|
|
576
|
-
var previousNode = currentNode;
|
|
577
|
-
while (currentNode === this.parent.editableElement) {
|
|
578
|
-
previousNode = currentNode;
|
|
579
|
-
currentNode = currentNode.parentElement;
|
|
556
|
+
var selectedNodes = this.parent.domNode.blockNodes();
|
|
557
|
+
if (selectedNodes.length > 1) {
|
|
558
|
+
var i = 0;
|
|
559
|
+
var currentAlignmentNode = selectedNodes[0];
|
|
560
|
+
while (!isNOU(currentAlignmentNode)) {
|
|
561
|
+
if (currentAlignmentNode.nodeName === 'BR') {
|
|
562
|
+
var nextNode = currentAlignmentNode.nextSibling;
|
|
563
|
+
detach(currentAlignmentNode);
|
|
564
|
+
currentAlignmentNode = nextNode;
|
|
580
565
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
while (!isNOU(preNode) && preNode.nodeName !== 'BR' &&
|
|
593
|
-
!this.parent.domNode.isBlockNode(preNode)) {
|
|
594
|
-
tempElem.firstChild.parentElement.insertBefore(preNode, tempElem.firstChild);
|
|
595
|
-
preNode = tempElem.previousSibling;
|
|
596
|
-
}
|
|
597
|
-
if (!isNOU(preNode) && preNode.nodeName === 'BR') {
|
|
598
|
-
detach(preNode);
|
|
599
|
-
}
|
|
600
|
-
var postNode = tempElem.nextSibling;
|
|
601
|
-
while (!isNOU(postNode) && postNode.nodeName !== 'BR' &&
|
|
602
|
-
!this.parent.domNode.isBlockNode(postNode)) {
|
|
603
|
-
tempElem.appendChild(postNode);
|
|
604
|
-
postNode = tempElem.nextSibling;
|
|
566
|
+
if (!isNOU(currentAlignmentNode)) {
|
|
567
|
+
selectedNodes[i] = currentAlignmentNode.nodeName === 'LI' || this.parent.domNode.isBlockNode(currentAlignmentNode) ?
|
|
568
|
+
currentAlignmentNode : this.gatherElementsAround(currentAlignmentNode);
|
|
569
|
+
var currentSelectNode = selectedNodes[i].nodeName === 'LI' ? selectedNodes[i].parentElement : selectedNodes[i];
|
|
570
|
+
var currentElementCheckNode = currentAlignmentNode.nodeName === '#text' ? currentAlignmentNode.parentElement : currentAlignmentNode;
|
|
571
|
+
currentAlignmentNode = !isNOU(currentElementCheckNode.querySelector('.e-editor-select-end')) ||
|
|
572
|
+
!isNOU(closest(currentAlignmentNode, '.e-editor-select-end')) ?
|
|
573
|
+
null : currentSelectNode.nextSibling;
|
|
574
|
+
if (currentAlignmentNode === null && !isNOU(currentSelectNode.nextSibling) && currentSelectNode.nextSibling.nodeName === 'BR') {
|
|
575
|
+
detach(currentSelectNode.nextSibling);
|
|
576
|
+
}
|
|
605
577
|
}
|
|
606
|
-
|
|
607
|
-
|
|
578
|
+
i++;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
if (!this.parent.domNode.isBlockNode(selectedNodes[0])) {
|
|
583
|
+
selectedNodes[0] = this.gatherElementsAround(selectedNodes[0]);
|
|
584
|
+
if (!isNOU(selectedNodes[0].nextSibling) && (selectedNodes[0].nextSibling.nodeName === 'BR')) {
|
|
585
|
+
detach(selectedNodes[0].nextSibling);
|
|
608
586
|
}
|
|
609
587
|
}
|
|
610
588
|
}
|
|
@@ -710,6 +688,16 @@ var Lists = /** @class */ (function () {
|
|
|
710
688
|
}
|
|
711
689
|
}
|
|
712
690
|
this.cleanNode();
|
|
691
|
+
if (e.enterAction === 'BR') {
|
|
692
|
+
var spansToRemove = document.querySelectorAll('span#removeSpan');
|
|
693
|
+
spansToRemove.forEach(function (span) {
|
|
694
|
+
var fragment = document.createDocumentFragment();
|
|
695
|
+
while (span.firstChild) {
|
|
696
|
+
fragment.appendChild(span.firstChild);
|
|
697
|
+
}
|
|
698
|
+
span.parentNode.replaceChild(fragment, span);
|
|
699
|
+
});
|
|
700
|
+
}
|
|
713
701
|
this.parent.editableElement.focus();
|
|
714
702
|
if (isIDevice()) {
|
|
715
703
|
setEditFrameFocus(this.parent.editableElement, selector);
|
|
@@ -913,6 +901,12 @@ var Lists = /** @class */ (function () {
|
|
|
913
901
|
if (e.enterAction !== 'BR') {
|
|
914
902
|
this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
|
|
915
903
|
}
|
|
904
|
+
else {
|
|
905
|
+
var wrapperSpan = '<span class=e-rte-wrap-inner id=removeSpan></span>';
|
|
906
|
+
var br = document.createElement('br');
|
|
907
|
+
this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapperSpan));
|
|
908
|
+
element.appendChild(br);
|
|
909
|
+
}
|
|
916
910
|
}
|
|
917
911
|
else if (this.domNode.contents(element)[0].nodeType === 3) {
|
|
918
912
|
var replace = this.domNode.createTagString(CONSTANT.DEFAULT_TAG, parentNode, this.parent.domNode.encode(this.domNode.contents(element)[0].textContent));
|
|
@@ -925,8 +919,18 @@ var Lists = /** @class */ (function () {
|
|
|
925
919
|
}
|
|
926
920
|
else {
|
|
927
921
|
var childNode = element.firstChild;
|
|
922
|
+
if (childNode) {
|
|
923
|
+
var attributes_1 = element.parentElement.attributes;
|
|
924
|
+
if (attributes_1.length > 0) {
|
|
925
|
+
for (var d = 0; d < attributes_1.length; d++) {
|
|
926
|
+
var e_1 = attributes_1[d];
|
|
927
|
+
var existingValue = childNode.getAttribute(e_1.nodeName);
|
|
928
|
+
var parentValue = (element.parentElement).getAttribute(e_1.nodeName);
|
|
929
|
+
childNode.setAttribute(e_1.nodeName, existingValue ? parentValue + ' ' + existingValue : parentValue);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
928
933
|
className = childNode.getAttribute('class');
|
|
929
|
-
attributes(childNode, this.domNode.rawAttributes(parentNode));
|
|
930
934
|
if (className && childNode.getAttribute('class')) {
|
|
931
935
|
attributes(childNode, { 'class': className + ' ' + childNode.getAttribute('class') });
|
|
932
936
|
}
|
|
@@ -967,6 +971,48 @@ var Lists = /** @class */ (function () {
|
|
|
967
971
|
Lists.prototype.closeTag = function (type) {
|
|
968
972
|
return this.domNode.parseHTMLFragment('<span class="e-rte-list-close-' + type.toLowerCase() + '"></span>');
|
|
969
973
|
};
|
|
974
|
+
Lists.prototype.gatherElementsAround = function (node) {
|
|
975
|
+
var pWrap = document.createElement('p');
|
|
976
|
+
// Insert the new div before the current node
|
|
977
|
+
var currentNode = node.previousSibling;
|
|
978
|
+
var classNode = node.parentNode;
|
|
979
|
+
if (classNode.className === 'e-editor-select-start') {
|
|
980
|
+
node.parentNode.parentNode.insertBefore(pWrap, node.parentNode);
|
|
981
|
+
}
|
|
982
|
+
else if (node.parentNode) {
|
|
983
|
+
node.parentNode.insertBefore(pWrap, node);
|
|
984
|
+
}
|
|
985
|
+
// Gather text and inline elements before the currentNode
|
|
986
|
+
var i = 0;
|
|
987
|
+
while (currentNode !== null && currentNode.nodeName !== 'BR' &&
|
|
988
|
+
!this.parent.domNode.isBlockNode(currentNode)) {
|
|
989
|
+
var prevSibling = currentNode.previousSibling;
|
|
990
|
+
if (currentNode.nodeType === 3 || currentNode.nodeType === 1) {
|
|
991
|
+
if (i === 0) {
|
|
992
|
+
pWrap.appendChild(currentNode);
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
pWrap.insertBefore(currentNode, pWrap.firstChild);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
currentNode = prevSibling;
|
|
999
|
+
i++;
|
|
1000
|
+
}
|
|
1001
|
+
// Add the current node to the new p
|
|
1002
|
+
pWrap.appendChild(node);
|
|
1003
|
+
// Gather text and inline elements after the currentNode
|
|
1004
|
+
currentNode = pWrap.nextSibling ? pWrap.nextSibling : pWrap.parentElement.nextSibling;
|
|
1005
|
+
while (currentNode !== null && currentNode.nodeName !== 'BR' &&
|
|
1006
|
+
!this.parent.domNode.isBlockNode(currentNode)) {
|
|
1007
|
+
var nextSibling = currentNode.nextSibling ?
|
|
1008
|
+
currentNode.nextSibling : currentNode.parentElement.nextSibling;
|
|
1009
|
+
if (currentNode.nodeType === 3 || currentNode.nodeType === 1) {
|
|
1010
|
+
pWrap.appendChild(currentNode);
|
|
1011
|
+
}
|
|
1012
|
+
currentNode = nextSibling;
|
|
1013
|
+
}
|
|
1014
|
+
return pWrap;
|
|
1015
|
+
};
|
|
970
1016
|
return Lists;
|
|
971
1017
|
}());
|
|
972
1018
|
export { Lists };
|
|
@@ -66,9 +66,9 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
66
66
|
var patern2 = /class="?Mso|style="[^ ]*\bmso-/i;
|
|
67
67
|
var patern3 = /(class="?Mso|class='?Mso|class="?Xl|class='?Xl|class=Xl|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument)/gi;
|
|
68
68
|
var pattern4 = /style='mso-width-source:/i;
|
|
69
|
+
var source = this.findSource(elm);
|
|
69
70
|
if (patern.test(tempHTMLContent) || patern2.test(tempHTMLContent) || patern3.test(tempHTMLContent) ||
|
|
70
71
|
pattern4.test(tempHTMLContent)) {
|
|
71
|
-
var source = this.findSource(elm);
|
|
72
72
|
tempHTMLContent = tempHTMLContent.replace(/<img[^>]+>/i, '');
|
|
73
73
|
this.addListClass(elm);
|
|
74
74
|
listNodes = this.cleanUp(elm, listNodes);
|
|
@@ -93,7 +93,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
93
93
|
e.callBack(elm.innerHTML, this.cropImageDimensions, source);
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
|
-
e.callBack(elm.innerHTML);
|
|
96
|
+
e.callBack(elm.innerHTML, null, source);
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
MsWordPaste.prototype.addDoubleBr = function (elm) {
|
|
@@ -50,7 +50,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
50
50
|
fragment = this.spliceEmptyNode(fragment, false);
|
|
51
51
|
if (fragment && fragment.childNodes.length > 0) {
|
|
52
52
|
var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG' && !(fragment.querySelectorAll('img').length > 0)
|
|
53
|
-
&& this.isRteElm(fragment) && fragment.textContent === '') ? true : false;
|
|
53
|
+
&& this.isRteElm(fragment) && fragment.textContent.trim() === '') ? true : false;
|
|
54
54
|
if (!isEmpty) {
|
|
55
55
|
if (node) {
|
|
56
56
|
InsertMethods.AppendBefore(fragment, node);
|
|
@@ -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.isRteElm(fragment) && fragment.textContent === '') ? true : false;
|
|
74
|
+
&& this.isRteElm(fragment) && fragment.textContent.trim() === '') ? true : false;
|
|
75
75
|
if (!isEmpty) {
|
|
76
76
|
if (node) {
|
|
77
77
|
InsertMethods.AppendBefore(fragment, node, true);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { debounce, isNullOrUndefined, detach } from '@syncfusion/ej2-base';
|
|
2
2
|
import { NodeSelection } from './../../selection/selection';
|
|
3
3
|
import * as EVENTS from './../../common/constant';
|
|
4
|
-
import { isIDevice, setEditFrameFocus } from '../../common/util';
|
|
4
|
+
import { isIDevice, scrollToCursor, setEditFrameFocus } from '../../common/util';
|
|
5
5
|
/**
|
|
6
6
|
* `Undo` module is used to handle undo actions.
|
|
7
7
|
*/
|
|
@@ -183,6 +183,7 @@ var UndoRedoManager = /** @class */ (function () {
|
|
|
183
183
|
this.parent.editableElement.innerHTML = '';
|
|
184
184
|
this.parent.editableElement.appendChild(removedContent.cloneNode(true));
|
|
185
185
|
this.parent.editableElement.focus();
|
|
186
|
+
scrollToCursor(this.parent.currentDocument, this.parent.editableElement);
|
|
186
187
|
if (isIDevice()) {
|
|
187
188
|
setEditFrameFocus(this.parent.editableElement, e.selector);
|
|
188
189
|
}
|
|
@@ -215,6 +216,7 @@ var UndoRedoManager = /** @class */ (function () {
|
|
|
215
216
|
this.parent.editableElement.innerHTML = '';
|
|
216
217
|
this.parent.editableElement.appendChild(addedContent.cloneNode(true));
|
|
217
218
|
this.parent.editableElement.focus();
|
|
219
|
+
scrollToCursor(this.parent.currentDocument, this.parent.editableElement);
|
|
218
220
|
if (isIDevice()) {
|
|
219
221
|
setEditFrameFocus(this.parent.editableElement, e.selector);
|
|
220
222
|
}
|
|
@@ -767,7 +767,7 @@ var EmojiPicker = /** @class */ (function () {
|
|
|
767
767
|
var popupHeight = 330;
|
|
768
768
|
var popupTop = cursorTop;
|
|
769
769
|
var popupLeft = cursorLeft + rect.width;
|
|
770
|
-
if (rteEle.getBoundingClientRect().top < 0) {
|
|
770
|
+
if (rteEle.getBoundingClientRect().top < 0 && !this.parent.inlineMode.enable) {
|
|
771
771
|
popupTop = popupTop + rteContent.getBoundingClientRect().top - toolbarHeight;
|
|
772
772
|
}
|
|
773
773
|
if (rect.top < popupHeight) {
|
|
@@ -364,6 +364,7 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
364
364
|
else {
|
|
365
365
|
currentParent = _this.startNode;
|
|
366
366
|
}
|
|
367
|
+
var currentParentStyle = window.getComputedStyle(currentParent);
|
|
367
368
|
_this.removeBRElement(currentParent);
|
|
368
369
|
var isEmptyBrInserted = false;
|
|
369
370
|
var currentParentLastChild = currentParent.lastChild;
|
|
@@ -428,6 +429,14 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
428
429
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
429
430
|
isEmptyBrInserted = true;
|
|
430
431
|
}
|
|
432
|
+
else if (currentParent !== _this.parent.inputElement &&
|
|
433
|
+
(currentParentStyle.display === 'inline' || currentParentStyle.display === 'inline-block')) {
|
|
434
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
435
|
+
newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, true).cloneNode(true);
|
|
436
|
+
currentParent.parentElement.insertBefore(outerBRElem, currentParent);
|
|
437
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentParent, 0);
|
|
438
|
+
_this.insertFocusContent();
|
|
439
|
+
}
|
|
431
440
|
else {
|
|
432
441
|
_this.insertBRElement();
|
|
433
442
|
}
|
|
@@ -11,7 +11,7 @@ import { ColorPickerInput } from './color-picker';
|
|
|
11
11
|
import { NodeSelection } from '../../selection/selection';
|
|
12
12
|
import { InsertHtml } from '../../editor-manager/plugin/inserthtml';
|
|
13
13
|
import { getTextNodesUnder, sanitizeHelper, getDefaultValue } from '../base/util';
|
|
14
|
-
import { isIDevice } from '../../common/util';
|
|
14
|
+
import { isIDevice, scrollToCursor } from '../../common/util';
|
|
15
15
|
import { XhtmlValidation } from './xhtml-validation';
|
|
16
16
|
import { ON_BEGIN } from './../../common/constant';
|
|
17
17
|
import * as CONSTANT from '../base/constant';
|
|
@@ -216,8 +216,14 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
216
216
|
range.insertNode(tempSpan);
|
|
217
217
|
}
|
|
218
218
|
var currentChild = this.parent.inputElement.firstChild;
|
|
219
|
-
while (!isNOU(currentChild)
|
|
220
|
-
currentChild.
|
|
219
|
+
while (!isNOU(currentChild)) {
|
|
220
|
+
if (currentChild.nodeName === '#text') {
|
|
221
|
+
currentChild = currentChild.nextElementSibling;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (currentChild.textContent.replace(regEx, '').trim().length > 0) {
|
|
225
|
+
currentChild.innerHTML = currentChild.innerHTML.replace(regEx, '');
|
|
226
|
+
}
|
|
221
227
|
currentChild = currentChild.nextElementSibling;
|
|
222
228
|
}
|
|
223
229
|
var tempSpanToRemove = this.parent.inputElement.querySelector('.tempSpan');
|
|
@@ -316,15 +322,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
316
322
|
}
|
|
317
323
|
else {
|
|
318
324
|
this.parent.notify(events.enterHandler, { args: e.args });
|
|
319
|
-
|
|
320
|
-
if (!isNullOrUndefined(newRange.startContainer) && this.parent.height !== 'auto' && newRange.startContainer.nodeName !== '#text'
|
|
321
|
-
&& !this.parent.iframeSettings.enable && newRange.startContainer.getBoundingClientRect().bottom > this.parent.element.getBoundingClientRect().bottom) {
|
|
322
|
-
this.parent.element.querySelector('.e-rte-content').scrollTop += newRange.startContainer.getBoundingClientRect().bottom - this.parent.element.getBoundingClientRect().bottom;
|
|
323
|
-
}
|
|
324
|
-
else if (!isNullOrUndefined(newRange.startContainer) && this.parent.height === 'auto' && newRange.startContainer.nodeName !== '#text'
|
|
325
|
-
&& !this.parent.iframeSettings.enable && window.innerHeight < newRange.startContainer.getBoundingClientRect().top) {
|
|
326
|
-
newRange.startContainer.scrollIntoView({ block: 'end', inline: 'nearest' });
|
|
327
|
-
}
|
|
325
|
+
scrollToCursor(this.parent.contentModule.getDocument(), this.parent.inputElement);
|
|
328
326
|
}
|
|
329
327
|
}
|
|
330
328
|
}
|
|
@@ -9,10 +9,11 @@ import { CLS_RTE_IMAGE, CLS_IMGINLINE, CLS_IMGBREAK } from '../base/classes';
|
|
|
9
9
|
import { pasteCleanupGroupingTags } from '../../common/config';
|
|
10
10
|
import { NodeSelection } from '../../selection/selection';
|
|
11
11
|
import * as EVENTS from './../../common/constant';
|
|
12
|
-
import { RenderType,
|
|
12
|
+
import { RenderType, ImageInputSource } from '../base/enum';
|
|
13
13
|
import { Uploader } from '@syncfusion/ej2-inputs';
|
|
14
14
|
import * as classes from '../base/classes';
|
|
15
15
|
import { sanitizeHelper, convertToBlob, getDefaultValue } from '../base/util';
|
|
16
|
+
import { scrollToCursor } from '../../common/util';
|
|
16
17
|
/**
|
|
17
18
|
* PasteCleanup module called when pasting content in RichTextEditor
|
|
18
19
|
*/
|
|
@@ -404,13 +405,15 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
404
405
|
popupObj.close();
|
|
405
406
|
}
|
|
406
407
|
this.parent.trigger(events.imageUploadFailed, e);
|
|
407
|
-
uploadObj.
|
|
408
|
+
if (uploadObj && document.body.contains(uploadObj.element)) {
|
|
409
|
+
uploadObj.destroy();
|
|
410
|
+
}
|
|
408
411
|
};
|
|
409
412
|
PasteCleanup.prototype.popupClose = function (popupObj, uploadObj, imgElem, e) {
|
|
410
413
|
var _this = this;
|
|
411
414
|
this.parent.inputElement.contentEditable = 'true';
|
|
412
415
|
e.element = imgElem;
|
|
413
|
-
e.
|
|
416
|
+
e.detectImageSource = ImageInputSource.Pasted;
|
|
414
417
|
this.parent.trigger(events.imageUploadSuccess, e, function (e) {
|
|
415
418
|
if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
|
|
416
419
|
var url = _this.parent.insertImageSettings.path + e.file.name;
|
|
@@ -420,7 +423,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
420
423
|
});
|
|
421
424
|
popupObj.close();
|
|
422
425
|
imgElem.style.opacity = '1';
|
|
423
|
-
if (
|
|
426
|
+
if (uploadObj && document.body.contains(uploadObj.element)) {
|
|
424
427
|
uploadObj.destroy();
|
|
425
428
|
}
|
|
426
429
|
this.toolbarEnableDisable(false);
|
|
@@ -720,6 +723,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
720
723
|
extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
|
|
721
724
|
_this.parent.formatter.onSuccess(_this.parent, args);
|
|
722
725
|
}, clipBoardElem, null, null, this.parent.enterKey);
|
|
726
|
+
scrollToCursor(this.parent.contentModule.getDocument(), this.parent.inputElement);
|
|
723
727
|
this.removeTempClass();
|
|
724
728
|
this.parent.notify(events.toolbarRefresh, {});
|
|
725
729
|
this.cropImageHandler(this.parent.inputElement);
|
|
@@ -774,15 +778,15 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
774
778
|
}
|
|
775
779
|
};
|
|
776
780
|
PasteCleanup.prototype.addTableClass = function (element, source) {
|
|
777
|
-
source = isNOU(source) ? '' : source;
|
|
778
781
|
var tableElement = element.querySelectorAll('table');
|
|
779
782
|
for (var i = 0; i < tableElement.length; i++) {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}
|
|
783
|
-
else if (source && source !== 'html') {
|
|
783
|
+
var isMSTeamsTable = tableElement[i].parentElement.nodeName === 'FIGURE';
|
|
784
|
+
if (this.parent.pasteCleanupSettings.keepFormat && source && !isMSTeamsTable) {
|
|
784
785
|
tableElement[i].classList.add('e-rte-paste-' + source + '-table');
|
|
785
786
|
}
|
|
787
|
+
else if (!tableElement[i].classList.contains('e-rte-table')) {
|
|
788
|
+
tableElement[i].classList.add('e-rte-table');
|
|
789
|
+
}
|
|
786
790
|
}
|
|
787
791
|
return element;
|
|
788
792
|
};
|
|
@@ -67,11 +67,11 @@ export declare type ToolbarConfigItems = 'Alignments' | 'JustifyLeft' | 'Justify
|
|
|
67
67
|
/**
|
|
68
68
|
* Defines types to be used as inserted image.
|
|
69
69
|
*/
|
|
70
|
-
export declare enum
|
|
71
|
-
/** Defines
|
|
70
|
+
export declare enum ImageInputSource {
|
|
71
|
+
/** Defines ImageInputSource as Uploaded */
|
|
72
72
|
Uploaded = "Uploaded",
|
|
73
|
-
/** Defines
|
|
73
|
+
/** Defines ImageInputSource as Dropped */
|
|
74
74
|
Dropped = "Dropped",
|
|
75
|
-
/** Defines
|
|
75
|
+
/** Defines ImageInputSource as Pasted */
|
|
76
76
|
Pasted = "Pasted"
|
|
77
77
|
}
|
|
@@ -64,12 +64,12 @@ export var DialogType;
|
|
|
64
64
|
/**
|
|
65
65
|
* Defines types to be used as inserted image.
|
|
66
66
|
*/
|
|
67
|
-
export var
|
|
68
|
-
(function (
|
|
69
|
-
/** Defines
|
|
70
|
-
|
|
71
|
-
/** Defines
|
|
72
|
-
|
|
73
|
-
/** Defines
|
|
74
|
-
|
|
75
|
-
})(
|
|
67
|
+
export var ImageInputSource;
|
|
68
|
+
(function (ImageInputSource) {
|
|
69
|
+
/** Defines ImageInputSource as Uploaded */
|
|
70
|
+
ImageInputSource["Uploaded"] = "Uploaded";
|
|
71
|
+
/** Defines ImageInputSource as Dropped */
|
|
72
|
+
ImageInputSource["Dropped"] = "Dropped";
|
|
73
|
+
/** Defines ImageInputSource as Pasted */
|
|
74
|
+
ImageInputSource["Pasted"] = "Pasted";
|
|
75
|
+
})(ImageInputSource || (ImageInputSource = {}));
|