@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
|
@@ -4252,9 +4252,10 @@ var PASTE_SOURCE = ['word', 'excel', 'onenote'];
|
|
|
4252
4252
|
* `Selection` module is used to handle RTE Selections.
|
|
4253
4253
|
*/
|
|
4254
4254
|
var NodeSelection = /** @__PURE__ @class */ (function () {
|
|
4255
|
-
function NodeSelection() {
|
|
4255
|
+
function NodeSelection(editElement) {
|
|
4256
4256
|
this.startNodeName = [];
|
|
4257
4257
|
this.endNodeName = [];
|
|
4258
|
+
this.editableElement = editElement;
|
|
4258
4259
|
}
|
|
4259
4260
|
NodeSelection.prototype.saveInstance = function (range, body) {
|
|
4260
4261
|
this.range = range.cloneRange();
|
|
@@ -4334,6 +4335,9 @@ var NodeSelection = /** @__PURE__ @class */ (function () {
|
|
|
4334
4335
|
return false;
|
|
4335
4336
|
};
|
|
4336
4337
|
NodeSelection.prototype.getNode = function (startNode, endNode, nodeCollection) {
|
|
4338
|
+
if (this.editableElement && (!this.editableElement.contains(startNode) || this.editableElement === startNode)) {
|
|
4339
|
+
return null;
|
|
4340
|
+
}
|
|
4337
4341
|
if (endNode === startNode &&
|
|
4338
4342
|
(startNode.nodeType === 3 || !startNode.firstChild || nodeCollection.indexOf(startNode.firstChild) !== -1
|
|
4339
4343
|
|| this.isChildNode(nodeCollection, startNode))) {
|
|
@@ -4368,6 +4372,12 @@ var NodeSelection = /** @__PURE__ @class */ (function () {
|
|
|
4368
4372
|
|| range.startContainer;
|
|
4369
4373
|
var endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
|
|
4370
4374
|
|| range.endContainer;
|
|
4375
|
+
var tableCursor = this.processedTableImageCursor(range);
|
|
4376
|
+
if (tableCursor.start || tableCursor.end) {
|
|
4377
|
+
if (tableCursor.startName === 'TABLE' || tableCursor.endName === 'TABLE') {
|
|
4378
|
+
return [];
|
|
4379
|
+
}
|
|
4380
|
+
}
|
|
4371
4381
|
if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
|
|
4372
4382
|
startNode.childNodes.length === 0) {
|
|
4373
4383
|
return [startNode];
|
|
@@ -4687,6 +4697,39 @@ var NodeSelection = /** @__PURE__ @class */ (function () {
|
|
|
4687
4697
|
selection.removeAllRanges();
|
|
4688
4698
|
selection.addRange(range);
|
|
4689
4699
|
};
|
|
4700
|
+
NodeSelection.prototype.isTableOrImageStart = function (range) {
|
|
4701
|
+
var customHandlerElements = ['TABLE'];
|
|
4702
|
+
var startContainer = range.startContainer;
|
|
4703
|
+
var startOffset = range.startOffset;
|
|
4704
|
+
var isCursorAtStart = range.collapsed && (startContainer.nodeType === 1) &&
|
|
4705
|
+
startContainer.isContentEditable && startContainer.childNodes[startOffset] &&
|
|
4706
|
+
(customHandlerElements.indexOf(startContainer.childNodes[startOffset].nodeName) > -1);
|
|
4707
|
+
if (isCursorAtStart) {
|
|
4708
|
+
return { start: isCursorAtStart, startNodeName: startContainer.childNodes[startOffset].nodeName };
|
|
4709
|
+
}
|
|
4710
|
+
else {
|
|
4711
|
+
return { start: false, startNodeName: '' };
|
|
4712
|
+
}
|
|
4713
|
+
};
|
|
4714
|
+
NodeSelection.prototype.isTableOrImageEnd = function (range) {
|
|
4715
|
+
var customHandlerElements = ['TABLE'];
|
|
4716
|
+
var startContainer = range.startContainer;
|
|
4717
|
+
var startOffset = range.startOffset;
|
|
4718
|
+
var isCursorAtEnd = range.collapsed && (startContainer.nodeType === 1) &&
|
|
4719
|
+
startContainer.isContentEditable && startContainer.childNodes[startOffset - 1] &&
|
|
4720
|
+
(customHandlerElements.indexOf(startContainer.childNodes[startOffset - 1].nodeName) > -1);
|
|
4721
|
+
if (isCursorAtEnd) {
|
|
4722
|
+
return { end: isCursorAtEnd, endNodeName: startContainer.childNodes[startOffset - 1].nodeName };
|
|
4723
|
+
}
|
|
4724
|
+
else {
|
|
4725
|
+
return { end: false, endNodeName: '' };
|
|
4726
|
+
}
|
|
4727
|
+
};
|
|
4728
|
+
NodeSelection.prototype.processedTableImageCursor = function (range) {
|
|
4729
|
+
var _a = this.isTableOrImageStart(range), start = _a.start, startNodeName = _a.startNodeName;
|
|
4730
|
+
var _b = this.isTableOrImageEnd(range), end = _b.end, endNodeName = _b.endNodeName;
|
|
4731
|
+
return { start: start, startName: startNodeName, end: end, endName: endNodeName };
|
|
4732
|
+
};
|
|
4690
4733
|
return NodeSelection;
|
|
4691
4734
|
}());
|
|
4692
4735
|
|
|
@@ -5042,7 +5085,7 @@ var ToolbarStatus = /** @__PURE__ @class */ (function () {
|
|
|
5042
5085
|
ToolbarStatus.get = function (docElement, rootNode, formatNode, fontSize, fontName, documentNode) {
|
|
5043
5086
|
var formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
5044
5087
|
var nodeCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
5045
|
-
var nodeSelection = new NodeSelection();
|
|
5088
|
+
var nodeSelection = new NodeSelection(rootNode);
|
|
5046
5089
|
var range = nodeSelection.getRange(docElement);
|
|
5047
5090
|
var nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
|
|
5048
5091
|
nodeSelection.getSelectionNodeCollectionBr(range);
|
|
@@ -6649,11 +6692,15 @@ var Link = /** @__PURE__ @class */ (function () {
|
|
|
6649
6692
|
Link.prototype.openLink = function (e) {
|
|
6650
6693
|
var selectParentEle = this.getAnchorNode(e.selectParent[0]);
|
|
6651
6694
|
if (selectParentEle.classList.contains('e-rte-anchor') || selectParentEle.tagName === 'A') {
|
|
6695
|
+
var sanitizedHTML = this.parent.htmlEditorModule.sanitizeHelper(selectParentEle.outerHTML);
|
|
6696
|
+
var tempEle = document.createElement('div');
|
|
6697
|
+
tempEle.innerHTML = sanitizedHTML;
|
|
6652
6698
|
this.parent.formatter.process(this.parent, e.args, e.args, {
|
|
6653
|
-
url:
|
|
6699
|
+
url: tempEle.firstChild.href, text: selectParentEle.innerText,
|
|
6654
6700
|
target: selectParentEle.target === '' ? '_self' : '_blank', selectNode: e.selectNode,
|
|
6655
6701
|
subCommand: e.args.item.subCommand
|
|
6656
6702
|
});
|
|
6703
|
+
tempEle.remove();
|
|
6657
6704
|
}
|
|
6658
6705
|
};
|
|
6659
6706
|
Link.prototype.getAnchorNode = function (element) {
|
|
@@ -7451,11 +7498,15 @@ var Image$1 = /** @__PURE__ @class */ (function () {
|
|
|
7451
7498
|
}
|
|
7452
7499
|
};
|
|
7453
7500
|
Image.prototype.openImgLink = function (e) {
|
|
7501
|
+
var sanitizedHTML = this.parent.htmlEditorModule.sanitizeHelper(e.selectParent[0].parentNode.outerHTML);
|
|
7502
|
+
var tempEle = document.createElement('div');
|
|
7503
|
+
tempEle.innerHTML = sanitizedHTML;
|
|
7454
7504
|
var target = e.selectParent[0].parentNode.target === '' ? '_self' : '_blank';
|
|
7455
7505
|
this.parent.formatter.process(this.parent, e.args, e.args, {
|
|
7456
|
-
url:
|
|
7506
|
+
url: tempEle.firstChild.href, target: target, selectNode: e.selectNode,
|
|
7457
7507
|
subCommand: e.args.item.subCommand
|
|
7458
7508
|
});
|
|
7509
|
+
tempEle.remove();
|
|
7459
7510
|
};
|
|
7460
7511
|
Image.prototype.editImgLink = function (e) {
|
|
7461
7512
|
var selectParentEle = e.selectParent[0].parentNode;
|
|
@@ -7542,7 +7593,7 @@ var Image$1 = /** @__PURE__ @class */ (function () {
|
|
|
7542
7593
|
}
|
|
7543
7594
|
}
|
|
7544
7595
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
7545
|
-
if (selectNodeEle && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
|
|
7596
|
+
if (selectNodeEle && selectNodeEle[0] && selectNodeEle[0].nodeName === 'IMG' && selectNodeEle.length < 1) {
|
|
7546
7597
|
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
7547
7598
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
7548
7599
|
}
|
|
@@ -10878,7 +10929,7 @@ var Video = /** @__PURE__ @class */ (function () {
|
|
|
10878
10929
|
this.undoStack({ subCommand: (originalEvent.keyCode === 90 ? 'undo' : 'redo') });
|
|
10879
10930
|
}
|
|
10880
10931
|
if (originalEvent.keyCode === 8 || originalEvent.keyCode === 46) {
|
|
10881
|
-
if (selectNodeEle && (selectNodeEle[0].nodeName === 'VIDEO' || this.isEmbedVidElem(selectNodeEle[0])) && selectNodeEle.length < 1) {
|
|
10932
|
+
if (selectNodeEle && selectNodeEle[0] && (selectNodeEle[0].nodeName === 'VIDEO' || this.isEmbedVidElem(selectNodeEle[0])) && selectNodeEle.length < 1) {
|
|
10882
10933
|
if (!isNullOrUndefined(this.parent.formatter.editorManager.nodeSelection)) {
|
|
10883
10934
|
save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
|
|
10884
10935
|
}
|
|
@@ -15049,7 +15100,7 @@ var SlashMenu = /** @__PURE__ @class */ (function () {
|
|
|
15049
15100
|
this.parent = options;
|
|
15050
15101
|
this.currentDocument = this.parent.element.ownerDocument;
|
|
15051
15102
|
this.L10n = serviceLocator.getService('rteLocale');
|
|
15052
|
-
this.savedSelection = new NodeSelection();
|
|
15103
|
+
this.savedSelection = new NodeSelection(this.parent.inputElement);
|
|
15053
15104
|
this.defaultItems = defaultSlashMenuDataModel;
|
|
15054
15105
|
this.injectibleItems = injectibleSlashMenuDataModel;
|
|
15055
15106
|
this.parent.on(modelChanged, this.onPropertyChanged, this);
|
|
@@ -21206,7 +21257,7 @@ var DOMNode = /** @__PURE__ @class */ (function () {
|
|
|
21206
21257
|
*/
|
|
21207
21258
|
function DOMNode(parent, currentDocument) {
|
|
21208
21259
|
this.parent = parent;
|
|
21209
|
-
this.nodeSelection = new NodeSelection();
|
|
21260
|
+
this.nodeSelection = new NodeSelection(parent);
|
|
21210
21261
|
this.currentDocument = currentDocument;
|
|
21211
21262
|
this.tableSelection = new TableSelection(parent, currentDocument);
|
|
21212
21263
|
}
|
|
@@ -22522,7 +22573,7 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
22522
22573
|
if (e.event.which === 8) {
|
|
22523
22574
|
this.backspaceList(e);
|
|
22524
22575
|
}
|
|
22525
|
-
if ((e.event.which === 46 && e.event.action === 'delete')
|
|
22576
|
+
if ((e.event.which === 46 && e.event.action === 'delete')) {
|
|
22526
22577
|
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
22527
22578
|
var commonAncestor = range.commonAncestorContainer;
|
|
22528
22579
|
var startEle = range.startContainer;
|
|
@@ -24049,7 +24100,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
24049
24100
|
node = insertNode;
|
|
24050
24101
|
}
|
|
24051
24102
|
}
|
|
24052
|
-
var nodeSelection = new NodeSelection();
|
|
24103
|
+
var nodeSelection = new NodeSelection(editNode);
|
|
24053
24104
|
var nodeCutter = new NodeCutter();
|
|
24054
24105
|
var range = nodeSelection.getRange(docElement);
|
|
24055
24106
|
if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
|
|
@@ -24413,6 +24464,26 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
24413
24464
|
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
|
|
24414
24465
|
}
|
|
24415
24466
|
this.alignCheck(editNode);
|
|
24467
|
+
var currentRange = nodeSelection.getRange(docElement);
|
|
24468
|
+
this.listCleanUp(currentRange);
|
|
24469
|
+
};
|
|
24470
|
+
InsertHtml.listCleanUp = function (range) {
|
|
24471
|
+
if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
|
|
24472
|
+
var liElems = range.startContainer.parentElement.closest('ol,ul').querySelectorAll('li');
|
|
24473
|
+
if (liElems.length > 0) {
|
|
24474
|
+
liElems.forEach(function (item) {
|
|
24475
|
+
if (!isNullOrUndefined(item.firstChild) && (item.firstChild.nodeName === 'OL' || item.firstChild.nodeName === 'UL')) {
|
|
24476
|
+
item.style.listStyleType = 'none';
|
|
24477
|
+
}
|
|
24478
|
+
var nestedLi = Array.from(item.children).find(function (child) {
|
|
24479
|
+
return child.tagName === 'LI' && (child.parentElement && child.parentElement.tagName !== 'OL' && child.parentElement.tagName !== 'UL');
|
|
24480
|
+
});
|
|
24481
|
+
if (nestedLi) {
|
|
24482
|
+
item.parentNode.replaceChild(nestedLi, item);
|
|
24483
|
+
}
|
|
24484
|
+
});
|
|
24485
|
+
}
|
|
24486
|
+
}
|
|
24416
24487
|
};
|
|
24417
24488
|
InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
24418
24489
|
lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNullOrUndefined(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
|
|
@@ -24477,7 +24548,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
24477
24548
|
blockNode = range.endContainer;
|
|
24478
24549
|
range.setEnd(blockNode, range.endContainer.textContent.length);
|
|
24479
24550
|
}
|
|
24480
|
-
if (blockNode && blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
|
|
24551
|
+
if (blockNode && blockNode.nodeName === 'BODY' || blockNode.nodeName === 'DIV' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
|
|
24481
24552
|
blockNode = range.startContainer;
|
|
24482
24553
|
}
|
|
24483
24554
|
if (blockNode && blockNode.closest('LI') && editNode.contains(blockNode.closest('LI')) && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
|
|
@@ -24497,12 +24568,12 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
24497
24568
|
tempSpan.parentNode.replaceChild(node, tempSpan);
|
|
24498
24569
|
}
|
|
24499
24570
|
else {
|
|
24500
|
-
var nodeSelection = new NodeSelection();
|
|
24571
|
+
var nodeSelection = new NodeSelection(editNode);
|
|
24501
24572
|
var currentNode = this.getNodeCollection(range, nodeSelection, node)[this.getNodeCollection(range, nodeSelection, node).length - 1];
|
|
24502
24573
|
var splitedElm = void 0;
|
|
24503
|
-
if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR' ||
|
|
24574
|
+
if (currentNode && ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR' ||
|
|
24504
24575
|
(currentNode.nodeName === '#text' && !isNullOrUndefined(currentNode.parentElement) && currentNode.parentElement.nodeName === 'LI')) &&
|
|
24505
|
-
(!isNullOrUndefined(currentNode.parentElement) && currentNode.parentElement.textContent.trim().length === 0)) {
|
|
24576
|
+
(!isNullOrUndefined(currentNode.parentElement) && currentNode.parentElement.textContent.trim().length === 0))) {
|
|
24506
24577
|
splitedElm = currentNode;
|
|
24507
24578
|
if (currentNode.parentElement.nodeName === 'LI' && !isNullOrUndefined(currentNode.nextSibling) &&
|
|
24508
24579
|
currentNode.nextSibling.nodeName === 'BR') {
|
|
@@ -24515,16 +24586,20 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
24515
24586
|
return;
|
|
24516
24587
|
}
|
|
24517
24588
|
}
|
|
24518
|
-
else if ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !isNullOrUndefined(currentNode.parentElement) &&
|
|
24589
|
+
else if (currentNode && ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !isNullOrUndefined(currentNode.parentElement) &&
|
|
24519
24590
|
(currentNode.parentElement.nodeName === 'LI' || currentNode.parentElement.closest('LI') || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
|
|
24520
|
-
currentNode.parentElement.textContent.trim().length > 0) {
|
|
24591
|
+
currentNode.parentElement.textContent.trim().length > 0)) {
|
|
24521
24592
|
splitedElm = currentNode;
|
|
24522
24593
|
if (currentNode.parentElement.nodeName === 'LI' && !isNullOrUndefined(currentNode.nextSibling) &&
|
|
24523
24594
|
currentNode.nextSibling.nodeName === 'BR') {
|
|
24524
24595
|
detach(currentNode.nextSibling);
|
|
24525
24596
|
}
|
|
24526
24597
|
if (!range.collapsed) {
|
|
24598
|
+
var startContainer = range.startContainer;
|
|
24599
|
+
var startOffset = range.startOffset;
|
|
24527
24600
|
this.removeListfromPaste(range);
|
|
24601
|
+
range.setStart(startContainer, startOffset);
|
|
24602
|
+
range.setEnd(startContainer, startOffset);
|
|
24528
24603
|
}
|
|
24529
24604
|
range.insertNode(node);
|
|
24530
24605
|
this.contentsDeleted = true;
|
|
@@ -24564,9 +24639,9 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
24564
24639
|
};
|
|
24565
24640
|
// eslint-disable-next-line
|
|
24566
24641
|
InsertHtml.getImmediateBlockNode = function (node, editNode) {
|
|
24567
|
-
|
|
24642
|
+
while (node && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0) {
|
|
24568
24643
|
node = node.parentNode;
|
|
24569
|
-
}
|
|
24644
|
+
}
|
|
24570
24645
|
return node;
|
|
24571
24646
|
};
|
|
24572
24647
|
InsertHtml.removingComments = function (elm) {
|
|
@@ -24682,7 +24757,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
24682
24757
|
var value = range.startContainer;
|
|
24683
24758
|
if (!isNullOrUndefined(value) && value.nodeName === 'LI' && !isNullOrUndefined(value.parentElement) && (value.parentElement.nodeName === 'OL' || value.parentElement.nodeName === 'UL') && value.textContent.trim() === '') {
|
|
24684
24759
|
value.parentElement.querySelectorAll('li').forEach(function (item) {
|
|
24685
|
-
if (item.textContent.trim() === '') {
|
|
24760
|
+
if (item.textContent.trim() === '' && item !== value) {
|
|
24686
24761
|
item.remove();
|
|
24687
24762
|
}
|
|
24688
24763
|
});
|
|
@@ -24785,7 +24860,7 @@ var LinkCommand = /** @__PURE__ @class */ (function () {
|
|
|
24785
24860
|
}
|
|
24786
24861
|
}
|
|
24787
24862
|
else {
|
|
24788
|
-
var domSelection = new NodeSelection();
|
|
24863
|
+
var domSelection = new NodeSelection(this.parent.editableElement);
|
|
24789
24864
|
var range = domSelection.getRange(this.parent.currentDocument);
|
|
24790
24865
|
if (range.endContainer.nodeName === '#text' && range.startContainer.textContent.length === (range.endOffset + 1) &&
|
|
24791
24866
|
range.endContainer.textContent.charAt(range.endOffset) === ' ' && (!isNullOrUndefined(range.endContainer.nextSibling) && range.endContainer.nextSibling.nodeName === 'A')) {
|
|
@@ -24831,7 +24906,7 @@ var LinkCommand = /** @__PURE__ @class */ (function () {
|
|
|
24831
24906
|
}
|
|
24832
24907
|
};
|
|
24833
24908
|
LinkCommand.prototype.createLinkNode = function (e) {
|
|
24834
|
-
var domSelection = new NodeSelection();
|
|
24909
|
+
var domSelection = new NodeSelection(this.parent.editableElement);
|
|
24835
24910
|
var nodeCutter = new NodeCutter();
|
|
24836
24911
|
var range = domSelection.getRange(this.parent.currentDocument);
|
|
24837
24912
|
var nodes = this.getSelectionNodes(domSelection.getNodeCollection(range));
|
|
@@ -25406,6 +25481,8 @@ var ImageCommand = /** @__PURE__ @class */ (function () {
|
|
|
25406
25481
|
(Browser.isIE ? selectedNode.previousSibling : selectedNode.previousElementSibling);
|
|
25407
25482
|
var onImageLoadEvent_1 = function () {
|
|
25408
25483
|
if (!isNullOrUndefined(_this.parent.currentDocument)) {
|
|
25484
|
+
imgElm_1.setAttribute('width', _this.calculateStyleValue(imgElm_1.offsetWidth));
|
|
25485
|
+
imgElm_1.setAttribute('height', _this.calculateStyleValue(imgElm_1.offsetHeight));
|
|
25409
25486
|
e.callBack({
|
|
25410
25487
|
requestType: (e.value === 'Replace') ? (e.item.subCommand = 'Replace', 'Replace') : 'Images',
|
|
25411
25488
|
editorMode: 'HTML',
|
|
@@ -27240,7 +27317,7 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
|
|
|
27240
27317
|
if (format === 'backgroundcolor' && value === '') {
|
|
27241
27318
|
value = 'transparent';
|
|
27242
27319
|
}
|
|
27243
|
-
var domSelection = new NodeSelection();
|
|
27320
|
+
var domSelection = new NodeSelection(endNode);
|
|
27244
27321
|
var domNode = new DOMNode(endNode, docElement);
|
|
27245
27322
|
var nodeCutter = new NodeCutter();
|
|
27246
27323
|
var isFormatted = new IsFormatted();
|
|
@@ -27449,7 +27526,7 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
|
|
|
27449
27526
|
if (cursorNodes.length === 1 && range.startOffset === 0 && (cursorNodes[0].nodeName === 'BR' || (isNullOrUndefined(cursorNodes[0].nextSibling) ? false : cursorNodes[0].nextSibling.nodeName === 'BR'))) {
|
|
27450
27527
|
detach(cursorNodes[0].nodeName === '#text' ? cursorNodes[0].nextSibling : cursorNodes[0]);
|
|
27451
27528
|
}
|
|
27452
|
-
if (!isNullOrUndefined(cursorNodes[0].parentElement) && IsFormatted.inlineTags.
|
|
27529
|
+
if (!isNullOrUndefined(cursorNodes[0] && cursorNodes[0].parentElement) && IsFormatted.inlineTags.
|
|
27453
27530
|
indexOf((cursorNodes[0].parentElement).tagName.toLowerCase()) !== -1 && cursorNodes[0].textContent.includes('\u200B')) {
|
|
27454
27531
|
var element = this.GetFormatNode(format, value);
|
|
27455
27532
|
var tempNode = cursorNodes[0];
|
|
@@ -28362,7 +28439,7 @@ var ClearFormat$1 = /** @__PURE__ @class */ (function () {
|
|
|
28362
28439
|
ClearFormat.clear = function (docElement, endNode, enterAction, selector, command) {
|
|
28363
28440
|
this.domNode = new DOMNode(endNode, docElement);
|
|
28364
28441
|
this.defaultTag = enterAction === 'P' ? this.defaultTag : 'div';
|
|
28365
|
-
var nodeSelection = new NodeSelection();
|
|
28442
|
+
var nodeSelection = new NodeSelection(endNode);
|
|
28366
28443
|
var nodeCutter = new NodeCutter();
|
|
28367
28444
|
var range = nodeSelection.getRange(docElement);
|
|
28368
28445
|
var nodes = range.collapsed ? nodeSelection.getSelectionNodeCollection(range) :
|
|
@@ -28794,7 +28871,7 @@ var UndoRedoManager = /** @__PURE__ @class */ (function () {
|
|
|
28794
28871
|
if (!this.parent.currentDocument) {
|
|
28795
28872
|
return;
|
|
28796
28873
|
}
|
|
28797
|
-
var range = new NodeSelection().getRange(this.parent.currentDocument);
|
|
28874
|
+
var range = new NodeSelection(this.parent.editableElement).getRange(this.parent.currentDocument);
|
|
28798
28875
|
var currentContainer = this.parent.editableElement === range.startContainer.parentElement ?
|
|
28799
28876
|
range.startContainer.parentElement : range.startContainer;
|
|
28800
28877
|
for (var i = currentContainer.childNodes.length - 1; i >= 0; i--) {
|
|
@@ -28804,8 +28881,8 @@ var UndoRedoManager = /** @__PURE__ @class */ (function () {
|
|
|
28804
28881
|
detach(currentContainer.childNodes[i]);
|
|
28805
28882
|
}
|
|
28806
28883
|
}
|
|
28807
|
-
range = new NodeSelection().getRange(this.parent.currentDocument);
|
|
28808
|
-
var save = new NodeSelection().save(range, this.parent.currentDocument);
|
|
28884
|
+
range = new NodeSelection(this.parent.editableElement).getRange(this.parent.currentDocument);
|
|
28885
|
+
var save = new NodeSelection(this.parent.editableElement).save(range, this.parent.currentDocument);
|
|
28809
28886
|
var clonedElement = this.parent.editableElement.cloneNode(true);
|
|
28810
28887
|
var fragment = document.createDocumentFragment();
|
|
28811
28888
|
while (clonedElement.firstChild) {
|
|
@@ -30787,7 +30864,7 @@ var EditorManager = /** @__PURE__ @class */ (function () {
|
|
|
30787
30864
|
function EditorManager(options) {
|
|
30788
30865
|
this.currentDocument = options.document;
|
|
30789
30866
|
this.editableElement = options.editableElement;
|
|
30790
|
-
this.nodeSelection = new NodeSelection();
|
|
30867
|
+
this.nodeSelection = new NodeSelection(this.editableElement);
|
|
30791
30868
|
this.nodeCutter = new NodeCutter();
|
|
30792
30869
|
this.domNode = new DOMNode(this.editableElement, this.currentDocument);
|
|
30793
30870
|
this.observer = new Observer(this);
|
|
@@ -31474,7 +31551,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
31474
31551
|
if (this.parent.isDestroyed) {
|
|
31475
31552
|
return;
|
|
31476
31553
|
}
|
|
31477
|
-
this.nodeSelectionObj = new NodeSelection();
|
|
31554
|
+
this.nodeSelectionObj = new NodeSelection(this.parent.inputElement);
|
|
31478
31555
|
this.parent.on(initialLoad, this.instantiateRenderer, this);
|
|
31479
31556
|
this.parent.on(htmlToolbarClick, this.onToolbarClick, this);
|
|
31480
31557
|
this.parent.on(keyDown, this.onKeyDown, this);
|
|
@@ -32188,7 +32265,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
32188
32265
|
urlText = urlText.slice(0, urlTextRange);
|
|
32189
32266
|
// eslint-disable-next-line
|
|
32190
32267
|
var regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
|
|
32191
|
-
if (selectNodeEle[0].nodeName !== 'A' && urlText.match(regex)) {
|
|
32268
|
+
if (selectNodeEle[0] && selectNodeEle[0].nodeName !== 'A' && urlText.match(regex)) {
|
|
32192
32269
|
var selection = this.nodeSelectionObj.save(range, this.parent.contentModule.getDocument());
|
|
32193
32270
|
var url = urlText.indexOf('http') > -1 ? urlText : 'http://' + urlText;
|
|
32194
32271
|
var selectParent = this.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
|
|
@@ -32549,7 +32626,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
32549
32626
|
this.isDestroyed = false;
|
|
32550
32627
|
}
|
|
32551
32628
|
PasteCleanup.prototype.addEventListener = function () {
|
|
32552
|
-
this.nodeSelectionObj = new NodeSelection();
|
|
32629
|
+
this.nodeSelectionObj = new NodeSelection(this.parent.inputElement);
|
|
32553
32630
|
if (this.parent.isDestroyed) {
|
|
32554
32631
|
return;
|
|
32555
32632
|
}
|
|
@@ -33714,6 +33791,8 @@ var Resize = /** @__PURE__ @class */ (function () {
|
|
|
33714
33791
|
this.parent = parent;
|
|
33715
33792
|
this.addEventListener();
|
|
33716
33793
|
this.isDestroyed = false;
|
|
33794
|
+
this.isResizing = false;
|
|
33795
|
+
this.iframeMouseUpBoundFn = this.iframeMouseUp.bind(this);
|
|
33717
33796
|
}
|
|
33718
33797
|
Resize.prototype.addEventListener = function () {
|
|
33719
33798
|
if (this.parent.isDestroyed) {
|
|
@@ -33733,6 +33812,7 @@ var Resize = /** @__PURE__ @class */ (function () {
|
|
|
33733
33812
|
this.parent.rootContainer.classList.add('e-resize-enabled');
|
|
33734
33813
|
if (this.parent.iframeSettings.enable) {
|
|
33735
33814
|
this.parent.inputElement.classList.add('e-resize-enabled');
|
|
33815
|
+
this.parent.contentModule.getDocument().addEventListener('mouseup', this.iframeMouseUpBoundFn);
|
|
33736
33816
|
}
|
|
33737
33817
|
this.touchStartEvent = (Browser.info.name === 'msie') ? 'pointerdown' : 'touchstart';
|
|
33738
33818
|
EventHandler.add(this.resizer, 'mousedown', this.resizeStart, this);
|
|
@@ -33740,6 +33820,7 @@ var Resize = /** @__PURE__ @class */ (function () {
|
|
|
33740
33820
|
};
|
|
33741
33821
|
Resize.prototype.resizeStart = function (e) {
|
|
33742
33822
|
var _this = this;
|
|
33823
|
+
this.isResizing = false;
|
|
33743
33824
|
if (e.cancelable) {
|
|
33744
33825
|
e.preventDefault();
|
|
33745
33826
|
}
|
|
@@ -33754,6 +33835,7 @@ var Resize = /** @__PURE__ @class */ (function () {
|
|
|
33754
33835
|
};
|
|
33755
33836
|
Resize.prototype.performResize = function (e) {
|
|
33756
33837
|
var _this = this;
|
|
33838
|
+
this.isResizing = true;
|
|
33757
33839
|
var args = { event: e, requestType: 'editor' };
|
|
33758
33840
|
this.parent.trigger(onResize, args, function (resizingArgs) {
|
|
33759
33841
|
if (resizingArgs.cancel) {
|
|
@@ -33783,6 +33865,7 @@ var Resize = /** @__PURE__ @class */ (function () {
|
|
|
33783
33865
|
this.parent.refreshUI();
|
|
33784
33866
|
};
|
|
33785
33867
|
Resize.prototype.stopResize = function (e) {
|
|
33868
|
+
this.isResizing = false;
|
|
33786
33869
|
this.parent.refreshUI();
|
|
33787
33870
|
this.unwireResizeEvents();
|
|
33788
33871
|
var args = { event: e, requestType: 'editor' };
|
|
@@ -33832,6 +33915,7 @@ var Resize = /** @__PURE__ @class */ (function () {
|
|
|
33832
33915
|
}
|
|
33833
33916
|
if (this.parent.iframeSettings.enable && !isNullOrUndefined(this.parent.inputElement)) {
|
|
33834
33917
|
this.parent.inputElement.classList.remove('e-resize-enabled');
|
|
33918
|
+
this.parent.contentModule.getDocument().removeEventListener('mouseup', this.iframeMouseUpBoundFn);
|
|
33835
33919
|
}
|
|
33836
33920
|
if (this.resizer) {
|
|
33837
33921
|
EventHandler.remove(this.resizer, 'mousedown', this.resizeStart);
|
|
@@ -33839,6 +33923,12 @@ var Resize = /** @__PURE__ @class */ (function () {
|
|
|
33839
33923
|
detach(this.resizer);
|
|
33840
33924
|
}
|
|
33841
33925
|
this.parent.off(destroy, this.destroy);
|
|
33926
|
+
this.iframeMouseUpBoundFn = null;
|
|
33927
|
+
};
|
|
33928
|
+
Resize.prototype.iframeMouseUp = function (e) {
|
|
33929
|
+
if (this.isResizing) {
|
|
33930
|
+
this.stopResize(e);
|
|
33931
|
+
}
|
|
33842
33932
|
};
|
|
33843
33933
|
/**
|
|
33844
33934
|
* For internal use only - Get the module name.
|
|
@@ -35354,7 +35444,7 @@ var ImportExport = /** @__PURE__ @class */ (function () {
|
|
|
35354
35444
|
saveUrl: this.parent.importWord.serviceUrl
|
|
35355
35445
|
},
|
|
35356
35446
|
success: function (args) {
|
|
35357
|
-
_this.parent.executeCommand('
|
|
35447
|
+
_this.parent.executeCommand('importWord', args.e.currentTarget.response, { undo: true });
|
|
35358
35448
|
}
|
|
35359
35449
|
});
|
|
35360
35450
|
this.parent.setProperties({ enableXhtml: true }, true);
|
|
@@ -36804,11 +36894,16 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
36804
36894
|
else if (!isNullOrUndefined(currentParent) && currentParent !== _this.parent.inputElement && currentParent.nodeName !== 'BR') {
|
|
36805
36895
|
if (currentParent.textContent.trim().length === 0 || (currentParent.textContent.trim().length === 1 &&
|
|
36806
36896
|
currentParent.textContent.charCodeAt(0) === 8203)) {
|
|
36807
|
-
|
|
36808
|
-
|
|
36809
|
-
|
|
36810
|
-
|
|
36811
|
-
|
|
36897
|
+
if (currentParent.childElementCount > 1 && currentParent.lastElementChild.nodeName === 'IMG') {
|
|
36898
|
+
_this.insertBRElement();
|
|
36899
|
+
}
|
|
36900
|
+
else {
|
|
36901
|
+
var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, true).cloneNode(true);
|
|
36902
|
+
_this.parent.formatter.editorManager.domNode.insertAfter(newElem, currentParent);
|
|
36903
|
+
var outerBRElem = _this.parent.createElement('br');
|
|
36904
|
+
newElem.parentElement.insertBefore(outerBRElem, newElem);
|
|
36905
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElem, 0);
|
|
36906
|
+
}
|
|
36812
36907
|
}
|
|
36813
36908
|
else {
|
|
36814
36909
|
var newElem = void 0;
|
|
@@ -37380,6 +37475,17 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
37380
37475
|
* @public
|
|
37381
37476
|
*/
|
|
37382
37477
|
RichTextEditor.prototype.executeCommand = function (commandName, value, option) {
|
|
37478
|
+
if (commandName === 'importWord') {
|
|
37479
|
+
var importContainer = this.createElement('div');
|
|
37480
|
+
importContainer.innerHTML = value;
|
|
37481
|
+
var tableElement = importContainer.querySelectorAll('table:not(.e-rte-table):not(.e-rte-paste-table)');
|
|
37482
|
+
for (var i = 0; i < tableElement.length; i++) {
|
|
37483
|
+
tableElement[i].classList.add('e-rte-paste-table');
|
|
37484
|
+
}
|
|
37485
|
+
value = importContainer.innerHTML;
|
|
37486
|
+
importContainer.remove();
|
|
37487
|
+
commandName = 'insertHTML';
|
|
37488
|
+
}
|
|
37383
37489
|
value = this.htmlPurifier(commandName, value);
|
|
37384
37490
|
var internalValue;
|
|
37385
37491
|
if (this.editorMode === 'HTML') {
|