@syncfusion/ej2-richtexteditor 25.1.42 → 25.2.3
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 +14 -4
- 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 +67 -18
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +67 -18
- 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/common/util.d.ts +8 -0
- package/src/common/util.js +52 -0
- package/src/editor-manager/plugin/ms-word-clean-up.js +2 -2
- package/src/editor-manager/plugin/undo.js +3 -1
- package/src/rich-text-editor/actions/html-editor.js +2 -10
- package/src/rich-text-editor/actions/paste-clean-up.js +11 -7
- package/styles/bootstrap-dark.css +3 -6
- package/styles/bootstrap.css +3 -6
- package/styles/bootstrap4.css +3 -6
- package/styles/bootstrap5-dark.css +3 -6
- package/styles/bootstrap5.css +3 -6
- package/styles/fabric-dark.css +3 -6
- package/styles/fabric.css +3 -6
- package/styles/fluent-dark.css +3 -6
- package/styles/fluent.css +3 -6
- package/styles/highcontrast-light.css +3 -6
- package/styles/highcontrast.css +3 -6
- package/styles/material-dark.css +3 -6
- package/styles/material.css +3 -6
- package/styles/material3-dark.css +3 -6
- package/styles/material3.css +3 -6
- package/styles/rich-text-editor/_layout.scss +3 -6
- package/styles/rich-text-editor/bootstrap-dark.css +3 -6
- package/styles/rich-text-editor/bootstrap.css +3 -6
- package/styles/rich-text-editor/bootstrap4.css +3 -6
- package/styles/rich-text-editor/bootstrap5-dark.css +3 -6
- package/styles/rich-text-editor/bootstrap5.css +3 -6
- package/styles/rich-text-editor/fabric-dark.css +3 -6
- package/styles/rich-text-editor/fabric.css +3 -6
- package/styles/rich-text-editor/fluent-dark.css +3 -6
- package/styles/rich-text-editor/fluent.css +3 -6
- package/styles/rich-text-editor/highcontrast-light.css +3 -6
- package/styles/rich-text-editor/highcontrast.css +3 -6
- package/styles/rich-text-editor/material-dark.css +3 -6
- package/styles/rich-text-editor/material.css +3 -6
- package/styles/rich-text-editor/material3-dark.css +3 -6
- package/styles/rich-text-editor/material3.css +3 -6
- package/styles/rich-text-editor/tailwind-dark.css +3 -6
- package/styles/rich-text-editor/tailwind.css +3 -6
- package/styles/tailwind-dark.css +3 -6
- package/styles/tailwind.css +3 -6
|
@@ -4476,6 +4476,10 @@ function updateTextNode$1(value, enterAction) {
|
|
|
4476
4476
|
tableElm[i].classList.remove('e-rte-paste-onenote-table');
|
|
4477
4477
|
continue;
|
|
4478
4478
|
}
|
|
4479
|
+
else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
|
|
4480
|
+
tableElm[i].classList.remove('e-rte-paste-html-table');
|
|
4481
|
+
continue;
|
|
4482
|
+
}
|
|
4479
4483
|
}
|
|
4480
4484
|
}
|
|
4481
4485
|
var imageElm = resultElm.querySelectorAll('img');
|
|
@@ -4580,6 +4584,54 @@ function nestedListCleanUp(range) {
|
|
|
4580
4584
|
}
|
|
4581
4585
|
}
|
|
4582
4586
|
}
|
|
4587
|
+
/**
|
|
4588
|
+
* Method to scroll the content to the cursor position
|
|
4589
|
+
*
|
|
4590
|
+
* @param {Document} document - specifies the document.
|
|
4591
|
+
* @param {HTMLElement | HTMLBodyElement} inputElement - specifies the input element.
|
|
4592
|
+
* @returns {void}
|
|
4593
|
+
*/
|
|
4594
|
+
function scrollToCursor(document, inputElement) {
|
|
4595
|
+
var rootElement = inputElement.nodeName === 'BODY' ?
|
|
4596
|
+
inputElement.ownerDocument.defaultView.frameElement.closest('.e-richtexteditor') :
|
|
4597
|
+
inputElement.closest('.e-richtexteditor');
|
|
4598
|
+
var height = rootElement.style.height;
|
|
4599
|
+
if (document.getSelection().rangeCount === 0) {
|
|
4600
|
+
return;
|
|
4601
|
+
}
|
|
4602
|
+
var range = document.getSelection().getRangeAt(0);
|
|
4603
|
+
var finalFocusElement = range.startContainer.nodeName === '#text' ? range.startContainer.parentElement :
|
|
4604
|
+
range.startContainer;
|
|
4605
|
+
var rect = finalFocusElement.getBoundingClientRect();
|
|
4606
|
+
var cursorTop = rect.top;
|
|
4607
|
+
var cursorBottom = rect.bottom;
|
|
4608
|
+
var rootRect = rootElement.getBoundingClientRect();
|
|
4609
|
+
var hasMargin = rootElement.querySelectorAll('.e-count-enabled, .e-resize-enabled').length > 0;
|
|
4610
|
+
if (inputElement.nodeName === 'BODY') {
|
|
4611
|
+
if (height === 'auto') {
|
|
4612
|
+
if (window.innerHeight < cursorTop) {
|
|
4613
|
+
finalFocusElement.scrollIntoView(false);
|
|
4614
|
+
}
|
|
4615
|
+
}
|
|
4616
|
+
else {
|
|
4617
|
+
if (cursorTop > inputElement.getBoundingClientRect().height) {
|
|
4618
|
+
finalFocusElement.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
4619
|
+
}
|
|
4620
|
+
}
|
|
4621
|
+
}
|
|
4622
|
+
else {
|
|
4623
|
+
if (height === 'auto') {
|
|
4624
|
+
if (window.innerHeight < cursorTop) {
|
|
4625
|
+
finalFocusElement.scrollIntoView({ block: 'end', inline: 'nearest' });
|
|
4626
|
+
}
|
|
4627
|
+
}
|
|
4628
|
+
else {
|
|
4629
|
+
if (cursorBottom > rootRect.bottom) {
|
|
4630
|
+
rootElement.querySelector('.e-rte-content').scrollTop += (cursorBottom - rootRect.bottom) + (hasMargin ? 20 : 0);
|
|
4631
|
+
}
|
|
4632
|
+
}
|
|
4633
|
+
}
|
|
4634
|
+
}
|
|
4583
4635
|
|
|
4584
4636
|
/**
|
|
4585
4637
|
* Update Toolbar Status
|
|
@@ -19083,6 +19135,7 @@ var UndoRedoManager = /** @__PURE__ @class */ (function () {
|
|
|
19083
19135
|
this.parent.editableElement.innerHTML = '';
|
|
19084
19136
|
this.parent.editableElement.appendChild(removedContent.cloneNode(true));
|
|
19085
19137
|
this.parent.editableElement.focus();
|
|
19138
|
+
scrollToCursor(this.parent.currentDocument, this.parent.editableElement);
|
|
19086
19139
|
if (isIDevice$1()) {
|
|
19087
19140
|
setEditFrameFocus(this.parent.editableElement, e.selector);
|
|
19088
19141
|
}
|
|
@@ -19115,6 +19168,7 @@ var UndoRedoManager = /** @__PURE__ @class */ (function () {
|
|
|
19115
19168
|
this.parent.editableElement.innerHTML = '';
|
|
19116
19169
|
this.parent.editableElement.appendChild(addedContent.cloneNode(true));
|
|
19117
19170
|
this.parent.editableElement.focus();
|
|
19171
|
+
scrollToCursor(this.parent.currentDocument, this.parent.editableElement);
|
|
19118
19172
|
if (isIDevice$1()) {
|
|
19119
19173
|
setEditFrameFocus(this.parent.editableElement, e.selector);
|
|
19120
19174
|
}
|
|
@@ -19216,9 +19270,9 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
19216
19270
|
var patern2 = /class="?Mso|style="[^ ]*\bmso-/i;
|
|
19217
19271
|
var patern3 = /(class="?Mso|class='?Mso|class="?Xl|class='?Xl|class=Xl|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument)/gi;
|
|
19218
19272
|
var pattern4 = /style='mso-width-source:/i;
|
|
19273
|
+
var source = this.findSource(elm);
|
|
19219
19274
|
if (patern.test(tempHTMLContent) || patern2.test(tempHTMLContent) || patern3.test(tempHTMLContent) ||
|
|
19220
19275
|
pattern4.test(tempHTMLContent)) {
|
|
19221
|
-
var source = this.findSource(elm);
|
|
19222
19276
|
tempHTMLContent = tempHTMLContent.replace(/<img[^>]+>/i, '');
|
|
19223
19277
|
this.addListClass(elm);
|
|
19224
19278
|
listNodes = this.cleanUp(elm, listNodes);
|
|
@@ -19243,7 +19297,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
19243
19297
|
e.callBack(elm.innerHTML, this.cropImageDimensions, source);
|
|
19244
19298
|
}
|
|
19245
19299
|
else {
|
|
19246
|
-
e.callBack(elm.innerHTML);
|
|
19300
|
+
e.callBack(elm.innerHTML, null, source);
|
|
19247
19301
|
}
|
|
19248
19302
|
};
|
|
19249
19303
|
MsWordPaste.prototype.addDoubleBr = function (elm) {
|
|
@@ -21972,15 +22026,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
21972
22026
|
}
|
|
21973
22027
|
else {
|
|
21974
22028
|
this.parent.notify(enterHandler, { args: e.args });
|
|
21975
|
-
|
|
21976
|
-
if (!isNullOrUndefined(newRange.startContainer) && this.parent.height !== 'auto' && newRange.startContainer.nodeName !== '#text'
|
|
21977
|
-
&& !this.parent.iframeSettings.enable && newRange.startContainer.getBoundingClientRect().bottom > this.parent.element.getBoundingClientRect().bottom) {
|
|
21978
|
-
this.parent.element.querySelector('.e-rte-content').scrollTop += newRange.startContainer.getBoundingClientRect().bottom - this.parent.element.getBoundingClientRect().bottom;
|
|
21979
|
-
}
|
|
21980
|
-
else if (!isNullOrUndefined(newRange.startContainer) && this.parent.height === 'auto' && newRange.startContainer.nodeName !== '#text'
|
|
21981
|
-
&& !this.parent.iframeSettings.enable && window.innerHeight < newRange.startContainer.getBoundingClientRect().top) {
|
|
21982
|
-
newRange.startContainer.scrollIntoView({ block: 'end', inline: 'nearest' });
|
|
21983
|
-
}
|
|
22029
|
+
scrollToCursor(this.parent.contentModule.getDocument(), this.parent.inputElement);
|
|
21984
22030
|
}
|
|
21985
22031
|
}
|
|
21986
22032
|
}
|
|
@@ -23017,7 +23063,9 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
23017
23063
|
popupObj.close();
|
|
23018
23064
|
}
|
|
23019
23065
|
this.parent.trigger(imageUploadFailed, e);
|
|
23020
|
-
uploadObj.
|
|
23066
|
+
if (uploadObj && document.body.contains(uploadObj.element)) {
|
|
23067
|
+
uploadObj.destroy();
|
|
23068
|
+
}
|
|
23021
23069
|
};
|
|
23022
23070
|
PasteCleanup.prototype.popupClose = function (popupObj, uploadObj, imgElem, e) {
|
|
23023
23071
|
var _this = this;
|
|
@@ -23033,7 +23081,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
23033
23081
|
});
|
|
23034
23082
|
popupObj.close();
|
|
23035
23083
|
imgElem.style.opacity = '1';
|
|
23036
|
-
if (
|
|
23084
|
+
if (uploadObj && document.body.contains(uploadObj.element)) {
|
|
23037
23085
|
uploadObj.destroy();
|
|
23038
23086
|
}
|
|
23039
23087
|
this.toolbarEnableDisable(false);
|
|
@@ -23333,6 +23381,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
23333
23381
|
extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
|
|
23334
23382
|
_this.parent.formatter.onSuccess(_this.parent, args);
|
|
23335
23383
|
}, clipBoardElem, null, null, this.parent.enterKey);
|
|
23384
|
+
scrollToCursor(this.parent.contentModule.getDocument(), this.parent.inputElement);
|
|
23336
23385
|
this.removeTempClass();
|
|
23337
23386
|
this.parent.notify(toolbarRefresh, {});
|
|
23338
23387
|
this.cropImageHandler(this.parent.inputElement);
|
|
@@ -23387,15 +23436,15 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
23387
23436
|
}
|
|
23388
23437
|
};
|
|
23389
23438
|
PasteCleanup.prototype.addTableClass = function (element, source) {
|
|
23390
|
-
source = isNullOrUndefined(source) ? '' : source;
|
|
23391
23439
|
var tableElement = element.querySelectorAll('table');
|
|
23392
23440
|
for (var i = 0; i < tableElement.length; i++) {
|
|
23393
|
-
|
|
23394
|
-
|
|
23395
|
-
}
|
|
23396
|
-
else if (source && source !== 'html') {
|
|
23441
|
+
var isMSTeamsTable = tableElement[i].parentElement.nodeName === 'FIGURE';
|
|
23442
|
+
if (this.parent.pasteCleanupSettings.keepFormat && source && !isMSTeamsTable) {
|
|
23397
23443
|
tableElement[i].classList.add('e-rte-paste-' + source + '-table');
|
|
23398
23444
|
}
|
|
23445
|
+
else if (!tableElement[i].classList.contains('e-rte-table')) {
|
|
23446
|
+
tableElement[i].classList.add('e-rte-table');
|
|
23447
|
+
}
|
|
23399
23448
|
}
|
|
23400
23449
|
return element;
|
|
23401
23450
|
};
|