@syncfusion/ej2-richtexteditor 19.4.53 → 19.4.54
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 +20 -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 +55 -3
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +55 -3
- 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 +5 -5
- package/src/editor-manager/plugin/inserthtml.js +1 -1
- package/src/rich-text-editor/actions/enter-key.d.ts +1 -0
- package/src/rich-text-editor/actions/enter-key.js +10 -1
- package/src/rich-text-editor/actions/html-editor.d.ts +1 -0
- package/src/rich-text-editor/actions/html-editor.js +13 -2
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +8 -0
- package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -0
- package/src/rich-text-editor/base/rich-text-editor.js +24 -0
|
@@ -12196,7 +12196,7 @@ class InsertHtml {
|
|
|
12196
12196
|
let currentNode = nodes[nodes.length - 1];
|
|
12197
12197
|
let splitedElm;
|
|
12198
12198
|
if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNullOrUndefined(currentNode.parentElement) &&
|
|
12199
|
-
currentNode.parentElement.textContent.trim().length === 0 && !node.classList.contains('pasteContent')) {
|
|
12199
|
+
currentNode.parentElement.textContent.trim().length === 0 && (currentNode.parentElement === editNode || !node.classList.contains('pasteContent'))) {
|
|
12200
12200
|
splitedElm = currentNode;
|
|
12201
12201
|
}
|
|
12202
12202
|
else {
|
|
@@ -17138,6 +17138,7 @@ class XhtmlValidation {
|
|
|
17138
17138
|
class HtmlEditor {
|
|
17139
17139
|
constructor(parent, serviceLocator) {
|
|
17140
17140
|
this.rangeCollection = [];
|
|
17141
|
+
this.isImageDelete = false;
|
|
17141
17142
|
this.parent = parent;
|
|
17142
17143
|
this.locator = serviceLocator;
|
|
17143
17144
|
this.renderFactory = this.locator.getService('rendererFactory');
|
|
@@ -17310,7 +17311,9 @@ class HtmlEditor {
|
|
|
17310
17311
|
this.oldRangeElement = null;
|
|
17311
17312
|
this.deleteRangeElement = null;
|
|
17312
17313
|
this.deleteOldRangeElement = null;
|
|
17313
|
-
|
|
17314
|
+
if (!this.isImageDelete) {
|
|
17315
|
+
args.preventDefault();
|
|
17316
|
+
}
|
|
17314
17317
|
}
|
|
17315
17318
|
}
|
|
17316
17319
|
isOrderedList(editorValue) {
|
|
@@ -17434,7 +17437,15 @@ class HtmlEditor {
|
|
|
17434
17437
|
return;
|
|
17435
17438
|
}
|
|
17436
17439
|
else {
|
|
17437
|
-
|
|
17440
|
+
if (currentRange.startOffset === 0 && currentRange.endOffset === 1 &&
|
|
17441
|
+
this.deleteRangeElement.childNodes[0].nodeName === 'IMG') {
|
|
17442
|
+
this.parent.formatter.editorManager.nodeSelection.setSelectionText(this.parent.contentModule.getDocument(), this.deleteRangeElement, this.deleteRangeElement, 0, 1);
|
|
17443
|
+
this.isImageDelete = true;
|
|
17444
|
+
}
|
|
17445
|
+
else {
|
|
17446
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.deleteRangeElement, this.deleteRangeElement.childNodes.length);
|
|
17447
|
+
this.isImageDelete = false;
|
|
17448
|
+
}
|
|
17438
17449
|
if (this.deleteRangeElement.querySelector('BR')) {
|
|
17439
17450
|
detach(this.deleteRangeElement.querySelector('BR'));
|
|
17440
17451
|
}
|
|
@@ -18014,6 +18025,11 @@ class PasteCleanup {
|
|
|
18014
18025
|
}
|
|
18015
18026
|
}
|
|
18016
18027
|
}
|
|
18028
|
+
toolbarEnableDisable(state) {
|
|
18029
|
+
if (!this.parent.inlineMode.enable) {
|
|
18030
|
+
this.parent.toolbarModule.baseToolbar.toolbarObj.disable(state);
|
|
18031
|
+
}
|
|
18032
|
+
}
|
|
18017
18033
|
uploadMethod(fileList, imgElem) {
|
|
18018
18034
|
const uploadEle = document.createElement('div');
|
|
18019
18035
|
document.body.appendChild(uploadEle);
|
|
@@ -18089,6 +18105,7 @@ class PasteCleanup {
|
|
|
18089
18105
|
if (beforeUploadArgs.cancel) {
|
|
18090
18106
|
return;
|
|
18091
18107
|
}
|
|
18108
|
+
this.toolbarEnableDisable(true);
|
|
18092
18109
|
/* eslint-disable */
|
|
18093
18110
|
uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
|
|
18094
18111
|
beforeUploadArgs.currentRequest : uploadObj.currentRequestHeader;
|
|
@@ -18100,6 +18117,7 @@ class PasteCleanup {
|
|
|
18100
18117
|
}
|
|
18101
18118
|
else {
|
|
18102
18119
|
this.parent.trigger(beforeImageUpload, args);
|
|
18120
|
+
this.toolbarEnableDisable(true);
|
|
18103
18121
|
}
|
|
18104
18122
|
},
|
|
18105
18123
|
// eslint-disable-next-line
|
|
@@ -18171,6 +18189,7 @@ class PasteCleanup {
|
|
|
18171
18189
|
popupObj.close();
|
|
18172
18190
|
imgElem.style.opacity = '1';
|
|
18173
18191
|
uploadObj.destroy();
|
|
18192
|
+
this.toolbarEnableDisable(false);
|
|
18174
18193
|
}
|
|
18175
18194
|
refreshPopup(imageElement, popupObj) {
|
|
18176
18195
|
const imgPosition = this.parent.iframeSettings.enable ? this.parent.element.offsetTop +
|
|
@@ -24237,6 +24256,7 @@ class EnterKeyAction {
|
|
|
24237
24256
|
else if (this.range.startOffset === 0 && this.range.endOffset === 0) {
|
|
24238
24257
|
isFocusedFirst = true;
|
|
24239
24258
|
}
|
|
24259
|
+
this.removeBRElement(nearBlockNode);
|
|
24240
24260
|
if (((this.range.startOffset === 0 && this.range.endOffset === 0) || isFocusedFirst) &&
|
|
24241
24261
|
!(!isNullOrUndefined(this.range.startContainer.previousSibling) &&
|
|
24242
24262
|
(this.range.startContainer.previousSibling.nodeName === 'IMG' || this.range.startContainer.previousSibling.nodeName === 'BR'))) {
|
|
@@ -24340,6 +24360,7 @@ class EnterKeyAction {
|
|
|
24340
24360
|
else {
|
|
24341
24361
|
currentParent = this.startNode;
|
|
24342
24362
|
}
|
|
24363
|
+
this.removeBRElement(currentParent);
|
|
24343
24364
|
let currentParentLastChild = currentParent.lastChild;
|
|
24344
24365
|
while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text' || currentParentLastChild.nodeName === 'BR')) {
|
|
24345
24366
|
currentParentLastChild = currentParentLastChild.lastChild;
|
|
@@ -24401,6 +24422,13 @@ class EnterKeyAction {
|
|
|
24401
24422
|
}
|
|
24402
24423
|
}
|
|
24403
24424
|
}
|
|
24425
|
+
removeBRElement(currentElement) {
|
|
24426
|
+
if (Browser.userAgent.indexOf('Firefox') != -1 &&
|
|
24427
|
+
this.range.endOffset === currentElement.textContent.length &&
|
|
24428
|
+
currentElement.lastChild.nodeName === 'BR') {
|
|
24429
|
+
detach(currentElement.lastChild);
|
|
24430
|
+
}
|
|
24431
|
+
}
|
|
24404
24432
|
insertBRElement() {
|
|
24405
24433
|
let isEmptyBrInserted = false;
|
|
24406
24434
|
const brElm = this.parent.createElement('br');
|
|
@@ -24857,6 +24885,27 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
24857
24885
|
eventInitializer() {
|
|
24858
24886
|
this.wireEvents();
|
|
24859
24887
|
}
|
|
24888
|
+
cleanList(e) {
|
|
24889
|
+
const range = this.getRange();
|
|
24890
|
+
const currentStartContainer = range.startContainer;
|
|
24891
|
+
const currentEndContainer = range.endContainer;
|
|
24892
|
+
let currentStartOffset = range.startOffset;
|
|
24893
|
+
let isSameContainer = currentStartContainer === currentEndContainer ? true : false;
|
|
24894
|
+
let currentEndOffset;
|
|
24895
|
+
const endNode = range.endContainer.nodeName === '#text' ? range.endContainer.parentElement :
|
|
24896
|
+
range.endContainer;
|
|
24897
|
+
let closestLI = closest(endNode, 'LI');
|
|
24898
|
+
if (!isNullOrUndefined(closestLI) && endNode.textContent.length === range.endOffset &&
|
|
24899
|
+
!range.collapsed) {
|
|
24900
|
+
closestLI.textContent = closestLI.textContent.trim();
|
|
24901
|
+
currentEndOffset = closestLI.textContent.length - 1;
|
|
24902
|
+
let currentLastElem = closestLI;
|
|
24903
|
+
while (currentLastElem.nodeName !== '#text') {
|
|
24904
|
+
currentLastElem = currentLastElem.lastChild;
|
|
24905
|
+
}
|
|
24906
|
+
this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), isSameContainer ? currentLastElem : currentStartContainer, currentLastElem, currentStartOffset, currentLastElem.textContent.length);
|
|
24907
|
+
}
|
|
24908
|
+
}
|
|
24860
24909
|
/**
|
|
24861
24910
|
* For internal use only - keydown the event handler;
|
|
24862
24911
|
*
|
|
@@ -24869,6 +24918,9 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
24869
24918
|
keyDown(e) {
|
|
24870
24919
|
this.notify(keyDown, { member: 'keydown', args: e });
|
|
24871
24920
|
this.restrict(e);
|
|
24921
|
+
if (this.editorMode === 'HTML') {
|
|
24922
|
+
this.cleanList(e);
|
|
24923
|
+
}
|
|
24872
24924
|
if (this.editorMode === 'HTML' && ((e.which === 8 && e.code === 'Backspace') || (e.which === 46 && e.code === 'Delete'))) {
|
|
24873
24925
|
const range = this.getRange();
|
|
24874
24926
|
const startNode = range.startContainer.nodeName === '#text' ? range.startContainer.parentElement :
|