@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
|
@@ -12299,7 +12299,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
12299
12299
|
var currentNode = nodes[nodes.length - 1];
|
|
12300
12300
|
var splitedElm = void 0;
|
|
12301
12301
|
if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNullOrUndefined(currentNode.parentElement) &&
|
|
12302
|
-
currentNode.parentElement.textContent.trim().length === 0 && !node.classList.contains('pasteContent')) {
|
|
12302
|
+
currentNode.parentElement.textContent.trim().length === 0 && (currentNode.parentElement === editNode || !node.classList.contains('pasteContent'))) {
|
|
12303
12303
|
splitedElm = currentNode;
|
|
12304
12304
|
}
|
|
12305
12305
|
else {
|
|
@@ -17216,6 +17216,7 @@ var XhtmlValidation = /** @__PURE__ @class */ (function () {
|
|
|
17216
17216
|
var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
17217
17217
|
function HtmlEditor(parent, serviceLocator) {
|
|
17218
17218
|
this.rangeCollection = [];
|
|
17219
|
+
this.isImageDelete = false;
|
|
17219
17220
|
this.parent = parent;
|
|
17220
17221
|
this.locator = serviceLocator;
|
|
17221
17222
|
this.renderFactory = this.locator.getService('rendererFactory');
|
|
@@ -17389,7 +17390,9 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
17389
17390
|
this.oldRangeElement = null;
|
|
17390
17391
|
this.deleteRangeElement = null;
|
|
17391
17392
|
this.deleteOldRangeElement = null;
|
|
17392
|
-
|
|
17393
|
+
if (!this.isImageDelete) {
|
|
17394
|
+
args.preventDefault();
|
|
17395
|
+
}
|
|
17393
17396
|
}
|
|
17394
17397
|
};
|
|
17395
17398
|
HtmlEditor.prototype.isOrderedList = function (editorValue) {
|
|
@@ -17513,7 +17516,15 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
17513
17516
|
return;
|
|
17514
17517
|
}
|
|
17515
17518
|
else {
|
|
17516
|
-
|
|
17519
|
+
if (currentRange.startOffset === 0 && currentRange.endOffset === 1 &&
|
|
17520
|
+
this.deleteRangeElement.childNodes[0].nodeName === 'IMG') {
|
|
17521
|
+
this.parent.formatter.editorManager.nodeSelection.setSelectionText(this.parent.contentModule.getDocument(), this.deleteRangeElement, this.deleteRangeElement, 0, 1);
|
|
17522
|
+
this.isImageDelete = true;
|
|
17523
|
+
}
|
|
17524
|
+
else {
|
|
17525
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.deleteRangeElement, this.deleteRangeElement.childNodes.length);
|
|
17526
|
+
this.isImageDelete = false;
|
|
17527
|
+
}
|
|
17517
17528
|
if (this.deleteRangeElement.querySelector('BR')) {
|
|
17518
17529
|
detach(this.deleteRangeElement.querySelector('BR'));
|
|
17519
17530
|
}
|
|
@@ -18095,6 +18106,11 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
18095
18106
|
}
|
|
18096
18107
|
}
|
|
18097
18108
|
};
|
|
18109
|
+
PasteCleanup.prototype.toolbarEnableDisable = function (state) {
|
|
18110
|
+
if (!this.parent.inlineMode.enable) {
|
|
18111
|
+
this.parent.toolbarModule.baseToolbar.toolbarObj.disable(state);
|
|
18112
|
+
}
|
|
18113
|
+
};
|
|
18098
18114
|
PasteCleanup.prototype.uploadMethod = function (fileList, imgElem) {
|
|
18099
18115
|
var _this = this;
|
|
18100
18116
|
var uploadEle = document.createElement('div');
|
|
@@ -18171,6 +18187,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
18171
18187
|
if (beforeUploadArgs.cancel) {
|
|
18172
18188
|
return;
|
|
18173
18189
|
}
|
|
18190
|
+
_this.toolbarEnableDisable(true);
|
|
18174
18191
|
/* eslint-disable */
|
|
18175
18192
|
uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
|
|
18176
18193
|
beforeUploadArgs.currentRequest : uploadObj.currentRequestHeader;
|
|
@@ -18182,6 +18199,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
18182
18199
|
}
|
|
18183
18200
|
else {
|
|
18184
18201
|
_this.parent.trigger(beforeImageUpload, args);
|
|
18202
|
+
_this.toolbarEnableDisable(true);
|
|
18185
18203
|
}
|
|
18186
18204
|
},
|
|
18187
18205
|
// eslint-disable-next-line
|
|
@@ -18254,6 +18272,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
18254
18272
|
popupObj.close();
|
|
18255
18273
|
imgElem.style.opacity = '1';
|
|
18256
18274
|
uploadObj.destroy();
|
|
18275
|
+
this.toolbarEnableDisable(false);
|
|
18257
18276
|
};
|
|
18258
18277
|
PasteCleanup.prototype.refreshPopup = function (imageElement, popupObj) {
|
|
18259
18278
|
var imgPosition = this.parent.iframeSettings.enable ? this.parent.element.offsetTop +
|
|
@@ -24481,6 +24500,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
24481
24500
|
else if (_this.range.startOffset === 0 && _this.range.endOffset === 0) {
|
|
24482
24501
|
isFocusedFirst = true;
|
|
24483
24502
|
}
|
|
24503
|
+
_this.removeBRElement(nearBlockNode);
|
|
24484
24504
|
if (((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
|
|
24485
24505
|
!(!isNullOrUndefined(_this.range.startContainer.previousSibling) &&
|
|
24486
24506
|
(_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
|
|
@@ -24584,6 +24604,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
24584
24604
|
else {
|
|
24585
24605
|
currentParent = _this.startNode;
|
|
24586
24606
|
}
|
|
24607
|
+
_this.removeBRElement(currentParent);
|
|
24587
24608
|
var currentParentLastChild = currentParent.lastChild;
|
|
24588
24609
|
while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text' || currentParentLastChild.nodeName === 'BR')) {
|
|
24589
24610
|
currentParentLastChild = currentParentLastChild.lastChild;
|
|
@@ -24645,6 +24666,13 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
24645
24666
|
}
|
|
24646
24667
|
}
|
|
24647
24668
|
};
|
|
24669
|
+
EnterKeyAction.prototype.removeBRElement = function (currentElement) {
|
|
24670
|
+
if (Browser.userAgent.indexOf('Firefox') != -1 &&
|
|
24671
|
+
this.range.endOffset === currentElement.textContent.length &&
|
|
24672
|
+
currentElement.lastChild.nodeName === 'BR') {
|
|
24673
|
+
detach(currentElement.lastChild);
|
|
24674
|
+
}
|
|
24675
|
+
};
|
|
24648
24676
|
EnterKeyAction.prototype.insertBRElement = function () {
|
|
24649
24677
|
var isEmptyBrInserted = false;
|
|
24650
24678
|
var brElm = this.parent.createElement('br');
|
|
@@ -25128,6 +25156,27 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
25128
25156
|
RichTextEditor.prototype.eventInitializer = function () {
|
|
25129
25157
|
this.wireEvents();
|
|
25130
25158
|
};
|
|
25159
|
+
RichTextEditor.prototype.cleanList = function (e) {
|
|
25160
|
+
var range = this.getRange();
|
|
25161
|
+
var currentStartContainer = range.startContainer;
|
|
25162
|
+
var currentEndContainer = range.endContainer;
|
|
25163
|
+
var currentStartOffset = range.startOffset;
|
|
25164
|
+
var isSameContainer = currentStartContainer === currentEndContainer ? true : false;
|
|
25165
|
+
var currentEndOffset;
|
|
25166
|
+
var endNode = range.endContainer.nodeName === '#text' ? range.endContainer.parentElement :
|
|
25167
|
+
range.endContainer;
|
|
25168
|
+
var closestLI = closest(endNode, 'LI');
|
|
25169
|
+
if (!isNullOrUndefined(closestLI) && endNode.textContent.length === range.endOffset &&
|
|
25170
|
+
!range.collapsed) {
|
|
25171
|
+
closestLI.textContent = closestLI.textContent.trim();
|
|
25172
|
+
currentEndOffset = closestLI.textContent.length - 1;
|
|
25173
|
+
var currentLastElem = closestLI;
|
|
25174
|
+
while (currentLastElem.nodeName !== '#text') {
|
|
25175
|
+
currentLastElem = currentLastElem.lastChild;
|
|
25176
|
+
}
|
|
25177
|
+
this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), isSameContainer ? currentLastElem : currentStartContainer, currentLastElem, currentStartOffset, currentLastElem.textContent.length);
|
|
25178
|
+
}
|
|
25179
|
+
};
|
|
25131
25180
|
/**
|
|
25132
25181
|
* For internal use only - keydown the event handler;
|
|
25133
25182
|
*
|
|
@@ -25140,6 +25189,9 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
25140
25189
|
RichTextEditor.prototype.keyDown = function (e) {
|
|
25141
25190
|
this.notify(keyDown, { member: 'keydown', args: e });
|
|
25142
25191
|
this.restrict(e);
|
|
25192
|
+
if (this.editorMode === 'HTML') {
|
|
25193
|
+
this.cleanList(e);
|
|
25194
|
+
}
|
|
25143
25195
|
if (this.editorMode === 'HTML' && ((e.which === 8 && e.code === 'Backspace') || (e.which === 46 && e.code === 'Delete'))) {
|
|
25144
25196
|
var range = this.getRange();
|
|
25145
25197
|
var startNode = range.startContainer.nodeName === '#text' ? range.startContainer.parentElement :
|