@syncfusion/ej2-richtexteditor 19.3.55 → 19.4.47
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/.github/PULL_REQUEST_TEMPLATE/Bug.md +41 -0
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +27 -0
- package/CHANGELOG.md +37 -1
- package/README.md +1 -1
- 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 +250 -100
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +249 -99
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/dist/global/ej2-richtexteditor.min.js +2 -2
- package/dist/global/ej2-richtexteditor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +12 -12
- package/src/editor-manager/plugin/inserthtml.js +9 -1
- package/src/editor-manager/plugin/lists.js +4 -2
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +1 -1
- package/src/editor-manager/plugin/ms-word-clean-up.js +54 -20
- package/src/editor-manager/plugin/selection-commands.js +10 -5
- package/src/editor-manager/plugin/undo.js +10 -1
- package/src/rich-text-editor/actions/color-picker.d.ts +1 -0
- package/src/rich-text-editor/actions/color-picker.js +2 -1
- package/src/rich-text-editor/actions/dropdown-buttons.js +0 -10
- package/src/rich-text-editor/actions/enter-key.d.ts +1 -0
- package/src/rich-text-editor/actions/enter-key.js +90 -37
- package/src/rich-text-editor/actions/html-editor.js +4 -3
- package/src/rich-text-editor/actions/quick-toolbar.js +1 -1
- package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
- package/src/rich-text-editor/base/interface.d.ts +3 -1
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
- package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
- package/src/rich-text-editor/base/rich-text-editor.js +2 -2
- package/src/rich-text-editor/formatter/formatter.js +3 -3
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.js +1 -1
- package/src/rich-text-editor/renderer/image-module.js +53 -7
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +1 -1
- package/src/rich-text-editor/renderer/toolbar-renderer.js +3 -2
- package/src/selection/selection.js +2 -1
- package/styles/rich-text-editor/_fluent-definition.scss +168 -0
- package/styles/rich-text-editor/_layout.scss +1 -1
- package/styles/rich-text-editor/icons/_fluent.scss +303 -0
|
@@ -2965,7 +2965,7 @@ class ToolbarRenderer {
|
|
|
2965
2965
|
* @hidden
|
|
2966
2966
|
* @deprecated
|
|
2967
2967
|
*/
|
|
2968
|
-
renderColorPickerDropDown(args, item, colorPicker) {
|
|
2968
|
+
renderColorPickerDropDown(args, item, colorPicker, defaultColor) {
|
|
2969
2969
|
// eslint-disable-next-line
|
|
2970
2970
|
const proxy = this;
|
|
2971
2971
|
let css = CLS_RTE_ELEMENTS + ' ' + CLS_TB_BTN + ((this.parent.inlineMode) ? (' ' + CLS_INLINE_DROPDOWN) : '');
|
|
@@ -2973,8 +2973,9 @@ class ToolbarRenderer {
|
|
|
2973
2973
|
const content = proxy.parent.createElement('span', { className: CLS_COLOR_CONTENT });
|
|
2974
2974
|
const inlineEle = proxy.parent.createElement('span', { className: args.cssClass });
|
|
2975
2975
|
let range;
|
|
2976
|
+
let initialBackgroundColor = (isNullOrUndefined(defaultColor)) ? proxy.parent.backgroundColor.default : defaultColor;
|
|
2976
2977
|
inlineEle.style.borderBottomColor = (item === 'backgroundcolor') ?
|
|
2977
|
-
|
|
2978
|
+
initialBackgroundColor : proxy.parent.fontColor.default;
|
|
2978
2979
|
content.appendChild(inlineEle);
|
|
2979
2980
|
const dropDown = new DropDownButton({
|
|
2980
2981
|
target: colorPicker.element.parentElement, cssClass: css,
|
|
@@ -3592,11 +3593,6 @@ class DropDownButtons {
|
|
|
3592
3593
|
for (const prop of Object.keys(newProp)) {
|
|
3593
3594
|
switch (prop) {
|
|
3594
3595
|
case 'fontFamily':
|
|
3595
|
-
if (this.parent.inlineMode.enable) {
|
|
3596
|
-
if (!isNullOrUndefined(this.parent.fontFamily.default)) {
|
|
3597
|
-
this.getEditNode().style.fontFamily = this.parent.fontFamily.default;
|
|
3598
|
-
}
|
|
3599
|
-
}
|
|
3600
3596
|
if (this.fontNameDropDown) {
|
|
3601
3597
|
for (const fontFamily$$1 of Object.keys(newProp.fontFamily)) {
|
|
3602
3598
|
switch (fontFamily$$1) {
|
|
@@ -3627,11 +3623,6 @@ class DropDownButtons {
|
|
|
3627
3623
|
}
|
|
3628
3624
|
break;
|
|
3629
3625
|
case 'fontSize':
|
|
3630
|
-
if (this.parent.inlineMode) {
|
|
3631
|
-
if (!isNullOrUndefined(this.parent.fontSize.default)) {
|
|
3632
|
-
this.getEditNode().style.fontSize = this.parent.fontSize.default;
|
|
3633
|
-
}
|
|
3634
|
-
}
|
|
3635
3626
|
if (this.fontSizeDropDown) {
|
|
3636
3627
|
for (const fontSize$$1 of Object.keys(newProp.fontSize)) {
|
|
3637
3628
|
switch (fontSize$$1) {
|
|
@@ -4997,7 +4988,7 @@ class ColorPickerInput {
|
|
|
4997
4988
|
target: (targetID)
|
|
4998
4989
|
};
|
|
4999
4990
|
this.backgroundColorPicker = this.toolbarRenderer.renderColorPicker(options, 'backgroundcolor');
|
|
5000
|
-
this.backgroundColorDropDown = this.toolbarRenderer.renderColorPickerDropDown(options, 'backgroundcolor', this.backgroundColorPicker);
|
|
4991
|
+
this.backgroundColorDropDown = this.toolbarRenderer.renderColorPickerDropDown(options, 'backgroundcolor', this.backgroundColorPicker, this.defaultColorPicker);
|
|
5001
4992
|
break;
|
|
5002
4993
|
}
|
|
5003
4994
|
}
|
|
@@ -5032,6 +5023,7 @@ class ColorPickerInput {
|
|
|
5032
5023
|
if (this.backgroundColorDropDown && !this.backgroundColorDropDown.isDestroyed) {
|
|
5033
5024
|
const innerEle = this.backgroundColorDropDown.element.querySelector('.e-rte-color-content');
|
|
5034
5025
|
if (innerEle) {
|
|
5026
|
+
this.defaultColorPicker = innerEle.children[0].style.borderBottomColor;
|
|
5035
5027
|
detach(innerEle);
|
|
5036
5028
|
}
|
|
5037
5029
|
this.backgroundColorDropDown.destroy();
|
|
@@ -5714,7 +5706,7 @@ class QuickToolbar {
|
|
|
5714
5706
|
* @deprecated
|
|
5715
5707
|
*/
|
|
5716
5708
|
showInlineQTBar(x, y, target) {
|
|
5717
|
-
if (this.parent.readonly) {
|
|
5709
|
+
if (this.parent.readonly || target.tagName.toLowerCase() === "img") {
|
|
5718
5710
|
return;
|
|
5719
5711
|
}
|
|
5720
5712
|
this.inlineQTBar.showPopup(x, y, target);
|
|
@@ -6853,7 +6845,7 @@ class Formatter {
|
|
|
6853
6845
|
|| ((args.item.subCommand === 'FontName' || args.item.subCommand === 'FontSize') && args.name === 'dropDownSelect')
|
|
6854
6846
|
|| ((args.item.subCommand === 'BackgroundColor' || args.item.subCommand === 'FontColor')
|
|
6855
6847
|
&& args.name === 'colorPickerChanged'))) {
|
|
6856
|
-
extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value }, true);
|
|
6848
|
+
extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value, selectType: args.name }, true);
|
|
6857
6849
|
self.trigger(actionBegin, args, (actionBeginArgs) => {
|
|
6858
6850
|
if (!actionBeginArgs.cancel) {
|
|
6859
6851
|
if (this.getUndoRedoStack().length === 0 && actionBeginArgs.item.command !== 'Links'
|
|
@@ -6871,8 +6863,8 @@ class Formatter {
|
|
|
6871
6863
|
}
|
|
6872
6864
|
else {
|
|
6873
6865
|
this.editorManager.observer.notify(checkUndo, { subCommand: actionBeginArgs.item.subCommand });
|
|
6874
|
-
this.editorManager.execCommand(actionBeginArgs.item.command, actionBeginArgs.item.subCommand, event, this.onSuccess.bind(this, self), actionBeginArgs.item.value, actionBeginArgs.item.subCommand === 'Pre' &&
|
|
6875
|
-
{ name:
|
|
6866
|
+
this.editorManager.execCommand(actionBeginArgs.item.command, actionBeginArgs.item.subCommand, event, this.onSuccess.bind(this, self), actionBeginArgs.item.value, actionBeginArgs.item.subCommand === 'Pre' && actionBeginArgs.selectType === 'dropDownSelect' ?
|
|
6867
|
+
{ name: actionBeginArgs.selectType } : value, ('#' + self.getID() + ' iframe'), self.enterKey);
|
|
6876
6868
|
}
|
|
6877
6869
|
}
|
|
6878
6870
|
});
|
|
@@ -9343,7 +9335,8 @@ class NodeSelection {
|
|
|
9343
9335
|
|| range.startContainer;
|
|
9344
9336
|
const endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
|
|
9345
9337
|
|| range.endContainer;
|
|
9346
|
-
if (startNode === endNode && startNode.childNodes.
|
|
9338
|
+
if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
|
|
9339
|
+
startNode.childNodes.length === 0) {
|
|
9347
9340
|
return [startNode];
|
|
9348
9341
|
}
|
|
9349
9342
|
if (range.startOffset === range.endOffset && range.startOffset !== 0 && range.startContainer.nodeName === 'PRE') {
|
|
@@ -10475,8 +10468,9 @@ class Lists {
|
|
|
10475
10468
|
testCurrentList(range) {
|
|
10476
10469
|
const olListStartRegex = [/^[1]+[.]+$/, /^[i]+[.]+$/, /^[a]+[.]+$/];
|
|
10477
10470
|
if (!isNullOrUndefined(range.startContainer.textContent.slice(0, range.startOffset))) {
|
|
10471
|
+
const currentContent = range.startContainer.textContent.replace(/\u200B/g, '').slice(0, range.startOffset).trim();
|
|
10478
10472
|
for (let i = 0; i < olListStartRegex.length; i++) {
|
|
10479
|
-
if (olListStartRegex[i].test(
|
|
10473
|
+
if (olListStartRegex[i].test(currentContent) && currentContent.length === 2) {
|
|
10480
10474
|
return true;
|
|
10481
10475
|
}
|
|
10482
10476
|
}
|
|
@@ -10518,7 +10512,8 @@ class Lists {
|
|
|
10518
10512
|
range.startContainer.parentElement.closest('LI');
|
|
10519
10513
|
const endNode = range.endContainer.nodeName === 'LI' ? range.endContainer :
|
|
10520
10514
|
range.endContainer.parentElement.closest('LI');
|
|
10521
|
-
if (!isNullOrUndefined(startNode) && !isNullOrUndefined(endNode) && startNode === endNode && startNode.tagName === 'LI' &&
|
|
10515
|
+
if (!isNullOrUndefined(startNode) && !isNullOrUndefined(endNode) && startNode === endNode && startNode.tagName === 'LI' &&
|
|
10516
|
+
startNode.textContent.trim() === '' && startNode.querySelectorAll('IMG').length === 0) {
|
|
10522
10517
|
if (startNode.textContent.charCodeAt(0) === 65279) {
|
|
10523
10518
|
startNode.textContent = '';
|
|
10524
10519
|
}
|
|
@@ -12197,7 +12192,15 @@ class InsertHtml {
|
|
|
12197
12192
|
tempSpan.parentNode.replaceChild(node, tempSpan);
|
|
12198
12193
|
}
|
|
12199
12194
|
else {
|
|
12200
|
-
|
|
12195
|
+
let currentNode = nodes[nodes.length - 1];
|
|
12196
|
+
let splitedElm;
|
|
12197
|
+
if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNullOrUndefined(currentNode.parentElement) &&
|
|
12198
|
+
currentNode.parentElement.textContent.trim().length === 0 && !node.classList.contains('pasteContent')) {
|
|
12199
|
+
splitedElm = currentNode;
|
|
12200
|
+
}
|
|
12201
|
+
else {
|
|
12202
|
+
splitedElm = nodeCutter.GetSpliceNode(range, blockNode);
|
|
12203
|
+
}
|
|
12201
12204
|
splitedElm.parentNode.replaceChild(node, splitedElm);
|
|
12202
12205
|
}
|
|
12203
12206
|
}
|
|
@@ -14486,6 +14489,9 @@ class SelectionCommands {
|
|
|
14486
14489
|
}
|
|
14487
14490
|
static removeFormat(nodes, index, formatNode, isCursor, isFormat, isFontStyle, range, nodeCutter, format, value, domSelection, endNode, domNode) {
|
|
14488
14491
|
let splitNode = null;
|
|
14492
|
+
let startText = range.startContainer.nodeName === '#text' ?
|
|
14493
|
+
range.startContainer.textContent.substring(range.startOffset, range.startContainer.textContent.length) :
|
|
14494
|
+
range.startContainer.textContent;
|
|
14489
14495
|
if (!(range.startContainer === range.endContainer && range.startOffset === 0
|
|
14490
14496
|
&& range.endOffset === range.startContainer.length)) {
|
|
14491
14497
|
const nodeIndex = [];
|
|
@@ -14585,11 +14591,13 @@ class SelectionCommands {
|
|
|
14585
14591
|
for (let num = 0; num < child.length; num++) {
|
|
14586
14592
|
if (child[num].nodeType !== 3 || (child[num].textContent && child[num].textContent.trim().length > 0)) {
|
|
14587
14593
|
child[num] = InsertMethods.Wrap(child[num], this.GetFormatNode(format, value, formatNodeTagName, formatNodeStyles));
|
|
14588
|
-
if (num ===
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14594
|
+
if (child[num].textContent === startText) {
|
|
14595
|
+
if (num === 0) {
|
|
14596
|
+
range.setStartBefore(child[num]);
|
|
14597
|
+
}
|
|
14598
|
+
else if (num === child.length - 1) {
|
|
14599
|
+
range.setEndAfter(child[num]);
|
|
14600
|
+
}
|
|
14593
14601
|
}
|
|
14594
14602
|
}
|
|
14595
14603
|
}
|
|
@@ -15261,7 +15269,16 @@ class UndoRedoManager {
|
|
|
15261
15269
|
* @deprecated
|
|
15262
15270
|
*/
|
|
15263
15271
|
saveData(e) {
|
|
15264
|
-
|
|
15272
|
+
let range = new NodeSelection().getRange(this.parent.currentDocument);
|
|
15273
|
+
let currentContainer = range.startContainer;
|
|
15274
|
+
for (let i = currentContainer.childNodes.length - 1; i >= 0; i--) {
|
|
15275
|
+
if (!isNullOrUndefined(currentContainer.childNodes[i]) && currentContainer.childNodes[i].nodeName === '#text' &&
|
|
15276
|
+
currentContainer.childNodes[i].textContent.length === 0 && currentContainer.childNodes[i].nodeName !== 'IMG' &&
|
|
15277
|
+
currentContainer.childNodes[i].nodeName !== 'BR' && currentContainer.childNodes[i].nodeName && 'HR') {
|
|
15278
|
+
detach(currentContainer.childNodes[i]);
|
|
15279
|
+
}
|
|
15280
|
+
}
|
|
15281
|
+
range = new NodeSelection().getRange(this.parent.currentDocument);
|
|
15265
15282
|
const save = new NodeSelection().save(range, this.parent.currentDocument);
|
|
15266
15283
|
const htmlText = this.parent.editableElement.innerHTML;
|
|
15267
15284
|
const changEle = { text: htmlText, range: save };
|
|
@@ -15411,7 +15428,7 @@ class MsWordPaste {
|
|
|
15411
15428
|
this.parent.observer.on(MS_WORD_CLEANUP_PLUGIN, this.wordCleanup, this);
|
|
15412
15429
|
}
|
|
15413
15430
|
wordCleanup(e) {
|
|
15414
|
-
const wordPasteStyleConfig = e.allowedStylePropertiesArray;
|
|
15431
|
+
const wordPasteStyleConfig = !isNullOrUndefined(e.allowedStylePropertiesArray) ? e.allowedStylePropertiesArray : [];
|
|
15415
15432
|
let listNodes = [];
|
|
15416
15433
|
let tempHTMLContent = e.args.clipboardData.getData('text/HTML');
|
|
15417
15434
|
const rtfData = e.args.clipboardData.getData('text/rtf');
|
|
@@ -15835,8 +15852,10 @@ class MsWordPaste {
|
|
|
15835
15852
|
this.listContents = [];
|
|
15836
15853
|
this.getListContent(listNodes[i]);
|
|
15837
15854
|
let type;
|
|
15855
|
+
let listStyleType;
|
|
15838
15856
|
if (!isNullOrUndefined(this.listContents[0])) {
|
|
15839
15857
|
type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
|
|
15858
|
+
listStyleType = this.getlistStyleType(this.listContents[0], type);
|
|
15840
15859
|
const tempNode = [];
|
|
15841
15860
|
for (let j = 1; j < this.listContents.length; j++) {
|
|
15842
15861
|
tempNode.push(this.listContents[j]);
|
|
@@ -15853,7 +15872,7 @@ class MsWordPaste {
|
|
|
15853
15872
|
}
|
|
15854
15873
|
}
|
|
15855
15874
|
collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
|
|
15856
|
-
listStyle: currentListStyle });
|
|
15875
|
+
listStyle: currentListStyle, listStyleTypeName: listStyleType });
|
|
15857
15876
|
}
|
|
15858
15877
|
}
|
|
15859
15878
|
stNode = listNodes.shift();
|
|
@@ -15877,6 +15896,45 @@ class MsWordPaste {
|
|
|
15877
15896
|
}
|
|
15878
15897
|
}
|
|
15879
15898
|
}
|
|
15899
|
+
getlistStyleType(listContent, type) {
|
|
15900
|
+
let currentListClass;
|
|
15901
|
+
if (type === 'ol') {
|
|
15902
|
+
switch (listContent.split('.')[0]) {
|
|
15903
|
+
case "A":
|
|
15904
|
+
currentListClass = "upper-alpha";
|
|
15905
|
+
break;
|
|
15906
|
+
case "a":
|
|
15907
|
+
currentListClass = "lower-alpha";
|
|
15908
|
+
break;
|
|
15909
|
+
case "I":
|
|
15910
|
+
currentListClass = "upper-roman";
|
|
15911
|
+
break;
|
|
15912
|
+
case "i":
|
|
15913
|
+
currentListClass = "lower-roman";
|
|
15914
|
+
break;
|
|
15915
|
+
case "α":
|
|
15916
|
+
currentListClass = "lower-greek";
|
|
15917
|
+
break;
|
|
15918
|
+
default:
|
|
15919
|
+
currentListClass = "decimal";
|
|
15920
|
+
break;
|
|
15921
|
+
}
|
|
15922
|
+
}
|
|
15923
|
+
else {
|
|
15924
|
+
switch (listContent.split('.')[0]) {
|
|
15925
|
+
case "o":
|
|
15926
|
+
currentListClass = "circle";
|
|
15927
|
+
break;
|
|
15928
|
+
case "§":
|
|
15929
|
+
currentListClass = "square";
|
|
15930
|
+
break;
|
|
15931
|
+
default:
|
|
15932
|
+
currentListClass = "disc";
|
|
15933
|
+
break;
|
|
15934
|
+
}
|
|
15935
|
+
}
|
|
15936
|
+
return currentListClass;
|
|
15937
|
+
}
|
|
15880
15938
|
makeConversion(collection) {
|
|
15881
15939
|
const root = createElement('div');
|
|
15882
15940
|
let temp;
|
|
@@ -15893,7 +15951,7 @@ class MsWordPaste {
|
|
|
15893
15951
|
prevList.appendChild(pElement);
|
|
15894
15952
|
temp.appendChild(prevList);
|
|
15895
15953
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
15896
|
-
temp.style.
|
|
15954
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
15897
15955
|
}
|
|
15898
15956
|
else if (collection[index].nestedLevel === pLevel) {
|
|
15899
15957
|
if (prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
|
|
@@ -15902,6 +15960,7 @@ class MsWordPaste {
|
|
|
15902
15960
|
}
|
|
15903
15961
|
else {
|
|
15904
15962
|
temp = createElement(collection[index].listType);
|
|
15963
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
15905
15964
|
prevList.parentElement.parentElement.appendChild(temp);
|
|
15906
15965
|
prevList = createElement('li');
|
|
15907
15966
|
prevList.appendChild(pElement);
|
|
@@ -15913,14 +15972,15 @@ class MsWordPaste {
|
|
|
15913
15972
|
if (!isNullOrUndefined(prevList)) {
|
|
15914
15973
|
for (let j = 0; j < collection[index].nestedLevel - pLevel; j++) {
|
|
15915
15974
|
prevList.appendChild(temp = createElement(collection[index].listType));
|
|
15916
|
-
prevList = createElement('li'
|
|
15975
|
+
prevList = createElement('li');
|
|
15976
|
+
if (j != collection[index].nestedLevel - pLevel - 1 && collection[index].nestedLevel - pLevel > 1) {
|
|
15977
|
+
prevList.style.listStyleType = "none";
|
|
15978
|
+
}
|
|
15917
15979
|
temp.appendChild(prevList);
|
|
15918
15980
|
}
|
|
15919
15981
|
prevList.appendChild(pElement);
|
|
15920
15982
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
15921
|
-
temp.style.
|
|
15922
|
-
temp.childNodes[0].style.listStyle =
|
|
15923
|
-
this.getListStyle(collection[index].listType, collection[index].nestedLevel);
|
|
15983
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
15924
15984
|
}
|
|
15925
15985
|
else {
|
|
15926
15986
|
root.appendChild(temp = createElement(collection[index].listType));
|
|
@@ -15928,7 +15988,7 @@ class MsWordPaste {
|
|
|
15928
15988
|
prevList.appendChild(pElement);
|
|
15929
15989
|
temp.appendChild(prevList);
|
|
15930
15990
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
15931
|
-
temp.style.
|
|
15991
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
15932
15992
|
}
|
|
15933
15993
|
}
|
|
15934
15994
|
else if (collection[index].nestedLevel === 1) {
|
|
@@ -15937,12 +15997,12 @@ class MsWordPaste {
|
|
|
15937
15997
|
}
|
|
15938
15998
|
else {
|
|
15939
15999
|
root.appendChild(temp = createElement(collection[index].listType));
|
|
16000
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
15940
16001
|
}
|
|
15941
16002
|
prevList = createElement('li');
|
|
15942
16003
|
prevList.appendChild(pElement);
|
|
15943
16004
|
temp.appendChild(prevList);
|
|
15944
16005
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
15945
|
-
temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
|
|
15946
16006
|
}
|
|
15947
16007
|
else {
|
|
15948
16008
|
elem = prevList;
|
|
@@ -15963,7 +16023,7 @@ class MsWordPaste {
|
|
|
15963
16023
|
prevList.appendChild(pElement);
|
|
15964
16024
|
temp.appendChild(prevList);
|
|
15965
16025
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
15966
|
-
temp.style.
|
|
16026
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
15967
16027
|
break;
|
|
15968
16028
|
}
|
|
15969
16029
|
}
|
|
@@ -15972,21 +16032,12 @@ class MsWordPaste {
|
|
|
15972
16032
|
}
|
|
15973
16033
|
prevList.setAttribute('class', collection[index].class);
|
|
15974
16034
|
const currentStyle = prevList.getAttribute('style');
|
|
15975
|
-
prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : '')
|
|
16035
|
+
prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : ''));
|
|
15976
16036
|
pLevel = collection[index].nestedLevel;
|
|
15977
16037
|
listCount++;
|
|
15978
16038
|
}
|
|
15979
16039
|
return root;
|
|
15980
16040
|
}
|
|
15981
|
-
getListStyle(listType, nestedLevel) {
|
|
15982
|
-
nestedLevel = (nestedLevel > 0) ? nestedLevel - 1 : nestedLevel;
|
|
15983
|
-
if (listType === 'ol') {
|
|
15984
|
-
return (nestedLevel < this.olData.length ? this.olData[nestedLevel] : this.olData[0]);
|
|
15985
|
-
}
|
|
15986
|
-
else {
|
|
15987
|
-
return (nestedLevel < this.ulData.length ? this.ulData[nestedLevel] : this.ulData[0]);
|
|
15988
|
-
}
|
|
15989
|
-
}
|
|
15990
16041
|
getListContent(elem) {
|
|
15991
16042
|
let pushContent = '';
|
|
15992
16043
|
const firstChild = elem.firstElementChild;
|
|
@@ -16930,7 +16981,7 @@ class XhtmlValidation {
|
|
|
16930
16981
|
this.ImageTags();
|
|
16931
16982
|
this.removeTags();
|
|
16932
16983
|
this.RemoveUnsupported();
|
|
16933
|
-
this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText ===
|
|
16984
|
+
this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText === "\n" ?
|
|
16934
16985
|
this.currentElement.innerText.length : this.currentElement.innerText.trim().length);
|
|
16935
16986
|
this.parent.setProperties({ value: this.currentElement.innerHTML }, true);
|
|
16936
16987
|
}
|
|
@@ -17214,7 +17265,7 @@ class HtmlEditor {
|
|
|
17214
17265
|
e.args.action === 'enter' ||
|
|
17215
17266
|
e.args.keyCode === 13) {
|
|
17216
17267
|
this.spaceLink(e.args);
|
|
17217
|
-
if (this.parent.editorMode === 'HTML' && !
|
|
17268
|
+
if (this.parent.editorMode === 'HTML' && !this.parent.readonly) {
|
|
17218
17269
|
this.parent.notify(enterHandler, { args: e.args });
|
|
17219
17270
|
}
|
|
17220
17271
|
}
|
|
@@ -17294,7 +17345,8 @@ class HtmlEditor {
|
|
|
17294
17345
|
if (this.rangeElement.tagName === 'OL' || this.rangeElement.tagName === 'UL') {
|
|
17295
17346
|
const liElement = this.getRangeLiNode(currentRange.startContainer);
|
|
17296
17347
|
if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
|
|
17297
|
-
this.oldRangeElement = liElement.previousElementSibling.lastElementChild
|
|
17348
|
+
this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
|
|
17349
|
+
liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
|
|
17298
17350
|
if (!isNullOrUndefined(liElement.lastElementChild)) {
|
|
17299
17351
|
this.rangeElement = liElement.lastElementChild;
|
|
17300
17352
|
isLiElement = true;
|
|
@@ -17491,7 +17543,7 @@ class HtmlEditor {
|
|
|
17491
17543
|
const divElement = this.parent.createElement('div');
|
|
17492
17544
|
divElement.setAttribute('class', 'pasteContent');
|
|
17493
17545
|
divElement.style.display = 'inline';
|
|
17494
|
-
divElement.innerHTML = contentInnerElem;
|
|
17546
|
+
divElement.innerHTML = contentInnerElem.replace('¶', '&para');
|
|
17495
17547
|
const paraElem = divElement.querySelectorAll('span, p');
|
|
17496
17548
|
for (let i = 0; i < paraElem.length; i++) {
|
|
17497
17549
|
const splitTextContent = paraElem[i].innerHTML.split(' ');
|
|
@@ -20091,7 +20143,7 @@ class Image {
|
|
|
20091
20143
|
left: elem.offsetLeft
|
|
20092
20144
|
};
|
|
20093
20145
|
}
|
|
20094
|
-
setAspectRatio(img, expectedX, expectedY) {
|
|
20146
|
+
setAspectRatio(img, expectedX, expectedY, e) {
|
|
20095
20147
|
if (isNullOrUndefined(img.width)) {
|
|
20096
20148
|
return;
|
|
20097
20149
|
}
|
|
@@ -20115,10 +20167,14 @@ class Image {
|
|
|
20115
20167
|
img.style.height = expectedY + 'px';
|
|
20116
20168
|
}
|
|
20117
20169
|
else if (img.style.width !== '' && img.style.height === '') {
|
|
20118
|
-
|
|
20170
|
+
let currentWidth = ((width / height * expectedY) + width / height) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
|
|
20171
|
+
((width / height * expectedY) + width / height) : (this.parent.inputElement.getBoundingClientRect().right - 32);
|
|
20172
|
+
img.style.width = currentWidth.toString() + 'px';
|
|
20119
20173
|
}
|
|
20120
20174
|
else if (img.style.width !== '') {
|
|
20121
|
-
|
|
20175
|
+
let currentWidth = (width / height * expectedY) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
|
|
20176
|
+
(width / height * expectedY) : (this.parent.inputElement.getBoundingClientRect().right - 32);
|
|
20177
|
+
img.style.width = currentWidth + 'px';
|
|
20122
20178
|
img.style.height = expectedY + 'px';
|
|
20123
20179
|
}
|
|
20124
20180
|
else {
|
|
@@ -20141,7 +20197,7 @@ class Image {
|
|
|
20141
20197
|
img.style.height = (height / width * expectedX) + 'px';
|
|
20142
20198
|
}
|
|
20143
20199
|
else {
|
|
20144
|
-
img.setAttribute('width', expectedX.toString());
|
|
20200
|
+
img.setAttribute('width', this.resizeBtnStat.botRight ? (this.getPointX(e.event) - img.getBoundingClientRect().left).toString() : expectedX.toString());
|
|
20145
20201
|
}
|
|
20146
20202
|
}
|
|
20147
20203
|
else {
|
|
@@ -20181,7 +20237,7 @@ class Image {
|
|
|
20181
20237
|
return;
|
|
20182
20238
|
}
|
|
20183
20239
|
this.imgEle.parentElement.style.cursor = 'pointer';
|
|
20184
|
-
this.setAspectRatio(this.imgEle, parseInt(width, 10), parseInt(height, 10));
|
|
20240
|
+
this.setAspectRatio(this.imgEle, parseInt(width, 10), parseInt(height, 10), args);
|
|
20185
20241
|
this.resizeImgDupPos(this.imgEle);
|
|
20186
20242
|
this.imgResizePos(this.imgEle, this.imgResizeDiv);
|
|
20187
20243
|
this.parent.setContentHeight('', false);
|
|
@@ -20226,7 +20282,8 @@ class Image {
|
|
|
20226
20282
|
}
|
|
20227
20283
|
resizeImgDupPos(e) {
|
|
20228
20284
|
this.imgDupPos = {
|
|
20229
|
-
width: (e.style.
|
|
20285
|
+
width: (e.style.width !== '' && (this.parent.insertImageSettings &&
|
|
20286
|
+
!this.parent.insertImageSettings.resizeByPercent)) ? this.imgEle.style.width : e.width + 'px',
|
|
20230
20287
|
height: (e.style.height !== '') ? this.imgEle.style.height : e.height + 'px'
|
|
20231
20288
|
};
|
|
20232
20289
|
}
|
|
@@ -20394,6 +20451,27 @@ class Image {
|
|
|
20394
20451
|
const src = this.deletedImg[i].src;
|
|
20395
20452
|
this.imageRemovePost(src);
|
|
20396
20453
|
}
|
|
20454
|
+
if (range.startContainer.nodeType === 3) {
|
|
20455
|
+
if (originalEvent.code === 'Backspace') {
|
|
20456
|
+
if (range.startContainer.previousElementSibling && range.startOffset === 0 &&
|
|
20457
|
+
range.startContainer.previousElementSibling.classList.contains(CLS_CAPTION) &&
|
|
20458
|
+
range.startContainer.previousElementSibling.classList.contains(CLS_CAPINLINE)) {
|
|
20459
|
+
detach(range.startContainer.previousElementSibling);
|
|
20460
|
+
}
|
|
20461
|
+
}
|
|
20462
|
+
else {
|
|
20463
|
+
if (range.startContainer.nextElementSibling &&
|
|
20464
|
+
range.endContainer.textContent.length === range.endOffset &&
|
|
20465
|
+
range.startContainer.nextElementSibling.classList.contains(CLS_CAPTION) &&
|
|
20466
|
+
range.startContainer.nextElementSibling.classList.contains(CLS_CAPINLINE)) {
|
|
20467
|
+
detach(range.startContainer.nextElementSibling);
|
|
20468
|
+
}
|
|
20469
|
+
}
|
|
20470
|
+
}
|
|
20471
|
+
else if ((range.startContainer.nodeType === 1 &&
|
|
20472
|
+
range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE))) {
|
|
20473
|
+
detach(range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE));
|
|
20474
|
+
}
|
|
20397
20475
|
break;
|
|
20398
20476
|
case 'insert-image':
|
|
20399
20477
|
this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
|
|
@@ -20598,7 +20676,7 @@ class Image {
|
|
|
20598
20676
|
const target = args.target;
|
|
20599
20677
|
this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
|
|
20600
20678
|
const isPopupOpen = this.quickToolObj.imageQTBar.element.classList.contains('e-rte-pop');
|
|
20601
|
-
if (target.nodeName === 'IMG' && this.parent.quickToolbarModule
|
|
20679
|
+
if (target.nodeName === 'IMG' && this.parent.quickToolbarModule) {
|
|
20602
20680
|
if (isPopupOpen) {
|
|
20603
20681
|
return;
|
|
20604
20682
|
}
|
|
@@ -20837,6 +20915,9 @@ class Image {
|
|
|
20837
20915
|
imageRemovePost(src) {
|
|
20838
20916
|
const proxy = this;
|
|
20839
20917
|
let absoluteUrl = '';
|
|
20918
|
+
if (isNullOrUndefined(this.parent.insertImageSettings.removeUrl) || this.parent.insertImageSettings.removeUrl === '') {
|
|
20919
|
+
return;
|
|
20920
|
+
}
|
|
20840
20921
|
if (src.indexOf('http://') > -1 || src.indexOf('https://') > -1) {
|
|
20841
20922
|
absoluteUrl = src;
|
|
20842
20923
|
}
|
|
@@ -21673,6 +21754,7 @@ class Image {
|
|
|
21673
21754
|
imageTag.addEventListener('load', () => {
|
|
21674
21755
|
this.parent.trigger(actionComplete, e);
|
|
21675
21756
|
});
|
|
21757
|
+
detach(parentElement);
|
|
21676
21758
|
}
|
|
21677
21759
|
/**
|
|
21678
21760
|
* Rendering uploader and popup for drag and drop
|
|
@@ -21707,6 +21789,9 @@ class Image {
|
|
|
21707
21789
|
this.popupObj.destroy();
|
|
21708
21790
|
detach(this.popupObj.element);
|
|
21709
21791
|
this.popupObj = null;
|
|
21792
|
+
if (!this.parent.inlineMode.enable) {
|
|
21793
|
+
this.parent.toolbarModule.baseToolbar.toolbarObj.disable(false);
|
|
21794
|
+
}
|
|
21710
21795
|
}
|
|
21711
21796
|
});
|
|
21712
21797
|
this.popupObj.element.style.display = 'none';
|
|
@@ -21738,6 +21823,10 @@ class Image {
|
|
|
21738
21823
|
isUploading = false;
|
|
21739
21824
|
detach(imageElement);
|
|
21740
21825
|
this.popupObj.close();
|
|
21826
|
+
this.quickToolObj.imageQTBar.hidePopup();
|
|
21827
|
+
setTimeout(() => {
|
|
21828
|
+
this.uploadObj.destroy();
|
|
21829
|
+
}, 900);
|
|
21741
21830
|
},
|
|
21742
21831
|
beforeUpload: (args) => {
|
|
21743
21832
|
if (this.parent.isServerRendered) {
|
|
@@ -21749,6 +21838,9 @@ class Image {
|
|
|
21749
21838
|
if (beforeUploadArgs.cancel) {
|
|
21750
21839
|
return;
|
|
21751
21840
|
}
|
|
21841
|
+
if (!this.parent.inlineMode.enable) {
|
|
21842
|
+
this.parent.toolbarModule.baseToolbar.toolbarObj.disable(true);
|
|
21843
|
+
}
|
|
21752
21844
|
/* eslint-disable */
|
|
21753
21845
|
this.uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
|
|
21754
21846
|
beforeUploadArgs.currentRequest : this.uploadObj.currentRequestHeader;
|
|
@@ -21761,6 +21853,9 @@ class Image {
|
|
|
21761
21853
|
}
|
|
21762
21854
|
else {
|
|
21763
21855
|
this.parent.trigger(beforeImageUpload, args);
|
|
21856
|
+
if (!this.parent.inlineMode.enable) {
|
|
21857
|
+
this.parent.toolbarModule.baseToolbar.toolbarObj.disable(true);
|
|
21858
|
+
}
|
|
21764
21859
|
}
|
|
21765
21860
|
},
|
|
21766
21861
|
uploading: (e) => {
|
|
@@ -21803,6 +21898,9 @@ class Image {
|
|
|
21803
21898
|
}, 900);
|
|
21804
21899
|
},
|
|
21805
21900
|
success: (e) => {
|
|
21901
|
+
if (e.operation === "cancel") {
|
|
21902
|
+
return;
|
|
21903
|
+
}
|
|
21806
21904
|
isUploading = false;
|
|
21807
21905
|
this.parent.inputElement.contentEditable = 'true';
|
|
21808
21906
|
const args = {
|
|
@@ -23854,7 +23952,7 @@ __decorate$2([
|
|
|
23854
23952
|
Property(null)
|
|
23855
23953
|
], PasteCleanupSettings.prototype, "deniedAttrs", void 0);
|
|
23856
23954
|
__decorate$2([
|
|
23857
|
-
Property(['background', 'background-color', 'border', 'border-bottom', 'border-left', 'border-radius', 'border-right', 'border-style', 'border-top', 'border-width', 'clear', 'color', 'cursor', 'direction', 'display', 'float', 'font', 'font-family', 'font-size', 'font-weight', 'font-style', 'height', 'left', 'line-height', 'margin', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'max-height', 'max-width', 'min-height', 'min-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'position', 'right', 'table-layout', 'text-align', 'text-decoration', 'text-indent', 'top', 'vertical-align', 'visibility', 'white-space', 'width'])
|
|
23955
|
+
Property(['background', 'background-color', 'border', 'border-bottom', 'border-left', 'border-radius', 'border-right', 'border-style', 'border-top', 'border-width', 'clear', 'color', 'cursor', 'direction', 'display', 'float', 'font', 'font-family', 'font-size', 'font-weight', 'font-style', 'height', 'left', 'line-height', 'list-style-type', 'margin', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'max-height', 'max-width', 'min-height', 'min-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'position', 'right', 'table-layout', 'text-align', 'text-decoration', 'text-indent', 'top', 'vertical-align', 'visibility', 'white-space', 'width'])
|
|
23858
23956
|
], PasteCleanupSettings.prototype, "allowedStyleProps", void 0);
|
|
23859
23957
|
__decorate$2([
|
|
23860
23958
|
Property(null)
|
|
@@ -24042,9 +24140,20 @@ class EnterKeyAction {
|
|
|
24042
24140
|
}
|
|
24043
24141
|
enterHandler(e) {
|
|
24044
24142
|
this.getRangeNode();
|
|
24143
|
+
let isTableEnter = true;
|
|
24144
|
+
if (!isNullOrUndefined(this.startNode.closest('TABLE')) && !isNullOrUndefined(this.endNode.closest('TABLE'))) {
|
|
24145
|
+
isTableEnter = false;
|
|
24146
|
+
let curElement = this.startNode;
|
|
24147
|
+
let blockElement = curElement;
|
|
24148
|
+
while (!this.parent.formatter.editorManager.domNode.isBlockNode(curElement)) {
|
|
24149
|
+
blockElement = curElement;
|
|
24150
|
+
curElement = curElement.parentElement;
|
|
24151
|
+
}
|
|
24152
|
+
isTableEnter = blockElement.tagName === 'TD' ? false : true;
|
|
24153
|
+
}
|
|
24045
24154
|
if (e.args.which === 13 && e.args.code === 'Enter') {
|
|
24046
|
-
if (isNullOrUndefined(this.startNode.closest('LI')) && isNullOrUndefined(this.endNode.closest('LI')) &&
|
|
24047
|
-
isNullOrUndefined(this.
|
|
24155
|
+
if (isNullOrUndefined(this.startNode.closest('LI')) && isNullOrUndefined(this.endNode.closest('LI')) && isTableEnter &&
|
|
24156
|
+
isNullOrUndefined(this.startNode.closest('PRE')) && isNullOrUndefined(this.endNode.closest('PRE'))) {
|
|
24048
24157
|
const shiftKey = e.args.shiftKey;
|
|
24049
24158
|
const actionBeginArgs = {
|
|
24050
24159
|
cancel: false,
|
|
@@ -24102,12 +24211,32 @@ class EnterKeyAction {
|
|
|
24102
24211
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.range.startContainer.childNodes[this.range.startOffset], 0);
|
|
24103
24212
|
this.getRangeNode();
|
|
24104
24213
|
}
|
|
24105
|
-
if (this.parent.enterKey === 'P' || this.parent.enterKey === 'DIV' ||
|
|
24214
|
+
if ((this.parent.enterKey === 'P' && !shiftKey) || (this.parent.enterKey === 'DIV' && !shiftKey) ||
|
|
24106
24215
|
(this.parent.shiftEnterKey === 'P' && shiftKey) ||
|
|
24107
24216
|
(this.parent.shiftEnterKey === 'DIV' && shiftKey)) {
|
|
24108
|
-
|
|
24217
|
+
let nearBlockNode;
|
|
24218
|
+
if (isTableEnter && this.parent.formatter.editorManager.domNode.isBlockNode(this.startNode)) {
|
|
24219
|
+
nearBlockNode = this.startNode;
|
|
24220
|
+
}
|
|
24221
|
+
else {
|
|
24222
|
+
nearBlockNode = this.parent.formatter.editorManager.domNode.blockParentNode(this.startNode);
|
|
24223
|
+
}
|
|
24109
24224
|
let isImageNode = false;
|
|
24110
|
-
|
|
24225
|
+
let isFocusedFirst = false;
|
|
24226
|
+
if (this.range.startOffset != 0 && this.range.endOffset != 0 && this.range.startContainer === this.range.endContainer &&
|
|
24227
|
+
!(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
|
|
24228
|
+
let startNodeText = this.range.startContainer.textContent;
|
|
24229
|
+
let splitFirstText = startNodeText.substring(0, this.range.startOffset);
|
|
24230
|
+
if (splitFirstText.charCodeAt(this.range.startOffset - 1) != 160 && splitFirstText.trim().length === 0) {
|
|
24231
|
+
isFocusedFirst = true;
|
|
24232
|
+
}
|
|
24233
|
+
}
|
|
24234
|
+
else if (this.range.startOffset === 0 && this.range.endOffset === 0) {
|
|
24235
|
+
isFocusedFirst = true;
|
|
24236
|
+
}
|
|
24237
|
+
if (((this.range.startOffset === 0 && this.range.endOffset === 0) || isFocusedFirst) &&
|
|
24238
|
+
!(!isNullOrUndefined(this.range.startContainer.previousSibling) &&
|
|
24239
|
+
(this.range.startContainer.previousSibling.nodeName === 'IMG' || this.range.startContainer.previousSibling.nodeName === 'BR'))) {
|
|
24111
24240
|
let isNearBlockLengthZero;
|
|
24112
24241
|
let newElem;
|
|
24113
24242
|
if (this.range.startContainer.nodeName === 'IMG') {
|
|
@@ -24116,7 +24245,7 @@ class EnterKeyAction {
|
|
|
24116
24245
|
isNearBlockLengthZero = false;
|
|
24117
24246
|
}
|
|
24118
24247
|
else {
|
|
24119
|
-
if (nearBlockNode.textContent.length !== 0) {
|
|
24248
|
+
if (nearBlockNode.textContent.trim().length !== 0) {
|
|
24120
24249
|
newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, false).cloneNode(true);
|
|
24121
24250
|
isNearBlockLengthZero = false;
|
|
24122
24251
|
}
|
|
@@ -24165,7 +24294,18 @@ class EnterKeyAction {
|
|
|
24165
24294
|
}
|
|
24166
24295
|
if (newElem.textContent.trim().length === 0) {
|
|
24167
24296
|
const brElm = this.parent.createElement('br');
|
|
24168
|
-
this.startNode.
|
|
24297
|
+
if (this.startNode.nodeName === 'A') {
|
|
24298
|
+
let startParentElem = this.startNode.parentElement;
|
|
24299
|
+
this.startNode.parentElement.insertBefore(brElm, this.startNode);
|
|
24300
|
+
detach(this.startNode);
|
|
24301
|
+
this.startNode = startParentElem;
|
|
24302
|
+
}
|
|
24303
|
+
else {
|
|
24304
|
+
this.startNode.appendChild(brElm);
|
|
24305
|
+
}
|
|
24306
|
+
if (newElem.childNodes[0].textContent === '\n') {
|
|
24307
|
+
detach(newElem.childNodes[0]);
|
|
24308
|
+
}
|
|
24169
24309
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.startNode, 0);
|
|
24170
24310
|
}
|
|
24171
24311
|
if (((this.parent.enterKey === 'P' || this.parent.enterKey === 'DIV') && !shiftKey) || ((this.parent.shiftEnterKey === 'DIV' ||
|
|
@@ -24176,12 +24316,13 @@ class EnterKeyAction {
|
|
|
24176
24316
|
}
|
|
24177
24317
|
this.parent.formatter.editorManager.domNode.insertAfter(insertElm, newElem);
|
|
24178
24318
|
detach(newElem);
|
|
24179
|
-
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.parent.formatter.editorManager.domNode.isBlockNode(this.startNode) ?
|
|
24319
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.parent.formatter.editorManager.domNode.isBlockNode(this.startNode) ?
|
|
24320
|
+
insertElm : this.startNode, 0);
|
|
24180
24321
|
}
|
|
24181
24322
|
}
|
|
24182
24323
|
e.args.preventDefault();
|
|
24183
24324
|
}
|
|
24184
|
-
if (this.parent.enterKey === 'BR' && !shiftKey) {
|
|
24325
|
+
if ((this.parent.enterKey === 'BR' && !shiftKey) || (this.parent.shiftEnterKey === 'BR' && shiftKey)) {
|
|
24185
24326
|
let currentParent;
|
|
24186
24327
|
if (!this.parent.formatter.editorManager.domNode.isBlockNode(this.startNode)) {
|
|
24187
24328
|
let currentNode = this.startNode;
|
|
@@ -24196,14 +24337,21 @@ class EnterKeyAction {
|
|
|
24196
24337
|
else {
|
|
24197
24338
|
currentParent = this.startNode;
|
|
24198
24339
|
}
|
|
24199
|
-
let
|
|
24340
|
+
let currentParentLastChild = currentParent.lastChild;
|
|
24341
|
+
while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text')) {
|
|
24342
|
+
currentParentLastChild = currentParentLastChild.lastChild;
|
|
24343
|
+
}
|
|
24344
|
+
const isLastNodeLength = this.range.startContainer === currentParentLastChild ?
|
|
24345
|
+
this.range.startContainer.textContent.length : currentParent.textContent.length;
|
|
24200
24346
|
if (currentParent !== this.parent.inputElement &&
|
|
24201
24347
|
this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
|
|
24202
24348
|
this.range.startOffset === this.range.endOffset &&
|
|
24203
|
-
this.range.startOffset ===
|
|
24204
|
-
const
|
|
24205
|
-
this.parent.
|
|
24206
|
-
this.parent.formatter.editorManager.
|
|
24349
|
+
this.range.startOffset === isLastNodeLength) {
|
|
24350
|
+
const focusBRElem = this.parent.createElement('br');
|
|
24351
|
+
const lineBreakBRElem = this.parent.createElement('br');
|
|
24352
|
+
this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, this.range.startContainer);
|
|
24353
|
+
this.parent.formatter.editorManager.domNode.insertAfter(lineBreakBRElem, this.range.startContainer);
|
|
24354
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), focusBRElem, 0);
|
|
24207
24355
|
}
|
|
24208
24356
|
else if (!isNullOrUndefined(currentParent) && currentParent !== this.parent.inputElement && currentParent.nodeName !== 'BR') {
|
|
24209
24357
|
if (currentParent.textContent.trim().length === 0 || (currentParent.textContent.trim().length === 1 &&
|
|
@@ -24227,37 +24375,15 @@ class EnterKeyAction {
|
|
|
24227
24375
|
currentFocusElem = currentFocusElem.lastChild;
|
|
24228
24376
|
}
|
|
24229
24377
|
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), currentFocusElem, 0);
|
|
24230
|
-
|
|
24378
|
+
|
|
24231
24379
|
}
|
|
24232
24380
|
else {
|
|
24233
|
-
|
|
24234
|
-
newElem.parentElement.insertBefore(outerBRElem, newElem);
|
|
24235
|
-
this.insertFocusContent();
|
|
24381
|
+
this.insertBRElement();
|
|
24236
24382
|
}
|
|
24237
24383
|
}
|
|
24238
24384
|
}
|
|
24239
24385
|
else {
|
|
24240
|
-
|
|
24241
|
-
if (this.startNode.nodeName === 'BR' && this.endNode.nodeName === 'BR' && this.range.startOffset === 0 && this.range.startOffset === this.range.endOffset) {
|
|
24242
|
-
this.parent.formatter.editorManager.domNode.insertAfter(brElm, this.startNode);
|
|
24243
|
-
isEmptyBrInserted = true;
|
|
24244
|
-
}
|
|
24245
|
-
else {
|
|
24246
|
-
if (this.startNode === this.parent.inputElement && !isNullOrUndefined(this.range.startContainer.previousSibling) &&
|
|
24247
|
-
this.range.startContainer.previousSibling.nodeName === 'BR' && this.range.startContainer.textContent.length === 0) {
|
|
24248
|
-
isEmptyBrInserted = true;
|
|
24249
|
-
}
|
|
24250
|
-
this.range.insertNode(brElm);
|
|
24251
|
-
}
|
|
24252
|
-
if (isEmptyBrInserted || (!isNullOrUndefined(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNullOrUndefined(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
|
|
24253
|
-
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), !isNullOrUndefined(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
|
|
24254
|
-
isEmptyBrInserted = false;
|
|
24255
|
-
}
|
|
24256
|
-
else {
|
|
24257
|
-
const brElm2 = this.parent.createElement('br');
|
|
24258
|
-
this.range.insertNode(brElm2);
|
|
24259
|
-
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), brElm, 0);
|
|
24260
|
-
}
|
|
24386
|
+
this.insertBRElement();
|
|
24261
24387
|
}
|
|
24262
24388
|
e.args.preventDefault();
|
|
24263
24389
|
}
|
|
@@ -24267,6 +24393,30 @@ class EnterKeyAction {
|
|
|
24267
24393
|
}
|
|
24268
24394
|
}
|
|
24269
24395
|
}
|
|
24396
|
+
insertBRElement() {
|
|
24397
|
+
let isEmptyBrInserted = false;
|
|
24398
|
+
const brElm = this.parent.createElement('br');
|
|
24399
|
+
if (this.startNode.nodeName === 'BR' && this.endNode.nodeName === 'BR' && this.range.startOffset === 0 && this.range.startOffset === this.range.endOffset) {
|
|
24400
|
+
this.parent.formatter.editorManager.domNode.insertAfter(brElm, this.startNode);
|
|
24401
|
+
isEmptyBrInserted = true;
|
|
24402
|
+
}
|
|
24403
|
+
else {
|
|
24404
|
+
if (this.startNode === this.parent.inputElement && !isNullOrUndefined(this.range.startContainer.previousSibling) &&
|
|
24405
|
+
this.range.startContainer.previousSibling.nodeName === 'BR' && this.range.startContainer.textContent.length === 0) {
|
|
24406
|
+
isEmptyBrInserted = true;
|
|
24407
|
+
}
|
|
24408
|
+
this.range.insertNode(brElm);
|
|
24409
|
+
}
|
|
24410
|
+
if (isEmptyBrInserted || (!isNullOrUndefined(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNullOrUndefined(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
|
|
24411
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), !isNullOrUndefined(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
|
|
24412
|
+
isEmptyBrInserted = false;
|
|
24413
|
+
}
|
|
24414
|
+
else {
|
|
24415
|
+
const brElm2 = this.parent.createElement('br');
|
|
24416
|
+
this.range.insertNode(brElm2);
|
|
24417
|
+
this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), brElm, 0);
|
|
24418
|
+
}
|
|
24419
|
+
}
|
|
24270
24420
|
insertFocusContent() {
|
|
24271
24421
|
if (this.range.startContainer.textContent.length === 0) {
|
|
24272
24422
|
if (this.range.startContainer.nodeName === '#text') {
|
|
@@ -25664,7 +25814,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
25664
25814
|
this.setProperties({ value: this.valueTemplate });
|
|
25665
25815
|
}
|
|
25666
25816
|
else {
|
|
25667
|
-
const compiledTemplate = compile(this.valueTemplate)(
|
|
25817
|
+
const compiledTemplate = compile(this.valueTemplate)("", this, 'valueTemplate');
|
|
25668
25818
|
for (let i = 0; i < compiledTemplate.length; i++) {
|
|
25669
25819
|
const item = compiledTemplate[i];
|
|
25670
25820
|
append([item], this.element);
|
|
@@ -26059,7 +26209,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
26059
26209
|
this.isRTE = false;
|
|
26060
26210
|
}
|
|
26061
26211
|
this.notify(docClick, { args: e });
|
|
26062
|
-
if (e.detail > 3) {
|
|
26212
|
+
if (Browser.info.name !== 'msie' && e.detail > 3) {
|
|
26063
26213
|
e.preventDefault();
|
|
26064
26214
|
}
|
|
26065
26215
|
}
|