@syncfusion/ej2-richtexteditor 19.4.54 → 19.4.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 +16 -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 +35 -9
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +33 -7
- 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 +7 -7
- package/src/editor-manager/plugin/image.js +6 -1
- package/src/editor-manager/plugin/link.js +5 -0
- package/src/editor-manager/plugin/lists.js +8 -0
- package/src/editor-manager/plugin/selection-commands.js +8 -2
- package/src/rich-text-editor/actions/html-editor.js +3 -1
- package/src/rich-text-editor/renderer/image-module.js +2 -2
- package/src/rich-text-editor/renderer/table-module.js +1 -1
|
@@ -10828,7 +10828,15 @@ class Lists {
|
|
|
10828
10828
|
return isNested;
|
|
10829
10829
|
}
|
|
10830
10830
|
applyListsHandler(e) {
|
|
10831
|
-
|
|
10831
|
+
let range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
10832
|
+
if (range.startContainer === range.endContainer && range.startContainer === this.parent.editableElement &&
|
|
10833
|
+
range.startOffset === range.endOffset && range.startOffset === 0 &&
|
|
10834
|
+
this.parent.editableElement.textContent.length === 0 && (this.parent.editableElement.childNodes[0].nodeName != 'TABLE' &&
|
|
10835
|
+
this.parent.editableElement.childNodes[0].nodeName != 'IMG')) {
|
|
10836
|
+
const focusNode = range.startContainer.childNodes[0];
|
|
10837
|
+
this.parent.nodeSelection.setSelectionText(this.parent.currentDocument, focusNode, focusNode, 0, 0);
|
|
10838
|
+
range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
10839
|
+
}
|
|
10832
10840
|
this.saveSelection = this.parent.nodeSelection.save(range, this.parent.currentDocument);
|
|
10833
10841
|
this.currentAction = e.subCommand;
|
|
10834
10842
|
this.currentAction = e.subCommand = this.currentAction === 'NumberFormatList' ? 'OL' : this.currentAction === 'BulletFormatList' ? 'UL' : this.currentAction;
|
|
@@ -12358,7 +12366,12 @@ class LinkCommand {
|
|
|
12358
12366
|
}
|
|
12359
12367
|
else {
|
|
12360
12368
|
const domSelection = new NodeSelection();
|
|
12361
|
-
|
|
12369
|
+
let range = domSelection.getRange(this.parent.currentDocument);
|
|
12370
|
+
if (range.endContainer.nodeName === '#text' && range.startContainer.textContent.length === (range.endOffset + 1) &&
|
|
12371
|
+
range.endContainer.textContent.charAt(range.endOffset) === ' ' && range.endContainer.nextSibling.nodeName === 'A') {
|
|
12372
|
+
domSelection.setSelectionText(this.parent.currentDocument, range.startContainer, range.endContainer, range.startOffset, range.endOffset + 1);
|
|
12373
|
+
range = domSelection.getRange(this.parent.currentDocument);
|
|
12374
|
+
}
|
|
12362
12375
|
const text = isNullOrUndefined(e.item.text) ? true : e.item.text.replace(/ /g, '').localeCompare(range.toString()
|
|
12363
12376
|
.replace(/\n/g, ' ').replace(/ /g, '')) < 0;
|
|
12364
12377
|
if (e.event && e.event.type === 'keydown' && (e.event.keyCode === 32
|
|
@@ -13012,7 +13025,12 @@ class ImageCommand {
|
|
|
13012
13025
|
removeImage(e) {
|
|
13013
13026
|
if (closest(e.item.selectNode[0], 'a')) {
|
|
13014
13027
|
if (e.item.selectNode[0].parentElement.nodeName === 'A' && !isNullOrUndefined(e.item.selectNode[0].parentElement.innerText)) {
|
|
13015
|
-
|
|
13028
|
+
if (!isNullOrUndefined(closest(e.item.selectNode[0], '.' + CLASS_CAPTION))) {
|
|
13029
|
+
detach(closest(e.item.selectNode[0], '.' + CLASS_CAPTION));
|
|
13030
|
+
}
|
|
13031
|
+
else {
|
|
13032
|
+
detach(e.item.selectNode[0]);
|
|
13033
|
+
}
|
|
13016
13034
|
}
|
|
13017
13035
|
else {
|
|
13018
13036
|
detach(closest(e.item.selectNode[0], 'a'));
|
|
@@ -14413,6 +14431,7 @@ class SelectionCommands {
|
|
|
14413
14431
|
}
|
|
14414
14432
|
static insertCursorNode(docElement, domSelection, range, isFormatted, nodeCutter, format, value, endNode) {
|
|
14415
14433
|
const cursorNodes = domSelection.getNodeCollection(range);
|
|
14434
|
+
const domNode = new DOMNode(endNode, docElement);
|
|
14416
14435
|
const cursorFormat = (cursorNodes.length > 0) ?
|
|
14417
14436
|
(cursorNodes.length > 1 && range.startContainer === range.endContainer) ?
|
|
14418
14437
|
this.getCursorFormat(isFormatted, cursorNodes, format, endNode) :
|
|
@@ -14420,11 +14439,16 @@ class SelectionCommands {
|
|
|
14420
14439
|
let cursorNode = null;
|
|
14421
14440
|
if (cursorFormat) {
|
|
14422
14441
|
cursorNode = cursorNodes[0];
|
|
14423
|
-
if (cursorFormat.firstChild.textContent.charCodeAt(0) === 8203) {
|
|
14442
|
+
if (cursorFormat.firstChild.textContent.charCodeAt(0) === 8203 && cursorFormat.firstChild.nodeType === 3) {
|
|
14424
14443
|
const regEx = new RegExp(String.fromCharCode(8203), 'g');
|
|
14425
14444
|
let emptySpaceNode;
|
|
14426
14445
|
if (cursorFormat.firstChild === cursorNode) {
|
|
14427
|
-
cursorNode.textContent =
|
|
14446
|
+
cursorNode.textContent = (cursorFormat.parentElement && (domNode.isBlockNode(cursorFormat.parentElement) &&
|
|
14447
|
+
cursorFormat.parentElement.textContent.length <= 1 ? cursorFormat.parentElement.childElementCount > 1 :
|
|
14448
|
+
cursorFormat.childElementCount === 0) &&
|
|
14449
|
+
(cursorFormat.parentElement.textContent.length > 1 ||
|
|
14450
|
+
cursorFormat.parentElement.firstChild && cursorFormat.parentElement.firstChild.nodeType === 1) ?
|
|
14451
|
+
cursorNode.textContent : cursorNode.textContent.replace(regEx, ''));
|
|
14428
14452
|
emptySpaceNode = cursorNode;
|
|
14429
14453
|
|
|
14430
14454
|
}
|
|
@@ -17224,7 +17248,9 @@ class HtmlEditor {
|
|
|
17224
17248
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
|
|
17225
17249
|
}
|
|
17226
17250
|
if (!isNullOrUndefined(range.startContainer.previousSibling) && !isNullOrUndefined(range.startContainer.previousSibling.parentElement) &&
|
|
17227
|
-
range.startContainer.parentElement === range.startContainer.previousSibling.parentElement &&
|
|
17251
|
+
range.startContainer.parentElement === range.startContainer.previousSibling.parentElement &&
|
|
17252
|
+
range.startContainer.previousSibling.textContent.charCodeAt(0) === 8203 &&
|
|
17253
|
+
range.startContainer.previousSibling.textContent.length <= 1) {
|
|
17228
17254
|
range.startContainer.previousSibling.textContent = range.startContainer.previousSibling.textContent.replace(regEx, '');
|
|
17229
17255
|
}
|
|
17230
17256
|
if (range.endContainer.textContent.charCodeAt(range.endOffset) === 8203) {
|
|
@@ -21693,7 +21719,8 @@ class Image {
|
|
|
21693
21719
|
if (activePopupElement) {
|
|
21694
21720
|
activePopupElement.classList.add(CLS_HIDE);
|
|
21695
21721
|
}
|
|
21696
|
-
|
|
21722
|
+
const imgElement = this.parent.inputElement.ownerDocument.querySelector('.' + CLS_RTE_DRAG_IMAGE);
|
|
21723
|
+
if (e.dataTransfer.files.length > 0 && imgElement === null) { //For external image drag and drop
|
|
21697
21724
|
if (e.dataTransfer.files.length > 1) {
|
|
21698
21725
|
return;
|
|
21699
21726
|
}
|
|
@@ -21716,7 +21743,6 @@ class Image {
|
|
|
21716
21743
|
}
|
|
21717
21744
|
else { //For internal image drag and drop
|
|
21718
21745
|
const range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
|
|
21719
|
-
const imgElement = this.parent.inputElement.ownerDocument.querySelector('.' + CLS_RTE_DRAG_IMAGE);
|
|
21720
21746
|
if (imgElement && imgElement.tagName === 'IMG') {
|
|
21721
21747
|
if (imgElement.nextElementSibling) {
|
|
21722
21748
|
if (imgElement.nextElementSibling.classList.contains(CLS_IMG_INNER)) {
|
|
@@ -22838,7 +22864,7 @@ class Table {
|
|
|
22838
22864
|
return;
|
|
22839
22865
|
}
|
|
22840
22866
|
const target = e.target || e.targetTouches[0].target;
|
|
22841
|
-
const closestTable = closest(target, 'table');
|
|
22867
|
+
const closestTable = closest(target, 'table.e-rte-table');
|
|
22842
22868
|
if (!isNullOrUndefined(this.curTable) && !isNullOrUndefined(closestTable) && closestTable !== this.curTable) {
|
|
22843
22869
|
this.removeResizeElement();
|
|
22844
22870
|
this.removeHelper(e);
|