@syncfusion/ej2-richtexteditor 25.2.5 → 25.2.7
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 +26 -0
- 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 +190 -25
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +191 -25
- 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 +11 -11
- package/src/common/interface.d.ts +14 -0
- package/src/editor-manager/plugin/inserthtml.js +3 -0
- package/src/editor-manager/plugin/lists.js +53 -2
- package/src/editor-manager/plugin/ms-word-clean-up.js +1 -1
- package/src/rich-text-editor/actions/enter-key.d.ts +5 -0
- package/src/rich-text-editor/actions/enter-key.js +98 -13
- package/src/rich-text-editor/actions/html-editor.js +1 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +2 -1
- package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -0
- package/src/rich-text-editor/base/rich-text-editor.js +12 -1
- package/src/rich-text-editor/renderer/audio-module.js +6 -1
- package/src/rich-text-editor/renderer/image-module.js +9 -4
- package/src/rich-text-editor/renderer/video-module.js +6 -1
|
@@ -13211,7 +13211,7 @@ class Lists {
|
|
|
13211
13211
|
e.event.preventDefault();
|
|
13212
13212
|
}
|
|
13213
13213
|
}
|
|
13214
|
-
onKeyUp() {
|
|
13214
|
+
onKeyUp(e) {
|
|
13215
13215
|
if (!isNullOrUndefined(this.commonLIParent) && !isNullOrUndefined(this.commonLIParent.querySelector('.removeList'))) {
|
|
13216
13216
|
const currentLIElem = this.commonLIParent.querySelector('.removeList');
|
|
13217
13217
|
while (!isNullOrUndefined(currentLIElem.firstChild)) {
|
|
@@ -13219,6 +13219,14 @@ class Lists {
|
|
|
13219
13219
|
}
|
|
13220
13220
|
detach(currentLIElem);
|
|
13221
13221
|
}
|
|
13222
|
+
if (e.event.keyCode === 13) {
|
|
13223
|
+
const listElements = this.parent.editableElement.querySelectorAll('UL, OL');
|
|
13224
|
+
for (let i = 0; i < listElements.length; i++) {
|
|
13225
|
+
if (!isNullOrUndefined(listElements[i]) && !isNullOrUndefined(listElements[i].parentElement) && !isNullOrUndefined(listElements[i].previousElementSibling) && (listElements[i].parentElement.nodeName === 'UL' || listElements[i].parentElement.nodeName === 'OL')) {
|
|
13226
|
+
listElements[i].previousElementSibling.appendChild(listElements[i]);
|
|
13227
|
+
}
|
|
13228
|
+
}
|
|
13229
|
+
}
|
|
13222
13230
|
}
|
|
13223
13231
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13224
13232
|
firstListBackSpace(range, _e) {
|
|
@@ -13460,6 +13468,8 @@ class Lists {
|
|
|
13460
13468
|
else {
|
|
13461
13469
|
if (prevSibling.tagName === 'LI') {
|
|
13462
13470
|
const nestedElement = createElement(elements[i].parentNode.tagName);
|
|
13471
|
+
nestedElement.style.listStyleType =
|
|
13472
|
+
elements[i].parentNode.style.listStyleType;
|
|
13463
13473
|
append([nestedElement], prevSibling);
|
|
13464
13474
|
append([elements[i]], nestedElement);
|
|
13465
13475
|
}
|
|
@@ -13566,7 +13576,7 @@ class Lists {
|
|
|
13566
13576
|
}
|
|
13567
13577
|
let elemAtt;
|
|
13568
13578
|
elements[i].style.removeProperty('margin-left');
|
|
13569
|
-
elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
|
|
13579
|
+
elemAtt = elements[i].tagName === 'IMG' || elements[i].classList.contains('e-editor-select-start') ? '' : this.domNode.attributes(elements[i]);
|
|
13570
13580
|
if (elements[i].getAttribute('contenteditable') === 'true'
|
|
13571
13581
|
&& elements[i].childNodes.length === 1 && elements[i].childNodes[0].nodeName === 'TABLE') {
|
|
13572
13582
|
const listEle = document.createElement(type);
|
|
@@ -13687,6 +13697,13 @@ class Lists {
|
|
|
13687
13697
|
for (let c = 0; c < liParents.length; c++) {
|
|
13688
13698
|
const node = liParents[c];
|
|
13689
13699
|
let toFindtopOlUl = true;
|
|
13700
|
+
let containsListElements = node;
|
|
13701
|
+
while (containsListElements.parentElement) {
|
|
13702
|
+
if (containsListElements.parentElement && containsListElements.parentElement.tagName !== 'LI' && containsListElements.parentElement.tagName !== 'OL' && containsListElements.parentElement.tagName !== 'UL') {
|
|
13703
|
+
break;
|
|
13704
|
+
}
|
|
13705
|
+
containsListElements = containsListElements.parentElement;
|
|
13706
|
+
}
|
|
13690
13707
|
if (toFindtopOlUl && (liParents[c].parentElement.parentElement.nodeName === 'OL' || liParents[c].parentElement.parentElement.nodeName === 'UL')) {
|
|
13691
13708
|
toFindtopOlUl = false;
|
|
13692
13709
|
const preElement = liParents[c].parentElement.parentElement;
|
|
@@ -13706,9 +13723,43 @@ class Lists {
|
|
|
13706
13723
|
node.previousElementSibling.lastChild.append(node);
|
|
13707
13724
|
}
|
|
13708
13725
|
}
|
|
13726
|
+
else if (this.domNode.isList(node.previousElementSibling) && containsListElements.contains(node.previousElementSibling) && ((node.tagName === 'OL' || node.tagName === 'UL') && (node.previousElementSibling.nodeName === 'OL' || node.previousElementSibling.nodeName === 'UL'))) {
|
|
13727
|
+
const contentNodes = this.domNode.contents(node);
|
|
13728
|
+
for (let f = 0; f < contentNodes.length; f++) {
|
|
13729
|
+
node.previousElementSibling.appendChild(contentNodes[f]);
|
|
13730
|
+
}
|
|
13731
|
+
node.parentNode.removeChild(node);
|
|
13732
|
+
}
|
|
13709
13733
|
}
|
|
13710
13734
|
if (firstNodeOL) {
|
|
13711
13735
|
firstNodeOL.style.listStyleType = listStyleType;
|
|
13736
|
+
const range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
13737
|
+
let listOlUlElements = [];
|
|
13738
|
+
if (range.commonAncestorContainer.nodeName === 'UL' || range.commonAncestorContainer.nodeName === 'OL') {
|
|
13739
|
+
if (range.commonAncestorContainer instanceof Element) {
|
|
13740
|
+
listOlUlElements.push(range.commonAncestorContainer);
|
|
13741
|
+
}
|
|
13742
|
+
listOlUlElements = listOlUlElements.concat(Array.from(range.commonAncestorContainer.querySelectorAll('ol, ul')));
|
|
13743
|
+
}
|
|
13744
|
+
else {
|
|
13745
|
+
listOlUlElements = Array.from(range.commonAncestorContainer.querySelectorAll('ol, ul'));
|
|
13746
|
+
}
|
|
13747
|
+
for (let k = 0; k < listOlUlElements.length; k++) {
|
|
13748
|
+
let listStyle;
|
|
13749
|
+
let listElements = listOlUlElements[k];
|
|
13750
|
+
while (listElements) {
|
|
13751
|
+
if (listElements.nodeName === 'OL' || listElements.nodeName === 'OL') {
|
|
13752
|
+
if (listElements.style.listStyleType !== '' && listElements.style.listStyleType !== 'none' && listElements.nodeName !== 'LI') {
|
|
13753
|
+
listStyle = listElements.style.listStyleType;
|
|
13754
|
+
}
|
|
13755
|
+
else if (!isNullOrUndefined(listStyle) && (listElements.style.listStyleType === '' || listElements.style.listStyleType === 'none') &&
|
|
13756
|
+
listElements.nodeName !== 'LI' && (listElements.nodeName === 'UL' || listElements.nodeName === 'OL')) {
|
|
13757
|
+
listElements.style.listStyleType = listStyle;
|
|
13758
|
+
}
|
|
13759
|
+
}
|
|
13760
|
+
listElements = listElements.querySelector('UL,OL');
|
|
13761
|
+
}
|
|
13762
|
+
}
|
|
13712
13763
|
}
|
|
13713
13764
|
}
|
|
13714
13765
|
findUnSelected(temp, elements) {
|
|
@@ -14637,6 +14688,9 @@ class InsertHtml {
|
|
|
14637
14688
|
this.insertTableInList(range, node, closestParentNode, nodes[0], nodeCutter);
|
|
14638
14689
|
return;
|
|
14639
14690
|
}
|
|
14691
|
+
if (isCursor && range.startContainer.textContent === '' && range.startContainer.nodeName !== 'BR' && enterAction !== 'BR' && node.nodeName !== '#text' && !isNullOrUndefined(node.children[0]) && !isNullOrUndefined(node.children[0].tagName) && node.children[0].tagName === 'IMG' && node.children.length === 1) {
|
|
14692
|
+
range.startContainer.innerHTML = '';
|
|
14693
|
+
}
|
|
14640
14694
|
if (isExternal || (!isNullOrUndefined(node) && !isNullOrUndefined(node.classList) &&
|
|
14641
14695
|
node.classList.contains('pasteContent'))) {
|
|
14642
14696
|
this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction);
|
|
@@ -19930,7 +19984,7 @@ class MsWordPaste {
|
|
|
19930
19984
|
!isNormalList) {
|
|
19931
19985
|
prevList = null;
|
|
19932
19986
|
}
|
|
19933
|
-
const pElement = createElement('p', { className: '
|
|
19987
|
+
const pElement = createElement('p', { className: 'MsoNoSpacing' });
|
|
19934
19988
|
pElement.innerHTML = collection[index].content.join(' ');
|
|
19935
19989
|
if ((collection[index].nestedLevel === 1) &&
|
|
19936
19990
|
(listCount === 0 || lfo !== collection[index].listFormatOverride) &&
|
|
@@ -21964,7 +22018,7 @@ class HtmlEditor {
|
|
|
21964
22018
|
const range = this.nodeSelectionObj.getRange(this.contentRenderer.getDocument());
|
|
21965
22019
|
const parentNode = this.nodeSelectionObj.getParentNodeCollection(range);
|
|
21966
22020
|
if (!((parentNode[0].nodeName === 'LI' || closest(parentNode[0], 'li') ||
|
|
21967
|
-
closest(parentNode[0], 'table'))
|
|
22021
|
+
closest(parentNode[0], 'table')))) {
|
|
21968
22022
|
args.preventDefault();
|
|
21969
22023
|
const selection = this.contentRenderer.getDocument().getSelection().getRangeAt(0);
|
|
21970
22024
|
let alignmentNodes = this.parent.formatter.editorManager.domNode.blockNodes();
|
|
@@ -23345,7 +23399,8 @@ class PasteCleanup {
|
|
|
23345
23399
|
clipBoardElem = this.allowedStyle(clipBoardElem);
|
|
23346
23400
|
}
|
|
23347
23401
|
this.saveSelection.restore();
|
|
23348
|
-
|
|
23402
|
+
const newText = clipBoardElem.innerHTML.split("&").join("&");
|
|
23403
|
+
clipBoardElem.innerHTML = this.sanitizeHelper(newText);
|
|
23349
23404
|
const allImg = clipBoardElem.querySelectorAll('img');
|
|
23350
23405
|
for (let i = 0; i < allImg.length; i++) {
|
|
23351
23406
|
if (!isNullOrUndefined(allImg[i].getAttribute('src'))) {
|
|
@@ -26704,13 +26759,13 @@ class Image$1 {
|
|
|
26704
26759
|
selectParentEle = this.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
|
|
26705
26760
|
if (!originalEvent.ctrlKey && originalEvent.key && (originalEvent.key.length === 1 || originalEvent.action === 'enter') &&
|
|
26706
26761
|
(!isNullOrUndefined(selectParentEle[0]) && selectParentEle[0].tagName === 'IMG') && selectParentEle[0].parentElement) {
|
|
26707
|
-
const prev = selectParentEle[0].parentElement.childNodes[0];
|
|
26708
26762
|
if (this.contentModule.getEditPanel().querySelector('.e-img-resize')) {
|
|
26709
26763
|
this.removeResizeEle();
|
|
26710
26764
|
}
|
|
26711
|
-
this.parent.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), prev, prev, prev.textContent.length, prev.textContent.length);
|
|
26712
26765
|
removeClass([selectParentEle[0]], 'e-img-focus');
|
|
26713
|
-
this.quickToolObj.imageQTBar
|
|
26766
|
+
if (this.quickToolObj && this.quickToolObj.imageQTBar) {
|
|
26767
|
+
this.quickToolObj.imageQTBar.hidePopup();
|
|
26768
|
+
}
|
|
26714
26769
|
}
|
|
26715
26770
|
}
|
|
26716
26771
|
if (originalEvent.ctrlKey && (originalEvent.keyCode === 89 || originalEvent.keyCode === 90)) {
|
|
@@ -27471,7 +27526,12 @@ class Image$1 {
|
|
|
27471
27526
|
animationSettings: { effect: 'None' },
|
|
27472
27527
|
close: (event) => {
|
|
27473
27528
|
if (this.isImgUploaded) {
|
|
27474
|
-
this.
|
|
27529
|
+
if (this.dialogObj.element.querySelector('.e-file-abort-btn')) {
|
|
27530
|
+
this.dialogObj.element.querySelector('.e-file-abort-btn').click();
|
|
27531
|
+
}
|
|
27532
|
+
else {
|
|
27533
|
+
this.uploadObj.remove();
|
|
27534
|
+
}
|
|
27475
27535
|
}
|
|
27476
27536
|
this.parent.isBlur = false;
|
|
27477
27537
|
if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
|
|
@@ -28978,7 +29038,12 @@ class Audio {
|
|
|
28978
29038
|
animationSettings: { effect: 'None' },
|
|
28979
29039
|
close: (event) => {
|
|
28980
29040
|
if (this.isAudioUploaded) {
|
|
28981
|
-
this.
|
|
29041
|
+
if (this.dialogObj.element.querySelector('.e-file-abort-btn')) {
|
|
29042
|
+
this.dialogObj.element.querySelector('.e-file-abort-btn').click();
|
|
29043
|
+
}
|
|
29044
|
+
else {
|
|
29045
|
+
this.uploadObj.remove();
|
|
29046
|
+
}
|
|
28982
29047
|
}
|
|
28983
29048
|
this.parent.isBlur = false;
|
|
28984
29049
|
if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
|
|
@@ -30329,7 +30394,12 @@ class Video {
|
|
|
30329
30394
|
animationSettings: { effect: 'None' },
|
|
30330
30395
|
close: (event) => {
|
|
30331
30396
|
if (this.isVideoUploaded) {
|
|
30332
|
-
this.
|
|
30397
|
+
if (this.dialogObj.element.querySelector('.e-file-abort-btn')) {
|
|
30398
|
+
this.dialogObj.element.querySelector('.e-file-abort-btn').click();
|
|
30399
|
+
}
|
|
30400
|
+
else {
|
|
30401
|
+
this.uploadObj.remove();
|
|
30402
|
+
}
|
|
30333
30403
|
}
|
|
30334
30404
|
this.parent.isBlur = false;
|
|
30335
30405
|
if (event && !isNullOrUndefined(event.event) && event.event.returnValue) {
|
|
@@ -33488,16 +33558,18 @@ class EnterKeyAction {
|
|
|
33488
33558
|
this.getRangeNode();
|
|
33489
33559
|
let isTableEnter = true;
|
|
33490
33560
|
this.formatTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote'];
|
|
33491
|
-
const
|
|
33492
|
-
|
|
33493
|
-
|
|
33494
|
-
|
|
33495
|
-
|
|
33496
|
-
|
|
33497
|
-
|
|
33498
|
-
if (
|
|
33499
|
-
this.
|
|
33500
|
-
|
|
33561
|
+
const tableImagCursor = this.processedTableImageCursor();
|
|
33562
|
+
if (tableImagCursor.start || tableImagCursor.end) {
|
|
33563
|
+
if (tableImagCursor.startName === 'TABLE' || tableImagCursor.endName === 'TABLE') { // Default browser action prevented and hanled manually.
|
|
33564
|
+
this.handleCursorAtTableSide(e, tableImagCursor.start, tableImagCursor.end);
|
|
33565
|
+
return;
|
|
33566
|
+
}
|
|
33567
|
+
}
|
|
33568
|
+
if (tableImagCursor.start || tableImagCursor.end || this.range.startContainer.nodeName === 'IMG') {
|
|
33569
|
+
if (this.parent.enterKey === 'BR' && (tableImagCursor.startName === 'IMG' || tableImagCursor.endName === 'IMG' || this.range.startContainer.nodeName === 'IMG')) { // Default browser action prevented and hanled manually.
|
|
33570
|
+
this.handleEnterKeyAtImageSide(e, tableImagCursor.start, tableImagCursor.end);
|
|
33571
|
+
return;
|
|
33572
|
+
}
|
|
33501
33573
|
}
|
|
33502
33574
|
if (!isNullOrUndefined(this.startNode.closest('TABLE')) && !isNullOrUndefined(this.endNode.closest('TABLE'))) {
|
|
33503
33575
|
isTableEnter = false;
|
|
@@ -33865,7 +33937,6 @@ class EnterKeyAction {
|
|
|
33865
33937
|
const outerBRElem = this.parent.createElement('br');
|
|
33866
33938
|
if (this.range.startOffset === 0 && this.range.endOffset === 0 &&
|
|
33867
33939
|
!isNullOrUndefined(currentParent.previousSibling) && currentParent.previousSibling.nodeName === 'BR' && currentParent.nodeName !== 'P' && currentParent.nodeName !== 'DIV') {
|
|
33868
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33869
33940
|
newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, currentParent, false).cloneNode(true);
|
|
33870
33941
|
this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
|
|
33871
33942
|
this.insertFocusContent();
|
|
@@ -33895,7 +33966,7 @@ class EnterKeyAction {
|
|
|
33895
33966
|
}
|
|
33896
33967
|
e.args.preventDefault();
|
|
33897
33968
|
}
|
|
33898
|
-
this.
|
|
33969
|
+
this.triggerActionComplete(e, shiftKey);
|
|
33899
33970
|
}
|
|
33900
33971
|
});
|
|
33901
33972
|
}
|
|
@@ -33965,6 +34036,9 @@ class EnterKeyAction {
|
|
|
33965
34036
|
}
|
|
33966
34037
|
return insertElem;
|
|
33967
34038
|
}
|
|
34039
|
+
triggerActionComplete(e, shiftKey) {
|
|
34040
|
+
this.parent.trigger(actionComplete, { requestType: shiftKey ? 'ShiftEnterAction' : 'EnterAction', args: e.args });
|
|
34041
|
+
}
|
|
33968
34042
|
handleCursorAtTableSide(e, isStart, isEnd) {
|
|
33969
34043
|
if (this.parent.enterKey !== 'BR') {
|
|
33970
34044
|
const shiftKey = e.args.shiftKey;
|
|
@@ -33994,11 +34068,91 @@ class EnterKeyAction {
|
|
|
33994
34068
|
}
|
|
33995
34069
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), newElement, 0);
|
|
33996
34070
|
e.args.preventDefault();
|
|
33997
|
-
this.
|
|
34071
|
+
this.triggerActionComplete(e, shiftKey);
|
|
33998
34072
|
}
|
|
33999
34073
|
});
|
|
34000
34074
|
}
|
|
34001
34075
|
}
|
|
34076
|
+
handleEnterKeyAtImageSide(e, isStart, isEnd) {
|
|
34077
|
+
const actionBeginArgs = {
|
|
34078
|
+
cancel: false,
|
|
34079
|
+
name: actionBegin,
|
|
34080
|
+
requestType: e.args.shiftKey ? 'ShiftEnterAction' : 'EnterAction',
|
|
34081
|
+
originalEvent: e.args
|
|
34082
|
+
};
|
|
34083
|
+
let directRange = false;
|
|
34084
|
+
if (this.range.startContainer.nodeName === 'IMG' && this.range.startOffset === 0) {
|
|
34085
|
+
directRange = true;
|
|
34086
|
+
}
|
|
34087
|
+
this.parent.trigger(actionBegin, actionBeginArgs, (actionBeginArgs) => {
|
|
34088
|
+
if (!actionBeginArgs.cancel) {
|
|
34089
|
+
if (this.parent.enterKey === 'BR') {
|
|
34090
|
+
const newElement = this.parent.createElement('BR');
|
|
34091
|
+
let imageElement;
|
|
34092
|
+
if (directRange) {
|
|
34093
|
+
imageElement = this.range.startContainer;
|
|
34094
|
+
imageElement.parentElement.insertBefore(newElement, imageElement);
|
|
34095
|
+
this.parent.formatter.editorManager.nodeSelection.
|
|
34096
|
+
setCursorPoint(this.parent.contentModule.getDocument(), imageElement, 0);
|
|
34097
|
+
}
|
|
34098
|
+
if (isStart) {
|
|
34099
|
+
imageElement = this.range.startContainer.childNodes[this.range.startOffset];
|
|
34100
|
+
imageElement.parentElement.insertBefore(newElement, imageElement);
|
|
34101
|
+
this.parent.formatter.editorManager.nodeSelection.
|
|
34102
|
+
setCursorPoint(this.parent.contentModule.getDocument(), imageElement, 0);
|
|
34103
|
+
}
|
|
34104
|
+
if (isEnd) {
|
|
34105
|
+
imageElement = this.range.startContainer.childNodes[this.range.startOffset - 1];
|
|
34106
|
+
if (!isNullOrUndefined(imageElement.nextSibling)) {
|
|
34107
|
+
imageElement.parentElement.insertBefore(newElement, imageElement.nextSibling);
|
|
34108
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), newElement.nextSibling, 0);
|
|
34109
|
+
}
|
|
34110
|
+
else if (isNullOrUndefined(imageElement.nextSibling)) {
|
|
34111
|
+
imageElement.parentElement.appendChild(newElement);
|
|
34112
|
+
const brElement = this.parent.createElement('BR');
|
|
34113
|
+
imageElement.parentElement.appendChild(brElement);
|
|
34114
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), brElement, 0);
|
|
34115
|
+
}
|
|
34116
|
+
}
|
|
34117
|
+
e.args.preventDefault();
|
|
34118
|
+
this.triggerActionComplete(e, e.args.shiftKey);
|
|
34119
|
+
}
|
|
34120
|
+
}
|
|
34121
|
+
});
|
|
34122
|
+
}
|
|
34123
|
+
isTableOrImageStart() {
|
|
34124
|
+
const customHandlerElements = ['IMG', 'TABLE'];
|
|
34125
|
+
const startContainer = this.range.startContainer;
|
|
34126
|
+
const startOffset = this.range.startOffset;
|
|
34127
|
+
const isCursorAtStart = this.range.collapsed && (startContainer.nodeType === 1) &&
|
|
34128
|
+
startContainer.isContentEditable && startContainer.childNodes[startOffset] &&
|
|
34129
|
+
(customHandlerElements.indexOf(startContainer.childNodes[startOffset].nodeName) > -1);
|
|
34130
|
+
if (isCursorAtStart) {
|
|
34131
|
+
return { start: isCursorAtStart, startNodeName: startContainer.childNodes[startOffset].nodeName };
|
|
34132
|
+
}
|
|
34133
|
+
else {
|
|
34134
|
+
return { start: false, startNodeName: '' };
|
|
34135
|
+
}
|
|
34136
|
+
}
|
|
34137
|
+
isTableOrImageEnd() {
|
|
34138
|
+
const customHandlerElements = ['IMG', 'TABLE'];
|
|
34139
|
+
const startContainer = this.range.startContainer;
|
|
34140
|
+
const startOffset = this.range.startOffset;
|
|
34141
|
+
const isCursorAtEnd = this.range.collapsed && (startContainer.nodeType === 1) &&
|
|
34142
|
+
startContainer.isContentEditable && startContainer.childNodes[startOffset - 1] &&
|
|
34143
|
+
(customHandlerElements.indexOf(startContainer.childNodes[startOffset - 1].nodeName) > -1);
|
|
34144
|
+
if (isCursorAtEnd) {
|
|
34145
|
+
return { end: isCursorAtEnd, endNodeName: startContainer.childNodes[startOffset - 1].nodeName };
|
|
34146
|
+
}
|
|
34147
|
+
else {
|
|
34148
|
+
return { end: false, endNodeName: '' };
|
|
34149
|
+
}
|
|
34150
|
+
}
|
|
34151
|
+
processedTableImageCursor() {
|
|
34152
|
+
const { start, startNodeName } = this.isTableOrImageStart();
|
|
34153
|
+
const { end, endNodeName } = this.isTableOrImageEnd();
|
|
34154
|
+
return { start, startName: startNodeName, end, endName: endNodeName };
|
|
34155
|
+
}
|
|
34002
34156
|
}
|
|
34003
34157
|
|
|
34004
34158
|
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -35370,7 +35524,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
35370
35524
|
}
|
|
35371
35525
|
}
|
|
35372
35526
|
updatePanelValue() {
|
|
35373
|
-
let value = this.value;
|
|
35527
|
+
let value = this.listOrderCorrection(this.value);
|
|
35374
35528
|
value = (this.enableHtmlEncode && this.value) ? decode(value) : value;
|
|
35375
35529
|
const getTextArea = this.element.querySelector('.' + CLS_RTE_SOURCE_CODE_TXTAREA);
|
|
35376
35530
|
if (value) {
|
|
@@ -35414,6 +35568,17 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
35414
35568
|
this.countModule.refresh();
|
|
35415
35569
|
}
|
|
35416
35570
|
}
|
|
35571
|
+
listOrderCorrection(value) {
|
|
35572
|
+
const valueElementWrapper = this.createElement('div');
|
|
35573
|
+
valueElementWrapper.innerHTML = value;
|
|
35574
|
+
const listElements = valueElementWrapper.querySelectorAll('UL, OL');
|
|
35575
|
+
for (let i = 0; i < listElements.length; i++) {
|
|
35576
|
+
if (!isNullOrUndefined(listElements[i]) && !isNullOrUndefined(listElements[i].parentElement) && !isNullOrUndefined(listElements[i].previousElementSibling) && (listElements[i].parentElement.nodeName === 'UL' || listElements[i].parentElement.nodeName === 'OL')) {
|
|
35577
|
+
listElements[i].previousElementSibling.appendChild(listElements[i]);
|
|
35578
|
+
}
|
|
35579
|
+
}
|
|
35580
|
+
return valueElementWrapper.innerHTML;
|
|
35581
|
+
}
|
|
35417
35582
|
setHeight(height) {
|
|
35418
35583
|
if (height !== 'auto') {
|
|
35419
35584
|
this.element.style.height = formatUnit(height);
|