@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
|
@@ -12946,52 +12946,62 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
12946
12946
|
}
|
|
12947
12947
|
}
|
|
12948
12948
|
else {
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
}
|
|
12957
|
-
|
|
12958
|
-
|
|
12959
|
-
|
|
12960
|
-
|
|
12949
|
+
var parentElem = range.startContainer;
|
|
12950
|
+
while (!isNullOrUndefined(parentElem) && parentElem.nodeName !== 'PRE' && parentElem !== editNode) {
|
|
12951
|
+
parentElem = parentElem.parentElement;
|
|
12952
|
+
}
|
|
12953
|
+
if (!isNullOrUndefined(node) && !isNullOrUndefined(parentElem) && parentElem.nodeName === 'PRE') {
|
|
12954
|
+
range.insertNode(node);
|
|
12955
|
+
lastSelectionNode = node.lastChild;
|
|
12956
|
+
}
|
|
12957
|
+
else {
|
|
12958
|
+
this.insertTempNode(range, node, nodes, nodeCutter, editNode);
|
|
12959
|
+
var isFirstTextNode = true;
|
|
12960
|
+
var isPreviousInlineElem = void 0;
|
|
12961
|
+
var paraElm = void 0;
|
|
12962
|
+
var previousParent = void 0;
|
|
12963
|
+
if (!this.contentsDeleted) {
|
|
12964
|
+
range.deleteContents();
|
|
12961
12965
|
}
|
|
12962
|
-
|
|
12963
|
-
(
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
var firstParaElm = createElement('p');
|
|
12967
|
-
node.parentElement.insertBefore(firstParaElm, node);
|
|
12966
|
+
while (node.firstChild) {
|
|
12967
|
+
if (node.firstChild.nodeName === '#text' && node.firstChild.textContent.trim() === '') {
|
|
12968
|
+
detach(node.firstChild);
|
|
12969
|
+
continue;
|
|
12968
12970
|
}
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
if (!isPreviousInlineElem) {
|
|
12976
|
-
paraElm = createElement('p');
|
|
12977
|
-
paraElm.appendChild(node.firstChild);
|
|
12978
|
-
fragment.appendChild(paraElm);
|
|
12979
|
-
}
|
|
12980
|
-
else {
|
|
12981
|
-
previousParent.appendChild(node.firstChild);
|
|
12982
|
-
fragment.appendChild(previousParent);
|
|
12971
|
+
if (node.firstChild.nodeName === '#text' && isFirstTextNode ||
|
|
12972
|
+
(this.inlineNode.indexOf(node.firstChild.nodeName.toLocaleLowerCase()) >= 0 && isFirstTextNode)) {
|
|
12973
|
+
lastSelectionNode = node.firstChild;
|
|
12974
|
+
if (isNullOrUndefined(node.previousElementSibling)) {
|
|
12975
|
+
var firstParaElm = createElement('p');
|
|
12976
|
+
node.parentElement.insertBefore(firstParaElm, node);
|
|
12983
12977
|
}
|
|
12984
|
-
|
|
12985
|
-
isPreviousInlineElem = true;
|
|
12978
|
+
node.previousElementSibling.appendChild(node.firstChild);
|
|
12986
12979
|
}
|
|
12987
12980
|
else {
|
|
12988
|
-
|
|
12989
|
-
|
|
12981
|
+
lastSelectionNode = node.firstChild;
|
|
12982
|
+
if (node.firstChild.nodeName === '#text' ||
|
|
12983
|
+
(this.inlineNode.indexOf(node.firstChild.nodeName.toLocaleLowerCase()) >= 0)) {
|
|
12984
|
+
if (!isPreviousInlineElem) {
|
|
12985
|
+
paraElm = createElement('p');
|
|
12986
|
+
paraElm.appendChild(node.firstChild);
|
|
12987
|
+
fragment.appendChild(paraElm);
|
|
12988
|
+
}
|
|
12989
|
+
else {
|
|
12990
|
+
previousParent.appendChild(node.firstChild);
|
|
12991
|
+
fragment.appendChild(previousParent);
|
|
12992
|
+
}
|
|
12993
|
+
previousParent = paraElm;
|
|
12994
|
+
isPreviousInlineElem = true;
|
|
12995
|
+
}
|
|
12996
|
+
else {
|
|
12997
|
+
fragment.appendChild(node.firstChild);
|
|
12998
|
+
isPreviousInlineElem = false;
|
|
12999
|
+
}
|
|
13000
|
+
isFirstTextNode = false;
|
|
12990
13001
|
}
|
|
12991
|
-
isFirstTextNode = false;
|
|
12992
13002
|
}
|
|
13003
|
+
node.parentNode.replaceChild(fragment, node);
|
|
12993
13004
|
}
|
|
12994
|
-
node.parentNode.replaceChild(fragment, node);
|
|
12995
13005
|
}
|
|
12996
13006
|
if (lastSelectionNode.nodeName === '#text') {
|
|
12997
13007
|
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
@@ -17756,10 +17766,11 @@ var ToolbarStatus = /** @__PURE__ @class */ (function () {
|
|
|
17756
17766
|
var formatCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
17757
17767
|
var nodeCollection = JSON.parse(JSON.stringify(statusCollection));
|
|
17758
17768
|
var nodeSelection = new NodeSelection();
|
|
17759
|
-
var
|
|
17769
|
+
var range = nodeSelection.getRange(docElement);
|
|
17770
|
+
var nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
|
|
17771
|
+
nodeSelection.getSelectionNodeCollectionBr(range);
|
|
17760
17772
|
var nodesLength = nodes.length;
|
|
17761
17773
|
var isNodeChanged = false;
|
|
17762
|
-
var range = nodeSelection.getRange(docElement);
|
|
17763
17774
|
for (var index = 0; index < nodes.length; index++) {
|
|
17764
17775
|
while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
|
|
17765
17776
|
nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
|
|
@@ -18572,10 +18583,12 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
18572
18583
|
// eslint-disable-next-line
|
|
18573
18584
|
var regEx = new RegExp(String.fromCharCode(8203), 'g');
|
|
18574
18585
|
var pointer;
|
|
18586
|
+
var isRootParent = false;
|
|
18575
18587
|
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
|
|
18576
18588
|
pointer = range.startOffset;
|
|
18577
18589
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
18578
|
-
range.startContainer.nodeName === '#text' ? range.startContainer.parentElement.
|
|
18590
|
+
range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
|
|
18591
|
+
: isRootParent = true : range.startContainer.classList.add('currentStartMark');
|
|
18579
18592
|
if (range.startContainer.textContent.charCodeAt(0) === 8203) {
|
|
18580
18593
|
pointer = range.startOffset === 0 ? range.startOffset : range.startOffset - 1;
|
|
18581
18594
|
range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
|
|
@@ -18584,7 +18597,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
18584
18597
|
var previousLength = this.parent.inputElement.innerHTML.length;
|
|
18585
18598
|
var currentLength = this.parent.inputElement.innerHTML.replace(regEx, '').length;
|
|
18586
18599
|
var focusNode = range.startContainer;
|
|
18587
|
-
if (previousLength > currentLength) {
|
|
18600
|
+
if (previousLength > currentLength && !isRootParent) {
|
|
18588
18601
|
var currentChild = this.parent.inputElement.firstChild;
|
|
18589
18602
|
while (!isNullOrUndefined(currentChild) && currentChild.textContent.replace(regEx, '').trim().length > 0) {
|
|
18590
18603
|
currentChild.innerHTML = currentChild.innerHTML.replace(regEx, '');
|
|
@@ -21878,6 +21891,10 @@ var Image = /** @__PURE__ @class */ (function () {
|
|
|
21878
21891
|
});
|
|
21879
21892
|
};
|
|
21880
21893
|
Image.prototype.resizing = function (e) {
|
|
21894
|
+
if (!this.parent) {
|
|
21895
|
+
this.cancelResizeAction();
|
|
21896
|
+
return;
|
|
21897
|
+
}
|
|
21881
21898
|
if (this.imgEle.offsetWidth >= this.parent.getInsertImgMaxWidth()) {
|
|
21882
21899
|
this.imgEle.style.maxHeight = this.imgEle.offsetHeight + 'px';
|
|
21883
21900
|
}
|
|
@@ -26760,9 +26777,10 @@ var Table = /** @__PURE__ @class */ (function () {
|
|
|
26760
26777
|
var range_1 = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
|
|
26761
26778
|
this.parent.formatter.editorManager.nodeSelection.save(range_1, this.contentModule.getDocument());
|
|
26762
26779
|
this.parent.formatter.editorManager.nodeSelection.Clear(this.contentModule.getDocument());
|
|
26780
|
+
var pageX = (this.parent.iframeSettings.enable) ? window.pageXOffset + this.parent.element.getBoundingClientRect().left + args.clientX : args.pageX;
|
|
26763
26781
|
var pageY = (this.parent.iframeSettings.enable) ? window.pageYOffset +
|
|
26764
26782
|
this.parent.element.getBoundingClientRect().top + args.clientY : args.pageY;
|
|
26765
|
-
this.quickToolObj.tableQTBar.showPopup(
|
|
26783
|
+
this.quickToolObj.tableQTBar.showPopup(pageX, pageY, target);
|
|
26766
26784
|
this.parent.formatter.editorManager.nodeSelection.restore();
|
|
26767
26785
|
}
|
|
26768
26786
|
else {
|