@syncfusion/ej2-richtexteditor 20.4.40 → 20.4.43
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 +16 -0
- package/README.md +1 -1
- 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 +61 -43
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +61 -43
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/dist/global/ej2-richtexteditor.min.js +2 -2
- package/dist/global/ej2-richtexteditor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +12 -12
- package/src/editor-manager/plugin/inserthtml.js +48 -38
- package/src/editor-manager/plugin/toolbar-status.js +3 -2
- package/src/rich-text-editor/actions/html-editor.js +4 -2
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +2 -2
- package/src/rich-text-editor/base/rich-text-editor.d.ts +2 -2
- package/src/rich-text-editor/renderer/image-module.js +4 -0
- package/src/rich-text-editor/renderer/table-module.js +2 -1
|
@@ -12848,52 +12848,62 @@ class InsertHtml {
|
|
|
12848
12848
|
}
|
|
12849
12849
|
}
|
|
12850
12850
|
else {
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
}
|
|
12859
|
-
|
|
12860
|
-
|
|
12861
|
-
|
|
12862
|
-
|
|
12851
|
+
let parentElem = range.startContainer;
|
|
12852
|
+
while (!isNullOrUndefined(parentElem) && parentElem.nodeName !== 'PRE' && parentElem !== editNode) {
|
|
12853
|
+
parentElem = parentElem.parentElement;
|
|
12854
|
+
}
|
|
12855
|
+
if (!isNullOrUndefined(node) && !isNullOrUndefined(parentElem) && parentElem.nodeName === 'PRE') {
|
|
12856
|
+
range.insertNode(node);
|
|
12857
|
+
lastSelectionNode = node.lastChild;
|
|
12858
|
+
}
|
|
12859
|
+
else {
|
|
12860
|
+
this.insertTempNode(range, node, nodes, nodeCutter, editNode);
|
|
12861
|
+
let isFirstTextNode = true;
|
|
12862
|
+
let isPreviousInlineElem;
|
|
12863
|
+
let paraElm;
|
|
12864
|
+
let previousParent;
|
|
12865
|
+
if (!this.contentsDeleted) {
|
|
12866
|
+
range.deleteContents();
|
|
12863
12867
|
}
|
|
12864
|
-
|
|
12865
|
-
(
|
|
12866
|
-
|
|
12867
|
-
|
|
12868
|
-
const firstParaElm = createElement('p');
|
|
12869
|
-
node.parentElement.insertBefore(firstParaElm, node);
|
|
12868
|
+
while (node.firstChild) {
|
|
12869
|
+
if (node.firstChild.nodeName === '#text' && node.firstChild.textContent.trim() === '') {
|
|
12870
|
+
detach(node.firstChild);
|
|
12871
|
+
continue;
|
|
12870
12872
|
}
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
if (!isPreviousInlineElem) {
|
|
12878
|
-
paraElm = createElement('p');
|
|
12879
|
-
paraElm.appendChild(node.firstChild);
|
|
12880
|
-
fragment.appendChild(paraElm);
|
|
12881
|
-
}
|
|
12882
|
-
else {
|
|
12883
|
-
previousParent.appendChild(node.firstChild);
|
|
12884
|
-
fragment.appendChild(previousParent);
|
|
12873
|
+
if (node.firstChild.nodeName === '#text' && isFirstTextNode ||
|
|
12874
|
+
(this.inlineNode.indexOf(node.firstChild.nodeName.toLocaleLowerCase()) >= 0 && isFirstTextNode)) {
|
|
12875
|
+
lastSelectionNode = node.firstChild;
|
|
12876
|
+
if (isNullOrUndefined(node.previousElementSibling)) {
|
|
12877
|
+
const firstParaElm = createElement('p');
|
|
12878
|
+
node.parentElement.insertBefore(firstParaElm, node);
|
|
12885
12879
|
}
|
|
12886
|
-
|
|
12887
|
-
isPreviousInlineElem = true;
|
|
12880
|
+
node.previousElementSibling.appendChild(node.firstChild);
|
|
12888
12881
|
}
|
|
12889
12882
|
else {
|
|
12890
|
-
|
|
12891
|
-
|
|
12883
|
+
lastSelectionNode = node.firstChild;
|
|
12884
|
+
if (node.firstChild.nodeName === '#text' ||
|
|
12885
|
+
(this.inlineNode.indexOf(node.firstChild.nodeName.toLocaleLowerCase()) >= 0)) {
|
|
12886
|
+
if (!isPreviousInlineElem) {
|
|
12887
|
+
paraElm = createElement('p');
|
|
12888
|
+
paraElm.appendChild(node.firstChild);
|
|
12889
|
+
fragment.appendChild(paraElm);
|
|
12890
|
+
}
|
|
12891
|
+
else {
|
|
12892
|
+
previousParent.appendChild(node.firstChild);
|
|
12893
|
+
fragment.appendChild(previousParent);
|
|
12894
|
+
}
|
|
12895
|
+
previousParent = paraElm;
|
|
12896
|
+
isPreviousInlineElem = true;
|
|
12897
|
+
}
|
|
12898
|
+
else {
|
|
12899
|
+
fragment.appendChild(node.firstChild);
|
|
12900
|
+
isPreviousInlineElem = false;
|
|
12901
|
+
}
|
|
12902
|
+
isFirstTextNode = false;
|
|
12892
12903
|
}
|
|
12893
|
-
isFirstTextNode = false;
|
|
12894
12904
|
}
|
|
12905
|
+
node.parentNode.replaceChild(fragment, node);
|
|
12895
12906
|
}
|
|
12896
|
-
node.parentNode.replaceChild(fragment, node);
|
|
12897
12907
|
}
|
|
12898
12908
|
if (lastSelectionNode.nodeName === '#text') {
|
|
12899
12909
|
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
@@ -17609,10 +17619,11 @@ class ToolbarStatus {
|
|
|
17609
17619
|
let formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
17610
17620
|
const nodeCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
17611
17621
|
const nodeSelection = new NodeSelection();
|
|
17612
|
-
const
|
|
17622
|
+
const range = nodeSelection.getRange(docElement);
|
|
17623
|
+
const nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
|
|
17624
|
+
nodeSelection.getSelectionNodeCollectionBr(range);
|
|
17613
17625
|
const nodesLength = nodes.length;
|
|
17614
17626
|
let isNodeChanged = false;
|
|
17615
|
-
const range = nodeSelection.getRange(docElement);
|
|
17616
17627
|
for (let index = 0; index < nodes.length; index++) {
|
|
17617
17628
|
while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
|
|
17618
17629
|
nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
|
|
@@ -18499,10 +18510,12 @@ class HtmlEditor {
|
|
|
18499
18510
|
// eslint-disable-next-line
|
|
18500
18511
|
const regEx = new RegExp(String.fromCharCode(8203), 'g');
|
|
18501
18512
|
let pointer;
|
|
18513
|
+
let isRootParent = false;
|
|
18502
18514
|
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
|
|
18503
18515
|
pointer = range.startOffset;
|
|
18504
18516
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
18505
|
-
range.startContainer.nodeName === '#text' ? range.startContainer.parentElement.
|
|
18517
|
+
range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
|
|
18518
|
+
: isRootParent = true : range.startContainer.classList.add('currentStartMark');
|
|
18506
18519
|
if (range.startContainer.textContent.charCodeAt(0) === 8203) {
|
|
18507
18520
|
pointer = range.startOffset === 0 ? range.startOffset : range.startOffset - 1;
|
|
18508
18521
|
range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
|
|
@@ -18511,7 +18524,7 @@ class HtmlEditor {
|
|
|
18511
18524
|
const previousLength = this.parent.inputElement.innerHTML.length;
|
|
18512
18525
|
const currentLength = this.parent.inputElement.innerHTML.replace(regEx, '').length;
|
|
18513
18526
|
let focusNode = range.startContainer;
|
|
18514
|
-
if (previousLength > currentLength) {
|
|
18527
|
+
if (previousLength > currentLength && !isRootParent) {
|
|
18515
18528
|
let currentChild = this.parent.inputElement.firstChild;
|
|
18516
18529
|
while (!isNullOrUndefined(currentChild) && currentChild.textContent.replace(regEx, '').trim().length > 0) {
|
|
18517
18530
|
currentChild.innerHTML = currentChild.innerHTML.replace(regEx, '');
|
|
@@ -21783,6 +21796,10 @@ class Image {
|
|
|
21783
21796
|
});
|
|
21784
21797
|
}
|
|
21785
21798
|
resizing(e) {
|
|
21799
|
+
if (!this.parent) {
|
|
21800
|
+
this.cancelResizeAction();
|
|
21801
|
+
return;
|
|
21802
|
+
}
|
|
21786
21803
|
if (this.imgEle.offsetWidth >= this.parent.getInsertImgMaxWidth()) {
|
|
21787
21804
|
this.imgEle.style.maxHeight = this.imgEle.offsetHeight + 'px';
|
|
21788
21805
|
}
|
|
@@ -26634,9 +26651,10 @@ class Table {
|
|
|
26634
26651
|
const range = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
|
|
26635
26652
|
this.parent.formatter.editorManager.nodeSelection.save(range, this.contentModule.getDocument());
|
|
26636
26653
|
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
26654
|
+
const pageX = (this.parent.iframeSettings.enable) ? window.pageXOffset + this.parent.element.getBoundingClientRect().left + args.clientX : args.pageX;
|
|
26637
26655
|
const pageY = (this.parent.iframeSettings.enable) ? window.pageYOffset +
|
|
26638
26656
|
this.parent.element.getBoundingClientRect().top + args.clientY : args.pageY;
|
|
26639
|
-
this.quickToolObj.tableQTBar.showPopup(
|
|
26657
|
+
this.quickToolObj.tableQTBar.showPopup(pageX, pageY, target);
|
|
26640
26658
|
this.parent.formatter.editorManager.nodeSelection.restore();
|
|
26641
26659
|
}
|
|
26642
26660
|
else {
|