@syncfusion/ej2-richtexteditor 26.2.8 → 26.2.10
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 +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 +50 -32
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +50 -32
- 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/lists.d.ts +1 -1
- package/src/editor-manager/plugin/selection-commands.js +6 -0
- package/src/rich-text-editor/actions/html-editor.js +11 -2
- package/src/rich-text-editor/actions/paste-clean-up.js +25 -26
- package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -0
- package/src/rich-text-editor/base/rich-text-editor.js +8 -4
|
@@ -26793,6 +26793,12 @@ class SelectionCommands {
|
|
|
26793
26793
|
if (cursorNodes.length === 1 && range.startOffset === 0 && (cursorNodes[0].nodeName === 'BR' || (isNullOrUndefined(cursorNodes[0].nextSibling) ? false : cursorNodes[0].nextSibling.nodeName === 'BR'))) {
|
|
26794
26794
|
detach(cursorNodes[0].nodeName === '#text' ? cursorNodes[0].nextSibling : cursorNodes[0]);
|
|
26795
26795
|
}
|
|
26796
|
+
if (!isNullOrUndefined(cursorNodes[0].parentElement) && IsFormatted.inlineTags.
|
|
26797
|
+
indexOf((cursorNodes[0].parentElement).tagName.toLowerCase()) !== -1 && cursorNodes[0].textContent.includes('\u200B')) {
|
|
26798
|
+
const element = this.GetFormatNode(format, value);
|
|
26799
|
+
this.applyStyles(cursorNodes, 0, element);
|
|
26800
|
+
return cursorNodes[0];
|
|
26801
|
+
}
|
|
26796
26802
|
cursorNode = this.getInsertNode(docElement, range, format, value).firstChild;
|
|
26797
26803
|
}
|
|
26798
26804
|
return cursorNode;
|
|
@@ -30825,7 +30831,7 @@ class HtmlEditor {
|
|
|
30825
30831
|
}
|
|
30826
30832
|
onKeyUp(e) {
|
|
30827
30833
|
const args = e.args;
|
|
30828
|
-
const restrictKeys = [8, 9, 13,
|
|
30834
|
+
const restrictKeys = [8, 9, 13, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
|
|
30829
30835
|
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
|
|
30830
30836
|
const range = this.parent.getRange();
|
|
30831
30837
|
const regEx = new RegExp('\u200B', 'g');
|
|
@@ -30833,9 +30839,18 @@ class HtmlEditor {
|
|
|
30833
30839
|
range.startOffset === 1 && range.startContainer.textContent.length === 1 &&
|
|
30834
30840
|
range.startContainer.textContent.charCodeAt(0) === 8203 &&
|
|
30835
30841
|
range.startContainer.textContent.replace(regEx, '').length === 0;
|
|
30842
|
+
let isMention = false;
|
|
30843
|
+
if (range.startContainer === range.endContainer &&
|
|
30844
|
+
range.startOffset === range.endOffset && (range.startContainer !== this.parent.inputElement && range.startOffset !== 0)) {
|
|
30845
|
+
const mentionStartNode = range.startContainer.nodeType === 3 ?
|
|
30846
|
+
range.startContainer : range.startContainer.childNodes[range.startOffset - 1];
|
|
30847
|
+
isMention = args.keyCode === 16 &&
|
|
30848
|
+
mentionStartNode.textContent.charCodeAt(0) === 8203 &&
|
|
30849
|
+
!isNullOrUndefined(mentionStartNode.previousSibling) && mentionStartNode.previousSibling.contentEditable === 'false';
|
|
30850
|
+
}
|
|
30836
30851
|
let pointer;
|
|
30837
30852
|
let isRootParent = false;
|
|
30838
|
-
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
|
|
30853
|
+
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode && !isMention) {
|
|
30839
30854
|
pointer = range.startOffset;
|
|
30840
30855
|
const container = range.startContainer;
|
|
30841
30856
|
// Check if the container is a text node and contains a zero-width space
|
|
@@ -32015,9 +32030,7 @@ class PasteCleanup {
|
|
|
32015
32030
|
dropArea: this.parent.inputElement,
|
|
32016
32031
|
allowedExtensions: this.parent.insertImageSettings.allowedTypes.toString(),
|
|
32017
32032
|
success: (e) => {
|
|
32018
|
-
this.
|
|
32019
|
-
this.popupClose(this.popupObj, this.uploadObj, imgElem, e);
|
|
32020
|
-
}, 900);
|
|
32033
|
+
this.popupClose(this.popupObj, this.uploadObj, imgElem, e);
|
|
32021
32034
|
},
|
|
32022
32035
|
uploading: (e) => {
|
|
32023
32036
|
if (!this.parent.isServerRendered) {
|
|
@@ -32098,30 +32111,31 @@ class PasteCleanup {
|
|
|
32098
32111
|
this.parent.inputElement.contentEditable = 'true';
|
|
32099
32112
|
e.element = imgElem;
|
|
32100
32113
|
e.detectImageSource = ImageInputSource.Pasted;
|
|
32101
|
-
|
|
32102
|
-
|
|
32103
|
-
|
|
32104
|
-
|
|
32105
|
-
|
|
32106
|
-
|
|
32107
|
-
|
|
32108
|
-
|
|
32109
|
-
|
|
32110
|
-
}
|
|
32111
|
-
else if (element.statusCode === '5') {
|
|
32112
|
-
this.parent.trigger(imageRemoving, e, (e) => {
|
|
32113
|
-
if (!isNullOrUndefined(e.element.src)) {
|
|
32114
|
-
e.element.src = '';
|
|
32115
|
-
}
|
|
32116
|
-
});
|
|
32117
|
-
}
|
|
32118
|
-
});
|
|
32119
|
-
popupObj.close();
|
|
32120
|
-
imgElem.style.opacity = '1';
|
|
32121
|
-
if (uploadObj && document.body.contains(uploadObj.element)) {
|
|
32122
|
-
uploadObj.destroy();
|
|
32114
|
+
const element = e.file;
|
|
32115
|
+
if (element.statusCode === '2') {
|
|
32116
|
+
this.parent.trigger(imageUploadSuccess, e, (e) => {
|
|
32117
|
+
if (!isNullOrUndefined(this.parent.insertImageSettings.path)) {
|
|
32118
|
+
const url = this.parent.insertImageSettings.path + e.file.name;
|
|
32119
|
+
imgElem.src = url;
|
|
32120
|
+
imgElem.setAttribute('alt', e.file.name);
|
|
32121
|
+
}
|
|
32122
|
+
});
|
|
32123
32123
|
}
|
|
32124
|
-
|
|
32124
|
+
else if (element.statusCode === '5') {
|
|
32125
|
+
this.parent.trigger(imageRemoving, e, (e) => {
|
|
32126
|
+
if (!isNullOrUndefined(e.element.src)) {
|
|
32127
|
+
e.element.src = '';
|
|
32128
|
+
}
|
|
32129
|
+
});
|
|
32130
|
+
}
|
|
32131
|
+
this.popupCloseTime = setTimeout(function () {
|
|
32132
|
+
popupObj.close();
|
|
32133
|
+
imgElem.style.opacity = '1';
|
|
32134
|
+
this.toolbarEnableDisable(false);
|
|
32135
|
+
if (uploadObj && document.body.contains(uploadObj.element)) {
|
|
32136
|
+
uploadObj.destroy();
|
|
32137
|
+
}
|
|
32138
|
+
}.bind(this), 1500);
|
|
32125
32139
|
}
|
|
32126
32140
|
refreshPopup(imageElement, popupObj) {
|
|
32127
32141
|
const imgPosition = this.parent.iframeSettings.enable ? this.parent.element.offsetTop +
|
|
@@ -36651,7 +36665,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
36651
36665
|
this.inputElement.innerHTML = this.enterKey !== 'BR' ? '<' + this.enterKey + '><br></' + this.enterKey + '>' : '<br>';
|
|
36652
36666
|
this.isSelectAll = false;
|
|
36653
36667
|
}
|
|
36654
|
-
if (selection.rangeCount > 0 && this.contentModule.getDocument().activeElement.tagName !== 'INPUT' && this.inputElement.contains(this.contentModule.getDocument().activeElement)) {
|
|
36668
|
+
if (selection.rangeCount > 0 && this.contentModule.getDocument().activeElement.tagName !== 'INPUT' && this.inputElement.contains(this.contentModule.getDocument().activeElement) && range.startContainer.innerHTML === '<br>' && range.startContainer.textContent === '') {
|
|
36655
36669
|
selection.removeAllRanges();
|
|
36656
36670
|
selection.addRange(currentRange);
|
|
36657
36671
|
}
|
|
@@ -36913,6 +36927,10 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
36913
36927
|
clearInterval(this.timeInterval);
|
|
36914
36928
|
this.timeInterval = null;
|
|
36915
36929
|
}
|
|
36930
|
+
if (!isNullOrUndefined(this.autoSaveTimeOut)) {
|
|
36931
|
+
clearTimeout(this.autoSaveTimeOut);
|
|
36932
|
+
this.autoSaveTimeOut = null;
|
|
36933
|
+
}
|
|
36916
36934
|
if (!isNullOrUndefined(this.idleInterval)) {
|
|
36917
36935
|
clearTimeout(this.idleInterval);
|
|
36918
36936
|
this.idleInterval = null;
|
|
@@ -37944,7 +37962,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
37944
37962
|
}
|
|
37945
37963
|
this.preventDefaultResize(e);
|
|
37946
37964
|
this.trigger('focus', { event: e, isInteracted: Object.keys(e).length === 0 ? false : true });
|
|
37947
|
-
if (!isNullOrUndefined(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle) {
|
|
37965
|
+
if (!isNullOrUndefined(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle && isNullOrUndefined(this.timeInterval)) {
|
|
37948
37966
|
this.timeInterval = setInterval(this.updateValueOnIdle.bind(this), this.saveInterval);
|
|
37949
37967
|
}
|
|
37950
37968
|
EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
|
|
@@ -38113,8 +38131,8 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
38113
38131
|
contentChanged() {
|
|
38114
38132
|
if (this.autoSaveOnIdle) {
|
|
38115
38133
|
if (!isNullOrUndefined(this.saveInterval)) {
|
|
38116
|
-
clearTimeout(this.
|
|
38117
|
-
this.
|
|
38134
|
+
clearTimeout(this.autoSaveTimeOut);
|
|
38135
|
+
this.autoSaveTimeOut = setTimeout(this.updateIntervalValue.bind(this), this.saveInterval);
|
|
38118
38136
|
}
|
|
38119
38137
|
}
|
|
38120
38138
|
}
|