@syncfusion/ej2-richtexteditor 20.4.52 → 20.4.53
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 +18 -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 +124 -43
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +124 -43
- 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/common/util.d.ts +1 -1
- package/src/common/util.js +14 -6
- package/src/editor-manager/base/editor-manager.js +1 -1
- package/src/editor-manager/plugin/inserthtml-exec.js +1 -1
- package/src/editor-manager/plugin/inserthtml.d.ts +1 -1
- package/src/editor-manager/plugin/inserthtml.js +14 -8
- package/src/editor-manager/plugin/ms-word-clean-up.js +54 -16
- package/src/rich-text-editor/actions/enter-key.js +18 -6
- package/src/rich-text-editor/actions/paste-clean-up.js +2 -2
- package/src/rich-text-editor/actions/quick-toolbar.js +8 -1
- package/src/rich-text-editor/actions/toolbar.js +5 -0
- package/src/rich-text-editor/base/rich-text-editor.js +7 -2
- package/GitLeaksReport.json +0 -1
- package/gitleaks-ci/gitleaks +0 -0
- package/gitleaks-ci.tar.gz +0 -0
|
@@ -5007,6 +5007,11 @@ var Toolbar$2 = /** @__PURE__ @class */ (function () {
|
|
|
5007
5007
|
Toolbar$$1.prototype.toolbarClickHandler = function (e) {
|
|
5008
5008
|
var trg = closest(e.originalEvent.target, '.e-hor-nav');
|
|
5009
5009
|
if (trg && this.parent.toolbarSettings.type === ToolbarType.Expand && !isNullOrUndefined(trg)) {
|
|
5010
|
+
var extendedTbar = this.tbElement.querySelector('.e-toolbar-extended');
|
|
5011
|
+
if (!isNullOrUndefined(extendedTbar)) {
|
|
5012
|
+
setStyleAttribute(extendedTbar, { maxHeight: '', display: 'block' });
|
|
5013
|
+
setStyleAttribute(extendedTbar, { maxHeight: extendedTbar.offsetHeight + 'px', display: '' });
|
|
5014
|
+
}
|
|
5010
5015
|
if (!trg.classList.contains('e-nav-active')) {
|
|
5011
5016
|
removeClass([this.tbElement], [CLS_EXPAND_OPEN]);
|
|
5012
5017
|
this.parent.setContentHeight('toolbar', false);
|
|
@@ -6343,10 +6348,17 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
|
|
|
6343
6348
|
};
|
|
6344
6349
|
QuickToolbar.prototype.keyUpHandler = function (e) {
|
|
6345
6350
|
if (this.parent.inlineMode.enable && !Browser.isDevice) {
|
|
6351
|
+
var args = e.args;
|
|
6346
6352
|
if (this.parent.inlineMode.onSelection) {
|
|
6353
|
+
if (this.parent.getSelection().length > 0) {
|
|
6354
|
+
if ((args.ctrlKey && args.keyCode === 65) || (args.shiftKey && (args.keyCode === 33 || args.keyCode === 34 ||
|
|
6355
|
+
args.keyCode === 35 || args.keyCode === 36 || args.keyCode === 37 || args.keyCode === 38 ||
|
|
6356
|
+
args.keyCode === 39 || args.keyCode === 40))) {
|
|
6357
|
+
this.showInlineQTBar(this.offsetX, this.offsetY, args.target);
|
|
6358
|
+
}
|
|
6359
|
+
}
|
|
6347
6360
|
return;
|
|
6348
6361
|
}
|
|
6349
|
-
var args = e.args;
|
|
6350
6362
|
this.deBounce(this.offsetX, this.offsetY, args.target);
|
|
6351
6363
|
}
|
|
6352
6364
|
};
|
|
@@ -7006,7 +7018,7 @@ function setEditFrameFocus(editableElement, selector) {
|
|
|
7006
7018
|
* @returns {void}
|
|
7007
7019
|
* @hidden
|
|
7008
7020
|
*/
|
|
7009
|
-
function updateTextNode$1(value) {
|
|
7021
|
+
function updateTextNode$1(value, enterAction) {
|
|
7010
7022
|
var tempNode = document.createElement('div');
|
|
7011
7023
|
tempNode.innerHTML = value;
|
|
7012
7024
|
tempNode.setAttribute('class', 'tempDiv');
|
|
@@ -7021,15 +7033,23 @@ function updateTextNode$1(value) {
|
|
|
7021
7033
|
(tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
|
|
7022
7034
|
inlineNode$1.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
|
|
7023
7035
|
if (!isPreviousInlineElem) {
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7036
|
+
if (enterAction === 'BR') {
|
|
7037
|
+
resultElm.appendChild(tempNode.firstChild);
|
|
7038
|
+
previousParent = resultElm;
|
|
7039
|
+
}
|
|
7040
|
+
else {
|
|
7041
|
+
paraElm = createElement('p');
|
|
7042
|
+
resultElm.appendChild(paraElm);
|
|
7043
|
+
paraElm.appendChild(tempNode.firstChild);
|
|
7044
|
+
previousParent = paraElm;
|
|
7045
|
+
isPreviousInlineElem = true;
|
|
7046
|
+
}
|
|
7027
7047
|
}
|
|
7028
7048
|
else {
|
|
7029
7049
|
previousParent.appendChild(tempNode.firstChild);
|
|
7050
|
+
previousParent = paraElm;
|
|
7051
|
+
isPreviousInlineElem = true;
|
|
7030
7052
|
}
|
|
7031
|
-
previousParent = paraElm;
|
|
7032
|
-
isPreviousInlineElem = true;
|
|
7033
7053
|
}
|
|
7034
7054
|
else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
|
|
7035
7055
|
(tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
|
|
@@ -12719,7 +12739,7 @@ var Formats = /** @__PURE__ @class */ (function () {
|
|
|
12719
12739
|
var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
12720
12740
|
function InsertHtml() {
|
|
12721
12741
|
}
|
|
12722
|
-
InsertHtml.Insert = function (docElement, insertNode, editNode, isExternal) {
|
|
12742
|
+
InsertHtml.Insert = function (docElement, insertNode, editNode, isExternal, enterAction) {
|
|
12723
12743
|
var node;
|
|
12724
12744
|
if (typeof insertNode === 'string') {
|
|
12725
12745
|
var divNode = document.createElement('div');
|
|
@@ -12741,7 +12761,8 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
12741
12761
|
var nodeCutter = new NodeCutter();
|
|
12742
12762
|
var range = nodeSelection.getRange(docElement);
|
|
12743
12763
|
if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
|
|
12744
|
-
range.startOffset === range.endOffset && editNode.textContent.length === 0 &&
|
|
12764
|
+
range.startOffset === range.endOffset && editNode.textContent.length === 0 &&
|
|
12765
|
+
(editNode.children[0].tagName === 'P' || (editNode.children[0].tagName === 'BR'))) {
|
|
12745
12766
|
nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
|
|
12746
12767
|
range = nodeSelection.getRange(docElement);
|
|
12747
12768
|
}
|
|
@@ -12758,7 +12779,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
12758
12779
|
var closestParentNode = (node.nodeName.toLowerCase() === 'table') ? this.closestEle(nodes[0].parentNode, editNode) : nodes[0];
|
|
12759
12780
|
if (isExternal || (!isNullOrUndefined(node) && !isNullOrUndefined(node.classList) &&
|
|
12760
12781
|
node.classList.contains('pasteContent'))) {
|
|
12761
|
-
this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode);
|
|
12782
|
+
this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction);
|
|
12762
12783
|
return;
|
|
12763
12784
|
}
|
|
12764
12785
|
if (editNode !== range.startContainer && ((!isCollapsed && !(closestParentNode.nodeType === Node.ELEMENT_NODE &&
|
|
@@ -12872,7 +12893,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
12872
12893
|
}
|
|
12873
12894
|
}
|
|
12874
12895
|
};
|
|
12875
|
-
InsertHtml.pasteInsertHTML = function (nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode) {
|
|
12896
|
+
InsertHtml.pasteInsertHTML = function (nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
|
|
12876
12897
|
var isCursor = range.startOffset === range.endOffset &&
|
|
12877
12898
|
range.startContainer === range.endContainer;
|
|
12878
12899
|
if (isCursor && range.startContainer === editNode && editNode.textContent === '') {
|
|
@@ -12982,7 +13003,12 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
12982
13003
|
var firstParaElm = createElement('p');
|
|
12983
13004
|
node.parentElement.insertBefore(firstParaElm, node);
|
|
12984
13005
|
}
|
|
12985
|
-
node.previousElementSibling.
|
|
13006
|
+
if (node.previousElementSibling.nodeName === 'BR') {
|
|
13007
|
+
node.parentElement.insertBefore(node.firstChild, node);
|
|
13008
|
+
}
|
|
13009
|
+
else {
|
|
13010
|
+
node.previousElementSibling.appendChild(node.firstChild);
|
|
13011
|
+
}
|
|
12986
13012
|
}
|
|
12987
13013
|
else {
|
|
12988
13014
|
lastSelectionNode = node.firstChild;
|
|
@@ -13014,7 +13040,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
13014
13040
|
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
13015
13041
|
}
|
|
13016
13042
|
else {
|
|
13017
|
-
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
13043
|
+
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
|
|
13018
13044
|
}
|
|
13019
13045
|
};
|
|
13020
13046
|
InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
@@ -13129,9 +13155,9 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
|
|
|
13129
13155
|
}
|
|
13130
13156
|
}
|
|
13131
13157
|
};
|
|
13132
|
-
InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
13158
|
+
InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction) {
|
|
13133
13159
|
lastSelectionNode.classList.add('lastNode');
|
|
13134
|
-
editNode.innerHTML = updateTextNode$1(editNode.innerHTML);
|
|
13160
|
+
editNode.innerHTML = updateTextNode$1(editNode.innerHTML, enterAction);
|
|
13135
13161
|
lastSelectionNode = editNode.querySelector('.lastNode');
|
|
13136
13162
|
if (!isNullOrUndefined(lastSelectionNode)) {
|
|
13137
13163
|
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
@@ -16324,7 +16350,7 @@ var InsertHtmlExec = /** @__PURE__ @class */ (function () {
|
|
|
16324
16350
|
this.parent.observer.on(INSERTHTML_TYPE, this.applyHtml, this);
|
|
16325
16351
|
};
|
|
16326
16352
|
InsertHtmlExec.prototype.applyHtml = function (e) {
|
|
16327
|
-
InsertHtml.Insert(this.parent.currentDocument, e.value, this.parent.editableElement, true);
|
|
16353
|
+
InsertHtml.Insert(this.parent.currentDocument, e.value, this.parent.editableElement, true, e.enterAction);
|
|
16328
16354
|
if (e.subCommand === 'pasteCleanup') {
|
|
16329
16355
|
var pastedElements = this.parent.editableElement.querySelectorAll('.pasteContent_RTE');
|
|
16330
16356
|
var allPastedElements = [].slice.call(pastedElements);
|
|
@@ -17222,6 +17248,29 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17222
17248
|
}
|
|
17223
17249
|
fromClass = false;
|
|
17224
17250
|
}
|
|
17251
|
+
var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
|
|
17252
|
+
for (var i = 0; i < listClass.length; i++) {
|
|
17253
|
+
if (keys.indexOf('li.' + listClass[i]) > -1) {
|
|
17254
|
+
var olULElems = elm.querySelectorAll('ol.' + listClass[i] + ', ul.' + listClass[i]);
|
|
17255
|
+
for (var j = 0; j < olULElems.length; j++) {
|
|
17256
|
+
var styleProperty = olULElems[j].getAttribute('style');
|
|
17257
|
+
if (!isNullOrUndefined(styleProperty) && styleProperty.trim() !== '' && olULElems[j].style.marginLeft !== '') {
|
|
17258
|
+
var valueSplit = values[keys.indexOf('li.' + listClass[i])].split(';');
|
|
17259
|
+
for (var k = 0; k < valueSplit.length; k++) {
|
|
17260
|
+
if ('margin-left'.indexOf(valueSplit[k].split(':')[0]) >= 0) {
|
|
17261
|
+
if (!isNullOrUndefined(valueSplit[k].split(':')[1]) &&
|
|
17262
|
+
valueSplit[k].split(':')[1].indexOf('in') >= 0 &&
|
|
17263
|
+
olULElems[j].style.marginLeft.indexOf('in') >= 0) {
|
|
17264
|
+
var classStyle = parseFloat(valueSplit[k].split(':')[1].split('in')[0]);
|
|
17265
|
+
var inlineStyle = parseFloat(olULElems[j].style.marginLeft.split('in')[0]);
|
|
17266
|
+
olULElems[j].style.marginLeft = (inlineStyle - classStyle) + 'in';
|
|
17267
|
+
}
|
|
17268
|
+
}
|
|
17269
|
+
}
|
|
17270
|
+
}
|
|
17271
|
+
}
|
|
17272
|
+
}
|
|
17273
|
+
}
|
|
17225
17274
|
}
|
|
17226
17275
|
};
|
|
17227
17276
|
MsWordPaste.prototype.filterStyles = function (elm, wordPasteStyleConfig) {
|
|
@@ -17342,12 +17391,13 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17342
17391
|
var type = void 0;
|
|
17343
17392
|
var listStyleType = void 0;
|
|
17344
17393
|
var startAttr = void 0;
|
|
17394
|
+
var styleMarginLeft = void 0;
|
|
17345
17395
|
if (!isNullOrUndefined(this.listContents[0])) {
|
|
17346
17396
|
type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
|
|
17347
17397
|
listStyleType = this.getlistStyleType(this.listContents[0], type);
|
|
17348
|
-
if (type === 'ol' && listNodes[i - 1] === null) {
|
|
17398
|
+
if (type === 'ol' && (i === 0 || listNodes[i - 1] === null)) {
|
|
17349
17399
|
var startString = this.listContents[0].split('.')[0];
|
|
17350
|
-
var listTypes = ['A', 'a', 'I', 'i', 'α', '1'];
|
|
17400
|
+
var listTypes = ['A', 'a', 'I', 'i', 'α', '1', '1-']; // Add '1-' for rare list type.
|
|
17351
17401
|
if (listTypes.indexOf(startString) === -1) {
|
|
17352
17402
|
if (listStyleType === 'decimal') {
|
|
17353
17403
|
// Bug in getlistStyleType() list style stype is returned as decimal for nested list with start attribute
|
|
@@ -17355,10 +17405,16 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17355
17405
|
startAttr = parseInt(startString);
|
|
17356
17406
|
}
|
|
17357
17407
|
}
|
|
17358
|
-
else if (listStyleType === 'upper-alpha'
|
|
17359
|
-
startAttr =
|
|
17408
|
+
else if (listStyleType === 'upper-alpha') {
|
|
17409
|
+
startAttr = (startString.split('.')[0].charCodeAt(0) - 64);
|
|
17410
|
+
}
|
|
17411
|
+
else if (listStyleType === 'lower-alpha') {
|
|
17412
|
+
startAttr = (startString.split('.')[0].charCodeAt(0) - 96);
|
|
17360
17413
|
}
|
|
17361
17414
|
}
|
|
17415
|
+
if (listNodes[i].style.marginLeft !== '') {
|
|
17416
|
+
styleMarginLeft = listNodes[i].style.marginLeft;
|
|
17417
|
+
}
|
|
17362
17418
|
}
|
|
17363
17419
|
var tempNode = [];
|
|
17364
17420
|
for (var j = 1; j < this.listContents.length; j++) {
|
|
@@ -17376,7 +17432,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17376
17432
|
}
|
|
17377
17433
|
}
|
|
17378
17434
|
collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
|
|
17379
|
-
listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr });
|
|
17435
|
+
listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft });
|
|
17380
17436
|
}
|
|
17381
17437
|
}
|
|
17382
17438
|
stNode = listNodes.shift();
|
|
@@ -17402,23 +17458,30 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17402
17458
|
};
|
|
17403
17459
|
MsWordPaste.prototype.getlistStyleType = function (listContent, type) {
|
|
17404
17460
|
var currentListClass;
|
|
17461
|
+
var upperRomanNumber = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX',
|
|
17462
|
+
'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX'];
|
|
17463
|
+
var lowerRomanNumber = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix',
|
|
17464
|
+
'x', 'xi', 'xii', 'xiii', 'xiv', 'xv', 'xvi', 'xvii', 'xviii', 'xix', 'xx'];
|
|
17465
|
+
var lowerGreekNumber = ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ',
|
|
17466
|
+
'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
|
|
17405
17467
|
if (type === 'ol') {
|
|
17406
|
-
|
|
17407
|
-
|
|
17408
|
-
|
|
17409
|
-
break;
|
|
17410
|
-
case 'a':
|
|
17411
|
-
currentListClass = 'lower-alpha';
|
|
17412
|
-
break;
|
|
17413
|
-
case 'I':
|
|
17468
|
+
var charCode = listContent.split('.')[0].charCodeAt(0);
|
|
17469
|
+
switch (true) {
|
|
17470
|
+
case upperRomanNumber.indexOf(listContent.split('.')[0]) > -1:
|
|
17414
17471
|
currentListClass = 'upper-roman';
|
|
17415
17472
|
break;
|
|
17416
|
-
case '
|
|
17473
|
+
case lowerRomanNumber.indexOf(listContent.split('.')[0]) > -1:
|
|
17417
17474
|
currentListClass = 'lower-roman';
|
|
17418
17475
|
break;
|
|
17419
|
-
case '
|
|
17476
|
+
case lowerGreekNumber.indexOf(listContent.split('.')[0]) > -1:
|
|
17420
17477
|
currentListClass = 'lower-greek';
|
|
17421
17478
|
break;
|
|
17479
|
+
case (charCode > 64 && charCode < 91):
|
|
17480
|
+
currentListClass = 'upper-alpha';
|
|
17481
|
+
break;
|
|
17482
|
+
case (charCode > 96 && charCode < 123):
|
|
17483
|
+
currentListClass = 'lower-alpha';
|
|
17484
|
+
break;
|
|
17422
17485
|
default:
|
|
17423
17486
|
currentListClass = 'decimal';
|
|
17424
17487
|
break;
|
|
@@ -17450,11 +17513,12 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
|
|
|
17450
17513
|
var pElement = createElement('p');
|
|
17451
17514
|
pElement.innerHTML = collection[index].content.join(' ');
|
|
17452
17515
|
if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
|
|
17453
|
-
root.appendChild(temp = createElement(collection[index].listType));
|
|
17516
|
+
root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
|
|
17454
17517
|
prevList = createElement('li');
|
|
17455
17518
|
prevList.appendChild(pElement);
|
|
17456
17519
|
temp.appendChild(prevList);
|
|
17457
17520
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
17521
|
+
temp.style.marginLeft = collection[index].styleMarginLeft;
|
|
17458
17522
|
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
17459
17523
|
}
|
|
17460
17524
|
else if (collection[index].nestedLevel === pLevel) {
|
|
@@ -17787,7 +17851,7 @@ var EditorManager = /** @__PURE__ @class */ (function () {
|
|
|
17787
17851
|
this.observer.notify(SELECTION_TYPE, { subCommand: value, event: event, callBack: callBack, value: text, selector: selector, enterAction: enterAction });
|
|
17788
17852
|
break;
|
|
17789
17853
|
case 'inserthtml':
|
|
17790
|
-
this.observer.notify(INSERTHTML_TYPE, { subCommand: value, callBack: callBack, value: text });
|
|
17854
|
+
this.observer.notify(INSERTHTML_TYPE, { subCommand: value, callBack: callBack, value: text, enterAction: enterAction });
|
|
17791
17855
|
break;
|
|
17792
17856
|
case 'inserttext':
|
|
17793
17857
|
this.observer.notify(INSERT_TEXT_TYPE, { subCommand: value, callBack: callBack, value: text });
|
|
@@ -20025,7 +20089,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
20025
20089
|
this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, function (returnArgs) {
|
|
20026
20090
|
extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
|
|
20027
20091
|
_this.parent.formatter.onSuccess(_this.parent, args);
|
|
20028
|
-
}, clipBoardElem);
|
|
20092
|
+
}, clipBoardElem, null, null, this.parent.enterKey);
|
|
20029
20093
|
this.removeTempClass();
|
|
20030
20094
|
this.parent.notify(toolbarRefresh, {});
|
|
20031
20095
|
this.imgUploading(this.parent.inputElement);
|
|
@@ -20095,7 +20159,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
|
|
|
20095
20159
|
this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, function (returnArgs) {
|
|
20096
20160
|
extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
|
|
20097
20161
|
_this.parent.formatter.onSuccess(_this.parent, args);
|
|
20098
|
-
}, clipBoardElem);
|
|
20162
|
+
}, clipBoardElem, null, null, this.parent.enterKey);
|
|
20099
20163
|
this.removeTempClass();
|
|
20100
20164
|
}
|
|
20101
20165
|
else {
|
|
@@ -28798,7 +28862,16 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
28798
28862
|
_this.parent.tableModule.removeResizeElement();
|
|
28799
28863
|
}
|
|
28800
28864
|
if (!(_this.parent.inputElement.childNodes.length === 1 && _this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
|
|
28801
|
-
|
|
28865
|
+
if (isNullOrUndefined(_this.range.startContainer.childNodes[_this.range.startOffset])) {
|
|
28866
|
+
var currentLastElem = _this.range.startContainer.childNodes[_this.range.startOffset - 1];
|
|
28867
|
+
while (currentLastElem.lastChild !== null && currentLastElem.nodeName !== '#text') {
|
|
28868
|
+
currentLastElem = currentLastElem.lastChild;
|
|
28869
|
+
}
|
|
28870
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentLastElem, (currentLastElem.nodeName === 'BR' ? 0 : currentLastElem.textContent.length));
|
|
28871
|
+
}
|
|
28872
|
+
else {
|
|
28873
|
+
_this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], 0);
|
|
28874
|
+
}
|
|
28802
28875
|
}
|
|
28803
28876
|
_this.getRangeNode();
|
|
28804
28877
|
}
|
|
@@ -29020,11 +29093,13 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
29020
29093
|
}
|
|
29021
29094
|
var isLastNodeLength = _this.range.startContainer === currentParentLastChild ?
|
|
29022
29095
|
_this.range.startContainer.textContent.length : currentParent.textContent.length;
|
|
29096
|
+
var isImageElement = (_this.range.startContainer.nodeName === 'IMG' || (_this.range.startContainer.childNodes.length > 0
|
|
29097
|
+
&& _this.range.startContainer.childNodes[_this.range.startOffset].nodeName === 'IMG'));
|
|
29023
29098
|
if (currentParent !== _this.parent.inputElement &&
|
|
29024
29099
|
_this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
|
|
29025
29100
|
_this.range.startOffset === _this.range.endOffset &&
|
|
29026
29101
|
(_this.range.startOffset === isLastNodeLength ||
|
|
29027
|
-
(currentParent.textContent.trim().length === 0 &&
|
|
29102
|
+
(currentParent.textContent.trim().length === 0 && isImageElement))) {
|
|
29028
29103
|
var focusBRElem = _this.parent.createElement('br');
|
|
29029
29104
|
if (_this.range.startOffset === 0 && _this.range.startContainer.nodeName === 'TABLE') {
|
|
29030
29105
|
_this.range.startContainer.parentElement.insertBefore(focusBRElem, _this.range.startContainer);
|
|
@@ -29033,10 +29108,11 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
|
|
|
29033
29108
|
if (currentParentLastChild.nodeName === 'BR' && currentParent.textContent.length === 0) {
|
|
29034
29109
|
_this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, currentParentLastChild);
|
|
29035
29110
|
}
|
|
29036
|
-
else if (_this.range.startOffset === 0 && _this.range.endOffset === 0 &&
|
|
29037
|
-
|
|
29038
|
-
|
|
29039
|
-
focusBRElem
|
|
29111
|
+
else if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && isImageElement) {
|
|
29112
|
+
var imageElement = _this.range.startContainer.nodeName === 'IMG' ? _this.range.startContainer :
|
|
29113
|
+
_this.range.startContainer.childNodes[_this.range.startOffset];
|
|
29114
|
+
currentParent.insertBefore(focusBRElem, imageElement);
|
|
29115
|
+
focusBRElem = imageElement;
|
|
29040
29116
|
}
|
|
29041
29117
|
else {
|
|
29042
29118
|
var lineBreakBRElem = _this.parent.createElement('br');
|
|
@@ -29748,15 +29824,16 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
29748
29824
|
var currentEndContainer = range.endContainer;
|
|
29749
29825
|
var currentStartOffset = range.startOffset;
|
|
29750
29826
|
var isSameContainer = currentStartContainer === currentEndContainer ? true : false;
|
|
29751
|
-
var currentEndOffset = currentEndContainer.textContent.length;
|
|
29752
29827
|
var endNode = range.endContainer.nodeName === '#text' ? range.endContainer.parentElement :
|
|
29753
29828
|
range.endContainer;
|
|
29754
29829
|
var closestLI = closest(endNode, 'LI');
|
|
29830
|
+
var isDetached = false;
|
|
29755
29831
|
if (!isNullOrUndefined(closestLI) && endNode.textContent.length === range.endOffset &&
|
|
29756
29832
|
!range.collapsed && isNullOrUndefined(endNode.nextElementSibling)) {
|
|
29757
29833
|
for (var i = 0; i < closestLI.childNodes.length; i++) {
|
|
29758
29834
|
if (closestLI.childNodes[i].nodeName === '#text' && closestLI.childNodes[i].textContent.trim().length === 0) {
|
|
29759
29835
|
detach(closestLI.childNodes[i]);
|
|
29836
|
+
isDetached = true;
|
|
29760
29837
|
i--;
|
|
29761
29838
|
}
|
|
29762
29839
|
}
|
|
@@ -29764,7 +29841,11 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
|
|
|
29764
29841
|
while (currentLastElem.lastChild !== null && currentLastElem.nodeName !== '#text') {
|
|
29765
29842
|
currentLastElem = currentLastElem.lastChild;
|
|
29766
29843
|
}
|
|
29767
|
-
|
|
29844
|
+
if (isDetached) {
|
|
29845
|
+
var currentLast = currentLastElem.nodeName === 'BR' && !isNullOrUndefined(currentLastElem.previousSibling) ?
|
|
29846
|
+
currentLastElem.previousSibling : currentLastElem;
|
|
29847
|
+
this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), isSameContainer ? currentLast : currentStartContainer, currentLast, currentStartOffset, (currentLast.nodeName === 'BR' ? 0 : currentLast.textContent.length));
|
|
29848
|
+
}
|
|
29768
29849
|
}
|
|
29769
29850
|
};
|
|
29770
29851
|
/**
|