@syncfusion/ej2-richtexteditor 27.1.52 → 27.1.55
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/dist/ej2-richtexteditor.min.js +10 -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 +141 -37
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +143 -37
- 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/base/editor-manager.js +1 -1
- package/src/editor-manager/base/interface.d.ts +2 -2
- package/src/editor-manager/plugin/clearformat.js +1 -1
- package/src/editor-manager/plugin/dom-node.js +1 -1
- package/src/editor-manager/plugin/image.js +2 -0
- package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
- package/src/editor-manager/plugin/inserthtml.js +34 -10
- package/src/editor-manager/plugin/link.js +2 -2
- package/src/editor-manager/plugin/lists.js +1 -1
- package/src/editor-manager/plugin/selection-commands.js +2 -2
- package/src/editor-manager/plugin/toolbar-status.js +1 -1
- package/src/editor-manager/plugin/undo.js +3 -3
- package/src/rich-text-editor/actions/enter-key.js +10 -5
- package/src/rich-text-editor/actions/html-editor.js +2 -2
- package/src/rich-text-editor/actions/import-export.js +1 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +1 -1
- package/src/rich-text-editor/actions/resize.d.ts +3 -0
- package/src/rich-text-editor/actions/resize.js +13 -0
- package/src/rich-text-editor/base/interface.d.ts +13 -1
- package/src/rich-text-editor/base/rich-text-editor.js +11 -0
- package/src/rich-text-editor/renderer/image-module.js +6 -2
- package/src/rich-text-editor/renderer/link-module.js +5 -1
- package/src/rich-text-editor/renderer/slash-menu.js +1 -1
- package/src/rich-text-editor/renderer/video-module.js +1 -1
- package/src/selection/selection.d.ts +5 -0
- package/src/selection/selection.js +44 -1
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 27.1.
|
|
3
|
+
* version : 27.1.55
|
|
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@27.1.
|
|
3
|
+
"_id": "@syncfusion/ej2-richtexteditor@27.1.52",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-XR/x+b75MIK0pvux0i7pKXCiE3wHiKBruu+8envZ4mRykDST1Gga87CiBMHuz9R1cuFm6lAmulHlCXqv+xjabw==",
|
|
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-27.1.
|
|
29
|
-
"_shasum": "
|
|
28
|
+
"_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-27.1.52.tgz",
|
|
29
|
+
"_shasum": "990c5dad0331d0dc7e2947c6fc5577bbe886f01b",
|
|
30
30
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
31
31
|
"_where": "/jenkins/workspace/elease-automation_release_27.1.1/packages/included",
|
|
32
32
|
"author": {
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
},
|
|
38
38
|
"bundleDependencies": false,
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@syncfusion/ej2-base": "~27.1.
|
|
41
|
-
"@syncfusion/ej2-buttons": "~27.1.
|
|
42
|
-
"@syncfusion/ej2-dropdowns": "~27.1.
|
|
43
|
-
"@syncfusion/ej2-filemanager": "~27.1.
|
|
44
|
-
"@syncfusion/ej2-inputs": "~27.1.
|
|
45
|
-
"@syncfusion/ej2-navigations": "~27.1.
|
|
46
|
-
"@syncfusion/ej2-popups": "~27.1.
|
|
40
|
+
"@syncfusion/ej2-base": "~27.1.55",
|
|
41
|
+
"@syncfusion/ej2-buttons": "~27.1.53",
|
|
42
|
+
"@syncfusion/ej2-dropdowns": "~27.1.55",
|
|
43
|
+
"@syncfusion/ej2-filemanager": "~27.1.55",
|
|
44
|
+
"@syncfusion/ej2-inputs": "~27.1.55",
|
|
45
|
+
"@syncfusion/ej2-navigations": "~27.1.55",
|
|
46
|
+
"@syncfusion/ej2-popups": "~27.1.55",
|
|
47
47
|
"@syncfusion/ej2-splitbuttons": "~27.1.50"
|
|
48
48
|
},
|
|
49
49
|
"deprecated": false,
|
|
@@ -80,6 +80,6 @@
|
|
|
80
80
|
"url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
|
|
81
81
|
},
|
|
82
82
|
"typings": "index.d.ts",
|
|
83
|
-
"version": "27.1.
|
|
83
|
+
"version": "27.1.55",
|
|
84
84
|
"sideEffects": false
|
|
85
85
|
}
|
|
@@ -39,7 +39,7 @@ var EditorManager = /** @class */ (function () {
|
|
|
39
39
|
function EditorManager(options) {
|
|
40
40
|
this.currentDocument = options.document;
|
|
41
41
|
this.editableElement = options.editableElement;
|
|
42
|
-
this.nodeSelection = new NodeSelection();
|
|
42
|
+
this.nodeSelection = new NodeSelection(this.editableElement);
|
|
43
43
|
this.nodeCutter = new NodeCutter();
|
|
44
44
|
this.domNode = new DOMNode(this.editableElement, this.currentDocument);
|
|
45
45
|
this.observer = new Observer(this);
|
|
@@ -10,11 +10,11 @@ import { IFormatPainterActionValue, IFormatPainterContext } from './enum';
|
|
|
10
10
|
*/
|
|
11
11
|
export interface ICommandModel {
|
|
12
12
|
/**
|
|
13
|
-
* Specifies the current document.
|
|
13
|
+
* Specifies the editor element's current document.
|
|
14
14
|
*/
|
|
15
15
|
document: HTMLDocument;
|
|
16
16
|
/**
|
|
17
|
-
* Specifies the
|
|
17
|
+
* Specifies the editable element.
|
|
18
18
|
*/
|
|
19
19
|
editableElement: Element;
|
|
20
20
|
options?: {
|
|
@@ -26,7 +26,7 @@ var ClearFormat = /** @class */ (function () {
|
|
|
26
26
|
ClearFormat.clear = function (docElement, endNode, enterAction, selector, command) {
|
|
27
27
|
this.domNode = new DOMNode(endNode, docElement);
|
|
28
28
|
this.defaultTag = enterAction === 'P' ? this.defaultTag : 'div';
|
|
29
|
-
var nodeSelection = new NodeSelection();
|
|
29
|
+
var nodeSelection = new NodeSelection(endNode);
|
|
30
30
|
var nodeCutter = new NodeCutter();
|
|
31
31
|
var range = nodeSelection.getRange(docElement);
|
|
32
32
|
var nodes = range.collapsed ? nodeSelection.getSelectionNodeCollection(range) :
|
|
@@ -25,7 +25,7 @@ var DOMNode = /** @class */ (function () {
|
|
|
25
25
|
*/
|
|
26
26
|
function DOMNode(parent, currentDocument) {
|
|
27
27
|
this.parent = parent;
|
|
28
|
-
this.nodeSelection = new NodeSelection();
|
|
28
|
+
this.nodeSelection = new NodeSelection(parent);
|
|
29
29
|
this.currentDocument = currentDocument;
|
|
30
30
|
this.tableSelection = new TableSelection(parent, currentDocument);
|
|
31
31
|
}
|
|
@@ -119,6 +119,8 @@ var ImageCommand = /** @class */ (function () {
|
|
|
119
119
|
(Browser.isIE ? selectedNode.previousSibling : selectedNode.previousElementSibling);
|
|
120
120
|
var onImageLoadEvent_1 = function () {
|
|
121
121
|
if (!isNOU(_this.parent.currentDocument)) {
|
|
122
|
+
imgElm_1.setAttribute('width', _this.calculateStyleValue(imgElm_1.offsetWidth));
|
|
123
|
+
imgElm_1.setAttribute('height', _this.calculateStyleValue(imgElm_1.offsetHeight));
|
|
122
124
|
e.callBack({
|
|
123
125
|
requestType: (e.value === 'Replace') ? (e.item.subCommand = 'Replace', 'Replace') : 'Images',
|
|
124
126
|
editorMode: 'HTML',
|
|
@@ -16,6 +16,7 @@ export declare class InsertHtml {
|
|
|
16
16
|
static Insert(docElement: Document, insertNode: Node | string, editNode?: Element, isExternal?: boolean, enterAction?: string): void;
|
|
17
17
|
private static findFirstTextNode;
|
|
18
18
|
private static pasteInsertHTML;
|
|
19
|
+
private static listCleanUp;
|
|
19
20
|
private static placeCursorEnd;
|
|
20
21
|
private static getNodeCollection;
|
|
21
22
|
private static insertTempNode;
|
|
@@ -31,7 +31,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
31
31
|
node = insertNode;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
var nodeSelection = new NodeSelection();
|
|
34
|
+
var nodeSelection = new NodeSelection(editNode);
|
|
35
35
|
var nodeCutter = new NodeCutter();
|
|
36
36
|
var range = nodeSelection.getRange(docElement);
|
|
37
37
|
if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
|
|
@@ -395,6 +395,26 @@ var InsertHtml = /** @class */ (function () {
|
|
|
395
395
|
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
|
|
396
396
|
}
|
|
397
397
|
this.alignCheck(editNode);
|
|
398
|
+
var currentRange = nodeSelection.getRange(docElement);
|
|
399
|
+
this.listCleanUp(currentRange);
|
|
400
|
+
};
|
|
401
|
+
InsertHtml.listCleanUp = function (range) {
|
|
402
|
+
if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
|
|
403
|
+
var liElems = range.startContainer.parentElement.closest('ol,ul').querySelectorAll('li');
|
|
404
|
+
if (liElems.length > 0) {
|
|
405
|
+
liElems.forEach(function (item) {
|
|
406
|
+
if (!isNOU(item.firstChild) && (item.firstChild.nodeName === 'OL' || item.firstChild.nodeName === 'UL')) {
|
|
407
|
+
item.style.listStyleType = 'none';
|
|
408
|
+
}
|
|
409
|
+
var nestedLi = Array.from(item.children).find(function (child) {
|
|
410
|
+
return child.tagName === 'LI' && (child.parentElement && child.parentElement.tagName !== 'OL' && child.parentElement.tagName !== 'UL');
|
|
411
|
+
});
|
|
412
|
+
if (nestedLi) {
|
|
413
|
+
item.parentNode.replaceChild(nestedLi, item);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
}
|
|
398
418
|
};
|
|
399
419
|
InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
400
420
|
lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNOU(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
|
|
@@ -459,7 +479,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
459
479
|
blockNode = range.endContainer;
|
|
460
480
|
range.setEnd(blockNode, range.endContainer.textContent.length);
|
|
461
481
|
}
|
|
462
|
-
if (blockNode && blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
|
|
482
|
+
if (blockNode && blockNode.nodeName === 'BODY' || blockNode.nodeName === 'DIV' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
|
|
463
483
|
blockNode = range.startContainer;
|
|
464
484
|
}
|
|
465
485
|
if (blockNode && blockNode.closest('LI') && editNode.contains(blockNode.closest('LI')) && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
|
|
@@ -479,12 +499,12 @@ var InsertHtml = /** @class */ (function () {
|
|
|
479
499
|
tempSpan.parentNode.replaceChild(node, tempSpan);
|
|
480
500
|
}
|
|
481
501
|
else {
|
|
482
|
-
var nodeSelection = new NodeSelection();
|
|
502
|
+
var nodeSelection = new NodeSelection(editNode);
|
|
483
503
|
var currentNode = this.getNodeCollection(range, nodeSelection, node)[this.getNodeCollection(range, nodeSelection, node).length - 1];
|
|
484
504
|
var splitedElm = void 0;
|
|
485
|
-
if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR' ||
|
|
505
|
+
if (currentNode && ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR' ||
|
|
486
506
|
(currentNode.nodeName === '#text' && !isNOU(currentNode.parentElement) && currentNode.parentElement.nodeName === 'LI')) &&
|
|
487
|
-
(!isNOU(currentNode.parentElement) && currentNode.parentElement.textContent.trim().length === 0)) {
|
|
507
|
+
(!isNOU(currentNode.parentElement) && currentNode.parentElement.textContent.trim().length === 0))) {
|
|
488
508
|
splitedElm = currentNode;
|
|
489
509
|
if (currentNode.parentElement.nodeName === 'LI' && !isNOU(currentNode.nextSibling) &&
|
|
490
510
|
currentNode.nextSibling.nodeName === 'BR') {
|
|
@@ -497,16 +517,20 @@ var InsertHtml = /** @class */ (function () {
|
|
|
497
517
|
return;
|
|
498
518
|
}
|
|
499
519
|
}
|
|
500
|
-
else if ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !isNOU(currentNode.parentElement) &&
|
|
520
|
+
else if (currentNode && ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !isNOU(currentNode.parentElement) &&
|
|
501
521
|
(currentNode.parentElement.nodeName === 'LI' || currentNode.parentElement.closest('LI') || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
|
|
502
|
-
currentNode.parentElement.textContent.trim().length > 0) {
|
|
522
|
+
currentNode.parentElement.textContent.trim().length > 0)) {
|
|
503
523
|
splitedElm = currentNode;
|
|
504
524
|
if (currentNode.parentElement.nodeName === 'LI' && !isNOU(currentNode.nextSibling) &&
|
|
505
525
|
currentNode.nextSibling.nodeName === 'BR') {
|
|
506
526
|
detach(currentNode.nextSibling);
|
|
507
527
|
}
|
|
508
528
|
if (!range.collapsed) {
|
|
529
|
+
var startContainer = range.startContainer;
|
|
530
|
+
var startOffset = range.startOffset;
|
|
509
531
|
this.removeListfromPaste(range);
|
|
532
|
+
range.setStart(startContainer, startOffset);
|
|
533
|
+
range.setEnd(startContainer, startOffset);
|
|
510
534
|
}
|
|
511
535
|
range.insertNode(node);
|
|
512
536
|
this.contentsDeleted = true;
|
|
@@ -546,9 +570,9 @@ var InsertHtml = /** @class */ (function () {
|
|
|
546
570
|
};
|
|
547
571
|
// eslint-disable-next-line
|
|
548
572
|
InsertHtml.getImmediateBlockNode = function (node, editNode) {
|
|
549
|
-
|
|
573
|
+
while (node && CONSTANT.BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0) {
|
|
550
574
|
node = node.parentNode;
|
|
551
|
-
}
|
|
575
|
+
}
|
|
552
576
|
return node;
|
|
553
577
|
};
|
|
554
578
|
InsertHtml.removingComments = function (elm) {
|
|
@@ -664,7 +688,7 @@ var InsertHtml = /** @class */ (function () {
|
|
|
664
688
|
var value = range.startContainer;
|
|
665
689
|
if (!isNOU(value) && value.nodeName === 'LI' && !isNOU(value.parentElement) && (value.parentElement.nodeName === 'OL' || value.parentElement.nodeName === 'UL') && value.textContent.trim() === '') {
|
|
666
690
|
value.parentElement.querySelectorAll('li').forEach(function (item) {
|
|
667
|
-
if (item.textContent.trim() === '') {
|
|
691
|
+
if (item.textContent.trim() === '' && item !== value) {
|
|
668
692
|
item.remove();
|
|
669
693
|
}
|
|
670
694
|
});
|
|
@@ -86,7 +86,7 @@ var LinkCommand = /** @class */ (function () {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
|
-
var domSelection = new NodeSelection();
|
|
89
|
+
var domSelection = new NodeSelection(this.parent.editableElement);
|
|
90
90
|
var range = domSelection.getRange(this.parent.currentDocument);
|
|
91
91
|
if (range.endContainer.nodeName === '#text' && range.startContainer.textContent.length === (range.endOffset + 1) &&
|
|
92
92
|
range.endContainer.textContent.charAt(range.endOffset) === ' ' && (!isNOU(range.endContainer.nextSibling) && range.endContainer.nextSibling.nodeName === 'A')) {
|
|
@@ -132,7 +132,7 @@ var LinkCommand = /** @class */ (function () {
|
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
LinkCommand.prototype.createLinkNode = function (e) {
|
|
135
|
-
var domSelection = new NodeSelection();
|
|
135
|
+
var domSelection = new NodeSelection(this.parent.editableElement);
|
|
136
136
|
var nodeCutter = new NodeCutter();
|
|
137
137
|
var range = domSelection.getRange(this.parent.currentDocument);
|
|
138
138
|
var nodes = this.getSelectionNodes(domSelection.getNodeCollection(range));
|
|
@@ -312,7 +312,7 @@ var Lists = /** @class */ (function () {
|
|
|
312
312
|
if (e.event.which === 8) {
|
|
313
313
|
this.backspaceList(e);
|
|
314
314
|
}
|
|
315
|
-
if ((e.event.which === 46 && e.event.action === 'delete')
|
|
315
|
+
if ((e.event.which === 46 && e.event.action === 'delete')) {
|
|
316
316
|
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
317
317
|
var commonAncestor = range.commonAncestorContainer;
|
|
318
318
|
var startEle = range.startContainer;
|
|
@@ -34,7 +34,7 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
34
34
|
if (format === 'backgroundcolor' && value === '') {
|
|
35
35
|
value = 'transparent';
|
|
36
36
|
}
|
|
37
|
-
var domSelection = new NodeSelection();
|
|
37
|
+
var domSelection = new NodeSelection(endNode);
|
|
38
38
|
var domNode = new DOMNode(endNode, docElement);
|
|
39
39
|
var nodeCutter = new NodeCutter();
|
|
40
40
|
var isFormatted = new IsFormatted();
|
|
@@ -243,7 +243,7 @@ var SelectionCommands = /** @class */ (function () {
|
|
|
243
243
|
if (cursorNodes.length === 1 && range.startOffset === 0 && (cursorNodes[0].nodeName === 'BR' || (isNOU(cursorNodes[0].nextSibling) ? false : cursorNodes[0].nextSibling.nodeName === 'BR'))) {
|
|
244
244
|
detach(cursorNodes[0].nodeName === '#text' ? cursorNodes[0].nextSibling : cursorNodes[0]);
|
|
245
245
|
}
|
|
246
|
-
if (!isNOU(cursorNodes[0].parentElement) && IsFormatted.inlineTags.
|
|
246
|
+
if (!isNOU(cursorNodes[0] && cursorNodes[0].parentElement) && IsFormatted.inlineTags.
|
|
247
247
|
indexOf((cursorNodes[0].parentElement).tagName.toLowerCase()) !== -1 && cursorNodes[0].textContent.includes('\u200B')) {
|
|
248
248
|
var element = this.GetFormatNode(format, value);
|
|
249
249
|
var tempNode = cursorNodes[0];
|
|
@@ -29,7 +29,7 @@ var ToolbarStatus = /** @class */ (function () {
|
|
|
29
29
|
ToolbarStatus.get = function (docElement, rootNode, formatNode, fontSize, fontName, documentNode) {
|
|
30
30
|
var formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
31
31
|
var nodeCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
32
|
-
var nodeSelection = new NodeSelection();
|
|
32
|
+
var nodeSelection = new NodeSelection(rootNode);
|
|
33
33
|
var range = nodeSelection.getRange(docElement);
|
|
34
34
|
var nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
|
|
35
35
|
nodeSelection.getSelectionNodeCollectionBr(range);
|
|
@@ -139,7 +139,7 @@ var UndoRedoManager = /** @class */ (function () {
|
|
|
139
139
|
if (!this.parent.currentDocument) {
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
|
-
var range = new NodeSelection().getRange(this.parent.currentDocument);
|
|
142
|
+
var range = new NodeSelection(this.parent.editableElement).getRange(this.parent.currentDocument);
|
|
143
143
|
var currentContainer = this.parent.editableElement === range.startContainer.parentElement ?
|
|
144
144
|
range.startContainer.parentElement : range.startContainer;
|
|
145
145
|
for (var i = currentContainer.childNodes.length - 1; i >= 0; i--) {
|
|
@@ -149,8 +149,8 @@ var UndoRedoManager = /** @class */ (function () {
|
|
|
149
149
|
detach(currentContainer.childNodes[i]);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
range = new NodeSelection().getRange(this.parent.currentDocument);
|
|
153
|
-
var save = new NodeSelection().save(range, this.parent.currentDocument);
|
|
152
|
+
range = new NodeSelection(this.parent.editableElement).getRange(this.parent.currentDocument);
|
|
153
|
+
var save = new NodeSelection(this.parent.editableElement).save(range, this.parent.currentDocument);
|
|
154
154
|
var clonedElement = this.parent.editableElement.cloneNode(true);
|
|
155
155
|
var fragment = document.createDocumentFragment();
|
|
156
156
|
while (clonedElement.firstChild) {
|
|
@@ -427,11 +427,16 @@ var EnterKeyAction = /** @class */ (function () {
|
|
|
427
427
|
else if (!isNOU(currentParent) && currentParent !== _this.parent.inputElement && currentParent.nodeName !== 'BR') {
|
|
428
428
|
if (currentParent.textContent.trim().length === 0 || (currentParent.textContent.trim().length === 1 &&
|
|
429
429
|
currentParent.textContent.charCodeAt(0) === 8203)) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
430
|
+
if (currentParent.childElementCount > 1 && currentParent.lastElementChild.nodeName === 'IMG') {
|
|
431
|
+
_this.insertBRElement();
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, true).cloneNode(true);
|
|
435
|
+
_this.parent.formatter.editorManager.domNode.insertAfter(newElem, currentParent);
|
|
436
|
+
var outerBRElem = _this.parent.createElement('br');
|
|
437
|
+
newElem.parentElement.insertBefore(outerBRElem, newElem);
|
|
438
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElem, 0);
|
|
439
|
+
}
|
|
435
440
|
}
|
|
436
441
|
else {
|
|
437
442
|
var newElem = void 0;
|
|
@@ -89,7 +89,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
89
89
|
if (this.parent.isDestroyed) {
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
this.nodeSelectionObj = new NodeSelection();
|
|
92
|
+
this.nodeSelectionObj = new NodeSelection(this.parent.inputElement);
|
|
93
93
|
this.parent.on(events.initialLoad, this.instantiateRenderer, this);
|
|
94
94
|
this.parent.on(events.htmlToolbarClick, this.onToolbarClick, this);
|
|
95
95
|
this.parent.on(events.keyDown, this.onKeyDown, this);
|
|
@@ -803,7 +803,7 @@ var HtmlEditor = /** @class */ (function () {
|
|
|
803
803
|
urlText = urlText.slice(0, urlTextRange);
|
|
804
804
|
// eslint-disable-next-line
|
|
805
805
|
var regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
|
|
806
|
-
if (selectNodeEle[0].nodeName !== 'A' && urlText.match(regex)) {
|
|
806
|
+
if (selectNodeEle[0] && selectNodeEle[0].nodeName !== 'A' && urlText.match(regex)) {
|
|
807
807
|
var selection = this.nodeSelectionObj.save(range, this.parent.contentModule.getDocument());
|
|
808
808
|
var url = urlText.indexOf('http') > -1 ? urlText : 'http://' + urlText;
|
|
809
809
|
var selectParent = this.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
|
|
@@ -21,7 +21,7 @@ var ImportExport = /** @class */ (function () {
|
|
|
21
21
|
saveUrl: this.parent.importWord.serviceUrl
|
|
22
22
|
},
|
|
23
23
|
success: function (args) {
|
|
24
|
-
_this.parent.executeCommand('
|
|
24
|
+
_this.parent.executeCommand('importWord', args.e.currentTarget.response, { undo: true });
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
this.parent.setProperties({ enableXhtml: true }, true);
|
|
@@ -40,7 +40,7 @@ var PasteCleanup = /** @class */ (function () {
|
|
|
40
40
|
this.isDestroyed = false;
|
|
41
41
|
}
|
|
42
42
|
PasteCleanup.prototype.addEventListener = function () {
|
|
43
|
-
this.nodeSelectionObj = new NodeSelection();
|
|
43
|
+
this.nodeSelectionObj = new NodeSelection(this.parent.inputElement);
|
|
44
44
|
if (this.parent.isDestroyed) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
@@ -9,6 +9,8 @@ export declare class Resize {
|
|
|
9
9
|
protected touchMoveEvent: string;
|
|
10
10
|
protected touchEndEvent: string;
|
|
11
11
|
private isDestroyed;
|
|
12
|
+
private isResizing;
|
|
13
|
+
private iframeMouseUpBoundFn;
|
|
12
14
|
private constructor();
|
|
13
15
|
private addEventListener;
|
|
14
16
|
private renderResizable;
|
|
@@ -21,6 +23,7 @@ export declare class Resize {
|
|
|
21
23
|
private unwireResizeEvents;
|
|
22
24
|
private destroy;
|
|
23
25
|
private removeEventListener;
|
|
26
|
+
private iframeMouseUp;
|
|
24
27
|
/**
|
|
25
28
|
* For internal use only - Get the module name.
|
|
26
29
|
*
|
|
@@ -9,6 +9,8 @@ var Resize = /** @class */ (function () {
|
|
|
9
9
|
this.parent = parent;
|
|
10
10
|
this.addEventListener();
|
|
11
11
|
this.isDestroyed = false;
|
|
12
|
+
this.isResizing = false;
|
|
13
|
+
this.iframeMouseUpBoundFn = this.iframeMouseUp.bind(this);
|
|
12
14
|
}
|
|
13
15
|
Resize.prototype.addEventListener = function () {
|
|
14
16
|
if (this.parent.isDestroyed) {
|
|
@@ -28,6 +30,7 @@ var Resize = /** @class */ (function () {
|
|
|
28
30
|
this.parent.rootContainer.classList.add('e-resize-enabled');
|
|
29
31
|
if (this.parent.iframeSettings.enable) {
|
|
30
32
|
this.parent.inputElement.classList.add('e-resize-enabled');
|
|
33
|
+
this.parent.contentModule.getDocument().addEventListener('mouseup', this.iframeMouseUpBoundFn);
|
|
31
34
|
}
|
|
32
35
|
this.touchStartEvent = (Browser.info.name === 'msie') ? 'pointerdown' : 'touchstart';
|
|
33
36
|
EventHandler.add(this.resizer, 'mousedown', this.resizeStart, this);
|
|
@@ -35,6 +38,7 @@ var Resize = /** @class */ (function () {
|
|
|
35
38
|
};
|
|
36
39
|
Resize.prototype.resizeStart = function (e) {
|
|
37
40
|
var _this = this;
|
|
41
|
+
this.isResizing = false;
|
|
38
42
|
if (e.cancelable) {
|
|
39
43
|
e.preventDefault();
|
|
40
44
|
}
|
|
@@ -49,6 +53,7 @@ var Resize = /** @class */ (function () {
|
|
|
49
53
|
};
|
|
50
54
|
Resize.prototype.performResize = function (e) {
|
|
51
55
|
var _this = this;
|
|
56
|
+
this.isResizing = true;
|
|
52
57
|
var args = { event: e, requestType: 'editor' };
|
|
53
58
|
this.parent.trigger(events.onResize, args, function (resizingArgs) {
|
|
54
59
|
if (resizingArgs.cancel) {
|
|
@@ -78,6 +83,7 @@ var Resize = /** @class */ (function () {
|
|
|
78
83
|
this.parent.refreshUI();
|
|
79
84
|
};
|
|
80
85
|
Resize.prototype.stopResize = function (e) {
|
|
86
|
+
this.isResizing = false;
|
|
81
87
|
this.parent.refreshUI();
|
|
82
88
|
this.unwireResizeEvents();
|
|
83
89
|
var args = { event: e, requestType: 'editor' };
|
|
@@ -127,6 +133,7 @@ var Resize = /** @class */ (function () {
|
|
|
127
133
|
}
|
|
128
134
|
if (this.parent.iframeSettings.enable && !isNullOrUndefined(this.parent.inputElement)) {
|
|
129
135
|
this.parent.inputElement.classList.remove('e-resize-enabled');
|
|
136
|
+
this.parent.contentModule.getDocument().removeEventListener('mouseup', this.iframeMouseUpBoundFn);
|
|
130
137
|
}
|
|
131
138
|
if (this.resizer) {
|
|
132
139
|
EventHandler.remove(this.resizer, 'mousedown', this.resizeStart);
|
|
@@ -134,6 +141,12 @@ var Resize = /** @class */ (function () {
|
|
|
134
141
|
detach(this.resizer);
|
|
135
142
|
}
|
|
136
143
|
this.parent.off(events.destroy, this.destroy);
|
|
144
|
+
this.iframeMouseUpBoundFn = null;
|
|
145
|
+
};
|
|
146
|
+
Resize.prototype.iframeMouseUp = function (e) {
|
|
147
|
+
if (this.isResizing) {
|
|
148
|
+
this.stopResize(e);
|
|
149
|
+
}
|
|
137
150
|
};
|
|
138
151
|
/**
|
|
139
152
|
* For internal use only - Get the module name.
|
|
@@ -246,7 +246,19 @@ export interface IRenderer {
|
|
|
246
246
|
inlineQTBar?: BaseQuickToolbar;
|
|
247
247
|
renderPanel?(): void;
|
|
248
248
|
setPanel?(panel: Element): void;
|
|
249
|
+
/**
|
|
250
|
+
* Retrieves the parent element of the content editable div.
|
|
251
|
+
* If the editor is in iframe mode, it returns the `iframe` element.
|
|
252
|
+
* Otherwise, it returns the parent element with the class `e-rte-content`.
|
|
253
|
+
*
|
|
254
|
+
* @returns {Element} - The parent element of the content editable div or the `iframe` element.
|
|
255
|
+
*/
|
|
249
256
|
getPanel?(): Element;
|
|
257
|
+
/**
|
|
258
|
+
* Retrieves the content editable `div` element of the RichTextEditor.
|
|
259
|
+
* If the editor is in iframe mode, it returns the `body` element of the iframe.
|
|
260
|
+
*
|
|
261
|
+
*/
|
|
250
262
|
getEditPanel?(): Element;
|
|
251
263
|
getText?(): string;
|
|
252
264
|
getDocument?(): Document;
|
|
@@ -1411,7 +1423,7 @@ export declare const executeGroup: {
|
|
|
1411
1423
|
/**
|
|
1412
1424
|
* Defines types to be used as CommandName.
|
|
1413
1425
|
*/
|
|
1414
|
-
export declare type CommandName = 'bold' | 'italic' | 'underline' | 'strikeThrough' | 'superscript' | 'subscript' | 'uppercase' | 'lowercase' | 'fontColor' | 'fontName' | 'fontSize' | 'backColor' | 'justifyCenter' | 'justifyFull' | 'justifyLeft' | 'justifyRight' | 'undo' | 'createLink' | 'formatBlock' | 'heading' | 'indent' | 'insertHTML' | 'insertOrderedList' | 'insertUnorderedList' | 'insertParagraph' | 'outdent' | 'redo' | 'removeFormat' | 'insertText' | 'insertImage' | 'insertAudio' | 'insertVideo' | 'insertHorizontalRule' | 'insertBrOnReturn' | 'insertCode' | 'insertTable' | 'editImage' | 'editLink' | 'applyFormatPainter' | 'copyFormatPainter' | 'escapeFormatPainter' | 'emojiPicker' | 'InlineCode';
|
|
1426
|
+
export declare type CommandName = 'bold' | 'italic' | 'underline' | 'strikeThrough' | 'superscript' | 'subscript' | 'uppercase' | 'lowercase' | 'fontColor' | 'fontName' | 'fontSize' | 'backColor' | 'justifyCenter' | 'justifyFull' | 'justifyLeft' | 'justifyRight' | 'undo' | 'createLink' | 'formatBlock' | 'heading' | 'indent' | 'insertHTML' | 'insertOrderedList' | 'insertUnorderedList' | 'insertParagraph' | 'outdent' | 'redo' | 'removeFormat' | 'insertText' | 'insertImage' | 'insertAudio' | 'insertVideo' | 'insertHorizontalRule' | 'insertBrOnReturn' | 'insertCode' | 'insertTable' | 'editImage' | 'editLink' | 'applyFormatPainter' | 'copyFormatPainter' | 'escapeFormatPainter' | 'emojiPicker' | 'InlineCode' | 'importWord';
|
|
1415
1427
|
/**
|
|
1416
1428
|
* @hidden
|
|
1417
1429
|
|
|
@@ -357,6 +357,17 @@ var RichTextEditor = /** @class */ (function (_super) {
|
|
|
357
357
|
* @public
|
|
358
358
|
*/
|
|
359
359
|
RichTextEditor.prototype.executeCommand = function (commandName, value, option) {
|
|
360
|
+
if (commandName === 'importWord') {
|
|
361
|
+
var importContainer = this.createElement('div');
|
|
362
|
+
importContainer.innerHTML = value;
|
|
363
|
+
var tableElement = importContainer.querySelectorAll('table:not(.e-rte-table):not(.e-rte-paste-table)');
|
|
364
|
+
for (var i = 0; i < tableElement.length; i++) {
|
|
365
|
+
tableElement[i].classList.add('e-rte-paste-table');
|
|
366
|
+
}
|
|
367
|
+
value = importContainer.innerHTML;
|
|
368
|
+
importContainer.remove();
|
|
369
|
+
commandName = 'insertHTML';
|
|
370
|
+
}
|
|
360
371
|
value = this.htmlPurifier(commandName, value);
|
|
361
372
|
var internalValue;
|
|
362
373
|
if (this.editorMode === 'HTML') {
|
|
@@ -568,11 +568,15 @@ var Image = /** @class */ (function () {
|
|
|
568
568
|
}
|
|
569
569
|
};
|
|
570
570
|
Image.prototype.openImgLink = function (e) {
|
|
571
|
+
var sanitizedHTML = this.parent.htmlEditorModule.sanitizeHelper(e.selectParent[0].parentNode.outerHTML);
|
|
572
|
+
var tempEle = document.createElement('div');
|
|
573
|
+
tempEle.innerHTML = sanitizedHTML;
|
|
571
574
|
var target = e.selectParent[0].parentNode.target === '' ? '_self' : '_blank';
|
|
572
575
|
this.parent.formatter.process(this.parent, e.args, e.args, {
|
|
573
|
-
url:
|
|
576
|
+
url: tempEle.firstChild.href, target: target, selectNode: e.selectNode,
|
|
574
577
|
subCommand: e.args.item.subCommand
|
|
575
578
|
});
|
|
579
|
+
tempEle.remove();
|
|
576
580
|
};
|
|
577
581
|
Image.prototype.editImgLink = function (e) {
|
|
578
582
|
var selectParentEle = e.selectParent[0].parentNode;
|
|
@@ -659,7 +663,7 @@ var Image = /** @class */ (function () {
|
|
|
659
663
|
}
|
|
660
664
|
}
|
|
661
665
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
662
|
-
if (selectNodeEle && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
|
|
666
|
+
if (selectNodeEle && selectNodeEle[0] && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
|
|
663
667
|
if (!isNOU(this.parent.formatter.editorManager.nodeSelection)) {
|
|
664
668
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
665
669
|
}
|
|
@@ -491,11 +491,15 @@ var Link = /** @class */ (function () {
|
|
|
491
491
|
Link.prototype.openLink = function (e) {
|
|
492
492
|
var selectParentEle = this.getAnchorNode(e.selectParent[0]);
|
|
493
493
|
if (selectParentEle.classList.contains('e-rte-anchor') || selectParentEle.tagName === 'A') {
|
|
494
|
+
var sanitizedHTML = this.parent.htmlEditorModule.sanitizeHelper(selectParentEle.outerHTML);
|
|
495
|
+
var tempEle = document.createElement('div');
|
|
496
|
+
tempEle.innerHTML = sanitizedHTML;
|
|
494
497
|
this.parent.formatter.process(this.parent, e.args, e.args, {
|
|
495
|
-
url:
|
|
498
|
+
url: tempEle.firstChild.href, text: selectParentEle.innerText,
|
|
496
499
|
target: selectParentEle.target === '' ? '_self' : '_blank', selectNode: e.selectNode,
|
|
497
500
|
subCommand: e.args.item.subCommand
|
|
498
501
|
});
|
|
502
|
+
tempEle.remove();
|
|
499
503
|
}
|
|
500
504
|
};
|
|
501
505
|
Link.prototype.getAnchorNode = function (element) {
|
|
@@ -9,7 +9,7 @@ var SlashMenu = /** @class */ (function () {
|
|
|
9
9
|
this.parent = options;
|
|
10
10
|
this.currentDocument = this.parent.element.ownerDocument;
|
|
11
11
|
this.L10n = serviceLocator.getService('rteLocale');
|
|
12
|
-
this.savedSelection = new NodeSelection();
|
|
12
|
+
this.savedSelection = new NodeSelection(this.parent.inputElement);
|
|
13
13
|
this.defaultItems = defaultSlashMenuDataModel;
|
|
14
14
|
this.injectibleItems = injectibleSlashMenuDataModel;
|
|
15
15
|
this.parent.on(events.modelChanged, this.onPropertyChanged, this);
|
|
@@ -670,7 +670,7 @@ var Video = /** @class */ (function () {
|
|
|
670
670
|
this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
|
|
671
671
|
}
|
|
672
672
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
673
|
-
if (selectNodeEle && (selectNodeEle[0].nodeName === 'VIDEO' || this.isEmbedVidElem(selectNodeEle[0])) && selectNodeEle.length < 1) {
|
|
673
|
+
if (selectNodeEle && selectNodeEle[0] && (selectNodeEle[0].nodeName === 'VIDEO' || this.isEmbedVidElem(selectNodeEle[0])) && selectNodeEle.length < 1) {
|
|
674
674
|
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
675
675
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
676
676
|
}
|
|
@@ -12,6 +12,8 @@ export declare class NodeSelection {
|
|
|
12
12
|
endOffset: number;
|
|
13
13
|
startNodeName: string[];
|
|
14
14
|
endNodeName: string[];
|
|
15
|
+
editableElement: HTMLElement | HTMLBodyElement;
|
|
16
|
+
constructor(editElement?: HTMLElement | HTMLBodyElement);
|
|
15
17
|
private saveInstance;
|
|
16
18
|
private documentFromRange;
|
|
17
19
|
getRange(docElement: Document): Range;
|
|
@@ -231,4 +233,7 @@ export declare class NodeSelection {
|
|
|
231
233
|
|
|
232
234
|
*/
|
|
233
235
|
setCursorPoint(docElement: Document, element: Element, point: number): void;
|
|
236
|
+
private isTableOrImageStart;
|
|
237
|
+
private isTableOrImageEnd;
|
|
238
|
+
private processedTableImageCursor;
|
|
234
239
|
}
|