@syncfusion/ej2-richtexteditor 20.1.48 → 20.1.52
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 +39 -1
- 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 +26 -18
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +28 -20
- 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 +9 -9
- package/src/editor-manager/plugin/insert-text.js +1 -1
- package/src/editor-manager/plugin/inserthtml.js +2 -1
- package/src/editor-manager/plugin/nodecutter.js +2 -2
- package/src/editor-manager/plugin/selection-commands.js +8 -2
- package/src/editor-manager/plugin/table.js +2 -2
- package/src/editor-manager/plugin/undo.js +1 -1
- package/src/rich-text-editor/actions/enter-key.js +3 -2
- package/src/rich-text-editor/actions/toolbar.js +1 -1
- package/src/rich-text-editor/base/rich-text-editor.js +6 -2
- package/src/rich-text-editor/renderer/image-module.js +1 -5
- package/src/rich-text-editor/renderer/table-module.js +1 -1
|
@@ -4253,7 +4253,7 @@ var Toolbar$2 = /** @__PURE__ @class */ (function () {
|
|
|
4253
4253
|
if ((parent_1.bottom < (floatOffset + tbHeight + topValue)) || parent_1.bottom < 0 || parent_1.top > floatOffset + topValue) {
|
|
4254
4254
|
isFloat = false;
|
|
4255
4255
|
}
|
|
4256
|
-
else if (parent_1.top < floatOffset) {
|
|
4256
|
+
else if (parent_1.top < floatOffset || parent_1.top < floatOffset + topValue) {
|
|
4257
4257
|
isFloat = true;
|
|
4258
4258
|
}
|
|
4259
4259
|
}
|
|
@@ -11459,7 +11459,7 @@ var NodeCutter = /** @__PURE__ @class */ (function () {
|
|
|
11459
11459
|
fragment = this.spliceEmptyNode(fragment, true);
|
|
11460
11460
|
if (fragment && fragment.childNodes.length > 0) {
|
|
11461
11461
|
var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG'
|
|
11462
|
-
&& this.isImgElm(fragment) && fragment.textContent
|
|
11462
|
+
&& this.isImgElm(fragment) && fragment.textContent === '') ? true : false;
|
|
11463
11463
|
if (!isEmpty) {
|
|
11464
11464
|
if (node) {
|
|
11465
11465
|
InsertMethods.AppendBefore(fragment, node, true);
|
|
@@ -11510,7 +11510,7 @@ var NodeCutter = /** @__PURE__ @class */ (function () {
|
|
|
11510
11510
|
else if (len > -1) {
|
|
11511
11511
|
this.spliceEmptyNode(fragment.childNodes[0], isStart);
|
|
11512
11512
|
}
|
|
11513
|
-
else if (fragment.nodeType !== 3 && fragment.nodeType !== 11) {
|
|
11513
|
+
else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG') {
|
|
11514
11514
|
fragment.parentNode.removeChild(fragment);
|
|
11515
11515
|
}
|
|
11516
11516
|
return fragment;
|
|
@@ -12336,7 +12336,8 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
12336
12336
|
tempSpan.parentNode.replaceChild(node, tempSpan);
|
|
12337
12337
|
}
|
|
12338
12338
|
else {
|
|
12339
|
-
var
|
|
12339
|
+
var nodeSelection = new NodeSelection();
|
|
12340
|
+
var currentNode = this.getNodeCollection(range, nodeSelection, node)[this.getNodeCollection(range, nodeSelection, node).length - 1];
|
|
12340
12341
|
var splitedElm = void 0;
|
|
12341
12342
|
if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNullOrUndefined(currentNode.parentElement) &&
|
|
12342
12343
|
currentNode.parentElement.textContent.trim().length === 0) {
|
|
@@ -13420,11 +13421,11 @@ var TableCommand = /** @__PURE__ @class */ (function () {
|
|
|
13420
13421
|
for (var i = 0; i < emptyUl.length; i++) {
|
|
13421
13422
|
detach(emptyUl[i]);
|
|
13422
13423
|
}
|
|
13423
|
-
var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
|
|
13424
|
+
var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
|
|
13424
13425
|
for (var i = 0; i < emptyLiChild.length; i++) {
|
|
13425
13426
|
detach(emptyLiChild[i]);
|
|
13426
13427
|
if (emptyLiChild.length === i + 1) {
|
|
13427
|
-
emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
|
|
13428
|
+
emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
|
|
13428
13429
|
i = -1;
|
|
13429
13430
|
}
|
|
13430
13431
|
}
|
|
@@ -14516,12 +14517,18 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
|
|
|
14516
14517
|
var preventRestore = false;
|
|
14517
14518
|
var isFontStyle = (['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1);
|
|
14518
14519
|
if (range.collapsed) {
|
|
14520
|
+
var currentFormatNode = isFormatted.getFormattedNode(range.startContainer, format, endNode);
|
|
14521
|
+
var currentSelector = !isNullOrUndefined(currentFormatNode) ?
|
|
14522
|
+
(currentFormatNode.getAttribute('style') === null ? currentFormatNode.nodeName :
|
|
14523
|
+
currentFormatNode.nodeName + "[style='" + currentFormatNode.getAttribute('style') + "']") : null;
|
|
14519
14524
|
if (nodes.length > 0) {
|
|
14520
14525
|
isCollapsed = true;
|
|
14521
14526
|
range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
|
|
14522
14527
|
}
|
|
14523
|
-
else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.childElementCount > 0 &&
|
|
14524
|
-
range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br')
|
|
14528
|
+
else if (range.startContainer.nodeType === 3 && ((range.startContainer.parentElement.childElementCount > 0 &&
|
|
14529
|
+
range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') ||
|
|
14530
|
+
!isNullOrUndefined(currentFormatNode) && currentFormatNode === (range.startContainer.parentElement.closest(currentSelector)) &&
|
|
14531
|
+
((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(new RegExp(String.fromCharCode(8203), 'g'), '').trim().length != 0))) {
|
|
14525
14532
|
isCollapsed = true;
|
|
14526
14533
|
range = nodeCutter.GetCursorRange(docElement, range, range.startContainer);
|
|
14527
14534
|
nodes.push(range.startContainer);
|
|
@@ -15453,7 +15460,7 @@ var UndoRedoManager = /** @__PURE__ @class */ (function () {
|
|
|
15453
15460
|
*/
|
|
15454
15461
|
UndoRedoManager.prototype.saveData = function (e) {
|
|
15455
15462
|
var range = new NodeSelection().getRange(this.parent.currentDocument);
|
|
15456
|
-
var currentContainer = range.startContainer;
|
|
15463
|
+
var currentContainer = this.parent.editableElement === range.startContainer.parentElement ? range.startContainer.parentElement : range.startContainer;
|
|
15457
15464
|
for (var i = currentContainer.childNodes.length - 1; i >= 0; i--) {
|
|
15458
15465
|
if (!isNullOrUndefined(currentContainer.childNodes[i]) && currentContainer.childNodes[i].nodeName === '#text' &&
|
|
15459
15466
|
currentContainer.childNodes[i].textContent.length === 0 && currentContainer.childNodes[i].nodeName !== 'IMG' &&
|
|
@@ -16286,7 +16293,7 @@ var InsertTextExec = /** @__PURE__ @class */ (function () {
|
|
|
16286
16293
|
};
|
|
16287
16294
|
InsertTextExec.prototype.insertText = function (e) {
|
|
16288
16295
|
var node = document.createTextNode(e.value);
|
|
16289
|
-
InsertHtml.Insert(this.parent.currentDocument, node);
|
|
16296
|
+
InsertHtml.Insert(this.parent.currentDocument, node, this.parent.editableElement);
|
|
16290
16297
|
if (e.callBack) {
|
|
16291
16298
|
e.callBack({
|
|
16292
16299
|
requestType: e.subCommand,
|
|
@@ -20410,14 +20417,10 @@ var Image = /** @__PURE__ @class */ (function () {
|
|
|
20410
20417
|
img.style.height = null;
|
|
20411
20418
|
img.removeAttribute('height');
|
|
20412
20419
|
}
|
|
20413
|
-
else
|
|
20420
|
+
else {
|
|
20414
20421
|
img.style.width = expectedX + 'px';
|
|
20415
20422
|
img.style.height = expectedX + 'px';
|
|
20416
20423
|
}
|
|
20417
|
-
else {
|
|
20418
|
-
img.setAttribute('width', expectedX.toString());
|
|
20419
|
-
img.setAttribute('height', expectedX.toString());
|
|
20420
|
-
}
|
|
20421
20424
|
}
|
|
20422
20425
|
};
|
|
20423
20426
|
Image.prototype.pixToPerc = function (expected, parentEle) {
|
|
@@ -23342,7 +23345,7 @@ var Table = /** @__PURE__ @class */ (function () {
|
|
|
23342
23345
|
EventHandler.remove(_this.contentModule.getEditPanel(), 'mouseover', _this.resizeHelper);
|
|
23343
23346
|
}
|
|
23344
23347
|
var widthType = _this.curTable.style.width.indexOf('%') > -1;
|
|
23345
|
-
_this.curTable.style.width = widthType ? _this.convertPixelToPercentage(tableWidth + mouseX, rteWidth) + '%'
|
|
23348
|
+
_this.curTable.style.width = widthType && !_this.curTable.closest('TD') ? _this.convertPixelToPercentage(tableWidth + mouseX, rteWidth) + '%'
|
|
23346
23349
|
: tableWidth + mouseX + 'px';
|
|
23347
23350
|
_this.curTable.style.height = tableHeight + mouseY + 'px';
|
|
23348
23351
|
tableReBox.classList.add('e-rbox-select');
|
|
@@ -24774,8 +24777,9 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
24774
24777
|
};
|
|
24775
24778
|
EnterKeyAction.prototype.removeBRElement = function (currentElement) {
|
|
24776
24779
|
if (Browser.userAgent.indexOf('Firefox') != -1 &&
|
|
24777
|
-
this.range.endOffset === currentElement.textContent.length &&
|
|
24778
|
-
currentElement.
|
|
24780
|
+
this.range.endOffset === currentElement.textContent.length && (currentElement.textContent.length !== 0 ||
|
|
24781
|
+
currentElement.querySelectorAll('BR').length > 1) &&
|
|
24782
|
+
!isNullOrUndefined(currentElement.lastChild) && currentElement.lastChild.nodeName === 'BR') {
|
|
24779
24783
|
detach(currentElement.lastChild);
|
|
24780
24784
|
}
|
|
24781
24785
|
};
|
|
@@ -25527,6 +25531,10 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
25527
25531
|
? 0 : e.clipboardData.getData('text/plain').length;
|
|
25528
25532
|
var totalLength = (currentLength - selectionLength) + pastedContentLength;
|
|
25529
25533
|
if (_this.editorMode === 'Markdown') {
|
|
25534
|
+
var args_1 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
|
|
25535
|
+
setTimeout(function () {
|
|
25536
|
+
_this.formatter.onSuccess(_this, args_1);
|
|
25537
|
+
}, 0);
|
|
25530
25538
|
if (!(_this.maxLength === -1 || totalLength <= _this.maxLength)) {
|
|
25531
25539
|
e.preventDefault();
|
|
25532
25540
|
}
|
|
@@ -25538,7 +25546,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
25538
25546
|
_this.notify(pasteClean, { args: e });
|
|
25539
25547
|
}
|
|
25540
25548
|
else {
|
|
25541
|
-
var
|
|
25549
|
+
var args_2 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
|
|
25542
25550
|
var value = null;
|
|
25543
25551
|
var htmlValue = false;
|
|
25544
25552
|
if (e && !isNullOrUndefined(e.clipboardData)) {
|
|
@@ -25556,7 +25564,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
25556
25564
|
});
|
|
25557
25565
|
}
|
|
25558
25566
|
setTimeout(function () {
|
|
25559
|
-
_this.formatter.onSuccess(_this,
|
|
25567
|
+
_this.formatter.onSuccess(_this, args_2);
|
|
25560
25568
|
}, 0);
|
|
25561
25569
|
}
|
|
25562
25570
|
}
|