@syncfusion/ej2-richtexteditor 25.2.4 → 25.2.6
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 +34 -2
- 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 +362 -130
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +360 -127
- 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/common/util.js +4 -1
- package/src/editor-manager/base/editor-manager.js +5 -3
- package/src/editor-manager/plugin/alignments.js +3 -0
- package/src/editor-manager/plugin/dom-node.d.ts +20 -0
- package/src/editor-manager/plugin/dom-node.js +104 -1
- package/src/editor-manager/plugin/formats.js +1 -1
- package/src/editor-manager/plugin/indents.js +3 -0
- package/src/editor-manager/plugin/lists.d.ts +0 -1
- package/src/editor-manager/plugin/lists.js +55 -78
- 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/full-screen.js +0 -6
- package/src/rich-text-editor/actions/html-editor.d.ts +1 -0
- package/src/rich-text-editor/actions/html-editor.js +63 -10
- 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/image-module.js +3 -3
- package/src/rich-text-editor/renderer/toolbar-renderer.js +7 -9
|
@@ -4573,11 +4573,14 @@ function nestedListCleanUp(range) {
|
|
|
4573
4573
|
item.remove();
|
|
4574
4574
|
});
|
|
4575
4575
|
}
|
|
4576
|
+
else {
|
|
4577
|
+
break;
|
|
4578
|
+
}
|
|
4576
4579
|
}
|
|
4577
4580
|
var liElem = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll("li");
|
|
4578
4581
|
if (liElem.length > 0) {
|
|
4579
4582
|
liElem.forEach(function (item) {
|
|
4580
|
-
if (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL") {
|
|
4583
|
+
if (!isNullOrUndefined(item.firstChild) && (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL")) {
|
|
4581
4584
|
item.style.listStyleType = "none";
|
|
4582
4585
|
}
|
|
4583
4586
|
});
|
|
@@ -5456,8 +5459,6 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
|
|
|
5456
5459
|
target: colorPicker.element.parentElement, cssClass: css,
|
|
5457
5460
|
enablePersistence: this.parent.enablePersistence, enableRtl: this.parent.enableRtl,
|
|
5458
5461
|
beforeOpen: function (dropDownArgs) {
|
|
5459
|
-
colorPicker.inline = true;
|
|
5460
|
-
colorPicker.dataBind();
|
|
5461
5462
|
if (proxy.parent.readonly || !proxy.parent.enabled) {
|
|
5462
5463
|
dropDownArgs.cancel = true;
|
|
5463
5464
|
return;
|
|
@@ -5596,14 +5597,18 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
|
|
|
5596
5597
|
var colorPicker = new ColorPicker({
|
|
5597
5598
|
enablePersistence: this.parent.enablePersistence,
|
|
5598
5599
|
enableRtl: this.parent.enableRtl,
|
|
5599
|
-
inline:
|
|
5600
|
-
value:
|
|
5600
|
+
inline: true,
|
|
5601
|
+
value: null,
|
|
5602
|
+
cssClass: ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass + ' ' + 'e-rte-picker-init',
|
|
5601
5603
|
created: function () {
|
|
5602
5604
|
var value = (item === 'backgroundcolor') ? proxy.parent.backgroundColor.default : proxy.parent.fontColor.default;
|
|
5603
|
-
colorPicker.
|
|
5605
|
+
colorPicker.cssClass = ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass;
|
|
5606
|
+
colorPicker.value = value;
|
|
5604
5607
|
},
|
|
5605
5608
|
mode: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.mode : proxy.parent.fontColor.mode),
|
|
5606
5609
|
modeSwitcher: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.modeSwitcher : proxy.parent.fontColor.modeSwitcher),
|
|
5610
|
+
presetColors: (item === 'backgroundcolor') ? this.parent.backgroundColor.colorCode : this.parent.fontColor.colorCode,
|
|
5611
|
+
columns: (item === 'backgroundcolor') ? this.parent.backgroundColor.columns : this.parent.fontColor.columns,
|
|
5607
5612
|
beforeTileRender: function (args) {
|
|
5608
5613
|
args.element.classList.add(CLS_COLOR_PALETTE);
|
|
5609
5614
|
args.element.classList.add(CLS_CUSTOM_TILE);
|
|
@@ -5648,10 +5653,6 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
|
|
|
5648
5653
|
}
|
|
5649
5654
|
});
|
|
5650
5655
|
colorPicker.isStringTemplate = true;
|
|
5651
|
-
colorPicker.columns = (item === 'backgroundcolor') ? this.parent.backgroundColor.columns : this.parent.fontColor.columns;
|
|
5652
|
-
colorPicker.presetColors = (item === 'backgroundcolor') ? this.parent.backgroundColor.colorCode :
|
|
5653
|
-
this.parent.fontColor.colorCode;
|
|
5654
|
-
colorPicker.cssClass = ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass;
|
|
5655
5656
|
colorPicker.createElement = this.parent.createElement;
|
|
5656
5657
|
colorPicker.appendTo(document.getElementById(args.target));
|
|
5657
5658
|
return colorPicker;
|
|
@@ -12698,6 +12699,109 @@ var DOMNode = /** @__PURE__ @class */ (function () {
|
|
|
12698
12699
|
}
|
|
12699
12700
|
return null;
|
|
12700
12701
|
};
|
|
12702
|
+
/**
|
|
12703
|
+
* Method to wrap the inline and text node with block node.
|
|
12704
|
+
*
|
|
12705
|
+
* @param {HTMLElement} node - specifies the element sent to wrap the node around it with block nodes.
|
|
12706
|
+
* @param {string} wrapperElement - specifies which block nodes to wrap around.
|
|
12707
|
+
* @returns {HTMLElement} - returns the wrapped element.
|
|
12708
|
+
* @hidden
|
|
12709
|
+
* @deprecated
|
|
12710
|
+
*/
|
|
12711
|
+
DOMNode.prototype.gatherElementsAround = function (node, wrapperElement) {
|
|
12712
|
+
var newWrapElem = createElement(wrapperElement);
|
|
12713
|
+
// Insert the new div element before the current node.
|
|
12714
|
+
var currentNode = node.previousSibling;
|
|
12715
|
+
var currentNodeParent = node.parentElement;
|
|
12716
|
+
if (currentNodeParent.className === 'e-editor-select-start') {
|
|
12717
|
+
currentNodeParent.parentNode.insertBefore(newWrapElem, currentNodeParent);
|
|
12718
|
+
}
|
|
12719
|
+
else if (currentNodeParent) {
|
|
12720
|
+
currentNodeParent.insertBefore(newWrapElem, node);
|
|
12721
|
+
}
|
|
12722
|
+
var i = 0;
|
|
12723
|
+
while (currentNode !== null && currentNode.nodeName !== 'BR' &&
|
|
12724
|
+
!this.isBlockNode(currentNode)) {
|
|
12725
|
+
var prevSibling = currentNode.previousSibling;
|
|
12726
|
+
if (currentNode.nodeType === 3 || currentNode.nodeType === 1) {
|
|
12727
|
+
if (i === 0) {
|
|
12728
|
+
newWrapElem.appendChild(currentNode);
|
|
12729
|
+
}
|
|
12730
|
+
else {
|
|
12731
|
+
newWrapElem.insertBefore(currentNode, newWrapElem.firstChild);
|
|
12732
|
+
}
|
|
12733
|
+
}
|
|
12734
|
+
currentNode = prevSibling;
|
|
12735
|
+
i++;
|
|
12736
|
+
}
|
|
12737
|
+
// Add the current node to the new div
|
|
12738
|
+
newWrapElem.appendChild(node);
|
|
12739
|
+
// Gather text and inline elements after the currentNode
|
|
12740
|
+
currentNode = newWrapElem.nextSibling ? newWrapElem.nextSibling :
|
|
12741
|
+
newWrapElem.parentElement.nextSibling;
|
|
12742
|
+
while (currentNode !== null && currentNode.nodeName !== 'BR' &&
|
|
12743
|
+
!this.isBlockNode(currentNode)) {
|
|
12744
|
+
var nextSibling = currentNode.nextSibling ?
|
|
12745
|
+
currentNode.nextSibling : currentNode.parentElement.nextSibling;
|
|
12746
|
+
if (currentNode.nodeType === 3 || currentNode.nodeType === 1) {
|
|
12747
|
+
newWrapElem.appendChild(currentNode);
|
|
12748
|
+
}
|
|
12749
|
+
currentNode = nextSibling;
|
|
12750
|
+
}
|
|
12751
|
+
return newWrapElem;
|
|
12752
|
+
};
|
|
12753
|
+
/**
|
|
12754
|
+
* Method to convert all the inline nodes between the selection to block nodes.
|
|
12755
|
+
*
|
|
12756
|
+
* @param {Node[]} selectedNodes - specifies the nodes of the start and end selection.
|
|
12757
|
+
* @param {boolean} fromList - specifies if the method is called from list module.
|
|
12758
|
+
* @returns {Node[]} - returns the selected list of elements as block nodes.
|
|
12759
|
+
* @hidden
|
|
12760
|
+
* @deprecated
|
|
12761
|
+
*/
|
|
12762
|
+
DOMNode.prototype.convertToBlockNodes = function (selectedNodes, fromList) {
|
|
12763
|
+
if (selectedNodes.length > 1) {
|
|
12764
|
+
var i = 0;
|
|
12765
|
+
var currentSelectedNode = selectedNodes[0];
|
|
12766
|
+
while (!isNullOrUndefined(currentSelectedNode)) {
|
|
12767
|
+
if (currentSelectedNode.nodeName === 'BR') {
|
|
12768
|
+
var nextNode = currentSelectedNode.nextSibling;
|
|
12769
|
+
detach(currentSelectedNode);
|
|
12770
|
+
currentSelectedNode = nextNode;
|
|
12771
|
+
}
|
|
12772
|
+
if (!isNullOrUndefined(currentSelectedNode)) {
|
|
12773
|
+
if (fromList) {
|
|
12774
|
+
selectedNodes[i] = currentSelectedNode.nodeName === 'LI' || this.isBlockNode(currentSelectedNode) ?
|
|
12775
|
+
currentSelectedNode :
|
|
12776
|
+
this.gatherElementsAround(currentSelectedNode, (fromList ? 'p' : 'div'));
|
|
12777
|
+
}
|
|
12778
|
+
else {
|
|
12779
|
+
selectedNodes[i] = !this.isBlockNode(selectedNodes[i]) ?
|
|
12780
|
+
this.gatherElementsAround(currentSelectedNode, (fromList ? 'p' : 'div')) :
|
|
12781
|
+
selectedNodes[i];
|
|
12782
|
+
}
|
|
12783
|
+
var currentProcessNode = selectedNodes[i].nodeName === 'LI' ? selectedNodes[i].parentElement : selectedNodes[i];
|
|
12784
|
+
var currentElementCheckNode = currentProcessNode.nodeName === '#text' ? currentProcessNode.parentElement : currentProcessNode;
|
|
12785
|
+
currentSelectedNode = !isNullOrUndefined(currentElementCheckNode.querySelector('.e-editor-select-end')) ||
|
|
12786
|
+
!isNullOrUndefined(closest(currentSelectedNode, '.e-editor-select-end')) ?
|
|
12787
|
+
null : currentProcessNode.nextSibling;
|
|
12788
|
+
if (currentSelectedNode === null && !isNullOrUndefined(currentProcessNode.nextSibling) && currentProcessNode.nextSibling.nodeName === 'BR') {
|
|
12789
|
+
detach(currentProcessNode.nextSibling);
|
|
12790
|
+
}
|
|
12791
|
+
}
|
|
12792
|
+
i++;
|
|
12793
|
+
}
|
|
12794
|
+
}
|
|
12795
|
+
else {
|
|
12796
|
+
if (!this.isBlockNode(selectedNodes[0])) {
|
|
12797
|
+
selectedNodes[0] = this.gatherElementsAround(selectedNodes[0], (fromList ? 'p' : 'div'));
|
|
12798
|
+
if (!isNullOrUndefined(selectedNodes[0].nextSibling) && (selectedNodes[0].nextSibling.nodeName === 'BR')) {
|
|
12799
|
+
detach(selectedNodes[0].nextSibling);
|
|
12800
|
+
}
|
|
12801
|
+
}
|
|
12802
|
+
}
|
|
12803
|
+
return selectedNodes;
|
|
12804
|
+
};
|
|
12701
12805
|
/**
|
|
12702
12806
|
* blockNodes method
|
|
12703
12807
|
*
|
|
@@ -13206,7 +13310,7 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
13206
13310
|
e.event.preventDefault();
|
|
13207
13311
|
}
|
|
13208
13312
|
};
|
|
13209
|
-
Lists.prototype.onKeyUp = function () {
|
|
13313
|
+
Lists.prototype.onKeyUp = function (e) {
|
|
13210
13314
|
if (!isNullOrUndefined(this.commonLIParent) && !isNullOrUndefined(this.commonLIParent.querySelector('.removeList'))) {
|
|
13211
13315
|
var currentLIElem = this.commonLIParent.querySelector('.removeList');
|
|
13212
13316
|
while (!isNullOrUndefined(currentLIElem.firstChild)) {
|
|
@@ -13214,6 +13318,14 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
13214
13318
|
}
|
|
13215
13319
|
detach(currentLIElem);
|
|
13216
13320
|
}
|
|
13321
|
+
if (e.event.keyCode === 13) {
|
|
13322
|
+
var listElements = this.parent.editableElement.querySelectorAll('UL, OL');
|
|
13323
|
+
for (var i = 0; i < listElements.length; i++) {
|
|
13324
|
+
if (!isNullOrUndefined(listElements[i]) && !isNullOrUndefined(listElements[i].parentElement) && !isNullOrUndefined(listElements[i].previousElementSibling) && (listElements[i].parentElement.nodeName === 'UL' || listElements[i].parentElement.nodeName === 'OL')) {
|
|
13325
|
+
listElements[i].previousElementSibling.appendChild(listElements[i]);
|
|
13326
|
+
}
|
|
13327
|
+
}
|
|
13328
|
+
}
|
|
13217
13329
|
};
|
|
13218
13330
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13219
13331
|
Lists.prototype.firstListBackSpace = function (range, _e) {
|
|
@@ -13455,6 +13567,8 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
13455
13567
|
else {
|
|
13456
13568
|
if (prevSibling.tagName === 'LI') {
|
|
13457
13569
|
var nestedElement = createElement(elements[i].parentNode.tagName);
|
|
13570
|
+
nestedElement.style.listStyleType =
|
|
13571
|
+
elements[i].parentNode.style.listStyleType;
|
|
13458
13572
|
append([nestedElement], prevSibling);
|
|
13459
13573
|
append([elements[i]], nestedElement);
|
|
13460
13574
|
}
|
|
@@ -13504,39 +13618,7 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
13504
13618
|
var listsNodes = this.domNode.blockNodes(true);
|
|
13505
13619
|
if (e.enterAction === 'BR') {
|
|
13506
13620
|
this.setSelectionBRConfig();
|
|
13507
|
-
|
|
13508
|
-
if (selectedNodes.length > 1) {
|
|
13509
|
-
var i = 0;
|
|
13510
|
-
var currentAlignmentNode = selectedNodes[0];
|
|
13511
|
-
while (!isNullOrUndefined(currentAlignmentNode)) {
|
|
13512
|
-
if (currentAlignmentNode.nodeName === 'BR') {
|
|
13513
|
-
var nextNode = currentAlignmentNode.nextSibling;
|
|
13514
|
-
detach(currentAlignmentNode);
|
|
13515
|
-
currentAlignmentNode = nextNode;
|
|
13516
|
-
}
|
|
13517
|
-
if (!isNullOrUndefined(currentAlignmentNode)) {
|
|
13518
|
-
selectedNodes[i] = currentAlignmentNode.nodeName === 'LI' || this.parent.domNode.isBlockNode(currentAlignmentNode) ?
|
|
13519
|
-
currentAlignmentNode : this.gatherElementsAround(currentAlignmentNode);
|
|
13520
|
-
var currentSelectNode = selectedNodes[i].nodeName === 'LI' ? selectedNodes[i].parentElement : selectedNodes[i];
|
|
13521
|
-
var currentElementCheckNode = currentAlignmentNode.nodeName === '#text' ? currentAlignmentNode.parentElement : currentAlignmentNode;
|
|
13522
|
-
currentAlignmentNode = !isNullOrUndefined(currentElementCheckNode.querySelector('.e-editor-select-end')) ||
|
|
13523
|
-
!isNullOrUndefined(closest(currentAlignmentNode, '.e-editor-select-end')) ?
|
|
13524
|
-
null : currentSelectNode.nextSibling;
|
|
13525
|
-
if (currentAlignmentNode === null && !isNullOrUndefined(currentSelectNode.nextSibling) && currentSelectNode.nextSibling.nodeName === 'BR') {
|
|
13526
|
-
detach(currentSelectNode.nextSibling);
|
|
13527
|
-
}
|
|
13528
|
-
}
|
|
13529
|
-
i++;
|
|
13530
|
-
}
|
|
13531
|
-
}
|
|
13532
|
-
else {
|
|
13533
|
-
if (!this.parent.domNode.isBlockNode(selectedNodes[0])) {
|
|
13534
|
-
selectedNodes[0] = this.gatherElementsAround(selectedNodes[0]);
|
|
13535
|
-
if (!isNullOrUndefined(selectedNodes[0].nextSibling) && (selectedNodes[0].nextSibling.nodeName === 'BR')) {
|
|
13536
|
-
detach(selectedNodes[0].nextSibling);
|
|
13537
|
-
}
|
|
13538
|
-
}
|
|
13539
|
-
}
|
|
13621
|
+
this.parent.domNode.convertToBlockNodes(this.parent.domNode.blockNodes(), true);
|
|
13540
13622
|
this.setSelectionBRConfig();
|
|
13541
13623
|
listsNodes = this.parent.domNode.blockNodes();
|
|
13542
13624
|
}
|
|
@@ -13593,7 +13675,7 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
13593
13675
|
}
|
|
13594
13676
|
var elemAtt = void 0;
|
|
13595
13677
|
elements[i].style.removeProperty('margin-left');
|
|
13596
|
-
elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);
|
|
13678
|
+
elemAtt = elements[i].tagName === 'IMG' || elements[i].classList.contains('e-editor-select-start') ? '' : this.domNode.attributes(elements[i]);
|
|
13597
13679
|
if (elements[i].getAttribute('contenteditable') === 'true'
|
|
13598
13680
|
&& elements[i].childNodes.length === 1 && elements[i].childNodes[0].nodeName === 'TABLE') {
|
|
13599
13681
|
var listEle = document.createElement(type);
|
|
@@ -13714,6 +13796,13 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
13714
13796
|
for (var c = 0; c < liParents.length; c++) {
|
|
13715
13797
|
var node = liParents[c];
|
|
13716
13798
|
var toFindtopOlUl = true;
|
|
13799
|
+
var containsListElements = node;
|
|
13800
|
+
while (containsListElements.parentElement) {
|
|
13801
|
+
if (containsListElements.parentElement && containsListElements.parentElement.tagName !== 'LI' && containsListElements.parentElement.tagName !== 'OL' && containsListElements.parentElement.tagName !== 'UL') {
|
|
13802
|
+
break;
|
|
13803
|
+
}
|
|
13804
|
+
containsListElements = containsListElements.parentElement;
|
|
13805
|
+
}
|
|
13717
13806
|
if (toFindtopOlUl && (liParents[c].parentElement.parentElement.nodeName === 'OL' || liParents[c].parentElement.parentElement.nodeName === 'UL')) {
|
|
13718
13807
|
toFindtopOlUl = false;
|
|
13719
13808
|
var preElement = liParents[c].parentElement.parentElement;
|
|
@@ -13733,9 +13822,43 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
13733
13822
|
node.previousElementSibling.lastChild.append(node);
|
|
13734
13823
|
}
|
|
13735
13824
|
}
|
|
13825
|
+
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'))) {
|
|
13826
|
+
var contentNodes = this.domNode.contents(node);
|
|
13827
|
+
for (var f = 0; f < contentNodes.length; f++) {
|
|
13828
|
+
node.previousElementSibling.appendChild(contentNodes[f]);
|
|
13829
|
+
}
|
|
13830
|
+
node.parentNode.removeChild(node);
|
|
13831
|
+
}
|
|
13736
13832
|
}
|
|
13737
13833
|
if (firstNodeOL) {
|
|
13738
13834
|
firstNodeOL.style.listStyleType = listStyleType;
|
|
13835
|
+
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
13836
|
+
var listOlUlElements = [];
|
|
13837
|
+
if (range.commonAncestorContainer.nodeName === 'UL' || range.commonAncestorContainer.nodeName === 'OL') {
|
|
13838
|
+
if (range.commonAncestorContainer instanceof Element) {
|
|
13839
|
+
listOlUlElements.push(range.commonAncestorContainer);
|
|
13840
|
+
}
|
|
13841
|
+
listOlUlElements = listOlUlElements.concat(Array.from(range.commonAncestorContainer.querySelectorAll('ol, ul')));
|
|
13842
|
+
}
|
|
13843
|
+
else {
|
|
13844
|
+
listOlUlElements = Array.from(range.commonAncestorContainer.querySelectorAll('ol, ul'));
|
|
13845
|
+
}
|
|
13846
|
+
for (var k = 0; k < listOlUlElements.length; k++) {
|
|
13847
|
+
var listStyle = void 0;
|
|
13848
|
+
var listElements = listOlUlElements[k];
|
|
13849
|
+
while (listElements) {
|
|
13850
|
+
if (listElements.nodeName === 'OL' || listElements.nodeName === 'OL') {
|
|
13851
|
+
if (listElements.style.listStyleType !== '' && listElements.style.listStyleType !== 'none' && listElements.nodeName !== 'LI') {
|
|
13852
|
+
listStyle = listElements.style.listStyleType;
|
|
13853
|
+
}
|
|
13854
|
+
else if (!isNullOrUndefined(listStyle) && (listElements.style.listStyleType === '' || listElements.style.listStyleType === 'none') &&
|
|
13855
|
+
listElements.nodeName !== 'LI' && (listElements.nodeName === 'UL' || listElements.nodeName === 'OL')) {
|
|
13856
|
+
listElements.style.listStyleType = listStyle;
|
|
13857
|
+
}
|
|
13858
|
+
}
|
|
13859
|
+
listElements = listElements.querySelector('UL,OL');
|
|
13860
|
+
}
|
|
13861
|
+
}
|
|
13739
13862
|
}
|
|
13740
13863
|
};
|
|
13741
13864
|
Lists.prototype.findUnSelected = function (temp, elements) {
|
|
@@ -13838,7 +13961,7 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
13838
13961
|
parentNode.removeAttribute("style");
|
|
13839
13962
|
}
|
|
13840
13963
|
}
|
|
13841
|
-
var wrapper = '<' +
|
|
13964
|
+
var wrapper = '<' + e.enterAction + wrapperclass + this.domNode.attributes(element) + '></' + e.enterAction + '>';
|
|
13842
13965
|
if (e.enterAction !== 'BR') {
|
|
13843
13966
|
this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
|
|
13844
13967
|
}
|
|
@@ -13912,48 +14035,6 @@ var Lists = /** @__PURE__ @class */ (function () {
|
|
|
13912
14035
|
Lists.prototype.closeTag = function (type) {
|
|
13913
14036
|
return this.domNode.parseHTMLFragment('<span class="e-rte-list-close-' + type.toLowerCase() + '"></span>');
|
|
13914
14037
|
};
|
|
13915
|
-
Lists.prototype.gatherElementsAround = function (node) {
|
|
13916
|
-
var pWrap = document.createElement('p');
|
|
13917
|
-
// Insert the new div before the current node
|
|
13918
|
-
var currentNode = node.previousSibling;
|
|
13919
|
-
var classNode = node.parentNode;
|
|
13920
|
-
if (classNode.className === 'e-editor-select-start') {
|
|
13921
|
-
node.parentNode.parentNode.insertBefore(pWrap, node.parentNode);
|
|
13922
|
-
}
|
|
13923
|
-
else if (node.parentNode) {
|
|
13924
|
-
node.parentNode.insertBefore(pWrap, node);
|
|
13925
|
-
}
|
|
13926
|
-
// Gather text and inline elements before the currentNode
|
|
13927
|
-
var i = 0;
|
|
13928
|
-
while (currentNode !== null && currentNode.nodeName !== 'BR' &&
|
|
13929
|
-
!this.parent.domNode.isBlockNode(currentNode)) {
|
|
13930
|
-
var prevSibling = currentNode.previousSibling;
|
|
13931
|
-
if (currentNode.nodeType === 3 || currentNode.nodeType === 1) {
|
|
13932
|
-
if (i === 0) {
|
|
13933
|
-
pWrap.appendChild(currentNode);
|
|
13934
|
-
}
|
|
13935
|
-
else {
|
|
13936
|
-
pWrap.insertBefore(currentNode, pWrap.firstChild);
|
|
13937
|
-
}
|
|
13938
|
-
}
|
|
13939
|
-
currentNode = prevSibling;
|
|
13940
|
-
i++;
|
|
13941
|
-
}
|
|
13942
|
-
// Add the current node to the new p
|
|
13943
|
-
pWrap.appendChild(node);
|
|
13944
|
-
// Gather text and inline elements after the currentNode
|
|
13945
|
-
currentNode = pWrap.nextSibling ? pWrap.nextSibling : pWrap.parentElement.nextSibling;
|
|
13946
|
-
while (currentNode !== null && currentNode.nodeName !== 'BR' &&
|
|
13947
|
-
!this.parent.domNode.isBlockNode(currentNode)) {
|
|
13948
|
-
var nextSibling = currentNode.nextSibling ?
|
|
13949
|
-
currentNode.nextSibling : currentNode.parentElement.nextSibling;
|
|
13950
|
-
if (currentNode.nodeType === 3 || currentNode.nodeType === 1) {
|
|
13951
|
-
pWrap.appendChild(currentNode);
|
|
13952
|
-
}
|
|
13953
|
-
currentNode = nextSibling;
|
|
13954
|
-
}
|
|
13955
|
-
return pWrap;
|
|
13956
|
-
};
|
|
13957
14038
|
return Lists;
|
|
13958
14039
|
}());
|
|
13959
14040
|
|
|
@@ -14293,7 +14374,7 @@ var Formats = /** @__PURE__ @class */ (function () {
|
|
|
14293
14374
|
}
|
|
14294
14375
|
}
|
|
14295
14376
|
}
|
|
14296
|
-
if (e.enterAction !== 'BR' && !isNullOrUndefined(range.startContainer) && !isNullOrUndefined(range.startContainer.parentElement) && range.startContainer === range.endContainer && range.startContainer.nodeName === '#text' && range.startContainer.parentElement.classList.contains(
|
|
14377
|
+
if (e.enterAction !== 'BR' && !isNullOrUndefined(range.startContainer) && !isNullOrUndefined(range.startContainer.parentElement) && range.startContainer === range.endContainer && range.startContainer.nodeName === '#text' && range.startContainer.parentElement.classList.contains('e-content') && range.startContainer.parentElement.isContentEditable) {
|
|
14297
14378
|
var pTag = createElement(e.enterAction);
|
|
14298
14379
|
range.startContainer.parentElement.insertBefore(pTag, range.startContainer);
|
|
14299
14380
|
pTag.appendChild(range.startContainer);
|
|
@@ -15640,6 +15721,9 @@ var Alignments = /** @__PURE__ @class */ (function () {
|
|
|
15640
15721
|
if (!isTableAlign) {
|
|
15641
15722
|
this.parent.domNode.setMarker(save);
|
|
15642
15723
|
var alignmentNodes = this.parent.domNode.blockNodes();
|
|
15724
|
+
if (e.enterAction === 'BR') {
|
|
15725
|
+
alignmentNodes = this.parent.domNode.convertToBlockNodes(alignmentNodes, false);
|
|
15726
|
+
}
|
|
15643
15727
|
for (var i = 0; i < alignmentNodes.length; i++) {
|
|
15644
15728
|
var parentNode = alignmentNodes[i];
|
|
15645
15729
|
setStyleAttribute(parentNode, { 'text-align': this.alignments[e.subCommand] });
|
|
@@ -15723,6 +15807,9 @@ var Indents = /** @__PURE__ @class */ (function () {
|
|
|
15723
15807
|
var save = this.parent.nodeSelection.save(range, this.parent.currentDocument);
|
|
15724
15808
|
this.parent.domNode.setMarker(save);
|
|
15725
15809
|
var indentsNodes = this.parent.domNode.blockNodes();
|
|
15810
|
+
if (e.enterAction === 'BR') {
|
|
15811
|
+
indentsNodes = this.parent.domNode.convertToBlockNodes(indentsNodes, false);
|
|
15812
|
+
}
|
|
15726
15813
|
var parentNodes = indentsNodes.slice();
|
|
15727
15814
|
var listsNodes = [];
|
|
15728
15815
|
for (var i = 0; i < parentNodes.length; i++) {
|
|
@@ -20025,7 +20112,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
20025
20112
|
!isNormalList) {
|
|
20026
20113
|
prevList = null;
|
|
20027
20114
|
}
|
|
20028
|
-
var pElement = createElement('p', { className: '
|
|
20115
|
+
var pElement = createElement('p', { className: 'MsoNoSpacing' });
|
|
20029
20116
|
pElement.innerHTML = collection[index].content.join(' ');
|
|
20030
20117
|
if ((collection[index].nestedLevel === 1) &&
|
|
20031
20118
|
(listCount === 0 || lfo !== collection[index].listFormatOverride) &&
|
|
@@ -21105,12 +21192,14 @@ var EditorManager = /** @__PURE__ @class */ (function () {
|
|
|
21105
21192
|
case 'alignments':
|
|
21106
21193
|
this.observer.notify(ALIGNMENT_TYPE, {
|
|
21107
21194
|
subCommand: value, event: event, callBack: callBack,
|
|
21108
|
-
selector: selector,
|
|
21109
|
-
value: exeValue
|
|
21195
|
+
selector: selector, value: exeValue, enterAction: enterAction
|
|
21110
21196
|
});
|
|
21111
21197
|
break;
|
|
21112
21198
|
case 'indents':
|
|
21113
|
-
this.observer.notify(INDENT_TYPE, {
|
|
21199
|
+
this.observer.notify(INDENT_TYPE, {
|
|
21200
|
+
subCommand: value, event: event, callBack: callBack,
|
|
21201
|
+
selector: selector, enterAction: enterAction
|
|
21202
|
+
});
|
|
21114
21203
|
break;
|
|
21115
21204
|
case 'links':
|
|
21116
21205
|
this.observer.notify(LINK, { command: command, value: value, item: exeValue, event: event, callBack: callBack });
|
|
@@ -21991,25 +22080,54 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
21991
22080
|
this.deleteCleanup(e, currentRange);
|
|
21992
22081
|
}
|
|
21993
22082
|
if (args.keyCode === 9 && this.parent.enableTabKey) {
|
|
22083
|
+
this.parent.formatter.saveData(e);
|
|
21994
22084
|
if (!isNullOrUndefined(args.target) && isNullOrUndefined(closest(args.target, '.e-rte-toolbar'))) {
|
|
21995
22085
|
var range = this.nodeSelectionObj.getRange(this.contentRenderer.getDocument());
|
|
21996
22086
|
var parentNode = this.nodeSelectionObj.getParentNodeCollection(range);
|
|
21997
22087
|
if (!((parentNode[0].nodeName === 'LI' || closest(parentNode[0], 'li') ||
|
|
21998
|
-
closest(parentNode[0], 'table'))
|
|
22088
|
+
closest(parentNode[0], 'table')))) {
|
|
21999
22089
|
args.preventDefault();
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
|
|
22090
|
+
var selection = this.contentRenderer.getDocument().getSelection().getRangeAt(0);
|
|
22091
|
+
var alignmentNodes = this.parent.formatter.editorManager.domNode.blockNodes();
|
|
22092
|
+
if (this.parent.enterKey === 'BR') {
|
|
22093
|
+
if (selection.startOffset !== selection.endOffset && selection.startOffset === 0) {
|
|
22094
|
+
var save = this.nodeSelectionObj.save(range, this.contentRenderer.getDocument());
|
|
22095
|
+
this.parent.formatter.editorManager.domNode.setMarker(save);
|
|
22096
|
+
alignmentNodes = this.parent.formatter.editorManager.domNode.blockNodes();
|
|
22097
|
+
this.parent.formatter.editorManager.domNode.convertToBlockNodes(alignmentNodes, false);
|
|
22098
|
+
this.marginTabAdd(args.shiftKey, alignmentNodes);
|
|
22099
|
+
save = this.parent.formatter.editorManager.domNode.saveMarker(save);
|
|
22100
|
+
save.restore();
|
|
22101
|
+
}
|
|
22102
|
+
else {
|
|
22103
|
+
InsertHtml.Insert(this.contentRenderer.getDocument(), ' ');
|
|
22104
|
+
this.rangeCollection.push(this.nodeSelectionObj.getRange(this.contentRenderer.getDocument()));
|
|
22105
|
+
}
|
|
22003
22106
|
}
|
|
22004
|
-
else
|
|
22005
|
-
|
|
22006
|
-
|
|
22007
|
-
|
|
22008
|
-
|
|
22009
|
-
|
|
22107
|
+
else {
|
|
22108
|
+
if (!args.shiftKey) {
|
|
22109
|
+
if (selection.startOffset !== selection.endOffset && selection.startOffset === 0) {
|
|
22110
|
+
this.marginTabAdd(args.shiftKey, alignmentNodes);
|
|
22111
|
+
}
|
|
22112
|
+
else {
|
|
22113
|
+
InsertHtml.Insert(this.contentRenderer.getDocument(), ' ');
|
|
22114
|
+
this.rangeCollection.push(this.nodeSelectionObj.getRange(this.contentRenderer.getDocument()));
|
|
22115
|
+
}
|
|
22116
|
+
}
|
|
22117
|
+
else if (this.rangeCollection.length > 0 &&
|
|
22118
|
+
this.rangeCollection[this.rangeCollection.length - 1].startContainer.textContent.length === 4) {
|
|
22119
|
+
var textCont = this.rangeCollection[this.rangeCollection.length - 1].startContainer;
|
|
22120
|
+
this.nodeSelectionObj.setSelectionText(this.contentRenderer.getDocument(), textCont, textCont, 0, textCont.textContent.length);
|
|
22121
|
+
InsertHtml.Insert(this.contentRenderer.getDocument(), document.createTextNode(''));
|
|
22122
|
+
this.rangeCollection.pop();
|
|
22123
|
+
}
|
|
22124
|
+
else {
|
|
22125
|
+
this.marginTabAdd(args.shiftKey, alignmentNodes);
|
|
22126
|
+
}
|
|
22010
22127
|
}
|
|
22011
22128
|
}
|
|
22012
22129
|
}
|
|
22130
|
+
this.parent.formatter.saveData(e);
|
|
22013
22131
|
}
|
|
22014
22132
|
if (e.args.action === 'space' ||
|
|
22015
22133
|
e.args.action === 'enter' ||
|
|
@@ -22672,6 +22790,30 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
|
|
|
22672
22790
|
HtmlEditor.prototype.getSelectedHtml = function (e) {
|
|
22673
22791
|
e.callBack(this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument()).toString());
|
|
22674
22792
|
};
|
|
22793
|
+
HtmlEditor.prototype.marginTabAdd = function (val, alignmentNodes) {
|
|
22794
|
+
for (var index = 0; index < alignmentNodes.length; index++) {
|
|
22795
|
+
var element = alignmentNodes[index];
|
|
22796
|
+
if (element.closest('li')) {
|
|
22797
|
+
continue;
|
|
22798
|
+
}
|
|
22799
|
+
if (element.style.marginLeft) {
|
|
22800
|
+
var count$$1 = parseInt(element.style.marginLeft, 10);
|
|
22801
|
+
if (val) {
|
|
22802
|
+
count$$1 -= 20;
|
|
22803
|
+
}
|
|
22804
|
+
else {
|
|
22805
|
+
count$$1 += 20;
|
|
22806
|
+
}
|
|
22807
|
+
element.style.marginLeft = count$$1.toString() + 'px';
|
|
22808
|
+
if (element.style.marginLeft === '0px') {
|
|
22809
|
+
element.removeAttribute('style');
|
|
22810
|
+
}
|
|
22811
|
+
}
|
|
22812
|
+
else if (!val) {
|
|
22813
|
+
element.style.marginLeft = '20px';
|
|
22814
|
+
}
|
|
22815
|
+
}
|
|
22816
|
+
};
|
|
22675
22817
|
return HtmlEditor;
|
|
22676
22818
|
}());
|
|
22677
22819
|
|
|
@@ -23332,7 +23474,8 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
23332
23474
|
clipBoardElem = this.allowedStyle(clipBoardElem);
|
|
23333
23475
|
}
|
|
23334
23476
|
this.saveSelection.restore();
|
|
23335
|
-
|
|
23477
|
+
var newText = clipBoardElem.innerHTML.split("&").join("&");
|
|
23478
|
+
clipBoardElem.innerHTML = this.sanitizeHelper(newText);
|
|
23336
23479
|
var allImg = clipBoardElem.querySelectorAll('img');
|
|
23337
23480
|
for (var i = 0; i < allImg.length; i++) {
|
|
23338
23481
|
if (!isNullOrUndefined(allImg[i].getAttribute('src'))) {
|
|
@@ -24253,9 +24396,6 @@ var FullScreen = /** @__PURE__ @class */ (function () {
|
|
|
24253
24396
|
&& !isNullOrUndefined(this.parent.quickToolbarModule)) {
|
|
24254
24397
|
this.parent.quickToolbarModule.hideQuickToolbars();
|
|
24255
24398
|
}
|
|
24256
|
-
if (this.parent.showTooltip && !isNullOrUndefined(document.querySelector('.e-tooltip-wrap'))) {
|
|
24257
|
-
this.parent.notify(destroyTooltip, { args: event });
|
|
24258
|
-
}
|
|
24259
24399
|
this.scrollableParent = getScrollableParent(this.parent.element);
|
|
24260
24400
|
if (!this.parent.element.classList.contains(CLS_FULL_SCREEN)) {
|
|
24261
24401
|
var evenArgs = {
|
|
@@ -24308,9 +24448,6 @@ var FullScreen = /** @__PURE__ @class */ (function () {
|
|
|
24308
24448
|
&& !isNullOrUndefined(this.parent.quickToolbarModule)) {
|
|
24309
24449
|
this.parent.quickToolbarModule.hideQuickToolbars();
|
|
24310
24450
|
}
|
|
24311
|
-
if (this.parent.showTooltip && !isNullOrUndefined(document.querySelector('.e-tooltip-wrap'))) {
|
|
24312
|
-
this.parent.notify(destroyTooltip, { args: event });
|
|
24313
|
-
}
|
|
24314
24451
|
if (this.parent.element.classList.contains(CLS_FULL_SCREEN)) {
|
|
24315
24452
|
var evenArgs = {
|
|
24316
24453
|
cancel: false,
|
|
@@ -26723,13 +26860,13 @@ var Image$1 = /** @__PURE__ @class */ (function () {
|
|
|
26723
26860
|
selectParentEle = this.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
|
|
26724
26861
|
if (!originalEvent.ctrlKey && originalEvent.key && (originalEvent.key.length === 1 || originalEvent.action === 'enter') &&
|
|
26725
26862
|
(!isNullOrUndefined(selectParentEle[0]) && selectParentEle[0].tagName === 'IMG') && selectParentEle[0].parentElement) {
|
|
26726
|
-
var prev = selectParentEle[0].parentElement.childNodes[0];
|
|
26727
26863
|
if (this.contentModule.getEditPanel().querySelector('.e-img-resize')) {
|
|
26728
26864
|
this.removeResizeEle();
|
|
26729
26865
|
}
|
|
26730
|
-
this.parent.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), prev, prev, prev.textContent.length, prev.textContent.length);
|
|
26731
26866
|
removeClass([selectParentEle[0]], 'e-img-focus');
|
|
26732
|
-
this.quickToolObj.imageQTBar
|
|
26867
|
+
if (this.quickToolObj && this.quickToolObj.imageQTBar) {
|
|
26868
|
+
this.quickToolObj.imageQTBar.hidePopup();
|
|
26869
|
+
}
|
|
26733
26870
|
}
|
|
26734
26871
|
}
|
|
26735
26872
|
if (originalEvent.ctrlKey && (originalEvent.keyCode === 89 || originalEvent.keyCode === 90)) {
|
|
@@ -33690,16 +33827,18 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
33690
33827
|
this.getRangeNode();
|
|
33691
33828
|
var isTableEnter = true;
|
|
33692
33829
|
this.formatTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote'];
|
|
33693
|
-
var
|
|
33694
|
-
|
|
33695
|
-
|
|
33696
|
-
|
|
33697
|
-
|
|
33698
|
-
|
|
33699
|
-
|
|
33700
|
-
if (
|
|
33701
|
-
this.
|
|
33702
|
-
|
|
33830
|
+
var tableImagCursor = this.processedTableImageCursor();
|
|
33831
|
+
if (tableImagCursor.start || tableImagCursor.end) {
|
|
33832
|
+
if (tableImagCursor.startName === 'TABLE' || tableImagCursor.endName === 'TABLE') { // Default browser action prevented and hanled manually.
|
|
33833
|
+
this.handleCursorAtTableSide(e, tableImagCursor.start, tableImagCursor.end);
|
|
33834
|
+
return;
|
|
33835
|
+
}
|
|
33836
|
+
}
|
|
33837
|
+
if (tableImagCursor.start || tableImagCursor.end || this.range.startContainer.nodeName === 'IMG') {
|
|
33838
|
+
if (this.parent.enterKey === 'BR' && (tableImagCursor.startName === 'IMG' || tableImagCursor.endName === 'IMG' || this.range.startContainer.nodeName === 'IMG')) { // Default browser action prevented and hanled manually.
|
|
33839
|
+
this.handleEnterKeyAtImageSide(e, tableImagCursor.start, tableImagCursor.end);
|
|
33840
|
+
return;
|
|
33841
|
+
}
|
|
33703
33842
|
}
|
|
33704
33843
|
if (!isNullOrUndefined(this.startNode.closest('TABLE')) && !isNullOrUndefined(this.endNode.closest('TABLE'))) {
|
|
33705
33844
|
isTableEnter = false;
|
|
@@ -34067,7 +34206,6 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
34067
34206
|
var outerBRElem = _this.parent.createElement('br');
|
|
34068
34207
|
if (_this.range.startOffset === 0 && _this.range.endOffset === 0 &&
|
|
34069
34208
|
!isNullOrUndefined(currentParent.previousSibling) && currentParent.previousSibling.nodeName === 'BR' && currentParent.nodeName !== 'P' && currentParent.nodeName !== 'DIV') {
|
|
34070
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
34071
34209
|
newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, false).cloneNode(true);
|
|
34072
34210
|
_this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
|
|
34073
34211
|
_this.insertFocusContent();
|
|
@@ -34097,7 +34235,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
34097
34235
|
}
|
|
34098
34236
|
e.args.preventDefault();
|
|
34099
34237
|
}
|
|
34100
|
-
_this.
|
|
34238
|
+
_this.triggerActionComplete(e, shiftKey_1);
|
|
34101
34239
|
}
|
|
34102
34240
|
});
|
|
34103
34241
|
}
|
|
@@ -34167,6 +34305,9 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
34167
34305
|
}
|
|
34168
34306
|
return insertElem;
|
|
34169
34307
|
};
|
|
34308
|
+
EnterKeyAction.prototype.triggerActionComplete = function (e, shiftKey) {
|
|
34309
|
+
this.parent.trigger(actionComplete, { requestType: shiftKey ? 'ShiftEnterAction' : 'EnterAction', args: e.args });
|
|
34310
|
+
};
|
|
34170
34311
|
EnterKeyAction.prototype.handleCursorAtTableSide = function (e, isStart, isEnd) {
|
|
34171
34312
|
var _this = this;
|
|
34172
34313
|
if (this.parent.enterKey !== 'BR') {
|
|
@@ -34197,11 +34338,92 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
34197
34338
|
}
|
|
34198
34339
|
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElement, 0);
|
|
34199
34340
|
e.args.preventDefault();
|
|
34200
|
-
_this.
|
|
34341
|
+
_this.triggerActionComplete(e, shiftKey_2);
|
|
34201
34342
|
}
|
|
34202
34343
|
});
|
|
34203
34344
|
}
|
|
34204
34345
|
};
|
|
34346
|
+
EnterKeyAction.prototype.handleEnterKeyAtImageSide = function (e, isStart, isEnd) {
|
|
34347
|
+
var _this = this;
|
|
34348
|
+
var actionBeginArgs = {
|
|
34349
|
+
cancel: false,
|
|
34350
|
+
name: actionBegin,
|
|
34351
|
+
requestType: e.args.shiftKey ? 'ShiftEnterAction' : 'EnterAction',
|
|
34352
|
+
originalEvent: e.args
|
|
34353
|
+
};
|
|
34354
|
+
var directRange = false;
|
|
34355
|
+
if (this.range.startContainer.nodeName === 'IMG' && this.range.startOffset === 0) {
|
|
34356
|
+
directRange = true;
|
|
34357
|
+
}
|
|
34358
|
+
this.parent.trigger(actionBegin, actionBeginArgs, function (actionBeginArgs) {
|
|
34359
|
+
if (!actionBeginArgs.cancel) {
|
|
34360
|
+
if (_this.parent.enterKey === 'BR') {
|
|
34361
|
+
var newElement = _this.parent.createElement('BR');
|
|
34362
|
+
var imageElement = void 0;
|
|
34363
|
+
if (directRange) {
|
|
34364
|
+
imageElement = _this.range.startContainer;
|
|
34365
|
+
imageElement.parentElement.insertBefore(newElement, imageElement);
|
|
34366
|
+
_this.parent.formatter.editorManager.nodeSelection.
|
|
34367
|
+
setCursorPoint(_this.parent.contentModule.getDocument(), imageElement, 0);
|
|
34368
|
+
}
|
|
34369
|
+
if (isStart) {
|
|
34370
|
+
imageElement = _this.range.startContainer.childNodes[_this.range.startOffset];
|
|
34371
|
+
imageElement.parentElement.insertBefore(newElement, imageElement);
|
|
34372
|
+
_this.parent.formatter.editorManager.nodeSelection.
|
|
34373
|
+
setCursorPoint(_this.parent.contentModule.getDocument(), imageElement, 0);
|
|
34374
|
+
}
|
|
34375
|
+
if (isEnd) {
|
|
34376
|
+
imageElement = _this.range.startContainer.childNodes[_this.range.startOffset - 1];
|
|
34377
|
+
if (!isNullOrUndefined(imageElement.nextSibling)) {
|
|
34378
|
+
imageElement.parentElement.insertBefore(newElement, imageElement.nextSibling);
|
|
34379
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElement.nextSibling, 0);
|
|
34380
|
+
}
|
|
34381
|
+
else if (isNullOrUndefined(imageElement.nextSibling)) {
|
|
34382
|
+
imageElement.parentElement.appendChild(newElement);
|
|
34383
|
+
var brElement = _this.parent.createElement('BR');
|
|
34384
|
+
imageElement.parentElement.appendChild(brElement);
|
|
34385
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), brElement, 0);
|
|
34386
|
+
}
|
|
34387
|
+
}
|
|
34388
|
+
e.args.preventDefault();
|
|
34389
|
+
_this.triggerActionComplete(e, e.args.shiftKey);
|
|
34390
|
+
}
|
|
34391
|
+
}
|
|
34392
|
+
});
|
|
34393
|
+
};
|
|
34394
|
+
EnterKeyAction.prototype.isTableOrImageStart = function () {
|
|
34395
|
+
var customHandlerElements = ['IMG', 'TABLE'];
|
|
34396
|
+
var startContainer = this.range.startContainer;
|
|
34397
|
+
var startOffset = this.range.startOffset;
|
|
34398
|
+
var isCursorAtStart = this.range.collapsed && (startContainer.nodeType === 1) &&
|
|
34399
|
+
startContainer.isContentEditable && startContainer.childNodes[startOffset] &&
|
|
34400
|
+
(customHandlerElements.indexOf(startContainer.childNodes[startOffset].nodeName) > -1);
|
|
34401
|
+
if (isCursorAtStart) {
|
|
34402
|
+
return { start: isCursorAtStart, startNodeName: startContainer.childNodes[startOffset].nodeName };
|
|
34403
|
+
}
|
|
34404
|
+
else {
|
|
34405
|
+
return { start: false, startNodeName: '' };
|
|
34406
|
+
}
|
|
34407
|
+
};
|
|
34408
|
+
EnterKeyAction.prototype.isTableOrImageEnd = function () {
|
|
34409
|
+
var customHandlerElements = ['IMG', 'TABLE'];
|
|
34410
|
+
var startContainer = this.range.startContainer;
|
|
34411
|
+
var startOffset = this.range.startOffset;
|
|
34412
|
+
var isCursorAtEnd = this.range.collapsed && (startContainer.nodeType === 1) &&
|
|
34413
|
+
startContainer.isContentEditable && startContainer.childNodes[startOffset - 1] &&
|
|
34414
|
+
(customHandlerElements.indexOf(startContainer.childNodes[startOffset - 1].nodeName) > -1);
|
|
34415
|
+
if (isCursorAtEnd) {
|
|
34416
|
+
return { end: isCursorAtEnd, endNodeName: startContainer.childNodes[startOffset - 1].nodeName };
|
|
34417
|
+
}
|
|
34418
|
+
else {
|
|
34419
|
+
return { end: false, endNodeName: '' };
|
|
34420
|
+
}
|
|
34421
|
+
};
|
|
34422
|
+
EnterKeyAction.prototype.processedTableImageCursor = function () {
|
|
34423
|
+
var _a = this.isTableOrImageStart(), start = _a.start, startNodeName = _a.startNodeName;
|
|
34424
|
+
var _b = this.isTableOrImageEnd(), end = _b.end, endNodeName = _b.endNodeName;
|
|
34425
|
+
return { start: start, startName: startNodeName, end: end, endName: endNodeName };
|
|
34426
|
+
};
|
|
34205
34427
|
return EnterKeyAction;
|
|
34206
34428
|
}());
|
|
34207
34429
|
|
|
@@ -35603,7 +35825,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
35603
35825
|
}
|
|
35604
35826
|
};
|
|
35605
35827
|
RichTextEditor.prototype.updatePanelValue = function () {
|
|
35606
|
-
var value = this.value;
|
|
35828
|
+
var value = this.listOrderCorrection(this.value);
|
|
35607
35829
|
value = (this.enableHtmlEncode && this.value) ? decode(value) : value;
|
|
35608
35830
|
var getTextArea = this.element.querySelector('.' + CLS_RTE_SOURCE_CODE_TXTAREA);
|
|
35609
35831
|
if (value) {
|
|
@@ -35647,6 +35869,17 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
35647
35869
|
this.countModule.refresh();
|
|
35648
35870
|
}
|
|
35649
35871
|
};
|
|
35872
|
+
RichTextEditor.prototype.listOrderCorrection = function (value) {
|
|
35873
|
+
var valueElementWrapper = this.createElement('div');
|
|
35874
|
+
valueElementWrapper.innerHTML = value;
|
|
35875
|
+
var listElements = valueElementWrapper.querySelectorAll('UL, OL');
|
|
35876
|
+
for (var i = 0; i < listElements.length; i++) {
|
|
35877
|
+
if (!isNullOrUndefined(listElements[i]) && !isNullOrUndefined(listElements[i].parentElement) && !isNullOrUndefined(listElements[i].previousElementSibling) && (listElements[i].parentElement.nodeName === 'UL' || listElements[i].parentElement.nodeName === 'OL')) {
|
|
35878
|
+
listElements[i].previousElementSibling.appendChild(listElements[i]);
|
|
35879
|
+
}
|
|
35880
|
+
}
|
|
35881
|
+
return valueElementWrapper.innerHTML;
|
|
35882
|
+
};
|
|
35650
35883
|
RichTextEditor.prototype.setHeight = function (height) {
|
|
35651
35884
|
if (height !== 'auto') {
|
|
35652
35885
|
this.element.style.height = formatUnit(height);
|