@syncfusion/ej2-richtexteditor 20.1.50 → 20.1.55
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 +38 -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 +26 -17
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +28 -19
- 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/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/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 +2 -1
|
@@ -4232,7 +4232,7 @@ class Toolbar$2 {
|
|
|
4232
4232
|
if ((parent.bottom < (floatOffset + tbHeight + topValue)) || parent.bottom < 0 || parent.top > floatOffset + topValue) {
|
|
4233
4233
|
isFloat = false;
|
|
4234
4234
|
}
|
|
4235
|
-
else if (parent.top < floatOffset) {
|
|
4235
|
+
else if (parent.top < floatOffset || parent.top < floatOffset + topValue) {
|
|
4236
4236
|
isFloat = true;
|
|
4237
4237
|
}
|
|
4238
4238
|
}
|
|
@@ -11360,7 +11360,7 @@ class NodeCutter {
|
|
|
11360
11360
|
fragment = this.spliceEmptyNode(fragment, true);
|
|
11361
11361
|
if (fragment && fragment.childNodes.length > 0) {
|
|
11362
11362
|
const isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG'
|
|
11363
|
-
&& this.isImgElm(fragment) && fragment.textContent
|
|
11363
|
+
&& this.isImgElm(fragment) && fragment.textContent === '') ? true : false;
|
|
11364
11364
|
if (!isEmpty) {
|
|
11365
11365
|
if (node) {
|
|
11366
11366
|
InsertMethods.AppendBefore(fragment, node, true);
|
|
@@ -11411,7 +11411,7 @@ class NodeCutter {
|
|
|
11411
11411
|
else if (len > -1) {
|
|
11412
11412
|
this.spliceEmptyNode(fragment.childNodes[0], isStart);
|
|
11413
11413
|
}
|
|
11414
|
-
else if (fragment.nodeType !== 3 && fragment.nodeType !== 11) {
|
|
11414
|
+
else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG') {
|
|
11415
11415
|
fragment.parentNode.removeChild(fragment);
|
|
11416
11416
|
}
|
|
11417
11417
|
return fragment;
|
|
@@ -12233,7 +12233,8 @@ class InsertHtml {
|
|
|
12233
12233
|
tempSpan.parentNode.replaceChild(node, tempSpan);
|
|
12234
12234
|
}
|
|
12235
12235
|
else {
|
|
12236
|
-
|
|
12236
|
+
const nodeSelection = new NodeSelection();
|
|
12237
|
+
let currentNode = this.getNodeCollection(range, nodeSelection, node)[this.getNodeCollection(range, nodeSelection, node).length - 1];
|
|
12237
12238
|
let splitedElm;
|
|
12238
12239
|
if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNullOrUndefined(currentNode.parentElement) &&
|
|
12239
12240
|
currentNode.parentElement.textContent.trim().length === 0) {
|
|
@@ -13311,11 +13312,11 @@ class TableCommand {
|
|
|
13311
13312
|
for (let i = 0; i < emptyUl.length; i++) {
|
|
13312
13313
|
detach(emptyUl[i]);
|
|
13313
13314
|
}
|
|
13314
|
-
let emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
|
|
13315
|
+
let emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
|
|
13315
13316
|
for (let i = 0; i < emptyLiChild.length; i++) {
|
|
13316
13317
|
detach(emptyLiChild[i]);
|
|
13317
13318
|
if (emptyLiChild.length === i + 1) {
|
|
13318
|
-
emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
|
|
13319
|
+
emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
|
|
13319
13320
|
i = -1;
|
|
13320
13321
|
}
|
|
13321
13322
|
}
|
|
@@ -14398,12 +14399,18 @@ class SelectionCommands {
|
|
|
14398
14399
|
let preventRestore = false;
|
|
14399
14400
|
const isFontStyle = (['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1);
|
|
14400
14401
|
if (range.collapsed) {
|
|
14402
|
+
let currentFormatNode = isFormatted.getFormattedNode(range.startContainer, format, endNode);
|
|
14403
|
+
let currentSelector = !isNullOrUndefined(currentFormatNode) ?
|
|
14404
|
+
(currentFormatNode.getAttribute('style') === null ? currentFormatNode.nodeName :
|
|
14405
|
+
currentFormatNode.nodeName + `[style='` + currentFormatNode.getAttribute('style') + `']`) : null;
|
|
14401
14406
|
if (nodes.length > 0) {
|
|
14402
14407
|
isCollapsed = true;
|
|
14403
14408
|
range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
|
|
14404
14409
|
}
|
|
14405
|
-
else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.childElementCount > 0 &&
|
|
14406
|
-
range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br')
|
|
14410
|
+
else if (range.startContainer.nodeType === 3 && ((range.startContainer.parentElement.childElementCount > 0 &&
|
|
14411
|
+
range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') ||
|
|
14412
|
+
!isNullOrUndefined(currentFormatNode) && currentFormatNode === (range.startContainer.parentElement.closest(currentSelector)) &&
|
|
14413
|
+
((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(new RegExp(String.fromCharCode(8203), 'g'), '').trim().length != 0))) {
|
|
14407
14414
|
isCollapsed = true;
|
|
14408
14415
|
range = nodeCutter.GetCursorRange(docElement, range, range.startContainer);
|
|
14409
14416
|
nodes.push(range.startContainer);
|
|
@@ -16158,7 +16165,7 @@ class InsertTextExec {
|
|
|
16158
16165
|
}
|
|
16159
16166
|
insertText(e) {
|
|
16160
16167
|
const node = document.createTextNode(e.value);
|
|
16161
|
-
InsertHtml.Insert(this.parent.currentDocument, node);
|
|
16168
|
+
InsertHtml.Insert(this.parent.currentDocument, node, this.parent.editableElement);
|
|
16162
16169
|
if (e.callBack) {
|
|
16163
16170
|
e.callBack({
|
|
16164
16171
|
requestType: e.subCommand,
|
|
@@ -20311,14 +20318,10 @@ class Image {
|
|
|
20311
20318
|
img.style.height = null;
|
|
20312
20319
|
img.removeAttribute('height');
|
|
20313
20320
|
}
|
|
20314
|
-
else
|
|
20321
|
+
else {
|
|
20315
20322
|
img.style.width = expectedX + 'px';
|
|
20316
20323
|
img.style.height = expectedX + 'px';
|
|
20317
20324
|
}
|
|
20318
|
-
else {
|
|
20319
|
-
img.setAttribute('width', expectedX.toString());
|
|
20320
|
-
img.setAttribute('height', expectedX.toString());
|
|
20321
|
-
}
|
|
20322
20325
|
}
|
|
20323
20326
|
}
|
|
20324
20327
|
pixToPerc(expected, parentEle) {
|
|
@@ -23182,7 +23185,8 @@ class Table {
|
|
|
23182
23185
|
const tableWidth = parseInt(getComputedStyle(this.curTable).width, 10);
|
|
23183
23186
|
const tableHeight = parseInt(getComputedStyle(this.curTable).height, 10);
|
|
23184
23187
|
const paddingSize = +getComputedStyle(this.contentModule.getEditPanel()).paddingRight.match(/\d/g).join('');
|
|
23185
|
-
const rteWidth = this.contentModule.getEditPanel().offsetWidth -
|
|
23188
|
+
const rteWidth = this.contentModule.getEditPanel().offsetWidth - (this.contentModule.getEditPanel().offsetWidth -
|
|
23189
|
+
this.contentModule.getEditPanel().clientWidth) - paddingSize * 2;
|
|
23186
23190
|
if (this.resizeBtnStat.column) {
|
|
23187
23191
|
const cellColl = this.curTable.rows[this.calMaxCol(this.curTable)].cells;
|
|
23188
23192
|
const width = parseFloat(this.columnEle.offsetWidth.toString());
|
|
@@ -24530,8 +24534,9 @@ class EnterKeyAction {
|
|
|
24530
24534
|
}
|
|
24531
24535
|
removeBRElement(currentElement) {
|
|
24532
24536
|
if (Browser.userAgent.indexOf('Firefox') != -1 &&
|
|
24533
|
-
this.range.endOffset === currentElement.textContent.length &&
|
|
24534
|
-
currentElement.
|
|
24537
|
+
this.range.endOffset === currentElement.textContent.length && (currentElement.textContent.length !== 0 ||
|
|
24538
|
+
currentElement.querySelectorAll('BR').length > 1) &&
|
|
24539
|
+
!isNullOrUndefined(currentElement.lastChild) && currentElement.lastChild.nodeName === 'BR') {
|
|
24535
24540
|
detach(currentElement.lastChild);
|
|
24536
24541
|
}
|
|
24537
24542
|
}
|
|
@@ -25255,6 +25260,10 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
25255
25260
|
? 0 : e.clipboardData.getData('text/plain').length;
|
|
25256
25261
|
const totalLength = (currentLength - selectionLength) + pastedContentLength;
|
|
25257
25262
|
if (this.editorMode === 'Markdown') {
|
|
25263
|
+
const args = { requestType: 'Paste', editorMode: this.editorMode, event: e };
|
|
25264
|
+
setTimeout(() => {
|
|
25265
|
+
this.formatter.onSuccess(this, args);
|
|
25266
|
+
}, 0);
|
|
25258
25267
|
if (!(this.maxLength === -1 || totalLength <= this.maxLength)) {
|
|
25259
25268
|
e.preventDefault();
|
|
25260
25269
|
}
|